diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/partition.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/partition.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..881c5ae0020b18202c6434e1446970edce531648 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/partition.d.ts @@ -0,0 +1,51 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.js"; +import { ValueIteratorTypeGuard } from "../_internal/ValueIteratorTypeGuard.js"; + +//#region src/compat/array/partition.d.ts +/** + * Creates an array of elements split into two groups, the first of which contains elements + * predicate returns truthy for, while the second of which contains elements predicate returns falsey for. + * The predicate is invoked with one argument: (value). + * + * @template T, U + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {(value: T) => value is U} callback - The function invoked per iteration. + * @returns {[U[], Array>]} Returns the array of grouped elements. + * + * @example + * partition([1, 2, 3, 4], n => n % 2 === 0); + * // => [[2, 4], [1, 3]] + */ +declare function partition(collection: ArrayLike | null | undefined, callback: ValueIteratorTypeGuard): [U[], Array>]; +/** + * Creates an array of elements split into two groups, the first of which contains elements + * predicate returns truthy for, while the second of which contains elements predicate returns falsey for. + * The predicate is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {((value: T) => unknown) | PropertyKey | [PropertyKey, any] | Partial} callback - The function invoked per iteration. + * @returns {[T[], T[]]} Returns the array of grouped elements. + * + * @example + * partition([1, 2, 3, 4], n => n % 2 === 0); + * // => [[2, 4], [1, 3]] + */ +declare function partition(collection: ArrayLike | null | undefined, callback: ValueIteratee): [T[], T[]]; +/** + * Creates an array of elements split into two groups, the first of which contains elements + * predicate returns truthy for, while the second of which contains elements predicate returns falsey for. + * The predicate is invoked with one argument: (value). + * + * @template T + * @param {T | null | undefined} collection - The collection to iterate over. + * @param {((value: T[keyof T]) => unknown) | PropertyKey | [PropertyKey, any] | Partial} callback - The function invoked per iteration. + * @returns {[Array, Array]} Returns the array of grouped elements. + * + * @example + * partition({ a: 1, b: 2, c: 3 }, n => n % 2 === 0); + * // => [[2], [1, 3]] + */ +declare function partition(collection: T | null | undefined, callback: ValueIteratee): [Array, Array]; +//#endregion +export { partition }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/partition.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/partition.js new file mode 100644 index 0000000000000000000000000000000000000000..4a2b54a8938fa5a2b62bfe237fb2bcb8bc1e53f1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/partition.js @@ -0,0 +1,42 @@ +const require_identity = require("../../function/identity.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_iteratee = require("../util/iteratee.js"); +//#region src/compat/array/partition.ts +/** +* Creates an array of elements split into two groups, the first of which contains elements +* `predicate` returns truthy for, the second of which contains elements +* `predicate` returns falsy for. The predicate is invoked with one argument: (value). +* +* @template T +* @param {ArrayLike | T | null | undefined} source - The array or object to iterate over. +* @param {((item: T, index: number, arr: any) => unknown) | Partial | [keyof T, unknown] | PropertyKey} [predicate=identity] - The function invoked per iteration. +* @returns {[T[], T[]]} - Returns the array of grouped elements. +* +* @example +* partition([{ a: 1 }, { a: 2 }, { b: 1 }], 'a'); +* // => [[{ a: 1 }, { a: 2 }], [{ b: 1 }]] +* +* partition([{ a: 1 }, { a: 2 }, { b: 1 }], { b: 1 }); +* // => [[{ b: 1 }], [{ a: 1 }, { a: 2 }]] +* +* partition({ item1: { a: 0, b: true }, item2: { a: 1, b: true }, item3: { a: 2, b: false }}, { b: false }) +* // => [[{ a: 2, b: false }], [{ a: 0, b: true }, { a: 1, b: true }]] +* +* partition([{ a: 1 }, { a: 2 }, { a: 3 }], ['a', 2]); +* // => [[{ a: 2 }], [{ a: 1 }, { a: 3 }]] +*/ +function partition(source, predicate = require_identity.identity) { + if (!source) return [[], []]; + const collection = require_isArrayLike.isArrayLike(source) ? source : Object.values(source); + predicate = require_iteratee.iteratee(predicate); + const matched = []; + const unmatched = []; + for (let i = 0; i < collection.length; i++) { + const value = collection[i]; + if (predicate(value)) matched.push(value); + else unmatched.push(value); + } + return [matched, unmatched]; +} +//#endregion +exports.partition = partition; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/partition.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/partition.mjs new file mode 100644 index 0000000000000000000000000000000000000000..8b4ea7d1fd4b3d3287ae321b4436642d3d00c04c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/partition.mjs @@ -0,0 +1,42 @@ +import { identity } from "../../function/identity.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +//#region src/compat/array/partition.ts +/** +* Creates an array of elements split into two groups, the first of which contains elements +* `predicate` returns truthy for, the second of which contains elements +* `predicate` returns falsy for. The predicate is invoked with one argument: (value). +* +* @template T +* @param {ArrayLike | T | null | undefined} source - The array or object to iterate over. +* @param {((item: T, index: number, arr: any) => unknown) | Partial | [keyof T, unknown] | PropertyKey} [predicate=identity] - The function invoked per iteration. +* @returns {[T[], T[]]} - Returns the array of grouped elements. +* +* @example +* partition([{ a: 1 }, { a: 2 }, { b: 1 }], 'a'); +* // => [[{ a: 1 }, { a: 2 }], [{ b: 1 }]] +* +* partition([{ a: 1 }, { a: 2 }, { b: 1 }], { b: 1 }); +* // => [[{ b: 1 }], [{ a: 1 }, { a: 2 }]] +* +* partition({ item1: { a: 0, b: true }, item2: { a: 1, b: true }, item3: { a: 2, b: false }}, { b: false }) +* // => [[{ a: 2, b: false }], [{ a: 0, b: true }, { a: 1, b: true }]] +* +* partition([{ a: 1 }, { a: 2 }, { a: 3 }], ['a', 2]); +* // => [[{ a: 2 }], [{ a: 1 }, { a: 3 }]] +*/ +function partition(source, predicate = identity) { + if (!source) return [[], []]; + const collection = isArrayLike(source) ? source : Object.values(source); + predicate = iteratee(predicate); + const matched = []; + const unmatched = []; + for (let i = 0; i < collection.length; i++) { + const value = collection[i]; + if (predicate(value)) matched.push(value); + else unmatched.push(value); + } + return [matched, unmatched]; +} +//#endregion +export { partition }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/pull.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/pull.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..01ffb5c0a4111ed4c2688ccd7c7963e13bdda1c7 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/pull.d.mts @@ -0,0 +1,39 @@ +//#region src/compat/array/pull.d.ts +/** + * Removes all provided values from array using SameValueZero for equality comparisons. + * + * **Note:** Unlike `_.without`, this method mutates `array`. + * + * @template T + * @param {T[]} array - The array to modify. + * @param {...T[]} values - The values to remove. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [1, 2, 3, 1, 2, 3]; + * + * pull(array, 2, 3); + * console.log(array); + * // => [1, 1] + */ +declare function pull(array: T[], ...values: T[]): T[]; +/** + * Removes all provided values from array using SameValueZero for equality comparisons. + * + * **Note:** Unlike `_.without`, this method mutates `array`. + * + * @template L + * @param {L} array - The array to modify. + * @param {...L[0][]} values - The values to remove. + * @returns {L} Returns `array`. + * + * @example + * var array = [1, 2, 3, 1, 2, 3]; + * + * pull(array, 2, 3); + * console.log(array); + * // => [1, 1] + */ +declare function pull>(array: L extends readonly any[] ? never : L, ...values: Array): L; +//#endregion +export { pull }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/pull.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/pull.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..01ffb5c0a4111ed4c2688ccd7c7963e13bdda1c7 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/pull.d.ts @@ -0,0 +1,39 @@ +//#region src/compat/array/pull.d.ts +/** + * Removes all provided values from array using SameValueZero for equality comparisons. + * + * **Note:** Unlike `_.without`, this method mutates `array`. + * + * @template T + * @param {T[]} array - The array to modify. + * @param {...T[]} values - The values to remove. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [1, 2, 3, 1, 2, 3]; + * + * pull(array, 2, 3); + * console.log(array); + * // => [1, 1] + */ +declare function pull(array: T[], ...values: T[]): T[]; +/** + * Removes all provided values from array using SameValueZero for equality comparisons. + * + * **Note:** Unlike `_.without`, this method mutates `array`. + * + * @template L + * @param {L} array - The array to modify. + * @param {...L[0][]} values - The values to remove. + * @returns {L} Returns `array`. + * + * @example + * var array = [1, 2, 3, 1, 2, 3]; + * + * pull(array, 2, 3); + * console.log(array); + * // => [1, 1] + */ +declare function pull>(array: L extends readonly any[] ? never : L, ...values: Array): L; +//#endregion +export { pull }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/pull.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/pull.js new file mode 100644 index 0000000000000000000000000000000000000000..23ecfe9289f64d36496028b572ee8f5e6efebfa3 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/pull.js @@ -0,0 +1,23 @@ +const require_pull = require("../../array/pull.js"); +//#region src/compat/array/pull.ts +/** +* Removes all specified values from an array. +* +* This function changes `arr` in place. +* If you want to remove values without modifying the original array, use `difference`. +* +* @template T, U +* @param {T[]} arr - The array to modify. +* @param {...unknown[]} valuesToRemove - The values to remove from the array. +* @returns {T[]} The modified array with the specified values removed. +* +* @example +* const numbers = [1, 2, 3, 4, 5, 2, 4]; +* pull(numbers, [2, 4]); +* console.log(numbers); // [1, 3, 5] +*/ +function pull(arr, ...valuesToRemove) { + return require_pull.pull(arr, valuesToRemove); +} +//#endregion +exports.pull = pull; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/pull.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/pull.mjs new file mode 100644 index 0000000000000000000000000000000000000000..773cefe562cafcaed6e171f92e18bf25b7692568 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/pull.mjs @@ -0,0 +1,23 @@ +import { pull as pull$1 } from "../../array/pull.mjs"; +//#region src/compat/array/pull.ts +/** +* Removes all specified values from an array. +* +* This function changes `arr` in place. +* If you want to remove values without modifying the original array, use `difference`. +* +* @template T, U +* @param {T[]} arr - The array to modify. +* @param {...unknown[]} valuesToRemove - The values to remove from the array. +* @returns {T[]} The modified array with the specified values removed. +* +* @example +* const numbers = [1, 2, 3, 4, 5, 2, 4]; +* pull(numbers, [2, 4]); +* console.log(numbers); // [1, 3, 5] +*/ +function pull(arr, ...valuesToRemove) { + return pull$1(arr, valuesToRemove); +} +//#endregion +export { pull }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAll.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAll.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b16aa9d0d055930528ba59f4d17d9165606f67f6 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAll.d.mts @@ -0,0 +1,42 @@ +import { MutableList } from "../_internal/MutableList.mjs"; +import { RejectReadonly } from "../_internal/RejectReadonly.mjs"; + +//#region src/compat/array/pullAll.d.ts +/** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @template T + * @param {T[]} array - The array to modify. + * @param {ArrayLike} [values] - The values to remove. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [1, 2, 3, 1, 2, 3]; + * + * pullAll(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ +declare function pullAll(array: T[], values?: ArrayLike): T[]; +/** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @template L + * @param {RejectReadonly} array - The array to modify. + * @param {List} [values] - The values to remove. + * @returns {L} Returns `array`. + * + * @example + * var array = [1, 2, 3, 1, 2, 3]; + * + * pullAll(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ +declare function pullAll>(array: RejectReadonly, values?: ArrayLike): L; +//#endregion +export { pullAll }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAll.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAll.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fbfcda04b09dd4392852a7f3a9adfc8f66e70403 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAll.d.ts @@ -0,0 +1,42 @@ +import { MutableList } from "../_internal/MutableList.js"; +import { RejectReadonly } from "../_internal/RejectReadonly.js"; + +//#region src/compat/array/pullAll.d.ts +/** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @template T + * @param {T[]} array - The array to modify. + * @param {ArrayLike} [values] - The values to remove. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [1, 2, 3, 1, 2, 3]; + * + * pullAll(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ +declare function pullAll(array: T[], values?: ArrayLike): T[]; +/** + * This method is like `_.pull` except that it accepts an array of values to remove. + * + * **Note:** Unlike `_.difference`, this method mutates `array`. + * + * @template L + * @param {RejectReadonly} array - The array to modify. + * @param {List} [values] - The values to remove. + * @returns {L} Returns `array`. + * + * @example + * var array = [1, 2, 3, 1, 2, 3]; + * + * pullAll(array, [2, 3]); + * console.log(array); + * // => [1, 1] + */ +declare function pullAll>(array: RejectReadonly, values?: ArrayLike): L; +//#endregion +export { pullAll }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAll.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAll.js new file mode 100644 index 0000000000000000000000000000000000000000..63bdf534e23738b86bf14f525c82e30ff0bf35cf --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAll.js @@ -0,0 +1,23 @@ +const require_pull = require("../../array/pull.js"); +//#region src/compat/array/pullAll.ts +/** +* Removes all specified values from an array. +* +* This function changes `arr` in place. +* If you want to remove values without modifying the original array, use `difference`. +* +* @template T +* @param {T[]} arr - The array to modify. +* @param {ArrayLike} valuesToRemove - The values to remove from the array. +* @returns {T[]} The modified array with the specified values removed. +* +* @example +* const numbers = [1, 2, 3, 4, 5, 2, 4]; +* pullAll(numbers, [2, 4]); +* console.log(numbers); // [1, 3, 5] +*/ +function pullAll(arr, valuesToRemove = []) { + return require_pull.pull(arr, Array.from(valuesToRemove)); +} +//#endregion +exports.pullAll = pullAll; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAll.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAll.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ae898ae4eb0a0e2fb3feac7fc6b1f2ededd9c454 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAll.mjs @@ -0,0 +1,23 @@ +import { pull } from "../../array/pull.mjs"; +//#region src/compat/array/pullAll.ts +/** +* Removes all specified values from an array. +* +* This function changes `arr` in place. +* If you want to remove values without modifying the original array, use `difference`. +* +* @template T +* @param {T[]} arr - The array to modify. +* @param {ArrayLike} valuesToRemove - The values to remove from the array. +* @returns {T[]} The modified array with the specified values removed. +* +* @example +* const numbers = [1, 2, 3, 4, 5, 2, 4]; +* pullAll(numbers, [2, 4]); +* console.log(numbers); // [1, 3, 5] +*/ +function pullAll(arr, valuesToRemove = []) { + return pull(arr, Array.from(valuesToRemove)); +} +//#endregion +export { pullAll }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllBy.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..fd2e0c41419df6280309b3fd42f5e1176e0fe707 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllBy.d.mts @@ -0,0 +1,87 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.mjs"; +import { MutableList } from "../_internal/MutableList.mjs"; +import { RejectReadonly } from "../_internal/RejectReadonly.mjs"; + +//#region src/compat/array/pullAllBy.d.ts +/** + * Removes all specified values from an array using an iteratee function. + * + * This function changes `arr` in place. + * If you want to remove values without modifying the original array, use `differenceBy`. + * + * @template T + * @param {T[]} array - The array to modify. + * @param {ArrayLike} [values] - The values to remove. + * @param {((value: T) => unknown) | PropertyKey | [PropertyKey, any] | Partial} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ +declare function pullAllBy(array: T[], values?: ArrayLike, iteratee?: ValueIteratee): T[]; +/** + * Removes all specified values from an array using an iteratee function. + * + * This function changes `arr` in place. + * If you want to remove values without modifying the original array, use `differenceBy`. + * + * @template L + * @param {RejectReadonly} array - The array to modify. + * @param {ArrayLike} [values] - The values to remove. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {L} Returns `array`. + * + * @example + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ +declare function pullAllBy>(array: RejectReadonly, values?: ArrayLike, iteratee?: ValueIteratee): L; +/** + * Removes all specified values from an array using an iteratee function. + * + * This function changes `arr` in place. + * If you want to remove values without modifying the original array, use `differenceBy`. + * + * @template T, U + * @param {T[]} array - The array to modify. + * @param {ArrayLike} values - The values to remove. + * @param {((value: T | U) => unknown) | PropertyKey | [PropertyKey, any] | Partial} iteratee - The iteratee invoked per element. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ +declare function pullAllBy(array: T[], values: ArrayLike, iteratee: ValueIteratee): T[]; +/** + * Removes all specified values from an array using an iteratee function. + * + * This function changes `arr` in place. + * If you want to remove values without modifying the original array, use `differenceBy`. + * + * @template L, U + * @param {L} array - The array to modify. + * @param {ArrayLike} values - The values to remove. + * @param {((value: L[0] | U) => unknown) | PropertyKey | [PropertyKey, any] | Partial} iteratee - The iteratee invoked per element. + * @returns {L} Returns `array`. + * + * @example + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ +declare function pullAllBy, U>(array: L extends readonly any[] ? never : L, values: ArrayLike, iteratee: ValueIteratee): L; +//#endregion +export { pullAllBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllBy.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f62e0ccf4d413fd490604067e7f38538cf777e3b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllBy.d.ts @@ -0,0 +1,87 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.js"; +import { MutableList } from "../_internal/MutableList.js"; +import { RejectReadonly } from "../_internal/RejectReadonly.js"; + +//#region src/compat/array/pullAllBy.d.ts +/** + * Removes all specified values from an array using an iteratee function. + * + * This function changes `arr` in place. + * If you want to remove values without modifying the original array, use `differenceBy`. + * + * @template T + * @param {T[]} array - The array to modify. + * @param {ArrayLike} [values] - The values to remove. + * @param {((value: T) => unknown) | PropertyKey | [PropertyKey, any] | Partial} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ +declare function pullAllBy(array: T[], values?: ArrayLike, iteratee?: ValueIteratee): T[]; +/** + * Removes all specified values from an array using an iteratee function. + * + * This function changes `arr` in place. + * If you want to remove values without modifying the original array, use `differenceBy`. + * + * @template L + * @param {RejectReadonly} array - The array to modify. + * @param {ArrayLike} [values] - The values to remove. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {L} Returns `array`. + * + * @example + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ +declare function pullAllBy>(array: RejectReadonly, values?: ArrayLike, iteratee?: ValueIteratee): L; +/** + * Removes all specified values from an array using an iteratee function. + * + * This function changes `arr` in place. + * If you want to remove values without modifying the original array, use `differenceBy`. + * + * @template T, U + * @param {T[]} array - The array to modify. + * @param {ArrayLike} values - The values to remove. + * @param {((value: T | U) => unknown) | PropertyKey | [PropertyKey, any] | Partial} iteratee - The iteratee invoked per element. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ +declare function pullAllBy(array: T[], values: ArrayLike, iteratee: ValueIteratee): T[]; +/** + * Removes all specified values from an array using an iteratee function. + * + * This function changes `arr` in place. + * If you want to remove values without modifying the original array, use `differenceBy`. + * + * @template L, U + * @param {L} array - The array to modify. + * @param {ArrayLike} values - The values to remove. + * @param {((value: L[0] | U) => unknown) | PropertyKey | [PropertyKey, any] | Partial} iteratee - The iteratee invoked per element. + * @returns {L} Returns `array`. + * + * @example + * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; + * + * pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); + * console.log(array); + * // => [{ 'x': 2 }] + */ +declare function pullAllBy, U>(array: L extends readonly any[] ? never : L, values: ArrayLike, iteratee: ValueIteratee): L; +//#endregion +export { pullAllBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllBy.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllBy.js new file mode 100644 index 0000000000000000000000000000000000000000..cb8446fe2e245b2d99ebe889a9c33a090381732e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllBy.js @@ -0,0 +1,43 @@ +const require_iteratee = require("../util/iteratee.js"); +//#region src/compat/array/pullAllBy.ts +/** +* Removes all specified values from an array using an iteratee function. +* +* This function changes `arr` in place. +* If you want to remove values without modifying the original array, use `differenceBy`. +* +* @template T +* @param {T[]} arr - The array to modify. +* @param {ArrayLike} valuesToRemove - The values to remove from the array. +* @param {keyof T} getValue - The key of the property to match against each element. +* @returns {T[]} The modified array with the specified values removed. +* +* @example +* // Using a iteratee function +* const items = [{ value: 1 }, { value: 2 }, { value: 3 }, { value: 1 }]; +* const result = pullAllBy(items, [{ value: 1 }, { value: 3 }], obj => obj.value); +* console.log(result); // [{ value: 2 }] +* +* // Using a property name +* const items = [{ value: 1 }, { value: 2 }, { value: 3 }, { value: 1 }]; +* const result = pullAllBy(items, [{ value: 1 }, { value: 3 }], 'value'); +* console.log(result); // [{ value: 2 }] +*/ +function pullAllBy(arr, valuesToRemove, _getValue) { + const getValue = require_iteratee.iteratee(_getValue); + const valuesSet = new Set(Array.from(valuesToRemove).map((x) => getValue(x))); + let resultIndex = 0; + for (let i = 0; i < arr.length; i++) { + const value = getValue(arr[i]); + if (valuesSet.has(value)) continue; + if (!Object.hasOwn(arr, i)) { + delete arr[resultIndex++]; + continue; + } + arr[resultIndex++] = arr[i]; + } + arr.length = resultIndex; + return arr; +} +//#endregion +exports.pullAllBy = pullAllBy; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllBy.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e2c11fd2cee7b720f328dee332a85ded4245584e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllBy.mjs @@ -0,0 +1,43 @@ +import { iteratee } from "../util/iteratee.mjs"; +//#region src/compat/array/pullAllBy.ts +/** +* Removes all specified values from an array using an iteratee function. +* +* This function changes `arr` in place. +* If you want to remove values without modifying the original array, use `differenceBy`. +* +* @template T +* @param {T[]} arr - The array to modify. +* @param {ArrayLike} valuesToRemove - The values to remove from the array. +* @param {keyof T} getValue - The key of the property to match against each element. +* @returns {T[]} The modified array with the specified values removed. +* +* @example +* // Using a iteratee function +* const items = [{ value: 1 }, { value: 2 }, { value: 3 }, { value: 1 }]; +* const result = pullAllBy(items, [{ value: 1 }, { value: 3 }], obj => obj.value); +* console.log(result); // [{ value: 2 }] +* +* // Using a property name +* const items = [{ value: 1 }, { value: 2 }, { value: 3 }, { value: 1 }]; +* const result = pullAllBy(items, [{ value: 1 }, { value: 3 }], 'value'); +* console.log(result); // [{ value: 2 }] +*/ +function pullAllBy(arr, valuesToRemove, _getValue) { + const getValue = iteratee(_getValue); + const valuesSet = new Set(Array.from(valuesToRemove).map((x) => getValue(x))); + let resultIndex = 0; + for (let i = 0; i < arr.length; i++) { + const value = getValue(arr[i]); + if (valuesSet.has(value)) continue; + if (!Object.hasOwn(arr, i)) { + delete arr[resultIndex++]; + continue; + } + arr[resultIndex++] = arr[i]; + } + arr.length = resultIndex; + return arr; +} +//#endregion +export { pullAllBy }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllWith.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..bb79eb5e8c80cba84f1013a4e06211be10077b1f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllWith.d.mts @@ -0,0 +1,90 @@ +import { MutableList } from "../_internal/MutableList.mjs"; +import { RejectReadonly } from "../_internal/RejectReadonly.mjs"; + +//#region src/compat/array/pullAllWith.d.ts +/** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @template T + * @param {T[]} array - The array to modify. + * @param {ArrayLike} [values] - The values to remove. + * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ +declare function pullAllWith(array: T[], values?: ArrayLike, comparator?: (a: T, b: T) => boolean): T[]; +/** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @template L + * @param {RejectReadonly} array - The array to modify. + * @param {List} [values] - The values to remove. + * @param {Comparator} [comparator] - The comparator invoked per element. + * @returns {L} Returns `array`. + * + * @example + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ +declare function pullAllWith>(array: RejectReadonly, values?: ArrayLike, comparator?: (a: L[0], b: L[0]) => boolean): L; +/** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @template T, U + * @param {T[]} array - The array to modify. + * @param {ArrayLike} values - The values to remove. + * @param {(a: T, b: U) => boolean} comparator - The comparator invoked per element. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ +declare function pullAllWith(array: T[], values: ArrayLike, comparator: (a: T, b: U) => boolean): T[]; +/** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @template L1, L2 + * @param {RejectReadonly} array - The array to modify. + * @param {List} values - The values to remove. + * @param {Comparator2} comparator - The comparator invoked per element. + * @returns {L1} Returns `array`. + * + * @example + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ +declare function pullAllWith, L2>(array: RejectReadonly, values: ArrayLike, comparator: (a: L1[0], b: L2) => boolean): L1; +//#endregion +export { pullAllWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllWith.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..089e023eb773a94efc836740acb76b9c6d9aac32 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllWith.d.ts @@ -0,0 +1,90 @@ +import { MutableList } from "../_internal/MutableList.js"; +import { RejectReadonly } from "../_internal/RejectReadonly.js"; + +//#region src/compat/array/pullAllWith.d.ts +/** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @template T + * @param {T[]} array - The array to modify. + * @param {ArrayLike} [values] - The values to remove. + * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ +declare function pullAllWith(array: T[], values?: ArrayLike, comparator?: (a: T, b: T) => boolean): T[]; +/** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @template L + * @param {RejectReadonly} array - The array to modify. + * @param {List} [values] - The values to remove. + * @param {Comparator} [comparator] - The comparator invoked per element. + * @returns {L} Returns `array`. + * + * @example + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ +declare function pullAllWith>(array: RejectReadonly, values?: ArrayLike, comparator?: (a: L[0], b: L[0]) => boolean): L; +/** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @template T, U + * @param {T[]} array - The array to modify. + * @param {ArrayLike} values - The values to remove. + * @param {(a: T, b: U) => boolean} comparator - The comparator invoked per element. + * @returns {T[]} Returns `array`. + * + * @example + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ +declare function pullAllWith(array: T[], values: ArrayLike, comparator: (a: T, b: U) => boolean): T[]; +/** + * This method is like `_.pullAll` except that it accepts `comparator` which is + * invoked to compare elements of array to values. The comparator is invoked with + * two arguments: (arrVal, othVal). + * + * **Note:** Unlike `_.differenceWith`, this method mutates `array`. + * + * @template L1, L2 + * @param {RejectReadonly} array - The array to modify. + * @param {List} values - The values to remove. + * @param {Comparator2} comparator - The comparator invoked per element. + * @returns {L1} Returns `array`. + * + * @example + * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; + * + * pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); + * console.log(array); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] + */ +declare function pullAllWith, L2>(array: RejectReadonly, values: ArrayLike, comparator: (a: L1[0], b: L2) => boolean): L1; +//#endregion +export { pullAllWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllWith.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllWith.js new file mode 100644 index 0000000000000000000000000000000000000000..9e0b638400d3817a5e02f6e2cd24dfbfb2bb1279 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllWith.js @@ -0,0 +1,44 @@ +const require_isEqualsSameValueZero = require("../../_internal/isEqualsSameValueZero.js"); +require("../util/eq.js"); +const require_copyArray = require("../_internal/copyArray.js"); +//#region src/compat/array/pullAllWith.ts +/** +* Removes and returns elements from an array using a provided comparison function to determine which elements to remove. +* +* @template T +* @param {T[] | ArrayLike} array - The array to modify. +* @param {T[] | ArrayLike} values - The values to remove from the array. +* @param {(a: T, b: T) => boolean} comparator - The function to compare elements of `array` with elements of `values`. Should return `true` if the two elements are considered equal. +* @returns {T[] | ArrayLike} - The array with specified values removed. +* +* @example +* import pullAllWith from './pullAllWith'; +* import isEqual from '../predicate'; +* +* const array = [{ x: 1, y: 2 }, { x: 3, y: 4 }, { x: 5, y: 6 }]; +* const valuesToRemove = [{ x: 3, y: 4 }]; +* +* const result = pullAllWith(array, valuesToRemove, isEqual); +* +* console.log(result); // [{ x: 1, y: 2 }, { x: 5, y: 6 }] +* console.log(array); // [{ x: 1, y: 2 }, { x: 5, y: 6 }] +*/ +function pullAllWith(array, values, comparator) { + if (array?.length == null || values?.length == null) return array; + if (array === values) values = require_copyArray.default(values); + let resultLength = 0; + if (comparator == null) comparator = (a, b) => require_isEqualsSameValueZero.isEqualsSameValueZero(a, b); + const valuesArray = Array.isArray(values) ? values : Array.from(values); + const hasUndefined = valuesArray.includes(void 0); + for (let i = 0; i < array.length; i++) { + if (i in array) { + if (!valuesArray.some((value) => comparator(array[i], value))) array[resultLength++] = array[i]; + continue; + } + if (!hasUndefined) delete array[resultLength++]; + } + array.length = resultLength; + return array; +} +//#endregion +exports.pullAllWith = pullAllWith; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllWith.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..58503012cde2533252169459a8ed8e3b1450816d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAllWith.mjs @@ -0,0 +1,44 @@ +import { isEqualsSameValueZero } from "../../_internal/isEqualsSameValueZero.mjs"; +import "../util/eq.mjs"; +import copyArray from "../_internal/copyArray.mjs"; +//#region src/compat/array/pullAllWith.ts +/** +* Removes and returns elements from an array using a provided comparison function to determine which elements to remove. +* +* @template T +* @param {T[] | ArrayLike} array - The array to modify. +* @param {T[] | ArrayLike} values - The values to remove from the array. +* @param {(a: T, b: T) => boolean} comparator - The function to compare elements of `array` with elements of `values`. Should return `true` if the two elements are considered equal. +* @returns {T[] | ArrayLike} - The array with specified values removed. +* +* @example +* import pullAllWith from './pullAllWith'; +* import isEqual from '../predicate'; +* +* const array = [{ x: 1, y: 2 }, { x: 3, y: 4 }, { x: 5, y: 6 }]; +* const valuesToRemove = [{ x: 3, y: 4 }]; +* +* const result = pullAllWith(array, valuesToRemove, isEqual); +* +* console.log(result); // [{ x: 1, y: 2 }, { x: 5, y: 6 }] +* console.log(array); // [{ x: 1, y: 2 }, { x: 5, y: 6 }] +*/ +function pullAllWith(array, values, comparator) { + if (array?.length == null || values?.length == null) return array; + if (array === values) values = copyArray(values); + let resultLength = 0; + if (comparator == null) comparator = (a, b) => isEqualsSameValueZero(a, b); + const valuesArray = Array.isArray(values) ? values : Array.from(values); + const hasUndefined = valuesArray.includes(void 0); + for (let i = 0; i < array.length; i++) { + if (i in array) { + if (!valuesArray.some((value) => comparator(array[i], value))) array[resultLength++] = array[i]; + continue; + } + if (!hasUndefined) delete array[resultLength++]; + } + array.length = resultLength; + return array; +} +//#endregion +export { pullAllWith }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAt.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAt.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..7793c0b1cc2fabe128368d6f61c5424dfbdb18e2 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAt.d.mts @@ -0,0 +1,51 @@ +import { MutableList } from "../_internal/MutableList.mjs"; +import { RejectReadonly } from "../_internal/RejectReadonly.mjs"; +import { Many } from "../_internal/Many.mjs"; + +//#region src/compat/array/pullAt.d.ts +/** + * Removes elements from array corresponding to the given indexes and returns an array of the removed elements. + * Indexes may be specified as an array of indexes or as individual arguments. + * + * **Note:** Unlike `_.at`, this method mutates `array`. + * + * @template T + * @param {T[]} array - The array to modify. + * @param {...Array} indexes - The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @returns {T[]} Returns the new array of removed elements. + * + * @example + * var array = [5, 10, 15, 20]; + * var evens = pullAt(array, 1, 3); + * + * console.log(array); + * // => [5, 15] + * + * console.log(evens); + * // => [10, 20] + */ +declare function pullAt(array: T[], ...indexes: Array>): T[]; +/** + * Removes elements from array corresponding to the given indexes and returns an array of the removed elements. + * Indexes may be specified as an array of indexes or as individual arguments. + * + * **Note:** Unlike `_.at`, this method mutates `array`. + * + * @template L + * @param {L} array - The array to modify. + * @param {...Array} indexes - The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @returns {L} Returns the new array of removed elements. + * + * @example + * var array = [5, 10, 15, 20]; + * var evens = pullAt(array, 1, 3); + * + * console.log(array); + * // => [5, 15] + * + * console.log(evens); + * // => [10, 20] + */ +declare function pullAt>(array: RejectReadonly, ...indexes: Array>): L; +//#endregion +export { pullAt }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAt.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAt.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..545a6e91e6cd5185eef630254216fe7d612cdfdb --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAt.d.ts @@ -0,0 +1,51 @@ +import { MutableList } from "../_internal/MutableList.js"; +import { RejectReadonly } from "../_internal/RejectReadonly.js"; +import { Many } from "../_internal/Many.js"; + +//#region src/compat/array/pullAt.d.ts +/** + * Removes elements from array corresponding to the given indexes and returns an array of the removed elements. + * Indexes may be specified as an array of indexes or as individual arguments. + * + * **Note:** Unlike `_.at`, this method mutates `array`. + * + * @template T + * @param {T[]} array - The array to modify. + * @param {...Array} indexes - The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @returns {T[]} Returns the new array of removed elements. + * + * @example + * var array = [5, 10, 15, 20]; + * var evens = pullAt(array, 1, 3); + * + * console.log(array); + * // => [5, 15] + * + * console.log(evens); + * // => [10, 20] + */ +declare function pullAt(array: T[], ...indexes: Array>): T[]; +/** + * Removes elements from array corresponding to the given indexes and returns an array of the removed elements. + * Indexes may be specified as an array of indexes or as individual arguments. + * + * **Note:** Unlike `_.at`, this method mutates `array`. + * + * @template L + * @param {L} array - The array to modify. + * @param {...Array} indexes - The indexes of elements to remove, specified as individual indexes or arrays of indexes. + * @returns {L} Returns the new array of removed elements. + * + * @example + * var array = [5, 10, 15, 20]; + * var evens = pullAt(array, 1, 3); + * + * console.log(array); + * // => [5, 15] + * + * console.log(evens); + * // => [10, 20] + */ +declare function pullAt>(array: RejectReadonly, ...indexes: Array>): L; +//#endregion +export { pullAt }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAt.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAt.js new file mode 100644 index 0000000000000000000000000000000000000000..c5c411e43012322c042a9b91f75b30df41d1ddbc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAt.js @@ -0,0 +1,44 @@ +const require_isArray = require("../predicate/isArray.js"); +const require_toKey = require("../_internal/toKey.js"); +const require_toPath = require("../util/toPath.js"); +const require_isIndex = require("../_internal/isIndex.js"); +const require_flattenDepth = require("./flattenDepth.js"); +const require_isKey = require("../_internal/isKey.js"); +const require_at = require("../object/at.js"); +const require_unset = require("../object/unset.js"); +//#region src/compat/array/pullAt.ts +/** +* Removes elements from an array at specified indices and returns the removed elements. +* +* @template T +* @param {ArrayLike} array - The array from which elements will be removed. +* @param {Array} _indices - An array of indices specifying the positions of elements to remove. +* @returns {ArrayLike} An array containing the elements that were removed from the original array. +* +* @example +* const numbers = [10, 20, 30, 40, 50]; +* const removed = pullAt(numbers, [1, 3, 4]); +* console.log(removed); // [20, 40, 50] +* console.log(numbers); // [10, 30] +*/ +function pullAt(array, ..._indices) { + const indices = require_flattenDepth.flattenDepth(_indices, 1); + if (!array) return Array(indices.length); + const result = require_at.at(array, indices); + const indicesToPull = indices.map((index) => require_isIndex.isIndex(index, array.length) ? Number(index) : index).sort((a, b) => b - a); + for (const index of new Set(indicesToPull)) { + if (require_isIndex.isIndex(index, array.length)) { + Array.prototype.splice.call(array, index, 1); + continue; + } + if (require_isKey.isKey(index, array)) { + delete array[require_toKey.toKey(index)]; + continue; + } + const path = require_isArray.isArray(index) ? index : require_toPath.toPath(index); + require_unset.unset(array, path); + } + return result; +} +//#endregion +exports.pullAt = pullAt; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAt.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAt.mjs new file mode 100644 index 0000000000000000000000000000000000000000..78a84d96362e2c83a91625325937c6f1fa42205a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/pullAt.mjs @@ -0,0 +1,43 @@ +import { isArray } from "../predicate/isArray.mjs"; +import { toKey } from "../_internal/toKey.mjs"; +import { toPath } from "../util/toPath.mjs"; +import { isIndex } from "../_internal/isIndex.mjs"; +import { flattenDepth } from "./flattenDepth.mjs"; +import { isKey } from "../_internal/isKey.mjs"; +import { at } from "../object/at.mjs"; +import { unset } from "../object/unset.mjs"; +//#region src/compat/array/pullAt.ts +/** +* Removes elements from an array at specified indices and returns the removed elements. +* +* @template T +* @param {ArrayLike} array - The array from which elements will be removed. +* @param {Array} _indices - An array of indices specifying the positions of elements to remove. +* @returns {ArrayLike} An array containing the elements that were removed from the original array. +* +* @example +* const numbers = [10, 20, 30, 40, 50]; +* const removed = pullAt(numbers, [1, 3, 4]); +* console.log(removed); // [20, 40, 50] +* console.log(numbers); // [10, 30] +*/ +function pullAt(array, ..._indices) { + const indices = flattenDepth(_indices, 1); + if (!array) return Array(indices.length); + const result = at(array, indices); + const indicesToPull = indices.map((index) => isIndex(index, array.length) ? Number(index) : index).sort((a, b) => b - a); + for (const index of new Set(indicesToPull)) { + if (isIndex(index, array.length)) { + Array.prototype.splice.call(array, index, 1); + continue; + } + if (isKey(index, array)) { + delete array[toKey(index)]; + continue; + } + unset(array, isArray(index) ? index : toPath(index)); + } + return result; +} +//#endregion +export { pullAt }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/reduce.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/reduce.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..753912912024d71c6bda140c2f53629b8b82c347 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/reduce.d.mts @@ -0,0 +1,81 @@ +import { MemoListIterator } from "../_internal/MemoListIterator.mjs"; +import { MemoObjectIterator } from "../_internal/MemoObjectIterator.mjs"; + +//#region src/compat/array/reduce.d.ts +/** + * Reduces an array to a single value using an iteratee function. + * + * @param {T[] | null | undefined} collection - The array to iterate over + * @param {MemoListIterator} callback - The function invoked per iteration + * @param {U} accumulator - The initial value + * @returns {U} Returns the accumulated value + * + * @example + * const array = [1, 2, 3]; + * reduce(array, (acc, value) => acc + value, 0); // => 6 + */ +declare function reduce(collection: T[] | null | undefined, callback: MemoListIterator, accumulator: U): U; +/** + * Reduces an array-like object to a single value using an iteratee function. + * + * @param {ArrayLike | null | undefined} collection - The array-like object to iterate over + * @param {MemoListIterator>} callback - The function invoked per iteration + * @param {U} accumulator - The initial value + * @returns {U} Returns the accumulated value + * + * @example + * const arrayLike = {0: 1, 1: 2, 2: 3, length: 3}; + * reduce(arrayLike, (acc, value) => acc + value, 0); // => 6 + */ +declare function reduce(collection: ArrayLike | null | undefined, callback: MemoListIterator>, accumulator: U): U; +/** + * Reduces an object to a single value using an iteratee function. + * + * @param {T | null | undefined} collection - The object to iterate over + * @param {MemoObjectIterator} callback - The function invoked per iteration + * @param {U} accumulator - The initial value + * @returns {U} Returns the accumulated value + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * reduce(obj, (acc, value) => acc + value, 0); // => 6 + */ +declare function reduce(collection: T | null | undefined, callback: MemoObjectIterator, accumulator: U): U; +/** + * Reduces an array to a single value using an iteratee function. + * + * @param {T[] | null | undefined} collection - The array to iterate over + * @param {MemoListIterator} callback - The function invoked per iteration + * @returns {T | undefined} Returns the accumulated value + * + * @example + * const array = [1, 2, 3]; + * reduce(array, (acc, value) => acc + value); // => 6 + */ +declare function reduce(collection: T[] | null | undefined, callback: MemoListIterator): T | undefined; +/** + * Reduces an array-like object to a single value using an iteratee function. + * + * @param {ArrayLike | null | undefined} collection - The array-like object to iterate over + * @param {MemoListIterator>} callback - The function invoked per iteration + * @returns {T | undefined} Returns the accumulated value + * + * @example + * const arrayLike = {0: 1, 1: 2, 2: 3, length: 3}; + * reduce(arrayLike, (acc, value) => acc + value); // => 6 + */ +declare function reduce(collection: ArrayLike | null | undefined, callback: MemoListIterator>): T | undefined; +/** + * Reduces an object to a single value using an iteratee function. + * + * @param {T | null | undefined} collection - The object to iterate over + * @param {MemoObjectIterator} callback - The function invoked per iteration + * @returns {T[keyof T] | undefined} Returns the accumulated value + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * reduce(obj, (acc, value) => acc + value); // => 6 + */ +declare function reduce(collection: T | null | undefined, callback: MemoObjectIterator): T[keyof T] | undefined; +//#endregion +export { reduce }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/reduce.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/reduce.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0c216ff3414cb8c819eb6bdff8e3fd5c1f784481 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/reduce.d.ts @@ -0,0 +1,81 @@ +import { MemoListIterator } from "../_internal/MemoListIterator.js"; +import { MemoObjectIterator } from "../_internal/MemoObjectIterator.js"; + +//#region src/compat/array/reduce.d.ts +/** + * Reduces an array to a single value using an iteratee function. + * + * @param {T[] | null | undefined} collection - The array to iterate over + * @param {MemoListIterator} callback - The function invoked per iteration + * @param {U} accumulator - The initial value + * @returns {U} Returns the accumulated value + * + * @example + * const array = [1, 2, 3]; + * reduce(array, (acc, value) => acc + value, 0); // => 6 + */ +declare function reduce(collection: T[] | null | undefined, callback: MemoListIterator, accumulator: U): U; +/** + * Reduces an array-like object to a single value using an iteratee function. + * + * @param {ArrayLike | null | undefined} collection - The array-like object to iterate over + * @param {MemoListIterator>} callback - The function invoked per iteration + * @param {U} accumulator - The initial value + * @returns {U} Returns the accumulated value + * + * @example + * const arrayLike = {0: 1, 1: 2, 2: 3, length: 3}; + * reduce(arrayLike, (acc, value) => acc + value, 0); // => 6 + */ +declare function reduce(collection: ArrayLike | null | undefined, callback: MemoListIterator>, accumulator: U): U; +/** + * Reduces an object to a single value using an iteratee function. + * + * @param {T | null | undefined} collection - The object to iterate over + * @param {MemoObjectIterator} callback - The function invoked per iteration + * @param {U} accumulator - The initial value + * @returns {U} Returns the accumulated value + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * reduce(obj, (acc, value) => acc + value, 0); // => 6 + */ +declare function reduce(collection: T | null | undefined, callback: MemoObjectIterator, accumulator: U): U; +/** + * Reduces an array to a single value using an iteratee function. + * + * @param {T[] | null | undefined} collection - The array to iterate over + * @param {MemoListIterator} callback - The function invoked per iteration + * @returns {T | undefined} Returns the accumulated value + * + * @example + * const array = [1, 2, 3]; + * reduce(array, (acc, value) => acc + value); // => 6 + */ +declare function reduce(collection: T[] | null | undefined, callback: MemoListIterator): T | undefined; +/** + * Reduces an array-like object to a single value using an iteratee function. + * + * @param {ArrayLike | null | undefined} collection - The array-like object to iterate over + * @param {MemoListIterator>} callback - The function invoked per iteration + * @returns {T | undefined} Returns the accumulated value + * + * @example + * const arrayLike = {0: 1, 1: 2, 2: 3, length: 3}; + * reduce(arrayLike, (acc, value) => acc + value); // => 6 + */ +declare function reduce(collection: ArrayLike | null | undefined, callback: MemoListIterator>): T | undefined; +/** + * Reduces an object to a single value using an iteratee function. + * + * @param {T | null | undefined} collection - The object to iterate over + * @param {MemoObjectIterator} callback - The function invoked per iteration + * @returns {T[keyof T] | undefined} Returns the accumulated value + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * reduce(obj, (acc, value) => acc + value); // => 6 + */ +declare function reduce(collection: T | null | undefined, callback: MemoObjectIterator): T[keyof T] | undefined; +//#endregion +export { reduce }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/reduce.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/reduce.js new file mode 100644 index 0000000000000000000000000000000000000000..80a64f6175cacb3f09a0d05124fb7f6cf5e70c5a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/reduce.js @@ -0,0 +1,53 @@ +const require_identity = require("../../function/identity.js"); +const require_range = require("../../math/range.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +//#region src/compat/array/reduce.ts +/** +* Reduces a collection to a single value using an iteratee function. +* +* @param {T[] | ArrayLike | Record | null | undefined} collection - The collection to iterate over. +* @param {((accumulator: any, value: any, index: PropertyKey, collection: any) => any) | PropertyKey | object} iteratee - The function invoked per iteration or the key to reduce over. +* @param {any} initialValue - The initial value. +* @returns {any} - Returns the accumulated value. +* +* @example +* // Using a reducer function +* const array = [1, 2, 3]; +* reduce(array, (acc, value) => acc + value, 0); // => 6 +* +* @example +* // Using a reducer function with initialValue +* const array = [1, 2, 3]; +* reduce(array, (acc, value) => acc + value % 2 === 0, true); // => false +* +* @example +* // Using an object as the collection +* const obj = { a: 1, b: 2, c: 3 }; +* reduce(obj, (acc, value) => acc + value, 0); // => 6 +*/ +function reduce(collection, iteratee = require_identity.identity, accumulator) { + if (!collection) return accumulator; + let keys; + let startIndex = 0; + if (require_isArrayLike.isArrayLike(collection)) { + keys = require_range.range(0, collection.length); + if (accumulator == null && collection.length > 0) { + accumulator = collection[0]; + startIndex += 1; + } + } else { + keys = Object.keys(collection); + if (accumulator == null) { + accumulator = collection[keys[0]]; + startIndex += 1; + } + } + for (let i = startIndex; i < keys.length; i++) { + const key = keys[i]; + const value = collection[key]; + accumulator = iteratee(accumulator, value, key, collection); + } + return accumulator; +} +//#endregion +exports.reduce = reduce; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/reduce.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/reduce.mjs new file mode 100644 index 0000000000000000000000000000000000000000..96b09f3058bbe0d343b572e5ddad080aa1bf75ac --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/reduce.mjs @@ -0,0 +1,53 @@ +import { identity } from "../../function/identity.mjs"; +import { range } from "../../math/range.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +//#region src/compat/array/reduce.ts +/** +* Reduces a collection to a single value using an iteratee function. +* +* @param {T[] | ArrayLike | Record | null | undefined} collection - The collection to iterate over. +* @param {((accumulator: any, value: any, index: PropertyKey, collection: any) => any) | PropertyKey | object} iteratee - The function invoked per iteration or the key to reduce over. +* @param {any} initialValue - The initial value. +* @returns {any} - Returns the accumulated value. +* +* @example +* // Using a reducer function +* const array = [1, 2, 3]; +* reduce(array, (acc, value) => acc + value, 0); // => 6 +* +* @example +* // Using a reducer function with initialValue +* const array = [1, 2, 3]; +* reduce(array, (acc, value) => acc + value % 2 === 0, true); // => false +* +* @example +* // Using an object as the collection +* const obj = { a: 1, b: 2, c: 3 }; +* reduce(obj, (acc, value) => acc + value, 0); // => 6 +*/ +function reduce(collection, iteratee = identity, accumulator) { + if (!collection) return accumulator; + let keys; + let startIndex = 0; + if (isArrayLike(collection)) { + keys = range(0, collection.length); + if (accumulator == null && collection.length > 0) { + accumulator = collection[0]; + startIndex += 1; + } + } else { + keys = Object.keys(collection); + if (accumulator == null) { + accumulator = collection[keys[0]]; + startIndex += 1; + } + } + for (let i = startIndex; i < keys.length; i++) { + const key = keys[i]; + const value = collection[key]; + accumulator = iteratee(accumulator, value, key, collection); + } + return accumulator; +} +//#endregion +export { reduce }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/reduceRight.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/reduceRight.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..70f471b8883a809a8e0238de6de023b9c8d139a5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/reduceRight.d.mts @@ -0,0 +1,119 @@ +import { MemoListIterator } from "../_internal/MemoListIterator.mjs"; +import { MemoObjectIterator } from "../_internal/MemoObjectIterator.mjs"; + +//#region src/compat/array/reduceRight.d.ts +/** + * Reduces an array to a single value using an iteratee function, starting from the right. + * + * The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one. + * This function takes the result of the previous step and the current element to perform a calculation. + * After going through all the elements, the function gives you one final result. + * + * When the `reduceRight()` function starts, there's no previous result to use. + * If you provide an initial value, it starts with that. + * If not, it uses the last element of the array and begins with the second to last element for the calculation. + * + * The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one. + * This function takes the result of the previous step and the current element to perform a calculation. + * After going through all the elements, the function gives you one final result. + * + * When the `reduceRight()` function starts, there's no previous result to use. + * If you provide an initial value, it starts with that. + * If not, it uses the last element of the array and begins with the second to last element for the calculation. + * + * @template T, U + * @param {T[] | null | undefined} collection - The array to iterate over. + * @param {MemoListIterator} callback - The function invoked per iteration. + * @param {U} accumulator - The initial value. + * @returns {U} Returns the accumulated value. + * + * @example + * reduceRight([1, 2, 3], (acc, value) => acc + value, 0); + * // => 6 + */ +declare function reduceRight(collection: T[] | null | undefined, callback: MemoListIterator, accumulator: U): U; +/** + * Reduces an array-like collection to a single value using an iteratee function, starting from the right. + * + * @template T, U + * @param {ArrayLike | null | undefined} collection - The array-like collection to iterate over. + * @param {MemoListIterator>} callback - The function invoked per iteration. + * @param {U} accumulator - The initial value. + * @returns {U} Returns the accumulated value. + * + * @example + * reduceRight([1, 2, 3], (acc, value) => acc + value, 0); + * // => 6 + */ +declare function reduceRight(collection: ArrayLike | null | undefined, callback: MemoListIterator>, accumulator: U): U; +/** + * Reduces an object to a single value using an iteratee function, starting from the right. + * + * @template T, U + * @param {T | null | undefined} collection - The object to iterate over. + * @param {MemoObjectIterator} callback - The function invoked per iteration. + * @param {U} accumulator - The initial value. + * @returns {U} Returns the accumulated value. + * + * @example + * reduceRight({ a: 1, b: 2, c: 3 }, (acc, value) => acc + value, 0); + * // => 6 + */ +declare function reduceRight(collection: T | null | undefined, callback: MemoObjectIterator, accumulator: U): U; +/** + * Reduces an array to a single value using an iteratee function, starting from the right. + * + * The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one. + * This function takes the result of the previous step and the current element to perform a calculation. + * After going through all the elements, the function gives you one final result. + * + * When the `reduceRight()` function starts, there's no previous result to use. + * If you provide an initial value, it starts with that. + * If not, it uses the last element of the array and begins with the second to last element for the calculation. + * + * The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one. + * This function takes the result of the previous step and the current element to perform a calculation. + * After going through all the elements, the function gives you one final result. + * + * When the `reduceRight()` function starts, there's no previous result to use. + * If you provide an initial value, it starts with that. + * If not, it uses the last element of the array and begins with the second to last element for the calculation. + * + * @template T + * @param {T[] | null | undefined} collection - The array to iterate over. + * @param {MemoListIterator} callback - The function invoked per iteration. + * @returns {T | undefined} Returns the accumulated value. + * + * @example + * reduceRight([1, 2, 3], (acc, value) => acc + value); + * // => 6 + */ +declare function reduceRight(collection: T[] | null | undefined, callback: MemoListIterator): T | undefined; +/** + * Reduces an array-like collection to a single value using an iteratee function, starting from the right. + * + * @template T + * @param {ArrayLike | null | undefined} collection - The array-like collection to iterate over. + * @param {MemoListIterator>} callback - The function invoked per iteration. + * @returns {T | undefined} Returns the accumulated value. + * + * @example + * reduceRight([1, 2, 3], (acc, value) => acc + value); + * // => 6 + */ +declare function reduceRight(collection: ArrayLike | null | undefined, callback: MemoListIterator>): T | undefined; +/** + * Reduces an object to a single value using an iteratee function, starting from the right. + * + * @template T + * @param {T | null | undefined} collection - The object to iterate over. + * @param {MemoObjectIterator} callback - The function invoked per iteration. + * @returns {T[keyof T] | undefined} Returns the accumulated value. + * + * @example + * reduceRight({ a: 1, b: 2, c: 3 }, (acc, value) => acc + value); + * // => 6 + */ +declare function reduceRight(collection: T | null | undefined, callback: MemoObjectIterator): T[keyof T] | undefined; +//#endregion +export { reduceRight }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/reduceRight.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/reduceRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..340d21ba8712fb1b7d38e0028063104f397f660d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/reduceRight.d.ts @@ -0,0 +1,119 @@ +import { MemoListIterator } from "../_internal/MemoListIterator.js"; +import { MemoObjectIterator } from "../_internal/MemoObjectIterator.js"; + +//#region src/compat/array/reduceRight.d.ts +/** + * Reduces an array to a single value using an iteratee function, starting from the right. + * + * The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one. + * This function takes the result of the previous step and the current element to perform a calculation. + * After going through all the elements, the function gives you one final result. + * + * When the `reduceRight()` function starts, there's no previous result to use. + * If you provide an initial value, it starts with that. + * If not, it uses the last element of the array and begins with the second to last element for the calculation. + * + * The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one. + * This function takes the result of the previous step and the current element to perform a calculation. + * After going through all the elements, the function gives you one final result. + * + * When the `reduceRight()` function starts, there's no previous result to use. + * If you provide an initial value, it starts with that. + * If not, it uses the last element of the array and begins with the second to last element for the calculation. + * + * @template T, U + * @param {T[] | null | undefined} collection - The array to iterate over. + * @param {MemoListIterator} callback - The function invoked per iteration. + * @param {U} accumulator - The initial value. + * @returns {U} Returns the accumulated value. + * + * @example + * reduceRight([1, 2, 3], (acc, value) => acc + value, 0); + * // => 6 + */ +declare function reduceRight(collection: T[] | null | undefined, callback: MemoListIterator, accumulator: U): U; +/** + * Reduces an array-like collection to a single value using an iteratee function, starting from the right. + * + * @template T, U + * @param {ArrayLike | null | undefined} collection - The array-like collection to iterate over. + * @param {MemoListIterator>} callback - The function invoked per iteration. + * @param {U} accumulator - The initial value. + * @returns {U} Returns the accumulated value. + * + * @example + * reduceRight([1, 2, 3], (acc, value) => acc + value, 0); + * // => 6 + */ +declare function reduceRight(collection: ArrayLike | null | undefined, callback: MemoListIterator>, accumulator: U): U; +/** + * Reduces an object to a single value using an iteratee function, starting from the right. + * + * @template T, U + * @param {T | null | undefined} collection - The object to iterate over. + * @param {MemoObjectIterator} callback - The function invoked per iteration. + * @param {U} accumulator - The initial value. + * @returns {U} Returns the accumulated value. + * + * @example + * reduceRight({ a: 1, b: 2, c: 3 }, (acc, value) => acc + value, 0); + * // => 6 + */ +declare function reduceRight(collection: T | null | undefined, callback: MemoObjectIterator, accumulator: U): U; +/** + * Reduces an array to a single value using an iteratee function, starting from the right. + * + * The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one. + * This function takes the result of the previous step and the current element to perform a calculation. + * After going through all the elements, the function gives you one final result. + * + * When the `reduceRight()` function starts, there's no previous result to use. + * If you provide an initial value, it starts with that. + * If not, it uses the last element of the array and begins with the second to last element for the calculation. + * + * The `reduceRight()` function goes through each element in an array from right to left and applies a special function (called a "reducer") to them, one by one. + * This function takes the result of the previous step and the current element to perform a calculation. + * After going through all the elements, the function gives you one final result. + * + * When the `reduceRight()` function starts, there's no previous result to use. + * If you provide an initial value, it starts with that. + * If not, it uses the last element of the array and begins with the second to last element for the calculation. + * + * @template T + * @param {T[] | null | undefined} collection - The array to iterate over. + * @param {MemoListIterator} callback - The function invoked per iteration. + * @returns {T | undefined} Returns the accumulated value. + * + * @example + * reduceRight([1, 2, 3], (acc, value) => acc + value); + * // => 6 + */ +declare function reduceRight(collection: T[] | null | undefined, callback: MemoListIterator): T | undefined; +/** + * Reduces an array-like collection to a single value using an iteratee function, starting from the right. + * + * @template T + * @param {ArrayLike | null | undefined} collection - The array-like collection to iterate over. + * @param {MemoListIterator>} callback - The function invoked per iteration. + * @returns {T | undefined} Returns the accumulated value. + * + * @example + * reduceRight([1, 2, 3], (acc, value) => acc + value); + * // => 6 + */ +declare function reduceRight(collection: ArrayLike | null | undefined, callback: MemoListIterator>): T | undefined; +/** + * Reduces an object to a single value using an iteratee function, starting from the right. + * + * @template T + * @param {T | null | undefined} collection - The object to iterate over. + * @param {MemoObjectIterator} callback - The function invoked per iteration. + * @returns {T[keyof T] | undefined} Returns the accumulated value. + * + * @example + * reduceRight({ a: 1, b: 2, c: 3 }, (acc, value) => acc + value); + * // => 6 + */ +declare function reduceRight(collection: T | null | undefined, callback: MemoObjectIterator): T[keyof T] | undefined; +//#endregion +export { reduceRight }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/reduceRight.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/reduceRight.js new file mode 100644 index 0000000000000000000000000000000000000000..83eaabad78cf262b2ba75abaf22efec0b5feb926 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/reduceRight.js @@ -0,0 +1,53 @@ +const require_identity = require("../../function/identity.js"); +const require_range = require("../../math/range.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +//#region src/compat/array/reduceRight.ts +/** +* Reduces a collection to a single value using an iteratee function, starting from the right. +* +* @param {T[] | ArrayLike | Record | null | undefined} collection - The collection to iterate over. +* @param {((accumulator: any, value: any, index: PropertyKey, collection: any) => any) | PropertyKey | object} iteratee - The function invoked per iteration or the key to reduce over. +* @param {any} initialValue - The initial value. +* @returns {any} - Returns the accumulated value. +* +* @example +* // Using a reducer function +* const array = [1, 2, 3]; +* reduceRight(array, (acc, value) => acc + value, 0); // => 6 +* +* @example +* // Using a reducer function with initialValue +* const array = [1, 2, 3]; +* reduceRight(array, (acc, value) => acc + value % 2 === 0, true); // => false +* +* @example +* // Using an object as the collection +* const obj = { a: 1, b: 2, c: 3 }; +* reduceRight(obj, (acc, value) => acc + value, 0); // => 6 +*/ +function reduceRight(collection, iteratee = require_identity.identity, accumulator) { + if (!collection) return accumulator; + let keys; + let startIndex; + if (require_isArrayLike.isArrayLike(collection)) { + keys = require_range.range(0, collection.length).reverse(); + if (accumulator == null && collection.length > 0) { + accumulator = collection[collection.length - 1]; + startIndex = 1; + } else startIndex = 0; + } else { + keys = Object.keys(collection).reverse(); + if (accumulator == null) { + accumulator = collection[keys[0]]; + startIndex = 1; + } else startIndex = 0; + } + for (let i = startIndex; i < keys.length; i++) { + const key = keys[i]; + const value = collection[key]; + accumulator = iteratee(accumulator, value, key, collection); + } + return accumulator; +} +//#endregion +exports.reduceRight = reduceRight; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/reduceRight.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/reduceRight.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f8329a4a7702ff650548a2e84270bfa4e4e24ce5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/reduceRight.mjs @@ -0,0 +1,53 @@ +import { identity } from "../../function/identity.mjs"; +import { range } from "../../math/range.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +//#region src/compat/array/reduceRight.ts +/** +* Reduces a collection to a single value using an iteratee function, starting from the right. +* +* @param {T[] | ArrayLike | Record | null | undefined} collection - The collection to iterate over. +* @param {((accumulator: any, value: any, index: PropertyKey, collection: any) => any) | PropertyKey | object} iteratee - The function invoked per iteration or the key to reduce over. +* @param {any} initialValue - The initial value. +* @returns {any} - Returns the accumulated value. +* +* @example +* // Using a reducer function +* const array = [1, 2, 3]; +* reduceRight(array, (acc, value) => acc + value, 0); // => 6 +* +* @example +* // Using a reducer function with initialValue +* const array = [1, 2, 3]; +* reduceRight(array, (acc, value) => acc + value % 2 === 0, true); // => false +* +* @example +* // Using an object as the collection +* const obj = { a: 1, b: 2, c: 3 }; +* reduceRight(obj, (acc, value) => acc + value, 0); // => 6 +*/ +function reduceRight(collection, iteratee = identity, accumulator) { + if (!collection) return accumulator; + let keys; + let startIndex; + if (isArrayLike(collection)) { + keys = range(0, collection.length).reverse(); + if (accumulator == null && collection.length > 0) { + accumulator = collection[collection.length - 1]; + startIndex = 1; + } else startIndex = 0; + } else { + keys = Object.keys(collection).reverse(); + if (accumulator == null) { + accumulator = collection[keys[0]]; + startIndex = 1; + } else startIndex = 0; + } + for (let i = startIndex; i < keys.length; i++) { + const key = keys[i]; + const value = collection[key]; + accumulator = iteratee(accumulator, value, key, collection); + } + return accumulator; +} +//#endregion +export { reduceRight }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/reject.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/reject.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..ab93cf84290fff48c861a5d56c0c24fe75bcd4c9 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/reject.d.mts @@ -0,0 +1,51 @@ +import { StringIterator } from "../_internal/StringIterator.mjs"; +import { ListIterateeCustom } from "../_internal/ListIterateeCustom.mjs"; +import { ObjectIterateeCustom } from "../_internal/ObjectIteratee.mjs"; + +//#region src/compat/array/reject.d.ts +/** + * Iterates over the collection and rejects elements based on the given predicate. + * If a function is provided, it is invoked for each element in the collection. + * + * @param {string | null | undefined} collection The string to iterate over + * @param {StringIterator} [predicate] The function invoked per iteration + * @returns {string[]} Returns a new array of characters that do not satisfy the predicate + * @example + * reject('abc', char => char === 'b') + * // => ['a', 'c'] + */ +declare function reject(collection: string | null | undefined, predicate?: StringIterator): string[]; +/** + * Iterates over the collection and rejects elements based on the given predicate. + * If a function is provided, it is invoked for each element in the collection. + * + * @template T + * @param {ArrayLike | null | undefined} collection The array-like to iterate over + * @param {ListIterateeCustom} [predicate] The function invoked per iteration + * @returns {T[]} Returns a new array of elements that do not satisfy the predicate + * @example + * reject([1, 2, 3], num => num % 2 === 0) + * // => [1, 3] + * + * reject([{ a: 1 }, { a: 2 }, { b: 1 }], 'a') + * // => [{ b: 1 }] + */ +declare function reject(collection: ArrayLike | null | undefined, predicate?: ListIterateeCustom): T[]; +/** + * Iterates over the collection and rejects elements based on the given predicate. + * If a function is provided, it is invoked for each element in the collection. + * + * @template T + * @param {T | null | undefined} collection The object to iterate over + * @param {ObjectIterateeCustom} [predicate] The function invoked per iteration + * @returns {Array} Returns a new array of elements that do not satisfy the predicate + * @example + * reject({ a: 1, b: 2, c: 3 }, value => value % 2 === 0) + * // => [1, 3] + * + * reject({ item1: { a: 0, b: true }, item2: { a: 1, b: true }, item3: { a: 2, b: false }}, { b: false }) + * // => [{ a: 0, b: true }, { a: 1, b: true }] + */ +declare function reject(collection: T | null | undefined, predicate?: ObjectIterateeCustom): Array; +//#endregion +export { reject }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/reject.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/reject.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0133eefe3f0b70157030bc6c80195cde72e62719 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/reject.d.ts @@ -0,0 +1,51 @@ +import { StringIterator } from "../_internal/StringIterator.js"; +import { ListIterateeCustom } from "../_internal/ListIterateeCustom.js"; +import { ObjectIterateeCustom } from "../_internal/ObjectIteratee.js"; + +//#region src/compat/array/reject.d.ts +/** + * Iterates over the collection and rejects elements based on the given predicate. + * If a function is provided, it is invoked for each element in the collection. + * + * @param {string | null | undefined} collection The string to iterate over + * @param {StringIterator} [predicate] The function invoked per iteration + * @returns {string[]} Returns a new array of characters that do not satisfy the predicate + * @example + * reject('abc', char => char === 'b') + * // => ['a', 'c'] + */ +declare function reject(collection: string | null | undefined, predicate?: StringIterator): string[]; +/** + * Iterates over the collection and rejects elements based on the given predicate. + * If a function is provided, it is invoked for each element in the collection. + * + * @template T + * @param {ArrayLike | null | undefined} collection The array-like to iterate over + * @param {ListIterateeCustom} [predicate] The function invoked per iteration + * @returns {T[]} Returns a new array of elements that do not satisfy the predicate + * @example + * reject([1, 2, 3], num => num % 2 === 0) + * // => [1, 3] + * + * reject([{ a: 1 }, { a: 2 }, { b: 1 }], 'a') + * // => [{ b: 1 }] + */ +declare function reject(collection: ArrayLike | null | undefined, predicate?: ListIterateeCustom): T[]; +/** + * Iterates over the collection and rejects elements based on the given predicate. + * If a function is provided, it is invoked for each element in the collection. + * + * @template T + * @param {T | null | undefined} collection The object to iterate over + * @param {ObjectIterateeCustom} [predicate] The function invoked per iteration + * @returns {Array} Returns a new array of elements that do not satisfy the predicate + * @example + * reject({ a: 1, b: 2, c: 3 }, value => value % 2 === 0) + * // => [1, 3] + * + * reject({ item1: { a: 0, b: true }, item2: { a: 1, b: true }, item3: { a: 2, b: false }}, { b: false }) + * // => [{ a: 0, b: true }, { a: 1, b: true }] + */ +declare function reject(collection: T | null | undefined, predicate?: ObjectIterateeCustom): Array; +//#endregion +export { reject }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/reject.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/reject.js new file mode 100644 index 0000000000000000000000000000000000000000..d29a8aee24d14966094b2b5598c9efb4964bc34a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/reject.js @@ -0,0 +1,32 @@ +const require_identity = require("../../function/identity.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_filter = require("./filter.js"); +const require_negate = require("../function/negate.js"); +//#region src/compat/array/reject.ts +/** +* Iterates over the collection and rejects elements based on the given predicate. +* If a function is provided, it is invoked for each element in the collection. +* +* @template T +* @param {ArrayLike | Record | null | undefined} source - The array or object to iterate over. +* @param {((item: T, index: number, arr: any) => unknown) | Partial | [keyof T, unknown] | PropertyKey} [predicate=identity] - The function invoked per iteration. +* @returns {T[]} - Returns a new array of elements that do not satisfy the predicate. +* +* @example +* reject([{ a: 1 }, { a: 2 }, { b: 1 }], 'a'); +* // => [{ b: 1 }] +* +* reject([{ a: 1 }, { a: 2 }, { b: 1 }], { b: 1 }); +* // => [{ a: 1 }, { a: 2 }] +* +* reject({ item1: { a: 0, b: true }, item2: { a: 1, b: true }, item3: { a: 2, b: false }}, { b: false }) +* // => [{ a: 0, b: true }, { a: 1, b: true }] +* +* reject([{ a: 1 }, { a: 2 }, { a: 3 }], ['a', 2]); +* // => [{ a: 1 }, { a: 3 }] +*/ +function reject(source, predicate = require_identity.identity) { + return require_filter.filter(source, require_negate.negate(require_iteratee.iteratee(predicate))); +} +//#endregion +exports.reject = reject; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/reject.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/reject.mjs new file mode 100644 index 0000000000000000000000000000000000000000..1d48929eab7fe5dc6983912a23f5ad22caf78044 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/reject.mjs @@ -0,0 +1,32 @@ +import { identity } from "../../function/identity.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +import { filter } from "./filter.mjs"; +import { negate } from "../function/negate.mjs"; +//#region src/compat/array/reject.ts +/** +* Iterates over the collection and rejects elements based on the given predicate. +* If a function is provided, it is invoked for each element in the collection. +* +* @template T +* @param {ArrayLike | Record | null | undefined} source - The array or object to iterate over. +* @param {((item: T, index: number, arr: any) => unknown) | Partial | [keyof T, unknown] | PropertyKey} [predicate=identity] - The function invoked per iteration. +* @returns {T[]} - Returns a new array of elements that do not satisfy the predicate. +* +* @example +* reject([{ a: 1 }, { a: 2 }, { b: 1 }], 'a'); +* // => [{ b: 1 }] +* +* reject([{ a: 1 }, { a: 2 }, { b: 1 }], { b: 1 }); +* // => [{ a: 1 }, { a: 2 }] +* +* reject({ item1: { a: 0, b: true }, item2: { a: 1, b: true }, item3: { a: 2, b: false }}, { b: false }) +* // => [{ a: 0, b: true }, { a: 1, b: true }] +* +* reject([{ a: 1 }, { a: 2 }, { a: 3 }], ['a', 2]); +* // => [{ a: 1 }, { a: 3 }] +*/ +function reject(source, predicate = identity) { + return filter(source, negate(iteratee(predicate))); +} +//#endregion +export { reject }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/remove.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/remove.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..7cf899b2128bc11870ab377415562eba94e9af39 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/remove.d.mts @@ -0,0 +1,22 @@ +import { ListIteratee } from "../_internal/ListIteratee.mjs"; +import { MutableList } from "../_internal/MutableList.mjs"; +import { RejectReadonly } from "../_internal/RejectReadonly.mjs"; + +//#region src/compat/array/remove.d.ts +/** + * Removes all elements from array that predicate returns truthy for and returns an array of the removed elements. + * + * @template L + * @param {RejectReadonly} array - The array to modify. + * @param {ListIteratee} [predicate] - The function invoked per iteration. + * @returns {Array} Returns the new array of removed elements. + * + * @example + * const array = [1, 2, 3, 4]; + * const evens = remove(array, n => n % 2 === 0); + * console.log(array); // => [1, 3] + * console.log(evens); // => [2, 4] + */ +declare function remove>(array: RejectReadonly, predicate?: ListIteratee): Array; +//#endregion +export { remove }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/remove.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/remove.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..322cc034efdfd0d1b8aa21820419cf7d4f61c803 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/remove.d.ts @@ -0,0 +1,22 @@ +import { ListIteratee } from "../_internal/ListIteratee.js"; +import { MutableList } from "../_internal/MutableList.js"; +import { RejectReadonly } from "../_internal/RejectReadonly.js"; + +//#region src/compat/array/remove.d.ts +/** + * Removes all elements from array that predicate returns truthy for and returns an array of the removed elements. + * + * @template L + * @param {RejectReadonly} array - The array to modify. + * @param {ListIteratee} [predicate] - The function invoked per iteration. + * @returns {Array} Returns the new array of removed elements. + * + * @example + * const array = [1, 2, 3, 4]; + * const evens = remove(array, n => n % 2 === 0); + * console.log(array); // => [1, 3] + * console.log(evens); // => [2, 4] + */ +declare function remove>(array: RejectReadonly, predicate?: ListIteratee): Array; +//#endregion +export { remove }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/remove.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/remove.js new file mode 100644 index 0000000000000000000000000000000000000000..543e4e5402e74fccd04599440fd4d653765e7aa6 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/remove.js @@ -0,0 +1,36 @@ +const require_remove = require("../../array/remove.js"); +const require_identity = require("../../function/identity.js"); +const require_iteratee = require("../util/iteratee.js"); +//#region src/compat/array/remove.ts +/** +* Removes elements from an array based on various criteria. +* +* @param {ArrayLike} arr - The array to iterate over. +* @param {(value: T, index: number, arr: ArrayLike) => boolean | Partial | [keyof T, unknown] | keyof T} shouldRemoveElement - The function invoked per iteration, a partial object, a property-value pair, or a key to match against each element. +* @returns {T[]} - Returns the modified array with the specified elements removed. +* +* @example +* // Using a predicate function +* const numbers = [1, 2, 3, 4, 5]; +* remove(numbers, value => value % 2 === 0); // => [1, 3, 5] +* +* @example +* // Using a partial object +* const objects = [{ a: 1 }, { a: 2 }, { a: 3 }]; +* remove(objects, { a: 1 }); // => [{ a: 2 }, { a: 3 }] +* +* @example +* // Using a property-value pair +* const objects = [{ a: 1 }, { a: 2 }, { a: 3 }]; +* remove(objects, ['a', 1]); // => [{ a: 2 }, { a: 3 }] +* +* @example +* // Using a property key +* const objects = [{ a: 0 }, { a: 1 }]; +* remove(objects, 'a'); // => [{ a: 0 }] +*/ +function remove(arr, shouldRemoveElement = require_identity.identity) { + return require_remove.remove(arr, require_iteratee.iteratee(shouldRemoveElement)); +} +//#endregion +exports.remove = remove; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/remove.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/remove.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e26964420b1104f686af5599a15fb3c42f0b5924 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/remove.mjs @@ -0,0 +1,36 @@ +import { remove as remove$1 } from "../../array/remove.mjs"; +import { identity } from "../../function/identity.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +//#region src/compat/array/remove.ts +/** +* Removes elements from an array based on various criteria. +* +* @param {ArrayLike} arr - The array to iterate over. +* @param {(value: T, index: number, arr: ArrayLike) => boolean | Partial | [keyof T, unknown] | keyof T} shouldRemoveElement - The function invoked per iteration, a partial object, a property-value pair, or a key to match against each element. +* @returns {T[]} - Returns the modified array with the specified elements removed. +* +* @example +* // Using a predicate function +* const numbers = [1, 2, 3, 4, 5]; +* remove(numbers, value => value % 2 === 0); // => [1, 3, 5] +* +* @example +* // Using a partial object +* const objects = [{ a: 1 }, { a: 2 }, { a: 3 }]; +* remove(objects, { a: 1 }); // => [{ a: 2 }, { a: 3 }] +* +* @example +* // Using a property-value pair +* const objects = [{ a: 1 }, { a: 2 }, { a: 3 }]; +* remove(objects, ['a', 1]); // => [{ a: 2 }, { a: 3 }] +* +* @example +* // Using a property key +* const objects = [{ a: 0 }, { a: 1 }]; +* remove(objects, 'a'); // => [{ a: 0 }] +*/ +function remove(arr, shouldRemoveElement = identity) { + return remove$1(arr, iteratee(shouldRemoveElement)); +} +//#endregion +export { remove }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/reverse.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/reverse.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..78da53f3fbb76c48bca4ee70c909e875e0fadbf5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/reverse.d.mts @@ -0,0 +1,19 @@ +import { MutableList } from "../_internal/MutableList.mjs"; +import { RejectReadonly } from "../_internal/RejectReadonly.mjs"; + +//#region src/compat/array/reverse.d.ts +/** + * Reverses `array` so that the first element becomes the last, the second element becomes the second to last, and so on. + * + * @template L + * @param {L extends readonly any[] ? never : L} array - The array to reverse. + * @returns {L} Returns `array`. + * + * @example + * const array = [1, 2, 3]; + * reverse(array); + * // => [3, 2, 1] + */ +declare function reverse>(array: RejectReadonly): L; +//#endregion +export { reverse }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/reverse.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/reverse.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e77baf614ef256d3ea30f933bac2a3f13a48aaad --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/reverse.d.ts @@ -0,0 +1,19 @@ +import { MutableList } from "../_internal/MutableList.js"; +import { RejectReadonly } from "../_internal/RejectReadonly.js"; + +//#region src/compat/array/reverse.d.ts +/** + * Reverses `array` so that the first element becomes the last, the second element becomes the second to last, and so on. + * + * @template L + * @param {L extends readonly any[] ? never : L} array - The array to reverse. + * @returns {L} Returns `array`. + * + * @example + * const array = [1, 2, 3]; + * reverse(array); + * // => [3, 2, 1] + */ +declare function reverse>(array: RejectReadonly): L; +//#endregion +export { reverse }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/reverse.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/reverse.js new file mode 100644 index 0000000000000000000000000000000000000000..a3c349ec5ee5762055551ce86cc5e0928e42b446 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/reverse.js @@ -0,0 +1,28 @@ +//#region src/compat/array/reverse.ts +/** +* Reverses the elements of an array in place. +* +* This function takes an array and reverses its elements in place, modifying the original array. +* If the input is `null` or `undefined`, it returns the input as is. +* +* @template T - The type of elements in the array. +* @param {T[] | null | undefined} array - The array to reverse. If `null` or `undefined`, the input is returned as is. +* @returns {T[] | null | undefined} The reversed array, or `null`/`undefined` if the input was `null`/`undefined`. +* +* @example +* const array = [1, 2, 3, 4, 5]; +* const reversedArray = reverse(array); +* // reversedArray is [5, 4, 3, 2, 1], and array is also modified to [5, 4, 3, 2, 1]. +* +* const emptyArray = reverse([]); +* // emptyArray is []. +* +* const nullArray = reverse(null); +* // nullArray is null. +*/ +function reverse(array) { + if (array == null) return array; + return array.reverse(); +} +//#endregion +exports.reverse = reverse; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/reverse.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/reverse.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f26937fb4cbffb3b7920da493e107c1f080f2f35 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/reverse.mjs @@ -0,0 +1,28 @@ +//#region src/compat/array/reverse.ts +/** +* Reverses the elements of an array in place. +* +* This function takes an array and reverses its elements in place, modifying the original array. +* If the input is `null` or `undefined`, it returns the input as is. +* +* @template T - The type of elements in the array. +* @param {T[] | null | undefined} array - The array to reverse. If `null` or `undefined`, the input is returned as is. +* @returns {T[] | null | undefined} The reversed array, or `null`/`undefined` if the input was `null`/`undefined`. +* +* @example +* const array = [1, 2, 3, 4, 5]; +* const reversedArray = reverse(array); +* // reversedArray is [5, 4, 3, 2, 1], and array is also modified to [5, 4, 3, 2, 1]. +* +* const emptyArray = reverse([]); +* // emptyArray is []. +* +* const nullArray = reverse(null); +* // nullArray is null. +*/ +function reverse(array) { + if (array == null) return array; + return array.reverse(); +} +//#endregion +export { reverse }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sample.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/sample.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..dd1c3dfe1e4aed0c327e2443407150c67f9d5b59 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sample.d.mts @@ -0,0 +1,39 @@ +//#region src/compat/array/sample.d.ts +/** + * Gets a random element from collection. + * + * @template T + * @param {readonly [T, ...T[]]} collection - The collection to sample. + * @returns {T} Returns the random element. + * + * @example + * sample([1, 2, 3, 4]); + * // => 2 + */ +declare function sample(collection: readonly [T, ...T[]]): T; +/** + * Gets a random element from collection. + * + * @template T + * @param {Record | Record | null | undefined} collection - The collection to sample. + * @returns {T | undefined} Returns the random element. + * + * @example + * sample({ 'a': 1, 'b': 2, 'c': 3 }); + * // => 2 + */ +declare function sample(collection: Record | Record | null | undefined): T | undefined; +/** + * Gets a random element from collection. + * + * @template T + * @param {T | null | undefined} collection - The collection to sample. + * @returns {T[keyof T] | undefined} Returns the random element. + * + * @example + * sample({ 'a': 1, 'b': 2, 'c': 3 }); + * // => 2 + */ +declare function sample(collection: T | null | undefined): T[keyof T] | undefined; +//#endregion +export { sample }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sample.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/sample.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dd1c3dfe1e4aed0c327e2443407150c67f9d5b59 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sample.d.ts @@ -0,0 +1,39 @@ +//#region src/compat/array/sample.d.ts +/** + * Gets a random element from collection. + * + * @template T + * @param {readonly [T, ...T[]]} collection - The collection to sample. + * @returns {T} Returns the random element. + * + * @example + * sample([1, 2, 3, 4]); + * // => 2 + */ +declare function sample(collection: readonly [T, ...T[]]): T; +/** + * Gets a random element from collection. + * + * @template T + * @param {Record | Record | null | undefined} collection - The collection to sample. + * @returns {T | undefined} Returns the random element. + * + * @example + * sample({ 'a': 1, 'b': 2, 'c': 3 }); + * // => 2 + */ +declare function sample(collection: Record | Record | null | undefined): T | undefined; +/** + * Gets a random element from collection. + * + * @template T + * @param {T | null | undefined} collection - The collection to sample. + * @returns {T[keyof T] | undefined} Returns the random element. + * + * @example + * sample({ 'a': 1, 'b': 2, 'c': 3 }); + * // => 2 + */ +declare function sample(collection: T | null | undefined): T[keyof T] | undefined; +//#endregion +export { sample }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sample.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/sample.js new file mode 100644 index 0000000000000000000000000000000000000000..b0c8df5a990446833aedf49db8c081e94dad9408 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sample.js @@ -0,0 +1,21 @@ +const require_sample = require("../../array/sample.js"); +const require_toArray = require("../_internal/toArray.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +//#region src/compat/array/sample.ts +/** +* The implementation for the overloaded sample function. +* +* This function takes an array, string, or object and returns a single element selected randomly. +* If the input is empty, or if it's null or undefined, the function returns `undefined`. +* +* @template T - The type of elements in the collection. +* @param {ArrayLike | Record} collection - The collection to sample from. +* @returns {T | string | undefined} A random element from the collection, or `undefined` if the collection is empty or invalid. +*/ +function sample(collection) { + if (collection == null) return; + if (require_isArrayLike.isArrayLike(collection)) return require_sample.sample(require_toArray.toArray(collection)); + return require_sample.sample(Object.values(collection)); +} +//#endregion +exports.sample = sample; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sample.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/sample.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f0c742dcb8368ad597da17b296ae18cdfed484e0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sample.mjs @@ -0,0 +1,21 @@ +import { sample as sample$1 } from "../../array/sample.mjs"; +import { toArray } from "../_internal/toArray.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +//#region src/compat/array/sample.ts +/** +* The implementation for the overloaded sample function. +* +* This function takes an array, string, or object and returns a single element selected randomly. +* If the input is empty, or if it's null or undefined, the function returns `undefined`. +* +* @template T - The type of elements in the collection. +* @param {ArrayLike | Record} collection - The collection to sample from. +* @returns {T | string | undefined} A random element from the collection, or `undefined` if the collection is empty or invalid. +*/ +function sample(collection) { + if (collection == null) return; + if (isArrayLike(collection)) return sample$1(toArray(collection)); + return sample$1(Object.values(collection)); +} +//#endregion +export { sample }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sampleSize.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/sampleSize.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..3fef25781aa2377ee0d65bdf748864e42fa7c685 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sampleSize.d.mts @@ -0,0 +1,29 @@ +//#region src/compat/array/sampleSize.d.ts +/** + * Returns a sample element array of a specified size from a collection. + * + * @template T + * @param {Record | Record | null | undefined} collection - The collection to sample from. + * @param {number} [n] - The size of sample. + * @returns {T[]} A new array with sample size applied. + * + * @example + * sampleSize([1, 2, 3], 2); + * // => [2, 3] (example, actual result will vary) + */ +declare function sampleSize(collection: Record | Record | null | undefined, n?: number): T[]; +/** + * Returns a sample element array of a specified size from an object. + * + * @template T + * @param {T | null | undefined} collection - The object to sample from. + * @param {number} [n] - The size of sample. + * @returns {Array} A new array with sample size applied. + * + * @example + * sampleSize({ a: 1, b: 2, c: 3 }, 2); + * // => [2, 3] (example, actual result will vary) + */ +declare function sampleSize(collection: T | null | undefined, n?: number): Array; +//#endregion +export { sampleSize }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sampleSize.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/sampleSize.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3fef25781aa2377ee0d65bdf748864e42fa7c685 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sampleSize.d.ts @@ -0,0 +1,29 @@ +//#region src/compat/array/sampleSize.d.ts +/** + * Returns a sample element array of a specified size from a collection. + * + * @template T + * @param {Record | Record | null | undefined} collection - The collection to sample from. + * @param {number} [n] - The size of sample. + * @returns {T[]} A new array with sample size applied. + * + * @example + * sampleSize([1, 2, 3], 2); + * // => [2, 3] (example, actual result will vary) + */ +declare function sampleSize(collection: Record | Record | null | undefined, n?: number): T[]; +/** + * Returns a sample element array of a specified size from an object. + * + * @template T + * @param {T | null | undefined} collection - The object to sample from. + * @param {number} [n] - The size of sample. + * @returns {Array} A new array with sample size applied. + * + * @example + * sampleSize({ a: 1, b: 2, c: 3 }, 2); + * // => [2, 3] (example, actual result will vary) + */ +declare function sampleSize(collection: T | null | undefined, n?: number): Array; +//#endregion +export { sampleSize }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sampleSize.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/sampleSize.js new file mode 100644 index 0000000000000000000000000000000000000000..e6f9bf5772ca0599e0a5e4de48a97be42169ace1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sampleSize.js @@ -0,0 +1,31 @@ +const require_sampleSize = require("../../array/sampleSize.js"); +const require_toInteger = require("../util/toInteger.js"); +const require_isIterateeCall = require("../_internal/isIterateeCall.js"); +const require_clamp = require("../math/clamp.js"); +const require_toArray = require("../util/toArray.js"); +//#region src/compat/array/sampleSize.ts +/** +* Returns a sample element array of a specified `size`. +* +* This function takes an array and a number, and returns an array containing the sampled elements using Floyd's algorithm. +* +* {@link https://www.nowherenearithaca.com/2013/05/robert-floyds-tiny-and-beautiful.html Floyd's algorithm} +* +* @template T - The type of elements in the array. +* @param {Record | Record | T | null | undefined} collection - The array to sample from. +* @param {number} size - The size of sample. +* @returns {Array | T[]} A new array with sample size applied. +* +* @example +* const result = sampleSize([1, 2, 3], 2) +* // result will be an array containing two of the elements from the collection. +* // [1, 2] or [1, 3] or [2, 3] +*/ +function sampleSize(collection, size, guard) { + const arrayCollection = require_toArray.toArray(collection); + if (guard ? require_isIterateeCall.isIterateeCall(collection, size, guard) : size === void 0) size = 1; + else size = require_clamp.clamp(require_toInteger.toInteger(size), 0, arrayCollection.length); + return require_sampleSize.sampleSize(arrayCollection, size); +} +//#endregion +exports.sampleSize = sampleSize; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sampleSize.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/sampleSize.mjs new file mode 100644 index 0000000000000000000000000000000000000000..fd4577bad46ae60a42c07d070cab6580ab6fbf1f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sampleSize.mjs @@ -0,0 +1,31 @@ +import { sampleSize as sampleSize$1 } from "../../array/sampleSize.mjs"; +import { toInteger } from "../util/toInteger.mjs"; +import { isIterateeCall } from "../_internal/isIterateeCall.mjs"; +import { clamp } from "../math/clamp.mjs"; +import { toArray } from "../util/toArray.mjs"; +//#region src/compat/array/sampleSize.ts +/** +* Returns a sample element array of a specified `size`. +* +* This function takes an array and a number, and returns an array containing the sampled elements using Floyd's algorithm. +* +* {@link https://www.nowherenearithaca.com/2013/05/robert-floyds-tiny-and-beautiful.html Floyd's algorithm} +* +* @template T - The type of elements in the array. +* @param {Record | Record | T | null | undefined} collection - The array to sample from. +* @param {number} size - The size of sample. +* @returns {Array | T[]} A new array with sample size applied. +* +* @example +* const result = sampleSize([1, 2, 3], 2) +* // result will be an array containing two of the elements from the collection. +* // [1, 2] or [1, 3] or [2, 3] +*/ +function sampleSize(collection, size, guard) { + const arrayCollection = toArray(collection); + if (guard ? isIterateeCall(collection, size, guard) : size === void 0) size = 1; + else size = clamp(toInteger(size), 0, arrayCollection.length); + return sampleSize$1(arrayCollection, size); +} +//#endregion +export { sampleSize }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/shuffle.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/shuffle.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..de3ccbb6944bfd3bbea25e40d9388bc4b0361877 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/shuffle.d.mts @@ -0,0 +1,23 @@ +//#region src/compat/array/shuffle.d.ts +/** + * Randomizes the order of elements in an `array` using the Fisher-Yates algorithm. + * + * This function takes an `array` and returns a new `array` with its elements shuffled in a random order. + * + * @template T - The type of elements in the `array`. + * @param {T[]} array - The `array` to shuffle. + * @returns {T[]} A new `array` with its elements shuffled in random order. + */ +declare function shuffle(array: ArrayLike | null | undefined): T[]; +/** + * Randomizes the order of elements in an `object` using the Fisher-Yates algorithm. + * + * This function takes an `object` and returns a new `object` with its values shuffled in a random order. + * + * @template T - The type of elements in the `object`. + * @param {T} object - The `object` to shuffle. + * @returns {T[]} A new `Array` with the values of the `object` shuffled in a random order. + */ +declare function shuffle(object: T | null | undefined): Array; +//#endregion +export { shuffle }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/shuffle.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/shuffle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..de3ccbb6944bfd3bbea25e40d9388bc4b0361877 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/shuffle.d.ts @@ -0,0 +1,23 @@ +//#region src/compat/array/shuffle.d.ts +/** + * Randomizes the order of elements in an `array` using the Fisher-Yates algorithm. + * + * This function takes an `array` and returns a new `array` with its elements shuffled in a random order. + * + * @template T - The type of elements in the `array`. + * @param {T[]} array - The `array` to shuffle. + * @returns {T[]} A new `array` with its elements shuffled in random order. + */ +declare function shuffle(array: ArrayLike | null | undefined): T[]; +/** + * Randomizes the order of elements in an `object` using the Fisher-Yates algorithm. + * + * This function takes an `object` and returns a new `object` with its values shuffled in a random order. + * + * @template T - The type of elements in the `object`. + * @param {T} object - The `object` to shuffle. + * @returns {T[]} A new `Array` with the values of the `object` shuffled in a random order. + */ +declare function shuffle(object: T | null | undefined): Array; +//#endregion +export { shuffle }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/shuffle.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/shuffle.js new file mode 100644 index 0000000000000000000000000000000000000000..ed4561df0aa7bd8444197a37f50ad9493a4a5c96 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/shuffle.js @@ -0,0 +1,25 @@ +const require_shuffle = require("../../array/shuffle.js"); +const require_isArray = require("../predicate/isArray.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_isObjectLike = require("../predicate/isObjectLike.js"); +const require_values = require("../object/values.js"); +const require_isNil = require("../predicate/isNil.js"); +//#region src/compat/array/shuffle.ts +/** +* Randomizes the order of elements in an `collection` using the Fisher-Yates algorithm. +* +* This function takes an `collection` and returns a new `collection` with its elements shuffled in a random order. +* +* @template T - The type of elements in the `collection`. +* @param {T[]} collection - The `collection` to shuffle. +* @returns {T[]} A new `collection` with its elements shuffled in random order. +*/ +function shuffle(collection) { + if (require_isNil.isNil(collection)) return []; + if (require_isArray.isArray(collection)) return require_shuffle.shuffle(collection); + if (require_isArrayLike.isArrayLike(collection)) return require_shuffle.shuffle(Array.from(collection)); + if (require_isObjectLike.isObjectLike(collection)) return require_shuffle.shuffle(require_values.values(collection)); + return []; +} +//#endregion +exports.shuffle = shuffle; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/shuffle.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/shuffle.mjs new file mode 100644 index 0000000000000000000000000000000000000000..30477df26bc853fff47ced25f5e501440eeb0333 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/shuffle.mjs @@ -0,0 +1,25 @@ +import { shuffle as shuffle$1 } from "../../array/shuffle.mjs"; +import { isArray } from "../predicate/isArray.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { isObjectLike } from "../predicate/isObjectLike.mjs"; +import { values } from "../object/values.mjs"; +import { isNil } from "../predicate/isNil.mjs"; +//#region src/compat/array/shuffle.ts +/** +* Randomizes the order of elements in an `collection` using the Fisher-Yates algorithm. +* +* This function takes an `collection` and returns a new `collection` with its elements shuffled in a random order. +* +* @template T - The type of elements in the `collection`. +* @param {T[]} collection - The `collection` to shuffle. +* @returns {T[]} A new `collection` with its elements shuffled in random order. +*/ +function shuffle(collection) { + if (isNil(collection)) return []; + if (isArray(collection)) return shuffle$1(collection); + if (isArrayLike(collection)) return shuffle$1(Array.from(collection)); + if (isObjectLike(collection)) return shuffle$1(values(collection)); + return []; +} +//#endregion +export { shuffle }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/size.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/size.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c108a78539cd66deb54d1c1470051f5084cca8b4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/size.d.mts @@ -0,0 +1,40 @@ +//#region src/compat/array/size.d.ts +/** + * Returns the length of an array, string, or object. + * + * This function takes an array, string, or object and returns its length. + * For arrays and strings, it returns the number of elements or characters, respectively. + * For objects, it returns the number of enumerable properties. + * + * @template T - The type of the input value. + * @param {T[] | object | string | Map | Set | null | undefined } target - The value whose size is to be determined. It can be an array, string, or object. + * @returns {number} The size of the input value. + * + * @example + * const arr = [1, 2, 3]; + * const arrSize = size(arr); + * // arrSize will be 3 + * + * const str = 'hello'; + * const strSize = size(str); + * // strSize will be 5 + * + * const obj = { a: 1, b: 2, c: 3 }; + * const objSize = size(obj); + * // objSize will be 3 + * + * const emptyArr = []; + * const emptyArrSize = size(emptyArr); + * // emptyArrSize will be 0 + * + * const emptyStr = ''; + * const emptyStrSize = size(emptyStr); + * // emptyStrSize will be 0 + * + * const emptyObj = {}; + * const emptyObjSize = size(emptyObj); + * // emptyObjSize will be 0 + */ +declare function size(collection: object | string | null | undefined): number; +//#endregion +export { size }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/size.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/size.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c108a78539cd66deb54d1c1470051f5084cca8b4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/size.d.ts @@ -0,0 +1,40 @@ +//#region src/compat/array/size.d.ts +/** + * Returns the length of an array, string, or object. + * + * This function takes an array, string, or object and returns its length. + * For arrays and strings, it returns the number of elements or characters, respectively. + * For objects, it returns the number of enumerable properties. + * + * @template T - The type of the input value. + * @param {T[] | object | string | Map | Set | null | undefined } target - The value whose size is to be determined. It can be an array, string, or object. + * @returns {number} The size of the input value. + * + * @example + * const arr = [1, 2, 3]; + * const arrSize = size(arr); + * // arrSize will be 3 + * + * const str = 'hello'; + * const strSize = size(str); + * // strSize will be 5 + * + * const obj = { a: 1, b: 2, c: 3 }; + * const objSize = size(obj); + * // objSize will be 3 + * + * const emptyArr = []; + * const emptyArrSize = size(emptyArr); + * // emptyArrSize will be 0 + * + * const emptyStr = ''; + * const emptyStrSize = size(emptyStr); + * // emptyStrSize will be 0 + * + * const emptyObj = {}; + * const emptyObjSize = size(emptyObj); + * // emptyObjSize will be 0 + */ +declare function size(collection: object | string | null | undefined): number; +//#endregion +export { size }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/size.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/size.js new file mode 100644 index 0000000000000000000000000000000000000000..751faa15020c03e233e54dda1421be29956b4c96 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/size.js @@ -0,0 +1,9 @@ +const require_isNil = require("../../predicate/isNil.js"); +//#region src/compat/array/size.ts +function size(target) { + if (require_isNil.isNil(target)) return 0; + if (target instanceof Map || target instanceof Set) return target.size; + return Object.keys(target).length; +} +//#endregion +exports.size = size; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/size.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/size.mjs new file mode 100644 index 0000000000000000000000000000000000000000..aff90909b0f5e4413eb8ea56509f01d1e5128ca1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/size.mjs @@ -0,0 +1,9 @@ +import { isNil } from "../../predicate/isNil.mjs"; +//#region src/compat/array/size.ts +function size(target) { + if (isNil(target)) return 0; + if (target instanceof Map || target instanceof Set) return target.size; + return Object.keys(target).length; +} +//#endregion +export { size }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/slice.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/slice.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..ac07bac4bc6d1b2f0513329f2197bb4782972b06 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/slice.d.mts @@ -0,0 +1,19 @@ +//#region src/compat/array/slice.d.ts +/** + * Create a slice of `array` from `start` up to, but not including, `end`. + * + * It does not return a dense array for sparse arrays unlike the native `Array.prototype.slice`. + * + * @template T - The type of the array elements. + * @param {ArrayLike | null | undefined} array - The array to slice. + * @param {number} [start=0] - The start position. + * @param {number} [end=array.length] - The end position. + * @returns {T[]} - Returns the slice of `array`. + * + * @example + * slice([1, 2, 3], 1, 2); // => [2] + * slice(new Array(3)); // => [undefined, undefined, undefined] + */ +declare function slice(array: ArrayLike | null | undefined, start?: number, end?: number): T[]; +//#endregion +export { slice }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/slice.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/slice.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ac07bac4bc6d1b2f0513329f2197bb4782972b06 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/slice.d.ts @@ -0,0 +1,19 @@ +//#region src/compat/array/slice.d.ts +/** + * Create a slice of `array` from `start` up to, but not including, `end`. + * + * It does not return a dense array for sparse arrays unlike the native `Array.prototype.slice`. + * + * @template T - The type of the array elements. + * @param {ArrayLike | null | undefined} array - The array to slice. + * @param {number} [start=0] - The start position. + * @param {number} [end=array.length] - The end position. + * @returns {T[]} - Returns the slice of `array`. + * + * @example + * slice([1, 2, 3], 1, 2); // => [2] + * slice(new Array(3)); // => [undefined, undefined, undefined] + */ +declare function slice(array: ArrayLike | null | undefined, start?: number, end?: number): T[]; +//#endregion +export { slice }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/slice.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/slice.js new file mode 100644 index 0000000000000000000000000000000000000000..f5d4e73cd0cb36a5203621775d011c8d02f4a20e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/slice.js @@ -0,0 +1,40 @@ +const require_toInteger = require("../util/toInteger.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_isIterateeCall = require("../_internal/isIterateeCall.js"); +//#region src/compat/array/slice.ts +/** +* Create a slice of `array` from `start` up to, but not including, `end`. +* +* It does not return a dense array for sparse arrays unlike the native `Array.prototype.slice`. +* +* @template T - The type of the array elements. +* @param {ArrayLike | null | undefined} array - The array to slice. +* @param {number} [start=0] - The start position. +* @param {number} [end=array.length] - The end position. +* @returns {T[]} - Returns the slice of `array`. +* +* @example +* slice([1, 2, 3], 1, 2); // => [2] +* slice(new Array(3)); // => [undefined, undefined, undefined] +*/ +function slice(array, start, end) { + if (!require_isArrayLike.isArrayLike(array)) return []; + const length = array.length; + if (end === void 0) end = length; + else if (typeof end !== "number" && require_isIterateeCall.isIterateeCall(array, start, end)) { + start = 0; + end = length; + } + start = require_toInteger.toInteger(start); + end = require_toInteger.toInteger(end); + if (start < 0) start = Math.max(length + start, 0); + else start = Math.min(start, length); + if (end < 0) end = Math.max(length + end, 0); + else end = Math.min(end, length); + const resultLength = Math.max(end - start, 0); + const result = new Array(resultLength); + for (let i = 0; i < resultLength; ++i) result[i] = array[start + i]; + return result; +} +//#endregion +exports.slice = slice; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/slice.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/slice.mjs new file mode 100644 index 0000000000000000000000000000000000000000..121f4a3717ce4d7d561edd4ac3fb33f0edf921f1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/slice.mjs @@ -0,0 +1,40 @@ +import { toInteger } from "../util/toInteger.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { isIterateeCall } from "../_internal/isIterateeCall.mjs"; +//#region src/compat/array/slice.ts +/** +* Create a slice of `array` from `start` up to, but not including, `end`. +* +* It does not return a dense array for sparse arrays unlike the native `Array.prototype.slice`. +* +* @template T - The type of the array elements. +* @param {ArrayLike | null | undefined} array - The array to slice. +* @param {number} [start=0] - The start position. +* @param {number} [end=array.length] - The end position. +* @returns {T[]} - Returns the slice of `array`. +* +* @example +* slice([1, 2, 3], 1, 2); // => [2] +* slice(new Array(3)); // => [undefined, undefined, undefined] +*/ +function slice(array, start, end) { + if (!isArrayLike(array)) return []; + const length = array.length; + if (end === void 0) end = length; + else if (typeof end !== "number" && isIterateeCall(array, start, end)) { + start = 0; + end = length; + } + start = toInteger(start); + end = toInteger(end); + if (start < 0) start = Math.max(length + start, 0); + else start = Math.min(start, length); + if (end < 0) end = Math.max(length + end, 0); + else end = Math.min(end, length); + const resultLength = Math.max(end - start, 0); + const result = new Array(resultLength); + for (let i = 0; i < resultLength; ++i) result[i] = array[start + i]; + return result; +} +//#endregion +export { slice }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/some.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/some.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..58edae9befad61eaf3e49c936c89cfbd14885131 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/some.d.mts @@ -0,0 +1,32 @@ +import { ListIterateeCustom } from "../_internal/ListIterateeCustom.mjs"; +import { ObjectIterateeCustom } from "../_internal/ObjectIteratee.mjs"; + +//#region src/compat/array/some.d.ts +/** + * Checks if predicate returns truthy for any element of collection. + * + * @template T + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {ListIterateeCustom} [predicate] - The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. + * + * @example + * some([null, 0, 'yes', false], Boolean); + * // => true + */ +declare function some(collection: ArrayLike | null | undefined, predicate?: ListIterateeCustom): boolean; +/** + * Checks if predicate returns truthy for any element of collection. + * + * @template T + * @param {T | null | undefined} collection - The object to iterate over. + * @param {ObjectIterateeCustom} [predicate] - The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. + * + * @example + * some({ 'a': 0, 'b': 1, 'c': 0 }, function(n) { return n > 0; }); + * // => true + */ +declare function some(collection: T | null | undefined, predicate?: ObjectIterateeCustom): boolean; +//#endregion +export { some }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/some.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/some.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bbd37b212dfa88b541fb49fb624feecac6498124 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/some.d.ts @@ -0,0 +1,32 @@ +import { ListIterateeCustom } from "../_internal/ListIterateeCustom.js"; +import { ObjectIterateeCustom } from "../_internal/ObjectIteratee.js"; + +//#region src/compat/array/some.d.ts +/** + * Checks if predicate returns truthy for any element of collection. + * + * @template T + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {ListIterateeCustom} [predicate] - The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. + * + * @example + * some([null, 0, 'yes', false], Boolean); + * // => true + */ +declare function some(collection: ArrayLike | null | undefined, predicate?: ListIterateeCustom): boolean; +/** + * Checks if predicate returns truthy for any element of collection. + * + * @template T + * @param {T | null | undefined} collection - The object to iterate over. + * @param {ObjectIterateeCustom} [predicate] - The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. + * + * @example + * some({ 'a': 0, 'b': 1, 'c': 0 }, function(n) { return n > 0; }); + * // => true + */ +declare function some(collection: T | null | undefined, predicate?: ObjectIterateeCustom): boolean; +//#endregion +export { some }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/some.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/some.js new file mode 100644 index 0000000000000000000000000000000000000000..9f06e013b256d65290907f0488c761c5ce2d6e43 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/some.js @@ -0,0 +1,90 @@ +const require_identity = require("../../function/identity.js"); +const require_property = require("../object/property.js"); +const require_matches = require("../predicate/matches.js"); +const require_matchesProperty = require("../predicate/matchesProperty.js"); +//#region src/compat/array/some.ts +/** +* Checks if there is an element in an array that matches the given predicate. +* +* Iteration is stopped once there is an element that matches `predicate`. +* +* @template T +* @param {ArrayLike | Record | null | undefined} source The source to iterate over. +* @param {((item: T, index: number, arr: any) => unknown) | Partial | [keyof T, unknown] | PropertyKey} [predicate=identity] The function invoked per iteration. +* If a property name or an object is provided it will be used to create a predicate function. +* @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. +* +* @example +* some([1, 2, 3, 4], n => n % 2 === 0); +* // => true +* +* some([{ a: 1 }, { a: 2 }, { a: 3 }], { a: 2 }); +* // => true +* +* some([{ a: 1 }, { a: 2 }, { a: 3 }], ['a', 2]); +* // => true +* +* some([{ a: 1 }, { a: 2 }, { a: 3 }], 'a'); +* // => true +* +* some({ a: 1, b: 2, c: 3 }, n => n % 2 === 0); +* // => true +* +* some({ a: { id: 1, name: 'Alice' }, b: { id: 2, name: 'Bob' } }, { name: 'Bob' }); +* // => true +* +* some({ a: { id: 1, name: 'Alice' }, b: { id: 2, name: 'Bob' } }, ['name', 'Alice']); +* // => true +* +* some({ a: { id: 1, name: 'Alice' }, b: { id: 2, name: 'Bob' } }, 'name'); +* // => true +*/ +function some(source, predicate, guard) { + if (!source) return false; + if (guard != null) predicate = void 0; + if (predicate == null) predicate = require_identity.identity; + const values = Array.isArray(source) ? source : Object.values(source); + switch (typeof predicate) { + case "function": + if (!Array.isArray(source)) { + const keys = Object.keys(source); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const value = source[key]; + if (predicate(value, key, source)) return true; + } + return false; + } + for (let i = 0; i < source.length; i++) if (predicate(source[i], i, source)) return true; + return false; + case "object": if (Array.isArray(predicate) && predicate.length === 2) { + const key = predicate[0]; + const value = predicate[1]; + const matchFunc = require_matchesProperty.matchesProperty(key, value); + if (Array.isArray(source)) { + for (let i = 0; i < source.length; i++) if (matchFunc(source[i])) return true; + return false; + } + return values.some(matchFunc); + } else { + const matchFunc = require_matches.matches(predicate); + if (Array.isArray(source)) { + for (let i = 0; i < source.length; i++) if (matchFunc(source[i])) return true; + return false; + } + return values.some(matchFunc); + } + case "number": + case "symbol": + case "string": { + const propFunc = require_property.property(predicate); + if (Array.isArray(source)) { + for (let i = 0; i < source.length; i++) if (propFunc(source[i])) return true; + return false; + } + return values.some(propFunc); + } + } +} +//#endregion +exports.some = some; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/some.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/some.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e70c3989ecc0b92be03653e96d4f5cbb386bbac5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/some.mjs @@ -0,0 +1,90 @@ +import { identity } from "../../function/identity.mjs"; +import { property } from "../object/property.mjs"; +import { matches } from "../predicate/matches.mjs"; +import { matchesProperty } from "../predicate/matchesProperty.mjs"; +//#region src/compat/array/some.ts +/** +* Checks if there is an element in an array that matches the given predicate. +* +* Iteration is stopped once there is an element that matches `predicate`. +* +* @template T +* @param {ArrayLike | Record | null | undefined} source The source to iterate over. +* @param {((item: T, index: number, arr: any) => unknown) | Partial | [keyof T, unknown] | PropertyKey} [predicate=identity] The function invoked per iteration. +* If a property name or an object is provided it will be used to create a predicate function. +* @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. +* +* @example +* some([1, 2, 3, 4], n => n % 2 === 0); +* // => true +* +* some([{ a: 1 }, { a: 2 }, { a: 3 }], { a: 2 }); +* // => true +* +* some([{ a: 1 }, { a: 2 }, { a: 3 }], ['a', 2]); +* // => true +* +* some([{ a: 1 }, { a: 2 }, { a: 3 }], 'a'); +* // => true +* +* some({ a: 1, b: 2, c: 3 }, n => n % 2 === 0); +* // => true +* +* some({ a: { id: 1, name: 'Alice' }, b: { id: 2, name: 'Bob' } }, { name: 'Bob' }); +* // => true +* +* some({ a: { id: 1, name: 'Alice' }, b: { id: 2, name: 'Bob' } }, ['name', 'Alice']); +* // => true +* +* some({ a: { id: 1, name: 'Alice' }, b: { id: 2, name: 'Bob' } }, 'name'); +* // => true +*/ +function some(source, predicate, guard) { + if (!source) return false; + if (guard != null) predicate = void 0; + if (predicate == null) predicate = identity; + const values = Array.isArray(source) ? source : Object.values(source); + switch (typeof predicate) { + case "function": + if (!Array.isArray(source)) { + const keys = Object.keys(source); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const value = source[key]; + if (predicate(value, key, source)) return true; + } + return false; + } + for (let i = 0; i < source.length; i++) if (predicate(source[i], i, source)) return true; + return false; + case "object": if (Array.isArray(predicate) && predicate.length === 2) { + const key = predicate[0]; + const value = predicate[1]; + const matchFunc = matchesProperty(key, value); + if (Array.isArray(source)) { + for (let i = 0; i < source.length; i++) if (matchFunc(source[i])) return true; + return false; + } + return values.some(matchFunc); + } else { + const matchFunc = matches(predicate); + if (Array.isArray(source)) { + for (let i = 0; i < source.length; i++) if (matchFunc(source[i])) return true; + return false; + } + return values.some(matchFunc); + } + case "number": + case "symbol": + case "string": { + const propFunc = property(predicate); + if (Array.isArray(source)) { + for (let i = 0; i < source.length; i++) if (propFunc(source[i])) return true; + return false; + } + return values.some(propFunc); + } + } +} +//#endregion +export { some }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortBy.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..821f8268b58ee1aa62d6bd9fafa62c6a34b8631b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortBy.d.mts @@ -0,0 +1,74 @@ +import { ListIteratee } from "../_internal/ListIteratee.mjs"; +import { ObjectIteratee } from "../_internal/ObjectIteratee.mjs"; +import { Many } from "../_internal/Many.mjs"; + +//#region src/compat/array/sortBy.d.ts +/** + * Sorts an array of objects based on multiple properties and their corresponding order directions. + * + * This function takes an array of objects, an array of criteria to sort by. + * It returns the ascending sorted array, ordering by each key. + * If values for a key are equal, it moves to the next key to determine the order. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | object | null | undefined} collection - The array of objects to be sorted. + * @param {Array | Criterion>>} criteria - An array of criteria (property names or property paths or custom key functions) to sort by. + * @returns {T[]} - The ascending sorted array. + * + * @example + * // Sort an array of objects by 'user' in ascending order and 'age' in descending order. + * const users = [ + * { user: 'fred', age: 48 }, + * { user: 'barney', age: 34 }, + * { user: 'fred', age: 40 }, + * { user: 'barney', age: 36 }, + * ]; + * const result = sortBy(users, ['user', (item) => item.age]) + * // result will be: + * // [ + * // { user: 'barney', age: 34 }, + * // { user: 'barney', age: 36 }, + * // { user: 'fred', age: 40 }, + * // { user: 'fred', age: 48 }, + * // ] + */ +/** + * Creates an array of elements, sorted in ascending order by the results of running each element in a collection thru each iteratee. + * + * @template T + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {...Array>} iteratees - The iteratees to sort by. + * @returns {T[]} Returns the new sorted array. + * + * @example + * const users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * sortBy(users, [function(o) { return o.user; }]); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ +declare function sortBy(collection: ArrayLike | null | undefined, ...iteratees: Array>>): T[]; +/** + * Creates an array of elements, sorted in ascending order by the results of running each element in a collection thru each iteratee. + * + * @template T + * @param {T | null | undefined} collection - The object to iterate over. + * @param {...Array | ObjectIteratee>} iteratees - The iteratees to sort by. + * @returns {Array} Returns the new sorted array. + * + * @example + * const users = { + * 'a': { 'user': 'fred', 'age': 48 }, + * 'b': { 'user': 'barney', 'age': 36 } + * }; + * + * sortBy(users, [function(o) { return o.user; }]); + * // => [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 48 }] + */ +declare function sortBy(collection: T | null | undefined, ...iteratees: Array>>): Array; +//#endregion +export { sortBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortBy.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e3c61e91c84f5027ea32933edb712d7c0786a890 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortBy.d.ts @@ -0,0 +1,74 @@ +import { ListIteratee } from "../_internal/ListIteratee.js"; +import { ObjectIteratee } from "../_internal/ObjectIteratee.js"; +import { Many } from "../_internal/Many.js"; + +//#region src/compat/array/sortBy.d.ts +/** + * Sorts an array of objects based on multiple properties and their corresponding order directions. + * + * This function takes an array of objects, an array of criteria to sort by. + * It returns the ascending sorted array, ordering by each key. + * If values for a key are equal, it moves to the next key to determine the order. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | object | null | undefined} collection - The array of objects to be sorted. + * @param {Array | Criterion>>} criteria - An array of criteria (property names or property paths or custom key functions) to sort by. + * @returns {T[]} - The ascending sorted array. + * + * @example + * // Sort an array of objects by 'user' in ascending order and 'age' in descending order. + * const users = [ + * { user: 'fred', age: 48 }, + * { user: 'barney', age: 34 }, + * { user: 'fred', age: 40 }, + * { user: 'barney', age: 36 }, + * ]; + * const result = sortBy(users, ['user', (item) => item.age]) + * // result will be: + * // [ + * // { user: 'barney', age: 34 }, + * // { user: 'barney', age: 36 }, + * // { user: 'fred', age: 40 }, + * // { user: 'fred', age: 48 }, + * // ] + */ +/** + * Creates an array of elements, sorted in ascending order by the results of running each element in a collection thru each iteratee. + * + * @template T + * @param {ArrayLike | null | undefined} collection - The collection to iterate over. + * @param {...Array>} iteratees - The iteratees to sort by. + * @returns {T[]} Returns the new sorted array. + * + * @example + * const users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * sortBy(users, [function(o) { return o.user; }]); + * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ +declare function sortBy(collection: ArrayLike | null | undefined, ...iteratees: Array>>): T[]; +/** + * Creates an array of elements, sorted in ascending order by the results of running each element in a collection thru each iteratee. + * + * @template T + * @param {T | null | undefined} collection - The object to iterate over. + * @param {...Array | ObjectIteratee>} iteratees - The iteratees to sort by. + * @returns {Array} Returns the new sorted array. + * + * @example + * const users = { + * 'a': { 'user': 'fred', 'age': 48 }, + * 'b': { 'user': 'barney', 'age': 36 } + * }; + * + * sortBy(users, [function(o) { return o.user; }]); + * // => [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 48 }] + */ +declare function sortBy(collection: T | null | undefined, ...iteratees: Array>>): Array; +//#endregion +export { sortBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortBy.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortBy.js new file mode 100644 index 0000000000000000000000000000000000000000..f475602cbb2853982dd164371de2d95edca3a8f5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortBy.js @@ -0,0 +1,12 @@ +const require_flatten = require("../../array/flatten.js"); +const require_isIterateeCall = require("../_internal/isIterateeCall.js"); +const require_orderBy = require("./orderBy.js"); +//#region src/compat/array/sortBy.ts +function sortBy(collection, ...criteria) { + const length = criteria.length; + if (length > 1 && require_isIterateeCall.isIterateeCall(collection, criteria[0], criteria[1])) criteria = []; + else if (length > 2 && require_isIterateeCall.isIterateeCall(criteria[0], criteria[1], criteria[2])) criteria = [criteria[0]]; + return require_orderBy.orderBy(collection, require_flatten.flatten(criteria), ["asc"]); +} +//#endregion +exports.sortBy = sortBy; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortBy.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..98a4da582f6a1028a1ae01bcbf5a9a9d18c717a8 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortBy.mjs @@ -0,0 +1,12 @@ +import { flatten } from "../../array/flatten.mjs"; +import { isIterateeCall } from "../_internal/isIterateeCall.mjs"; +import { orderBy } from "./orderBy.mjs"; +//#region src/compat/array/sortBy.ts +function sortBy(collection, ...criteria) { + const length = criteria.length; + if (length > 1 && isIterateeCall(collection, criteria[0], criteria[1])) criteria = []; + else if (length > 2 && isIterateeCall(criteria[0], criteria[1], criteria[2])) criteria = [criteria[0]]; + return orderBy(collection, flatten(criteria), ["asc"]); +} +//#endregion +export { sortBy }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndex.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndex.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f548e60d54da59abaf66c20f54b0dc1674a6c915 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndex.d.mts @@ -0,0 +1,31 @@ +//#region src/compat/array/sortedIndex.d.ts +/** + * Uses a binary search to determine the lowest index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param {ArrayLike | null | undefined} array The sorted array to inspect. + * @param {T} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * sortedIndex([30, 50], 40) + * // => 1 + */ +declare function sortedIndex(array: ArrayLike | null | undefined, value: T): number; +/** + * Uses a binary search to determine the lowest index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param {ArrayLike | null | undefined} array The sorted array to inspect. + * @param {T} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * sortedIndex([30, 50], 40) + * // => 1 + */ +declare function sortedIndex(array: ArrayLike | null | undefined, value: T): number; +//#endregion +export { sortedIndex }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndex.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndex.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f548e60d54da59abaf66c20f54b0dc1674a6c915 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndex.d.ts @@ -0,0 +1,31 @@ +//#region src/compat/array/sortedIndex.d.ts +/** + * Uses a binary search to determine the lowest index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param {ArrayLike | null | undefined} array The sorted array to inspect. + * @param {T} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * sortedIndex([30, 50], 40) + * // => 1 + */ +declare function sortedIndex(array: ArrayLike | null | undefined, value: T): number; +/** + * Uses a binary search to determine the lowest index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param {ArrayLike | null | undefined} array The sorted array to inspect. + * @param {T} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * sortedIndex([30, 50], 40) + * // => 1 + */ +declare function sortedIndex(array: ArrayLike | null | undefined, value: T): number; +//#endregion +export { sortedIndex }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndex.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndex.js new file mode 100644 index 0000000000000000000000000000000000000000..144a7e7a733183e1915f9dfb0d86b089f1ed9743 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndex.js @@ -0,0 +1,36 @@ +const require_isNil = require("../../predicate/isNil.js"); +const require_isNull = require("../../predicate/isNull.js"); +const require_isSymbol = require("../../predicate/isSymbol.js"); +const require_sortedIndexBy = require("./sortedIndexBy.js"); +const require_isNumber = require("../predicate/isNumber.js"); +const HALF_MAX_ARRAY_LENGTH = 2147483647; +/** +* Uses a binary search to determine the lowest index at which `value` +* should be inserted into `array` in order to maintain its sort order. +* +* @category Array +* @param {ArrayLike | null | undefined} array The sorted array to inspect. +* @param {T} value The value to evaluate. +* @returns {number} Returns the index at which `value` should be inserted +* into `array`. +* @example +* sortedIndex([30, 50], 40) +* // => 1 +*/ +function sortedIndex(array, value) { + if (require_isNil.isNil(array)) return 0; + let low = 0; + let high = array.length; + if (require_isNumber.isNumber(value) && value === value && high <= HALF_MAX_ARRAY_LENGTH) { + while (low < high) { + const mid = low + high >>> 1; + const compute = array[mid]; + if (!require_isNull.isNull(compute) && !require_isSymbol.isSymbol(compute) && compute < value) low = mid + 1; + else high = mid; + } + return high; + } + return require_sortedIndexBy.sortedIndexBy(array, value, (value) => value); +} +//#endregion +exports.sortedIndex = sortedIndex; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndex.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndex.mjs new file mode 100644 index 0000000000000000000000000000000000000000..50b4da73362ac88a1cbb7d5d0e7022aaf7d5fdc2 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndex.mjs @@ -0,0 +1,36 @@ +import { isNil } from "../../predicate/isNil.mjs"; +import { isNull } from "../../predicate/isNull.mjs"; +import { isSymbol } from "../../predicate/isSymbol.mjs"; +import { sortedIndexBy } from "./sortedIndexBy.mjs"; +import { isNumber } from "../predicate/isNumber.mjs"; +const HALF_MAX_ARRAY_LENGTH = 2147483647; +/** +* Uses a binary search to determine the lowest index at which `value` +* should be inserted into `array` in order to maintain its sort order. +* +* @category Array +* @param {ArrayLike | null | undefined} array The sorted array to inspect. +* @param {T} value The value to evaluate. +* @returns {number} Returns the index at which `value` should be inserted +* into `array`. +* @example +* sortedIndex([30, 50], 40) +* // => 1 +*/ +function sortedIndex(array, value) { + if (isNil(array)) return 0; + let low = 0; + let high = array.length; + if (isNumber(value) && value === value && high <= HALF_MAX_ARRAY_LENGTH) { + while (low < high) { + const mid = low + high >>> 1; + const compute = array[mid]; + if (!isNull(compute) && !isSymbol(compute) && compute < value) low = mid + 1; + else high = mid; + } + return high; + } + return sortedIndexBy(array, value, (value) => value); +} +//#endregion +export { sortedIndex }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..172cca94e9c16e936a1b7058b7610842230ccc33 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.d.mts @@ -0,0 +1,26 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.mjs"; + +//#region src/compat/array/sortedIndexBy.d.ts +/** + * This method is like `sortedIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} array - The sorted array to inspect. + * @param {T} value - The value to evaluate. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted into `array`. + * + * @example + * const dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; + * sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); + * // => 1 + * + * @example + * sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 0 + */ +declare function sortedIndexBy(array: ArrayLike | null | undefined, value: T, iteratee?: ValueIteratee): number; +//#endregion +export { sortedIndexBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7a49b4217283fec8a50b846ce07ff09a3b946bd0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.d.ts @@ -0,0 +1,26 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.js"; + +//#region src/compat/array/sortedIndexBy.d.ts +/** + * This method is like `sortedIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} array - The sorted array to inspect. + * @param {T} value - The value to evaluate. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted into `array`. + * + * @example + * const dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; + * sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); + * // => 1 + * + * @example + * sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 0 + */ +declare function sortedIndexBy(array: ArrayLike | null | undefined, value: T, iteratee?: ValueIteratee): number; +//#endregion +export { sortedIndexBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.js new file mode 100644 index 0000000000000000000000000000000000000000..ba6e0b0b2f19ae2d140a0d248b5e8a1a7dd57dc4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.js @@ -0,0 +1,54 @@ +const require_isSymbol = require("../predicate/isSymbol.js"); +const require_isNull = require("../../predicate/isNull.js"); +const require_isUndefined = require("../../predicate/isUndefined.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_identity = require("../function/identity.js"); +const require_isNil = require("../predicate/isNil.js"); +const require_isNaN = require("../predicate/isNaN.js"); +const MAX_ARRAY_INDEX = 4294967294; +/** +* This method is like `sortedIndex` except that it accepts `iteratee` +* which is invoked for `value` and each element of `array` to compute their +* sort ranking. The iteratee is invoked with one argument: (value). +* +* @param {ArrayLike | null | undefined} array The sorted array to inspect. +* @param {T} value The value to evaluate. +* @param {(value: T) => R | PropertyName | [PropertyName, any] | Partial} iteratee The iteratee invoked per element. +* @returns {number} Returns the index at which `value` should be inserted +* into `array`. +* @example +* const objects = [{ 'n': 4 }, { 'n': 5 }] +* sortedIndexBy(objects, { 'n': 4 }, ({ n }) => n) +* // => 0 +*/ +function sortedIndexBy(array, value, iteratee$1 = require_identity.identity, retHighest) { + if (require_isNil.isNil(array) || array.length === 0) return 0; + let low = 0; + let high = array.length; + const iterateeFunction = require_iteratee.iteratee(iteratee$1); + const transformedValue = iterateeFunction(value); + const valIsNaN = require_isNaN.isNaN(transformedValue); + const valIsNull = require_isNull.isNull(transformedValue); + const valIsSymbol = require_isSymbol.isSymbol(transformedValue); + const valIsUndefined = require_isUndefined.isUndefined(transformedValue); + while (low < high) { + let setLow; + const mid = Math.floor((low + high) / 2); + const computed = iterateeFunction(array[mid]); + const othIsDefined = !require_isUndefined.isUndefined(computed); + const othIsNull = require_isNull.isNull(computed); + const othIsReflexive = !require_isNaN.isNaN(computed); + const othIsSymbol = require_isSymbol.isSymbol(computed); + if (valIsNaN) setLow = retHighest || othIsReflexive; + else if (valIsUndefined) setLow = othIsReflexive && (retHighest || othIsDefined); + else if (valIsNull) setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); + else if (valIsSymbol) setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); + else if (othIsNull || othIsSymbol) setLow = false; + else setLow = retHighest ? computed <= transformedValue : computed < transformedValue; + if (setLow) low = mid + 1; + else high = mid; + } + return Math.min(high, MAX_ARRAY_INDEX); +} +//#endregion +exports.sortedIndexBy = sortedIndexBy; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9999e8144b8f7fd847b4ca9e8f15e659c793df37 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.mjs @@ -0,0 +1,54 @@ +import { isSymbol } from "../predicate/isSymbol.mjs"; +import { isNull } from "../../predicate/isNull.mjs"; +import { isUndefined } from "../../predicate/isUndefined.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +import { identity } from "../function/identity.mjs"; +import { isNil } from "../predicate/isNil.mjs"; +import { isNaN } from "../predicate/isNaN.mjs"; +const MAX_ARRAY_INDEX = 4294967294; +/** +* This method is like `sortedIndex` except that it accepts `iteratee` +* which is invoked for `value` and each element of `array` to compute their +* sort ranking. The iteratee is invoked with one argument: (value). +* +* @param {ArrayLike | null | undefined} array The sorted array to inspect. +* @param {T} value The value to evaluate. +* @param {(value: T) => R | PropertyName | [PropertyName, any] | Partial} iteratee The iteratee invoked per element. +* @returns {number} Returns the index at which `value` should be inserted +* into `array`. +* @example +* const objects = [{ 'n': 4 }, { 'n': 5 }] +* sortedIndexBy(objects, { 'n': 4 }, ({ n }) => n) +* // => 0 +*/ +function sortedIndexBy(array, value, iteratee$1 = identity, retHighest) { + if (isNil(array) || array.length === 0) return 0; + let low = 0; + let high = array.length; + const iterateeFunction = iteratee(iteratee$1); + const transformedValue = iterateeFunction(value); + const valIsNaN = isNaN(transformedValue); + const valIsNull = isNull(transformedValue); + const valIsSymbol = isSymbol(transformedValue); + const valIsUndefined = isUndefined(transformedValue); + while (low < high) { + let setLow; + const mid = Math.floor((low + high) / 2); + const computed = iterateeFunction(array[mid]); + const othIsDefined = !isUndefined(computed); + const othIsNull = isNull(computed); + const othIsReflexive = !isNaN(computed); + const othIsSymbol = isSymbol(computed); + if (valIsNaN) setLow = retHighest || othIsReflexive; + else if (valIsUndefined) setLow = othIsReflexive && (retHighest || othIsDefined); + else if (valIsNull) setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); + else if (valIsSymbol) setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); + else if (othIsNull || othIsSymbol) setLow = false; + else setLow = retHighest ? computed <= transformedValue : computed < transformedValue; + if (setLow) low = mid + 1; + else high = mid; + } + return Math.min(high, MAX_ARRAY_INDEX); +} +//#endregion +export { sortedIndexBy }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f75dc6412e59a6782b052c1ee632680bfd9bb969 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.d.mts @@ -0,0 +1,35 @@ +//#region src/compat/array/sortedIndexOf.d.ts +/** + * Finds the index of the first occurrence of a value in a sorted array, similar to how `Array#indexOf` works, but specifically for sorted arrays. + * + * Make sure to provide a sorted array to this function, as it uses a binary search to quickly find the index. + * + * @param {ArrayLike | null | undefined} array The sorted array to inspect. + * @param {T} value The value to search for. + * @returns {number} Returns the index of the matched value, else -1. + * + * @example + * const numbers = [1, 2, 3, 4, 5]; + * sortedIndexOf(numbers, 11); // Return value: 0 + * sortedIndexOf(numbers, 30); // Return value: -1 + * + * // If the value is duplicated, it returns the first index of the value. + * const duplicateNumbers = [1, 2, 2, 3, 3, 3, 4]; + * sortedIndexOf(duplicateNumbers, 3); // Return value: 3 + * + * // If the array is unsorted, it can return the wrong index. + * const unSortedArray = [55, 33, 22, 11, 44]; + * sortedIndexOf(unSortedArray, 11); // Return value: -1 + * + * // -0 and 0 are treated the same + * const mixedZeroArray = [-0, 0]; + * sortedIndexOf(mixedZeroArray, 0); // Return value: 0 + * sortedIndexOf(mixedZeroArray, -0); // Return value: 0 + * + * // It works with array-like objects + * const arrayLike = { length: 3, 0: 10, 1: 20, 2: 30 }; + * sortedIndexOf(arrayLike, 20); // Return value: 1 + */ +declare function sortedIndexOf(array: ArrayLike | null | undefined, value: T): number; +//#endregion +export { sortedIndexOf }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f75dc6412e59a6782b052c1ee632680bfd9bb969 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.d.ts @@ -0,0 +1,35 @@ +//#region src/compat/array/sortedIndexOf.d.ts +/** + * Finds the index of the first occurrence of a value in a sorted array, similar to how `Array#indexOf` works, but specifically for sorted arrays. + * + * Make sure to provide a sorted array to this function, as it uses a binary search to quickly find the index. + * + * @param {ArrayLike | null | undefined} array The sorted array to inspect. + * @param {T} value The value to search for. + * @returns {number} Returns the index of the matched value, else -1. + * + * @example + * const numbers = [1, 2, 3, 4, 5]; + * sortedIndexOf(numbers, 11); // Return value: 0 + * sortedIndexOf(numbers, 30); // Return value: -1 + * + * // If the value is duplicated, it returns the first index of the value. + * const duplicateNumbers = [1, 2, 2, 3, 3, 3, 4]; + * sortedIndexOf(duplicateNumbers, 3); // Return value: 3 + * + * // If the array is unsorted, it can return the wrong index. + * const unSortedArray = [55, 33, 22, 11, 44]; + * sortedIndexOf(unSortedArray, 11); // Return value: -1 + * + * // -0 and 0 are treated the same + * const mixedZeroArray = [-0, 0]; + * sortedIndexOf(mixedZeroArray, 0); // Return value: 0 + * sortedIndexOf(mixedZeroArray, -0); // Return value: 0 + * + * // It works with array-like objects + * const arrayLike = { length: 3, 0: 10, 1: 20, 2: 30 }; + * sortedIndexOf(arrayLike, 20); // Return value: 1 + */ +declare function sortedIndexOf(array: ArrayLike | null | undefined, value: T): number; +//#endregion +export { sortedIndexOf }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.js new file mode 100644 index 0000000000000000000000000000000000000000..9ca356d98194d2e6a05afa772a55fa1c5e557eff --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.js @@ -0,0 +1,43 @@ +const require_isEqualsSameValueZero = require("../../_internal/isEqualsSameValueZero.js"); +require("../util/eq.js"); +const require_sortedIndex = require("./sortedIndex.js"); +//#region src/compat/array/sortedIndexOf.ts +/** +* Finds the index of the first occurrence of a value in a sorted array, similar to how `Array#indexOf` works, but specifically for sorted arrays. +* +* Make sure to provide a sorted array to this function, as it uses a binary search to quickly find the index. +* +* @param {ArrayLike | null | undefined} array The sorted array to inspect. +* @param {T} value The value to search for. +* @returns {number} Returns the index of the matched value, else -1. +* +* @example +* const numbers = [1, 2, 3, 4, 5]; +* sortedIndexOf(numbers, 11); // Return value: 0 +* sortedIndexOf(numbers, 30); // Return value: -1 +* +* // If the value is duplicated, it returns the first index of the value. +* const duplicateNumbers = [1, 2, 2, 3, 3, 3, 4]; +* sortedIndexOf(duplicateNumbers, 3); // Return value: 3 +* +* // If the array is unsorted, it can return the wrong index. +* const unSortedArray = [55, 33, 22, 11, 44]; +* sortedIndexOf(unSortedArray, 11); // Return value: -1 +* +* // -0 and 0 are treated the same +* const mixedZeroArray = [-0, 0]; +* sortedIndexOf(mixedZeroArray, 0); // Return value: 0 +* sortedIndexOf(mixedZeroArray, -0); // Return value: 0 +* +* // It works with array-like objects +* const arrayLike = { length: 3, 0: 10, 1: 20, 2: 30 }; +* sortedIndexOf(arrayLike, 20); // Return value: 1 +*/ +function sortedIndexOf(array, value) { + if (!array?.length) return -1; + const index = require_sortedIndex.sortedIndex(array, value); + if (index < array.length && require_isEqualsSameValueZero.isEqualsSameValueZero(array[index], value)) return index; + return -1; +} +//#endregion +exports.sortedIndexOf = sortedIndexOf; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9e5a7ecb6acffb74a02951263ab2f17142e02321 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedIndexOf.mjs @@ -0,0 +1,43 @@ +import { isEqualsSameValueZero } from "../../_internal/isEqualsSameValueZero.mjs"; +import "../util/eq.mjs"; +import { sortedIndex } from "./sortedIndex.mjs"; +//#region src/compat/array/sortedIndexOf.ts +/** +* Finds the index of the first occurrence of a value in a sorted array, similar to how `Array#indexOf` works, but specifically for sorted arrays. +* +* Make sure to provide a sorted array to this function, as it uses a binary search to quickly find the index. +* +* @param {ArrayLike | null | undefined} array The sorted array to inspect. +* @param {T} value The value to search for. +* @returns {number} Returns the index of the matched value, else -1. +* +* @example +* const numbers = [1, 2, 3, 4, 5]; +* sortedIndexOf(numbers, 11); // Return value: 0 +* sortedIndexOf(numbers, 30); // Return value: -1 +* +* // If the value is duplicated, it returns the first index of the value. +* const duplicateNumbers = [1, 2, 2, 3, 3, 3, 4]; +* sortedIndexOf(duplicateNumbers, 3); // Return value: 3 +* +* // If the array is unsorted, it can return the wrong index. +* const unSortedArray = [55, 33, 22, 11, 44]; +* sortedIndexOf(unSortedArray, 11); // Return value: -1 +* +* // -0 and 0 are treated the same +* const mixedZeroArray = [-0, 0]; +* sortedIndexOf(mixedZeroArray, 0); // Return value: 0 +* sortedIndexOf(mixedZeroArray, -0); // Return value: 0 +* +* // It works with array-like objects +* const arrayLike = { length: 3, 0: 10, 1: 20, 2: 30 }; +* sortedIndexOf(arrayLike, 20); // Return value: 1 +*/ +function sortedIndexOf(array, value) { + if (!array?.length) return -1; + const index = sortedIndex(array, value); + if (index < array.length && isEqualsSameValueZero(array[index], value)) return index; + return -1; +} +//#endregion +export { sortedIndexOf }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d4df5a0ffccb133bc2dc8927b8c15e00f5f7415d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.d.mts @@ -0,0 +1,17 @@ +//#region src/compat/array/sortedLastIndex.d.ts +/** + * Uses a binary search to determine the highest index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param {ArrayLike | null | undefined} array The sorted array to inspect. + * @param {T} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * sortedLastIndex([4, 5, 5, 5, 6], 5) + * // => 4 + */ +declare function sortedLastIndex(array: ArrayLike | null | undefined, value: T): number; +//#endregion +export { sortedLastIndex }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d4df5a0ffccb133bc2dc8927b8c15e00f5f7415d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.d.ts @@ -0,0 +1,17 @@ +//#region src/compat/array/sortedLastIndex.d.ts +/** + * Uses a binary search to determine the highest index at which `value` + * should be inserted into `array` in order to maintain its sort order. + * + * @category Array + * @param {ArrayLike | null | undefined} array The sorted array to inspect. + * @param {T} value The value to evaluate. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * sortedLastIndex([4, 5, 5, 5, 6], 5) + * // => 4 + */ +declare function sortedLastIndex(array: ArrayLike | null | undefined, value: T): number; +//#endregion +export { sortedLastIndex }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.js new file mode 100644 index 0000000000000000000000000000000000000000..e6bd328073bc995aaac88508119bf20e114ec425 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.js @@ -0,0 +1,34 @@ +const require_isNil = require("../../predicate/isNil.js"); +const require_isNull = require("../../predicate/isNull.js"); +const require_isSymbol = require("../../predicate/isSymbol.js"); +const require_isNumber = require("../predicate/isNumber.js"); +const require_sortedLastIndexBy = require("./sortedLastIndexBy.js"); +const HALF_MAX_ARRAY_LENGTH = 2147483647; +/** +* Uses a binary search to determine the highest index at which `value` +* should be inserted into `array` in order to maintain its sort order. +* +* @category Array +* @param {ArrayLike | null | undefined} array The sorted array to inspect. +* @param {T} value The value to evaluate. +* @returns {number} Returns the index at which `value` should be inserted +* into `array`. +* @example +* sortedLastIndex([4, 5, 5, 5, 6], 5) +* // => 4 +*/ +function sortedLastIndex(array, value) { + if (require_isNil.isNil(array)) return 0; + let high = array.length; + if (!require_isNumber.isNumber(value) || Number.isNaN(value) || high > HALF_MAX_ARRAY_LENGTH) return require_sortedLastIndexBy.sortedLastIndexBy(array, value, (value) => value); + let low = 0; + while (low < high) { + const mid = low + high >>> 1; + const compute = array[mid]; + if (!require_isNull.isNull(compute) && !require_isSymbol.isSymbol(compute) && compute <= value) low = mid + 1; + else high = mid; + } + return high; +} +//#endregion +exports.sortedLastIndex = sortedLastIndex; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2d6245af5462522f07a6917600f53271d1066830 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndex.mjs @@ -0,0 +1,34 @@ +import { isNil } from "../../predicate/isNil.mjs"; +import { isNull } from "../../predicate/isNull.mjs"; +import { isSymbol } from "../../predicate/isSymbol.mjs"; +import { isNumber } from "../predicate/isNumber.mjs"; +import { sortedLastIndexBy } from "./sortedLastIndexBy.mjs"; +const HALF_MAX_ARRAY_LENGTH = 2147483647; +/** +* Uses a binary search to determine the highest index at which `value` +* should be inserted into `array` in order to maintain its sort order. +* +* @category Array +* @param {ArrayLike | null | undefined} array The sorted array to inspect. +* @param {T} value The value to evaluate. +* @returns {number} Returns the index at which `value` should be inserted +* into `array`. +* @example +* sortedLastIndex([4, 5, 5, 5, 6], 5) +* // => 4 +*/ +function sortedLastIndex(array, value) { + if (isNil(array)) return 0; + let high = array.length; + if (!isNumber(value) || Number.isNaN(value) || high > HALF_MAX_ARRAY_LENGTH) return sortedLastIndexBy(array, value, (value) => value); + let low = 0; + while (low < high) { + const mid = low + high >>> 1; + const compute = array[mid]; + if (!isNull(compute) && !isSymbol(compute) && compute <= value) low = mid + 1; + else high = mid; + } + return high; +} +//#endregion +export { sortedLastIndex }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..9c407e7335cec380af6819852c0afeb24e53beab --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.d.mts @@ -0,0 +1,21 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.mjs"; + +//#region src/compat/array/sortedLastIndexBy.d.ts +/** + * This method is like `sortedLastIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} array - The sorted array to inspect. + * @param {T} value - The value to evaluate. + * @param {ValueIteratee} iteratee - The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted into `array`. + * + * @example + * sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 1 + */ +declare function sortedLastIndexBy(array: ArrayLike | null | undefined, value: T, iteratee: ValueIteratee): number; +//#endregion +export { sortedLastIndexBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cf8f1cf00557689a71acb3df965c73994f9b5f3f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.d.ts @@ -0,0 +1,21 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.js"; + +//#region src/compat/array/sortedLastIndexBy.d.ts +/** + * This method is like `sortedLastIndex` except that it accepts `iteratee` + * which is invoked for `value` and each element of `array` to compute their + * sort ranking. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} array - The sorted array to inspect. + * @param {T} value - The value to evaluate. + * @param {ValueIteratee} iteratee - The iteratee invoked per element. + * @returns {number} Returns the index at which `value` should be inserted into `array`. + * + * @example + * sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * // => 1 + */ +declare function sortedLastIndexBy(array: ArrayLike | null | undefined, value: T, iteratee: ValueIteratee): number; +//#endregion +export { sortedLastIndexBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.js new file mode 100644 index 0000000000000000000000000000000000000000..2bb35830ec35ddaacddbe76edba84953ae917141 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.js @@ -0,0 +1,22 @@ +const require_sortedIndexBy = require("./sortedIndexBy.js"); +//#region src/compat/array/sortedLastIndexBy.ts +/** +* This method is like `sortedLastIndex` except that it accepts `iteratee` +* which is invoked for `value` and each element of `array` to compute their +* sort ranking. The iteratee is invoked with one argument: (value). +* +* @param {ArrayLike | null | undefined} array The sorted array to inspect. +* @param {T} value The value to evaluate. +* @param {(value: T) => R | PropertyName | [PropertyName, any] | Partial} iteratee The iteratee invoked per element. +* @returns {number} Returns the highest index at which `value` should be inserted +* into `array`. +* @example +* const objects = [{ 'n': 4 }, { 'n': 5 }] +* sortedLastIndexBy(objects, { 'n': 4 }, ({ n }) => n) +* // => 1 +*/ +function sortedLastIndexBy(array, value, iteratee) { + return require_sortedIndexBy.sortedIndexBy(array, value, iteratee, true); +} +//#endregion +exports.sortedLastIndexBy = sortedLastIndexBy; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..cfb9bdd136770845332c88c11d043e0c60d8f5de --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexBy.mjs @@ -0,0 +1,22 @@ +import { sortedIndexBy } from "./sortedIndexBy.mjs"; +//#region src/compat/array/sortedLastIndexBy.ts +/** +* This method is like `sortedLastIndex` except that it accepts `iteratee` +* which is invoked for `value` and each element of `array` to compute their +* sort ranking. The iteratee is invoked with one argument: (value). +* +* @param {ArrayLike | null | undefined} array The sorted array to inspect. +* @param {T} value The value to evaluate. +* @param {(value: T) => R | PropertyName | [PropertyName, any] | Partial} iteratee The iteratee invoked per element. +* @returns {number} Returns the highest index at which `value` should be inserted +* into `array`. +* @example +* const objects = [{ 'n': 4 }, { 'n': 5 }] +* sortedLastIndexBy(objects, { 'n': 4 }, ({ n }) => n) +* // => 1 +*/ +function sortedLastIndexBy(array, value, iteratee) { + return sortedIndexBy(array, value, iteratee, true); +} +//#endregion +export { sortedLastIndexBy }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6b68788cd0c70b122fef2faecbdccd4fa304eb71 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.d.mts @@ -0,0 +1,36 @@ +//#region src/compat/array/sortedLastIndexOf.d.ts +/** + * Finds the index of the last occurrence of a value in a sorted array. + * This function is similar to `Array#lastIndexOf` but is specifically designed for sorted arrays. + * + * Make sure to provide a sorted array to this function, as it uses a binary search to quickly find the index. + * + * @param {ArrayLike | null | undefined} array The sorted array to inspect. + * @param {T} value The value to search for. + * @returns {number} Returns the index of the last matched value, else -1. + * + * @example + * const numbers = [1, 2, 3, 4, 5]; + * sortedLastIndexOf(numbers, 3); // Return value: 2 + * sortedLastIndexOf(numbers, 6); // Return value: -1 + * + * // If the value is duplicated, it returns the last index of the value. + * const duplicateNumbers = [1, 2, 2, 3, 3, 3, 4]; + * sortedLastIndexOf(duplicateNumbers, 3); // Return value: 5 + * + * // If the array is unsorted, it can return the wrong index. + * const unSortedArray = [55, 33, 22, 11, 44]; + * sortedLastIndexOf(unSortedArray, 11); // Return value: -1 + * + * // -0 and 0 are treated the same + * const mixedZeroArray = [-0, 0]; + * sortedLastIndexOf(mixedZeroArray, 0); // Return value: 1 + * sortedLastIndexOf(mixedZeroArray, -0); // Return value: 1 + * + * // It works with array-like objects + * const arrayLike = { length: 3, 0: 10, 1: 20, 2: 20 }; + * sortedLastIndexOf(arrayLike, 20); // Return value: 2 + */ +declare function sortedLastIndexOf(array: ArrayLike | null | undefined, value: T): number; +//#endregion +export { sortedLastIndexOf }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6b68788cd0c70b122fef2faecbdccd4fa304eb71 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.d.ts @@ -0,0 +1,36 @@ +//#region src/compat/array/sortedLastIndexOf.d.ts +/** + * Finds the index of the last occurrence of a value in a sorted array. + * This function is similar to `Array#lastIndexOf` but is specifically designed for sorted arrays. + * + * Make sure to provide a sorted array to this function, as it uses a binary search to quickly find the index. + * + * @param {ArrayLike | null | undefined} array The sorted array to inspect. + * @param {T} value The value to search for. + * @returns {number} Returns the index of the last matched value, else -1. + * + * @example + * const numbers = [1, 2, 3, 4, 5]; + * sortedLastIndexOf(numbers, 3); // Return value: 2 + * sortedLastIndexOf(numbers, 6); // Return value: -1 + * + * // If the value is duplicated, it returns the last index of the value. + * const duplicateNumbers = [1, 2, 2, 3, 3, 3, 4]; + * sortedLastIndexOf(duplicateNumbers, 3); // Return value: 5 + * + * // If the array is unsorted, it can return the wrong index. + * const unSortedArray = [55, 33, 22, 11, 44]; + * sortedLastIndexOf(unSortedArray, 11); // Return value: -1 + * + * // -0 and 0 are treated the same + * const mixedZeroArray = [-0, 0]; + * sortedLastIndexOf(mixedZeroArray, 0); // Return value: 1 + * sortedLastIndexOf(mixedZeroArray, -0); // Return value: 1 + * + * // It works with array-like objects + * const arrayLike = { length: 3, 0: 10, 1: 20, 2: 20 }; + * sortedLastIndexOf(arrayLike, 20); // Return value: 2 + */ +declare function sortedLastIndexOf(array: ArrayLike | null | undefined, value: T): number; +//#endregion +export { sortedLastIndexOf }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.js new file mode 100644 index 0000000000000000000000000000000000000000..c2137afaf80adba5e32940a44a1342dd5f6692fd --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.js @@ -0,0 +1,44 @@ +const require_isEqualsSameValueZero = require("../../_internal/isEqualsSameValueZero.js"); +require("../util/eq.js"); +const require_sortedLastIndex = require("./sortedLastIndex.js"); +//#region src/compat/array/sortedLastIndexOf.ts +/** +* Finds the index of the last occurrence of a value in a sorted array. +* This function is similar to `Array#lastIndexOf` but is specifically designed for sorted arrays. +* +* Make sure to provide a sorted array to this function, as it uses a binary search to quickly find the index. +* +* @param {ArrayLike | null | undefined} array The sorted array to inspect. +* @param {T} value The value to search for. +* @returns {number} Returns the index of the last matched value, else -1. +* +* @example +* const numbers = [1, 2, 3, 4, 5]; +* sortedLastIndexOf(numbers, 3); // Return value: 2 +* sortedLastIndexOf(numbers, 6); // Return value: -1 +* +* // If the value is duplicated, it returns the last index of the value. +* const duplicateNumbers = [1, 2, 2, 3, 3, 3, 4]; +* sortedLastIndexOf(duplicateNumbers, 3); // Return value: 5 +* +* // If the array is unsorted, it can return the wrong index. +* const unSortedArray = [55, 33, 22, 11, 44]; +* sortedLastIndexOf(unSortedArray, 11); // Return value: -1 +* +* // -0 and 0 are treated the same +* const mixedZeroArray = [-0, 0]; +* sortedLastIndexOf(mixedZeroArray, 0); // Return value: 1 +* sortedLastIndexOf(mixedZeroArray, -0); // Return value: 1 +* +* // It works with array-like objects +* const arrayLike = { length: 3, 0: 10, 1: 20, 2: 20 }; +* sortedLastIndexOf(arrayLike, 20); // Return value: 2 +*/ +function sortedLastIndexOf(array, value) { + if (!array?.length) return -1; + const index = require_sortedLastIndex.sortedLastIndex(array, value) - 1; + if (index >= 0 && require_isEqualsSameValueZero.isEqualsSameValueZero(array[index], value)) return index; + return -1; +} +//#endregion +exports.sortedLastIndexOf = sortedLastIndexOf; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.mjs new file mode 100644 index 0000000000000000000000000000000000000000..462741e19662f87b1285912a8e8dd83d94946e4f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/sortedLastIndexOf.mjs @@ -0,0 +1,44 @@ +import { isEqualsSameValueZero } from "../../_internal/isEqualsSameValueZero.mjs"; +import "../util/eq.mjs"; +import { sortedLastIndex } from "./sortedLastIndex.mjs"; +//#region src/compat/array/sortedLastIndexOf.ts +/** +* Finds the index of the last occurrence of a value in a sorted array. +* This function is similar to `Array#lastIndexOf` but is specifically designed for sorted arrays. +* +* Make sure to provide a sorted array to this function, as it uses a binary search to quickly find the index. +* +* @param {ArrayLike | null | undefined} array The sorted array to inspect. +* @param {T} value The value to search for. +* @returns {number} Returns the index of the last matched value, else -1. +* +* @example +* const numbers = [1, 2, 3, 4, 5]; +* sortedLastIndexOf(numbers, 3); // Return value: 2 +* sortedLastIndexOf(numbers, 6); // Return value: -1 +* +* // If the value is duplicated, it returns the last index of the value. +* const duplicateNumbers = [1, 2, 2, 3, 3, 3, 4]; +* sortedLastIndexOf(duplicateNumbers, 3); // Return value: 5 +* +* // If the array is unsorted, it can return the wrong index. +* const unSortedArray = [55, 33, 22, 11, 44]; +* sortedLastIndexOf(unSortedArray, 11); // Return value: -1 +* +* // -0 and 0 are treated the same +* const mixedZeroArray = [-0, 0]; +* sortedLastIndexOf(mixedZeroArray, 0); // Return value: 1 +* sortedLastIndexOf(mixedZeroArray, -0); // Return value: 1 +* +* // It works with array-like objects +* const arrayLike = { length: 3, 0: 10, 1: 20, 2: 20 }; +* sortedLastIndexOf(arrayLike, 20); // Return value: 2 +*/ +function sortedLastIndexOf(array, value) { + if (!array?.length) return -1; + const index = sortedLastIndex(array, value) - 1; + if (index >= 0 && isEqualsSameValueZero(array[index], value)) return index; + return -1; +} +//#endregion +export { sortedLastIndexOf }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/tail.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/tail.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b37491d2be1385185a13cdcd9b9eb0433b2d86b2 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/tail.d.mts @@ -0,0 +1,27 @@ +//#region src/compat/array/tail.d.ts +/** + * Gets all but the first element of array. + * + * @template T + * @param {readonly [unknown, ...T]} array - The array to query. + * @returns {T} Returns the slice of array. + * + * @example + * tail([1, 2, 3]); + * // => [2, 3] + */ +declare function tail(array: readonly [unknown, ...T]): T; +/** + * Gets all but the first element of array. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to query. + * @returns {T[]} Returns the slice of array. + * + * @example + * tail([1, 2, 3]); + * // => [2, 3] + */ +declare function tail(array: ArrayLike | null | undefined): T[]; +//#endregion +export { tail }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/tail.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/tail.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b37491d2be1385185a13cdcd9b9eb0433b2d86b2 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/tail.d.ts @@ -0,0 +1,27 @@ +//#region src/compat/array/tail.d.ts +/** + * Gets all but the first element of array. + * + * @template T + * @param {readonly [unknown, ...T]} array - The array to query. + * @returns {T} Returns the slice of array. + * + * @example + * tail([1, 2, 3]); + * // => [2, 3] + */ +declare function tail(array: readonly [unknown, ...T]): T; +/** + * Gets all but the first element of array. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to query. + * @returns {T[]} Returns the slice of array. + * + * @example + * tail([1, 2, 3]); + * // => [2, 3] + */ +declare function tail(array: ArrayLike | null | undefined): T[]; +//#endregion +export { tail }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/tail.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/tail.js new file mode 100644 index 0000000000000000000000000000000000000000..24d2920ccd2232870be77914652d2e5c559a88d3 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/tail.js @@ -0,0 +1,34 @@ +const require_tail = require("../../array/tail.js"); +const require_toArray = require("../_internal/toArray.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +//#region src/compat/array/tail.ts +/** +* Returns a new array with all elements except for the first. +* +* This function takes an array and returns a new array containing all the elements +* except for the first one. If the input array is empty or has only one element, +* an empty array is returned. +* +* @template T - The type of elements in the array. +* @param {ArrayLike | null | undefined} arr - The array to get the tail of. +* @returns {T[]} A new array containing all elements of the input array except for the first one. +* +* @example +* const arr1 = [1, 2, 3]; +* const result = tail(arr1); +* // result will be [2, 3] +* +* const arr2 = [1]; +* const result2 = tail(arr2); +* // result2 will be [] +* +* const arr3 = []; +* const result3 = tail(arr3); +* // result3 will be [] +*/ +function tail(arr) { + if (!require_isArrayLike.isArrayLike(arr)) return []; + return require_tail.tail(require_toArray.toArray(arr)); +} +//#endregion +exports.tail = tail; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/tail.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/tail.mjs new file mode 100644 index 0000000000000000000000000000000000000000..714b90c4ea4c1eea2157392b0c3a160f7d71f920 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/tail.mjs @@ -0,0 +1,34 @@ +import { tail as tail$1 } from "../../array/tail.mjs"; +import { toArray } from "../_internal/toArray.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +//#region src/compat/array/tail.ts +/** +* Returns a new array with all elements except for the first. +* +* This function takes an array and returns a new array containing all the elements +* except for the first one. If the input array is empty or has only one element, +* an empty array is returned. +* +* @template T - The type of elements in the array. +* @param {ArrayLike | null | undefined} arr - The array to get the tail of. +* @returns {T[]} A new array containing all elements of the input array except for the first one. +* +* @example +* const arr1 = [1, 2, 3]; +* const result = tail(arr1); +* // result will be [2, 3] +* +* const arr2 = [1]; +* const result2 = tail(arr2); +* // result2 will be [] +* +* const arr3 = []; +* const result3 = tail(arr3); +* // result3 will be [] +*/ +function tail(arr) { + if (!isArrayLike(arr)) return []; + return tail$1(toArray(arr)); +} +//#endregion +export { tail }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/take.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/take.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c0fdd8d1cc09adc850c317ab98bd7e40ce8e463c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/take.d.mts @@ -0,0 +1,28 @@ +//#region src/compat/array/take.d.ts +/** + * Creates a slice of array with n elements taken from the beginning. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to query. + * @param {number} [n=1] - The number of elements to take. + * @returns {T[]} Returns the slice of array. + * + * @example + * take([1, 2, 3]); + * // => [1] + * + * @example + * take([1, 2, 3], 2); + * // => [1, 2] + * + * @example + * take([1, 2, 3], 5); + * // => [1, 2, 3] + * + * @example + * take([1, 2, 3], 0); + * // => [] + */ +declare function take(array: ArrayLike | null | undefined, n?: number): T[]; +//#endregion +export { take }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/take.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/take.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c0fdd8d1cc09adc850c317ab98bd7e40ce8e463c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/take.d.ts @@ -0,0 +1,28 @@ +//#region src/compat/array/take.d.ts +/** + * Creates a slice of array with n elements taken from the beginning. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to query. + * @param {number} [n=1] - The number of elements to take. + * @returns {T[]} Returns the slice of array. + * + * @example + * take([1, 2, 3]); + * // => [1] + * + * @example + * take([1, 2, 3], 2); + * // => [1, 2] + * + * @example + * take([1, 2, 3], 5); + * // => [1, 2, 3] + * + * @example + * take([1, 2, 3], 0); + * // => [] + */ +declare function take(array: ArrayLike | null | undefined, n?: number): T[]; +//#endregion +export { take }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/take.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/take.js new file mode 100644 index 0000000000000000000000000000000000000000..b64704ebd21245e15626a4a25a563b3af7472522 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/take.js @@ -0,0 +1,35 @@ +const require_toInteger = require("../util/toInteger.js"); +const require_take = require("../../array/take.js"); +const require_toArray = require("../_internal/toArray.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +//#region src/compat/array/take.ts +/** +* Returns a new array containing the first `count` elements from the input array `arr`. +* If `count` is greater than the length of `arr`, the entire array is returned. +* +* @template T - Type of elements in the input array. +* +* @param {ArrayLike | null | undefined} arr - The array to take elements from. +* @param {number} [count=1] - The number of elements to take. +* @param {unknown} [guard] - Enables use as an iteratee for methods like `_.map`. +* @returns {T[]} A new array containing the first `count` elements from `arr`. +* +* @example +* // Returns [1, 2, 3] +* take([1, 2, 3, 4, 5], 3); +* +* @example +* // Returns ['a', 'b'] +* take(['a', 'b', 'c'], 2); +* +* @example +* // Returns [1, 2, 3] +* take([1, 2, 3], 5); +*/ +function take(arr, count = 1, guard) { + count = guard ? 1 : require_toInteger.toInteger(count); + if (count < 1 || !require_isArrayLike.isArrayLike(arr)) return []; + return require_take.take(require_toArray.toArray(arr), count); +} +//#endregion +exports.take = take; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/take.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/take.mjs new file mode 100644 index 0000000000000000000000000000000000000000..eb6aed6c5198c652ff805a0fd05383ce699fcfdc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/take.mjs @@ -0,0 +1,35 @@ +import { toInteger } from "../util/toInteger.mjs"; +import { take as take$1 } from "../../array/take.mjs"; +import { toArray } from "../_internal/toArray.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +//#region src/compat/array/take.ts +/** +* Returns a new array containing the first `count` elements from the input array `arr`. +* If `count` is greater than the length of `arr`, the entire array is returned. +* +* @template T - Type of elements in the input array. +* +* @param {ArrayLike | null | undefined} arr - The array to take elements from. +* @param {number} [count=1] - The number of elements to take. +* @param {unknown} [guard] - Enables use as an iteratee for methods like `_.map`. +* @returns {T[]} A new array containing the first `count` elements from `arr`. +* +* @example +* // Returns [1, 2, 3] +* take([1, 2, 3, 4, 5], 3); +* +* @example +* // Returns ['a', 'b'] +* take(['a', 'b', 'c'], 2); +* +* @example +* // Returns [1, 2, 3] +* take([1, 2, 3], 5); +*/ +function take(arr, count = 1, guard) { + count = guard ? 1 : toInteger(count); + if (count < 1 || !isArrayLike(arr)) return []; + return take$1(toArray(arr), count); +} +//#endregion +export { take }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRight.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRight.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..30a043ada40f356ae84bce07b6ef3e16810bcad1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRight.d.mts @@ -0,0 +1,28 @@ +//#region src/compat/array/takeRight.d.ts +/** + * Creates a slice of array with n elements taken from the end. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to query. + * @param {number} [n=1] - The number of elements to take. + * @returns {T[]} Returns the slice of array. + * + * @example + * takeRight([1, 2, 3]); + * // => [3] + * + * @example + * takeRight([1, 2, 3], 2); + * // => [2, 3] + * + * @example + * takeRight([1, 2, 3], 5); + * // => [1, 2, 3] + * + * @example + * takeRight([1, 2, 3], 0); + * // => [] + */ +declare function takeRight(array: ArrayLike | null | undefined, n?: number): T[]; +//#endregion +export { takeRight }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRight.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..30a043ada40f356ae84bce07b6ef3e16810bcad1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRight.d.ts @@ -0,0 +1,28 @@ +//#region src/compat/array/takeRight.d.ts +/** + * Creates a slice of array with n elements taken from the end. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to query. + * @param {number} [n=1] - The number of elements to take. + * @returns {T[]} Returns the slice of array. + * + * @example + * takeRight([1, 2, 3]); + * // => [3] + * + * @example + * takeRight([1, 2, 3], 2); + * // => [2, 3] + * + * @example + * takeRight([1, 2, 3], 5); + * // => [1, 2, 3] + * + * @example + * takeRight([1, 2, 3], 0); + * // => [] + */ +declare function takeRight(array: ArrayLike | null | undefined, n?: number): T[]; +//#endregion +export { takeRight }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRight.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRight.js new file mode 100644 index 0000000000000000000000000000000000000000..157191edb2b2d934261e148b0f755408c13af29a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRight.js @@ -0,0 +1,34 @@ +const require_toInteger = require("../util/toInteger.js"); +const require_takeRight = require("../../array/takeRight.js"); +const require_toArray = require("../_internal/toArray.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +//#region src/compat/array/takeRight.ts +/** +* Returns a new array containing the last `count` elements from the input array `arr`. +* If `count` is greater than the length of `arr`, the entire array is returned. +* +* @template T - The type of elements in the array. +* @param {ArrayLike | null | undefined} arr - The array to take elements from. +* @param {number} [count=1] - The number of elements to take. +* @param {unknown} [guard] - Enables use as an iteratee for methods like `_.map`. +* @returns {T[]} A new array containing the last `count` elements from `arr`. +* +* @example +* // Returns [4, 5] +* takeRight([1, 2, 3, 4, 5], 2); +* +* @example +* // Returns ['b', 'c'] +* takeRight(['a', 'b', 'c'], 2); +* +* @example +* // Returns [1, 2, 3] +* takeRight([1, 2, 3], 5); +*/ +function takeRight(arr, count = 1, guard) { + count = guard ? 1 : require_toInteger.toInteger(count); + if (count <= 0 || !require_isArrayLike.isArrayLike(arr)) return []; + return require_takeRight.takeRight(require_toArray.toArray(arr), count); +} +//#endregion +exports.takeRight = takeRight; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRight.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRight.mjs new file mode 100644 index 0000000000000000000000000000000000000000..73ebbd5612e9e5c71ecdebbd29abbaa375ed5145 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRight.mjs @@ -0,0 +1,34 @@ +import { toInteger } from "../util/toInteger.mjs"; +import { takeRight as takeRight$1 } from "../../array/takeRight.mjs"; +import { toArray } from "../_internal/toArray.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +//#region src/compat/array/takeRight.ts +/** +* Returns a new array containing the last `count` elements from the input array `arr`. +* If `count` is greater than the length of `arr`, the entire array is returned. +* +* @template T - The type of elements in the array. +* @param {ArrayLike | null | undefined} arr - The array to take elements from. +* @param {number} [count=1] - The number of elements to take. +* @param {unknown} [guard] - Enables use as an iteratee for methods like `_.map`. +* @returns {T[]} A new array containing the last `count` elements from `arr`. +* +* @example +* // Returns [4, 5] +* takeRight([1, 2, 3, 4, 5], 2); +* +* @example +* // Returns ['b', 'c'] +* takeRight(['a', 'b', 'c'], 2); +* +* @example +* // Returns [1, 2, 3] +* takeRight([1, 2, 3], 5); +*/ +function takeRight(arr, count = 1, guard) { + count = guard ? 1 : toInteger(count); + if (count <= 0 || !isArrayLike(arr)) return []; + return takeRight$1(toArray(arr), count); +} +//#endregion +export { takeRight }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRightWhile.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRightWhile.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..4f32727aad2c640bc721765d1f87194d22ae1240 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRightWhile.d.mts @@ -0,0 +1,37 @@ +import { ListIteratee } from "../_internal/ListIteratee.mjs"; + +//#region src/compat/array/takeRightWhile.d.ts +/** + * Creates a slice of array with elements taken from the end. Elements are taken until predicate + * returns falsey. The predicate is invoked with three arguments: (value, index, array). + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to query. + * @param {ListIteratee} [predicate] - The function invoked per iteration. + * @returns {T[]} Returns the slice of array. + * + * @example + * const users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * takeRightWhile(users, function(o) { return !o.active; }); + * // => objects for ['fred', 'pebbles'] + * + * @example + * takeRightWhile(users, { 'user': 'pebbles', 'active': false }); + * // => objects for ['pebbles'] + * + * @example + * takeRightWhile(users, ['active', false]); + * // => objects for ['fred', 'pebbles'] + * + * @example + * takeRightWhile(users, 'active'); + * // => [] + */ +declare function takeRightWhile(array: ArrayLike | null | undefined, predicate?: ListIteratee): T[]; +//#endregion +export { takeRightWhile }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRightWhile.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRightWhile.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..78c7cd011ce76148c571b9b3255620e2ba7a4c15 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRightWhile.d.ts @@ -0,0 +1,37 @@ +import { ListIteratee } from "../_internal/ListIteratee.js"; + +//#region src/compat/array/takeRightWhile.d.ts +/** + * Creates a slice of array with elements taken from the end. Elements are taken until predicate + * returns falsey. The predicate is invoked with three arguments: (value, index, array). + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to query. + * @param {ListIteratee} [predicate] - The function invoked per iteration. + * @returns {T[]} Returns the slice of array. + * + * @example + * const users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * takeRightWhile(users, function(o) { return !o.active; }); + * // => objects for ['fred', 'pebbles'] + * + * @example + * takeRightWhile(users, { 'user': 'pebbles', 'active': false }); + * // => objects for ['pebbles'] + * + * @example + * takeRightWhile(users, ['active', false]); + * // => objects for ['fred', 'pebbles'] + * + * @example + * takeRightWhile(users, 'active'); + * // => [] + */ +declare function takeRightWhile(array: ArrayLike | null | undefined, predicate?: ListIteratee): T[]; +//#endregion +export { takeRightWhile }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRightWhile.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRightWhile.js new file mode 100644 index 0000000000000000000000000000000000000000..e913781c6ea65ce35f94a1d98b1c03d91d54480c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRightWhile.js @@ -0,0 +1,59 @@ +const require_identity = require("../../function/identity.js"); +const require_negate = require("../../function/negate.js"); +const require_toArray = require("../_internal/toArray.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +//#region src/compat/array/takeRightWhile.ts +/** +* Creates a slice of the array with elements taken from the end while the specified predicate is satisfied. +* If no predicate is provided, the identity function is used by default. +* If the array is `null` or `undefined`, returns an empty array. +* +* @template T +* @param {ArrayLike | null | undefined} array - The array to process. +* @param {(item: T, index: number, array: T[]) => unknown | Partial | [keyof T, unknown] | PropertyKey} [predicate] - The condition used to determine elements to include. Can be: +* - A function invoked per iteration. +* - A partial object to match properties. +* - A key-value pair as a tuple. +* - A property key to check for truthy values. +* Defaults to the identity function if not provided. +* @returns {T[]} - A slice of the array with elements taken from the end or an empty array if `array` is `null` or `undefined`. +* +* @example +* // Using a predicate function +* const items = [1, 2, 3, 4, 5]; +* const result = takeRightWhile(items, (item) => item > 3); +* console.log(result); // [4, 5] +* +* // Using a partial object +* const items2 = [{ id: 10 }, { id: 20 }, { id: 30 }]; +* const result2 = takeRightWhile(items2, { id: 30 }); +* console.log(result2); // [{ id: 30 }] +* +* // Using a key-value pair +* const items3 = [{ name: 'Alice' }, { name: 'Bob' }, { name: 'Alice' }]; +* const result3 = takeRightWhile(items3, ['name', 'Alice']); +* console.log(result3); // [{ name: 'Alice' }] +* +* // Using a property key +* const items4 = [{ active: false }, { active: true }, { active: true }]; +* const result4 = takeRightWhile(items4, 'active'); +* console.log(result4); // [{ active: true }, { active: true }] +* +* // No predicate provided +* const items5 = [false, true]; +* const result5 = takeRightWhile(items5); +* console.log(result5); // [true] +* +* // null or undefined array +* const result6 = takeRightWhile(null); +* console.log(result6); // [] +*/ +function takeRightWhile(_array, predicate) { + if (!require_isArrayLikeObject.isArrayLikeObject(_array)) return []; + const array = require_toArray.toArray(_array); + const index = array.findLastIndex(require_negate.negate(require_iteratee.iteratee(predicate ?? require_identity.identity))); + return array.slice(index + 1); +} +//#endregion +exports.takeRightWhile = takeRightWhile; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRightWhile.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRightWhile.mjs new file mode 100644 index 0000000000000000000000000000000000000000..1a24dd76527aac4995070c3233b70fdedeac9d45 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeRightWhile.mjs @@ -0,0 +1,59 @@ +import { identity } from "../../function/identity.mjs"; +import { negate } from "../../function/negate.mjs"; +import { toArray } from "../_internal/toArray.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +//#region src/compat/array/takeRightWhile.ts +/** +* Creates a slice of the array with elements taken from the end while the specified predicate is satisfied. +* If no predicate is provided, the identity function is used by default. +* If the array is `null` or `undefined`, returns an empty array. +* +* @template T +* @param {ArrayLike | null | undefined} array - The array to process. +* @param {(item: T, index: number, array: T[]) => unknown | Partial | [keyof T, unknown] | PropertyKey} [predicate] - The condition used to determine elements to include. Can be: +* - A function invoked per iteration. +* - A partial object to match properties. +* - A key-value pair as a tuple. +* - A property key to check for truthy values. +* Defaults to the identity function if not provided. +* @returns {T[]} - A slice of the array with elements taken from the end or an empty array if `array` is `null` or `undefined`. +* +* @example +* // Using a predicate function +* const items = [1, 2, 3, 4, 5]; +* const result = takeRightWhile(items, (item) => item > 3); +* console.log(result); // [4, 5] +* +* // Using a partial object +* const items2 = [{ id: 10 }, { id: 20 }, { id: 30 }]; +* const result2 = takeRightWhile(items2, { id: 30 }); +* console.log(result2); // [{ id: 30 }] +* +* // Using a key-value pair +* const items3 = [{ name: 'Alice' }, { name: 'Bob' }, { name: 'Alice' }]; +* const result3 = takeRightWhile(items3, ['name', 'Alice']); +* console.log(result3); // [{ name: 'Alice' }] +* +* // Using a property key +* const items4 = [{ active: false }, { active: true }, { active: true }]; +* const result4 = takeRightWhile(items4, 'active'); +* console.log(result4); // [{ active: true }, { active: true }] +* +* // No predicate provided +* const items5 = [false, true]; +* const result5 = takeRightWhile(items5); +* console.log(result5); // [true] +* +* // null or undefined array +* const result6 = takeRightWhile(null); +* console.log(result6); // [] +*/ +function takeRightWhile(_array, predicate) { + if (!isArrayLikeObject(_array)) return []; + const array = toArray(_array); + const index = array.findLastIndex(negate(iteratee(predicate ?? identity))); + return array.slice(index + 1); +} +//#endregion +export { takeRightWhile }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/takeWhile.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeWhile.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..eceb33851ada07e802932d082feedfceed5ba725 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeWhile.d.mts @@ -0,0 +1,37 @@ +import { ListIteratee } from "../_internal/ListIteratee.mjs"; + +//#region src/compat/array/takeWhile.d.ts +/** + * Creates a slice of array with elements taken from the beginning. Elements are taken until predicate + * returns falsey. The predicate is invoked with three arguments: (value, index, array). + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to query. + * @param {ListIteratee} [predicate] - The function invoked per iteration. + * @returns {T[]} Returns the slice of array. + * + * @example + * const users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * takeWhile(users, function(o) { return !o.active; }); + * // => objects for ['barney', 'fred'] + * + * @example + * takeWhile(users, { 'user': 'barney', 'active': false }); + * // => objects for ['barney'] + * + * @example + * takeWhile(users, ['active', false]); + * // => objects for ['barney', 'fred'] + * + * @example + * takeWhile(users, 'active'); + * // => [] + */ +declare function takeWhile(array: ArrayLike | null | undefined, predicate?: ListIteratee): T[]; +//#endregion +export { takeWhile }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/takeWhile.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeWhile.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1a74268cf9e8233b2075312f73dcce98e903145e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeWhile.d.ts @@ -0,0 +1,37 @@ +import { ListIteratee } from "../_internal/ListIteratee.js"; + +//#region src/compat/array/takeWhile.d.ts +/** + * Creates a slice of array with elements taken from the beginning. Elements are taken until predicate + * returns falsey. The predicate is invoked with three arguments: (value, index, array). + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to query. + * @param {ListIteratee} [predicate] - The function invoked per iteration. + * @returns {T[]} Returns the slice of array. + * + * @example + * const users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * takeWhile(users, function(o) { return !o.active; }); + * // => objects for ['barney', 'fred'] + * + * @example + * takeWhile(users, { 'user': 'barney', 'active': false }); + * // => objects for ['barney'] + * + * @example + * takeWhile(users, ['active', false]); + * // => objects for ['barney', 'fred'] + * + * @example + * takeWhile(users, 'active'); + * // => [] + */ +declare function takeWhile(array: ArrayLike | null | undefined, predicate?: ListIteratee): T[]; +//#endregion +export { takeWhile }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/takeWhile.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeWhile.js new file mode 100644 index 0000000000000000000000000000000000000000..99f7aebe30cbe1c637ccb03302dfe31e8e09a153 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeWhile.js @@ -0,0 +1,59 @@ +const require_toArray = require("../_internal/toArray.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +const require_identity = require("../function/identity.js"); +const require_negate = require("../function/negate.js"); +//#region src/compat/array/takeWhile.ts +/** +* Creates a slice of the array with elements taken from the beginning while the specified predicate is satisfied. +* If no predicate is provided, the identity function is used by default. +* If the array is `null` or `undefined`, returns an empty array. +* +* @template T +* @param {ArrayLike | null | undefined} array - The array to process. +* @param {(item: T, index: number, array: T[]) => unknown | Partial | [keyof T, unknown] | PropertyKey} [predicate] - The condition used to determine elements to include. Can be: +* - A function invoked per iteration. +* - A partial object to match properties. +* - A key-value pair as a tuple. +* - A property key to check for truthy values. +* Defaults to the identity function if not provided. +* @returns {T[]} - A slice of the array with elements taken from the beginning or an empty array if `array` is `null` or `undefined`. +* +* @example +* // Using a predicate function +* const items = [1, 2, 3, 4, 5]; +* const result = takeWhile(items, (item) => item < 3); +* console.log(result); // [1, 2] +* +* // Using a partial object +* const items2 = [{ id: 30 }, { id: 20 }, { id: 10 }]; +* const result2 = takeWhile(items2, { id: 30 }); +* console.log(result2); // [{ id: 30 }] +* +* // Using a key-value pair +* const items3 = [{ name: 'Alice' }, { name: 'Bob' }, { name: 'Alice' }]; +* const result3 = takeWhile(items3, ['name', 'Alice']); +* console.log(result3); // [{ name: 'Alice' }] +* +* // Using a property key +* const items4 = [{ active: true }, { active: true }, { active: false }]; +* const result4 = takeWhile(items4, 'active'); +* console.log(result4); // [{ active: true }, { active: true }] +* +* // No predicate provided +* const items5 = [true, false]; +* const result5 = takeWhile(items5); +* console.log(result5); // [true] +* +* // null or undefined array +* const result6 = takeWhile(null); +* console.log(result6); // [] +**/ +function takeWhile(array, predicate) { + if (!require_isArrayLikeObject.isArrayLikeObject(array)) return []; + const _array = require_toArray.toArray(array); + const index = _array.findIndex(require_negate.negate(require_iteratee.iteratee(predicate ?? require_identity.identity))); + return index === -1 ? _array : _array.slice(0, index); +} +//#endregion +exports.takeWhile = takeWhile; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/takeWhile.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeWhile.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b29c0445e2b9020779a9e19d11cd75255cbefb79 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/takeWhile.mjs @@ -0,0 +1,59 @@ +import { toArray } from "../_internal/toArray.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +import { identity } from "../function/identity.mjs"; +import { negate } from "../function/negate.mjs"; +//#region src/compat/array/takeWhile.ts +/** +* Creates a slice of the array with elements taken from the beginning while the specified predicate is satisfied. +* If no predicate is provided, the identity function is used by default. +* If the array is `null` or `undefined`, returns an empty array. +* +* @template T +* @param {ArrayLike | null | undefined} array - The array to process. +* @param {(item: T, index: number, array: T[]) => unknown | Partial | [keyof T, unknown] | PropertyKey} [predicate] - The condition used to determine elements to include. Can be: +* - A function invoked per iteration. +* - A partial object to match properties. +* - A key-value pair as a tuple. +* - A property key to check for truthy values. +* Defaults to the identity function if not provided. +* @returns {T[]} - A slice of the array with elements taken from the beginning or an empty array if `array` is `null` or `undefined`. +* +* @example +* // Using a predicate function +* const items = [1, 2, 3, 4, 5]; +* const result = takeWhile(items, (item) => item < 3); +* console.log(result); // [1, 2] +* +* // Using a partial object +* const items2 = [{ id: 30 }, { id: 20 }, { id: 10 }]; +* const result2 = takeWhile(items2, { id: 30 }); +* console.log(result2); // [{ id: 30 }] +* +* // Using a key-value pair +* const items3 = [{ name: 'Alice' }, { name: 'Bob' }, { name: 'Alice' }]; +* const result3 = takeWhile(items3, ['name', 'Alice']); +* console.log(result3); // [{ name: 'Alice' }] +* +* // Using a property key +* const items4 = [{ active: true }, { active: true }, { active: false }]; +* const result4 = takeWhile(items4, 'active'); +* console.log(result4); // [{ active: true }, { active: true }] +* +* // No predicate provided +* const items5 = [true, false]; +* const result5 = takeWhile(items5); +* console.log(result5); // [true] +* +* // null or undefined array +* const result6 = takeWhile(null); +* console.log(result6); // [] +**/ +function takeWhile(array, predicate) { + if (!isArrayLikeObject(array)) return []; + const _array = toArray(array); + const index = _array.findIndex(negate(iteratee(predicate ?? identity))); + return index === -1 ? _array : _array.slice(0, index); +} +//#endregion +export { takeWhile }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/union.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/union.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0f65dd9a9917a05bd1474a67f71f538d02091546 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/union.d.mts @@ -0,0 +1,31 @@ +//#region src/compat/array/union.d.ts +/** + * This function takes multiple arrays and returns a new array containing only the unique values + * from all input arrays, preserving the order of their first occurrence. + * + * @template T - The type of elements in the arrays. + * @param {Array | null | undefined>} arrays - The arrays to inspect. + * @returns {T[]} Returns the new array of combined unique values. + * + * @example + * // Returns [2, 1] + * union([2], [1, 2]); + * + * @example + * // Returns [2, 1, 3] + * union([2], [1, 2], [2, 3]); + * + * @example + * // Returns [1, 3, 2, [5], [4]] (does not deeply flatten nested arrays) + * union([1, 3, 2], [1, [5]], [2, [4]]); + * + * @example + * // Returns [0, 2, 1] (ignores non-array values like 3 and { '0': 1 }) + * union([0], 3, { '0': 1 }, null, [2, 1]); + * @example + * // Returns [0, 'a', 2, 1] (treats array-like object { 0: 'a', length: 1 } as a valid array) + * union([0], { 0: 'a', length: 1 }, [2, 1]); + */ +declare function union(...arrays: Array | null | undefined>): T[]; +//#endregion +export { union }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/union.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/union.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0f65dd9a9917a05bd1474a67f71f538d02091546 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/union.d.ts @@ -0,0 +1,31 @@ +//#region src/compat/array/union.d.ts +/** + * This function takes multiple arrays and returns a new array containing only the unique values + * from all input arrays, preserving the order of their first occurrence. + * + * @template T - The type of elements in the arrays. + * @param {Array | null | undefined>} arrays - The arrays to inspect. + * @returns {T[]} Returns the new array of combined unique values. + * + * @example + * // Returns [2, 1] + * union([2], [1, 2]); + * + * @example + * // Returns [2, 1, 3] + * union([2], [1, 2], [2, 3]); + * + * @example + * // Returns [1, 3, 2, [5], [4]] (does not deeply flatten nested arrays) + * union([1, 3, 2], [1, [5]], [2, [4]]); + * + * @example + * // Returns [0, 2, 1] (ignores non-array values like 3 and { '0': 1 }) + * union([0], 3, { '0': 1 }, null, [2, 1]); + * @example + * // Returns [0, 'a', 2, 1] (treats array-like object { 0: 'a', length: 1 } as a valid array) + * union([0], { 0: 'a', length: 1 }, [2, 1]); + */ +declare function union(...arrays: Array | null | undefined>): T[]; +//#endregion +export { union }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/union.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/union.js new file mode 100644 index 0000000000000000000000000000000000000000..5689f70d043b80ba4f4d6298b569adef761804e4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/union.js @@ -0,0 +1,38 @@ +const require_uniq = require("../../array/uniq.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +const require_flatMapDepth = require("./flatMapDepth.js"); +//#region src/compat/array/union.ts +/** +* This function takes multiple arrays and returns a new array containing only the unique values +* from all input arrays, preserving the order of their first occurrence. +* +* @template T - The type of elements in the arrays. +* @param {Array | null | undefined>} arrays - The arrays to inspect. +* @returns {T[]} Returns the new array of combined unique values. +* +* @example +* // Returns [2, 1] +* union([2], [1, 2]); +* +* @example +* // Returns [2, 1, 3] +* union([2], [1, 2], [2, 3]); +* +* @example +* // Returns [1, 3, 2, [5], [4]] (does not deeply flatten nested arrays) +* union([1, 3, 2], [1, [5]], [2, [4]]); +* +* @example +* // Returns [0, 2, 1] (ignores non-array values like 3 and { '0': 1 }) +* union([0], 3, { '0': 1 }, null, [2, 1]); +* @example +* // Returns [0, 'a', 2, 1] (treats array-like object { 0: 'a', length: 1 } as a valid array) +* union([0], { 0: 'a', length: 1 }, [2, 1]); +*/ +function union(...arrays) { + const validArrays = arrays.filter(require_isArrayLikeObject.isArrayLikeObject); + const flattened = require_flatMapDepth.flatMapDepth(validArrays, (v) => Array.from(v), 1); + return require_uniq.uniq(flattened); +} +//#endregion +exports.union = union; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/union.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/union.mjs new file mode 100644 index 0000000000000000000000000000000000000000..48a6a6911f2bad52941c047b8efd072f69efc94a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/union.mjs @@ -0,0 +1,36 @@ +import { uniq } from "../../array/uniq.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +import { flatMapDepth } from "./flatMapDepth.mjs"; +//#region src/compat/array/union.ts +/** +* This function takes multiple arrays and returns a new array containing only the unique values +* from all input arrays, preserving the order of their first occurrence. +* +* @template T - The type of elements in the arrays. +* @param {Array | null | undefined>} arrays - The arrays to inspect. +* @returns {T[]} Returns the new array of combined unique values. +* +* @example +* // Returns [2, 1] +* union([2], [1, 2]); +* +* @example +* // Returns [2, 1, 3] +* union([2], [1, 2], [2, 3]); +* +* @example +* // Returns [1, 3, 2, [5], [4]] (does not deeply flatten nested arrays) +* union([1, 3, 2], [1, [5]], [2, [4]]); +* +* @example +* // Returns [0, 2, 1] (ignores non-array values like 3 and { '0': 1 }) +* union([0], 3, { '0': 1 }, null, [2, 1]); +* @example +* // Returns [0, 'a', 2, 1] (treats array-like object { 0: 'a', length: 1 } as a valid array) +* union([0], { 0: 'a', length: 1 }, [2, 1]); +*/ +function union(...arrays) { + return uniq(flatMapDepth(arrays.filter(isArrayLikeObject), (v) => Array.from(v), 1)); +} +//#endregion +export { union }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/unionBy.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/unionBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..1a527ba0c5880d4642e2ab21811942f960a505db --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/unionBy.d.mts @@ -0,0 +1,94 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.mjs"; + +//#region src/compat/array/unionBy.d.ts +/** + * This method is like `union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The arrays to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionBy([2.1], [1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * @example + * unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ +declare function unionBy(arrays: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays1 - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionBy([2.1], [1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + */ +declare function unionBy(arrays1: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays1 - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionBy([2.1], [1.2, 2.3], [3.4], Math.floor); + * // => [2.1, 1.2, 3.4] + */ +declare function unionBy(arrays1: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays1 - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {ArrayLike | null | undefined} arrays4 - The fourth array to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionBy([2.1], [1.2, 2.3], [3.4], [4.5], Math.floor); + * // => [2.1, 1.2, 3.4, 4.5] + */ +declare function unionBy(arrays1: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, arrays4: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays1 - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {ArrayLike | null | undefined} arrays4 - The fourth array to inspect. + * @param {ArrayLike | null | undefined} arrays5 - The fifth array to inspect. + * @param {...Array | ArrayLike | null | undefined>} iteratee - The iteratee invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionBy([2.1], [1.2, 2.3], [3.4], [4.5], [5.6], Math.floor); + * // => [2.1, 1.2, 3.4, 4.5, 5.6] + */ +declare function unionBy(arrays1: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, arrays4: ArrayLike | null | undefined, arrays5: ArrayLike | null | undefined, ...iteratee: Array | ArrayLike | null | undefined>): T[]; +//#endregion +export { unionBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/unionBy.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/unionBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d9e76c2239b65168665e26329830e46df8a47894 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/unionBy.d.ts @@ -0,0 +1,94 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.js"; + +//#region src/compat/array/unionBy.d.ts +/** + * This method is like `union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The arrays to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionBy([2.1], [1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + * + * @example + * unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ +declare function unionBy(arrays: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays1 - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionBy([2.1], [1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + */ +declare function unionBy(arrays1: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays1 - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionBy([2.1], [1.2, 2.3], [3.4], Math.floor); + * // => [2.1, 1.2, 3.4] + */ +declare function unionBy(arrays1: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays1 - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {ArrayLike | null | undefined} arrays4 - The fourth array to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionBy([2.1], [1.2, 2.3], [3.4], [4.5], Math.floor); + * // => [2.1, 1.2, 3.4, 4.5] + */ +declare function unionBy(arrays1: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, arrays4: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `union` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays1 - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {ArrayLike | null | undefined} arrays4 - The fourth array to inspect. + * @param {ArrayLike | null | undefined} arrays5 - The fifth array to inspect. + * @param {...Array | ArrayLike | null | undefined>} iteratee - The iteratee invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionBy([2.1], [1.2, 2.3], [3.4], [4.5], [5.6], Math.floor); + * // => [2.1, 1.2, 3.4, 4.5, 5.6] + */ +declare function unionBy(arrays1: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, arrays4: ArrayLike | null | undefined, arrays5: ArrayLike | null | undefined, ...iteratee: Array | ArrayLike | null | undefined>): T[]; +//#endregion +export { unionBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/unionBy.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/unionBy.js new file mode 100644 index 0000000000000000000000000000000000000000..542b4d2c23f2ef884dd071042b474fd12396639e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/unionBy.js @@ -0,0 +1,37 @@ +const require_last = require("../../array/last.js"); +const require_uniq = require("../../array/uniq.js"); +const require_uniqBy = require("../../array/uniqBy.js"); +const require_ary = require("../../function/ary.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +const require_flattenArrayLike = require("../_internal/flattenArrayLike.js"); +//#region src/compat/array/unionBy.ts +/** +* This function takes multiple arrays and returns a new array containing only the unique values +* from all input arrays, preserving the order of their first occurrence. +* An iteratee function can be provided for comparison and it output values from the first possible array +* +* @template T - The type of elements in the arrays. +* @param {...(ArrayLike | null | undefined | Iteratee)} values - The arrays to inspect, or the iteratee function. +* @returns {T[]} Returns the new array of combined unique values. +* +* @example +* // Returns [2.1, 1.2] +* unionBy([2.1], [1.2, 2.3], Math.floor); +* +* @example +* // Returns [{ x: 1 }, { x: 2 }] +* unionBy([{ x: 1 }], [{ x: 2 }, { x: 1 }], 'x'); +* +* @example +* // Returns [{ x: 1, y: 1 }] +* unionBy([{ x: 1, y: 1 }], [{ x: 1, y: 2 }], 'x'); +*/ +function unionBy(...values) { + const lastValue = require_last.last(values); + const flattened = require_flattenArrayLike.flattenArrayLike(values); + if (require_isArrayLikeObject.isArrayLikeObject(lastValue) || lastValue == null) return require_uniq.uniq(flattened); + return require_uniqBy.uniqBy(flattened, require_ary.ary(require_iteratee.iteratee(lastValue), 1)); +} +//#endregion +exports.unionBy = unionBy; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/unionBy.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/unionBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5c335e9b94080b9f827389e2e526de84ef980d80 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/unionBy.mjs @@ -0,0 +1,37 @@ +import { last } from "../../array/last.mjs"; +import { uniq } from "../../array/uniq.mjs"; +import { uniqBy } from "../../array/uniqBy.mjs"; +import { ary } from "../../function/ary.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +import { flattenArrayLike } from "../_internal/flattenArrayLike.mjs"; +//#region src/compat/array/unionBy.ts +/** +* This function takes multiple arrays and returns a new array containing only the unique values +* from all input arrays, preserving the order of their first occurrence. +* An iteratee function can be provided for comparison and it output values from the first possible array +* +* @template T - The type of elements in the arrays. +* @param {...(ArrayLike | null | undefined | Iteratee)} values - The arrays to inspect, or the iteratee function. +* @returns {T[]} Returns the new array of combined unique values. +* +* @example +* // Returns [2.1, 1.2] +* unionBy([2.1], [1.2, 2.3], Math.floor); +* +* @example +* // Returns [{ x: 1 }, { x: 2 }] +* unionBy([{ x: 1 }], [{ x: 2 }, { x: 1 }], 'x'); +* +* @example +* // Returns [{ x: 1, y: 1 }] +* unionBy([{ x: 1, y: 1 }], [{ x: 1, y: 2 }], 'x'); +*/ +function unionBy(...values) { + const lastValue = last(values); + const flattened = flattenArrayLike(values); + if (isArrayLikeObject(lastValue) || lastValue == null) return uniq(flattened); + return uniqBy(flattened, ary(iteratee(lastValue), 1)); +} +//#endregion +export { unionBy }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/unionWith.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/unionWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b3cf22582428afabefea5d656cbafa903c5c83e0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/unionWith.d.mts @@ -0,0 +1,53 @@ +//#region src/compat/array/unionWith.d.ts +/** + * This method is like `union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The arrays to inspect. + * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * unionWith(objects, others, isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ +declare function unionWith(arrays: ArrayLike | null | undefined, comparator?: (a: T, b: T) => boolean): T[]; +/** + * This method is like `union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionWith([1, 2], [2, 3], (a, b) => a === b); + * // => [1, 2, 3] + */ +declare function unionWith(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, comparator?: (a: T, b: T) => boolean): T[]; +/** + * This method is like `union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {...Array<(a: T, b: T) => boolean | ArrayLike | null | undefined>} comparator - The comparator invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionWith([1], [2], [3], (a, b) => a === b); + * // => [1, 2, 3] + */ +declare function unionWith(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, ...comparator: Array<((a: T, b: T) => boolean) | ArrayLike | null | undefined>): T[]; +//#endregion +export { unionWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/unionWith.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/unionWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b3cf22582428afabefea5d656cbafa903c5c83e0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/unionWith.d.ts @@ -0,0 +1,53 @@ +//#region src/compat/array/unionWith.d.ts +/** + * This method is like `union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The arrays to inspect. + * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * unionWith(objects, others, isEqual); + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ +declare function unionWith(arrays: ArrayLike | null | undefined, comparator?: (a: T, b: T) => boolean): T[]; +/** + * This method is like `union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionWith([1, 2], [2, 3], (a, b) => a === b); + * // => [1, 2, 3] + */ +declare function unionWith(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, comparator?: (a: T, b: T) => boolean): T[]; +/** + * This method is like `union` except that it accepts `comparator` which + * is invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {...Array<(a: T, b: T) => boolean | ArrayLike | null | undefined>} comparator - The comparator invoked per element. + * @returns {T[]} Returns the new array of combined values. + * + * @example + * unionWith([1], [2], [3], (a, b) => a === b); + * // => [1, 2, 3] + */ +declare function unionWith(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, ...comparator: Array<((a: T, b: T) => boolean) | ArrayLike | null | undefined>): T[]; +//#endregion +export { unionWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/unionWith.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/unionWith.js new file mode 100644 index 0000000000000000000000000000000000000000..f2d23a8cb7c21e5414c8f18b7227a22b5bf678f3 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/unionWith.js @@ -0,0 +1,41 @@ +const require_last = require("../../array/last.js"); +const require_uniq = require("../../array/uniq.js"); +const require_uniqWith = require("../../array/uniqWith.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +const require_flattenArrayLike = require("../_internal/flattenArrayLike.js"); +//#region src/compat/array/unionWith.ts +/** +* This function takes multiple arrays and returns a new array containing only the unique values +* from all input arrays, preserving the order of their first occurrence. +* A comparator function can be provided for comparison and it output values from the first possible array +* +* @template T - The type of elements in the arrays. +* @param {...(ArrayLike | null | undefined | Comparator)} values - The arrays to inspect, or the comparator function. +* @returns {T[]} Returns the new array of combined unique values. +* +* @example +* const objects = [ +* { x: 1, y: 2 }, +* { x: 2, y: 1 }, +* ]; +* const others = [ +* { x: 1, y: 1 }, +* { x: 1, y: 2 }, +* ]; +* // Returns [objects[0], objects[1], others[0]] +* unionWith(objects, others, isEqual); +* +* @example +* const objects = [{ x: 1, y: 1 }]; +* const others = [{ x: 1, y: 2 }]; +* // Returns [{ x: 1, y: 1 }] +* unionWith(objects, others, (a, b) => a.x === b.x); +*/ +function unionWith(...values) { + const lastValue = require_last.last(values); + const flattened = require_flattenArrayLike.flattenArrayLike(values); + if (require_isArrayLikeObject.isArrayLikeObject(lastValue) || lastValue == null) return require_uniq.uniq(flattened); + return require_uniqWith.uniqWith(flattened, lastValue); +} +//#endregion +exports.unionWith = unionWith; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/unionWith.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/unionWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..677de95a326aed31177e95cc8de9041352768eec --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/unionWith.mjs @@ -0,0 +1,41 @@ +import { last } from "../../array/last.mjs"; +import { uniq } from "../../array/uniq.mjs"; +import { uniqWith } from "../../array/uniqWith.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +import { flattenArrayLike } from "../_internal/flattenArrayLike.mjs"; +//#region src/compat/array/unionWith.ts +/** +* This function takes multiple arrays and returns a new array containing only the unique values +* from all input arrays, preserving the order of their first occurrence. +* A comparator function can be provided for comparison and it output values from the first possible array +* +* @template T - The type of elements in the arrays. +* @param {...(ArrayLike | null | undefined | Comparator)} values - The arrays to inspect, or the comparator function. +* @returns {T[]} Returns the new array of combined unique values. +* +* @example +* const objects = [ +* { x: 1, y: 2 }, +* { x: 2, y: 1 }, +* ]; +* const others = [ +* { x: 1, y: 1 }, +* { x: 1, y: 2 }, +* ]; +* // Returns [objects[0], objects[1], others[0]] +* unionWith(objects, others, isEqual); +* +* @example +* const objects = [{ x: 1, y: 1 }]; +* const others = [{ x: 1, y: 2 }]; +* // Returns [{ x: 1, y: 1 }] +* unionWith(objects, others, (a, b) => a.x === b.x); +*/ +function unionWith(...values) { + const lastValue = last(values); + const flattened = flattenArrayLike(values); + if (isArrayLikeObject(lastValue) || lastValue == null) return uniq(flattened); + return uniqWith(flattened, lastValue); +} +//#endregion +export { unionWith }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/uniq.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniq.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..5020f4f956c3bd9099a3bae442bd888ab0ee0ac6 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniq.d.mts @@ -0,0 +1,19 @@ +//#region src/compat/array/uniq.d.ts +/** + * Creates a duplicate-free version of an array. + * + * This function takes an array and returns a new array containing only the unique values + * from the original array, preserving the order of first occurrence. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} arr - The array to process. + * @returns {T[]} A new array with only unique values from the original array. + * + * @example + * const array = [1, 2, 2, 3, 4, 4, 5]; + * const result = uniq(array); + * // result will be [1, 2, 3, 4, 5] + */ +declare function uniq(arr: ArrayLike | null | undefined): T[]; +//#endregion +export { uniq }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/uniq.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniq.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5020f4f956c3bd9099a3bae442bd888ab0ee0ac6 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniq.d.ts @@ -0,0 +1,19 @@ +//#region src/compat/array/uniq.d.ts +/** + * Creates a duplicate-free version of an array. + * + * This function takes an array and returns a new array containing only the unique values + * from the original array, preserving the order of first occurrence. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} arr - The array to process. + * @returns {T[]} A new array with only unique values from the original array. + * + * @example + * const array = [1, 2, 2, 3, 4, 4, 5]; + * const result = uniq(array); + * // result will be [1, 2, 3, 4, 5] + */ +declare function uniq(arr: ArrayLike | null | undefined): T[]; +//#endregion +export { uniq }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/uniq.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniq.js new file mode 100644 index 0000000000000000000000000000000000000000..5473d1da03fc49a5fa69d12779e4ab5b421a0838 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniq.js @@ -0,0 +1,24 @@ +const require_uniq = require("../../array/uniq.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +//#region src/compat/array/uniq.ts +/** +* Creates a duplicate-free version of an array. +* +* This function takes an array and returns a new array containing only the unique values +* from the original array, preserving the order of first occurrence. +* +* @template T - The type of elements in the array. +* @param {ArrayLike | null | undefined} arr - The array to process. +* @returns {T[]} A new array with only unique values from the original array. +* +* @example +* const array = [1, 2, 2, 3, 4, 4, 5]; +* const result = uniq(array); +* // result will be [1, 2, 3, 4, 5] +*/ +function uniq(arr) { + if (!require_isArrayLike.isArrayLike(arr)) return []; + return require_uniq.uniq(Array.from(arr)); +} +//#endregion +exports.uniq = uniq; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/uniq.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniq.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7c1b7efe38eafbfd96bb65f5a355d8188355156a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniq.mjs @@ -0,0 +1,24 @@ +import { uniq as uniq$1 } from "../../array/uniq.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +//#region src/compat/array/uniq.ts +/** +* Creates a duplicate-free version of an array. +* +* This function takes an array and returns a new array containing only the unique values +* from the original array, preserving the order of first occurrence. +* +* @template T - The type of elements in the array. +* @param {ArrayLike | null | undefined} arr - The array to process. +* @returns {T[]} A new array with only unique values from the original array. +* +* @example +* const array = [1, 2, 2, 3, 4, 4, 5]; +* const result = uniq(array); +* // result will be [1, 2, 3, 4, 5] +*/ +function uniq(arr) { + if (!isArrayLike(arr)) return []; + return uniq$1(Array.from(arr)); +} +//#endregion +export { uniq }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqBy.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..fc6ffa87e884a26b6ca49b88a1f3eec74c00e5b0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqBy.d.mts @@ -0,0 +1,18 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.mjs"; + +//#region src/compat/array/uniqBy.d.ts +/** + * Creates a duplicate-free version of an array, using an optional transform function. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to inspect. + * @param {ValueIteratee} iteratee - The transform function or property name to get values from. + * @returns {T[]} Returns the new duplicate-free array. + * + * @example + * uniqBy([2.1, 1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + */ +declare function uniqBy(array: ArrayLike | null | undefined, iteratee: ValueIteratee): T[]; +//#endregion +export { uniqBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqBy.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..71ed99ff026aa9364dc8e79bf326e3c56423a7d6 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqBy.d.ts @@ -0,0 +1,18 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.js"; + +//#region src/compat/array/uniqBy.d.ts +/** + * Creates a duplicate-free version of an array, using an optional transform function. + * + * @template T + * @param {ArrayLike | null | undefined} array - The array to inspect. + * @param {ValueIteratee} iteratee - The transform function or property name to get values from. + * @returns {T[]} Returns the new duplicate-free array. + * + * @example + * uniqBy([2.1, 1.2, 2.3], Math.floor); + * // => [2.1, 1.2] + */ +declare function uniqBy(array: ArrayLike | null | undefined, iteratee: ValueIteratee): T[]; +//#endregion +export { uniqBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqBy.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqBy.js new file mode 100644 index 0000000000000000000000000000000000000000..caf1d3179b6ac0432985634dc5ade202398aca1d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqBy.js @@ -0,0 +1,12 @@ +const require_uniqBy = require("../../array/uniqBy.js"); +const require_ary = require("../../function/ary.js"); +const require_identity = require("../../function/identity.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +//#region src/compat/array/uniqBy.ts +function uniqBy(array, iteratee$1 = require_identity.identity) { + if (!require_isArrayLikeObject.isArrayLikeObject(array)) return []; + return require_uniqBy.uniqBy(Array.from(array), require_ary.ary(require_iteratee.iteratee(iteratee$1), 1)); +} +//#endregion +exports.uniqBy = uniqBy; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqBy.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..0252c4b803c1bc1eb9bb286263850497c7882260 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqBy.mjs @@ -0,0 +1,12 @@ +import { uniqBy as uniqBy$1 } from "../../array/uniqBy.mjs"; +import { ary } from "../../function/ary.mjs"; +import { identity } from "../../function/identity.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +//#region src/compat/array/uniqBy.ts +function uniqBy(array, iteratee$1 = identity) { + if (!isArrayLikeObject(array)) return []; + return uniqBy$1(Array.from(array), ary(iteratee(iteratee$1), 1)); +} +//#endregion +export { uniqBy }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqWith.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..157ba7577f6e036543211ac7694a24a1c62f3581 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqWith.d.mts @@ -0,0 +1,28 @@ +//#region src/compat/array/uniqWith.d.ts +type Comparator = (a: T, b: T) => boolean; +/** + * This method is like `uniq`, except that it accepts a `comparator` which is used to determine the equality of elements. + * + * It creates a duplicate-free version of an array, in which only the first occurrence of each element is kept. + * If a `comparator` is provided, it will be invoked with two arguments: `(arrVal, othVal)` to compare elements. + * If no comparator is provided, shallow equality is used. + * + * The order of result values is determined by the order they appear in the input array. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} arr - The array to process. + * @param {Comparator} [comparator] - Optional function to compare elements for equality. + * @returns {T[]} A new array with only unique values based on the comparator. + * + * @example + * const array = [1, 2, 2, 3]; + * const result = uniqWith(array); + * // result will be [1, 2, 3] + * + * const array = [1, 2, 3]; + * const result = uniqWith(array, (a, b) => a % 2 === b % 2) + * // result will be [1, 2] + */ +declare function uniqWith(arr: ArrayLike | null | undefined, comparator?: Comparator): T[]; +//#endregion +export { uniqWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqWith.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..157ba7577f6e036543211ac7694a24a1c62f3581 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqWith.d.ts @@ -0,0 +1,28 @@ +//#region src/compat/array/uniqWith.d.ts +type Comparator = (a: T, b: T) => boolean; +/** + * This method is like `uniq`, except that it accepts a `comparator` which is used to determine the equality of elements. + * + * It creates a duplicate-free version of an array, in which only the first occurrence of each element is kept. + * If a `comparator` is provided, it will be invoked with two arguments: `(arrVal, othVal)` to compare elements. + * If no comparator is provided, shallow equality is used. + * + * The order of result values is determined by the order they appear in the input array. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} arr - The array to process. + * @param {Comparator} [comparator] - Optional function to compare elements for equality. + * @returns {T[]} A new array with only unique values based on the comparator. + * + * @example + * const array = [1, 2, 2, 3]; + * const result = uniqWith(array); + * // result will be [1, 2, 3] + * + * const array = [1, 2, 3]; + * const result = uniqWith(array, (a, b) => a % 2 === b % 2) + * // result will be [1, 2] + */ +declare function uniqWith(arr: ArrayLike | null | undefined, comparator?: Comparator): T[]; +//#endregion +export { uniqWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqWith.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqWith.js new file mode 100644 index 0000000000000000000000000000000000000000..6db9046f54db8f2f2ecccd2fb3861f5137d7f533 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqWith.js @@ -0,0 +1,34 @@ +const require_uniqWith = require("../../array/uniqWith.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_uniq = require("./uniq.js"); +//#region src/compat/array/uniqWith.ts +/** +* This method is like `uniq`, except that it accepts a `comparator` which is used to determine the equality of elements. +* +* It creates a duplicate-free version of an array, in which only the first occurrence of each element is kept. +* If a `comparator` is provided, it will be invoked with two arguments: `(arrVal, othVal)` to compare elements. +* If no comparator is provided, shallow equality is used. +* +* The order of result values is determined by the order they appear in the input array. +* +* @template T - The type of elements in the array. +* @param {ArrayLike | null | undefined} arr - The array to process. +* @param {Comparator} [comparator] - Optional function to compare elements for equality. +* @returns {T[]} A new array with only unique values based on the comparator. +* +* @example +* const array = [1, 2, 2, 3]; +* const result = uniqWith(array); +* // result will be [1, 2, 3] +* +* const array = [1, 2, 3]; +* const result = uniqWith(array, (a, b) => a % 2 === b % 2) +* // result will be [1, 2] +*/ +function uniqWith(arr, comparator) { + if (!require_isArrayLike.isArrayLike(arr)) return []; + if (typeof comparator !== "function") return require_uniq.uniq(Array.from(arr)); + return require_uniqWith.uniqWith(Array.from(arr), (kept, candidate) => comparator(candidate, kept)); +} +//#endregion +exports.uniqWith = uniqWith; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqWith.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9bd0e242191584ce4f407e6da0cb3a7faaf75f8c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/uniqWith.mjs @@ -0,0 +1,34 @@ +import { uniqWith as uniqWith$1 } from "../../array/uniqWith.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { uniq } from "./uniq.mjs"; +//#region src/compat/array/uniqWith.ts +/** +* This method is like `uniq`, except that it accepts a `comparator` which is used to determine the equality of elements. +* +* It creates a duplicate-free version of an array, in which only the first occurrence of each element is kept. +* If a `comparator` is provided, it will be invoked with two arguments: `(arrVal, othVal)` to compare elements. +* If no comparator is provided, shallow equality is used. +* +* The order of result values is determined by the order they appear in the input array. +* +* @template T - The type of elements in the array. +* @param {ArrayLike | null | undefined} arr - The array to process. +* @param {Comparator} [comparator] - Optional function to compare elements for equality. +* @returns {T[]} A new array with only unique values based on the comparator. +* +* @example +* const array = [1, 2, 2, 3]; +* const result = uniqWith(array); +* // result will be [1, 2, 3] +* +* const array = [1, 2, 3]; +* const result = uniqWith(array, (a, b) => a % 2 === b % 2) +* // result will be [1, 2] +*/ +function uniqWith(arr, comparator) { + if (!isArrayLike(arr)) return []; + if (typeof comparator !== "function") return uniq(Array.from(arr)); + return uniqWith$1(Array.from(arr), (kept, candidate) => comparator(candidate, kept)); +} +//#endregion +export { uniqWith }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/unzip.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/unzip.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a2dee5c5fe5003613bfedbe93bbef95008b33169 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/unzip.d.mts @@ -0,0 +1,17 @@ +//#region src/compat/array/unzip.d.ts +/** + * Gathers elements in the same position in an internal array + * from a grouped array of elements and returns them as a new array. + * + * @template T - The type of elements in the nested array. + * @param {T[][] | ArrayLike> | null | undefined} array - The nested array to unzip. + * @returns {T[][]} A new array of unzipped elements. + * + * @example + * const zipped = [['a', true, 1],['b', false, 2]]; + * const result = unzip(zipped); + * // result will be [['a', 'b'], [true, false], [1, 2]] + */ +declare function unzip(array: T[][] | ArrayLike> | null | undefined): T[][]; +//#endregion +export { unzip }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/unzip.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/unzip.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a2dee5c5fe5003613bfedbe93bbef95008b33169 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/unzip.d.ts @@ -0,0 +1,17 @@ +//#region src/compat/array/unzip.d.ts +/** + * Gathers elements in the same position in an internal array + * from a grouped array of elements and returns them as a new array. + * + * @template T - The type of elements in the nested array. + * @param {T[][] | ArrayLike> | null | undefined} array - The nested array to unzip. + * @returns {T[][]} A new array of unzipped elements. + * + * @example + * const zipped = [['a', true, 1],['b', false, 2]]; + * const result = unzip(zipped); + * // result will be [['a', 'b'], [true, false], [1, 2]] + */ +declare function unzip(array: T[][] | ArrayLike> | null | undefined): T[][]; +//#endregion +export { unzip }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/unzip.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/unzip.js new file mode 100644 index 0000000000000000000000000000000000000000..2e004a627941e6e0ff446fea93c1caf79cd12b27 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/unzip.js @@ -0,0 +1,25 @@ +const require_unzip = require("../../array/unzip.js"); +const require_isArray = require("../predicate/isArray.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +//#region src/compat/array/unzip.ts +/** +* Gathers elements in the same position in an internal array +* from a grouped array of elements and returns them as a new array. +* +* @template T - The type of elements in the nested array. +* @param {T[][] | ArrayLike> | null | undefined} array - The nested array to unzip. +* @returns {T[][]} A new array of unzipped elements. +* +* @example +* const zipped = [['a', true, 1],['b', false, 2]]; +* const result = unzip(zipped); +* // result will be [['a', 'b'], [true, false], [1, 2]] +*/ +function unzip(array) { + if (!require_isArrayLikeObject.isArrayLikeObject(array) || !array.length) return []; + array = require_isArray.isArray(array) ? array : Array.from(array); + array = array.filter((item) => require_isArrayLikeObject.isArrayLikeObject(item)); + return require_unzip.unzip(array); +} +//#endregion +exports.unzip = unzip; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/unzip.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/unzip.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9924e6389cab150b156e895acc4c0ce530e2ad22 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/unzip.mjs @@ -0,0 +1,25 @@ +import { unzip as unzip$1 } from "../../array/unzip.mjs"; +import { isArray } from "../predicate/isArray.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +//#region src/compat/array/unzip.ts +/** +* Gathers elements in the same position in an internal array +* from a grouped array of elements and returns them as a new array. +* +* @template T - The type of elements in the nested array. +* @param {T[][] | ArrayLike> | null | undefined} array - The nested array to unzip. +* @returns {T[][]} A new array of unzipped elements. +* +* @example +* const zipped = [['a', true, 1],['b', false, 2]]; +* const result = unzip(zipped); +* // result will be [['a', 'b'], [true, false], [1, 2]] +*/ +function unzip(array) { + if (!isArrayLikeObject(array) || !array.length) return []; + array = isArray(array) ? array : Array.from(array); + array = array.filter((item) => isArrayLikeObject(item)); + return unzip$1(array); +} +//#endregion +export { unzip }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/unzipWith.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/unzipWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0c2f8433813df9b0f2624711d4f7ccceb660b9c9 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/unzipWith.d.mts @@ -0,0 +1,31 @@ +//#region src/compat/array/unzipWith.d.ts +/** + * This method is like `unzip` except that it accepts an iteratee to specify + * how regrouped values should be combined. The iteratee is invoked with the + * elements of each group: (...group). + * + * @template T, R + * @param {ArrayLike> | null | undefined} array - The array of grouped elements to process. + * @param {(...values: T[]) => R} iteratee - The function to combine regrouped values. + * @returns {R[]} Returns the new array of regrouped elements. + * + * @example + * unzipWith([[1, 10, 100], [2, 20, 200]], (a, b) => a + b); + * // => [3, 30, 300] + */ +declare function unzipWith(array: ArrayLike> | null | undefined, iteratee: (...values: T[]) => R): R[]; +/** + * This method is like `unzip` except that it accepts an iteratee to specify + * how regrouped values should be combined. + * + * @template T + * @param {ArrayLike> | null | undefined} array - The array of grouped elements to process. + * @returns {T[][]} Returns the new array of regrouped elements. + * + * @example + * unzipWith([[1, 10, 100], [2, 20, 200]]); + * // => [[1, 2], [10, 20], [100, 200]] + */ +declare function unzipWith(array: ArrayLike> | null | undefined): T[][]; +//#endregion +export { unzipWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/unzipWith.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/unzipWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0c2f8433813df9b0f2624711d4f7ccceb660b9c9 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/unzipWith.d.ts @@ -0,0 +1,31 @@ +//#region src/compat/array/unzipWith.d.ts +/** + * This method is like `unzip` except that it accepts an iteratee to specify + * how regrouped values should be combined. The iteratee is invoked with the + * elements of each group: (...group). + * + * @template T, R + * @param {ArrayLike> | null | undefined} array - The array of grouped elements to process. + * @param {(...values: T[]) => R} iteratee - The function to combine regrouped values. + * @returns {R[]} Returns the new array of regrouped elements. + * + * @example + * unzipWith([[1, 10, 100], [2, 20, 200]], (a, b) => a + b); + * // => [3, 30, 300] + */ +declare function unzipWith(array: ArrayLike> | null | undefined, iteratee: (...values: T[]) => R): R[]; +/** + * This method is like `unzip` except that it accepts an iteratee to specify + * how regrouped values should be combined. + * + * @template T + * @param {ArrayLike> | null | undefined} array - The array of grouped elements to process. + * @returns {T[][]} Returns the new array of regrouped elements. + * + * @example + * unzipWith([[1, 10, 100], [2, 20, 200]]); + * // => [[1, 2], [10, 20], [100, 200]] + */ +declare function unzipWith(array: ArrayLike> | null | undefined): T[][]; +//#endregion +export { unzipWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/unzipWith.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/unzipWith.js new file mode 100644 index 0000000000000000000000000000000000000000..a3311ab77a7aef18b708eb26e6757ca18ad8fcb7 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/unzipWith.js @@ -0,0 +1,33 @@ +const require_unzip = require("../../array/unzip.js"); +const require_isArray = require("../predicate/isArray.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +//#region src/compat/array/unzipWith.ts +/** +* Unzips an array of arrays, applying an `iteratee` function to regrouped elements. +* +* If the array is `null` or `undefined`, returns an empty array. +* +* @template T +* @param {T[][] | ArrayLike> | null | undefined} array - The nested array to unzip. This is an array of arrays, +* where each inner array contains elements to be unzipped. +* @param {(...args: any[]) => unknown} iteratee - A function to transform the unzipped elements. +* @returns {any[]} A new array of unzipped and transformed elements. +* +* @example +* const nestedArray = [[1, 2], [3, 4], [5, 6]]; +* const result = unzipWith(nestedArray, (a, b) => a + b); +* console.log(result); // [9, 12] +*/ +function unzipWith(array, iteratee) { + if (!require_isArrayLikeObject.isArrayLikeObject(array) || !array.length) return []; + const unzipped = require_isArray.isArray(array) ? require_unzip.unzip(array) : require_unzip.unzip(Array.from(array, (value) => Array.from(value))); + if (!iteratee) return unzipped; + const result = new Array(unzipped.length); + for (let i = 0; i < unzipped.length; i++) { + const value = unzipped[i]; + result[i] = iteratee(...value); + } + return result; +} +//#endregion +exports.unzipWith = unzipWith; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/unzipWith.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/unzipWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..cedb07366af86ada4db54706b2e365d8f9c27eab --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/unzipWith.mjs @@ -0,0 +1,33 @@ +import { unzip } from "../../array/unzip.mjs"; +import { isArray } from "../predicate/isArray.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +//#region src/compat/array/unzipWith.ts +/** +* Unzips an array of arrays, applying an `iteratee` function to regrouped elements. +* +* If the array is `null` or `undefined`, returns an empty array. +* +* @template T +* @param {T[][] | ArrayLike> | null | undefined} array - The nested array to unzip. This is an array of arrays, +* where each inner array contains elements to be unzipped. +* @param {(...args: any[]) => unknown} iteratee - A function to transform the unzipped elements. +* @returns {any[]} A new array of unzipped and transformed elements. +* +* @example +* const nestedArray = [[1, 2], [3, 4], [5, 6]]; +* const result = unzipWith(nestedArray, (a, b) => a + b); +* console.log(result); // [9, 12] +*/ +function unzipWith(array, iteratee) { + if (!isArrayLikeObject(array) || !array.length) return []; + const unzipped = isArray(array) ? unzip(array) : unzip(Array.from(array, (value) => Array.from(value))); + if (!iteratee) return unzipped; + const result = new Array(unzipped.length); + for (let i = 0; i < unzipped.length; i++) { + const value = unzipped[i]; + result[i] = iteratee(...value); + } + return result; +} +//#endregion +export { unzipWith }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/without.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/without.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d73c2002f79ae401d0a63929beb1220141b4276c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/without.d.mts @@ -0,0 +1,24 @@ +//#region src/compat/array/without.d.ts +/** + * Creates an array that excludes all specified values. + * + * It correctly excludes `NaN`, as it compares values using [SameValueZero](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero). + * + * @template T The type of elements in the array. + * @param {ArrayLike | null | undefined} array - The array to filter. + * @param {...T[]} values - The values to exclude. + * @returns {T[]} A new array without the specified values. + * + * @example + * // Removes the specified values from the array + * without([1, 2, 3, 4, 5], 2, 4); + * // Returns: [1, 3, 5] + * + * @example + * // Removes specified string values from the array + * without(['a', 'b', 'c', 'a'], 'a'); + * // Returns: ['b', 'c'] + */ +declare function without(array: ArrayLike | null | undefined, ...values: T[]): T[]; +//#endregion +export { without }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/without.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/without.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d73c2002f79ae401d0a63929beb1220141b4276c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/without.d.ts @@ -0,0 +1,24 @@ +//#region src/compat/array/without.d.ts +/** + * Creates an array that excludes all specified values. + * + * It correctly excludes `NaN`, as it compares values using [SameValueZero](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero). + * + * @template T The type of elements in the array. + * @param {ArrayLike | null | undefined} array - The array to filter. + * @param {...T[]} values - The values to exclude. + * @returns {T[]} A new array without the specified values. + * + * @example + * // Removes the specified values from the array + * without([1, 2, 3, 4, 5], 2, 4); + * // Returns: [1, 3, 5] + * + * @example + * // Removes specified string values from the array + * without(['a', 'b', 'c', 'a'], 'a'); + * // Returns: ['b', 'c'] + */ +declare function without(array: ArrayLike | null | undefined, ...values: T[]): T[]; +//#endregion +export { without }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/without.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/without.js new file mode 100644 index 0000000000000000000000000000000000000000..e5774ad569b247acd8b32b5592508639486ceadc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/without.js @@ -0,0 +1,29 @@ +const require_without = require("../../array/without.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +//#region src/compat/array/without.ts +/** +* Creates an array that excludes all specified values. +* +* It correctly excludes `NaN`, as it compares values using [SameValueZero](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero). +* +* @template T The type of elements in the array. +* @param {ArrayLike | null | undefined} array - The array to filter. +* @param {...T[]} values - The values to exclude. +* @returns {T[]} A new array without the specified values. +* +* @example +* // Removes the specified values from the array +* without([1, 2, 3, 4, 5], 2, 4); +* // Returns: [1, 3, 5] +* +* @example +* // Removes specified string values from the array +* without(['a', 'b', 'c', 'a'], 'a'); +* // Returns: ['b', 'c'] +*/ +function without(array, ...values) { + if (!require_isArrayLikeObject.isArrayLikeObject(array)) return []; + return require_without.without(Array.from(array), ...values); +} +//#endregion +exports.without = without; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/without.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/without.mjs new file mode 100644 index 0000000000000000000000000000000000000000..19be693866b418a445ffa45d2bcc5a01c9249bcc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/without.mjs @@ -0,0 +1,29 @@ +import { without as without$1 } from "../../array/without.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +//#region src/compat/array/without.ts +/** +* Creates an array that excludes all specified values. +* +* It correctly excludes `NaN`, as it compares values using [SameValueZero](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero). +* +* @template T The type of elements in the array. +* @param {ArrayLike | null | undefined} array - The array to filter. +* @param {...T[]} values - The values to exclude. +* @returns {T[]} A new array without the specified values. +* +* @example +* // Removes the specified values from the array +* without([1, 2, 3, 4, 5], 2, 4); +* // Returns: [1, 3, 5] +* +* @example +* // Removes specified string values from the array +* without(['a', 'b', 'c', 'a'], 'a'); +* // Returns: ['b', 'c'] +*/ +function without(array, ...values) { + if (!isArrayLikeObject(array)) return []; + return without$1(Array.from(array), ...values); +} +//#endregion +export { without }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/xor.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/xor.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..51a762cad62ca893255e717bb10bfb3c2a6173ff --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/xor.d.mts @@ -0,0 +1,24 @@ +//#region src/compat/array/xor.d.ts +/** + * Computes the symmetric difference of the provided arrays, returning an array of elements + * that exist in only one of the arrays. + * + * @template T - The type of elements in the arrays. + * @param {...(ArrayLike | null | undefined)} arrays - The arrays to compare. + * @returns {T[]} An array containing the elements that are present in only one of the provided `arrays`. + * + * @example + * // Returns [1, 2, 5, 6] + * xor([1, 2, 3, 4], [3, 4, 5, 6]); + * + * @example + * // Returns ['a', 'c'] + * xor(['a', 'b'], ['b', 'c']); + * + * @example + * // Returns [1, 3, 5] + * xor([1, 2], [2, 3], [4, 5]); + */ +declare function xor(...arrays: Array | null | undefined>): T[]; +//#endregion +export { xor }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/xor.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/xor.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..51a762cad62ca893255e717bb10bfb3c2a6173ff --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/xor.d.ts @@ -0,0 +1,24 @@ +//#region src/compat/array/xor.d.ts +/** + * Computes the symmetric difference of the provided arrays, returning an array of elements + * that exist in only one of the arrays. + * + * @template T - The type of elements in the arrays. + * @param {...(ArrayLike | null | undefined)} arrays - The arrays to compare. + * @returns {T[]} An array containing the elements that are present in only one of the provided `arrays`. + * + * @example + * // Returns [1, 2, 5, 6] + * xor([1, 2, 3, 4], [3, 4, 5, 6]); + * + * @example + * // Returns ['a', 'c'] + * xor(['a', 'b'], ['b', 'c']); + * + * @example + * // Returns [1, 3, 5] + * xor([1, 2], [2, 3], [4, 5]); + */ +declare function xor(...arrays: Array | null | undefined>): T[]; +//#endregion +export { xor }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/xor.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/xor.js new file mode 100644 index 0000000000000000000000000000000000000000..63eb8d8d150250676a7c3f5653217ba50e69fd72 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/xor.js @@ -0,0 +1,38 @@ +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +const require_toArray = require("../util/toArray.js"); +//#region src/compat/array/xor.ts +/** +* Computes the symmetric difference of the provided arrays, returning an array of elements +* that exist in only one of the arrays. +* +* @template T - The type of elements in the arrays. +* @param {...(ArrayLike | null | undefined)} arrays - The arrays to compare. +* @returns {T[]} An array containing the elements that are present in only one of the provided `arrays`. +* +* @example +* // Returns [1, 2, 5, 6] +* xor([1, 2, 3, 4], [3, 4, 5, 6]); +* +* @example +* // Returns ['a', 'c'] +* xor(['a', 'b'], ['b', 'c']); +* +* @example +* // Returns [1, 3, 5] +* xor([1, 2], [2, 3], [4, 5]); +*/ +function xor(...arrays) { + const itemCounts = /* @__PURE__ */ new Map(); + for (let i = 0; i < arrays.length; i++) { + const array = arrays[i]; + if (!require_isArrayLikeObject.isArrayLikeObject(array)) continue; + const itemSet = new Set(require_toArray.toArray(array)); + for (const item of itemSet) if (!itemCounts.has(item)) itemCounts.set(item, 1); + else itemCounts.set(item, itemCounts.get(item) + 1); + } + const result = []; + for (const [item, count] of itemCounts) if (count === 1) result.push(item); + return result; +} +//#endregion +exports.xor = xor; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/xor.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/xor.mjs new file mode 100644 index 0000000000000000000000000000000000000000..324248a804ea7bc8ebca2e609bc45b1c59be9d54 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/xor.mjs @@ -0,0 +1,38 @@ +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +import { toArray } from "../util/toArray.mjs"; +//#region src/compat/array/xor.ts +/** +* Computes the symmetric difference of the provided arrays, returning an array of elements +* that exist in only one of the arrays. +* +* @template T - The type of elements in the arrays. +* @param {...(ArrayLike | null | undefined)} arrays - The arrays to compare. +* @returns {T[]} An array containing the elements that are present in only one of the provided `arrays`. +* +* @example +* // Returns [1, 2, 5, 6] +* xor([1, 2, 3, 4], [3, 4, 5, 6]); +* +* @example +* // Returns ['a', 'c'] +* xor(['a', 'b'], ['b', 'c']); +* +* @example +* // Returns [1, 3, 5] +* xor([1, 2], [2, 3], [4, 5]); +*/ +function xor(...arrays) { + const itemCounts = /* @__PURE__ */ new Map(); + for (let i = 0; i < arrays.length; i++) { + const array = arrays[i]; + if (!isArrayLikeObject(array)) continue; + const itemSet = new Set(toArray(array)); + for (const item of itemSet) if (!itemCounts.has(item)) itemCounts.set(item, 1); + else itemCounts.set(item, itemCounts.get(item) + 1); + } + const result = []; + for (const [item, count] of itemCounts) if (count === 1) result.push(item); + return result; +} +//#endregion +export { xor }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/xorBy.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/xorBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..418e3ea0c8788f021a278b2d6c6c6f4dc80777e1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/xorBy.d.mts @@ -0,0 +1,57 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.mjs"; + +//#region src/compat/array/xorBy.d.ts +/** + * This method is like `xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The arrays to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * @example + * xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ +declare function xorBy(arrays: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + */ +declare function xorBy(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {...Array | ArrayLike | null | undefined>} iteratee - The iteratee invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * xorBy([1.2, 2.3], [3.4, 4.5], [5.6, 6.7], Math.floor); + * // => [1.2, 3.4, 5.6] + */ +declare function xorBy(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, ...iteratee: Array | ArrayLike | null | undefined>): T[]; +//#endregion +export { xorBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/xorBy.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/xorBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6f27edf43c7c5fc70c4ba481aa87da5ec1d17d1a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/xorBy.d.ts @@ -0,0 +1,57 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.js"; + +//#region src/compat/array/xorBy.d.ts +/** + * This method is like `xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The arrays to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + * + * @example + * xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 2 }] + */ +declare function xorBy(arrays: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ValueIteratee} [iteratee] - The iteratee invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * // => [1.2, 4.3] + */ +declare function xorBy(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, iteratee?: ValueIteratee): T[]; +/** + * This method is like `xor` except that it accepts `iteratee` which is + * invoked for each element of each `arrays` to generate the criterion by which + * uniqueness is computed. The iteratee is invoked with one argument: (value). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {...Array | ArrayLike | null | undefined>} iteratee - The iteratee invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * xorBy([1.2, 2.3], [3.4, 4.5], [5.6, 6.7], Math.floor); + * // => [1.2, 3.4, 5.6] + */ +declare function xorBy(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, ...iteratee: Array | ArrayLike | null | undefined>): T[]; +//#endregion +export { xorBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/xorBy.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/xorBy.js new file mode 100644 index 0000000000000000000000000000000000000000..c3161b351e0f8dce1543efd759566e6afb5b7fa4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/xorBy.js @@ -0,0 +1,40 @@ +const require_windowed = require("../../array/windowed.js"); +const require_identity = require("../../function/identity.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +const require_last = require("./last.js"); +const require_differenceBy = require("./differenceBy.js"); +const require_intersectionBy = require("./intersectionBy.js"); +const require_unionBy = require("./unionBy.js"); +//#region src/compat/array/xorBy.ts +/** +* Computes the symmetric difference between two arrays using a custom mapping function. +* The symmetric difference is the set of elements which are in either of the arrays, +* but not in their intersection, determined by the result of the mapping function. +* +* @template T - Type of elements in the input arrays. +* @template U - Type of the values returned by the mapping function. +* +* @param {...(ArrayLike | null | undefined | PropertyKey | Partial | ((value: T) => unknown))} values - The arrays to inspect, or the function to map array elements to comparison values. +* @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the values returned by the mapping function. +* +* @example +* // Custom mapping function for objects with an 'id' property +* const idMapper = obj => obj.id; +* xorBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper); +* // Returns [{ id: 1 }, { id: 3 }] +*/ +function xorBy(...values) { + const lastValue = require_last.last(values); + let mapper = require_identity.identity; + if (!require_isArrayLikeObject.isArrayLikeObject(lastValue) && lastValue != null) { + mapper = require_iteratee.iteratee(lastValue); + values = values.slice(0, -1); + } + const arrays = values.filter(require_isArrayLikeObject.isArrayLikeObject); + const union = require_unionBy.unionBy(...arrays, mapper); + const intersections = require_windowed.windowed(arrays, 2).map(([arr1, arr2]) => require_intersectionBy.intersectionBy(arr1, arr2, mapper)); + return require_differenceBy.differenceBy(union, require_unionBy.unionBy(...intersections, mapper), mapper); +} +//#endregion +exports.xorBy = xorBy; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/xorBy.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/xorBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b240acf95d9be9a809a8250c6db5ba391eb95762 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/xorBy.mjs @@ -0,0 +1,38 @@ +import { windowed } from "../../array/windowed.mjs"; +import { identity } from "../../function/identity.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +import { last } from "./last.mjs"; +import { differenceBy } from "./differenceBy.mjs"; +import { intersectionBy } from "./intersectionBy.mjs"; +import { unionBy } from "./unionBy.mjs"; +//#region src/compat/array/xorBy.ts +/** +* Computes the symmetric difference between two arrays using a custom mapping function. +* The symmetric difference is the set of elements which are in either of the arrays, +* but not in their intersection, determined by the result of the mapping function. +* +* @template T - Type of elements in the input arrays. +* @template U - Type of the values returned by the mapping function. +* +* @param {...(ArrayLike | null | undefined | PropertyKey | Partial | ((value: T) => unknown))} values - The arrays to inspect, or the function to map array elements to comparison values. +* @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both, based on the values returned by the mapping function. +* +* @example +* // Custom mapping function for objects with an 'id' property +* const idMapper = obj => obj.id; +* xorBy([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idMapper); +* // Returns [{ id: 1 }, { id: 3 }] +*/ +function xorBy(...values) { + const lastValue = last(values); + let mapper = identity; + if (!isArrayLikeObject(lastValue) && lastValue != null) { + mapper = iteratee(lastValue); + values = values.slice(0, -1); + } + const arrays = values.filter(isArrayLikeObject); + return differenceBy(unionBy(...arrays, mapper), unionBy(...windowed(arrays, 2).map(([arr1, arr2]) => intersectionBy(arr1, arr2, mapper)), mapper), mapper); +} +//#endregion +export { xorBy }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/xorWith.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/xorWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..fd369f0f927679d2111e49048e93829edbd5c93a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/xorWith.d.mts @@ -0,0 +1,53 @@ +//#region src/compat/array/xorWith.d.ts +/** + * This method is like `xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The arrays to inspect. + * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * xorWith(objects, others, isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ +declare function xorWith(arrays: ArrayLike | null | undefined, comparator?: (a: T, b: T) => boolean): T[]; +/** + * This method is like `xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * xorWith([1, 2], [2, 3], (a, b) => a === b); + * // => [1, 3] + */ +declare function xorWith(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, comparator?: (a: T, b: T) => boolean): T[]; +/** + * This method is like `xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {...Array<(a: T, b: T) => boolean | ArrayLike | null | undefined>} comparator - The comparator invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * xorWith([1], [2], [3], (a, b) => a === b); + * // => [1, 2, 3] + */ +declare function xorWith(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, ...comparator: Array<((a: T, b: T) => boolean) | ArrayLike | null | undefined>): T[]; +//#endregion +export { xorWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/xorWith.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/xorWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fd369f0f927679d2111e49048e93829edbd5c93a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/xorWith.d.ts @@ -0,0 +1,53 @@ +//#region src/compat/array/xorWith.d.ts +/** + * This method is like `xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The arrays to inspect. + * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; + * const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; + * xorWith(objects, others, isEqual); + * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] + */ +declare function xorWith(arrays: ArrayLike | null | undefined, comparator?: (a: T, b: T) => boolean): T[]; +/** + * This method is like `xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * xorWith([1, 2], [2, 3], (a, b) => a === b); + * // => [1, 3] + */ +declare function xorWith(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, comparator?: (a: T, b: T) => boolean): T[]; +/** + * This method is like `xor` except that it accepts `comparator` which is + * invoked to compare elements of `arrays`. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @template T + * @param {ArrayLike | null | undefined} arrays - The first array to inspect. + * @param {ArrayLike | null | undefined} arrays2 - The second array to inspect. + * @param {ArrayLike | null | undefined} arrays3 - The third array to inspect. + * @param {...Array<(a: T, b: T) => boolean | ArrayLike | null | undefined>} comparator - The comparator invoked per element. + * @returns {T[]} Returns the new array of values. + * + * @example + * xorWith([1], [2], [3], (a, b) => a === b); + * // => [1, 2, 3] + */ +declare function xorWith(arrays: ArrayLike | null | undefined, arrays2: ArrayLike | null | undefined, arrays3: ArrayLike | null | undefined, ...comparator: Array<((a: T, b: T) => boolean) | ArrayLike | null | undefined>): T[]; +//#endregion +export { xorWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/xorWith.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/xorWith.js new file mode 100644 index 0000000000000000000000000000000000000000..5e952f22aefbe034010c0b3fc6556d398eff20a3 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/xorWith.js @@ -0,0 +1,39 @@ +const require_windowed = require("../../array/windowed.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +const require_last = require("./last.js"); +const require_differenceWith = require("./differenceWith.js"); +const require_intersectionWith = require("./intersectionWith.js"); +const require_unionWith = require("./unionWith.js"); +//#region src/compat/array/xorWith.ts +/** +* Creates an array of unique values that is the symmetric difference of the given arrays using a custom comparator function. +* +* The symmetric difference is the set of elements which are in either of the arrays, +* but not in their intersection, determined by the comparator function. +* +* @template T - Type of elements in the input arrays. +* +* @param {...(ArrayLike | null | undefined | ((a: T, b: T) => boolean))} values - The arrays to inspect, or the comparator function. +* @returns {T[]} An array containing the elements that are present in exactly one of the arrays +* as determined by the comparator. +* +* @example +* // Custom comparator function for objects with an 'id' property +* const idComparator = (a, b) => a.id === b.id; +* xorWith([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idComparator); +* // Returns [{ id: 1 }, { id: 3 }] +*/ +function xorWith(...values) { + const lastValue = require_last.last(values); + let comparator = (a, b) => a === b; + if (typeof lastValue === "function") { + comparator = lastValue; + values = values.slice(0, -1); + } + const arrays = values.filter(require_isArrayLikeObject.isArrayLikeObject); + const union = require_unionWith.unionWith(...arrays, comparator); + const intersections = require_windowed.windowed(arrays, 2).map(([arr1, arr2]) => require_intersectionWith.intersectionWith(arr1, arr2, comparator)); + return require_differenceWith.differenceWith(union, require_unionWith.unionWith(...intersections, comparator), comparator); +} +//#endregion +exports.xorWith = xorWith; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/xorWith.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/xorWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c3a301bb8e24b61a06ae0b4bf4476862a12425e5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/xorWith.mjs @@ -0,0 +1,37 @@ +import { windowed } from "../../array/windowed.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +import { last } from "./last.mjs"; +import { differenceWith } from "./differenceWith.mjs"; +import { intersectionWith } from "./intersectionWith.mjs"; +import { unionWith } from "./unionWith.mjs"; +//#region src/compat/array/xorWith.ts +/** +* Creates an array of unique values that is the symmetric difference of the given arrays using a custom comparator function. +* +* The symmetric difference is the set of elements which are in either of the arrays, +* but not in their intersection, determined by the comparator function. +* +* @template T - Type of elements in the input arrays. +* +* @param {...(ArrayLike | null | undefined | ((a: T, b: T) => boolean))} values - The arrays to inspect, or the comparator function. +* @returns {T[]} An array containing the elements that are present in exactly one of the arrays +* as determined by the comparator. +* +* @example +* // Custom comparator function for objects with an 'id' property +* const idComparator = (a, b) => a.id === b.id; +* xorWith([{ id: 1 }, { id: 2 }], [{ id: 2 }, { id: 3 }], idComparator); +* // Returns [{ id: 1 }, { id: 3 }] +*/ +function xorWith(...values) { + const lastValue = last(values); + let comparator = (a, b) => a === b; + if (typeof lastValue === "function") { + comparator = lastValue; + values = values.slice(0, -1); + } + const arrays = values.filter(isArrayLikeObject); + return differenceWith(unionWith(...arrays, comparator), unionWith(...windowed(arrays, 2).map(([arr1, arr2]) => intersectionWith(arr1, arr2, comparator)), comparator), comparator); +} +//#endregion +export { xorWith }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/zip.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/zip.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a9f12b882e422f0b205b55871247cbc86d8a77cb --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/zip.d.mts @@ -0,0 +1,187 @@ +//#region src/compat/array/zip.d.ts +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @returns {Array<[T | undefined, U | undefined]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const result = zip(arr1, arr2); + * // result will be [[1, 'a'], [2, 'b'], [3, 'c']] + */ +/** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @template T, U + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @returns {Array<[T | undefined, U | undefined]>} Returns the new array of grouped elements. + * + * @example + * zip([1, 2], ['a', 'b']); + * // => [[1, 'a'], [2, 'b']] + */ +declare function zip(arr1: ArrayLike, arr2: ArrayLike): Array<[T | undefined, U | undefined]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U, V + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const result = zip(arr1, arr2, arr3); + * // result will be [[1, 'a', true], [2, 'b', false], [3, 'c', undefined]] + */ +/** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @template T, U, V + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined]>} Returns the new array of grouped elements. + * + * @example + * zip([1, 2], ['a', 'b'], [true, false]); + * // => [[1, 'a', true], [2, 'b', false]] + */ +declare function zip(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike): Array<[T | undefined, U | undefined, V | undefined]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U, V, W + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined, W | undefined]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const arr4 = [null, null, null]; + * const result = zip(arr1, arr2, arr3, arr4); + * // result will be [[1, 'a', true, null], [2, 'b', false, null], [3, 'c', undefined, null]] + */ +/** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @template T, U, V, W + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined, W | undefined]>} Returns the new array of grouped elements. + * + * @example + * zip([1], ['a'], [true], [null]); + * // => [[1, 'a', true, null]] + */ +declare function zip(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike, arr4: ArrayLike): Array<[T | undefined, U | undefined, V | undefined, W | undefined]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U, V, W + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @param {ArrayLike} arr5 - The fifth array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined, W | undefined, X | undefined]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const arr4 = [null, null, null]; + * const arr5 = [undefined, undefined, undefined]; + * const result = zip(arr1, arr2, arr3, arr4, arr5); + * // result will be [[1, 'a', true, null, undefined], [2, 'b', false, null, undefined], [3, 'c', undefined, null, undefined]] + */ +/** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @template T, U, V, W, X + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @param {ArrayLike} arr5 - The fifth array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined, W | undefined, X | undefined]>} Returns the new array of grouped elements. + * + * @example + * zip([1], ['a'], [true], [null], [undefined]); + * // => [[1, 'a', true, null, undefined]] + */ +declare function zip(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike, arr4: ArrayLike, arr5: ArrayLike): Array<[T | undefined, U | undefined, V | undefined, W | undefined, X | undefined]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T + * @param {Array | null | undefined>} arrays - The arrays to zip. + * @returns {Array>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const arr4 = [null, null, null]; + * const arr5 = [undefined, undefined, undefined]; + * const result = zip(arr1, arr2, arr3, arr4, arr5); + * // result will be [[1, 'a', true, null, undefined], [2, 'b', false, null, undefined], [3, 'c', undefined, null, undefined]] + */ +/** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @template T + * @param {...Array | null | undefined>} arrays - The arrays to process. + * @returns {Array>} Returns the new array of grouped elements. + * + * @example + * zip([1, 2], ['a', 'b'], [true, false]); + * // => [[1, 'a', true], [2, 'b', false]] + */ +declare function zip(...arrays: Array | null | undefined>): Array>; +//#endregion +export { zip }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/zip.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/zip.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a9f12b882e422f0b205b55871247cbc86d8a77cb --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/zip.d.ts @@ -0,0 +1,187 @@ +//#region src/compat/array/zip.d.ts +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @returns {Array<[T | undefined, U | undefined]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const result = zip(arr1, arr2); + * // result will be [[1, 'a'], [2, 'b'], [3, 'c']] + */ +/** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @template T, U + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @returns {Array<[T | undefined, U | undefined]>} Returns the new array of grouped elements. + * + * @example + * zip([1, 2], ['a', 'b']); + * // => [[1, 'a'], [2, 'b']] + */ +declare function zip(arr1: ArrayLike, arr2: ArrayLike): Array<[T | undefined, U | undefined]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U, V + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const result = zip(arr1, arr2, arr3); + * // result will be [[1, 'a', true], [2, 'b', false], [3, 'c', undefined]] + */ +/** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @template T, U, V + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined]>} Returns the new array of grouped elements. + * + * @example + * zip([1, 2], ['a', 'b'], [true, false]); + * // => [[1, 'a', true], [2, 'b', false]] + */ +declare function zip(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike): Array<[T | undefined, U | undefined, V | undefined]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U, V, W + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined, W | undefined]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const arr4 = [null, null, null]; + * const result = zip(arr1, arr2, arr3, arr4); + * // result will be [[1, 'a', true, null], [2, 'b', false, null], [3, 'c', undefined, null]] + */ +/** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @template T, U, V, W + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined, W | undefined]>} Returns the new array of grouped elements. + * + * @example + * zip([1], ['a'], [true], [null]); + * // => [[1, 'a', true, null]] + */ +declare function zip(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike, arr4: ArrayLike): Array<[T | undefined, U | undefined, V | undefined, W | undefined]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T, U, V, W + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @param {ArrayLike} arr5 - The fifth array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined, W | undefined, X | undefined]>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const arr4 = [null, null, null]; + * const arr5 = [undefined, undefined, undefined]; + * const result = zip(arr1, arr2, arr3, arr4, arr5); + * // result will be [[1, 'a', true, null, undefined], [2, 'b', false, null, undefined], [3, 'c', undefined, null, undefined]] + */ +/** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @template T, U, V, W, X + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @param {ArrayLike} arr5 - The fifth array to zip. + * @returns {Array<[T | undefined, U | undefined, V | undefined, W | undefined, X | undefined]>} Returns the new array of grouped elements. + * + * @example + * zip([1], ['a'], [true], [null], [undefined]); + * // => [[1, 'a', true, null, undefined]] + */ +declare function zip(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike, arr4: ArrayLike, arr5: ArrayLike): Array<[T | undefined, U | undefined, V | undefined, W | undefined, X | undefined]>; +/** + * Combines multiple arrays into a single array of tuples. + * + * This function takes multiple arrays and returns a new array where each element is a tuple + * containing the corresponding elements from the input arrays. If the input arrays are of + * different lengths, the resulting array will have the length of the longest input array, + * with undefined values for missing elements. + * + * @template T + * @param {Array | null | undefined>} arrays - The arrays to zip. + * @returns {Array>} A new array of tuples containing the corresponding elements from the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const arr3 = [true, false]; + * const arr4 = [null, null, null]; + * const arr5 = [undefined, undefined, undefined]; + * const result = zip(arr1, arr2, arr3, arr4, arr5); + * // result will be [[1, 'a', true, null, undefined], [2, 'b', false, null, undefined], [3, 'c', undefined, null, undefined]] + */ +/** + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @template T + * @param {...Array | null | undefined>} arrays - The arrays to process. + * @returns {Array>} Returns the new array of grouped elements. + * + * @example + * zip([1, 2], ['a', 'b'], [true, false]); + * // => [[1, 'a', true], [2, 'b', false]] + */ +declare function zip(...arrays: Array | null | undefined>): Array>; +//#endregion +export { zip }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/zip.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/zip.js new file mode 100644 index 0000000000000000000000000000000000000000..555abe6a5c526e18eb795b469c7ae37cad574932 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/zip.js @@ -0,0 +1,30 @@ +const require_zip = require("../../array/zip.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +//#region src/compat/array/zip.ts +/** +* Combines multiple arrays into a single array of tuples. +* +* This function takes multiple arrays and returns a new array where each element is a tuple +* containing the corresponding elements from the input arrays. If the input arrays are of +* different lengths, the resulting array will have the length of the longest input array, +* with undefined values for missing elements. +* +* @template T +* @param {Array | null | undefined>} arrays - The arrays to zip. +* @returns {Array>} A new array of tuples containing the corresponding elements from the input arrays. +* +* @example +* const arr1 = [1, 2, 3]; +* const arr2 = ['a', 'b', 'c']; +* const arr3 = [true, false]; +* const arr4 = [null, null, null]; +* const arr5 = [undefined, undefined, undefined]; +* const result = zip(arr1, arr2, arr3, arr4, arr5); +* // result will be [[1, 'a', true, null, undefined], [2, 'b', false, null, undefined], [3, 'c', undefined, null, undefined]] +*/ +function zip(...arrays) { + if (!arrays.length) return []; + return require_zip.zip(...arrays.filter((group) => require_isArrayLikeObject.isArrayLikeObject(group))); +} +//#endregion +exports.zip = zip; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/zip.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/zip.mjs new file mode 100644 index 0000000000000000000000000000000000000000..56a933a3d3edd6e7b1dda12e18fad7b7ab7f24aa --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/zip.mjs @@ -0,0 +1,30 @@ +import { zip as zip$1 } from "../../array/zip.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +//#region src/compat/array/zip.ts +/** +* Combines multiple arrays into a single array of tuples. +* +* This function takes multiple arrays and returns a new array where each element is a tuple +* containing the corresponding elements from the input arrays. If the input arrays are of +* different lengths, the resulting array will have the length of the longest input array, +* with undefined values for missing elements. +* +* @template T +* @param {Array | null | undefined>} arrays - The arrays to zip. +* @returns {Array>} A new array of tuples containing the corresponding elements from the input arrays. +* +* @example +* const arr1 = [1, 2, 3]; +* const arr2 = ['a', 'b', 'c']; +* const arr3 = [true, false]; +* const arr4 = [null, null, null]; +* const arr5 = [undefined, undefined, undefined]; +* const result = zip(arr1, arr2, arr3, arr4, arr5); +* // result will be [[1, 'a', true, null, undefined], [2, 'b', false, null, undefined], [3, 'c', undefined, null, undefined]] +*/ +function zip(...arrays) { + if (!arrays.length) return []; + return zip$1(...arrays.filter((group) => isArrayLikeObject(group))); +} +//#endregion +export { zip }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObject.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObject.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..047d0713b0f28a9f8294003bcdb27ab0cbe63c17 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObject.d.mts @@ -0,0 +1,30 @@ +//#region src/compat/array/zipObject.d.ts +/** + * Combines two arrays, one of property names and one of corresponding values, into a single object. + * + * @template T - The type of values in the values array + * @param {ArrayLike} props - An array of property names + * @param {ArrayLike} values - An array of values corresponding to the property names + * @returns {Record} A new object composed of the given property names and values + * + * @example + * const props = ['a', 'b', 'c']; + * const values = [1, 2, 3]; + * zipObject(props, values); + * // => { a: 1, b: 2, c: 3 } + */ +declare function zipObject(props: ArrayLike, values: ArrayLike): Record; +/** + * Creates an object from an array of property names, with undefined values. + * + * @param {ArrayLike} [props] - An array of property names + * @returns {Record} A new object with the given property names and undefined values + * + * @example + * const props = ['a', 'b', 'c']; + * zipObject(props); + * // => { a: undefined, b: undefined, c: undefined } + */ +declare function zipObject(props?: ArrayLike): Record; +//#endregion +export { zipObject }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObject.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObject.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..047d0713b0f28a9f8294003bcdb27ab0cbe63c17 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObject.d.ts @@ -0,0 +1,30 @@ +//#region src/compat/array/zipObject.d.ts +/** + * Combines two arrays, one of property names and one of corresponding values, into a single object. + * + * @template T - The type of values in the values array + * @param {ArrayLike} props - An array of property names + * @param {ArrayLike} values - An array of values corresponding to the property names + * @returns {Record} A new object composed of the given property names and values + * + * @example + * const props = ['a', 'b', 'c']; + * const values = [1, 2, 3]; + * zipObject(props, values); + * // => { a: 1, b: 2, c: 3 } + */ +declare function zipObject(props: ArrayLike, values: ArrayLike): Record; +/** + * Creates an object from an array of property names, with undefined values. + * + * @param {ArrayLike} [props] - An array of property names + * @returns {Record} A new object with the given property names and undefined values + * + * @example + * const props = ['a', 'b', 'c']; + * zipObject(props); + * // => { a: undefined, b: undefined, c: undefined } + */ +declare function zipObject(props?: ArrayLike): Record; +//#endregion +export { zipObject }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObject.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObject.js new file mode 100644 index 0000000000000000000000000000000000000000..aec4309b394ad65b5bc13cfce41e80d1e950be73 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObject.js @@ -0,0 +1,39 @@ +const require_assignValue = require("../_internal/assignValue.js"); +//#region src/compat/array/zipObject.ts +/** +* Combines two arrays, one of property names and one of corresponding values, into a single object. +* +* This function takes two arrays: one containing property names and another containing corresponding values. +* It returns a new object where the property names from the first array are keys, and the corresponding elements +* from the second array are values. If the `keys` array is longer than the `values` array, the remaining keys will +* have `undefined` as their values. +* +* @template P - The type of elements in the array. +* @template V - The type of elements in the array. +* @param {ArrayLike} keys - An array of property names. +* @param {ArrayLike} values - An array of values corresponding to the property names. +* @returns {Record} - A new object composed of the given property names and values. +* +* @example +* const keys = ['a', 'b', 'c']; +* const values = [1, 2, 3]; +* const result = zipObject(keys, values); +* // result will be { a: 1, b: 2, c: 3 } +* +* const keys2 = ['a', 'b', 'c']; +* const values2 = [1, 2]; +* const result2 = zipObject(keys2, values2); +* // result2 will be { a: 1, b: 2, c: undefined } +* +* const keys2 = ['a', 'b']; +* const values2 = [1, 2, 3]; +* const result2 = zipObject(keys2, values2); +* // result2 will be { a: 1, b: 2 } +*/ +function zipObject(keys = [], values = []) { + const result = {}; + for (let i = 0; i < keys.length; i++) require_assignValue.assignValue(result, keys[i], values[i]); + return result; +} +//#endregion +exports.zipObject = zipObject; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObject.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObject.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2ffbd44fd9d325024392115ef544f3634b32fb81 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObject.mjs @@ -0,0 +1,39 @@ +import { assignValue } from "../_internal/assignValue.mjs"; +//#region src/compat/array/zipObject.ts +/** +* Combines two arrays, one of property names and one of corresponding values, into a single object. +* +* This function takes two arrays: one containing property names and another containing corresponding values. +* It returns a new object where the property names from the first array are keys, and the corresponding elements +* from the second array are values. If the `keys` array is longer than the `values` array, the remaining keys will +* have `undefined` as their values. +* +* @template P - The type of elements in the array. +* @template V - The type of elements in the array. +* @param {ArrayLike} keys - An array of property names. +* @param {ArrayLike} values - An array of values corresponding to the property names. +* @returns {Record} - A new object composed of the given property names and values. +* +* @example +* const keys = ['a', 'b', 'c']; +* const values = [1, 2, 3]; +* const result = zipObject(keys, values); +* // result will be { a: 1, b: 2, c: 3 } +* +* const keys2 = ['a', 'b', 'c']; +* const values2 = [1, 2]; +* const result2 = zipObject(keys2, values2); +* // result2 will be { a: 1, b: 2, c: undefined } +* +* const keys2 = ['a', 'b']; +* const values2 = [1, 2, 3]; +* const result2 = zipObject(keys2, values2); +* // result2 will be { a: 1, b: 2 } +*/ +function zipObject(keys = [], values = []) { + const result = {}; + for (let i = 0; i < keys.length; i++) assignValue(result, keys[i], values[i]); + return result; +} +//#endregion +export { zipObject }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..8eea234290f9fd43917d5559bf8ded7236627e5e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.d.mts @@ -0,0 +1,39 @@ +import { PropertyPath } from "../_internal/PropertyPath.mjs"; + +//#region src/compat/array/zipObjectDeep.d.ts +/** + * Creates a deeply nested object given arrays of paths and values. + * + * This function takes two arrays: one containing arrays of property paths, and the other containing corresponding values. + * It returns a new object where paths from the first array are used as key paths to set values, with corresponding elements from the second array as values. + * Paths can be dot-separated strings or arrays of property names. + * + * If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values. + * + * @template P - The type of property paths. + * @template V - The type of values corresponding to the property paths. + * @param {ArrayLike

} keys - An array of property paths, each path can be a dot-separated string or an array of property names. + * @param {ArrayLike} values - An array of values corresponding to the property paths. + * @returns {Record} A new object composed of the given property paths and values. + * + * @example + * const paths = ['a.b.c', 'd.e.f']; + * const values = [1, 2]; + * const result = zipObjectDeep(paths, values); + * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } } + * + * @example + * const paths = [['a', 'b', 'c'], ['d', 'e', 'f']]; + * const values = [1, 2]; + * const result = zipObjectDeep(paths, values); + * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } } + * + * @example + * const paths = ['a.b[0].c', 'a.b[1].d']; + * const values = [1, 2]; + * const result = zipObjectDeep(paths, values); + * // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } + */ +declare function zipObjectDeep(keys?: ArrayLike, values?: ArrayLike): object; +//#endregion +export { zipObjectDeep }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..06f3688bff30f4665b7d7cd566e98608e88107a5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.d.ts @@ -0,0 +1,39 @@ +import { PropertyPath } from "../_internal/PropertyPath.js"; + +//#region src/compat/array/zipObjectDeep.d.ts +/** + * Creates a deeply nested object given arrays of paths and values. + * + * This function takes two arrays: one containing arrays of property paths, and the other containing corresponding values. + * It returns a new object where paths from the first array are used as key paths to set values, with corresponding elements from the second array as values. + * Paths can be dot-separated strings or arrays of property names. + * + * If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values. + * + * @template P - The type of property paths. + * @template V - The type of values corresponding to the property paths. + * @param {ArrayLike

} keys - An array of property paths, each path can be a dot-separated string or an array of property names. + * @param {ArrayLike} values - An array of values corresponding to the property paths. + * @returns {Record} A new object composed of the given property paths and values. + * + * @example + * const paths = ['a.b.c', 'd.e.f']; + * const values = [1, 2]; + * const result = zipObjectDeep(paths, values); + * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } } + * + * @example + * const paths = [['a', 'b', 'c'], ['d', 'e', 'f']]; + * const values = [1, 2]; + * const result = zipObjectDeep(paths, values); + * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } } + * + * @example + * const paths = ['a.b[0].c', 'a.b[1].d']; + * const values = [1, 2]; + * const result = zipObjectDeep(paths, values); + * // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } + */ +declare function zipObjectDeep(keys?: ArrayLike, values?: ArrayLike): object; +//#endregion +export { zipObjectDeep }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.js new file mode 100644 index 0000000000000000000000000000000000000000..2306e2b44ff8830fbb25792d086e8557983c88b6 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.js @@ -0,0 +1,50 @@ +const require_zip = require("../../array/zip.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_set = require("../object/set.js"); +//#region src/compat/array/zipObjectDeep.ts +/** +* Creates a deeply nested object given arrays of paths and values. +* +* This function takes two arrays: one containing arrays of property paths, and the other containing corresponding values. +* It returns a new object where paths from the first array are used as key paths to set values, with corresponding elements from the second array as values. +* Paths can be dot-separated strings or arrays of property names. +* +* If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values. +* +* @template P - The type of property paths. +* @template V - The type of values corresponding to the property paths. +* @param {ArrayLike

} keys - An array of property paths, each path can be a dot-separated string or an array of property names. +* @param {ArrayLike} values - An array of values corresponding to the property paths. +* @returns {Record} A new object composed of the given property paths and values. +* +* @example +* const paths = ['a.b.c', 'd.e.f']; +* const values = [1, 2]; +* const result = zipObjectDeep(paths, values); +* // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } } +* +* @example +* const paths = [['a', 'b', 'c'], ['d', 'e', 'f']]; +* const values = [1, 2]; +* const result = zipObjectDeep(paths, values); +* // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } } +* +* @example +* const paths = ['a.b[0].c', 'a.b[1].d']; +* const values = [1, 2]; +* const result = zipObjectDeep(paths, values); +* // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } +*/ +function zipObjectDeep(keys, values) { + const result = {}; + if (!require_isArrayLike.isArrayLike(keys)) return result; + if (!require_isArrayLike.isArrayLike(values)) values = []; + const zipped = require_zip.zip(Array.from(keys), Array.from(values)); + for (let i = 0; i < zipped.length; i++) { + const [key, value] = zipped[i]; + if (key != null) require_set.set(result, key, value); + } + return result; +} +//#endregion +exports.zipObjectDeep = zipObjectDeep; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.mjs new file mode 100644 index 0000000000000000000000000000000000000000..648210a11f77598044183aba886f4f19f1deeae5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipObjectDeep.mjs @@ -0,0 +1,50 @@ +import { zip } from "../../array/zip.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { set } from "../object/set.mjs"; +//#region src/compat/array/zipObjectDeep.ts +/** +* Creates a deeply nested object given arrays of paths and values. +* +* This function takes two arrays: one containing arrays of property paths, and the other containing corresponding values. +* It returns a new object where paths from the first array are used as key paths to set values, with corresponding elements from the second array as values. +* Paths can be dot-separated strings or arrays of property names. +* +* If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values. +* +* @template P - The type of property paths. +* @template V - The type of values corresponding to the property paths. +* @param {ArrayLike

} keys - An array of property paths, each path can be a dot-separated string or an array of property names. +* @param {ArrayLike} values - An array of values corresponding to the property paths. +* @returns {Record} A new object composed of the given property paths and values. +* +* @example +* const paths = ['a.b.c', 'd.e.f']; +* const values = [1, 2]; +* const result = zipObjectDeep(paths, values); +* // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } } +* +* @example +* const paths = [['a', 'b', 'c'], ['d', 'e', 'f']]; +* const values = [1, 2]; +* const result = zipObjectDeep(paths, values); +* // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } } +* +* @example +* const paths = ['a.b[0].c', 'a.b[1].d']; +* const values = [1, 2]; +* const result = zipObjectDeep(paths, values); +* // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } +*/ +function zipObjectDeep(keys, values) { + const result = {}; + if (!isArrayLike(keys)) return result; + if (!isArrayLike(values)) values = []; + const zipped = zip(Array.from(keys), Array.from(values)); + for (let i = 0; i < zipped.length; i++) { + const [key, value] = zipped[i]; + if (key != null) set(result, key, value); + } + return result; +} +//#endregion +export { zipObjectDeep }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/zipWith.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b0c732713dd0b493847f6b7a6ddb07ffee81f1a4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipWith.d.mts @@ -0,0 +1,93 @@ +//#region src/compat/array/zipWith.d.ts +/** + * Combines one array into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template R - The type of elements in the resulting array. + * @param {ArrayLike} arr1 - The first array to zip. + * @param {(item: T) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: ArrayLike, combine: (item: T) => R): R[]; +/** + * Combines two arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template R - The type of elements in the resulting array. + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {(item1: T, item2: U) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: ArrayLike, arr2: ArrayLike, combine: (item1: T, item2: U) => R): R[]; +/** + * Combines three arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template V - The type of elements in the third array. + * @template R - The type of elements in the resulting array. + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {(item1: T, item2: U, item3: V) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike, combine: (item1: T, item2: U, item3: V) => R): R[]; +/** + * Combines four arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template V - The type of elements in the third array. + * @template W - The type of elements in the fourth array. + * @template R - The type of elements in the resulting array. + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @param {(item1: T, item2: U, item3: V, item4: W) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike, arr4: ArrayLike, combine: (item1: T, item2: U, item3: V, item4: W) => R): R[]; +/** + * Combines five arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template V - The type of elements in the third array. + * @template W - The type of elements in the fourth array. + * @template X - The type of elements in the fifth array. + * @template R - The type of elements in the resulting array. + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @param {ArrayLike} arr5 - The fifth array to zip. + * @param {(item1: T, item2: U, item3: V, item4: W, item5: X) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike, arr4: ArrayLike, arr5: ArrayLike, combine: (item1: T, item2: U, item3: V, item4: W, item5: X) => R): R[]; +/** + * Combines multiple arrays into a single array using a custom combiner function. + * + * This function takes one array and a variable number of additional arrays, + * applying the provided combiner function to the corresponding elements of each array. + * If the input arrays are of different lengths, the resulting array will have the length + * of the longest input array, with undefined values for missing elements. + * + * @template T - The type of elements in the input arrays. + * @template R - The type of elements in the resulting array. + * @param {Array<((...group: T[]) => R) | ArrayLike | null | undefined>} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const result = zipWith(arr1, arr2, (num, char) => `${num}${char}`); + * // result will be ['1a', '2b', '3c'] + */ +declare function zipWith(...combine: Array<((...group: T[]) => R) | ArrayLike | null | undefined>): R[]; +//#endregion +export { zipWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/zipWith.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b0c732713dd0b493847f6b7a6ddb07ffee81f1a4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipWith.d.ts @@ -0,0 +1,93 @@ +//#region src/compat/array/zipWith.d.ts +/** + * Combines one array into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template R - The type of elements in the resulting array. + * @param {ArrayLike} arr1 - The first array to zip. + * @param {(item: T) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: ArrayLike, combine: (item: T) => R): R[]; +/** + * Combines two arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template R - The type of elements in the resulting array. + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {(item1: T, item2: U) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: ArrayLike, arr2: ArrayLike, combine: (item1: T, item2: U) => R): R[]; +/** + * Combines three arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template V - The type of elements in the third array. + * @template R - The type of elements in the resulting array. + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {(item1: T, item2: U, item3: V) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike, combine: (item1: T, item2: U, item3: V) => R): R[]; +/** + * Combines four arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template V - The type of elements in the third array. + * @template W - The type of elements in the fourth array. + * @template R - The type of elements in the resulting array. + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @param {(item1: T, item2: U, item3: V, item4: W) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike, arr4: ArrayLike, combine: (item1: T, item2: U, item3: V, item4: W) => R): R[]; +/** + * Combines five arrays into a single array using a custom combiner function. + * + * @template T - The type of elements in the first array. + * @template U - The type of elements in the second array. + * @template V - The type of elements in the third array. + * @template W - The type of elements in the fourth array. + * @template X - The type of elements in the fifth array. + * @template R - The type of elements in the resulting array. + * @param {ArrayLike} arr1 - The first array to zip. + * @param {ArrayLike} arr2 - The second array to zip. + * @param {ArrayLike} arr3 - The third array to zip. + * @param {ArrayLike} arr4 - The fourth array to zip. + * @param {ArrayLike} arr5 - The fifth array to zip. + * @param {(item1: T, item2: U, item3: V, item4: W, item5: X) => R} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + */ +declare function zipWith(arr1: ArrayLike, arr2: ArrayLike, arr3: ArrayLike, arr4: ArrayLike, arr5: ArrayLike, combine: (item1: T, item2: U, item3: V, item4: W, item5: X) => R): R[]; +/** + * Combines multiple arrays into a single array using a custom combiner function. + * + * This function takes one array and a variable number of additional arrays, + * applying the provided combiner function to the corresponding elements of each array. + * If the input arrays are of different lengths, the resulting array will have the length + * of the longest input array, with undefined values for missing elements. + * + * @template T - The type of elements in the input arrays. + * @template R - The type of elements in the resulting array. + * @param {Array<((...group: T[]) => R) | ArrayLike | null | undefined>} combine - The combiner function that takes corresponding elements from each array and returns a single value. + * @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. + * + * @example + * const arr1 = [1, 2, 3]; + * const arr2 = ['a', 'b', 'c']; + * const result = zipWith(arr1, arr2, (num, char) => `${num}${char}`); + * // result will be ['1a', '2b', '3c'] + */ +declare function zipWith(...combine: Array<((...group: T[]) => R) | ArrayLike | null | undefined>): R[]; +//#endregion +export { zipWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/zipWith.js b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipWith.js new file mode 100644 index 0000000000000000000000000000000000000000..229895b96314426b108784d87a1ab9ac4020cd3f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipWith.js @@ -0,0 +1,35 @@ +const require_isFunction = require("../../predicate/isFunction.js"); +const require_unzip = require("./unzip.js"); +//#region src/compat/array/zipWith.ts +/** +* Combines multiple arrays into a single array using a custom combiner function. +* +* This function takes one array and a variable number of additional arrays, +* applying the provided combiner function to the corresponding elements of each array. +* If the input arrays are of different lengths, the resulting array will have the length +* of the longest input array, with undefined values for missing elements. +* +* @template T - The type of elements in the input arrays. +* @template R - The type of elements in the resulting array. +* @param {Array<((...group: T[]) => R) | ArrayLike | null | undefined>} combine - The combiner function that takes corresponding elements from each array and returns a single value. +* @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. +* +* @example +* const arr1 = [1, 2, 3]; +* const arr2 = ['a', 'b', 'c']; +* const result = zipWith(arr1, arr2, (num, char) => `${num}${char}`); +* // result will be ['1a', '2b', '3c'] +*/ +function zipWith(...combine) { + let iteratee = combine.pop(); + if (!require_isFunction.isFunction(iteratee)) { + combine.push(iteratee); + iteratee = void 0; + } + if (!combine?.length) return []; + const result = require_unzip.unzip(combine); + if (iteratee == null) return result; + return result.map((group) => iteratee(...group)); +} +//#endregion +exports.zipWith = zipWith; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/array/zipWith.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..780fc40a9f63347ea18a28dd4393199ce9d7d33f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/array/zipWith.mjs @@ -0,0 +1,35 @@ +import { isFunction } from "../../predicate/isFunction.mjs"; +import { unzip } from "./unzip.mjs"; +//#region src/compat/array/zipWith.ts +/** +* Combines multiple arrays into a single array using a custom combiner function. +* +* This function takes one array and a variable number of additional arrays, +* applying the provided combiner function to the corresponding elements of each array. +* If the input arrays are of different lengths, the resulting array will have the length +* of the longest input array, with undefined values for missing elements. +* +* @template T - The type of elements in the input arrays. +* @template R - The type of elements in the resulting array. +* @param {Array<((...group: T[]) => R) | ArrayLike | null | undefined>} combine - The combiner function that takes corresponding elements from each array and returns a single value. +* @returns {R[]} A new array where each element is the result of applying the combiner function to the corresponding elements of the input arrays. +* +* @example +* const arr1 = [1, 2, 3]; +* const arr2 = ['a', 'b', 'c']; +* const result = zipWith(arr1, arr2, (num, char) => `${num}${char}`); +* // result will be ['1a', '2b', '3c'] +*/ +function zipWith(...combine) { + let iteratee = combine.pop(); + if (!isFunction(iteratee)) { + combine.push(iteratee); + iteratee = void 0; + } + if (!combine?.length) return []; + const result = unzip(combine); + if (iteratee == null) return result; + return result.map((group) => iteratee(...group)); +} +//#endregion +export { zipWith }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/compat.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/compat.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..cc95d66ade0281596a1e584b6663c259599af330 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/compat.d.mts @@ -0,0 +1,298 @@ +import { castArray } from "./array/castArray.mjs"; +import { chunk } from "./array/chunk.mjs"; +import { compact } from "./array/compact.mjs"; +import { concat } from "./array/concat.mjs"; +import { countBy } from "./array/countBy.mjs"; +import { difference } from "./array/difference.mjs"; +import { differenceBy } from "./array/differenceBy.mjs"; +import { differenceWith } from "./array/differenceWith.mjs"; +import { drop } from "./array/drop.mjs"; +import { dropRight } from "./array/dropRight.mjs"; +import { dropRightWhile } from "./array/dropRightWhile.mjs"; +import { dropWhile } from "./array/dropWhile.mjs"; +import { forEach } from "./array/forEach.mjs"; +import { forEachRight } from "./array/forEachRight.mjs"; +import { every } from "./array/every.mjs"; +import { fill } from "./array/fill.mjs"; +import { filter } from "./array/filter.mjs"; +import { find } from "./array/find.mjs"; +import { findIndex } from "./array/findIndex.mjs"; +import { findLast } from "./array/findLast.mjs"; +import { findLastIndex } from "./array/findLastIndex.mjs"; +import { head } from "./array/head.mjs"; +import { flatMap } from "./array/flatMap.mjs"; +import { flatMapDeep } from "./array/flatMapDeep.mjs"; +import { flatMapDepth } from "./array/flatMapDepth.mjs"; +import { flatten } from "./array/flatten.mjs"; +import { flattenDeep } from "./array/flattenDeep.mjs"; +import { flattenDepth } from "./array/flattenDepth.mjs"; +import { groupBy } from "./array/groupBy.mjs"; +import { includes } from "./array/includes.mjs"; +import { indexOf } from "./array/indexOf.mjs"; +import { initial } from "./array/initial.mjs"; +import { intersection } from "./array/intersection.mjs"; +import { intersectionBy } from "./array/intersectionBy.mjs"; +import { intersectionWith } from "./array/intersectionWith.mjs"; +import { invokeMap } from "./array/invokeMap.mjs"; +import { join } from "./array/join.mjs"; +import { keyBy } from "./array/keyBy.mjs"; +import { last } from "./array/last.mjs"; +import { lastIndexOf } from "./array/lastIndexOf.mjs"; +import { map } from "./array/map.mjs"; +import { nth } from "./array/nth.mjs"; +import { orderBy } from "./array/orderBy.mjs"; +import { partition } from "./array/partition.mjs"; +import { pull } from "./array/pull.mjs"; +import { pullAll } from "./array/pullAll.mjs"; +import { pullAllBy } from "./array/pullAllBy.mjs"; +import { pullAllWith } from "./array/pullAllWith.mjs"; +import { pullAt } from "./array/pullAt.mjs"; +import { reduce } from "./array/reduce.mjs"; +import { reduceRight } from "./array/reduceRight.mjs"; +import { reject } from "./array/reject.mjs"; +import { remove } from "./array/remove.mjs"; +import { reverse } from "./array/reverse.mjs"; +import { sample } from "./array/sample.mjs"; +import { sampleSize } from "./array/sampleSize.mjs"; +import { shuffle } from "./array/shuffle.mjs"; +import { size } from "./array/size.mjs"; +import { slice } from "./array/slice.mjs"; +import { some } from "./array/some.mjs"; +import { sortBy } from "./array/sortBy.mjs"; +import { sortedIndex } from "./array/sortedIndex.mjs"; +import { sortedIndexBy } from "./array/sortedIndexBy.mjs"; +import { sortedIndexOf } from "./array/sortedIndexOf.mjs"; +import { sortedLastIndex } from "./array/sortedLastIndex.mjs"; +import { sortedLastIndexBy } from "./array/sortedLastIndexBy.mjs"; +import { sortedLastIndexOf } from "./array/sortedLastIndexOf.mjs"; +import { tail } from "./array/tail.mjs"; +import { take } from "./array/take.mjs"; +import { takeRight } from "./array/takeRight.mjs"; +import { takeRightWhile } from "./array/takeRightWhile.mjs"; +import { takeWhile } from "./array/takeWhile.mjs"; +import { union } from "./array/union.mjs"; +import { unionBy } from "./array/unionBy.mjs"; +import { unionWith } from "./array/unionWith.mjs"; +import { uniq } from "./array/uniq.mjs"; +import { uniqBy } from "./array/uniqBy.mjs"; +import { uniqWith } from "./array/uniqWith.mjs"; +import { unzip } from "./array/unzip.mjs"; +import { unzipWith } from "./array/unzipWith.mjs"; +import { without } from "./array/without.mjs"; +import { xor } from "./array/xor.mjs"; +import { xorBy } from "./array/xorBy.mjs"; +import { xorWith } from "./array/xorWith.mjs"; +import { zip } from "./array/zip.mjs"; +import { zipObject } from "./array/zipObject.mjs"; +import { zipObjectDeep } from "./array/zipObjectDeep.mjs"; +import { zipWith } from "./array/zipWith.mjs"; +import { after } from "./function/after.mjs"; +import { ary } from "./function/ary.mjs"; +import { attempt } from "./function/attempt.mjs"; +import { before } from "./function/before.mjs"; +import { bind } from "./function/bind.mjs"; +import { bindKey } from "./function/bindKey.mjs"; +import { curry } from "./function/curry.mjs"; +import { curryRight } from "./function/curryRight.mjs"; +import { DebouncedFunc, debounce } from "./function/debounce.mjs"; +import { defer } from "./function/defer.mjs"; +import { delay } from "./function/delay.mjs"; +import { flip } from "./function/flip.mjs"; +import { flow } from "./function/flow.mjs"; +import { flowRight } from "./function/flowRight.mjs"; +import { memoize } from "./function/memoize.mjs"; +import { negate } from "./function/negate.mjs"; +import { nthArg } from "./function/nthArg.mjs"; +import { once } from "./function/once.mjs"; +import { overArgs } from "./function/overArgs.mjs"; +import { partial } from "./function/partial.mjs"; +import { partialRight } from "./function/partialRight.mjs"; +import { rearg } from "./function/rearg.mjs"; +import { rest } from "./function/rest.mjs"; +import { spread } from "./function/spread.mjs"; +import { throttle } from "./function/throttle.mjs"; +import { unary } from "./function/unary.mjs"; +import { wrap } from "./function/wrap.mjs"; +import { add } from "./math/add.mjs"; +import { ceil } from "./math/ceil.mjs"; +import { clamp } from "./math/clamp.mjs"; +import { divide } from "./math/divide.mjs"; +import { floor } from "./math/floor.mjs"; +import { inRange } from "./math/inRange.mjs"; +import { max } from "./math/max.mjs"; +import { maxBy } from "./math/maxBy.mjs"; +import { mean } from "./math/mean.mjs"; +import { meanBy } from "./math/meanBy.mjs"; +import { min } from "./math/min.mjs"; +import { minBy } from "./math/minBy.mjs"; +import { multiply } from "./math/multiply.mjs"; +import { parseInt } from "./math/parseInt.mjs"; +import { random } from "./math/random.mjs"; +import { range } from "./math/range.mjs"; +import { rangeRight } from "./math/rangeRight.mjs"; +import { round } from "./math/round.mjs"; +import { subtract } from "./math/subtract.mjs"; +import { sum } from "./math/sum.mjs"; +import { sumBy } from "./math/sumBy.mjs"; +import { isEqual } from "../predicate/isEqual.mjs"; +import { identity } from "./function/identity.mjs"; +import { noop } from "./function/noop.mjs"; +import { assign } from "./object/assign.mjs"; +import { assignIn } from "./object/assignIn.mjs"; +import { assignInWith } from "./object/assignInWith.mjs"; +import { assignWith } from "./object/assignWith.mjs"; +import { at } from "./object/at.mjs"; +import { clone } from "./object/clone.mjs"; +import { cloneDeep } from "./object/cloneDeep.mjs"; +import { cloneDeepWith } from "./object/cloneDeepWith.mjs"; +import { cloneWith } from "./object/cloneWith.mjs"; +import { create } from "./object/create.mjs"; +import { defaults } from "./object/defaults.mjs"; +import { defaultsDeep } from "./object/defaultsDeep.mjs"; +import { findKey } from "./object/findKey.mjs"; +import { findLastKey } from "./object/findLastKey.mjs"; +import { forIn } from "./object/forIn.mjs"; +import { forInRight } from "./object/forInRight.mjs"; +import { forOwn } from "./object/forOwn.mjs"; +import { forOwnRight } from "./object/forOwnRight.mjs"; +import { fromPairs } from "./object/fromPairs.mjs"; +import { functions } from "./object/functions.mjs"; +import { functionsIn } from "./object/functionsIn.mjs"; +import { get } from "./object/get.mjs"; +import { has } from "./object/has.mjs"; +import { hasIn } from "./object/hasIn.mjs"; +import { invert } from "./object/invert.mjs"; +import { invertBy } from "./object/invertBy.mjs"; +import { keys } from "./object/keys.mjs"; +import { keysIn } from "./object/keysIn.mjs"; +import { mapKeys } from "./object/mapKeys.mjs"; +import { mapValues } from "./object/mapValues.mjs"; +import { merge } from "./object/merge.mjs"; +import { mergeWith } from "./object/mergeWith.mjs"; +import { omit } from "./object/omit.mjs"; +import { omitBy } from "./object/omitBy.mjs"; +import { pick } from "./object/pick.mjs"; +import { pickBy } from "./object/pickBy.mjs"; +import { property } from "./object/property.mjs"; +import { propertyOf } from "./object/propertyOf.mjs"; +import { result } from "./object/result.mjs"; +import { set } from "./object/set.mjs"; +import { setWith } from "./object/setWith.mjs"; +import { toDefaulted } from "./object/toDefaulted.mjs"; +import { toPairs } from "./object/toPairs.mjs"; +import { toPairsIn } from "./object/toPairsIn.mjs"; +import { transform } from "./object/transform.mjs"; +import { unset } from "./object/unset.mjs"; +import { update } from "./object/update.mjs"; +import { updateWith } from "./object/updateWith.mjs"; +import { values } from "./object/values.mjs"; +import { valuesIn } from "./object/valuesIn.mjs"; +import { isFunction } from "./predicate/isFunction.mjs"; +import { isLength } from "./predicate/isLength.mjs"; +import { isMatchWith } from "./predicate/isMatchWith.mjs"; +import { isNative } from "./predicate/isNative.mjs"; +import { isNull } from "./predicate/isNull.mjs"; +import { isUndefined } from "./predicate/isUndefined.mjs"; +import { conforms } from "./predicate/conforms.mjs"; +import { conformsTo } from "./predicate/conformsTo.mjs"; +import { isArguments } from "./predicate/isArguments.mjs"; +import { isArray } from "./predicate/isArray.mjs"; +import { isArrayBuffer } from "./predicate/isArrayBuffer.mjs"; +import { isArrayLike } from "./predicate/isArrayLike.mjs"; +import { isArrayLikeObject } from "./predicate/isArrayLikeObject.mjs"; +import { isBoolean } from "./predicate/isBoolean.mjs"; +import { isBuffer } from "./predicate/isBuffer.mjs"; +import { isDate } from "./predicate/isDate.mjs"; +import { isElement } from "./predicate/isElement.mjs"; +import { isEmpty } from "./predicate/isEmpty.mjs"; +import { isEqualWith } from "./predicate/isEqualWith.mjs"; +import { isError } from "./predicate/isError.mjs"; +import { isFinite } from "./predicate/isFinite.mjs"; +import { isInteger } from "./predicate/isInteger.mjs"; +import { isMap } from "./predicate/isMap.mjs"; +import { isMatch } from "./predicate/isMatch.mjs"; +import { isNaN } from "./predicate/isNaN.mjs"; +import { isNil } from "./predicate/isNil.mjs"; +import { isNumber } from "./predicate/isNumber.mjs"; +import { isObject } from "./predicate/isObject.mjs"; +import { isObjectLike } from "./predicate/isObjectLike.mjs"; +import { isPlainObject } from "./predicate/isPlainObject.mjs"; +import { isRegExp } from "./predicate/isRegExp.mjs"; +import { isSafeInteger } from "./predicate/isSafeInteger.mjs"; +import { isSet } from "./predicate/isSet.mjs"; +import { isString } from "./predicate/isString.mjs"; +import { isSymbol } from "./predicate/isSymbol.mjs"; +import { isTypedArray } from "./predicate/isTypedArray.mjs"; +import { isWeakMap } from "./predicate/isWeakMap.mjs"; +import { isWeakSet } from "./predicate/isWeakSet.mjs"; +import { matches } from "./predicate/matches.mjs"; +import { matchesProperty } from "./predicate/matchesProperty.mjs"; +import { capitalize } from "./string/capitalize.mjs"; +import { bindAll } from "./util/bindAll.mjs"; +import { camelCase } from "./string/camelCase.mjs"; +import { deburr } from "./string/deburr.mjs"; +import { endsWith } from "./string/endsWith.mjs"; +import { escape } from "./string/escape.mjs"; +import { escapeRegExp } from "./string/escapeRegExp.mjs"; +import { kebabCase } from "./string/kebabCase.mjs"; +import { lowerCase } from "./string/lowerCase.mjs"; +import { lowerFirst } from "./string/lowerFirst.mjs"; +import { pad } from "./string/pad.mjs"; +import { padEnd } from "./string/padEnd.mjs"; +import { padStart } from "./string/padStart.mjs"; +import { repeat } from "./string/repeat.mjs"; +import { replace } from "./string/replace.mjs"; +import { snakeCase } from "./string/snakeCase.mjs"; +import { split } from "./string/split.mjs"; +import { startCase } from "./string/startCase.mjs"; +import { startsWith } from "./string/startsWith.mjs"; +import { template, templateSettings } from "./string/template.mjs"; +import { toLower } from "./string/toLower.mjs"; +import { toUpper } from "./string/toUpper.mjs"; +import { trim } from "./string/trim.mjs"; +import { trimEnd } from "./string/trimEnd.mjs"; +import { trimStart } from "./string/trimStart.mjs"; +import { truncate } from "./string/truncate.mjs"; +import { unescape } from "./string/unescape.mjs"; +import { upperCase } from "./string/upperCase.mjs"; +import { upperFirst } from "./string/upperFirst.mjs"; +import { words } from "./string/words.mjs"; +import { cond } from "./util/cond.mjs"; +import { constant } from "./util/constant.mjs"; +import { defaultTo } from "./util/defaultTo.mjs"; +import { isEqualsSameValueZero } from "../_internal/isEqualsSameValueZero.mjs"; +import { gt } from "./util/gt.mjs"; +import { gte } from "./util/gte.mjs"; +import { invoke } from "./util/invoke.mjs"; +import { iteratee } from "./util/iteratee.mjs"; +import { lt } from "./util/lt.mjs"; +import { lte } from "./util/lte.mjs"; +import { method } from "./util/method.mjs"; +import { methodOf } from "./util/methodOf.mjs"; +import { now } from "./util/now.mjs"; +import { over } from "./util/over.mjs"; +import { overEvery } from "./util/overEvery.mjs"; +import { overSome } from "./util/overSome.mjs"; +import { stubArray } from "./util/stubArray.mjs"; +import { stubFalse } from "./util/stubFalse.mjs"; +import { stubObject } from "./util/stubObject.mjs"; +import { stubString } from "./util/stubString.mjs"; +import { stubTrue } from "./util/stubTrue.mjs"; +import { times } from "./util/times.mjs"; +import { toArray } from "./util/toArray.mjs"; +import { toFinite } from "./util/toFinite.mjs"; +import { toInteger } from "./util/toInteger.mjs"; +import { toLength } from "./util/toLength.mjs"; +import { toNumber } from "./util/toNumber.mjs"; +import { toPath } from "./util/toPath.mjs"; +import { toPlainObject } from "./util/toPlainObject.mjs"; +import { toSafeInteger } from "./util/toSafeInteger.mjs"; +import { toString } from "./util/toString.mjs"; +import { uniqueId } from "./util/uniqueId.mjs"; + +//#region src/compat/compat.d.ts +declare namespace compat_d_exports { + export { DebouncedFunc, add, after, ary, assign, assignIn, assignInWith, assignWith, at, attempt, before, bind, bindAll, bindKey, camelCase, capitalize, castArray, ceil, chunk, clamp, clone, cloneDeep, cloneDeepWith, cloneWith, compact, concat, cond, conforms, conformsTo, constant, countBy, create, curry, curryRight, debounce, deburr, defaultTo, defaults, defaultsDeep, defer, delay, difference, differenceBy, differenceWith, divide, drop, dropRight, dropRightWhile, dropWhile, forEach as each, forEachRight as eachRight, endsWith, isEqualsSameValueZero as eq, escape, escapeRegExp, every, assignIn as extend, assignInWith as extendWith, fill, filter, find, findIndex, findKey, findLast, findLastIndex, findLastKey, head as first, flatMap, flatMapDeep, flatMapDepth, flatten, flattenDeep, flattenDepth, flip, floor, flow, flowRight, forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, fromPairs, functions, functionsIn, get, groupBy, gt, gte, has, hasIn, head, identity, inRange, includes, indexOf, initial, intersection, intersectionBy, intersectionWith, invert, invertBy, invoke, invokeMap, isArguments, isArray, isArrayBuffer, isArrayLike, isArrayLikeObject, isBoolean, isBuffer, isDate, isElement, isEmpty, isEqual, isEqualWith, isError, isFinite, isFunction, isInteger, isLength, isMap, isMatch, isMatchWith, isNaN, isNative, isNil, isNull, isNumber, isObject, isObjectLike, isPlainObject, isRegExp, isSafeInteger, isSet, isString, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet, iteratee, join, kebabCase, keyBy, keys, keysIn, last, lastIndexOf, lowerCase, lowerFirst, lt, lte, map, mapKeys, mapValues, matches, matchesProperty, max, maxBy, mean, meanBy, memoize, merge, mergeWith, method, methodOf, min, minBy, multiply, negate, noop, now, nth, nthArg, omit, omitBy, once, orderBy, over, overArgs, overEvery, overSome, pad, padEnd, padStart, parseInt, partial, partialRight, partition, pick, pickBy, property, propertyOf, pull, pullAll, pullAllBy, pullAllWith, pullAt, random, range, rangeRight, rearg, reduce, reduceRight, reject, remove, repeat, replace, rest, result, reverse, round, sample, sampleSize, set, setWith, shuffle, size, slice, snakeCase, some, sortBy, sortedIndex, sortedIndexBy, sortedIndexOf, sortedLastIndex, sortedLastIndexBy, sortedLastIndexOf, split, spread, startCase, startsWith, stubArray, stubFalse, stubObject, stubString, stubTrue, subtract, sum, sumBy, tail, take, takeRight, takeRightWhile, takeWhile, template, templateSettings, throttle, times, toArray, toDefaulted, toFinite, toInteger, toLength, toLower, toNumber, toPairs, toPairsIn, toPath, toPlainObject, toSafeInteger, toString, toUpper, transform, trim, trimEnd, trimStart, truncate, unary, unescape, union, unionBy, unionWith, uniq, uniqBy, uniqWith, uniqueId, unset, unzip, unzipWith, update, updateWith, upperCase, upperFirst, values, valuesIn, without, words, wrap, xor, xorBy, xorWith, zip, zipObject, zipObjectDeep, zipWith }; +} +//#endregion +export { compat_d_exports }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/compat.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/compat.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5e0055dd732a52718f4d4725089a587de5d9392d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/compat.d.ts @@ -0,0 +1,298 @@ +import { castArray } from "./array/castArray.js"; +import { chunk } from "./array/chunk.js"; +import { compact } from "./array/compact.js"; +import { concat } from "./array/concat.js"; +import { countBy } from "./array/countBy.js"; +import { difference } from "./array/difference.js"; +import { differenceBy } from "./array/differenceBy.js"; +import { differenceWith } from "./array/differenceWith.js"; +import { drop } from "./array/drop.js"; +import { dropRight } from "./array/dropRight.js"; +import { dropRightWhile } from "./array/dropRightWhile.js"; +import { dropWhile } from "./array/dropWhile.js"; +import { forEach } from "./array/forEach.js"; +import { forEachRight } from "./array/forEachRight.js"; +import { every } from "./array/every.js"; +import { fill } from "./array/fill.js"; +import { filter } from "./array/filter.js"; +import { find } from "./array/find.js"; +import { findIndex } from "./array/findIndex.js"; +import { findLast } from "./array/findLast.js"; +import { findLastIndex } from "./array/findLastIndex.js"; +import { head } from "./array/head.js"; +import { flatMap } from "./array/flatMap.js"; +import { flatMapDeep } from "./array/flatMapDeep.js"; +import { flatMapDepth } from "./array/flatMapDepth.js"; +import { flatten } from "./array/flatten.js"; +import { flattenDeep } from "./array/flattenDeep.js"; +import { flattenDepth } from "./array/flattenDepth.js"; +import { groupBy } from "./array/groupBy.js"; +import { includes } from "./array/includes.js"; +import { indexOf } from "./array/indexOf.js"; +import { initial } from "./array/initial.js"; +import { intersection } from "./array/intersection.js"; +import { intersectionBy } from "./array/intersectionBy.js"; +import { intersectionWith } from "./array/intersectionWith.js"; +import { invokeMap } from "./array/invokeMap.js"; +import { join } from "./array/join.js"; +import { keyBy } from "./array/keyBy.js"; +import { last } from "./array/last.js"; +import { lastIndexOf } from "./array/lastIndexOf.js"; +import { map } from "./array/map.js"; +import { nth } from "./array/nth.js"; +import { orderBy } from "./array/orderBy.js"; +import { partition } from "./array/partition.js"; +import { pull } from "./array/pull.js"; +import { pullAll } from "./array/pullAll.js"; +import { pullAllBy } from "./array/pullAllBy.js"; +import { pullAllWith } from "./array/pullAllWith.js"; +import { pullAt } from "./array/pullAt.js"; +import { reduce } from "./array/reduce.js"; +import { reduceRight } from "./array/reduceRight.js"; +import { reject } from "./array/reject.js"; +import { remove } from "./array/remove.js"; +import { reverse } from "./array/reverse.js"; +import { sample } from "./array/sample.js"; +import { sampleSize } from "./array/sampleSize.js"; +import { shuffle } from "./array/shuffle.js"; +import { size } from "./array/size.js"; +import { slice } from "./array/slice.js"; +import { some } from "./array/some.js"; +import { sortBy } from "./array/sortBy.js"; +import { sortedIndex } from "./array/sortedIndex.js"; +import { sortedIndexBy } from "./array/sortedIndexBy.js"; +import { sortedIndexOf } from "./array/sortedIndexOf.js"; +import { sortedLastIndex } from "./array/sortedLastIndex.js"; +import { sortedLastIndexBy } from "./array/sortedLastIndexBy.js"; +import { sortedLastIndexOf } from "./array/sortedLastIndexOf.js"; +import { tail } from "./array/tail.js"; +import { take } from "./array/take.js"; +import { takeRight } from "./array/takeRight.js"; +import { takeRightWhile } from "./array/takeRightWhile.js"; +import { takeWhile } from "./array/takeWhile.js"; +import { union } from "./array/union.js"; +import { unionBy } from "./array/unionBy.js"; +import { unionWith } from "./array/unionWith.js"; +import { uniq } from "./array/uniq.js"; +import { uniqBy } from "./array/uniqBy.js"; +import { uniqWith } from "./array/uniqWith.js"; +import { unzip } from "./array/unzip.js"; +import { unzipWith } from "./array/unzipWith.js"; +import { without } from "./array/without.js"; +import { xor } from "./array/xor.js"; +import { xorBy } from "./array/xorBy.js"; +import { xorWith } from "./array/xorWith.js"; +import { zip } from "./array/zip.js"; +import { zipObject } from "./array/zipObject.js"; +import { zipObjectDeep } from "./array/zipObjectDeep.js"; +import { zipWith } from "./array/zipWith.js"; +import { after } from "./function/after.js"; +import { ary } from "./function/ary.js"; +import { attempt } from "./function/attempt.js"; +import { before } from "./function/before.js"; +import { bind } from "./function/bind.js"; +import { bindKey } from "./function/bindKey.js"; +import { curry } from "./function/curry.js"; +import { curryRight } from "./function/curryRight.js"; +import { DebouncedFunc, debounce } from "./function/debounce.js"; +import { defer } from "./function/defer.js"; +import { delay } from "./function/delay.js"; +import { flip } from "./function/flip.js"; +import { flow } from "./function/flow.js"; +import { flowRight } from "./function/flowRight.js"; +import { memoize } from "./function/memoize.js"; +import { negate } from "./function/negate.js"; +import { nthArg } from "./function/nthArg.js"; +import { once } from "./function/once.js"; +import { overArgs } from "./function/overArgs.js"; +import { partial } from "./function/partial.js"; +import { partialRight } from "./function/partialRight.js"; +import { rearg } from "./function/rearg.js"; +import { rest } from "./function/rest.js"; +import { spread } from "./function/spread.js"; +import { throttle } from "./function/throttle.js"; +import { unary } from "./function/unary.js"; +import { wrap } from "./function/wrap.js"; +import { add } from "./math/add.js"; +import { ceil } from "./math/ceil.js"; +import { clamp } from "./math/clamp.js"; +import { divide } from "./math/divide.js"; +import { floor } from "./math/floor.js"; +import { inRange } from "./math/inRange.js"; +import { max } from "./math/max.js"; +import { maxBy } from "./math/maxBy.js"; +import { mean } from "./math/mean.js"; +import { meanBy } from "./math/meanBy.js"; +import { min } from "./math/min.js"; +import { minBy } from "./math/minBy.js"; +import { multiply } from "./math/multiply.js"; +import { parseInt } from "./math/parseInt.js"; +import { random } from "./math/random.js"; +import { range } from "./math/range.js"; +import { rangeRight } from "./math/rangeRight.js"; +import { round } from "./math/round.js"; +import { subtract } from "./math/subtract.js"; +import { sum } from "./math/sum.js"; +import { sumBy } from "./math/sumBy.js"; +import { isEqual } from "../predicate/isEqual.js"; +import { identity } from "./function/identity.js"; +import { noop } from "./function/noop.js"; +import { assign } from "./object/assign.js"; +import { assignIn } from "./object/assignIn.js"; +import { assignInWith } from "./object/assignInWith.js"; +import { assignWith } from "./object/assignWith.js"; +import { at } from "./object/at.js"; +import { clone } from "./object/clone.js"; +import { cloneDeep } from "./object/cloneDeep.js"; +import { cloneDeepWith } from "./object/cloneDeepWith.js"; +import { cloneWith } from "./object/cloneWith.js"; +import { create } from "./object/create.js"; +import { defaults } from "./object/defaults.js"; +import { defaultsDeep } from "./object/defaultsDeep.js"; +import { findKey } from "./object/findKey.js"; +import { findLastKey } from "./object/findLastKey.js"; +import { forIn } from "./object/forIn.js"; +import { forInRight } from "./object/forInRight.js"; +import { forOwn } from "./object/forOwn.js"; +import { forOwnRight } from "./object/forOwnRight.js"; +import { fromPairs } from "./object/fromPairs.js"; +import { functions } from "./object/functions.js"; +import { functionsIn } from "./object/functionsIn.js"; +import { get } from "./object/get.js"; +import { has } from "./object/has.js"; +import { hasIn } from "./object/hasIn.js"; +import { invert } from "./object/invert.js"; +import { invertBy } from "./object/invertBy.js"; +import { keys } from "./object/keys.js"; +import { keysIn } from "./object/keysIn.js"; +import { mapKeys } from "./object/mapKeys.js"; +import { mapValues } from "./object/mapValues.js"; +import { merge } from "./object/merge.js"; +import { mergeWith } from "./object/mergeWith.js"; +import { omit } from "./object/omit.js"; +import { omitBy } from "./object/omitBy.js"; +import { pick } from "./object/pick.js"; +import { pickBy } from "./object/pickBy.js"; +import { property } from "./object/property.js"; +import { propertyOf } from "./object/propertyOf.js"; +import { result } from "./object/result.js"; +import { set } from "./object/set.js"; +import { setWith } from "./object/setWith.js"; +import { toDefaulted } from "./object/toDefaulted.js"; +import { toPairs } from "./object/toPairs.js"; +import { toPairsIn } from "./object/toPairsIn.js"; +import { transform } from "./object/transform.js"; +import { unset } from "./object/unset.js"; +import { update } from "./object/update.js"; +import { updateWith } from "./object/updateWith.js"; +import { values } from "./object/values.js"; +import { valuesIn } from "./object/valuesIn.js"; +import { isFunction } from "./predicate/isFunction.js"; +import { isLength } from "./predicate/isLength.js"; +import { isMatchWith } from "./predicate/isMatchWith.js"; +import { isNative } from "./predicate/isNative.js"; +import { isNull } from "./predicate/isNull.js"; +import { isUndefined } from "./predicate/isUndefined.js"; +import { conforms } from "./predicate/conforms.js"; +import { conformsTo } from "./predicate/conformsTo.js"; +import { isArguments } from "./predicate/isArguments.js"; +import { isArray } from "./predicate/isArray.js"; +import { isArrayBuffer } from "./predicate/isArrayBuffer.js"; +import { isArrayLike } from "./predicate/isArrayLike.js"; +import { isArrayLikeObject } from "./predicate/isArrayLikeObject.js"; +import { isBoolean } from "./predicate/isBoolean.js"; +import { isBuffer } from "./predicate/isBuffer.js"; +import { isDate } from "./predicate/isDate.js"; +import { isElement } from "./predicate/isElement.js"; +import { isEmpty } from "./predicate/isEmpty.js"; +import { isEqualWith } from "./predicate/isEqualWith.js"; +import { isError } from "./predicate/isError.js"; +import { isFinite } from "./predicate/isFinite.js"; +import { isInteger } from "./predicate/isInteger.js"; +import { isMap } from "./predicate/isMap.js"; +import { isMatch } from "./predicate/isMatch.js"; +import { isNaN } from "./predicate/isNaN.js"; +import { isNil } from "./predicate/isNil.js"; +import { isNumber } from "./predicate/isNumber.js"; +import { isObject } from "./predicate/isObject.js"; +import { isObjectLike } from "./predicate/isObjectLike.js"; +import { isPlainObject } from "./predicate/isPlainObject.js"; +import { isRegExp } from "./predicate/isRegExp.js"; +import { isSafeInteger } from "./predicate/isSafeInteger.js"; +import { isSet } from "./predicate/isSet.js"; +import { isString } from "./predicate/isString.js"; +import { isSymbol } from "./predicate/isSymbol.js"; +import { isTypedArray } from "./predicate/isTypedArray.js"; +import { isWeakMap } from "./predicate/isWeakMap.js"; +import { isWeakSet } from "./predicate/isWeakSet.js"; +import { matches } from "./predicate/matches.js"; +import { matchesProperty } from "./predicate/matchesProperty.js"; +import { capitalize } from "./string/capitalize.js"; +import { bindAll } from "./util/bindAll.js"; +import { camelCase } from "./string/camelCase.js"; +import { deburr } from "./string/deburr.js"; +import { endsWith } from "./string/endsWith.js"; +import { escape } from "./string/escape.js"; +import { escapeRegExp } from "./string/escapeRegExp.js"; +import { kebabCase } from "./string/kebabCase.js"; +import { lowerCase } from "./string/lowerCase.js"; +import { lowerFirst } from "./string/lowerFirst.js"; +import { pad } from "./string/pad.js"; +import { padEnd } from "./string/padEnd.js"; +import { padStart } from "./string/padStart.js"; +import { repeat } from "./string/repeat.js"; +import { replace } from "./string/replace.js"; +import { snakeCase } from "./string/snakeCase.js"; +import { split } from "./string/split.js"; +import { startCase } from "./string/startCase.js"; +import { startsWith } from "./string/startsWith.js"; +import { template, templateSettings } from "./string/template.js"; +import { toLower } from "./string/toLower.js"; +import { toUpper } from "./string/toUpper.js"; +import { trim } from "./string/trim.js"; +import { trimEnd } from "./string/trimEnd.js"; +import { trimStart } from "./string/trimStart.js"; +import { truncate } from "./string/truncate.js"; +import { unescape } from "./string/unescape.js"; +import { upperCase } from "./string/upperCase.js"; +import { upperFirst } from "./string/upperFirst.js"; +import { words } from "./string/words.js"; +import { cond } from "./util/cond.js"; +import { constant } from "./util/constant.js"; +import { defaultTo } from "./util/defaultTo.js"; +import { isEqualsSameValueZero } from "../_internal/isEqualsSameValueZero.js"; +import { gt } from "./util/gt.js"; +import { gte } from "./util/gte.js"; +import { invoke } from "./util/invoke.js"; +import { iteratee } from "./util/iteratee.js"; +import { lt } from "./util/lt.js"; +import { lte } from "./util/lte.js"; +import { method } from "./util/method.js"; +import { methodOf } from "./util/methodOf.js"; +import { now } from "./util/now.js"; +import { over } from "./util/over.js"; +import { overEvery } from "./util/overEvery.js"; +import { overSome } from "./util/overSome.js"; +import { stubArray } from "./util/stubArray.js"; +import { stubFalse } from "./util/stubFalse.js"; +import { stubObject } from "./util/stubObject.js"; +import { stubString } from "./util/stubString.js"; +import { stubTrue } from "./util/stubTrue.js"; +import { times } from "./util/times.js"; +import { toArray } from "./util/toArray.js"; +import { toFinite } from "./util/toFinite.js"; +import { toInteger } from "./util/toInteger.js"; +import { toLength } from "./util/toLength.js"; +import { toNumber } from "./util/toNumber.js"; +import { toPath } from "./util/toPath.js"; +import { toPlainObject } from "./util/toPlainObject.js"; +import { toSafeInteger } from "./util/toSafeInteger.js"; +import { toString } from "./util/toString.js"; +import { uniqueId } from "./util/uniqueId.js"; + +//#region src/compat/compat.d.ts +declare namespace compat_d_exports { + export { DebouncedFunc, add, after, ary, assign, assignIn, assignInWith, assignWith, at, attempt, before, bind, bindAll, bindKey, camelCase, capitalize, castArray, ceil, chunk, clamp, clone, cloneDeep, cloneDeepWith, cloneWith, compact, concat, cond, conforms, conformsTo, constant, countBy, create, curry, curryRight, debounce, deburr, defaultTo, defaults, defaultsDeep, defer, delay, difference, differenceBy, differenceWith, divide, drop, dropRight, dropRightWhile, dropWhile, forEach as each, forEachRight as eachRight, endsWith, isEqualsSameValueZero as eq, escape, escapeRegExp, every, assignIn as extend, assignInWith as extendWith, fill, filter, find, findIndex, findKey, findLast, findLastIndex, findLastKey, head as first, flatMap, flatMapDeep, flatMapDepth, flatten, flattenDeep, flattenDepth, flip, floor, flow, flowRight, forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, fromPairs, functions, functionsIn, get, groupBy, gt, gte, has, hasIn, head, identity, inRange, includes, indexOf, initial, intersection, intersectionBy, intersectionWith, invert, invertBy, invoke, invokeMap, isArguments, isArray, isArrayBuffer, isArrayLike, isArrayLikeObject, isBoolean, isBuffer, isDate, isElement, isEmpty, isEqual, isEqualWith, isError, isFinite, isFunction, isInteger, isLength, isMap, isMatch, isMatchWith, isNaN, isNative, isNil, isNull, isNumber, isObject, isObjectLike, isPlainObject, isRegExp, isSafeInteger, isSet, isString, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet, iteratee, join, kebabCase, keyBy, keys, keysIn, last, lastIndexOf, lowerCase, lowerFirst, lt, lte, map, mapKeys, mapValues, matches, matchesProperty, max, maxBy, mean, meanBy, memoize, merge, mergeWith, method, methodOf, min, minBy, multiply, negate, noop, now, nth, nthArg, omit, omitBy, once, orderBy, over, overArgs, overEvery, overSome, pad, padEnd, padStart, parseInt, partial, partialRight, partition, pick, pickBy, property, propertyOf, pull, pullAll, pullAllBy, pullAllWith, pullAt, random, range, rangeRight, rearg, reduce, reduceRight, reject, remove, repeat, replace, rest, result, reverse, round, sample, sampleSize, set, setWith, shuffle, size, slice, snakeCase, some, sortBy, sortedIndex, sortedIndexBy, sortedIndexOf, sortedLastIndex, sortedLastIndexBy, sortedLastIndexOf, split, spread, startCase, startsWith, stubArray, stubFalse, stubObject, stubString, stubTrue, subtract, sum, sumBy, tail, take, takeRight, takeRightWhile, takeWhile, template, templateSettings, throttle, times, toArray, toDefaulted, toFinite, toInteger, toLength, toLower, toNumber, toPairs, toPairsIn, toPath, toPlainObject, toSafeInteger, toString, toUpper, transform, trim, trimEnd, trimStart, truncate, unary, unescape, union, unionBy, unionWith, uniq, uniqBy, uniqWith, uniqueId, unset, unzip, unzipWith, update, updateWith, upperCase, upperFirst, values, valuesIn, without, words, wrap, xor, xorBy, xorWith, zip, zipObject, zipObjectDeep, zipWith }; +} +//#endregion +export { compat_d_exports }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/compat.js b/tools/ui/node_modules/es-toolkit/dist/compat/compat.js new file mode 100644 index 0000000000000000000000000000000000000000..4ce7a36d6dbf7863dd8e841eae1d75bccbbe7fb6 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/compat.js @@ -0,0 +1,606 @@ +const require_runtime = require("../_virtual/_rolldown/runtime.js"); +const require_isSymbol = require("./predicate/isSymbol.js"); +const require_toNumber = require("./util/toNumber.js"); +const require_toFinite = require("./util/toFinite.js"); +const require_toInteger = require("./util/toInteger.js"); +const require_isArray = require("./predicate/isArray.js"); +const require_isPlainObject = require("./predicate/isPlainObject.js"); +const require_isEqualsSameValueZero = require("../_internal/isEqualsSameValueZero.js"); +require("./util/eq.js"); +const require_isEqual = require("../predicate/isEqual.js"); +const require_castArray = require("./array/castArray.js"); +const require_isArrayLike = require("./predicate/isArrayLike.js"); +const require_chunk = require("./array/chunk.js"); +const require_compact = require("./array/compact.js"); +const require_concat = require("./array/concat.js"); +const require_toString = require("./util/toString.js"); +const require_toPath = require("./util/toPath.js"); +const require_get = require("./object/get.js"); +const require_property = require("./object/property.js"); +const require_isObject = require("./predicate/isObject.js"); +const require_isMatchWith = require("./predicate/isMatchWith.js"); +const require_isMatch = require("./predicate/isMatch.js"); +const require_matches = require("./predicate/matches.js"); +const require_cloneDeepWith = require("./object/cloneDeepWith.js"); +const require_cloneDeep = require("./object/cloneDeep.js"); +const require_isArguments = require("./predicate/isArguments.js"); +const require_has = require("./object/has.js"); +const require_matchesProperty = require("./predicate/matchesProperty.js"); +const require_iteratee = require("./util/iteratee.js"); +const require_countBy = require("./array/countBy.js"); +const require_isObjectLike = require("./predicate/isObjectLike.js"); +const require_isArrayLikeObject = require("./predicate/isArrayLikeObject.js"); +const require_difference = require("./array/difference.js"); +const require_last = require("./array/last.js"); +const require_differenceBy = require("./array/differenceBy.js"); +const require_differenceWith = require("./array/differenceWith.js"); +const require_drop = require("./array/drop.js"); +const require_dropRight = require("./array/dropRight.js"); +const require_dropRightWhile = require("./array/dropRightWhile.js"); +const require_dropWhile = require("./array/dropWhile.js"); +const require_forEach = require("./array/forEach.js"); +require("./array/each.js"); +const require_forEachRight = require("./array/forEachRight.js"); +require("./array/eachRight.js"); +const require_every = require("./array/every.js"); +const require_isString = require("./predicate/isString.js"); +const require_fill = require("./array/fill.js"); +const require_filter = require("./array/filter.js"); +const require_find = require("./array/find.js"); +const require_identity = require("./function/identity.js"); +const require_findIndex = require("./array/findIndex.js"); +const require_findLast = require("./array/findLast.js"); +const require_findLastIndex = require("./array/findLastIndex.js"); +const require_head = require("./array/head.js"); +require("./array/first.js"); +const require_flatten = require("./array/flatten.js"); +const require_flattenDepth = require("./array/flattenDepth.js"); +const require_map = require("./array/map.js"); +const require_flatMap = require("./array/flatMap.js"); +const require_flatMapDepth = require("./array/flatMapDepth.js"); +const require_flatMapDeep = require("./array/flatMapDeep.js"); +const require_flattenDeep = require("./array/flattenDeep.js"); +const require_groupBy = require("./array/groupBy.js"); +const require_includes = require("./array/includes.js"); +const require_indexOf = require("./array/indexOf.js"); +const require_initial = require("./array/initial.js"); +const require_intersection = require("./array/intersection.js"); +const require_intersectionBy = require("./array/intersectionBy.js"); +const require_uniq = require("./array/uniq.js"); +const require_intersectionWith = require("./array/intersectionWith.js"); +const require_invokeMap = require("./array/invokeMap.js"); +const require_join = require("./array/join.js"); +const require_reduce = require("./array/reduce.js"); +const require_keyBy = require("./array/keyBy.js"); +const require_lastIndexOf = require("./array/lastIndexOf.js"); +const require_nth = require("./array/nth.js"); +const require_orderBy = require("./array/orderBy.js"); +const require_partition = require("./array/partition.js"); +const require_pull = require("./array/pull.js"); +const require_pullAll = require("./array/pullAll.js"); +const require_pullAllBy = require("./array/pullAllBy.js"); +const require_pullAllWith = require("./array/pullAllWith.js"); +const require_at = require("./object/at.js"); +const require_unset = require("./object/unset.js"); +const require_pullAt = require("./array/pullAt.js"); +const require_reduceRight = require("./array/reduceRight.js"); +const require_negate = require("./function/negate.js"); +const require_reject = require("./array/reject.js"); +const require_remove = require("./array/remove.js"); +const require_reverse = require("./array/reverse.js"); +const require_sample = require("./array/sample.js"); +const require_clamp = require("./math/clamp.js"); +const require_isMap = require("./predicate/isMap.js"); +const require_toArray = require("./util/toArray.js"); +const require_sampleSize = require("./array/sampleSize.js"); +const require_values = require("./object/values.js"); +const require_isNil = require("./predicate/isNil.js"); +const require_shuffle = require("./array/shuffle.js"); +const require_size = require("./array/size.js"); +const require_slice = require("./array/slice.js"); +const require_some = require("./array/some.js"); +const require_sortBy = require("./array/sortBy.js"); +const require_isNaN = require("./predicate/isNaN.js"); +const require_sortedIndexBy = require("./array/sortedIndexBy.js"); +const require_isNumber = require("./predicate/isNumber.js"); +const require_sortedIndex = require("./array/sortedIndex.js"); +const require_sortedIndexOf = require("./array/sortedIndexOf.js"); +const require_sortedLastIndexBy = require("./array/sortedLastIndexBy.js"); +const require_sortedLastIndex = require("./array/sortedLastIndex.js"); +const require_sortedLastIndexOf = require("./array/sortedLastIndexOf.js"); +const require_tail = require("./array/tail.js"); +const require_take = require("./array/take.js"); +const require_takeRight = require("./array/takeRight.js"); +const require_takeRightWhile = require("./array/takeRightWhile.js"); +const require_takeWhile = require("./array/takeWhile.js"); +const require_union = require("./array/union.js"); +const require_unionBy = require("./array/unionBy.js"); +const require_unionWith = require("./array/unionWith.js"); +const require_uniqBy = require("./array/uniqBy.js"); +const require_uniqWith = require("./array/uniqWith.js"); +const require_unzip = require("./array/unzip.js"); +const require_unzipWith = require("./array/unzipWith.js"); +const require_without = require("./array/without.js"); +const require_xor = require("./array/xor.js"); +const require_xorBy = require("./array/xorBy.js"); +const require_xorWith = require("./array/xorWith.js"); +const require_zip = require("./array/zip.js"); +const require_zipObject = require("./array/zipObject.js"); +const require_updateWith = require("./object/updateWith.js"); +const require_set = require("./object/set.js"); +const require_zipObjectDeep = require("./array/zipObjectDeep.js"); +const require_zipWith = require("./array/zipWith.js"); +const require_after = require("./function/after.js"); +const require_ary = require("./function/ary.js"); +const require_attempt = require("./function/attempt.js"); +const require_before = require("./function/before.js"); +const require_bind = require("./function/bind.js"); +const require_bindKey = require("./function/bindKey.js"); +const require_curry = require("./function/curry.js"); +const require_curryRight = require("./function/curryRight.js"); +const require_debounce = require("./function/debounce.js"); +const require_defer = require("./function/defer.js"); +const require_delay = require("./function/delay.js"); +const require_flip = require("./function/flip.js"); +const require_flow = require("./function/flow.js"); +const require_flowRight = require("./function/flowRight.js"); +const require_memoize = require("./function/memoize.js"); +const require_nthArg = require("./function/nthArg.js"); +const require_once = require("./function/once.js"); +const require_overArgs = require("./function/overArgs.js"); +const require_partial = require("./function/partial.js"); +const require_partialRight = require("./function/partialRight.js"); +const require_rearg = require("./function/rearg.js"); +const require_rest = require("./function/rest.js"); +const require_spread = require("./function/spread.js"); +const require_throttle = require("./function/throttle.js"); +const require_unary = require("./function/unary.js"); +const require_wrap = require("./function/wrap.js"); +const require_add = require("./math/add.js"); +const require_ceil = require("./math/ceil.js"); +const require_divide = require("./math/divide.js"); +const require_floor = require("./math/floor.js"); +const require_inRange = require("./math/inRange.js"); +const require_max = require("./math/max.js"); +const require_maxBy = require("./math/maxBy.js"); +const require_sumBy = require("./math/sumBy.js"); +const require_sum = require("./math/sum.js"); +const require_mean = require("./math/mean.js"); +const require_meanBy = require("./math/meanBy.js"); +const require_min = require("./math/min.js"); +const require_minBy = require("./math/minBy.js"); +const require_multiply = require("./math/multiply.js"); +const require_parseInt = require("./math/parseInt.js"); +const require_random = require("./math/random.js"); +const require_range = require("./math/range.js"); +const require_rangeRight = require("./math/rangeRight.js"); +const require_round = require("./math/round.js"); +const require_subtract = require("./math/subtract.js"); +const require_noop = require("./function/noop.js"); +const require_isTypedArray = require("./predicate/isTypedArray.js"); +const require_times = require("./util/times.js"); +const require_keys = require("./object/keys.js"); +const require_assign = require("./object/assign.js"); +const require_keysIn = require("./object/keysIn.js"); +const require_assignIn = require("./object/assignIn.js"); +const require_assignInWith = require("./object/assignInWith.js"); +const require_assignWith = require("./object/assignWith.js"); +const require_clone = require("./object/clone.js"); +const require_cloneWith = require("./object/cloneWith.js"); +const require_create = require("./object/create.js"); +const require_defaults = require("./object/defaults.js"); +const require_defaultsDeep = require("./object/defaultsDeep.js"); +require("./object/extend.js"); +require("./object/extendWith.js"); +const require_findKey = require("./object/findKey.js"); +const require_findLastKey = require("./object/findLastKey.js"); +const require_forIn = require("./object/forIn.js"); +const require_forInRight = require("./object/forInRight.js"); +const require_forOwn = require("./object/forOwn.js"); +const require_forOwnRight = require("./object/forOwnRight.js"); +const require_fromPairs = require("./object/fromPairs.js"); +const require_functions = require("./object/functions.js"); +const require_functionsIn = require("./object/functionsIn.js"); +const require_hasIn = require("./object/hasIn.js"); +const require_invert = require("./object/invert.js"); +const require_invertBy = require("./object/invertBy.js"); +const require_mapKeys = require("./object/mapKeys.js"); +const require_mapValues = require("./object/mapValues.js"); +const require_mergeWith = require("./object/mergeWith.js"); +const require_merge = require("./object/merge.js"); +const require_omit = require("./object/omit.js"); +const require_omitBy = require("./object/omitBy.js"); +const require_pick = require("./object/pick.js"); +const require_pickBy = require("./object/pickBy.js"); +const require_propertyOf = require("./object/propertyOf.js"); +const require_result = require("./object/result.js"); +const require_setWith = require("./object/setWith.js"); +const require_toDefaulted = require("./object/toDefaulted.js"); +const require_toPairs = require("./object/toPairs.js"); +const require_toPairsIn = require("./object/toPairsIn.js"); +const require_isBuffer = require("./predicate/isBuffer.js"); +const require_transform = require("./object/transform.js"); +const require_update = require("./object/update.js"); +const require_valuesIn = require("./object/valuesIn.js"); +const require_isFunction = require("./predicate/isFunction.js"); +const require_isLength = require("./predicate/isLength.js"); +const require_isNative = require("./predicate/isNative.js"); +const require_isNull = require("./predicate/isNull.js"); +const require_isUndefined = require("./predicate/isUndefined.js"); +const require_conformsTo = require("./predicate/conformsTo.js"); +const require_conforms = require("./predicate/conforms.js"); +const require_isArrayBuffer = require("./predicate/isArrayBuffer.js"); +const require_isBoolean = require("./predicate/isBoolean.js"); +const require_isDate = require("./predicate/isDate.js"); +const require_isElement = require("./predicate/isElement.js"); +const require_isEmpty = require("./predicate/isEmpty.js"); +const require_isEqualWith = require("./predicate/isEqualWith.js"); +const require_isError = require("./predicate/isError.js"); +const require_isFinite = require("./predicate/isFinite.js"); +const require_isInteger = require("./predicate/isInteger.js"); +const require_isRegExp = require("./predicate/isRegExp.js"); +const require_isSafeInteger = require("./predicate/isSafeInteger.js"); +const require_isSet = require("./predicate/isSet.js"); +const require_isWeakMap = require("./predicate/isWeakMap.js"); +const require_isWeakSet = require("./predicate/isWeakSet.js"); +const require_capitalize = require("./string/capitalize.js"); +const require_bindAll = require("./util/bindAll.js"); +const require_deburr = require("./string/deburr.js"); +const require_camelCase = require("./string/camelCase.js"); +const require_endsWith = require("./string/endsWith.js"); +const require_escape = require("./string/escape.js"); +const require_escapeRegExp = require("./string/escapeRegExp.js"); +const require_kebabCase = require("./string/kebabCase.js"); +const require_lowerCase = require("./string/lowerCase.js"); +const require_lowerFirst = require("./string/lowerFirst.js"); +const require_pad = require("./string/pad.js"); +const require_padEnd = require("./string/padEnd.js"); +const require_padStart = require("./string/padStart.js"); +const require_repeat = require("./string/repeat.js"); +const require_replace = require("./string/replace.js"); +const require_snakeCase = require("./string/snakeCase.js"); +const require_split = require("./string/split.js"); +const require_startCase = require("./string/startCase.js"); +const require_startsWith = require("./string/startsWith.js"); +const require_template = require("./string/template.js"); +require("./string/templateSettings.js"); +const require_toLower = require("./string/toLower.js"); +const require_toUpper = require("./string/toUpper.js"); +const require_trim = require("./string/trim.js"); +const require_trimEnd = require("./string/trimEnd.js"); +const require_trimStart = require("./string/trimStart.js"); +const require_truncate = require("./string/truncate.js"); +const require_unescape = require("./string/unescape.js"); +const require_upperCase = require("./string/upperCase.js"); +const require_upperFirst = require("./string/upperFirst.js"); +const require_words = require("./string/words.js"); +const require_cond = require("./util/cond.js"); +const require_constant = require("./util/constant.js"); +const require_defaultTo = require("./util/defaultTo.js"); +const require_gt = require("./util/gt.js"); +const require_gte = require("./util/gte.js"); +const require_invoke = require("./util/invoke.js"); +const require_lt = require("./util/lt.js"); +const require_lte = require("./util/lte.js"); +const require_method = require("./util/method.js"); +const require_methodOf = require("./util/methodOf.js"); +const require_now = require("./util/now.js"); +const require_over = require("./util/over.js"); +const require_overEvery = require("./util/overEvery.js"); +const require_overSome = require("./util/overSome.js"); +const require_stubArray = require("./util/stubArray.js"); +const require_stubFalse = require("./util/stubFalse.js"); +const require_stubObject = require("./util/stubObject.js"); +const require_stubString = require("./util/stubString.js"); +const require_stubTrue = require("./util/stubTrue.js"); +const require_toLength = require("./util/toLength.js"); +const require_toPlainObject = require("./util/toPlainObject.js"); +const require_toSafeInteger = require("./util/toSafeInteger.js"); +const require_uniqueId = require("./util/uniqueId.js"); +//#region src/compat/compat.ts +var compat_exports = /* @__PURE__ */ require_runtime.__exportAll({ + add: () => require_add.add, + after: () => require_after.after, + ary: () => require_ary.ary, + assign: () => require_assign.assign, + assignIn: () => require_assignIn.assignIn, + assignInWith: () => require_assignInWith.assignInWith, + assignWith: () => require_assignWith.assignWith, + at: () => require_at.at, + attempt: () => require_attempt.attempt, + before: () => require_before.before, + bind: () => require_bind.bind, + bindAll: () => require_bindAll.bindAll, + bindKey: () => require_bindKey.bindKey, + camelCase: () => require_camelCase.camelCase, + capitalize: () => require_capitalize.capitalize, + castArray: () => require_castArray.castArray, + ceil: () => require_ceil.ceil, + chunk: () => require_chunk.chunk, + clamp: () => require_clamp.clamp, + clone: () => require_clone.clone, + cloneDeep: () => require_cloneDeep.cloneDeep, + cloneDeepWith: () => require_cloneDeepWith.cloneDeepWith, + cloneWith: () => require_cloneWith.cloneWith, + compact: () => require_compact.compact, + concat: () => require_concat.concat, + cond: () => require_cond.cond, + conforms: () => require_conforms.conforms, + conformsTo: () => require_conformsTo.conformsTo, + constant: () => require_constant.constant, + countBy: () => require_countBy.countBy, + create: () => require_create.create, + curry: () => require_curry.curry, + curryRight: () => require_curryRight.curryRight, + debounce: () => require_debounce.debounce, + deburr: () => require_deburr.deburr, + defaultTo: () => require_defaultTo.defaultTo, + defaults: () => require_defaults.defaults, + defaultsDeep: () => require_defaultsDeep.defaultsDeep, + defer: () => require_defer.defer, + delay: () => require_delay.delay, + difference: () => require_difference.difference, + differenceBy: () => require_differenceBy.differenceBy, + differenceWith: () => require_differenceWith.differenceWith, + divide: () => require_divide.divide, + drop: () => require_drop.drop, + dropRight: () => require_dropRight.dropRight, + dropRightWhile: () => require_dropRightWhile.dropRightWhile, + dropWhile: () => require_dropWhile.dropWhile, + each: () => require_forEach.forEach, + eachRight: () => require_forEachRight.forEachRight, + endsWith: () => require_endsWith.endsWith, + eq: () => require_isEqualsSameValueZero.isEqualsSameValueZero, + escape: () => require_escape.escape, + escapeRegExp: () => require_escapeRegExp.escapeRegExp, + every: () => require_every.every, + extend: () => require_assignIn.assignIn, + extendWith: () => require_assignInWith.assignInWith, + fill: () => require_fill.fill, + filter: () => require_filter.filter, + find: () => require_find.find, + findIndex: () => require_findIndex.findIndex, + findKey: () => require_findKey.findKey, + findLast: () => require_findLast.findLast, + findLastIndex: () => require_findLastIndex.findLastIndex, + findLastKey: () => require_findLastKey.findLastKey, + first: () => require_head.head, + flatMap: () => require_flatMap.flatMap, + flatMapDeep: () => require_flatMapDeep.flatMapDeep, + flatMapDepth: () => require_flatMapDepth.flatMapDepth, + flatten: () => require_flatten.flatten, + flattenDeep: () => require_flattenDeep.flattenDeep, + flattenDepth: () => require_flattenDepth.flattenDepth, + flip: () => require_flip.flip, + floor: () => require_floor.floor, + flow: () => require_flow.flow, + flowRight: () => require_flowRight.flowRight, + forEach: () => require_forEach.forEach, + forEachRight: () => require_forEachRight.forEachRight, + forIn: () => require_forIn.forIn, + forInRight: () => require_forInRight.forInRight, + forOwn: () => require_forOwn.forOwn, + forOwnRight: () => require_forOwnRight.forOwnRight, + fromPairs: () => require_fromPairs.fromPairs, + functions: () => require_functions.functions, + functionsIn: () => require_functionsIn.functionsIn, + get: () => require_get.get, + groupBy: () => require_groupBy.groupBy, + gt: () => require_gt.gt, + gte: () => require_gte.gte, + has: () => require_has.has, + hasIn: () => require_hasIn.hasIn, + head: () => require_head.head, + identity: () => require_identity.identity, + inRange: () => require_inRange.inRange, + includes: () => require_includes.includes, + indexOf: () => require_indexOf.indexOf, + initial: () => require_initial.initial, + intersection: () => require_intersection.intersection, + intersectionBy: () => require_intersectionBy.intersectionBy, + intersectionWith: () => require_intersectionWith.intersectionWith, + invert: () => require_invert.invert, + invertBy: () => require_invertBy.invertBy, + invoke: () => require_invoke.invoke, + invokeMap: () => require_invokeMap.invokeMap, + isArguments: () => require_isArguments.isArguments, + isArray: () => require_isArray.isArray, + isArrayBuffer: () => require_isArrayBuffer.isArrayBuffer, + isArrayLike: () => require_isArrayLike.isArrayLike, + isArrayLikeObject: () => require_isArrayLikeObject.isArrayLikeObject, + isBoolean: () => require_isBoolean.isBoolean, + isBuffer: () => require_isBuffer.isBuffer, + isDate: () => require_isDate.isDate, + isElement: () => require_isElement.isElement, + isEmpty: () => require_isEmpty.isEmpty, + isEqual: () => require_isEqual.isEqual, + isEqualWith: () => require_isEqualWith.isEqualWith, + isError: () => require_isError.isError, + isFinite: () => require_isFinite.isFinite, + isFunction: () => require_isFunction.isFunction, + isInteger: () => require_isInteger.isInteger, + isLength: () => require_isLength.isLength, + isMap: () => require_isMap.isMap, + isMatch: () => require_isMatch.isMatch, + isMatchWith: () => require_isMatchWith.isMatchWith, + isNaN: () => require_isNaN.isNaN, + isNative: () => require_isNative.isNative, + isNil: () => require_isNil.isNil, + isNull: () => require_isNull.isNull, + isNumber: () => require_isNumber.isNumber, + isObject: () => require_isObject.isObject, + isObjectLike: () => require_isObjectLike.isObjectLike, + isPlainObject: () => require_isPlainObject.isPlainObject, + isRegExp: () => require_isRegExp.isRegExp, + isSafeInteger: () => require_isSafeInteger.isSafeInteger, + isSet: () => require_isSet.isSet, + isString: () => require_isString.isString, + isSymbol: () => require_isSymbol.isSymbol, + isTypedArray: () => require_isTypedArray.isTypedArray, + isUndefined: () => require_isUndefined.isUndefined, + isWeakMap: () => require_isWeakMap.isWeakMap, + isWeakSet: () => require_isWeakSet.isWeakSet, + iteratee: () => require_iteratee.iteratee, + join: () => require_join.join, + kebabCase: () => require_kebabCase.kebabCase, + keyBy: () => require_keyBy.keyBy, + keys: () => require_keys.keys, + keysIn: () => require_keysIn.keysIn, + last: () => require_last.last, + lastIndexOf: () => require_lastIndexOf.lastIndexOf, + lowerCase: () => require_lowerCase.lowerCase, + lowerFirst: () => require_lowerFirst.lowerFirst, + lt: () => require_lt.lt, + lte: () => require_lte.lte, + map: () => require_map.map, + mapKeys: () => require_mapKeys.mapKeys, + mapValues: () => require_mapValues.mapValues, + matches: () => require_matches.matches, + matchesProperty: () => require_matchesProperty.matchesProperty, + max: () => require_max.max, + maxBy: () => require_maxBy.maxBy, + mean: () => require_mean.mean, + meanBy: () => require_meanBy.meanBy, + memoize: () => require_memoize.memoize, + merge: () => require_merge.merge, + mergeWith: () => require_mergeWith.mergeWith, + method: () => require_method.method, + methodOf: () => require_methodOf.methodOf, + min: () => require_min.min, + minBy: () => require_minBy.minBy, + multiply: () => require_multiply.multiply, + negate: () => require_negate.negate, + noop: () => require_noop.noop, + now: () => require_now.now, + nth: () => require_nth.nth, + nthArg: () => require_nthArg.nthArg, + omit: () => require_omit.omit, + omitBy: () => require_omitBy.omitBy, + once: () => require_once.once, + orderBy: () => require_orderBy.orderBy, + over: () => require_over.over, + overArgs: () => require_overArgs.overArgs, + overEvery: () => require_overEvery.overEvery, + overSome: () => require_overSome.overSome, + pad: () => require_pad.pad, + padEnd: () => require_padEnd.padEnd, + padStart: () => require_padStart.padStart, + parseInt: () => require_parseInt.parseInt, + partial: () => require_partial.partial, + partialRight: () => require_partialRight.partialRight, + partition: () => require_partition.partition, + pick: () => require_pick.pick, + pickBy: () => require_pickBy.pickBy, + property: () => require_property.property, + propertyOf: () => require_propertyOf.propertyOf, + pull: () => require_pull.pull, + pullAll: () => require_pullAll.pullAll, + pullAllBy: () => require_pullAllBy.pullAllBy, + pullAllWith: () => require_pullAllWith.pullAllWith, + pullAt: () => require_pullAt.pullAt, + random: () => require_random.random, + range: () => require_range.range, + rangeRight: () => require_rangeRight.rangeRight, + rearg: () => require_rearg.rearg, + reduce: () => require_reduce.reduce, + reduceRight: () => require_reduceRight.reduceRight, + reject: () => require_reject.reject, + remove: () => require_remove.remove, + repeat: () => require_repeat.repeat, + replace: () => require_replace.replace, + rest: () => require_rest.rest, + result: () => require_result.result, + reverse: () => require_reverse.reverse, + round: () => require_round.round, + sample: () => require_sample.sample, + sampleSize: () => require_sampleSize.sampleSize, + set: () => require_set.set, + setWith: () => require_setWith.setWith, + shuffle: () => require_shuffle.shuffle, + size: () => require_size.size, + slice: () => require_slice.slice, + snakeCase: () => require_snakeCase.snakeCase, + some: () => require_some.some, + sortBy: () => require_sortBy.sortBy, + sortedIndex: () => require_sortedIndex.sortedIndex, + sortedIndexBy: () => require_sortedIndexBy.sortedIndexBy, + sortedIndexOf: () => require_sortedIndexOf.sortedIndexOf, + sortedLastIndex: () => require_sortedLastIndex.sortedLastIndex, + sortedLastIndexBy: () => require_sortedLastIndexBy.sortedLastIndexBy, + sortedLastIndexOf: () => require_sortedLastIndexOf.sortedLastIndexOf, + split: () => require_split.split, + spread: () => require_spread.spread, + startCase: () => require_startCase.startCase, + startsWith: () => require_startsWith.startsWith, + stubArray: () => require_stubArray.stubArray, + stubFalse: () => require_stubFalse.stubFalse, + stubObject: () => require_stubObject.stubObject, + stubString: () => require_stubString.stubString, + stubTrue: () => require_stubTrue.stubTrue, + subtract: () => require_subtract.subtract, + sum: () => require_sum.sum, + sumBy: () => require_sumBy.sumBy, + tail: () => require_tail.tail, + take: () => require_take.take, + takeRight: () => require_takeRight.takeRight, + takeRightWhile: () => require_takeRightWhile.takeRightWhile, + takeWhile: () => require_takeWhile.takeWhile, + template: () => require_template.template, + templateSettings: () => require_template.templateSettings, + throttle: () => require_throttle.throttle, + times: () => require_times.times, + toArray: () => require_toArray.toArray, + toDefaulted: () => require_toDefaulted.toDefaulted, + toFinite: () => require_toFinite.toFinite, + toInteger: () => require_toInteger.toInteger, + toLength: () => require_toLength.toLength, + toLower: () => require_toLower.toLower, + toNumber: () => require_toNumber.toNumber, + toPairs: () => require_toPairs.toPairs, + toPairsIn: () => require_toPairsIn.toPairsIn, + toPath: () => require_toPath.toPath, + toPlainObject: () => require_toPlainObject.toPlainObject, + toSafeInteger: () => require_toSafeInteger.toSafeInteger, + toString: () => require_toString.toString, + toUpper: () => require_toUpper.toUpper, + transform: () => require_transform.transform, + trim: () => require_trim.trim, + trimEnd: () => require_trimEnd.trimEnd, + trimStart: () => require_trimStart.trimStart, + truncate: () => require_truncate.truncate, + unary: () => require_unary.unary, + unescape: () => require_unescape.unescape, + union: () => require_union.union, + unionBy: () => require_unionBy.unionBy, + unionWith: () => require_unionWith.unionWith, + uniq: () => require_uniq.uniq, + uniqBy: () => require_uniqBy.uniqBy, + uniqWith: () => require_uniqWith.uniqWith, + uniqueId: () => require_uniqueId.uniqueId, + unset: () => require_unset.unset, + unzip: () => require_unzip.unzip, + unzipWith: () => require_unzipWith.unzipWith, + update: () => require_update.update, + updateWith: () => require_updateWith.updateWith, + upperCase: () => require_upperCase.upperCase, + upperFirst: () => require_upperFirst.upperFirst, + values: () => require_values.values, + valuesIn: () => require_valuesIn.valuesIn, + without: () => require_without.without, + words: () => require_words.words, + wrap: () => require_wrap.wrap, + xor: () => require_xor.xor, + xorBy: () => require_xorBy.xorBy, + xorWith: () => require_xorWith.xorWith, + zip: () => require_zip.zip, + zipObject: () => require_zipObject.zipObject, + zipObjectDeep: () => require_zipObjectDeep.zipObjectDeep, + zipWith: () => require_zipWith.zipWith +}); +//#endregion +Object.defineProperty(exports, "compat_exports", { + enumerable: true, + get: function() { + return compat_exports; + } +}); diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/compat.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/compat.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9a3bc21ff7d61a58b49e9ffb150c2b9aa6f7b60e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/compat.mjs @@ -0,0 +1,601 @@ +import { __exportAll } from "../_virtual/_rolldown/runtime.mjs"; +import { isSymbol } from "./predicate/isSymbol.mjs"; +import { toNumber } from "./util/toNumber.mjs"; +import { toFinite } from "./util/toFinite.mjs"; +import { toInteger } from "./util/toInteger.mjs"; +import { isArray } from "./predicate/isArray.mjs"; +import { isPlainObject } from "./predicate/isPlainObject.mjs"; +import { isEqualsSameValueZero } from "../_internal/isEqualsSameValueZero.mjs"; +import "./util/eq.mjs"; +import { isEqual } from "../predicate/isEqual.mjs"; +import { castArray } from "./array/castArray.mjs"; +import { isArrayLike } from "./predicate/isArrayLike.mjs"; +import { chunk } from "./array/chunk.mjs"; +import { compact } from "./array/compact.mjs"; +import { concat } from "./array/concat.mjs"; +import { toString } from "./util/toString.mjs"; +import { toPath } from "./util/toPath.mjs"; +import { get } from "./object/get.mjs"; +import { property } from "./object/property.mjs"; +import { isObject } from "./predicate/isObject.mjs"; +import { isMatchWith } from "./predicate/isMatchWith.mjs"; +import { isMatch } from "./predicate/isMatch.mjs"; +import { matches } from "./predicate/matches.mjs"; +import { cloneDeepWith } from "./object/cloneDeepWith.mjs"; +import { cloneDeep } from "./object/cloneDeep.mjs"; +import { isArguments } from "./predicate/isArguments.mjs"; +import { has } from "./object/has.mjs"; +import { matchesProperty } from "./predicate/matchesProperty.mjs"; +import { iteratee } from "./util/iteratee.mjs"; +import { countBy } from "./array/countBy.mjs"; +import { isObjectLike } from "./predicate/isObjectLike.mjs"; +import { isArrayLikeObject } from "./predicate/isArrayLikeObject.mjs"; +import { difference } from "./array/difference.mjs"; +import { last } from "./array/last.mjs"; +import { differenceBy } from "./array/differenceBy.mjs"; +import { differenceWith } from "./array/differenceWith.mjs"; +import { drop } from "./array/drop.mjs"; +import { dropRight } from "./array/dropRight.mjs"; +import { dropRightWhile } from "./array/dropRightWhile.mjs"; +import { dropWhile } from "./array/dropWhile.mjs"; +import { forEach } from "./array/forEach.mjs"; +import "./array/each.mjs"; +import { forEachRight } from "./array/forEachRight.mjs"; +import "./array/eachRight.mjs"; +import { every } from "./array/every.mjs"; +import { isString } from "./predicate/isString.mjs"; +import { fill } from "./array/fill.mjs"; +import { filter } from "./array/filter.mjs"; +import { find } from "./array/find.mjs"; +import { identity } from "./function/identity.mjs"; +import { findIndex } from "./array/findIndex.mjs"; +import { findLast } from "./array/findLast.mjs"; +import { findLastIndex } from "./array/findLastIndex.mjs"; +import { head } from "./array/head.mjs"; +import "./array/first.mjs"; +import { flatten } from "./array/flatten.mjs"; +import { flattenDepth } from "./array/flattenDepth.mjs"; +import { map } from "./array/map.mjs"; +import { flatMap } from "./array/flatMap.mjs"; +import { flatMapDepth } from "./array/flatMapDepth.mjs"; +import { flatMapDeep } from "./array/flatMapDeep.mjs"; +import { flattenDeep } from "./array/flattenDeep.mjs"; +import { groupBy } from "./array/groupBy.mjs"; +import { includes } from "./array/includes.mjs"; +import { indexOf } from "./array/indexOf.mjs"; +import { initial } from "./array/initial.mjs"; +import { intersection } from "./array/intersection.mjs"; +import { intersectionBy } from "./array/intersectionBy.mjs"; +import { uniq } from "./array/uniq.mjs"; +import { intersectionWith } from "./array/intersectionWith.mjs"; +import { invokeMap } from "./array/invokeMap.mjs"; +import { join } from "./array/join.mjs"; +import { reduce } from "./array/reduce.mjs"; +import { keyBy } from "./array/keyBy.mjs"; +import { lastIndexOf } from "./array/lastIndexOf.mjs"; +import { nth } from "./array/nth.mjs"; +import { orderBy } from "./array/orderBy.mjs"; +import { partition } from "./array/partition.mjs"; +import { pull } from "./array/pull.mjs"; +import { pullAll } from "./array/pullAll.mjs"; +import { pullAllBy } from "./array/pullAllBy.mjs"; +import { pullAllWith } from "./array/pullAllWith.mjs"; +import { at } from "./object/at.mjs"; +import { unset } from "./object/unset.mjs"; +import { pullAt } from "./array/pullAt.mjs"; +import { reduceRight } from "./array/reduceRight.mjs"; +import { negate } from "./function/negate.mjs"; +import { reject } from "./array/reject.mjs"; +import { remove } from "./array/remove.mjs"; +import { reverse } from "./array/reverse.mjs"; +import { sample } from "./array/sample.mjs"; +import { clamp } from "./math/clamp.mjs"; +import { isMap } from "./predicate/isMap.mjs"; +import { toArray } from "./util/toArray.mjs"; +import { sampleSize } from "./array/sampleSize.mjs"; +import { values } from "./object/values.mjs"; +import { isNil } from "./predicate/isNil.mjs"; +import { shuffle } from "./array/shuffle.mjs"; +import { size } from "./array/size.mjs"; +import { slice } from "./array/slice.mjs"; +import { some } from "./array/some.mjs"; +import { sortBy } from "./array/sortBy.mjs"; +import { isNaN } from "./predicate/isNaN.mjs"; +import { sortedIndexBy } from "./array/sortedIndexBy.mjs"; +import { isNumber } from "./predicate/isNumber.mjs"; +import { sortedIndex } from "./array/sortedIndex.mjs"; +import { sortedIndexOf } from "./array/sortedIndexOf.mjs"; +import { sortedLastIndexBy } from "./array/sortedLastIndexBy.mjs"; +import { sortedLastIndex } from "./array/sortedLastIndex.mjs"; +import { sortedLastIndexOf } from "./array/sortedLastIndexOf.mjs"; +import { tail } from "./array/tail.mjs"; +import { take } from "./array/take.mjs"; +import { takeRight } from "./array/takeRight.mjs"; +import { takeRightWhile } from "./array/takeRightWhile.mjs"; +import { takeWhile } from "./array/takeWhile.mjs"; +import { union } from "./array/union.mjs"; +import { unionBy } from "./array/unionBy.mjs"; +import { unionWith } from "./array/unionWith.mjs"; +import { uniqBy } from "./array/uniqBy.mjs"; +import { uniqWith } from "./array/uniqWith.mjs"; +import { unzip } from "./array/unzip.mjs"; +import { unzipWith } from "./array/unzipWith.mjs"; +import { without } from "./array/without.mjs"; +import { xor } from "./array/xor.mjs"; +import { xorBy } from "./array/xorBy.mjs"; +import { xorWith } from "./array/xorWith.mjs"; +import { zip } from "./array/zip.mjs"; +import { zipObject } from "./array/zipObject.mjs"; +import { updateWith } from "./object/updateWith.mjs"; +import { set } from "./object/set.mjs"; +import { zipObjectDeep } from "./array/zipObjectDeep.mjs"; +import { zipWith } from "./array/zipWith.mjs"; +import { after } from "./function/after.mjs"; +import { ary } from "./function/ary.mjs"; +import { attempt } from "./function/attempt.mjs"; +import { before } from "./function/before.mjs"; +import { bind } from "./function/bind.mjs"; +import { bindKey } from "./function/bindKey.mjs"; +import { curry } from "./function/curry.mjs"; +import { curryRight } from "./function/curryRight.mjs"; +import { debounce } from "./function/debounce.mjs"; +import { defer } from "./function/defer.mjs"; +import { delay } from "./function/delay.mjs"; +import { flip } from "./function/flip.mjs"; +import { flow } from "./function/flow.mjs"; +import { flowRight } from "./function/flowRight.mjs"; +import { memoize } from "./function/memoize.mjs"; +import { nthArg } from "./function/nthArg.mjs"; +import { once } from "./function/once.mjs"; +import { overArgs } from "./function/overArgs.mjs"; +import { partial } from "./function/partial.mjs"; +import { partialRight } from "./function/partialRight.mjs"; +import { rearg } from "./function/rearg.mjs"; +import { rest } from "./function/rest.mjs"; +import { spread } from "./function/spread.mjs"; +import { throttle } from "./function/throttle.mjs"; +import { unary } from "./function/unary.mjs"; +import { wrap } from "./function/wrap.mjs"; +import { add } from "./math/add.mjs"; +import { ceil } from "./math/ceil.mjs"; +import { divide } from "./math/divide.mjs"; +import { floor } from "./math/floor.mjs"; +import { inRange } from "./math/inRange.mjs"; +import { max } from "./math/max.mjs"; +import { maxBy } from "./math/maxBy.mjs"; +import { sumBy } from "./math/sumBy.mjs"; +import { sum } from "./math/sum.mjs"; +import { mean } from "./math/mean.mjs"; +import { meanBy } from "./math/meanBy.mjs"; +import { min } from "./math/min.mjs"; +import { minBy } from "./math/minBy.mjs"; +import { multiply } from "./math/multiply.mjs"; +import { parseInt } from "./math/parseInt.mjs"; +import { random } from "./math/random.mjs"; +import { range } from "./math/range.mjs"; +import { rangeRight } from "./math/rangeRight.mjs"; +import { round } from "./math/round.mjs"; +import { subtract } from "./math/subtract.mjs"; +import { noop } from "./function/noop.mjs"; +import { isTypedArray } from "./predicate/isTypedArray.mjs"; +import { times } from "./util/times.mjs"; +import { keys } from "./object/keys.mjs"; +import { assign } from "./object/assign.mjs"; +import { keysIn } from "./object/keysIn.mjs"; +import { assignIn } from "./object/assignIn.mjs"; +import { assignInWith } from "./object/assignInWith.mjs"; +import { assignWith } from "./object/assignWith.mjs"; +import { clone } from "./object/clone.mjs"; +import { cloneWith } from "./object/cloneWith.mjs"; +import { create } from "./object/create.mjs"; +import { defaults } from "./object/defaults.mjs"; +import { defaultsDeep } from "./object/defaultsDeep.mjs"; +import "./object/extend.mjs"; +import "./object/extendWith.mjs"; +import { findKey } from "./object/findKey.mjs"; +import { findLastKey } from "./object/findLastKey.mjs"; +import { forIn } from "./object/forIn.mjs"; +import { forInRight } from "./object/forInRight.mjs"; +import { forOwn } from "./object/forOwn.mjs"; +import { forOwnRight } from "./object/forOwnRight.mjs"; +import { fromPairs } from "./object/fromPairs.mjs"; +import { functions } from "./object/functions.mjs"; +import { functionsIn } from "./object/functionsIn.mjs"; +import { hasIn } from "./object/hasIn.mjs"; +import { invert } from "./object/invert.mjs"; +import { invertBy } from "./object/invertBy.mjs"; +import { mapKeys } from "./object/mapKeys.mjs"; +import { mapValues } from "./object/mapValues.mjs"; +import { mergeWith } from "./object/mergeWith.mjs"; +import { merge } from "./object/merge.mjs"; +import { omit } from "./object/omit.mjs"; +import { omitBy } from "./object/omitBy.mjs"; +import { pick } from "./object/pick.mjs"; +import { pickBy } from "./object/pickBy.mjs"; +import { propertyOf } from "./object/propertyOf.mjs"; +import { result } from "./object/result.mjs"; +import { setWith } from "./object/setWith.mjs"; +import { toDefaulted } from "./object/toDefaulted.mjs"; +import { toPairs } from "./object/toPairs.mjs"; +import { toPairsIn } from "./object/toPairsIn.mjs"; +import { isBuffer } from "./predicate/isBuffer.mjs"; +import { transform } from "./object/transform.mjs"; +import { update } from "./object/update.mjs"; +import { valuesIn } from "./object/valuesIn.mjs"; +import { isFunction } from "./predicate/isFunction.mjs"; +import { isLength } from "./predicate/isLength.mjs"; +import { isNative } from "./predicate/isNative.mjs"; +import { isNull } from "./predicate/isNull.mjs"; +import { isUndefined } from "./predicate/isUndefined.mjs"; +import { conformsTo } from "./predicate/conformsTo.mjs"; +import { conforms } from "./predicate/conforms.mjs"; +import { isArrayBuffer } from "./predicate/isArrayBuffer.mjs"; +import { isBoolean } from "./predicate/isBoolean.mjs"; +import { isDate } from "./predicate/isDate.mjs"; +import { isElement } from "./predicate/isElement.mjs"; +import { isEmpty } from "./predicate/isEmpty.mjs"; +import { isEqualWith } from "./predicate/isEqualWith.mjs"; +import { isError } from "./predicate/isError.mjs"; +import { isFinite } from "./predicate/isFinite.mjs"; +import { isInteger } from "./predicate/isInteger.mjs"; +import { isRegExp } from "./predicate/isRegExp.mjs"; +import { isSafeInteger } from "./predicate/isSafeInteger.mjs"; +import { isSet } from "./predicate/isSet.mjs"; +import { isWeakMap } from "./predicate/isWeakMap.mjs"; +import { isWeakSet } from "./predicate/isWeakSet.mjs"; +import { capitalize } from "./string/capitalize.mjs"; +import { bindAll } from "./util/bindAll.mjs"; +import { deburr } from "./string/deburr.mjs"; +import { camelCase } from "./string/camelCase.mjs"; +import { endsWith } from "./string/endsWith.mjs"; +import { escape } from "./string/escape.mjs"; +import { escapeRegExp } from "./string/escapeRegExp.mjs"; +import { kebabCase } from "./string/kebabCase.mjs"; +import { lowerCase } from "./string/lowerCase.mjs"; +import { lowerFirst } from "./string/lowerFirst.mjs"; +import { pad } from "./string/pad.mjs"; +import { padEnd } from "./string/padEnd.mjs"; +import { padStart } from "./string/padStart.mjs"; +import { repeat } from "./string/repeat.mjs"; +import { replace } from "./string/replace.mjs"; +import { snakeCase } from "./string/snakeCase.mjs"; +import { split } from "./string/split.mjs"; +import { startCase } from "./string/startCase.mjs"; +import { startsWith } from "./string/startsWith.mjs"; +import { template, templateSettings } from "./string/template.mjs"; +import "./string/templateSettings.mjs"; +import { toLower } from "./string/toLower.mjs"; +import { toUpper } from "./string/toUpper.mjs"; +import { trim } from "./string/trim.mjs"; +import { trimEnd } from "./string/trimEnd.mjs"; +import { trimStart } from "./string/trimStart.mjs"; +import { truncate } from "./string/truncate.mjs"; +import { unescape } from "./string/unescape.mjs"; +import { upperCase } from "./string/upperCase.mjs"; +import { upperFirst } from "./string/upperFirst.mjs"; +import { words } from "./string/words.mjs"; +import { cond } from "./util/cond.mjs"; +import { constant } from "./util/constant.mjs"; +import { defaultTo } from "./util/defaultTo.mjs"; +import { gt } from "./util/gt.mjs"; +import { gte } from "./util/gte.mjs"; +import { invoke } from "./util/invoke.mjs"; +import { lt } from "./util/lt.mjs"; +import { lte } from "./util/lte.mjs"; +import { method } from "./util/method.mjs"; +import { methodOf } from "./util/methodOf.mjs"; +import { now } from "./util/now.mjs"; +import { over } from "./util/over.mjs"; +import { overEvery } from "./util/overEvery.mjs"; +import { overSome } from "./util/overSome.mjs"; +import { stubArray } from "./util/stubArray.mjs"; +import { stubFalse } from "./util/stubFalse.mjs"; +import { stubObject } from "./util/stubObject.mjs"; +import { stubString } from "./util/stubString.mjs"; +import { stubTrue } from "./util/stubTrue.mjs"; +import { toLength } from "./util/toLength.mjs"; +import { toPlainObject } from "./util/toPlainObject.mjs"; +import { toSafeInteger } from "./util/toSafeInteger.mjs"; +import { uniqueId } from "./util/uniqueId.mjs"; +//#region src/compat/compat.ts +var compat_exports = /* @__PURE__ */ __exportAll({ + add: () => add, + after: () => after, + ary: () => ary, + assign: () => assign, + assignIn: () => assignIn, + assignInWith: () => assignInWith, + assignWith: () => assignWith, + at: () => at, + attempt: () => attempt, + before: () => before, + bind: () => bind, + bindAll: () => bindAll, + bindKey: () => bindKey, + camelCase: () => camelCase, + capitalize: () => capitalize, + castArray: () => castArray, + ceil: () => ceil, + chunk: () => chunk, + clamp: () => clamp, + clone: () => clone, + cloneDeep: () => cloneDeep, + cloneDeepWith: () => cloneDeepWith, + cloneWith: () => cloneWith, + compact: () => compact, + concat: () => concat, + cond: () => cond, + conforms: () => conforms, + conformsTo: () => conformsTo, + constant: () => constant, + countBy: () => countBy, + create: () => create, + curry: () => curry, + curryRight: () => curryRight, + debounce: () => debounce, + deburr: () => deburr, + defaultTo: () => defaultTo, + defaults: () => defaults, + defaultsDeep: () => defaultsDeep, + defer: () => defer, + delay: () => delay, + difference: () => difference, + differenceBy: () => differenceBy, + differenceWith: () => differenceWith, + divide: () => divide, + drop: () => drop, + dropRight: () => dropRight, + dropRightWhile: () => dropRightWhile, + dropWhile: () => dropWhile, + each: () => forEach, + eachRight: () => forEachRight, + endsWith: () => endsWith, + eq: () => isEqualsSameValueZero, + escape: () => escape, + escapeRegExp: () => escapeRegExp, + every: () => every, + extend: () => assignIn, + extendWith: () => assignInWith, + fill: () => fill, + filter: () => filter, + find: () => find, + findIndex: () => findIndex, + findKey: () => findKey, + findLast: () => findLast, + findLastIndex: () => findLastIndex, + findLastKey: () => findLastKey, + first: () => head, + flatMap: () => flatMap, + flatMapDeep: () => flatMapDeep, + flatMapDepth: () => flatMapDepth, + flatten: () => flatten, + flattenDeep: () => flattenDeep, + flattenDepth: () => flattenDepth, + flip: () => flip, + floor: () => floor, + flow: () => flow, + flowRight: () => flowRight, + forEach: () => forEach, + forEachRight: () => forEachRight, + forIn: () => forIn, + forInRight: () => forInRight, + forOwn: () => forOwn, + forOwnRight: () => forOwnRight, + fromPairs: () => fromPairs, + functions: () => functions, + functionsIn: () => functionsIn, + get: () => get, + groupBy: () => groupBy, + gt: () => gt, + gte: () => gte, + has: () => has, + hasIn: () => hasIn, + head: () => head, + identity: () => identity, + inRange: () => inRange, + includes: () => includes, + indexOf: () => indexOf, + initial: () => initial, + intersection: () => intersection, + intersectionBy: () => intersectionBy, + intersectionWith: () => intersectionWith, + invert: () => invert, + invertBy: () => invertBy, + invoke: () => invoke, + invokeMap: () => invokeMap, + isArguments: () => isArguments, + isArray: () => isArray, + isArrayBuffer: () => isArrayBuffer, + isArrayLike: () => isArrayLike, + isArrayLikeObject: () => isArrayLikeObject, + isBoolean: () => isBoolean, + isBuffer: () => isBuffer, + isDate: () => isDate, + isElement: () => isElement, + isEmpty: () => isEmpty, + isEqual: () => isEqual, + isEqualWith: () => isEqualWith, + isError: () => isError, + isFinite: () => isFinite, + isFunction: () => isFunction, + isInteger: () => isInteger, + isLength: () => isLength, + isMap: () => isMap, + isMatch: () => isMatch, + isMatchWith: () => isMatchWith, + isNaN: () => isNaN, + isNative: () => isNative, + isNil: () => isNil, + isNull: () => isNull, + isNumber: () => isNumber, + isObject: () => isObject, + isObjectLike: () => isObjectLike, + isPlainObject: () => isPlainObject, + isRegExp: () => isRegExp, + isSafeInteger: () => isSafeInteger, + isSet: () => isSet, + isString: () => isString, + isSymbol: () => isSymbol, + isTypedArray: () => isTypedArray, + isUndefined: () => isUndefined, + isWeakMap: () => isWeakMap, + isWeakSet: () => isWeakSet, + iteratee: () => iteratee, + join: () => join, + kebabCase: () => kebabCase, + keyBy: () => keyBy, + keys: () => keys, + keysIn: () => keysIn, + last: () => last, + lastIndexOf: () => lastIndexOf, + lowerCase: () => lowerCase, + lowerFirst: () => lowerFirst, + lt: () => lt, + lte: () => lte, + map: () => map, + mapKeys: () => mapKeys, + mapValues: () => mapValues, + matches: () => matches, + matchesProperty: () => matchesProperty, + max: () => max, + maxBy: () => maxBy, + mean: () => mean, + meanBy: () => meanBy, + memoize: () => memoize, + merge: () => merge, + mergeWith: () => mergeWith, + method: () => method, + methodOf: () => methodOf, + min: () => min, + minBy: () => minBy, + multiply: () => multiply, + negate: () => negate, + noop: () => noop, + now: () => now, + nth: () => nth, + nthArg: () => nthArg, + omit: () => omit, + omitBy: () => omitBy, + once: () => once, + orderBy: () => orderBy, + over: () => over, + overArgs: () => overArgs, + overEvery: () => overEvery, + overSome: () => overSome, + pad: () => pad, + padEnd: () => padEnd, + padStart: () => padStart, + parseInt: () => parseInt, + partial: () => partial, + partialRight: () => partialRight, + partition: () => partition, + pick: () => pick, + pickBy: () => pickBy, + property: () => property, + propertyOf: () => propertyOf, + pull: () => pull, + pullAll: () => pullAll, + pullAllBy: () => pullAllBy, + pullAllWith: () => pullAllWith, + pullAt: () => pullAt, + random: () => random, + range: () => range, + rangeRight: () => rangeRight, + rearg: () => rearg, + reduce: () => reduce, + reduceRight: () => reduceRight, + reject: () => reject, + remove: () => remove, + repeat: () => repeat, + replace: () => replace, + rest: () => rest, + result: () => result, + reverse: () => reverse, + round: () => round, + sample: () => sample, + sampleSize: () => sampleSize, + set: () => set, + setWith: () => setWith, + shuffle: () => shuffle, + size: () => size, + slice: () => slice, + snakeCase: () => snakeCase, + some: () => some, + sortBy: () => sortBy, + sortedIndex: () => sortedIndex, + sortedIndexBy: () => sortedIndexBy, + sortedIndexOf: () => sortedIndexOf, + sortedLastIndex: () => sortedLastIndex, + sortedLastIndexBy: () => sortedLastIndexBy, + sortedLastIndexOf: () => sortedLastIndexOf, + split: () => split, + spread: () => spread, + startCase: () => startCase, + startsWith: () => startsWith, + stubArray: () => stubArray, + stubFalse: () => stubFalse, + stubObject: () => stubObject, + stubString: () => stubString, + stubTrue: () => stubTrue, + subtract: () => subtract, + sum: () => sum, + sumBy: () => sumBy, + tail: () => tail, + take: () => take, + takeRight: () => takeRight, + takeRightWhile: () => takeRightWhile, + takeWhile: () => takeWhile, + template: () => template, + templateSettings: () => templateSettings, + throttle: () => throttle, + times: () => times, + toArray: () => toArray, + toDefaulted: () => toDefaulted, + toFinite: () => toFinite, + toInteger: () => toInteger, + toLength: () => toLength, + toLower: () => toLower, + toNumber: () => toNumber, + toPairs: () => toPairs, + toPairsIn: () => toPairsIn, + toPath: () => toPath, + toPlainObject: () => toPlainObject, + toSafeInteger: () => toSafeInteger, + toString: () => toString, + toUpper: () => toUpper, + transform: () => transform, + trim: () => trim, + trimEnd: () => trimEnd, + trimStart: () => trimStart, + truncate: () => truncate, + unary: () => unary, + unescape: () => unescape, + union: () => union, + unionBy: () => unionBy, + unionWith: () => unionWith, + uniq: () => uniq, + uniqBy: () => uniqBy, + uniqWith: () => uniqWith, + uniqueId: () => uniqueId, + unset: () => unset, + unzip: () => unzip, + unzipWith: () => unzipWith, + update: () => update, + updateWith: () => updateWith, + upperCase: () => upperCase, + upperFirst: () => upperFirst, + values: () => values, + valuesIn: () => valuesIn, + without: () => without, + words: () => words, + wrap: () => wrap, + xor: () => xor, + xorBy: () => xorBy, + xorWith: () => xorWith, + zip: () => zip, + zipObject: () => zipObject, + zipObjectDeep: () => zipObjectDeep, + zipWith: () => zipWith +}); +//#endregion +export { compat_exports }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/after.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/after.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a45055cb9496191c5b68213b68fd6bbdbc9d3918 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/after.d.mts @@ -0,0 +1,25 @@ +//#region src/compat/function/after.d.ts +/** + * The opposite of `_.before`; this method creates a function that invokes + * `func` once it's called `n` or more times. + * + * @template TFunc - The type of the function to be invoked. + * @param {number} n - The number of calls before `func` is invoked. + * @param {TFunc} func - The function to restrict. + * @returns {TFunc} Returns the new restricted function. + * @throws {TypeError} - If `func` is not a function. + * + * @example + * const saves = ['profile', 'settings']; + * const done = after(saves.length, () => { + * console.log('done saving!'); + * }); + * + * saves.forEach(type => { + * asyncSave({ 'type': type, 'complete': done }); + * }); + * // => Logs 'done saving!' after the two async saves have completed. + */ +declare function after any>(n: number, func: TFunc): TFunc; +//#endregion +export { after }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/after.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/after.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a45055cb9496191c5b68213b68fd6bbdbc9d3918 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/after.d.ts @@ -0,0 +1,25 @@ +//#region src/compat/function/after.d.ts +/** + * The opposite of `_.before`; this method creates a function that invokes + * `func` once it's called `n` or more times. + * + * @template TFunc - The type of the function to be invoked. + * @param {number} n - The number of calls before `func` is invoked. + * @param {TFunc} func - The function to restrict. + * @returns {TFunc} Returns the new restricted function. + * @throws {TypeError} - If `func` is not a function. + * + * @example + * const saves = ['profile', 'settings']; + * const done = after(saves.length, () => { + * console.log('done saving!'); + * }); + * + * saves.forEach(type => { + * asyncSave({ 'type': type, 'complete': done }); + * }); + * // => Logs 'done saving!' after the two async saves have completed. + */ +declare function after any>(n: number, func: TFunc): TFunc; +//#endregion +export { after }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/after.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/after.js new file mode 100644 index 0000000000000000000000000000000000000000..1b6eeb54b2c1c3d01d380d815de3870a78a2e966 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/after.js @@ -0,0 +1,32 @@ +const require_toInteger = require("../util/toInteger.js"); +//#region src/compat/function/after.ts +/** +* The opposite of `_.before`; this method creates a function that invokes +* `func` once it's called `n` or more times. +* +* @template TFunc - The type of the function to be invoked. +* @param {number} n - The number of calls before `func` is invoked. +* @param {TFunc} func - The function to restrict. +* @returns {TFunc} Returns the new restricted function. +* @throws {TypeError} - If `func` is not a function. +* +* @example +* const saves = ['profile', 'settings']; +* const done = after(saves.length, () => { +* console.log('done saving!'); +* }); +* +* saves.forEach(type => { +* asyncSave({ 'type': type, 'complete': done }); +* }); +* // => Logs 'done saving!' after the two async saves have completed. +*/ +function after(n, func) { + if (typeof func !== "function") throw new TypeError("Expected a function"); + n = require_toInteger.toInteger(n); + return function(...args) { + if (--n < 1) return func.apply(this, args); + }; +} +//#endregion +exports.after = after; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/after.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/after.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7bf264656283f475aa883948ce43dfd080915c4b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/after.mjs @@ -0,0 +1,32 @@ +import { toInteger } from "../util/toInteger.mjs"; +//#region src/compat/function/after.ts +/** +* The opposite of `_.before`; this method creates a function that invokes +* `func` once it's called `n` or more times. +* +* @template TFunc - The type of the function to be invoked. +* @param {number} n - The number of calls before `func` is invoked. +* @param {TFunc} func - The function to restrict. +* @returns {TFunc} Returns the new restricted function. +* @throws {TypeError} - If `func` is not a function. +* +* @example +* const saves = ['profile', 'settings']; +* const done = after(saves.length, () => { +* console.log('done saving!'); +* }); +* +* saves.forEach(type => { +* asyncSave({ 'type': type, 'complete': done }); +* }); +* // => Logs 'done saving!' after the two async saves have completed. +*/ +function after(n, func) { + if (typeof func !== "function") throw new TypeError("Expected a function"); + n = toInteger(n); + return function(...args) { + if (--n < 1) return func.apply(this, args); + }; +} +//#endregion +export { after }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/ary.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/ary.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..3d677e5ecdba288c46b21ef71f6d512a609d0baf --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/ary.d.mts @@ -0,0 +1,25 @@ +//#region src/compat/function/ary.d.ts +/** + * Creates a function that invokes func, with up to `n` arguments, ignoring any additional arguments. + * If `n` is not provided, it defaults to the function's length. + * + * @param {Function} func - The function to cap arguments for. + * @param {number} [n] - The arity cap. Defaults to func.length. + * @returns {Function} Returns the new capped function. + * + * @example + * function fn(a: number, b: number, c: number) { + * return Array.from(arguments); + * } + * + * // Cap at 2 arguments + * const capped = ary(fn, 2); + * capped(1, 2, 3); // [1, 2] + * + * // Default to function length + * const defaultCap = ary(fn); + * defaultCap(1, 2, 3); // [1, 2, 3] + */ +declare function ary(func: (...args: any[]) => any, n?: number): (...args: any[]) => any; +//#endregion +export { ary }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/ary.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/ary.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3d677e5ecdba288c46b21ef71f6d512a609d0baf --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/ary.d.ts @@ -0,0 +1,25 @@ +//#region src/compat/function/ary.d.ts +/** + * Creates a function that invokes func, with up to `n` arguments, ignoring any additional arguments. + * If `n` is not provided, it defaults to the function's length. + * + * @param {Function} func - The function to cap arguments for. + * @param {number} [n] - The arity cap. Defaults to func.length. + * @returns {Function} Returns the new capped function. + * + * @example + * function fn(a: number, b: number, c: number) { + * return Array.from(arguments); + * } + * + * // Cap at 2 arguments + * const capped = ary(fn, 2); + * capped(1, 2, 3); // [1, 2] + * + * // Default to function length + * const defaultCap = ary(fn); + * defaultCap(1, 2, 3); // [1, 2, 3] + */ +declare function ary(func: (...args: any[]) => any, n?: number): (...args: any[]) => any; +//#endregion +export { ary }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/ary.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/ary.js new file mode 100644 index 0000000000000000000000000000000000000000..5ca1f7f62b99b32d07ace6f6847d0dbf9fe1dbc5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/ary.js @@ -0,0 +1,28 @@ +const require_ary = require("../../function/ary.js"); +//#region src/compat/function/ary.ts +/** +* Creates a function that invokes func, with up to `n` arguments, ignoring any additional arguments. +* +* @template F - The type of the function. +* @param {F} func - The function to cap arguments for. +* @param {number} n - The arity cap. +* @param {unknown} guard - The value to guard the arity cap. +* @returns {(...args: any[]) => ReturnType} Returns the new capped function. +* +* @example +* function fn(a: number, b: number, c: number) { +* return Array.from(arguments); +* } +* +* ary(fn, 0)(1, 2, 3); // [] +* ary(fn, 1)(1, 2, 3); // [1] +* ary(fn, 2)(1, 2, 3); // [1, 2] +* ary(fn, 3)(1, 2, 3); // [1, 2, 3] +*/ +function ary(func, n = func.length, guard) { + if (guard) n = func.length; + if (Number.isNaN(n) || n < 0) n = 0; + return require_ary.ary(func, n); +} +//#endregion +exports.ary = ary; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/ary.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/ary.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c5a20f9f4030d0be719f61763176ec168a7b26e5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/ary.mjs @@ -0,0 +1,28 @@ +import { ary as ary$1 } from "../../function/ary.mjs"; +//#region src/compat/function/ary.ts +/** +* Creates a function that invokes func, with up to `n` arguments, ignoring any additional arguments. +* +* @template F - The type of the function. +* @param {F} func - The function to cap arguments for. +* @param {number} n - The arity cap. +* @param {unknown} guard - The value to guard the arity cap. +* @returns {(...args: any[]) => ReturnType} Returns the new capped function. +* +* @example +* function fn(a: number, b: number, c: number) { +* return Array.from(arguments); +* } +* +* ary(fn, 0)(1, 2, 3); // [] +* ary(fn, 1)(1, 2, 3); // [1] +* ary(fn, 2)(1, 2, 3); // [1, 2] +* ary(fn, 3)(1, 2, 3); // [1, 2, 3] +*/ +function ary(func, n = func.length, guard) { + if (guard) n = func.length; + if (Number.isNaN(n) || n < 0) n = 0; + return ary$1(func, n); +} +//#endregion +export { ary }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/attempt.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/attempt.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..029b87cd1a01e092aa2907f79508a64e573e9a86 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/attempt.d.mts @@ -0,0 +1,34 @@ +//#region src/compat/function/attempt.d.ts +/** + * Attempts to execute a function with the provided arguments. + * If the function throws an error, it catches the error and returns it. + * If the caught error is not an instance of Error, it wraps it in a new Error. + * + * @param {(...args: any[]) => R} func - The function to be executed. + * @param {...any[]} args - The arguments to pass to the function. + * @returns {R | Error} The return value of the function if successful, or an Error if an exception is thrown. + * + * @template R - The type of the function return value. + * + * @example + * // Example 1: Successful execution + * const result = attempt((x, y) => x + y, 2, 3); + * console.log(result); // Output: 5 + * + * @example + * // Example 2: Function throws an error + * const errorResult = attempt(() => { + * throw new Error("Something went wrong"); + * }); + * console.log(errorResult); // Output: Error: Something went wrong + * + * @example + * // Example 3: Non-Error thrown + * const nonErrorResult = attempt(() => { + * throw "This is a string error"; + * }); + * console.log(nonErrorResult); // Output: Error: This is a string error + */ +declare function attempt(func: (...args: any[]) => R, ...args: any[]): R | Error; +//#endregion +export { attempt }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/attempt.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/attempt.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..029b87cd1a01e092aa2907f79508a64e573e9a86 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/attempt.d.ts @@ -0,0 +1,34 @@ +//#region src/compat/function/attempt.d.ts +/** + * Attempts to execute a function with the provided arguments. + * If the function throws an error, it catches the error and returns it. + * If the caught error is not an instance of Error, it wraps it in a new Error. + * + * @param {(...args: any[]) => R} func - The function to be executed. + * @param {...any[]} args - The arguments to pass to the function. + * @returns {R | Error} The return value of the function if successful, or an Error if an exception is thrown. + * + * @template R - The type of the function return value. + * + * @example + * // Example 1: Successful execution + * const result = attempt((x, y) => x + y, 2, 3); + * console.log(result); // Output: 5 + * + * @example + * // Example 2: Function throws an error + * const errorResult = attempt(() => { + * throw new Error("Something went wrong"); + * }); + * console.log(errorResult); // Output: Error: Something went wrong + * + * @example + * // Example 3: Non-Error thrown + * const nonErrorResult = attempt(() => { + * throw "This is a string error"; + * }); + * console.log(nonErrorResult); // Output: Error: This is a string error + */ +declare function attempt(func: (...args: any[]) => R, ...args: any[]): R | Error; +//#endregion +export { attempt }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/attempt.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/attempt.js new file mode 100644 index 0000000000000000000000000000000000000000..7053c083a3960a6b15fa442730743099caff9dfc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/attempt.js @@ -0,0 +1,40 @@ +//#region src/compat/function/attempt.ts +/** +* Attempts to execute a function with the provided arguments. +* If the function throws an error, it catches the error and returns it. +* If the caught error is not an instance of Error, it wraps it in a new Error. +* +* @param {(...args: any[]) => R} func - The function to be executed. +* @param {...any[]} args - The arguments to pass to the function. +* @returns {R | Error} The return value of the function if successful, or an Error if an exception is thrown. +* +* @template R - The type of the function return value. +* +* @example +* // Example 1: Successful execution +* const result = attempt((x, y) => x + y, 2, 3); +* console.log(result); // Output: 5 +* +* @example +* // Example 2: Function throws an error +* const errorResult = attempt(() => { +* throw new Error("Something went wrong"); +* }); +* console.log(errorResult); // Output: Error: Something went wrong +* +* @example +* // Example 3: Non-Error thrown +* const nonErrorResult = attempt(() => { +* throw "This is a string error"; +* }); +* console.log(nonErrorResult); // Output: Error: This is a string error +*/ +function attempt(func, ...args) { + try { + return func(...args); + } catch (e) { + return e instanceof Error ? e : new Error(e); + } +} +//#endregion +exports.attempt = attempt; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/attempt.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/attempt.mjs new file mode 100644 index 0000000000000000000000000000000000000000..dd00fc776ac4ba7a1d5acc80ba2799cbee1d0c32 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/attempt.mjs @@ -0,0 +1,40 @@ +//#region src/compat/function/attempt.ts +/** +* Attempts to execute a function with the provided arguments. +* If the function throws an error, it catches the error and returns it. +* If the caught error is not an instance of Error, it wraps it in a new Error. +* +* @param {(...args: any[]) => R} func - The function to be executed. +* @param {...any[]} args - The arguments to pass to the function. +* @returns {R | Error} The return value of the function if successful, or an Error if an exception is thrown. +* +* @template R - The type of the function return value. +* +* @example +* // Example 1: Successful execution +* const result = attempt((x, y) => x + y, 2, 3); +* console.log(result); // Output: 5 +* +* @example +* // Example 2: Function throws an error +* const errorResult = attempt(() => { +* throw new Error("Something went wrong"); +* }); +* console.log(errorResult); // Output: Error: Something went wrong +* +* @example +* // Example 3: Non-Error thrown +* const nonErrorResult = attempt(() => { +* throw "This is a string error"; +* }); +* console.log(nonErrorResult); // Output: Error: This is a string error +*/ +function attempt(func, ...args) { + try { + return func(...args); + } catch (e) { + return e instanceof Error ? e : new Error(e); + } +} +//#endregion +export { attempt }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/before.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/before.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..3021860af7b71c3d94aca44c9a9636ce1b0a9f89 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/before.d.mts @@ -0,0 +1,27 @@ +//#region src/compat/function/before.d.ts +/** + * Creates a function that invokes `func`, with the `this` binding and arguments + * of the created function, while it's called less than `n` times. Subsequent + * calls to the created function return the result of the last `func` invocation. + * + * @template F - The type of the function to be invoked. + * @param {number} n - The number of times the returned function is allowed to call `func` before stopping. + * - If `n` is 0, `func` will never be called. + * - If `n` is a positive integer, `func` will be called up to `n-1` times. + * @param {F} func - The function to be called with the limit applied. + * @returns {(...args: Parameters) => ReturnType } - A new function that: + * - Tracks the number of calls. + * - Invokes `func` until the `n-1`-th call. + * - Returns last result of `func`, if `n` is reached. + * @throws {TypeError} - If `func` is not a function. + * @example + * let count = 0; + * const before3 = before(3, () => ++count); + * + * before3(); // => 1 + * before3(); // => 2 + * before3(); // => 2 + */ +declare function before any>(n: number, func: F): F; +//#endregion +export { before }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/before.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/before.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3021860af7b71c3d94aca44c9a9636ce1b0a9f89 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/before.d.ts @@ -0,0 +1,27 @@ +//#region src/compat/function/before.d.ts +/** + * Creates a function that invokes `func`, with the `this` binding and arguments + * of the created function, while it's called less than `n` times. Subsequent + * calls to the created function return the result of the last `func` invocation. + * + * @template F - The type of the function to be invoked. + * @param {number} n - The number of times the returned function is allowed to call `func` before stopping. + * - If `n` is 0, `func` will never be called. + * - If `n` is a positive integer, `func` will be called up to `n-1` times. + * @param {F} func - The function to be called with the limit applied. + * @returns {(...args: Parameters) => ReturnType } - A new function that: + * - Tracks the number of calls. + * - Invokes `func` until the `n-1`-th call. + * - Returns last result of `func`, if `n` is reached. + * @throws {TypeError} - If `func` is not a function. + * @example + * let count = 0; + * const before3 = before(3, () => ++count); + * + * before3(); // => 1 + * before3(); // => 2 + * before3(); // => 2 + */ +declare function before any>(n: number, func: F): F; +//#endregion +export { before }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/before.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/before.js new file mode 100644 index 0000000000000000000000000000000000000000..7353584bbb61d9c120e93af1789b14e8348f7bae --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/before.js @@ -0,0 +1,37 @@ +const require_toInteger = require("../util/toInteger.js"); +//#region src/compat/function/before.ts +/** +* Creates a function that invokes `func`, with the `this` binding and arguments +* of the created function, while it's called less than `n` times. Subsequent +* calls to the created function return the result of the last `func` invocation. +* +* @template F - The type of the function to be invoked. +* @param {number} n - The number of times the returned function is allowed to call `func` before stopping. +* - If `n` is 0, `func` will never be called. +* - If `n` is a positive integer, `func` will be called up to `n-1` times. +* @param {F} func - The function to be called with the limit applied. +* @returns {(...args: Parameters) => ReturnType } - A new function that: +* - Tracks the number of calls. +* - Invokes `func` until the `n-1`-th call. +* - Returns last result of `func`, if `n` is reached. +* @throws {TypeError} - If `func` is not a function. +* @example +* let count = 0; +* const before3 = before(3, () => ++count); +* +* before3(); // => 1 +* before3(); // => 2 +* before3(); // => 2 +*/ +function before(n, func) { + if (typeof func !== "function") throw new TypeError("Expected a function"); + let result; + n = require_toInteger.toInteger(n); + return function(...args) { + if (--n > 0) result = func.apply(this, args); + if (n <= 1 && func) func = void 0; + return result; + }; +} +//#endregion +exports.before = before; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/before.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/before.mjs new file mode 100644 index 0000000000000000000000000000000000000000..92d2392196610056ce30bfdbdb767770a6715b24 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/before.mjs @@ -0,0 +1,37 @@ +import { toInteger } from "../util/toInteger.mjs"; +//#region src/compat/function/before.ts +/** +* Creates a function that invokes `func`, with the `this` binding and arguments +* of the created function, while it's called less than `n` times. Subsequent +* calls to the created function return the result of the last `func` invocation. +* +* @template F - The type of the function to be invoked. +* @param {number} n - The number of times the returned function is allowed to call `func` before stopping. +* - If `n` is 0, `func` will never be called. +* - If `n` is a positive integer, `func` will be called up to `n-1` times. +* @param {F} func - The function to be called with the limit applied. +* @returns {(...args: Parameters) => ReturnType } - A new function that: +* - Tracks the number of calls. +* - Invokes `func` until the `n-1`-th call. +* - Returns last result of `func`, if `n` is reached. +* @throws {TypeError} - If `func` is not a function. +* @example +* let count = 0; +* const before3 = before(3, () => ++count); +* +* before3(); // => 1 +* before3(); // => 2 +* before3(); // => 2 +*/ +function before(n, func) { + if (typeof func !== "function") throw new TypeError("Expected a function"); + let result; + n = toInteger(n); + return function(...args) { + if (--n > 0) result = func.apply(this, args); + if (n <= 1 && func) func = void 0; + return result; + }; +} +//#endregion +export { before }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/bind.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/bind.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..ecfab7019c6bed84410046169415fcccad4edfab --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/bind.d.mts @@ -0,0 +1,33 @@ +//#region src/compat/function/bind.d.ts +/** + * Creates a function that invokes `func` with the `this` binding of `thisArg` and `partials` prepended to the arguments it receives. + * + * The `bind.placeholder` value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. + * + * Note: Unlike native `Function#bind`, this method doesn't set the `length` property of bound functions. + * + * @param {(...args: any[]) => any} func - The function to bind. + * @param {any} thisObj - The `this` binding of `func`. + * @param {...any} partialArgs - The arguments to be partially applied. + * @returns {(...args: any[]) => any} - Returns the new bound function. + * + * @example + * function greet(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * } + * const object = { user: 'fred' }; + * let bound = bind(greet, object, 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * bound = bind(greet, object, bind.placeholder, '!'); + * bound('hi'); + * // => 'hi fred!' + */ +declare function bind(func: (...args: any[]) => any, thisObj: any, ...partialArgs: any[]): (...args: any[]) => any; +declare namespace bind { + var placeholder: typeof bindPlaceholder; +} +declare const bindPlaceholder: unique symbol; +//#endregion +export { bind }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/bind.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/bind.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ecfab7019c6bed84410046169415fcccad4edfab --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/bind.d.ts @@ -0,0 +1,33 @@ +//#region src/compat/function/bind.d.ts +/** + * Creates a function that invokes `func` with the `this` binding of `thisArg` and `partials` prepended to the arguments it receives. + * + * The `bind.placeholder` value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. + * + * Note: Unlike native `Function#bind`, this method doesn't set the `length` property of bound functions. + * + * @param {(...args: any[]) => any} func - The function to bind. + * @param {any} thisObj - The `this` binding of `func`. + * @param {...any} partialArgs - The arguments to be partially applied. + * @returns {(...args: any[]) => any} - Returns the new bound function. + * + * @example + * function greet(greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * } + * const object = { user: 'fred' }; + * let bound = bind(greet, object, 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * bound = bind(greet, object, bind.placeholder, '!'); + * bound('hi'); + * // => 'hi fred!' + */ +declare function bind(func: (...args: any[]) => any, thisObj: any, ...partialArgs: any[]): (...args: any[]) => any; +declare namespace bind { + var placeholder: typeof bindPlaceholder; +} +declare const bindPlaceholder: unique symbol; +//#endregion +export { bind }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/bind.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/bind.js new file mode 100644 index 0000000000000000000000000000000000000000..23c987538669084ca9f4e7df010cbece1d86cc25 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/bind.js @@ -0,0 +1,44 @@ +//#region src/compat/function/bind.ts +/** +* Creates a function that invokes `func` with the `this` binding of `thisArg` and `partials` prepended to the arguments it receives. +* +* The `bind.placeholder` value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. +* +* Note: Unlike native `Function#bind`, this method doesn't set the `length` property of bound functions. +* +* @param {(...args: any[]) => any} func - The function to bind. +* @param {any} thisObj - The `this` binding of `func`. +* @param {...any} partialArgs - The arguments to be partially applied. +* @returns {(...args: any[]) => any} - Returns the new bound function. +* +* @example +* function greet(greeting, punctuation) { +* return greeting + ' ' + this.user + punctuation; +* } +* const object = { user: 'fred' }; +* let bound = bind(greet, object, 'hi'); +* bound('!'); +* // => 'hi fred!' +* +* bound = bind(greet, object, bind.placeholder, '!'); +* bound('hi'); +* // => 'hi fred!' +*/ +function bind(func, thisObj, ...partialArgs) { + const bound = function(...providedArgs) { + const args = []; + let startIndex = 0; + for (let i = 0; i < partialArgs.length; i++) { + const arg = partialArgs[i]; + if (arg === bind.placeholder) args.push(providedArgs[startIndex++]); + else args.push(arg); + } + for (let i = startIndex; i < providedArgs.length; i++) args.push(providedArgs[i]); + if (this instanceof bound) return new func(...args); + return func.apply(thisObj, args); + }; + return bound; +} +bind.placeholder = Symbol("bind.placeholder"); +//#endregion +exports.bind = bind; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/bind.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/bind.mjs new file mode 100644 index 0000000000000000000000000000000000000000..addbaf3ff7516c0570644f656623696de44bed84 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/bind.mjs @@ -0,0 +1,44 @@ +//#region src/compat/function/bind.ts +/** +* Creates a function that invokes `func` with the `this` binding of `thisArg` and `partials` prepended to the arguments it receives. +* +* The `bind.placeholder` value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. +* +* Note: Unlike native `Function#bind`, this method doesn't set the `length` property of bound functions. +* +* @param {(...args: any[]) => any} func - The function to bind. +* @param {any} thisObj - The `this` binding of `func`. +* @param {...any} partialArgs - The arguments to be partially applied. +* @returns {(...args: any[]) => any} - Returns the new bound function. +* +* @example +* function greet(greeting, punctuation) { +* return greeting + ' ' + this.user + punctuation; +* } +* const object = { user: 'fred' }; +* let bound = bind(greet, object, 'hi'); +* bound('!'); +* // => 'hi fred!' +* +* bound = bind(greet, object, bind.placeholder, '!'); +* bound('hi'); +* // => 'hi fred!' +*/ +function bind(func, thisObj, ...partialArgs) { + const bound = function(...providedArgs) { + const args = []; + let startIndex = 0; + for (let i = 0; i < partialArgs.length; i++) { + const arg = partialArgs[i]; + if (arg === bind.placeholder) args.push(providedArgs[startIndex++]); + else args.push(arg); + } + for (let i = startIndex; i < providedArgs.length; i++) args.push(providedArgs[i]); + if (this instanceof bound) return new func(...args); + return func.apply(thisObj, args); + }; + return bound; +} +bind.placeholder = Symbol("bind.placeholder"); +//#endregion +export { bind }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/bindKey.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/bindKey.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..bf546ffa29ab4e2d06b526992d9b5df4500c1fac --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/bindKey.d.mts @@ -0,0 +1,46 @@ +//#region src/compat/function/bindKey.d.ts +/** + * Creates a function that invokes the method at `object[key]` with `partialArgs` prepended to the arguments it receives. + * + * This method differs from `bind` by allowing bound functions to reference methods that may be redefined or don't yet exist. + * + * The `bindKey.placeholder` value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. + * + * @template T - The type of the object to bind. + * @template K - The type of the key to bind. + * @param {T} object - The object to invoke the method on. + * @param {K} key - The key of the method. + * @param {...any} partialArgs - The arguments to be partially applied. + * @returns {T[K] extends (...args: any[]) => any ? (...args: any[]) => ReturnType : never} - Returns the new bound function. + * + * @example + * const object = { + * user: 'fred', + * greet: function (greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * }, + * }; + * + * let bound = bindKey(object, 'greet', 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * object.greet = function (greeting, punctuation) { + * return greeting + 'ya ' + this.user + punctuation; + * }; + * + * bound('!'); + * // => 'hiya fred!' + * + * // Bound with placeholders. + * bound = bindKey(object, 'greet', bindKey.placeholder, '!'); + * bound('hi'); + * // => 'hiya fred!' + */ +declare function bindKey(object: object, key: string, ...partialArgs: any[]): (...args: any[]) => any; +declare namespace bindKey { + var placeholder: typeof bindKeyPlaceholder; +} +declare const bindKeyPlaceholder: unique symbol; +//#endregion +export { bindKey }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/bindKey.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/bindKey.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bf546ffa29ab4e2d06b526992d9b5df4500c1fac --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/bindKey.d.ts @@ -0,0 +1,46 @@ +//#region src/compat/function/bindKey.d.ts +/** + * Creates a function that invokes the method at `object[key]` with `partialArgs` prepended to the arguments it receives. + * + * This method differs from `bind` by allowing bound functions to reference methods that may be redefined or don't yet exist. + * + * The `bindKey.placeholder` value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. + * + * @template T - The type of the object to bind. + * @template K - The type of the key to bind. + * @param {T} object - The object to invoke the method on. + * @param {K} key - The key of the method. + * @param {...any} partialArgs - The arguments to be partially applied. + * @returns {T[K] extends (...args: any[]) => any ? (...args: any[]) => ReturnType : never} - Returns the new bound function. + * + * @example + * const object = { + * user: 'fred', + * greet: function (greeting, punctuation) { + * return greeting + ' ' + this.user + punctuation; + * }, + * }; + * + * let bound = bindKey(object, 'greet', 'hi'); + * bound('!'); + * // => 'hi fred!' + * + * object.greet = function (greeting, punctuation) { + * return greeting + 'ya ' + this.user + punctuation; + * }; + * + * bound('!'); + * // => 'hiya fred!' + * + * // Bound with placeholders. + * bound = bindKey(object, 'greet', bindKey.placeholder, '!'); + * bound('hi'); + * // => 'hiya fred!' + */ +declare function bindKey(object: object, key: string, ...partialArgs: any[]): (...args: any[]) => any; +declare namespace bindKey { + var placeholder: typeof bindKeyPlaceholder; +} +declare const bindKeyPlaceholder: unique symbol; +//#endregion +export { bindKey }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/bindKey.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/bindKey.js new file mode 100644 index 0000000000000000000000000000000000000000..1f53416092d447202f729edb604f4873de3ffcde --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/bindKey.js @@ -0,0 +1,57 @@ +//#region src/compat/function/bindKey.ts +/** +* Creates a function that invokes the method at `object[key]` with `partialArgs` prepended to the arguments it receives. +* +* This method differs from `bind` by allowing bound functions to reference methods that may be redefined or don't yet exist. +* +* The `bindKey.placeholder` value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. +* +* @template T - The type of the object to bind. +* @template K - The type of the key to bind. +* @param {T} object - The object to invoke the method on. +* @param {K} key - The key of the method. +* @param {...any} partialArgs - The arguments to be partially applied. +* @returns {T[K] extends (...args: any[]) => any ? (...args: any[]) => ReturnType : never} - Returns the new bound function. +* +* @example +* const object = { +* user: 'fred', +* greet: function (greeting, punctuation) { +* return greeting + ' ' + this.user + punctuation; +* }, +* }; +* +* let bound = bindKey(object, 'greet', 'hi'); +* bound('!'); +* // => 'hi fred!' +* +* object.greet = function (greeting, punctuation) { +* return greeting + 'ya ' + this.user + punctuation; +* }; +* +* bound('!'); +* // => 'hiya fred!' +* +* // Bound with placeholders. +* bound = bindKey(object, 'greet', bindKey.placeholder, '!'); +* bound('hi'); +* // => 'hiya fred!' +*/ +function bindKey(object, key, ...partialArgs) { + const bound = function(...providedArgs) { + const args = []; + let startIndex = 0; + for (let i = 0; i < partialArgs.length; i++) { + const arg = partialArgs[i]; + if (arg === bindKey.placeholder) args.push(providedArgs[startIndex++]); + else args.push(arg); + } + for (let i = startIndex; i < providedArgs.length; i++) args.push(providedArgs[i]); + if (this instanceof bound) return new object[key](...args); + return object[key].apply(object, args); + }; + return bound; +} +bindKey.placeholder = Symbol("bindKey.placeholder"); +//#endregion +exports.bindKey = bindKey; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/bindKey.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/bindKey.mjs new file mode 100644 index 0000000000000000000000000000000000000000..af97164a9cd0c237d7c8940e59aeacaf67efb8e4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/bindKey.mjs @@ -0,0 +1,57 @@ +//#region src/compat/function/bindKey.ts +/** +* Creates a function that invokes the method at `object[key]` with `partialArgs` prepended to the arguments it receives. +* +* This method differs from `bind` by allowing bound functions to reference methods that may be redefined or don't yet exist. +* +* The `bindKey.placeholder` value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. +* +* @template T - The type of the object to bind. +* @template K - The type of the key to bind. +* @param {T} object - The object to invoke the method on. +* @param {K} key - The key of the method. +* @param {...any} partialArgs - The arguments to be partially applied. +* @returns {T[K] extends (...args: any[]) => any ? (...args: any[]) => ReturnType : never} - Returns the new bound function. +* +* @example +* const object = { +* user: 'fred', +* greet: function (greeting, punctuation) { +* return greeting + ' ' + this.user + punctuation; +* }, +* }; +* +* let bound = bindKey(object, 'greet', 'hi'); +* bound('!'); +* // => 'hi fred!' +* +* object.greet = function (greeting, punctuation) { +* return greeting + 'ya ' + this.user + punctuation; +* }; +* +* bound('!'); +* // => 'hiya fred!' +* +* // Bound with placeholders. +* bound = bindKey(object, 'greet', bindKey.placeholder, '!'); +* bound('hi'); +* // => 'hiya fred!' +*/ +function bindKey(object, key, ...partialArgs) { + const bound = function(...providedArgs) { + const args = []; + let startIndex = 0; + for (let i = 0; i < partialArgs.length; i++) { + const arg = partialArgs[i]; + if (arg === bindKey.placeholder) args.push(providedArgs[startIndex++]); + else args.push(arg); + } + for (let i = startIndex; i < providedArgs.length; i++) args.push(providedArgs[i]); + if (this instanceof bound) return new object[key](...args); + return object[key].apply(object, args); + }; + return bound; +} +bindKey.placeholder = Symbol("bindKey.placeholder"); +//#endregion +export { bindKey }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/curry.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/curry.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..30d3c7993537474fc278ba3a36a147c3e90ff224 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/curry.d.mts @@ -0,0 +1,155 @@ +//#region src/compat/function/curry.d.ts +type __ = typeof curryPlaceholder; +interface CurriedFunction1 { + (): CurriedFunction1; + (t1: T1): R; +} +interface CurriedFunction2 { + (): CurriedFunction2; + (t1: T1): CurriedFunction1; + (t1: __, t2: T2): CurriedFunction1; + (t1: T1, t2: T2): R; +} +interface CurriedFunction3 { + (): CurriedFunction3; + (t1: T1): CurriedFunction2; + (t1: __, t2: T2): CurriedFunction2; + (t1: T1, t2: T2): CurriedFunction1; + (t1: __, t2: __, t3: T3): CurriedFunction2; + (t1: T1, t2: __, t3: T3): CurriedFunction1; + (t1: __, t2: T2, t3: T3): CurriedFunction1; + (t1: T1, t2: T2, t3: T3): R; +} +interface CurriedFunction4 { + (): CurriedFunction4; + (t1: T1): CurriedFunction3; + (t1: __, t2: T2): CurriedFunction3; + (t1: T1, t2: T2): CurriedFunction2; + (t1: __, t2: __, t3: T3): CurriedFunction3; + (t1: __, t2: __, t3: T3): CurriedFunction2; + (t1: __, t2: T2, t3: T3): CurriedFunction2; + (t1: T1, t2: T2, t3: T3): CurriedFunction1; + (t1: __, t2: __, t3: __, t4: T4): CurriedFunction3; + (t1: T1, t2: __, t3: __, t4: T4): CurriedFunction2; + (t1: __, t2: T2, t3: __, t4: T4): CurriedFunction2; + (t1: __, t2: __, t3: T3, t4: T4): CurriedFunction2; + (t1: T1, t2: T2, t3: __, t4: T4): CurriedFunction1; + (t1: T1, t2: __, t3: T3, t4: T4): CurriedFunction1; + (t1: __, t2: T2, t3: T3, t4: T4): CurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4): R; +} +interface CurriedFunction5 { + (): CurriedFunction5; + (t1: T1): CurriedFunction4; + (t1: __, t2: T2): CurriedFunction4; + (t1: T1, t2: T2): CurriedFunction3; + (t1: __, t2: __, t3: T3): CurriedFunction4; + (t1: T1, t2: __, t3: T3): CurriedFunction3; + (t1: __, t2: T2, t3: T3): CurriedFunction3; + (t1: T1, t2: T2, t3: T3): CurriedFunction2; + (t1: __, t2: __, t3: __, t4: T4): CurriedFunction4; + (t1: T1, t2: __, t3: __, t4: T4): CurriedFunction3; + (t1: __, t2: T2, t3: __, t4: T4): CurriedFunction3; + (t1: __, t2: __, t3: T3, t4: T4): CurriedFunction3; + (t1: T1, t2: T2, t3: __, t4: T4): CurriedFunction2; + (t1: T1, t2: __, t3: T3, t4: T4): CurriedFunction2; + (t1: __, t2: T2, t3: T3, t4: T4): CurriedFunction2; + (t1: T1, t2: T2, t3: T3, t4: T4): CurriedFunction1; + (t1: __, t2: __, t3: __, t4: __, t5: T5): CurriedFunction4; + (t1: T1, t2: __, t3: __, t4: __, t5: T5): CurriedFunction3; + (t1: __, t2: T2, t3: __, t4: __, t5: T5): CurriedFunction3; + (t1: __, t2: __, t3: T3, t4: __, t5: T5): CurriedFunction3; + (t1: __, t2: __, t3: __, t4: T4, t5: T5): CurriedFunction3; + (t1: T1, t2: T2, t3: __, t4: __, t5: T5): CurriedFunction2; + (t1: T1, t2: __, t3: T3, t4: __, t5: T5): CurriedFunction2; + (t1: T1, t2: __, t3: __, t4: T4, t5: T5): CurriedFunction2; + (t1: __, t2: T2, t3: T3, t4: __, t5: T5): CurriedFunction2; + (t1: __, t2: T2, t3: __, t4: T4, t5: T5): CurriedFunction2; + (t1: __, t2: __, t3: T3, t4: T4, t5: T5): CurriedFunction2; + (t1: T1, t2: T2, t3: T3, t4: __, t5: T5): CurriedFunction1; + (t1: T1, t2: T2, t3: __, t4: T4, t5: T5): CurriedFunction1; + (t1: T1, t2: __, t3: T3, t4: T4, t5: T5): CurriedFunction1; + (t1: __, t2: T2, t3: T3, t4: T4, t5: T5): CurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R; +} +/** + * Creates a curried function that accepts a single argument. + * @param {(t1: T1) => R} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {CurriedFunction1} - Returns the new curried function. + * @example + * const greet = (name: string) => `Hello ${name}`; + * const curriedGreet = curry(greet); + * curriedGreet('John'); // => 'Hello John' + */ +declare function curry(func: (t1: T1) => R, arity?: number): CurriedFunction1; +/** + * Creates a curried function that accepts two arguments. + * @param {(t1: T1, t2: T2) => R} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {CurriedFunction2} - Returns the new curried function. + * @example + * const add = (a: number, b: number) => a + b; + * const curriedAdd = curry(add); + * curriedAdd(1)(2); // => 3 + * curriedAdd(1, 2); // => 3 + */ +declare function curry(func: (t1: T1, t2: T2) => R, arity?: number): CurriedFunction2; +/** + * Creates a curried function that accepts three arguments. + * @param {(t1: T1, t2: T2, t3: T3) => R} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {CurriedFunction3} - Returns the new curried function. + * @example + * const volume = (l: number, w: number, h: number) => l * w * h; + * const curriedVolume = curry(volume); + * curriedVolume(2)(3)(4); // => 24 + * curriedVolume(2, 3)(4); // => 24 + * curriedVolume(2, 3, 4); // => 24 + */ +declare function curry(func: (t1: T1, t2: T2, t3: T3) => R, arity?: number): CurriedFunction3; +/** + * Creates a curried function that accepts four arguments. + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {CurriedFunction4} - Returns the new curried function. + * @example + * const fn = (a: number, b: number, c: number, d: number) => a + b + c + d; + * const curriedFn = curry(fn); + * curriedFn(1)(2)(3)(4); // => 10 + * curriedFn(1, 2)(3, 4); // => 10 + * curriedFn(1, 2, 3, 4); // => 10 + */ +declare function curry(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arity?: number): CurriedFunction4; +/** + * Creates a curried function that accepts five arguments. + * @param {(t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {CurriedFunction5} - Returns the new curried function. + * @example + * const fn = (a: number, b: number, c: number, d: number, e: number) => a + b + c + d + e; + * const curriedFn = curry(fn); + * curriedFn(1)(2)(3)(4)(5); // => 15 + * curriedFn(1, 2)(3, 4)(5); // => 15 + * curriedFn(1, 2, 3, 4, 5); // => 15 + */ +declare function curry(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R, arity?: number): CurriedFunction5; +/** + * Creates a curried function that accepts any number of arguments. + * @param {(...args: any[]) => any} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {(...args: any[]) => any} - Returns the new curried function. + * @example + * const sum = (...args: number[]) => args.reduce((a, b) => a + b, 0); + * const curriedSum = curry(sum); + * curriedSum(1, 2, 3); // => 6 + * curriedSum(1)(2, 3); // => 6 + * curriedSum(1)(2)(3); // => 6 + */ +declare function curry(func: (...args: any[]) => any, arity?: number): (...args: any[]) => any; +declare namespace curry { + var placeholder: typeof curryPlaceholder; +} +declare const curryPlaceholder: unique symbol; +//#endregion +export { curry }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/curry.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/curry.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..30d3c7993537474fc278ba3a36a147c3e90ff224 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/curry.d.ts @@ -0,0 +1,155 @@ +//#region src/compat/function/curry.d.ts +type __ = typeof curryPlaceholder; +interface CurriedFunction1 { + (): CurriedFunction1; + (t1: T1): R; +} +interface CurriedFunction2 { + (): CurriedFunction2; + (t1: T1): CurriedFunction1; + (t1: __, t2: T2): CurriedFunction1; + (t1: T1, t2: T2): R; +} +interface CurriedFunction3 { + (): CurriedFunction3; + (t1: T1): CurriedFunction2; + (t1: __, t2: T2): CurriedFunction2; + (t1: T1, t2: T2): CurriedFunction1; + (t1: __, t2: __, t3: T3): CurriedFunction2; + (t1: T1, t2: __, t3: T3): CurriedFunction1; + (t1: __, t2: T2, t3: T3): CurriedFunction1; + (t1: T1, t2: T2, t3: T3): R; +} +interface CurriedFunction4 { + (): CurriedFunction4; + (t1: T1): CurriedFunction3; + (t1: __, t2: T2): CurriedFunction3; + (t1: T1, t2: T2): CurriedFunction2; + (t1: __, t2: __, t3: T3): CurriedFunction3; + (t1: __, t2: __, t3: T3): CurriedFunction2; + (t1: __, t2: T2, t3: T3): CurriedFunction2; + (t1: T1, t2: T2, t3: T3): CurriedFunction1; + (t1: __, t2: __, t3: __, t4: T4): CurriedFunction3; + (t1: T1, t2: __, t3: __, t4: T4): CurriedFunction2; + (t1: __, t2: T2, t3: __, t4: T4): CurriedFunction2; + (t1: __, t2: __, t3: T3, t4: T4): CurriedFunction2; + (t1: T1, t2: T2, t3: __, t4: T4): CurriedFunction1; + (t1: T1, t2: __, t3: T3, t4: T4): CurriedFunction1; + (t1: __, t2: T2, t3: T3, t4: T4): CurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4): R; +} +interface CurriedFunction5 { + (): CurriedFunction5; + (t1: T1): CurriedFunction4; + (t1: __, t2: T2): CurriedFunction4; + (t1: T1, t2: T2): CurriedFunction3; + (t1: __, t2: __, t3: T3): CurriedFunction4; + (t1: T1, t2: __, t3: T3): CurriedFunction3; + (t1: __, t2: T2, t3: T3): CurriedFunction3; + (t1: T1, t2: T2, t3: T3): CurriedFunction2; + (t1: __, t2: __, t3: __, t4: T4): CurriedFunction4; + (t1: T1, t2: __, t3: __, t4: T4): CurriedFunction3; + (t1: __, t2: T2, t3: __, t4: T4): CurriedFunction3; + (t1: __, t2: __, t3: T3, t4: T4): CurriedFunction3; + (t1: T1, t2: T2, t3: __, t4: T4): CurriedFunction2; + (t1: T1, t2: __, t3: T3, t4: T4): CurriedFunction2; + (t1: __, t2: T2, t3: T3, t4: T4): CurriedFunction2; + (t1: T1, t2: T2, t3: T3, t4: T4): CurriedFunction1; + (t1: __, t2: __, t3: __, t4: __, t5: T5): CurriedFunction4; + (t1: T1, t2: __, t3: __, t4: __, t5: T5): CurriedFunction3; + (t1: __, t2: T2, t3: __, t4: __, t5: T5): CurriedFunction3; + (t1: __, t2: __, t3: T3, t4: __, t5: T5): CurriedFunction3; + (t1: __, t2: __, t3: __, t4: T4, t5: T5): CurriedFunction3; + (t1: T1, t2: T2, t3: __, t4: __, t5: T5): CurriedFunction2; + (t1: T1, t2: __, t3: T3, t4: __, t5: T5): CurriedFunction2; + (t1: T1, t2: __, t3: __, t4: T4, t5: T5): CurriedFunction2; + (t1: __, t2: T2, t3: T3, t4: __, t5: T5): CurriedFunction2; + (t1: __, t2: T2, t3: __, t4: T4, t5: T5): CurriedFunction2; + (t1: __, t2: __, t3: T3, t4: T4, t5: T5): CurriedFunction2; + (t1: T1, t2: T2, t3: T3, t4: __, t5: T5): CurriedFunction1; + (t1: T1, t2: T2, t3: __, t4: T4, t5: T5): CurriedFunction1; + (t1: T1, t2: __, t3: T3, t4: T4, t5: T5): CurriedFunction1; + (t1: __, t2: T2, t3: T3, t4: T4, t5: T5): CurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R; +} +/** + * Creates a curried function that accepts a single argument. + * @param {(t1: T1) => R} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {CurriedFunction1} - Returns the new curried function. + * @example + * const greet = (name: string) => `Hello ${name}`; + * const curriedGreet = curry(greet); + * curriedGreet('John'); // => 'Hello John' + */ +declare function curry(func: (t1: T1) => R, arity?: number): CurriedFunction1; +/** + * Creates a curried function that accepts two arguments. + * @param {(t1: T1, t2: T2) => R} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {CurriedFunction2} - Returns the new curried function. + * @example + * const add = (a: number, b: number) => a + b; + * const curriedAdd = curry(add); + * curriedAdd(1)(2); // => 3 + * curriedAdd(1, 2); // => 3 + */ +declare function curry(func: (t1: T1, t2: T2) => R, arity?: number): CurriedFunction2; +/** + * Creates a curried function that accepts three arguments. + * @param {(t1: T1, t2: T2, t3: T3) => R} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {CurriedFunction3} - Returns the new curried function. + * @example + * const volume = (l: number, w: number, h: number) => l * w * h; + * const curriedVolume = curry(volume); + * curriedVolume(2)(3)(4); // => 24 + * curriedVolume(2, 3)(4); // => 24 + * curriedVolume(2, 3, 4); // => 24 + */ +declare function curry(func: (t1: T1, t2: T2, t3: T3) => R, arity?: number): CurriedFunction3; +/** + * Creates a curried function that accepts four arguments. + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {CurriedFunction4} - Returns the new curried function. + * @example + * const fn = (a: number, b: number, c: number, d: number) => a + b + c + d; + * const curriedFn = curry(fn); + * curriedFn(1)(2)(3)(4); // => 10 + * curriedFn(1, 2)(3, 4); // => 10 + * curriedFn(1, 2, 3, 4); // => 10 + */ +declare function curry(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arity?: number): CurriedFunction4; +/** + * Creates a curried function that accepts five arguments. + * @param {(t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {CurriedFunction5} - Returns the new curried function. + * @example + * const fn = (a: number, b: number, c: number, d: number, e: number) => a + b + c + d + e; + * const curriedFn = curry(fn); + * curriedFn(1)(2)(3)(4)(5); // => 15 + * curriedFn(1, 2)(3, 4)(5); // => 15 + * curriedFn(1, 2, 3, 4, 5); // => 15 + */ +declare function curry(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R, arity?: number): CurriedFunction5; +/** + * Creates a curried function that accepts any number of arguments. + * @param {(...args: any[]) => any} func - The function to curry. + * @param {number=func.length} arity - The arity of func. + * @returns {(...args: any[]) => any} - Returns the new curried function. + * @example + * const sum = (...args: number[]) => args.reduce((a, b) => a + b, 0); + * const curriedSum = curry(sum); + * curriedSum(1, 2, 3); // => 6 + * curriedSum(1)(2, 3); // => 6 + * curriedSum(1)(2)(3); // => 6 + */ +declare function curry(func: (...args: any[]) => any, arity?: number): (...args: any[]) => any; +declare namespace curry { + var placeholder: typeof curryPlaceholder; +} +declare const curryPlaceholder: unique symbol; +//#endregion +export { curry }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/curry.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/curry.js new file mode 100644 index 0000000000000000000000000000000000000000..b3cb3f8dba0de53bdeec247b75e175e491d439c5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/curry.js @@ -0,0 +1,81 @@ +//#region src/compat/function/curry.ts +/** +* Creates a function that accepts arguments of `func` and either invokes `func` returning its result, if at least `arity` number of arguments have been provided, or returns a function that accepts the remaining `func` arguments, and so on. +* The arity of `func` may be specified if `func.length` is not sufficient. +* +* The `curry.placeholder` value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. +* +* Note: This method doesn't set the `length` property of curried functions. +* +* @param {(...args: any[]) => any} func - The function to curry. +* @param {number=func.length} arity - The arity of func. +* @param {unknown} guard - Enables use as an iteratee for methods like `Array#map`. +* @returns {((...args: any[]) => any) & { placeholder: typeof curry.placeholder }} - Returns the new curried function. +* +* @example +* const abc = function(a, b, c) { +* return Array.from(arguments); +* }; +* +* let curried = curry(abc); +* +* curried(1)(2)(3); +* // => [1, 2, 3] +* +* curried(1, 2)(3); +* // => [1, 2, 3] +* +* curried(1, 2, 3); +* // => [1, 2, 3] +* +* // Curried with placeholders. +* curried(1)(curry.placeholder, 3)(2); +* // => [1, 2, 3] +* +* // Curried with arity. +* curried = curry(abc, 2); +* +* curried(1)(2); +* // => [1, 2] +*/ +function curry(func, arity = func.length, guard) { + arity = guard ? func.length : arity; + arity = Number.parseInt(arity, 10); + if (Number.isNaN(arity) || arity < 1) arity = 0; + const wrapper = function(...partialArgs) { + const holders = partialArgs.filter((item) => item === curry.placeholder); + const length = partialArgs.length - holders.length; + if (length < arity) return makeCurry(func, arity - length, partialArgs); + if (this instanceof wrapper) return new func(...partialArgs); + return func.apply(this, partialArgs); + }; + wrapper.placeholder = curryPlaceholder; + return wrapper; +} +function makeCurry(func, arity, partialArgs) { + function wrapper(...providedArgs) { + const holders = providedArgs.filter((item) => item === curry.placeholder); + const length = providedArgs.length - holders.length; + providedArgs = composeArgs(providedArgs, partialArgs); + if (length < arity) return makeCurry(func, arity - length, providedArgs); + if (this instanceof wrapper) return new func(...providedArgs); + return func.apply(this, providedArgs); + } + wrapper.placeholder = curryPlaceholder; + return wrapper; +} +function composeArgs(providedArgs, partialArgs) { + const args = []; + let startIndex = 0; + for (let i = 0; i < partialArgs.length; i++) { + const arg = partialArgs[i]; + if (arg === curry.placeholder && startIndex < providedArgs.length) args.push(providedArgs[startIndex++]); + else args.push(arg); + } + for (let i = startIndex; i < providedArgs.length; i++) args.push(providedArgs[i]); + return args; +} +const curryPlaceholder = Symbol("curry.placeholder"); +curry.placeholder = curryPlaceholder; +//#endregion +exports.curry = curry; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/curry.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/curry.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9b8e4db6f59928c716744d914abafbba3d054bde --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/curry.mjs @@ -0,0 +1,81 @@ +//#region src/compat/function/curry.ts +/** +* Creates a function that accepts arguments of `func` and either invokes `func` returning its result, if at least `arity` number of arguments have been provided, or returns a function that accepts the remaining `func` arguments, and so on. +* The arity of `func` may be specified if `func.length` is not sufficient. +* +* The `curry.placeholder` value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. +* +* Note: This method doesn't set the `length` property of curried functions. +* +* @param {(...args: any[]) => any} func - The function to curry. +* @param {number=func.length} arity - The arity of func. +* @param {unknown} guard - Enables use as an iteratee for methods like `Array#map`. +* @returns {((...args: any[]) => any) & { placeholder: typeof curry.placeholder }} - Returns the new curried function. +* +* @example +* const abc = function(a, b, c) { +* return Array.from(arguments); +* }; +* +* let curried = curry(abc); +* +* curried(1)(2)(3); +* // => [1, 2, 3] +* +* curried(1, 2)(3); +* // => [1, 2, 3] +* +* curried(1, 2, 3); +* // => [1, 2, 3] +* +* // Curried with placeholders. +* curried(1)(curry.placeholder, 3)(2); +* // => [1, 2, 3] +* +* // Curried with arity. +* curried = curry(abc, 2); +* +* curried(1)(2); +* // => [1, 2] +*/ +function curry(func, arity = func.length, guard) { + arity = guard ? func.length : arity; + arity = Number.parseInt(arity, 10); + if (Number.isNaN(arity) || arity < 1) arity = 0; + const wrapper = function(...partialArgs) { + const holders = partialArgs.filter((item) => item === curry.placeholder); + const length = partialArgs.length - holders.length; + if (length < arity) return makeCurry(func, arity - length, partialArgs); + if (this instanceof wrapper) return new func(...partialArgs); + return func.apply(this, partialArgs); + }; + wrapper.placeholder = curryPlaceholder; + return wrapper; +} +function makeCurry(func, arity, partialArgs) { + function wrapper(...providedArgs) { + const holders = providedArgs.filter((item) => item === curry.placeholder); + const length = providedArgs.length - holders.length; + providedArgs = composeArgs(providedArgs, partialArgs); + if (length < arity) return makeCurry(func, arity - length, providedArgs); + if (this instanceof wrapper) return new func(...providedArgs); + return func.apply(this, providedArgs); + } + wrapper.placeholder = curryPlaceholder; + return wrapper; +} +function composeArgs(providedArgs, partialArgs) { + const args = []; + let startIndex = 0; + for (let i = 0; i < partialArgs.length; i++) { + const arg = partialArgs[i]; + if (arg === curry.placeholder && startIndex < providedArgs.length) args.push(providedArgs[startIndex++]); + else args.push(arg); + } + for (let i = startIndex; i < providedArgs.length; i++) args.push(providedArgs[i]); + return args; +} +const curryPlaceholder = Symbol("curry.placeholder"); +curry.placeholder = curryPlaceholder; +//#endregion +export { curry }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/curryRight.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/curryRight.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6a2f4126f9646a639417a8f2c60ca03607bff3f4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/curryRight.d.mts @@ -0,0 +1,86 @@ +//#region src/compat/function/curryRight.d.ts +type __ = typeof curryRightPlaceholder; +interface RightCurriedFunction1 { + (): RightCurriedFunction1; + (t1: T1): R; +} +interface RightCurriedFunction2 { + (): RightCurriedFunction2; + (t2: T2): RightCurriedFunction1; + (t1: T1, t2: __): RightCurriedFunction1; + (t1: T1, t2: T2): R; +} +interface RightCurriedFunction3 { + (): RightCurriedFunction3; + (t3: T3): RightCurriedFunction2; + (t2: T2, t3: __): RightCurriedFunction2; + (t2: T2, t3: T3): RightCurriedFunction1; + (t1: T1, t2: __, t3: __): RightCurriedFunction2; + (t1: T1, t2: T2, t3: __): RightCurriedFunction1; + (t1: T1, t2: __, t3: T3): RightCurriedFunction1; + (t1: T1, t2: T2, t3: T3): R; +} +interface RightCurriedFunction4 { + (): RightCurriedFunction4; + (t4: T4): RightCurriedFunction3; + (t3: T3, t4: __): RightCurriedFunction3; + (t3: T3, t4: T4): RightCurriedFunction2; + (t2: T2, t3: __, t4: __): RightCurriedFunction3; + (t2: T2, t3: T3, t4: __): RightCurriedFunction2; + (t2: T2, t3: __, t4: T4): RightCurriedFunction2; + (t2: T2, t3: T3, t4: T4): RightCurriedFunction1; + (t1: T1, t2: __, t3: __, t4: __): RightCurriedFunction3; + (t1: T1, t2: T2, t3: __, t4: __): RightCurriedFunction2; + (t1: T1, t2: __, t3: T3, t4: __): RightCurriedFunction2; + (t1: T1, t2: __, t3: __, t4: T4): RightCurriedFunction2; + (t1: T1, t2: T2, t3: T3, t4: __): RightCurriedFunction1; + (t1: T1, t2: T2, t3: __, t4: T4): RightCurriedFunction1; + (t1: T1, t2: __, t3: T3, t4: T4): RightCurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4): R; +} +interface RightCurriedFunction5 { + (): RightCurriedFunction5; + (t5: T5): RightCurriedFunction4; + (t4: T4, t5: __): RightCurriedFunction4; + (t4: T4, t5: T5): RightCurriedFunction3; + (t3: T3, t4: __, t5: __): RightCurriedFunction4; + (t3: T3, t4: T4, t5: __): RightCurriedFunction3; + (t3: T3, t4: __, t5: T5): RightCurriedFunction3; + (t3: T3, t4: T4, t5: T5): RightCurriedFunction2; + (t2: T2, t3: __, t4: __, t5: __): RightCurriedFunction4; + (t2: T2, t3: T3, t4: __, t5: __): RightCurriedFunction3; + (t2: T2, t3: __, t4: T4, t5: __): RightCurriedFunction3; + (t2: T2, t3: __, t4: __, t5: T5): RightCurriedFunction3; + (t2: T2, t3: T3, t4: T4, t5: __): RightCurriedFunction2; + (t2: T2, t3: T3, t4: __, t5: T5): RightCurriedFunction2; + (t2: T2, t3: __, t4: T4, t5: T5): RightCurriedFunction2; + (t2: T2, t3: T3, t4: T4, t5: T5): RightCurriedFunction1; + (t1: T1, t2: __, t3: __, t4: __, t5: __): RightCurriedFunction4; + (t1: T1, t2: T2, t3: __, t4: __, t5: __): RightCurriedFunction3; + (t1: T1, t2: __, t3: T3, t4: __, t5: __): RightCurriedFunction3; + (t1: T1, t2: __, t3: __, t4: T4, t5: __): RightCurriedFunction3; + (t1: T1, t2: __, t3: __, t4: __, t5: T5): RightCurriedFunction3; + (t1: T1, t2: T2, t3: T3, t4: __, t5: __): RightCurriedFunction2; + (t1: T1, t2: T2, t3: __, t4: T4, t5: __): RightCurriedFunction2; + (t1: T1, t2: T2, t3: __, t4: __, t5: T5): RightCurriedFunction2; + (t1: T1, t2: __, t3: T3, t4: T4, t5: __): RightCurriedFunction2; + (t1: T1, t2: __, t3: T3, t4: __, t5: T5): RightCurriedFunction2; + (t1: T1, t2: __, t3: __, t4: T4, t5: T5): RightCurriedFunction2; + (t1: T1, t2: T2, t3: T3, t4: T4, t5: __): RightCurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: __, t5: T5): RightCurriedFunction1; + (t1: T1, t2: T2, t3: __, t4: T4, t5: T5): RightCurriedFunction1; + (t1: T1, t2: __, t3: T3, t4: T4, t5: T5): RightCurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R; +} +declare function curryRight(func: (t1: T1) => R, arity?: number): RightCurriedFunction1; +declare function curryRight(func: (t1: T1, t2: T2) => R, arity?: number): RightCurriedFunction2; +declare function curryRight(func: (t1: T1, t2: T2, t3: T3) => R, arity?: number): RightCurriedFunction3; +declare function curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arity?: number): RightCurriedFunction4; +declare function curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R, arity?: number): RightCurriedFunction5; +declare function curryRight(func: (...args: any[]) => any, arity?: number): (...args: any[]) => any; +declare namespace curryRight { + var placeholder: typeof curryRightPlaceholder; +} +declare const curryRightPlaceholder: unique symbol; +//#endregion +export { curryRight }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/curryRight.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/curryRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6a2f4126f9646a639417a8f2c60ca03607bff3f4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/curryRight.d.ts @@ -0,0 +1,86 @@ +//#region src/compat/function/curryRight.d.ts +type __ = typeof curryRightPlaceholder; +interface RightCurriedFunction1 { + (): RightCurriedFunction1; + (t1: T1): R; +} +interface RightCurriedFunction2 { + (): RightCurriedFunction2; + (t2: T2): RightCurriedFunction1; + (t1: T1, t2: __): RightCurriedFunction1; + (t1: T1, t2: T2): R; +} +interface RightCurriedFunction3 { + (): RightCurriedFunction3; + (t3: T3): RightCurriedFunction2; + (t2: T2, t3: __): RightCurriedFunction2; + (t2: T2, t3: T3): RightCurriedFunction1; + (t1: T1, t2: __, t3: __): RightCurriedFunction2; + (t1: T1, t2: T2, t3: __): RightCurriedFunction1; + (t1: T1, t2: __, t3: T3): RightCurriedFunction1; + (t1: T1, t2: T2, t3: T3): R; +} +interface RightCurriedFunction4 { + (): RightCurriedFunction4; + (t4: T4): RightCurriedFunction3; + (t3: T3, t4: __): RightCurriedFunction3; + (t3: T3, t4: T4): RightCurriedFunction2; + (t2: T2, t3: __, t4: __): RightCurriedFunction3; + (t2: T2, t3: T3, t4: __): RightCurriedFunction2; + (t2: T2, t3: __, t4: T4): RightCurriedFunction2; + (t2: T2, t3: T3, t4: T4): RightCurriedFunction1; + (t1: T1, t2: __, t3: __, t4: __): RightCurriedFunction3; + (t1: T1, t2: T2, t3: __, t4: __): RightCurriedFunction2; + (t1: T1, t2: __, t3: T3, t4: __): RightCurriedFunction2; + (t1: T1, t2: __, t3: __, t4: T4): RightCurriedFunction2; + (t1: T1, t2: T2, t3: T3, t4: __): RightCurriedFunction1; + (t1: T1, t2: T2, t3: __, t4: T4): RightCurriedFunction1; + (t1: T1, t2: __, t3: T3, t4: T4): RightCurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4): R; +} +interface RightCurriedFunction5 { + (): RightCurriedFunction5; + (t5: T5): RightCurriedFunction4; + (t4: T4, t5: __): RightCurriedFunction4; + (t4: T4, t5: T5): RightCurriedFunction3; + (t3: T3, t4: __, t5: __): RightCurriedFunction4; + (t3: T3, t4: T4, t5: __): RightCurriedFunction3; + (t3: T3, t4: __, t5: T5): RightCurriedFunction3; + (t3: T3, t4: T4, t5: T5): RightCurriedFunction2; + (t2: T2, t3: __, t4: __, t5: __): RightCurriedFunction4; + (t2: T2, t3: T3, t4: __, t5: __): RightCurriedFunction3; + (t2: T2, t3: __, t4: T4, t5: __): RightCurriedFunction3; + (t2: T2, t3: __, t4: __, t5: T5): RightCurriedFunction3; + (t2: T2, t3: T3, t4: T4, t5: __): RightCurriedFunction2; + (t2: T2, t3: T3, t4: __, t5: T5): RightCurriedFunction2; + (t2: T2, t3: __, t4: T4, t5: T5): RightCurriedFunction2; + (t2: T2, t3: T3, t4: T4, t5: T5): RightCurriedFunction1; + (t1: T1, t2: __, t3: __, t4: __, t5: __): RightCurriedFunction4; + (t1: T1, t2: T2, t3: __, t4: __, t5: __): RightCurriedFunction3; + (t1: T1, t2: __, t3: T3, t4: __, t5: __): RightCurriedFunction3; + (t1: T1, t2: __, t3: __, t4: T4, t5: __): RightCurriedFunction3; + (t1: T1, t2: __, t3: __, t4: __, t5: T5): RightCurriedFunction3; + (t1: T1, t2: T2, t3: T3, t4: __, t5: __): RightCurriedFunction2; + (t1: T1, t2: T2, t3: __, t4: T4, t5: __): RightCurriedFunction2; + (t1: T1, t2: T2, t3: __, t4: __, t5: T5): RightCurriedFunction2; + (t1: T1, t2: __, t3: T3, t4: T4, t5: __): RightCurriedFunction2; + (t1: T1, t2: __, t3: T3, t4: __, t5: T5): RightCurriedFunction2; + (t1: T1, t2: __, t3: __, t4: T4, t5: T5): RightCurriedFunction2; + (t1: T1, t2: T2, t3: T3, t4: T4, t5: __): RightCurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: __, t5: T5): RightCurriedFunction1; + (t1: T1, t2: T2, t3: __, t4: T4, t5: T5): RightCurriedFunction1; + (t1: T1, t2: __, t3: T3, t4: T4, t5: T5): RightCurriedFunction1; + (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R; +} +declare function curryRight(func: (t1: T1) => R, arity?: number): RightCurriedFunction1; +declare function curryRight(func: (t1: T1, t2: T2) => R, arity?: number): RightCurriedFunction2; +declare function curryRight(func: (t1: T1, t2: T2, t3: T3) => R, arity?: number): RightCurriedFunction3; +declare function curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arity?: number): RightCurriedFunction4; +declare function curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R, arity?: number): RightCurriedFunction5; +declare function curryRight(func: (...args: any[]) => any, arity?: number): (...args: any[]) => any; +declare namespace curryRight { + var placeholder: typeof curryRightPlaceholder; +} +declare const curryRightPlaceholder: unique symbol; +//#endregion +export { curryRight }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/curryRight.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/curryRight.js new file mode 100644 index 0000000000000000000000000000000000000000..b5a8a86231cd00660aacc96592bfe8c304492e9d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/curryRight.js @@ -0,0 +1,86 @@ +//#region src/compat/function/curryRight.ts +/** +* Creates a function that accepts arguments of `func` and either invokes `func` returning its result, if at least `arity` number of arguments have been provided, or returns a function that accepts the remaining `func` arguments, and so on. +* The arity of `func` may be specified if `func.length` is not sufficient. +* +* Unlike `curry`, this function curries the function from right to left. +* +* The `curryRight.placeholder` value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. +* +* Note: This method doesn't set the `length` property of curried functions. +* +* @param {(...args: any[]) => any} func - The function to curry. +* @param {number=func.length} arity - The arity of func. +* @param {unknown} guard - Enables use as an iteratee for methods like `Array#map`. +* @returns {((...args: any[]) => any) & { placeholder: typeof curryRight.placeholder }} - Returns the new curried function. +* +* @example +* const abc = function(a, b, c) { +* return Array.from(arguments); +* }; +* +* let curried = curryRight(abc); +* +* curried(3)(2)(1); +* // => [1, 2, 3] +* +* curried(2, 3)(1); +* // => [1, 2, 3] +* +* curried(1, 2, 3); +* // => [1, 2, 3] +* +* // Curried with placeholders. +* curried(3)(curryRight.placeholder, 2)(1); +* // => [1, 2, 3] +* +* // Curried with arity. +* curried = curryRight(abc, 2); +* +* curried(2)(1); +* // => [1, 2] +*/ +function curryRight(func, arity = func.length, guard) { + arity = guard ? func.length : arity; + arity = Number.parseInt(arity, 10); + if (Number.isNaN(arity) || arity < 1) arity = 0; + const wrapper = function(...partialArgs) { + const holders = partialArgs.filter((item) => item === curryRight.placeholder); + const length = partialArgs.length - holders.length; + if (length < arity) return makeCurryRight(func, arity - length, partialArgs); + if (this instanceof wrapper) return new func(...partialArgs); + return func.apply(this, partialArgs); + }; + wrapper.placeholder = curryRightPlaceholder; + return wrapper; +} +function makeCurryRight(func, arity, partialArgs) { + function wrapper(...providedArgs) { + const holders = providedArgs.filter((item) => item === curryRight.placeholder); + const length = providedArgs.length - holders.length; + providedArgs = composeArgs(providedArgs, partialArgs); + if (length < arity) return makeCurryRight(func, arity - length, providedArgs); + if (this instanceof wrapper) return new func(...providedArgs); + return func.apply(this, providedArgs); + } + wrapper.placeholder = curryRightPlaceholder; + return wrapper; +} +function composeArgs(providedArgs, partialArgs) { + const placeholderLength = partialArgs.filter((arg) => arg === curryRight.placeholder).length; + const rangeLength = Math.max(providedArgs.length - placeholderLength, 0); + const args = []; + let providedIndex = 0; + for (let i = 0; i < rangeLength; i++) args.push(providedArgs[providedIndex++]); + for (let i = 0; i < partialArgs.length; i++) { + const arg = partialArgs[i]; + if (arg === curryRight.placeholder) if (providedIndex < providedArgs.length) args.push(providedArgs[providedIndex++]); + else args.push(arg); + else args.push(arg); + } + return args; +} +const curryRightPlaceholder = Symbol("curryRight.placeholder"); +curryRight.placeholder = curryRightPlaceholder; +//#endregion +exports.curryRight = curryRight; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/curryRight.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/curryRight.mjs new file mode 100644 index 0000000000000000000000000000000000000000..38987529b4d667fa9a1bbd79af8c271266a7e47d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/curryRight.mjs @@ -0,0 +1,86 @@ +//#region src/compat/function/curryRight.ts +/** +* Creates a function that accepts arguments of `func` and either invokes `func` returning its result, if at least `arity` number of arguments have been provided, or returns a function that accepts the remaining `func` arguments, and so on. +* The arity of `func` may be specified if `func.length` is not sufficient. +* +* Unlike `curry`, this function curries the function from right to left. +* +* The `curryRight.placeholder` value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. +* +* Note: This method doesn't set the `length` property of curried functions. +* +* @param {(...args: any[]) => any} func - The function to curry. +* @param {number=func.length} arity - The arity of func. +* @param {unknown} guard - Enables use as an iteratee for methods like `Array#map`. +* @returns {((...args: any[]) => any) & { placeholder: typeof curryRight.placeholder }} - Returns the new curried function. +* +* @example +* const abc = function(a, b, c) { +* return Array.from(arguments); +* }; +* +* let curried = curryRight(abc); +* +* curried(3)(2)(1); +* // => [1, 2, 3] +* +* curried(2, 3)(1); +* // => [1, 2, 3] +* +* curried(1, 2, 3); +* // => [1, 2, 3] +* +* // Curried with placeholders. +* curried(3)(curryRight.placeholder, 2)(1); +* // => [1, 2, 3] +* +* // Curried with arity. +* curried = curryRight(abc, 2); +* +* curried(2)(1); +* // => [1, 2] +*/ +function curryRight(func, arity = func.length, guard) { + arity = guard ? func.length : arity; + arity = Number.parseInt(arity, 10); + if (Number.isNaN(arity) || arity < 1) arity = 0; + const wrapper = function(...partialArgs) { + const holders = partialArgs.filter((item) => item === curryRight.placeholder); + const length = partialArgs.length - holders.length; + if (length < arity) return makeCurryRight(func, arity - length, partialArgs); + if (this instanceof wrapper) return new func(...partialArgs); + return func.apply(this, partialArgs); + }; + wrapper.placeholder = curryRightPlaceholder; + return wrapper; +} +function makeCurryRight(func, arity, partialArgs) { + function wrapper(...providedArgs) { + const holders = providedArgs.filter((item) => item === curryRight.placeholder); + const length = providedArgs.length - holders.length; + providedArgs = composeArgs(providedArgs, partialArgs); + if (length < arity) return makeCurryRight(func, arity - length, providedArgs); + if (this instanceof wrapper) return new func(...providedArgs); + return func.apply(this, providedArgs); + } + wrapper.placeholder = curryRightPlaceholder; + return wrapper; +} +function composeArgs(providedArgs, partialArgs) { + const placeholderLength = partialArgs.filter((arg) => arg === curryRight.placeholder).length; + const rangeLength = Math.max(providedArgs.length - placeholderLength, 0); + const args = []; + let providedIndex = 0; + for (let i = 0; i < rangeLength; i++) args.push(providedArgs[providedIndex++]); + for (let i = 0; i < partialArgs.length; i++) { + const arg = partialArgs[i]; + if (arg === curryRight.placeholder) if (providedIndex < providedArgs.length) args.push(providedArgs[providedIndex++]); + else args.push(arg); + else args.push(arg); + } + return args; +} +const curryRightPlaceholder = Symbol("curryRight.placeholder"); +curryRight.placeholder = curryRightPlaceholder; +//#endregion +export { curryRight }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/debounce.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/debounce.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b165a5901e2a3f9eb69dca1af126f0933bbb6762 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/debounce.d.mts @@ -0,0 +1,145 @@ +//#region src/compat/function/debounce.d.ts +interface DebounceSettings { + /** + * If `true`, the function will be invoked on the leading edge of the timeout. + * @default false + */ + leading?: boolean | undefined; + /** + * The maximum time `func` is allowed to be delayed before it's invoked. + * @default Infinity + */ + maxWait?: number | undefined; + /** + * If `true`, the function will be invoked on the trailing edge of the timeout. + * @default true + */ + trailing?: boolean | undefined; +} +interface DebounceSettingsLeading extends DebounceSettings { + leading: true; +} +interface DebouncedFunc any> { + /** + * Call the original function, but applying the debounce rules. + * + * If the debounced function can be run immediately, this calls it and returns its return + * value. + * + * Otherwise, it returns the return value of the last invocation, or undefined if the debounced + * function was not invoked yet. + */ + (...args: Parameters): ReturnType | undefined; + /** + * Throw away any pending invocation of the debounced function. + */ + cancel(): void; + /** + * If there is a pending invocation of the debounced function, invoke it immediately and return + * its return value. + * + * Otherwise, return the value from the last invocation, or undefined if the debounced function + * was never invoked. + */ + flush(): ReturnType | undefined; +} +interface DebouncedFuncLeading any> extends DebouncedFunc { + (...args: Parameters): ReturnType; + flush(): ReturnType; +} +/** + * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds + * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel` + * method to cancel any pending execution. + * + * You can set the debounced function to run at the start (`leading`) or end (`trailing`) of the delay period. + * If `leading` is true, the function runs immediately on the first call. + * If `trailing` is true, the function runs after `debounceMs` milliseconds have passed since the last call. + * If both `leading` and `trailing` are true, the function runs at both the start and end, but it must be called at least twice within `debounceMs` milliseconds for this to happen + * (since one debounced function call cannot trigger the function twice). + * + * You can also set a `maxWait` time, which is the maximum time the function is allowed to be delayed before it is called. + * + * @template F - The type of function. + * @param {F} func - The function to debounce. + * @param {number} debounceMs - The number of milliseconds to delay. + * @param {DebounceOptions} options - The options object + * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function. + * @param {boolean} options.leading - If `true`, the function will be invoked on the leading edge of the timeout. + * @param {boolean} options.trailing - If `true`, the function will be invoked on the trailing edge of the timeout. + * @param {number} options.maxWait - The maximum time `func` is allowed to be delayed before it's invoked. + * @returns A new debounced function with a `cancel` method. + * + * @example + * const debouncedFunction = debounce(() => { + * console.log('Function executed'); + * }, 1000); + * + * // Will log 'Function executed' after 1 second if not called again in that time + * debouncedFunction(); + * + * // Will not log anything as the previous call is canceled + * debouncedFunction.cancel(); + * + * // With AbortSignal + * const controller = new AbortController(); + * const signal = controller.signal; + * const debouncedWithSignal = debounce(() => { + * console.log('Function executed'); + * }, 1000, { signal }); + * + * debouncedWithSignal(); + * + * // Will cancel the debounced function call + * controller.abort(); + */ +declare function debounce any>(func: T, wait: number | undefined, options: DebounceSettingsLeading): DebouncedFuncLeading; +/** + * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds + * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel` + * method to cancel any pending execution. + * + * You can set the debounced function to run at the start (`leading`) or end (`trailing`) of the delay period. + * If `leading` is true, the function runs immediately on the first call. + * If `trailing` is true, the function runs after `debounceMs` milliseconds have passed since the last call. + * If both `leading` and `trailing` are true, the function runs at both the start and end, but it must be called at least twice within `debounceMs` milliseconds for this to happen + * (since one debounced function call cannot trigger the function twice). + * + * You can also set a `maxWait` time, which is the maximum time the function is allowed to be delayed before it is called. + * + * @template F - The type of function. + * @param {F} func - The function to debounce. + * @param {number} debounceMs - The number of milliseconds to delay. + * @param {DebounceOptions} options - The options object + * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function. + * @param {boolean} options.leading - If `true`, the function will be invoked on the leading edge of the timeout. + * @param {boolean} options.trailing - If `true`, the function will be invoked on the trailing edge of the timeout. + * @param {number} options.maxWait - The maximum time `func` is allowed to be delayed before it's invoked. + * @returns A new debounced function with a `cancel` method. + * + * @example + * const debouncedFunction = debounce(() => { + * console.log('Function executed'); + * }, 1000); + * + * // Will log 'Function executed' after 1 second if not called again in that time + * debouncedFunction(); + * + * // Will not log anything as the previous call is canceled + * debouncedFunction.cancel(); + * + * // With AbortSignal + * const controller = new AbortController(); + * const signal = controller.signal; + * const debouncedWithSignal = debounce(() => { + * console.log('Function executed'); + * }, 1000, { signal }); + * + * debouncedWithSignal(); + * + * // Will cancel the debounced function call + * controller.abort(); + */ +declare function debounce any>(func: T, wait?: number, options?: DebounceSettings): DebouncedFunc; +//#endregion +export { DebouncedFunc, DebouncedFuncLeading, debounce }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/debounce.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/debounce.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b165a5901e2a3f9eb69dca1af126f0933bbb6762 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/debounce.d.ts @@ -0,0 +1,145 @@ +//#region src/compat/function/debounce.d.ts +interface DebounceSettings { + /** + * If `true`, the function will be invoked on the leading edge of the timeout. + * @default false + */ + leading?: boolean | undefined; + /** + * The maximum time `func` is allowed to be delayed before it's invoked. + * @default Infinity + */ + maxWait?: number | undefined; + /** + * If `true`, the function will be invoked on the trailing edge of the timeout. + * @default true + */ + trailing?: boolean | undefined; +} +interface DebounceSettingsLeading extends DebounceSettings { + leading: true; +} +interface DebouncedFunc any> { + /** + * Call the original function, but applying the debounce rules. + * + * If the debounced function can be run immediately, this calls it and returns its return + * value. + * + * Otherwise, it returns the return value of the last invocation, or undefined if the debounced + * function was not invoked yet. + */ + (...args: Parameters): ReturnType | undefined; + /** + * Throw away any pending invocation of the debounced function. + */ + cancel(): void; + /** + * If there is a pending invocation of the debounced function, invoke it immediately and return + * its return value. + * + * Otherwise, return the value from the last invocation, or undefined if the debounced function + * was never invoked. + */ + flush(): ReturnType | undefined; +} +interface DebouncedFuncLeading any> extends DebouncedFunc { + (...args: Parameters): ReturnType; + flush(): ReturnType; +} +/** + * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds + * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel` + * method to cancel any pending execution. + * + * You can set the debounced function to run at the start (`leading`) or end (`trailing`) of the delay period. + * If `leading` is true, the function runs immediately on the first call. + * If `trailing` is true, the function runs after `debounceMs` milliseconds have passed since the last call. + * If both `leading` and `trailing` are true, the function runs at both the start and end, but it must be called at least twice within `debounceMs` milliseconds for this to happen + * (since one debounced function call cannot trigger the function twice). + * + * You can also set a `maxWait` time, which is the maximum time the function is allowed to be delayed before it is called. + * + * @template F - The type of function. + * @param {F} func - The function to debounce. + * @param {number} debounceMs - The number of milliseconds to delay. + * @param {DebounceOptions} options - The options object + * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function. + * @param {boolean} options.leading - If `true`, the function will be invoked on the leading edge of the timeout. + * @param {boolean} options.trailing - If `true`, the function will be invoked on the trailing edge of the timeout. + * @param {number} options.maxWait - The maximum time `func` is allowed to be delayed before it's invoked. + * @returns A new debounced function with a `cancel` method. + * + * @example + * const debouncedFunction = debounce(() => { + * console.log('Function executed'); + * }, 1000); + * + * // Will log 'Function executed' after 1 second if not called again in that time + * debouncedFunction(); + * + * // Will not log anything as the previous call is canceled + * debouncedFunction.cancel(); + * + * // With AbortSignal + * const controller = new AbortController(); + * const signal = controller.signal; + * const debouncedWithSignal = debounce(() => { + * console.log('Function executed'); + * }, 1000, { signal }); + * + * debouncedWithSignal(); + * + * // Will cancel the debounced function call + * controller.abort(); + */ +declare function debounce any>(func: T, wait: number | undefined, options: DebounceSettingsLeading): DebouncedFuncLeading; +/** + * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds + * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel` + * method to cancel any pending execution. + * + * You can set the debounced function to run at the start (`leading`) or end (`trailing`) of the delay period. + * If `leading` is true, the function runs immediately on the first call. + * If `trailing` is true, the function runs after `debounceMs` milliseconds have passed since the last call. + * If both `leading` and `trailing` are true, the function runs at both the start and end, but it must be called at least twice within `debounceMs` milliseconds for this to happen + * (since one debounced function call cannot trigger the function twice). + * + * You can also set a `maxWait` time, which is the maximum time the function is allowed to be delayed before it is called. + * + * @template F - The type of function. + * @param {F} func - The function to debounce. + * @param {number} debounceMs - The number of milliseconds to delay. + * @param {DebounceOptions} options - The options object + * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function. + * @param {boolean} options.leading - If `true`, the function will be invoked on the leading edge of the timeout. + * @param {boolean} options.trailing - If `true`, the function will be invoked on the trailing edge of the timeout. + * @param {number} options.maxWait - The maximum time `func` is allowed to be delayed before it's invoked. + * @returns A new debounced function with a `cancel` method. + * + * @example + * const debouncedFunction = debounce(() => { + * console.log('Function executed'); + * }, 1000); + * + * // Will log 'Function executed' after 1 second if not called again in that time + * debouncedFunction(); + * + * // Will not log anything as the previous call is canceled + * debouncedFunction.cancel(); + * + * // With AbortSignal + * const controller = new AbortController(); + * const signal = controller.signal; + * const debouncedWithSignal = debounce(() => { + * console.log('Function executed'); + * }, 1000, { signal }); + * + * debouncedWithSignal(); + * + * // Will cancel the debounced function call + * controller.abort(); + */ +declare function debounce any>(func: T, wait?: number, options?: DebounceSettings): DebouncedFunc; +//#endregion +export { DebouncedFunc, DebouncedFuncLeading, debounce }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/debounce.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/debounce.js new file mode 100644 index 0000000000000000000000000000000000000000..aaf3c8d39f7be6dd0c2fdae30f0cdef92c566b14 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/debounce.js @@ -0,0 +1,38 @@ +const require_debounce = require("../../function/debounce.js"); +//#region src/compat/function/debounce.ts +function debounce(func, debounceMs = 0, options = {}) { + if (typeof options !== "object") options = {}; + const { leading = false, trailing = true, maxWait } = options; + const edges = Array(2); + if (leading) edges[0] = "leading"; + if (trailing) edges[1] = "trailing"; + let result = void 0; + let pendingAt = null; + const _debounced = require_debounce.debounce(function(...args) { + result = func.apply(this, args); + pendingAt = null; + }, debounceMs, { edges }); + const debounced = function(...args) { + if (maxWait != null) { + if (pendingAt === null) pendingAt = Date.now(); + if (Date.now() - pendingAt >= maxWait) { + result = func.apply(this, args); + pendingAt = Date.now(); + _debounced.cancel(); + _debounced.schedule(); + return result; + } + } + _debounced.apply(this, args); + return result; + }; + const flush = () => { + _debounced.flush(); + return result; + }; + debounced.cancel = _debounced.cancel; + debounced.flush = flush; + return debounced; +} +//#endregion +exports.debounce = debounce; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/debounce.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/debounce.mjs new file mode 100644 index 0000000000000000000000000000000000000000..70e431b615db45762c665a5325ee48e4a8ca914c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/debounce.mjs @@ -0,0 +1,38 @@ +import { debounce as debounce$1 } from "../../function/debounce.mjs"; +//#region src/compat/function/debounce.ts +function debounce(func, debounceMs = 0, options = {}) { + if (typeof options !== "object") options = {}; + const { leading = false, trailing = true, maxWait } = options; + const edges = Array(2); + if (leading) edges[0] = "leading"; + if (trailing) edges[1] = "trailing"; + let result = void 0; + let pendingAt = null; + const _debounced = debounce$1(function(...args) { + result = func.apply(this, args); + pendingAt = null; + }, debounceMs, { edges }); + const debounced = function(...args) { + if (maxWait != null) { + if (pendingAt === null) pendingAt = Date.now(); + if (Date.now() - pendingAt >= maxWait) { + result = func.apply(this, args); + pendingAt = Date.now(); + _debounced.cancel(); + _debounced.schedule(); + return result; + } + } + _debounced.apply(this, args); + return result; + }; + const flush = () => { + _debounced.flush(); + return result; + }; + debounced.cancel = _debounced.cancel; + debounced.flush = flush; + return debounced; +} +//#endregion +export { debounce }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/defer.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/defer.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e1c2e0991cb9478b3273cb54c1fee9d5717be7fb --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/defer.d.mts @@ -0,0 +1,15 @@ +//#region src/compat/function/defer.d.ts +/** + * Defers invoking the `func` until the current call stack has cleared. Any additional arguments are provided to func when it's invoked. + * + * @param {(...args: any[]) => any} func The function to defer. + * @param {...any[]} args The arguments to invoke `func` with. + * @returns {number} Returns the timer id. + * + * @example + * defer(console.log, 'deferred'); + * // => Logs 'deferred' after the current call stack has cleared. + */ +declare function defer(func: (...args: any[]) => any, ...args: any[]): number; +//#endregion +export { defer }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/defer.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/defer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e1c2e0991cb9478b3273cb54c1fee9d5717be7fb --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/defer.d.ts @@ -0,0 +1,15 @@ +//#region src/compat/function/defer.d.ts +/** + * Defers invoking the `func` until the current call stack has cleared. Any additional arguments are provided to func when it's invoked. + * + * @param {(...args: any[]) => any} func The function to defer. + * @param {...any[]} args The arguments to invoke `func` with. + * @returns {number} Returns the timer id. + * + * @example + * defer(console.log, 'deferred'); + * // => Logs 'deferred' after the current call stack has cleared. + */ +declare function defer(func: (...args: any[]) => any, ...args: any[]): number; +//#endregion +export { defer }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/defer.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/defer.js new file mode 100644 index 0000000000000000000000000000000000000000..2629f48ef5ab1f77b58487e44d6faa66e46afbbf --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/defer.js @@ -0,0 +1,20 @@ +//#region src/compat/function/defer.ts +/** +* Defers invoking the `func` until the current call stack has cleared. Any additional arguments are provided to func when it's invoked. +* +* @param {F} func The function to defer. +* @param {Parameters} args The arguments to invoke `func` with. +* @returns {number} Returns the timer id. +* +* @example +* defer((text) => { +* console.log(text); +* }, 'deferred'); +* // => Logs 'deferred' after the current call stack has cleared. +*/ +function defer(func, ...args) { + if (typeof func !== "function") throw new TypeError("Expected a function"); + return setTimeout(func, 1, ...args); +} +//#endregion +exports.defer = defer; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/defer.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/defer.mjs new file mode 100644 index 0000000000000000000000000000000000000000..11d80baa563fe1bf0355495578eb55fd445a9025 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/defer.mjs @@ -0,0 +1,20 @@ +//#region src/compat/function/defer.ts +/** +* Defers invoking the `func` until the current call stack has cleared. Any additional arguments are provided to func when it's invoked. +* +* @param {F} func The function to defer. +* @param {Parameters} args The arguments to invoke `func` with. +* @returns {number} Returns the timer id. +* +* @example +* defer((text) => { +* console.log(text); +* }, 'deferred'); +* // => Logs 'deferred' after the current call stack has cleared. +*/ +function defer(func, ...args) { + if (typeof func !== "function") throw new TypeError("Expected a function"); + return setTimeout(func, 1, ...args); +} +//#endregion +export { defer }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/delay.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/delay.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..ef9df34f7ef50886ed5531efa6479b51914b98f7 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/delay.d.mts @@ -0,0 +1,30 @@ +//#region src/compat/function/delay.d.ts +/** + * Invokes the specified function after a delay of the given number of milliseconds. + * Any additional arguments are passed to the function when it is invoked. + * + * @param {(...args: any[]) => any} func - The function to delay. + * @param {number} wait - The number of milliseconds to delay the invocation. + * @param {...any[]} args - The arguments to pass to the function when it is invoked. + * @returns {number} Returns the timer id. + * @throws {TypeError} If the first argument is not a function. + * + * @example + * // Example 1: Delayed function execution + * const timerId = delay( + * (greeting, recipient) => { + * console.log(`${greeting}, ${recipient}!`); + * }, + * 1000, + * 'Hello', + * 'Alice' + * ); + * // => 'Hello, Alice!' will be logged after one second. + * + * // Example 2: Clearing the timeout before execution + * clearTimeout(timerId); + * // The function will not be executed because the timeout was cleared. + */ +declare function delay(func: (...args: any[]) => any, wait: number, ...args: any[]): number; +//#endregion +export { delay }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/delay.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/delay.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ef9df34f7ef50886ed5531efa6479b51914b98f7 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/delay.d.ts @@ -0,0 +1,30 @@ +//#region src/compat/function/delay.d.ts +/** + * Invokes the specified function after a delay of the given number of milliseconds. + * Any additional arguments are passed to the function when it is invoked. + * + * @param {(...args: any[]) => any} func - The function to delay. + * @param {number} wait - The number of milliseconds to delay the invocation. + * @param {...any[]} args - The arguments to pass to the function when it is invoked. + * @returns {number} Returns the timer id. + * @throws {TypeError} If the first argument is not a function. + * + * @example + * // Example 1: Delayed function execution + * const timerId = delay( + * (greeting, recipient) => { + * console.log(`${greeting}, ${recipient}!`); + * }, + * 1000, + * 'Hello', + * 'Alice' + * ); + * // => 'Hello, Alice!' will be logged after one second. + * + * // Example 2: Clearing the timeout before execution + * clearTimeout(timerId); + * // The function will not be executed because the timeout was cleared. + */ +declare function delay(func: (...args: any[]) => any, wait: number, ...args: any[]): number; +//#endregion +export { delay }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/delay.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/delay.js new file mode 100644 index 0000000000000000000000000000000000000000..e5b87bc2767bd68eab64812ec825fd4794053b7c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/delay.js @@ -0,0 +1,34 @@ +const require_toNumber = require("../util/toNumber.js"); +//#region src/compat/function/delay.ts +/** +* Invokes the specified function after a delay of the given number of milliseconds. +* Any additional arguments are passed to the function when it is invoked. +* +* @param {(...args: any[]) => any} func - The function to delay. +* @param {number} wait - The number of milliseconds to delay the invocation. +* @param {...any[]} args - The arguments to pass to the function when it is invoked. +* @returns {number} Returns the timer id. +* @throws {TypeError} If the first argument is not a function. +* +* @example +* // Example 1: Delayed function execution +* const timerId = delay( +* (greeting, recipient) => { +* console.log(`${greeting}, ${recipient}!`); +* }, +* 1000, +* 'Hello', +* 'Alice' +* ); +* // => 'Hello, Alice!' will be logged after one second. +* +* // Example 2: Clearing the timeout before execution +* clearTimeout(timerId); +* // The function will not be executed because the timeout was cleared. +*/ +function delay(func, wait, ...args) { + if (typeof func !== "function") throw new TypeError("Expected a function"); + return setTimeout(func, require_toNumber.toNumber(wait) || 0, ...args); +} +//#endregion +exports.delay = delay; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/delay.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/delay.mjs new file mode 100644 index 0000000000000000000000000000000000000000..1ce41ee35ddbe49c8c2341ebad487775506dd972 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/delay.mjs @@ -0,0 +1,34 @@ +import { toNumber } from "../util/toNumber.mjs"; +//#region src/compat/function/delay.ts +/** +* Invokes the specified function after a delay of the given number of milliseconds. +* Any additional arguments are passed to the function when it is invoked. +* +* @param {(...args: any[]) => any} func - The function to delay. +* @param {number} wait - The number of milliseconds to delay the invocation. +* @param {...any[]} args - The arguments to pass to the function when it is invoked. +* @returns {number} Returns the timer id. +* @throws {TypeError} If the first argument is not a function. +* +* @example +* // Example 1: Delayed function execution +* const timerId = delay( +* (greeting, recipient) => { +* console.log(`${greeting}, ${recipient}!`); +* }, +* 1000, +* 'Hello', +* 'Alice' +* ); +* // => 'Hello, Alice!' will be logged after one second. +* +* // Example 2: Clearing the timeout before execution +* clearTimeout(timerId); +* // The function will not be executed because the timeout was cleared. +*/ +function delay(func, wait, ...args) { + if (typeof func !== "function") throw new TypeError("Expected a function"); + return setTimeout(func, toNumber(wait) || 0, ...args); +} +//#endregion +export { delay }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/flip.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/flip.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c6b613663e4c3c2ca1ffcbe8d8931a19c9603b91 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/flip.d.mts @@ -0,0 +1,19 @@ +//#region src/compat/function/flip.d.ts +/** + * Reverses the order of arguments for a given function. + * + * @template T - The type of the function being flipped. + * @param {T} func - The function whose arguments will be reversed. + * @returns {T} A new function that takes the reversed arguments and returns the result of calling `func`. + * + * @example + * var flipped = flip(function() { + * return Array.prototype.slice.call(arguments); + * }); + * + * flipped('a', 'b', 'c', 'd'); + * // => ['d', 'c', 'b', 'a'] + */ +declare function flip any>(func: T): T; +//#endregion +export { flip }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/flip.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/flip.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6b613663e4c3c2ca1ffcbe8d8931a19c9603b91 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/flip.d.ts @@ -0,0 +1,19 @@ +//#region src/compat/function/flip.d.ts +/** + * Reverses the order of arguments for a given function. + * + * @template T - The type of the function being flipped. + * @param {T} func - The function whose arguments will be reversed. + * @returns {T} A new function that takes the reversed arguments and returns the result of calling `func`. + * + * @example + * var flipped = flip(function() { + * return Array.prototype.slice.call(arguments); + * }); + * + * flipped('a', 'b', 'c', 'd'); + * // => ['d', 'c', 'b', 'a'] + */ +declare function flip any>(func: T): T; +//#endregion +export { flip }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/flip.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/flip.js new file mode 100644 index 0000000000000000000000000000000000000000..1bda5e861a2fb84ec11f8d83d87f715014b030b1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/flip.js @@ -0,0 +1,24 @@ +//#region src/compat/function/flip.ts +/** +* Reverses the order of arguments for a given function. +* +* @template F - The type of the function being flipped. +* @param {F} func - The function whose arguments will be reversed. +* @returns {(...args: Reversed>) => ReturnType} A new function that takes the +* reversed arguments and returns the result of calling `func`. +* +* @example +* function fn(a: string, b: string, c: string, d: string) { +* return [a, b, c, d]; +* } +* +* const flipped = flip(fn); +* flipped('a', 'b', 'c', 'd'); // => ['d', 'c', 'b', 'a'] +*/ +function flip(func) { + return function(...args) { + return func.apply(this, args.reverse()); + }; +} +//#endregion +exports.flip = flip; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/flip.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/flip.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ea93a0294f86dc69ba17fcb6f429259a4cce982a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/flip.mjs @@ -0,0 +1,24 @@ +//#region src/compat/function/flip.ts +/** +* Reverses the order of arguments for a given function. +* +* @template F - The type of the function being flipped. +* @param {F} func - The function whose arguments will be reversed. +* @returns {(...args: Reversed>) => ReturnType} A new function that takes the +* reversed arguments and returns the result of calling `func`. +* +* @example +* function fn(a: string, b: string, c: string, d: string) { +* return [a, b, c, d]; +* } +* +* const flipped = flip(fn); +* flipped('a', 'b', 'c', 'd'); // => ['d', 'c', 'b', 'a'] +*/ +function flip(func) { + return function(...args) { + return func.apply(this, args.reverse()); + }; +} +//#endregion +export { flip }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/flow.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/flow.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b7591da8d36366a178290346633d3463113309be --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/flow.d.mts @@ -0,0 +1,120 @@ +import { Many } from "../_internal/Many.mjs"; + +//#region src/compat/function/flow.d.ts +/** + * Creates a new function that executes the given functions in sequence. The return value of the previous function is passed as an argument to the next function. + * + * @template A - The type of the arguments. + * @template R - The type of the return values. + * @param {(...args: A) => R} f1 - The first function to invoke. + * @param {(a: R) => R} f2 - The second function to invoke. + * @param {(a: R) => R} f3 - The third function to invoke. + * @param {(a: R) => R} f4 - The fourth function to invoke. + * @param {(a: R) => R} f5 - The fifth function to invoke. + * @param {(a: R) => R} f6 - The sixth function to invoke. + * @param {(a: R) => R} f7 - The seventh function to invoke. + * @returns {(...args: A) => R} Returns the new composite function. + * + * @example + * function square(n) { + * return n * n; + * } + * + * var addSquare = flow([add, square]); + * addSquare(1, 2); + * // => 9 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (...args: A) => R7; +/** + * Creates a new function that executes up to 7 functions in sequence, with additional functions flattened. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * const toString = (n: number) => n.toString(); + * + * const combined = flow(add, square, double, toString); + * console.log(combined(1, 2)); // "18" + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...func: Array any>>): (...args: A) => any; +/** + * Creates a new function that executes 6 functions in sequence. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flow(add, square, double); + * console.log(combined(1, 2)); // 18 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (...args: A) => R6; +/** + * Creates a new function that executes 5 functions in sequence. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flow(add, square, double); + * console.log(combined(1, 2)); // 18 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (...args: A) => R5; +/** + * Creates a new function that executes 4 functions in sequence. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flow(add, square, double); + * console.log(combined(1, 2)); // 18 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (...args: A) => R4; +/** + * Creates a new function that executes 3 functions in sequence. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flow(add, square, double); + * console.log(combined(1, 2)); // 18 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (...args: A) => R3; +/** + * Creates a new function that executes 2 functions in sequence. + * The return value of the first function is passed as an argument to the second function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * + * const addThenSquare = flow(add, square); + * console.log(addThenSquare(1, 2)); // 9 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2): (...args: A) => R2; +/** + * Creates a new function that executes the given functions in sequence. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flow(add, square, double); + * console.log(combined(1, 2)); // 18 + */ +declare function flow(...func: Array any>>): (...args: any[]) => any; +//#endregion +export { flow }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/flow.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/flow.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6a10522db1fe9988dd735d5845e30f050250b59b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/flow.d.ts @@ -0,0 +1,120 @@ +import { Many } from "../_internal/Many.js"; + +//#region src/compat/function/flow.d.ts +/** + * Creates a new function that executes the given functions in sequence. The return value of the previous function is passed as an argument to the next function. + * + * @template A - The type of the arguments. + * @template R - The type of the return values. + * @param {(...args: A) => R} f1 - The first function to invoke. + * @param {(a: R) => R} f2 - The second function to invoke. + * @param {(a: R) => R} f3 - The third function to invoke. + * @param {(a: R) => R} f4 - The fourth function to invoke. + * @param {(a: R) => R} f5 - The fifth function to invoke. + * @param {(a: R) => R} f6 - The sixth function to invoke. + * @param {(a: R) => R} f7 - The seventh function to invoke. + * @returns {(...args: A) => R} Returns the new composite function. + * + * @example + * function square(n) { + * return n * n; + * } + * + * var addSquare = flow([add, square]); + * addSquare(1, 2); + * // => 9 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (...args: A) => R7; +/** + * Creates a new function that executes up to 7 functions in sequence, with additional functions flattened. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * const toString = (n: number) => n.toString(); + * + * const combined = flow(add, square, double, toString); + * console.log(combined(1, 2)); // "18" + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7, ...func: Array any>>): (...args: A) => any; +/** + * Creates a new function that executes 6 functions in sequence. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flow(add, square, double); + * console.log(combined(1, 2)); // 18 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (...args: A) => R6; +/** + * Creates a new function that executes 5 functions in sequence. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flow(add, square, double); + * console.log(combined(1, 2)); // 18 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (...args: A) => R5; +/** + * Creates a new function that executes 4 functions in sequence. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flow(add, square, double); + * console.log(combined(1, 2)); // 18 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (...args: A) => R4; +/** + * Creates a new function that executes 3 functions in sequence. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flow(add, square, double); + * console.log(combined(1, 2)); // 18 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (...args: A) => R3; +/** + * Creates a new function that executes 2 functions in sequence. + * The return value of the first function is passed as an argument to the second function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * + * const addThenSquare = flow(add, square); + * console.log(addThenSquare(1, 2)); // 9 + */ +declare function flow(f1: (...args: A) => R1, f2: (a: R1) => R2): (...args: A) => R2; +/** + * Creates a new function that executes the given functions in sequence. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flow(add, square, double); + * console.log(combined(1, 2)); // 18 + */ +declare function flow(...func: Array any>>): (...args: any[]) => any; +//#endregion +export { flow }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/flow.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/flow.js new file mode 100644 index 0000000000000000000000000000000000000000..9a41459523cb1709944be618df9c2108852c68a4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/flow.js @@ -0,0 +1,26 @@ +const require_flatten = require("../../array/flatten.js"); +const require_flow = require("../../function/flow.js"); +//#region src/compat/function/flow.ts +/** +* Creates a new function that executes the given functions in sequence. The return value of the previous function is passed as an argument to the next function. +* +* The `this` context of the returned function is also passed to the functions provided as parameters. +* +* @param {Array<((...args: any[]) => any) | Array<(...args: any[]) => any>>} funcs The functions to invoke. +* @returns {(...args: any[]) => any} Returns the new composite function. +* +* @example +* const add = (x: number, y: number) => x + y; +* const square = (n: number) => n * n; +* const double = (n: number) => n * 2; +* +* const combined = flow([add, square], double); +* console.log(combined(1, 2)); // 18 +*/ +function flow(...funcs) { + const flattenFuncs = require_flatten.flatten(funcs, 1); + if (flattenFuncs.some((func) => typeof func !== "function")) throw new TypeError("Expected a function"); + return require_flow.flow(...flattenFuncs); +} +//#endregion +exports.flow = flow; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/flow.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/flow.mjs new file mode 100644 index 0000000000000000000000000000000000000000..36bd9b1277314a9694176c9e832f56033bbc10d2 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/flow.mjs @@ -0,0 +1,26 @@ +import { flatten } from "../../array/flatten.mjs"; +import { flow as flow$1 } from "../../function/flow.mjs"; +//#region src/compat/function/flow.ts +/** +* Creates a new function that executes the given functions in sequence. The return value of the previous function is passed as an argument to the next function. +* +* The `this` context of the returned function is also passed to the functions provided as parameters. +* +* @param {Array<((...args: any[]) => any) | Array<(...args: any[]) => any>>} funcs The functions to invoke. +* @returns {(...args: any[]) => any} Returns the new composite function. +* +* @example +* const add = (x: number, y: number) => x + y; +* const square = (n: number) => n * n; +* const double = (n: number) => n * 2; +* +* const combined = flow([add, square], double); +* console.log(combined(1, 2)); // 18 +*/ +function flow(...funcs) { + const flattenFuncs = flatten(funcs, 1); + if (flattenFuncs.some((func) => typeof func !== "function")) throw new TypeError("Expected a function"); + return flow$1(...flattenFuncs); +} +//#endregion +export { flow }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/flowRight.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/flowRight.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..45ac6b583489fda7295674c048137842160ddf59 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/flowRight.d.mts @@ -0,0 +1,118 @@ +import { Many } from "../_internal/Many.mjs"; + +//#region src/compat/function/flowRight.d.ts +/** + * Creates a new function that executes the given functions in sequence from right to left. The return value of the previous function is passed as an argument to the next function. + * + * @template A - The type of the arguments. + * @template R - The type of the return values. + * @param {(a: R) => R} f7 - The seventh function to invoke. + * @param {(a: R) => R} f6 - The sixth function to invoke. + * @param {(a: R) => R} f5 - The fifth function to invoke. + * @param {(a: R) => R} f4 - The fourth function to invoke. + * @param {(a: R) => R} f3 - The third function to invoke. + * @param {(a: R) => R} f2 - The second function to invoke. + * @param {(...args: A) => R} f1 - The first function to invoke. + * @returns {(...args: A) => R} Returns the new composite function. + * + * @example + * function square(n) { + * return n * n; + * } + * + * var addSquare = flowRight(square, add); + * addSquare(1, 2); + * // => 9 + */ +declare function flowRight(f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R7; +/** + * Creates a new function that executes 6 functions in sequence from right to left. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * const toString = (n: number) => String(n); + * const append = (s: string) => s + '!'; + * const length = (s: string) => s.length; + * + * const combined = flowRight(length, append, toString, double, square, add); + * console.log(combined(1, 2)); // 7 + */ +declare function flowRight(f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R6; +/** + * Creates a new function that executes 5 functions in sequence from right to left. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * const toString = (n: number) => String(n); + * const append = (s: string) => s + '!'; + * + * const combined = flowRight(append, toString, double, square, add); + * console.log(combined(1, 2)); // '18!' + */ +declare function flowRight(f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R5; +/** + * Creates a new function that executes 4 functions in sequence from right to left. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * const toString = (n: number) => String(n); + * + * const combined = flowRight(toString, double, square, add); + * console.log(combined(1, 2)); // '18' + */ +declare function flowRight(f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R4; +/** + * Creates a new function that executes 3 functions in sequence from right to left. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flowRight(double, square, add); + * console.log(combined(1, 2)); // 18 + */ +declare function flowRight(f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R3; +/** + * Creates a new function that executes 2 functions in sequence from right to left. + * The return value of the first function is passed as an argument to the second function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * + * const combined = flowRight(square, add); + * console.log(combined(1, 2)); // 9 + */ +declare function flowRight(f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R2; +/** + * Creates a new function that executes the given functions in sequence from right to left. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * const toString = (n: number) => String(n); + * + * // Pass functions as separate arguments + * const combined1 = flowRight(toString, double, square, add); + * console.log(combined1(1, 2)); // '18' + * + * // Pass functions as arrays + * const combined2 = flowRight([toString, double], [square, add]); + * console.log(combined2(1, 2)); // '18' + */ +declare function flowRight(...func: Array any>>): (...args: any[]) => any; +//#endregion +export { flowRight }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/flowRight.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/flowRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..30eda07636717119d5be829adc80e7cf720beae6 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/flowRight.d.ts @@ -0,0 +1,118 @@ +import { Many } from "../_internal/Many.js"; + +//#region src/compat/function/flowRight.d.ts +/** + * Creates a new function that executes the given functions in sequence from right to left. The return value of the previous function is passed as an argument to the next function. + * + * @template A - The type of the arguments. + * @template R - The type of the return values. + * @param {(a: R) => R} f7 - The seventh function to invoke. + * @param {(a: R) => R} f6 - The sixth function to invoke. + * @param {(a: R) => R} f5 - The fifth function to invoke. + * @param {(a: R) => R} f4 - The fourth function to invoke. + * @param {(a: R) => R} f3 - The third function to invoke. + * @param {(a: R) => R} f2 - The second function to invoke. + * @param {(...args: A) => R} f1 - The first function to invoke. + * @returns {(...args: A) => R} Returns the new composite function. + * + * @example + * function square(n) { + * return n * n; + * } + * + * var addSquare = flowRight(square, add); + * addSquare(1, 2); + * // => 9 + */ +declare function flowRight(f7: (a: R6) => R7, f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R7; +/** + * Creates a new function that executes 6 functions in sequence from right to left. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * const toString = (n: number) => String(n); + * const append = (s: string) => s + '!'; + * const length = (s: string) => s.length; + * + * const combined = flowRight(length, append, toString, double, square, add); + * console.log(combined(1, 2)); // 7 + */ +declare function flowRight(f6: (a: R5) => R6, f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R6; +/** + * Creates a new function that executes 5 functions in sequence from right to left. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * const toString = (n: number) => String(n); + * const append = (s: string) => s + '!'; + * + * const combined = flowRight(append, toString, double, square, add); + * console.log(combined(1, 2)); // '18!' + */ +declare function flowRight(f5: (a: R4) => R5, f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R5; +/** + * Creates a new function that executes 4 functions in sequence from right to left. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * const toString = (n: number) => String(n); + * + * const combined = flowRight(toString, double, square, add); + * console.log(combined(1, 2)); // '18' + */ +declare function flowRight(f4: (a: R3) => R4, f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R4; +/** + * Creates a new function that executes 3 functions in sequence from right to left. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * + * const combined = flowRight(double, square, add); + * console.log(combined(1, 2)); // 18 + */ +declare function flowRight(f3: (a: R2) => R3, f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R3; +/** + * Creates a new function that executes 2 functions in sequence from right to left. + * The return value of the first function is passed as an argument to the second function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * + * const combined = flowRight(square, add); + * console.log(combined(1, 2)); // 9 + */ +declare function flowRight(f2: (a: R1) => R2, f1: (...args: A) => R1): (...args: A) => R2; +/** + * Creates a new function that executes the given functions in sequence from right to left. + * The return value of each function is passed as an argument to the next function. + * + * @example + * const add = (x: number, y: number) => x + y; + * const square = (n: number) => n * n; + * const double = (n: number) => n * 2; + * const toString = (n: number) => String(n); + * + * // Pass functions as separate arguments + * const combined1 = flowRight(toString, double, square, add); + * console.log(combined1(1, 2)); // '18' + * + * // Pass functions as arrays + * const combined2 = flowRight([toString, double], [square, add]); + * console.log(combined2(1, 2)); // '18' + */ +declare function flowRight(...func: Array any>>): (...args: any[]) => any; +//#endregion +export { flowRight }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/flowRight.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/flowRight.js new file mode 100644 index 0000000000000000000000000000000000000000..6fe722d81df4a47feecb24ca0084f886dbdfe225 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/flowRight.js @@ -0,0 +1,28 @@ +const require_flatten = require("../../array/flatten.js"); +const require_flowRight = require("../../function/flowRight.js"); +//#region src/compat/function/flowRight.ts +/** +* Creates a new function that executes the given functions in sequence from right to left. The return value of the previous function is passed as an argument to the next function. +* +* The `this` context of the returned function is also passed to the functions provided as parameters. +* +* This method is like `flow` except that it creates a function that invokes the given functions from right to left. +* +* @param {Array<((...args: any[]) => any) | Array<(...args: any[]) => any>>} funcs The functions to invoke. +* @returns {(...args: any[]) => any} Returns the new composite function. +* +* @example +* const add = (x: number, y: number) => x + y; +* const square = (n: number) => n * n; +* const double = (n: number) => n * 2; +* +* const combined = flowRight(double, [square, add]); +* console.log(combined(1, 2)); // 18 +*/ +function flowRight(...funcs) { + const flattenFuncs = require_flatten.flatten(funcs, 1); + if (flattenFuncs.some((func) => typeof func !== "function")) throw new TypeError("Expected a function"); + return require_flowRight.flowRight(...flattenFuncs); +} +//#endregion +exports.flowRight = flowRight; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/flowRight.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/flowRight.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a32738edb0079639b7ee6db2d1e5cacfc4cd6e53 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/flowRight.mjs @@ -0,0 +1,28 @@ +import { flatten } from "../../array/flatten.mjs"; +import { flowRight as flowRight$1 } from "../../function/flowRight.mjs"; +//#region src/compat/function/flowRight.ts +/** +* Creates a new function that executes the given functions in sequence from right to left. The return value of the previous function is passed as an argument to the next function. +* +* The `this` context of the returned function is also passed to the functions provided as parameters. +* +* This method is like `flow` except that it creates a function that invokes the given functions from right to left. +* +* @param {Array<((...args: any[]) => any) | Array<(...args: any[]) => any>>} funcs The functions to invoke. +* @returns {(...args: any[]) => any} Returns the new composite function. +* +* @example +* const add = (x: number, y: number) => x + y; +* const square = (n: number) => n * n; +* const double = (n: number) => n * 2; +* +* const combined = flowRight(double, [square, add]); +* console.log(combined(1, 2)); // 18 +*/ +function flowRight(...funcs) { + const flattenFuncs = flatten(funcs, 1); + if (flattenFuncs.some((func) => typeof func !== "function")) throw new TypeError("Expected a function"); + return flowRight$1(...flattenFuncs); +} +//#endregion +export { flowRight }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/identity.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/identity.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a4869841d49fffa0fd0bf564ccc7384fc24e3bab --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/identity.d.mts @@ -0,0 +1,43 @@ +//#region src/compat/function/identity.d.ts +/** + * Returns the input value unchanged. + * + * @template T - The type of the input value. + * @param {T} x - The value to be returned. + * @returns {T} The input value. + * + * @example + * // Returns 5 + * identity(5); + * + * @example + * // Returns 'hello' + * identity('hello'); + * + * @example + * // Returns { key: 'value' } + * identity({ key: 'value' }); + */ +declare function identity(value: T): T; +/** + * Returns the input value unchanged. + * + * @template T - The type of the input value. + * @param {T} x - The value to be returned. + * @returns {T} The input value. + * + * @example + * // Returns 5 + * identity(5); + * + * @example + * // Returns 'hello' + * identity('hello'); + * + * @example + * // Returns { key: 'value' } + * identity({ key: 'value' }); + */ +declare function identity(): undefined; +//#endregion +export { identity }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/identity.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/identity.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a4869841d49fffa0fd0bf564ccc7384fc24e3bab --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/identity.d.ts @@ -0,0 +1,43 @@ +//#region src/compat/function/identity.d.ts +/** + * Returns the input value unchanged. + * + * @template T - The type of the input value. + * @param {T} x - The value to be returned. + * @returns {T} The input value. + * + * @example + * // Returns 5 + * identity(5); + * + * @example + * // Returns 'hello' + * identity('hello'); + * + * @example + * // Returns { key: 'value' } + * identity({ key: 'value' }); + */ +declare function identity(value: T): T; +/** + * Returns the input value unchanged. + * + * @template T - The type of the input value. + * @param {T} x - The value to be returned. + * @returns {T} The input value. + * + * @example + * // Returns 5 + * identity(5); + * + * @example + * // Returns 'hello' + * identity('hello'); + * + * @example + * // Returns { key: 'value' } + * identity({ key: 'value' }); + */ +declare function identity(): undefined; +//#endregion +export { identity }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/identity.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/identity.js new file mode 100644 index 0000000000000000000000000000000000000000..553e2007afba9a4f623034d356ccb0b81e18ddc9 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/identity.js @@ -0,0 +1,6 @@ +//#region src/compat/function/identity.ts +function identity(x) { + return x; +} +//#endregion +exports.identity = identity; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/identity.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/identity.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9a3d0ac039823306713f4fc5dfdc87b91eff5d48 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/identity.mjs @@ -0,0 +1,6 @@ +//#region src/compat/function/identity.ts +function identity(x) { + return x; +} +//#endregion +export { identity }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/memoize.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/memoize.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..80f5dd8992202653492aa399147c039cc0867dee --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/memoize.d.mts @@ -0,0 +1,120 @@ +//#region src/compat/function/memoize.d.ts +interface MapCache { + /** + * Removes the value associated with the specified key from the cache. + * + * @param key - The key of the value to remove + * @returns `true` if an element was removed, `false` if the key wasn't found + * + * @example + * ```typescript + * cache.set('user', { id: 123, name: 'John' }); + * cache.delete('user'); // Returns true + * cache.delete('unknown'); // Returns false + * ``` + */ + delete(key: any): boolean; + /** + * Retrieves the value associated with the specified key from the cache. + * + * @param key - The key of the value to retrieve + * @returns The cached value or undefined if not found + * + * @example + * ```typescript + * cache.set('user', { id: 123, name: 'John' }); + * cache.get('user'); // Returns { id: 123, name: 'John' } + * cache.get('unknown'); // Returns undefined + * ``` + */ + get(key: any): any; + /** + * Checks if the cache contains a value for the specified key. + * + * @param key - The key to check for existence + * @returns `true` if the key exists in the cache, otherwise `false` + * + * @example + * ```typescript + * cache.set('user', { id: 123, name: 'John' }); + * cache.has('user'); // Returns true + * cache.has('unknown'); // Returns false + * ``` + */ + has(key: any): boolean; + /** + * Stores a value in the cache with the specified key. + * If the key already exists, its value is updated. + * + * @param key - The key to associate with the value + * @param value - The value to store in the cache + * @returns The cache instance for method chaining + * + * @example + * ```typescript + * cache.set('user', { id: 123, name: 'John' }) + * .set('settings', { theme: 'dark' }); + * ``` + */ + set(key: any, value: any): this; + /** + * Removes all key-value pairs from the cache. + * This method is optional as some cache implementations may be immutable. + * + * @example + * ```typescript + * cache.set('user', { id: 123, name: 'John' }); + * cache.set('settings', { theme: 'dark' }); + * cache.clear(); // Cache is now empty + * ``` + */ + clear?(): void; +} +/** + * Constructor interface for creating a new MapCache instance. + * This defines the shape of a constructor that can create cache objects + * conforming to the MapCache interface. + * + * @example + * ```typescript + * class CustomCache implements MapCache { + * // Cache implementation + * } + * + * const CacheConstructor: MapCacheConstructor = CustomCache; + * const cache = new CacheConstructor(); + * ``` + */ +interface MapCacheConstructor { + new (): MapCache; +} +/** + * Represents a function that has been memoized. + * A memoized function maintains the same signature as the original function + * but adds a cache property to store previously computed results. + * + * @template T - The type of the original function being memoized + */ +interface MemoizedFunction { + /** + * The cache storing previously computed results + */ + cache: MapCache; +} +/** + * Creates a function that memoizes the result of func. If resolver is provided it determines the cache key for + * storing the result based on the arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is coerced to a string and used as the cache key. The func is invoked with + * the this binding of the memoized function. + * + * @template T - The type of the original function being memoized + * @param {T} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @return {MemoizedFunction} Returns the new memoizing function. + */ +declare function memoize any>(func: T, resolver?: (...args: Parameters) => any): T & MemoizedFunction; +declare namespace memoize { + var Cache: MapCacheConstructor; +} +//#endregion +export { memoize }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/memoize.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/memoize.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..80f5dd8992202653492aa399147c039cc0867dee --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/memoize.d.ts @@ -0,0 +1,120 @@ +//#region src/compat/function/memoize.d.ts +interface MapCache { + /** + * Removes the value associated with the specified key from the cache. + * + * @param key - The key of the value to remove + * @returns `true` if an element was removed, `false` if the key wasn't found + * + * @example + * ```typescript + * cache.set('user', { id: 123, name: 'John' }); + * cache.delete('user'); // Returns true + * cache.delete('unknown'); // Returns false + * ``` + */ + delete(key: any): boolean; + /** + * Retrieves the value associated with the specified key from the cache. + * + * @param key - The key of the value to retrieve + * @returns The cached value or undefined if not found + * + * @example + * ```typescript + * cache.set('user', { id: 123, name: 'John' }); + * cache.get('user'); // Returns { id: 123, name: 'John' } + * cache.get('unknown'); // Returns undefined + * ``` + */ + get(key: any): any; + /** + * Checks if the cache contains a value for the specified key. + * + * @param key - The key to check for existence + * @returns `true` if the key exists in the cache, otherwise `false` + * + * @example + * ```typescript + * cache.set('user', { id: 123, name: 'John' }); + * cache.has('user'); // Returns true + * cache.has('unknown'); // Returns false + * ``` + */ + has(key: any): boolean; + /** + * Stores a value in the cache with the specified key. + * If the key already exists, its value is updated. + * + * @param key - The key to associate with the value + * @param value - The value to store in the cache + * @returns The cache instance for method chaining + * + * @example + * ```typescript + * cache.set('user', { id: 123, name: 'John' }) + * .set('settings', { theme: 'dark' }); + * ``` + */ + set(key: any, value: any): this; + /** + * Removes all key-value pairs from the cache. + * This method is optional as some cache implementations may be immutable. + * + * @example + * ```typescript + * cache.set('user', { id: 123, name: 'John' }); + * cache.set('settings', { theme: 'dark' }); + * cache.clear(); // Cache is now empty + * ``` + */ + clear?(): void; +} +/** + * Constructor interface for creating a new MapCache instance. + * This defines the shape of a constructor that can create cache objects + * conforming to the MapCache interface. + * + * @example + * ```typescript + * class CustomCache implements MapCache { + * // Cache implementation + * } + * + * const CacheConstructor: MapCacheConstructor = CustomCache; + * const cache = new CacheConstructor(); + * ``` + */ +interface MapCacheConstructor { + new (): MapCache; +} +/** + * Represents a function that has been memoized. + * A memoized function maintains the same signature as the original function + * but adds a cache property to store previously computed results. + * + * @template T - The type of the original function being memoized + */ +interface MemoizedFunction { + /** + * The cache storing previously computed results + */ + cache: MapCache; +} +/** + * Creates a function that memoizes the result of func. If resolver is provided it determines the cache key for + * storing the result based on the arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is coerced to a string and used as the cache key. The func is invoked with + * the this binding of the memoized function. + * + * @template T - The type of the original function being memoized + * @param {T} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @return {MemoizedFunction} Returns the new memoizing function. + */ +declare function memoize any>(func: T, resolver?: (...args: Parameters) => any): T & MemoizedFunction; +declare namespace memoize { + var Cache: MapCacheConstructor; +} +//#endregion +export { memoize }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/memoize.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/memoize.js new file mode 100644 index 0000000000000000000000000000000000000000..c751a6f964faf79599a89a2b29bbb69df5673aa1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/memoize.js @@ -0,0 +1,28 @@ +//#region src/compat/function/memoize.ts +/** +* Creates a function that memoizes the result of func. If resolver is provided it determines the cache key for +* storing the result based on the arguments provided to the memoized function. By default, the first argument +* provided to the memoized function is coerced to a string and used as the cache key. The func is invoked with +* the this binding of the memoized function. +* +* @template T - The type of the original function being memoized +* @param {T} func The function to have its output memoized. +* @param {Function} [resolver] The function to resolve the cache key. +* @return {MemoizedFunction} Returns the new memoizing function. +*/ +function memoize(func, resolver) { + if (typeof func !== "function" || resolver != null && typeof resolver !== "function") throw new TypeError("Expected a function"); + const memoized = function(...args) { + const key = resolver ? resolver.apply(this, args) : args[0]; + const cache = memoized.cache; + if (cache.has(key)) return cache.get(key); + const result = func.apply(this, args); + memoized.cache = cache.set(key, result) || cache; + return result; + }; + memoized.cache = new (memoize.Cache || Map)(); + return memoized; +} +memoize.Cache = Map; +//#endregion +exports.memoize = memoize; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/memoize.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/memoize.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7b094c8150795bbdea5521d2f4b27eb2b62c73eb --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/memoize.mjs @@ -0,0 +1,28 @@ +//#region src/compat/function/memoize.ts +/** +* Creates a function that memoizes the result of func. If resolver is provided it determines the cache key for +* storing the result based on the arguments provided to the memoized function. By default, the first argument +* provided to the memoized function is coerced to a string and used as the cache key. The func is invoked with +* the this binding of the memoized function. +* +* @template T - The type of the original function being memoized +* @param {T} func The function to have its output memoized. +* @param {Function} [resolver] The function to resolve the cache key. +* @return {MemoizedFunction} Returns the new memoizing function. +*/ +function memoize(func, resolver) { + if (typeof func !== "function" || resolver != null && typeof resolver !== "function") throw new TypeError("Expected a function"); + const memoized = function(...args) { + const key = resolver ? resolver.apply(this, args) : args[0]; + const cache = memoized.cache; + if (cache.has(key)) return cache.get(key); + const result = func.apply(this, args); + memoized.cache = cache.set(key, result) || cache; + return result; + }; + memoized.cache = new (memoize.Cache || Map)(); + return memoized; +} +memoize.Cache = Map; +//#endregion +export { memoize }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/negate.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/negate.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e95871c0345e1f02853539ffdf2a37667c60bb58 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/negate.d.mts @@ -0,0 +1,19 @@ +//#region src/compat/function/negate.d.ts +/** + * Creates a function that negates the result of the predicate function. + * + * @template T - The type of the arguments array. + * @param {(...args: T) => boolean} predicate - The predicate to negate. + * @returns {(...args: T) => boolean} The new negated function. + * + * @example + * function isEven(n) { + * return n % 2 == 0; + * } + * + * filter([1, 2, 3, 4, 5, 6], negate(isEven)); + * // => [1, 3, 5] + */ +declare function negate(predicate: (...args: T) => boolean): (...args: T) => boolean; +//#endregion +export { negate }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/negate.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/negate.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e95871c0345e1f02853539ffdf2a37667c60bb58 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/negate.d.ts @@ -0,0 +1,19 @@ +//#region src/compat/function/negate.d.ts +/** + * Creates a function that negates the result of the predicate function. + * + * @template T - The type of the arguments array. + * @param {(...args: T) => boolean} predicate - The predicate to negate. + * @returns {(...args: T) => boolean} The new negated function. + * + * @example + * function isEven(n) { + * return n % 2 == 0; + * } + * + * filter([1, 2, 3, 4, 5, 6], negate(isEven)); + * // => [1, 3, 5] + */ +declare function negate(predicate: (...args: T) => boolean): (...args: T) => boolean; +//#endregion +export { negate }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/negate.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/negate.js new file mode 100644 index 0000000000000000000000000000000000000000..a9a7bfef5644b0ee5ac742fbec1a8a2fad260a59 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/negate.js @@ -0,0 +1,22 @@ +//#region src/compat/function/negate.ts +/** +* Creates a function that negates the result of the predicate function. +* +* @template F - The type of the function to negate. +* @param {F} func - The function to negate. +* @returns {F} The new negated function, which negates the boolean result of `func`. +* +* @example +* const array = [1, 2, 3, 4, 5, 6]; +* const isEven = (n: number) => n % 2 === 0; +* const result = array.filter(negate(isEven)); +* // result will be [1, 3, 5] +*/ +function negate(func) { + if (typeof func !== "function") throw new TypeError("Expected a function"); + return function(...args) { + return !func.apply(this, args); + }; +} +//#endregion +exports.negate = negate; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/negate.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/negate.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2244a81955f13818fd10dd227d5f3f02df86b15d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/negate.mjs @@ -0,0 +1,22 @@ +//#region src/compat/function/negate.ts +/** +* Creates a function that negates the result of the predicate function. +* +* @template F - The type of the function to negate. +* @param {F} func - The function to negate. +* @returns {F} The new negated function, which negates the boolean result of `func`. +* +* @example +* const array = [1, 2, 3, 4, 5, 6]; +* const isEven = (n: number) => n % 2 === 0; +* const result = array.filter(negate(isEven)); +* // result will be [1, 3, 5] +*/ +function negate(func) { + if (typeof func !== "function") throw new TypeError("Expected a function"); + return function(...args) { + return !func.apply(this, args); + }; +} +//#endregion +export { negate }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/noop.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/noop.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..2fb8683b5173ada958c737c760a5096144ae50ef --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/noop.d.mts @@ -0,0 +1,13 @@ +//#region src/compat/function/noop.d.ts +/** + * A no-operation function that does nothing. + * This can be used as a placeholder or default function. + * + * @example + * noop(); // Does nothing + * + * @returns {void} This function does not return anything. + */ +declare function noop(..._: any[]): void; +//#endregion +export { noop }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/noop.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/noop.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2fb8683b5173ada958c737c760a5096144ae50ef --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/noop.d.ts @@ -0,0 +1,13 @@ +//#region src/compat/function/noop.d.ts +/** + * A no-operation function that does nothing. + * This can be used as a placeholder or default function. + * + * @example + * noop(); // Does nothing + * + * @returns {void} This function does not return anything. + */ +declare function noop(..._: any[]): void; +//#endregion +export { noop }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/noop.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/noop.js new file mode 100644 index 0000000000000000000000000000000000000000..eba0a497bc36515fe816e140baceddb3c7abd98b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/noop.js @@ -0,0 +1,13 @@ +//#region src/compat/function/noop.ts +/** +* A no-operation function that does nothing. +* This can be used as a placeholder or default function. +* +* @example +* noop(); // Does nothing +* +* @returns {void} This function does not return anything. +*/ +function noop(..._) {} +//#endregion +exports.noop = noop; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/noop.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/noop.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9b2069ee40565abbf2ae776fb71fc395aaa18c22 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/noop.mjs @@ -0,0 +1,13 @@ +//#region src/compat/function/noop.ts +/** +* A no-operation function that does nothing. +* This can be used as a placeholder or default function. +* +* @example +* noop(); // Does nothing +* +* @returns {void} This function does not return anything. +*/ +function noop(..._) {} +//#endregion +export { noop }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/nthArg.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/nthArg.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..2a2f46d68ead46afce887e69e3da185db9ac1097 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/nthArg.d.mts @@ -0,0 +1,19 @@ +//#region src/compat/function/nthArg.d.ts +/** + * Creates a function that gets the argument at index `n`. If `n` is negative, the nth argument from the end is returned. + * + * @param {number} [n=0] - The index of the argument to return. + * @returns {(...args: any[]) => any} Returns the new function. + * + * @example + * var func = nthArg(1); + * func('a', 'b', 'c', 'd'); + * // => 'b' + * + * var func = nthArg(-2); + * func('a', 'b', 'c', 'd'); + * // => 'c' + */ +declare function nthArg(n?: number): (...args: any[]) => any; +//#endregion +export { nthArg }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/nthArg.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/nthArg.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2a2f46d68ead46afce887e69e3da185db9ac1097 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/nthArg.d.ts @@ -0,0 +1,19 @@ +//#region src/compat/function/nthArg.d.ts +/** + * Creates a function that gets the argument at index `n`. If `n` is negative, the nth argument from the end is returned. + * + * @param {number} [n=0] - The index of the argument to return. + * @returns {(...args: any[]) => any} Returns the new function. + * + * @example + * var func = nthArg(1); + * func('a', 'b', 'c', 'd'); + * // => 'b' + * + * var func = nthArg(-2); + * func('a', 'b', 'c', 'd'); + * // => 'c' + */ +declare function nthArg(n?: number): (...args: any[]) => any; +//#endregion +export { nthArg }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/nthArg.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/nthArg.js new file mode 100644 index 0000000000000000000000000000000000000000..b98a7c1e7ab6e2a0131040148534bce22fcf0654 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/nthArg.js @@ -0,0 +1,28 @@ +const require_toInteger = require("../util/toInteger.js"); +//#region src/compat/function/nthArg.ts +/** +* Creates a function that retrieves the argument at the specified index `n`. +* +* If `n` is negative, the nth argument from the end is returned. +* +* @param {number} [n=0] - The index of the argument to retrieve. +* If negative, counts from the end of the arguments list. +* @returns {(args: any[]) => unknown} A new function that returns the argument at the specified index. +* +* @example +* const getSecondArg = nthArg(1); +* const result = getSecondArg('a', 'b', 'c'); +* console.log(result); // => 'b' +* +* @example +* const getLastArg = nthArg(-1); +* const result = getLastArg('a', 'b', 'c'); +* console.log(result); // => 'c' +*/ +function nthArg(n = 0) { + return function(...args) { + return args.at(require_toInteger.toInteger(n)); + }; +} +//#endregion +exports.nthArg = nthArg; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/nthArg.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/nthArg.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2565fe5c6de78e7b2ba459cd9be232b9a3d731ce --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/nthArg.mjs @@ -0,0 +1,28 @@ +import { toInteger } from "../util/toInteger.mjs"; +//#region src/compat/function/nthArg.ts +/** +* Creates a function that retrieves the argument at the specified index `n`. +* +* If `n` is negative, the nth argument from the end is returned. +* +* @param {number} [n=0] - The index of the argument to retrieve. +* If negative, counts from the end of the arguments list. +* @returns {(args: any[]) => unknown} A new function that returns the argument at the specified index. +* +* @example +* const getSecondArg = nthArg(1); +* const result = getSecondArg('a', 'b', 'c'); +* console.log(result); // => 'b' +* +* @example +* const getLastArg = nthArg(-1); +* const result = getLastArg('a', 'b', 'c'); +* console.log(result); // => 'c' +*/ +function nthArg(n = 0) { + return function(...args) { + return args.at(toInteger(n)); + }; +} +//#endregion +export { nthArg }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/once.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/once.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..9a1438b14231d8f4b81fa493a057fca086e0bd8d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/once.d.mts @@ -0,0 +1,4 @@ +//#region src/compat/function/once.d.ts +declare function once any>(func: T): T; +//#endregion +export { once }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/once.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/once.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9a1438b14231d8f4b81fa493a057fca086e0bd8d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/once.d.ts @@ -0,0 +1,4 @@ +//#region src/compat/function/once.d.ts +declare function once any>(func: T): T; +//#endregion +export { once }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/once.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/once.js new file mode 100644 index 0000000000000000000000000000000000000000..123c819f08393571dbf7af7d36914dce0121bdeb --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/once.js @@ -0,0 +1,7 @@ +const require_once = require("../../function/once.js"); +//#region src/compat/function/once.ts +function once(func) { + return require_once.once(func); +} +//#endregion +exports.once = once; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/once.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/once.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c7d5d0c0acaba5383f85dc147214b81a4442fce4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/once.mjs @@ -0,0 +1,7 @@ +import { once as once$1 } from "../../function/once.mjs"; +//#region src/compat/function/once.ts +function once(func) { + return once$1(func); +} +//#endregion +export { once }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/overArgs.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/overArgs.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..283c298b35e6bc5c4e2151f582dfaa808f8feaf2 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/overArgs.d.mts @@ -0,0 +1,51 @@ +import { Many } from "../_internal/Many.mjs"; + +//#region src/compat/function/overArgs.d.ts +/** + * Creates a function that invokes `func` with its arguments transformed by corresponding transform functions. + * + * Transform functions can be: + * - Functions that accept and return a value + * - Property names (strings) to get a property value from each argument + * - Objects to check if arguments match the object properties + * - Arrays of [property, value] to check if argument properties match values + * + * If a transform is nullish, the identity function is used instead. + * Only transforms arguments up to the number of transform functions provided. + * + * @param {(...args: any[]) => any} func - The function to wrap + * @param {Array any>>} transforms - The functions to transform arguments. Each transform can be: + * - A function that accepts and returns a value + * - A string to get a property value (e.g. 'name' gets the name property) + * - An object to check if arguments match its properties + * - An array of [property, value] to check property matches + * @returns {(...args: any[]) => any} A new function that transforms arguments before passing them to func + * @throws {TypeError} If func is not a function. + * @example + * ```ts + * function doubled(n: number) { + * return n * 2; + * } + * + * function square(n: number) { + * return n * n; + * } + * + * const func = overArgs((x, y) => [x, y], [doubled, square]); + * + * func(5, 3); + * // => [10, 9] + * + * // With property shorthand + * const user = { name: 'John', age: 30 }; + * const getUserInfo = overArgs( + * (name, age) => `${name} is ${age} years old`, + * ['name', 'age'] + * ); + * getUserInfo(user, user); + * // => "John is 30 years old" + * ``` + */ +declare function overArgs(func: (...args: any[]) => any, ..._transforms: Array any>>): (...args: any[]) => any; +//#endregion +export { overArgs }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/overArgs.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/overArgs.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..514a00a1ea873e1a2b0278722e515cd59a5e47fa --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/overArgs.d.ts @@ -0,0 +1,51 @@ +import { Many } from "../_internal/Many.js"; + +//#region src/compat/function/overArgs.d.ts +/** + * Creates a function that invokes `func` with its arguments transformed by corresponding transform functions. + * + * Transform functions can be: + * - Functions that accept and return a value + * - Property names (strings) to get a property value from each argument + * - Objects to check if arguments match the object properties + * - Arrays of [property, value] to check if argument properties match values + * + * If a transform is nullish, the identity function is used instead. + * Only transforms arguments up to the number of transform functions provided. + * + * @param {(...args: any[]) => any} func - The function to wrap + * @param {Array any>>} transforms - The functions to transform arguments. Each transform can be: + * - A function that accepts and returns a value + * - A string to get a property value (e.g. 'name' gets the name property) + * - An object to check if arguments match its properties + * - An array of [property, value] to check property matches + * @returns {(...args: any[]) => any} A new function that transforms arguments before passing them to func + * @throws {TypeError} If func is not a function. + * @example + * ```ts + * function doubled(n: number) { + * return n * 2; + * } + * + * function square(n: number) { + * return n * n; + * } + * + * const func = overArgs((x, y) => [x, y], [doubled, square]); + * + * func(5, 3); + * // => [10, 9] + * + * // With property shorthand + * const user = { name: 'John', age: 30 }; + * const getUserInfo = overArgs( + * (name, age) => `${name} is ${age} years old`, + * ['name', 'age'] + * ); + * getUserInfo(user, user); + * // => "John is 30 years old" + * ``` + */ +declare function overArgs(func: (...args: any[]) => any, ..._transforms: Array any>>): (...args: any[]) => any; +//#endregion +export { overArgs }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/overArgs.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/overArgs.js new file mode 100644 index 0000000000000000000000000000000000000000..15d760b7871623a8f3dfbe385c4de259779bb656 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/overArgs.js @@ -0,0 +1,60 @@ +const require_identity = require("../../function/identity.js"); +const require_iteratee = require("../util/iteratee.js"); +//#region src/compat/function/overArgs.ts +/** +* Creates a function that invokes `func` with its arguments transformed by corresponding transform functions. +* +* Transform functions can be: +* - Functions that accept and return a value +* - Property names (strings) to get a property value from each argument +* - Objects to check if arguments match the object properties +* - Arrays of [property, value] to check if argument properties match values +* +* If a transform is nullish, the identity function is used instead. +* Only transforms arguments up to the number of transform functions provided. +* +* @param {(...args: any[]) => any} func - The function to wrap +* @param {Array any>>} transforms - The functions to transform arguments. Each transform can be: +* - A function that accepts and returns a value +* - A string to get a property value (e.g. 'name' gets the name property) +* - An object to check if arguments match its properties +* - An array of [property, value] to check property matches +* @returns {(...args: any[]) => any} A new function that transforms arguments before passing them to func +* @throws {TypeError} If func is not a function. +* @example +* ```ts +* function doubled(n: number) { +* return n * 2; +* } +* +* function square(n: number) { +* return n * n; +* } +* +* const func = overArgs((x, y) => [x, y], [doubled, square]); +* +* func(5, 3); +* // => [10, 9] +* +* // With property shorthand +* const user = { name: 'John', age: 30 }; +* const getUserInfo = overArgs( +* (name, age) => `${name} is ${age} years old`, +* ['name', 'age'] +* ); +* getUserInfo(user, user); +* // => "John is 30 years old" +* ``` +*/ +function overArgs(func, ..._transforms) { + if (typeof func !== "function") throw new TypeError("Expected a function"); + const transforms = _transforms.flat(); + return function(...args) { + const length = Math.min(args.length, transforms.length); + const transformedArgs = [...args]; + for (let i = 0; i < length; i++) transformedArgs[i] = require_iteratee.iteratee(transforms[i] ?? require_identity.identity).call(this, args[i]); + return func.apply(this, transformedArgs); + }; +} +//#endregion +exports.overArgs = overArgs; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/overArgs.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/overArgs.mjs new file mode 100644 index 0000000000000000000000000000000000000000..98381a8a4db78c1b6ab6cb2136b8d990c7735756 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/overArgs.mjs @@ -0,0 +1,60 @@ +import { identity } from "../../function/identity.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +//#region src/compat/function/overArgs.ts +/** +* Creates a function that invokes `func` with its arguments transformed by corresponding transform functions. +* +* Transform functions can be: +* - Functions that accept and return a value +* - Property names (strings) to get a property value from each argument +* - Objects to check if arguments match the object properties +* - Arrays of [property, value] to check if argument properties match values +* +* If a transform is nullish, the identity function is used instead. +* Only transforms arguments up to the number of transform functions provided. +* +* @param {(...args: any[]) => any} func - The function to wrap +* @param {Array any>>} transforms - The functions to transform arguments. Each transform can be: +* - A function that accepts and returns a value +* - A string to get a property value (e.g. 'name' gets the name property) +* - An object to check if arguments match its properties +* - An array of [property, value] to check property matches +* @returns {(...args: any[]) => any} A new function that transforms arguments before passing them to func +* @throws {TypeError} If func is not a function. +* @example +* ```ts +* function doubled(n: number) { +* return n * 2; +* } +* +* function square(n: number) { +* return n * n; +* } +* +* const func = overArgs((x, y) => [x, y], [doubled, square]); +* +* func(5, 3); +* // => [10, 9] +* +* // With property shorthand +* const user = { name: 'John', age: 30 }; +* const getUserInfo = overArgs( +* (name, age) => `${name} is ${age} years old`, +* ['name', 'age'] +* ); +* getUserInfo(user, user); +* // => "John is 30 years old" +* ``` +*/ +function overArgs(func, ..._transforms) { + if (typeof func !== "function") throw new TypeError("Expected a function"); + const transforms = _transforms.flat(); + return function(...args) { + const length = Math.min(args.length, transforms.length); + const transformedArgs = [...args]; + for (let i = 0; i < length; i++) transformedArgs[i] = iteratee(transforms[i] ?? identity).call(this, args[i]); + return func.apply(this, transformedArgs); + }; +} +//#endregion +export { overArgs }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/partial.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/partial.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..dc1fa695413d7031bb149fbc7503bb1ec91b7518 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/partial.d.mts @@ -0,0 +1,205 @@ +import { Toolkit } from "../toolkit.mjs"; + +//#region src/compat/function/partial.d.ts +type __ = Placeholder | Toolkit; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. + * + * @example + * const greet = (greeting: string, name: string) => `${greeting} ${name}`; + * const sayHello = partial(greet, _, 'world'); + * console.log(sayHello('Hello')); // => 'Hello world' + */ +declare function partial(func: (t1: T1, t2: T2) => R, plc1: __, arg2: T2): (t1: T1) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const calculate = (x: number, y: number, z: number) => x + y + z; + * const addToY = partial(calculate, _, 2); + * console.log(addToY(1, 3)); // => 6 + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3) => R, plc1: __, arg2: T2): (t1: T1, t3: T3) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const calculate = (x: number, y: number, z: number) => x + y + z; + * const addZ = partial(calculate, _, _, 3); + * console.log(addZ(1, 2)); // => 6 + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3) => R, plc1: __, plc2: __, arg3: T3): (t1: T1, t2: T2) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const calculate = (x: number, y: number, z: number) => x + y + z; + * const withXandZ = partial(calculate, 1, _, 3); + * console.log(withXandZ(2)); // => 6 + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3) => R, arg1: T1, plc2: __, arg3: T3): (t2: T2) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const calculate = (x: number, y: number, z: number) => x + y + z; + * const withYandZ = partial(calculate, _, 2, 3); + * console.log(withYandZ(1)); // => 6 + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3) => R, plc1: __, arg2: T2, arg3: T3): (t1: T1) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withB = partial(format, _, 'b'); + * console.log(withB('a', 'c', 'd')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, plc1: __, arg2: T2): (t1: T1, t3: T3, t4: T4) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withC = partial(format, _, _, 'c'); + * console.log(withC('a', 'b', 'd')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, plc1: __, plc2: __, arg3: T3): (t1: T1, t2: T2, t4: T4) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withAandC = partial(format, 'a', _, 'c'); + * console.log(withAandC('b', 'd')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, plc2: __, arg3: T3): (t2: T2, t4: T4) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withBandC = partial(format, _, 'b', 'c'); + * console.log(withBandC('a', 'd')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, plc1: __, arg2: T2, arg3: T3): (t1: T1, t4: T4) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withD = partial(format, _, _, _, 'd'); + * console.log(withD('a', 'b', 'c')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, plc1: __, plc2: __, plc3: __, arg4: T4): (t1: T1, t2: T2, t3: T3) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withAandD = partial(format, 'a', _, _, 'd'); + * console.log(withAandD('b', 'c')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, plc2: __, plc3: __, arg4: T4): (t2: T2, t3: T3) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withBandD = partial(format, _, 'b', _, 'd'); + * console.log(withBandD('a', 'c')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, plc1: __, arg2: T2, plc3: __, arg4: T4): (t1: T1, t3: T3) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withABandD = partial(format, 'a', 'b', _, 'd'); + * console.log(withABandD('c')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, arg2: T2, plc3: __, arg4: T4): (t3: T3) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withCandD = partial(format, _, _, 'c', 'd'); + * console.log(withCandD('a', 'b')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, plc1: __, plc2: __, arg3: T3, arg4: T4): (t1: T1, t2: T2) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withACandD = partial(format, 'a', _, 'c', 'd'); + * console.log(withACandD('b')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, plc2: __, arg3: T3, arg4: T4): (t2: T2) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withBCandD = partial(format, _, 'b', 'c', 'd'); + * console.log(withBCandD('a')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, plc1: __, arg2: T2, arg3: T3, arg4: T4): (t1: T1) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const sum = (...numbers: number[]) => numbers.reduce((a, b) => a + b, 0); + * const partialSum = partial(sum); + * console.log(partialSum(1, 2, 3)); // => 6 + */ +declare function partial(func: (...ts: TS) => R): (...ts: TS) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const log = (prefix: string, ...messages: string[]) => console.log(prefix, ...messages); + * const debugLog = partial(log, '[DEBUG]'); + * debugLog('message 1', 'message 2'); // => '[DEBUG] message 1 message 2' + */ +declare function partial(func: (t1: T1, ...ts: TS) => R, arg1: T1): (...ts: TS) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (prefix: string, separator: string, ...messages: string[]) => `${prefix}${messages.join(separator)}`; + * const logWithPrefix = partial(format, '[LOG]', ' - '); + * console.log(logWithPrefix('msg1', 'msg2')); // => '[LOG]msg1 - msg2' + */ +declare function partial(func: (t1: T1, t2: T2, ...ts: TS) => R, t1: T1, t2: T2): (...ts: TS) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (type: string, level: string, message: string, ...tags: string[]) => + * `[${type}][${level}] ${message} ${tags.join(',')}`; + * const errorLog = partial(format, 'ERROR', 'HIGH', 'Something went wrong'); + * console.log(errorLog('critical', 'urgent')); // => '[ERROR][HIGH] Something went wrong critical,urgent' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, ...ts: TS) => R, t1: T1, t2: T2, t3: T3): (...ts: TS) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string, ...rest: string[]) => + * `${a}-${b}-${c}-${d}:${rest.join(',')}`; + * const prefixedFormat = partial(format, 'a', 'b', 'c', 'd'); + * console.log(prefixedFormat('e', 'f')); // => 'a-b-c-d:e,f' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4, ...ts: TS) => R, t1: T1, t2: T2, t3: T3, t4: T4): (...ts: TS) => R; +declare namespace partial { + var placeholder: Placeholder; +} +type Placeholder = symbol | (((value: any) => any) & { + partial: typeof partial; +}); +//#endregion +export { partial }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/partial.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/partial.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3d3b444a8b1620ae59937e5d8677ff9c0c451cd8 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/partial.d.ts @@ -0,0 +1,205 @@ +import { Toolkit } from "../toolkit.js"; + +//#region src/compat/function/partial.d.ts +type __ = Placeholder | Toolkit; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. + * + * @example + * const greet = (greeting: string, name: string) => `${greeting} ${name}`; + * const sayHello = partial(greet, _, 'world'); + * console.log(sayHello('Hello')); // => 'Hello world' + */ +declare function partial(func: (t1: T1, t2: T2) => R, plc1: __, arg2: T2): (t1: T1) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const calculate = (x: number, y: number, z: number) => x + y + z; + * const addToY = partial(calculate, _, 2); + * console.log(addToY(1, 3)); // => 6 + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3) => R, plc1: __, arg2: T2): (t1: T1, t3: T3) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const calculate = (x: number, y: number, z: number) => x + y + z; + * const addZ = partial(calculate, _, _, 3); + * console.log(addZ(1, 2)); // => 6 + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3) => R, plc1: __, plc2: __, arg3: T3): (t1: T1, t2: T2) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const calculate = (x: number, y: number, z: number) => x + y + z; + * const withXandZ = partial(calculate, 1, _, 3); + * console.log(withXandZ(2)); // => 6 + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3) => R, arg1: T1, plc2: __, arg3: T3): (t2: T2) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const calculate = (x: number, y: number, z: number) => x + y + z; + * const withYandZ = partial(calculate, _, 2, 3); + * console.log(withYandZ(1)); // => 6 + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3) => R, plc1: __, arg2: T2, arg3: T3): (t1: T1) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withB = partial(format, _, 'b'); + * console.log(withB('a', 'c', 'd')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, plc1: __, arg2: T2): (t1: T1, t3: T3, t4: T4) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withC = partial(format, _, _, 'c'); + * console.log(withC('a', 'b', 'd')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, plc1: __, plc2: __, arg3: T3): (t1: T1, t2: T2, t4: T4) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withAandC = partial(format, 'a', _, 'c'); + * console.log(withAandC('b', 'd')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, plc2: __, arg3: T3): (t2: T2, t4: T4) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withBandC = partial(format, _, 'b', 'c'); + * console.log(withBandC('a', 'd')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, plc1: __, arg2: T2, arg3: T3): (t1: T1, t4: T4) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withD = partial(format, _, _, _, 'd'); + * console.log(withD('a', 'b', 'c')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, plc1: __, plc2: __, plc3: __, arg4: T4): (t1: T1, t2: T2, t3: T3) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withAandD = partial(format, 'a', _, _, 'd'); + * console.log(withAandD('b', 'c')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, plc2: __, plc3: __, arg4: T4): (t2: T2, t3: T3) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withBandD = partial(format, _, 'b', _, 'd'); + * console.log(withBandD('a', 'c')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, plc1: __, arg2: T2, plc3: __, arg4: T4): (t1: T1, t3: T3) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withABandD = partial(format, 'a', 'b', _, 'd'); + * console.log(withABandD('c')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, arg2: T2, plc3: __, arg4: T4): (t3: T3) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withCandD = partial(format, _, _, 'c', 'd'); + * console.log(withCandD('a', 'b')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, plc1: __, plc2: __, arg3: T3, arg4: T4): (t1: T1, t2: T2) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withACandD = partial(format, 'a', _, 'c', 'd'); + * console.log(withACandD('b')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, plc2: __, arg3: T3, arg4: T4): (t2: T2) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string) => `${a}-${b}-${c}-${d}`; + * const withBCandD = partial(format, _, 'b', 'c', 'd'); + * console.log(withBCandD('a')); // => 'a-b-c-d' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, plc1: __, arg2: T2, arg3: T3, arg4: T4): (t1: T1) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const sum = (...numbers: number[]) => numbers.reduce((a, b) => a + b, 0); + * const partialSum = partial(sum); + * console.log(partialSum(1, 2, 3)); // => 6 + */ +declare function partial(func: (...ts: TS) => R): (...ts: TS) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const log = (prefix: string, ...messages: string[]) => console.log(prefix, ...messages); + * const debugLog = partial(log, '[DEBUG]'); + * debugLog('message 1', 'message 2'); // => '[DEBUG] message 1 message 2' + */ +declare function partial(func: (t1: T1, ...ts: TS) => R, arg1: T1): (...ts: TS) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (prefix: string, separator: string, ...messages: string[]) => `${prefix}${messages.join(separator)}`; + * const logWithPrefix = partial(format, '[LOG]', ' - '); + * console.log(logWithPrefix('msg1', 'msg2')); // => '[LOG]msg1 - msg2' + */ +declare function partial(func: (t1: T1, t2: T2, ...ts: TS) => R, t1: T1, t2: T2): (...ts: TS) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (type: string, level: string, message: string, ...tags: string[]) => + * `[${type}][${level}] ${message} ${tags.join(',')}`; + * const errorLog = partial(format, 'ERROR', 'HIGH', 'Something went wrong'); + * console.log(errorLog('critical', 'urgent')); // => '[ERROR][HIGH] Something went wrong critical,urgent' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, ...ts: TS) => R, t1: T1, t2: T2, t3: T3): (...ts: TS) => R; +/** + * Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. + * + * @example + * const format = (a: string, b: string, c: string, d: string, ...rest: string[]) => + * `${a}-${b}-${c}-${d}:${rest.join(',')}`; + * const prefixedFormat = partial(format, 'a', 'b', 'c', 'd'); + * console.log(prefixedFormat('e', 'f')); // => 'a-b-c-d:e,f' + */ +declare function partial(func: (t1: T1, t2: T2, t3: T3, t4: T4, ...ts: TS) => R, t1: T1, t2: T2, t3: T3, t4: T4): (...ts: TS) => R; +declare namespace partial { + var placeholder: Placeholder; +} +type Placeholder = symbol | (((value: any) => any) & { + partial: typeof partial; +}); +//#endregion +export { partial }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/partial.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/partial.js new file mode 100644 index 0000000000000000000000000000000000000000..5598e9aae4b6bfcbffa692a33ac1b2f27479a8f6 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/partial.js @@ -0,0 +1,34 @@ +const require_partial = require("../../function/partial.js"); +//#region src/compat/function/partial.ts +/** +* Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. +* +* The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. +* +* Note: This method doesn't set the `length` property of partially applied functions. +* +* @template F The type of the function to partially apply. +* @param {F} func The function to partially apply arguments to. +* @param {any[]} partialArgs The arguments to be partially applied. +* @returns {(...args: any[]) => ReturnType} Returns the new partially applied function. +* +* @example +* function greet(greeting, name) { +* return greeting + ' ' + name; +* } +* +* const sayHelloTo = partial(greet, 'hello'); +* sayHelloTo('fred'); +* // => 'hello fred' +* +* // Partially applied with placeholders. +* const greetFred = partial(greet, partial.placeholder, 'fred'); +* greetFred('hi'); +* // => 'hi fred' +*/ +function partial(func, ...partialArgs) { + return require_partial.partialImpl(func, partial.placeholder, ...partialArgs); +} +partial.placeholder = Symbol("compat.partial.placeholder"); +//#endregion +exports.partial = partial; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/partial.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/partial.mjs new file mode 100644 index 0000000000000000000000000000000000000000..581fea81c19b2f67b36eaccd3d271dc669db4877 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/partial.mjs @@ -0,0 +1,34 @@ +import { partialImpl } from "../../function/partial.mjs"; +//#region src/compat/function/partial.ts +/** +* Creates a function that invokes `func` with `partialArgs` prepended to the arguments it receives. This method is like `bind` except it does not alter the `this` binding. +* +* The partial.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. +* +* Note: This method doesn't set the `length` property of partially applied functions. +* +* @template F The type of the function to partially apply. +* @param {F} func The function to partially apply arguments to. +* @param {any[]} partialArgs The arguments to be partially applied. +* @returns {(...args: any[]) => ReturnType} Returns the new partially applied function. +* +* @example +* function greet(greeting, name) { +* return greeting + ' ' + name; +* } +* +* const sayHelloTo = partial(greet, 'hello'); +* sayHelloTo('fred'); +* // => 'hello fred' +* +* // Partially applied with placeholders. +* const greetFred = partial(greet, partial.placeholder, 'fred'); +* greetFred('hi'); +* // => 'hi fred' +*/ +function partial(func, ...partialArgs) { + return partialImpl(func, partial.placeholder, ...partialArgs); +} +partial.placeholder = Symbol("compat.partial.placeholder"); +//#endregion +export { partial }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/partialRight.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/partialRight.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..587156123d7e195f80fa3afa771cf529e9e55023 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/partialRight.d.mts @@ -0,0 +1,623 @@ +import { Toolkit } from "../toolkit.mjs"; + +//#region src/compat/function/partialRight.d.ts +type __ = Placeholder | Toolkit; +/** + * Creates a function that invokes the provided function with no arguments. + * + * @template R The return type of the function + * @param {() => R} func The function to partially apply + * @returns {() => R} Returns the new partially applied function + * + * @example + * const greet = () => 'Hello!'; + * const sayHello = partialRight(greet); + * sayHello(); // => 'Hello!' + */ +declare function partialRight(func: () => R): () => R; +/** + * Creates a function that invokes the provided function with one argument. + * + * @template T The type of the argument + * @template R The return type of the function + * @param {(t1: T) => R} func The function to partially apply + * @returns {(t1: T) => R} Returns the new partially applied function + * + * @example + * const greet = (name: string) => `Hello ${name}!`; + * const greetPerson = partialRight(greet); + * greetPerson('Fred'); // => 'Hello Fred!' + */ +declare function partialRight(func: (t1: T) => R): (t1: T) => R; +/** + * Creates a function that invokes the provided function with one argument pre-filled. + * + * @template T The type of the argument + * @template R The return type of the function + * @param {(t1: T) => R} func The function to partially apply + * @param {T} arg1 The argument to pre-fill + * @returns {() => R} Returns the new partially applied function + * + * @example + * const greet = (name: string) => `Hello ${name}!`; + * const greetFred = partialRight(greet, 'Fred'); + * greetFred(); // => 'Hello Fred!' + */ +declare function partialRight(func: (t1: T) => R, arg1: T): () => R; +/** + * Creates a function that invokes the provided function with two arguments. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2) => R} func The function to partially apply + * @returns {(t1: T1, t2: T2) => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string) => `${greeting} ${name}!`; + * const greetWithParams = partialRight(greet); + * greetWithParams('Hi', 'Fred'); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2) => R): (t1: T1, t2: T2) => R; +/** + * Creates a function that invokes the provided function with one argument pre-filled and a placeholder. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2) => R} func The function to partially apply + * @param {T1} arg1 The argument to pre-fill + * @param {__} plc2 The placeholder for the second argument + * @returns {(t2: T2) => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string) => `${greeting} ${name}!`; + * const hiWithName = partialRight(greet, 'Hi', partialRight.placeholder); + * hiWithName('Fred'); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2) => R, arg1: T1, plc2: __): (t2: T2) => R; +/** + * Creates a function that invokes the provided function with the second argument pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2) => R} func The function to partially apply + * @param {T2} arg2 The argument to pre-fill + * @returns {(t1: T1) => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string) => `${greeting} ${name}!`; + * const greetFred = partialRight(greet, 'Fred'); + * greetFred('Hi'); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2) => R, arg2: T2): (t1: T1) => R; +/** + * Creates a function that invokes the provided function with both arguments pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {T2} arg2 The second argument to pre-fill + * @returns {() => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string) => `${greeting} ${name}!`; + * const sayHiToFred = partialRight(greet, 'Hi', 'Fred'); + * sayHiToFred(); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2) => R, arg1: T1, arg2: T2): () => R; +/** + * Creates a function that invokes the provided function with no pre-filled arguments. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3) => R} func The function to partially apply + * @returns {(t1: T1, t2: T2, t3: T3) => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string, punctuation: string) => `${greeting} ${name}${punctuation}`; + * const greetWithArgs = partialRight(greet); + * greetWithArgs('Hi', 'Fred', '!'); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3) => R): (t1: T1, t2: T2, t3: T3) => R; +/** + * Creates a function that invokes the provided function with the first argument pre-filled and placeholders for the rest. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {__} plc2 The placeholder for the second argument + * @param {__} plc3 The placeholder for the third argument + * @returns {(t2: T2, t3: T3) => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string, punctuation: string) => `${greeting} ${name}${punctuation}`; + * const hiWithNameAndPunc = partialRight(greet, 'Hi', partialRight.placeholder, partialRight.placeholder); + * hiWithNameAndPunc('Fred', '!'); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3) => R, arg1: T1, plc2: __, plc3: __): (t2: T2, t3: T3) => R; +/** + * Creates a function that invokes the provided function with the second argument pre-filled and a placeholder for the third. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3) => R} func The function to partially apply + * @param {T2} arg2 The second argument to pre-fill + * @param {__} plc3 The placeholder for the third argument + * @returns {(t1: T1, t3: T3) => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string, punctuation: string) => `${greeting} ${name}${punctuation}`; + * const greetFredWithPunc = partialRight(greet, 'Fred', partialRight.placeholder); + * greetFredWithPunc('Hi', '!'); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3) => R, arg2: T2, plc3: __): (t1: T1, t3: T3) => R; +/** + * Creates a function that invokes the provided function with the first two arguments pre-filled and a placeholder for the third. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {T2} arg2 The second argument to pre-fill + * @param {__} plc3 The placeholder for the third argument + * @returns {(t3: T3) => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string, punctuation: string) => `${greeting} ${name}${punctuation}`; + * const hiToFredWithPunc = partialRight(greet, 'Hi', 'Fred', partialRight.placeholder); + * hiToFredWithPunc('!'); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3) => R, arg1: T1, arg2: T2, plc3: __): (t3: T3) => R; +/** + * Creates a function that invokes the provided function with the third argument pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3) => R} func The function to partially apply + * @param {T3} arg3 The third argument to pre-fill + * @returns {(t1: T1, t2: T2) => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string, punctuation: string) => `${greeting} ${name}${punctuation}`; + * const greetWithExclamation = partialRight(greet, '!'); + * greetWithExclamation('Hi', 'Fred'); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3) => R, arg3: T3): (t1: T1, t2: T2) => R; +/** + * Creates a function that invokes the provided function with the first and third arguments pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {__} plc2 The placeholder for the second argument + * @param {T3} arg3 The third argument to pre-fill + * @returns {(t2: T2) => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string, punctuation: string) => `${greeting} ${name}${punctuation}`; + * const hiWithNameAndExclamation = partialRight(greet, 'Hi', partialRight.placeholder, '!'); + * hiWithNameAndExclamation('Fred'); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3) => R, arg1: T1, plc2: __, arg3: T3): (t2: T2) => R; +/** + * Creates a function that invokes the provided function with the second and third arguments pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3) => R} func The function to partially apply + * @param {T2} arg2 The second argument to pre-fill + * @param {T3} arg3 The third argument to pre-fill + * @returns {(t1: T1) => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string, punctuation: string) => `${greeting} ${name}${punctuation}`; + * const greetFredWithExclamation = partialRight(greet, 'Fred', '!'); + * greetFredWithExclamation('Hi'); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3) => R, arg2: T2, arg3: T3): (t1: T1) => R; +/** + * Creates a function that invokes the provided function with all three arguments pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {T2} arg2 The second argument to pre-fill + * @param {T3} arg3 The third argument to pre-fill + * @returns {() => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string, punctuation: string) => `${greeting} ${name}${punctuation}`; + * const sayHiToFredWithExclamation = partialRight(greet, 'Hi', 'Fred', '!'); + * sayHiToFredWithExclamation(); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3) => R, arg1: T1, arg2: T2, arg3: T3): () => R; +/** + * Creates a function that invokes the provided function with no pre-filled arguments. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @returns {(t1: T1, t2: T2, t3: T3, t4: T4) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const formatWithArgs = partialRight(format); + * formatWithArgs('Hi', 'Fred', 'morning', '!'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): (t1: T1, t2: T2, t3: T3, t4: T4) => R; +/** + * Creates a function that invokes the provided function with the first argument pre-filled and placeholders for the rest. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {__} plc2 The placeholder for the second argument + * @param {__} plc3 The placeholder for the third argument + * @param {__} plc4 The placeholder for the fourth argument + * @returns {(t2: T2, t3: T3, t4: T4) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const hiWithRest = partialRight(format, 'Hi', partialRight.placeholder, partialRight.placeholder, partialRight.placeholder); + * hiWithRest('Fred', 'morning', '!'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, plc2: __, plc3: __, plc4: __): (t2: T2, t3: T3, t4: T4) => R; +/** + * Creates a function that invokes the provided function with the second argument pre-filled and placeholders for the rest. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T2} arg2 The second argument to pre-fill + * @param {__} plc3 The placeholder for the third argument + * @param {__} plc4 The placeholder for the fourth argument + * @returns {(t1: T1, t3: T3, t4: T4) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const greetFredWithRest = partialRight(format, 'Fred', partialRight.placeholder, partialRight.placeholder); + * greetFredWithRest('Hi', 'morning', '!'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg2: T2, plc3: __, plc4: __): (t1: T1, t3: T3, t4: T4) => R; +/** + * Creates a function that invokes the provided function with the first two arguments pre-filled and placeholders for the rest. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {T2} arg2 The second argument to pre-fill + * @param {__} plc3 The placeholder for the third argument + * @param {__} plc4 The placeholder for the fourth argument + * @returns {(t3: T3, t4: T4) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const hiToFredWithRest = partialRight(format, 'Hi', 'Fred', partialRight.placeholder, partialRight.placeholder); + * hiToFredWithRest('morning', '!'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, arg2: T2, plc3: __, plc4: __): (t3: T3, t4: T4) => R; +/** + * Creates a function that invokes the provided function with the third argument pre-filled and a placeholder for the fourth. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T3} arg3 The third argument to pre-fill + * @param {__} plc4 The placeholder for the fourth argument + * @returns {(t1: T1, t2: T2, t4: T4) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const atMorningWithPunc = partialRight(format, 'morning', partialRight.placeholder); + * atMorningWithPunc('Hi', 'Fred', '!'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg3: T3, plc4: __): (t1: T1, t2: T2, t4: T4) => R; +/** + * Creates a function that invokes the provided function with the first and third arguments pre-filled and a placeholder for the fourth. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {__} plc2 The placeholder for the second argument + * @param {T3} arg3 The third argument to pre-fill + * @param {__} plc4 The placeholder for the fourth argument + * @returns {(t2: T2, t4: T4) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const hiAtMorningWithNameAndPunc = partialRight(format, 'Hi', partialRight.placeholder, 'morning', partialRight.placeholder); + * hiAtMorningWithNameAndPunc('Fred', '!'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, plc2: __, arg3: T3, plc4: __): (t2: T2, t4: T4) => R; +/** + * Creates a function that invokes the provided function with the second and third arguments pre-filled and a placeholder for the fourth. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T2} arg2 The second argument to pre-fill + * @param {T3} arg3 The third argument to pre-fill + * @param {__} plc4 The placeholder for the fourth argument + * @returns {(t1: T1, t4: T4) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const greetFredAtMorningWithPunc = partialRight(format, 'Fred', 'morning', partialRight.placeholder); + * greetFredAtMorningWithPunc('Hi', '!'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg2: T2, arg3: T3, plc4: __): (t1: T1, t4: T4) => R; +/** + * Creates a function that invokes the provided function with the first three arguments pre-filled and a placeholder for the fourth. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {T2} arg2 The second argument to pre-fill + * @param {T3} arg3 The third argument to pre-fill + * @param {__} plc4 The placeholder for the fourth argument + * @returns {(t4: T4) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const hiToFredAtMorningWithPunc = partialRight(format, 'Hi', 'Fred', 'morning', partialRight.placeholder); + * hiToFredAtMorningWithPunc('!'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, arg2: T2, arg3: T3, plc4: __): (t4: T4) => R; +/** + * Creates a function that invokes the provided function with the fourth argument pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T4} arg4 The fourth argument to pre-fill + * @returns {(t1: T1, t2: T2, t3: T3) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const withExclamation = partialRight(format, '!'); + * withExclamation('Hi', 'Fred', 'morning'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg4: T4): (t1: T1, t2: T2, t3: T3) => R; +/** + * Creates a function that invokes the provided function with the first and fourth arguments pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {__} plc2 The placeholder for the second argument + * @param {__} plc3 The placeholder for the third argument + * @param {T4} arg4 The fourth argument to pre-fill + * @returns {(t2: T2, t3: T3) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const hiWithExclamation = partialRight(format, 'Hi', partialRight.placeholder, partialRight.placeholder, '!'); + * hiWithExclamation('Fred', 'morning'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, plc2: __, plc3: __, arg4: T4): (t2: T2, t3: T3) => R; +/** + * Creates a function that invokes the provided function with the second and fourth arguments pre-filled and a placeholder for the third. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T2} arg2 The second argument to pre-fill + * @param {__} plc3 The placeholder for the third argument + * @param {T4} arg4 The fourth argument to pre-fill + * @returns {(t1: T1, t3: T3) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const greetFredWithTime = partialRight(format, 'Fred', partialRight.placeholder, '!'); + * greetFredWithTime('Hi', 'morning'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg2: T2, plc3: __, arg4: T4): (t1: T1, t3: T3) => R; +/** + * Creates a function that invokes the provided function with the first, second and fourth arguments pre-filled and a placeholder for the third. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {T2} arg2 The second argument to pre-fill + * @param {__} plc3 The placeholder for the third argument + * @param {T4} arg4 The fourth argument to pre-fill + * @returns {(t3: T3) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const hiToFredWithTime = partialRight(format, 'Hi', 'Fred', partialRight.placeholder, '!'); + * hiToFredWithTime('morning'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, arg2: T2, plc3: __, arg4: T4): (t3: T3) => R; +/** + * Creates a function that invokes the provided function with the third and fourth arguments pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T3} arg3 The third argument to pre-fill + * @param {T4} arg4 The fourth argument to pre-fill + * @returns {(t1: T1, t2: T2) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const inMorningWithExclamation = partialRight(format, 'morning', '!'); + * inMorningWithExclamation('Hi', 'Fred'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg3: T3, arg4: T4): (t1: T1, t2: T2) => R; +/** + * Creates a function that invokes the provided function with the first, third and fourth arguments pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {__} plc2 The placeholder for the second argument + * @param {T3} arg3 The third argument to pre-fill + * @param {T4} arg4 The fourth argument to pre-fill + * @returns {(t2: T2) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const hiInMorningWithExclamation = partialRight(format, 'Hi', partialRight.placeholder, 'morning', '!'); + * hiInMorningWithExclamation('Fred'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, plc2: __, arg3: T3, arg4: T4): (t2: T2) => R; +/** + * Creates a function that invokes the provided function with the second, third and fourth arguments pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T2} arg2 The second argument to pre-fill + * @param {T3} arg3 The third argument to pre-fill + * @param {T4} arg4 The fourth argument to pre-fill + * @returns {(t1: T1) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const greetFredInMorningWithExclamation = partialRight(format, 'Fred', 'morning', '!'); + * greetFredInMorningWithExclamation('Hi'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg2: T2, arg3: T3, arg4: T4): (t1: T1) => R; +/** + * Creates a function that invokes the provided function with all arguments pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {T2} arg2 The second argument to pre-fill + * @param {T3} arg3 The third argument to pre-fill + * @param {T4} arg4 The fourth argument to pre-fill + * @returns {() => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const sayHiToFredInMorningWithExclamation = partialRight(format, 'Hi', 'Fred', 'morning', '!'); + * sayHiToFredInMorningWithExclamation(); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, arg2: T2, arg3: T3, arg4: T4): () => R; +/** + * Creates a function that invokes the provided function with partially applied arguments appended to the arguments it receives. + * The partialRight.placeholder value can be used as a placeholder for partially applied arguments. + * + * @template F The type of the function to partially apply + * @param {F} func The function to partially apply arguments to + * @param {...any[]} args The arguments to be partially applied + * @returns {(...args: any[]) => ReturnType} Returns the new partially applied function + * + * @example + * function greet(greeting: string, name: string) { + * return greeting + ' ' + name; + * } + * + * const greetFred = partialRight(greet, 'Fred'); + * greetFred('Hi'); // => 'Hi Fred' + * + * // Using placeholders + * const sayHelloTo = partialRight(greet, 'Hello', partialRight.placeholder); + * sayHelloTo('Fred'); // => 'Hello Fred' + */ +declare function partialRight(func: (...args: any[]) => any, ...args: any[]): (...args: any[]) => any; +declare namespace partialRight { + var placeholder: Placeholder; +} +type Placeholder = symbol | (((value: any) => any) & { + partialRight: typeof partialRight; +}); +//#endregion +export { partialRight }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/partialRight.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/partialRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..17f15bb958e94c62d333daad7c49823ae3421c61 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/partialRight.d.ts @@ -0,0 +1,623 @@ +import { Toolkit } from "../toolkit.js"; + +//#region src/compat/function/partialRight.d.ts +type __ = Placeholder | Toolkit; +/** + * Creates a function that invokes the provided function with no arguments. + * + * @template R The return type of the function + * @param {() => R} func The function to partially apply + * @returns {() => R} Returns the new partially applied function + * + * @example + * const greet = () => 'Hello!'; + * const sayHello = partialRight(greet); + * sayHello(); // => 'Hello!' + */ +declare function partialRight(func: () => R): () => R; +/** + * Creates a function that invokes the provided function with one argument. + * + * @template T The type of the argument + * @template R The return type of the function + * @param {(t1: T) => R} func The function to partially apply + * @returns {(t1: T) => R} Returns the new partially applied function + * + * @example + * const greet = (name: string) => `Hello ${name}!`; + * const greetPerson = partialRight(greet); + * greetPerson('Fred'); // => 'Hello Fred!' + */ +declare function partialRight(func: (t1: T) => R): (t1: T) => R; +/** + * Creates a function that invokes the provided function with one argument pre-filled. + * + * @template T The type of the argument + * @template R The return type of the function + * @param {(t1: T) => R} func The function to partially apply + * @param {T} arg1 The argument to pre-fill + * @returns {() => R} Returns the new partially applied function + * + * @example + * const greet = (name: string) => `Hello ${name}!`; + * const greetFred = partialRight(greet, 'Fred'); + * greetFred(); // => 'Hello Fred!' + */ +declare function partialRight(func: (t1: T) => R, arg1: T): () => R; +/** + * Creates a function that invokes the provided function with two arguments. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2) => R} func The function to partially apply + * @returns {(t1: T1, t2: T2) => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string) => `${greeting} ${name}!`; + * const greetWithParams = partialRight(greet); + * greetWithParams('Hi', 'Fred'); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2) => R): (t1: T1, t2: T2) => R; +/** + * Creates a function that invokes the provided function with one argument pre-filled and a placeholder. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2) => R} func The function to partially apply + * @param {T1} arg1 The argument to pre-fill + * @param {__} plc2 The placeholder for the second argument + * @returns {(t2: T2) => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string) => `${greeting} ${name}!`; + * const hiWithName = partialRight(greet, 'Hi', partialRight.placeholder); + * hiWithName('Fred'); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2) => R, arg1: T1, plc2: __): (t2: T2) => R; +/** + * Creates a function that invokes the provided function with the second argument pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2) => R} func The function to partially apply + * @param {T2} arg2 The argument to pre-fill + * @returns {(t1: T1) => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string) => `${greeting} ${name}!`; + * const greetFred = partialRight(greet, 'Fred'); + * greetFred('Hi'); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2) => R, arg2: T2): (t1: T1) => R; +/** + * Creates a function that invokes the provided function with both arguments pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {T2} arg2 The second argument to pre-fill + * @returns {() => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string) => `${greeting} ${name}!`; + * const sayHiToFred = partialRight(greet, 'Hi', 'Fred'); + * sayHiToFred(); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2) => R, arg1: T1, arg2: T2): () => R; +/** + * Creates a function that invokes the provided function with no pre-filled arguments. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3) => R} func The function to partially apply + * @returns {(t1: T1, t2: T2, t3: T3) => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string, punctuation: string) => `${greeting} ${name}${punctuation}`; + * const greetWithArgs = partialRight(greet); + * greetWithArgs('Hi', 'Fred', '!'); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3) => R): (t1: T1, t2: T2, t3: T3) => R; +/** + * Creates a function that invokes the provided function with the first argument pre-filled and placeholders for the rest. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {__} plc2 The placeholder for the second argument + * @param {__} plc3 The placeholder for the third argument + * @returns {(t2: T2, t3: T3) => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string, punctuation: string) => `${greeting} ${name}${punctuation}`; + * const hiWithNameAndPunc = partialRight(greet, 'Hi', partialRight.placeholder, partialRight.placeholder); + * hiWithNameAndPunc('Fred', '!'); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3) => R, arg1: T1, plc2: __, plc3: __): (t2: T2, t3: T3) => R; +/** + * Creates a function that invokes the provided function with the second argument pre-filled and a placeholder for the third. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3) => R} func The function to partially apply + * @param {T2} arg2 The second argument to pre-fill + * @param {__} plc3 The placeholder for the third argument + * @returns {(t1: T1, t3: T3) => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string, punctuation: string) => `${greeting} ${name}${punctuation}`; + * const greetFredWithPunc = partialRight(greet, 'Fred', partialRight.placeholder); + * greetFredWithPunc('Hi', '!'); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3) => R, arg2: T2, plc3: __): (t1: T1, t3: T3) => R; +/** + * Creates a function that invokes the provided function with the first two arguments pre-filled and a placeholder for the third. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {T2} arg2 The second argument to pre-fill + * @param {__} plc3 The placeholder for the third argument + * @returns {(t3: T3) => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string, punctuation: string) => `${greeting} ${name}${punctuation}`; + * const hiToFredWithPunc = partialRight(greet, 'Hi', 'Fred', partialRight.placeholder); + * hiToFredWithPunc('!'); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3) => R, arg1: T1, arg2: T2, plc3: __): (t3: T3) => R; +/** + * Creates a function that invokes the provided function with the third argument pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3) => R} func The function to partially apply + * @param {T3} arg3 The third argument to pre-fill + * @returns {(t1: T1, t2: T2) => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string, punctuation: string) => `${greeting} ${name}${punctuation}`; + * const greetWithExclamation = partialRight(greet, '!'); + * greetWithExclamation('Hi', 'Fred'); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3) => R, arg3: T3): (t1: T1, t2: T2) => R; +/** + * Creates a function that invokes the provided function with the first and third arguments pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {__} plc2 The placeholder for the second argument + * @param {T3} arg3 The third argument to pre-fill + * @returns {(t2: T2) => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string, punctuation: string) => `${greeting} ${name}${punctuation}`; + * const hiWithNameAndExclamation = partialRight(greet, 'Hi', partialRight.placeholder, '!'); + * hiWithNameAndExclamation('Fred'); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3) => R, arg1: T1, plc2: __, arg3: T3): (t2: T2) => R; +/** + * Creates a function that invokes the provided function with the second and third arguments pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3) => R} func The function to partially apply + * @param {T2} arg2 The second argument to pre-fill + * @param {T3} arg3 The third argument to pre-fill + * @returns {(t1: T1) => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string, punctuation: string) => `${greeting} ${name}${punctuation}`; + * const greetFredWithExclamation = partialRight(greet, 'Fred', '!'); + * greetFredWithExclamation('Hi'); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3) => R, arg2: T2, arg3: T3): (t1: T1) => R; +/** + * Creates a function that invokes the provided function with all three arguments pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {T2} arg2 The second argument to pre-fill + * @param {T3} arg3 The third argument to pre-fill + * @returns {() => R} Returns the new partially applied function + * + * @example + * const greet = (greeting: string, name: string, punctuation: string) => `${greeting} ${name}${punctuation}`; + * const sayHiToFredWithExclamation = partialRight(greet, 'Hi', 'Fred', '!'); + * sayHiToFredWithExclamation(); // => 'Hi Fred!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3) => R, arg1: T1, arg2: T2, arg3: T3): () => R; +/** + * Creates a function that invokes the provided function with no pre-filled arguments. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @returns {(t1: T1, t2: T2, t3: T3, t4: T4) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const formatWithArgs = partialRight(format); + * formatWithArgs('Hi', 'Fred', 'morning', '!'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): (t1: T1, t2: T2, t3: T3, t4: T4) => R; +/** + * Creates a function that invokes the provided function with the first argument pre-filled and placeholders for the rest. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {__} plc2 The placeholder for the second argument + * @param {__} plc3 The placeholder for the third argument + * @param {__} plc4 The placeholder for the fourth argument + * @returns {(t2: T2, t3: T3, t4: T4) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const hiWithRest = partialRight(format, 'Hi', partialRight.placeholder, partialRight.placeholder, partialRight.placeholder); + * hiWithRest('Fred', 'morning', '!'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, plc2: __, plc3: __, plc4: __): (t2: T2, t3: T3, t4: T4) => R; +/** + * Creates a function that invokes the provided function with the second argument pre-filled and placeholders for the rest. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T2} arg2 The second argument to pre-fill + * @param {__} plc3 The placeholder for the third argument + * @param {__} plc4 The placeholder for the fourth argument + * @returns {(t1: T1, t3: T3, t4: T4) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const greetFredWithRest = partialRight(format, 'Fred', partialRight.placeholder, partialRight.placeholder); + * greetFredWithRest('Hi', 'morning', '!'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg2: T2, plc3: __, plc4: __): (t1: T1, t3: T3, t4: T4) => R; +/** + * Creates a function that invokes the provided function with the first two arguments pre-filled and placeholders for the rest. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {T2} arg2 The second argument to pre-fill + * @param {__} plc3 The placeholder for the third argument + * @param {__} plc4 The placeholder for the fourth argument + * @returns {(t3: T3, t4: T4) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const hiToFredWithRest = partialRight(format, 'Hi', 'Fred', partialRight.placeholder, partialRight.placeholder); + * hiToFredWithRest('morning', '!'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, arg2: T2, plc3: __, plc4: __): (t3: T3, t4: T4) => R; +/** + * Creates a function that invokes the provided function with the third argument pre-filled and a placeholder for the fourth. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T3} arg3 The third argument to pre-fill + * @param {__} plc4 The placeholder for the fourth argument + * @returns {(t1: T1, t2: T2, t4: T4) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const atMorningWithPunc = partialRight(format, 'morning', partialRight.placeholder); + * atMorningWithPunc('Hi', 'Fred', '!'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg3: T3, plc4: __): (t1: T1, t2: T2, t4: T4) => R; +/** + * Creates a function that invokes the provided function with the first and third arguments pre-filled and a placeholder for the fourth. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {__} plc2 The placeholder for the second argument + * @param {T3} arg3 The third argument to pre-fill + * @param {__} plc4 The placeholder for the fourth argument + * @returns {(t2: T2, t4: T4) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const hiAtMorningWithNameAndPunc = partialRight(format, 'Hi', partialRight.placeholder, 'morning', partialRight.placeholder); + * hiAtMorningWithNameAndPunc('Fred', '!'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, plc2: __, arg3: T3, plc4: __): (t2: T2, t4: T4) => R; +/** + * Creates a function that invokes the provided function with the second and third arguments pre-filled and a placeholder for the fourth. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T2} arg2 The second argument to pre-fill + * @param {T3} arg3 The third argument to pre-fill + * @param {__} plc4 The placeholder for the fourth argument + * @returns {(t1: T1, t4: T4) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const greetFredAtMorningWithPunc = partialRight(format, 'Fred', 'morning', partialRight.placeholder); + * greetFredAtMorningWithPunc('Hi', '!'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg2: T2, arg3: T3, plc4: __): (t1: T1, t4: T4) => R; +/** + * Creates a function that invokes the provided function with the first three arguments pre-filled and a placeholder for the fourth. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {T2} arg2 The second argument to pre-fill + * @param {T3} arg3 The third argument to pre-fill + * @param {__} plc4 The placeholder for the fourth argument + * @returns {(t4: T4) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const hiToFredAtMorningWithPunc = partialRight(format, 'Hi', 'Fred', 'morning', partialRight.placeholder); + * hiToFredAtMorningWithPunc('!'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, arg2: T2, arg3: T3, plc4: __): (t4: T4) => R; +/** + * Creates a function that invokes the provided function with the fourth argument pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T4} arg4 The fourth argument to pre-fill + * @returns {(t1: T1, t2: T2, t3: T3) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const withExclamation = partialRight(format, '!'); + * withExclamation('Hi', 'Fred', 'morning'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg4: T4): (t1: T1, t2: T2, t3: T3) => R; +/** + * Creates a function that invokes the provided function with the first and fourth arguments pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {__} plc2 The placeholder for the second argument + * @param {__} plc3 The placeholder for the third argument + * @param {T4} arg4 The fourth argument to pre-fill + * @returns {(t2: T2, t3: T3) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const hiWithExclamation = partialRight(format, 'Hi', partialRight.placeholder, partialRight.placeholder, '!'); + * hiWithExclamation('Fred', 'morning'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, plc2: __, plc3: __, arg4: T4): (t2: T2, t3: T3) => R; +/** + * Creates a function that invokes the provided function with the second and fourth arguments pre-filled and a placeholder for the third. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T2} arg2 The second argument to pre-fill + * @param {__} plc3 The placeholder for the third argument + * @param {T4} arg4 The fourth argument to pre-fill + * @returns {(t1: T1, t3: T3) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const greetFredWithTime = partialRight(format, 'Fred', partialRight.placeholder, '!'); + * greetFredWithTime('Hi', 'morning'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg2: T2, plc3: __, arg4: T4): (t1: T1, t3: T3) => R; +/** + * Creates a function that invokes the provided function with the first, second and fourth arguments pre-filled and a placeholder for the third. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {T2} arg2 The second argument to pre-fill + * @param {__} plc3 The placeholder for the third argument + * @param {T4} arg4 The fourth argument to pre-fill + * @returns {(t3: T3) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const hiToFredWithTime = partialRight(format, 'Hi', 'Fred', partialRight.placeholder, '!'); + * hiToFredWithTime('morning'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, arg2: T2, plc3: __, arg4: T4): (t3: T3) => R; +/** + * Creates a function that invokes the provided function with the third and fourth arguments pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T3} arg3 The third argument to pre-fill + * @param {T4} arg4 The fourth argument to pre-fill + * @returns {(t1: T1, t2: T2) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const inMorningWithExclamation = partialRight(format, 'morning', '!'); + * inMorningWithExclamation('Hi', 'Fred'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg3: T3, arg4: T4): (t1: T1, t2: T2) => R; +/** + * Creates a function that invokes the provided function with the first, third and fourth arguments pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {__} plc2 The placeholder for the second argument + * @param {T3} arg3 The third argument to pre-fill + * @param {T4} arg4 The fourth argument to pre-fill + * @returns {(t2: T2) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const hiInMorningWithExclamation = partialRight(format, 'Hi', partialRight.placeholder, 'morning', '!'); + * hiInMorningWithExclamation('Fred'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, plc2: __, arg3: T3, arg4: T4): (t2: T2) => R; +/** + * Creates a function that invokes the provided function with the second, third and fourth arguments pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T2} arg2 The second argument to pre-fill + * @param {T3} arg3 The third argument to pre-fill + * @param {T4} arg4 The fourth argument to pre-fill + * @returns {(t1: T1) => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const greetFredInMorningWithExclamation = partialRight(format, 'Fred', 'morning', '!'); + * greetFredInMorningWithExclamation('Hi'); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg2: T2, arg3: T3, arg4: T4): (t1: T1) => R; +/** + * Creates a function that invokes the provided function with all arguments pre-filled. + * + * @template T1 The type of the first argument + * @template T2 The type of the second argument + * @template T3 The type of the third argument + * @template T4 The type of the fourth argument + * @template R The return type of the function + * @param {(t1: T1, t2: T2, t3: T3, t4: T4) => R} func The function to partially apply + * @param {T1} arg1 The first argument to pre-fill + * @param {T2} arg2 The second argument to pre-fill + * @param {T3} arg3 The third argument to pre-fill + * @param {T4} arg4 The fourth argument to pre-fill + * @returns {() => R} Returns the new partially applied function + * + * @example + * const format = (greeting: string, name: string, time: string, punctuation: string) => + * `${greeting} ${name}, it's ${time}${punctuation}`; + * const sayHiToFredInMorningWithExclamation = partialRight(format, 'Hi', 'Fred', 'morning', '!'); + * sayHiToFredInMorningWithExclamation(); // => 'Hi Fred, it's morning!' + */ +declare function partialRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R, arg1: T1, arg2: T2, arg3: T3, arg4: T4): () => R; +/** + * Creates a function that invokes the provided function with partially applied arguments appended to the arguments it receives. + * The partialRight.placeholder value can be used as a placeholder for partially applied arguments. + * + * @template F The type of the function to partially apply + * @param {F} func The function to partially apply arguments to + * @param {...any[]} args The arguments to be partially applied + * @returns {(...args: any[]) => ReturnType} Returns the new partially applied function + * + * @example + * function greet(greeting: string, name: string) { + * return greeting + ' ' + name; + * } + * + * const greetFred = partialRight(greet, 'Fred'); + * greetFred('Hi'); // => 'Hi Fred' + * + * // Using placeholders + * const sayHelloTo = partialRight(greet, 'Hello', partialRight.placeholder); + * sayHelloTo('Fred'); // => 'Hello Fred' + */ +declare function partialRight(func: (...args: any[]) => any, ...args: any[]): (...args: any[]) => any; +declare namespace partialRight { + var placeholder: Placeholder; +} +type Placeholder = symbol | (((value: any) => any) & { + partialRight: typeof partialRight; +}); +//#endregion +export { partialRight }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/partialRight.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/partialRight.js new file mode 100644 index 0000000000000000000000000000000000000000..c764f22bebe0741e41393f5fe44bef540754fe13 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/partialRight.js @@ -0,0 +1,34 @@ +const require_partialRight = require("../../function/partialRight.js"); +//#region src/compat/function/partialRight.ts +/** +* This method is like `partial` except that partially applied arguments are appended to the arguments it receives. +* +* The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. +* +* Note: This method doesn't set the `length` property of partially applied functions. +* +* @template F The type of the function to partially apply. +* @param {F} func The function to partially apply arguments to. +* @param {any[]} partialArgs The arguments to be partially applied. +* @returns {(...args: any[]) => ReturnType} Returns the new partially applied function. +* +* @example +* function greet(greeting, name) { +* return greeting + ' ' + name; +* } +* +* const greetFred = partialRight(greet, 'fred'); +* greetFred('hi'); +* // => 'hi fred' +* +* // Partially applied with placeholders. +* const sayHelloTo = partialRight(greet, 'hello', partialRight.placeholder); +* sayHelloTo('fred'); +* // => 'hello fred' +*/ +function partialRight(func, ...partialArgs) { + return require_partialRight.partialRightImpl(func, partialRight.placeholder, ...partialArgs); +} +partialRight.placeholder = Symbol("compat.partialRight.placeholder"); +//#endregion +exports.partialRight = partialRight; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/partialRight.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/partialRight.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b704e6b9ea8defd3f81db241b61bc4b244dda5d0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/partialRight.mjs @@ -0,0 +1,34 @@ +import { partialRightImpl } from "../../function/partialRight.mjs"; +//#region src/compat/function/partialRight.ts +/** +* This method is like `partial` except that partially applied arguments are appended to the arguments it receives. +* +* The partialRight.placeholder value, which defaults to a `symbol`, may be used as a placeholder for partially applied arguments. +* +* Note: This method doesn't set the `length` property of partially applied functions. +* +* @template F The type of the function to partially apply. +* @param {F} func The function to partially apply arguments to. +* @param {any[]} partialArgs The arguments to be partially applied. +* @returns {(...args: any[]) => ReturnType} Returns the new partially applied function. +* +* @example +* function greet(greeting, name) { +* return greeting + ' ' + name; +* } +* +* const greetFred = partialRight(greet, 'fred'); +* greetFred('hi'); +* // => 'hi fred' +* +* // Partially applied with placeholders. +* const sayHelloTo = partialRight(greet, 'hello', partialRight.placeholder); +* sayHelloTo('fred'); +* // => 'hello fred' +*/ +function partialRight(func, ...partialArgs) { + return partialRightImpl(func, partialRight.placeholder, ...partialArgs); +} +partialRight.placeholder = Symbol("compat.partialRight.placeholder"); +//#endregion +export { partialRight }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/rearg.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/rearg.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6755978fce1c27597b25c50b595eeafd31a834da --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/rearg.d.mts @@ -0,0 +1,20 @@ +import { Many } from "../_internal/Many.mjs"; + +//#region src/compat/function/rearg.d.ts +/** + * Creates a function that invokes `func` with arguments arranged according to the specified `indices` + * where the argument value at the first index is provided as the first argument, + * the argument value at the second index is provided as the second argument, and so on. + * + * @param {(...args: any[]) => any} func The function to rearrange arguments for. + * @param {Array} indices The arranged argument indices. + * @returns {(...args: any[]) => any} Returns the new function. + * + * @example + * const greet = (greeting: string, name: string) => `${greeting}, ${name}!`; + * const rearrangedGreet = rearg(greet, 1, 0); + * console.log(rearrangedGreet('World', 'Hello')); // Output: "Hello, World!" + */ +declare function rearg(func: (...args: any[]) => any, ...indices: Array>): (...args: any[]) => any; +//#endregion +export { rearg }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/rearg.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/rearg.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..273cf4683e9716292ba24394c9ddf426718a9181 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/rearg.d.ts @@ -0,0 +1,20 @@ +import { Many } from "../_internal/Many.js"; + +//#region src/compat/function/rearg.d.ts +/** + * Creates a function that invokes `func` with arguments arranged according to the specified `indices` + * where the argument value at the first index is provided as the first argument, + * the argument value at the second index is provided as the second argument, and so on. + * + * @param {(...args: any[]) => any} func The function to rearrange arguments for. + * @param {Array} indices The arranged argument indices. + * @returns {(...args: any[]) => any} Returns the new function. + * + * @example + * const greet = (greeting: string, name: string) => `${greeting}, ${name}!`; + * const rearrangedGreet = rearg(greet, 1, 0); + * console.log(rearrangedGreet('World', 'Hello')); // Output: "Hello, World!" + */ +declare function rearg(func: (...args: any[]) => any, ...indices: Array>): (...args: any[]) => any; +//#endregion +export { rearg }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/rearg.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/rearg.js new file mode 100644 index 0000000000000000000000000000000000000000..62e45ee270a00d95ab086b283a1659f3d3c8ab8e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/rearg.js @@ -0,0 +1,26 @@ +const require_flatten = require("../array/flatten.js"); +//#region src/compat/function/rearg.ts +/** +* Creates a function that invokes `func` with arguments arranged according to the specified `indices` +* where the argument value at the first index is provided as the first argument, +* the argument value at the second index is provided as the second argument, and so on. +* +* @param {(...args: any[]) => any} func The function to rearrange arguments for. +* @param {Array} indices The arranged argument indices. +* @returns {(...args: any[]) => any} Returns the new function. +* +* @example +* const greet = (greeting: string, name: string) => `${greeting}, ${name}!`; +* const rearrangedGreet = rearg(greet, 1, 0); +* console.log(rearrangedGreet('World', 'Hello')); // Output: "Hello, World!" +*/ +function rearg(func, ...indices) { + const flattenIndices = require_flatten.flatten(indices); + return function(...args) { + const reorderedArgs = flattenIndices.map((i) => args[i]).slice(0, args.length); + for (let i = reorderedArgs.length; i < args.length; i++) reorderedArgs.push(args[i]); + return func.apply(this, reorderedArgs); + }; +} +//#endregion +exports.rearg = rearg; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/rearg.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/rearg.mjs new file mode 100644 index 0000000000000000000000000000000000000000..08745e2ecdfe50faf221901f5af77f5af21f24e5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/rearg.mjs @@ -0,0 +1,26 @@ +import { flatten } from "../array/flatten.mjs"; +//#region src/compat/function/rearg.ts +/** +* Creates a function that invokes `func` with arguments arranged according to the specified `indices` +* where the argument value at the first index is provided as the first argument, +* the argument value at the second index is provided as the second argument, and so on. +* +* @param {(...args: any[]) => any} func The function to rearrange arguments for. +* @param {Array} indices The arranged argument indices. +* @returns {(...args: any[]) => any} Returns the new function. +* +* @example +* const greet = (greeting: string, name: string) => `${greeting}, ${name}!`; +* const rearrangedGreet = rearg(greet, 1, 0); +* console.log(rearrangedGreet('World', 'Hello')); // Output: "Hello, World!" +*/ +function rearg(func, ...indices) { + const flattenIndices = flatten(indices); + return function(...args) { + const reorderedArgs = flattenIndices.map((i) => args[i]).slice(0, args.length); + for (let i = reorderedArgs.length; i < args.length; i++) reorderedArgs.push(args[i]); + return func.apply(this, reorderedArgs); + }; +} +//#endregion +export { rearg }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/rest.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/rest.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a8a0fe36854ccbd7cdb26470602189ea4f79daba --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/rest.d.mts @@ -0,0 +1,33 @@ +//#region src/compat/function/rest.d.ts +/** + * Creates a function that transforms the arguments of the provided function `func`. + * The transformed arguments are passed to `func` such that the arguments starting from a specified index + * are grouped into an array, while the previous arguments are passed as individual elements. + * + * @param {(...args: any[]) => any} func - The function whose arguments are to be transformed. + * @param {number} [start=func.length - 1] - The index from which to start grouping the remaining arguments into an array. + * Defaults to `func.length - 1`, grouping all arguments after the last parameter. + * @returns {(...args: any[]) => any} A new function that, when called, returns the result of calling `func` with the transformed arguments. + * + * The transformed arguments are: + * - The first `start` arguments as individual elements. + * - The remaining arguments from index `start` onward grouped into an array. + * @example + * function fn(a, b, c) { + * return [a, b, c]; + * } + * + * // Using default start index (func.length - 1, which is 2 in this case) + * const transformedFn = rest(fn); + * console.log(transformedFn(1, 2, 3, 4)); // [1, 2, [3, 4]] + * + * // Using start index 1 + * const transformedFnWithStart = rest(fn, 1); + * console.log(transformedFnWithStart(1, 2, 3, 4)); // [1, [2, 3, 4]] + * + * // With fewer arguments than the start index + * console.log(transformedFn(1)); // [1, undefined, []] + */ +declare function rest(func: (...args: any[]) => any, start?: number): (...args: any[]) => any; +//#endregion +export { rest }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/rest.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/rest.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a8a0fe36854ccbd7cdb26470602189ea4f79daba --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/rest.d.ts @@ -0,0 +1,33 @@ +//#region src/compat/function/rest.d.ts +/** + * Creates a function that transforms the arguments of the provided function `func`. + * The transformed arguments are passed to `func` such that the arguments starting from a specified index + * are grouped into an array, while the previous arguments are passed as individual elements. + * + * @param {(...args: any[]) => any} func - The function whose arguments are to be transformed. + * @param {number} [start=func.length - 1] - The index from which to start grouping the remaining arguments into an array. + * Defaults to `func.length - 1`, grouping all arguments after the last parameter. + * @returns {(...args: any[]) => any} A new function that, when called, returns the result of calling `func` with the transformed arguments. + * + * The transformed arguments are: + * - The first `start` arguments as individual elements. + * - The remaining arguments from index `start` onward grouped into an array. + * @example + * function fn(a, b, c) { + * return [a, b, c]; + * } + * + * // Using default start index (func.length - 1, which is 2 in this case) + * const transformedFn = rest(fn); + * console.log(transformedFn(1, 2, 3, 4)); // [1, 2, [3, 4]] + * + * // Using start index 1 + * const transformedFnWithStart = rest(fn, 1); + * console.log(transformedFnWithStart(1, 2, 3, 4)); // [1, [2, 3, 4]] + * + * // With fewer arguments than the start index + * console.log(transformedFn(1)); // [1, undefined, []] + */ +declare function rest(func: (...args: any[]) => any, start?: number): (...args: any[]) => any; +//#endregion +export { rest }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/rest.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/rest.js new file mode 100644 index 0000000000000000000000000000000000000000..5b6a959672612d12dcd1607d6adf3e68bdb5a284 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/rest.js @@ -0,0 +1,38 @@ +const require_rest = require("../../function/rest.js"); +//#region src/compat/function/rest.ts +/** +* Creates a function that transforms the arguments of the provided function `func`. +* The transformed arguments are passed to `func` such that the arguments starting from a specified index +* are grouped into an array, while the previous arguments are passed as individual elements. +* +* @param {(...args: any[]) => any} func - The function whose arguments are to be transformed. +* @param {number} [start=func.length - 1] - The index from which to start grouping the remaining arguments into an array. +* Defaults to `func.length - 1`, grouping all arguments after the last parameter. +* @returns {(...args: any[]) => any} A new function that, when called, returns the result of calling `func` with the transformed arguments. +* +* The transformed arguments are: +* - The first `start` arguments as individual elements. +* - The remaining arguments from index `start` onward grouped into an array. +* @example +* function fn(a, b, c) { +* return [a, b, c]; +* } +* +* // Using default start index (func.length - 1, which is 2 in this case) +* const transformedFn = rest(fn); +* console.log(transformedFn(1, 2, 3, 4)); // [1, 2, [3, 4]] +* +* // Using start index 1 +* const transformedFnWithStart = rest(fn, 1); +* console.log(transformedFnWithStart(1, 2, 3, 4)); // [1, [2, 3, 4]] +* +* // With fewer arguments than the start index +* console.log(transformedFn(1)); // [1, undefined, []] +*/ +function rest(func, start = func.length - 1) { + start = Number.parseInt(start, 10); + if (Number.isNaN(start) || start < 0) start = func.length - 1; + return require_rest.rest(func, start); +} +//#endregion +exports.rest = rest; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/rest.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/rest.mjs new file mode 100644 index 0000000000000000000000000000000000000000..8bd2388fb421485548a23c37c87abde7ea968d4e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/rest.mjs @@ -0,0 +1,38 @@ +import { rest as rest$1 } from "../../function/rest.mjs"; +//#region src/compat/function/rest.ts +/** +* Creates a function that transforms the arguments of the provided function `func`. +* The transformed arguments are passed to `func` such that the arguments starting from a specified index +* are grouped into an array, while the previous arguments are passed as individual elements. +* +* @param {(...args: any[]) => any} func - The function whose arguments are to be transformed. +* @param {number} [start=func.length - 1] - The index from which to start grouping the remaining arguments into an array. +* Defaults to `func.length - 1`, grouping all arguments after the last parameter. +* @returns {(...args: any[]) => any} A new function that, when called, returns the result of calling `func` with the transformed arguments. +* +* The transformed arguments are: +* - The first `start` arguments as individual elements. +* - The remaining arguments from index `start` onward grouped into an array. +* @example +* function fn(a, b, c) { +* return [a, b, c]; +* } +* +* // Using default start index (func.length - 1, which is 2 in this case) +* const transformedFn = rest(fn); +* console.log(transformedFn(1, 2, 3, 4)); // [1, 2, [3, 4]] +* +* // Using start index 1 +* const transformedFnWithStart = rest(fn, 1); +* console.log(transformedFnWithStart(1, 2, 3, 4)); // [1, [2, 3, 4]] +* +* // With fewer arguments than the start index +* console.log(transformedFn(1)); // [1, undefined, []] +*/ +function rest(func, start = func.length - 1) { + start = Number.parseInt(start, 10); + if (Number.isNaN(start) || start < 0) start = func.length - 1; + return rest$1(func, start); +} +//#endregion +export { rest }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/spread.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/spread.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..3853531bd99af17778ec00288a128161b8e7f6b1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/spread.d.mts @@ -0,0 +1,48 @@ +//#region src/compat/function/spread.d.ts +/** + * Creates a new function that spreads elements of an array argument into individual arguments + * for the original function. The array argument is positioned based on the `argsIndex` parameter. + * + * @template F - A function type with any number of parameters and any return type. + * @param {F} func - The function to be transformed. It can be any function with any number of arguments. + * @param {number} [argsIndex=0] - The index where the array argument is positioned among the other arguments. + * If `argsIndex` is negative or `NaN`, it defaults to `0`. If it's a fractional number, it is rounded to the nearest integer. + * @returns {(...args: any[]) => ReturnType} - A new function that takes multiple arguments, including an array of arguments at the specified `argsIndex`, + * and returns the result of calling the original function with those arguments. + * + * @example + * function add(a, b) { + * return a + b; + * } + * + * const spreadAdd = spread(add); + * console.log(spreadAdd([1, 2])); // Output: 3 + * + * @example + * // Example function to spread arguments over + * function add(a, b) { + * return a + b; + * } + * + * // Create a new function that uses `spread` to combine arguments + * const spreadAdd = spread(add, 1); + * + * // Calling `spreadAdd` with an array as the second argument + * console.log(spreadAdd(1, [2])); // Output: 3 + * + * @example + * // Function with default arguments + * function greet(name, greeting = 'Hello') { + * return `${greeting}, ${name}!`; + * } + * + * // Create a new function that uses `spread` to position the argument array at index 0 + * const spreadGreet = spread(greet, 0); + * + * // Calling `spreadGreet` with an array of arguments + * console.log(spreadGreet(['Alice'])); // Output: Hello, Alice! + * console.log(spreadGreet(['Bob', 'Hi'])); // Output: Hi, Bob! + */ +declare function spread(func: (...args: any[]) => R, argsIndex?: number): (...args: any[]) => R; +//#endregion +export { spread }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/spread.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/spread.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3853531bd99af17778ec00288a128161b8e7f6b1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/spread.d.ts @@ -0,0 +1,48 @@ +//#region src/compat/function/spread.d.ts +/** + * Creates a new function that spreads elements of an array argument into individual arguments + * for the original function. The array argument is positioned based on the `argsIndex` parameter. + * + * @template F - A function type with any number of parameters and any return type. + * @param {F} func - The function to be transformed. It can be any function with any number of arguments. + * @param {number} [argsIndex=0] - The index where the array argument is positioned among the other arguments. + * If `argsIndex` is negative or `NaN`, it defaults to `0`. If it's a fractional number, it is rounded to the nearest integer. + * @returns {(...args: any[]) => ReturnType} - A new function that takes multiple arguments, including an array of arguments at the specified `argsIndex`, + * and returns the result of calling the original function with those arguments. + * + * @example + * function add(a, b) { + * return a + b; + * } + * + * const spreadAdd = spread(add); + * console.log(spreadAdd([1, 2])); // Output: 3 + * + * @example + * // Example function to spread arguments over + * function add(a, b) { + * return a + b; + * } + * + * // Create a new function that uses `spread` to combine arguments + * const spreadAdd = spread(add, 1); + * + * // Calling `spreadAdd` with an array as the second argument + * console.log(spreadAdd(1, [2])); // Output: 3 + * + * @example + * // Function with default arguments + * function greet(name, greeting = 'Hello') { + * return `${greeting}, ${name}!`; + * } + * + * // Create a new function that uses `spread` to position the argument array at index 0 + * const spreadGreet = spread(greet, 0); + * + * // Calling `spreadGreet` with an array of arguments + * console.log(spreadGreet(['Alice'])); // Output: Hello, Alice! + * console.log(spreadGreet(['Bob', 'Hi'])); // Output: Hi, Bob! + */ +declare function spread(func: (...args: any[]) => R, argsIndex?: number): (...args: any[]) => R; +//#endregion +export { spread }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/spread.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/spread.js new file mode 100644 index 0000000000000000000000000000000000000000..8e6f80c3ff9d4c08f1801d1f5d687de94ee6020d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/spread.js @@ -0,0 +1,57 @@ +//#region src/compat/function/spread.ts +/** +* Creates a new function that spreads elements of an array argument into individual arguments +* for the original function. The array argument is positioned based on the `argsIndex` parameter. +* +* @template F - A function type with any number of parameters and any return type. +* @param {F} func - The function to be transformed. It can be any function with any number of arguments. +* @param {number} [argsIndex=0] - The index where the array argument is positioned among the other arguments. +* If `argsIndex` is negative or `NaN`, it defaults to `0`. If it's a fractional number, it is rounded to the nearest integer. +* @returns {(...args: any[]) => ReturnType} - A new function that takes multiple arguments, including an array of arguments at the specified `argsIndex`, +* and returns the result of calling the original function with those arguments. +* +* @example +* function add(a, b) { +* return a + b; +* } +* +* const spreadAdd = spread(add); +* console.log(spreadAdd([1, 2])); // Output: 3 +* +* @example +* // Example function to spread arguments over +* function add(a, b) { +* return a + b; +* } +* +* // Create a new function that uses `spread` to combine arguments +* const spreadAdd = spread(add, 1); +* +* // Calling `spreadAdd` with an array as the second argument +* console.log(spreadAdd(1, [2])); // Output: 3 +* +* @example +* // Function with default arguments +* function greet(name, greeting = 'Hello') { +* return `${greeting}, ${name}!`; +* } +* +* // Create a new function that uses `spread` to position the argument array at index 0 +* const spreadGreet = spread(greet, 0); +* +* // Calling `spreadGreet` with an array of arguments +* console.log(spreadGreet(['Alice'])); // Output: Hello, Alice! +* console.log(spreadGreet(['Bob', 'Hi'])); // Output: Hi, Bob! +*/ +function spread(func, argsIndex = 0) { + argsIndex = Number.parseInt(argsIndex, 10); + if (Number.isNaN(argsIndex) || argsIndex < 0) argsIndex = 0; + return function(...args) { + const array = args[argsIndex]; + const params = args.slice(0, argsIndex); + if (array) params.push(...array); + return func.apply(this, params); + }; +} +//#endregion +exports.spread = spread; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/spread.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/spread.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f9c5f95fadf5dc69aa571428d2b266748c0cdc6f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/spread.mjs @@ -0,0 +1,57 @@ +//#region src/compat/function/spread.ts +/** +* Creates a new function that spreads elements of an array argument into individual arguments +* for the original function. The array argument is positioned based on the `argsIndex` parameter. +* +* @template F - A function type with any number of parameters and any return type. +* @param {F} func - The function to be transformed. It can be any function with any number of arguments. +* @param {number} [argsIndex=0] - The index where the array argument is positioned among the other arguments. +* If `argsIndex` is negative or `NaN`, it defaults to `0`. If it's a fractional number, it is rounded to the nearest integer. +* @returns {(...args: any[]) => ReturnType} - A new function that takes multiple arguments, including an array of arguments at the specified `argsIndex`, +* and returns the result of calling the original function with those arguments. +* +* @example +* function add(a, b) { +* return a + b; +* } +* +* const spreadAdd = spread(add); +* console.log(spreadAdd([1, 2])); // Output: 3 +* +* @example +* // Example function to spread arguments over +* function add(a, b) { +* return a + b; +* } +* +* // Create a new function that uses `spread` to combine arguments +* const spreadAdd = spread(add, 1); +* +* // Calling `spreadAdd` with an array as the second argument +* console.log(spreadAdd(1, [2])); // Output: 3 +* +* @example +* // Function with default arguments +* function greet(name, greeting = 'Hello') { +* return `${greeting}, ${name}!`; +* } +* +* // Create a new function that uses `spread` to position the argument array at index 0 +* const spreadGreet = spread(greet, 0); +* +* // Calling `spreadGreet` with an array of arguments +* console.log(spreadGreet(['Alice'])); // Output: Hello, Alice! +* console.log(spreadGreet(['Bob', 'Hi'])); // Output: Hi, Bob! +*/ +function spread(func, argsIndex = 0) { + argsIndex = Number.parseInt(argsIndex, 10); + if (Number.isNaN(argsIndex) || argsIndex < 0) argsIndex = 0; + return function(...args) { + const array = args[argsIndex]; + const params = args.slice(0, argsIndex); + if (array) params.push(...array); + return func.apply(this, params); + }; +} +//#endregion +export { spread }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/throttle.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/throttle.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d87c2ae050ff5cf7207416bcb34114cd8243783a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/throttle.d.mts @@ -0,0 +1,82 @@ +import { DebouncedFunc, DebouncedFuncLeading } from "./debounce.mjs"; + +//#region src/compat/function/throttle.d.ts +interface ThrottleSettings { + /** + * If `true`, the function will be invoked on the leading edge of the timeout. + * @default true + */ + leading?: boolean | undefined; + /** + * If `true`, the function will be invoked on the trailing edge of the timeout. + * @default true + */ + trailing?: boolean | undefined; +} +type ThrottleSettingsLeading = (ThrottleSettings & { + leading: true; +}) | Omit; +/** + * Creates a throttled function that only invokes the provided function at most once + * per every `throttleMs` milliseconds. Subsequent calls to the throttled function + * within the wait time will not trigger the execution of the original function. + * + * @template F - The type of function. + * @param {F} func - The function to throttle. + * @param {number} throttleMs - The number of milliseconds to throttle executions to. + * @param {ThrottleOptions} options - The options object + * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the throttled function. + * @param {boolean} options.leading - If `true`, the function will be invoked on the leading edge of the timeout. + * @param {boolean} options.trailing - If `true`, the function will be invoked on the trailing edge of the timeout. + * @returns {(...args: Parameters) => void} A new throttled function that accepts the same parameters as the original function. + * + * @example + * const throttledFunction = throttle(() => { + * console.log('Function executed'); + * }, 1000); + * + * // Will log 'Function executed' immediately + * throttledFunction(); + * + * // Will not log anything as it is within the throttle time + * throttledFunction(); + * + * // After 1 second + * setTimeout(() => { + * throttledFunction(); // Will log 'Function executed' + * }, 1000); + */ +declare function throttle any>(func: T, throttleMs?: number, options?: ThrottleSettingsLeading): DebouncedFuncLeading; +/** + * Creates a throttled function that only invokes the provided function at most once + * per every `throttleMs` milliseconds. Subsequent calls to the throttled function + * within the wait time will not trigger the execution of the original function. + * + * @template F - The type of function. + * @param {F} func - The function to throttle. + * @param {number} throttleMs - The number of milliseconds to throttle executions to. + * @param {ThrottleOptions} options - The options object + * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the throttled function. + * @param {boolean} options.leading - If `true`, the function will be invoked on the leading edge of the timeout. + * @param {boolean} options.trailing - If `true`, the function will be invoked on the trailing edge of the timeout. + * @returns {(...args: Parameters) => void} A new throttled function that accepts the same parameters as the original function. + * + * @example + * const throttledFunction = throttle(() => { + * console.log('Function executed'); + * }, 1000); + * + * // Will log 'Function executed' immediately + * throttledFunction(); + * + * // Will not log anything as it is within the throttle time + * throttledFunction(); + * + * // After 1 second + * setTimeout(() => { + * throttledFunction(); // Will log 'Function executed' + * }, 1000); + */ +declare function throttle any>(func: T, throttleMs?: number, options?: ThrottleSettings): DebouncedFunc; +//#endregion +export { throttle }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/throttle.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/throttle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3bc0779dc05d1298f343ca191135900687c2741d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/throttle.d.ts @@ -0,0 +1,82 @@ +import { DebouncedFunc, DebouncedFuncLeading } from "./debounce.js"; + +//#region src/compat/function/throttle.d.ts +interface ThrottleSettings { + /** + * If `true`, the function will be invoked on the leading edge of the timeout. + * @default true + */ + leading?: boolean | undefined; + /** + * If `true`, the function will be invoked on the trailing edge of the timeout. + * @default true + */ + trailing?: boolean | undefined; +} +type ThrottleSettingsLeading = (ThrottleSettings & { + leading: true; +}) | Omit; +/** + * Creates a throttled function that only invokes the provided function at most once + * per every `throttleMs` milliseconds. Subsequent calls to the throttled function + * within the wait time will not trigger the execution of the original function. + * + * @template F - The type of function. + * @param {F} func - The function to throttle. + * @param {number} throttleMs - The number of milliseconds to throttle executions to. + * @param {ThrottleOptions} options - The options object + * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the throttled function. + * @param {boolean} options.leading - If `true`, the function will be invoked on the leading edge of the timeout. + * @param {boolean} options.trailing - If `true`, the function will be invoked on the trailing edge of the timeout. + * @returns {(...args: Parameters) => void} A new throttled function that accepts the same parameters as the original function. + * + * @example + * const throttledFunction = throttle(() => { + * console.log('Function executed'); + * }, 1000); + * + * // Will log 'Function executed' immediately + * throttledFunction(); + * + * // Will not log anything as it is within the throttle time + * throttledFunction(); + * + * // After 1 second + * setTimeout(() => { + * throttledFunction(); // Will log 'Function executed' + * }, 1000); + */ +declare function throttle any>(func: T, throttleMs?: number, options?: ThrottleSettingsLeading): DebouncedFuncLeading; +/** + * Creates a throttled function that only invokes the provided function at most once + * per every `throttleMs` milliseconds. Subsequent calls to the throttled function + * within the wait time will not trigger the execution of the original function. + * + * @template F - The type of function. + * @param {F} func - The function to throttle. + * @param {number} throttleMs - The number of milliseconds to throttle executions to. + * @param {ThrottleOptions} options - The options object + * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the throttled function. + * @param {boolean} options.leading - If `true`, the function will be invoked on the leading edge of the timeout. + * @param {boolean} options.trailing - If `true`, the function will be invoked on the trailing edge of the timeout. + * @returns {(...args: Parameters) => void} A new throttled function that accepts the same parameters as the original function. + * + * @example + * const throttledFunction = throttle(() => { + * console.log('Function executed'); + * }, 1000); + * + * // Will log 'Function executed' immediately + * throttledFunction(); + * + * // Will not log anything as it is within the throttle time + * throttledFunction(); + * + * // After 1 second + * setTimeout(() => { + * throttledFunction(); // Will log 'Function executed' + * }, 1000); + */ +declare function throttle any>(func: T, throttleMs?: number, options?: ThrottleSettings): DebouncedFunc; +//#endregion +export { throttle }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/throttle.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/throttle.js new file mode 100644 index 0000000000000000000000000000000000000000..87ac217de537a1c12a517de17948f0f8bbd3ed88 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/throttle.js @@ -0,0 +1,42 @@ +const require_debounce = require("./debounce.js"); +//#region src/compat/function/throttle.ts +/** +* Creates a throttled function that only invokes the provided function at most once +* per every `throttleMs` milliseconds. Subsequent calls to the throttled function +* within the wait time will not trigger the execution of the original function. +* +* @template F - The type of function. +* @param {F} func - The function to throttle. +* @param {number} throttleMs - The number of milliseconds to throttle executions to. +* @param {ThrottleOptions} options - The options object +* @param {AbortSignal} options.signal - An optional AbortSignal to cancel the throttled function. +* @param {boolean} options.leading - If `true`, the function will be invoked on the leading edge of the timeout. +* @param {boolean} options.trailing - If `true`, the function will be invoked on the trailing edge of the timeout. +* @returns {(...args: Parameters) => void} A new throttled function that accepts the same parameters as the original function. +* +* @example +* const throttledFunction = throttle(() => { +* console.log('Function executed'); +* }, 1000); +* +* // Will log 'Function executed' immediately +* throttledFunction(); +* +* // Will not log anything as it is within the throttle time +* throttledFunction(); +* +* // After 1 second +* setTimeout(() => { +* throttledFunction(); // Will log 'Function executed' +* }, 1000); +*/ +function throttle(func, throttleMs = 0, options = {}) { + const { leading = true, trailing = true } = options; + return require_debounce.debounce(func, throttleMs, { + leading, + maxWait: throttleMs, + trailing + }); +} +//#endregion +exports.throttle = throttle; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/throttle.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/throttle.mjs new file mode 100644 index 0000000000000000000000000000000000000000..8213700302e00f14d12e4595738560b5fd97c3b8 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/throttle.mjs @@ -0,0 +1,42 @@ +import { debounce } from "./debounce.mjs"; +//#region src/compat/function/throttle.ts +/** +* Creates a throttled function that only invokes the provided function at most once +* per every `throttleMs` milliseconds. Subsequent calls to the throttled function +* within the wait time will not trigger the execution of the original function. +* +* @template F - The type of function. +* @param {F} func - The function to throttle. +* @param {number} throttleMs - The number of milliseconds to throttle executions to. +* @param {ThrottleOptions} options - The options object +* @param {AbortSignal} options.signal - An optional AbortSignal to cancel the throttled function. +* @param {boolean} options.leading - If `true`, the function will be invoked on the leading edge of the timeout. +* @param {boolean} options.trailing - If `true`, the function will be invoked on the trailing edge of the timeout. +* @returns {(...args: Parameters) => void} A new throttled function that accepts the same parameters as the original function. +* +* @example +* const throttledFunction = throttle(() => { +* console.log('Function executed'); +* }, 1000); +* +* // Will log 'Function executed' immediately +* throttledFunction(); +* +* // Will not log anything as it is within the throttle time +* throttledFunction(); +* +* // After 1 second +* setTimeout(() => { +* throttledFunction(); // Will log 'Function executed' +* }, 1000); +*/ +function throttle(func, throttleMs = 0, options = {}) { + const { leading = true, trailing = true } = options; + return debounce(func, throttleMs, { + leading, + maxWait: throttleMs, + trailing + }); +} +//#endregion +export { throttle }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/unary.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/unary.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..1b7ff92aef96d6b77716657cdf9f6f9ce156ecdc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/unary.d.mts @@ -0,0 +1,18 @@ +//#region src/compat/function/unary.d.ts +/** + * Creates a function that accepts up to one argument, ignoring any additional arguments. + * + * @template F - The type of the function. + * @param {F} func - The function to cap arguments for. + * @returns {(...args: any[]) => ReturnType} Returns the new capped function. + * + * @example + * function fn(a, b, c) { + * console.log(arguments); + * } + * + * unary(fn)(1, 2, 3); // [Arguments] { '0': 1 } + */ +declare function unary(func: (arg1: T, ...args: any[]) => U): (arg1: T) => U; +//#endregion +export { unary }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/unary.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/unary.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1b7ff92aef96d6b77716657cdf9f6f9ce156ecdc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/unary.d.ts @@ -0,0 +1,18 @@ +//#region src/compat/function/unary.d.ts +/** + * Creates a function that accepts up to one argument, ignoring any additional arguments. + * + * @template F - The type of the function. + * @param {F} func - The function to cap arguments for. + * @returns {(...args: any[]) => ReturnType} Returns the new capped function. + * + * @example + * function fn(a, b, c) { + * console.log(arguments); + * } + * + * unary(fn)(1, 2, 3); // [Arguments] { '0': 1 } + */ +declare function unary(func: (arg1: T, ...args: any[]) => U): (arg1: T) => U; +//#endregion +export { unary }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/unary.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/unary.js new file mode 100644 index 0000000000000000000000000000000000000000..9660630496e7d2e066273d544e6a69276f643737 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/unary.js @@ -0,0 +1,21 @@ +const require_ary = require("./ary.js"); +//#region src/compat/function/unary.ts +/** +* Creates a function that accepts up to one argument, ignoring any additional arguments. +* +* @template F - The type of the function. +* @param {F} func - The function to cap arguments for. +* @returns {(...args: any[]) => ReturnType} Returns the new capped function. +* +* @example +* function fn(a, b, c) { +* console.log(arguments); +* } +* +* unary(fn)(1, 2, 3); // [Arguments] { '0': 1 } +*/ +function unary(func) { + return require_ary.ary(func, 1); +} +//#endregion +exports.unary = unary; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/unary.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/unary.mjs new file mode 100644 index 0000000000000000000000000000000000000000..465724b9b83bc88847863790acdf12f438cb1179 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/unary.mjs @@ -0,0 +1,21 @@ +import { ary } from "./ary.mjs"; +//#region src/compat/function/unary.ts +/** +* Creates a function that accepts up to one argument, ignoring any additional arguments. +* +* @template F - The type of the function. +* @param {F} func - The function to cap arguments for. +* @returns {(...args: any[]) => ReturnType} Returns the new capped function. +* +* @example +* function fn(a, b, c) { +* console.log(arguments); +* } +* +* unary(fn)(1, 2, 3); // [Arguments] { '0': 1 } +*/ +function unary(func) { + return ary(func, 1); +} +//#endregion +export { unary }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/wrap.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/function/wrap.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..8ba868e232c14eb3e5902fd05ab614606ef1a540 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/wrap.d.mts @@ -0,0 +1,28 @@ +//#region src/compat/function/wrap.d.ts +/** + * Creates a new function that wraps the given function `func`. + * In this process, you can apply additional logic defined in the `wrapper` function before and after the execution of the original function. + * + * If a `value` is provided instead of a function, this value is passed as the first argument to the `wrapper` function. + * + * @template T - The type of the value being wrapped. + * @template U - The type of the arguments being passed to the `wrapper` function. + * @template V - The type of the return value of the `wrapper` function. + * @param {T} value - The value to be wrapped. + * @param {(value: T, ...args: U[]) => V} wrapper - The function to wrap the value with. + * @returns {(...args: U[]) => V} A new function that wraps the value with the `wrapper` function. + * + * @example + * // Wrap a function + * const greet = (name: string) => `Hi, ${name}`; + * const wrapped = wrap(greet, (value, name) => `[LOG] ${value(name)}`); + * wrapped('Bob'); // => "[LOG] Hi, Bob" + * + * @example + * // Wrap a primitive value + * const wrapped = wrap('value', v => `

${v}

`); + * wrapped(); // => "

value

" + */ +declare function wrap(value: T, wrapper: (value: T, ...args: U[]) => V): (...args: U[]) => V; +//#endregion +export { wrap }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/wrap.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/function/wrap.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8ba868e232c14eb3e5902fd05ab614606ef1a540 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/wrap.d.ts @@ -0,0 +1,28 @@ +//#region src/compat/function/wrap.d.ts +/** + * Creates a new function that wraps the given function `func`. + * In this process, you can apply additional logic defined in the `wrapper` function before and after the execution of the original function. + * + * If a `value` is provided instead of a function, this value is passed as the first argument to the `wrapper` function. + * + * @template T - The type of the value being wrapped. + * @template U - The type of the arguments being passed to the `wrapper` function. + * @template V - The type of the return value of the `wrapper` function. + * @param {T} value - The value to be wrapped. + * @param {(value: T, ...args: U[]) => V} wrapper - The function to wrap the value with. + * @returns {(...args: U[]) => V} A new function that wraps the value with the `wrapper` function. + * + * @example + * // Wrap a function + * const greet = (name: string) => `Hi, ${name}`; + * const wrapped = wrap(greet, (value, name) => `[LOG] ${value(name)}`); + * wrapped('Bob'); // => "[LOG] Hi, Bob" + * + * @example + * // Wrap a primitive value + * const wrapped = wrap('value', v => `

${v}

`); + * wrapped(); // => "

value

" + */ +declare function wrap(value: T, wrapper: (value: T, ...args: U[]) => V): (...args: U[]) => V; +//#endregion +export { wrap }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/wrap.js b/tools/ui/node_modules/es-toolkit/dist/compat/function/wrap.js new file mode 100644 index 0000000000000000000000000000000000000000..d013423d27308614249c483c2114ff01f4933ea6 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/wrap.js @@ -0,0 +1,34 @@ +const require_identity = require("../../function/identity.js"); +const require_isFunction = require("../../predicate/isFunction.js"); +//#region src/compat/function/wrap.ts +/** +* Creates a new function that wraps the given function `func`. +* In this process, you can apply additional logic defined in the `wrapper` function before and after the execution of the original function. +* +* If a `value` is provided instead of a function, this value is passed as the first argument to the `wrapper` function. +* +* @template T - The type of the value being wrapped. +* @template U - The type of the arguments being passed to the `wrapper` function. +* @template V - The type of the return value of the `wrapper` function. +* @param {T} value - The value to be wrapped. +* @param {(value: T, ...args: U[]) => V} wrapper - The function to wrap the value with. +* @returns {(...args: U[]) => V} A new function that wraps the value with the `wrapper` function. +* +* @example +* // Wrap a function +* const greet = (name: string) => `Hi, ${name}`; +* const wrapped = wrap(greet, (value, name) => `[LOG] ${value(name)}`); +* wrapped('Bob'); // => "[LOG] Hi, Bob" +* +* @example +* // Wrap a primitive value +* const wrapped = wrap('value', v => `

${v}

`); +* wrapped(); // => "

value

" +*/ +function wrap(value, wrapper) { + return function(...args) { + return (require_isFunction.isFunction(wrapper) ? wrapper : require_identity.identity).apply(this, [value, ...args]); + }; +} +//#endregion +exports.wrap = wrap; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/function/wrap.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/function/wrap.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7612e0b167cbbeccfb041377e8f73a92fc58fd4d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/function/wrap.mjs @@ -0,0 +1,34 @@ +import { identity } from "../../function/identity.mjs"; +import { isFunction } from "../../predicate/isFunction.mjs"; +//#region src/compat/function/wrap.ts +/** +* Creates a new function that wraps the given function `func`. +* In this process, you can apply additional logic defined in the `wrapper` function before and after the execution of the original function. +* +* If a `value` is provided instead of a function, this value is passed as the first argument to the `wrapper` function. +* +* @template T - The type of the value being wrapped. +* @template U - The type of the arguments being passed to the `wrapper` function. +* @template V - The type of the return value of the `wrapper` function. +* @param {T} value - The value to be wrapped. +* @param {(value: T, ...args: U[]) => V} wrapper - The function to wrap the value with. +* @returns {(...args: U[]) => V} A new function that wraps the value with the `wrapper` function. +* +* @example +* // Wrap a function +* const greet = (name: string) => `Hi, ${name}`; +* const wrapped = wrap(greet, (value, name) => `[LOG] ${value(name)}`); +* wrapped('Bob'); // => "[LOG] Hi, Bob" +* +* @example +* // Wrap a primitive value +* const wrapped = wrap('value', v => `

${v}

`); +* wrapped(); // => "

value

" +*/ +function wrap(value, wrapper) { + return function(...args) { + return (isFunction(wrapper) ? wrapper : identity).apply(this, [value, ...args]); + }; +} +//#endregion +export { wrap }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/index.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0d849a694d0cc5c25e2a8cf19204df0e34410f5c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/index.d.mts @@ -0,0 +1,293 @@ +import { castArray } from "./array/castArray.mjs"; +import { chunk } from "./array/chunk.mjs"; +import { compact } from "./array/compact.mjs"; +import { concat } from "./array/concat.mjs"; +import { countBy } from "./array/countBy.mjs"; +import { difference } from "./array/difference.mjs"; +import { differenceBy } from "./array/differenceBy.mjs"; +import { differenceWith } from "./array/differenceWith.mjs"; +import { drop } from "./array/drop.mjs"; +import { dropRight } from "./array/dropRight.mjs"; +import { dropRightWhile } from "./array/dropRightWhile.mjs"; +import { dropWhile } from "./array/dropWhile.mjs"; +import { forEach } from "./array/forEach.mjs"; +import { forEachRight } from "./array/forEachRight.mjs"; +import { every } from "./array/every.mjs"; +import { fill } from "./array/fill.mjs"; +import { filter } from "./array/filter.mjs"; +import { find } from "./array/find.mjs"; +import { findIndex } from "./array/findIndex.mjs"; +import { findLast } from "./array/findLast.mjs"; +import { findLastIndex } from "./array/findLastIndex.mjs"; +import { head } from "./array/head.mjs"; +import { flatMap } from "./array/flatMap.mjs"; +import { flatMapDeep } from "./array/flatMapDeep.mjs"; +import { flatMapDepth } from "./array/flatMapDepth.mjs"; +import { flatten } from "./array/flatten.mjs"; +import { flattenDeep } from "./array/flattenDeep.mjs"; +import { flattenDepth } from "./array/flattenDepth.mjs"; +import { groupBy } from "./array/groupBy.mjs"; +import { includes } from "./array/includes.mjs"; +import { indexOf } from "./array/indexOf.mjs"; +import { initial } from "./array/initial.mjs"; +import { intersection } from "./array/intersection.mjs"; +import { intersectionBy } from "./array/intersectionBy.mjs"; +import { intersectionWith } from "./array/intersectionWith.mjs"; +import { invokeMap } from "./array/invokeMap.mjs"; +import { join } from "./array/join.mjs"; +import { keyBy } from "./array/keyBy.mjs"; +import { last } from "./array/last.mjs"; +import { lastIndexOf } from "./array/lastIndexOf.mjs"; +import { map } from "./array/map.mjs"; +import { nth } from "./array/nth.mjs"; +import { orderBy } from "./array/orderBy.mjs"; +import { partition } from "./array/partition.mjs"; +import { pull } from "./array/pull.mjs"; +import { pullAll } from "./array/pullAll.mjs"; +import { pullAllBy } from "./array/pullAllBy.mjs"; +import { pullAllWith } from "./array/pullAllWith.mjs"; +import { pullAt } from "./array/pullAt.mjs"; +import { reduce } from "./array/reduce.mjs"; +import { reduceRight } from "./array/reduceRight.mjs"; +import { reject } from "./array/reject.mjs"; +import { remove } from "./array/remove.mjs"; +import { reverse } from "./array/reverse.mjs"; +import { sample } from "./array/sample.mjs"; +import { sampleSize } from "./array/sampleSize.mjs"; +import { shuffle } from "./array/shuffle.mjs"; +import { size } from "./array/size.mjs"; +import { slice } from "./array/slice.mjs"; +import { some } from "./array/some.mjs"; +import { sortBy } from "./array/sortBy.mjs"; +import { sortedIndex } from "./array/sortedIndex.mjs"; +import { sortedIndexBy } from "./array/sortedIndexBy.mjs"; +import { sortedIndexOf } from "./array/sortedIndexOf.mjs"; +import { sortedLastIndex } from "./array/sortedLastIndex.mjs"; +import { sortedLastIndexBy } from "./array/sortedLastIndexBy.mjs"; +import { sortedLastIndexOf } from "./array/sortedLastIndexOf.mjs"; +import { tail } from "./array/tail.mjs"; +import { take } from "./array/take.mjs"; +import { takeRight } from "./array/takeRight.mjs"; +import { takeRightWhile } from "./array/takeRightWhile.mjs"; +import { takeWhile } from "./array/takeWhile.mjs"; +import { union } from "./array/union.mjs"; +import { unionBy } from "./array/unionBy.mjs"; +import { unionWith } from "./array/unionWith.mjs"; +import { uniq } from "./array/uniq.mjs"; +import { uniqBy } from "./array/uniqBy.mjs"; +import { uniqWith } from "./array/uniqWith.mjs"; +import { unzip } from "./array/unzip.mjs"; +import { unzipWith } from "./array/unzipWith.mjs"; +import { without } from "./array/without.mjs"; +import { xor } from "./array/xor.mjs"; +import { xorBy } from "./array/xorBy.mjs"; +import { xorWith } from "./array/xorWith.mjs"; +import { zip } from "./array/zip.mjs"; +import { zipObject } from "./array/zipObject.mjs"; +import { zipObjectDeep } from "./array/zipObjectDeep.mjs"; +import { zipWith } from "./array/zipWith.mjs"; +import { after } from "./function/after.mjs"; +import { ary } from "./function/ary.mjs"; +import { attempt } from "./function/attempt.mjs"; +import { before } from "./function/before.mjs"; +import { bind } from "./function/bind.mjs"; +import { bindKey } from "./function/bindKey.mjs"; +import { curry } from "./function/curry.mjs"; +import { curryRight } from "./function/curryRight.mjs"; +import { DebouncedFunc, debounce } from "./function/debounce.mjs"; +import { defer } from "./function/defer.mjs"; +import { delay } from "./function/delay.mjs"; +import { flip } from "./function/flip.mjs"; +import { flow } from "./function/flow.mjs"; +import { flowRight } from "./function/flowRight.mjs"; +import { memoize } from "./function/memoize.mjs"; +import { negate } from "./function/negate.mjs"; +import { nthArg } from "./function/nthArg.mjs"; +import { once } from "./function/once.mjs"; +import { overArgs } from "./function/overArgs.mjs"; +import { toolkit } from "./toolkit.mjs"; +import { partial } from "./function/partial.mjs"; +import { partialRight } from "./function/partialRight.mjs"; +import { rearg } from "./function/rearg.mjs"; +import { rest } from "./function/rest.mjs"; +import { spread } from "./function/spread.mjs"; +import { throttle } from "./function/throttle.mjs"; +import { unary } from "./function/unary.mjs"; +import { wrap } from "./function/wrap.mjs"; +import { add } from "./math/add.mjs"; +import { ceil } from "./math/ceil.mjs"; +import { clamp } from "./math/clamp.mjs"; +import { divide } from "./math/divide.mjs"; +import { floor } from "./math/floor.mjs"; +import { inRange } from "./math/inRange.mjs"; +import { max } from "./math/max.mjs"; +import { maxBy } from "./math/maxBy.mjs"; +import { mean } from "./math/mean.mjs"; +import { meanBy } from "./math/meanBy.mjs"; +import { min } from "./math/min.mjs"; +import { minBy } from "./math/minBy.mjs"; +import { multiply } from "./math/multiply.mjs"; +import { parseInt } from "./math/parseInt.mjs"; +import { random } from "./math/random.mjs"; +import { range } from "./math/range.mjs"; +import { rangeRight } from "./math/rangeRight.mjs"; +import { round } from "./math/round.mjs"; +import { subtract } from "./math/subtract.mjs"; +import { sum } from "./math/sum.mjs"; +import { sumBy } from "./math/sumBy.mjs"; +import { isEqual } from "../predicate/isEqual.mjs"; +import { identity } from "./function/identity.mjs"; +import { noop } from "./function/noop.mjs"; +import { assign } from "./object/assign.mjs"; +import { assignIn } from "./object/assignIn.mjs"; +import { assignInWith } from "./object/assignInWith.mjs"; +import { assignWith } from "./object/assignWith.mjs"; +import { at } from "./object/at.mjs"; +import { clone } from "./object/clone.mjs"; +import { cloneDeep } from "./object/cloneDeep.mjs"; +import { cloneDeepWith } from "./object/cloneDeepWith.mjs"; +import { cloneWith } from "./object/cloneWith.mjs"; +import { create } from "./object/create.mjs"; +import { defaults } from "./object/defaults.mjs"; +import { defaultsDeep } from "./object/defaultsDeep.mjs"; +import { findKey } from "./object/findKey.mjs"; +import { findLastKey } from "./object/findLastKey.mjs"; +import { forIn } from "./object/forIn.mjs"; +import { forInRight } from "./object/forInRight.mjs"; +import { forOwn } from "./object/forOwn.mjs"; +import { forOwnRight } from "./object/forOwnRight.mjs"; +import { fromPairs } from "./object/fromPairs.mjs"; +import { functions } from "./object/functions.mjs"; +import { functionsIn } from "./object/functionsIn.mjs"; +import { get } from "./object/get.mjs"; +import { has } from "./object/has.mjs"; +import { hasIn } from "./object/hasIn.mjs"; +import { invert } from "./object/invert.mjs"; +import { invertBy } from "./object/invertBy.mjs"; +import { keys } from "./object/keys.mjs"; +import { keysIn } from "./object/keysIn.mjs"; +import { mapKeys } from "./object/mapKeys.mjs"; +import { mapValues } from "./object/mapValues.mjs"; +import { merge } from "./object/merge.mjs"; +import { mergeWith } from "./object/mergeWith.mjs"; +import { omit } from "./object/omit.mjs"; +import { omitBy } from "./object/omitBy.mjs"; +import { pick } from "./object/pick.mjs"; +import { pickBy } from "./object/pickBy.mjs"; +import { property } from "./object/property.mjs"; +import { propertyOf } from "./object/propertyOf.mjs"; +import { result } from "./object/result.mjs"; +import { set } from "./object/set.mjs"; +import { setWith } from "./object/setWith.mjs"; +import { toDefaulted } from "./object/toDefaulted.mjs"; +import { toPairs } from "./object/toPairs.mjs"; +import { toPairsIn } from "./object/toPairsIn.mjs"; +import { transform } from "./object/transform.mjs"; +import { unset } from "./object/unset.mjs"; +import { update } from "./object/update.mjs"; +import { updateWith } from "./object/updateWith.mjs"; +import { values } from "./object/values.mjs"; +import { valuesIn } from "./object/valuesIn.mjs"; +import { isFunction } from "./predicate/isFunction.mjs"; +import { isLength } from "./predicate/isLength.mjs"; +import { isMatchWith } from "./predicate/isMatchWith.mjs"; +import { isNative } from "./predicate/isNative.mjs"; +import { isNull } from "./predicate/isNull.mjs"; +import { isUndefined } from "./predicate/isUndefined.mjs"; +import { conforms } from "./predicate/conforms.mjs"; +import { conformsTo } from "./predicate/conformsTo.mjs"; +import { isArguments } from "./predicate/isArguments.mjs"; +import { isArray } from "./predicate/isArray.mjs"; +import { isArrayBuffer } from "./predicate/isArrayBuffer.mjs"; +import { isArrayLike } from "./predicate/isArrayLike.mjs"; +import { isArrayLikeObject } from "./predicate/isArrayLikeObject.mjs"; +import { isBoolean } from "./predicate/isBoolean.mjs"; +import { isBuffer } from "./predicate/isBuffer.mjs"; +import { isDate } from "./predicate/isDate.mjs"; +import { isElement } from "./predicate/isElement.mjs"; +import { isEmpty } from "./predicate/isEmpty.mjs"; +import { isEqualWith } from "./predicate/isEqualWith.mjs"; +import { isError } from "./predicate/isError.mjs"; +import { isFinite } from "./predicate/isFinite.mjs"; +import { isInteger } from "./predicate/isInteger.mjs"; +import { isMap } from "./predicate/isMap.mjs"; +import { isMatch } from "./predicate/isMatch.mjs"; +import { isNaN } from "./predicate/isNaN.mjs"; +import { isNil } from "./predicate/isNil.mjs"; +import { isNumber } from "./predicate/isNumber.mjs"; +import { isObject } from "./predicate/isObject.mjs"; +import { isObjectLike } from "./predicate/isObjectLike.mjs"; +import { isPlainObject } from "./predicate/isPlainObject.mjs"; +import { isRegExp } from "./predicate/isRegExp.mjs"; +import { isSafeInteger } from "./predicate/isSafeInteger.mjs"; +import { isSet } from "./predicate/isSet.mjs"; +import { isString } from "./predicate/isString.mjs"; +import { isSymbol } from "./predicate/isSymbol.mjs"; +import { isTypedArray } from "./predicate/isTypedArray.mjs"; +import { isWeakMap } from "./predicate/isWeakMap.mjs"; +import { isWeakSet } from "./predicate/isWeakSet.mjs"; +import { matches } from "./predicate/matches.mjs"; +import { matchesProperty } from "./predicate/matchesProperty.mjs"; +import { capitalize } from "./string/capitalize.mjs"; +import { bindAll } from "./util/bindAll.mjs"; +import { camelCase } from "./string/camelCase.mjs"; +import { deburr } from "./string/deburr.mjs"; +import { endsWith } from "./string/endsWith.mjs"; +import { escape } from "./string/escape.mjs"; +import { escapeRegExp } from "./string/escapeRegExp.mjs"; +import { kebabCase } from "./string/kebabCase.mjs"; +import { lowerCase } from "./string/lowerCase.mjs"; +import { lowerFirst } from "./string/lowerFirst.mjs"; +import { pad } from "./string/pad.mjs"; +import { padEnd } from "./string/padEnd.mjs"; +import { padStart } from "./string/padStart.mjs"; +import { repeat } from "./string/repeat.mjs"; +import { replace } from "./string/replace.mjs"; +import { snakeCase } from "./string/snakeCase.mjs"; +import { split } from "./string/split.mjs"; +import { startCase } from "./string/startCase.mjs"; +import { startsWith } from "./string/startsWith.mjs"; +import { template, templateSettings } from "./string/template.mjs"; +import { toLower } from "./string/toLower.mjs"; +import { toUpper } from "./string/toUpper.mjs"; +import { trim } from "./string/trim.mjs"; +import { trimEnd } from "./string/trimEnd.mjs"; +import { trimStart } from "./string/trimStart.mjs"; +import { truncate } from "./string/truncate.mjs"; +import { unescape } from "./string/unescape.mjs"; +import { upperCase } from "./string/upperCase.mjs"; +import { upperFirst } from "./string/upperFirst.mjs"; +import { words } from "./string/words.mjs"; +import { cond } from "./util/cond.mjs"; +import { constant } from "./util/constant.mjs"; +import { defaultTo } from "./util/defaultTo.mjs"; +import { isEqualsSameValueZero } from "../_internal/isEqualsSameValueZero.mjs"; +import { gt } from "./util/gt.mjs"; +import { gte } from "./util/gte.mjs"; +import { invoke } from "./util/invoke.mjs"; +import { iteratee } from "./util/iteratee.mjs"; +import { lt } from "./util/lt.mjs"; +import { lte } from "./util/lte.mjs"; +import { method } from "./util/method.mjs"; +import { methodOf } from "./util/methodOf.mjs"; +import { now } from "./util/now.mjs"; +import { over } from "./util/over.mjs"; +import { overEvery } from "./util/overEvery.mjs"; +import { overSome } from "./util/overSome.mjs"; +import { stubArray } from "./util/stubArray.mjs"; +import { stubFalse } from "./util/stubFalse.mjs"; +import { stubObject } from "./util/stubObject.mjs"; +import { stubString } from "./util/stubString.mjs"; +import { stubTrue } from "./util/stubTrue.mjs"; +import { times } from "./util/times.mjs"; +import { toArray } from "./util/toArray.mjs"; +import { toFinite } from "./util/toFinite.mjs"; +import { toInteger } from "./util/toInteger.mjs"; +import { toLength } from "./util/toLength.mjs"; +import { toNumber } from "./util/toNumber.mjs"; +import { toPath } from "./util/toPath.mjs"; +import { toPlainObject } from "./util/toPlainObject.mjs"; +import { toSafeInteger } from "./util/toSafeInteger.mjs"; +import { toString } from "./util/toString.mjs"; +import { uniqueId } from "./util/uniqueId.mjs"; +export { DebouncedFunc, add, after, ary, assign, assignIn, assignInWith, assignWith, at, attempt, before, bind, bindAll, bindKey, camelCase, capitalize, castArray, ceil, chunk, clamp, clone, cloneDeep, cloneDeepWith, cloneWith, compact, concat, cond, conforms, conformsTo, constant, countBy, create, curry, curryRight, debounce, deburr, toolkit as default, defaultTo, defaults, defaultsDeep, defer, delay, difference, differenceBy, differenceWith, divide, drop, dropRight, dropRightWhile, dropWhile, forEach as each, forEachRight as eachRight, endsWith, isEqualsSameValueZero as eq, escape, escapeRegExp, every, assignIn as extend, assignInWith as extendWith, fill, filter, find, findIndex, findKey, findLast, findLastIndex, findLastKey, head as first, flatMap, flatMapDeep, flatMapDepth, flatten, flattenDeep, flattenDepth, flip, floor, flow, flowRight, forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, fromPairs, functions, functionsIn, get, groupBy, gt, gte, has, hasIn, head, identity, inRange, includes, indexOf, initial, intersection, intersectionBy, intersectionWith, invert, invertBy, invoke, invokeMap, isArguments, isArray, isArrayBuffer, isArrayLike, isArrayLikeObject, isBoolean, isBuffer, isDate, isElement, isEmpty, isEqual, isEqualWith, isError, isFinite, isFunction, isInteger, isLength, isMap, isMatch, isMatchWith, isNaN, isNative, isNil, isNull, isNumber, isObject, isObjectLike, isPlainObject, isRegExp, isSafeInteger, isSet, isString, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet, iteratee, join, kebabCase, keyBy, keys, keysIn, last, lastIndexOf, lowerCase, lowerFirst, lt, lte, map, mapKeys, mapValues, matches, matchesProperty, max, maxBy, mean, meanBy, memoize, merge, mergeWith, method, methodOf, min, minBy, multiply, negate, noop, now, nth, nthArg, omit, omitBy, once, orderBy, over, overArgs, overEvery, overSome, pad, padEnd, padStart, parseInt, partial, partialRight, partition, pick, pickBy, property, propertyOf, pull, pullAll, pullAllBy, pullAllWith, pullAt, random, range, rangeRight, rearg, reduce, reduceRight, reject, remove, repeat, replace, rest, result, reverse, round, sample, sampleSize, set, setWith, shuffle, size, slice, snakeCase, some, sortBy, sortedIndex, sortedIndexBy, sortedIndexOf, sortedLastIndex, sortedLastIndexBy, sortedLastIndexOf, split, spread, startCase, startsWith, stubArray, stubFalse, stubObject, stubString, stubTrue, subtract, sum, sumBy, tail, take, takeRight, takeRightWhile, takeWhile, template, templateSettings, throttle, times, toArray, toDefaulted, toFinite, toInteger, toLength, toLower, toNumber, toPairs, toPairsIn, toPath, toPlainObject, toSafeInteger, toString, toUpper, transform, trim, trimEnd, trimStart, truncate, unary, unescape, union, unionBy, unionWith, uniq, uniqBy, uniqWith, uniqueId, unset, unzip, unzipWith, update, updateWith, upperCase, upperFirst, values, valuesIn, without, words, wrap, xor, xorBy, xorWith, zip, zipObject, zipObjectDeep, zipWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/index.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8f8e87353f1f441e62190281f5b24d980fdf78f3 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/index.d.ts @@ -0,0 +1,293 @@ +import { castArray } from "./array/castArray.js"; +import { chunk } from "./array/chunk.js"; +import { compact } from "./array/compact.js"; +import { concat } from "./array/concat.js"; +import { countBy } from "./array/countBy.js"; +import { difference } from "./array/difference.js"; +import { differenceBy } from "./array/differenceBy.js"; +import { differenceWith } from "./array/differenceWith.js"; +import { drop } from "./array/drop.js"; +import { dropRight } from "./array/dropRight.js"; +import { dropRightWhile } from "./array/dropRightWhile.js"; +import { dropWhile } from "./array/dropWhile.js"; +import { forEach } from "./array/forEach.js"; +import { forEachRight } from "./array/forEachRight.js"; +import { every } from "./array/every.js"; +import { fill } from "./array/fill.js"; +import { filter } from "./array/filter.js"; +import { find } from "./array/find.js"; +import { findIndex } from "./array/findIndex.js"; +import { findLast } from "./array/findLast.js"; +import { findLastIndex } from "./array/findLastIndex.js"; +import { head } from "./array/head.js"; +import { flatMap } from "./array/flatMap.js"; +import { flatMapDeep } from "./array/flatMapDeep.js"; +import { flatMapDepth } from "./array/flatMapDepth.js"; +import { flatten } from "./array/flatten.js"; +import { flattenDeep } from "./array/flattenDeep.js"; +import { flattenDepth } from "./array/flattenDepth.js"; +import { groupBy } from "./array/groupBy.js"; +import { includes } from "./array/includes.js"; +import { indexOf } from "./array/indexOf.js"; +import { initial } from "./array/initial.js"; +import { intersection } from "./array/intersection.js"; +import { intersectionBy } from "./array/intersectionBy.js"; +import { intersectionWith } from "./array/intersectionWith.js"; +import { invokeMap } from "./array/invokeMap.js"; +import { join } from "./array/join.js"; +import { keyBy } from "./array/keyBy.js"; +import { last } from "./array/last.js"; +import { lastIndexOf } from "./array/lastIndexOf.js"; +import { map } from "./array/map.js"; +import { nth } from "./array/nth.js"; +import { orderBy } from "./array/orderBy.js"; +import { partition } from "./array/partition.js"; +import { pull } from "./array/pull.js"; +import { pullAll } from "./array/pullAll.js"; +import { pullAllBy } from "./array/pullAllBy.js"; +import { pullAllWith } from "./array/pullAllWith.js"; +import { pullAt } from "./array/pullAt.js"; +import { reduce } from "./array/reduce.js"; +import { reduceRight } from "./array/reduceRight.js"; +import { reject } from "./array/reject.js"; +import { remove } from "./array/remove.js"; +import { reverse } from "./array/reverse.js"; +import { sample } from "./array/sample.js"; +import { sampleSize } from "./array/sampleSize.js"; +import { shuffle } from "./array/shuffle.js"; +import { size } from "./array/size.js"; +import { slice } from "./array/slice.js"; +import { some } from "./array/some.js"; +import { sortBy } from "./array/sortBy.js"; +import { sortedIndex } from "./array/sortedIndex.js"; +import { sortedIndexBy } from "./array/sortedIndexBy.js"; +import { sortedIndexOf } from "./array/sortedIndexOf.js"; +import { sortedLastIndex } from "./array/sortedLastIndex.js"; +import { sortedLastIndexBy } from "./array/sortedLastIndexBy.js"; +import { sortedLastIndexOf } from "./array/sortedLastIndexOf.js"; +import { tail } from "./array/tail.js"; +import { take } from "./array/take.js"; +import { takeRight } from "./array/takeRight.js"; +import { takeRightWhile } from "./array/takeRightWhile.js"; +import { takeWhile } from "./array/takeWhile.js"; +import { union } from "./array/union.js"; +import { unionBy } from "./array/unionBy.js"; +import { unionWith } from "./array/unionWith.js"; +import { uniq } from "./array/uniq.js"; +import { uniqBy } from "./array/uniqBy.js"; +import { uniqWith } from "./array/uniqWith.js"; +import { unzip } from "./array/unzip.js"; +import { unzipWith } from "./array/unzipWith.js"; +import { without } from "./array/without.js"; +import { xor } from "./array/xor.js"; +import { xorBy } from "./array/xorBy.js"; +import { xorWith } from "./array/xorWith.js"; +import { zip } from "./array/zip.js"; +import { zipObject } from "./array/zipObject.js"; +import { zipObjectDeep } from "./array/zipObjectDeep.js"; +import { zipWith } from "./array/zipWith.js"; +import { after } from "./function/after.js"; +import { ary } from "./function/ary.js"; +import { attempt } from "./function/attempt.js"; +import { before } from "./function/before.js"; +import { bind } from "./function/bind.js"; +import { bindKey } from "./function/bindKey.js"; +import { curry } from "./function/curry.js"; +import { curryRight } from "./function/curryRight.js"; +import { DebouncedFunc, debounce } from "./function/debounce.js"; +import { defer } from "./function/defer.js"; +import { delay } from "./function/delay.js"; +import { flip } from "./function/flip.js"; +import { flow } from "./function/flow.js"; +import { flowRight } from "./function/flowRight.js"; +import { memoize } from "./function/memoize.js"; +import { negate } from "./function/negate.js"; +import { nthArg } from "./function/nthArg.js"; +import { once } from "./function/once.js"; +import { overArgs } from "./function/overArgs.js"; +import { toolkit } from "./toolkit.js"; +import { partial } from "./function/partial.js"; +import { partialRight } from "./function/partialRight.js"; +import { rearg } from "./function/rearg.js"; +import { rest } from "./function/rest.js"; +import { spread } from "./function/spread.js"; +import { throttle } from "./function/throttle.js"; +import { unary } from "./function/unary.js"; +import { wrap } from "./function/wrap.js"; +import { add } from "./math/add.js"; +import { ceil } from "./math/ceil.js"; +import { clamp } from "./math/clamp.js"; +import { divide } from "./math/divide.js"; +import { floor } from "./math/floor.js"; +import { inRange } from "./math/inRange.js"; +import { max } from "./math/max.js"; +import { maxBy } from "./math/maxBy.js"; +import { mean } from "./math/mean.js"; +import { meanBy } from "./math/meanBy.js"; +import { min } from "./math/min.js"; +import { minBy } from "./math/minBy.js"; +import { multiply } from "./math/multiply.js"; +import { parseInt } from "./math/parseInt.js"; +import { random } from "./math/random.js"; +import { range } from "./math/range.js"; +import { rangeRight } from "./math/rangeRight.js"; +import { round } from "./math/round.js"; +import { subtract } from "./math/subtract.js"; +import { sum } from "./math/sum.js"; +import { sumBy } from "./math/sumBy.js"; +import { isEqual } from "../predicate/isEqual.js"; +import { identity } from "./function/identity.js"; +import { noop } from "./function/noop.js"; +import { assign } from "./object/assign.js"; +import { assignIn } from "./object/assignIn.js"; +import { assignInWith } from "./object/assignInWith.js"; +import { assignWith } from "./object/assignWith.js"; +import { at } from "./object/at.js"; +import { clone } from "./object/clone.js"; +import { cloneDeep } from "./object/cloneDeep.js"; +import { cloneDeepWith } from "./object/cloneDeepWith.js"; +import { cloneWith } from "./object/cloneWith.js"; +import { create } from "./object/create.js"; +import { defaults } from "./object/defaults.js"; +import { defaultsDeep } from "./object/defaultsDeep.js"; +import { findKey } from "./object/findKey.js"; +import { findLastKey } from "./object/findLastKey.js"; +import { forIn } from "./object/forIn.js"; +import { forInRight } from "./object/forInRight.js"; +import { forOwn } from "./object/forOwn.js"; +import { forOwnRight } from "./object/forOwnRight.js"; +import { fromPairs } from "./object/fromPairs.js"; +import { functions } from "./object/functions.js"; +import { functionsIn } from "./object/functionsIn.js"; +import { get } from "./object/get.js"; +import { has } from "./object/has.js"; +import { hasIn } from "./object/hasIn.js"; +import { invert } from "./object/invert.js"; +import { invertBy } from "./object/invertBy.js"; +import { keys } from "./object/keys.js"; +import { keysIn } from "./object/keysIn.js"; +import { mapKeys } from "./object/mapKeys.js"; +import { mapValues } from "./object/mapValues.js"; +import { merge } from "./object/merge.js"; +import { mergeWith } from "./object/mergeWith.js"; +import { omit } from "./object/omit.js"; +import { omitBy } from "./object/omitBy.js"; +import { pick } from "./object/pick.js"; +import { pickBy } from "./object/pickBy.js"; +import { property } from "./object/property.js"; +import { propertyOf } from "./object/propertyOf.js"; +import { result } from "./object/result.js"; +import { set } from "./object/set.js"; +import { setWith } from "./object/setWith.js"; +import { toDefaulted } from "./object/toDefaulted.js"; +import { toPairs } from "./object/toPairs.js"; +import { toPairsIn } from "./object/toPairsIn.js"; +import { transform } from "./object/transform.js"; +import { unset } from "./object/unset.js"; +import { update } from "./object/update.js"; +import { updateWith } from "./object/updateWith.js"; +import { values } from "./object/values.js"; +import { valuesIn } from "./object/valuesIn.js"; +import { isFunction } from "./predicate/isFunction.js"; +import { isLength } from "./predicate/isLength.js"; +import { isMatchWith } from "./predicate/isMatchWith.js"; +import { isNative } from "./predicate/isNative.js"; +import { isNull } from "./predicate/isNull.js"; +import { isUndefined } from "./predicate/isUndefined.js"; +import { conforms } from "./predicate/conforms.js"; +import { conformsTo } from "./predicate/conformsTo.js"; +import { isArguments } from "./predicate/isArguments.js"; +import { isArray } from "./predicate/isArray.js"; +import { isArrayBuffer } from "./predicate/isArrayBuffer.js"; +import { isArrayLike } from "./predicate/isArrayLike.js"; +import { isArrayLikeObject } from "./predicate/isArrayLikeObject.js"; +import { isBoolean } from "./predicate/isBoolean.js"; +import { isBuffer } from "./predicate/isBuffer.js"; +import { isDate } from "./predicate/isDate.js"; +import { isElement } from "./predicate/isElement.js"; +import { isEmpty } from "./predicate/isEmpty.js"; +import { isEqualWith } from "./predicate/isEqualWith.js"; +import { isError } from "./predicate/isError.js"; +import { isFinite } from "./predicate/isFinite.js"; +import { isInteger } from "./predicate/isInteger.js"; +import { isMap } from "./predicate/isMap.js"; +import { isMatch } from "./predicate/isMatch.js"; +import { isNaN } from "./predicate/isNaN.js"; +import { isNil } from "./predicate/isNil.js"; +import { isNumber } from "./predicate/isNumber.js"; +import { isObject } from "./predicate/isObject.js"; +import { isObjectLike } from "./predicate/isObjectLike.js"; +import { isPlainObject } from "./predicate/isPlainObject.js"; +import { isRegExp } from "./predicate/isRegExp.js"; +import { isSafeInteger } from "./predicate/isSafeInteger.js"; +import { isSet } from "./predicate/isSet.js"; +import { isString } from "./predicate/isString.js"; +import { isSymbol } from "./predicate/isSymbol.js"; +import { isTypedArray } from "./predicate/isTypedArray.js"; +import { isWeakMap } from "./predicate/isWeakMap.js"; +import { isWeakSet } from "./predicate/isWeakSet.js"; +import { matches } from "./predicate/matches.js"; +import { matchesProperty } from "./predicate/matchesProperty.js"; +import { capitalize } from "./string/capitalize.js"; +import { bindAll } from "./util/bindAll.js"; +import { camelCase } from "./string/camelCase.js"; +import { deburr } from "./string/deburr.js"; +import { endsWith } from "./string/endsWith.js"; +import { escape } from "./string/escape.js"; +import { escapeRegExp } from "./string/escapeRegExp.js"; +import { kebabCase } from "./string/kebabCase.js"; +import { lowerCase } from "./string/lowerCase.js"; +import { lowerFirst } from "./string/lowerFirst.js"; +import { pad } from "./string/pad.js"; +import { padEnd } from "./string/padEnd.js"; +import { padStart } from "./string/padStart.js"; +import { repeat } from "./string/repeat.js"; +import { replace } from "./string/replace.js"; +import { snakeCase } from "./string/snakeCase.js"; +import { split } from "./string/split.js"; +import { startCase } from "./string/startCase.js"; +import { startsWith } from "./string/startsWith.js"; +import { template, templateSettings } from "./string/template.js"; +import { toLower } from "./string/toLower.js"; +import { toUpper } from "./string/toUpper.js"; +import { trim } from "./string/trim.js"; +import { trimEnd } from "./string/trimEnd.js"; +import { trimStart } from "./string/trimStart.js"; +import { truncate } from "./string/truncate.js"; +import { unescape } from "./string/unescape.js"; +import { upperCase } from "./string/upperCase.js"; +import { upperFirst } from "./string/upperFirst.js"; +import { words } from "./string/words.js"; +import { cond } from "./util/cond.js"; +import { constant } from "./util/constant.js"; +import { defaultTo } from "./util/defaultTo.js"; +import { isEqualsSameValueZero } from "../_internal/isEqualsSameValueZero.js"; +import { gt } from "./util/gt.js"; +import { gte } from "./util/gte.js"; +import { invoke } from "./util/invoke.js"; +import { iteratee } from "./util/iteratee.js"; +import { lt } from "./util/lt.js"; +import { lte } from "./util/lte.js"; +import { method } from "./util/method.js"; +import { methodOf } from "./util/methodOf.js"; +import { now } from "./util/now.js"; +import { over } from "./util/over.js"; +import { overEvery } from "./util/overEvery.js"; +import { overSome } from "./util/overSome.js"; +import { stubArray } from "./util/stubArray.js"; +import { stubFalse } from "./util/stubFalse.js"; +import { stubObject } from "./util/stubObject.js"; +import { stubString } from "./util/stubString.js"; +import { stubTrue } from "./util/stubTrue.js"; +import { times } from "./util/times.js"; +import { toArray } from "./util/toArray.js"; +import { toFinite } from "./util/toFinite.js"; +import { toInteger } from "./util/toInteger.js"; +import { toLength } from "./util/toLength.js"; +import { toNumber } from "./util/toNumber.js"; +import { toPath } from "./util/toPath.js"; +import { toPlainObject } from "./util/toPlainObject.js"; +import { toSafeInteger } from "./util/toSafeInteger.js"; +import { toString } from "./util/toString.js"; +import { uniqueId } from "./util/uniqueId.js"; +export { DebouncedFunc, add, after, ary, assign, assignIn, assignInWith, assignWith, at, attempt, before, bind, bindAll, bindKey, camelCase, capitalize, castArray, ceil, chunk, clamp, clone, cloneDeep, cloneDeepWith, cloneWith, compact, concat, cond, conforms, conformsTo, constant, countBy, create, curry, curryRight, debounce, deburr, toolkit as default, defaultTo, defaults, defaultsDeep, defer, delay, difference, differenceBy, differenceWith, divide, drop, dropRight, dropRightWhile, dropWhile, forEach as each, forEachRight as eachRight, endsWith, isEqualsSameValueZero as eq, escape, escapeRegExp, every, assignIn as extend, assignInWith as extendWith, fill, filter, find, findIndex, findKey, findLast, findLastIndex, findLastKey, head as first, flatMap, flatMapDeep, flatMapDepth, flatten, flattenDeep, flattenDepth, flip, floor, flow, flowRight, forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, fromPairs, functions, functionsIn, get, groupBy, gt, gte, has, hasIn, head, identity, inRange, includes, indexOf, initial, intersection, intersectionBy, intersectionWith, invert, invertBy, invoke, invokeMap, isArguments, isArray, isArrayBuffer, isArrayLike, isArrayLikeObject, isBoolean, isBuffer, isDate, isElement, isEmpty, isEqual, isEqualWith, isError, isFinite, isFunction, isInteger, isLength, isMap, isMatch, isMatchWith, isNaN, isNative, isNil, isNull, isNumber, isObject, isObjectLike, isPlainObject, isRegExp, isSafeInteger, isSet, isString, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet, iteratee, join, kebabCase, keyBy, keys, keysIn, last, lastIndexOf, lowerCase, lowerFirst, lt, lte, map, mapKeys, mapValues, matches, matchesProperty, max, maxBy, mean, meanBy, memoize, merge, mergeWith, method, methodOf, min, minBy, multiply, negate, noop, now, nth, nthArg, omit, omitBy, once, orderBy, over, overArgs, overEvery, overSome, pad, padEnd, padStart, parseInt, partial, partialRight, partition, pick, pickBy, property, propertyOf, pull, pullAll, pullAllBy, pullAllWith, pullAt, random, range, rangeRight, rearg, reduce, reduceRight, reject, remove, repeat, replace, rest, result, reverse, round, sample, sampleSize, set, setWith, shuffle, size, slice, snakeCase, some, sortBy, sortedIndex, sortedIndexBy, sortedIndexOf, sortedLastIndex, sortedLastIndexBy, sortedLastIndexOf, split, spread, startCase, startsWith, stubArray, stubFalse, stubObject, stubString, stubTrue, subtract, sum, sumBy, tail, take, takeRight, takeRightWhile, takeWhile, template, templateSettings, throttle, times, toArray, toDefaulted, toFinite, toInteger, toLength, toLower, toNumber, toPairs, toPairsIn, toPath, toPlainObject, toSafeInteger, toString, toUpper, transform, trim, trimEnd, trimStart, truncate, unary, unescape, union, unionBy, unionWith, uniq, uniqBy, uniqWith, uniqueId, unset, unzip, unzipWith, update, updateWith, upperCase, upperFirst, values, valuesIn, without, words, wrap, xor, xorBy, xorWith, zip, zipObject, zipObjectDeep, zipWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/index.js b/tools/ui/node_modules/es-toolkit/dist/compat/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d7f90abc3212edf9429ec18f1ad1891ab6ab3e1a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/index.js @@ -0,0 +1,595 @@ +Object.defineProperties(exports, { + __esModule: { value: true }, + [Symbol.toStringTag]: { value: "Module" } +}); +const require_isSymbol = require("./predicate/isSymbol.js"); +const require_toNumber = require("./util/toNumber.js"); +const require_toFinite = require("./util/toFinite.js"); +const require_toInteger = require("./util/toInteger.js"); +const require_isArray = require("./predicate/isArray.js"); +const require_isPlainObject = require("./predicate/isPlainObject.js"); +const require_isEqualsSameValueZero = require("../_internal/isEqualsSameValueZero.js"); +const require_isEqual = require("../predicate/isEqual.js"); +const require_castArray = require("./array/castArray.js"); +const require_isArrayLike = require("./predicate/isArrayLike.js"); +const require_chunk = require("./array/chunk.js"); +const require_compact = require("./array/compact.js"); +const require_concat = require("./array/concat.js"); +const require_toString = require("./util/toString.js"); +const require_toPath = require("./util/toPath.js"); +const require_get = require("./object/get.js"); +const require_property = require("./object/property.js"); +const require_isObject = require("./predicate/isObject.js"); +const require_isMatchWith = require("./predicate/isMatchWith.js"); +const require_isMatch = require("./predicate/isMatch.js"); +const require_matches = require("./predicate/matches.js"); +const require_cloneDeepWith = require("./object/cloneDeepWith.js"); +const require_cloneDeep = require("./object/cloneDeep.js"); +const require_isArguments = require("./predicate/isArguments.js"); +const require_has = require("./object/has.js"); +const require_matchesProperty = require("./predicate/matchesProperty.js"); +const require_iteratee = require("./util/iteratee.js"); +const require_countBy = require("./array/countBy.js"); +const require_isObjectLike = require("./predicate/isObjectLike.js"); +const require_isArrayLikeObject = require("./predicate/isArrayLikeObject.js"); +const require_difference = require("./array/difference.js"); +const require_last = require("./array/last.js"); +const require_differenceBy = require("./array/differenceBy.js"); +const require_differenceWith = require("./array/differenceWith.js"); +const require_drop = require("./array/drop.js"); +const require_dropRight = require("./array/dropRight.js"); +const require_dropRightWhile = require("./array/dropRightWhile.js"); +const require_dropWhile = require("./array/dropWhile.js"); +const require_forEach = require("./array/forEach.js"); +const require_forEachRight = require("./array/forEachRight.js"); +const require_every = require("./array/every.js"); +const require_isString = require("./predicate/isString.js"); +const require_fill = require("./array/fill.js"); +const require_filter = require("./array/filter.js"); +const require_find = require("./array/find.js"); +const require_identity = require("./function/identity.js"); +const require_findIndex = require("./array/findIndex.js"); +const require_findLast = require("./array/findLast.js"); +const require_findLastIndex = require("./array/findLastIndex.js"); +const require_head = require("./array/head.js"); +const require_flatten = require("./array/flatten.js"); +const require_flattenDepth = require("./array/flattenDepth.js"); +const require_map = require("./array/map.js"); +const require_flatMap = require("./array/flatMap.js"); +const require_flatMapDepth = require("./array/flatMapDepth.js"); +const require_flatMapDeep = require("./array/flatMapDeep.js"); +const require_flattenDeep = require("./array/flattenDeep.js"); +const require_groupBy = require("./array/groupBy.js"); +const require_includes = require("./array/includes.js"); +const require_indexOf = require("./array/indexOf.js"); +const require_initial = require("./array/initial.js"); +const require_intersection = require("./array/intersection.js"); +const require_intersectionBy = require("./array/intersectionBy.js"); +const require_uniq = require("./array/uniq.js"); +const require_intersectionWith = require("./array/intersectionWith.js"); +const require_invokeMap = require("./array/invokeMap.js"); +const require_join = require("./array/join.js"); +const require_reduce = require("./array/reduce.js"); +const require_keyBy = require("./array/keyBy.js"); +const require_lastIndexOf = require("./array/lastIndexOf.js"); +const require_nth = require("./array/nth.js"); +const require_orderBy = require("./array/orderBy.js"); +const require_partition = require("./array/partition.js"); +const require_pull = require("./array/pull.js"); +const require_pullAll = require("./array/pullAll.js"); +const require_pullAllBy = require("./array/pullAllBy.js"); +const require_pullAllWith = require("./array/pullAllWith.js"); +const require_at = require("./object/at.js"); +const require_unset = require("./object/unset.js"); +const require_pullAt = require("./array/pullAt.js"); +const require_reduceRight = require("./array/reduceRight.js"); +const require_negate = require("./function/negate.js"); +const require_reject = require("./array/reject.js"); +const require_remove = require("./array/remove.js"); +const require_reverse = require("./array/reverse.js"); +const require_sample = require("./array/sample.js"); +const require_clamp = require("./math/clamp.js"); +const require_isMap = require("./predicate/isMap.js"); +const require_toArray = require("./util/toArray.js"); +const require_sampleSize = require("./array/sampleSize.js"); +const require_values = require("./object/values.js"); +const require_isNil = require("./predicate/isNil.js"); +const require_shuffle = require("./array/shuffle.js"); +const require_size = require("./array/size.js"); +const require_slice = require("./array/slice.js"); +const require_some = require("./array/some.js"); +const require_sortBy = require("./array/sortBy.js"); +const require_isNaN = require("./predicate/isNaN.js"); +const require_sortedIndexBy = require("./array/sortedIndexBy.js"); +const require_isNumber = require("./predicate/isNumber.js"); +const require_sortedIndex = require("./array/sortedIndex.js"); +const require_sortedIndexOf = require("./array/sortedIndexOf.js"); +const require_sortedLastIndexBy = require("./array/sortedLastIndexBy.js"); +const require_sortedLastIndex = require("./array/sortedLastIndex.js"); +const require_sortedLastIndexOf = require("./array/sortedLastIndexOf.js"); +const require_tail = require("./array/tail.js"); +const require_take = require("./array/take.js"); +const require_takeRight = require("./array/takeRight.js"); +const require_takeRightWhile = require("./array/takeRightWhile.js"); +const require_takeWhile = require("./array/takeWhile.js"); +const require_union = require("./array/union.js"); +const require_unionBy = require("./array/unionBy.js"); +const require_unionWith = require("./array/unionWith.js"); +const require_uniqBy = require("./array/uniqBy.js"); +const require_uniqWith = require("./array/uniqWith.js"); +const require_unzip = require("./array/unzip.js"); +const require_unzipWith = require("./array/unzipWith.js"); +const require_without = require("./array/without.js"); +const require_xor = require("./array/xor.js"); +const require_xorBy = require("./array/xorBy.js"); +const require_xorWith = require("./array/xorWith.js"); +const require_zip = require("./array/zip.js"); +const require_zipObject = require("./array/zipObject.js"); +const require_updateWith = require("./object/updateWith.js"); +const require_set = require("./object/set.js"); +const require_zipObjectDeep = require("./array/zipObjectDeep.js"); +const require_zipWith = require("./array/zipWith.js"); +const require_after = require("./function/after.js"); +const require_ary = require("./function/ary.js"); +const require_attempt = require("./function/attempt.js"); +const require_before = require("./function/before.js"); +const require_bind = require("./function/bind.js"); +const require_bindKey = require("./function/bindKey.js"); +const require_curry = require("./function/curry.js"); +const require_curryRight = require("./function/curryRight.js"); +const require_debounce = require("./function/debounce.js"); +const require_defer = require("./function/defer.js"); +const require_delay = require("./function/delay.js"); +const require_flip = require("./function/flip.js"); +const require_flow = require("./function/flow.js"); +const require_flowRight = require("./function/flowRight.js"); +const require_memoize = require("./function/memoize.js"); +const require_nthArg = require("./function/nthArg.js"); +const require_once = require("./function/once.js"); +const require_overArgs = require("./function/overArgs.js"); +const require_partial = require("./function/partial.js"); +const require_partialRight = require("./function/partialRight.js"); +const require_rearg = require("./function/rearg.js"); +const require_rest = require("./function/rest.js"); +const require_spread = require("./function/spread.js"); +const require_throttle = require("./function/throttle.js"); +const require_unary = require("./function/unary.js"); +const require_wrap = require("./function/wrap.js"); +const require_add = require("./math/add.js"); +const require_ceil = require("./math/ceil.js"); +const require_divide = require("./math/divide.js"); +const require_floor = require("./math/floor.js"); +const require_inRange = require("./math/inRange.js"); +const require_max = require("./math/max.js"); +const require_maxBy = require("./math/maxBy.js"); +const require_sumBy = require("./math/sumBy.js"); +const require_sum = require("./math/sum.js"); +const require_mean = require("./math/mean.js"); +const require_meanBy = require("./math/meanBy.js"); +const require_min = require("./math/min.js"); +const require_minBy = require("./math/minBy.js"); +const require_multiply = require("./math/multiply.js"); +const require_parseInt = require("./math/parseInt.js"); +const require_random = require("./math/random.js"); +const require_range = require("./math/range.js"); +const require_rangeRight = require("./math/rangeRight.js"); +const require_round = require("./math/round.js"); +const require_subtract = require("./math/subtract.js"); +const require_noop = require("./function/noop.js"); +const require_isTypedArray = require("./predicate/isTypedArray.js"); +const require_times = require("./util/times.js"); +const require_keys = require("./object/keys.js"); +const require_assign = require("./object/assign.js"); +const require_keysIn = require("./object/keysIn.js"); +const require_assignIn = require("./object/assignIn.js"); +const require_assignInWith = require("./object/assignInWith.js"); +const require_assignWith = require("./object/assignWith.js"); +const require_clone = require("./object/clone.js"); +const require_cloneWith = require("./object/cloneWith.js"); +const require_create = require("./object/create.js"); +const require_defaults = require("./object/defaults.js"); +const require_defaultsDeep = require("./object/defaultsDeep.js"); +const require_findKey = require("./object/findKey.js"); +const require_findLastKey = require("./object/findLastKey.js"); +const require_forIn = require("./object/forIn.js"); +const require_forInRight = require("./object/forInRight.js"); +const require_forOwn = require("./object/forOwn.js"); +const require_forOwnRight = require("./object/forOwnRight.js"); +const require_fromPairs = require("./object/fromPairs.js"); +const require_functions = require("./object/functions.js"); +const require_functionsIn = require("./object/functionsIn.js"); +const require_hasIn = require("./object/hasIn.js"); +const require_invert = require("./object/invert.js"); +const require_invertBy = require("./object/invertBy.js"); +const require_mapKeys = require("./object/mapKeys.js"); +const require_mapValues = require("./object/mapValues.js"); +const require_mergeWith = require("./object/mergeWith.js"); +const require_merge = require("./object/merge.js"); +const require_omit = require("./object/omit.js"); +const require_omitBy = require("./object/omitBy.js"); +const require_pick = require("./object/pick.js"); +const require_pickBy = require("./object/pickBy.js"); +const require_propertyOf = require("./object/propertyOf.js"); +const require_result = require("./object/result.js"); +const require_setWith = require("./object/setWith.js"); +const require_toDefaulted = require("./object/toDefaulted.js"); +const require_toPairs = require("./object/toPairs.js"); +const require_toPairsIn = require("./object/toPairsIn.js"); +const require_isBuffer = require("./predicate/isBuffer.js"); +const require_transform = require("./object/transform.js"); +const require_update = require("./object/update.js"); +const require_valuesIn = require("./object/valuesIn.js"); +const require_isFunction = require("./predicate/isFunction.js"); +const require_isLength = require("./predicate/isLength.js"); +const require_isNative = require("./predicate/isNative.js"); +const require_isNull = require("./predicate/isNull.js"); +const require_isUndefined = require("./predicate/isUndefined.js"); +const require_conformsTo = require("./predicate/conformsTo.js"); +const require_conforms = require("./predicate/conforms.js"); +const require_isArrayBuffer = require("./predicate/isArrayBuffer.js"); +const require_isBoolean = require("./predicate/isBoolean.js"); +const require_isDate = require("./predicate/isDate.js"); +const require_isElement = require("./predicate/isElement.js"); +const require_isEmpty = require("./predicate/isEmpty.js"); +const require_isEqualWith = require("./predicate/isEqualWith.js"); +const require_isError = require("./predicate/isError.js"); +const require_isFinite = require("./predicate/isFinite.js"); +const require_isInteger = require("./predicate/isInteger.js"); +const require_isRegExp = require("./predicate/isRegExp.js"); +const require_isSafeInteger = require("./predicate/isSafeInteger.js"); +const require_isSet = require("./predicate/isSet.js"); +const require_isWeakMap = require("./predicate/isWeakMap.js"); +const require_isWeakSet = require("./predicate/isWeakSet.js"); +const require_capitalize = require("./string/capitalize.js"); +const require_bindAll = require("./util/bindAll.js"); +const require_deburr = require("./string/deburr.js"); +const require_camelCase = require("./string/camelCase.js"); +const require_endsWith = require("./string/endsWith.js"); +const require_escape = require("./string/escape.js"); +const require_escapeRegExp = require("./string/escapeRegExp.js"); +const require_kebabCase = require("./string/kebabCase.js"); +const require_lowerCase = require("./string/lowerCase.js"); +const require_lowerFirst = require("./string/lowerFirst.js"); +const require_pad = require("./string/pad.js"); +const require_padEnd = require("./string/padEnd.js"); +const require_padStart = require("./string/padStart.js"); +const require_repeat = require("./string/repeat.js"); +const require_replace = require("./string/replace.js"); +const require_snakeCase = require("./string/snakeCase.js"); +const require_split = require("./string/split.js"); +const require_startCase = require("./string/startCase.js"); +const require_startsWith = require("./string/startsWith.js"); +const require_template = require("./string/template.js"); +const require_toLower = require("./string/toLower.js"); +const require_toUpper = require("./string/toUpper.js"); +const require_trim = require("./string/trim.js"); +const require_trimEnd = require("./string/trimEnd.js"); +const require_trimStart = require("./string/trimStart.js"); +const require_truncate = require("./string/truncate.js"); +const require_unescape = require("./string/unescape.js"); +const require_upperCase = require("./string/upperCase.js"); +const require_upperFirst = require("./string/upperFirst.js"); +const require_words = require("./string/words.js"); +const require_cond = require("./util/cond.js"); +const require_constant = require("./util/constant.js"); +const require_defaultTo = require("./util/defaultTo.js"); +const require_gt = require("./util/gt.js"); +const require_gte = require("./util/gte.js"); +const require_invoke = require("./util/invoke.js"); +const require_lt = require("./util/lt.js"); +const require_lte = require("./util/lte.js"); +const require_method = require("./util/method.js"); +const require_methodOf = require("./util/methodOf.js"); +const require_now = require("./util/now.js"); +const require_over = require("./util/over.js"); +const require_overEvery = require("./util/overEvery.js"); +const require_overSome = require("./util/overSome.js"); +const require_stubArray = require("./util/stubArray.js"); +const require_stubFalse = require("./util/stubFalse.js"); +const require_stubObject = require("./util/stubObject.js"); +const require_stubString = require("./util/stubString.js"); +const require_stubTrue = require("./util/stubTrue.js"); +const require_toLength = require("./util/toLength.js"); +const require_toPlainObject = require("./util/toPlainObject.js"); +const require_toSafeInteger = require("./util/toSafeInteger.js"); +const require_uniqueId = require("./util/uniqueId.js"); +require("./compat.js"); +const require_toolkit = require("./toolkit.js"); +exports.add = require_add.add; +exports.after = require_after.after; +exports.ary = require_ary.ary; +exports.assign = require_assign.assign; +exports.assignIn = require_assignIn.assignIn; +exports.assignInWith = require_assignInWith.assignInWith; +exports.assignWith = require_assignWith.assignWith; +exports.at = require_at.at; +exports.attempt = require_attempt.attempt; +exports.before = require_before.before; +exports.bind = require_bind.bind; +exports.bindAll = require_bindAll.bindAll; +exports.bindKey = require_bindKey.bindKey; +exports.camelCase = require_camelCase.camelCase; +exports.capitalize = require_capitalize.capitalize; +exports.castArray = require_castArray.castArray; +exports.ceil = require_ceil.ceil; +exports.chunk = require_chunk.chunk; +exports.clamp = require_clamp.clamp; +exports.clone = require_clone.clone; +exports.cloneDeep = require_cloneDeep.cloneDeep; +exports.cloneDeepWith = require_cloneDeepWith.cloneDeepWith; +exports.cloneWith = require_cloneWith.cloneWith; +exports.compact = require_compact.compact; +exports.concat = require_concat.concat; +exports.cond = require_cond.cond; +exports.conforms = require_conforms.conforms; +exports.conformsTo = require_conformsTo.conformsTo; +exports.constant = require_constant.constant; +exports.countBy = require_countBy.countBy; +exports.create = require_create.create; +exports.curry = require_curry.curry; +exports.curryRight = require_curryRight.curryRight; +exports.debounce = require_debounce.debounce; +exports.deburr = require_deburr.deburr; +exports.default = require_toolkit.toolkit; +exports.defaultTo = require_defaultTo.defaultTo; +exports.defaults = require_defaults.defaults; +exports.defaultsDeep = require_defaultsDeep.defaultsDeep; +exports.defer = require_defer.defer; +exports.delay = require_delay.delay; +exports.difference = require_difference.difference; +exports.differenceBy = require_differenceBy.differenceBy; +exports.differenceWith = require_differenceWith.differenceWith; +exports.divide = require_divide.divide; +exports.drop = require_drop.drop; +exports.dropRight = require_dropRight.dropRight; +exports.dropRightWhile = require_dropRightWhile.dropRightWhile; +exports.dropWhile = require_dropWhile.dropWhile; +exports.each = require_forEach.forEach; +exports.eachRight = require_forEachRight.forEachRight; +exports.endsWith = require_endsWith.endsWith; +exports.eq = require_isEqualsSameValueZero.isEqualsSameValueZero; +exports.escape = require_escape.escape; +exports.escapeRegExp = require_escapeRegExp.escapeRegExp; +exports.every = require_every.every; +exports.extend = require_assignIn.assignIn; +exports.extendWith = require_assignInWith.assignInWith; +exports.fill = require_fill.fill; +exports.filter = require_filter.filter; +exports.find = require_find.find; +exports.findIndex = require_findIndex.findIndex; +exports.findKey = require_findKey.findKey; +exports.findLast = require_findLast.findLast; +exports.findLastIndex = require_findLastIndex.findLastIndex; +exports.findLastKey = require_findLastKey.findLastKey; +exports.first = require_head.head; +exports.flatMap = require_flatMap.flatMap; +exports.flatMapDeep = require_flatMapDeep.flatMapDeep; +exports.flatMapDepth = require_flatMapDepth.flatMapDepth; +exports.flatten = require_flatten.flatten; +exports.flattenDeep = require_flattenDeep.flattenDeep; +exports.flattenDepth = require_flattenDepth.flattenDepth; +exports.flip = require_flip.flip; +exports.floor = require_floor.floor; +exports.flow = require_flow.flow; +exports.flowRight = require_flowRight.flowRight; +exports.forEach = require_forEach.forEach; +exports.forEachRight = require_forEachRight.forEachRight; +exports.forIn = require_forIn.forIn; +exports.forInRight = require_forInRight.forInRight; +exports.forOwn = require_forOwn.forOwn; +exports.forOwnRight = require_forOwnRight.forOwnRight; +exports.fromPairs = require_fromPairs.fromPairs; +exports.functions = require_functions.functions; +exports.functionsIn = require_functionsIn.functionsIn; +exports.get = require_get.get; +exports.groupBy = require_groupBy.groupBy; +exports.gt = require_gt.gt; +exports.gte = require_gte.gte; +exports.has = require_has.has; +exports.hasIn = require_hasIn.hasIn; +exports.head = require_head.head; +exports.identity = require_identity.identity; +exports.inRange = require_inRange.inRange; +exports.includes = require_includes.includes; +exports.indexOf = require_indexOf.indexOf; +exports.initial = require_initial.initial; +exports.intersection = require_intersection.intersection; +exports.intersectionBy = require_intersectionBy.intersectionBy; +exports.intersectionWith = require_intersectionWith.intersectionWith; +exports.invert = require_invert.invert; +exports.invertBy = require_invertBy.invertBy; +exports.invoke = require_invoke.invoke; +exports.invokeMap = require_invokeMap.invokeMap; +exports.isArguments = require_isArguments.isArguments; +exports.isArray = require_isArray.isArray; +exports.isArrayBuffer = require_isArrayBuffer.isArrayBuffer; +exports.isArrayLike = require_isArrayLike.isArrayLike; +exports.isArrayLikeObject = require_isArrayLikeObject.isArrayLikeObject; +exports.isBoolean = require_isBoolean.isBoolean; +exports.isBuffer = require_isBuffer.isBuffer; +exports.isDate = require_isDate.isDate; +exports.isElement = require_isElement.isElement; +exports.isEmpty = require_isEmpty.isEmpty; +exports.isEqual = require_isEqual.isEqual; +exports.isEqualWith = require_isEqualWith.isEqualWith; +exports.isError = require_isError.isError; +exports.isFinite = require_isFinite.isFinite; +exports.isFunction = require_isFunction.isFunction; +exports.isInteger = require_isInteger.isInteger; +exports.isLength = require_isLength.isLength; +exports.isMap = require_isMap.isMap; +exports.isMatch = require_isMatch.isMatch; +exports.isMatchWith = require_isMatchWith.isMatchWith; +exports.isNaN = require_isNaN.isNaN; +exports.isNative = require_isNative.isNative; +exports.isNil = require_isNil.isNil; +exports.isNull = require_isNull.isNull; +exports.isNumber = require_isNumber.isNumber; +exports.isObject = require_isObject.isObject; +exports.isObjectLike = require_isObjectLike.isObjectLike; +exports.isPlainObject = require_isPlainObject.isPlainObject; +exports.isRegExp = require_isRegExp.isRegExp; +exports.isSafeInteger = require_isSafeInteger.isSafeInteger; +exports.isSet = require_isSet.isSet; +exports.isString = require_isString.isString; +exports.isSymbol = require_isSymbol.isSymbol; +exports.isTypedArray = require_isTypedArray.isTypedArray; +exports.isUndefined = require_isUndefined.isUndefined; +exports.isWeakMap = require_isWeakMap.isWeakMap; +exports.isWeakSet = require_isWeakSet.isWeakSet; +exports.iteratee = require_iteratee.iteratee; +exports.join = require_join.join; +exports.kebabCase = require_kebabCase.kebabCase; +exports.keyBy = require_keyBy.keyBy; +exports.keys = require_keys.keys; +exports.keysIn = require_keysIn.keysIn; +exports.last = require_last.last; +exports.lastIndexOf = require_lastIndexOf.lastIndexOf; +exports.lowerCase = require_lowerCase.lowerCase; +exports.lowerFirst = require_lowerFirst.lowerFirst; +exports.lt = require_lt.lt; +exports.lte = require_lte.lte; +exports.map = require_map.map; +exports.mapKeys = require_mapKeys.mapKeys; +exports.mapValues = require_mapValues.mapValues; +exports.matches = require_matches.matches; +exports.matchesProperty = require_matchesProperty.matchesProperty; +exports.max = require_max.max; +exports.maxBy = require_maxBy.maxBy; +exports.mean = require_mean.mean; +exports.meanBy = require_meanBy.meanBy; +exports.memoize = require_memoize.memoize; +exports.merge = require_merge.merge; +exports.mergeWith = require_mergeWith.mergeWith; +exports.method = require_method.method; +exports.methodOf = require_methodOf.methodOf; +exports.min = require_min.min; +exports.minBy = require_minBy.minBy; +exports.multiply = require_multiply.multiply; +exports.negate = require_negate.negate; +exports.noop = require_noop.noop; +exports.now = require_now.now; +exports.nth = require_nth.nth; +exports.nthArg = require_nthArg.nthArg; +exports.omit = require_omit.omit; +exports.omitBy = require_omitBy.omitBy; +exports.once = require_once.once; +exports.orderBy = require_orderBy.orderBy; +exports.over = require_over.over; +exports.overArgs = require_overArgs.overArgs; +exports.overEvery = require_overEvery.overEvery; +exports.overSome = require_overSome.overSome; +exports.pad = require_pad.pad; +exports.padEnd = require_padEnd.padEnd; +exports.padStart = require_padStart.padStart; +exports.parseInt = require_parseInt.parseInt; +exports.partial = require_partial.partial; +exports.partialRight = require_partialRight.partialRight; +exports.partition = require_partition.partition; +exports.pick = require_pick.pick; +exports.pickBy = require_pickBy.pickBy; +exports.property = require_property.property; +exports.propertyOf = require_propertyOf.propertyOf; +exports.pull = require_pull.pull; +exports.pullAll = require_pullAll.pullAll; +exports.pullAllBy = require_pullAllBy.pullAllBy; +exports.pullAllWith = require_pullAllWith.pullAllWith; +exports.pullAt = require_pullAt.pullAt; +exports.random = require_random.random; +exports.range = require_range.range; +exports.rangeRight = require_rangeRight.rangeRight; +exports.rearg = require_rearg.rearg; +exports.reduce = require_reduce.reduce; +exports.reduceRight = require_reduceRight.reduceRight; +exports.reject = require_reject.reject; +exports.remove = require_remove.remove; +exports.repeat = require_repeat.repeat; +exports.replace = require_replace.replace; +exports.rest = require_rest.rest; +exports.result = require_result.result; +exports.reverse = require_reverse.reverse; +exports.round = require_round.round; +exports.sample = require_sample.sample; +exports.sampleSize = require_sampleSize.sampleSize; +exports.set = require_set.set; +exports.setWith = require_setWith.setWith; +exports.shuffle = require_shuffle.shuffle; +exports.size = require_size.size; +exports.slice = require_slice.slice; +exports.snakeCase = require_snakeCase.snakeCase; +exports.some = require_some.some; +exports.sortBy = require_sortBy.sortBy; +exports.sortedIndex = require_sortedIndex.sortedIndex; +exports.sortedIndexBy = require_sortedIndexBy.sortedIndexBy; +exports.sortedIndexOf = require_sortedIndexOf.sortedIndexOf; +exports.sortedLastIndex = require_sortedLastIndex.sortedLastIndex; +exports.sortedLastIndexBy = require_sortedLastIndexBy.sortedLastIndexBy; +exports.sortedLastIndexOf = require_sortedLastIndexOf.sortedLastIndexOf; +exports.split = require_split.split; +exports.spread = require_spread.spread; +exports.startCase = require_startCase.startCase; +exports.startsWith = require_startsWith.startsWith; +exports.stubArray = require_stubArray.stubArray; +exports.stubFalse = require_stubFalse.stubFalse; +exports.stubObject = require_stubObject.stubObject; +exports.stubString = require_stubString.stubString; +exports.stubTrue = require_stubTrue.stubTrue; +exports.subtract = require_subtract.subtract; +exports.sum = require_sum.sum; +exports.sumBy = require_sumBy.sumBy; +exports.tail = require_tail.tail; +exports.take = require_take.take; +exports.takeRight = require_takeRight.takeRight; +exports.takeRightWhile = require_takeRightWhile.takeRightWhile; +exports.takeWhile = require_takeWhile.takeWhile; +exports.template = require_template.template; +exports.templateSettings = require_template.templateSettings; +exports.throttle = require_throttle.throttle; +exports.times = require_times.times; +exports.toArray = require_toArray.toArray; +exports.toDefaulted = require_toDefaulted.toDefaulted; +exports.toFinite = require_toFinite.toFinite; +exports.toInteger = require_toInteger.toInteger; +exports.toLength = require_toLength.toLength; +exports.toLower = require_toLower.toLower; +exports.toNumber = require_toNumber.toNumber; +exports.toPairs = require_toPairs.toPairs; +exports.toPairsIn = require_toPairsIn.toPairsIn; +exports.toPath = require_toPath.toPath; +exports.toPlainObject = require_toPlainObject.toPlainObject; +exports.toSafeInteger = require_toSafeInteger.toSafeInteger; +exports.toString = require_toString.toString; +exports.toUpper = require_toUpper.toUpper; +exports.transform = require_transform.transform; +exports.trim = require_trim.trim; +exports.trimEnd = require_trimEnd.trimEnd; +exports.trimStart = require_trimStart.trimStart; +exports.truncate = require_truncate.truncate; +exports.unary = require_unary.unary; +exports.unescape = require_unescape.unescape; +exports.union = require_union.union; +exports.unionBy = require_unionBy.unionBy; +exports.unionWith = require_unionWith.unionWith; +exports.uniq = require_uniq.uniq; +exports.uniqBy = require_uniqBy.uniqBy; +exports.uniqWith = require_uniqWith.uniqWith; +exports.uniqueId = require_uniqueId.uniqueId; +exports.unset = require_unset.unset; +exports.unzip = require_unzip.unzip; +exports.unzipWith = require_unzipWith.unzipWith; +exports.update = require_update.update; +exports.updateWith = require_updateWith.updateWith; +exports.upperCase = require_upperCase.upperCase; +exports.upperFirst = require_upperFirst.upperFirst; +exports.values = require_values.values; +exports.valuesIn = require_valuesIn.valuesIn; +exports.without = require_without.without; +exports.words = require_words.words; +exports.wrap = require_wrap.wrap; +exports.xor = require_xor.xor; +exports.xorBy = require_xorBy.xorBy; +exports.xorWith = require_xorWith.xorWith; +exports.zip = require_zip.zip; +exports.zipObject = require_zipObject.zipObject; +exports.zipObjectDeep = require_zipObjectDeep.zipObjectDeep; +exports.zipWith = require_zipWith.zipWith; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/index.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c94a65d003f5a205dee0caafc855c3688027ecb0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/index.mjs @@ -0,0 +1,294 @@ +import { isSymbol } from "./predicate/isSymbol.mjs"; +import { toNumber } from "./util/toNumber.mjs"; +import { toFinite } from "./util/toFinite.mjs"; +import { toInteger } from "./util/toInteger.mjs"; +import { isArray } from "./predicate/isArray.mjs"; +import { isPlainObject } from "./predicate/isPlainObject.mjs"; +import { isEqualsSameValueZero } from "../_internal/isEqualsSameValueZero.mjs"; +import { isEqual } from "../predicate/isEqual.mjs"; +import { castArray } from "./array/castArray.mjs"; +import { isArrayLike } from "./predicate/isArrayLike.mjs"; +import { chunk } from "./array/chunk.mjs"; +import { compact } from "./array/compact.mjs"; +import { concat } from "./array/concat.mjs"; +import { toString } from "./util/toString.mjs"; +import { toPath } from "./util/toPath.mjs"; +import { get } from "./object/get.mjs"; +import { property } from "./object/property.mjs"; +import { isObject } from "./predicate/isObject.mjs"; +import { isMatchWith } from "./predicate/isMatchWith.mjs"; +import { isMatch } from "./predicate/isMatch.mjs"; +import { matches } from "./predicate/matches.mjs"; +import { cloneDeepWith } from "./object/cloneDeepWith.mjs"; +import { cloneDeep } from "./object/cloneDeep.mjs"; +import { isArguments } from "./predicate/isArguments.mjs"; +import { has } from "./object/has.mjs"; +import { matchesProperty } from "./predicate/matchesProperty.mjs"; +import { iteratee } from "./util/iteratee.mjs"; +import { countBy } from "./array/countBy.mjs"; +import { isObjectLike } from "./predicate/isObjectLike.mjs"; +import { isArrayLikeObject } from "./predicate/isArrayLikeObject.mjs"; +import { difference } from "./array/difference.mjs"; +import { last } from "./array/last.mjs"; +import { differenceBy } from "./array/differenceBy.mjs"; +import { differenceWith } from "./array/differenceWith.mjs"; +import { drop } from "./array/drop.mjs"; +import { dropRight } from "./array/dropRight.mjs"; +import { dropRightWhile } from "./array/dropRightWhile.mjs"; +import { dropWhile } from "./array/dropWhile.mjs"; +import { forEach } from "./array/forEach.mjs"; +import { forEachRight } from "./array/forEachRight.mjs"; +import { every } from "./array/every.mjs"; +import { isString } from "./predicate/isString.mjs"; +import { fill } from "./array/fill.mjs"; +import { filter } from "./array/filter.mjs"; +import { find } from "./array/find.mjs"; +import { identity } from "./function/identity.mjs"; +import { findIndex } from "./array/findIndex.mjs"; +import { findLast } from "./array/findLast.mjs"; +import { findLastIndex } from "./array/findLastIndex.mjs"; +import { head } from "./array/head.mjs"; +import { flatten } from "./array/flatten.mjs"; +import { flattenDepth } from "./array/flattenDepth.mjs"; +import { map } from "./array/map.mjs"; +import { flatMap } from "./array/flatMap.mjs"; +import { flatMapDepth } from "./array/flatMapDepth.mjs"; +import { flatMapDeep } from "./array/flatMapDeep.mjs"; +import { flattenDeep } from "./array/flattenDeep.mjs"; +import { groupBy } from "./array/groupBy.mjs"; +import { includes } from "./array/includes.mjs"; +import { indexOf } from "./array/indexOf.mjs"; +import { initial } from "./array/initial.mjs"; +import { intersection } from "./array/intersection.mjs"; +import { intersectionBy } from "./array/intersectionBy.mjs"; +import { uniq } from "./array/uniq.mjs"; +import { intersectionWith } from "./array/intersectionWith.mjs"; +import { invokeMap } from "./array/invokeMap.mjs"; +import { join } from "./array/join.mjs"; +import { reduce } from "./array/reduce.mjs"; +import { keyBy } from "./array/keyBy.mjs"; +import { lastIndexOf } from "./array/lastIndexOf.mjs"; +import { nth } from "./array/nth.mjs"; +import { orderBy } from "./array/orderBy.mjs"; +import { partition } from "./array/partition.mjs"; +import { pull } from "./array/pull.mjs"; +import { pullAll } from "./array/pullAll.mjs"; +import { pullAllBy } from "./array/pullAllBy.mjs"; +import { pullAllWith } from "./array/pullAllWith.mjs"; +import { at } from "./object/at.mjs"; +import { unset } from "./object/unset.mjs"; +import { pullAt } from "./array/pullAt.mjs"; +import { reduceRight } from "./array/reduceRight.mjs"; +import { negate } from "./function/negate.mjs"; +import { reject } from "./array/reject.mjs"; +import { remove } from "./array/remove.mjs"; +import { reverse } from "./array/reverse.mjs"; +import { sample } from "./array/sample.mjs"; +import { clamp } from "./math/clamp.mjs"; +import { isMap } from "./predicate/isMap.mjs"; +import { toArray } from "./util/toArray.mjs"; +import { sampleSize } from "./array/sampleSize.mjs"; +import { values } from "./object/values.mjs"; +import { isNil } from "./predicate/isNil.mjs"; +import { shuffle } from "./array/shuffle.mjs"; +import { size } from "./array/size.mjs"; +import { slice } from "./array/slice.mjs"; +import { some } from "./array/some.mjs"; +import { sortBy } from "./array/sortBy.mjs"; +import { isNaN } from "./predicate/isNaN.mjs"; +import { sortedIndexBy } from "./array/sortedIndexBy.mjs"; +import { isNumber } from "./predicate/isNumber.mjs"; +import { sortedIndex } from "./array/sortedIndex.mjs"; +import { sortedIndexOf } from "./array/sortedIndexOf.mjs"; +import { sortedLastIndexBy } from "./array/sortedLastIndexBy.mjs"; +import { sortedLastIndex } from "./array/sortedLastIndex.mjs"; +import { sortedLastIndexOf } from "./array/sortedLastIndexOf.mjs"; +import { tail } from "./array/tail.mjs"; +import { take } from "./array/take.mjs"; +import { takeRight } from "./array/takeRight.mjs"; +import { takeRightWhile } from "./array/takeRightWhile.mjs"; +import { takeWhile } from "./array/takeWhile.mjs"; +import { union } from "./array/union.mjs"; +import { unionBy } from "./array/unionBy.mjs"; +import { unionWith } from "./array/unionWith.mjs"; +import { uniqBy } from "./array/uniqBy.mjs"; +import { uniqWith } from "./array/uniqWith.mjs"; +import { unzip } from "./array/unzip.mjs"; +import { unzipWith } from "./array/unzipWith.mjs"; +import { without } from "./array/without.mjs"; +import { xor } from "./array/xor.mjs"; +import { xorBy } from "./array/xorBy.mjs"; +import { xorWith } from "./array/xorWith.mjs"; +import { zip } from "./array/zip.mjs"; +import { zipObject } from "./array/zipObject.mjs"; +import { updateWith } from "./object/updateWith.mjs"; +import { set } from "./object/set.mjs"; +import { zipObjectDeep } from "./array/zipObjectDeep.mjs"; +import { zipWith } from "./array/zipWith.mjs"; +import { after } from "./function/after.mjs"; +import { ary } from "./function/ary.mjs"; +import { attempt } from "./function/attempt.mjs"; +import { before } from "./function/before.mjs"; +import { bind } from "./function/bind.mjs"; +import { bindKey } from "./function/bindKey.mjs"; +import { curry } from "./function/curry.mjs"; +import { curryRight } from "./function/curryRight.mjs"; +import { debounce } from "./function/debounce.mjs"; +import { defer } from "./function/defer.mjs"; +import { delay } from "./function/delay.mjs"; +import { flip } from "./function/flip.mjs"; +import { flow } from "./function/flow.mjs"; +import { flowRight } from "./function/flowRight.mjs"; +import { memoize } from "./function/memoize.mjs"; +import { nthArg } from "./function/nthArg.mjs"; +import { once } from "./function/once.mjs"; +import { overArgs } from "./function/overArgs.mjs"; +import { partial } from "./function/partial.mjs"; +import { partialRight } from "./function/partialRight.mjs"; +import { rearg } from "./function/rearg.mjs"; +import { rest } from "./function/rest.mjs"; +import { spread } from "./function/spread.mjs"; +import { throttle } from "./function/throttle.mjs"; +import { unary } from "./function/unary.mjs"; +import { wrap } from "./function/wrap.mjs"; +import { add } from "./math/add.mjs"; +import { ceil } from "./math/ceil.mjs"; +import { divide } from "./math/divide.mjs"; +import { floor } from "./math/floor.mjs"; +import { inRange } from "./math/inRange.mjs"; +import { max } from "./math/max.mjs"; +import { maxBy } from "./math/maxBy.mjs"; +import { sumBy } from "./math/sumBy.mjs"; +import { sum } from "./math/sum.mjs"; +import { mean } from "./math/mean.mjs"; +import { meanBy } from "./math/meanBy.mjs"; +import { min } from "./math/min.mjs"; +import { minBy } from "./math/minBy.mjs"; +import { multiply } from "./math/multiply.mjs"; +import { parseInt } from "./math/parseInt.mjs"; +import { random } from "./math/random.mjs"; +import { range } from "./math/range.mjs"; +import { rangeRight } from "./math/rangeRight.mjs"; +import { round } from "./math/round.mjs"; +import { subtract } from "./math/subtract.mjs"; +import { noop } from "./function/noop.mjs"; +import { isTypedArray } from "./predicate/isTypedArray.mjs"; +import { times } from "./util/times.mjs"; +import { keys } from "./object/keys.mjs"; +import { assign } from "./object/assign.mjs"; +import { keysIn } from "./object/keysIn.mjs"; +import { assignIn } from "./object/assignIn.mjs"; +import { assignInWith } from "./object/assignInWith.mjs"; +import { assignWith } from "./object/assignWith.mjs"; +import { clone } from "./object/clone.mjs"; +import { cloneWith } from "./object/cloneWith.mjs"; +import { create } from "./object/create.mjs"; +import { defaults } from "./object/defaults.mjs"; +import { defaultsDeep } from "./object/defaultsDeep.mjs"; +import { findKey } from "./object/findKey.mjs"; +import { findLastKey } from "./object/findLastKey.mjs"; +import { forIn } from "./object/forIn.mjs"; +import { forInRight } from "./object/forInRight.mjs"; +import { forOwn } from "./object/forOwn.mjs"; +import { forOwnRight } from "./object/forOwnRight.mjs"; +import { fromPairs } from "./object/fromPairs.mjs"; +import { functions } from "./object/functions.mjs"; +import { functionsIn } from "./object/functionsIn.mjs"; +import { hasIn } from "./object/hasIn.mjs"; +import { invert } from "./object/invert.mjs"; +import { invertBy } from "./object/invertBy.mjs"; +import { mapKeys } from "./object/mapKeys.mjs"; +import { mapValues } from "./object/mapValues.mjs"; +import { mergeWith } from "./object/mergeWith.mjs"; +import { merge } from "./object/merge.mjs"; +import { omit } from "./object/omit.mjs"; +import { omitBy } from "./object/omitBy.mjs"; +import { pick } from "./object/pick.mjs"; +import { pickBy } from "./object/pickBy.mjs"; +import { propertyOf } from "./object/propertyOf.mjs"; +import { result } from "./object/result.mjs"; +import { setWith } from "./object/setWith.mjs"; +import { toDefaulted } from "./object/toDefaulted.mjs"; +import { toPairs } from "./object/toPairs.mjs"; +import { toPairsIn } from "./object/toPairsIn.mjs"; +import { isBuffer } from "./predicate/isBuffer.mjs"; +import { transform } from "./object/transform.mjs"; +import { update } from "./object/update.mjs"; +import { valuesIn } from "./object/valuesIn.mjs"; +import { isFunction } from "./predicate/isFunction.mjs"; +import { isLength } from "./predicate/isLength.mjs"; +import { isNative } from "./predicate/isNative.mjs"; +import { isNull } from "./predicate/isNull.mjs"; +import { isUndefined } from "./predicate/isUndefined.mjs"; +import { conformsTo } from "./predicate/conformsTo.mjs"; +import { conforms } from "./predicate/conforms.mjs"; +import { isArrayBuffer } from "./predicate/isArrayBuffer.mjs"; +import { isBoolean } from "./predicate/isBoolean.mjs"; +import { isDate } from "./predicate/isDate.mjs"; +import { isElement } from "./predicate/isElement.mjs"; +import { isEmpty } from "./predicate/isEmpty.mjs"; +import { isEqualWith } from "./predicate/isEqualWith.mjs"; +import { isError } from "./predicate/isError.mjs"; +import { isFinite } from "./predicate/isFinite.mjs"; +import { isInteger } from "./predicate/isInteger.mjs"; +import { isRegExp } from "./predicate/isRegExp.mjs"; +import { isSafeInteger } from "./predicate/isSafeInteger.mjs"; +import { isSet } from "./predicate/isSet.mjs"; +import { isWeakMap } from "./predicate/isWeakMap.mjs"; +import { isWeakSet } from "./predicate/isWeakSet.mjs"; +import { capitalize } from "./string/capitalize.mjs"; +import { bindAll } from "./util/bindAll.mjs"; +import { deburr } from "./string/deburr.mjs"; +import { camelCase } from "./string/camelCase.mjs"; +import { endsWith } from "./string/endsWith.mjs"; +import { escape } from "./string/escape.mjs"; +import { escapeRegExp } from "./string/escapeRegExp.mjs"; +import { kebabCase } from "./string/kebabCase.mjs"; +import { lowerCase } from "./string/lowerCase.mjs"; +import { lowerFirst } from "./string/lowerFirst.mjs"; +import { pad } from "./string/pad.mjs"; +import { padEnd } from "./string/padEnd.mjs"; +import { padStart } from "./string/padStart.mjs"; +import { repeat } from "./string/repeat.mjs"; +import { replace } from "./string/replace.mjs"; +import { snakeCase } from "./string/snakeCase.mjs"; +import { split } from "./string/split.mjs"; +import { startCase } from "./string/startCase.mjs"; +import { startsWith } from "./string/startsWith.mjs"; +import { template, templateSettings } from "./string/template.mjs"; +import { toLower } from "./string/toLower.mjs"; +import { toUpper } from "./string/toUpper.mjs"; +import { trim } from "./string/trim.mjs"; +import { trimEnd } from "./string/trimEnd.mjs"; +import { trimStart } from "./string/trimStart.mjs"; +import { truncate } from "./string/truncate.mjs"; +import { unescape } from "./string/unescape.mjs"; +import { upperCase } from "./string/upperCase.mjs"; +import { upperFirst } from "./string/upperFirst.mjs"; +import { words } from "./string/words.mjs"; +import { cond } from "./util/cond.mjs"; +import { constant } from "./util/constant.mjs"; +import { defaultTo } from "./util/defaultTo.mjs"; +import { gt } from "./util/gt.mjs"; +import { gte } from "./util/gte.mjs"; +import { invoke } from "./util/invoke.mjs"; +import { lt } from "./util/lt.mjs"; +import { lte } from "./util/lte.mjs"; +import { method } from "./util/method.mjs"; +import { methodOf } from "./util/methodOf.mjs"; +import { now } from "./util/now.mjs"; +import { over } from "./util/over.mjs"; +import { overEvery } from "./util/overEvery.mjs"; +import { overSome } from "./util/overSome.mjs"; +import { stubArray } from "./util/stubArray.mjs"; +import { stubFalse } from "./util/stubFalse.mjs"; +import { stubObject } from "./util/stubObject.mjs"; +import { stubString } from "./util/stubString.mjs"; +import { stubTrue } from "./util/stubTrue.mjs"; +import { toLength } from "./util/toLength.mjs"; +import { toPlainObject } from "./util/toPlainObject.mjs"; +import { toSafeInteger } from "./util/toSafeInteger.mjs"; +import { uniqueId } from "./util/uniqueId.mjs"; +import "./compat.mjs"; +import { toolkit } from "./toolkit.mjs"; +export { add, after, ary, assign, assignIn, assignInWith, assignWith, at, attempt, before, bind, bindAll, bindKey, camelCase, capitalize, castArray, ceil, chunk, clamp, clone, cloneDeep, cloneDeepWith, cloneWith, compact, concat, cond, conforms, conformsTo, constant, countBy, create, curry, curryRight, debounce, deburr, toolkit as default, defaultTo, defaults, defaultsDeep, defer, delay, difference, differenceBy, differenceWith, divide, drop, dropRight, dropRightWhile, dropWhile, forEach as each, forEachRight as eachRight, endsWith, isEqualsSameValueZero as eq, escape, escapeRegExp, every, assignIn as extend, assignInWith as extendWith, fill, filter, find, findIndex, findKey, findLast, findLastIndex, findLastKey, head as first, flatMap, flatMapDeep, flatMapDepth, flatten, flattenDeep, flattenDepth, flip, floor, flow, flowRight, forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, fromPairs, functions, functionsIn, get, groupBy, gt, gte, has, hasIn, head, identity, inRange, includes, indexOf, initial, intersection, intersectionBy, intersectionWith, invert, invertBy, invoke, invokeMap, isArguments, isArray, isArrayBuffer, isArrayLike, isArrayLikeObject, isBoolean, isBuffer, isDate, isElement, isEmpty, isEqual, isEqualWith, isError, isFinite, isFunction, isInteger, isLength, isMap, isMatch, isMatchWith, isNaN, isNative, isNil, isNull, isNumber, isObject, isObjectLike, isPlainObject, isRegExp, isSafeInteger, isSet, isString, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet, iteratee, join, kebabCase, keyBy, keys, keysIn, last, lastIndexOf, lowerCase, lowerFirst, lt, lte, map, mapKeys, mapValues, matches, matchesProperty, max, maxBy, mean, meanBy, memoize, merge, mergeWith, method, methodOf, min, minBy, multiply, negate, noop, now, nth, nthArg, omit, omitBy, once, orderBy, over, overArgs, overEvery, overSome, pad, padEnd, padStart, parseInt, partial, partialRight, partition, pick, pickBy, property, propertyOf, pull, pullAll, pullAllBy, pullAllWith, pullAt, random, range, rangeRight, rearg, reduce, reduceRight, reject, remove, repeat, replace, rest, result, reverse, round, sample, sampleSize, set, setWith, shuffle, size, slice, snakeCase, some, sortBy, sortedIndex, sortedIndexBy, sortedIndexOf, sortedLastIndex, sortedLastIndexBy, sortedLastIndexOf, split, spread, startCase, startsWith, stubArray, stubFalse, stubObject, stubString, stubTrue, subtract, sum, sumBy, tail, take, takeRight, takeRightWhile, takeWhile, template, templateSettings, throttle, times, toArray, toDefaulted, toFinite, toInteger, toLength, toLower, toNumber, toPairs, toPairsIn, toPath, toPlainObject, toSafeInteger, toString, toUpper, transform, trim, trimEnd, trimStart, truncate, unary, unescape, union, unionBy, unionWith, uniq, uniqBy, uniqWith, uniqueId, unset, unzip, unzipWith, update, updateWith, upperCase, upperFirst, values, valuesIn, without, words, wrap, xor, xorBy, xorWith, zip, zipObject, zipObjectDeep, zipWith }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/add.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/math/add.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..ae2624ab3c74499aa42bd70269f2903446c29c24 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/add.d.mts @@ -0,0 +1,19 @@ +//#region src/compat/math/add.d.ts +/** + * Adds two numbers while safely handling `NaN` values. + * + * This function takes two numbers and returns their sum. If either of the numbers is `NaN`, + * the function returns `NaN`. + * + * @param {number} value - The first number to add. + * @param {number} other - The second number to add. + * @returns {number} The sum of the two numbers, or `NaN` if any input is `NaN`. + * + * @example + * const result1 = add(2, 3); // result1 will be 5 + * const result2 = add(5, NaN); // result2 will be NaN + * const result3 = add(NaN, 10); // result3 will be NaN + */ +declare function add(value: number, other: number): number; +//#endregion +export { add }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/add.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/math/add.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ae2624ab3c74499aa42bd70269f2903446c29c24 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/add.d.ts @@ -0,0 +1,19 @@ +//#region src/compat/math/add.d.ts +/** + * Adds two numbers while safely handling `NaN` values. + * + * This function takes two numbers and returns their sum. If either of the numbers is `NaN`, + * the function returns `NaN`. + * + * @param {number} value - The first number to add. + * @param {number} other - The second number to add. + * @returns {number} The sum of the two numbers, or `NaN` if any input is `NaN`. + * + * @example + * const result1 = add(2, 3); // result1 will be 5 + * const result2 = add(5, NaN); // result2 will be NaN + * const result3 = add(NaN, 10); // result3 will be NaN + */ +declare function add(value: number, other: number): number; +//#endregion +export { add }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/add.js b/tools/ui/node_modules/es-toolkit/dist/compat/math/add.js new file mode 100644 index 0000000000000000000000000000000000000000..88d3055cc7560515e31e3fa91c67d47b0a2b9cb5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/add.js @@ -0,0 +1,32 @@ +const require_toNumber = require("../util/toNumber.js"); +const require_toString = require("../util/toString.js"); +//#region src/compat/math/add.ts +/** +* Adds two numbers while safely handling `NaN` values. +* +* This function takes two numbers and returns their sum. If either of the numbers is `NaN`, +* the function returns `NaN`. +* +* @param {number} value - The first number to add. +* @param {number} other - The second number to add. +* @returns {number} The sum of the two numbers, or `NaN` if any input is `NaN`. +* +* @example +* const result1 = add(2, 3); // result1 will be 5 +* const result2 = add(5, NaN); // result2 will be NaN +* const result3 = add(NaN, 10); // result3 will be NaN +*/ +function add(value, other) { + if (value === void 0 && other === void 0) return 0; + if (value === void 0 || other === void 0) return value ?? other; + if (typeof value === "string" || typeof other === "string") { + value = require_toString.toString(value); + other = require_toString.toString(other); + } else { + value = require_toNumber.toNumber(value); + other = require_toNumber.toNumber(other); + } + return value + other; +} +//#endregion +exports.add = add; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/add.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/math/add.mjs new file mode 100644 index 0000000000000000000000000000000000000000..88620a17bd5df96036d471f8abc005759aa786ca --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/add.mjs @@ -0,0 +1,32 @@ +import { toNumber } from "../util/toNumber.mjs"; +import { toString } from "../util/toString.mjs"; +//#region src/compat/math/add.ts +/** +* Adds two numbers while safely handling `NaN` values. +* +* This function takes two numbers and returns their sum. If either of the numbers is `NaN`, +* the function returns `NaN`. +* +* @param {number} value - The first number to add. +* @param {number} other - The second number to add. +* @returns {number} The sum of the two numbers, or `NaN` if any input is `NaN`. +* +* @example +* const result1 = add(2, 3); // result1 will be 5 +* const result2 = add(5, NaN); // result2 will be NaN +* const result3 = add(NaN, 10); // result3 will be NaN +*/ +function add(value, other) { + if (value === void 0 && other === void 0) return 0; + if (value === void 0 || other === void 0) return value ?? other; + if (typeof value === "string" || typeof other === "string") { + value = toString(value); + other = toString(other); + } else { + value = toNumber(value); + other = toNumber(other); + } + return value + other; +} +//#endregion +export { add }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/ceil.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/math/ceil.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f4fec9d4effb6cd56d661a1ea06f349842821065 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/ceil.d.mts @@ -0,0 +1,16 @@ +//#region src/compat/math/ceil.d.ts +/** + * Computes number rounded up to precision. + * + * @param {number | string} number The number to round up. + * @param {number | string} precision The precision to round up to. + * @returns {number} Returns the rounded up number. + * + * @example + * ceil(4.006); // => 5 + * ceil(6.004, 2); // => 6.01 + * ceil(6040, -2); // => 6100 + */ +declare function ceil(number: number, precision?: number): number; +//#endregion +export { ceil }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/ceil.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/math/ceil.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f4fec9d4effb6cd56d661a1ea06f349842821065 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/ceil.d.ts @@ -0,0 +1,16 @@ +//#region src/compat/math/ceil.d.ts +/** + * Computes number rounded up to precision. + * + * @param {number | string} number The number to round up. + * @param {number | string} precision The precision to round up to. + * @returns {number} Returns the rounded up number. + * + * @example + * ceil(4.006); // => 5 + * ceil(6.004, 2); // => 6.01 + * ceil(6040, -2); // => 6100 + */ +declare function ceil(number: number, precision?: number): number; +//#endregion +export { ceil }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/ceil.js b/tools/ui/node_modules/es-toolkit/dist/compat/math/ceil.js new file mode 100644 index 0000000000000000000000000000000000000000..e2bb031a2c1b02ab92fed1ef9a1b83b4846d52d0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/ceil.js @@ -0,0 +1,19 @@ +const require_decimalAdjust = require("../_internal/decimalAdjust.js"); +//#region src/compat/math/ceil.ts +/** +* Computes number rounded up to precision. +* +* @param {number | string} number The number to round up. +* @param {number | string} precision The precision to round up to. +* @returns {number} Returns the rounded up number. +* +* @example +* ceil(4.006); // => 5 +* ceil(6.004, 2); // => 6.01 +* ceil(6040, -2); // => 6100 +*/ +function ceil(number, precision = 0) { + return require_decimalAdjust.decimalAdjust("ceil", number, precision); +} +//#endregion +exports.ceil = ceil; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/ceil.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/math/ceil.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a3b58691dea84f707eb24a0a4938bb51293c9135 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/ceil.mjs @@ -0,0 +1,19 @@ +import { decimalAdjust } from "../_internal/decimalAdjust.mjs"; +//#region src/compat/math/ceil.ts +/** +* Computes number rounded up to precision. +* +* @param {number | string} number The number to round up. +* @param {number | string} precision The precision to round up to. +* @returns {number} Returns the rounded up number. +* +* @example +* ceil(4.006); // => 5 +* ceil(6.004, 2); // => 6.01 +* ceil(6040, -2); // => 6100 +*/ +function ceil(number, precision = 0) { + return decimalAdjust("ceil", number, precision); +} +//#endregion +export { ceil }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/clamp.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/math/clamp.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e285b39f8ecfd007b499ead135be885fda1ee044 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/clamp.d.mts @@ -0,0 +1,27 @@ +//#region src/compat/math/clamp.d.ts +/** + * Clamps a number within the specified bounds. + * + * @param {number} number The number to clamp + * @param {number} lower The lower bound + * @param {number} upper The upper bound + * @returns {number} Returns the clamped number + * @example + * clamp(3, 2, 4) // => 3 + * clamp(0, 5, 10) // => 5 + * clamp(15, 5, 10) // => 10 + */ +declare function clamp(number: number, lower: number, upper: number): number; +/** + * Clamps a number to an upper bound. + * + * @param {number} number The number to clamp + * @param {number} upper The upper bound + * @returns {number} Returns the clamped number + * @example + * clamp(5, 3) // => 3 + * clamp(2, 3) // => 2 + */ +declare function clamp(number: number, upper: number): number; +//#endregion +export { clamp }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/clamp.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/math/clamp.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e285b39f8ecfd007b499ead135be885fda1ee044 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/clamp.d.ts @@ -0,0 +1,27 @@ +//#region src/compat/math/clamp.d.ts +/** + * Clamps a number within the specified bounds. + * + * @param {number} number The number to clamp + * @param {number} lower The lower bound + * @param {number} upper The upper bound + * @returns {number} Returns the clamped number + * @example + * clamp(3, 2, 4) // => 3 + * clamp(0, 5, 10) // => 5 + * clamp(15, 5, 10) // => 10 + */ +declare function clamp(number: number, lower: number, upper: number): number; +/** + * Clamps a number to an upper bound. + * + * @param {number} number The number to clamp + * @param {number} upper The upper bound + * @returns {number} Returns the clamped number + * @example + * clamp(5, 3) // => 3 + * clamp(2, 3) // => 2 + */ +declare function clamp(number: number, upper: number): number; +//#endregion +export { clamp }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/clamp.js b/tools/ui/node_modules/es-toolkit/dist/compat/math/clamp.js new file mode 100644 index 0000000000000000000000000000000000000000..3ef14aab3f48a706175b8aa3543eba05c8458986 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/clamp.js @@ -0,0 +1,36 @@ +const require_toNumber = require("../util/toNumber.js"); +//#region src/compat/math/clamp.ts +/** +* Clamps a number within the specified bounds. +* +* This function takes a number and one or two bounds, and returns the number clamped within the specified bounds. +* If only one bound is provided, it returns the minimum of the value and the bound. +* +* @param {number} value - The number to clamp. +* @param {number} bound1 - The minimum bound to clamp the number, or the maximum bound if bound2 is not provided. +* @param {number} [bound2] - The maximum bound to clamp the number. If not provided, the function will only consider bound1 as the upper limit. +* @returns {number} The clamped number within the specified bounds. +* +* @example +* const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5 +* const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15 +* const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5 +* const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15 +*/ +function clamp(value, bound1, bound2) { + if (bound2 === void 0) { + bound2 = bound1; + bound1 = void 0; + } + if (bound2 !== void 0) { + bound2 = require_toNumber.toNumber(bound2); + value = Math.min(value, Number.isNaN(bound2) ? 0 : bound2); + } + if (bound1 !== void 0) { + bound1 = require_toNumber.toNumber(bound1); + value = Math.max(value, Number.isNaN(bound1) ? 0 : bound1); + } + return value; +} +//#endregion +exports.clamp = clamp; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/clamp.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/math/clamp.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5ae32809781a14f0916bfe8576f7ff540b5d61ec --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/clamp.mjs @@ -0,0 +1,36 @@ +import { toNumber } from "../util/toNumber.mjs"; +//#region src/compat/math/clamp.ts +/** +* Clamps a number within the specified bounds. +* +* This function takes a number and one or two bounds, and returns the number clamped within the specified bounds. +* If only one bound is provided, it returns the minimum of the value and the bound. +* +* @param {number} value - The number to clamp. +* @param {number} bound1 - The minimum bound to clamp the number, or the maximum bound if bound2 is not provided. +* @param {number} [bound2] - The maximum bound to clamp the number. If not provided, the function will only consider bound1 as the upper limit. +* @returns {number} The clamped number within the specified bounds. +* +* @example +* const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5 +* const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15 +* const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5 +* const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15 +*/ +function clamp(value, bound1, bound2) { + if (bound2 === void 0) { + bound2 = bound1; + bound1 = void 0; + } + if (bound2 !== void 0) { + bound2 = toNumber(bound2); + value = Math.min(value, Number.isNaN(bound2) ? 0 : bound2); + } + if (bound1 !== void 0) { + bound1 = toNumber(bound1); + value = Math.max(value, Number.isNaN(bound1) ? 0 : bound1); + } + return value; +} +//#endregion +export { clamp }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/divide.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/math/divide.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..347bc742013e4d33a6e1a7364b652aeb5a66eb0f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/divide.d.mts @@ -0,0 +1,19 @@ +//#region src/compat/math/divide.d.ts +/** + * Divide two numbers. + * + * If either of the numbers is `NaN`, the function returns `NaN`. + * + * @param {number} value The first number in a division. + * @param {number} other The second number in a division. + * @returns {number} The quotient of value and other. + * + * @example + * divide(6, 3); // => 2 + * divide(2, NaN); // => NaN + * divide(NaN, 3); // => NaN + * divide(NaN, NaN); // => NaN + */ +declare function divide(value: number, other: number): number; +//#endregion +export { divide }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/divide.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/math/divide.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..347bc742013e4d33a6e1a7364b652aeb5a66eb0f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/divide.d.ts @@ -0,0 +1,19 @@ +//#region src/compat/math/divide.d.ts +/** + * Divide two numbers. + * + * If either of the numbers is `NaN`, the function returns `NaN`. + * + * @param {number} value The first number in a division. + * @param {number} other The second number in a division. + * @returns {number} The quotient of value and other. + * + * @example + * divide(6, 3); // => 2 + * divide(2, NaN); // => NaN + * divide(NaN, 3); // => NaN + * divide(NaN, NaN); // => NaN + */ +declare function divide(value: number, other: number): number; +//#endregion +export { divide }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/divide.js b/tools/ui/node_modules/es-toolkit/dist/compat/math/divide.js new file mode 100644 index 0000000000000000000000000000000000000000..95d9115d4d07255b453fd6c31754593b4b5d0c4a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/divide.js @@ -0,0 +1,32 @@ +const require_toNumber = require("../util/toNumber.js"); +const require_toString = require("../util/toString.js"); +//#region src/compat/math/divide.ts +/** +* Divide two numbers. +* +* If either of the numbers is `NaN`, the function returns `NaN`. +* +* @param {number} value The first number in a division. +* @param {number} other The second number in a division. +* @returns {number} The quotient of value and other. +* +* @example +* divide(6, 3); // => 2 +* divide(2, NaN); // => NaN +* divide(NaN, 3); // => NaN +* divide(NaN, NaN); // => NaN +*/ +function divide(value, other) { + if (value === void 0 && other === void 0) return 1; + if (value === void 0 || other === void 0) return value ?? other; + if (typeof value === "string" || typeof other === "string") { + value = require_toString.toString(value); + other = require_toString.toString(other); + } else { + value = require_toNumber.toNumber(value); + other = require_toNumber.toNumber(other); + } + return value / other; +} +//#endregion +exports.divide = divide; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/divide.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/math/divide.mjs new file mode 100644 index 0000000000000000000000000000000000000000..24cf01c5b4c6fbc545752a693665638af8bc325a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/divide.mjs @@ -0,0 +1,32 @@ +import { toNumber } from "../util/toNumber.mjs"; +import { toString } from "../util/toString.mjs"; +//#region src/compat/math/divide.ts +/** +* Divide two numbers. +* +* If either of the numbers is `NaN`, the function returns `NaN`. +* +* @param {number} value The first number in a division. +* @param {number} other The second number in a division. +* @returns {number} The quotient of value and other. +* +* @example +* divide(6, 3); // => 2 +* divide(2, NaN); // => NaN +* divide(NaN, 3); // => NaN +* divide(NaN, NaN); // => NaN +*/ +function divide(value, other) { + if (value === void 0 && other === void 0) return 1; + if (value === void 0 || other === void 0) return value ?? other; + if (typeof value === "string" || typeof other === "string") { + value = toString(value); + other = toString(other); + } else { + value = toNumber(value); + other = toNumber(other); + } + return value / other; +} +//#endregion +export { divide }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/floor.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/math/floor.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..76d6ca4e6f406aff4b745a74b4f92ca91b45b290 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/floor.d.mts @@ -0,0 +1,16 @@ +//#region src/compat/math/floor.d.ts +/** + * Computes number rounded down to precision. + * + * @param {number | string} number The number to round down. + * @param {number | string} precision The precision to round down to. + * @returns {number} Returns the rounded down number. + * + * @example + * floor(4.006); // => 4 + * floor(0.046, 2); // => 0.04 + * floor(4060, -2); // => 4000 + */ +declare function floor(number: number, precision?: number): number; +//#endregion +export { floor }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/floor.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/math/floor.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..76d6ca4e6f406aff4b745a74b4f92ca91b45b290 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/floor.d.ts @@ -0,0 +1,16 @@ +//#region src/compat/math/floor.d.ts +/** + * Computes number rounded down to precision. + * + * @param {number | string} number The number to round down. + * @param {number | string} precision The precision to round down to. + * @returns {number} Returns the rounded down number. + * + * @example + * floor(4.006); // => 4 + * floor(0.046, 2); // => 0.04 + * floor(4060, -2); // => 4000 + */ +declare function floor(number: number, precision?: number): number; +//#endregion +export { floor }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/floor.js b/tools/ui/node_modules/es-toolkit/dist/compat/math/floor.js new file mode 100644 index 0000000000000000000000000000000000000000..2044a901ab72fcc8eee1e4482c5dc2d6f8c48317 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/floor.js @@ -0,0 +1,19 @@ +const require_decimalAdjust = require("../_internal/decimalAdjust.js"); +//#region src/compat/math/floor.ts +/** +* Computes number rounded down to precision. +* +* @param {number | string} number The number to round down. +* @param {number | string} precision The precision to round down to. +* @returns {number} Returns the rounded down number. +* +* @example +* floor(4.006); // => 4 +* floor(0.046, 2); // => 0.04 +* floor(4060, -2); // => 4000 +*/ +function floor(number, precision = 0) { + return require_decimalAdjust.decimalAdjust("floor", number, precision); +} +//#endregion +exports.floor = floor; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/floor.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/math/floor.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ee36f08f17c8aa16d61c41cd381f4344de5922da --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/floor.mjs @@ -0,0 +1,19 @@ +import { decimalAdjust } from "../_internal/decimalAdjust.mjs"; +//#region src/compat/math/floor.ts +/** +* Computes number rounded down to precision. +* +* @param {number | string} number The number to round down. +* @param {number | string} precision The precision to round down to. +* @returns {number} Returns the rounded down number. +* +* @example +* floor(4.006); // => 4 +* floor(0.046, 2); // => 0.04 +* floor(4060, -2); // => 4000 +*/ +function floor(number, precision = 0) { + return decimalAdjust("floor", number, precision); +} +//#endregion +export { floor }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/inRange.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/math/inRange.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..7e1ac2584a07cac97b881a90696dd71e4c384559 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/inRange.d.mts @@ -0,0 +1,18 @@ +//#region src/compat/math/inRange.d.ts +/** + * Checks if the value is within a specified range. + * + * @param {number} value The value to check. + * @param {number} minimum The lower bound of the range (inclusive). + * @param {number} maximum The upper bound of the range (exclusive). + * @returns {boolean} `true` if the value is within the specified range, otherwise `false`. + * @throws {Error} Throws an error if the `minimum` is greater or equal than the `maximum`. + * + * @example + * const result1 = inRange(3, 5); // result1 will be true. + * const result2 = inRange(1, 2, 5); // result2 will be false. + * const result3 = inRange(1, 5, 2); // If the minimum is greater or equal than the maximum, an error is thrown. + */ +declare function inRange(value: number, minimum: number, maximum?: number): boolean; +//#endregion +export { inRange }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/inRange.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/math/inRange.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7e1ac2584a07cac97b881a90696dd71e4c384559 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/inRange.d.ts @@ -0,0 +1,18 @@ +//#region src/compat/math/inRange.d.ts +/** + * Checks if the value is within a specified range. + * + * @param {number} value The value to check. + * @param {number} minimum The lower bound of the range (inclusive). + * @param {number} maximum The upper bound of the range (exclusive). + * @returns {boolean} `true` if the value is within the specified range, otherwise `false`. + * @throws {Error} Throws an error if the `minimum` is greater or equal than the `maximum`. + * + * @example + * const result1 = inRange(3, 5); // result1 will be true. + * const result2 = inRange(1, 2, 5); // result2 will be false. + * const result3 = inRange(1, 5, 2); // If the minimum is greater or equal than the maximum, an error is thrown. + */ +declare function inRange(value: number, minimum: number, maximum?: number): boolean; +//#endregion +export { inRange }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/inRange.js b/tools/ui/node_modules/es-toolkit/dist/compat/math/inRange.js new file mode 100644 index 0000000000000000000000000000000000000000..8edbf52841bac49df233915f2ac9dad198c97296 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/inRange.js @@ -0,0 +1,28 @@ +const require_inRange = require("../../math/inRange.js"); +//#region src/compat/math/inRange.ts +/** +* Checks if the value is within a specified range. +* +* @param {number} value The value to check. +* @param {number} minimum The lower bound of the range (inclusive). +* @param {number} maximum The upper bound of the range (exclusive). +* @returns {boolean} `true` if the value is within the specified range, otherwise `false`. +* @throws {Error} Throws an error if the `minimum` is greater or equal than the `maximum`. +* +* @example +* const result1 = inRange(3, 5); // result1 will be true. +* const result2 = inRange(1, 2, 5); // result2 will be false. +* const result3 = inRange(1, 5, 2); // If the minimum is greater or equal than the maximum, an error is thrown. +*/ +function inRange(value, minimum, maximum) { + if (!minimum) minimum = 0; + if (maximum != null && !maximum) maximum = 0; + if (minimum != null && typeof minimum !== "number") minimum = Number(minimum); + if (maximum == null && minimum === 0) return false; + if (maximum != null && typeof maximum !== "number") maximum = Number(maximum); + if (maximum != null && minimum > maximum) [minimum, maximum] = [maximum, minimum]; + if (minimum === maximum) return false; + return require_inRange.inRange(value, minimum, maximum); +} +//#endregion +exports.inRange = inRange; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/inRange.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/math/inRange.mjs new file mode 100644 index 0000000000000000000000000000000000000000..939ae1cc3166bd549ac8662cdaa076554e8e7c50 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/inRange.mjs @@ -0,0 +1,28 @@ +import { inRange as inRange$1 } from "../../math/inRange.mjs"; +//#region src/compat/math/inRange.ts +/** +* Checks if the value is within a specified range. +* +* @param {number} value The value to check. +* @param {number} minimum The lower bound of the range (inclusive). +* @param {number} maximum The upper bound of the range (exclusive). +* @returns {boolean} `true` if the value is within the specified range, otherwise `false`. +* @throws {Error} Throws an error if the `minimum` is greater or equal than the `maximum`. +* +* @example +* const result1 = inRange(3, 5); // result1 will be true. +* const result2 = inRange(1, 2, 5); // result2 will be false. +* const result3 = inRange(1, 5, 2); // If the minimum is greater or equal than the maximum, an error is thrown. +*/ +function inRange(value, minimum, maximum) { + if (!minimum) minimum = 0; + if (maximum != null && !maximum) maximum = 0; + if (minimum != null && typeof minimum !== "number") minimum = Number(minimum); + if (maximum == null && minimum === 0) return false; + if (maximum != null && typeof maximum !== "number") maximum = Number(maximum); + if (maximum != null && minimum > maximum) [minimum, maximum] = [maximum, minimum]; + if (minimum === maximum) return false; + return inRange$1(value, minimum, maximum); +} +//#endregion +export { inRange }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/max.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/math/max.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6e4823a393c66c56bb9ce469a8f75929461c7fa0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/max.d.mts @@ -0,0 +1,11 @@ +//#region src/compat/math/max.d.ts +/** + * Finds the element in an array that has the maximum value. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} [items] - The array of elements to search. Defaults to an empty array. + * @returns {T | undefined} - The element with the maximum value, or undefined if the array is empty. + */ +declare function max(items: ArrayLike | null | undefined): T | undefined; +//#endregion +export { max }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/max.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/math/max.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6e4823a393c66c56bb9ce469a8f75929461c7fa0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/max.d.ts @@ -0,0 +1,11 @@ +//#region src/compat/math/max.d.ts +/** + * Finds the element in an array that has the maximum value. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} [items] - The array of elements to search. Defaults to an empty array. + * @returns {T | undefined} - The element with the maximum value, or undefined if the array is empty. + */ +declare function max(items: ArrayLike | null | undefined): T | undefined; +//#endregion +export { max }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/max.js b/tools/ui/node_modules/es-toolkit/dist/compat/math/max.js new file mode 100644 index 0000000000000000000000000000000000000000..934dde6707969463a928aa8319efed86efc3fb1a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/max.js @@ -0,0 +1,20 @@ +//#region src/compat/math/max.ts +/** +* Finds the element in an array that has the maximum value. +* +* @template T - The type of elements in the array. +* @param {ArrayLike | null | undefined} [items] - The array of elements to search. Defaults to an empty array. +* @returns {T | undefined} - The element with the maximum value, or undefined if the array is empty. +*/ +function max(items) { + if (!items || items.length === 0) return; + let maxResult = void 0; + for (let i = 0; i < items.length; i++) { + const current = items[i]; + if (current == null || Number.isNaN(current) || typeof current === "symbol") continue; + if (maxResult === void 0 || current > maxResult) maxResult = current; + } + return maxResult; +} +//#endregion +exports.max = max; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/max.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/math/max.mjs new file mode 100644 index 0000000000000000000000000000000000000000..257127e068b09455e8fc640cafa01ee54d44851d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/max.mjs @@ -0,0 +1,20 @@ +//#region src/compat/math/max.ts +/** +* Finds the element in an array that has the maximum value. +* +* @template T - The type of elements in the array. +* @param {ArrayLike | null | undefined} [items] - The array of elements to search. Defaults to an empty array. +* @returns {T | undefined} - The element with the maximum value, or undefined if the array is empty. +*/ +function max(items) { + if (!items || items.length === 0) return; + let maxResult = void 0; + for (let i = 0; i < items.length; i++) { + const current = items[i]; + if (current == null || Number.isNaN(current) || typeof current === "symbol") continue; + if (maxResult === void 0 || current > maxResult) maxResult = current; + } + return maxResult; +} +//#endregion +export { max }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/maxBy.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/math/maxBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..62792394ebbf42e4dea92654d9ebb5b5f050368b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/maxBy.d.mts @@ -0,0 +1,34 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.mjs"; + +//#region src/compat/math/maxBy.d.ts +/** + * Finds the element in an array that has the maximum value when applying + * the `iteratee` to each element. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} items The array of elements to search. + * @param {ValueIteratee} iteratee + * The criteria used to determine the maximum value. + * - If a **function** is provided, it extracts a numeric value from each element. + * - If a **string** is provided, it is treated as a key to extract values from the objects. + * - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair. + * - If an **object** is provided, it matches elements that contain the specified properties. + * @returns {T | undefined} The element with the maximum value as determined by the `iteratee`. + * @example + * maxBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 3 } + * maxBy([], x => x.a); // Returns: undefined + * maxBy( + * [ + * { name: 'john', age: 30 }, + * { name: 'jane', age: 28 }, + * { name: 'joe', age: 26 }, + * ], + * x => x.age + * ); // Returns: { name: 'john', age: 30 } + * maxBy([{ a: 1 }, { a: 2 }], 'a'); // Returns: { a: 2 } + * maxBy([{ a: 1 }, { a: 2 }], ['a', 1]); // Returns: { a: 1 } + * maxBy([{ a: 1 }, { a: 2 }], { a: 1 }); // Returns: { a: 1 } + */ +declare function maxBy(items: ArrayLike | null | undefined, iteratee?: ValueIteratee): T | undefined; +//#endregion +export { maxBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/maxBy.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/math/maxBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..462bfafd90965f7a757c45770dcf6322663e02b6 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/maxBy.d.ts @@ -0,0 +1,34 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.js"; + +//#region src/compat/math/maxBy.d.ts +/** + * Finds the element in an array that has the maximum value when applying + * the `iteratee` to each element. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} items The array of elements to search. + * @param {ValueIteratee} iteratee + * The criteria used to determine the maximum value. + * - If a **function** is provided, it extracts a numeric value from each element. + * - If a **string** is provided, it is treated as a key to extract values from the objects. + * - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair. + * - If an **object** is provided, it matches elements that contain the specified properties. + * @returns {T | undefined} The element with the maximum value as determined by the `iteratee`. + * @example + * maxBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 3 } + * maxBy([], x => x.a); // Returns: undefined + * maxBy( + * [ + * { name: 'john', age: 30 }, + * { name: 'jane', age: 28 }, + * { name: 'joe', age: 26 }, + * ], + * x => x.age + * ); // Returns: { name: 'john', age: 30 } + * maxBy([{ a: 1 }, { a: 2 }], 'a'); // Returns: { a: 2 } + * maxBy([{ a: 1 }, { a: 2 }], ['a', 1]); // Returns: { a: 1 } + * maxBy([{ a: 1 }, { a: 2 }], { a: 1 }); // Returns: { a: 1 } + */ +declare function maxBy(items: ArrayLike | null | undefined, iteratee?: ValueIteratee): T | undefined; +//#endregion +export { maxBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/maxBy.js b/tools/ui/node_modules/es-toolkit/dist/compat/math/maxBy.js new file mode 100644 index 0000000000000000000000000000000000000000..7b9c8fc13ba259357ce141266c114f261482e463 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/maxBy.js @@ -0,0 +1,38 @@ +const require_maxBy = require("../../array/maxBy.js"); +const require_identity = require("../../function/identity.js"); +const require_iteratee = require("../util/iteratee.js"); +//#region src/compat/math/maxBy.ts +/** +* Finds the element in an array that has the maximum value when applying +* the `iteratee` to each element. +* +* @template T - The type of elements in the array. +* @param {ArrayLike | null | undefined} items The array of elements to search. +* @param {ValueIteratee} iteratee +* The criteria used to determine the maximum value. +* - If a **function** is provided, it extracts a numeric value from each element. +* - If a **string** is provided, it is treated as a key to extract values from the objects. +* - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair. +* - If an **object** is provided, it matches elements that contain the specified properties. +* @returns {T | undefined} The element with the maximum value as determined by the `iteratee`. +* @example +* maxBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 3 } +* maxBy([], x => x.a); // Returns: undefined +* maxBy( +* [ +* { name: 'john', age: 30 }, +* { name: 'jane', age: 28 }, +* { name: 'joe', age: 26 }, +* ], +* x => x.age +* ); // Returns: { name: 'john', age: 30 } +* maxBy([{ a: 1 }, { a: 2 }], 'a'); // Returns: { a: 2 } +* maxBy([{ a: 1 }, { a: 2 }], ['a', 1]); // Returns: { a: 1 } +* maxBy([{ a: 1 }, { a: 2 }], { a: 1 }); // Returns: { a: 1 } +*/ +function maxBy(items, iteratee$1) { + if (items == null) return; + return require_maxBy.maxBy(Array.from(items), require_iteratee.iteratee(iteratee$1 ?? require_identity.identity)); +} +//#endregion +exports.maxBy = maxBy; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/maxBy.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/math/maxBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..cb8d0d1c382fe721d0f8a35e294dc0e427b592e0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/maxBy.mjs @@ -0,0 +1,38 @@ +import { maxBy as maxBy$1 } from "../../array/maxBy.mjs"; +import { identity } from "../../function/identity.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +//#region src/compat/math/maxBy.ts +/** +* Finds the element in an array that has the maximum value when applying +* the `iteratee` to each element. +* +* @template T - The type of elements in the array. +* @param {ArrayLike | null | undefined} items The array of elements to search. +* @param {ValueIteratee} iteratee +* The criteria used to determine the maximum value. +* - If a **function** is provided, it extracts a numeric value from each element. +* - If a **string** is provided, it is treated as a key to extract values from the objects. +* - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair. +* - If an **object** is provided, it matches elements that contain the specified properties. +* @returns {T | undefined} The element with the maximum value as determined by the `iteratee`. +* @example +* maxBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 3 } +* maxBy([], x => x.a); // Returns: undefined +* maxBy( +* [ +* { name: 'john', age: 30 }, +* { name: 'jane', age: 28 }, +* { name: 'joe', age: 26 }, +* ], +* x => x.age +* ); // Returns: { name: 'john', age: 30 } +* maxBy([{ a: 1 }, { a: 2 }], 'a'); // Returns: { a: 2 } +* maxBy([{ a: 1 }, { a: 2 }], ['a', 1]); // Returns: { a: 1 } +* maxBy([{ a: 1 }, { a: 2 }], { a: 1 }); // Returns: { a: 1 } +*/ +function maxBy(items, iteratee$1) { + if (items == null) return; + return maxBy$1(Array.from(items), iteratee(iteratee$1 ?? identity)); +} +//#endregion +export { maxBy }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/mean.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/math/mean.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..3a9c3eaf5a70b1602d48777989c89ff67e1f67b8 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/mean.d.mts @@ -0,0 +1,17 @@ +//#region src/compat/math/mean.d.ts +/** + * Calculates the average of an array of numbers. + * + * If the array is empty, this function returns `NaN`. + * + * @param {ArrayLike | null | undefined} nums - An array of numbers to calculate the average. + * @returns {number} The average of all the numbers in the array. + * + * @example + * const numbers = [1, 2, 3, 4, 5]; + * const result = mean(numbers); + * // result will be 3 + */ +declare function mean(nums: ArrayLike | null | undefined): number; +//#endregion +export { mean }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/mean.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/math/mean.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3a9c3eaf5a70b1602d48777989c89ff67e1f67b8 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/mean.d.ts @@ -0,0 +1,17 @@ +//#region src/compat/math/mean.d.ts +/** + * Calculates the average of an array of numbers. + * + * If the array is empty, this function returns `NaN`. + * + * @param {ArrayLike | null | undefined} nums - An array of numbers to calculate the average. + * @returns {number} The average of all the numbers in the array. + * + * @example + * const numbers = [1, 2, 3, 4, 5]; + * const result = mean(numbers); + * // result will be 3 + */ +declare function mean(nums: ArrayLike | null | undefined): number; +//#endregion +export { mean }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/mean.js b/tools/ui/node_modules/es-toolkit/dist/compat/math/mean.js new file mode 100644 index 0000000000000000000000000000000000000000..f9604404dfcaacb09277dc168eb54a5d0995fbf7 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/mean.js @@ -0,0 +1,21 @@ +const require_sum = require("./sum.js"); +//#region src/compat/math/mean.ts +/** +* Calculates the average of an array of numbers. +* +* If the array is empty, this function returns `NaN`. +* +* @param {ArrayLike | null | undefined} nums - An array of numbers to calculate the average. +* @returns {number} The average of all the numbers in the array. +* +* @example +* const numbers = [1, 2, 3, 4, 5]; +* const result = mean(numbers); +* // result will be 3 +*/ +function mean(nums) { + const length = nums ? nums.length : 0; + return length === 0 ? NaN : require_sum.sum(nums) / length; +} +//#endregion +exports.mean = mean; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/mean.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/math/mean.mjs new file mode 100644 index 0000000000000000000000000000000000000000..13812c8144afc0e43e244d9c4aa09a8b08505163 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/mean.mjs @@ -0,0 +1,21 @@ +import { sum } from "./sum.mjs"; +//#region src/compat/math/mean.ts +/** +* Calculates the average of an array of numbers. +* +* If the array is empty, this function returns `NaN`. +* +* @param {ArrayLike | null | undefined} nums - An array of numbers to calculate the average. +* @returns {number} The average of all the numbers in the array. +* +* @example +* const numbers = [1, 2, 3, 4, 5]; +* const result = mean(numbers); +* // result will be 3 +*/ +function mean(nums) { + const length = nums ? nums.length : 0; + return length === 0 ? NaN : sum(nums) / length; +} +//#endregion +export { mean }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/meanBy.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/math/meanBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..bfb83eba351a00d4210e4215d2ee034aa78f4c15 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/meanBy.d.mts @@ -0,0 +1,28 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.mjs"; + +//#region src/compat/math/meanBy.d.ts +/** + * Calculates the average of an array of numbers when applying + * the `iteratee` function to each element. + * + * If the array is empty, this function returns `NaN`. + * + * @template T - The type of elements in the array. + * @param {T[]} items An array to calculate the average. + * @param {((element: T) => unknown) | PropertyKey | [PropertyKey, any] | PartialShallow} iteratee + * The criteria used to determine the maximum value. + * - If a **function** is provided, it extracts a numeric value from each element. + * - If a **string** is provided, it is treated as a key to extract values from the objects. + * - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair. + * - If an **object** is provided, it matches elements that contain the specified properties. + * @returns {number} The average of all the numbers as determined by the `iteratee` function. + * + * @example + * meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2 + * meanBy([], x => x.a); // Returns: NaN + * meanBy([[2], [3], [1]], 0); // Returns: 2 + * meanBy([{ a: 2 }, { a: 3 }, { a: 1 }], 'a'); // Returns: 2 + */ +declare function meanBy(items: ArrayLike | null | undefined, iteratee?: ValueIteratee): number; +//#endregion +export { meanBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/meanBy.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/math/meanBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..799b965cf6927d23844d5f0fee8241be0f86d01c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/meanBy.d.ts @@ -0,0 +1,28 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.js"; + +//#region src/compat/math/meanBy.d.ts +/** + * Calculates the average of an array of numbers when applying + * the `iteratee` function to each element. + * + * If the array is empty, this function returns `NaN`. + * + * @template T - The type of elements in the array. + * @param {T[]} items An array to calculate the average. + * @param {((element: T) => unknown) | PropertyKey | [PropertyKey, any] | PartialShallow} iteratee + * The criteria used to determine the maximum value. + * - If a **function** is provided, it extracts a numeric value from each element. + * - If a **string** is provided, it is treated as a key to extract values from the objects. + * - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair. + * - If an **object** is provided, it matches elements that contain the specified properties. + * @returns {number} The average of all the numbers as determined by the `iteratee` function. + * + * @example + * meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2 + * meanBy([], x => x.a); // Returns: NaN + * meanBy([[2], [3], [1]], 0); // Returns: 2 + * meanBy([{ a: 2 }, { a: 3 }, { a: 1 }], 'a'); // Returns: 2 + */ +declare function meanBy(items: ArrayLike | null | undefined, iteratee?: ValueIteratee): number; +//#endregion +export { meanBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/meanBy.js b/tools/ui/node_modules/es-toolkit/dist/compat/math/meanBy.js new file mode 100644 index 0000000000000000000000000000000000000000..cd94baa2a17c85d34362c67ef98d7517375a63cc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/meanBy.js @@ -0,0 +1,32 @@ +const require_identity = require("../../function/identity.js"); +const require_meanBy = require("../../math/meanBy.js"); +const require_iteratee = require("../util/iteratee.js"); +//#region src/compat/math/meanBy.ts +/** +* Calculates the average of an array of numbers when applying +* the `iteratee` function to each element. +* +* If the array is empty, this function returns `NaN`. +* +* @template T - The type of elements in the array. +* @param {T[]} items An array to calculate the average. +* @param {((element: T) => unknown) | PropertyKey | [PropertyKey, any] | PartialShallow} iteratee +* The criteria used to determine the maximum value. +* - If a **function** is provided, it extracts a numeric value from each element. +* - If a **string** is provided, it is treated as a key to extract values from the objects. +* - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair. +* - If an **object** is provided, it matches elements that contain the specified properties. +* @returns {number} The average of all the numbers as determined by the `iteratee` function. +* +* @example +* meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2 +* meanBy([], x => x.a); // Returns: NaN +* meanBy([[2], [3], [1]], 0); // Returns: 2 +* meanBy([{ a: 2 }, { a: 3 }, { a: 1 }], 'a'); // Returns: 2 +*/ +function meanBy(items, iteratee$1) { + if (items == null) return NaN; + return require_meanBy.meanBy(Array.from(items), require_iteratee.iteratee(iteratee$1 ?? require_identity.identity)); +} +//#endregion +exports.meanBy = meanBy; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/meanBy.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/math/meanBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..184f381ea5ccdf178291da7b4399117cd162718a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/meanBy.mjs @@ -0,0 +1,32 @@ +import { identity } from "../../function/identity.mjs"; +import { meanBy as meanBy$1 } from "../../math/meanBy.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +//#region src/compat/math/meanBy.ts +/** +* Calculates the average of an array of numbers when applying +* the `iteratee` function to each element. +* +* If the array is empty, this function returns `NaN`. +* +* @template T - The type of elements in the array. +* @param {T[]} items An array to calculate the average. +* @param {((element: T) => unknown) | PropertyKey | [PropertyKey, any] | PartialShallow} iteratee +* The criteria used to determine the maximum value. +* - If a **function** is provided, it extracts a numeric value from each element. +* - If a **string** is provided, it is treated as a key to extract values from the objects. +* - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair. +* - If an **object** is provided, it matches elements that contain the specified properties. +* @returns {number} The average of all the numbers as determined by the `iteratee` function. +* +* @example +* meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2 +* meanBy([], x => x.a); // Returns: NaN +* meanBy([[2], [3], [1]], 0); // Returns: 2 +* meanBy([{ a: 2 }, { a: 3 }, { a: 1 }], 'a'); // Returns: 2 +*/ +function meanBy(items, iteratee$1) { + if (items == null) return NaN; + return meanBy$1(Array.from(items), iteratee(iteratee$1 ?? identity)); +} +//#endregion +export { meanBy }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/min.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/math/min.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f6658f1d63f44e159ef13b64251dec875411316b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/min.d.mts @@ -0,0 +1,11 @@ +//#region src/compat/math/min.d.ts +/** + * Finds the element in an array that has the minimum value. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} [items] - The array of elements to search. Defaults to an empty array. + * @returns {T | undefined} - The element with the minimum value, or undefined if the array is empty. + */ +declare function min(items: ArrayLike | null | undefined): T | undefined; +//#endregion +export { min }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/min.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/math/min.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f6658f1d63f44e159ef13b64251dec875411316b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/min.d.ts @@ -0,0 +1,11 @@ +//#region src/compat/math/min.d.ts +/** + * Finds the element in an array that has the minimum value. + * + * @template T - The type of elements in the array. + * @param {ArrayLike | null | undefined} [items] - The array of elements to search. Defaults to an empty array. + * @returns {T | undefined} - The element with the minimum value, or undefined if the array is empty. + */ +declare function min(items: ArrayLike | null | undefined): T | undefined; +//#endregion +export { min }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/min.js b/tools/ui/node_modules/es-toolkit/dist/compat/math/min.js new file mode 100644 index 0000000000000000000000000000000000000000..fce14d8a1d8119addc1b7a82f48db5abee38e7f5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/min.js @@ -0,0 +1,20 @@ +//#region src/compat/math/min.ts +/** +* Finds the element in an array that has the minimum value. +* +* @template T - The type of elements in the array. +* @param {ArrayLike | null | undefined} [items] - The array of elements to search. Defaults to an empty array. +* @returns {T | undefined} - The element with the minimum value, or undefined if the array is empty. +*/ +function min(items) { + if (!items || items.length === 0) return; + let minResult = void 0; + for (let i = 0; i < items.length; i++) { + const current = items[i]; + if (current == null || Number.isNaN(current) || typeof current === "symbol") continue; + if (minResult === void 0 || current < minResult) minResult = current; + } + return minResult; +} +//#endregion +exports.min = min; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/min.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/math/min.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c8960a694c9b0bef51f88a97974a3103280bfbfd --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/min.mjs @@ -0,0 +1,20 @@ +//#region src/compat/math/min.ts +/** +* Finds the element in an array that has the minimum value. +* +* @template T - The type of elements in the array. +* @param {ArrayLike | null | undefined} [items] - The array of elements to search. Defaults to an empty array. +* @returns {T | undefined} - The element with the minimum value, or undefined if the array is empty. +*/ +function min(items) { + if (!items || items.length === 0) return; + let minResult = void 0; + for (let i = 0; i < items.length; i++) { + const current = items[i]; + if (current == null || Number.isNaN(current) || typeof current === "symbol") continue; + if (minResult === void 0 || current < minResult) minResult = current; + } + return minResult; +} +//#endregion +export { min }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/minBy.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/math/minBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..cc7f8f66b07a830facdf906290f26d6dd4b0b71e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/minBy.d.mts @@ -0,0 +1,34 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.mjs"; + +//#region src/compat/math/minBy.d.ts +/** + * Finds the element in an array that has the minimum value when applying + * the `iteratee` to each element. + * + * @template T - The type of elements in the array. + * @param {T[]} items The array of elements to search. + * @param {((element: T) => number) | keyof T | [keyof T, unknown] | Partial} iteratee + * The criteria used to determine the minimum value. + * - If a **function** is provided, it extracts a numeric value from each element. + * - If a **string** is provided, it is treated as a key to extract values from the objects. + * - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair. + * - If an **object** is provided, it matches elements that contain the specified properties. + * @returns {T | undefined} The element with the minimum value as determined by the `iteratee`. + * @example + * minBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 1 } + * minBy([], x => x.a); // Returns: undefined + * minBy( + * [ + * { name: 'john', age: 30 }, + * { name: 'jane', age: 28 }, + * { name: 'joe', age: 26 }, + * ], + * x => x.age + * ); // Returns: { name: 'joe', age: 26 } + * minBy([{ a: 1 }, { a: 2 }], 'a'); // Returns: { a: 1 } + * minBy([{ a: 1 }, { a: 2 }], ['a', 1]); // Returns: { a: 2 } + * minBy([{ a: 1 }, { a: 2 }], { a: 1 }); // Returns: { a: 2 } + */ +declare function minBy(items: ArrayLike | null | undefined, iteratee?: ValueIteratee): T | undefined; +//#endregion +export { minBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/minBy.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/math/minBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5f740fa3d8b10d54a70e34b5b298971ad496dc4b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/minBy.d.ts @@ -0,0 +1,34 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.js"; + +//#region src/compat/math/minBy.d.ts +/** + * Finds the element in an array that has the minimum value when applying + * the `iteratee` to each element. + * + * @template T - The type of elements in the array. + * @param {T[]} items The array of elements to search. + * @param {((element: T) => number) | keyof T | [keyof T, unknown] | Partial} iteratee + * The criteria used to determine the minimum value. + * - If a **function** is provided, it extracts a numeric value from each element. + * - If a **string** is provided, it is treated as a key to extract values from the objects. + * - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair. + * - If an **object** is provided, it matches elements that contain the specified properties. + * @returns {T | undefined} The element with the minimum value as determined by the `iteratee`. + * @example + * minBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 1 } + * minBy([], x => x.a); // Returns: undefined + * minBy( + * [ + * { name: 'john', age: 30 }, + * { name: 'jane', age: 28 }, + * { name: 'joe', age: 26 }, + * ], + * x => x.age + * ); // Returns: { name: 'joe', age: 26 } + * minBy([{ a: 1 }, { a: 2 }], 'a'); // Returns: { a: 1 } + * minBy([{ a: 1 }, { a: 2 }], ['a', 1]); // Returns: { a: 2 } + * minBy([{ a: 1 }, { a: 2 }], { a: 1 }); // Returns: { a: 2 } + */ +declare function minBy(items: ArrayLike | null | undefined, iteratee?: ValueIteratee): T | undefined; +//#endregion +export { minBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/minBy.js b/tools/ui/node_modules/es-toolkit/dist/compat/math/minBy.js new file mode 100644 index 0000000000000000000000000000000000000000..86ada09870dfece529e78d3edd952fd87b5e031d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/minBy.js @@ -0,0 +1,38 @@ +const require_minBy = require("../../array/minBy.js"); +const require_identity = require("../../function/identity.js"); +const require_iteratee = require("../util/iteratee.js"); +//#region src/compat/math/minBy.ts +/** +* Finds the element in an array that has the minimum value when applying +* the `iteratee` to each element. +* +* @template T - The type of elements in the array. +* @param {T[]} items The array of elements to search. +* @param {((element: T) => number) | keyof T | [keyof T, unknown] | Partial} iteratee +* The criteria used to determine the minimum value. +* - If a **function** is provided, it extracts a numeric value from each element. +* - If a **string** is provided, it is treated as a key to extract values from the objects. +* - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair. +* - If an **object** is provided, it matches elements that contain the specified properties. +* @returns {T | undefined} The element with the minimum value as determined by the `iteratee`. +* @example +* minBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 1 } +* minBy([], x => x.a); // Returns: undefined +* minBy( +* [ +* { name: 'john', age: 30 }, +* { name: 'jane', age: 28 }, +* { name: 'joe', age: 26 }, +* ], +* x => x.age +* ); // Returns: { name: 'joe', age: 26 } +* minBy([{ a: 1 }, { a: 2 }], 'a'); // Returns: { a: 1 } +* minBy([{ a: 1 }, { a: 2 }], ['a', 1]); // Returns: { a: 2 } +* minBy([{ a: 1 }, { a: 2 }], { a: 1 }); // Returns: { a: 2 } +*/ +function minBy(items, iteratee$1) { + if (items == null) return; + return require_minBy.minBy(Array.from(items), require_iteratee.iteratee(iteratee$1 ?? require_identity.identity)); +} +//#endregion +exports.minBy = minBy; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/minBy.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/math/minBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4f717796205d139451e20ae452a0808001c17cfc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/minBy.mjs @@ -0,0 +1,38 @@ +import { minBy as minBy$1 } from "../../array/minBy.mjs"; +import { identity } from "../../function/identity.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +//#region src/compat/math/minBy.ts +/** +* Finds the element in an array that has the minimum value when applying +* the `iteratee` to each element. +* +* @template T - The type of elements in the array. +* @param {T[]} items The array of elements to search. +* @param {((element: T) => number) | keyof T | [keyof T, unknown] | Partial} iteratee +* The criteria used to determine the minimum value. +* - If a **function** is provided, it extracts a numeric value from each element. +* - If a **string** is provided, it is treated as a key to extract values from the objects. +* - If a **[key, value]** pair is provided, it matches elements with the specified key-value pair. +* - If an **object** is provided, it matches elements that contain the specified properties. +* @returns {T | undefined} The element with the minimum value as determined by the `iteratee`. +* @example +* minBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: { a: 1 } +* minBy([], x => x.a); // Returns: undefined +* minBy( +* [ +* { name: 'john', age: 30 }, +* { name: 'jane', age: 28 }, +* { name: 'joe', age: 26 }, +* ], +* x => x.age +* ); // Returns: { name: 'joe', age: 26 } +* minBy([{ a: 1 }, { a: 2 }], 'a'); // Returns: { a: 1 } +* minBy([{ a: 1 }, { a: 2 }], ['a', 1]); // Returns: { a: 2 } +* minBy([{ a: 1 }, { a: 2 }], { a: 1 }); // Returns: { a: 2 } +*/ +function minBy(items, iteratee$1) { + if (items == null) return; + return minBy$1(Array.from(items), iteratee(iteratee$1 ?? identity)); +} +//#endregion +export { minBy }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/multiply.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/math/multiply.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..4ff581aaf714ba3764fa0fd0ce6dabcd83dfcc2b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/multiply.d.mts @@ -0,0 +1,19 @@ +//#region src/compat/math/multiply.d.ts +/** + * Multiply two numbers. + * + * If either of the numbers is `NaN`, the function returns `NaN`. + * + * @param {number} value The first number in a multiplication + * @param {number} other The second number in a multiplication + * @returns {number} The product of value and other + * + * @example + * multiply(2, 3); // => 6 + * multiply(2, NaN); // => NaN + * multiply(NaN, 3); // => NaN + * multiply(NaN, NaN); // => NaN + */ +declare function multiply(value: number, other: number): number; +//#endregion +export { multiply }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/multiply.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/math/multiply.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4ff581aaf714ba3764fa0fd0ce6dabcd83dfcc2b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/multiply.d.ts @@ -0,0 +1,19 @@ +//#region src/compat/math/multiply.d.ts +/** + * Multiply two numbers. + * + * If either of the numbers is `NaN`, the function returns `NaN`. + * + * @param {number} value The first number in a multiplication + * @param {number} other The second number in a multiplication + * @returns {number} The product of value and other + * + * @example + * multiply(2, 3); // => 6 + * multiply(2, NaN); // => NaN + * multiply(NaN, 3); // => NaN + * multiply(NaN, NaN); // => NaN + */ +declare function multiply(value: number, other: number): number; +//#endregion +export { multiply }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/multiply.js b/tools/ui/node_modules/es-toolkit/dist/compat/math/multiply.js new file mode 100644 index 0000000000000000000000000000000000000000..2d3498e9e0e413b84ef2b8a4a21dc97506328141 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/multiply.js @@ -0,0 +1,32 @@ +const require_toNumber = require("../util/toNumber.js"); +const require_toString = require("../util/toString.js"); +//#region src/compat/math/multiply.ts +/** +* Multiply two numbers. +* +* If either of the numbers is `NaN`, the function returns `NaN`. +* +* @param {number} value The first number in a multiplication +* @param {number} other The second number in a multiplication +* @returns {number} The product of value and other +* +* @example +* multiply(2, 3); // => 6 +* multiply(2, NaN); // => NaN +* multiply(NaN, 3); // => NaN +* multiply(NaN, NaN); // => NaN +*/ +function multiply(value, other) { + if (value === void 0 && other === void 0) return 1; + if (value === void 0 || other === void 0) return value ?? other; + if (typeof value === "string" || typeof other === "string") { + value = require_toString.toString(value); + other = require_toString.toString(other); + } else { + value = require_toNumber.toNumber(value); + other = require_toNumber.toNumber(other); + } + return value * other; +} +//#endregion +exports.multiply = multiply; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/multiply.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/math/multiply.mjs new file mode 100644 index 0000000000000000000000000000000000000000..0e86474ff5cd3ca3077b329d7de7b850d1dd923a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/multiply.mjs @@ -0,0 +1,32 @@ +import { toNumber } from "../util/toNumber.mjs"; +import { toString } from "../util/toString.mjs"; +//#region src/compat/math/multiply.ts +/** +* Multiply two numbers. +* +* If either of the numbers is `NaN`, the function returns `NaN`. +* +* @param {number} value The first number in a multiplication +* @param {number} other The second number in a multiplication +* @returns {number} The product of value and other +* +* @example +* multiply(2, 3); // => 6 +* multiply(2, NaN); // => NaN +* multiply(NaN, 3); // => NaN +* multiply(NaN, NaN); // => NaN +*/ +function multiply(value, other) { + if (value === void 0 && other === void 0) return 1; + if (value === void 0 || other === void 0) return value ?? other; + if (typeof value === "string" || typeof other === "string") { + value = toString(value); + other = toString(other); + } else { + value = toNumber(value); + other = toNumber(other); + } + return value * other; +} +//#endregion +export { multiply }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/parseInt.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/math/parseInt.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..89d97b2e99f4908b026f2ca3eac907971ee1f66b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/parseInt.d.mts @@ -0,0 +1,21 @@ +//#region src/compat/math/parseInt.d.ts +/** + * Converts `string` to an integer of the specified radix. If `radix` is undefined or 0, a `radix` of 10 is used unless `string` is a hexadecimal, in which case a `radix` of 16 is used. + * + * @param {string} string The string to convert to an integer. + * @param {number} radix The radix to use when converting the string to an integer. Defaults to `0`. + * @param {unknown} guard Enables use as an iteratee for methods like `Array#map`. + * @returns {number} Returns the converted integer. + * + * @example + * parseInt('08'); // => 8 + * parseInt('0x20'); // => 32 + * + * parseInt('08', 10); // => 8 + * parseInt('0x20', 16); // => 32 + * + * ['6', '08', '10'].map(parseInt); // => [6, 8, 10] + */ +declare function parseInt(string: string, radix?: number): number; +//#endregion +export { parseInt }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/parseInt.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/math/parseInt.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..89d97b2e99f4908b026f2ca3eac907971ee1f66b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/parseInt.d.ts @@ -0,0 +1,21 @@ +//#region src/compat/math/parseInt.d.ts +/** + * Converts `string` to an integer of the specified radix. If `radix` is undefined or 0, a `radix` of 10 is used unless `string` is a hexadecimal, in which case a `radix` of 16 is used. + * + * @param {string} string The string to convert to an integer. + * @param {number} radix The radix to use when converting the string to an integer. Defaults to `0`. + * @param {unknown} guard Enables use as an iteratee for methods like `Array#map`. + * @returns {number} Returns the converted integer. + * + * @example + * parseInt('08'); // => 8 + * parseInt('0x20'); // => 32 + * + * parseInt('08', 10); // => 8 + * parseInt('0x20', 16); // => 32 + * + * ['6', '08', '10'].map(parseInt); // => [6, 8, 10] + */ +declare function parseInt(string: string, radix?: number): number; +//#endregion +export { parseInt }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/parseInt.js b/tools/ui/node_modules/es-toolkit/dist/compat/math/parseInt.js new file mode 100644 index 0000000000000000000000000000000000000000..1456091e8eb8fa9f1db29433ff6c4bebaf0c0860 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/parseInt.js @@ -0,0 +1,24 @@ +//#region src/compat/math/parseInt.ts +/** +* Converts `string` to an integer of the specified radix. If `radix` is undefined or 0, a `radix` of 10 is used unless `string` is a hexadecimal, in which case a `radix` of 16 is used. +* +* @param {string} string The string to convert to an integer. +* @param {number} radix The radix to use when converting the string to an integer. Defaults to `0`. +* @param {unknown} guard Enables use as an iteratee for methods like `Array#map`. +* @returns {number} Returns the converted integer. +* +* @example +* parseInt('08'); // => 8 +* parseInt('0x20'); // => 32 +* +* parseInt('08', 10); // => 8 +* parseInt('0x20', 16); // => 32 +* +* ['6', '08', '10'].map(parseInt); // => [6, 8, 10] +*/ +function parseInt(string, radix = 0, guard) { + if (guard) radix = 0; + return Number.parseInt(string, radix); +} +//#endregion +exports.parseInt = parseInt; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/parseInt.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/math/parseInt.mjs new file mode 100644 index 0000000000000000000000000000000000000000..91764c42a2097cb51ec75d3117607efa098230ce --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/parseInt.mjs @@ -0,0 +1,24 @@ +//#region src/compat/math/parseInt.ts +/** +* Converts `string` to an integer of the specified radix. If `radix` is undefined or 0, a `radix` of 10 is used unless `string` is a hexadecimal, in which case a `radix` of 16 is used. +* +* @param {string} string The string to convert to an integer. +* @param {number} radix The radix to use when converting the string to an integer. Defaults to `0`. +* @param {unknown} guard Enables use as an iteratee for methods like `Array#map`. +* @returns {number} Returns the converted integer. +* +* @example +* parseInt('08'); // => 8 +* parseInt('0x20'); // => 32 +* +* parseInt('08', 10); // => 8 +* parseInt('0x20', 16); // => 32 +* +* ['6', '08', '10'].map(parseInt); // => [6, 8, 10] +*/ +function parseInt(string, radix = 0, guard) { + if (guard) radix = 0; + return Number.parseInt(string, radix); +} +//#endregion +export { parseInt }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/random.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/math/random.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..7e8c6197c1dfaa7c1d2745f878c25300780f2d32 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/random.d.mts @@ -0,0 +1,47 @@ +//#region src/compat/math/random.d.ts +/** + * Generate a random number between 0 and 1. + * @param {boolean} [floating] - Whether to return a floating point number. Defaults to true. + * @returns {number} A random number between 0 and 1. + * @example + * random(); // Returns a random number between 0 and 1 + * random(true); // Returns a random floating point number between 0 and 1 + * random(false); // Returns a random integer between 0 and 1 + */ +declare function random(floating?: boolean): number; +/** + * Generate a random number between 0 and max. + * @param {number} max - The upper bound (exclusive). + * @param {boolean} [floating] - Whether to return a floating point number. Defaults to true. + * @returns {number} A random number between 0 and max. + * @example + * random(5); // Returns a random number between 0 and 5 + * random(10, true); // Returns a random floating point number between 0 and 10 + * random(3, false); // Returns a random integer between 0 and 3 + */ +declare function random(max: number, floating?: boolean): number; +/** + * Generate a random number between min and max. + * @param {number} min - The lower bound (inclusive). + * @param {number} max - The upper bound (exclusive). + * @param {boolean} [floating] - Whether to return a floating point number. Defaults to true. + * @returns {number} A random number between min and max. + * @example + * random(1, 5); // Returns a random number between 1 and 5 + * random(0, 10, true); // Returns a random floating point number between 0 and 10 + * random(1, 6, false); // Returns a random integer between 1 and 6 + */ +declare function random(min: number, max: number, floating?: boolean): number; +/** + * Generate a random number between 0 and min, using guard object for special cases. + * @param {number} min - The upper bound (exclusive). + * @param {string | number} index - The index or key to check in the guard object. + * @param {object} guard - The guard object to validate the parameters. + * @returns {number} A random number between 0 and min. + * @example + * const guard = { 5: 5 }; + * random(5, 5, guard); // Returns a random number between 0 and 5 + */ +declare function random(min: number, index: string | number, guard: object): number; +//#endregion +export { random }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/random.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/math/random.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7e8c6197c1dfaa7c1d2745f878c25300780f2d32 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/random.d.ts @@ -0,0 +1,47 @@ +//#region src/compat/math/random.d.ts +/** + * Generate a random number between 0 and 1. + * @param {boolean} [floating] - Whether to return a floating point number. Defaults to true. + * @returns {number} A random number between 0 and 1. + * @example + * random(); // Returns a random number between 0 and 1 + * random(true); // Returns a random floating point number between 0 and 1 + * random(false); // Returns a random integer between 0 and 1 + */ +declare function random(floating?: boolean): number; +/** + * Generate a random number between 0 and max. + * @param {number} max - The upper bound (exclusive). + * @param {boolean} [floating] - Whether to return a floating point number. Defaults to true. + * @returns {number} A random number between 0 and max. + * @example + * random(5); // Returns a random number between 0 and 5 + * random(10, true); // Returns a random floating point number between 0 and 10 + * random(3, false); // Returns a random integer between 0 and 3 + */ +declare function random(max: number, floating?: boolean): number; +/** + * Generate a random number between min and max. + * @param {number} min - The lower bound (inclusive). + * @param {number} max - The upper bound (exclusive). + * @param {boolean} [floating] - Whether to return a floating point number. Defaults to true. + * @returns {number} A random number between min and max. + * @example + * random(1, 5); // Returns a random number between 1 and 5 + * random(0, 10, true); // Returns a random floating point number between 0 and 10 + * random(1, 6, false); // Returns a random integer between 1 and 6 + */ +declare function random(min: number, max: number, floating?: boolean): number; +/** + * Generate a random number between 0 and min, using guard object for special cases. + * @param {number} min - The upper bound (exclusive). + * @param {string | number} index - The index or key to check in the guard object. + * @param {object} guard - The guard object to validate the parameters. + * @returns {number} A random number between 0 and min. + * @example + * const guard = { 5: 5 }; + * random(5, 5, guard); // Returns a random number between 0 and 5 + */ +declare function random(min: number, index: string | number, guard: object): number; +//#endregion +export { random }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/random.js b/tools/ui/node_modules/es-toolkit/dist/compat/math/random.js new file mode 100644 index 0000000000000000000000000000000000000000..674c64bc873e784711f9b06ec253d504c5ad3ec0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/random.js @@ -0,0 +1,56 @@ +const require_random = require("../../math/random.js"); +const require_randomInt = require("../../math/randomInt.js"); +const require_clamp = require("./clamp.js"); +//#region src/compat/math/random.ts +/** +* Generate a random number within the given range. +* +* @param {number} minimum - The lower bound (inclusive). +* @param {number} maximum - The upper bound (exclusive). +* @returns {number} A random number between minimum (inclusive) and maximum (exclusive). The number can be an integer or a decimal. +* @throws {Error} Throws an error if `maximum` is not greater than `minimum`. +* +* @example +* const result1 = random(0, 5); // Returns a random number between 0 and 5. +* const result2 = random(5, 0); // If the minimum is greater than the maximum, an error is thrown. +* const result3 = random(5, 5); // If the minimum is equal to the maximum, an error is thrown. +*/ +function random(...args) { + let minimum = 0; + let maximum = 1; + let floating = false; + switch (args.length) { + case 1: + if (typeof args[0] === "boolean") floating = args[0]; + else maximum = args[0]; + break; + case 2: if (typeof args[1] === "boolean") { + maximum = args[0]; + floating = args[1]; + } else { + minimum = args[0]; + maximum = args[1]; + } + case 3: if (typeof args[2] === "object" && args[2] != null && args[2][args[1]] === args[0]) { + minimum = 0; + maximum = args[0]; + floating = false; + } else { + minimum = args[0]; + maximum = args[1]; + floating = args[2]; + } + } + if (typeof minimum !== "number") minimum = Number(minimum); + if (typeof maximum !== "number") minimum = Number(maximum); + if (!minimum) minimum = 0; + if (!maximum) maximum = 0; + if (minimum > maximum) [minimum, maximum] = [maximum, minimum]; + minimum = require_clamp.clamp(minimum, -Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER); + maximum = require_clamp.clamp(maximum, -Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER); + if (minimum === maximum) return minimum; + if (floating) return require_random.random(minimum, maximum + 1); + else return require_randomInt.randomInt(minimum, maximum + 1); +} +//#endregion +exports.random = random; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/random.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/math/random.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b0c0ba2706afe761ad99f7984287f65f1774dd38 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/random.mjs @@ -0,0 +1,56 @@ +import { random as random$1 } from "../../math/random.mjs"; +import { randomInt } from "../../math/randomInt.mjs"; +import { clamp } from "./clamp.mjs"; +//#region src/compat/math/random.ts +/** +* Generate a random number within the given range. +* +* @param {number} minimum - The lower bound (inclusive). +* @param {number} maximum - The upper bound (exclusive). +* @returns {number} A random number between minimum (inclusive) and maximum (exclusive). The number can be an integer or a decimal. +* @throws {Error} Throws an error if `maximum` is not greater than `minimum`. +* +* @example +* const result1 = random(0, 5); // Returns a random number between 0 and 5. +* const result2 = random(5, 0); // If the minimum is greater than the maximum, an error is thrown. +* const result3 = random(5, 5); // If the minimum is equal to the maximum, an error is thrown. +*/ +function random(...args) { + let minimum = 0; + let maximum = 1; + let floating = false; + switch (args.length) { + case 1: + if (typeof args[0] === "boolean") floating = args[0]; + else maximum = args[0]; + break; + case 2: if (typeof args[1] === "boolean") { + maximum = args[0]; + floating = args[1]; + } else { + minimum = args[0]; + maximum = args[1]; + } + case 3: if (typeof args[2] === "object" && args[2] != null && args[2][args[1]] === args[0]) { + minimum = 0; + maximum = args[0]; + floating = false; + } else { + minimum = args[0]; + maximum = args[1]; + floating = args[2]; + } + } + if (typeof minimum !== "number") minimum = Number(minimum); + if (typeof maximum !== "number") minimum = Number(maximum); + if (!minimum) minimum = 0; + if (!maximum) maximum = 0; + if (minimum > maximum) [minimum, maximum] = [maximum, minimum]; + minimum = clamp(minimum, -Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER); + maximum = clamp(maximum, -Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER); + if (minimum === maximum) return minimum; + if (floating) return random$1(minimum, maximum + 1); + else return randomInt(minimum, maximum + 1); +} +//#endregion +export { random }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/range.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/math/range.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f5e459581222e0373c1343274a884168f71120af --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/range.d.mts @@ -0,0 +1,34 @@ +//#region src/compat/math/range.d.ts +/** + * Creates an array of numbers progressing from `start` up to, but not including, `end`. + * + * @param {number} start - The starting number of the range (inclusive) + * @param {number} end - The end number of the range (exclusive) + * @param {number} step - The value to increment or decrement by + * @returns {number[]} An array of numbers from start to end + * @example + * range(4) + * // => [0, 1, 2, 3] + * + * range(1, 5) + * // => [1, 2, 3, 4] + * + * range(0, 20, 5) + * // => [0, 5, 10, 15] + */ +declare function range(start: number, end?: number, step?: number): number[]; +/** + * Creates an array of numbers progressing from 0 up to, but not including, `end`. + * Used internally when range is called as an iteratee. + * + * @param {number} end - The end of the range (exclusive) + * @param {string|number} index - The index argument passed to the iteratee + * @param {object} guard - The guard object passed to the iteratee + * @returns {number[]} An array of numbers from 0 to end + * @example + * [1, 2, 3].map(range) + * // => [[0], [0, 1], [0, 1, 2]] + */ +declare function range(end: number, index: string | number, guard: object): number[]; +//#endregion +export { range }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/range.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/math/range.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f5e459581222e0373c1343274a884168f71120af --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/range.d.ts @@ -0,0 +1,34 @@ +//#region src/compat/math/range.d.ts +/** + * Creates an array of numbers progressing from `start` up to, but not including, `end`. + * + * @param {number} start - The starting number of the range (inclusive) + * @param {number} end - The end number of the range (exclusive) + * @param {number} step - The value to increment or decrement by + * @returns {number[]} An array of numbers from start to end + * @example + * range(4) + * // => [0, 1, 2, 3] + * + * range(1, 5) + * // => [1, 2, 3, 4] + * + * range(0, 20, 5) + * // => [0, 5, 10, 15] + */ +declare function range(start: number, end?: number, step?: number): number[]; +/** + * Creates an array of numbers progressing from 0 up to, but not including, `end`. + * Used internally when range is called as an iteratee. + * + * @param {number} end - The end of the range (exclusive) + * @param {string|number} index - The index argument passed to the iteratee + * @param {object} guard - The guard object passed to the iteratee + * @returns {number[]} An array of numbers from 0 to end + * @example + * [1, 2, 3].map(range) + * // => [[0], [0, 1], [0, 1, 2]] + */ +declare function range(end: number, index: string | number, guard: object): number[]; +//#endregion +export { range }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/range.js b/tools/ui/node_modules/es-toolkit/dist/compat/math/range.js new file mode 100644 index 0000000000000000000000000000000000000000..cd79f658402b844c95bae6970e3cf836d70e5e5d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/range.js @@ -0,0 +1,37 @@ +const require_toFinite = require("../util/toFinite.js"); +const require_isIterateeCall = require("../_internal/isIterateeCall.js"); +//#region src/compat/math/range.ts +/** +* Returns an array of numbers from `start` (inclusive) to `end` (exclusive), incrementing by `step`. +* +* @param {number} start - The starting number of the range (inclusive). +* @param {number} end - The end number of the range (exclusive). +* @param {number} step - The step value for the range. +* @returns {number[]} An array of numbers from `start` (inclusive) to `end` (exclusive) with the specified `step`. +* +* @example +* // Returns [0, 1, 2, 3] +* range(4); +* +* @example +* // Returns [0, -1, -2, -3] +* range(0, -4, -1); +*/ +function range(start, end, step) { + if (step && typeof step !== "number" && require_isIterateeCall.isIterateeCall(start, end, step)) end = step = void 0; + start = require_toFinite.toFinite(start); + if (end === void 0) { + end = start; + start = 0; + } else end = require_toFinite.toFinite(end); + step = step === void 0 ? start < end ? 1 : -1 : require_toFinite.toFinite(step); + const length = Math.max(Math.ceil((end - start) / (step || 1)), 0); + const result = new Array(length); + for (let index = 0; index < length; index++) { + result[index] = start; + start += step; + } + return result; +} +//#endregion +exports.range = range; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/range.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/math/range.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f111fae8b2fec4ad381d9d02895ac31f764e8b8a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/range.mjs @@ -0,0 +1,37 @@ +import { toFinite } from "../util/toFinite.mjs"; +import { isIterateeCall } from "../_internal/isIterateeCall.mjs"; +//#region src/compat/math/range.ts +/** +* Returns an array of numbers from `start` (inclusive) to `end` (exclusive), incrementing by `step`. +* +* @param {number} start - The starting number of the range (inclusive). +* @param {number} end - The end number of the range (exclusive). +* @param {number} step - The step value for the range. +* @returns {number[]} An array of numbers from `start` (inclusive) to `end` (exclusive) with the specified `step`. +* +* @example +* // Returns [0, 1, 2, 3] +* range(4); +* +* @example +* // Returns [0, -1, -2, -3] +* range(0, -4, -1); +*/ +function range(start, end, step) { + if (step && typeof step !== "number" && isIterateeCall(start, end, step)) end = step = void 0; + start = toFinite(start); + if (end === void 0) { + end = start; + start = 0; + } else end = toFinite(end); + step = step === void 0 ? start < end ? 1 : -1 : toFinite(step); + const length = Math.max(Math.ceil((end - start) / (step || 1)), 0); + const result = new Array(length); + for (let index = 0; index < length; index++) { + result[index] = start; + start += step; + } + return result; +} +//#endregion +export { range }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/rangeRight.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/math/rangeRight.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..066e75e854fac27ea2c72eae03018d55b1204b3a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/rangeRight.d.mts @@ -0,0 +1,32 @@ +//#region src/compat/math/rangeRight.d.ts +/** + * Creates an array of numbers from `start` to `end` with optional `step`. + * @param {number} start - The starting number of the range (inclusive). + * @param {number} [end] - The end number of the range (exclusive). + * @param {number} [step] - The step value for the range. + * @returns {number[]} An array of numbers from `start` to `end` with the specified `step`. + * @example + * // Returns [0, 1, 2, 3] + * rangeRight(4); + * @example + * // Returns [0, 2, 4, 6] + * rangeRight(0, 8, 2); + * @example + * // Returns [5, 4, 3, 2, 1] + * rangeRight(1, 6); + */ +declare function rangeRight(start: number, end?: number, step?: number): number[]; +/** + * Creates an array of numbers from 0 to `end` with step 1. + * Used when called as an iteratee for methods like `_.map`. + * @param {number} end - The end number of the range (exclusive). + * @param {string | number} index - The index parameter (used for iteratee calls). + * @param {object} guard - The guard parameter (used for iteratee calls). + * @returns {number[]} An array of numbers from 0 to `end` with step 1. + * @example + * // Returns [0, 1, 2, 3] + * rangeRight(4, 'index', {}); + */ +declare function rangeRight(end: number, index: string | number, guard: object): number[]; +//#endregion +export { rangeRight }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/rangeRight.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/math/rangeRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..066e75e854fac27ea2c72eae03018d55b1204b3a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/rangeRight.d.ts @@ -0,0 +1,32 @@ +//#region src/compat/math/rangeRight.d.ts +/** + * Creates an array of numbers from `start` to `end` with optional `step`. + * @param {number} start - The starting number of the range (inclusive). + * @param {number} [end] - The end number of the range (exclusive). + * @param {number} [step] - The step value for the range. + * @returns {number[]} An array of numbers from `start` to `end` with the specified `step`. + * @example + * // Returns [0, 1, 2, 3] + * rangeRight(4); + * @example + * // Returns [0, 2, 4, 6] + * rangeRight(0, 8, 2); + * @example + * // Returns [5, 4, 3, 2, 1] + * rangeRight(1, 6); + */ +declare function rangeRight(start: number, end?: number, step?: number): number[]; +/** + * Creates an array of numbers from 0 to `end` with step 1. + * Used when called as an iteratee for methods like `_.map`. + * @param {number} end - The end number of the range (exclusive). + * @param {string | number} index - The index parameter (used for iteratee calls). + * @param {object} guard - The guard parameter (used for iteratee calls). + * @returns {number[]} An array of numbers from 0 to `end` with step 1. + * @example + * // Returns [0, 1, 2, 3] + * rangeRight(4, 'index', {}); + */ +declare function rangeRight(end: number, index: string | number, guard: object): number[]; +//#endregion +export { rangeRight }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/rangeRight.js b/tools/ui/node_modules/es-toolkit/dist/compat/math/rangeRight.js new file mode 100644 index 0000000000000000000000000000000000000000..ad26a43dbcddde40ac3a264a95108e2b241e772e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/rangeRight.js @@ -0,0 +1,38 @@ +const require_toFinite = require("../util/toFinite.js"); +const require_isIterateeCall = require("../_internal/isIterateeCall.js"); +//#region src/compat/math/rangeRight.ts +/** +* Returns an array of numbers from `end` (exclusive) to `start` (inclusive), decrementing by `step`. +* +* @param {number} start - The starting number of the range (inclusive). +* @param {string | number} end - The end number of the range (exclusive). +* @param {number | object} step - The step value for the range. +* @returns {number[]} An array of numbers from `end` (exclusive) to `start` (inclusive) with the specified `step`. +* @throws {Error} Throws an error if the step value is not a non-zero integer. +* +* @example +* // Returns [3, 2, 1, 0] +* rangeRight(4); +* +* @example +* // Returns [-3, -2, -1, 0] +* rangeRight(0, -4, -1); +*/ +function rangeRight(start, end, step) { + if (step && typeof step !== "number" && require_isIterateeCall.isIterateeCall(start, end, step)) end = step = void 0; + start = require_toFinite.toFinite(start); + if (end === void 0) { + end = start; + start = 0; + } else end = require_toFinite.toFinite(end); + step = step === void 0 ? start < end ? 1 : -1 : require_toFinite.toFinite(step); + const length = Math.max(Math.ceil((end - start) / (step || 1)), 0); + const result = new Array(length); + for (let index = length - 1; index >= 0; index--) { + result[index] = start; + start += step; + } + return result; +} +//#endregion +exports.rangeRight = rangeRight; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/rangeRight.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/math/rangeRight.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a2ed89037e0767529f7c3fe9488d798da381ed41 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/rangeRight.mjs @@ -0,0 +1,38 @@ +import { toFinite } from "../util/toFinite.mjs"; +import { isIterateeCall } from "../_internal/isIterateeCall.mjs"; +//#region src/compat/math/rangeRight.ts +/** +* Returns an array of numbers from `end` (exclusive) to `start` (inclusive), decrementing by `step`. +* +* @param {number} start - The starting number of the range (inclusive). +* @param {string | number} end - The end number of the range (exclusive). +* @param {number | object} step - The step value for the range. +* @returns {number[]} An array of numbers from `end` (exclusive) to `start` (inclusive) with the specified `step`. +* @throws {Error} Throws an error if the step value is not a non-zero integer. +* +* @example +* // Returns [3, 2, 1, 0] +* rangeRight(4); +* +* @example +* // Returns [-3, -2, -1, 0] +* rangeRight(0, -4, -1); +*/ +function rangeRight(start, end, step) { + if (step && typeof step !== "number" && isIterateeCall(start, end, step)) end = step = void 0; + start = toFinite(start); + if (end === void 0) { + end = start; + start = 0; + } else end = toFinite(end); + step = step === void 0 ? start < end ? 1 : -1 : toFinite(step); + const length = Math.max(Math.ceil((end - start) / (step || 1)), 0); + const result = new Array(length); + for (let index = length - 1; index >= 0; index--) { + result[index] = start; + start += step; + } + return result; +} +//#endregion +export { rangeRight }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/round.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/math/round.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..38cfe274d47d70e17fa4385f07ebba0db3adea48 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/round.d.mts @@ -0,0 +1,16 @@ +//#region src/compat/math/round.d.ts +/** + * Computes number rounded to precision. + * + * @param {number} number The number to round. + * @param {number} precision The precision to round to. + * @returns {number} Returns the rounded number. + * + * @example + * round(4.006); // => 4 + * round(4.006, 2); // => 4.01 + * round(4060, -2); // => 4100 + */ +declare function round(number: number, precision?: number): number; +//#endregion +export { round }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/round.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/math/round.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..38cfe274d47d70e17fa4385f07ebba0db3adea48 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/round.d.ts @@ -0,0 +1,16 @@ +//#region src/compat/math/round.d.ts +/** + * Computes number rounded to precision. + * + * @param {number} number The number to round. + * @param {number} precision The precision to round to. + * @returns {number} Returns the rounded number. + * + * @example + * round(4.006); // => 4 + * round(4.006, 2); // => 4.01 + * round(4060, -2); // => 4100 + */ +declare function round(number: number, precision?: number): number; +//#endregion +export { round }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/round.js b/tools/ui/node_modules/es-toolkit/dist/compat/math/round.js new file mode 100644 index 0000000000000000000000000000000000000000..bccc10129ea2ae76d15c5128408bb6e878bc1945 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/round.js @@ -0,0 +1,19 @@ +const require_decimalAdjust = require("../_internal/decimalAdjust.js"); +//#region src/compat/math/round.ts +/** +* Computes number rounded to precision. +* +* @param {number} number The number to round. +* @param {number} precision The precision to round to. +* @returns {number} Returns the rounded number. +* +* @example +* round(4.006); // => 4 +* round(4.006, 2); // => 4.01 +* round(4060, -2); // => 4100 +*/ +function round(number, precision = 0) { + return require_decimalAdjust.decimalAdjust("round", number, precision); +} +//#endregion +exports.round = round; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/round.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/math/round.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3eae550b1b0ad44c0851bc2a88ef84de2a97144a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/round.mjs @@ -0,0 +1,19 @@ +import { decimalAdjust } from "../_internal/decimalAdjust.mjs"; +//#region src/compat/math/round.ts +/** +* Computes number rounded to precision. +* +* @param {number} number The number to round. +* @param {number} precision The precision to round to. +* @returns {number} Returns the rounded number. +* +* @example +* round(4.006); // => 4 +* round(4.006, 2); // => 4.01 +* round(4060, -2); // => 4100 +*/ +function round(number, precision = 0) { + return decimalAdjust("round", number, precision); +} +//#endregion +export { round }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/subtract.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/math/subtract.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6608b0b39bb090cec8a08b31df90fc64c0bbeea0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/subtract.d.mts @@ -0,0 +1,18 @@ +//#region src/compat/math/subtract.d.ts +/** + * Subtracts one number from another. + * + * If either of the numbers is `NaN`, the function returns `NaN`. + * + * @param {number} value The first number. (minuend) + * @param {number} other The second number.(subtrahend) + * @returns {number} The difference of the two numbers, or `NaN` if any input is `NaN`. + * + * @example + * subtract(6, 3); // => 3 + * subtract(6, NaN); // => NaN + * subtract(NaN, 3); // => NaN + */ +declare function subtract(value: number, other: number): number; +//#endregion +export { subtract }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/subtract.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/math/subtract.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6608b0b39bb090cec8a08b31df90fc64c0bbeea0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/subtract.d.ts @@ -0,0 +1,18 @@ +//#region src/compat/math/subtract.d.ts +/** + * Subtracts one number from another. + * + * If either of the numbers is `NaN`, the function returns `NaN`. + * + * @param {number} value The first number. (minuend) + * @param {number} other The second number.(subtrahend) + * @returns {number} The difference of the two numbers, or `NaN` if any input is `NaN`. + * + * @example + * subtract(6, 3); // => 3 + * subtract(6, NaN); // => NaN + * subtract(NaN, 3); // => NaN + */ +declare function subtract(value: number, other: number): number; +//#endregion +export { subtract }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/subtract.js b/tools/ui/node_modules/es-toolkit/dist/compat/math/subtract.js new file mode 100644 index 0000000000000000000000000000000000000000..bfa935dc996693d200e724b11d772a26bb480c1b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/subtract.js @@ -0,0 +1,31 @@ +const require_toNumber = require("../util/toNumber.js"); +const require_toString = require("../util/toString.js"); +//#region src/compat/math/subtract.ts +/** +* Subtracts one number from another. +* +* If either of the numbers is `NaN`, the function returns `NaN`. +* +* @param {number} value The first number. (minuend) +* @param {number} other The second number.(subtrahend) +* @returns {number} The difference of the two numbers, or `NaN` if any input is `NaN`. +* +* @example +* subtract(6, 3); // => 3 +* subtract(6, NaN); // => NaN +* subtract(NaN, 3); // => NaN +*/ +function subtract(value, other) { + if (value === void 0 && other === void 0) return 0; + if (value === void 0 || other === void 0) return value ?? other; + if (typeof value === "string" || typeof other === "string") { + value = require_toString.toString(value); + other = require_toString.toString(other); + } else { + value = require_toNumber.toNumber(value); + other = require_toNumber.toNumber(other); + } + return value - other; +} +//#endregion +exports.subtract = subtract; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/subtract.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/math/subtract.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2150c51e80f56e40fda31f02173174dd687e0aa0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/subtract.mjs @@ -0,0 +1,31 @@ +import { toNumber } from "../util/toNumber.mjs"; +import { toString } from "../util/toString.mjs"; +//#region src/compat/math/subtract.ts +/** +* Subtracts one number from another. +* +* If either of the numbers is `NaN`, the function returns `NaN`. +* +* @param {number} value The first number. (minuend) +* @param {number} other The second number.(subtrahend) +* @returns {number} The difference of the two numbers, or `NaN` if any input is `NaN`. +* +* @example +* subtract(6, 3); // => 3 +* subtract(6, NaN); // => NaN +* subtract(NaN, 3); // => NaN +*/ +function subtract(value, other) { + if (value === void 0 && other === void 0) return 0; + if (value === void 0 || other === void 0) return value ?? other; + if (typeof value === "string" || typeof other === "string") { + value = toString(value); + other = toString(other); + } else { + value = toNumber(value); + other = toNumber(other); + } + return value - other; +} +//#endregion +export { subtract }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/sum.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/math/sum.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c5f01f697d08bce003b0cb2484285f8d97408165 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/sum.d.mts @@ -0,0 +1,20 @@ +//#region src/compat/math/sum.d.ts +/** + * Computes the sum of the values that are returned by the `iteratee` function. + * + * It does not coerce values to `number`. + * + * @param {ArrayLike | null | undefined} array - The array to iterate over. + * @returns {number} Returns the sum. + * + * @example + * sum([1, 2, 3]); // => 6 + * sum([1n, 2n, 3n]); // => 6n + * sum(["1", "2"]); // => "12" + * sum([1, undefined, 2]); // => 3 + * sum(null); // => 0 + * sum(undefined); // => 0 + */ +declare function sum(array: ArrayLike | null | undefined): number; +//#endregion +export { sum }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/sum.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/math/sum.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c5f01f697d08bce003b0cb2484285f8d97408165 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/sum.d.ts @@ -0,0 +1,20 @@ +//#region src/compat/math/sum.d.ts +/** + * Computes the sum of the values that are returned by the `iteratee` function. + * + * It does not coerce values to `number`. + * + * @param {ArrayLike | null | undefined} array - The array to iterate over. + * @returns {number} Returns the sum. + * + * @example + * sum([1, 2, 3]); // => 6 + * sum([1n, 2n, 3n]); // => 6n + * sum(["1", "2"]); // => "12" + * sum([1, undefined, 2]); // => 3 + * sum(null); // => 0 + * sum(undefined); // => 0 + */ +declare function sum(array: ArrayLike | null | undefined): number; +//#endregion +export { sum }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/sum.js b/tools/ui/node_modules/es-toolkit/dist/compat/math/sum.js new file mode 100644 index 0000000000000000000000000000000000000000..0fb6953de367e02a67331cb8f68b222890250a60 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/sum.js @@ -0,0 +1,23 @@ +const require_sumBy = require("./sumBy.js"); +//#region src/compat/math/sum.ts +/** +* Computes the sum of the values that are returned by the `iteratee` function. +* +* It does not coerce values to `number`. +* +* @param {ArrayLike | null | undefined} array - The array to iterate over. +* @returns {number} Returns the sum. +* +* @example +* sum([1, 2, 3]); // => 6 +* sum([1n, 2n, 3n]); // => 6n +* sum(["1", "2"]); // => "12" +* sum([1, undefined, 2]); // => 3 +* sum(null); // => 0 +* sum(undefined); // => 0 +*/ +function sum(array) { + return require_sumBy.sumBy(array); +} +//#endregion +exports.sum = sum; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/sum.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/math/sum.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3dbad312a1d3ee32d8aedb674efbcc72b040ef8b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/sum.mjs @@ -0,0 +1,23 @@ +import { sumBy } from "./sumBy.mjs"; +//#region src/compat/math/sum.ts +/** +* Computes the sum of the values that are returned by the `iteratee` function. +* +* It does not coerce values to `number`. +* +* @param {ArrayLike | null | undefined} array - The array to iterate over. +* @returns {number} Returns the sum. +* +* @example +* sum([1, 2, 3]); // => 6 +* sum([1n, 2n, 3n]); // => 6n +* sum(["1", "2"]); // => "12" +* sum([1, undefined, 2]); // => 3 +* sum(null); // => 0 +* sum(undefined); // => 0 +*/ +function sum(array) { + return sumBy(array); +} +//#endregion +export { sum }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/sumBy.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/math/sumBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..3598c94abaa9dbb7fd88ebf85b76475cc9eb55f5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/sumBy.d.mts @@ -0,0 +1,22 @@ +//#region src/compat/math/sumBy.d.ts +/** + * Computes the sum of the values that are returned by the `iteratee` function. + * + * It does not coerce values to `number`. + * + * @template T - The type of the array elements. + * @param {ArrayLike | null | undefined} array - The array to iterate over. + * @param {((value: T) => number) | string} iteratee - The function invoked per iteration. + * @returns {number} Returns the sum. + * + * @example + * sumBy([1, undefined, 2], value => value); // => 3 + * sumBy(null); // => 0 + * sumBy(undefined); // => 0 + * sumBy([1, 2, 3]); // => 6 + * sumBy([1n, 2n, 3n]); // => 6n + * sumBy([{ a: "1" }, { a: "2" }], object => object.a); // => "12" + */ +declare function sumBy(array: ArrayLike | null | undefined, iteratee?: ((value: T) => number) | string): number; +//#endregion +export { sumBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/sumBy.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/math/sumBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3598c94abaa9dbb7fd88ebf85b76475cc9eb55f5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/sumBy.d.ts @@ -0,0 +1,22 @@ +//#region src/compat/math/sumBy.d.ts +/** + * Computes the sum of the values that are returned by the `iteratee` function. + * + * It does not coerce values to `number`. + * + * @template T - The type of the array elements. + * @param {ArrayLike | null | undefined} array - The array to iterate over. + * @param {((value: T) => number) | string} iteratee - The function invoked per iteration. + * @returns {number} Returns the sum. + * + * @example + * sumBy([1, undefined, 2], value => value); // => 3 + * sumBy(null); // => 0 + * sumBy(undefined); // => 0 + * sumBy([1, 2, 3]); // => 6 + * sumBy([1n, 2n, 3n]); // => 6n + * sumBy([{ a: "1" }, { a: "2" }], object => object.a); // => "12" + */ +declare function sumBy(array: ArrayLike | null | undefined, iteratee?: ((value: T) => number) | string): number; +//#endregion +export { sumBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/sumBy.js b/tools/ui/node_modules/es-toolkit/dist/compat/math/sumBy.js new file mode 100644 index 0000000000000000000000000000000000000000..36cd3c845cfdbe979c7542a4c3acf9b4e7876b43 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/sumBy.js @@ -0,0 +1,33 @@ +const require_iteratee = require("../util/iteratee.js"); +//#region src/compat/math/sumBy.ts +/** +* Computes the sum of the values that are returned by the `iteratee` function. +* +* It does not coerce values to `number`. +* +* @template T - The type of the array elements. +* @param {ArrayLike | null | undefined} array - The array to iterate over. +* @param {((value: T) => number) | string} iteratee - The function invoked per iteration. +* @returns {number} Returns the sum. +* +* @example +* sumBy([1, undefined, 2], value => value); // => 3 +* sumBy(null); // => 0 +* sumBy(undefined); // => 0 +* sumBy([1, 2, 3]); // => 6 +* sumBy([1n, 2n, 3n]); // => 6n +* sumBy([{ a: "1" }, { a: "2" }], object => object.a); // => "12" +*/ +function sumBy(array, iteratee$1) { + if (!array || !array.length) return 0; + if (iteratee$1 != null) iteratee$1 = require_iteratee.iteratee(iteratee$1); + let result = void 0; + for (let i = 0; i < array.length; i++) { + const current = iteratee$1 ? iteratee$1(array[i]) : array[i]; + if (current !== void 0) if (result === void 0) result = current; + else result += current; + } + return result; +} +//#endregion +exports.sumBy = sumBy; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/math/sumBy.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/math/sumBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..767577f83f2f2a0b67a9fb3da18790e253487455 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/math/sumBy.mjs @@ -0,0 +1,33 @@ +import { iteratee } from "../util/iteratee.mjs"; +//#region src/compat/math/sumBy.ts +/** +* Computes the sum of the values that are returned by the `iteratee` function. +* +* It does not coerce values to `number`. +* +* @template T - The type of the array elements. +* @param {ArrayLike | null | undefined} array - The array to iterate over. +* @param {((value: T) => number) | string} iteratee - The function invoked per iteration. +* @returns {number} Returns the sum. +* +* @example +* sumBy([1, undefined, 2], value => value); // => 3 +* sumBy(null); // => 0 +* sumBy(undefined); // => 0 +* sumBy([1, 2, 3]); // => 6 +* sumBy([1n, 2n, 3n]); // => 6n +* sumBy([{ a: "1" }, { a: "2" }], object => object.a); // => "12" +*/ +function sumBy(array, iteratee$1) { + if (!array || !array.length) return 0; + if (iteratee$1 != null) iteratee$1 = iteratee(iteratee$1); + let result = void 0; + for (let i = 0; i < array.length; i++) { + const current = iteratee$1 ? iteratee$1(array[i]) : array[i]; + if (current !== void 0) if (result === void 0) result = current; + else result += current; + } + return result; +} +//#endregion +export { sumBy }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/assign.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/assign.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d0d630f948be8842c322bda24e599ba4ad68f6bf --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/assign.d.mts @@ -0,0 +1,111 @@ +//#region src/compat/object/assign.d.ts +/** + * Assigns properties from one source object to a target object. + * + * @template T - The type of the target object. + * @template U - The type of the source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source - The source object whose properties will be assigned to the target object. + * @returns {T & U} The updated target object with properties from the source object assigned. + * + * @example + * const target = { a: 1, b: 2 }; + * const source = { b: 3, c: 4 }; + * const result = assign(target, source); + * // => { a: 1, b: 3, c: 4 } + */ +declare function assign(object: T, source: U): T & U; +/** + * Assigns properties from two source objects to a target object. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @returns {T & U & V} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const result = assign(target, source1, source2); + * // => { a: 1, b: 2, c: 3 } + */ +declare function assign(object: T, source1: U, source2: V): T & U & V; +/** + * Assigns properties from three source objects to a target object. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @template W - The type of the third source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @param {W} source3 - The third source object whose properties will be assigned to the target object. + * @returns {T & U & V & W} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const source3 = { d: 4 }; + * const result = assign(target, source1, source2, source3); + * // => { a: 1, b: 2, c: 3, d: 4 } + */ +declare function assign(object: T, source1: U, source2: V, source3: W): T & U & V & W; +/** + * Assigns properties from four source objects to a target object. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @template W - The type of the third source object. + * @template X - The type of the fourth source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @param {W} source3 - The third source object whose properties will be assigned to the target object. + * @param {X} source4 - The fourth source object whose properties will be assigned to the target object. + * @returns {T & U & V & W & X} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const source3 = { d: 4 }; + * const source4 = { e: 5 }; + * const result = assign(target, source1, source2, source3, source4); + * // => { a: 1, b: 2, c: 3, d: 4, e: 5 } + */ +declare function assign(object: T, source1: U, source2: V, source3: W, source4: X): T & U & V & W & X; +/** + * Assigns properties from a target object to itself. + * + * @template T - The type of the target object. + * @param {T} object - The target object. + * @returns {T} The target object. + * + * @example + * const target = { a: 1, b: 2 }; + * const result = assign(target); + * // => { a: 1, b: 2 } + */ +declare function assign(object: T): T; +/** + * Assigns properties from multiple source objects to a target object. + * + * @param {any} object - The target object to which properties will be assigned. + * @param {...any[]} otherArgs - The source objects whose properties will be assigned to the target object. + * @returns {any} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const result = assign(target, { b: 2 }, { c: 3 }, { d: 4 }); + * // => { a: 1, b: 2, c: 3, d: 4 } + */ +declare function assign(object: any, ...otherArgs: any[]): any; +//#endregion +export { assign }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/assign.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/assign.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d0d630f948be8842c322bda24e599ba4ad68f6bf --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/assign.d.ts @@ -0,0 +1,111 @@ +//#region src/compat/object/assign.d.ts +/** + * Assigns properties from one source object to a target object. + * + * @template T - The type of the target object. + * @template U - The type of the source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source - The source object whose properties will be assigned to the target object. + * @returns {T & U} The updated target object with properties from the source object assigned. + * + * @example + * const target = { a: 1, b: 2 }; + * const source = { b: 3, c: 4 }; + * const result = assign(target, source); + * // => { a: 1, b: 3, c: 4 } + */ +declare function assign(object: T, source: U): T & U; +/** + * Assigns properties from two source objects to a target object. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @returns {T & U & V} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const result = assign(target, source1, source2); + * // => { a: 1, b: 2, c: 3 } + */ +declare function assign(object: T, source1: U, source2: V): T & U & V; +/** + * Assigns properties from three source objects to a target object. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @template W - The type of the third source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @param {W} source3 - The third source object whose properties will be assigned to the target object. + * @returns {T & U & V & W} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const source3 = { d: 4 }; + * const result = assign(target, source1, source2, source3); + * // => { a: 1, b: 2, c: 3, d: 4 } + */ +declare function assign(object: T, source1: U, source2: V, source3: W): T & U & V & W; +/** + * Assigns properties from four source objects to a target object. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @template W - The type of the third source object. + * @template X - The type of the fourth source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @param {W} source3 - The third source object whose properties will be assigned to the target object. + * @param {X} source4 - The fourth source object whose properties will be assigned to the target object. + * @returns {T & U & V & W & X} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const source3 = { d: 4 }; + * const source4 = { e: 5 }; + * const result = assign(target, source1, source2, source3, source4); + * // => { a: 1, b: 2, c: 3, d: 4, e: 5 } + */ +declare function assign(object: T, source1: U, source2: V, source3: W, source4: X): T & U & V & W & X; +/** + * Assigns properties from a target object to itself. + * + * @template T - The type of the target object. + * @param {T} object - The target object. + * @returns {T} The target object. + * + * @example + * const target = { a: 1, b: 2 }; + * const result = assign(target); + * // => { a: 1, b: 2 } + */ +declare function assign(object: T): T; +/** + * Assigns properties from multiple source objects to a target object. + * + * @param {any} object - The target object to which properties will be assigned. + * @param {...any[]} otherArgs - The source objects whose properties will be assigned to the target object. + * @returns {any} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const result = assign(target, { b: 2 }, { c: 3 }, { d: 4 }); + * // => { a: 1, b: 2, c: 3, d: 4 } + */ +declare function assign(object: any, ...otherArgs: any[]): any; +//#endregion +export { assign }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/assign.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/assign.js new file mode 100644 index 0000000000000000000000000000000000000000..715dd85fc7fcfe744dcf6ad823181a4ae85bd7cf --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/assign.js @@ -0,0 +1,33 @@ +const require_isEqualsSameValueZero = require("../../_internal/isEqualsSameValueZero.js"); +require("../util/eq.js"); +const require_keys = require("./keys.js"); +//#region src/compat/object/assign.ts +/** +* Assigns properties from multiple source objects to a target object. +* +* This function merges the properties of the source objects into the target object. +* If a property in the source objects is equal to the corresponding property in the target object, +* it will not be overwritten. +* +* @param {any} object - The target object to which properties will be assigned. +* @param {...any[]} sources - The source objects whose properties will be assigned to the target object. +* @returns {any} The updated target object with properties from the source objects assigned. +* +* @example +* const target = { a: 1 }; +* const result = assign(target, { b: 2 }, { c: 3 }); +* console.log(result); // Output: { a: 1, b: 2, c: 3 } +*/ +function assign(object, ...sources) { + for (let i = 0; i < sources.length; i++) assignImpl(object, sources[i]); + return object; +} +function assignImpl(object, source) { + const keys$1 = require_keys.keys(source); + for (let i = 0; i < keys$1.length; i++) { + const key = keys$1[i]; + if (!(key in object) || !require_isEqualsSameValueZero.isEqualsSameValueZero(object[key], source[key])) object[key] = source[key]; + } +} +//#endregion +exports.assign = assign; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/assign.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/assign.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5f1ddc615dc5b3cd692d93ddc7777a0c4d76a392 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/assign.mjs @@ -0,0 +1,33 @@ +import { isEqualsSameValueZero } from "../../_internal/isEqualsSameValueZero.mjs"; +import "../util/eq.mjs"; +import { keys } from "./keys.mjs"; +//#region src/compat/object/assign.ts +/** +* Assigns properties from multiple source objects to a target object. +* +* This function merges the properties of the source objects into the target object. +* If a property in the source objects is equal to the corresponding property in the target object, +* it will not be overwritten. +* +* @param {any} object - The target object to which properties will be assigned. +* @param {...any[]} sources - The source objects whose properties will be assigned to the target object. +* @returns {any} The updated target object with properties from the source objects assigned. +* +* @example +* const target = { a: 1 }; +* const result = assign(target, { b: 2 }, { c: 3 }); +* console.log(result); // Output: { a: 1, b: 2, c: 3 } +*/ +function assign(object, ...sources) { + for (let i = 0; i < sources.length; i++) assignImpl(object, sources[i]); + return object; +} +function assignImpl(object, source) { + const keys$1 = keys(source); + for (let i = 0; i < keys$1.length; i++) { + const key = keys$1[i]; + if (!(key in object) || !isEqualsSameValueZero(object[key], source[key])) object[key] = source[key]; + } +} +//#endregion +export { assign }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/assignIn.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignIn.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..45f2b0860474b094d1b2e52f9dff2a6629754711 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignIn.d.mts @@ -0,0 +1,112 @@ +//#region src/compat/object/assignIn.d.ts +/** + * Assigns own and inherited properties from one source object to a target object. + * + * @template T - The type of the target object. + * @template U - The type of the source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source - The source object whose properties will be assigned to the target object. + * @returns {T & U} The updated target object with properties from the source object assigned. + * + * @example + * const target = { a: 1, b: 2 }; + * const source = { b: 3, c: 4 }; + * const result = assignIn(target, source); + * // => { a: 1, b: 3, c: 4 } + */ +declare function assignIn(object: T, source: U): T & U; +/** + * Assigns own and inherited properties from two source objects to a target object. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @returns {T & U & V} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const result = assignIn(target, source1, source2); + * // => { a: 1, b: 2, c: 3 } + */ +declare function assignIn(object: T, source1: U, source2: V): T & U & V; +/** + * Assigns own and inherited properties from three source objects to a target object. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @template W - The type of the third source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @param {W} source3 - The third source object whose properties will be assigned to the target object. + * @returns {T & U & V & W} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const source3 = { d: 4 }; + * const result = assignIn(target, source1, source2, source3); + * // => { a: 1, b: 2, c: 3, d: 4 } + */ +declare function assignIn(object: T, source1: U, source2: V, source3: W): T & U & V & W; +/** + * Assigns own and inherited properties from four source objects to a target object. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @template W - The type of the third source object. + * @template X - The type of the fourth source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @param {W} source3 - The third source object whose properties will be assigned to the target object. + * @param {X} source4 - The fourth source object whose properties will be assigned to the target object. + * @returns {T & U & V & W & X} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const source3 = { d: 4 }; + * const source4 = { e: 5 }; + * const result = assignIn(target, source1, source2, source3, source4); + * // => { a: 1, b: 2, c: 3, d: 4, e: 5 } + */ +declare function assignIn(object: T, source1: U, source2: V, source3: W, source4: X): T & U & V & W & X; +/** + * Returns the target object as-is. + * + * @template T - The type of the target object. + * @param {T} object - The target object. + * @returns {T} The target object. + * + * @example + * const target = { a: 1, b: 2 }; + * const result = assignIn(target); + * // => { a: 1, b: 2 } + */ +declare function assignIn(object: T): T; +/** + * Assigns own and inherited properties from multiple source objects to a target object. + * + * @template R - The type of the result. + * @param {any} object - The target object to which properties will be assigned. + * @param {...any[]} otherArgs - The source objects whose properties will be assigned to the target object. + * @returns {R} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const result = assignIn(target, { b: 2 }, { c: 3 }, { d: 4 }); + * // => { a: 1, b: 2, c: 3, d: 4 } + */ +declare function assignIn(object: any, ...otherArgs: any[]): R; +//#endregion +export { assignIn }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/assignIn.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignIn.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..45f2b0860474b094d1b2e52f9dff2a6629754711 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignIn.d.ts @@ -0,0 +1,112 @@ +//#region src/compat/object/assignIn.d.ts +/** + * Assigns own and inherited properties from one source object to a target object. + * + * @template T - The type of the target object. + * @template U - The type of the source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source - The source object whose properties will be assigned to the target object. + * @returns {T & U} The updated target object with properties from the source object assigned. + * + * @example + * const target = { a: 1, b: 2 }; + * const source = { b: 3, c: 4 }; + * const result = assignIn(target, source); + * // => { a: 1, b: 3, c: 4 } + */ +declare function assignIn(object: T, source: U): T & U; +/** + * Assigns own and inherited properties from two source objects to a target object. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @returns {T & U & V} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const result = assignIn(target, source1, source2); + * // => { a: 1, b: 2, c: 3 } + */ +declare function assignIn(object: T, source1: U, source2: V): T & U & V; +/** + * Assigns own and inherited properties from three source objects to a target object. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @template W - The type of the third source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @param {W} source3 - The third source object whose properties will be assigned to the target object. + * @returns {T & U & V & W} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const source3 = { d: 4 }; + * const result = assignIn(target, source1, source2, source3); + * // => { a: 1, b: 2, c: 3, d: 4 } + */ +declare function assignIn(object: T, source1: U, source2: V, source3: W): T & U & V & W; +/** + * Assigns own and inherited properties from four source objects to a target object. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @template W - The type of the third source object. + * @template X - The type of the fourth source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @param {W} source3 - The third source object whose properties will be assigned to the target object. + * @param {X} source4 - The fourth source object whose properties will be assigned to the target object. + * @returns {T & U & V & W & X} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const source3 = { d: 4 }; + * const source4 = { e: 5 }; + * const result = assignIn(target, source1, source2, source3, source4); + * // => { a: 1, b: 2, c: 3, d: 4, e: 5 } + */ +declare function assignIn(object: T, source1: U, source2: V, source3: W, source4: X): T & U & V & W & X; +/** + * Returns the target object as-is. + * + * @template T - The type of the target object. + * @param {T} object - The target object. + * @returns {T} The target object. + * + * @example + * const target = { a: 1, b: 2 }; + * const result = assignIn(target); + * // => { a: 1, b: 2 } + */ +declare function assignIn(object: T): T; +/** + * Assigns own and inherited properties from multiple source objects to a target object. + * + * @template R - The type of the result. + * @param {any} object - The target object to which properties will be assigned. + * @param {...any[]} otherArgs - The source objects whose properties will be assigned to the target object. + * @returns {R} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const result = assignIn(target, { b: 2 }, { c: 3 }, { d: 4 }); + * // => { a: 1, b: 2, c: 3, d: 4 } + */ +declare function assignIn(object: any, ...otherArgs: any[]): R; +//#endregion +export { assignIn }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/assignIn.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignIn.js new file mode 100644 index 0000000000000000000000000000000000000000..1c4649c805b37a4f1cdb790df78197408dc644c4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignIn.js @@ -0,0 +1,33 @@ +const require_isEqualsSameValueZero = require("../../_internal/isEqualsSameValueZero.js"); +require("../util/eq.js"); +const require_keysIn = require("./keysIn.js"); +//#region src/compat/object/assignIn.ts +/** +* Assigns properties from multiple source objects to a target object. +* +* This function merges the properties of the source objects into the target object, +* including properties from the prototype chain. If a property in the source objects +* is equal to the corresponding property in the target object, it will not be overwritten. +* +* @param {any} object - The target object to which properties will be assigned. +* @param {...any[]} sources - The source objects whose properties will be assigned to the target object. +* @returns {any} The updated target object with properties from the source objects assigned. +* +* @example +* const target = { a: 1 }; +* const result = assignIn(target, { b: 2 }, { c: 3 }); +* console.log(result); // Output: { a: 1, b: 2, c: 3 } +*/ +function assignIn(object, ...sources) { + for (let i = 0; i < sources.length; i++) assignInImpl(object, sources[i]); + return object; +} +function assignInImpl(object, source) { + const keys = require_keysIn.keysIn(source); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + if (!(key in object) || !require_isEqualsSameValueZero.isEqualsSameValueZero(object[key], source[key])) object[key] = source[key]; + } +} +//#endregion +exports.assignIn = assignIn; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/assignIn.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignIn.mjs new file mode 100644 index 0000000000000000000000000000000000000000..76ec7363cdc781df5495e423aa9b86470e9869fd --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignIn.mjs @@ -0,0 +1,33 @@ +import { isEqualsSameValueZero } from "../../_internal/isEqualsSameValueZero.mjs"; +import "../util/eq.mjs"; +import { keysIn } from "./keysIn.mjs"; +//#region src/compat/object/assignIn.ts +/** +* Assigns properties from multiple source objects to a target object. +* +* This function merges the properties of the source objects into the target object, +* including properties from the prototype chain. If a property in the source objects +* is equal to the corresponding property in the target object, it will not be overwritten. +* +* @param {any} object - The target object to which properties will be assigned. +* @param {...any[]} sources - The source objects whose properties will be assigned to the target object. +* @returns {any} The updated target object with properties from the source objects assigned. +* +* @example +* const target = { a: 1 }; +* const result = assignIn(target, { b: 2 }, { c: 3 }); +* console.log(result); // Output: { a: 1, b: 2, c: 3 } +*/ +function assignIn(object, ...sources) { + for (let i = 0; i < sources.length; i++) assignInImpl(object, sources[i]); + return object; +} +function assignInImpl(object, source) { + const keys = keysIn(source); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + if (!(key in object) || !isEqualsSameValueZero(object[key], source[key])) object[key] = source[key]; + } +} +//#endregion +export { assignIn }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/assignInWith.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignInWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..8479d96ad0465c3620d1bf9873ce41c4aaf2a4e2 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignInWith.d.mts @@ -0,0 +1,127 @@ +//#region src/compat/object/assignInWith.d.ts +type AssignCustomizer = (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any; +/** + * Assigns own and inherited properties from one source object to a target object using a customizer function. + * + * @template T - The type of the target object. + * @template U - The type of the source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source - The source object whose properties will be assigned to the target object. + * @param {AssignCustomizer} customizer - The function to customize assigned values. + * @returns {T & U} The updated target object with properties from the source object assigned. + * + * @example + * const target = { a: 1, b: 2 }; + * const source = { b: 3, c: 4 }; + * const result = assignInWith(target, source, (objValue, srcValue) => { + * return objValue === undefined ? srcValue : objValue; + * }); + * // => { a: 1, b: 2, c: 4 } + */ +declare function assignInWith(object: T, source: U, customizer: AssignCustomizer): T & U; +/** + * Assigns own and inherited properties from two source objects to a target object using a customizer function. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @param {AssignCustomizer} customizer - The function to customize assigned values. + * @returns {T & U & V} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const result = assignInWith(target, source1, source2, (objValue, srcValue) => { + * return objValue === undefined ? srcValue : objValue; + * }); + * // => { a: 1, b: 2, c: 3 } + */ +declare function assignInWith(object: T, source1: U, source2: V, customizer: AssignCustomizer): T & U & V; +/** + * Assigns own and inherited properties from three source objects to a target object using a customizer function. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @template W - The type of the third source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @param {W} source3 - The third source object whose properties will be assigned to the target object. + * @param {AssignCustomizer} customizer - The function to customize assigned values. + * @returns {T & U & V & W} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const source3 = { d: 4 }; + * const result = assignInWith(target, source1, source2, source3, (objValue, srcValue) => { + * return objValue === undefined ? srcValue : objValue; + * }); + * // => { a: 1, b: 2, c: 3, d: 4 } + */ +declare function assignInWith(object: T, source1: U, source2: V, source3: W, customizer: AssignCustomizer): T & U & V & W; +/** + * Assigns own and inherited properties from four source objects to a target object using a customizer function. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @template W - The type of the third source object. + * @template X - The type of the fourth source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @param {W} source3 - The third source object whose properties will be assigned to the target object. + * @param {X} source4 - The fourth source object whose properties will be assigned to the target object. + * @param {AssignCustomizer} customizer - The function to customize assigned values. + * @returns {T & U & V & W & X} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const source3 = { d: 4 }; + * const source4 = { e: 5 }; + * const result = assignInWith(target, source1, source2, source3, source4, (objValue, srcValue) => { + * return objValue === undefined ? srcValue : objValue; + * }); + * // => { a: 1, b: 2, c: 3, d: 4, e: 5 } + */ +declare function assignInWith(object: T, source1: U, source2: V, source3: W, source4: X, customizer: AssignCustomizer): T & U & V & W & X; +/** + * Returns the target object as-is. + * + * @template T - The type of the target object. + * @param {T} object - The target object. + * @returns {T} The target object. + * + * @example + * const target = { a: 1, b: 2 }; + * const result = assignInWith(target); + * // => { a: 1, b: 2 } + */ +declare function assignInWith(object: T): T; +/** + * Assigns own and inherited properties from multiple source objects to a target object using a customizer function. + * + * @template R - The type of the result. + * @param {any} object - The target object to which properties will be assigned. + * @param {...any[]} otherArgs - The source objects and customizer function. + * @returns {R} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const result = assignInWith(target, { b: 2 }, { c: 3 }, (objValue, srcValue) => { + * return objValue === undefined ? srcValue : objValue; + * }); + * // => { a: 1, b: 2, c: 3 } + */ +declare function assignInWith(object: any, ...otherArgs: any[]): R; +//#endregion +export { assignInWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/assignInWith.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignInWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8479d96ad0465c3620d1bf9873ce41c4aaf2a4e2 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignInWith.d.ts @@ -0,0 +1,127 @@ +//#region src/compat/object/assignInWith.d.ts +type AssignCustomizer = (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any; +/** + * Assigns own and inherited properties from one source object to a target object using a customizer function. + * + * @template T - The type of the target object. + * @template U - The type of the source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source - The source object whose properties will be assigned to the target object. + * @param {AssignCustomizer} customizer - The function to customize assigned values. + * @returns {T & U} The updated target object with properties from the source object assigned. + * + * @example + * const target = { a: 1, b: 2 }; + * const source = { b: 3, c: 4 }; + * const result = assignInWith(target, source, (objValue, srcValue) => { + * return objValue === undefined ? srcValue : objValue; + * }); + * // => { a: 1, b: 2, c: 4 } + */ +declare function assignInWith(object: T, source: U, customizer: AssignCustomizer): T & U; +/** + * Assigns own and inherited properties from two source objects to a target object using a customizer function. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @param {AssignCustomizer} customizer - The function to customize assigned values. + * @returns {T & U & V} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const result = assignInWith(target, source1, source2, (objValue, srcValue) => { + * return objValue === undefined ? srcValue : objValue; + * }); + * // => { a: 1, b: 2, c: 3 } + */ +declare function assignInWith(object: T, source1: U, source2: V, customizer: AssignCustomizer): T & U & V; +/** + * Assigns own and inherited properties from three source objects to a target object using a customizer function. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @template W - The type of the third source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @param {W} source3 - The third source object whose properties will be assigned to the target object. + * @param {AssignCustomizer} customizer - The function to customize assigned values. + * @returns {T & U & V & W} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const source3 = { d: 4 }; + * const result = assignInWith(target, source1, source2, source3, (objValue, srcValue) => { + * return objValue === undefined ? srcValue : objValue; + * }); + * // => { a: 1, b: 2, c: 3, d: 4 } + */ +declare function assignInWith(object: T, source1: U, source2: V, source3: W, customizer: AssignCustomizer): T & U & V & W; +/** + * Assigns own and inherited properties from four source objects to a target object using a customizer function. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @template W - The type of the third source object. + * @template X - The type of the fourth source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @param {W} source3 - The third source object whose properties will be assigned to the target object. + * @param {X} source4 - The fourth source object whose properties will be assigned to the target object. + * @param {AssignCustomizer} customizer - The function to customize assigned values. + * @returns {T & U & V & W & X} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const source3 = { d: 4 }; + * const source4 = { e: 5 }; + * const result = assignInWith(target, source1, source2, source3, source4, (objValue, srcValue) => { + * return objValue === undefined ? srcValue : objValue; + * }); + * // => { a: 1, b: 2, c: 3, d: 4, e: 5 } + */ +declare function assignInWith(object: T, source1: U, source2: V, source3: W, source4: X, customizer: AssignCustomizer): T & U & V & W & X; +/** + * Returns the target object as-is. + * + * @template T - The type of the target object. + * @param {T} object - The target object. + * @returns {T} The target object. + * + * @example + * const target = { a: 1, b: 2 }; + * const result = assignInWith(target); + * // => { a: 1, b: 2 } + */ +declare function assignInWith(object: T): T; +/** + * Assigns own and inherited properties from multiple source objects to a target object using a customizer function. + * + * @template R - The type of the result. + * @param {any} object - The target object to which properties will be assigned. + * @param {...any[]} otherArgs - The source objects and customizer function. + * @returns {R} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const result = assignInWith(target, { b: 2 }, { c: 3 }, (objValue, srcValue) => { + * return objValue === undefined ? srcValue : objValue; + * }); + * // => { a: 1, b: 2, c: 3 } + */ +declare function assignInWith(object: any, ...otherArgs: any[]): R; +//#endregion +export { assignInWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/assignInWith.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignInWith.js new file mode 100644 index 0000000000000000000000000000000000000000..312a2f3735ddf234aa6523561bef8362c1f06402 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignInWith.js @@ -0,0 +1,48 @@ +const require_isEqualsSameValueZero = require("../../_internal/isEqualsSameValueZero.js"); +require("../util/eq.js"); +const require_keysIn = require("./keysIn.js"); +//#region src/compat/object/assignInWith.ts +/** +* Assigns properties from multiple source objects to a target object. +* You can provide a `getValueToAssign` function to determine what value will be assigned for each property. +* +* This function merges the properties of the source objects into the target object, +* including properties from the prototype chain. If a property in the source objects +* is equal to the corresponding property in the target object, it will not be overwritten. +* +* Unlike `assignIn`, this method accepts a `getValueToAssign` function that determines +* the final value to be assigned to each property in the target object. The return value +* of this function will be directly assigned to the corresponding property. This allows for +* more precise control over how properties are merged between objects. If not provided, +* the default behavior is equivalent to using the identity function (returning the source value). +* +* @param {any} object - The target object to which properties will be assigned. +* @param {...any[]} sources - The source objects whose properties will be assigned to the target object. +* @returns {any} The updated target object with properties from the source objects assigned. +* +* @example +* const target = { a: 1 }; +* const result = assignInWith(target, { b: 2 }, { c: 3 }, function(objValue, srcValue) { +* return objValue === undefined ? srcValue : objValue; +* }); +* console.log(result); // Output: { a: 1, b: 2, c: 3 } +*/ +function assignInWith(object, ...sources) { + let getValueToAssign = sources[sources.length - 1]; + if (typeof getValueToAssign === "function") sources.pop(); + else getValueToAssign = void 0; + for (let i = 0; i < sources.length; i++) assignInWithImpl(object, sources[i], getValueToAssign); + return object; +} +function assignInWithImpl(object, source, getValueToAssign) { + const keys = require_keysIn.keysIn(source); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const objValue = object[key]; + const srcValue = source[key]; + const newValue = getValueToAssign?.(objValue, srcValue, key, object, source) ?? srcValue; + if (!(key in object) || !require_isEqualsSameValueZero.isEqualsSameValueZero(objValue, newValue)) object[key] = newValue; + } +} +//#endregion +exports.assignInWith = assignInWith; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/assignInWith.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignInWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7918e9b2bd32da073391765e76e2a7d81d776372 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignInWith.mjs @@ -0,0 +1,48 @@ +import { isEqualsSameValueZero } from "../../_internal/isEqualsSameValueZero.mjs"; +import "../util/eq.mjs"; +import { keysIn } from "./keysIn.mjs"; +//#region src/compat/object/assignInWith.ts +/** +* Assigns properties from multiple source objects to a target object. +* You can provide a `getValueToAssign` function to determine what value will be assigned for each property. +* +* This function merges the properties of the source objects into the target object, +* including properties from the prototype chain. If a property in the source objects +* is equal to the corresponding property in the target object, it will not be overwritten. +* +* Unlike `assignIn`, this method accepts a `getValueToAssign` function that determines +* the final value to be assigned to each property in the target object. The return value +* of this function will be directly assigned to the corresponding property. This allows for +* more precise control over how properties are merged between objects. If not provided, +* the default behavior is equivalent to using the identity function (returning the source value). +* +* @param {any} object - The target object to which properties will be assigned. +* @param {...any[]} sources - The source objects whose properties will be assigned to the target object. +* @returns {any} The updated target object with properties from the source objects assigned. +* +* @example +* const target = { a: 1 }; +* const result = assignInWith(target, { b: 2 }, { c: 3 }, function(objValue, srcValue) { +* return objValue === undefined ? srcValue : objValue; +* }); +* console.log(result); // Output: { a: 1, b: 2, c: 3 } +*/ +function assignInWith(object, ...sources) { + let getValueToAssign = sources[sources.length - 1]; + if (typeof getValueToAssign === "function") sources.pop(); + else getValueToAssign = void 0; + for (let i = 0; i < sources.length; i++) assignInWithImpl(object, sources[i], getValueToAssign); + return object; +} +function assignInWithImpl(object, source, getValueToAssign) { + const keys = keysIn(source); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const objValue = object[key]; + const srcValue = source[key]; + const newValue = getValueToAssign?.(objValue, srcValue, key, object, source) ?? srcValue; + if (!(key in object) || !isEqualsSameValueZero(objValue, newValue)) object[key] = newValue; + } +} +//#endregion +export { assignInWith }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/assignWith.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..611b247f17b031f16a23506df75f4d478ba50bdf --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignWith.d.mts @@ -0,0 +1,127 @@ +//#region src/compat/object/assignWith.d.ts +type AssignCustomizer = (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any; +/** + * Assigns own properties from one source object to a target object using a customizer function. + * + * @template T - The type of the target object. + * @template U - The type of the source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source - The source object whose properties will be assigned to the target object. + * @param {AssignCustomizer} customizer - The function to customize assigned values. + * @returns {T & U} The updated target object with properties from the source object assigned. + * + * @example + * const target = { a: 1, b: 2 }; + * const source = { b: 3, c: 4 }; + * const result = assignWith(target, source, (objValue, srcValue) => { + * return objValue === undefined ? srcValue : objValue; + * }); + * // => { a: 1, b: 2, c: 4 } + */ +declare function assignWith(object: T, source: U, customizer: AssignCustomizer): T & U; +/** + * Assigns own properties from two source objects to a target object using a customizer function. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @param {AssignCustomizer} customizer - The function to customize assigned values. + * @returns {T & U & V} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const result = assignWith(target, source1, source2, (objValue, srcValue) => { + * return objValue === undefined ? srcValue : objValue; + * }); + * // => { a: 1, b: 2, c: 3 } + */ +declare function assignWith(object: T, source1: U, source2: V, customizer: AssignCustomizer): T & U & V; +/** + * Assigns own properties from three source objects to a target object using a customizer function. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @template W - The type of the third source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @param {W} source3 - The third source object whose properties will be assigned to the target object. + * @param {AssignCustomizer} customizer - The function to customize assigned values. + * @returns {T & U & V & W} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const source3 = { d: 4 }; + * const result = assignWith(target, source1, source2, source3, (objValue, srcValue) => { + * return objValue === undefined ? srcValue : objValue; + * }); + * // => { a: 1, b: 2, c: 3, d: 4 } + */ +declare function assignWith(object: T, source1: U, source2: V, source3: W, customizer: AssignCustomizer): T & U & V & W; +/** + * Assigns own properties from four source objects to a target object using a customizer function. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @template W - The type of the third source object. + * @template X - The type of the fourth source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @param {W} source3 - The third source object whose properties will be assigned to the target object. + * @param {X} source4 - The fourth source object whose properties will be assigned to the target object. + * @param {AssignCustomizer} customizer - The function to customize assigned values. + * @returns {T & U & V & W & X} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const source3 = { d: 4 }; + * const source4 = { e: 5 }; + * const result = assignWith(target, source1, source2, source3, source4, (objValue, srcValue) => { + * return objValue === undefined ? srcValue : objValue; + * }); + * // => { a: 1, b: 2, c: 3, d: 4, e: 5 } + */ +declare function assignWith(object: T, source1: U, source2: V, source3: W, source4: X, customizer: AssignCustomizer): T & U & V & W & X; +/** + * Returns the target object as-is. + * + * @template T - The type of the target object. + * @param {T} object - The target object. + * @returns {T} The target object. + * + * @example + * const target = { a: 1, b: 2 }; + * const result = assignWith(target); + * // => { a: 1, b: 2 } + */ +declare function assignWith(object: T): T; +/** + * Assigns own properties from multiple source objects to a target object using a customizer function. + * + * @template R - The type of the result. + * @param {any} object - The target object to which properties will be assigned. + * @param {...any[]} otherArgs - The source objects and customizer function. + * @returns {R} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const result = assignWith(target, { b: 2 }, { c: 3 }, (objValue, srcValue) => { + * return objValue === undefined ? srcValue : objValue; + * }); + * // => { a: 1, b: 2, c: 3 } + */ +declare function assignWith(object: any, ...otherArgs: any[]): R; +//#endregion +export { assignWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/assignWith.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..611b247f17b031f16a23506df75f4d478ba50bdf --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignWith.d.ts @@ -0,0 +1,127 @@ +//#region src/compat/object/assignWith.d.ts +type AssignCustomizer = (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any; +/** + * Assigns own properties from one source object to a target object using a customizer function. + * + * @template T - The type of the target object. + * @template U - The type of the source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source - The source object whose properties will be assigned to the target object. + * @param {AssignCustomizer} customizer - The function to customize assigned values. + * @returns {T & U} The updated target object with properties from the source object assigned. + * + * @example + * const target = { a: 1, b: 2 }; + * const source = { b: 3, c: 4 }; + * const result = assignWith(target, source, (objValue, srcValue) => { + * return objValue === undefined ? srcValue : objValue; + * }); + * // => { a: 1, b: 2, c: 4 } + */ +declare function assignWith(object: T, source: U, customizer: AssignCustomizer): T & U; +/** + * Assigns own properties from two source objects to a target object using a customizer function. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @param {AssignCustomizer} customizer - The function to customize assigned values. + * @returns {T & U & V} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const result = assignWith(target, source1, source2, (objValue, srcValue) => { + * return objValue === undefined ? srcValue : objValue; + * }); + * // => { a: 1, b: 2, c: 3 } + */ +declare function assignWith(object: T, source1: U, source2: V, customizer: AssignCustomizer): T & U & V; +/** + * Assigns own properties from three source objects to a target object using a customizer function. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @template W - The type of the third source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @param {W} source3 - The third source object whose properties will be assigned to the target object. + * @param {AssignCustomizer} customizer - The function to customize assigned values. + * @returns {T & U & V & W} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const source3 = { d: 4 }; + * const result = assignWith(target, source1, source2, source3, (objValue, srcValue) => { + * return objValue === undefined ? srcValue : objValue; + * }); + * // => { a: 1, b: 2, c: 3, d: 4 } + */ +declare function assignWith(object: T, source1: U, source2: V, source3: W, customizer: AssignCustomizer): T & U & V & W; +/** + * Assigns own properties from four source objects to a target object using a customizer function. + * + * @template T - The type of the target object. + * @template U - The type of the first source object. + * @template V - The type of the second source object. + * @template W - The type of the third source object. + * @template X - The type of the fourth source object. + * @param {T} object - The target object to which properties will be assigned. + * @param {U} source1 - The first source object whose properties will be assigned to the target object. + * @param {V} source2 - The second source object whose properties will be assigned to the target object. + * @param {W} source3 - The third source object whose properties will be assigned to the target object. + * @param {X} source4 - The fourth source object whose properties will be assigned to the target object. + * @param {AssignCustomizer} customizer - The function to customize assigned values. + * @returns {T & U & V & W & X} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const source3 = { d: 4 }; + * const source4 = { e: 5 }; + * const result = assignWith(target, source1, source2, source3, source4, (objValue, srcValue) => { + * return objValue === undefined ? srcValue : objValue; + * }); + * // => { a: 1, b: 2, c: 3, d: 4, e: 5 } + */ +declare function assignWith(object: T, source1: U, source2: V, source3: W, source4: X, customizer: AssignCustomizer): T & U & V & W & X; +/** + * Returns the target object as-is. + * + * @template T - The type of the target object. + * @param {T} object - The target object. + * @returns {T} The target object. + * + * @example + * const target = { a: 1, b: 2 }; + * const result = assignWith(target); + * // => { a: 1, b: 2 } + */ +declare function assignWith(object: T): T; +/** + * Assigns own properties from multiple source objects to a target object using a customizer function. + * + * @template R - The type of the result. + * @param {any} object - The target object to which properties will be assigned. + * @param {...any[]} otherArgs - The source objects and customizer function. + * @returns {R} The updated target object with properties from the source objects assigned. + * + * @example + * const target = { a: 1 }; + * const result = assignWith(target, { b: 2 }, { c: 3 }, (objValue, srcValue) => { + * return objValue === undefined ? srcValue : objValue; + * }); + * // => { a: 1, b: 2, c: 3 } + */ +declare function assignWith(object: any, ...otherArgs: any[]): R; +//#endregion +export { assignWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/assignWith.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignWith.js new file mode 100644 index 0000000000000000000000000000000000000000..ffaa9af1cae6e23a664a61f14b53b2e5c3bf9499 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignWith.js @@ -0,0 +1,48 @@ +const require_isEqualsSameValueZero = require("../../_internal/isEqualsSameValueZero.js"); +require("../util/eq.js"); +const require_keys = require("./keys.js"); +//#region src/compat/object/assignWith.ts +/** +* Assigns properties from multiple source objects to a target object. +* You can provide a `getValueToAssign` function to determine what value will be assigned for each property. +* +* This function merges the properties of the source objects into the target object. +* If a property in the source objects is equal to the corresponding property in the target object, +* it will not be overwritten. +* +* Unlike `assign`, this method accepts a `getValueToAssign` function that determines +* the final value to be assigned to each property in the target object. The return value +* of this function will be directly assigned to the corresponding property. This allows for +* more precise control over how properties are merged between objects. If not provided, +* the default behavior is equivalent to using the identity function (returning the source value). +* +* @param {any} object - The target object to which properties will be assigned. +* @param {...any[]} sources - The source objects whose properties will be assigned to the target object. +* @returns {any} The updated target object with properties from the source objects assigned. +* +* @example +* const target = { a: 1 }; +* const result = assignWith(target, { b: 2 }, { c: 3 }, function(objValue, srcValue) { +* return objValue === undefined ? srcValue : objValue; +* }); +* console.log(result); // Output: { a: 1, b: 2, c: 3 } +*/ +function assignWith(object, ...sources) { + let getValueToAssign = sources[sources.length - 1]; + if (typeof getValueToAssign === "function") sources.pop(); + else getValueToAssign = void 0; + for (let i = 0; i < sources.length; i++) assignWithImpl(object, sources[i], getValueToAssign); + return object; +} +function assignWithImpl(object, source, getValueToAssign) { + const keys$1 = require_keys.keys(source); + for (let i = 0; i < keys$1.length; i++) { + const key = keys$1[i]; + const objValue = object[key]; + const srcValue = source[key]; + const newValue = getValueToAssign?.(objValue, srcValue, key, object, source) ?? srcValue; + if (!(key in object) || !require_isEqualsSameValueZero.isEqualsSameValueZero(objValue, newValue)) object[key] = newValue; + } +} +//#endregion +exports.assignWith = assignWith; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/assignWith.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..367c65c4d0865358dec9777c35567a52da1edd51 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/assignWith.mjs @@ -0,0 +1,48 @@ +import { isEqualsSameValueZero } from "../../_internal/isEqualsSameValueZero.mjs"; +import "../util/eq.mjs"; +import { keys } from "./keys.mjs"; +//#region src/compat/object/assignWith.ts +/** +* Assigns properties from multiple source objects to a target object. +* You can provide a `getValueToAssign` function to determine what value will be assigned for each property. +* +* This function merges the properties of the source objects into the target object. +* If a property in the source objects is equal to the corresponding property in the target object, +* it will not be overwritten. +* +* Unlike `assign`, this method accepts a `getValueToAssign` function that determines +* the final value to be assigned to each property in the target object. The return value +* of this function will be directly assigned to the corresponding property. This allows for +* more precise control over how properties are merged between objects. If not provided, +* the default behavior is equivalent to using the identity function (returning the source value). +* +* @param {any} object - The target object to which properties will be assigned. +* @param {...any[]} sources - The source objects whose properties will be assigned to the target object. +* @returns {any} The updated target object with properties from the source objects assigned. +* +* @example +* const target = { a: 1 }; +* const result = assignWith(target, { b: 2 }, { c: 3 }, function(objValue, srcValue) { +* return objValue === undefined ? srcValue : objValue; +* }); +* console.log(result); // Output: { a: 1, b: 2, c: 3 } +*/ +function assignWith(object, ...sources) { + let getValueToAssign = sources[sources.length - 1]; + if (typeof getValueToAssign === "function") sources.pop(); + else getValueToAssign = void 0; + for (let i = 0; i < sources.length; i++) assignWithImpl(object, sources[i], getValueToAssign); + return object; +} +function assignWithImpl(object, source, getValueToAssign) { + const keys$1 = keys(source); + for (let i = 0; i < keys$1.length; i++) { + const key = keys$1[i]; + const objValue = object[key]; + const srcValue = source[key]; + const newValue = getValueToAssign?.(objValue, srcValue, key, object, source) ?? srcValue; + if (!(key in object) || !isEqualsSameValueZero(objValue, newValue)) object[key] = newValue; + } +} +//#endregion +export { assignWith }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/at.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/at.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..7bbc566b3e5715cf49c0d2787108e7c3644b1f5d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/at.d.mts @@ -0,0 +1,34 @@ +//#region src/compat/object/at.d.ts +type PropertyName = string | number | symbol; +type Many = T | readonly T[]; +type PropertyPath = Many; +/** + * Gets values at given paths from a dictionary or numeric dictionary. + * + * @template T - The type of the values in the dictionary. + * @param {Record | Record | null | undefined} object - The dictionary to query. + * @param {...PropertyPath[]} props - The property paths to get values for. + * @returns {T[]} Returns an array of the picked values. + * + * @example + * const object = { 'a': 1, 'b': 2, 'c': 3 }; + * at(object, 'a', 'c'); + * // => [1, 3] + */ +declare function at(object: Record | Record | null | undefined, ...props: PropertyPath[]): T[]; +/** + * Gets values at given keys from an object. + * + * @template T - The type of the object. + * @param {T | null | undefined} object - The object to query. + * @param {...Array>} props - The property keys to get values for. + * @returns {Array} Returns an array of the picked values. + * + * @example + * const object = { 'a': 1, 'b': 2, 'c': 3 }; + * at(object, 'a', 'c'); + * // => [1, 3] + */ +declare function at(object: T | null | undefined, ...props: Array>): Array; +//#endregion +export { at }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/at.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/at.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7bbc566b3e5715cf49c0d2787108e7c3644b1f5d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/at.d.ts @@ -0,0 +1,34 @@ +//#region src/compat/object/at.d.ts +type PropertyName = string | number | symbol; +type Many = T | readonly T[]; +type PropertyPath = Many; +/** + * Gets values at given paths from a dictionary or numeric dictionary. + * + * @template T - The type of the values in the dictionary. + * @param {Record | Record | null | undefined} object - The dictionary to query. + * @param {...PropertyPath[]} props - The property paths to get values for. + * @returns {T[]} Returns an array of the picked values. + * + * @example + * const object = { 'a': 1, 'b': 2, 'c': 3 }; + * at(object, 'a', 'c'); + * // => [1, 3] + */ +declare function at(object: Record | Record | null | undefined, ...props: PropertyPath[]): T[]; +/** + * Gets values at given keys from an object. + * + * @template T - The type of the object. + * @param {T | null | undefined} object - The object to query. + * @param {...Array>} props - The property keys to get values for. + * @returns {Array} Returns an array of the picked values. + * + * @example + * const object = { 'a': 1, 'b': 2, 'c': 3 }; + * at(object, 'a', 'c'); + * // => [1, 3] + */ +declare function at(object: T | null | undefined, ...props: Array>): Array; +//#endregion +export { at }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/at.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/at.js new file mode 100644 index 0000000000000000000000000000000000000000..96c7685e411a71507b5f1c4e2ceb824bc8fe714f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/at.js @@ -0,0 +1,37 @@ +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_get = require("./get.js"); +const require_isString = require("../predicate/isString.js"); +//#region src/compat/object/at.ts +/** +* Returns an array of values corresponding to `paths` of `object`. +* +* @template T - The type of the object. +* @param {T} object - The object to iterate over. +* @param {...(PropertyKey | PropertyKey[] | ArrayLike)} [paths] - The property paths to pick. +* @returns {Array} - Returns the picked values. +* +* @example +* ```js +* const object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; +* +* at(object, ['a[0].b.c', 'a[1]']); +* // => [3, 4] +* ``` +*/ +function at(object, ...paths) { + if (paths.length === 0) return []; + const allPaths = []; + for (let i = 0; i < paths.length; i++) { + const path = paths[i]; + if (!require_isArrayLike.isArrayLike(path) || require_isString.isString(path)) { + allPaths.push(path); + continue; + } + for (let j = 0; j < path.length; j++) allPaths.push(path[j]); + } + const result = []; + for (let i = 0; i < allPaths.length; i++) result.push(require_get.get(object, allPaths[i])); + return result; +} +//#endregion +exports.at = at; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/at.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/at.mjs new file mode 100644 index 0000000000000000000000000000000000000000..32d1e2e7ee446aed18c97ff17e9323d4e23c1556 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/at.mjs @@ -0,0 +1,37 @@ +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { get } from "./get.mjs"; +import { isString } from "../predicate/isString.mjs"; +//#region src/compat/object/at.ts +/** +* Returns an array of values corresponding to `paths` of `object`. +* +* @template T - The type of the object. +* @param {T} object - The object to iterate over. +* @param {...(PropertyKey | PropertyKey[] | ArrayLike)} [paths] - The property paths to pick. +* @returns {Array} - Returns the picked values. +* +* @example +* ```js +* const object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; +* +* at(object, ['a[0].b.c', 'a[1]']); +* // => [3, 4] +* ``` +*/ +function at(object, ...paths) { + if (paths.length === 0) return []; + const allPaths = []; + for (let i = 0; i < paths.length; i++) { + const path = paths[i]; + if (!isArrayLike(path) || isString(path)) { + allPaths.push(path); + continue; + } + for (let j = 0; j < path.length; j++) allPaths.push(path[j]); + } + const result = []; + for (let i = 0; i < allPaths.length; i++) result.push(get(object, allPaths[i])); + return result; +} +//#endregion +export { at }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/clone.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/clone.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..673efebc546b60d834a5240bd3cdcda4cc15cdf4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/clone.d.mts @@ -0,0 +1,32 @@ +//#region src/compat/object/clone.d.ts +/** + * Creates a shallow clone of the given object. + * + * @template T - The type of the object. + * @param {T} obj - The object to clone. + * @returns {T} - A shallow clone of the given object. + * + * @example + * // Clone a primitive objs + * const num = 29; + * const clonedNum = clone(num); + * console.log(clonedNum); // 29 + * console.log(clonedNum === num); // true + * + * @example + * // Clone an array + * const arr = [1, 2, 3]; + * const clonedArr = clone(arr); + * console.log(clonedArr); // [1, 2, 3] + * console.log(clonedArr === arr); // false + * + * @example + * // Clone an object + * const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] }; + * const clonedObj = clone(obj); + * console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] } + * console.log(clonedObj === obj); // false + */ +declare function clone(obj: T): T; +//#endregion +export { clone }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/clone.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/clone.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..673efebc546b60d834a5240bd3cdcda4cc15cdf4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/clone.d.ts @@ -0,0 +1,32 @@ +//#region src/compat/object/clone.d.ts +/** + * Creates a shallow clone of the given object. + * + * @template T - The type of the object. + * @param {T} obj - The object to clone. + * @returns {T} - A shallow clone of the given object. + * + * @example + * // Clone a primitive objs + * const num = 29; + * const clonedNum = clone(num); + * console.log(clonedNum); // 29 + * console.log(clonedNum === num); // true + * + * @example + * // Clone an array + * const arr = [1, 2, 3]; + * const clonedArr = clone(arr); + * console.log(clonedArr); // [1, 2, 3] + * console.log(clonedArr === arr); // false + * + * @example + * // Clone an object + * const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] }; + * const clonedObj = clone(obj); + * console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] } + * console.log(clonedObj === obj); // false + */ +declare function clone(obj: T): T; +//#endregion +export { clone }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/clone.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/clone.js new file mode 100644 index 0000000000000000000000000000000000000000..8cd5f038542f380afc471fe99fa0004568ff21fe --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/clone.js @@ -0,0 +1,156 @@ +const require_isPrimitive = require("../../predicate/isPrimitive.js"); +const require_getTag = require("../_internal/getTag.js"); +const require_tags = require("../_internal/tags.js"); +const require_isArray = require("../predicate/isArray.js"); +const require_isTypedArray = require("../predicate/isTypedArray.js"); +//#region src/compat/object/clone.ts +/** +* Creates a shallow clone of the given object. +* +* @template T - The type of the object. +* @param {T} obj - The object to clone. +* @returns {T} - A shallow clone of the given object. +* +* @example +* // Clone a primitive objs +* const num = 29; +* const clonedNum = clone(num); +* console.log(clonedNum); // 29 +* console.log(clonedNum === num); // true +* +* @example +* // Clone an array +* const arr = [1, 2, 3]; +* const clonedArr = clone(arr); +* console.log(clonedArr); // [1, 2, 3] +* console.log(clonedArr === arr); // false +* +* @example +* // Clone an object +* const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] }; +* const clonedObj = clone(obj); +* console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] } +* console.log(clonedObj === obj); // false +*/ +function clone(obj) { + if (require_isPrimitive.isPrimitive(obj)) return obj; + const tag = require_getTag.getTag(obj); + if (!isCloneableObject(obj)) return {}; + if (require_isArray.isArray(obj)) { + const result = Array.from(obj); + if (obj.length > 0 && typeof obj[0] === "string" && Object.hasOwn(obj, "index")) { + result.index = obj.index; + result.input = obj.input; + } + return result; + } + if (require_isTypedArray.isTypedArray(obj)) { + const typedArray = obj; + const Ctor = typedArray.constructor; + return new Ctor(typedArray.buffer, typedArray.byteOffset, typedArray.length); + } + if (tag === "[object ArrayBuffer]") return new ArrayBuffer(obj.byteLength); + if (tag === "[object DataView]") { + const dataView = obj; + const buffer = dataView.buffer; + const byteOffset = dataView.byteOffset; + const byteLength = dataView.byteLength; + const clonedBuffer = new ArrayBuffer(byteLength); + const srcView = new Uint8Array(buffer, byteOffset, byteLength); + new Uint8Array(clonedBuffer).set(srcView); + return new DataView(clonedBuffer); + } + if (tag === "[object Boolean]" || tag === "[object Number]" || tag === "[object String]") { + const Ctor = obj.constructor; + const clone = new Ctor(obj.valueOf()); + if (tag === "[object String]") cloneStringObjectProperties(clone, obj); + else copyOwnProperties(clone, obj); + return clone; + } + if (tag === "[object Date]") return new Date(Number(obj)); + if (tag === "[object RegExp]") { + const regExp = obj; + const clone = new RegExp(regExp.source, regExp.flags); + clone.lastIndex = regExp.lastIndex; + return clone; + } + if (tag === "[object Symbol]") return Object(Symbol.prototype.valueOf.call(obj)); + if (tag === "[object Map]") { + const map = obj; + const result = /* @__PURE__ */ new Map(); + map.forEach((obj, key) => { + result.set(key, obj); + }); + return result; + } + if (tag === "[object Set]") { + const set = obj; + const result = /* @__PURE__ */ new Set(); + set.forEach((obj) => { + result.add(obj); + }); + return result; + } + if (tag === "[object Arguments]") { + const args = obj; + const result = {}; + copyOwnProperties(result, args); + result.length = args.length; + result[Symbol.iterator] = args[Symbol.iterator]; + return result; + } + const result = {}; + copyPrototype(result, obj); + copyOwnProperties(result, obj); + copySymbolProperties(result, obj); + return result; +} +function isCloneableObject(object) { + switch (require_getTag.getTag(object)) { + case require_tags.argumentsTag: + case require_tags.arrayTag: + case require_tags.arrayBufferTag: + case require_tags.dataViewTag: + case require_tags.booleanTag: + case require_tags.dateTag: + case require_tags.float32ArrayTag: + case require_tags.float64ArrayTag: + case require_tags.int8ArrayTag: + case require_tags.int16ArrayTag: + case require_tags.int32ArrayTag: + case require_tags.mapTag: + case require_tags.numberTag: + case require_tags.objectTag: + case require_tags.regexpTag: + case require_tags.setTag: + case require_tags.stringTag: + case require_tags.symbolTag: + case require_tags.uint8ArrayTag: + case require_tags.uint8ClampedArrayTag: + case require_tags.uint16ArrayTag: + case require_tags.uint32ArrayTag: return true; + default: return false; + } +} +function copyOwnProperties(target, source) { + for (const key in source) if (Object.hasOwn(source, key)) target[key] = source[key]; +} +function copySymbolProperties(target, source) { + const symbols = Object.getOwnPropertySymbols(source); + for (let i = 0; i < symbols.length; i++) { + const symbol = symbols[i]; + if (Object.prototype.propertyIsEnumerable.call(source, symbol)) target[symbol] = source[symbol]; + } +} +function cloneStringObjectProperties(target, source) { + const stringLength = source.valueOf().length; + for (const key in source) if (Object.hasOwn(source, key) && (Number.isNaN(Number(key)) || Number(key) >= stringLength)) target[key] = source[key]; +} +function copyPrototype(target, source) { + const proto = Object.getPrototypeOf(source); + if (proto !== null) { + if (typeof source.constructor === "function") Object.setPrototypeOf(target, proto); + } +} +//#endregion +exports.clone = clone; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/clone.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/clone.mjs new file mode 100644 index 0000000000000000000000000000000000000000..562ab34c72263195fd2b1133a4bcd3d53c5c69cb --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/clone.mjs @@ -0,0 +1,156 @@ +import { isPrimitive } from "../../predicate/isPrimitive.mjs"; +import { getTag } from "../_internal/getTag.mjs"; +import { argumentsTag, arrayBufferTag, arrayTag, booleanTag, dataViewTag, dateTag, float32ArrayTag, float64ArrayTag, int16ArrayTag, int32ArrayTag, int8ArrayTag, mapTag, numberTag, objectTag, regexpTag, setTag, stringTag, symbolTag, uint16ArrayTag, uint32ArrayTag, uint8ArrayTag, uint8ClampedArrayTag } from "../_internal/tags.mjs"; +import { isArray } from "../predicate/isArray.mjs"; +import { isTypedArray } from "../predicate/isTypedArray.mjs"; +//#region src/compat/object/clone.ts +/** +* Creates a shallow clone of the given object. +* +* @template T - The type of the object. +* @param {T} obj - The object to clone. +* @returns {T} - A shallow clone of the given object. +* +* @example +* // Clone a primitive objs +* const num = 29; +* const clonedNum = clone(num); +* console.log(clonedNum); // 29 +* console.log(clonedNum === num); // true +* +* @example +* // Clone an array +* const arr = [1, 2, 3]; +* const clonedArr = clone(arr); +* console.log(clonedArr); // [1, 2, 3] +* console.log(clonedArr === arr); // false +* +* @example +* // Clone an object +* const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] }; +* const clonedObj = clone(obj); +* console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] } +* console.log(clonedObj === obj); // false +*/ +function clone(obj) { + if (isPrimitive(obj)) return obj; + const tag = getTag(obj); + if (!isCloneableObject(obj)) return {}; + if (isArray(obj)) { + const result = Array.from(obj); + if (obj.length > 0 && typeof obj[0] === "string" && Object.hasOwn(obj, "index")) { + result.index = obj.index; + result.input = obj.input; + } + return result; + } + if (isTypedArray(obj)) { + const typedArray = obj; + const Ctor = typedArray.constructor; + return new Ctor(typedArray.buffer, typedArray.byteOffset, typedArray.length); + } + if (tag === "[object ArrayBuffer]") return new ArrayBuffer(obj.byteLength); + if (tag === "[object DataView]") { + const dataView = obj; + const buffer = dataView.buffer; + const byteOffset = dataView.byteOffset; + const byteLength = dataView.byteLength; + const clonedBuffer = new ArrayBuffer(byteLength); + const srcView = new Uint8Array(buffer, byteOffset, byteLength); + new Uint8Array(clonedBuffer).set(srcView); + return new DataView(clonedBuffer); + } + if (tag === "[object Boolean]" || tag === "[object Number]" || tag === "[object String]") { + const Ctor = obj.constructor; + const clone = new Ctor(obj.valueOf()); + if (tag === "[object String]") cloneStringObjectProperties(clone, obj); + else copyOwnProperties(clone, obj); + return clone; + } + if (tag === "[object Date]") return new Date(Number(obj)); + if (tag === "[object RegExp]") { + const regExp = obj; + const clone = new RegExp(regExp.source, regExp.flags); + clone.lastIndex = regExp.lastIndex; + return clone; + } + if (tag === "[object Symbol]") return Object(Symbol.prototype.valueOf.call(obj)); + if (tag === "[object Map]") { + const map = obj; + const result = /* @__PURE__ */ new Map(); + map.forEach((obj, key) => { + result.set(key, obj); + }); + return result; + } + if (tag === "[object Set]") { + const set = obj; + const result = /* @__PURE__ */ new Set(); + set.forEach((obj) => { + result.add(obj); + }); + return result; + } + if (tag === "[object Arguments]") { + const args = obj; + const result = {}; + copyOwnProperties(result, args); + result.length = args.length; + result[Symbol.iterator] = args[Symbol.iterator]; + return result; + } + const result = {}; + copyPrototype(result, obj); + copyOwnProperties(result, obj); + copySymbolProperties(result, obj); + return result; +} +function isCloneableObject(object) { + switch (getTag(object)) { + case argumentsTag: + case arrayTag: + case arrayBufferTag: + case dataViewTag: + case booleanTag: + case dateTag: + case float32ArrayTag: + case float64ArrayTag: + case int8ArrayTag: + case int16ArrayTag: + case int32ArrayTag: + case mapTag: + case numberTag: + case objectTag: + case regexpTag: + case setTag: + case stringTag: + case symbolTag: + case uint8ArrayTag: + case uint8ClampedArrayTag: + case uint16ArrayTag: + case uint32ArrayTag: return true; + default: return false; + } +} +function copyOwnProperties(target, source) { + for (const key in source) if (Object.hasOwn(source, key)) target[key] = source[key]; +} +function copySymbolProperties(target, source) { + const symbols = Object.getOwnPropertySymbols(source); + for (let i = 0; i < symbols.length; i++) { + const symbol = symbols[i]; + if (Object.prototype.propertyIsEnumerable.call(source, symbol)) target[symbol] = source[symbol]; + } +} +function cloneStringObjectProperties(target, source) { + const stringLength = source.valueOf().length; + for (const key in source) if (Object.hasOwn(source, key) && (Number.isNaN(Number(key)) || Number(key) >= stringLength)) target[key] = source[key]; +} +function copyPrototype(target, source) { + const proto = Object.getPrototypeOf(source); + if (proto !== null) { + if (typeof source.constructor === "function") Object.setPrototypeOf(target, proto); + } +} +//#endregion +export { clone }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeep.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeep.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..7c7705b3b058fdc6b8198dc1cd9782fd8b66d9e4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeep.d.mts @@ -0,0 +1,50 @@ +//#region src/compat/object/cloneDeep.d.ts +/** + * Creates a deep clone of the given object. + * + * @template T - The type of the object. + * @param {T} obj - The object to clone. + * @returns {T} - A deep clone of the given object. + * + * @example + * // Clone a primitive values + * const num = 29; + * const clonedNum = clone(num); + * console.log(clonedNum); // 29 + * console.log(clonedNum === num); // true + * + * @example + * // Clone an array + * const arr = [1, 2, 3]; + * const clonedArr = clone(arr); + * console.log(clonedArr); // [1, 2, 3] + * console.log(clonedArr === arr); // false + * + * @example + * // Clone an array with nested objects + * const arr = [1, { a: 1 }, [1, 2, 3]]; + * const clonedArr = clone(arr); + * arr[1].a = 2; + * console.log(arr); // [2, { a: 2 }, [1, 2, 3]] + * console.log(clonedArr); // [1, { a: 1 }, [1, 2, 3]] + * console.log(clonedArr === arr); // false + * + * @example + * // Clone an object + * const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] }; + * const clonedObj = clone(obj); + * console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] } + * console.log(clonedObj === obj); // false + * + * @example + * // Clone an object with nested objects + * const obj = { a: 1, b: { c: 1 } }; + * const clonedObj = clone(obj); + * obj.b.c = 2; + * console.log(obj); // { a: 1, b: { c: 2 } } + * console.log(clonedObj); // { a: 1, b: { c: 1 } } + * console.log(clonedObj === obj); // false + */ +declare function cloneDeep(obj: T): T; +//#endregion +export { cloneDeep }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeep.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeep.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7c7705b3b058fdc6b8198dc1cd9782fd8b66d9e4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeep.d.ts @@ -0,0 +1,50 @@ +//#region src/compat/object/cloneDeep.d.ts +/** + * Creates a deep clone of the given object. + * + * @template T - The type of the object. + * @param {T} obj - The object to clone. + * @returns {T} - A deep clone of the given object. + * + * @example + * // Clone a primitive values + * const num = 29; + * const clonedNum = clone(num); + * console.log(clonedNum); // 29 + * console.log(clonedNum === num); // true + * + * @example + * // Clone an array + * const arr = [1, 2, 3]; + * const clonedArr = clone(arr); + * console.log(clonedArr); // [1, 2, 3] + * console.log(clonedArr === arr); // false + * + * @example + * // Clone an array with nested objects + * const arr = [1, { a: 1 }, [1, 2, 3]]; + * const clonedArr = clone(arr); + * arr[1].a = 2; + * console.log(arr); // [2, { a: 2 }, [1, 2, 3]] + * console.log(clonedArr); // [1, { a: 1 }, [1, 2, 3]] + * console.log(clonedArr === arr); // false + * + * @example + * // Clone an object + * const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] }; + * const clonedObj = clone(obj); + * console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] } + * console.log(clonedObj === obj); // false + * + * @example + * // Clone an object with nested objects + * const obj = { a: 1, b: { c: 1 } }; + * const clonedObj = clone(obj); + * obj.b.c = 2; + * console.log(obj); // { a: 1, b: { c: 2 } } + * console.log(clonedObj); // { a: 1, b: { c: 1 } } + * console.log(clonedObj === obj); // false + */ +declare function cloneDeep(obj: T): T; +//#endregion +export { cloneDeep }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeep.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeep.js new file mode 100644 index 0000000000000000000000000000000000000000..0984144d8f47fd71c40138ead717eb64b809d5c4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeep.js @@ -0,0 +1,53 @@ +const require_cloneDeepWith = require("./cloneDeepWith.js"); +//#region src/compat/object/cloneDeep.ts +/** +* Creates a deep clone of the given object. +* +* @template T - The type of the object. +* @param {T} obj - The object to clone. +* @returns {T} - A deep clone of the given object. +* +* @example +* // Clone a primitive values +* const num = 29; +* const clonedNum = clone(num); +* console.log(clonedNum); // 29 +* console.log(clonedNum === num); // true +* +* @example +* // Clone an array +* const arr = [1, 2, 3]; +* const clonedArr = clone(arr); +* console.log(clonedArr); // [1, 2, 3] +* console.log(clonedArr === arr); // false +* +* @example +* // Clone an array with nested objects +* const arr = [1, { a: 1 }, [1, 2, 3]]; +* const clonedArr = clone(arr); +* arr[1].a = 2; +* console.log(arr); // [2, { a: 2 }, [1, 2, 3]] +* console.log(clonedArr); // [1, { a: 1 }, [1, 2, 3]] +* console.log(clonedArr === arr); // false +* +* @example +* // Clone an object +* const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] }; +* const clonedObj = clone(obj); +* console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] } +* console.log(clonedObj === obj); // false +* +* @example +* // Clone an object with nested objects +* const obj = { a: 1, b: { c: 1 } }; +* const clonedObj = clone(obj); +* obj.b.c = 2; +* console.log(obj); // { a: 1, b: { c: 2 } } +* console.log(clonedObj); // { a: 1, b: { c: 1 } } +* console.log(clonedObj === obj); // false +*/ +function cloneDeep(obj) { + return require_cloneDeepWith.cloneDeepWith(obj); +} +//#endregion +exports.cloneDeep = cloneDeep; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeep.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeep.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5be874ec234c8d4f76637c8ab6a9d967902417fa --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeep.mjs @@ -0,0 +1,53 @@ +import { cloneDeepWith } from "./cloneDeepWith.mjs"; +//#region src/compat/object/cloneDeep.ts +/** +* Creates a deep clone of the given object. +* +* @template T - The type of the object. +* @param {T} obj - The object to clone. +* @returns {T} - A deep clone of the given object. +* +* @example +* // Clone a primitive values +* const num = 29; +* const clonedNum = clone(num); +* console.log(clonedNum); // 29 +* console.log(clonedNum === num); // true +* +* @example +* // Clone an array +* const arr = [1, 2, 3]; +* const clonedArr = clone(arr); +* console.log(clonedArr); // [1, 2, 3] +* console.log(clonedArr === arr); // false +* +* @example +* // Clone an array with nested objects +* const arr = [1, { a: 1 }, [1, 2, 3]]; +* const clonedArr = clone(arr); +* arr[1].a = 2; +* console.log(arr); // [2, { a: 2 }, [1, 2, 3]] +* console.log(clonedArr); // [1, { a: 1 }, [1, 2, 3]] +* console.log(clonedArr === arr); // false +* +* @example +* // Clone an object +* const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] }; +* const clonedObj = clone(obj); +* console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] } +* console.log(clonedObj === obj); // false +* +* @example +* // Clone an object with nested objects +* const obj = { a: 1, b: { c: 1 } }; +* const clonedObj = clone(obj); +* obj.b.c = 2; +* console.log(obj); // { a: 1, b: { c: 2 } } +* console.log(clonedObj); // { a: 1, b: { c: 1 } } +* console.log(clonedObj === obj); // false +*/ +function cloneDeep(obj) { + return cloneDeepWith(obj); +} +//#endregion +export { cloneDeep }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..2dad4526489bed90c664abbc8375f342bff2fb4c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.d.mts @@ -0,0 +1,35 @@ +//#region src/compat/object/cloneDeepWith.d.ts +type CloneDeepWithCustomizer = (value: any, key: number | string | undefined, object: TObject | undefined, stack: any) => any; +/** + * Creates a deep clone of the given value using a customizer function. + * + * @template T - The type of the value. + * @param {T} value - The value to clone. + * @param {CloneDeepWithCustomizer} customizer - A function to customize the cloning process. + * @returns {any} - A deep clone of the given value. + * + * @example + * const obj = { a: 1, b: 2 }; + * const clonedObj = cloneDeepWith(obj, (value) => { + * if (typeof value === 'number') { + * return value * 2; + * } + * }); + * // => { a: 2, b: 4 } + */ +declare function cloneDeepWith(value: T, customizer: CloneDeepWithCustomizer): any; +/** + * Creates a deep clone of the given value. + * + * @template T - The type of the value. + * @param {T} value - The value to clone. + * @returns {T} - A deep clone of the given value. + * + * @example + * const obj = { a: 1, b: { c: 2 } }; + * const clonedObj = cloneDeepWith(obj); + * // => { a: 1, b: { c: 2 } } + */ +declare function cloneDeepWith(value: T): T; +//#endregion +export { cloneDeepWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2dad4526489bed90c664abbc8375f342bff2fb4c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.d.ts @@ -0,0 +1,35 @@ +//#region src/compat/object/cloneDeepWith.d.ts +type CloneDeepWithCustomizer = (value: any, key: number | string | undefined, object: TObject | undefined, stack: any) => any; +/** + * Creates a deep clone of the given value using a customizer function. + * + * @template T - The type of the value. + * @param {T} value - The value to clone. + * @param {CloneDeepWithCustomizer} customizer - A function to customize the cloning process. + * @returns {any} - A deep clone of the given value. + * + * @example + * const obj = { a: 1, b: 2 }; + * const clonedObj = cloneDeepWith(obj, (value) => { + * if (typeof value === 'number') { + * return value * 2; + * } + * }); + * // => { a: 2, b: 4 } + */ +declare function cloneDeepWith(value: T, customizer: CloneDeepWithCustomizer): any; +/** + * Creates a deep clone of the given value. + * + * @template T - The type of the value. + * @param {T} value - The value to clone. + * @returns {T} - A deep clone of the given value. + * + * @example + * const obj = { a: 1, b: { c: 2 } }; + * const clonedObj = cloneDeepWith(obj); + * // => { a: 1, b: { c: 2 } } + */ +declare function cloneDeepWith(value: T): T; +//#endregion +export { cloneDeepWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.js new file mode 100644 index 0000000000000000000000000000000000000000..964cb486ffea90798bca473892265be373886183 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.js @@ -0,0 +1,71 @@ +const require_getTag = require("../_internal/getTag.js"); +const require_tags = require("../_internal/tags.js"); +const require_cloneDeepWith = require("../../object/cloneDeepWith.js"); +//#region src/compat/object/cloneDeepWith.ts +/** +* Creates a deep clone of the given object using a customizer function. +* +* @template T - The type of the object. +* @param {T} obj - The object to clone. +* @param {Function} [cloneValue] - A function to customize the cloning process. +* @returns {T} - A deep clone of the given object. +* +* @example +* // Clone a primitive value +* const num = 29; +* const clonedNum = cloneDeepWith(num); +* console.log(clonedNum); // 29 +* console.log(clonedNum === num); // true +* +* @example +* // Clone an object with a customizer +* const obj = { a: 1, b: 2 }; +* const clonedObj = cloneDeepWith(obj, (value) => { +* if (typeof value === 'number') { +* return value * 2; // Double the number +* } +* }); +* console.log(clonedObj); // { a: 2, b: 4 } +* console.log(clonedObj === obj); // false +* +* @example +* // Clone an array with a customizer +* const arr = [1, 2, 3]; +* const clonedArr = cloneDeepWith(arr, (value) => { +* return value + 1; // Increment each value +* }); +* console.log(clonedArr); // [2, 3, 4] +* console.log(clonedArr === arr); // false +*/ +function cloneDeepWith(obj, customizer) { + return require_cloneDeepWith.cloneDeepWith(obj, (value, key, object, stack) => { + const cloned = customizer?.(value, key, object, stack); + if (cloned !== void 0) return cloned; + if (typeof obj !== "object") return; + if (require_getTag.getTag(obj) === "[object Object]" && typeof obj.constructor !== "function") { + const result = {}; + stack.set(obj, result); + require_cloneDeepWith.copyProperties(result, obj, object, stack); + return result; + } + switch (Object.prototype.toString.call(obj)) { + case require_tags.numberTag: + case require_tags.stringTag: + case require_tags.booleanTag: { + const result = new obj.constructor(obj?.valueOf()); + require_cloneDeepWith.copyProperties(result, obj); + return result; + } + case require_tags.argumentsTag: { + const result = {}; + require_cloneDeepWith.copyProperties(result, obj); + result.length = obj.length; + result[Symbol.iterator] = obj[Symbol.iterator]; + return result; + } + default: return; + } + }); +} +//#endregion +exports.cloneDeepWith = cloneDeepWith; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6c359234d165201bafce4a36a23a608f7bed8f07 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.mjs @@ -0,0 +1,71 @@ +import { getTag } from "../_internal/getTag.mjs"; +import { argumentsTag, booleanTag, numberTag, stringTag } from "../_internal/tags.mjs"; +import { cloneDeepWith as cloneDeepWith$1, copyProperties } from "../../object/cloneDeepWith.mjs"; +//#region src/compat/object/cloneDeepWith.ts +/** +* Creates a deep clone of the given object using a customizer function. +* +* @template T - The type of the object. +* @param {T} obj - The object to clone. +* @param {Function} [cloneValue] - A function to customize the cloning process. +* @returns {T} - A deep clone of the given object. +* +* @example +* // Clone a primitive value +* const num = 29; +* const clonedNum = cloneDeepWith(num); +* console.log(clonedNum); // 29 +* console.log(clonedNum === num); // true +* +* @example +* // Clone an object with a customizer +* const obj = { a: 1, b: 2 }; +* const clonedObj = cloneDeepWith(obj, (value) => { +* if (typeof value === 'number') { +* return value * 2; // Double the number +* } +* }); +* console.log(clonedObj); // { a: 2, b: 4 } +* console.log(clonedObj === obj); // false +* +* @example +* // Clone an array with a customizer +* const arr = [1, 2, 3]; +* const clonedArr = cloneDeepWith(arr, (value) => { +* return value + 1; // Increment each value +* }); +* console.log(clonedArr); // [2, 3, 4] +* console.log(clonedArr === arr); // false +*/ +function cloneDeepWith(obj, customizer) { + return cloneDeepWith$1(obj, (value, key, object, stack) => { + const cloned = customizer?.(value, key, object, stack); + if (cloned !== void 0) return cloned; + if (typeof obj !== "object") return; + if (getTag(obj) === "[object Object]" && typeof obj.constructor !== "function") { + const result = {}; + stack.set(obj, result); + copyProperties(result, obj, object, stack); + return result; + } + switch (Object.prototype.toString.call(obj)) { + case numberTag: + case stringTag: + case booleanTag: { + const result = new obj.constructor(obj?.valueOf()); + copyProperties(result, obj); + return result; + } + case argumentsTag: { + const result = {}; + copyProperties(result, obj); + result.length = obj.length; + result[Symbol.iterator] = obj[Symbol.iterator]; + return result; + } + default: return; + } + }); +} +//#endregion +export { cloneDeepWith }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneWith.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e0db7d0b3cb51746d0d14617f0a4ea5db5b940c0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneWith.d.mts @@ -0,0 +1,55 @@ +//#region src/compat/object/cloneWith.d.ts +type CloneWithCustomizer = (value: T, key: number | string | undefined, object: any, stack: any) => R; +/** + * Creates a shallow clone of a value with customizer that returns a specific result type. + * + * @template T - The type of the value to clone. + * @template R - The result type extending primitive types or objects. + * @param {T} value - The value to clone. + * @param {CloneWithCustomizer} customizer - The function to customize cloning. + * @returns {R} Returns the cloned value. + * + * @example + * const obj = { a: 1, b: 2 }; + * const cloned = cloneWith(obj, (value) => { + * if (typeof value === 'object') { + * return JSON.parse(JSON.stringify(value)); + * } + * }); + * // => { a: 1, b: 2 } + */ +declare function cloneWith(value: T, customizer: CloneWithCustomizer): R; +/** + * Creates a shallow clone of a value with optional customizer. + * + * @template T - The type of the value to clone. + * @template R - The result type. + * @param {T} value - The value to clone. + * @param {CloneWithCustomizer} customizer - The function to customize cloning. + * @returns {R | T} Returns the cloned value or the customized result. + * + * @example + * const obj = { a: 1, b: 2 }; + * const cloned = cloneWith(obj, (value) => { + * if (typeof value === 'number') { + * return value * 2; + * } + * }); + * // => { a: 2, b: 4 } + */ +declare function cloneWith(value: T, customizer: CloneWithCustomizer): R | T; +/** + * Creates a shallow clone of a value. + * + * @template T - The type of the value to clone. + * @param {T} value - The value to clone. + * @returns {T} Returns the cloned value. + * + * @example + * const obj = { a: 1, b: 2 }; + * const cloned = cloneWith(obj); + * // => { a: 1, b: 2 } + */ +declare function cloneWith(value: T): T; +//#endregion +export { cloneWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneWith.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e0db7d0b3cb51746d0d14617f0a4ea5db5b940c0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneWith.d.ts @@ -0,0 +1,55 @@ +//#region src/compat/object/cloneWith.d.ts +type CloneWithCustomizer = (value: T, key: number | string | undefined, object: any, stack: any) => R; +/** + * Creates a shallow clone of a value with customizer that returns a specific result type. + * + * @template T - The type of the value to clone. + * @template R - The result type extending primitive types or objects. + * @param {T} value - The value to clone. + * @param {CloneWithCustomizer} customizer - The function to customize cloning. + * @returns {R} Returns the cloned value. + * + * @example + * const obj = { a: 1, b: 2 }; + * const cloned = cloneWith(obj, (value) => { + * if (typeof value === 'object') { + * return JSON.parse(JSON.stringify(value)); + * } + * }); + * // => { a: 1, b: 2 } + */ +declare function cloneWith(value: T, customizer: CloneWithCustomizer): R; +/** + * Creates a shallow clone of a value with optional customizer. + * + * @template T - The type of the value to clone. + * @template R - The result type. + * @param {T} value - The value to clone. + * @param {CloneWithCustomizer} customizer - The function to customize cloning. + * @returns {R | T} Returns the cloned value or the customized result. + * + * @example + * const obj = { a: 1, b: 2 }; + * const cloned = cloneWith(obj, (value) => { + * if (typeof value === 'number') { + * return value * 2; + * } + * }); + * // => { a: 2, b: 4 } + */ +declare function cloneWith(value: T, customizer: CloneWithCustomizer): R | T; +/** + * Creates a shallow clone of a value. + * + * @template T - The type of the value to clone. + * @param {T} value - The value to clone. + * @returns {T} Returns the cloned value. + * + * @example + * const obj = { a: 1, b: 2 }; + * const cloned = cloneWith(obj); + * // => { a: 1, b: 2 } + */ +declare function cloneWith(value: T): T; +//#endregion +export { cloneWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneWith.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneWith.js new file mode 100644 index 0000000000000000000000000000000000000000..191174ef73c8f96ba179377553a0885900abc17e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneWith.js @@ -0,0 +1,55 @@ +const require_clone = require("./clone.js"); +//#region src/compat/object/cloneWith.ts +/** +* Creates a shallow clone of the given object with customization. +* This method is like `_.clone` except that it accepts a customizer which +* is invoked to produce the cloned value. If customizer returns undefined, +* cloning is handled by the method instead. +* +* If no customizer is provided, it behaves like `clone`. +* +* @template T - The type of the object. +* @param {T} value - The value to clone. +* @param {Function} [customizer] - The function to customize cloning. +* @returns {T} - A shallow clone of the given object. +* +* @example +* // Clone a primitive values +* const num = 29; +* const clonedNum = cloneWith(num); +* console.log(clonedNum); // 29 +* console.log(clonedNum === num); // true +* +* @example +* // Clone an array +* const arr = [1, 2, 3]; +* const clonedArr = cloneWith(arr); +* console.log(clonedArr); // [1, 2, 3] +* console.log(clonedArr === arr); // false +* +* @example +* // Clone an object +* const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] }; +* const clonedObj = cloneWith(obj); +* console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] } +* console.log(clonedObj === obj); // false +* +* @example +* // Clone an object with a customizer +* const obj = { a: 1, b: 2 }; +* const clonedObj = cloneWith(obj, (value) => { +* if (typeof value === 'number') { +* return value * 2; // Double the number +* } +* // Returning undefined uses the default cloning +* }); +* console.log(clonedObj); // { a: 2, b: 4 } +*/ +function cloneWith(value, customizer) { + if (!customizer) return require_clone.clone(value); + const result = customizer(value); + if (result !== void 0) return result; + return require_clone.clone(value); +} +//#endregion +exports.cloneWith = cloneWith; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneWith.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..543e1ac96bd88cf651b8baa8112d25865b866b00 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/cloneWith.mjs @@ -0,0 +1,55 @@ +import { clone } from "./clone.mjs"; +//#region src/compat/object/cloneWith.ts +/** +* Creates a shallow clone of the given object with customization. +* This method is like `_.clone` except that it accepts a customizer which +* is invoked to produce the cloned value. If customizer returns undefined, +* cloning is handled by the method instead. +* +* If no customizer is provided, it behaves like `clone`. +* +* @template T - The type of the object. +* @param {T} value - The value to clone. +* @param {Function} [customizer] - The function to customize cloning. +* @returns {T} - A shallow clone of the given object. +* +* @example +* // Clone a primitive values +* const num = 29; +* const clonedNum = cloneWith(num); +* console.log(clonedNum); // 29 +* console.log(clonedNum === num); // true +* +* @example +* // Clone an array +* const arr = [1, 2, 3]; +* const clonedArr = cloneWith(arr); +* console.log(clonedArr); // [1, 2, 3] +* console.log(clonedArr === arr); // false +* +* @example +* // Clone an object +* const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] }; +* const clonedObj = cloneWith(obj); +* console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] } +* console.log(clonedObj === obj); // false +* +* @example +* // Clone an object with a customizer +* const obj = { a: 1, b: 2 }; +* const clonedObj = cloneWith(obj, (value) => { +* if (typeof value === 'number') { +* return value * 2; // Double the number +* } +* // Returning undefined uses the default cloning +* }); +* console.log(clonedObj); // { a: 2, b: 4 } +*/ +function cloneWith(value, customizer) { + if (!customizer) return clone(value); + const result = customizer(value); + if (result !== void 0) return result; + return clone(value); +} +//#endregion +export { cloneWith }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/create.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/create.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..3cfef035d88cef93e0122a7a9730c680e6d95e36 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/create.d.mts @@ -0,0 +1,17 @@ +//#region src/compat/object/create.d.ts +/** + * Creates an object that inherits from the prototype object. + * + * If `properties` are provided, they will be added to the new object. + * Only string-keyed enumerable properties directly owned by the `properties` object are copied. + * Inherited properties or those with `Symbol` keys are not copied. + * + * @template T - The prototype object type. + * @template U - The properties object type. + * @param {T} prototype - The object to inherit from. + * @param {U} properties - The properties to assign to the created object. + * @returns {T & U} The new object. + */ +declare function create(prototype: T, properties?: U): T & U; +//#endregion +export { create }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/create.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/create.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3cfef035d88cef93e0122a7a9730c680e6d95e36 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/create.d.ts @@ -0,0 +1,17 @@ +//#region src/compat/object/create.d.ts +/** + * Creates an object that inherits from the prototype object. + * + * If `properties` are provided, they will be added to the new object. + * Only string-keyed enumerable properties directly owned by the `properties` object are copied. + * Inherited properties or those with `Symbol` keys are not copied. + * + * @template T - The prototype object type. + * @template U - The properties object type. + * @param {T} prototype - The object to inherit from. + * @param {U} properties - The properties to assign to the created object. + * @returns {T & U} The new object. + */ +declare function create(prototype: T, properties?: U): T & U; +//#endregion +export { create }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/create.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/create.js new file mode 100644 index 0000000000000000000000000000000000000000..de3a6bfa291e7a70f0430689cd7a1e520c6abfe0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/create.js @@ -0,0 +1,31 @@ +const require_isObject = require("../predicate/isObject.js"); +const require_assignValue = require("../_internal/assignValue.js"); +const require_keys = require("./keys.js"); +//#region src/compat/object/create.ts +/** +* Creates an object that inherits from the prototype object. +* +* If `properties` are provided, they will be added to the new object. +* Only string-keyed enumerable properties directly owned by the `properties` object are copied. +* Inherited properties or those with `Symbol` keys are not copied. +* +* @template T - The prototype object type. +* @template U - The properties object type. +* @param {T} prototype - The object to inherit from. +* @param {U} properties - The properties to assign to the created object. +* @returns {T & U} The new object. +*/ +function create(prototype, properties) { + const proto = require_isObject.isObject(prototype) ? Object.create(prototype) : {}; + if (properties != null) { + const propsKeys = require_keys.keys(properties); + for (let i = 0; i < propsKeys.length; i++) { + const key = propsKeys[i]; + const propsValue = properties[key]; + require_assignValue.assignValue(proto, key, propsValue); + } + } + return proto; +} +//#endregion +exports.create = create; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/create.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/create.mjs new file mode 100644 index 0000000000000000000000000000000000000000..889e0c8d3a7e8a90531683494aee5357c8471b27 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/create.mjs @@ -0,0 +1,31 @@ +import { isObject } from "../predicate/isObject.mjs"; +import { assignValue } from "../_internal/assignValue.mjs"; +import { keys } from "./keys.mjs"; +//#region src/compat/object/create.ts +/** +* Creates an object that inherits from the prototype object. +* +* If `properties` are provided, they will be added to the new object. +* Only string-keyed enumerable properties directly owned by the `properties` object are copied. +* Inherited properties or those with `Symbol` keys are not copied. +* +* @template T - The prototype object type. +* @template U - The properties object type. +* @param {T} prototype - The object to inherit from. +* @param {U} properties - The properties to assign to the created object. +* @returns {T & U} The new object. +*/ +function create(prototype, properties) { + const proto = isObject(prototype) ? Object.create(prototype) : {}; + if (properties != null) { + const propsKeys = keys(properties); + for (let i = 0; i < propsKeys.length; i++) { + const key = propsKeys[i]; + const propsValue = properties[key]; + assignValue(proto, key, propsValue); + } + } + return proto; +} +//#endregion +export { create }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/defaults.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/defaults.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..8dda46407bd68cb659e5c3b4737970d3e4d97972 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/defaults.d.mts @@ -0,0 +1,101 @@ +//#region src/compat/object/defaults.d.ts +/** + * Assigns default values to an `object`, ensuring that certain properties do not remain `undefined`. + * It sets default values for properties that are either `undefined` or inherited from `Object.prototype`. + * + * @template T - The type of the object being processed. + * @template S - The type of the object that provides default values. + * @param {T} object - The target object that will receive default values. + * @param {S} source - The object that specifies the default values to apply. + * @returns {NonNullable} The `object` that has been updated with default values from `source`. + * + * @example + * defaults({ a: 1 }, { b: 2 }); // { a: 1, b: 2 } + * defaults({ a: undefined }, { a: 1 }); // { a: 1 } + */ +declare function defaults(object: T, source: S): NonNullable; +/** + * Assigns default values to an `object`, ensuring that certain properties do not remain `undefined`. + * It sets default values for properties that are either `undefined` or inherited from `Object.prototype`. + * + * @template T - The type of the object being processed. + * @template S1 - The type of the first object that provides default values. + * @template S2 - The type of the second object that provides default values. + * @param {T} object - The target object that will receive default values. + * @param {S1} source1 - The first object that specifies the default values to apply. + * @param {S2} source2 - The second object that specifies the default values to apply. + * @returns {NonNullable} The `object` that has been updated with default values from `source1` and `source2`. + * + * @example + * defaults({ a: 1 }, { b: 2 }, { c: 3 }); // { a: 1, b: 2, c: 3 } + * defaults({ a: undefined }, { a: 1 }, { b: 2 }); // { a: 1, b: 2 } + */ +declare function defaults(object: T, source1: S1, source2: S2): NonNullable; +/** + * Assigns default values to an `object`, ensuring that certain properties do not remain `undefined`. + * It sets default values for properties that are either `undefined` or inherited from `Object.prototype`. + * + * @template T - The type of the object being processed. + * @template S1 - The type of the first object that provides default values. + * @template S2 - The type of the second object that provides default values. + * @template S3 - The type of the third object that provides default values. + * @param {T} object - The target object that will receive default values. + * @param {S1} source1 - The first object that specifies the default values to apply. + * @param {S2} source2 - The second object that specifies the default values to apply. + * @param {S3} source3 - The third object that specifies the default values to apply. + * @returns {NonNullable} The `object` that has been updated with default values from `source1`, `source2`, and `source3`. + * + * @example + * defaults({ a: 1 }, { b: 2 }, { c: 3 }, { d: 4 }); // { a: 1, b: 2, c: 3, d: 4 } + * defaults({ a: undefined }, { a: 1 }, { b: 2 }, { c: 3 }); // { a: 1, b: 2, c: 3 } + */ +declare function defaults(object: T, source1: S1, source2: S2, source3: S3): NonNullable; +/** + * Assigns default values to an `object`, ensuring that certain properties do not remain `undefined`. + * It sets default values for properties that are either `undefined` or inherited from `Object.prototype`. + * + * @template T - The type of the object being processed. + * @template S1 - The type of the first object that provides default values. + * @template S2 - The type of the second object that provides default values. + * @template S3 - The type of the third object that provides default values. + * @template S4 - The type of the fourth object that provides default values. + * @param {T} object - The target object that will receive default values. + * @param {S1} source1 - The first object that specifies the default values to apply. + * @param {S2} source2 - The second object that specifies the default values to apply. + * @param {S3} source3 - The third object that specifies the default values to apply. + * @param {S4} source4 - The fourth object that specifies the default values to apply. + * @returns {NonNullable} The `object` that has been updated with default values from `source1`, `source2`, `source3`, and `source4`. + * + * @example + * defaults({ a: 1 }, { b: 2 }, { c: 3 }, { d: 4 }, { e: 5 }); // { a: 1, b: 2, c: 3, d: 4, e: 5 } + * defaults({ a: undefined }, { a: 1 }, { b: 2 }, { c: 3 }, { d: 4 }); // { a: 1, b: 2, c: 3, d: 4 } + */ +declare function defaults(object: T, source1: S1, source2: S2, source3: S3, source4: S4): NonNullable; +/** + * Assigns default values to an `object`, ensuring that certain properties do not remain `undefined`. + * It sets default values for properties that are either `undefined` or inherited from `Object.prototype`. + * + * @template T - The type of the object being processed. + * @param {T} object - The target object that will receive default values. + * @returns {NonNullable} The `object` that has been updated with default values. + * + * @example + * defaults({ a: 1 }); // { a: 1 } + * defaults({ a: undefined }); // { a: undefined } + */ +declare function defaults(object: T): NonNullable; +/** + * Assigns default values to an `object`, ensuring that certain properties do not remain `undefined`. + * It sets default values for properties that are either `undefined` or inherited from `Object.prototype`. + * + * @param {any} object - The target object that will receive default values. + * @param {...any[]} sources - The objects that specify the default values to apply. + * @returns {any} The `object` that has been updated with default values from `sources`. + * + * @example + * defaults({}, { a: 1 }, { b: 2 }); // { a: 1, b: 2 } + * defaults({ a: undefined }, { a: 1 }); // { a: 1 } + */ +declare function defaults(object: any, ...sources: any[]): any; +//#endregion +export { defaults }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/defaults.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/defaults.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8dda46407bd68cb659e5c3b4737970d3e4d97972 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/defaults.d.ts @@ -0,0 +1,101 @@ +//#region src/compat/object/defaults.d.ts +/** + * Assigns default values to an `object`, ensuring that certain properties do not remain `undefined`. + * It sets default values for properties that are either `undefined` or inherited from `Object.prototype`. + * + * @template T - The type of the object being processed. + * @template S - The type of the object that provides default values. + * @param {T} object - The target object that will receive default values. + * @param {S} source - The object that specifies the default values to apply. + * @returns {NonNullable} The `object` that has been updated with default values from `source`. + * + * @example + * defaults({ a: 1 }, { b: 2 }); // { a: 1, b: 2 } + * defaults({ a: undefined }, { a: 1 }); // { a: 1 } + */ +declare function defaults(object: T, source: S): NonNullable; +/** + * Assigns default values to an `object`, ensuring that certain properties do not remain `undefined`. + * It sets default values for properties that are either `undefined` or inherited from `Object.prototype`. + * + * @template T - The type of the object being processed. + * @template S1 - The type of the first object that provides default values. + * @template S2 - The type of the second object that provides default values. + * @param {T} object - The target object that will receive default values. + * @param {S1} source1 - The first object that specifies the default values to apply. + * @param {S2} source2 - The second object that specifies the default values to apply. + * @returns {NonNullable} The `object` that has been updated with default values from `source1` and `source2`. + * + * @example + * defaults({ a: 1 }, { b: 2 }, { c: 3 }); // { a: 1, b: 2, c: 3 } + * defaults({ a: undefined }, { a: 1 }, { b: 2 }); // { a: 1, b: 2 } + */ +declare function defaults(object: T, source1: S1, source2: S2): NonNullable; +/** + * Assigns default values to an `object`, ensuring that certain properties do not remain `undefined`. + * It sets default values for properties that are either `undefined` or inherited from `Object.prototype`. + * + * @template T - The type of the object being processed. + * @template S1 - The type of the first object that provides default values. + * @template S2 - The type of the second object that provides default values. + * @template S3 - The type of the third object that provides default values. + * @param {T} object - The target object that will receive default values. + * @param {S1} source1 - The first object that specifies the default values to apply. + * @param {S2} source2 - The second object that specifies the default values to apply. + * @param {S3} source3 - The third object that specifies the default values to apply. + * @returns {NonNullable} The `object` that has been updated with default values from `source1`, `source2`, and `source3`. + * + * @example + * defaults({ a: 1 }, { b: 2 }, { c: 3 }, { d: 4 }); // { a: 1, b: 2, c: 3, d: 4 } + * defaults({ a: undefined }, { a: 1 }, { b: 2 }, { c: 3 }); // { a: 1, b: 2, c: 3 } + */ +declare function defaults(object: T, source1: S1, source2: S2, source3: S3): NonNullable; +/** + * Assigns default values to an `object`, ensuring that certain properties do not remain `undefined`. + * It sets default values for properties that are either `undefined` or inherited from `Object.prototype`. + * + * @template T - The type of the object being processed. + * @template S1 - The type of the first object that provides default values. + * @template S2 - The type of the second object that provides default values. + * @template S3 - The type of the third object that provides default values. + * @template S4 - The type of the fourth object that provides default values. + * @param {T} object - The target object that will receive default values. + * @param {S1} source1 - The first object that specifies the default values to apply. + * @param {S2} source2 - The second object that specifies the default values to apply. + * @param {S3} source3 - The third object that specifies the default values to apply. + * @param {S4} source4 - The fourth object that specifies the default values to apply. + * @returns {NonNullable} The `object` that has been updated with default values from `source1`, `source2`, `source3`, and `source4`. + * + * @example + * defaults({ a: 1 }, { b: 2 }, { c: 3 }, { d: 4 }, { e: 5 }); // { a: 1, b: 2, c: 3, d: 4, e: 5 } + * defaults({ a: undefined }, { a: 1 }, { b: 2 }, { c: 3 }, { d: 4 }); // { a: 1, b: 2, c: 3, d: 4 } + */ +declare function defaults(object: T, source1: S1, source2: S2, source3: S3, source4: S4): NonNullable; +/** + * Assigns default values to an `object`, ensuring that certain properties do not remain `undefined`. + * It sets default values for properties that are either `undefined` or inherited from `Object.prototype`. + * + * @template T - The type of the object being processed. + * @param {T} object - The target object that will receive default values. + * @returns {NonNullable} The `object` that has been updated with default values. + * + * @example + * defaults({ a: 1 }); // { a: 1 } + * defaults({ a: undefined }); // { a: undefined } + */ +declare function defaults(object: T): NonNullable; +/** + * Assigns default values to an `object`, ensuring that certain properties do not remain `undefined`. + * It sets default values for properties that are either `undefined` or inherited from `Object.prototype`. + * + * @param {any} object - The target object that will receive default values. + * @param {...any[]} sources - The objects that specify the default values to apply. + * @returns {any} The `object` that has been updated with default values from `sources`. + * + * @example + * defaults({}, { a: 1 }, { b: 2 }); // { a: 1, b: 2 } + * defaults({ a: undefined }, { a: 1 }); // { a: 1 } + */ +declare function defaults(object: any, ...sources: any[]): any; +//#endregion +export { defaults }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/defaults.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/defaults.js new file mode 100644 index 0000000000000000000000000000000000000000..95f7c3011c5091ae8ab30aca55958d8cd1ea4f42 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/defaults.js @@ -0,0 +1,47 @@ +const require_isEqualsSameValueZero = require("../../_internal/isEqualsSameValueZero.js"); +require("../util/eq.js"); +const require_isNil = require("../../predicate/isNil.js"); +const require_isIterateeCall = require("../_internal/isIterateeCall.js"); +//#region src/compat/object/defaults.ts +/** +* Assigns default values to an `object`, ensuring that certain properties do not remain `undefined`. +* It sets default values for properties that are either `undefined` or inherited from `Object.prototype`. +* +* You can pass in multiple objects to define these default values, +* and they will be applied in order from left to right. +* Once a property has been assigned a value, any subsequent values for that property will be ignored. +* +* Note: This function modifies the first argument, `object`. If you want to keep `object` unchanged, consider using `toDefaulted` instead. +* +* @template T - The type of the object being processed. +* @template S - The type of the objects that provides default values. +* @param {T} object - The target object that will receive default values. +* @param {S[]} source - The objects that specifies the default values to apply. +* @returns {object} The `object` that has been updated with default values from `sources`, ensuring that all properties are defined and none are left as `undefined`. +* +* @example +* defaults({ a: 1 }, { a: 2, b: 2 }, { c: 3 }); // { a: 1, b: 2, c: 3 } +* defaults({ a: 1, b: 2 }, { b: 3 }, { c: 3 }); // { a: 1, b: 2, c: 3 } +* defaults({ a: null }, { a: 1 }); // { a: null } +* defaults({ a: undefined }, { a: 1 }); // { a: 1 } +*/ +function defaults(object, ...sources) { + object = Object(object); + const objectProto = Object.prototype; + let length = sources.length; + const guard = length > 2 ? sources[2] : void 0; + if (guard && require_isIterateeCall.isIterateeCall(sources[0], sources[1], guard)) length = 1; + for (let i = 0; i < length; i++) { + if (require_isNil.isNil(sources[i])) continue; + const source = sources[i]; + const keys = Object.keys(source); + for (let j = 0; j < keys.length; j++) { + const key = keys[j]; + const value = object[key]; + if (value === void 0 || !Object.hasOwn(object, key) && require_isEqualsSameValueZero.isEqualsSameValueZero(value, objectProto[key])) object[key] = source[key]; + } + } + return object; +} +//#endregion +exports.defaults = defaults; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/defaults.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/defaults.mjs new file mode 100644 index 0000000000000000000000000000000000000000..022f34d5e8fcd1ec2e3cc0e69d22b20d8d7372c1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/defaults.mjs @@ -0,0 +1,47 @@ +import { isEqualsSameValueZero } from "../../_internal/isEqualsSameValueZero.mjs"; +import "../util/eq.mjs"; +import { isNil } from "../../predicate/isNil.mjs"; +import { isIterateeCall } from "../_internal/isIterateeCall.mjs"; +//#region src/compat/object/defaults.ts +/** +* Assigns default values to an `object`, ensuring that certain properties do not remain `undefined`. +* It sets default values for properties that are either `undefined` or inherited from `Object.prototype`. +* +* You can pass in multiple objects to define these default values, +* and they will be applied in order from left to right. +* Once a property has been assigned a value, any subsequent values for that property will be ignored. +* +* Note: This function modifies the first argument, `object`. If you want to keep `object` unchanged, consider using `toDefaulted` instead. +* +* @template T - The type of the object being processed. +* @template S - The type of the objects that provides default values. +* @param {T} object - The target object that will receive default values. +* @param {S[]} source - The objects that specifies the default values to apply. +* @returns {object} The `object` that has been updated with default values from `sources`, ensuring that all properties are defined and none are left as `undefined`. +* +* @example +* defaults({ a: 1 }, { a: 2, b: 2 }, { c: 3 }); // { a: 1, b: 2, c: 3 } +* defaults({ a: 1, b: 2 }, { b: 3 }, { c: 3 }); // { a: 1, b: 2, c: 3 } +* defaults({ a: null }, { a: 1 }); // { a: null } +* defaults({ a: undefined }, { a: 1 }); // { a: 1 } +*/ +function defaults(object, ...sources) { + object = Object(object); + const objectProto = Object.prototype; + let length = sources.length; + const guard = length > 2 ? sources[2] : void 0; + if (guard && isIterateeCall(sources[0], sources[1], guard)) length = 1; + for (let i = 0; i < length; i++) { + if (isNil(sources[i])) continue; + const source = sources[i]; + const keys = Object.keys(source); + for (let j = 0; j < keys.length; j++) { + const key = keys[j]; + const value = object[key]; + if (value === void 0 || !Object.hasOwn(object, key) && isEqualsSameValueZero(value, objectProto[key])) object[key] = source[key]; + } + } + return object; +} +//#endregion +export { defaults }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/defaultsDeep.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/defaultsDeep.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..4769f80a1bc361d1df922ee5118a23448bfaa2ad --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/defaultsDeep.d.mts @@ -0,0 +1,24 @@ +//#region src/compat/object/defaultsDeep.d.ts +/** + * Recursively assigns default values to an `object`, ensuring that certain properties do not remain `undefined`. + * It sets default values for properties that are either `undefined` or inherited from `Object.prototype`. + * + * Similar to `defaults` but recursively applies default values to nested objects. + * Source objects are applied in order from left to right, and once a property has been assigned a value, + * any subsequent values for that property will be ignored. + * + * Note: This function modifies the first argument, `object`. + * + * @template T - The type of the object being processed. + * @param {any} target - The target object that will receive default values. + * @param {any[]} sources - One or more source objects that specify default values to apply. + * @returns {any} The `object` that has been updated with default values from all sources, recursively merging nested objects. + * + * @example + * defaultsDeep({ a: { b: 2 } }, { a: { b: 3, c: 3 }, d: 4 }); // { a: { b: 2, c: 3 }, d: 4 } + * defaultsDeep({ a: { b: undefined } }, { a: { b: 1 } }); // { a: { b: 1 } } + * defaultsDeep({ a: null }, { a: { b: 1 } }); // { a: null } + */ +declare function defaultsDeep(target: any, ...sources: any[]): any; +//#endregion +export { defaultsDeep }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/defaultsDeep.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/defaultsDeep.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4769f80a1bc361d1df922ee5118a23448bfaa2ad --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/defaultsDeep.d.ts @@ -0,0 +1,24 @@ +//#region src/compat/object/defaultsDeep.d.ts +/** + * Recursively assigns default values to an `object`, ensuring that certain properties do not remain `undefined`. + * It sets default values for properties that are either `undefined` or inherited from `Object.prototype`. + * + * Similar to `defaults` but recursively applies default values to nested objects. + * Source objects are applied in order from left to right, and once a property has been assigned a value, + * any subsequent values for that property will be ignored. + * + * Note: This function modifies the first argument, `object`. + * + * @template T - The type of the object being processed. + * @param {any} target - The target object that will receive default values. + * @param {any[]} sources - One or more source objects that specify default values to apply. + * @returns {any} The `object` that has been updated with default values from all sources, recursively merging nested objects. + * + * @example + * defaultsDeep({ a: { b: 2 } }, { a: { b: 3, c: 3 }, d: 4 }); // { a: { b: 2, c: 3 }, d: 4 } + * defaultsDeep({ a: { b: undefined } }, { a: { b: 1 } }); // { a: { b: 1 } } + * defaultsDeep({ a: null }, { a: { b: 1 } }); // { a: null } + */ +declare function defaultsDeep(target: any, ...sources: any[]): any; +//#endregion +export { defaultsDeep }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/defaultsDeep.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/defaultsDeep.js new file mode 100644 index 0000000000000000000000000000000000000000..fbaa7594281236a0acf1b6adc179d0c2052db444 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/defaultsDeep.js @@ -0,0 +1,70 @@ +const require_isPlainObject = require("../predicate/isPlainObject.js"); +//#region src/compat/object/defaultsDeep.ts +/** +* Recursively assigns default values to an `object`, ensuring that certain properties do not remain `undefined`. +* It sets default values for properties that are either `undefined` or inherited from `Object.prototype`. +* +* Similar to `defaults` but recursively applies default values to nested objects. +* Source objects are applied in order from left to right, and once a property has been assigned a value, +* any subsequent values for that property will be ignored. +* +* Note: This function modifies the first argument, `object`. +* +* @template T - The type of the object being processed. +* @param {any} target - The target object that will receive default values. +* @param {any[]} sources - One or more source objects that specify default values to apply. +* @returns {any} The `object` that has been updated with default values from all sources, recursively merging nested objects. +* +* @example +* defaultsDeep({ a: { b: 2 } }, { a: { b: 3, c: 3 }, d: 4 }); // { a: { b: 2, c: 3 }, d: 4 } +* defaultsDeep({ a: { b: undefined } }, { a: { b: 1 } }); // { a: { b: 1 } } +* defaultsDeep({ a: null }, { a: { b: 1 } }); // { a: null } +*/ +function defaultsDeep(target, ...sources) { + target = Object(target); + for (let i = 0; i < sources.length; i++) { + const source = sources[i]; + if (source != null) defaultsDeepRecursive(target, source, /* @__PURE__ */ new WeakMap()); + } + return target; +} +function defaultsDeepRecursive(target, source, stack) { + for (const key in source) { + const sourceValue = source[key]; + const targetValue = target[key]; + if (targetValue === void 0 || !Object.hasOwn(target, key)) { + target[key] = handleMissingProperty(sourceValue, stack); + continue; + } + if (stack.get(sourceValue) === targetValue) continue; + handleExistingProperty(targetValue, sourceValue, stack); + } +} +function handleMissingProperty(sourceValue, stack) { + if (stack.has(sourceValue)) return stack.get(sourceValue); + if (require_isPlainObject.isPlainObject(sourceValue)) { + const newObj = {}; + stack.set(sourceValue, newObj); + defaultsDeepRecursive(newObj, sourceValue, stack); + return newObj; + } + return sourceValue; +} +function handleExistingProperty(targetValue, sourceValue, stack) { + if (require_isPlainObject.isPlainObject(targetValue) && require_isPlainObject.isPlainObject(sourceValue)) { + stack.set(sourceValue, targetValue); + defaultsDeepRecursive(targetValue, sourceValue, stack); + return; + } + if (Array.isArray(targetValue) && Array.isArray(sourceValue)) { + stack.set(sourceValue, targetValue); + mergeArrays(targetValue, sourceValue, stack); + } +} +function mergeArrays(targetArray, sourceArray, stack) { + const minLength = Math.min(sourceArray.length, targetArray.length); + for (let i = 0; i < minLength; i++) if (require_isPlainObject.isPlainObject(targetArray[i]) && require_isPlainObject.isPlainObject(sourceArray[i])) defaultsDeepRecursive(targetArray[i], sourceArray[i], stack); + for (let i = minLength; i < sourceArray.length; i++) targetArray.push(sourceArray[i]); +} +//#endregion +exports.defaultsDeep = defaultsDeep; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/defaultsDeep.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/defaultsDeep.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d8ff9a3be198ea45e2f31d9879b3c47a70e36bc4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/defaultsDeep.mjs @@ -0,0 +1,70 @@ +import { isPlainObject } from "../predicate/isPlainObject.mjs"; +//#region src/compat/object/defaultsDeep.ts +/** +* Recursively assigns default values to an `object`, ensuring that certain properties do not remain `undefined`. +* It sets default values for properties that are either `undefined` or inherited from `Object.prototype`. +* +* Similar to `defaults` but recursively applies default values to nested objects. +* Source objects are applied in order from left to right, and once a property has been assigned a value, +* any subsequent values for that property will be ignored. +* +* Note: This function modifies the first argument, `object`. +* +* @template T - The type of the object being processed. +* @param {any} target - The target object that will receive default values. +* @param {any[]} sources - One or more source objects that specify default values to apply. +* @returns {any} The `object` that has been updated with default values from all sources, recursively merging nested objects. +* +* @example +* defaultsDeep({ a: { b: 2 } }, { a: { b: 3, c: 3 }, d: 4 }); // { a: { b: 2, c: 3 }, d: 4 } +* defaultsDeep({ a: { b: undefined } }, { a: { b: 1 } }); // { a: { b: 1 } } +* defaultsDeep({ a: null }, { a: { b: 1 } }); // { a: null } +*/ +function defaultsDeep(target, ...sources) { + target = Object(target); + for (let i = 0; i < sources.length; i++) { + const source = sources[i]; + if (source != null) defaultsDeepRecursive(target, source, /* @__PURE__ */ new WeakMap()); + } + return target; +} +function defaultsDeepRecursive(target, source, stack) { + for (const key in source) { + const sourceValue = source[key]; + const targetValue = target[key]; + if (targetValue === void 0 || !Object.hasOwn(target, key)) { + target[key] = handleMissingProperty(sourceValue, stack); + continue; + } + if (stack.get(sourceValue) === targetValue) continue; + handleExistingProperty(targetValue, sourceValue, stack); + } +} +function handleMissingProperty(sourceValue, stack) { + if (stack.has(sourceValue)) return stack.get(sourceValue); + if (isPlainObject(sourceValue)) { + const newObj = {}; + stack.set(sourceValue, newObj); + defaultsDeepRecursive(newObj, sourceValue, stack); + return newObj; + } + return sourceValue; +} +function handleExistingProperty(targetValue, sourceValue, stack) { + if (isPlainObject(targetValue) && isPlainObject(sourceValue)) { + stack.set(sourceValue, targetValue); + defaultsDeepRecursive(targetValue, sourceValue, stack); + return; + } + if (Array.isArray(targetValue) && Array.isArray(sourceValue)) { + stack.set(sourceValue, targetValue); + mergeArrays(targetValue, sourceValue, stack); + } +} +function mergeArrays(targetArray, sourceArray, stack) { + const minLength = Math.min(sourceArray.length, targetArray.length); + for (let i = 0; i < minLength; i++) if (isPlainObject(targetArray[i]) && isPlainObject(sourceArray[i])) defaultsDeepRecursive(targetArray[i], sourceArray[i], stack); + for (let i = minLength; i < sourceArray.length; i++) targetArray.push(sourceArray[i]); +} +//#endregion +export { defaultsDeep }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/extend.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/extend.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..4bf314a8d840e931023bf4f495e40e9cd96bb286 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/extend.d.mts @@ -0,0 +1 @@ +import { assignIn } from "./assignIn.mjs"; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/extend.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/extend.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..698dbf5426150d7c00b1732dba176ff740cc2deb --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/extend.d.ts @@ -0,0 +1 @@ +import { assignIn } from "./assignIn.js"; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/extend.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/extend.js new file mode 100644 index 0000000000000000000000000000000000000000..3255a35b7a5fc3ce42e17eaba591a90e667327ba --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/extend.js @@ -0,0 +1 @@ +require("./assignIn.js"); diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/extend.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/extend.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4615ce68d4f231478be8b783e567035119f9f0c1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/extend.mjs @@ -0,0 +1 @@ +import "./assignIn.mjs"; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/extendWith.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/extendWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..837df9828061bae5dba30c0f01c261fa120ed0d7 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/extendWith.d.mts @@ -0,0 +1 @@ +import { assignInWith } from "./assignInWith.mjs"; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/extendWith.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/extendWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e2647c04444a0afeb09449ea79fd7316a759f7ee --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/extendWith.d.ts @@ -0,0 +1 @@ +import { assignInWith } from "./assignInWith.js"; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/extendWith.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/extendWith.js new file mode 100644 index 0000000000000000000000000000000000000000..a46f616df6b445b853f62109932f445d961ddda4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/extendWith.js @@ -0,0 +1 @@ +require("./assignInWith.js"); diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/extendWith.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/extendWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2a0163158fb1d993137c68eac3c39b7cb7c10ed9 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/extendWith.mjs @@ -0,0 +1 @@ +import "./assignInWith.mjs"; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/findKey.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/findKey.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d8efe6230c7275b0b6f2c2a2bbe4d7366a526ec4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/findKey.d.mts @@ -0,0 +1,18 @@ +import { ObjectIteratee } from "../_internal/ObjectIteratee.mjs"; + +//#region src/compat/object/findKey.d.ts +/** + * Finds the key of the first element that matches the given predicate. + * + * This function determines the type of the predicate and delegates the search + * to the appropriate helper function. It supports predicates as functions, objects, + * arrays, or strings. + * + * @template T - The type of the object. + * @param {T | null | undefined} obj - The object to inspect. + * @param {ObjectIteratee} predicate - The predicate to match. + * @returns {string | undefined} Returns the key of the matched element, else `undefined`. + */ +declare function findKey(obj: T | null | undefined, predicate?: ObjectIteratee): string | undefined; +//#endregion +export { findKey }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/findKey.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/findKey.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9e506b3bbf010283ef03d0b35cdcf4af2669dee8 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/findKey.d.ts @@ -0,0 +1,18 @@ +import { ObjectIteratee } from "../_internal/ObjectIteratee.js"; + +//#region src/compat/object/findKey.d.ts +/** + * Finds the key of the first element that matches the given predicate. + * + * This function determines the type of the predicate and delegates the search + * to the appropriate helper function. It supports predicates as functions, objects, + * arrays, or strings. + * + * @template T - The type of the object. + * @param {T | null | undefined} obj - The object to inspect. + * @param {ObjectIteratee} predicate - The predicate to match. + * @returns {string | undefined} Returns the key of the matched element, else `undefined`. + */ +declare function findKey(obj: T | null | undefined, predicate?: ObjectIteratee): string | undefined; +//#endregion +export { findKey }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/findKey.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/findKey.js new file mode 100644 index 0000000000000000000000000000000000000000..598ec932c321c746d243fd5cb7096df5d271d53c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/findKey.js @@ -0,0 +1,24 @@ +const require_findKey = require("../../object/findKey.js"); +const require_isObject = require("../predicate/isObject.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_identity = require("../function/identity.js"); +//#region src/compat/object/findKey.ts +/** +* Finds the key of the first element that matches the given predicate. +* +* This function determines the type of the predicate and delegates the search +* to the appropriate helper function. It supports predicates as functions, objects, +* arrays, or strings. +* +* @template T - The type of the object. +* @param {T | null | undefined} obj - The object to inspect. +* @param {ObjectIteratee} predicate - The predicate to match. +* @returns {string | undefined} Returns the key of the matched element, else `undefined`. +*/ +function findKey(obj, predicate) { + if (!require_isObject.isObject(obj)) return; + const iteratee$1 = require_iteratee.iteratee(predicate ?? require_identity.identity); + return require_findKey.findKey(obj, iteratee$1); +} +//#endregion +exports.findKey = findKey; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/findKey.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/findKey.mjs new file mode 100644 index 0000000000000000000000000000000000000000..dbd086d875cc9b5d22efc773caf83d4f3d470ad7 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/findKey.mjs @@ -0,0 +1,23 @@ +import { findKey as findKey$1 } from "../../object/findKey.mjs"; +import { isObject } from "../predicate/isObject.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +import { identity } from "../function/identity.mjs"; +//#region src/compat/object/findKey.ts +/** +* Finds the key of the first element that matches the given predicate. +* +* This function determines the type of the predicate and delegates the search +* to the appropriate helper function. It supports predicates as functions, objects, +* arrays, or strings. +* +* @template T - The type of the object. +* @param {T | null | undefined} obj - The object to inspect. +* @param {ObjectIteratee} predicate - The predicate to match. +* @returns {string | undefined} Returns the key of the matched element, else `undefined`. +*/ +function findKey(obj, predicate) { + if (!isObject(obj)) return; + return findKey$1(obj, iteratee(predicate ?? identity)); +} +//#endregion +export { findKey }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/findLastKey.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/findLastKey.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..1d51b7c3e3d445846b81cfbea298f7797059c419 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/findLastKey.d.mts @@ -0,0 +1,18 @@ +import { ObjectIteratee } from "../_internal/ObjectIteratee.mjs"; + +//#region src/compat/object/findLastKey.d.ts +/** + * Finds the key of the last element that matches the given predicate. + * + * This function determines the type of the predicate and delegates the search + * to the appropriate helper function. It supports predicates as functions, objects, + * arrays, or strings. + * + * @template T - The type of the object. + * @param {T | null | undefined} obj - The object to inspect. + * @param {ObjectIteratee} predicate - The predicate to match. + * @returns {string | undefined} Returns the key of the matched element, else `undefined`. + */ +declare function findLastKey(obj: T | null | undefined, predicate?: ObjectIteratee): string | undefined; +//#endregion +export { findLastKey }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/findLastKey.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/findLastKey.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..479b8bc62853a5da4f7f95327318cf5414a0e4ce --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/findLastKey.d.ts @@ -0,0 +1,18 @@ +import { ObjectIteratee } from "../_internal/ObjectIteratee.js"; + +//#region src/compat/object/findLastKey.d.ts +/** + * Finds the key of the last element that matches the given predicate. + * + * This function determines the type of the predicate and delegates the search + * to the appropriate helper function. It supports predicates as functions, objects, + * arrays, or strings. + * + * @template T - The type of the object. + * @param {T | null | undefined} obj - The object to inspect. + * @param {ObjectIteratee} predicate - The predicate to match. + * @returns {string | undefined} Returns the key of the matched element, else `undefined`. + */ +declare function findLastKey(obj: T | null | undefined, predicate?: ObjectIteratee): string | undefined; +//#endregion +export { findLastKey }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/findLastKey.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/findLastKey.js new file mode 100644 index 0000000000000000000000000000000000000000..46c09792495f5c321669058023ddc0a52d97e5e8 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/findLastKey.js @@ -0,0 +1,23 @@ +const require_isObject = require("../predicate/isObject.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_identity = require("../function/identity.js"); +//#region src/compat/object/findLastKey.ts +/** +* Finds the key of the last element that matches the given predicate. +* +* This function determines the type of the predicate and delegates the search +* to the appropriate helper function. It supports predicates as functions, objects, +* arrays, or strings. +* +* @template T - The type of the object. +* @param {T | null | undefined} obj - The object to inspect. +* @param {ObjectIteratee} predicate - The predicate to match. +* @returns {string | undefined} Returns the key of the matched element, else `undefined`. +*/ +function findLastKey(obj, predicate) { + if (!require_isObject.isObject(obj)) return; + const iteratee$1 = require_iteratee.iteratee(predicate ?? require_identity.identity); + return Object.keys(obj).findLast((key) => iteratee$1(obj[key], key, obj)); +} +//#endregion +exports.findLastKey = findLastKey; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/findLastKey.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/findLastKey.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b990d5f752bfdfcc27c72324d58ef0654fca7909 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/findLastKey.mjs @@ -0,0 +1,23 @@ +import { isObject } from "../predicate/isObject.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +import { identity } from "../function/identity.mjs"; +//#region src/compat/object/findLastKey.ts +/** +* Finds the key of the last element that matches the given predicate. +* +* This function determines the type of the predicate and delegates the search +* to the appropriate helper function. It supports predicates as functions, objects, +* arrays, or strings. +* +* @template T - The type of the object. +* @param {T | null | undefined} obj - The object to inspect. +* @param {ObjectIteratee} predicate - The predicate to match. +* @returns {string | undefined} Returns the key of the matched element, else `undefined`. +*/ +function findLastKey(obj, predicate) { + if (!isObject(obj)) return; + const iteratee$1 = iteratee(predicate ?? identity); + return Object.keys(obj).findLast((key) => iteratee$1(obj[key], key, obj)); +} +//#endregion +export { findLastKey }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/forIn.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/forIn.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..8f55ccbc2d4630ddcfac1459ebbb4fa226c18965 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/forIn.d.mts @@ -0,0 +1,59 @@ +//#region src/compat/object/forIn.d.ts +/** + * Iterates over an object and invokes the `iteratee` function for each property. + * + * Iterates over string keyed properties including inherited properties. + * + * The iteration is terminated early if the `iteratee` function returns `false`. + * + * @template T - The type of the object + * @param {T} object - The object to iterate over + * @param {(value: T[keyof T], key: string, obj: T) => any} iteratee - The function invoked per iteration + * @returns {T} Returns the object + * + * @example + * // Iterate over all properties including inherited ones + * const obj = { a: 1, b: 2 }; + * forIn(obj, (value, key) => { + * console.log(key, value); + * }); + * // Output: 'a' 1, 'b' 2 + * + * // Early termination + * forIn(obj, (value, key) => { + * console.log(key, value); + * return key !== 'a'; // stop after 'a' + * }); + * // Output: 'a' 1 + */ +declare function forIn(object: T, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T; +/** + * Iterates over an object and invokes the `iteratee` function for each property. + * + * Iterates over string keyed properties including inherited properties. + * + * The iteration is terminated early if the `iteratee` function returns `false`. + * + * @template T - The type of the object + * @param {T | null | undefined} object - The object to iterate over + * @param {(value: T[keyof T], key: string, obj: T) => any} iteratee - The function invoked per iteration + * @returns {T | null | undefined} Returns the object + * + * @example + * // Iterate over all properties including inherited ones + * const obj = { a: 1, b: 2 }; + * forIn(obj, (value, key) => { + * console.log(key, value); + * }); + * // Output: 'a' 1, 'b' 2 + * + * // Early termination + * forIn(obj, (value, key) => { + * console.log(key, value); + * return key !== 'a'; // stop after 'a' + * }); + * // Output: 'a' 1 + */ +declare function forIn(object: T | null | undefined, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T | null | undefined; +//#endregion +export { forIn }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/forIn.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/forIn.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8f55ccbc2d4630ddcfac1459ebbb4fa226c18965 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/forIn.d.ts @@ -0,0 +1,59 @@ +//#region src/compat/object/forIn.d.ts +/** + * Iterates over an object and invokes the `iteratee` function for each property. + * + * Iterates over string keyed properties including inherited properties. + * + * The iteration is terminated early if the `iteratee` function returns `false`. + * + * @template T - The type of the object + * @param {T} object - The object to iterate over + * @param {(value: T[keyof T], key: string, obj: T) => any} iteratee - The function invoked per iteration + * @returns {T} Returns the object + * + * @example + * // Iterate over all properties including inherited ones + * const obj = { a: 1, b: 2 }; + * forIn(obj, (value, key) => { + * console.log(key, value); + * }); + * // Output: 'a' 1, 'b' 2 + * + * // Early termination + * forIn(obj, (value, key) => { + * console.log(key, value); + * return key !== 'a'; // stop after 'a' + * }); + * // Output: 'a' 1 + */ +declare function forIn(object: T, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T; +/** + * Iterates over an object and invokes the `iteratee` function for each property. + * + * Iterates over string keyed properties including inherited properties. + * + * The iteration is terminated early if the `iteratee` function returns `false`. + * + * @template T - The type of the object + * @param {T | null | undefined} object - The object to iterate over + * @param {(value: T[keyof T], key: string, obj: T) => any} iteratee - The function invoked per iteration + * @returns {T | null | undefined} Returns the object + * + * @example + * // Iterate over all properties including inherited ones + * const obj = { a: 1, b: 2 }; + * forIn(obj, (value, key) => { + * console.log(key, value); + * }); + * // Output: 'a' 1, 'b' 2 + * + * // Early termination + * forIn(obj, (value, key) => { + * console.log(key, value); + * return key !== 'a'; // stop after 'a' + * }); + * // Output: 'a' 1 + */ +declare function forIn(object: T | null | undefined, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T | null | undefined; +//#endregion +export { forIn }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/forIn.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/forIn.js new file mode 100644 index 0000000000000000000000000000000000000000..12a95735aa408b282c82692e72b53a3a99b5138a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/forIn.js @@ -0,0 +1,36 @@ +const require_identity = require("../../function/identity.js"); +//#region src/compat/object/forIn.ts +/** +* Iterates over an object and invokes the `iteratee` function for each property. +* +* Iterates over string keyed properties including inherited properties. +* +* The iteration is terminated early if the `iteratee` function returns `false`. +* +* @template T - The type of the object +* @param {T | null | undefined} object - The object to iterate over +* @param {(value: T[keyof T], key: string, obj: T) => any} iteratee - The function invoked per iteration +* @returns {T | null | undefined} Returns the object +* +* @example +* // Iterate over all properties including inherited ones +* const obj = { a: 1, b: 2 }; +* forIn(obj, (value, key) => { +* console.log(key, value); +* }); +* // Output: 'a' 1, 'b' 2 +* +* // Early termination +* forIn(obj, (value, key) => { +* console.log(key, value); +* return key !== 'a'; // stop after 'a' +* }); +* // Output: 'a' 1 +*/ +function forIn(object, iteratee = require_identity.identity) { + if (object == null) return object; + for (const key in object) if (iteratee(object[key], key, object) === false) break; + return object; +} +//#endregion +exports.forIn = forIn; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/forIn.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/forIn.mjs new file mode 100644 index 0000000000000000000000000000000000000000..501aaeef6a029a475bd1638c5c61a20eabfc64e1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/forIn.mjs @@ -0,0 +1,36 @@ +import { identity } from "../../function/identity.mjs"; +//#region src/compat/object/forIn.ts +/** +* Iterates over an object and invokes the `iteratee` function for each property. +* +* Iterates over string keyed properties including inherited properties. +* +* The iteration is terminated early if the `iteratee` function returns `false`. +* +* @template T - The type of the object +* @param {T | null | undefined} object - The object to iterate over +* @param {(value: T[keyof T], key: string, obj: T) => any} iteratee - The function invoked per iteration +* @returns {T | null | undefined} Returns the object +* +* @example +* // Iterate over all properties including inherited ones +* const obj = { a: 1, b: 2 }; +* forIn(obj, (value, key) => { +* console.log(key, value); +* }); +* // Output: 'a' 1, 'b' 2 +* +* // Early termination +* forIn(obj, (value, key) => { +* console.log(key, value); +* return key !== 'a'; // stop after 'a' +* }); +* // Output: 'a' 1 +*/ +function forIn(object, iteratee = identity) { + if (object == null) return object; + for (const key in object) if (iteratee(object[key], key, object) === false) break; + return object; +} +//#endregion +export { forIn }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/forInRight.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/forInRight.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..95ab52f5eb271b7169979e61a9352000b5a12e0c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/forInRight.d.mts @@ -0,0 +1,59 @@ +//#region src/compat/object/forInRight.d.ts +/** + * Iterates over an object in reverse order and invokes the `iteratee` function for each property. + * + * Iterates over string keyed properties including inherited properties in reverse order. + * + * The iteration is terminated early if the `iteratee` function returns `false`. + * + * @template T - The type of the object + * @param {T} object - The object to iterate over + * @param {(value: T[keyof T], key: string, collection: T) => any} iteratee - The function invoked per iteration + * @returns {T} Returns the object + * + * @example + * // Iterate over all properties including inherited ones + * const obj = { a: 1, b: 2 }; + * forInRight(obj, (value, key) => { + * console.log(key, value); + * }); + * // Output: 'b' 2, 'a' 1 + * + * // Early termination + * forInRight(obj, (value, key) => { + * console.log(key, value); + * return key !== 'a'; // stop after 'a' + * }); + * // Output: 'b' 2 + */ +declare function forInRight(object: T, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T; +/** + * Iterates over an object in reverse order and invokes the `iteratee` function for each property. + * + * Iterates over string keyed properties including inherited properties in reverse order. + * + * The iteration is terminated early if the `iteratee` function returns `false`. + * + * @template T - The type of the object + * @param {T | null | undefined} object - The object to iterate over + * @param {(value: T[keyof T], key: string, obj: T) => any} iteratee - The function invoked per iteration + * @returns {T | null | undefined} Returns the object + * + * @example + * // Iterate over all properties including inherited ones + * const obj = { a: 1, b: 2 }; + * forInRight(obj, (value, key) => { + * console.log(key, value); + * }); + * // Output: 'b' 2, 'a' 1 + * + * // Early termination + * forInRight(obj, (value, key) => { + * console.log(key, value); + * return key !== 'a'; // stop after 'a' + * }); + * // Output: 'b' 2 + */ +declare function forInRight(object: T | null | undefined, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T | null | undefined; +//#endregion +export { forInRight }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/forInRight.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/forInRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..95ab52f5eb271b7169979e61a9352000b5a12e0c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/forInRight.d.ts @@ -0,0 +1,59 @@ +//#region src/compat/object/forInRight.d.ts +/** + * Iterates over an object in reverse order and invokes the `iteratee` function for each property. + * + * Iterates over string keyed properties including inherited properties in reverse order. + * + * The iteration is terminated early if the `iteratee` function returns `false`. + * + * @template T - The type of the object + * @param {T} object - The object to iterate over + * @param {(value: T[keyof T], key: string, collection: T) => any} iteratee - The function invoked per iteration + * @returns {T} Returns the object + * + * @example + * // Iterate over all properties including inherited ones + * const obj = { a: 1, b: 2 }; + * forInRight(obj, (value, key) => { + * console.log(key, value); + * }); + * // Output: 'b' 2, 'a' 1 + * + * // Early termination + * forInRight(obj, (value, key) => { + * console.log(key, value); + * return key !== 'a'; // stop after 'a' + * }); + * // Output: 'b' 2 + */ +declare function forInRight(object: T, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T; +/** + * Iterates over an object in reverse order and invokes the `iteratee` function for each property. + * + * Iterates over string keyed properties including inherited properties in reverse order. + * + * The iteration is terminated early if the `iteratee` function returns `false`. + * + * @template T - The type of the object + * @param {T | null | undefined} object - The object to iterate over + * @param {(value: T[keyof T], key: string, obj: T) => any} iteratee - The function invoked per iteration + * @returns {T | null | undefined} Returns the object + * + * @example + * // Iterate over all properties including inherited ones + * const obj = { a: 1, b: 2 }; + * forInRight(obj, (value, key) => { + * console.log(key, value); + * }); + * // Output: 'b' 2, 'a' 1 + * + * // Early termination + * forInRight(obj, (value, key) => { + * console.log(key, value); + * return key !== 'a'; // stop after 'a' + * }); + * // Output: 'b' 2 + */ +declare function forInRight(object: T | null | undefined, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T | null | undefined; +//#endregion +export { forInRight }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/forInRight.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/forInRight.js new file mode 100644 index 0000000000000000000000000000000000000000..c7be1749c36fbe73c9f3b4c114fb8984e022575c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/forInRight.js @@ -0,0 +1,41 @@ +const require_identity = require("../../function/identity.js"); +//#region src/compat/object/forInRight.ts +/** +* Iterates over an object in reverse order and invokes the `iteratee` function for each property. +* +* Iterates over string keyed properties including inherited properties in reverse order. +* +* The iteration is terminated early if the `iteratee` function returns `false`. +* +* @template T - The type of the object +* @param {T | null | undefined} object - The object to iterate over +* @param {(value: T[keyof T], key: string, obj: T) => any} iteratee - The function invoked per iteration +* @returns {T | null | undefined} Returns the object +* +* @example +* // Iterate over all properties including inherited ones +* const obj = { a: 1, b: 2 }; +* forInRight(obj, (value, key) => { +* console.log(key, value); +* }); +* // Output: 'b' 2, 'a' 1 +* +* // Early termination +* forInRight(obj, (value, key) => { +* console.log(key, value); +* return key !== 'a'; // stop after 'a' +* }); +* // Output: 'b' 2 +*/ +function forInRight(object, iteratee = require_identity.identity) { + if (object == null) return object; + const keys = []; + for (const key in object) keys.push(key); + for (let i = keys.length - 1; i >= 0; i--) { + const key = keys[i]; + if (iteratee(object[key], key, object) === false) break; + } + return object; +} +//#endregion +exports.forInRight = forInRight; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/forInRight.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/forInRight.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d26d086c5a9554eb55cf2f074b90db6e429fee61 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/forInRight.mjs @@ -0,0 +1,41 @@ +import { identity } from "../../function/identity.mjs"; +//#region src/compat/object/forInRight.ts +/** +* Iterates over an object in reverse order and invokes the `iteratee` function for each property. +* +* Iterates over string keyed properties including inherited properties in reverse order. +* +* The iteration is terminated early if the `iteratee` function returns `false`. +* +* @template T - The type of the object +* @param {T | null | undefined} object - The object to iterate over +* @param {(value: T[keyof T], key: string, obj: T) => any} iteratee - The function invoked per iteration +* @returns {T | null | undefined} Returns the object +* +* @example +* // Iterate over all properties including inherited ones +* const obj = { a: 1, b: 2 }; +* forInRight(obj, (value, key) => { +* console.log(key, value); +* }); +* // Output: 'b' 2, 'a' 1 +* +* // Early termination +* forInRight(obj, (value, key) => { +* console.log(key, value); +* return key !== 'a'; // stop after 'a' +* }); +* // Output: 'b' 2 +*/ +function forInRight(object, iteratee = identity) { + if (object == null) return object; + const keys = []; + for (const key in object) keys.push(key); + for (let i = keys.length - 1; i >= 0; i--) { + const key = keys[i]; + if (iteratee(object[key], key, object) === false) break; + } + return object; +} +//#endregion +export { forInRight }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwn.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwn.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e5960e4f9dc04ac0e3956e741e7ffadcfd7ffb8a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwn.d.mts @@ -0,0 +1,55 @@ +//#region src/compat/object/forOwn.d.ts +/** + * Iterates over an object's properties and calls the `iteratee` function for each property. + * + * It only iterates over the object's own properties, not including inherited properties or properties with `Symbol` keys. + * + * The `iteratee` function can terminate the iteration early by returning `false`. + * + * @template T - The type of the object. + * @param {T} object The object to iterate over. + * @param {(value: T[keyof T], key: string, collection: T) => any} [iteratee=identity] The function invoked per iteration. If not provided, the identity function will be used. + * @return {T} Returns object. + * + * @example + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * forOwn(new Foo(), function(value, key) { + * console.log(key); + * }); + * // => Logs 'a' then 'b' (iteration order is not guaranteed). + */ +declare function forOwn(object: T, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T; +/** + * Iterates over an object's properties and calls the `iteratee` function for each property. + * + * It only iterates over the object's own properties, not including inherited properties or properties with `Symbol` keys. + * + * The `iteratee` function can terminate the iteration early by returning `false`. + * + * @template T - The type of the object. + * @param {T | null | undefined} object The object to iterate over. + * @param {(value: T[keyof T], key: string, collection: T) => any} [iteratee=identity] The function invoked per iteration. If not provided, the identity function will be used. + * @return {T | null | undefined} Returns object. + * + * @example + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * forOwn(new Foo(), function(value, key) { + * console.log(key); + * }); + * // => Logs 'a' then 'b' (iteration order is not guaranteed). + */ +declare function forOwn(object: T | null | undefined, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T | null | undefined; +//#endregion +export { forOwn }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwn.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwn.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e5960e4f9dc04ac0e3956e741e7ffadcfd7ffb8a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwn.d.ts @@ -0,0 +1,55 @@ +//#region src/compat/object/forOwn.d.ts +/** + * Iterates over an object's properties and calls the `iteratee` function for each property. + * + * It only iterates over the object's own properties, not including inherited properties or properties with `Symbol` keys. + * + * The `iteratee` function can terminate the iteration early by returning `false`. + * + * @template T - The type of the object. + * @param {T} object The object to iterate over. + * @param {(value: T[keyof T], key: string, collection: T) => any} [iteratee=identity] The function invoked per iteration. If not provided, the identity function will be used. + * @return {T} Returns object. + * + * @example + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * forOwn(new Foo(), function(value, key) { + * console.log(key); + * }); + * // => Logs 'a' then 'b' (iteration order is not guaranteed). + */ +declare function forOwn(object: T, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T; +/** + * Iterates over an object's properties and calls the `iteratee` function for each property. + * + * It only iterates over the object's own properties, not including inherited properties or properties with `Symbol` keys. + * + * The `iteratee` function can terminate the iteration early by returning `false`. + * + * @template T - The type of the object. + * @param {T | null | undefined} object The object to iterate over. + * @param {(value: T[keyof T], key: string, collection: T) => any} [iteratee=identity] The function invoked per iteration. If not provided, the identity function will be used. + * @return {T | null | undefined} Returns object. + * + * @example + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * forOwn(new Foo(), function(value, key) { + * console.log(key); + * }); + * // => Logs 'a' then 'b' (iteration order is not guaranteed). + */ +declare function forOwn(object: T | null | undefined, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T | null | undefined; +//#endregion +export { forOwn }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwn.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwn.js new file mode 100644 index 0000000000000000000000000000000000000000..7a3842f1b1a5b9b3fa855ab4f4a0c16b4a809583 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwn.js @@ -0,0 +1,40 @@ +const require_identity = require("../../function/identity.js"); +const require_keys = require("./keys.js"); +//#region src/compat/object/forOwn.ts +/** +* Iterates over an object's properties and calls the `iteratee` function for each property. +* +* It only iterates over the object's own properties, not including inherited properties or properties with `Symbol` keys. +* +* The `iteratee` function can terminate the iteration early by returning `false`. +* +* @template T - The type of the object. +* @param {T | null | undefined} object The object to iterate over. +* @param {(value: T[keyof T], key: string, collection: T) => any} [iteratee=identity] The function invoked per iteration. If not provided, the identity function will be used. +* @return {T | null | undefined} Returns object. +* +* @example +* function Foo() { +* this.a = 1; +* this.b = 2; +* } +* +* Foo.prototype.c = 3; +* +* forOwn(new Foo(), function(value, key) { +* console.log(key); +* }); +* // => Logs 'a' then 'b' (iteration order is not guaranteed). +*/ +function forOwn(object, iteratee = require_identity.identity) { + if (object == null) return object; + const iterable = Object(object); + const keys$1 = require_keys.keys(object); + for (let i = 0; i < keys$1.length; ++i) { + const key = keys$1[i]; + if (iteratee(iterable[key], key, iterable) === false) break; + } + return object; +} +//#endregion +exports.forOwn = forOwn; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwn.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwn.mjs new file mode 100644 index 0000000000000000000000000000000000000000..094f1408aa188258ab83ef8952d2cca5e7600ab5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwn.mjs @@ -0,0 +1,40 @@ +import { identity } from "../../function/identity.mjs"; +import { keys } from "./keys.mjs"; +//#region src/compat/object/forOwn.ts +/** +* Iterates over an object's properties and calls the `iteratee` function for each property. +* +* It only iterates over the object's own properties, not including inherited properties or properties with `Symbol` keys. +* +* The `iteratee` function can terminate the iteration early by returning `false`. +* +* @template T - The type of the object. +* @param {T | null | undefined} object The object to iterate over. +* @param {(value: T[keyof T], key: string, collection: T) => any} [iteratee=identity] The function invoked per iteration. If not provided, the identity function will be used. +* @return {T | null | undefined} Returns object. +* +* @example +* function Foo() { +* this.a = 1; +* this.b = 2; +* } +* +* Foo.prototype.c = 3; +* +* forOwn(new Foo(), function(value, key) { +* console.log(key); +* }); +* // => Logs 'a' then 'b' (iteration order is not guaranteed). +*/ +function forOwn(object, iteratee = identity) { + if (object == null) return object; + const iterable = Object(object); + const keys$1 = keys(object); + for (let i = 0; i < keys$1.length; ++i) { + const key = keys$1[i]; + if (iteratee(iterable[key], key, iterable) === false) break; + } + return object; +} +//#endregion +export { forOwn }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwnRight.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwnRight.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..25585beedf5bb36c0528be9d23029adffd2e69ac --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwnRight.d.mts @@ -0,0 +1,55 @@ +//#region src/compat/object/forOwnRight.d.ts +/** + * Iterates over an object's properties in reverse order and calls the `iteratee` function for each property. + * + * It only iterates over the object's own properties, not including inherited properties or properties with `Symbol` keys. + * + * The `iteratee` function can terminate the iteration early by returning `false`. + * + * @template T - The type of the object. + * @param {T} object The object to iterate over. + * @param {(value: T[keyof T], key: string, collection: T) => any} [iteratee=identity] The function invoked per iteration. If not provided, the identity function will be used. + * @return {T} Returns object. + * + * @example + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * forOwnRight(new Foo(), function(value, key) { + * console.log(key); + * }); + * // => Logs 'b' then 'a' (iteration order is not guaranteed). + */ +declare function forOwnRight(object: T, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T; +/** + * Iterates over an object's properties in reverse order and calls the `iteratee` function for each property. + * + * It only iterates over the object's own properties, not including inherited properties or properties with `Symbol` keys. + * + * The `iteratee` function can terminate the iteration early by returning `false`. + * + * @template T - The type of the object. + * @param {T | null | undefined} object The object to iterate over. + * @param {(value: T[keyof T], key: string, collection: T) => any} [iteratee=identity] The function invoked per iteration. If not provided, the identity function will be used. + * @return {T | null | undefined} Returns object. + * + * @example + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * forOwnRight(new Foo(), function(value, key) { + * console.log(key); + * }); + * // => Logs 'b' then 'a' (iteration order is not guaranteed). + */ +declare function forOwnRight(object: T | null | undefined, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T | null | undefined; +//#endregion +export { forOwnRight }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwnRight.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwnRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..25585beedf5bb36c0528be9d23029adffd2e69ac --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwnRight.d.ts @@ -0,0 +1,55 @@ +//#region src/compat/object/forOwnRight.d.ts +/** + * Iterates over an object's properties in reverse order and calls the `iteratee` function for each property. + * + * It only iterates over the object's own properties, not including inherited properties or properties with `Symbol` keys. + * + * The `iteratee` function can terminate the iteration early by returning `false`. + * + * @template T - The type of the object. + * @param {T} object The object to iterate over. + * @param {(value: T[keyof T], key: string, collection: T) => any} [iteratee=identity] The function invoked per iteration. If not provided, the identity function will be used. + * @return {T} Returns object. + * + * @example + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * forOwnRight(new Foo(), function(value, key) { + * console.log(key); + * }); + * // => Logs 'b' then 'a' (iteration order is not guaranteed). + */ +declare function forOwnRight(object: T, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T; +/** + * Iterates over an object's properties in reverse order and calls the `iteratee` function for each property. + * + * It only iterates over the object's own properties, not including inherited properties or properties with `Symbol` keys. + * + * The `iteratee` function can terminate the iteration early by returning `false`. + * + * @template T - The type of the object. + * @param {T | null | undefined} object The object to iterate over. + * @param {(value: T[keyof T], key: string, collection: T) => any} [iteratee=identity] The function invoked per iteration. If not provided, the identity function will be used. + * @return {T | null | undefined} Returns object. + * + * @example + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * forOwnRight(new Foo(), function(value, key) { + * console.log(key); + * }); + * // => Logs 'b' then 'a' (iteration order is not guaranteed). + */ +declare function forOwnRight(object: T | null | undefined, iteratee?: (value: T[keyof T], key: string, collection: T) => any): T | null | undefined; +//#endregion +export { forOwnRight }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwnRight.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwnRight.js new file mode 100644 index 0000000000000000000000000000000000000000..24180c8ab8503ef45f5fdca760649abb70936367 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwnRight.js @@ -0,0 +1,40 @@ +const require_identity = require("../../function/identity.js"); +const require_keys = require("./keys.js"); +//#region src/compat/object/forOwnRight.ts +/** +* Iterates over an object's properties in reverse order and calls the `iteratee` function for each property. +* +* It only iterates over the object's own properties, not including inherited properties or properties with `Symbol` keys. +* +* The `iteratee` function can terminate the iteration early by returning `false`. +* +* @template T - The type of the object. +* @param {T | null | undefined} object The object to iterate over. +* @param {(value: T[keyof T], key: string, collection: T) => any} [iteratee=identity] The function invoked per iteration. If not provided, the identity function will be used. +* @return {T | null | undefined} Returns object. +* +* @example +* function Foo() { +* this.a = 1; +* this.b = 2; +* } +* +* Foo.prototype.c = 3; +* +* forOwnRight(new Foo(), function(value, key) { +* console.log(key); +* }); +* // => Logs 'b' then 'a' (iteration order is not guaranteed). +*/ +function forOwnRight(object, iteratee = require_identity.identity) { + if (object == null) return object; + const iterable = Object(object); + const keys$1 = require_keys.keys(object); + for (let i = keys$1.length - 1; i >= 0; --i) { + const key = keys$1[i]; + if (iteratee(iterable[key], key, iterable) === false) break; + } + return object; +} +//#endregion +exports.forOwnRight = forOwnRight; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwnRight.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwnRight.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3960991e01864c4391d94909326ebf2b01fa1ccf --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/forOwnRight.mjs @@ -0,0 +1,40 @@ +import { identity } from "../../function/identity.mjs"; +import { keys } from "./keys.mjs"; +//#region src/compat/object/forOwnRight.ts +/** +* Iterates over an object's properties in reverse order and calls the `iteratee` function for each property. +* +* It only iterates over the object's own properties, not including inherited properties or properties with `Symbol` keys. +* +* The `iteratee` function can terminate the iteration early by returning `false`. +* +* @template T - The type of the object. +* @param {T | null | undefined} object The object to iterate over. +* @param {(value: T[keyof T], key: string, collection: T) => any} [iteratee=identity] The function invoked per iteration. If not provided, the identity function will be used. +* @return {T | null | undefined} Returns object. +* +* @example +* function Foo() { +* this.a = 1; +* this.b = 2; +* } +* +* Foo.prototype.c = 3; +* +* forOwnRight(new Foo(), function(value, key) { +* console.log(key); +* }); +* // => Logs 'b' then 'a' (iteration order is not guaranteed). +*/ +function forOwnRight(object, iteratee = identity) { + if (object == null) return object; + const iterable = Object(object); + const keys$1 = keys(object); + for (let i = keys$1.length - 1; i >= 0; --i) { + const key = keys$1[i]; + if (iteratee(iterable[key], key, iterable) === false) break; + } + return object; +} +//#endregion +export { forOwnRight }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/fromPairs.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/fromPairs.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0989685e6c18a30b706bee790dc365e94d2b0dcc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/fromPairs.d.mts @@ -0,0 +1,29 @@ +//#region src/compat/object/fromPairs.d.ts +type PropertyName = string | number | symbol; +/** + * Converts an array of key-value pairs into an object. + * + * @template T - The type of the values. + * @param {ArrayLike<[PropertyName, T]> | null | undefined} pairs - An array of key-value pairs. + * @returns {Record} - An object where keys are strings and values are of type T. + * + * @example + * const pairs = [['a', 1], ['b', 2]]; + * const result = fromPairs(pairs); + * // => { a: 1, b: 2 } + */ +declare function fromPairs(pairs: ArrayLike<[PropertyName, T]> | null | undefined): Record; +/** + * Converts an array of key-value pairs into an object. + * + * @param {ArrayLike | null | undefined} pairs - An array of key-value pairs. + * @returns {Record} - An object where keys are strings and values can be any type. + * + * @example + * const pairs = [['a', 1], ['b', 'hello']]; + * const result = fromPairs(pairs); + * // => { a: 1, b: 'hello' } + */ +declare function fromPairs(pairs: ArrayLike | null | undefined): Record; +//#endregion +export { fromPairs }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/fromPairs.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/fromPairs.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0989685e6c18a30b706bee790dc365e94d2b0dcc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/fromPairs.d.ts @@ -0,0 +1,29 @@ +//#region src/compat/object/fromPairs.d.ts +type PropertyName = string | number | symbol; +/** + * Converts an array of key-value pairs into an object. + * + * @template T - The type of the values. + * @param {ArrayLike<[PropertyName, T]> | null | undefined} pairs - An array of key-value pairs. + * @returns {Record} - An object where keys are strings and values are of type T. + * + * @example + * const pairs = [['a', 1], ['b', 2]]; + * const result = fromPairs(pairs); + * // => { a: 1, b: 2 } + */ +declare function fromPairs(pairs: ArrayLike<[PropertyName, T]> | null | undefined): Record; +/** + * Converts an array of key-value pairs into an object. + * + * @param {ArrayLike | null | undefined} pairs - An array of key-value pairs. + * @returns {Record} - An object where keys are strings and values can be any type. + * + * @example + * const pairs = [['a', 1], ['b', 'hello']]; + * const result = fromPairs(pairs); + * // => { a: 1, b: 'hello' } + */ +declare function fromPairs(pairs: ArrayLike | null | undefined): Record; +//#endregion +export { fromPairs }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/fromPairs.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/fromPairs.js new file mode 100644 index 0000000000000000000000000000000000000000..7f3c6cba752c419e49bb8f1dc52a35f55713f452 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/fromPairs.js @@ -0,0 +1,27 @@ +const require_isArrayLike = require("../predicate/isArrayLike.js"); +//#region src/compat/object/fromPairs.ts +/** +* Converts an array of key-value pairs into an object. +* +* @template T - The type of the keys in the resulting object. It must extend `PropertyKey`. +* @template U - The type of the values in the resulting object. +* +* @param {Array<[T, U]>} pairs - An array of key-value pairs where each key is a `PropertyKey` and each value is of type `U`. +* @returns {Record} - An object where the keys are of type `T` and the values are of type `U`. +* +* @example +* const pairs = [['a', 1], ['b', 2]]; +* const result = fromPairs(pairs); +* // result will be: { a: 1, b: 2 } +*/ +function fromPairs(pairs) { + if (!require_isArrayLike.isArrayLike(pairs)) return {}; + const result = {}; + for (let i = 0; i < pairs.length; i++) { + const [key, value] = pairs[i]; + result[key] = value; + } + return result; +} +//#endregion +exports.fromPairs = fromPairs; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/fromPairs.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/fromPairs.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a0c3f2840bd0eeeb7f269883576972a1c90eeadf --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/fromPairs.mjs @@ -0,0 +1,27 @@ +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +//#region src/compat/object/fromPairs.ts +/** +* Converts an array of key-value pairs into an object. +* +* @template T - The type of the keys in the resulting object. It must extend `PropertyKey`. +* @template U - The type of the values in the resulting object. +* +* @param {Array<[T, U]>} pairs - An array of key-value pairs where each key is a `PropertyKey` and each value is of type `U`. +* @returns {Record} - An object where the keys are of type `T` and the values are of type `U`. +* +* @example +* const pairs = [['a', 1], ['b', 2]]; +* const result = fromPairs(pairs); +* // result will be: { a: 1, b: 2 } +*/ +function fromPairs(pairs) { + if (!isArrayLike(pairs)) return {}; + const result = {}; + for (let i = 0; i < pairs.length; i++) { + const [key, value] = pairs[i]; + result[key] = value; + } + return result; +} +//#endregion +export { fromPairs }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/functions.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/functions.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..bd284e21fddbc4a57a2f66d3f32a28e9da8753c3 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/functions.d.mts @@ -0,0 +1,21 @@ +//#region src/compat/object/functions.d.ts +/** + * Creates an array of property names from an object where the property values are functions. + * + * @param {any} object - The object to inspect. + * @returns {string[]} - An array of function property names. + * + * @example + * function Foo() { + * this.a = () => 'a'; + * this.b = () => 'b'; + * } + * + * Foo.prototype.c = () => 'c'; + * + * functions(new Foo); + * // => ['a', 'b'] + */ +declare function functions(object: any): string[]; +//#endregion +export { functions }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/functions.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/functions.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bd284e21fddbc4a57a2f66d3f32a28e9da8753c3 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/functions.d.ts @@ -0,0 +1,21 @@ +//#region src/compat/object/functions.d.ts +/** + * Creates an array of property names from an object where the property values are functions. + * + * @param {any} object - The object to inspect. + * @returns {string[]} - An array of function property names. + * + * @example + * function Foo() { + * this.a = () => 'a'; + * this.b = () => 'b'; + * } + * + * Foo.prototype.c = () => 'c'; + * + * functions(new Foo); + * // => ['a', 'b'] + */ +declare function functions(object: any): string[]; +//#endregion +export { functions }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/functions.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/functions.js new file mode 100644 index 0000000000000000000000000000000000000000..e0c78cecc7a6a8312265ab0d8a4be84beedac042 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/functions.js @@ -0,0 +1,29 @@ +const require_keys = require("./keys.js"); +//#region src/compat/object/functions.ts +/** +* Creates an array of property names from an object where the property values are functions. +* +* Only checks for own properties with string keys. Inherited properties or +* properties with Symbol keys are not included. +* +* @param {unknown} object The object to inspect. +* @returns {string[]} An array of function property names. +* +* @example +* +* function Foo() { +* this.a = () => 'a' +* this.b = () => 'b' +* } +* +* Foo.prototype.c = () => 'c' +* +* functions(new Foo) +* // => ['a', 'b'] +*/ +function functions(object) { + if (object == null) return []; + return require_keys.keys(object).filter((key) => typeof object[key] === "function"); +} +//#endregion +exports.functions = functions; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/functions.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/functions.mjs new file mode 100644 index 0000000000000000000000000000000000000000..fd788e0d6c87a63363ba9267bab141c630876c2b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/functions.mjs @@ -0,0 +1,29 @@ +import { keys } from "./keys.mjs"; +//#region src/compat/object/functions.ts +/** +* Creates an array of property names from an object where the property values are functions. +* +* Only checks for own properties with string keys. Inherited properties or +* properties with Symbol keys are not included. +* +* @param {unknown} object The object to inspect. +* @returns {string[]} An array of function property names. +* +* @example +* +* function Foo() { +* this.a = () => 'a' +* this.b = () => 'b' +* } +* +* Foo.prototype.c = () => 'c' +* +* functions(new Foo) +* // => ['a', 'b'] +*/ +function functions(object) { + if (object == null) return []; + return keys(object).filter((key) => typeof object[key] === "function"); +} +//#endregion +export { functions }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/functionsIn.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/functionsIn.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..bfc6f02a2b36e013921d6f14584a70557b648108 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/functionsIn.d.mts @@ -0,0 +1,21 @@ +//#region src/compat/object/functionsIn.d.ts +/** + * Returns an array of property names whose values are functions, including inherited properties. + * + * @param {*} object The object to inspect. + * @returns {Array} Returns the function names. + * @example + * + * function Foo() { + * this.a = function() { return 'a'; }; + * this.b = function() { return 'b'; }; + * } + * + * Foo.prototype.c = function() { return 'c'; }; + * + * functionsIn(new Foo); + * // => ['a', 'b', 'c'] + */ +declare function functionsIn(object: any): string[]; +//#endregion +export { functionsIn }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/functionsIn.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/functionsIn.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bfc6f02a2b36e013921d6f14584a70557b648108 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/functionsIn.d.ts @@ -0,0 +1,21 @@ +//#region src/compat/object/functionsIn.d.ts +/** + * Returns an array of property names whose values are functions, including inherited properties. + * + * @param {*} object The object to inspect. + * @returns {Array} Returns the function names. + * @example + * + * function Foo() { + * this.a = function() { return 'a'; }; + * this.b = function() { return 'b'; }; + * } + * + * Foo.prototype.c = function() { return 'c'; }; + * + * functionsIn(new Foo); + * // => ['a', 'b', 'c'] + */ +declare function functionsIn(object: any): string[]; +//#endregion +export { functionsIn }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/functionsIn.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/functionsIn.js new file mode 100644 index 0000000000000000000000000000000000000000..b4c1ecd70ebf4e14bdffd21ba15403b3f16bf4dc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/functionsIn.js @@ -0,0 +1,27 @@ +const require_isFunction = require("../../predicate/isFunction.js"); +//#region src/compat/object/functionsIn.ts +/** +* Returns an array of property names whose values are functions, including inherited properties. +* +* @param {*} object The object to inspect. +* @returns {Array} Returns the function names. +* @example +* +* function Foo() { +* this.a = function() { return 'a'; }; +* this.b = function() { return 'b'; }; +* } +* +* Foo.prototype.c = function() { return 'c'; }; +* +* functionsIn(new Foo); +* // => ['a', 'b', 'c'] +*/ +function functionsIn(object) { + if (object == null) return []; + const result = []; + for (const key in object) if (require_isFunction.isFunction(object[key])) result.push(key); + return result; +} +//#endregion +exports.functionsIn = functionsIn; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/functionsIn.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/functionsIn.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f32e536fb012b91cef506d6a7d9711ee239a0576 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/functionsIn.mjs @@ -0,0 +1,27 @@ +import { isFunction } from "../../predicate/isFunction.mjs"; +//#region src/compat/object/functionsIn.ts +/** +* Returns an array of property names whose values are functions, including inherited properties. +* +* @param {*} object The object to inspect. +* @returns {Array} Returns the function names. +* @example +* +* function Foo() { +* this.a = function() { return 'a'; }; +* this.b = function() { return 'b'; }; +* } +* +* Foo.prototype.c = function() { return 'c'; }; +* +* functionsIn(new Foo); +* // => ['a', 'b', 'c'] +*/ +function functionsIn(object) { + if (object == null) return []; + const result = []; + for (const key in object) if (isFunction(object[key])) result.push(key); + return result; +} +//#endregion +export { functionsIn }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/get.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/get.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..cb0fe2659ab409f95f17fe028b0b1725784e04de --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/get.d.mts @@ -0,0 +1,328 @@ +import { PropertyPath } from "../_internal/PropertyPath.mjs"; +import { GetFieldType } from "../_internal/GetFieldType.mjs"; + +//#region src/compat/object/get.d.ts +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TObject + * @template TKey + * @param {TObject} object - The object to query. + * @param {TKey | [TKey]} path - The path of the property to get. + * @returns {TObject[TKey]} Returns the resolved value. + * + * @example + * const object = { 'a': [{ 'b': { 'c': 3 } }] }; + * get(object, 'a[0].b.c'); + * // => 3 + */ +declare function get(object: TObject, path: TKey | [TKey]): TObject[TKey]; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TObject + * @template TKey + * @param {TObject | null | undefined} object - The object to query. + * @param {TKey | [TKey]} path - The path of the property to get. + * @returns {TObject[TKey] | undefined} Returns the resolved value. + * + * @example + * const object = { 'a': [{ 'b': { 'c': 3 } }] }; + * get(object, 'a[0].b.c'); + * // => 3 + */ +declare function get(object: TObject | null | undefined, path: TKey | [TKey]): TObject[TKey] | undefined; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TObject + * @template TKey + * @template TDefault + * @param {TObject | null | undefined} object - The object to query. + * @param {TKey | [TKey]} path - The path of the property to get. + * @param {TDefault} defaultValue - The value returned if the resolved value is undefined. + * @returns {Exclude | TDefault} Returns the resolved value. + * + * @example + * const object = { 'a': [{ 'b': { 'c': 3 } }] }; + * get(object, 'a[0].b.c', 'default'); + * // => 3 + */ +declare function get(object: TObject | null | undefined, path: TKey | [TKey], defaultValue: TDefault): Exclude | TDefault; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TObject + * @template TKey1 + * @template TKey2 + * @param {TObject} object - The object to query. + * @param {[TKey1, TKey2]} path - The path of the property to get. + * @returns {TObject[TKey1][TKey2]} Returns the resolved value. + * + * @example + * const object = { 'a': { 'b': 2 } }; + * get(object, ['a', 'b']); + * // => 2 + */ +declare function get(object: TObject, path: [TKey1, TKey2]): TObject[TKey1][TKey2]; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TObject + * @template TKey1 + * @template TKey2 + * @param {TObject | null | undefined} object - The object to query. + * @param {[TKey1, TKey2]} path - The path of the property to get. + * @returns {NonNullable[TKey2] | undefined} Returns the resolved value. + * + * @example + * const object = { 'a': { 'b': 2 } }; + * get(object, ['a', 'b']); + * // => 2 + */ +declare function get>(object: TObject | null | undefined, path: [TKey1, TKey2]): NonNullable[TKey2] | undefined; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TObject + * @template TKey1 + * @template TKey2 + * @template TDefault + * @param {TObject | null | undefined} object - The object to query. + * @param {[TKey1, TKey2]} path - The path of the property to get. + * @param {TDefault} defaultValue - The value returned if the resolved value is undefined. + * @returns {Exclude[TKey2], undefined> | TDefault} Returns the resolved value. + * + * @example + * const object = { 'a': { 'b': 2 } }; + * get(object, ['a', 'b'], 'default'); + * // => 2 + */ +declare function get, TDefault>(object: TObject | null | undefined, path: [TKey1, TKey2], defaultValue: TDefault): Exclude[TKey2], undefined> | TDefault; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TObject + * @template TKey1 + * @template TKey2 + * @template TKey3 + * @param {TObject} object - The object to query. + * @param {[TKey1, TKey2, TKey3]} path - The path of the property to get. + * @returns {TObject[TKey1][TKey2][TKey3]} Returns the resolved value. + * + * @example + * const object = { 'a': { 'b': { 'c': 3 } } }; + * get(object, ['a', 'b', 'c']); + * // => 3 + */ +declare function get(object: TObject, path: [TKey1, TKey2, TKey3]): TObject[TKey1][TKey2][TKey3]; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TObject + * @template TKey1 + * @template TKey2 + * @template TKey3 + * @param {TObject | null | undefined} object - The object to query. + * @param {[TKey1, TKey2, TKey3]} path - The path of the property to get. + * @returns {NonNullable[TKey2]>[TKey3] | undefined} Returns the resolved value. + * + * @example + * const object = { 'a': { 'b': { 'c': 3 } } }; + * get(object, ['a', 'b', 'c']); + * // => 3 + */ +declare function get, TKey3 extends keyof NonNullable[TKey2]>>(object: TObject | null | undefined, path: [TKey1, TKey2, TKey3]): NonNullable[TKey2]>[TKey3] | undefined; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TObject + * @template TKey1 + * @template TKey2 + * @template TKey3 + * @template TDefault + * @param {TObject | null | undefined} object - The object to query. + * @param {[TKey1, TKey2, TKey3]} path - The path of the property to get. + * @param {TDefault} defaultValue - The value returned if the resolved value is undefined. + * @returns {Exclude[TKey2]>[TKey3], undefined> | TDefault} Returns the resolved value. + * + * @example + * const object = { 'a': { 'b': { 'c': 3 } } }; + * get(object, ['a', 'b', 'c'], 'default'); + * // => 3 + */ +declare function get, TKey3 extends keyof NonNullable[TKey2]>, TDefault>(object: TObject | null | undefined, path: [TKey1, TKey2, TKey3], defaultValue: TDefault): Exclude[TKey2]>[TKey3], undefined> | TDefault; +/** + * Gets the value at path of object. + * + * @template TObject + * @template TKey1 + * @template TKey2 + * @template TKey3 + * @template TKey4 + * @param {TObject} object - The object to query. + * @param {[TKey1, TKey2, TKey3, TKey4]} path - The path of the property to get. + * @returns {TObject[TKey1][TKey2][TKey3][TKey4]} Returns the resolved value. + * + * @example + * const object = { 'a': { 'b': { 'c': { 'd': 4 } } } }; + * get(object, ['a', 'b', 'c', 'd']); + * // => 4 + */ +declare function get(object: TObject, path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4]; +/** + * Gets the value at path of object. If the resolved value is undefined, undefined is returned. + * + * @template TObject + * @template TKey1 + * @template TKey2 + * @template TKey3 + * @template TKey4 + * @param {TObject | null | undefined} object - The object to query. + * @param {[TKey1, TKey2, TKey3, TKey4]} path - The path of the property to get. + * @returns {NonNullable[TKey2]>[TKey3]>[TKey4] | undefined} Returns the resolved value. + * + * @example + * const object = { 'a': { 'b': { 'c': { 'd': 4 } } } }; + * get(object, ['a', 'b', 'c', 'd']); + * // => 4 + */ +declare function get, TKey3 extends keyof NonNullable[TKey2]>, TKey4 extends keyof NonNullable[TKey2]>[TKey3]>>(object: TObject | null | undefined, path: [TKey1, TKey2, TKey3, TKey4]): NonNullable[TKey2]>[TKey3]>[TKey4] | undefined; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TObject + * @template TKey1 + * @template TKey2 + * @template TKey3 + * @template TKey4 + * @template TDefault + * @param {TObject | null | undefined} object - The object to query. + * @param {[TKey1, TKey2, TKey3, TKey4]} path - The path of the property to get. + * @param {TDefault} defaultValue - The value returned if the resolved value is undefined. + * @returns {Exclude[TKey2]>[TKey3]>[TKey4], undefined> | TDefault} Returns the resolved value. + * + * @example + * const object = { 'a': { 'b': { 'c': { 'd': 4 } } } }; + * get(object, ['a', 'b', 'c', 'd'], 'default'); + * // => 4 + */ +declare function get, TKey3 extends keyof NonNullable[TKey2]>, TKey4 extends keyof NonNullable[TKey2]>[TKey3]>, TDefault>(object: TObject | null | undefined, path: [TKey1, TKey2, TKey3, TKey4], defaultValue: TDefault): Exclude[TKey2]>[TKey3]>[TKey4], undefined> | TDefault; +/** + * Gets the value at path of object. + * + * @template T + * @param {Record} object - The object to query. + * @param {number} path - The path of the property to get. + * @returns {T} Returns the resolved value. + * + * @example + * const object = { 0: 'a', 1: 'b', 2: 'c' }; + * get(object, 1); + * // => 'b' + */ +declare function get(object: Record, path: number): T; +/** + * Gets the value at path of object. If the resolved value is undefined, undefined is returned. + * + * @template T + * @param {Record | null | undefined} object - The object to query. + * @param {number} path - The path of the property to get. + * @returns {T | undefined} Returns the resolved value. + * + * @example + * const object = { 0: 'a', 1: 'b', 2: 'c' }; + * get(object, 1); + * // => 'b' + */ +declare function get(object: Record | null | undefined, path: number): T | undefined; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template T + * @template TDefault + * @param {Record | null | undefined} object - The object to query. + * @param {number} path - The path of the property to get. + * @param {TDefault} defaultValue - The value returned if the resolved value is undefined. + * @returns {T | TDefault} Returns the resolved value. + * + * @example + * const object = { 0: 'a', 1: 'b', 2: 'c' }; + * get(object, 1, 'default'); + * // => 'b' + */ +declare function get(object: Record | null | undefined, path: number, defaultValue: TDefault): T | TDefault; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TDefault + * @param {null | undefined} object - The object to query. + * @param {PropertyPath} path - The path of the property to get. + * @param {TDefault} defaultValue - The value returned if the resolved value is undefined. + * @returns {TDefault} Returns the default value. + * + * @example + * get(null, 'a.b.c', 'default'); + * // => 'default' + */ +declare function get(object: null | undefined, path: PropertyPath, defaultValue: TDefault): TDefault; +/** + * Gets the value at path of object. If the resolved value is undefined, undefined is returned. + * + * @param {null | undefined} object - The object to query. + * @param {PropertyPath} path - The path of the property to get. + * @returns {undefined} Returns undefined. + * + * @example + * get(null, 'a.b.c'); + * // => undefined + */ +declare function get(object: null | undefined, path: PropertyPath): undefined; +/** + * Gets the value at path of object using type-safe path. + * + * @template TObject + * @template TPath + * @param {TObject} data - The object to query. + * @param {TPath} path - The path of the property to get. + * @returns {string extends TPath ? any : GetFieldType} Returns the resolved value. + * + * @example + * const object = { a: { b: { c: 1 } } }; + * get(object, 'a.b.c'); + * // => 1 + */ +declare function get(data: TObject, path: TPath): string extends TPath ? any : GetFieldType; +/** + * Gets the value at path of object using type-safe path. If the resolved value is undefined, the defaultValue is returned. + * + * @template TObject + * @template TPath + * @template TDefault + * @param {TObject} data - The object to query. + * @param {TPath} path - The path of the property to get. + * @param {TDefault} defaultValue - The value returned if the resolved value is undefined. + * @returns {Exclude, null | undefined> | TDefault} Returns the resolved value. + * + * @example + * const object = { a: { b: { c: 1 } } }; + * get(object, 'a.b.d', 'default'); + * // => 'default' + */ +declare function get>(data: TObject, path: TPath, defaultValue: TDefault): Exclude, null | undefined> | TDefault; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned. + * + * @param {any} object - The object to query. + * @param {PropertyPath} path - The path of the property to get. + * @param {any} [defaultValue] - The value returned if the resolved value is undefined. + * @returns {any} Returns the resolved value. + * + * @example + * const object = { a: { b: { c: 1 } } }; + * get(object, 'a.b.c', 'default'); + * // => 1 + */ +declare function get(object: any, path: PropertyPath, defaultValue?: any): any; +//#endregion +export { get }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/get.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/get.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..96c09151af25860d464647f23bbe57886b27706e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/get.d.ts @@ -0,0 +1,328 @@ +import { PropertyPath } from "../_internal/PropertyPath.js"; +import { GetFieldType } from "../_internal/GetFieldType.js"; + +//#region src/compat/object/get.d.ts +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TObject + * @template TKey + * @param {TObject} object - The object to query. + * @param {TKey | [TKey]} path - The path of the property to get. + * @returns {TObject[TKey]} Returns the resolved value. + * + * @example + * const object = { 'a': [{ 'b': { 'c': 3 } }] }; + * get(object, 'a[0].b.c'); + * // => 3 + */ +declare function get(object: TObject, path: TKey | [TKey]): TObject[TKey]; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TObject + * @template TKey + * @param {TObject | null | undefined} object - The object to query. + * @param {TKey | [TKey]} path - The path of the property to get. + * @returns {TObject[TKey] | undefined} Returns the resolved value. + * + * @example + * const object = { 'a': [{ 'b': { 'c': 3 } }] }; + * get(object, 'a[0].b.c'); + * // => 3 + */ +declare function get(object: TObject | null | undefined, path: TKey | [TKey]): TObject[TKey] | undefined; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TObject + * @template TKey + * @template TDefault + * @param {TObject | null | undefined} object - The object to query. + * @param {TKey | [TKey]} path - The path of the property to get. + * @param {TDefault} defaultValue - The value returned if the resolved value is undefined. + * @returns {Exclude | TDefault} Returns the resolved value. + * + * @example + * const object = { 'a': [{ 'b': { 'c': 3 } }] }; + * get(object, 'a[0].b.c', 'default'); + * // => 3 + */ +declare function get(object: TObject | null | undefined, path: TKey | [TKey], defaultValue: TDefault): Exclude | TDefault; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TObject + * @template TKey1 + * @template TKey2 + * @param {TObject} object - The object to query. + * @param {[TKey1, TKey2]} path - The path of the property to get. + * @returns {TObject[TKey1][TKey2]} Returns the resolved value. + * + * @example + * const object = { 'a': { 'b': 2 } }; + * get(object, ['a', 'b']); + * // => 2 + */ +declare function get(object: TObject, path: [TKey1, TKey2]): TObject[TKey1][TKey2]; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TObject + * @template TKey1 + * @template TKey2 + * @param {TObject | null | undefined} object - The object to query. + * @param {[TKey1, TKey2]} path - The path of the property to get. + * @returns {NonNullable[TKey2] | undefined} Returns the resolved value. + * + * @example + * const object = { 'a': { 'b': 2 } }; + * get(object, ['a', 'b']); + * // => 2 + */ +declare function get>(object: TObject | null | undefined, path: [TKey1, TKey2]): NonNullable[TKey2] | undefined; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TObject + * @template TKey1 + * @template TKey2 + * @template TDefault + * @param {TObject | null | undefined} object - The object to query. + * @param {[TKey1, TKey2]} path - The path of the property to get. + * @param {TDefault} defaultValue - The value returned if the resolved value is undefined. + * @returns {Exclude[TKey2], undefined> | TDefault} Returns the resolved value. + * + * @example + * const object = { 'a': { 'b': 2 } }; + * get(object, ['a', 'b'], 'default'); + * // => 2 + */ +declare function get, TDefault>(object: TObject | null | undefined, path: [TKey1, TKey2], defaultValue: TDefault): Exclude[TKey2], undefined> | TDefault; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TObject + * @template TKey1 + * @template TKey2 + * @template TKey3 + * @param {TObject} object - The object to query. + * @param {[TKey1, TKey2, TKey3]} path - The path of the property to get. + * @returns {TObject[TKey1][TKey2][TKey3]} Returns the resolved value. + * + * @example + * const object = { 'a': { 'b': { 'c': 3 } } }; + * get(object, ['a', 'b', 'c']); + * // => 3 + */ +declare function get(object: TObject, path: [TKey1, TKey2, TKey3]): TObject[TKey1][TKey2][TKey3]; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TObject + * @template TKey1 + * @template TKey2 + * @template TKey3 + * @param {TObject | null | undefined} object - The object to query. + * @param {[TKey1, TKey2, TKey3]} path - The path of the property to get. + * @returns {NonNullable[TKey2]>[TKey3] | undefined} Returns the resolved value. + * + * @example + * const object = { 'a': { 'b': { 'c': 3 } } }; + * get(object, ['a', 'b', 'c']); + * // => 3 + */ +declare function get, TKey3 extends keyof NonNullable[TKey2]>>(object: TObject | null | undefined, path: [TKey1, TKey2, TKey3]): NonNullable[TKey2]>[TKey3] | undefined; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TObject + * @template TKey1 + * @template TKey2 + * @template TKey3 + * @template TDefault + * @param {TObject | null | undefined} object - The object to query. + * @param {[TKey1, TKey2, TKey3]} path - The path of the property to get. + * @param {TDefault} defaultValue - The value returned if the resolved value is undefined. + * @returns {Exclude[TKey2]>[TKey3], undefined> | TDefault} Returns the resolved value. + * + * @example + * const object = { 'a': { 'b': { 'c': 3 } } }; + * get(object, ['a', 'b', 'c'], 'default'); + * // => 3 + */ +declare function get, TKey3 extends keyof NonNullable[TKey2]>, TDefault>(object: TObject | null | undefined, path: [TKey1, TKey2, TKey3], defaultValue: TDefault): Exclude[TKey2]>[TKey3], undefined> | TDefault; +/** + * Gets the value at path of object. + * + * @template TObject + * @template TKey1 + * @template TKey2 + * @template TKey3 + * @template TKey4 + * @param {TObject} object - The object to query. + * @param {[TKey1, TKey2, TKey3, TKey4]} path - The path of the property to get. + * @returns {TObject[TKey1][TKey2][TKey3][TKey4]} Returns the resolved value. + * + * @example + * const object = { 'a': { 'b': { 'c': { 'd': 4 } } } }; + * get(object, ['a', 'b', 'c', 'd']); + * // => 4 + */ +declare function get(object: TObject, path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4]; +/** + * Gets the value at path of object. If the resolved value is undefined, undefined is returned. + * + * @template TObject + * @template TKey1 + * @template TKey2 + * @template TKey3 + * @template TKey4 + * @param {TObject | null | undefined} object - The object to query. + * @param {[TKey1, TKey2, TKey3, TKey4]} path - The path of the property to get. + * @returns {NonNullable[TKey2]>[TKey3]>[TKey4] | undefined} Returns the resolved value. + * + * @example + * const object = { 'a': { 'b': { 'c': { 'd': 4 } } } }; + * get(object, ['a', 'b', 'c', 'd']); + * // => 4 + */ +declare function get, TKey3 extends keyof NonNullable[TKey2]>, TKey4 extends keyof NonNullable[TKey2]>[TKey3]>>(object: TObject | null | undefined, path: [TKey1, TKey2, TKey3, TKey4]): NonNullable[TKey2]>[TKey3]>[TKey4] | undefined; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TObject + * @template TKey1 + * @template TKey2 + * @template TKey3 + * @template TKey4 + * @template TDefault + * @param {TObject | null | undefined} object - The object to query. + * @param {[TKey1, TKey2, TKey3, TKey4]} path - The path of the property to get. + * @param {TDefault} defaultValue - The value returned if the resolved value is undefined. + * @returns {Exclude[TKey2]>[TKey3]>[TKey4], undefined> | TDefault} Returns the resolved value. + * + * @example + * const object = { 'a': { 'b': { 'c': { 'd': 4 } } } }; + * get(object, ['a', 'b', 'c', 'd'], 'default'); + * // => 4 + */ +declare function get, TKey3 extends keyof NonNullable[TKey2]>, TKey4 extends keyof NonNullable[TKey2]>[TKey3]>, TDefault>(object: TObject | null | undefined, path: [TKey1, TKey2, TKey3, TKey4], defaultValue: TDefault): Exclude[TKey2]>[TKey3]>[TKey4], undefined> | TDefault; +/** + * Gets the value at path of object. + * + * @template T + * @param {Record} object - The object to query. + * @param {number} path - The path of the property to get. + * @returns {T} Returns the resolved value. + * + * @example + * const object = { 0: 'a', 1: 'b', 2: 'c' }; + * get(object, 1); + * // => 'b' + */ +declare function get(object: Record, path: number): T; +/** + * Gets the value at path of object. If the resolved value is undefined, undefined is returned. + * + * @template T + * @param {Record | null | undefined} object - The object to query. + * @param {number} path - The path of the property to get. + * @returns {T | undefined} Returns the resolved value. + * + * @example + * const object = { 0: 'a', 1: 'b', 2: 'c' }; + * get(object, 1); + * // => 'b' + */ +declare function get(object: Record | null | undefined, path: number): T | undefined; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template T + * @template TDefault + * @param {Record | null | undefined} object - The object to query. + * @param {number} path - The path of the property to get. + * @param {TDefault} defaultValue - The value returned if the resolved value is undefined. + * @returns {T | TDefault} Returns the resolved value. + * + * @example + * const object = { 0: 'a', 1: 'b', 2: 'c' }; + * get(object, 1, 'default'); + * // => 'b' + */ +declare function get(object: Record | null | undefined, path: number, defaultValue: TDefault): T | TDefault; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place. + * + * @template TDefault + * @param {null | undefined} object - The object to query. + * @param {PropertyPath} path - The path of the property to get. + * @param {TDefault} defaultValue - The value returned if the resolved value is undefined. + * @returns {TDefault} Returns the default value. + * + * @example + * get(null, 'a.b.c', 'default'); + * // => 'default' + */ +declare function get(object: null | undefined, path: PropertyPath, defaultValue: TDefault): TDefault; +/** + * Gets the value at path of object. If the resolved value is undefined, undefined is returned. + * + * @param {null | undefined} object - The object to query. + * @param {PropertyPath} path - The path of the property to get. + * @returns {undefined} Returns undefined. + * + * @example + * get(null, 'a.b.c'); + * // => undefined + */ +declare function get(object: null | undefined, path: PropertyPath): undefined; +/** + * Gets the value at path of object using type-safe path. + * + * @template TObject + * @template TPath + * @param {TObject} data - The object to query. + * @param {TPath} path - The path of the property to get. + * @returns {string extends TPath ? any : GetFieldType} Returns the resolved value. + * + * @example + * const object = { a: { b: { c: 1 } } }; + * get(object, 'a.b.c'); + * // => 1 + */ +declare function get(data: TObject, path: TPath): string extends TPath ? any : GetFieldType; +/** + * Gets the value at path of object using type-safe path. If the resolved value is undefined, the defaultValue is returned. + * + * @template TObject + * @template TPath + * @template TDefault + * @param {TObject} data - The object to query. + * @param {TPath} path - The path of the property to get. + * @param {TDefault} defaultValue - The value returned if the resolved value is undefined. + * @returns {Exclude, null | undefined> | TDefault} Returns the resolved value. + * + * @example + * const object = { a: { b: { c: 1 } } }; + * get(object, 'a.b.d', 'default'); + * // => 'default' + */ +declare function get>(data: TObject, path: TPath, defaultValue: TDefault): Exclude, null | undefined> | TDefault; +/** + * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned. + * + * @param {any} object - The object to query. + * @param {PropertyPath} path - The path of the property to get. + * @param {any} [defaultValue] - The value returned if the resolved value is undefined. + * @returns {any} Returns the resolved value. + * + * @example + * const object = { a: { b: { c: 1 } } }; + * get(object, 'a.b.c', 'default'); + * // => 1 + */ +declare function get(object: any, path: PropertyPath, defaultValue?: any): any; +//#endregion +export { get }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/get.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/get.js new file mode 100644 index 0000000000000000000000000000000000000000..ee83228ca16dd23543caa2b83ccadf483545bfdd --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/get.js @@ -0,0 +1,65 @@ +const require_isUnsafeProperty = require("../../_internal/isUnsafeProperty.js"); +const require_isDeepKey = require("../_internal/isDeepKey.js"); +const require_toKey = require("../_internal/toKey.js"); +const require_toPath = require("../util/toPath.js"); +//#region src/compat/object/get.ts +/** +* Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead. +* +* @param {any} object - The object to query. +* @param {PropertyKey | readonly PropertyKey[]} path - The path of the property to get. +* @param {any} [defaultValue] - The value returned if the resolved value is undefined. +* @returns {any} Returns the resolved value. +* +* @example +* const object = { a: { b: { c: 1 } } }; +* get(object, 'a.b.c'); +* // => 1 +* +* get(object, ['a', 'b', 'c']); +* // => 1 +* +* get(object, 'a.b.d', 'default'); +* // => 'default' +*/ +function get(object, path, defaultValue) { + if (object == null) return defaultValue; + switch (typeof path) { + case "string": { + if (require_isUnsafeProperty.isUnsafeProperty(path)) return defaultValue; + const result = object[path]; + if (result === void 0) if (require_isDeepKey.isDeepKey(path)) return get(object, require_toPath.toPath(path), defaultValue); + else return defaultValue; + return result; + } + case "number": + case "symbol": { + if (typeof path === "number") path = require_toKey.toKey(path); + const result = object[path]; + if (result === void 0) return defaultValue; + return result; + } + default: { + if (Array.isArray(path)) return getWithPath(object, path, defaultValue); + if (Object.is(path?.valueOf(), -0)) path = "-0"; + else path = String(path); + if (require_isUnsafeProperty.isUnsafeProperty(path)) return defaultValue; + const result = object[path]; + if (result === void 0) return defaultValue; + return result; + } + } +} +function getWithPath(object, path, defaultValue) { + if (path.length === 0) return defaultValue; + let current = object; + for (let index = 0; index < path.length; index++) { + if (current == null) return defaultValue; + if (require_isUnsafeProperty.isUnsafeProperty(path[index])) return defaultValue; + current = current[path[index]]; + } + if (current === void 0) return defaultValue; + return current; +} +//#endregion +exports.get = get; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/get.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/get.mjs new file mode 100644 index 0000000000000000000000000000000000000000..be0cc6ee74733b940819dec496415cb8aaea6804 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/get.mjs @@ -0,0 +1,65 @@ +import { isUnsafeProperty } from "../../_internal/isUnsafeProperty.mjs"; +import { isDeepKey } from "../_internal/isDeepKey.mjs"; +import { toKey } from "../_internal/toKey.mjs"; +import { toPath } from "../util/toPath.mjs"; +//#region src/compat/object/get.ts +/** +* Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead. +* +* @param {any} object - The object to query. +* @param {PropertyKey | readonly PropertyKey[]} path - The path of the property to get. +* @param {any} [defaultValue] - The value returned if the resolved value is undefined. +* @returns {any} Returns the resolved value. +* +* @example +* const object = { a: { b: { c: 1 } } }; +* get(object, 'a.b.c'); +* // => 1 +* +* get(object, ['a', 'b', 'c']); +* // => 1 +* +* get(object, 'a.b.d', 'default'); +* // => 'default' +*/ +function get(object, path, defaultValue) { + if (object == null) return defaultValue; + switch (typeof path) { + case "string": { + if (isUnsafeProperty(path)) return defaultValue; + const result = object[path]; + if (result === void 0) if (isDeepKey(path)) return get(object, toPath(path), defaultValue); + else return defaultValue; + return result; + } + case "number": + case "symbol": { + if (typeof path === "number") path = toKey(path); + const result = object[path]; + if (result === void 0) return defaultValue; + return result; + } + default: { + if (Array.isArray(path)) return getWithPath(object, path, defaultValue); + if (Object.is(path?.valueOf(), -0)) path = "-0"; + else path = String(path); + if (isUnsafeProperty(path)) return defaultValue; + const result = object[path]; + if (result === void 0) return defaultValue; + return result; + } + } +} +function getWithPath(object, path, defaultValue) { + if (path.length === 0) return defaultValue; + let current = object; + for (let index = 0; index < path.length; index++) { + if (current == null) return defaultValue; + if (isUnsafeProperty(path[index])) return defaultValue; + current = current[path[index]]; + } + if (current === void 0) return defaultValue; + return current; +} +//#endregion +export { get }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/has.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/has.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..4ce7e7084d4fe787dfe4fdada81146635423b63d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/has.d.mts @@ -0,0 +1,51 @@ +import { PropertyPath } from "../_internal/PropertyPath.mjs"; + +//#region src/compat/object/has.d.ts +/** + * Checks if a given path exists within an object. + * + * @template T + * @template K + * @param {T} object - The object to query. + * @param {K} path - The path to check. + * @returns {object is T & { [P in K]: P extends keyof T ? T[P] : Record extends T ? T[keyof T] : unknown } & { [key: symbol]: unknown }} Returns a type guard indicating if the path exists in the object. + * + * @example + * const obj = { a: 1, b: { c: 2 } }; + * + * if (has(obj, 'a')) { + * console.log(obj.a); // TypeScript knows obj.a exists + * } + * + * if (has(obj, 'b')) { + * console.log(obj.b.c); // TypeScript knows obj.b exists + * } + */ +declare function has(object: T, path: K): object is T & { [P in K]: P extends keyof T ? T[P] : Record extends T ? T[keyof T] : unknown } & { + [key: symbol]: unknown; +}; +/** + * Checks if a given path exists within an object. + * + * @template T + * @param {T} object - The object to query. + * @param {PropertyPath} path - The path to check. This can be a single property key, + * an array of property keys, or a string representing a deep path. + * @returns {boolean} Returns `true` if the path exists in the object, `false` otherwise. + * + * @example + * const obj = { a: { b: { c: 3 } } }; + * + * has(obj, 'a'); // true + * has(obj, ['a', 'b']); // true + * has(obj, ['a', 'b', 'c']); // true + * has(obj, 'a.b.c'); // true + * has(obj, 'a.b.d'); // false + * has(obj, ['a', 'b', 'c', 'd']); // false + * has([], 0); // false + * has([1, 2, 3], 2); // true + * has([1, 2, 3], 5); // false + */ +declare function has(object: T, path: PropertyPath): boolean; +//#endregion +export { has }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/has.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/has.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..31c56ce262d02fc5fae8d4033eb596bf19f08383 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/has.d.ts @@ -0,0 +1,51 @@ +import { PropertyPath } from "../_internal/PropertyPath.js"; + +//#region src/compat/object/has.d.ts +/** + * Checks if a given path exists within an object. + * + * @template T + * @template K + * @param {T} object - The object to query. + * @param {K} path - The path to check. + * @returns {object is T & { [P in K]: P extends keyof T ? T[P] : Record extends T ? T[keyof T] : unknown } & { [key: symbol]: unknown }} Returns a type guard indicating if the path exists in the object. + * + * @example + * const obj = { a: 1, b: { c: 2 } }; + * + * if (has(obj, 'a')) { + * console.log(obj.a); // TypeScript knows obj.a exists + * } + * + * if (has(obj, 'b')) { + * console.log(obj.b.c); // TypeScript knows obj.b exists + * } + */ +declare function has(object: T, path: K): object is T & { [P in K]: P extends keyof T ? T[P] : Record extends T ? T[keyof T] : unknown } & { + [key: symbol]: unknown; +}; +/** + * Checks if a given path exists within an object. + * + * @template T + * @param {T} object - The object to query. + * @param {PropertyPath} path - The path to check. This can be a single property key, + * an array of property keys, or a string representing a deep path. + * @returns {boolean} Returns `true` if the path exists in the object, `false` otherwise. + * + * @example + * const obj = { a: { b: { c: 3 } } }; + * + * has(obj, 'a'); // true + * has(obj, ['a', 'b']); // true + * has(obj, ['a', 'b', 'c']); // true + * has(obj, 'a.b.c'); // true + * has(obj, 'a.b.d'); // false + * has(obj, ['a', 'b', 'c', 'd']); // false + * has([], 0); // false + * has([1, 2, 3], 2); // true + * has([1, 2, 3], 5); // false + */ +declare function has(object: T, path: PropertyPath): boolean; +//#endregion +export { has }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/has.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/has.js new file mode 100644 index 0000000000000000000000000000000000000000..ef90b5351ac72942bf4065be2c72890c97369006 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/has.js @@ -0,0 +1,52 @@ +const require_isDeepKey = require("../_internal/isDeepKey.js"); +const require_toPath = require("../util/toPath.js"); +const require_isIndex = require("../_internal/isIndex.js"); +const require_isArguments = require("../predicate/isArguments.js"); +//#region src/compat/object/has.ts +/** +* Checks if a given path exists within an object. +* +* You can provide the path as a single property key, an array of property keys, +* or a string representing a deep path. +* +* If the path is an index and the object is an array or an arguments object, the function will verify +* if the index is valid and within the bounds of the array or arguments object, even if the array or +* arguments object is sparse (i.e., not all indexes are defined). +* +* @param {any} object - The object to query. +* @param {PropertyKey | readonly PropertyKey[]} path - The path to check. This can be a single property key, +* an array of property keys, or a string representing a deep path. +* @returns {boolean} Returns `true` if the path exists in the object, `false` otherwise. +* +* @example +* +* const obj = { a: { b: { c: 3 } } }; +* +* has(obj, 'a'); // true +* has(obj, ['a', 'b']); // true +* has(obj, ['a', 'b', 'c']); // true +* has(obj, 'a.b.c'); // true +* has(obj, 'a.b.d'); // false +* has(obj, ['a', 'b', 'c', 'd']); // false +* has([], 0); // false +* has([1, 2, 3], 2); // true +* has([1, 2, 3], 5); // false +*/ +function has(object, path) { + let resolvedPath; + if (Array.isArray(path)) resolvedPath = path; + else if (typeof path === "string" && require_isDeepKey.isDeepKey(path) && object?.[path] == null) resolvedPath = require_toPath.toPath(path); + else resolvedPath = [path]; + if (resolvedPath.length === 0) return false; + let current = object; + for (let i = 0; i < resolvedPath.length; i++) { + const key = resolvedPath[i]; + if (current == null || !Object.hasOwn(current, key)) { + if (!((Array.isArray(current) || require_isArguments.isArguments(current)) && require_isIndex.isIndex(key) && key < current.length)) return false; + } + current = current[key]; + } + return true; +} +//#endregion +exports.has = has; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/has.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/has.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f458556d66eb869f286df5b02838a202e42f2074 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/has.mjs @@ -0,0 +1,52 @@ +import { isDeepKey } from "../_internal/isDeepKey.mjs"; +import { toPath } from "../util/toPath.mjs"; +import { isIndex } from "../_internal/isIndex.mjs"; +import { isArguments } from "../predicate/isArguments.mjs"; +//#region src/compat/object/has.ts +/** +* Checks if a given path exists within an object. +* +* You can provide the path as a single property key, an array of property keys, +* or a string representing a deep path. +* +* If the path is an index and the object is an array or an arguments object, the function will verify +* if the index is valid and within the bounds of the array or arguments object, even if the array or +* arguments object is sparse (i.e., not all indexes are defined). +* +* @param {any} object - The object to query. +* @param {PropertyKey | readonly PropertyKey[]} path - The path to check. This can be a single property key, +* an array of property keys, or a string representing a deep path. +* @returns {boolean} Returns `true` if the path exists in the object, `false` otherwise. +* +* @example +* +* const obj = { a: { b: { c: 3 } } }; +* +* has(obj, 'a'); // true +* has(obj, ['a', 'b']); // true +* has(obj, ['a', 'b', 'c']); // true +* has(obj, 'a.b.c'); // true +* has(obj, 'a.b.d'); // false +* has(obj, ['a', 'b', 'c', 'd']); // false +* has([], 0); // false +* has([1, 2, 3], 2); // true +* has([1, 2, 3], 5); // false +*/ +function has(object, path) { + let resolvedPath; + if (Array.isArray(path)) resolvedPath = path; + else if (typeof path === "string" && isDeepKey(path) && object?.[path] == null) resolvedPath = toPath(path); + else resolvedPath = [path]; + if (resolvedPath.length === 0) return false; + let current = object; + for (let i = 0; i < resolvedPath.length; i++) { + const key = resolvedPath[i]; + if (current == null || !Object.hasOwn(current, key)) { + if (!((Array.isArray(current) || isArguments(current)) && isIndex(key) && key < current.length)) return false; + } + current = current[key]; + } + return true; +} +//#endregion +export { has }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/hasIn.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/hasIn.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..696d2d1cb5bb94bb8dec9a5a25240ebd78d6a2bc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/hasIn.d.mts @@ -0,0 +1,44 @@ +import { PropertyPath } from "../_internal/PropertyPath.mjs"; + +//#region src/compat/object/hasIn.d.ts +/** + * Checks if a given path exists in an object, **including inherited properties**. + * + * You can provide the path as a single property key, an array of property keys, + * or a string representing a deep path. + * + * Unlike `has`, which only checks for own properties, `hasIn` also checks for properties + * in the prototype chain. + * + * If the path is an index and the object is an array or an arguments object, the function will verify + * if the index is valid and within the bounds of the array or arguments object, even if the array or + * arguments object is sparse (i.e., not all indexes are defined). + * + * @template T + * @param {T} object - The object to query. + * @param {PropertyPath} path - The path to check. This can be a single property key, + * an array of property keys, or a string representing a deep path. + * @returns {boolean} Returns `true` if the path exists (own or inherited), `false` otherwise. + * + * @example + * + * const obj = { a: { b: { c: 3 } } }; + * + * hasIn(obj, 'a'); // true + * hasIn(obj, ['a', 'b']); // true + * hasIn(obj, ['a', 'b', 'c']); // true + * hasIn(obj, 'a.b.c'); // true + * hasIn(obj, 'a.b.d'); // false + * hasIn(obj, ['a', 'b', 'c', 'd']); // false + * + * // Example with inherited properties: + * function Rectangle() {} + * Rectangle.prototype.area = function() {}; + * + * const rect = new Rectangle(); + * hasIn(rect, 'area'); // true + * has(rect, 'area'); // false - has only checks own properties + */ +declare function hasIn(object: T, path: PropertyPath): boolean; +//#endregion +export { hasIn }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/hasIn.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/hasIn.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fe95b9b2fb8a8c75f572bc0470afab886d0ba9be --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/hasIn.d.ts @@ -0,0 +1,44 @@ +import { PropertyPath } from "../_internal/PropertyPath.js"; + +//#region src/compat/object/hasIn.d.ts +/** + * Checks if a given path exists in an object, **including inherited properties**. + * + * You can provide the path as a single property key, an array of property keys, + * or a string representing a deep path. + * + * Unlike `has`, which only checks for own properties, `hasIn` also checks for properties + * in the prototype chain. + * + * If the path is an index and the object is an array or an arguments object, the function will verify + * if the index is valid and within the bounds of the array or arguments object, even if the array or + * arguments object is sparse (i.e., not all indexes are defined). + * + * @template T + * @param {T} object - The object to query. + * @param {PropertyPath} path - The path to check. This can be a single property key, + * an array of property keys, or a string representing a deep path. + * @returns {boolean} Returns `true` if the path exists (own or inherited), `false` otherwise. + * + * @example + * + * const obj = { a: { b: { c: 3 } } }; + * + * hasIn(obj, 'a'); // true + * hasIn(obj, ['a', 'b']); // true + * hasIn(obj, ['a', 'b', 'c']); // true + * hasIn(obj, 'a.b.c'); // true + * hasIn(obj, 'a.b.d'); // false + * hasIn(obj, ['a', 'b', 'c', 'd']); // false + * + * // Example with inherited properties: + * function Rectangle() {} + * Rectangle.prototype.area = function() {}; + * + * const rect = new Rectangle(); + * hasIn(rect, 'area'); // true + * has(rect, 'area'); // false - has only checks own properties + */ +declare function hasIn(object: T, path: PropertyPath): boolean; +//#endregion +export { hasIn }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/hasIn.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/hasIn.js new file mode 100644 index 0000000000000000000000000000000000000000..bffe8bbfc4fb44ff342cb58997a0b9d9043bf3ce --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/hasIn.js @@ -0,0 +1,62 @@ +const require_isDeepKey = require("../_internal/isDeepKey.js"); +const require_toPath = require("../util/toPath.js"); +const require_isIndex = require("../_internal/isIndex.js"); +const require_isArguments = require("../predicate/isArguments.js"); +//#region src/compat/object/hasIn.ts +/** +* Checks if a given path exists in an object, **including inherited properties**. +* +* You can provide the path as a single property key, an array of property keys, +* or a string representing a deep path. +* +* Unlike `has`, which only checks for own properties, `hasIn` also checks for properties +* in the prototype chain. +* +* If the path is an index and the object is an array or an arguments object, the function will verify +* if the index is valid and within the bounds of the array or arguments object, even if the array or +* arguments object is sparse (i.e., not all indexes are defined). +* +* @template T +* @param {T} object - The object to query. +* @param {PropertyPath} path - The path to check. This can be a single property key, +* an array of property keys, or a string representing a deep path. +* @returns {boolean} Returns `true` if the path exists (own or inherited), `false` otherwise. +* +* @example +* +* const obj = { a: { b: { c: 3 } } }; +* +* hasIn(obj, 'a'); // true +* hasIn(obj, ['a', 'b']); // true +* hasIn(obj, ['a', 'b', 'c']); // true +* hasIn(obj, 'a.b.c'); // true +* hasIn(obj, 'a.b.d'); // false +* hasIn(obj, ['a', 'b', 'c', 'd']); // false +* +* // Example with inherited properties: +* function Rectangle() {} +* Rectangle.prototype.area = function() {}; +* +* const rect = new Rectangle(); +* hasIn(rect, 'area'); // true +* has(rect, 'area'); // false - has only checks own properties +*/ +function hasIn(object, path) { + if (object == null) return false; + let resolvedPath; + if (Array.isArray(path)) resolvedPath = path; + else if (typeof path === "string" && require_isDeepKey.isDeepKey(path) && object[path] == null) resolvedPath = require_toPath.toPath(path); + else resolvedPath = [path]; + if (resolvedPath.length === 0) return false; + let current = object; + for (let i = 0; i < resolvedPath.length; i++) { + const key = resolvedPath[i]; + if (current == null || !(key in Object(current))) { + if (!((Array.isArray(current) || require_isArguments.isArguments(current)) && require_isIndex.isIndex(key) && key < current.length)) return false; + } + current = current[key]; + } + return true; +} +//#endregion +exports.hasIn = hasIn; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/hasIn.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/hasIn.mjs new file mode 100644 index 0000000000000000000000000000000000000000..bef3a46bb2cee878454a0f3a56fb8b55157177f9 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/hasIn.mjs @@ -0,0 +1,62 @@ +import { isDeepKey } from "../_internal/isDeepKey.mjs"; +import { toPath } from "../util/toPath.mjs"; +import { isIndex } from "../_internal/isIndex.mjs"; +import { isArguments } from "../predicate/isArguments.mjs"; +//#region src/compat/object/hasIn.ts +/** +* Checks if a given path exists in an object, **including inherited properties**. +* +* You can provide the path as a single property key, an array of property keys, +* or a string representing a deep path. +* +* Unlike `has`, which only checks for own properties, `hasIn` also checks for properties +* in the prototype chain. +* +* If the path is an index and the object is an array or an arguments object, the function will verify +* if the index is valid and within the bounds of the array or arguments object, even if the array or +* arguments object is sparse (i.e., not all indexes are defined). +* +* @template T +* @param {T} object - The object to query. +* @param {PropertyPath} path - The path to check. This can be a single property key, +* an array of property keys, or a string representing a deep path. +* @returns {boolean} Returns `true` if the path exists (own or inherited), `false` otherwise. +* +* @example +* +* const obj = { a: { b: { c: 3 } } }; +* +* hasIn(obj, 'a'); // true +* hasIn(obj, ['a', 'b']); // true +* hasIn(obj, ['a', 'b', 'c']); // true +* hasIn(obj, 'a.b.c'); // true +* hasIn(obj, 'a.b.d'); // false +* hasIn(obj, ['a', 'b', 'c', 'd']); // false +* +* // Example with inherited properties: +* function Rectangle() {} +* Rectangle.prototype.area = function() {}; +* +* const rect = new Rectangle(); +* hasIn(rect, 'area'); // true +* has(rect, 'area'); // false - has only checks own properties +*/ +function hasIn(object, path) { + if (object == null) return false; + let resolvedPath; + if (Array.isArray(path)) resolvedPath = path; + else if (typeof path === "string" && isDeepKey(path) && object[path] == null) resolvedPath = toPath(path); + else resolvedPath = [path]; + if (resolvedPath.length === 0) return false; + let current = object; + for (let i = 0; i < resolvedPath.length; i++) { + const key = resolvedPath[i]; + if (current == null || !(key in Object(current))) { + if (!((Array.isArray(current) || isArguments(current)) && isIndex(key) && key < current.length)) return false; + } + current = current[key]; + } + return true; +} +//#endregion +export { hasIn }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/invert.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/invert.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..11fee311150cbdb2c6aa0f1a3a251ac6df6e72de --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/invert.d.mts @@ -0,0 +1,14 @@ +//#region src/compat/object/invert.d.ts +/** + * Inverts the keys and values of an object. + * + * @param {object} object - The object to invert. + * @returns {Record} - Returns the new inverted object. + * + * @example + * invert({ a: 1, b: 2, c: 3 }); + * // => { '1': 'a', '2': 'b', '3': 'c' } + */ +declare function invert(object: object): Record; +//#endregion +export { invert }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/invert.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/invert.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..11fee311150cbdb2c6aa0f1a3a251ac6df6e72de --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/invert.d.ts @@ -0,0 +1,14 @@ +//#region src/compat/object/invert.d.ts +/** + * Inverts the keys and values of an object. + * + * @param {object} object - The object to invert. + * @returns {Record} - Returns the new inverted object. + * + * @example + * invert({ a: 1, b: 2, c: 3 }); + * // => { '1': 'a', '2': 'b', '3': 'c' } + */ +declare function invert(object: object): Record; +//#endregion +export { invert }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/invert.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/invert.js new file mode 100644 index 0000000000000000000000000000000000000000..eced54ace1bef15a7f0636bf22b46e873fd8cfd1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/invert.js @@ -0,0 +1,25 @@ +const require_invert = require("../../object/invert.js"); +//#region src/compat/object/invert.ts +/** +* Inverts the keys and values of an object. The keys of the input object become the values of the output object and vice versa. +* +* This function takes an object and creates a new object by inverting its keys and values. If the input object has duplicate values, +* the key of the last occurrence will be used as the value for the new key in the output object. It effectively creates a reverse mapping +* of the input object's key-value pairs. +* +* @template K - Type of the keys in the input object (string, number, symbol) +* @template V - Type of the values in the input object (string, number, symbol) +* @param {Record} obj - The input object whose keys and values are to be inverted +* @returns {Record} - A new object with keys and values inverted +* +* @example +* invert({ a: 1, b: 2, c: 3 }); // { 1: 'a', 2: 'b', 3: 'c' } +* invert({ 1: 'a', 2: 'b', 3: 'c' }); // { a: '1', b: '2', c: '3' } +* invert({ a: 1, 2: 'b', c: 3, 4: 'd' }); // { 1: 'a', b: '2', 3: 'c', d: '4' } +* invert({ a: Symbol('sym1'), b: Symbol('sym2') }); // { [Symbol('sym1')]: 'a', [Symbol('sym2')]: 'b' } +*/ +function invert(obj) { + return require_invert.invert(obj); +} +//#endregion +exports.invert = invert; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/invert.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/invert.mjs new file mode 100644 index 0000000000000000000000000000000000000000..833aaae88db7847ea9e7d4e844c72f15f7baf1ad --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/invert.mjs @@ -0,0 +1,25 @@ +import { invert as invert$1 } from "../../object/invert.mjs"; +//#region src/compat/object/invert.ts +/** +* Inverts the keys and values of an object. The keys of the input object become the values of the output object and vice versa. +* +* This function takes an object and creates a new object by inverting its keys and values. If the input object has duplicate values, +* the key of the last occurrence will be used as the value for the new key in the output object. It effectively creates a reverse mapping +* of the input object's key-value pairs. +* +* @template K - Type of the keys in the input object (string, number, symbol) +* @template V - Type of the values in the input object (string, number, symbol) +* @param {Record} obj - The input object whose keys and values are to be inverted +* @returns {Record} - A new object with keys and values inverted +* +* @example +* invert({ a: 1, b: 2, c: 3 }); // { 1: 'a', 2: 'b', 3: 'c' } +* invert({ 1: 'a', 2: 'b', 3: 'c' }); // { a: '1', b: '2', c: '3' } +* invert({ a: 1, 2: 'b', c: 3, 4: 'd' }); // { 1: 'a', b: '2', 3: 'c', d: '4' } +* invert({ a: Symbol('sym1'), b: Symbol('sym2') }); // { [Symbol('sym1')]: 'a', [Symbol('sym2')]: 'b' } +*/ +function invert(obj) { + return invert$1(obj); +} +//#endregion +export { invert }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/invertBy.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/invertBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..873e4ad6c9d2a850ca94eafc224f06ef6a3a089f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/invertBy.d.mts @@ -0,0 +1,35 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.mjs"; + +//#region src/compat/object/invertBy.d.ts +/** + * Creates a new object that reverses the keys and values of the given object, similar to the invert. + * The values of the new object are arrays of keys that correspond to the value returned by the `iteratee` function. + * + * @param {Record} object - The object to iterate over + * @param {ValueIteratee} [iteratee] - Optional function to transform values into keys + * @returns {Record} An object with transformed values as keys and arrays of original keys as values + * + * @example + * const obj = { a: 1, b: 2, c: 1 }; + * invertBy(obj); // => { '1': ['a', 'c'], '2': ['b'] } + * + * @example + * const obj = { a: 1, b: 2, c: 1 }; + * invertBy(obj, value => `group${value}`); // => { 'group1': ['a', 'c'], 'group2': ['b'] } + */ +declare function invertBy(object: Record | Record | null | undefined, interatee?: ValueIteratee): Record; +/** + * Creates a new object that reverses the keys and values of the given object, similar to the invert. + * The values of the new object are arrays of keys that correspond to the value returned by the `iteratee` function. + * + * @param {T} object - The object to iterate over + * @param {ValueIteratee} [iteratee] - Optional function to transform values into keys + * @returns {Record} An object with transformed values as keys and arrays of original keys as values + * + * @example + * const obj = { foo: { id: 1 }, bar: { id: 2 }, baz: { id: 1 } }; + * invertBy(obj, value => String(value.id)); // => { '1': ['foo', 'baz'], '2': ['bar'] } + */ +declare function invertBy(object: T | null | undefined, interatee?: ValueIteratee): Record; +//#endregion +export { invertBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/invertBy.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/invertBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cc6c6f239b06b5985a42dfd7d2b001b826b9a5db --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/invertBy.d.ts @@ -0,0 +1,35 @@ +import { ValueIteratee } from "../_internal/ValueIteratee.js"; + +//#region src/compat/object/invertBy.d.ts +/** + * Creates a new object that reverses the keys and values of the given object, similar to the invert. + * The values of the new object are arrays of keys that correspond to the value returned by the `iteratee` function. + * + * @param {Record} object - The object to iterate over + * @param {ValueIteratee} [iteratee] - Optional function to transform values into keys + * @returns {Record} An object with transformed values as keys and arrays of original keys as values + * + * @example + * const obj = { a: 1, b: 2, c: 1 }; + * invertBy(obj); // => { '1': ['a', 'c'], '2': ['b'] } + * + * @example + * const obj = { a: 1, b: 2, c: 1 }; + * invertBy(obj, value => `group${value}`); // => { 'group1': ['a', 'c'], 'group2': ['b'] } + */ +declare function invertBy(object: Record | Record | null | undefined, interatee?: ValueIteratee): Record; +/** + * Creates a new object that reverses the keys and values of the given object, similar to the invert. + * The values of the new object are arrays of keys that correspond to the value returned by the `iteratee` function. + * + * @param {T} object - The object to iterate over + * @param {ValueIteratee} [iteratee] - Optional function to transform values into keys + * @returns {Record} An object with transformed values as keys and arrays of original keys as values + * + * @example + * const obj = { foo: { id: 1 }, bar: { id: 2 }, baz: { id: 1 } }; + * invertBy(obj, value => String(value.id)); // => { '1': ['foo', 'baz'], '2': ['bar'] } + */ +declare function invertBy(object: T | null | undefined, interatee?: ValueIteratee): Record; +//#endregion +export { invertBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/invertBy.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/invertBy.js new file mode 100644 index 0000000000000000000000000000000000000000..bc8b50f1df2756de8a62318299327fc63d851e5d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/invertBy.js @@ -0,0 +1,45 @@ +const require_identity = require("../../function/identity.js"); +const require_isNil = require("../../predicate/isNil.js"); +const require_iteratee = require("../util/iteratee.js"); +//#region src/compat/object/invertBy.ts +/** +* Creates a new object that reverses the keys and values of the given object, similar to the invert. +* +* The `iteratee` function specifies how the values are reversed into keys. If no `iteratee` function is provided, the values are used as keys as-is. +* +* The values of the new object are arrays of keys that correspond to the value returned by the `iteratee` function. +* +* @param {Record} object - The object to iterate over. +* @param {(value: V) => string} [iteratee] - Optional. A function that generates a key based on each value in the object. +* If not provided, the function defaults to using the value as a string. +* +* @returns {Record} An object where the keys are generated by the iteratee, and the values +* are arrays of property names (keys) from the input object that correspond to those keys. +* +* @example +* const obj = { a: 1, b: 2, c: 1 }; +* const result = invertBy(obj); +* // result => { '1': ['a', 'c'], '2': ['b'] } +* +* @example +* const obj = { a: 1, b: 2, c: 1 }; +* const result = invertBy(obj, value => `group${value}`); +* // result => { 'group1': ['a', 'c'], 'group2': ['b'] } +*/ +function invertBy(object, iteratee$1) { + const result = {}; + if (require_isNil.isNil(object)) return result; + if (iteratee$1 == null) iteratee$1 = require_identity.identity; + const keys = Object.keys(object); + const getString = require_iteratee.iteratee(iteratee$1); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const value = object[key]; + const valueStr = getString(value); + if (Array.isArray(result[valueStr])) result[valueStr].push(key); + else result[valueStr] = [key]; + } + return result; +} +//#endregion +exports.invertBy = invertBy; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/invertBy.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/invertBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..754d42ba730dec349bb186d83a09ece8e912c30f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/invertBy.mjs @@ -0,0 +1,45 @@ +import { identity } from "../../function/identity.mjs"; +import { isNil } from "../../predicate/isNil.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +//#region src/compat/object/invertBy.ts +/** +* Creates a new object that reverses the keys and values of the given object, similar to the invert. +* +* The `iteratee` function specifies how the values are reversed into keys. If no `iteratee` function is provided, the values are used as keys as-is. +* +* The values of the new object are arrays of keys that correspond to the value returned by the `iteratee` function. +* +* @param {Record} object - The object to iterate over. +* @param {(value: V) => string} [iteratee] - Optional. A function that generates a key based on each value in the object. +* If not provided, the function defaults to using the value as a string. +* +* @returns {Record} An object where the keys are generated by the iteratee, and the values +* are arrays of property names (keys) from the input object that correspond to those keys. +* +* @example +* const obj = { a: 1, b: 2, c: 1 }; +* const result = invertBy(obj); +* // result => { '1': ['a', 'c'], '2': ['b'] } +* +* @example +* const obj = { a: 1, b: 2, c: 1 }; +* const result = invertBy(obj, value => `group${value}`); +* // result => { 'group1': ['a', 'c'], 'group2': ['b'] } +*/ +function invertBy(object, iteratee$1) { + const result = {}; + if (isNil(object)) return result; + if (iteratee$1 == null) iteratee$1 = identity; + const keys = Object.keys(object); + const getString = iteratee(iteratee$1); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const value = object[key]; + const valueStr = getString(value); + if (Array.isArray(result[valueStr])) result[valueStr].push(key); + else result[valueStr] = [key]; + } + return result; +} +//#endregion +export { invertBy }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/keys.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/keys.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..445c8c31c70c4249ae7c4f8f76253d7cf7f2d3e8 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/keys.d.mts @@ -0,0 +1,23 @@ +//#region src/compat/object/keys.d.ts +/** + * Creates an array of the own enumerable property names of `object`. + * + * Non-object values are coerced to objects. + * + * @param {object} object The object to query. + * @returns {string[]} Returns the array of property names. + * @example + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * Foo.prototype.c = 3; + * keys(new Foo); // ['a', 'b'] (iteration order is not guaranteed) + * + * keys('hi'); // ['0', '1'] + * keys([1, 2, 3]); // ['0', '1', '2'] + * keys({ a: 1, b: 2 }); // ['a', 'b'] + */ +declare function keys(object?: any): string[]; +//#endregion +export { keys }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/keys.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/keys.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..445c8c31c70c4249ae7c4f8f76253d7cf7f2d3e8 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/keys.d.ts @@ -0,0 +1,23 @@ +//#region src/compat/object/keys.d.ts +/** + * Creates an array of the own enumerable property names of `object`. + * + * Non-object values are coerced to objects. + * + * @param {object} object The object to query. + * @returns {string[]} Returns the array of property names. + * @example + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * Foo.prototype.c = 3; + * keys(new Foo); // ['a', 'b'] (iteration order is not guaranteed) + * + * keys('hi'); // ['0', '1'] + * keys([1, 2, 3]); // ['0', '1', '2'] + * keys({ a: 1, b: 2 }); // ['a', 'b'] + */ +declare function keys(object?: any): string[]; +//#endregion +export { keys }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/keys.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/keys.js new file mode 100644 index 0000000000000000000000000000000000000000..e8468fe3bafb49ce903b0083e29a9c24ce4b1100 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/keys.js @@ -0,0 +1,49 @@ +const require_isBuffer = require("../../predicate/isBuffer.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_isPrototype = require("../_internal/isPrototype.js"); +const require_isTypedArray = require("../predicate/isTypedArray.js"); +const require_times = require("../util/times.js"); +//#region src/compat/object/keys.ts +/** +* Creates an array of the own enumerable property names of `object`. +* +* Non-object values are coerced to objects. +* +* @param {object} object The object to query. +* @returns {string[]} Returns the array of property names. +* @example +* function Foo() { +* this.a = 1; +* this.b = 2; +* } +* Foo.prototype.c = 3; +* keys(new Foo); // ['a', 'b'] (iteration order is not guaranteed) +* +* keys('hi'); // ['0', '1'] +* keys([1, 2, 3]); // ['0', '1', '2'] +* keys({ a: 1, b: 2 }); // ['a', 'b'] +*/ +function keys(object) { + if (require_isArrayLike.isArrayLike(object)) return arrayLikeKeys(object); + const result = Object.keys(Object(object)); + if (!require_isPrototype.isPrototype(object)) return result; + return result.filter((key) => key !== "constructor"); +} +function arrayLikeKeys(object) { + const indices = require_times.times(object.length, (index) => `${index}`); + const filteredKeys = new Set(indices); + if (require_isBuffer.isBuffer(object)) { + filteredKeys.add("offset"); + filteredKeys.add("parent"); + } + if (require_isTypedArray.isTypedArray(object)) { + filteredKeys.add("buffer"); + filteredKeys.add("byteLength"); + filteredKeys.add("byteOffset"); + } + const inheritedKeys = Object.keys(object).filter((key) => !filteredKeys.has(key)); + if (Array.isArray(object)) return [...indices, ...inheritedKeys]; + return [...indices.filter((index) => Object.hasOwn(object, index)), ...inheritedKeys]; +} +//#endregion +exports.keys = keys; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/keys.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/keys.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9ae8bc4ad502df32cbf55df33949105771f8a5d1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/keys.mjs @@ -0,0 +1,49 @@ +import { isBuffer } from "../../predicate/isBuffer.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { isPrototype } from "../_internal/isPrototype.mjs"; +import { isTypedArray } from "../predicate/isTypedArray.mjs"; +import { times } from "../util/times.mjs"; +//#region src/compat/object/keys.ts +/** +* Creates an array of the own enumerable property names of `object`. +* +* Non-object values are coerced to objects. +* +* @param {object} object The object to query. +* @returns {string[]} Returns the array of property names. +* @example +* function Foo() { +* this.a = 1; +* this.b = 2; +* } +* Foo.prototype.c = 3; +* keys(new Foo); // ['a', 'b'] (iteration order is not guaranteed) +* +* keys('hi'); // ['0', '1'] +* keys([1, 2, 3]); // ['0', '1', '2'] +* keys({ a: 1, b: 2 }); // ['a', 'b'] +*/ +function keys(object) { + if (isArrayLike(object)) return arrayLikeKeys(object); + const result = Object.keys(Object(object)); + if (!isPrototype(object)) return result; + return result.filter((key) => key !== "constructor"); +} +function arrayLikeKeys(object) { + const indices = times(object.length, (index) => `${index}`); + const filteredKeys = new Set(indices); + if (isBuffer(object)) { + filteredKeys.add("offset"); + filteredKeys.add("parent"); + } + if (isTypedArray(object)) { + filteredKeys.add("buffer"); + filteredKeys.add("byteLength"); + filteredKeys.add("byteOffset"); + } + const inheritedKeys = Object.keys(object).filter((key) => !filteredKeys.has(key)); + if (Array.isArray(object)) return [...indices, ...inheritedKeys]; + return [...indices.filter((index) => Object.hasOwn(object, index)), ...inheritedKeys]; +} +//#endregion +export { keys }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/keysIn.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/keysIn.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..14cf25a8776b30a58e7e9bac1b78c79c3b0422f2 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/keysIn.d.mts @@ -0,0 +1,27 @@ +//#region src/compat/object/keysIn.d.ts +/** + * This function retrieves the names of string-keyed properties from an object, including those inherited from its prototype. + * + * - If the value is not an object, it is converted to an object. + * - Array-like objects are treated like arrays. + * - Sparse arrays with some missing indices are treated like dense arrays. + * - If the value is `null` or `undefined`, an empty array is returned. + * - When handling prototype objects, the `constructor` property is excluded from the results. + * + * @param {any} [object] - The object to inspect for keys. + * @returns {string[]} An array of string keys from the object. + * + * @example + * const obj = { a: 1, b: 2 }; + * console.log(keysIn(obj)); // ['a', 'b'] + * + * const arr = [1, 2, 3]; + * console.log(keysIn(arr)); // ['0', '1', '2'] + * + * function Foo() {} + * Foo.prototype.a = 1; + * console.log(keysIn(new Foo())); // ['a'] + */ +declare function keysIn(object?: any): string[]; +//#endregion +export { keysIn }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/keysIn.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/keysIn.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..14cf25a8776b30a58e7e9bac1b78c79c3b0422f2 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/keysIn.d.ts @@ -0,0 +1,27 @@ +//#region src/compat/object/keysIn.d.ts +/** + * This function retrieves the names of string-keyed properties from an object, including those inherited from its prototype. + * + * - If the value is not an object, it is converted to an object. + * - Array-like objects are treated like arrays. + * - Sparse arrays with some missing indices are treated like dense arrays. + * - If the value is `null` or `undefined`, an empty array is returned. + * - When handling prototype objects, the `constructor` property is excluded from the results. + * + * @param {any} [object] - The object to inspect for keys. + * @returns {string[]} An array of string keys from the object. + * + * @example + * const obj = { a: 1, b: 2 }; + * console.log(keysIn(obj)); // ['a', 'b'] + * + * const arr = [1, 2, 3]; + * console.log(keysIn(arr)); // ['0', '1', '2'] + * + * function Foo() {} + * Foo.prototype.a = 1; + * console.log(keysIn(new Foo())); // ['a'] + */ +declare function keysIn(object?: any): string[]; +//#endregion +export { keysIn }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/keysIn.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/keysIn.js new file mode 100644 index 0000000000000000000000000000000000000000..94a18d1323d4b4907a549b1eb60f286b7d39ea50 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/keysIn.js @@ -0,0 +1,66 @@ +const require_isBuffer = require("../../predicate/isBuffer.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_isPrototype = require("../_internal/isPrototype.js"); +const require_isTypedArray = require("../predicate/isTypedArray.js"); +const require_times = require("../util/times.js"); +//#region src/compat/object/keysIn.ts +/** +* This function retrieves the names of string-keyed properties from an object, including those inherited from its prototype. +* +* - If the value is not an object, it is converted to an object. +* - Array-like objects are treated like arrays. +* - Sparse arrays with some missing indices are treated like dense arrays. +* - If the value is `null` or `undefined`, an empty array is returned. +* - When handling prototype objects, the `constructor` property is excluded from the results. +* +* @param {any} [object] - The object to inspect for keys. +* @returns {string[]} An array of string keys from the object. +* +* @example +* const obj = { a: 1, b: 2 }; +* console.log(keysIn(obj)); // ['a', 'b'] +* +* const arr = [1, 2, 3]; +* console.log(keysIn(arr)); // ['0', '1', '2'] +* +* function Foo() {} +* Foo.prototype.a = 1; +* console.log(keysIn(new Foo())); // ['a'] +*/ +function keysIn(object) { + if (object == null) return []; + switch (typeof object) { + case "object": + case "function": + if (require_isArrayLike.isArrayLike(object)) return arrayLikeKeysIn(object); + if (require_isPrototype.isPrototype(object)) return prototypeKeysIn(object); + return keysInImpl(object); + default: return keysInImpl(Object(object)); + } +} +function keysInImpl(object) { + const result = []; + for (const key in object) result.push(key); + return result; +} +function prototypeKeysIn(object) { + return keysInImpl(object).filter((key) => key !== "constructor"); +} +function arrayLikeKeysIn(object) { + const indices = require_times.times(object.length, (index) => `${index}`); + const filteredKeys = new Set(indices); + if (require_isBuffer.isBuffer(object)) { + filteredKeys.add("offset"); + filteredKeys.add("parent"); + } + if (require_isTypedArray.isTypedArray(object)) { + filteredKeys.add("buffer"); + filteredKeys.add("byteLength"); + filteredKeys.add("byteOffset"); + } + const inheritedKeys = keysInImpl(object).filter((key) => !filteredKeys.has(key)); + if (Array.isArray(object)) return [...indices, ...inheritedKeys]; + return [...indices.filter((index) => Object.hasOwn(object, index)), ...inheritedKeys]; +} +//#endregion +exports.keysIn = keysIn; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/keysIn.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/keysIn.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7096102296e817f508ec8b8669ecbfd3107caad2 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/keysIn.mjs @@ -0,0 +1,66 @@ +import { isBuffer } from "../../predicate/isBuffer.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { isPrototype } from "../_internal/isPrototype.mjs"; +import { isTypedArray } from "../predicate/isTypedArray.mjs"; +import { times } from "../util/times.mjs"; +//#region src/compat/object/keysIn.ts +/** +* This function retrieves the names of string-keyed properties from an object, including those inherited from its prototype. +* +* - If the value is not an object, it is converted to an object. +* - Array-like objects are treated like arrays. +* - Sparse arrays with some missing indices are treated like dense arrays. +* - If the value is `null` or `undefined`, an empty array is returned. +* - When handling prototype objects, the `constructor` property is excluded from the results. +* +* @param {any} [object] - The object to inspect for keys. +* @returns {string[]} An array of string keys from the object. +* +* @example +* const obj = { a: 1, b: 2 }; +* console.log(keysIn(obj)); // ['a', 'b'] +* +* const arr = [1, 2, 3]; +* console.log(keysIn(arr)); // ['0', '1', '2'] +* +* function Foo() {} +* Foo.prototype.a = 1; +* console.log(keysIn(new Foo())); // ['a'] +*/ +function keysIn(object) { + if (object == null) return []; + switch (typeof object) { + case "object": + case "function": + if (isArrayLike(object)) return arrayLikeKeysIn(object); + if (isPrototype(object)) return prototypeKeysIn(object); + return keysInImpl(object); + default: return keysInImpl(Object(object)); + } +} +function keysInImpl(object) { + const result = []; + for (const key in object) result.push(key); + return result; +} +function prototypeKeysIn(object) { + return keysInImpl(object).filter((key) => key !== "constructor"); +} +function arrayLikeKeysIn(object) { + const indices = times(object.length, (index) => `${index}`); + const filteredKeys = new Set(indices); + if (isBuffer(object)) { + filteredKeys.add("offset"); + filteredKeys.add("parent"); + } + if (isTypedArray(object)) { + filteredKeys.add("buffer"); + filteredKeys.add("byteLength"); + filteredKeys.add("byteOffset"); + } + const inheritedKeys = keysInImpl(object).filter((key) => !filteredKeys.has(key)); + if (Array.isArray(object)) return [...indices, ...inheritedKeys]; + return [...indices.filter((index) => Object.hasOwn(object, index)), ...inheritedKeys]; +} +//#endregion +export { keysIn }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/mapKeys.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/mapKeys.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..303046ec5f344899e1f11909e6ae3794c1eab784 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/mapKeys.d.mts @@ -0,0 +1,32 @@ +import { ListIteratee } from "../_internal/ListIteratee.mjs"; +import { ObjectIteratee } from "../_internal/ObjectIteratee.mjs"; + +//#region src/compat/object/mapKeys.d.ts +/** + * Creates an object with the same values as `object` and keys generated by running each own enumerable string keyed property through `iteratee`. + * + * @template T + * @param {ArrayLike | null | undefined} object - The object to iterate over. + * @param {ValueIteratee} [iteratee] - The function invoked per iteration. + * @returns {Record} - Returns the new mapped object. + * + * @example + * mapKeys([1, 2, 3], (value, index) => `key${index}`); + * // => { 'key0': 1, 'key1': 2, 'key2': 3 } + */ +declare function mapKeys(object: ArrayLike | null | undefined, iteratee?: ListIteratee): Record; +/** + * Creates an object with the same values as `object` and keys generated by running each own enumerable string keyed property through `iteratee`. + * + * @template T + * @param {T | null | undefined} object - The object to iterate over. + * @param {ValueIteratee} [iteratee] - The function invoked per iteration. + * @returns {Record} - Returns the new mapped object. + * + * @example + * mapKeys({ a: 1, b: 2 }, (value, key) => key + value); + * // => { 'a1': 1, 'b2': 2 } + */ +declare function mapKeys(object: T | null | undefined, iteratee?: ObjectIteratee): Record; +//#endregion +export { mapKeys }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/mapKeys.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/mapKeys.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c2361caa30570012d9d0fa1d17987e92ba5fd568 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/mapKeys.d.ts @@ -0,0 +1,32 @@ +import { ListIteratee } from "../_internal/ListIteratee.js"; +import { ObjectIteratee } from "../_internal/ObjectIteratee.js"; + +//#region src/compat/object/mapKeys.d.ts +/** + * Creates an object with the same values as `object` and keys generated by running each own enumerable string keyed property through `iteratee`. + * + * @template T + * @param {ArrayLike | null | undefined} object - The object to iterate over. + * @param {ValueIteratee} [iteratee] - The function invoked per iteration. + * @returns {Record} - Returns the new mapped object. + * + * @example + * mapKeys([1, 2, 3], (value, index) => `key${index}`); + * // => { 'key0': 1, 'key1': 2, 'key2': 3 } + */ +declare function mapKeys(object: ArrayLike | null | undefined, iteratee?: ListIteratee): Record; +/** + * Creates an object with the same values as `object` and keys generated by running each own enumerable string keyed property through `iteratee`. + * + * @template T + * @param {T | null | undefined} object - The object to iterate over. + * @param {ValueIteratee} [iteratee] - The function invoked per iteration. + * @returns {Record} - Returns the new mapped object. + * + * @example + * mapKeys({ a: 1, b: 2 }, (value, key) => key + value); + * // => { 'a1': 1, 'b2': 2 } + */ +declare function mapKeys(object: T | null | undefined, iteratee?: ObjectIteratee): Record; +//#endregion +export { mapKeys }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/mapKeys.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/mapKeys.js new file mode 100644 index 0000000000000000000000000000000000000000..b128c56c47599afd86c8a8b5fe80175bc9799051 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/mapKeys.js @@ -0,0 +1,28 @@ +const require_identity = require("../../function/identity.js"); +const require_mapKeys = require("../../object/mapKeys.js"); +const require_iteratee = require("../util/iteratee.js"); +//#region src/compat/object/mapKeys.ts +/** +* Creates a new object with the same values as the given object, but with keys generated +* by running each own enumerable property of the object through the iteratee function. +* +* @template T - The type of the object. +* @template K1 - The type of the keys in the object. +* @template K2 - The type of the new keys generated by the iteratee function. +* +* @param {T} object - The object to iterate over. +* @param {(value: T[K1], key: K1, object: T) => K2} [getNewKey] - The function invoked per own enumerable property, or a path to generate new keys. +* @returns {Record} - Returns the new mapped object. +* +* @example +* // Example usage: +* const obj = { a: 1, b: 2 }; +* const result = mapKeys(obj, (value, key) => key + value); +* console.log(result); // { a1: 1, b2: 2 } +*/ +function mapKeys(object, getNewKey = require_identity.identity) { + if (object == null) return {}; + return require_mapKeys.mapKeys(object, require_iteratee.iteratee(getNewKey)); +} +//#endregion +exports.mapKeys = mapKeys; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/mapKeys.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/mapKeys.mjs new file mode 100644 index 0000000000000000000000000000000000000000..dfe28147d617b736fbdf59d541e597fedda7baaa --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/mapKeys.mjs @@ -0,0 +1,28 @@ +import { identity } from "../../function/identity.mjs"; +import { mapKeys as mapKeys$1 } from "../../object/mapKeys.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +//#region src/compat/object/mapKeys.ts +/** +* Creates a new object with the same values as the given object, but with keys generated +* by running each own enumerable property of the object through the iteratee function. +* +* @template T - The type of the object. +* @template K1 - The type of the keys in the object. +* @template K2 - The type of the new keys generated by the iteratee function. +* +* @param {T} object - The object to iterate over. +* @param {(value: T[K1], key: K1, object: T) => K2} [getNewKey] - The function invoked per own enumerable property, or a path to generate new keys. +* @returns {Record} - Returns the new mapped object. +* +* @example +* // Example usage: +* const obj = { a: 1, b: 2 }; +* const result = mapKeys(obj, (value, key) => key + value); +* console.log(result); // { a1: 1, b2: 2 } +*/ +function mapKeys(object, getNewKey = identity) { + if (object == null) return {}; + return mapKeys$1(object, iteratee(getNewKey)); +} +//#endregion +export { mapKeys }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/mapValues.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/mapValues.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..17f4b5237a2d7dad593f5b9bbbf0c4f4a3ef7c64 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/mapValues.d.mts @@ -0,0 +1,125 @@ +import { ArrayIterator } from "../_internal/ArrayIterator.mjs"; +import { ObjectIterator } from "../_internal/ObjectIterator.mjs"; +import { StringIterator } from "../_internal/StringIterator.mjs"; + +//#region src/compat/object/mapValues.d.ts +/** + * Creates a new object by mapping each character in a string to a value. + * @param obj - The string to iterate over + * @param callback - The function invoked per character + * @returns A new object with numeric keys and mapped values + * @example + * mapValues('abc', (char) => char.toUpperCase()) + * // => { '0': 'A', '1': 'B', '2': 'C' } + */ +declare function mapValues(obj: string | null | undefined, callback: StringIterator): Record; +/** + * Creates a new object by mapping each element in an array to a value. + * @param array - The array to iterate over + * @param callback - The function invoked per element + * @returns A new object with numeric keys and mapped values + * @example + * mapValues([1, 2], (num) => num * 2) + * // => { '0': 2, '1': 4 } + */ +declare function mapValues(array: T[], callback: ArrayIterator): Record; +/** + * Creates a new object by mapping each property value in an object to a new value. + * @param obj - The object to iterate over + * @param callback - The function invoked per property + * @returns A new object with the same keys and mapped values + * @example + * mapValues({ a: 1, b: 2 }, (num) => num * 2) + * // => { a: 2, b: 4 } + */ +declare function mapValues(obj: T | null | undefined, callback: ObjectIterator): { [P in keyof T]: U }; +/** + * Creates a new object by checking each value against a matcher object. + * @param obj - The object to iterate over + * @param iteratee - The object to match against + * @returns A new object with boolean values indicating matches + * @example + * mapValues({ a: { x: 1 }, b: { x: 2 } }, { x: 2 }) + * // => { a: false, b: true } + */ +declare function mapValues(obj: Record | Record | null | undefined, iteratee: object): Record; +/** + * Creates a new object by checking each value against a matcher object. + * @param obj - The object to iterate over + * @param iteratee - The object to match against + * @returns A new object with boolean values indicating matches + * @example + * mapValues({ a: { x: 1 }, b: { x: 2 } }, { x: 2 }) + * // => { a: false, b: true } + */ +declare function mapValues(obj: T | null | undefined, iteratee: object): { [P in keyof T]: boolean }; +/** + * Creates a new object by extracting a property from each value. + * @param obj - The object to iterate over + * @param iteratee - The property key to extract + * @returns A new object with extracted property values + * @example + * mapValues({ a: { x: 1 }, b: { x: 2 } }, 'x') + * // => { a: 1, b: 2 } + */ +declare function mapValues(obj: Record | Record | null | undefined, iteratee: K): Record; +/** + * Creates a new object by extracting values at a path from each value. + * @param obj - The object to iterate over + * @param iteratee - The path to extract + * @returns A new object with extracted values + * @example + * mapValues({ a: { x: { y: 1 } }, b: { x: { y: 2 } } }, 'x.y') + * // => { a: 1, b: 2 } + */ +declare function mapValues(obj: Record | Record | null | undefined, iteratee: string): Record; +/** + * Creates a new object by extracting values at a path from each value. + * @param obj - The object to iterate over + * @param iteratee - The path to extract + * @returns A new object with extracted values + * @example + * mapValues({ a: { x: { y: 1 } }, b: { x: { y: 2 } } }, 'x.y') + * // => { a: 1, b: 2 } + */ +declare function mapValues(obj: T | null | undefined, iteratee: string): { [P in keyof T]: any }; +/** + * Creates a new object from a string using identity function. + * @param obj - The string to convert + * @returns A new object with characters as values + * @example + * mapValues('abc') + * // => { '0': 'a', '1': 'b', '2': 'c' } + */ +declare function mapValues(obj: string | null | undefined): Record; +/** + * Creates a new object using identity function. + * @param obj - The object to clone + * @returns A new object with the same values + * @example + * mapValues({ a: 1, b: 2 }) + * // => { a: 1, b: 2 } + */ +declare function mapValues(obj: Record | Record | null | undefined): Record; +/** + * Creates a new object using identity function. + * @param obj - The object to clone + * @returns A new object with the same values + * @example + * mapValues({ a: 1, b: 2 }) + * // => { a: 1, b: 2 } + */ +declare function mapValues(obj: T): T; +/** + * Creates a new object using identity function. + * @param obj - The object to clone + * @returns A new object with the same values, or empty object if input is null/undefined + * @example + * mapValues({ a: 1, b: 2 }) + * // => { a: 1, b: 2 } + * mapValues(null) + * // => {} + */ +declare function mapValues(obj: T | null | undefined): Partial; +//#endregion +export { mapValues }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/mapValues.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/mapValues.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d806a02e7e07ca3f86763f18db6da49dd60a7791 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/mapValues.d.ts @@ -0,0 +1,125 @@ +import { ArrayIterator } from "../_internal/ArrayIterator.js"; +import { ObjectIterator } from "../_internal/ObjectIterator.js"; +import { StringIterator } from "../_internal/StringIterator.js"; + +//#region src/compat/object/mapValues.d.ts +/** + * Creates a new object by mapping each character in a string to a value. + * @param obj - The string to iterate over + * @param callback - The function invoked per character + * @returns A new object with numeric keys and mapped values + * @example + * mapValues('abc', (char) => char.toUpperCase()) + * // => { '0': 'A', '1': 'B', '2': 'C' } + */ +declare function mapValues(obj: string | null | undefined, callback: StringIterator): Record; +/** + * Creates a new object by mapping each element in an array to a value. + * @param array - The array to iterate over + * @param callback - The function invoked per element + * @returns A new object with numeric keys and mapped values + * @example + * mapValues([1, 2], (num) => num * 2) + * // => { '0': 2, '1': 4 } + */ +declare function mapValues(array: T[], callback: ArrayIterator): Record; +/** + * Creates a new object by mapping each property value in an object to a new value. + * @param obj - The object to iterate over + * @param callback - The function invoked per property + * @returns A new object with the same keys and mapped values + * @example + * mapValues({ a: 1, b: 2 }, (num) => num * 2) + * // => { a: 2, b: 4 } + */ +declare function mapValues(obj: T | null | undefined, callback: ObjectIterator): { [P in keyof T]: U }; +/** + * Creates a new object by checking each value against a matcher object. + * @param obj - The object to iterate over + * @param iteratee - The object to match against + * @returns A new object with boolean values indicating matches + * @example + * mapValues({ a: { x: 1 }, b: { x: 2 } }, { x: 2 }) + * // => { a: false, b: true } + */ +declare function mapValues(obj: Record | Record | null | undefined, iteratee: object): Record; +/** + * Creates a new object by checking each value against a matcher object. + * @param obj - The object to iterate over + * @param iteratee - The object to match against + * @returns A new object with boolean values indicating matches + * @example + * mapValues({ a: { x: 1 }, b: { x: 2 } }, { x: 2 }) + * // => { a: false, b: true } + */ +declare function mapValues(obj: T | null | undefined, iteratee: object): { [P in keyof T]: boolean }; +/** + * Creates a new object by extracting a property from each value. + * @param obj - The object to iterate over + * @param iteratee - The property key to extract + * @returns A new object with extracted property values + * @example + * mapValues({ a: { x: 1 }, b: { x: 2 } }, 'x') + * // => { a: 1, b: 2 } + */ +declare function mapValues(obj: Record | Record | null | undefined, iteratee: K): Record; +/** + * Creates a new object by extracting values at a path from each value. + * @param obj - The object to iterate over + * @param iteratee - The path to extract + * @returns A new object with extracted values + * @example + * mapValues({ a: { x: { y: 1 } }, b: { x: { y: 2 } } }, 'x.y') + * // => { a: 1, b: 2 } + */ +declare function mapValues(obj: Record | Record | null | undefined, iteratee: string): Record; +/** + * Creates a new object by extracting values at a path from each value. + * @param obj - The object to iterate over + * @param iteratee - The path to extract + * @returns A new object with extracted values + * @example + * mapValues({ a: { x: { y: 1 } }, b: { x: { y: 2 } } }, 'x.y') + * // => { a: 1, b: 2 } + */ +declare function mapValues(obj: T | null | undefined, iteratee: string): { [P in keyof T]: any }; +/** + * Creates a new object from a string using identity function. + * @param obj - The string to convert + * @returns A new object with characters as values + * @example + * mapValues('abc') + * // => { '0': 'a', '1': 'b', '2': 'c' } + */ +declare function mapValues(obj: string | null | undefined): Record; +/** + * Creates a new object using identity function. + * @param obj - The object to clone + * @returns A new object with the same values + * @example + * mapValues({ a: 1, b: 2 }) + * // => { a: 1, b: 2 } + */ +declare function mapValues(obj: Record | Record | null | undefined): Record; +/** + * Creates a new object using identity function. + * @param obj - The object to clone + * @returns A new object with the same values + * @example + * mapValues({ a: 1, b: 2 }) + * // => { a: 1, b: 2 } + */ +declare function mapValues(obj: T): T; +/** + * Creates a new object using identity function. + * @param obj - The object to clone + * @returns A new object with the same values, or empty object if input is null/undefined + * @example + * mapValues({ a: 1, b: 2 }) + * // => { a: 1, b: 2 } + * mapValues(null) + * // => {} + */ +declare function mapValues(obj: T | null | undefined): Partial; +//#endregion +export { mapValues }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/mapValues.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/mapValues.js new file mode 100644 index 0000000000000000000000000000000000000000..f50d6b9ff5fceccef89b221c0b44302c1ad9c74b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/mapValues.js @@ -0,0 +1,29 @@ +const require_identity = require("../../function/identity.js"); +const require_mapValues = require("../../object/mapValues.js"); +const require_iteratee = require("../util/iteratee.js"); +//#region src/compat/object/mapValues.ts +/** +* Creates a new object with the same keys as the given object, but with values generated +* by running each own enumerable property of the object through the iteratee function. +* +* @template T - The type of the object. +* @template K - The type of the keys in the object. +* @template V - The type of the new values generated by the iteratee function. +* +* @param {T} object - The object to iterate over. +* @param {(value: T[K], key: K, object: T) => V | PropertyKey | readonly PropertyKey[] | null | undefined} [getNewValue] - +* The function invoked per own enumerable property, or a path to generate new values. +* @returns {Record} - Returns the new mapped object. +* +* @example +* // Example usage: +* const obj = { a: 1, b: 2 }; +* const result = mapValues(obj, (value) => value * 2); +* console.log(result); // { a: 2, b: 4 } +*/ +function mapValues(object, getNewValue = require_identity.identity) { + if (object == null) return {}; + return require_mapValues.mapValues(object, require_iteratee.iteratee(getNewValue)); +} +//#endregion +exports.mapValues = mapValues; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/mapValues.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/mapValues.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c1b4b0da0758059c044a05c958619136dd8ad813 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/mapValues.mjs @@ -0,0 +1,29 @@ +import { identity } from "../../function/identity.mjs"; +import { mapValues as mapValues$1 } from "../../object/mapValues.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +//#region src/compat/object/mapValues.ts +/** +* Creates a new object with the same keys as the given object, but with values generated +* by running each own enumerable property of the object through the iteratee function. +* +* @template T - The type of the object. +* @template K - The type of the keys in the object. +* @template V - The type of the new values generated by the iteratee function. +* +* @param {T} object - The object to iterate over. +* @param {(value: T[K], key: K, object: T) => V | PropertyKey | readonly PropertyKey[] | null | undefined} [getNewValue] - +* The function invoked per own enumerable property, or a path to generate new values. +* @returns {Record} - Returns the new mapped object. +* +* @example +* // Example usage: +* const obj = { a: 1, b: 2 }; +* const result = mapValues(obj, (value) => value * 2); +* console.log(result); // { a: 2, b: 4 } +*/ +function mapValues(object, getNewValue = identity) { + if (object == null) return {}; + return mapValues$1(object, iteratee(getNewValue)); +} +//#endregion +export { mapValues }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/merge.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/merge.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..059daa9203c62bdf50fb4ebbab036f292e19968d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/merge.d.mts @@ -0,0 +1,85 @@ +//#region src/compat/object/merge.d.ts +/** + * Recursively merges own and inherited enumerable string keyed properties of source objects into the destination object. + * + * @template T + * @template U + * @param {T} object - The destination object. + * @param {U} source - The source object. + * @returns {T & U} - Returns `object`. + * + * @example + * const object = { a: [{ b: 2 }, { d: 4 }] }; + * const other = { a: [{ c: 3 }, { e: 5 }] }; + * merge(object, other); + * // => { a: [{ b: 2, c: 3 }, { d: 4, e: 5 }] } + */ +declare function merge(object: T, source: U): T & U; +/** + * Recursively merges own and inherited enumerable string keyed properties of source objects into the destination object. + * + * @template T + * @template U + * @template V + * @param {T} object - The destination object. + * @param {U} source1 - The first source object. + * @param {V} source2 - The second source object. + * @returns {T & U & V} - Returns `object`. + * + * @example + * merge({ a: 1 }, { b: 2 }, { c: 3 }); + * // => { a: 1, b: 2, c: 3 } + */ +declare function merge(object: T, source1: U, source2: V): T & U & V; +/** + * Recursively merges own and inherited enumerable string keyed properties of source objects into the destination object. + * + * @template T + * @template U + * @template V + * @template W + * @param {T} object - The destination object. + * @param {U} source1 - The first source object. + * @param {V} source2 - The second source object. + * @param {W} source3 - The third source object. + * @returns {T & U & V & W} - Returns `object`. + * + * @example + * merge({ a: 1 }, { b: 2 }, { c: 3 }, { d: 4 }); + * // => { a: 1, b: 2, c: 3, d: 4 } + */ +declare function merge(object: T, source1: U, source2: V, source3: W): T & U & V & W; +/** + * Recursively merges own and inherited enumerable string keyed properties of source objects into the destination object. + * + * @template T + * @template U + * @template V + * @template W + * @template X + * @param {T} object - The destination object. + * @param {U} source1 - The first source object. + * @param {V} source2 - The second source object. + * @param {W} source3 - The third source object. + * @param {X} source4 - The fourth source object. + * @returns {T & U & V & W & X} - Returns `object`. + * + * @example + * merge({ a: 1 }, { b: 2 }, { c: 3 }, { d: 4 }, { e: 5 }); + * // => { a: 1, b: 2, c: 3, d: 4, e: 5 } + */ +declare function merge(object: T, source1: U, source2: V, source3: W, source4: X): T & U & V & W & X; +/** + * Recursively merges own and inherited enumerable string keyed properties of source objects into the destination object. + * + * @param {any} object - The destination object. + * @param {...any[]} otherArgs - The source objects. + * @returns {any} - Returns `object`. + * + * @example + * merge({ a: 1 }, { b: 2 }, { c: 3 }); + * // => { a: 1, b: 2, c: 3 } + */ +declare function merge(object: any, ...otherArgs: any[]): any; +//#endregion +export { merge }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/merge.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/merge.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..059daa9203c62bdf50fb4ebbab036f292e19968d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/merge.d.ts @@ -0,0 +1,85 @@ +//#region src/compat/object/merge.d.ts +/** + * Recursively merges own and inherited enumerable string keyed properties of source objects into the destination object. + * + * @template T + * @template U + * @param {T} object - The destination object. + * @param {U} source - The source object. + * @returns {T & U} - Returns `object`. + * + * @example + * const object = { a: [{ b: 2 }, { d: 4 }] }; + * const other = { a: [{ c: 3 }, { e: 5 }] }; + * merge(object, other); + * // => { a: [{ b: 2, c: 3 }, { d: 4, e: 5 }] } + */ +declare function merge(object: T, source: U): T & U; +/** + * Recursively merges own and inherited enumerable string keyed properties of source objects into the destination object. + * + * @template T + * @template U + * @template V + * @param {T} object - The destination object. + * @param {U} source1 - The first source object. + * @param {V} source2 - The second source object. + * @returns {T & U & V} - Returns `object`. + * + * @example + * merge({ a: 1 }, { b: 2 }, { c: 3 }); + * // => { a: 1, b: 2, c: 3 } + */ +declare function merge(object: T, source1: U, source2: V): T & U & V; +/** + * Recursively merges own and inherited enumerable string keyed properties of source objects into the destination object. + * + * @template T + * @template U + * @template V + * @template W + * @param {T} object - The destination object. + * @param {U} source1 - The first source object. + * @param {V} source2 - The second source object. + * @param {W} source3 - The third source object. + * @returns {T & U & V & W} - Returns `object`. + * + * @example + * merge({ a: 1 }, { b: 2 }, { c: 3 }, { d: 4 }); + * // => { a: 1, b: 2, c: 3, d: 4 } + */ +declare function merge(object: T, source1: U, source2: V, source3: W): T & U & V & W; +/** + * Recursively merges own and inherited enumerable string keyed properties of source objects into the destination object. + * + * @template T + * @template U + * @template V + * @template W + * @template X + * @param {T} object - The destination object. + * @param {U} source1 - The first source object. + * @param {V} source2 - The second source object. + * @param {W} source3 - The third source object. + * @param {X} source4 - The fourth source object. + * @returns {T & U & V & W & X} - Returns `object`. + * + * @example + * merge({ a: 1 }, { b: 2 }, { c: 3 }, { d: 4 }, { e: 5 }); + * // => { a: 1, b: 2, c: 3, d: 4, e: 5 } + */ +declare function merge(object: T, source1: U, source2: V, source3: W, source4: X): T & U & V & W & X; +/** + * Recursively merges own and inherited enumerable string keyed properties of source objects into the destination object. + * + * @param {any} object - The destination object. + * @param {...any[]} otherArgs - The source objects. + * @returns {any} - Returns `object`. + * + * @example + * merge({ a: 1 }, { b: 2 }, { c: 3 }); + * // => { a: 1, b: 2, c: 3 } + */ +declare function merge(object: any, ...otherArgs: any[]): any; +//#endregion +export { merge }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/merge.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/merge.js new file mode 100644 index 0000000000000000000000000000000000000000..eddfa72663586187de6cd6d024b81f9e6755c7fc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/merge.js @@ -0,0 +1,45 @@ +const require_noop = require("../../function/noop.js"); +const require_mergeWith = require("./mergeWith.js"); +//#region src/compat/object/merge.ts +/** +* Merges the properties of one or more source objects into the target object. +* +* This function performs a deep merge, recursively merging nested objects and arrays. +* If a property in the source object is an array or object and the corresponding property in the target object is also an array or object, they will be merged. +* If a property in the source object is `undefined`, it will not overwrite a defined property in the target object. +* +* The function can handle multiple source objects and will merge them all into the target object. +* +* @param {any} object - The target object into which the source object properties will be merged. This object is modified in place. +* @param {any[]} sources - The source objects whose properties will be merged into the target object. +* @returns {any} The updated target object with properties from the source object(s) merged in. +* +* @example +* const target = { a: 1, b: { x: 1, y: 2 } }; +* const source = { b: { y: 3, z: 4 }, c: 5 }; +* +* const result = merge(target, source); +* console.log(result); +* // Output: { a: 1, b: { x: 1, y: 3, z: 4 }, c: 5 } +* +* @example +* const target = { a: [1, 2], b: { x: 1 } }; +* const source = { a: [3], b: { y: 2 } }; +* +* const result = merge(target, source); +* console.log(result); +* // Output: { a: [3], b: { x: 1, y: 2 } } +* +* @example +* const target = { a: null }; +* const source = { a: [1, 2, 3] }; +* +* const result = merge(target, source); +* console.log(result); +* // Output: { a: [1, 2, 3] } +*/ +function merge(object, ...sources) { + return require_mergeWith.mergeWith(object, ...sources, require_noop.noop); +} +//#endregion +exports.merge = merge; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/merge.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/merge.mjs new file mode 100644 index 0000000000000000000000000000000000000000..78f293a37914ec45578da39d6d8b24e5c71769ac --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/merge.mjs @@ -0,0 +1,45 @@ +import { noop } from "../../function/noop.mjs"; +import { mergeWith } from "./mergeWith.mjs"; +//#region src/compat/object/merge.ts +/** +* Merges the properties of one or more source objects into the target object. +* +* This function performs a deep merge, recursively merging nested objects and arrays. +* If a property in the source object is an array or object and the corresponding property in the target object is also an array or object, they will be merged. +* If a property in the source object is `undefined`, it will not overwrite a defined property in the target object. +* +* The function can handle multiple source objects and will merge them all into the target object. +* +* @param {any} object - The target object into which the source object properties will be merged. This object is modified in place. +* @param {any[]} sources - The source objects whose properties will be merged into the target object. +* @returns {any} The updated target object with properties from the source object(s) merged in. +* +* @example +* const target = { a: 1, b: { x: 1, y: 2 } }; +* const source = { b: { y: 3, z: 4 }, c: 5 }; +* +* const result = merge(target, source); +* console.log(result); +* // Output: { a: 1, b: { x: 1, y: 3, z: 4 }, c: 5 } +* +* @example +* const target = { a: [1, 2], b: { x: 1 } }; +* const source = { a: [3], b: { y: 2 } }; +* +* const result = merge(target, source); +* console.log(result); +* // Output: { a: [3], b: { x: 1, y: 2 } } +* +* @example +* const target = { a: null }; +* const source = { a: [1, 2, 3] }; +* +* const result = merge(target, source); +* console.log(result); +* // Output: { a: [1, 2, 3] } +*/ +function merge(object, ...sources) { + return mergeWith(object, ...sources, noop); +} +//#endregion +export { merge }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/mergeWith.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/mergeWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0d7af1044baffc6ca259cf1e5d1da9ed3732e611 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/mergeWith.d.mts @@ -0,0 +1,126 @@ +//#region src/compat/object/mergeWith.d.ts +type MergeWithCustomizer = (objValue: any, srcValue: any, key: string, object: any, source: any, stack: any) => any; +/** + * Merges the properties of a source object into the target object using a customizer function. + * + * @template TObject + * @template TSource + * @param {TObject} object - The target object into which the source object properties will be merged. + * @param {TSource} source - The source object whose properties will be merged into the target object. + * @param {MergeWithCustomizer} customizer - The function to customize assigned values. + * @returns {TObject & TSource} Returns the updated target object with properties from the source object merged in. + * + * @example + * const target = { a: 1, b: 2 }; + * const source = { b: 3, c: 4 }; + * + * const result = mergeWith(target, source, (objValue, srcValue) => { + * if (typeof objValue === 'number' && typeof srcValue === 'number') { + * return objValue + srcValue; + * } + * }); + * // => { a: 1, b: 5, c: 4 } + */ +declare function mergeWith(object: TObject, source: TSource, customizer: MergeWithCustomizer): TObject & TSource; +/** + * Merges the properties of two source objects into the target object using a customizer function. + * + * @template TObject + * @template TSource1 + * @template TSource2 + * @param {TObject} object - The target object into which the source objects properties will be merged. + * @param {TSource1} source1 - The first source object. + * @param {TSource2} source2 - The second source object. + * @param {MergeWithCustomizer} customizer - The function to customize assigned values. + * @returns {TObject & TSource1 & TSource2} Returns the updated target object with properties from the source objects merged in. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * + * const result = mergeWith(target, source1, source2, (objValue, srcValue) => { + * if (typeof objValue === 'number' && typeof srcValue === 'number') { + * return objValue + srcValue; + * } + * }); + * // => { a: 1, b: 2, c: 3 } + */ +declare function mergeWith(object: TObject, source1: TSource1, source2: TSource2, customizer: MergeWithCustomizer): TObject & TSource1 & TSource2; +/** + * Merges the properties of three source objects into the target object using a customizer function. + * + * @template TObject + * @template TSource1 + * @template TSource2 + * @template TSource3 + * @param {TObject} object - The target object into which the source objects properties will be merged. + * @param {TSource1} source1 - The first source object. + * @param {TSource2} source2 - The second source object. + * @param {TSource3} source3 - The third source object. + * @param {MergeWithCustomizer} customizer - The function to customize assigned values. + * @returns {TObject & TSource1 & TSource2 & TSource3} Returns the updated target object with properties from the source objects merged in. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const source3 = { d: 4 }; + * + * const result = mergeWith(target, source1, source2, source3, (objValue, srcValue) => { + * if (typeof objValue === 'number' && typeof srcValue === 'number') { + * return objValue + srcValue; + * } + * }); + * // => { a: 1, b: 2, c: 3, d: 4 } + */ +declare function mergeWith(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, customizer: MergeWithCustomizer): TObject & TSource1 & TSource2 & TSource3; +/** + * Merges the properties of four source objects into the target object using a customizer function. + * + * @template TObject + * @template TSource1 + * @template TSource2 + * @template TSource3 + * @template TSource4 + * @param {TObject} object - The target object into which the source objects properties will be merged. + * @param {TSource1} source1 - The first source object. + * @param {TSource2} source2 - The second source object. + * @param {TSource3} source3 - The third source object. + * @param {TSource4} source4 - The fourth source object. + * @param {MergeWithCustomizer} customizer - The function to customize assigned values. + * @returns {TObject & TSource1 & TSource2 & TSource3 & TSource4} Returns the updated target object with properties from the source objects merged in. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const source3 = { d: 4 }; + * const source4 = { e: 5 }; + * + * const result = mergeWith(target, source1, source2, source3, source4, (objValue, srcValue) => { + * if (typeof objValue === 'number' && typeof srcValue === 'number') { + * return objValue + srcValue; + * } + * }); + * // => { a: 1, b: 2, c: 3, d: 4, e: 5 } + */ +declare function mergeWith(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4, customizer: MergeWithCustomizer): TObject & TSource1 & TSource2 & TSource3 & TSource4; +/** + * Merges the properties of one or more source objects into the target object. + * + * @param {any} object - The target object into which the source object properties will be merged. + * @param {...any} otherArgs - Additional source objects to merge into the target object, including the custom `merge` function. + * @returns {any} The updated target object with properties from the source object(s) merged in. + * + * @example + * const target = { a: 1, b: 2 }; + * const source = { b: 3, c: 4 }; + * + * const result = mergeWith(target, source, (objValue, srcValue) => { + * if (typeof objValue === 'number' && typeof srcValue === 'number') { + * return objValue + srcValue; + */ +declare function mergeWith(object: any, ...otherArgs: any[]): any; +//#endregion +export { mergeWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/mergeWith.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/mergeWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0d7af1044baffc6ca259cf1e5d1da9ed3732e611 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/mergeWith.d.ts @@ -0,0 +1,126 @@ +//#region src/compat/object/mergeWith.d.ts +type MergeWithCustomizer = (objValue: any, srcValue: any, key: string, object: any, source: any, stack: any) => any; +/** + * Merges the properties of a source object into the target object using a customizer function. + * + * @template TObject + * @template TSource + * @param {TObject} object - The target object into which the source object properties will be merged. + * @param {TSource} source - The source object whose properties will be merged into the target object. + * @param {MergeWithCustomizer} customizer - The function to customize assigned values. + * @returns {TObject & TSource} Returns the updated target object with properties from the source object merged in. + * + * @example + * const target = { a: 1, b: 2 }; + * const source = { b: 3, c: 4 }; + * + * const result = mergeWith(target, source, (objValue, srcValue) => { + * if (typeof objValue === 'number' && typeof srcValue === 'number') { + * return objValue + srcValue; + * } + * }); + * // => { a: 1, b: 5, c: 4 } + */ +declare function mergeWith(object: TObject, source: TSource, customizer: MergeWithCustomizer): TObject & TSource; +/** + * Merges the properties of two source objects into the target object using a customizer function. + * + * @template TObject + * @template TSource1 + * @template TSource2 + * @param {TObject} object - The target object into which the source objects properties will be merged. + * @param {TSource1} source1 - The first source object. + * @param {TSource2} source2 - The second source object. + * @param {MergeWithCustomizer} customizer - The function to customize assigned values. + * @returns {TObject & TSource1 & TSource2} Returns the updated target object with properties from the source objects merged in. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * + * const result = mergeWith(target, source1, source2, (objValue, srcValue) => { + * if (typeof objValue === 'number' && typeof srcValue === 'number') { + * return objValue + srcValue; + * } + * }); + * // => { a: 1, b: 2, c: 3 } + */ +declare function mergeWith(object: TObject, source1: TSource1, source2: TSource2, customizer: MergeWithCustomizer): TObject & TSource1 & TSource2; +/** + * Merges the properties of three source objects into the target object using a customizer function. + * + * @template TObject + * @template TSource1 + * @template TSource2 + * @template TSource3 + * @param {TObject} object - The target object into which the source objects properties will be merged. + * @param {TSource1} source1 - The first source object. + * @param {TSource2} source2 - The second source object. + * @param {TSource3} source3 - The third source object. + * @param {MergeWithCustomizer} customizer - The function to customize assigned values. + * @returns {TObject & TSource1 & TSource2 & TSource3} Returns the updated target object with properties from the source objects merged in. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const source3 = { d: 4 }; + * + * const result = mergeWith(target, source1, source2, source3, (objValue, srcValue) => { + * if (typeof objValue === 'number' && typeof srcValue === 'number') { + * return objValue + srcValue; + * } + * }); + * // => { a: 1, b: 2, c: 3, d: 4 } + */ +declare function mergeWith(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, customizer: MergeWithCustomizer): TObject & TSource1 & TSource2 & TSource3; +/** + * Merges the properties of four source objects into the target object using a customizer function. + * + * @template TObject + * @template TSource1 + * @template TSource2 + * @template TSource3 + * @template TSource4 + * @param {TObject} object - The target object into which the source objects properties will be merged. + * @param {TSource1} source1 - The first source object. + * @param {TSource2} source2 - The second source object. + * @param {TSource3} source3 - The third source object. + * @param {TSource4} source4 - The fourth source object. + * @param {MergeWithCustomizer} customizer - The function to customize assigned values. + * @returns {TObject & TSource1 & TSource2 & TSource3 & TSource4} Returns the updated target object with properties from the source objects merged in. + * + * @example + * const target = { a: 1 }; + * const source1 = { b: 2 }; + * const source2 = { c: 3 }; + * const source3 = { d: 4 }; + * const source4 = { e: 5 }; + * + * const result = mergeWith(target, source1, source2, source3, source4, (objValue, srcValue) => { + * if (typeof objValue === 'number' && typeof srcValue === 'number') { + * return objValue + srcValue; + * } + * }); + * // => { a: 1, b: 2, c: 3, d: 4, e: 5 } + */ +declare function mergeWith(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3, source4: TSource4, customizer: MergeWithCustomizer): TObject & TSource1 & TSource2 & TSource3 & TSource4; +/** + * Merges the properties of one or more source objects into the target object. + * + * @param {any} object - The target object into which the source object properties will be merged. + * @param {...any} otherArgs - Additional source objects to merge into the target object, including the custom `merge` function. + * @returns {any} The updated target object with properties from the source object(s) merged in. + * + * @example + * const target = { a: 1, b: 2 }; + * const source = { b: 3, c: 4 }; + * + * const result = mergeWith(target, source, (objValue, srcValue) => { + * if (typeof objValue === 'number' && typeof srcValue === 'number') { + * return objValue + srcValue; + */ +declare function mergeWith(object: any, ...otherArgs: any[]): any; +//#endregion +export { mergeWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/mergeWith.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/mergeWith.js new file mode 100644 index 0000000000000000000000000000000000000000..533a3cccef5b4de40d4f46bb674d12ba53f9047c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/mergeWith.js @@ -0,0 +1,111 @@ +const require_isPrimitive = require("../../predicate/isPrimitive.js"); +const require_clone = require("../../object/clone.js"); +const require_getSymbols = require("../_internal/getSymbols.js"); +const require_isBuffer = require("../../predicate/isBuffer.js"); +const require_isUnsafeProperty = require("../../_internal/isUnsafeProperty.js"); +const require_isPlainObject = require("../predicate/isPlainObject.js"); +const require_cloneDeep = require("./cloneDeep.js"); +const require_isArguments = require("../predicate/isArguments.js"); +const require_isObjectLike = require("../predicate/isObjectLike.js"); +const require_isArrayLikeObject = require("../predicate/isArrayLikeObject.js"); +const require_isTypedArray = require("../predicate/isTypedArray.js"); +//#region src/compat/object/mergeWith.ts +/** +* Merges the properties of one or more source objects into the target object using a customizer function. +* +* This function performs a deep merge, recursively merging nested objects and arrays. +* If a property in the source object is an array or object and the corresponding property in the target object is also an array or object, they will be merged. +* If a property in the source object is `undefined`, it will not overwrite a defined property in the target object. +* +* You can provide a custom `merge` function to control how properties are merged. The `merge` function is called for each property that is being merged and receives the following arguments: +* +* - `targetValue`: The current value of the property in the target object. +* - `sourceValue`: The value of the property in the source object. +* - `key`: The key of the property being merged. +* - `target`: The target object. +* - `source`: The source object. +* - `stack`: A `Map` used to keep track of objects that have already been processed to handle circular references. +* +* The `merge` function should return the value to be set in the target object. If it returns `undefined`, a default deep merge will be applied for arrays and objects. +* +* The function can handle multiple source objects and will merge them all into the target object. +* +* @param {any} object - The target object into which the source object properties will be merged. This object is modified in place. +* @param {...any} otherArgs - Additional source objects to merge into the target object, including the custom `merge` function. +* @returns {any} The updated target object with properties from the source object(s) merged in. +* +* @example +* const target = { a: 1, b: 2 }; +* const source = { b: 3, c: 4 }; +* +* mergeWith(target, source, (targetValue, sourceValue) => { +* if (typeof targetValue === 'number' && typeof sourceValue === 'number') { +* return targetValue + sourceValue; +* } +* }); +* // Returns { a: 1, b: 5, c: 4 } +* @example +* const target = { a: [1], b: [2] }; +* const source = { a: [3], b: [4] }; +* +* const result = mergeWith(target, source, (objValue, srcValue) => { +* if (Array.isArray(objValue)) { +* return objValue.concat(srcValue); +* } +* }); +* +* expect(result).toEqual({ a: [1, 3], b: [2, 4] }); +*/ +function mergeWith(object, ...otherArgs) { + const sources = otherArgs.slice(0, -1); + const merge = otherArgs[otherArgs.length - 1]; + let result = object; + for (let i = 0; i < sources.length; i++) { + const source = sources[i]; + result = mergeWithDeep(result, source, merge, /* @__PURE__ */ new Map()); + } + return result; +} +function mergeWithDeep(target, source, merge, stack) { + if (require_isPrimitive.isPrimitive(target)) target = Object(target); + if (source == null || typeof source !== "object") return target; + if (stack.has(source)) return require_clone.clone(stack.get(source)); + stack.set(source, target); + if (Array.isArray(source)) { + source = source.slice(); + for (let i = 0; i < source.length; i++) source[i] = source[i] ?? void 0; + } + const sourceKeys = [...Object.keys(source), ...require_getSymbols.getSymbols(source)]; + for (let i = 0; i < sourceKeys.length; i++) { + const key = sourceKeys[i]; + if (require_isUnsafeProperty.isUnsafeProperty(key)) continue; + let sourceValue = source[key]; + let targetValue = target[key]; + if (require_isArguments.isArguments(sourceValue)) sourceValue = { ...sourceValue }; + if (require_isArguments.isArguments(targetValue)) targetValue = { ...targetValue }; + if (require_isBuffer.isBuffer(sourceValue)) sourceValue = require_cloneDeep.cloneDeep(sourceValue); + if (Array.isArray(sourceValue)) if (Array.isArray(targetValue)) { + const cloned = []; + const targetKeys = Reflect.ownKeys(targetValue); + for (let i = 0; i < targetKeys.length; i++) { + const targetKey = targetKeys[i]; + cloned[targetKey] = targetValue[targetKey]; + } + targetValue = cloned; + } else if (require_isArrayLikeObject.isArrayLikeObject(targetValue)) { + const cloned = []; + for (let i = 0; i < targetValue.length; i++) cloned[i] = targetValue[i]; + targetValue = cloned; + } else targetValue = []; + const merged = merge(targetValue, sourceValue, key, target, source, stack); + if (merged !== void 0) target[key] = merged; + else if (Array.isArray(sourceValue)) target[key] = mergeWithDeep(targetValue, sourceValue, merge, stack); + else if (require_isObjectLike.isObjectLike(targetValue) && require_isObjectLike.isObjectLike(sourceValue) && (require_isPlainObject.isPlainObject(targetValue) || require_isPlainObject.isPlainObject(sourceValue) || require_isTypedArray.isTypedArray(targetValue) || require_isTypedArray.isTypedArray(sourceValue))) target[key] = mergeWithDeep(targetValue, sourceValue, merge, stack); + else if (targetValue == null && require_isPlainObject.isPlainObject(sourceValue)) target[key] = mergeWithDeep({}, sourceValue, merge, stack); + else if (targetValue == null && require_isTypedArray.isTypedArray(sourceValue)) target[key] = require_cloneDeep.cloneDeep(sourceValue); + else if (targetValue === void 0 || sourceValue !== void 0) target[key] = sourceValue; + } + return target; +} +//#endregion +exports.mergeWith = mergeWith; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/mergeWith.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/mergeWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d87c9b680a12fba343d11107d4636a0d9049b3df --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/mergeWith.mjs @@ -0,0 +1,111 @@ +import { isPrimitive } from "../../predicate/isPrimitive.mjs"; +import { clone } from "../../object/clone.mjs"; +import { getSymbols } from "../_internal/getSymbols.mjs"; +import { isBuffer } from "../../predicate/isBuffer.mjs"; +import { isUnsafeProperty } from "../../_internal/isUnsafeProperty.mjs"; +import { isPlainObject } from "../predicate/isPlainObject.mjs"; +import { cloneDeep } from "./cloneDeep.mjs"; +import { isArguments } from "../predicate/isArguments.mjs"; +import { isObjectLike } from "../predicate/isObjectLike.mjs"; +import { isArrayLikeObject } from "../predicate/isArrayLikeObject.mjs"; +import { isTypedArray } from "../predicate/isTypedArray.mjs"; +//#region src/compat/object/mergeWith.ts +/** +* Merges the properties of one or more source objects into the target object using a customizer function. +* +* This function performs a deep merge, recursively merging nested objects and arrays. +* If a property in the source object is an array or object and the corresponding property in the target object is also an array or object, they will be merged. +* If a property in the source object is `undefined`, it will not overwrite a defined property in the target object. +* +* You can provide a custom `merge` function to control how properties are merged. The `merge` function is called for each property that is being merged and receives the following arguments: +* +* - `targetValue`: The current value of the property in the target object. +* - `sourceValue`: The value of the property in the source object. +* - `key`: The key of the property being merged. +* - `target`: The target object. +* - `source`: The source object. +* - `stack`: A `Map` used to keep track of objects that have already been processed to handle circular references. +* +* The `merge` function should return the value to be set in the target object. If it returns `undefined`, a default deep merge will be applied for arrays and objects. +* +* The function can handle multiple source objects and will merge them all into the target object. +* +* @param {any} object - The target object into which the source object properties will be merged. This object is modified in place. +* @param {...any} otherArgs - Additional source objects to merge into the target object, including the custom `merge` function. +* @returns {any} The updated target object with properties from the source object(s) merged in. +* +* @example +* const target = { a: 1, b: 2 }; +* const source = { b: 3, c: 4 }; +* +* mergeWith(target, source, (targetValue, sourceValue) => { +* if (typeof targetValue === 'number' && typeof sourceValue === 'number') { +* return targetValue + sourceValue; +* } +* }); +* // Returns { a: 1, b: 5, c: 4 } +* @example +* const target = { a: [1], b: [2] }; +* const source = { a: [3], b: [4] }; +* +* const result = mergeWith(target, source, (objValue, srcValue) => { +* if (Array.isArray(objValue)) { +* return objValue.concat(srcValue); +* } +* }); +* +* expect(result).toEqual({ a: [1, 3], b: [2, 4] }); +*/ +function mergeWith(object, ...otherArgs) { + const sources = otherArgs.slice(0, -1); + const merge = otherArgs[otherArgs.length - 1]; + let result = object; + for (let i = 0; i < sources.length; i++) { + const source = sources[i]; + result = mergeWithDeep(result, source, merge, /* @__PURE__ */ new Map()); + } + return result; +} +function mergeWithDeep(target, source, merge, stack) { + if (isPrimitive(target)) target = Object(target); + if (source == null || typeof source !== "object") return target; + if (stack.has(source)) return clone(stack.get(source)); + stack.set(source, target); + if (Array.isArray(source)) { + source = source.slice(); + for (let i = 0; i < source.length; i++) source[i] = source[i] ?? void 0; + } + const sourceKeys = [...Object.keys(source), ...getSymbols(source)]; + for (let i = 0; i < sourceKeys.length; i++) { + const key = sourceKeys[i]; + if (isUnsafeProperty(key)) continue; + let sourceValue = source[key]; + let targetValue = target[key]; + if (isArguments(sourceValue)) sourceValue = { ...sourceValue }; + if (isArguments(targetValue)) targetValue = { ...targetValue }; + if (isBuffer(sourceValue)) sourceValue = cloneDeep(sourceValue); + if (Array.isArray(sourceValue)) if (Array.isArray(targetValue)) { + const cloned = []; + const targetKeys = Reflect.ownKeys(targetValue); + for (let i = 0; i < targetKeys.length; i++) { + const targetKey = targetKeys[i]; + cloned[targetKey] = targetValue[targetKey]; + } + targetValue = cloned; + } else if (isArrayLikeObject(targetValue)) { + const cloned = []; + for (let i = 0; i < targetValue.length; i++) cloned[i] = targetValue[i]; + targetValue = cloned; + } else targetValue = []; + const merged = merge(targetValue, sourceValue, key, target, source, stack); + if (merged !== void 0) target[key] = merged; + else if (Array.isArray(sourceValue)) target[key] = mergeWithDeep(targetValue, sourceValue, merge, stack); + else if (isObjectLike(targetValue) && isObjectLike(sourceValue) && (isPlainObject(targetValue) || isPlainObject(sourceValue) || isTypedArray(targetValue) || isTypedArray(sourceValue))) target[key] = mergeWithDeep(targetValue, sourceValue, merge, stack); + else if (targetValue == null && isPlainObject(sourceValue)) target[key] = mergeWithDeep({}, sourceValue, merge, stack); + else if (targetValue == null && isTypedArray(sourceValue)) target[key] = cloneDeep(sourceValue); + else if (targetValue === void 0 || sourceValue !== void 0) target[key] = sourceValue; + } + return target; +} +//#endregion +export { mergeWith }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/omit.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/omit.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f29b1a177feeaa2dec0d8f673161e5176c751167 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/omit.d.mts @@ -0,0 +1,46 @@ +import { Many } from "../_internal/Many.mjs"; + +//#region src/compat/object/omit.d.ts +/** + * Creates a new object with specified keys omitted. + * + * @template T - The type of object. + * @template K - The type of keys to omit. + * @param {T | null | undefined} object - The object to omit keys from. + * @param {...K} paths - The keys to be omitted from the object. + * @returns {Pick>} A new object with the specified keys omitted. + * + * @example + * omit({ a: 1, b: 2, c: 3 }, 'a', 'c'); + * // => { b: 2 } + */ +declare function omit(object: T | null | undefined, ...paths: K): Pick>; +/** + * Creates a new object with specified keys omitted. + * + * @template T - The type of object. + * @template K - The type of keys to omit. + * @param {T | null | undefined} object - The object to omit keys from. + * @param {...Array>} paths - The keys to be omitted from the object. + * @returns {Omit} A new object with the specified keys omitted. + * + * @example + * omit({ a: 1, b: 2, c: 3 }, 'a', ['b', 'c']); + * // => {} + */ +declare function omit(object: T | null | undefined, ...paths: Array>): Omit; +/** + * Creates a new object with specified keys omitted. + * + * @template T - The type of object. + * @param {T | null | undefined} object - The object to omit keys from. + * @param {...Array>} paths - The keys to be omitted from the object. + * @returns {Partial} A new object with the specified keys omitted. + * + * @example + * omit({ a: 1, b: 2, c: 3 }, 'a', 'b'); + * // => { c: 3 } + */ +declare function omit(object: T | null | undefined, ...paths: Array>): Partial; +//#endregion +export { omit }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/omit.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/omit.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b2d450a4a3e39a56f98f148dff07151b16155caf --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/omit.d.ts @@ -0,0 +1,46 @@ +import { Many } from "../_internal/Many.js"; + +//#region src/compat/object/omit.d.ts +/** + * Creates a new object with specified keys omitted. + * + * @template T - The type of object. + * @template K - The type of keys to omit. + * @param {T | null | undefined} object - The object to omit keys from. + * @param {...K} paths - The keys to be omitted from the object. + * @returns {Pick>} A new object with the specified keys omitted. + * + * @example + * omit({ a: 1, b: 2, c: 3 }, 'a', 'c'); + * // => { b: 2 } + */ +declare function omit(object: T | null | undefined, ...paths: K): Pick>; +/** + * Creates a new object with specified keys omitted. + * + * @template T - The type of object. + * @template K - The type of keys to omit. + * @param {T | null | undefined} object - The object to omit keys from. + * @param {...Array>} paths - The keys to be omitted from the object. + * @returns {Omit} A new object with the specified keys omitted. + * + * @example + * omit({ a: 1, b: 2, c: 3 }, 'a', ['b', 'c']); + * // => {} + */ +declare function omit(object: T | null | undefined, ...paths: Array>): Omit; +/** + * Creates a new object with specified keys omitted. + * + * @template T - The type of object. + * @param {T | null | undefined} object - The object to omit keys from. + * @param {...Array>} paths - The keys to be omitted from the object. + * @returns {Partial} A new object with the specified keys omitted. + * + * @example + * omit({ a: 1, b: 2, c: 3 }, 'a', 'b'); + * // => { c: 3 } + */ +declare function omit(object: T | null | undefined, ...paths: Array>): Partial; +//#endregion +export { omit }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/omit.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/omit.js new file mode 100644 index 0000000000000000000000000000000000000000..501a8ea3327890e82fc219adecdb2291d7217cca --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/omit.js @@ -0,0 +1,78 @@ +const require_isPlainObject = require("../predicate/isPlainObject.js"); +const require_isDeepKey = require("../_internal/isDeepKey.js"); +const require_cloneDeepWith = require("./cloneDeepWith.js"); +const require_flatten = require("../array/flatten.js"); +const require_unset = require("./unset.js"); +const require_keysIn = require("./keysIn.js"); +const require_getSymbolsIn = require("../_internal/getSymbolsIn.js"); +//#region src/compat/object/omit.ts +/** +* Creates a new object with specified keys omitted. +* +* This function takes an object and a variable number of keys, and returns a new object that +* excludes the properties corresponding to the specified keys. Note that keys can be deep. +* +* Deep keys can be specified for keys. +* +* @template T - The type of object. +* @param {T | null | undefined} obj - The object to omit keys from. +* @param {...Array> | Array>} keysArr - A variable number of keys to be omitted from the object. +* @returns {Partial} A new object with the specified keys omitted. +* +* @example +* omit({ a: 1, b: 2, c: 3 }, 'a', 'b'); +* // => { c: 3 } +* +* omit({ a: { b: 1, c: 2 }, d: 3 }, 'a.b', 'd'); +* // => { a: { c: 2 } } +*/ +function omit(obj, ...keysArr) { + if (obj == null) return {}; + keysArr = require_flatten.flatten(keysArr); + const result = cloneInOmit(obj, keysArr); + for (let i = 0; i < keysArr.length; i++) { + let keys = keysArr[i]; + switch (typeof keys) { + case "object": + if (!Array.isArray(keys)) keys = Array.from(keys); + for (let j = 0; j < keys.length; j++) { + const key = keys[j]; + require_unset.unset(result, key); + } + break; + case "string": + case "symbol": + case "number": + require_unset.unset(result, keys); + break; + } + } + return result; +} +function cloneInOmit(obj, keys) { + if (keys.some((key) => Array.isArray(key) || require_isDeepKey.isDeepKey(key))) return deepCloneInOmit(obj); + return shallowCloneInOmit(obj); +} +function shallowCloneInOmit(obj) { + const result = {}; + const keysToCopy = [...require_keysIn.keysIn(obj), ...require_getSymbolsIn.getSymbolsIn(obj)]; + for (let i = 0; i < keysToCopy.length; i++) { + const key = keysToCopy[i]; + result[key] = obj[key]; + } + return result; +} +function deepCloneInOmit(obj) { + const result = {}; + const keysToCopy = [...require_keysIn.keysIn(obj), ...require_getSymbolsIn.getSymbolsIn(obj)]; + for (let i = 0; i < keysToCopy.length; i++) { + const key = keysToCopy[i]; + result[key] = require_cloneDeepWith.cloneDeepWith(obj[key], (valueToClone) => { + if (require_isPlainObject.isPlainObject(valueToClone)) return; + return valueToClone; + }); + } + return result; +} +//#endregion +exports.omit = omit; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/omit.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/omit.mjs new file mode 100644 index 0000000000000000000000000000000000000000..64dfaaa21e08d0cef9da13655712210a3b8fa470 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/omit.mjs @@ -0,0 +1,78 @@ +import { isPlainObject } from "../predicate/isPlainObject.mjs"; +import { isDeepKey } from "../_internal/isDeepKey.mjs"; +import { cloneDeepWith } from "./cloneDeepWith.mjs"; +import { flatten } from "../array/flatten.mjs"; +import { unset } from "./unset.mjs"; +import { keysIn } from "./keysIn.mjs"; +import { getSymbolsIn } from "../_internal/getSymbolsIn.mjs"; +//#region src/compat/object/omit.ts +/** +* Creates a new object with specified keys omitted. +* +* This function takes an object and a variable number of keys, and returns a new object that +* excludes the properties corresponding to the specified keys. Note that keys can be deep. +* +* Deep keys can be specified for keys. +* +* @template T - The type of object. +* @param {T | null | undefined} obj - The object to omit keys from. +* @param {...Array> | Array>} keysArr - A variable number of keys to be omitted from the object. +* @returns {Partial} A new object with the specified keys omitted. +* +* @example +* omit({ a: 1, b: 2, c: 3 }, 'a', 'b'); +* // => { c: 3 } +* +* omit({ a: { b: 1, c: 2 }, d: 3 }, 'a.b', 'd'); +* // => { a: { c: 2 } } +*/ +function omit(obj, ...keysArr) { + if (obj == null) return {}; + keysArr = flatten(keysArr); + const result = cloneInOmit(obj, keysArr); + for (let i = 0; i < keysArr.length; i++) { + let keys = keysArr[i]; + switch (typeof keys) { + case "object": + if (!Array.isArray(keys)) keys = Array.from(keys); + for (let j = 0; j < keys.length; j++) { + const key = keys[j]; + unset(result, key); + } + break; + case "string": + case "symbol": + case "number": + unset(result, keys); + break; + } + } + return result; +} +function cloneInOmit(obj, keys) { + if (keys.some((key) => Array.isArray(key) || isDeepKey(key))) return deepCloneInOmit(obj); + return shallowCloneInOmit(obj); +} +function shallowCloneInOmit(obj) { + const result = {}; + const keysToCopy = [...keysIn(obj), ...getSymbolsIn(obj)]; + for (let i = 0; i < keysToCopy.length; i++) { + const key = keysToCopy[i]; + result[key] = obj[key]; + } + return result; +} +function deepCloneInOmit(obj) { + const result = {}; + const keysToCopy = [...keysIn(obj), ...getSymbolsIn(obj)]; + for (let i = 0; i < keysToCopy.length; i++) { + const key = keysToCopy[i]; + result[key] = cloneDeepWith(obj[key], (valueToClone) => { + if (isPlainObject(valueToClone)) return; + return valueToClone; + }); + } + return result; +} +//#endregion +export { omit }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/omitBy.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/omitBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..2792ab5bd6b4b6f5bf334cf12c3f1cef6d0295c6 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/omitBy.d.mts @@ -0,0 +1,44 @@ +import { ValueKeyIteratee } from "../_internal/ValueKeyIteratee.mjs"; + +//#region src/compat/object/omitBy.d.ts +/** + * Creates a new object composed of the properties that do not satisfy the predicate function. + * + * @template T + * @param {Record | null | undefined} object - The source object. + * @param {ValueKeyIteratee} predicate - The function invoked per property. + * @returns {Record} Returns the new object. + * + * @example + * omitBy({ 'a': 1, 'b': '2', 'c': 3 }, isString); + * // => { 'a': 1, 'c': 3 } + */ +declare function omitBy(object: Record | null | undefined, predicate?: ValueKeyIteratee): Record; +/** + * Creates a new object composed of the properties that do not satisfy the predicate function. + * + * @template T + * @param {Record | null | undefined} object - The source object. + * @param {ValueKeyIteratee} predicate - The function invoked per property. + * @returns {Record} Returns the new object. + * + * @example + * omitBy({ 0: 1, 1: '2', 2: 3 }, isString); + * // => { 0: 1, 2: 3 } + */ +declare function omitBy(object: Record | null | undefined, predicate?: ValueKeyIteratee): Record; +/** + * Creates a new object composed of the properties that do not satisfy the predicate function. + * + * @template T + * @param {T | null | undefined} object - The source object. + * @param {ValueKeyIteratee} predicate - The function invoked per property. + * @returns {Partial} Returns the new object. + * + * @example + * omitBy({ 'a': 1, 'b': '2', 'c': 3 }, isString); + * // => { 'a': 1, 'c': 3 } + */ +declare function omitBy(object: T | null | undefined, predicate: ValueKeyIteratee): Partial; +//#endregion +export { omitBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/omitBy.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/omitBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e2c862bb9e45993eeefed8810fd3417deee01799 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/omitBy.d.ts @@ -0,0 +1,44 @@ +import { ValueKeyIteratee } from "../_internal/ValueKeyIteratee.js"; + +//#region src/compat/object/omitBy.d.ts +/** + * Creates a new object composed of the properties that do not satisfy the predicate function. + * + * @template T + * @param {Record | null | undefined} object - The source object. + * @param {ValueKeyIteratee} predicate - The function invoked per property. + * @returns {Record} Returns the new object. + * + * @example + * omitBy({ 'a': 1, 'b': '2', 'c': 3 }, isString); + * // => { 'a': 1, 'c': 3 } + */ +declare function omitBy(object: Record | null | undefined, predicate?: ValueKeyIteratee): Record; +/** + * Creates a new object composed of the properties that do not satisfy the predicate function. + * + * @template T + * @param {Record | null | undefined} object - The source object. + * @param {ValueKeyIteratee} predicate - The function invoked per property. + * @returns {Record} Returns the new object. + * + * @example + * omitBy({ 0: 1, 1: '2', 2: 3 }, isString); + * // => { 0: 1, 2: 3 } + */ +declare function omitBy(object: Record | null | undefined, predicate?: ValueKeyIteratee): Record; +/** + * Creates a new object composed of the properties that do not satisfy the predicate function. + * + * @template T + * @param {T | null | undefined} object - The source object. + * @param {ValueKeyIteratee} predicate - The function invoked per property. + * @returns {Partial} Returns the new object. + * + * @example + * omitBy({ 'a': 1, 'b': '2', 'c': 3 }, isString); + * // => { 'a': 1, 'c': 3 } + */ +declare function omitBy(object: T | null | undefined, predicate: ValueKeyIteratee): Partial; +//#endregion +export { omitBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/omitBy.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/omitBy.js new file mode 100644 index 0000000000000000000000000000000000000000..d1ac0343abf6cc510bb0999ccb2c79075ea9b7cb --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/omitBy.js @@ -0,0 +1,39 @@ +const require_isSymbol = require("../predicate/isSymbol.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_identity = require("../function/identity.js"); +const require_keysIn = require("./keysIn.js"); +const require_getSymbolsIn = require("../_internal/getSymbolsIn.js"); +//#region src/compat/object/omitBy.ts +/** +* Creates a new object composed of the properties that do not satisfy the predicate function. +* +* This function takes an object and a predicate function, and returns a new object that +* includes only the properties for which the predicate function returns false. +* +* @template T - The type of object. +* @param {T} obj - The object to omit properties from. +* @param {(value: T[keyof T], key: keyof T, obj: T) => boolean} shouldOmit - A predicate function that determines +* whether a property should be omitted. It takes the property's value, key, and the source object as arguments and returns `true` +* if the property should be omitted, and `false` otherwise. +* @returns {Partial} Returns the new object. +* +* @example +* const obj = { a: 1, b: 'omit', c: 3 }; +* const shouldOmit = (value) => typeof value === 'string'; +* const result = omitBy(obj, shouldOmit); +* // result will be { a: 1, c: 3 } +*/ +function omitBy(object, shouldOmit) { + if (object == null) return {}; + const result = {}; + const predicate = require_iteratee.iteratee(shouldOmit ?? require_identity.identity); + const keys = [...require_keysIn.keysIn(object), ...require_getSymbolsIn.getSymbolsIn(object)]; + for (let i = 0; i < keys.length; i++) { + const key = require_isSymbol.isSymbol(keys[i]) ? keys[i] : keys[i].toString(); + const value = object[key]; + if (!predicate(value, key, object)) result[key] = value; + } + return result; +} +//#endregion +exports.omitBy = omitBy; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/omitBy.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/omitBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..379a7e76c3d1bda1f8e681d1e88e1fe09b7b2b11 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/omitBy.mjs @@ -0,0 +1,39 @@ +import { isSymbol } from "../predicate/isSymbol.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +import { identity } from "../function/identity.mjs"; +import { keysIn } from "./keysIn.mjs"; +import { getSymbolsIn } from "../_internal/getSymbolsIn.mjs"; +//#region src/compat/object/omitBy.ts +/** +* Creates a new object composed of the properties that do not satisfy the predicate function. +* +* This function takes an object and a predicate function, and returns a new object that +* includes only the properties for which the predicate function returns false. +* +* @template T - The type of object. +* @param {T} obj - The object to omit properties from. +* @param {(value: T[keyof T], key: keyof T, obj: T) => boolean} shouldOmit - A predicate function that determines +* whether a property should be omitted. It takes the property's value, key, and the source object as arguments and returns `true` +* if the property should be omitted, and `false` otherwise. +* @returns {Partial} Returns the new object. +* +* @example +* const obj = { a: 1, b: 'omit', c: 3 }; +* const shouldOmit = (value) => typeof value === 'string'; +* const result = omitBy(obj, shouldOmit); +* // result will be { a: 1, c: 3 } +*/ +function omitBy(object, shouldOmit) { + if (object == null) return {}; + const result = {}; + const predicate = iteratee(shouldOmit ?? identity); + const keys = [...keysIn(object), ...getSymbolsIn(object)]; + for (let i = 0; i < keys.length; i++) { + const key = isSymbol(keys[i]) ? keys[i] : keys[i].toString(); + const value = object[key]; + if (!predicate(value, key, object)) result[key] = value; + } + return result; +} +//#endregion +export { omitBy }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/pick.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/pick.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..66d9f9e70847b7ad2bdf161ebb7e51f28bd86908 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/pick.d.mts @@ -0,0 +1,35 @@ +import { Many } from "../_internal/Many.mjs"; +import { PropertyPath } from "../_internal/PropertyPath.mjs"; + +//#region src/compat/object/pick.d.ts +/** + * Creates a new object composed of the picked object properties. + * + * @template T - The type of object. + * @template U - The type of keys to pick. + * @param {T} object - The object to pick keys from. + * @param {...Array>} props - An array of keys to be picked from the object. + * @returns {Pick} A new object with the specified keys picked. + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * const result = pick(obj, ['a', 'c']); + * // result will be { a: 1, c: 3 } + */ +declare function pick(object: T, ...props: Array>): Pick; +/** + * Creates a new object composed of the picked object properties. + * + * @template T - The type of object. + * @param {T | null | undefined} object - The object to pick keys from. + * @param {...Array>} props - An array of keys to be picked from the object. + * @returns {Partial} A new object with the specified keys picked. + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * const result = pick(obj, ['a', 'c']); + * // result will be { a: 1, c: 3 } + */ +declare function pick(object: T | null | undefined, ...props: Array>): Partial; +//#endregion +export { pick }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/pick.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/pick.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f35d35ad82d5de246c05bae5055f1e52f1611759 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/pick.d.ts @@ -0,0 +1,35 @@ +import { Many } from "../_internal/Many.js"; +import { PropertyPath } from "../_internal/PropertyPath.js"; + +//#region src/compat/object/pick.d.ts +/** + * Creates a new object composed of the picked object properties. + * + * @template T - The type of object. + * @template U - The type of keys to pick. + * @param {T} object - The object to pick keys from. + * @param {...Array>} props - An array of keys to be picked from the object. + * @returns {Pick} A new object with the specified keys picked. + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * const result = pick(obj, ['a', 'c']); + * // result will be { a: 1, c: 3 } + */ +declare function pick(object: T, ...props: Array>): Pick; +/** + * Creates a new object composed of the picked object properties. + * + * @template T - The type of object. + * @param {T | null | undefined} object - The object to pick keys from. + * @param {...Array>} props - An array of keys to be picked from the object. + * @returns {Partial} A new object with the specified keys picked. + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * const result = pick(obj, ['a', 'c']); + * // result will be { a: 1, c: 3 } + */ +declare function pick(object: T | null | undefined, ...props: Array>): Partial; +//#endregion +export { pick }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/pick.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/pick.js new file mode 100644 index 0000000000000000000000000000000000000000..53e76c823d33335c0ce90f5d41420afd9e7d5235 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/pick.js @@ -0,0 +1,59 @@ +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_get = require("./get.js"); +const require_has = require("./has.js"); +const require_isNil = require("../predicate/isNil.js"); +const require_set = require("./set.js"); +//#region src/compat/object/pick.ts +/** +* Creates a new object composed of the picked object properties. +* +* This function takes an object and an array of keys, and returns a new object that +* includes only the properties corresponding to the specified keys. +* +* @template T - The type of object. +* @template U - The type of keys to pick. +* @param {T | any | null | undefined} object - The object to pick keys from. +* @param {...Array> | Array>} props - An array of keys to be picked from the object. received keys goes through a flattening process before being used. +* @returns {Pick | Partial} A new object with the specified keys picked. +* +* @example +* const obj = { a: 1, b: 2, c: 3 }; +* const result = pick(obj, ['a', 'c']); +* // result will be { a: 1, c: 3 } +* +* // each path can be passed individually as an argument +* const obj = { a: 1, b: 2, c: 3 }; +* const result = pick(obj, 'a', 'c'); +* +* // pick a key over a path +* const obj = { 'a.b': 1, a: { b: 2 } }; +* const result = pick(obj, 'a.b'); +* // result will be { 'a.b': 1 } +*/ +function pick(obj, ...keysArr) { + if (require_isNil.isNil(obj)) return {}; + const result = {}; + for (let i = 0; i < keysArr.length; i++) { + let keys = keysArr[i]; + switch (typeof keys) { + case "object": + if (!Array.isArray(keys)) if (require_isArrayLike.isArrayLike(keys)) keys = Array.from(keys); + else keys = [keys]; + break; + case "string": + case "symbol": + case "number": + keys = [keys]; + break; + } + for (const key of keys) { + const value = require_get.get(obj, key); + if (value === void 0 && !require_has.has(obj, key)) continue; + if (typeof key === "string" && Object.hasOwn(obj, key)) result[key] = value; + else require_set.set(result, key, value); + } + } + return result; +} +//#endregion +exports.pick = pick; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/pick.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/pick.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3b62ac3bd9db1bb86c0866234d9026ac204f1ba8 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/pick.mjs @@ -0,0 +1,59 @@ +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { get } from "./get.mjs"; +import { has } from "./has.mjs"; +import { isNil } from "../predicate/isNil.mjs"; +import { set } from "./set.mjs"; +//#region src/compat/object/pick.ts +/** +* Creates a new object composed of the picked object properties. +* +* This function takes an object and an array of keys, and returns a new object that +* includes only the properties corresponding to the specified keys. +* +* @template T - The type of object. +* @template U - The type of keys to pick. +* @param {T | any | null | undefined} object - The object to pick keys from. +* @param {...Array> | Array>} props - An array of keys to be picked from the object. received keys goes through a flattening process before being used. +* @returns {Pick | Partial} A new object with the specified keys picked. +* +* @example +* const obj = { a: 1, b: 2, c: 3 }; +* const result = pick(obj, ['a', 'c']); +* // result will be { a: 1, c: 3 } +* +* // each path can be passed individually as an argument +* const obj = { a: 1, b: 2, c: 3 }; +* const result = pick(obj, 'a', 'c'); +* +* // pick a key over a path +* const obj = { 'a.b': 1, a: { b: 2 } }; +* const result = pick(obj, 'a.b'); +* // result will be { 'a.b': 1 } +*/ +function pick(obj, ...keysArr) { + if (isNil(obj)) return {}; + const result = {}; + for (let i = 0; i < keysArr.length; i++) { + let keys = keysArr[i]; + switch (typeof keys) { + case "object": + if (!Array.isArray(keys)) if (isArrayLike(keys)) keys = Array.from(keys); + else keys = [keys]; + break; + case "string": + case "symbol": + case "number": + keys = [keys]; + break; + } + for (const key of keys) { + const value = get(obj, key); + if (value === void 0 && !has(obj, key)) continue; + if (typeof key === "string" && Object.hasOwn(obj, key)) result[key] = value; + else set(result, key, value); + } + } + return result; +} +//#endregion +export { pick }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/pickBy.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/pickBy.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..cb139f7946e0f9734c1e965eececd906af3acea1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/pickBy.d.mts @@ -0,0 +1,81 @@ +import { ValueKeyIteratee } from "../_internal/ValueKeyIteratee.mjs"; +import { ValueKeyIterateeTypeGuard } from "../_internal/ValueKeyIterateeTypeGuard.mjs"; + +//#region src/compat/object/pickBy.d.ts +/** + * Creates a new object composed of the properties that satisfy the predicate function. + * + * @template T - The type of object values. + * @template S - The type of filtered values. + * @param {Record | null | undefined} object - The source object. + * @param {ValueKeyIterateeTypeGuard} predicate - The function invoked per property. + * @returns {Record} Returns the new filtered object. + * + * @example + * const users = { + * 'fred': { 'user': 'fred', 'age': 40 }, + * 'pebbles': { 'user': 'pebbles', 'age': 1 } + * }; + * pickBy(users, ({ age }) => age < 40); + * // => { 'pebbles': { 'user': 'pebbles', 'age': 1 } } + */ +declare function pickBy(object: Record | null | undefined, predicate: ValueKeyIterateeTypeGuard): Record; +/** + * Creates a new object composed of the properties that satisfy the predicate function. + * + * @template T - The type of object values. + * @template S - The type of filtered values. + * @param {Record | null | undefined} object - The source object. + * @param {ValueKeyIterateeTypeGuard} predicate - The function invoked per property. + * @returns {Record} Returns the new filtered object. + * + * @example + * const array = [1, 2, 3, 4]; + * pickBy(array, (value) => value % 2 === 0); + * // => { 1: 2, 3: 4 } + */ +declare function pickBy(object: Record | null | undefined, predicate: ValueKeyIterateeTypeGuard): Record; +/** + * Creates a new object composed of the properties that satisfy the predicate function. + * + * @template T - The type of object values. + * @param {Record | null | undefined} object - The source object. + * @param {ValueKeyIteratee} [predicate] - The function invoked per property. + * @returns {Record} Returns the new filtered object. + * + * @example + * const object = { 'a': 1, 'b': '2', 'c': 3 }; + * pickBy(object, (value) => typeof value === 'string'); + * // => { 'b': '2' } + */ +declare function pickBy(object: Record | null | undefined, predicate?: ValueKeyIteratee): Record; +/** + * Creates a new object composed of the properties that satisfy the predicate function. + * + * @template T - The type of object values. + * @param {Record | null | undefined} object - The source object. + * @param {ValueKeyIteratee} [predicate] - The function invoked per property. + * @returns {Record} Returns the new filtered object. + * + * @example + * const array = [1, 2, 3, 4]; + * pickBy(array, (value) => value > 2); + * // => { 2: 3, 3: 4 } + */ +declare function pickBy(object: Record | null | undefined, predicate?: ValueKeyIteratee): Record; +/** + * Creates a new object composed of the properties that satisfy the predicate function. + * + * @template T - The type of object. + * @param {T | null | undefined} object - The source object. + * @param {ValueKeyIteratee} [predicate] - The function invoked per property. + * @returns {Partial} Returns the new filtered object. + * + * @example + * const object = { 'a': 1, 'b': '2', 'c': 3 }; + * pickBy(object, (value) => typeof value === 'string'); + * // => { 'b': '2' } + */ +declare function pickBy(object: T | null | undefined, predicate?: ValueKeyIteratee): Partial; +//#endregion +export { pickBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/pickBy.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/pickBy.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e9d9525efc7415bdc464171174dbd441f325ee0f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/pickBy.d.ts @@ -0,0 +1,81 @@ +import { ValueKeyIteratee } from "../_internal/ValueKeyIteratee.js"; +import { ValueKeyIterateeTypeGuard } from "../_internal/ValueKeyIterateeTypeGuard.js"; + +//#region src/compat/object/pickBy.d.ts +/** + * Creates a new object composed of the properties that satisfy the predicate function. + * + * @template T - The type of object values. + * @template S - The type of filtered values. + * @param {Record | null | undefined} object - The source object. + * @param {ValueKeyIterateeTypeGuard} predicate - The function invoked per property. + * @returns {Record} Returns the new filtered object. + * + * @example + * const users = { + * 'fred': { 'user': 'fred', 'age': 40 }, + * 'pebbles': { 'user': 'pebbles', 'age': 1 } + * }; + * pickBy(users, ({ age }) => age < 40); + * // => { 'pebbles': { 'user': 'pebbles', 'age': 1 } } + */ +declare function pickBy(object: Record | null | undefined, predicate: ValueKeyIterateeTypeGuard): Record; +/** + * Creates a new object composed of the properties that satisfy the predicate function. + * + * @template T - The type of object values. + * @template S - The type of filtered values. + * @param {Record | null | undefined} object - The source object. + * @param {ValueKeyIterateeTypeGuard} predicate - The function invoked per property. + * @returns {Record} Returns the new filtered object. + * + * @example + * const array = [1, 2, 3, 4]; + * pickBy(array, (value) => value % 2 === 0); + * // => { 1: 2, 3: 4 } + */ +declare function pickBy(object: Record | null | undefined, predicate: ValueKeyIterateeTypeGuard): Record; +/** + * Creates a new object composed of the properties that satisfy the predicate function. + * + * @template T - The type of object values. + * @param {Record | null | undefined} object - The source object. + * @param {ValueKeyIteratee} [predicate] - The function invoked per property. + * @returns {Record} Returns the new filtered object. + * + * @example + * const object = { 'a': 1, 'b': '2', 'c': 3 }; + * pickBy(object, (value) => typeof value === 'string'); + * // => { 'b': '2' } + */ +declare function pickBy(object: Record | null | undefined, predicate?: ValueKeyIteratee): Record; +/** + * Creates a new object composed of the properties that satisfy the predicate function. + * + * @template T - The type of object values. + * @param {Record | null | undefined} object - The source object. + * @param {ValueKeyIteratee} [predicate] - The function invoked per property. + * @returns {Record} Returns the new filtered object. + * + * @example + * const array = [1, 2, 3, 4]; + * pickBy(array, (value) => value > 2); + * // => { 2: 3, 3: 4 } + */ +declare function pickBy(object: Record | null | undefined, predicate?: ValueKeyIteratee): Record; +/** + * Creates a new object composed of the properties that satisfy the predicate function. + * + * @template T - The type of object. + * @param {T | null | undefined} object - The source object. + * @param {ValueKeyIteratee} [predicate] - The function invoked per property. + * @returns {Partial} Returns the new filtered object. + * + * @example + * const object = { 'a': 1, 'b': '2', 'c': 3 }; + * pickBy(object, (value) => typeof value === 'string'); + * // => { 'b': '2' } + */ +declare function pickBy(object: T | null | undefined, predicate?: ValueKeyIteratee): Partial; +//#endregion +export { pickBy }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/pickBy.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/pickBy.js new file mode 100644 index 0000000000000000000000000000000000000000..60cbbe869f83780ba5446ef0bf6504863dff2a71 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/pickBy.js @@ -0,0 +1,41 @@ +const require_isSymbol = require("../predicate/isSymbol.js"); +const require_range = require("../../math/range.js"); +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_identity = require("../function/identity.js"); +const require_keysIn = require("./keysIn.js"); +const require_getSymbolsIn = require("../_internal/getSymbolsIn.js"); +//#region src/compat/object/pickBy.ts +/** +* Creates a new object composed of the properties that satisfy the predicate function. +* +* This function takes an object and a predicate function, and returns a new object that +* includes only the properties for which the predicate function returns true. +* +* @template T - The type of object. +* @param {Record | Record | object | null | undefined} obj - The object to pick properties from. +* @param {ValueKeyIterateeTypeGuard | ValueKeyIteratee | ValueKeyIteratee} [shouldPick] - A predicate function that determines +* whether a property should be picked. It takes the property's key and value as arguments and returns `true` +* if the property should be picked, and `false` otherwise. +* @returns {Record | Record | Partial} A new object with the properties that satisfy the predicate function. +* +* @example +* const obj = { a: 1, b: 'pick', c: 3 }; +* const shouldPick = (value) => typeof value === 'string'; +* const result = pickBy(obj, shouldPick); +* // result will be { b: 'pick' } +*/ +function pickBy(obj, shouldPick) { + if (obj == null) return {}; + const predicate = require_iteratee.iteratee(shouldPick ?? require_identity.identity); + const result = {}; + const keys = require_isArrayLike.isArrayLike(obj) ? require_range.range(0, obj.length) : [...require_keysIn.keysIn(obj), ...require_getSymbolsIn.getSymbolsIn(obj)]; + for (let i = 0; i < keys.length; i++) { + const key = require_isSymbol.isSymbol(keys[i]) ? keys[i] : keys[i].toString(); + const value = obj[key]; + if (predicate(value, key, obj)) result[key] = value; + } + return result; +} +//#endregion +exports.pickBy = pickBy; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/pickBy.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/pickBy.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d873297ccea8db571cf30d5e57aee88702ea6223 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/pickBy.mjs @@ -0,0 +1,41 @@ +import { isSymbol } from "../predicate/isSymbol.mjs"; +import { range } from "../../math/range.mjs"; +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +import { identity } from "../function/identity.mjs"; +import { keysIn } from "./keysIn.mjs"; +import { getSymbolsIn } from "../_internal/getSymbolsIn.mjs"; +//#region src/compat/object/pickBy.ts +/** +* Creates a new object composed of the properties that satisfy the predicate function. +* +* This function takes an object and a predicate function, and returns a new object that +* includes only the properties for which the predicate function returns true. +* +* @template T - The type of object. +* @param {Record | Record | object | null | undefined} obj - The object to pick properties from. +* @param {ValueKeyIterateeTypeGuard | ValueKeyIteratee | ValueKeyIteratee} [shouldPick] - A predicate function that determines +* whether a property should be picked. It takes the property's key and value as arguments and returns `true` +* if the property should be picked, and `false` otherwise. +* @returns {Record | Record | Partial} A new object with the properties that satisfy the predicate function. +* +* @example +* const obj = { a: 1, b: 'pick', c: 3 }; +* const shouldPick = (value) => typeof value === 'string'; +* const result = pickBy(obj, shouldPick); +* // result will be { b: 'pick' } +*/ +function pickBy(obj, shouldPick) { + if (obj == null) return {}; + const predicate = iteratee(shouldPick ?? identity); + const result = {}; + const keys = isArrayLike(obj) ? range(0, obj.length) : [...keysIn(obj), ...getSymbolsIn(obj)]; + for (let i = 0; i < keys.length; i++) { + const key = isSymbol(keys[i]) ? keys[i] : keys[i].toString(); + const value = obj[key]; + if (predicate(value, key, obj)) result[key] = value; + } + return result; +} +//#endregion +export { pickBy }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/property.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/property.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..adf340d660d9845f72a3edec7f7870dabdfa18bf --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/property.d.mts @@ -0,0 +1,6 @@ +import { PropertyPath } from "../_internal/PropertyPath.mjs"; + +//#region src/compat/object/property.d.ts +declare function property(path: PropertyPath): (obj: T) => R; +//#endregion +export { property }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/property.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/property.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..507c08a1e3dc75fc3ee300bed723b0190dfee171 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/property.d.ts @@ -0,0 +1,6 @@ +import { PropertyPath } from "../_internal/PropertyPath.js"; + +//#region src/compat/object/property.d.ts +declare function property(path: PropertyPath): (obj: T) => R; +//#endregion +export { property }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/property.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/property.js new file mode 100644 index 0000000000000000000000000000000000000000..65e582760e898f779c4fca5627469d339dbf96f5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/property.js @@ -0,0 +1,27 @@ +const require_get = require("./get.js"); +//#region src/compat/object/property.ts +/** +* Creates a function that returns the value at a given path of an object. +* +* @template T - The type of object. +* @template R - The type of the value to return. +* @param {PropertyPath} path - The path of the property to get. +* @returns {(object: T) => R} - Returns a new function that takes an object and returns the value at the specified path. +* +* @example +* const getObjectValue = property('a.b.c'); +* const result = getObjectValue({ a: { b: { c: 3 } } }); +* console.log(result); // => 3 +* +* @example +* const getObjectValue = property(['a', 'b', 'c']); +* const result = getObjectValue({ a: { b: { c: 3 } } }); +* console.log(result); // => 3 +*/ +function property(path) { + return function(object) { + return require_get.get(object, path); + }; +} +//#endregion +exports.property = property; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/property.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/property.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d57c146c51fbf1953ac0b7c007b1cca664dedf9c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/property.mjs @@ -0,0 +1,27 @@ +import { get } from "./get.mjs"; +//#region src/compat/object/property.ts +/** +* Creates a function that returns the value at a given path of an object. +* +* @template T - The type of object. +* @template R - The type of the value to return. +* @param {PropertyPath} path - The path of the property to get. +* @returns {(object: T) => R} - Returns a new function that takes an object and returns the value at the specified path. +* +* @example +* const getObjectValue = property('a.b.c'); +* const result = getObjectValue({ a: { b: { c: 3 } } }); +* console.log(result); // => 3 +* +* @example +* const getObjectValue = property(['a', 'b', 'c']); +* const result = getObjectValue({ a: { b: { c: 3 } } }); +* console.log(result); // => 3 +*/ +function property(path) { + return function(object) { + return get(object, path); + }; +} +//#endregion +export { property }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/propertyOf.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/propertyOf.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c3160dcd5a91b99c015ea1217c961770a9b86eaf --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/propertyOf.d.mts @@ -0,0 +1,6 @@ +import { PropertyPath } from "../_internal/PropertyPath.mjs"; + +//#region src/compat/object/propertyOf.d.ts +declare function propertyOf(object: T): (path: PropertyPath) => any; +//#endregion +export { propertyOf }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/propertyOf.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/propertyOf.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bda9eb59430bd55e98d15aea6a364a7d48cd3f2e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/propertyOf.d.ts @@ -0,0 +1,6 @@ +import { PropertyPath } from "../_internal/PropertyPath.js"; + +//#region src/compat/object/propertyOf.d.ts +declare function propertyOf(object: T): (path: PropertyPath) => any; +//#endregion +export { propertyOf }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/propertyOf.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/propertyOf.js new file mode 100644 index 0000000000000000000000000000000000000000..78cea7a25ea97a35486f4c19eef6497776321b9e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/propertyOf.js @@ -0,0 +1,29 @@ +const require_get = require("./get.js"); +//#region src/compat/object/propertyOf.ts +/** +* Creates a function that returns the value at a given path of an object. +* +* Unlike `property`, which creates a function bound to a specific path and allows you to query different objects, +* `propertyOf` creates a function bound to a specific object and allows you to query different paths within that object. +* +* @template T - The type of object. +* @param {T} object - The object to query. +* @returns {(path: PropertyPath) => any} - Returns a new function that takes a path and retrieves the value from the object at the specified path. +* +* @example +* const getValue = propertyOf({ a: { b: { c: 3 } } }); +* const result = getValue('a.b.c'); +* console.log(result); // => 3 +* +* @example +* const getValue = propertyOf({ a: { b: { c: 3 } } }); +* const result = getValue(['a', 'b', 'c']); +* console.log(result); // => 3 +*/ +function propertyOf(object) { + return function(path) { + return require_get.get(object, path); + }; +} +//#endregion +exports.propertyOf = propertyOf; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/propertyOf.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/propertyOf.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3f65b61b96657f89b4e6cb19ca90de74ac8389b5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/propertyOf.mjs @@ -0,0 +1,29 @@ +import { get } from "./get.mjs"; +//#region src/compat/object/propertyOf.ts +/** +* Creates a function that returns the value at a given path of an object. +* +* Unlike `property`, which creates a function bound to a specific path and allows you to query different objects, +* `propertyOf` creates a function bound to a specific object and allows you to query different paths within that object. +* +* @template T - The type of object. +* @param {T} object - The object to query. +* @returns {(path: PropertyPath) => any} - Returns a new function that takes a path and retrieves the value from the object at the specified path. +* +* @example +* const getValue = propertyOf({ a: { b: { c: 3 } } }); +* const result = getValue('a.b.c'); +* console.log(result); // => 3 +* +* @example +* const getValue = propertyOf({ a: { b: { c: 3 } } }); +* const result = getValue(['a', 'b', 'c']); +* console.log(result); // => 3 +*/ +function propertyOf(object) { + return function(path) { + return get(object, path); + }; +} +//#endregion +export { propertyOf }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/result.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/result.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..ae3a8b2d22484cebb050e7dbc255cebf02319b17 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/result.d.mts @@ -0,0 +1,38 @@ +import { PropertyPath } from "../_internal/PropertyPath.mjs"; + +//#region src/compat/object/result.d.ts +/** + * Retrieves the value at a given path of an object. + * If the resolved value is a function, it is invoked with the object as its `this` context. + * If the value is `undefined`, the `defaultValue` is returned. + * + * @template T - The type of object. + * @template R - The type of the value to return. + * @param {T} object - The object to query. + * @param {PropertyPath} path - The path of the property to get. + * @param {R | ((...args: any[]) => R)} [defaultValue] - The value returned if the resolved value is `undefined`. + * @returns {R} - Returns the resolved value. + * + * @example + * const obj = { a: { b: { c: 3 } } }; + * result(obj, 'a.b.c'); + * // => 3 + * + * @example + * const obj = { a: () => 5 }; + * result(obj, 'a'); + * // => 5 (calls the function `a` and returns its result) + * + * @example + * const obj = { a: { b: null } }; + * result(obj, 'a.b.c', 'default'); + * // => 'default' + * + * @example + * const obj = { a: { b: { c: 3 } } }; + * result(obj, 'a.b.d', () => 'default'); + * // => 'default' + */ +declare function result(object: any, path: PropertyPath, defaultValue?: R | ((...args: any[]) => R)): R; +//#endregion +export { result }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/result.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/result.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9e9f1a121438978d259dbd9107d40b8a129224d4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/result.d.ts @@ -0,0 +1,38 @@ +import { PropertyPath } from "../_internal/PropertyPath.js"; + +//#region src/compat/object/result.d.ts +/** + * Retrieves the value at a given path of an object. + * If the resolved value is a function, it is invoked with the object as its `this` context. + * If the value is `undefined`, the `defaultValue` is returned. + * + * @template T - The type of object. + * @template R - The type of the value to return. + * @param {T} object - The object to query. + * @param {PropertyPath} path - The path of the property to get. + * @param {R | ((...args: any[]) => R)} [defaultValue] - The value returned if the resolved value is `undefined`. + * @returns {R} - Returns the resolved value. + * + * @example + * const obj = { a: { b: { c: 3 } } }; + * result(obj, 'a.b.c'); + * // => 3 + * + * @example + * const obj = { a: () => 5 }; + * result(obj, 'a'); + * // => 5 (calls the function `a` and returns its result) + * + * @example + * const obj = { a: { b: null } }; + * result(obj, 'a.b.c', 'default'); + * // => 'default' + * + * @example + * const obj = { a: { b: { c: 3 } } }; + * result(obj, 'a.b.d', () => 'default'); + * // => 'default' + */ +declare function result(object: any, path: PropertyPath, defaultValue?: R | ((...args: any[]) => R)): R; +//#endregion +export { result }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/result.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/result.js new file mode 100644 index 0000000000000000000000000000000000000000..47acf331fc6d3a6950e7642467b7ee03c1a3d41b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/result.js @@ -0,0 +1,50 @@ +const require_toKey = require("../_internal/toKey.js"); +const require_toString = require("../util/toString.js"); +const require_toPath = require("../util/toPath.js"); +const require_isKey = require("../_internal/isKey.js"); +//#region src/compat/object/result.ts +/** +* Retrieves the value at a given path of an object. +* If the resolved value is a function, it is invoked with the object as its `this` context. +* If the value is `undefined`, the `defaultValue` is returned. +* +* @template T - The type of object. +* @template R - The type of the value to return. +* @param {T} object - The object to query. +* @param {PropertyPath} path - The path of the property to get. +* @param {R | ((...args: any[]) => R)} [defaultValue] - The value returned if the resolved value is `undefined`. +* @returns {R} - Returns the resolved value. +* +* @example +* const obj = { a: { b: { c: 3 } } }; +* result(obj, 'a.b.c'); +* // => 3 +* +* @example +* const obj = { a: () => 5 }; +* result(obj, 'a'); +* // => 5 (calls the function `a` and returns its result) +* +* @example +* const obj = { a: { b: null } }; +* result(obj, 'a.b.c', 'default'); +* // => 'default' +* +* @example +* const obj = { a: { b: { c: 3 } } }; +* result(obj, 'a.b.d', () => 'default'); +* // => 'default' +*/ +function result(object, path, defaultValue) { + if (require_isKey.isKey(path, object)) path = [path]; + else if (!Array.isArray(path)) path = require_toPath.toPath(require_toString.toString(path)); + const pathLength = Math.max(path.length, 1); + for (let index = 0; index < pathLength; index++) { + const value = object == null ? void 0 : object[require_toKey.toKey(path[index])]; + if (value === void 0) return typeof defaultValue === "function" ? defaultValue.call(object) : defaultValue; + object = typeof value === "function" ? value.call(object) : value; + } + return object; +} +//#endregion +exports.result = result; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/result.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/result.mjs new file mode 100644 index 0000000000000000000000000000000000000000..63c5f23e93b8bf5530d675e8a85d4c507f891738 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/result.mjs @@ -0,0 +1,50 @@ +import { toKey } from "../_internal/toKey.mjs"; +import { toString } from "../util/toString.mjs"; +import { toPath } from "../util/toPath.mjs"; +import { isKey } from "../_internal/isKey.mjs"; +//#region src/compat/object/result.ts +/** +* Retrieves the value at a given path of an object. +* If the resolved value is a function, it is invoked with the object as its `this` context. +* If the value is `undefined`, the `defaultValue` is returned. +* +* @template T - The type of object. +* @template R - The type of the value to return. +* @param {T} object - The object to query. +* @param {PropertyPath} path - The path of the property to get. +* @param {R | ((...args: any[]) => R)} [defaultValue] - The value returned if the resolved value is `undefined`. +* @returns {R} - Returns the resolved value. +* +* @example +* const obj = { a: { b: { c: 3 } } }; +* result(obj, 'a.b.c'); +* // => 3 +* +* @example +* const obj = { a: () => 5 }; +* result(obj, 'a'); +* // => 5 (calls the function `a` and returns its result) +* +* @example +* const obj = { a: { b: null } }; +* result(obj, 'a.b.c', 'default'); +* // => 'default' +* +* @example +* const obj = { a: { b: { c: 3 } } }; +* result(obj, 'a.b.d', () => 'default'); +* // => 'default' +*/ +function result(object, path, defaultValue) { + if (isKey(path, object)) path = [path]; + else if (!Array.isArray(path)) path = toPath(toString(path)); + const pathLength = Math.max(path.length, 1); + for (let index = 0; index < pathLength; index++) { + const value = object == null ? void 0 : object[toKey(path[index])]; + if (value === void 0) return typeof defaultValue === "function" ? defaultValue.call(object) : defaultValue; + object = typeof value === "function" ? value.call(object) : value; + } + return object; +} +//#endregion +export { result }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/set.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/set.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..06fd6ddc93c253051a4ac98ed691d00529449ea4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/set.d.mts @@ -0,0 +1,61 @@ +import { PropertyPath } from "../_internal/PropertyPath.mjs"; + +//#region src/compat/object/set.d.ts +/** + * Sets the value at the specified path of the given object. If any part of the path does not exist, it will be created. + * + * @template T - The type of the object. + * @param {T} object - The object to modify. + * @param {PropertyPath} path - The path of the property to set. + * @param {any} value - The value to set. + * @returns {T} - The modified object. + * + * @example + * // Set a value in a nested object + * const obj = { a: { b: { c: 3 } } }; + * set(obj, 'a.b.c', 4); + * console.log(obj.a.b.c); // 4 + * + * @example + * // Set a value in an array + * const arr = [1, 2, 3]; + * set(arr, 1, 4); + * console.log(arr[1]); // 4 + * + * @example + * // Create non-existent path and set value + * const obj = {}; + * set(obj, 'a.b.c', 4); + * console.log(obj); // { a: { b: { c: 4 } } } + */ +declare function set(object: T, path: PropertyPath, value: any): T; +/** + * Sets the value at the specified path of the given object. If any part of the path does not exist, it will be created. + * + * @template R - The return type. + * @param {object} object - The object to modify. + * @param {PropertyPath} path - The path of the property to set. + * @param {any} value - The value to set. + * @returns {R} - The modified object. + * + * @example + * // Set a value in a nested object + * const obj = { a: { b: { c: 3 } } }; + * set(obj, 'a.b.c', 4); + * console.log(obj.a.b.c); // 4 + * + * @example + * // Set a value in an array + * const arr = [1, 2, 3]; + * set(arr, 1, 4); + * console.log(arr[1]); // 4 + * + * @example + * // Create non-existent path and set value + * const obj = {}; + * set(obj, 'a.b.c', 4); + * console.log(obj); // { a: { b: { c: 4 } } } + */ +declare function set(object: object, path: PropertyPath, value: any): R; +//#endregion +export { set }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/set.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/set.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e177b111697007c0ebb64eddd223895a76f7271e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/set.d.ts @@ -0,0 +1,61 @@ +import { PropertyPath } from "../_internal/PropertyPath.js"; + +//#region src/compat/object/set.d.ts +/** + * Sets the value at the specified path of the given object. If any part of the path does not exist, it will be created. + * + * @template T - The type of the object. + * @param {T} object - The object to modify. + * @param {PropertyPath} path - The path of the property to set. + * @param {any} value - The value to set. + * @returns {T} - The modified object. + * + * @example + * // Set a value in a nested object + * const obj = { a: { b: { c: 3 } } }; + * set(obj, 'a.b.c', 4); + * console.log(obj.a.b.c); // 4 + * + * @example + * // Set a value in an array + * const arr = [1, 2, 3]; + * set(arr, 1, 4); + * console.log(arr[1]); // 4 + * + * @example + * // Create non-existent path and set value + * const obj = {}; + * set(obj, 'a.b.c', 4); + * console.log(obj); // { a: { b: { c: 4 } } } + */ +declare function set(object: T, path: PropertyPath, value: any): T; +/** + * Sets the value at the specified path of the given object. If any part of the path does not exist, it will be created. + * + * @template R - The return type. + * @param {object} object - The object to modify. + * @param {PropertyPath} path - The path of the property to set. + * @param {any} value - The value to set. + * @returns {R} - The modified object. + * + * @example + * // Set a value in a nested object + * const obj = { a: { b: { c: 3 } } }; + * set(obj, 'a.b.c', 4); + * console.log(obj.a.b.c); // 4 + * + * @example + * // Set a value in an array + * const arr = [1, 2, 3]; + * set(arr, 1, 4); + * console.log(arr[1]); // 4 + * + * @example + * // Create non-existent path and set value + * const obj = {}; + * set(obj, 'a.b.c', 4); + * console.log(obj); // { a: { b: { c: 4 } } } + */ +declare function set(object: object, path: PropertyPath, value: any): R; +//#endregion +export { set }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/set.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/set.js new file mode 100644 index 0000000000000000000000000000000000000000..b52f024ef8ff1eeee18d096e751094c0d54bd822 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/set.js @@ -0,0 +1,34 @@ +const require_updateWith = require("./updateWith.js"); +//#region src/compat/object/set.ts +/** +* Sets the value at the specified path of the given object. If any part of the path does not exist, it will be created. +* +* @template T - The type of the object. +* @param {T} obj - The object to modify. +* @param {PropertyPath} path - The path of the property to set. +* @param {any} value - The value to set. +* @returns {T} - The modified object. +* +* @example +* // Set a value in a nested object +* const obj = { a: { b: { c: 3 } } }; +* set(obj, 'a.b.c', 4); +* console.log(obj.a.b.c); // 4 +* +* @example +* // Set a value in an array +* const arr = [1, 2, 3]; +* set(arr, 1, 4); +* console.log(arr[1]); // 4 +* +* @example +* // Create non-existent path and set value +* const obj = {}; +* set(obj, 'a.b.c', 4); +* console.log(obj); // { a: { b: { c: 4 } } } +*/ +function set(obj, path, value) { + return require_updateWith.updateWith(obj, path, () => value, () => void 0); +} +//#endregion +exports.set = set; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/set.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/set.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6a549f048813c6c713bf9a533e756b1f66850425 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/set.mjs @@ -0,0 +1,34 @@ +import { updateWith } from "./updateWith.mjs"; +//#region src/compat/object/set.ts +/** +* Sets the value at the specified path of the given object. If any part of the path does not exist, it will be created. +* +* @template T - The type of the object. +* @param {T} obj - The object to modify. +* @param {PropertyPath} path - The path of the property to set. +* @param {any} value - The value to set. +* @returns {T} - The modified object. +* +* @example +* // Set a value in a nested object +* const obj = { a: { b: { c: 3 } } }; +* set(obj, 'a.b.c', 4); +* console.log(obj.a.b.c); // 4 +* +* @example +* // Set a value in an array +* const arr = [1, 2, 3]; +* set(arr, 1, 4); +* console.log(arr[1]); // 4 +* +* @example +* // Create non-existent path and set value +* const obj = {}; +* set(obj, 'a.b.c', 4); +* console.log(obj); // { a: { b: { c: 4 } } } +*/ +function set(obj, path, value) { + return updateWith(obj, path, () => value, () => void 0); +} +//#endregion +export { set }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/setWith.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/setWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e7054e86d316011118ed1ecd8917b7239b48a4f4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/setWith.d.mts @@ -0,0 +1,52 @@ +import { PropertyPath } from "../_internal/PropertyPath.mjs"; + +//#region src/compat/object/setWith.d.ts +/** + * Sets the value at the specified path of the given object using a customizer function. + * If any part of the path does not exist, it will be created based on the customizer's result. + * + * The customizer is invoked to produce the objects of the path. If the customizer returns + * a value, that value is used for the current path segment. If the customizer returns + * `undefined`, the method will create an appropriate object based on the path - an array + * if the next path segment is a valid array index, or an object otherwise. + * + * @template T - The type of the object. + * @param {T} object - The object to modify. + * @param {PropertyPath} path - The path of the property to set. + * @param {any} value - The value to set. + * @param {(nsValue: any, key: string, nsObject: T) => any} [customizer] - The function to customize assigned values. + * @returns {T} - The modified object. + * + * @example + * // Set a value with a customizer that creates arrays for numeric path segments + * const object = {}; + * setWith(object, '[0][1]', 'a', (value) => Array.isArray(value) ? value : []); + * // => { '0': [, 'a'] } + */ +declare function setWith(object: T, path: PropertyPath, value: any, customizer?: (nsValue: any, key: string, nsObject: T) => any): T; +/** + * Sets the value at the specified path of the given object using a customizer function. + * If any part of the path does not exist, it will be created based on the customizer's result. + * + * The customizer is invoked to produce the objects of the path. If the customizer returns + * a value, that value is used for the current path segment. If the customizer returns + * `undefined`, the method will create an appropriate object based on the path - an array + * if the next path segment is a valid array index, or an object otherwise. + * + * @template T - The type of the object. + * @template R - The type of the return value. + * @param {T} object - The object to modify. + * @param {PropertyPath} path - The path of the property to set. + * @param {any} value - The value to set. + * @param {(nsValue: any, key: string, nsObject: T) => any} [customizer] - The function to customize assigned values. + * @returns {R} - The modified object. + * + * @example + * // Set a value with a customizer that creates arrays for numeric path segments + * const object = {}; + * setWith(object, '[0][1]', 'a', (value) => Array.isArray(value) ? value : []); + * // => { '0': [, 'a'] } + */ +declare function setWith(object: T, path: PropertyPath, value: any, customizer?: (nsValue: any, key: string, nsObject: T) => any): R; +//#endregion +export { setWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/setWith.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/setWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6889df82b7ac3a59dfd6944f367531cfe84e9057 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/setWith.d.ts @@ -0,0 +1,52 @@ +import { PropertyPath } from "../_internal/PropertyPath.js"; + +//#region src/compat/object/setWith.d.ts +/** + * Sets the value at the specified path of the given object using a customizer function. + * If any part of the path does not exist, it will be created based on the customizer's result. + * + * The customizer is invoked to produce the objects of the path. If the customizer returns + * a value, that value is used for the current path segment. If the customizer returns + * `undefined`, the method will create an appropriate object based on the path - an array + * if the next path segment is a valid array index, or an object otherwise. + * + * @template T - The type of the object. + * @param {T} object - The object to modify. + * @param {PropertyPath} path - The path of the property to set. + * @param {any} value - The value to set. + * @param {(nsValue: any, key: string, nsObject: T) => any} [customizer] - The function to customize assigned values. + * @returns {T} - The modified object. + * + * @example + * // Set a value with a customizer that creates arrays for numeric path segments + * const object = {}; + * setWith(object, '[0][1]', 'a', (value) => Array.isArray(value) ? value : []); + * // => { '0': [, 'a'] } + */ +declare function setWith(object: T, path: PropertyPath, value: any, customizer?: (nsValue: any, key: string, nsObject: T) => any): T; +/** + * Sets the value at the specified path of the given object using a customizer function. + * If any part of the path does not exist, it will be created based on the customizer's result. + * + * The customizer is invoked to produce the objects of the path. If the customizer returns + * a value, that value is used for the current path segment. If the customizer returns + * `undefined`, the method will create an appropriate object based on the path - an array + * if the next path segment is a valid array index, or an object otherwise. + * + * @template T - The type of the object. + * @template R - The type of the return value. + * @param {T} object - The object to modify. + * @param {PropertyPath} path - The path of the property to set. + * @param {any} value - The value to set. + * @param {(nsValue: any, key: string, nsObject: T) => any} [customizer] - The function to customize assigned values. + * @returns {R} - The modified object. + * + * @example + * // Set a value with a customizer that creates arrays for numeric path segments + * const object = {}; + * setWith(object, '[0][1]', 'a', (value) => Array.isArray(value) ? value : []); + * // => { '0': [, 'a'] } + */ +declare function setWith(object: T, path: PropertyPath, value: any, customizer?: (nsValue: any, key: string, nsObject: T) => any): R; +//#endregion +export { setWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/setWith.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/setWith.js new file mode 100644 index 0000000000000000000000000000000000000000..fd112230dc4c4b44a1bd34822bbdaedf789684d8 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/setWith.js @@ -0,0 +1,33 @@ +const require_updateWith = require("./updateWith.js"); +//#region src/compat/object/setWith.ts +/** +* Sets the value at the specified path of the given object using a customizer function. +* If any part of the path does not exist, it will be created based on the customizer's result. +* +* The customizer is invoked to produce the objects of the path. If the customizer returns +* a value, that value is used for the current path segment. If the customizer returns +* `undefined`, the method will create an appropriate object based on the path - an array +* if the next path segment is a valid array index, or an object otherwise. +* +* @template T - The type of the object. +* @template R - The type of the return value. +* @param {T} obj - The object to modify. +* @param {PropertyPath} path - The path of the property to set. +* @param {any} value - The value to set. +* @param {(value: any, key: string, object: T) => any} [customizer] - The function to customize assigned values. +* @returns {T | R} - The modified object. +* +* @example +* // Set a value with a customizer that creates arrays for numeric path segments +* const object = {}; +* setWith(object, '[0][1]', 'a', (value) => Array.isArray(value) ? value : []); +* // => { '0': [, 'a'] } +*/ +function setWith(obj, path, value, customizer) { + let customizerFn; + if (typeof customizer === "function") customizerFn = customizer; + else customizerFn = () => void 0; + return require_updateWith.updateWith(obj, path, () => value, customizerFn); +} +//#endregion +exports.setWith = setWith; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/setWith.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/setWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..da80d4bb632a3f6b942346156fdf8ccb8033ba23 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/setWith.mjs @@ -0,0 +1,33 @@ +import { updateWith } from "./updateWith.mjs"; +//#region src/compat/object/setWith.ts +/** +* Sets the value at the specified path of the given object using a customizer function. +* If any part of the path does not exist, it will be created based on the customizer's result. +* +* The customizer is invoked to produce the objects of the path. If the customizer returns +* a value, that value is used for the current path segment. If the customizer returns +* `undefined`, the method will create an appropriate object based on the path - an array +* if the next path segment is a valid array index, or an object otherwise. +* +* @template T - The type of the object. +* @template R - The type of the return value. +* @param {T} obj - The object to modify. +* @param {PropertyPath} path - The path of the property to set. +* @param {any} value - The value to set. +* @param {(value: any, key: string, object: T) => any} [customizer] - The function to customize assigned values. +* @returns {T | R} - The modified object. +* +* @example +* // Set a value with a customizer that creates arrays for numeric path segments +* const object = {}; +* setWith(object, '[0][1]', 'a', (value) => Array.isArray(value) ? value : []); +* // => { '0': [, 'a'] } +*/ +function setWith(obj, path, value, customizer) { + let customizerFn; + if (typeof customizer === "function") customizerFn = customizer; + else customizerFn = () => void 0; + return updateWith(obj, path, () => value, customizerFn); +} +//#endregion +export { setWith }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/toDefaulted.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/toDefaulted.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..744dac6831c0505ff77d89079e9b76dd1d92a1a4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/toDefaulted.d.mts @@ -0,0 +1,123 @@ +//#region src/compat/object/toDefaulted.d.ts +/** + * Creates a new object based on the provided `object`, applying default values from the `sources` to ensure that no properties are left `undefined`. + * It assigns default values to properties that are either `undefined` or come from `Object.prototype`. + * + * You can provide multiple source objects to set these default values, + * and they will be applied in the order they are given, from left to right. + * Once a property has been set, any later values for that property will be ignored. + * + * Note: This function creates a new object. If you want to modify the `object`, use the `defaults` function instead. + * + * Note: This function creates a new object. If you want to modify the `object`, use the `defaults` function instead. + * + * @template T - The type of the object being processed. + * @param {T} object - The target object. + * @returns {T} The cloned object. + */ +declare function toDefaulted(object: T): T; +/** + * Creates a new object based on the provided `object`, applying default values from the `sources` to ensure that no properties are left `undefined`. + * It assigns default values to properties that are either `undefined` or come from `Object.prototype`. + * + * You can provide multiple source objects to set these default values, + * and they will be applied in the order they are given, from left to right. + * Once a property has been set, any later values for that property will be ignored. + * + * Note: This function creates a new object. If you want to modify the `object`, use the `defaults` function instead. + * + * @template T - The type of the object being processed. + * @template S - The type of the object that provides default values. + * @param {T} object - The target object that will receive default values. + * @param {S} source - The object that specifies the default values to apply. + * @returns {NonNullable} A new object that combines the target and default values, ensuring no properties are left undefined. + */ +declare function toDefaulted(object: T, source: S): NonNullable; +/** + * Creates a new object based on the provided `object`, applying default values from the `sources` to ensure that no properties are left `undefined`. + * It assigns default values to properties that are either `undefined` or come from `Object.prototype`. + * + * You can provide multiple source objects to set these default values, + * and they will be applied in the order they are given, from left to right. + * Once a property has been set, any later values for that property will be ignored. + * + * Note: This function creates a new object. If you want to modify the `object`, use the `defaults` function instead. + * + * @template T - The type of the object being processed. + * @template S1 - The type of the first object that provides default values. + * @template S2 - The type of the second object that provides default values. + * @param {T} object - The target object that will receive default values. + * @param {S1} source1 - The first object that specifies the default values to apply. + * @param {S2} source2 - The second object that specifies the default values to apply. + * @returns {NonNullable} A new object that combines the target and default values, ensuring no properties are left undefined. + */ +declare function toDefaulted(object: T, source1: S1, source2: S2): NonNullable; +/** + * Creates a new object based on the provided `object`, applying default values from the `sources` to ensure that no properties are left `undefined`. + * It assigns default values to properties that are either `undefined` or come from `Object.prototype`. + * + * You can provide multiple source objects to set these default values, + * and they will be applied in the order they are given, from left to right. + * Once a property has been set, any later values for that property will be ignored. + * + * Note: This function creates a new object. If you want to modify the `object`, use the `defaults` function instead. + * + * @template T - The type of the object being processed. + * @template S1 - The type of the first object that provides default values. + * @template S2 - The type of the second object that provides default values. + * @template S3 - The type of the third object that provides default values. + * @param {T} object - The target object that will receive default values. + * @param {S1} source1 - The first object that specifies the default values to apply. + * @param {S2} source2 - The second object that specifies the default values to apply. + * @param {S3} source3 - The third object that specifies the default values to apply. + * @returns {NonNullable} A new object that combines the target and default values, ensuring no properties are left undefined. + */ +declare function toDefaulted(object: T, source1: S1, source2: S2, source3: S3): NonNullable; +/** + * Creates a new object based on the provided `object`, applying default values from the `sources` to ensure that no properties are left `undefined`. + * It assigns default values to properties that are either `undefined` or come from `Object.prototype`. + * + * You can provide multiple source objects to set these default values, + * and they will be applied in the order they are given, from left to right. + * Once a property has been set, any later values for that property will be ignored. + * + * Note: This function creates a new object. If you want to modify the `object`, use the `defaults` function instead. + * + * @template T - The type of the object being processed. + * @template S1 - The type of the first object that provides default values. + * @template S2 - The type of the second object that provides default values. + * @template S3 - The type of the third object that provides default values. + * @template S4 - The type of the fourth object that provides default values. + * @param {T} object - The target object that will receive default values. + * @param {S1} source1 - The first object that specifies the default values to apply. + * @param {S2} source2 - The second object that specifies the default values to apply. + * @param {S3} source3 - The third object that specifies the default values to apply. + * @param {S4} source4 - The fourth object that specifies the default values to apply. + * @returns {NonNullable} A new object that combines the target and default values, ensuring no properties are left undefined. + */ +declare function toDefaulted(object: T, source1: S1, source2: S2, source3: S3, source4: S4): NonNullable; +/** + * Creates a new object based on the provided `object`, applying default values from the `sources` to ensure that no properties are left `undefined`. + * It assigns default values to properties that are either `undefined` or come from `Object.prototype`. + * + * You can provide multiple source objects to set these default values, + * and they will be applied in the order they are given, from left to right. + * Once a property has been set, any later values for that property will be ignored. + * + * Note: This function creates a new object. If you want to modify the `object`, use the `defaults` function instead. + * + * @template T - The type of the object being processed. + * @template S - The type of the objects that provides default values. + * @param {T} object - The target object that will receive default values. + * @param {S[]} sources - The objects that specifies the default values to apply. + * @returns {object} A new object that combines the target and default values, ensuring no properties are left undefined. + * + * @example + * toDefaulted({ a: 1 }, { a: 2, b: 2 }, { c: 3 }); // { a: 1, b: 2, c: 3 } + * toDefaulted({ a: 1, b: 2 }, { b: 3 }, { c: 3 }); // { a: 1, b: 2, c: 3 } + * toDefaulted({ a: null }, { a: 1 }); // { a: null } + * toDefaulted({ a: undefined }, { a: 1 }); // { a: 1 } + */ +declare function toDefaulted(object: T, ...sources: S[]): object; +//#endregion +export { toDefaulted }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/toDefaulted.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/toDefaulted.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..744dac6831c0505ff77d89079e9b76dd1d92a1a4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/toDefaulted.d.ts @@ -0,0 +1,123 @@ +//#region src/compat/object/toDefaulted.d.ts +/** + * Creates a new object based on the provided `object`, applying default values from the `sources` to ensure that no properties are left `undefined`. + * It assigns default values to properties that are either `undefined` or come from `Object.prototype`. + * + * You can provide multiple source objects to set these default values, + * and they will be applied in the order they are given, from left to right. + * Once a property has been set, any later values for that property will be ignored. + * + * Note: This function creates a new object. If you want to modify the `object`, use the `defaults` function instead. + * + * Note: This function creates a new object. If you want to modify the `object`, use the `defaults` function instead. + * + * @template T - The type of the object being processed. + * @param {T} object - The target object. + * @returns {T} The cloned object. + */ +declare function toDefaulted(object: T): T; +/** + * Creates a new object based on the provided `object`, applying default values from the `sources` to ensure that no properties are left `undefined`. + * It assigns default values to properties that are either `undefined` or come from `Object.prototype`. + * + * You can provide multiple source objects to set these default values, + * and they will be applied in the order they are given, from left to right. + * Once a property has been set, any later values for that property will be ignored. + * + * Note: This function creates a new object. If you want to modify the `object`, use the `defaults` function instead. + * + * @template T - The type of the object being processed. + * @template S - The type of the object that provides default values. + * @param {T} object - The target object that will receive default values. + * @param {S} source - The object that specifies the default values to apply. + * @returns {NonNullable} A new object that combines the target and default values, ensuring no properties are left undefined. + */ +declare function toDefaulted(object: T, source: S): NonNullable; +/** + * Creates a new object based on the provided `object`, applying default values from the `sources` to ensure that no properties are left `undefined`. + * It assigns default values to properties that are either `undefined` or come from `Object.prototype`. + * + * You can provide multiple source objects to set these default values, + * and they will be applied in the order they are given, from left to right. + * Once a property has been set, any later values for that property will be ignored. + * + * Note: This function creates a new object. If you want to modify the `object`, use the `defaults` function instead. + * + * @template T - The type of the object being processed. + * @template S1 - The type of the first object that provides default values. + * @template S2 - The type of the second object that provides default values. + * @param {T} object - The target object that will receive default values. + * @param {S1} source1 - The first object that specifies the default values to apply. + * @param {S2} source2 - The second object that specifies the default values to apply. + * @returns {NonNullable} A new object that combines the target and default values, ensuring no properties are left undefined. + */ +declare function toDefaulted(object: T, source1: S1, source2: S2): NonNullable; +/** + * Creates a new object based on the provided `object`, applying default values from the `sources` to ensure that no properties are left `undefined`. + * It assigns default values to properties that are either `undefined` or come from `Object.prototype`. + * + * You can provide multiple source objects to set these default values, + * and they will be applied in the order they are given, from left to right. + * Once a property has been set, any later values for that property will be ignored. + * + * Note: This function creates a new object. If you want to modify the `object`, use the `defaults` function instead. + * + * @template T - The type of the object being processed. + * @template S1 - The type of the first object that provides default values. + * @template S2 - The type of the second object that provides default values. + * @template S3 - The type of the third object that provides default values. + * @param {T} object - The target object that will receive default values. + * @param {S1} source1 - The first object that specifies the default values to apply. + * @param {S2} source2 - The second object that specifies the default values to apply. + * @param {S3} source3 - The third object that specifies the default values to apply. + * @returns {NonNullable} A new object that combines the target and default values, ensuring no properties are left undefined. + */ +declare function toDefaulted(object: T, source1: S1, source2: S2, source3: S3): NonNullable; +/** + * Creates a new object based on the provided `object`, applying default values from the `sources` to ensure that no properties are left `undefined`. + * It assigns default values to properties that are either `undefined` or come from `Object.prototype`. + * + * You can provide multiple source objects to set these default values, + * and they will be applied in the order they are given, from left to right. + * Once a property has been set, any later values for that property will be ignored. + * + * Note: This function creates a new object. If you want to modify the `object`, use the `defaults` function instead. + * + * @template T - The type of the object being processed. + * @template S1 - The type of the first object that provides default values. + * @template S2 - The type of the second object that provides default values. + * @template S3 - The type of the third object that provides default values. + * @template S4 - The type of the fourth object that provides default values. + * @param {T} object - The target object that will receive default values. + * @param {S1} source1 - The first object that specifies the default values to apply. + * @param {S2} source2 - The second object that specifies the default values to apply. + * @param {S3} source3 - The third object that specifies the default values to apply. + * @param {S4} source4 - The fourth object that specifies the default values to apply. + * @returns {NonNullable} A new object that combines the target and default values, ensuring no properties are left undefined. + */ +declare function toDefaulted(object: T, source1: S1, source2: S2, source3: S3, source4: S4): NonNullable; +/** + * Creates a new object based on the provided `object`, applying default values from the `sources` to ensure that no properties are left `undefined`. + * It assigns default values to properties that are either `undefined` or come from `Object.prototype`. + * + * You can provide multiple source objects to set these default values, + * and they will be applied in the order they are given, from left to right. + * Once a property has been set, any later values for that property will be ignored. + * + * Note: This function creates a new object. If you want to modify the `object`, use the `defaults` function instead. + * + * @template T - The type of the object being processed. + * @template S - The type of the objects that provides default values. + * @param {T} object - The target object that will receive default values. + * @param {S[]} sources - The objects that specifies the default values to apply. + * @returns {object} A new object that combines the target and default values, ensuring no properties are left undefined. + * + * @example + * toDefaulted({ a: 1 }, { a: 2, b: 2 }, { c: 3 }); // { a: 1, b: 2, c: 3 } + * toDefaulted({ a: 1, b: 2 }, { b: 3 }, { c: 3 }); // { a: 1, b: 2, c: 3 } + * toDefaulted({ a: null }, { a: 1 }); // { a: null } + * toDefaulted({ a: undefined }, { a: 1 }); // { a: 1 } + */ +declare function toDefaulted(object: T, ...sources: S[]): object; +//#endregion +export { toDefaulted }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/toDefaulted.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/toDefaulted.js new file mode 100644 index 0000000000000000000000000000000000000000..516fefdb050c0824450babb655cc8851b529ece9 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/toDefaulted.js @@ -0,0 +1,31 @@ +const require_cloneDeep = require("./cloneDeep.js"); +const require_defaults = require("./defaults.js"); +//#region src/compat/object/toDefaulted.ts +/** +* Creates a new object based on the provided `object`, applying default values from the `sources` to ensure that no properties are left `undefined`. +* It assigns default values to properties that are either `undefined` or come from `Object.prototype`. +* +* You can provide multiple source objects to set these default values, +* and they will be applied in the order they are given, from left to right. +* Once a property has been set, any later values for that property will be ignored. +* +* Note: This function creates a new object. If you want to modify the `object`, use the `defaults` function instead. +* +* @template T - The type of the object being processed. +* @template S - The type of the objects that provides default values. +* @param {T} object - The target object that will receive default values. +* @param {S[]} sources - The objects that specifies the default values to apply. +* @returns {object} A new object that combines the target and default values, ensuring no properties are left undefined. +* +* @example +* toDefaulted({ a: 1 }, { a: 2, b: 2 }, { c: 3 }); // { a: 1, b: 2, c: 3 } +* toDefaulted({ a: 1, b: 2 }, { b: 3 }, { c: 3 }); // { a: 1, b: 2, c: 3 } +* toDefaulted({ a: null }, { a: 1 }); // { a: null } +* toDefaulted({ a: undefined }, { a: 1 }); // { a: 1 } +*/ +function toDefaulted(object, ...sources) { + const cloned = require_cloneDeep.cloneDeep(object); + return require_defaults.defaults(cloned, ...sources); +} +//#endregion +exports.toDefaulted = toDefaulted; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/toDefaulted.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/toDefaulted.mjs new file mode 100644 index 0000000000000000000000000000000000000000..dfdf322cc446c16eae554066f474efbba9233af7 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/toDefaulted.mjs @@ -0,0 +1,30 @@ +import { cloneDeep } from "./cloneDeep.mjs"; +import { defaults } from "./defaults.mjs"; +//#region src/compat/object/toDefaulted.ts +/** +* Creates a new object based on the provided `object`, applying default values from the `sources` to ensure that no properties are left `undefined`. +* It assigns default values to properties that are either `undefined` or come from `Object.prototype`. +* +* You can provide multiple source objects to set these default values, +* and they will be applied in the order they are given, from left to right. +* Once a property has been set, any later values for that property will be ignored. +* +* Note: This function creates a new object. If you want to modify the `object`, use the `defaults` function instead. +* +* @template T - The type of the object being processed. +* @template S - The type of the objects that provides default values. +* @param {T} object - The target object that will receive default values. +* @param {S[]} sources - The objects that specifies the default values to apply. +* @returns {object} A new object that combines the target and default values, ensuring no properties are left undefined. +* +* @example +* toDefaulted({ a: 1 }, { a: 2, b: 2 }, { c: 3 }); // { a: 1, b: 2, c: 3 } +* toDefaulted({ a: 1, b: 2 }, { b: 3 }, { c: 3 }); // { a: 1, b: 2, c: 3 } +* toDefaulted({ a: null }, { a: 1 }); // { a: null } +* toDefaulted({ a: undefined }, { a: 1 }); // { a: 1 } +*/ +function toDefaulted(object, ...sources) { + return defaults(cloneDeep(object), ...sources); +} +//#endregion +export { toDefaulted }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairs.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairs.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..4013c171f660055721df0207bc9bf23273b540ba --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairs.d.mts @@ -0,0 +1,26 @@ +//#region src/compat/object/toPairs.d.ts +/** + * Creates an array of key-value pairs from an object. + * + * @template T + * @param {Record | Record} object - The object to query. + * @returns {Array<[string, T]>} Returns the array of key-value pairs. + * + * @example + * const object = { a: 1, b: 2 }; + * toPairs(object); // [['a', 1], ['b', 2]] + */ +declare function toPairs(object?: Record | Record): Array<[string, T]>; +/** + * Creates an array of key-value pairs from an object. + * + * @param {object} object - The object to query. + * @returns {Array<[string, any]>} Returns the array of key-value pairs. + * + * @example + * const object = { a: 1, b: 2 }; + * toPairs(object); // [['a', 1], ['b', 2]] + */ +declare function toPairs(object?: object): Array<[string, any]>; +//#endregion +export { toPairs }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairs.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairs.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4013c171f660055721df0207bc9bf23273b540ba --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairs.d.ts @@ -0,0 +1,26 @@ +//#region src/compat/object/toPairs.d.ts +/** + * Creates an array of key-value pairs from an object. + * + * @template T + * @param {Record | Record} object - The object to query. + * @returns {Array<[string, T]>} Returns the array of key-value pairs. + * + * @example + * const object = { a: 1, b: 2 }; + * toPairs(object); // [['a', 1], ['b', 2]] + */ +declare function toPairs(object?: Record | Record): Array<[string, T]>; +/** + * Creates an array of key-value pairs from an object. + * + * @param {object} object - The object to query. + * @returns {Array<[string, any]>} Returns the array of key-value pairs. + * + * @example + * const object = { a: 1, b: 2 }; + * toPairs(object); // [['a', 1], ['b', 2]] + */ +declare function toPairs(object?: object): Array<[string, any]>; +//#endregion +export { toPairs }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairs.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairs.js new file mode 100644 index 0000000000000000000000000000000000000000..a103baa7c053729361311dc473fb968dc3e1785b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairs.js @@ -0,0 +1,37 @@ +const require_keys = require("./keys.js"); +const require_mapToEntries = require("../_internal/mapToEntries.js"); +const require_setToEntries = require("../_internal/setToEntries.js"); +//#region src/compat/object/toPairs.ts +/** +* Creates an array of key-value pairs from an object, set, or map. +* +* @template T +* @param {Record | Record | object} object - The object, set, or map to query. +* @returns {Array<[string, T]> | Array<[string, any]>} Returns the array of key-value pairs. +* +* @example +* const object = { a: 1, b: 2 }; +* toPairs(object); // [['a', 1], ['b', 2]] +* +* const set = new Set([1, 2]); +* toPairs(set); // [[1, 1], [2, 2]] +* +* const map = new Map(); +* map.set('a', 1); +* map.set('b', 2); +* toPairs(map); // [['a', 1], ['b', 2]] +*/ +function toPairs(object) { + if (object == null) return []; + if (object instanceof Set) return require_setToEntries.setToEntries(object); + if (object instanceof Map) return require_mapToEntries.mapToEntries(object); + const keys$1 = require_keys.keys(object); + const result = new Array(keys$1.length); + for (let i = 0; i < keys$1.length; i++) { + const key = keys$1[i]; + result[i] = [key, object[key]]; + } + return result; +} +//#endregion +exports.toPairs = toPairs; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairs.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairs.mjs new file mode 100644 index 0000000000000000000000000000000000000000..49fb661f4637bb0ae784e76e1f98fe277884244f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairs.mjs @@ -0,0 +1,37 @@ +import { keys } from "./keys.mjs"; +import { mapToEntries } from "../_internal/mapToEntries.mjs"; +import { setToEntries } from "../_internal/setToEntries.mjs"; +//#region src/compat/object/toPairs.ts +/** +* Creates an array of key-value pairs from an object, set, or map. +* +* @template T +* @param {Record | Record | object} object - The object, set, or map to query. +* @returns {Array<[string, T]> | Array<[string, any]>} Returns the array of key-value pairs. +* +* @example +* const object = { a: 1, b: 2 }; +* toPairs(object); // [['a', 1], ['b', 2]] +* +* const set = new Set([1, 2]); +* toPairs(set); // [[1, 1], [2, 2]] +* +* const map = new Map(); +* map.set('a', 1); +* map.set('b', 2); +* toPairs(map); // [['a', 1], ['b', 2]] +*/ +function toPairs(object) { + if (object == null) return []; + if (object instanceof Set) return setToEntries(object); + if (object instanceof Map) return mapToEntries(object); + const keys$1 = keys(object); + const result = new Array(keys$1.length); + for (let i = 0; i < keys$1.length; i++) { + const key = keys$1[i]; + result[i] = [key, object[key]]; + } + return result; +} +//#endregion +export { toPairs }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairsIn.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairsIn.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6abfb00aa0d8ca11365d7f6f9cc677007dba62b5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairsIn.d.mts @@ -0,0 +1,26 @@ +//#region src/compat/object/toPairsIn.d.ts +/** + * Creates an array of key-value pairs from an object, including inherited properties. + * + * @template T + * @param {Record | Record} object - The object to query. + * @returns {Array<[string, T]>} Returns the array of key-value pairs. + * + * @example + * const object = { a: 1, b: 2 }; + * toPairsIn(object); // [['a', 1], ['b', 2]] + */ +declare function toPairsIn(object?: Record | Record): Array<[string, T]>; +/** + * Creates an array of key-value pairs from an object, including inherited properties. + * + * @param {object} object - The object to query. + * @returns {Array<[string, any]>} Returns the array of key-value pairs. + * + * @example + * const object = { a: 1, b: 2 }; + * toPairsIn(object); // [['a', 1], ['b', 2]] + */ +declare function toPairsIn(object?: object): Array<[string, any]>; +//#endregion +export { toPairsIn }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairsIn.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairsIn.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6abfb00aa0d8ca11365d7f6f9cc677007dba62b5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairsIn.d.ts @@ -0,0 +1,26 @@ +//#region src/compat/object/toPairsIn.d.ts +/** + * Creates an array of key-value pairs from an object, including inherited properties. + * + * @template T + * @param {Record | Record} object - The object to query. + * @returns {Array<[string, T]>} Returns the array of key-value pairs. + * + * @example + * const object = { a: 1, b: 2 }; + * toPairsIn(object); // [['a', 1], ['b', 2]] + */ +declare function toPairsIn(object?: Record | Record): Array<[string, T]>; +/** + * Creates an array of key-value pairs from an object, including inherited properties. + * + * @param {object} object - The object to query. + * @returns {Array<[string, any]>} Returns the array of key-value pairs. + * + * @example + * const object = { a: 1, b: 2 }; + * toPairsIn(object); // [['a', 1], ['b', 2]] + */ +declare function toPairsIn(object?: object): Array<[string, any]>; +//#endregion +export { toPairsIn }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairsIn.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairsIn.js new file mode 100644 index 0000000000000000000000000000000000000000..7446b7e40cf0bd5e13ae650750fafe004e736188 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairsIn.js @@ -0,0 +1,35 @@ +const require_keysIn = require("./keysIn.js"); +const require_mapToEntries = require("../_internal/mapToEntries.js"); +const require_setToEntries = require("../_internal/setToEntries.js"); +//#region src/compat/object/toPairsIn.ts +/** +* Creates an array of key-value pairs from an object, set, or map, including inherited properties. +* +* @param {Record | Record | object} object The object, set, or map to query. +* @returns {Array<[string, T]> | Array<[string, any]>} Returns the array of key-value pairs. +* @example +* const object = { a: 1, b: 2 }; +* toPairsIn(object); // [['a', 1], ['b', 2]] +* +* const set = new Set([1, 2]); +* toPairsIn(set); // [[1, 1], [2, 2]] +* +* const map = new Map(); +* map.set('a', 1); +* map.set('b', 2); +* toPairsIn(map); // [['a', 1], ['b', 2]] +*/ +function toPairsIn(object) { + if (object == null) return []; + if (object instanceof Set) return require_setToEntries.setToEntries(object); + if (object instanceof Map) return require_mapToEntries.mapToEntries(object); + const keys = require_keysIn.keysIn(object); + const result = new Array(keys.length); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + result[i] = [key, object[key]]; + } + return result; +} +//#endregion +exports.toPairsIn = toPairsIn; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairsIn.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairsIn.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3a886d36ac22c7373ca95d3c2faa5f0e5f75e921 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/toPairsIn.mjs @@ -0,0 +1,35 @@ +import { keysIn } from "./keysIn.mjs"; +import { mapToEntries } from "../_internal/mapToEntries.mjs"; +import { setToEntries } from "../_internal/setToEntries.mjs"; +//#region src/compat/object/toPairsIn.ts +/** +* Creates an array of key-value pairs from an object, set, or map, including inherited properties. +* +* @param {Record | Record | object} object The object, set, or map to query. +* @returns {Array<[string, T]> | Array<[string, any]>} Returns the array of key-value pairs. +* @example +* const object = { a: 1, b: 2 }; +* toPairsIn(object); // [['a', 1], ['b', 2]] +* +* const set = new Set([1, 2]); +* toPairsIn(set); // [[1, 1], [2, 2]] +* +* const map = new Map(); +* map.set('a', 1); +* map.set('b', 2); +* toPairsIn(map); // [['a', 1], ['b', 2]] +*/ +function toPairsIn(object) { + if (object == null) return []; + if (object instanceof Set) return setToEntries(object); + if (object instanceof Map) return mapToEntries(object); + const keys = keysIn(object); + const result = new Array(keys.length); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + result[i] = [key, object[key]]; + } + return result; +} +//#endregion +export { toPairsIn }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/transform.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/transform.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..398f73784dda2d198cb574d5452851fa10fbde6c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/transform.d.mts @@ -0,0 +1,75 @@ +//#region src/compat/object/transform.d.ts +/** + * Traverses object values and creates a new object by accumulating them in the desired form. + * + * @template T - The type of object. + * @template R - The type of accumulator. + * @param {readonly T[]} object - The array to iterate over. + * @param {(acc: R, curr: T, index: number, arr: T[]) => void} iteratee - The function invoked per iteration. + * @param {R} [accumulator] - The initial value. + * @returns {R} Returns the accumulated value. + * + * @example + * const array = [2, 3, 4]; + * transform(array, (acc, value) => { acc.push(value * 2); }, []); + * // => [4, 6, 8] + */ +declare function transform(object: readonly T[], iteratee: (acc: R, curr: T, index: number, arr: T[]) => void, accumulator?: R): R; +/** + * Traverses object values and creates a new object by accumulating them in the desired form. + * + * @template T - The type of object. + * @template R - The type of accumulator. + * @param {Record} object - The object to iterate over. + * @param {(acc: R, curr: T, key: string, dict: Record) => void} iteratee - The function invoked per iteration. + * @param {R} [accumulator] - The initial value. + * @returns {R} Returns the accumulated value. + * + * @example + * const obj = { 'a': 1, 'b': 2, 'c': 1 }; + * transform(obj, (result, value, key) => { (result[value] || (result[value] = [])).push(key) }, {}); + * // => { '1': ['a', 'c'], '2': ['b'] } + */ +declare function transform(object: Record, iteratee: (acc: R, curr: T, key: string, dict: Record) => void, accumulator?: R): R; +/** + * Traverses object values and creates a new object by accumulating them in the desired form. + * + * @template T - The type of object. + * @template R - The type of accumulator. + * @param {T} object - The object to iterate over. + * @param {(acc: R, curr: T[keyof T], key: keyof T, dict: Record) => void} iteratee - The function invoked per iteration. + * @param {R} [accumulator] - The initial value. + * @returns {R} Returns the accumulated value. + * + * @example + * const obj = { x: 1, y: 2, z: 3 }; + * transform(obj, (acc, value, key) => { acc[key] = value * 2; }, {}); + * // => { x: 2, y: 4, z: 6 } + */ +declare function transform(object: T, iteratee: (acc: R, curr: T[keyof T], key: keyof T, dict: Record) => void, accumulator?: R): R; +/** + * Traverses object values and creates a new object by accumulating them in the desired form. + * + * @param {any[]} object - The array to iterate over. + * @returns {any[]} Returns the accumulated value. + * + * @example + * const array = [1, 2, 3]; + * transform(array); + * // => [1, 2, 3] + */ +declare function transform(object: any[]): any[]; +/** + * Traverses object values and creates a new object by accumulating them in the desired form. + * + * @param {object} object - The object to iterate over. + * @returns {Record} Returns the accumulated value. + * + * @example + * const obj = { a: 1, b: 2 }; + * transform(obj); + * // => { a: 1, b: 2 } + */ +declare function transform(object: object): Record; +//#endregion +export { transform }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/transform.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/transform.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..398f73784dda2d198cb574d5452851fa10fbde6c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/transform.d.ts @@ -0,0 +1,75 @@ +//#region src/compat/object/transform.d.ts +/** + * Traverses object values and creates a new object by accumulating them in the desired form. + * + * @template T - The type of object. + * @template R - The type of accumulator. + * @param {readonly T[]} object - The array to iterate over. + * @param {(acc: R, curr: T, index: number, arr: T[]) => void} iteratee - The function invoked per iteration. + * @param {R} [accumulator] - The initial value. + * @returns {R} Returns the accumulated value. + * + * @example + * const array = [2, 3, 4]; + * transform(array, (acc, value) => { acc.push(value * 2); }, []); + * // => [4, 6, 8] + */ +declare function transform(object: readonly T[], iteratee: (acc: R, curr: T, index: number, arr: T[]) => void, accumulator?: R): R; +/** + * Traverses object values and creates a new object by accumulating them in the desired form. + * + * @template T - The type of object. + * @template R - The type of accumulator. + * @param {Record} object - The object to iterate over. + * @param {(acc: R, curr: T, key: string, dict: Record) => void} iteratee - The function invoked per iteration. + * @param {R} [accumulator] - The initial value. + * @returns {R} Returns the accumulated value. + * + * @example + * const obj = { 'a': 1, 'b': 2, 'c': 1 }; + * transform(obj, (result, value, key) => { (result[value] || (result[value] = [])).push(key) }, {}); + * // => { '1': ['a', 'c'], '2': ['b'] } + */ +declare function transform(object: Record, iteratee: (acc: R, curr: T, key: string, dict: Record) => void, accumulator?: R): R; +/** + * Traverses object values and creates a new object by accumulating them in the desired form. + * + * @template T - The type of object. + * @template R - The type of accumulator. + * @param {T} object - The object to iterate over. + * @param {(acc: R, curr: T[keyof T], key: keyof T, dict: Record) => void} iteratee - The function invoked per iteration. + * @param {R} [accumulator] - The initial value. + * @returns {R} Returns the accumulated value. + * + * @example + * const obj = { x: 1, y: 2, z: 3 }; + * transform(obj, (acc, value, key) => { acc[key] = value * 2; }, {}); + * // => { x: 2, y: 4, z: 6 } + */ +declare function transform(object: T, iteratee: (acc: R, curr: T[keyof T], key: keyof T, dict: Record) => void, accumulator?: R): R; +/** + * Traverses object values and creates a new object by accumulating them in the desired form. + * + * @param {any[]} object - The array to iterate over. + * @returns {any[]} Returns the accumulated value. + * + * @example + * const array = [1, 2, 3]; + * transform(array); + * // => [1, 2, 3] + */ +declare function transform(object: any[]): any[]; +/** + * Traverses object values and creates a new object by accumulating them in the desired form. + * + * @param {object} object - The object to iterate over. + * @returns {Record} Returns the accumulated value. + * + * @example + * const obj = { a: 1, b: 2 }; + * transform(obj); + * // => { a: 1, b: 2 } + */ +declare function transform(object: object): Record; +//#endregion +export { transform }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/transform.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/transform.js new file mode 100644 index 0000000000000000000000000000000000000000..f426588959bf41eeb33c9d2daa7922e63047dee1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/transform.js @@ -0,0 +1,44 @@ +const require_identity = require("../../function/identity.js"); +const require_isFunction = require("../../predicate/isFunction.js"); +const require_isObject = require("../predicate/isObject.js"); +const require_iteratee = require("../util/iteratee.js"); +const require_forEach = require("../array/forEach.js"); +const require_isTypedArray = require("../predicate/isTypedArray.js"); +const require_isBuffer = require("../predicate/isBuffer.js"); +//#region src/compat/object/transform.ts +/** +* Traverses object values and creates a new object by accumulating them in the desired form. +* +* If no initial value is provided for `accumulator`, it creates a new array or object with the same prototype. +* +The traversal is interrupted when the `iteratee` function returns `false`. +* +* @template T - The type of object. +* @template U - The type of accumulator. +* @param {readonly T[] | T} object - The object to iterate over. +* @param {(accumulator: U, value: T | T[keyof T], key: any, object: T[] | T) => unknown} [iteratee] - The function invoked per iteration. +* @param {U} [accumulator] - The initial value. +* @returns {U} Returns the accumulated value. +* +* @example +* // Transform an array +* const array = [2, 3, 4]; +* transform(array, (acc, value) => { acc += value; return value % 2 === 0; }, 0) // => 5 +* +* @example +* // Transform an object +* const obj = { 'a': 1, 'b': 2, 'c': 1 }; +* transform(obj, (result, value, key) => { (result[value] || (result[value] = [])).push(key) }, {}) // => { '1': ['a', 'c'], '2': ['b'] } +*/ +function transform(object, iteratee$1 = require_identity.identity, accumulator) { + const isArrayOrBufferOrTypedArray = Array.isArray(object) || require_isBuffer.isBuffer(object) || require_isTypedArray.isTypedArray(object); + iteratee$1 = require_iteratee.iteratee(iteratee$1); + if (accumulator == null) if (isArrayOrBufferOrTypedArray) accumulator = []; + else if (require_isObject.isObject(object) && require_isFunction.isFunction(object.constructor)) accumulator = Object.create(Object.getPrototypeOf(object)); + else accumulator = {}; + if (object == null) return accumulator; + require_forEach.forEach(object, (value, key, object) => iteratee$1(accumulator, value, key, object)); + return accumulator; +} +//#endregion +exports.transform = transform; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/transform.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/transform.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2d1dddc36bd024c8f9e8a7d5d4190ce17d0d5265 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/transform.mjs @@ -0,0 +1,44 @@ +import { identity } from "../../function/identity.mjs"; +import { isFunction } from "../../predicate/isFunction.mjs"; +import { isObject } from "../predicate/isObject.mjs"; +import { iteratee } from "../util/iteratee.mjs"; +import { forEach } from "../array/forEach.mjs"; +import { isTypedArray } from "../predicate/isTypedArray.mjs"; +import { isBuffer } from "../predicate/isBuffer.mjs"; +//#region src/compat/object/transform.ts +/** +* Traverses object values and creates a new object by accumulating them in the desired form. +* +* If no initial value is provided for `accumulator`, it creates a new array or object with the same prototype. +* +The traversal is interrupted when the `iteratee` function returns `false`. +* +* @template T - The type of object. +* @template U - The type of accumulator. +* @param {readonly T[] | T} object - The object to iterate over. +* @param {(accumulator: U, value: T | T[keyof T], key: any, object: T[] | T) => unknown} [iteratee] - The function invoked per iteration. +* @param {U} [accumulator] - The initial value. +* @returns {U} Returns the accumulated value. +* +* @example +* // Transform an array +* const array = [2, 3, 4]; +* transform(array, (acc, value) => { acc += value; return value % 2 === 0; }, 0) // => 5 +* +* @example +* // Transform an object +* const obj = { 'a': 1, 'b': 2, 'c': 1 }; +* transform(obj, (result, value, key) => { (result[value] || (result[value] = [])).push(key) }, {}) // => { '1': ['a', 'c'], '2': ['b'] } +*/ +function transform(object, iteratee$1 = identity, accumulator) { + const isArrayOrBufferOrTypedArray = Array.isArray(object) || isBuffer(object) || isTypedArray(object); + iteratee$1 = iteratee(iteratee$1); + if (accumulator == null) if (isArrayOrBufferOrTypedArray) accumulator = []; + else if (isObject(object) && isFunction(object.constructor)) accumulator = Object.create(Object.getPrototypeOf(object)); + else accumulator = {}; + if (object == null) return accumulator; + forEach(object, (value, key, object) => iteratee$1(accumulator, value, key, object)); + return accumulator; +} +//#endregion +export { transform }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/unset.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/unset.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b320d2d535ec69d1f06808a20662b371cc796358 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/unset.d.mts @@ -0,0 +1,21 @@ +//#region src/compat/object/unset.d.ts +/** + * Removes the property at the given path of the object. + * + * @param {unknown} obj - The object to modify. + * @param {PropertyKey | readonly PropertyKey[]} path - The path of the property to unset. + * @returns {boolean} - Returns true if the property is deleted, else false. + * + * @example + * const obj = { a: { b: { c: 42 } } }; + * unset(obj, 'a.b.c'); // true + * console.log(obj); // { a: { b: {} } } + * + * @example + * const obj = { a: { b: { c: 42 } } }; + * unset(obj, ['a', 'b', 'c']); // true + * console.log(obj); // { a: { b: {} } } + */ +declare function unset(obj: any, path: PropertyKey | readonly PropertyKey[]): boolean; +//#endregion +export { unset }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/unset.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/unset.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b320d2d535ec69d1f06808a20662b371cc796358 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/unset.d.ts @@ -0,0 +1,21 @@ +//#region src/compat/object/unset.d.ts +/** + * Removes the property at the given path of the object. + * + * @param {unknown} obj - The object to modify. + * @param {PropertyKey | readonly PropertyKey[]} path - The path of the property to unset. + * @returns {boolean} - Returns true if the property is deleted, else false. + * + * @example + * const obj = { a: { b: { c: 42 } } }; + * unset(obj, 'a.b.c'); // true + * console.log(obj); // { a: { b: {} } } + * + * @example + * const obj = { a: { b: { c: 42 } } }; + * unset(obj, ['a', 'b', 'c']); // true + * console.log(obj); // { a: { b: {} } } + */ +declare function unset(obj: any, path: PropertyKey | readonly PropertyKey[]): boolean; +//#endregion +export { unset }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/unset.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/unset.js new file mode 100644 index 0000000000000000000000000000000000000000..e0e6b41706dbbe14d1e6ad9d6bd5c4c20d210502 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/unset.js @@ -0,0 +1,66 @@ +const require_isUnsafeProperty = require("../../_internal/isUnsafeProperty.js"); +const require_isDeepKey = require("../_internal/isDeepKey.js"); +const require_toKey = require("../_internal/toKey.js"); +const require_toPath = require("../util/toPath.js"); +const require_get = require("./get.js"); +//#region src/compat/object/unset.ts +/** +* Removes the property at the given path of the object. +* +* @param {unknown} obj - The object to modify. +* @param {PropertyKey | readonly PropertyKey[]} path - The path of the property to unset. +* @returns {boolean} - Returns true if the property is deleted, else false. +* +* @example +* const obj = { a: { b: { c: 42 } } }; +* unset(obj, 'a.b.c'); // true +* console.log(obj); // { a: { b: {} } } +* +* @example +* const obj = { a: { b: { c: 42 } } }; +* unset(obj, ['a', 'b', 'c']); // true +* console.log(obj); // { a: { b: {} } } +*/ +function unset(obj, path) { + if (obj == null) return true; + switch (typeof path) { + case "symbol": + case "number": + case "object": + if (Array.isArray(path)) return unsetWithPath(obj, path); + if (typeof path === "number") path = require_toKey.toKey(path); + else if (typeof path === "object") if (Object.is(path?.valueOf(), -0)) path = "-0"; + else path = String(path); + if (require_isUnsafeProperty.isUnsafeProperty(path)) return false; + if (obj?.[path] === void 0) return true; + try { + delete obj[path]; + return true; + } catch { + return false; + } + case "string": + if (obj?.[path] === void 0 && require_isDeepKey.isDeepKey(path)) return unsetWithPath(obj, require_toPath.toPath(path)); + if (require_isUnsafeProperty.isUnsafeProperty(path)) return false; + try { + delete obj[path]; + return true; + } catch { + return false; + } + } +} +function unsetWithPath(obj, path) { + const parent = path.length === 1 ? obj : require_get.get(obj, path.slice(0, -1)); + const lastKey = path[path.length - 1]; + if (parent?.[lastKey] === void 0) return true; + if (require_isUnsafeProperty.isUnsafeProperty(lastKey)) return false; + try { + delete parent[lastKey]; + return true; + } catch { + return false; + } +} +//#endregion +exports.unset = unset; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/unset.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/unset.mjs new file mode 100644 index 0000000000000000000000000000000000000000..bea6c5e50e1f55535ca5066c06e42c625bbdd040 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/unset.mjs @@ -0,0 +1,66 @@ +import { isUnsafeProperty } from "../../_internal/isUnsafeProperty.mjs"; +import { isDeepKey } from "../_internal/isDeepKey.mjs"; +import { toKey } from "../_internal/toKey.mjs"; +import { toPath } from "../util/toPath.mjs"; +import { get } from "./get.mjs"; +//#region src/compat/object/unset.ts +/** +* Removes the property at the given path of the object. +* +* @param {unknown} obj - The object to modify. +* @param {PropertyKey | readonly PropertyKey[]} path - The path of the property to unset. +* @returns {boolean} - Returns true if the property is deleted, else false. +* +* @example +* const obj = { a: { b: { c: 42 } } }; +* unset(obj, 'a.b.c'); // true +* console.log(obj); // { a: { b: {} } } +* +* @example +* const obj = { a: { b: { c: 42 } } }; +* unset(obj, ['a', 'b', 'c']); // true +* console.log(obj); // { a: { b: {} } } +*/ +function unset(obj, path) { + if (obj == null) return true; + switch (typeof path) { + case "symbol": + case "number": + case "object": + if (Array.isArray(path)) return unsetWithPath(obj, path); + if (typeof path === "number") path = toKey(path); + else if (typeof path === "object") if (Object.is(path?.valueOf(), -0)) path = "-0"; + else path = String(path); + if (isUnsafeProperty(path)) return false; + if (obj?.[path] === void 0) return true; + try { + delete obj[path]; + return true; + } catch { + return false; + } + case "string": + if (obj?.[path] === void 0 && isDeepKey(path)) return unsetWithPath(obj, toPath(path)); + if (isUnsafeProperty(path)) return false; + try { + delete obj[path]; + return true; + } catch { + return false; + } + } +} +function unsetWithPath(obj, path) { + const parent = path.length === 1 ? obj : get(obj, path.slice(0, -1)); + const lastKey = path[path.length - 1]; + if (parent?.[lastKey] === void 0) return true; + if (isUnsafeProperty(lastKey)) return false; + try { + delete parent[lastKey]; + return true; + } catch { + return false; + } +} +//#endregion +export { unset }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/update.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/update.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6bd242ecfe70dde165324aee329c42de5a0cd4d1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/update.d.mts @@ -0,0 +1,15 @@ +import { PropertyPath } from "../_internal/PropertyPath.mjs"; + +//#region src/compat/object/update.d.ts +/** + * Updates the value at the specified path of the given object using an updater function. + * If any part of the path does not exist, it will be created. + * + * @param {object} obj - The object to modify. + * @param {PropertyPath} path - The path of the property to update. + * @param {(value: any) => any} updater - The function to produce the updated value. + * @returns {any} - The modified object. + */ +declare function update(obj: object, path: PropertyPath, updater: (value: any) => any): any; +//#endregion +export { update }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/update.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/update.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a3d539ea17fb72c0db0e210986f924d47c7fbce3 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/update.d.ts @@ -0,0 +1,15 @@ +import { PropertyPath } from "../_internal/PropertyPath.js"; + +//#region src/compat/object/update.d.ts +/** + * Updates the value at the specified path of the given object using an updater function. + * If any part of the path does not exist, it will be created. + * + * @param {object} obj - The object to modify. + * @param {PropertyPath} path - The path of the property to update. + * @param {(value: any) => any} updater - The function to produce the updated value. + * @returns {any} - The modified object. + */ +declare function update(obj: object, path: PropertyPath, updater: (value: any) => any): any; +//#endregion +export { update }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/update.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/update.js new file mode 100644 index 0000000000000000000000000000000000000000..677b40878b27b7b238322d38f522647849e7a66e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/update.js @@ -0,0 +1,16 @@ +const require_updateWith = require("./updateWith.js"); +//#region src/compat/object/update.ts +/** +* Updates the value at the specified path of the given object using an updater function. +* If any part of the path does not exist, it will be created. +* +* @param {object} obj - The object to modify. +* @param {PropertyPath} path - The path of the property to update. +* @param {(value: any) => any} updater - The function to produce the updated value. +* @returns {any} - The modified object. +*/ +function update(obj, path, updater) { + return require_updateWith.updateWith(obj, path, updater, () => void 0); +} +//#endregion +exports.update = update; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/update.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/update.mjs new file mode 100644 index 0000000000000000000000000000000000000000..890627ab02c50bb65100ccaa6523331b7fa00e07 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/update.mjs @@ -0,0 +1,16 @@ +import { updateWith } from "./updateWith.mjs"; +//#region src/compat/object/update.ts +/** +* Updates the value at the specified path of the given object using an updater function. +* If any part of the path does not exist, it will be created. +* +* @param {object} obj - The object to modify. +* @param {PropertyPath} path - The path of the property to update. +* @param {(value: any) => any} updater - The function to produce the updated value. +* @returns {any} - The modified object. +*/ +function update(obj, path, updater) { + return updateWith(obj, path, updater, () => void 0); +} +//#endregion +export { update }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/updateWith.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/updateWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..060c8a892f3ae5b47f3dead12deffe9b6215742b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/updateWith.d.mts @@ -0,0 +1,40 @@ +import { PropertyPath } from "../_internal/PropertyPath.mjs"; + +//#region src/compat/object/updateWith.d.ts +/** + * Updates the value at the specified path of the given object using an updater function and a customizer. + * If any part of the path does not exist, it will be created. + * + * @template T - The type of the object. + * @param {T} object - The object to modify. + * @param {PropertyPath} path - The path of the property to update. + * @param {(oldValue: any) => any} updater - The function to produce the updated value. + * @param {(value: any, key: string, object: T) => any} customizer - The function to customize the update process. + * @returns {T} - The modified object. + * + * @example + * const object = { 'a': [{ 'b': { 'c': 3 } }] }; + * updateWith(object, 'a[0].b.c', (n) => n * n); + * // => { 'a': [{ 'b': { 'c': 9 } }] } + */ +declare function updateWith(object: T, path: PropertyPath, updater: (oldValue: any) => any, customizer?: (value: any, key: string, object: T) => any): T; +/** + * Updates the value at the specified path of the given object using an updater function and a customizer. + * If any part of the path does not exist, it will be created. + * + * @template T - The type of the object. + * @template R - The type of the return value. + * @param {T} object - The object to modify. + * @param {PropertyPath} path - The path of the property to update. + * @param {(oldValue: any) => any} updater - The function to produce the updated value. + * @param {(value: any, key: string, object: T) => any} customizer - The function to customize the update process. + * @returns {R} - The modified object. + * + * @example + * const object = { 'a': [{ 'b': { 'c': 3 } }] }; + * updateWith(object, 'a[0].b.c', (n) => n * n); + * // => { 'a': [{ 'b': { 'c': 9 } }] } + */ +declare function updateWith(object: T, path: PropertyPath, updater: (oldValue: any) => any, customizer?: (value: any, key: string, object: T) => any): R; +//#endregion +export { updateWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/updateWith.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/updateWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..04eee9f2ff1d2a96dd799a3c0a31b5a1bbab7b00 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/updateWith.d.ts @@ -0,0 +1,40 @@ +import { PropertyPath } from "../_internal/PropertyPath.js"; + +//#region src/compat/object/updateWith.d.ts +/** + * Updates the value at the specified path of the given object using an updater function and a customizer. + * If any part of the path does not exist, it will be created. + * + * @template T - The type of the object. + * @param {T} object - The object to modify. + * @param {PropertyPath} path - The path of the property to update. + * @param {(oldValue: any) => any} updater - The function to produce the updated value. + * @param {(value: any, key: string, object: T) => any} customizer - The function to customize the update process. + * @returns {T} - The modified object. + * + * @example + * const object = { 'a': [{ 'b': { 'c': 3 } }] }; + * updateWith(object, 'a[0].b.c', (n) => n * n); + * // => { 'a': [{ 'b': { 'c': 9 } }] } + */ +declare function updateWith(object: T, path: PropertyPath, updater: (oldValue: any) => any, customizer?: (value: any, key: string, object: T) => any): T; +/** + * Updates the value at the specified path of the given object using an updater function and a customizer. + * If any part of the path does not exist, it will be created. + * + * @template T - The type of the object. + * @template R - The type of the return value. + * @param {T} object - The object to modify. + * @param {PropertyPath} path - The path of the property to update. + * @param {(oldValue: any) => any} updater - The function to produce the updated value. + * @param {(value: any, key: string, object: T) => any} customizer - The function to customize the update process. + * @returns {R} - The modified object. + * + * @example + * const object = { 'a': [{ 'b': { 'c': 3 } }] }; + * updateWith(object, 'a[0].b.c', (n) => n * n); + * // => { 'a': [{ 'b': { 'c': 9 } }] } + */ +declare function updateWith(object: T, path: PropertyPath, updater: (oldValue: any) => any, customizer?: (value: any, key: string, object: T) => any): R; +//#endregion +export { updateWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/updateWith.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/updateWith.js new file mode 100644 index 0000000000000000000000000000000000000000..943f1fc248603d88b27ff94442304265714bb68d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/updateWith.js @@ -0,0 +1,51 @@ +const require_isUnsafeProperty = require("../../_internal/isUnsafeProperty.js"); +const require_toKey = require("../_internal/toKey.js"); +const require_toPath = require("../util/toPath.js"); +const require_get = require("./get.js"); +const require_isObject = require("../predicate/isObject.js"); +const require_isIndex = require("../_internal/isIndex.js"); +const require_isKey = require("../_internal/isKey.js"); +const require_assignValue = require("../_internal/assignValue.js"); +//#region src/compat/object/updateWith.ts +/** +* Updates the value at the specified path of the given object using an updater function and a customizer. +* If any part of the path does not exist, it will be created. +* +* @template T - The type of the object. +* @template R - The type of the return value. +* @param {T} obj - The object to modify. +* @param {PropertyPath} path - The path of the property to update. +* @param {(value: any) => any} updater - The function to produce the updated value. +* @param {(value: any, key: string, object: T) => any} customizer - The function to customize the update process. +* @returns {T | R} - The modified object. +* +* @example +* const object = { 'a': [{ 'b': { 'c': 3 } }] }; +* updateWith(object, 'a[0].b.c', (n) => n * n); +* // => { 'a': [{ 'b': { 'c': 9 } }] } +*/ +function updateWith(obj, path, updater, customizer) { + if (obj == null && !require_isObject.isObject(obj)) return obj; + let resolvedPath; + if (require_isKey.isKey(path, obj)) resolvedPath = [path]; + else if (Array.isArray(path)) resolvedPath = path; + else resolvedPath = require_toPath.toPath(path); + const updateValue = updater(require_get.get(obj, resolvedPath)); + let current = obj; + for (let i = 0; i < resolvedPath.length && current != null; i++) { + const key = require_toKey.toKey(resolvedPath[i]); + if (require_isUnsafeProperty.isUnsafeProperty(key)) continue; + let newValue; + if (i === resolvedPath.length - 1) newValue = updateValue; + else { + const objValue = current[key]; + const customizerResult = customizer?.(objValue, key, obj); + newValue = customizerResult !== void 0 ? customizerResult : require_isObject.isObject(objValue) ? objValue : require_isIndex.isIndex(resolvedPath[i + 1]) ? [] : {}; + } + require_assignValue.assignValue(current, key, newValue); + current = current[key]; + } + return obj; +} +//#endregion +exports.updateWith = updateWith; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/updateWith.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/updateWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..10d248d4d28f8769639297e60e053f6f39013661 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/updateWith.mjs @@ -0,0 +1,51 @@ +import { isUnsafeProperty } from "../../_internal/isUnsafeProperty.mjs"; +import { toKey } from "../_internal/toKey.mjs"; +import { toPath } from "../util/toPath.mjs"; +import { get } from "./get.mjs"; +import { isObject } from "../predicate/isObject.mjs"; +import { isIndex } from "../_internal/isIndex.mjs"; +import { isKey } from "../_internal/isKey.mjs"; +import { assignValue } from "../_internal/assignValue.mjs"; +//#region src/compat/object/updateWith.ts +/** +* Updates the value at the specified path of the given object using an updater function and a customizer. +* If any part of the path does not exist, it will be created. +* +* @template T - The type of the object. +* @template R - The type of the return value. +* @param {T} obj - The object to modify. +* @param {PropertyPath} path - The path of the property to update. +* @param {(value: any) => any} updater - The function to produce the updated value. +* @param {(value: any, key: string, object: T) => any} customizer - The function to customize the update process. +* @returns {T | R} - The modified object. +* +* @example +* const object = { 'a': [{ 'b': { 'c': 3 } }] }; +* updateWith(object, 'a[0].b.c', (n) => n * n); +* // => { 'a': [{ 'b': { 'c': 9 } }] } +*/ +function updateWith(obj, path, updater, customizer) { + if (obj == null && !isObject(obj)) return obj; + let resolvedPath; + if (isKey(path, obj)) resolvedPath = [path]; + else if (Array.isArray(path)) resolvedPath = path; + else resolvedPath = toPath(path); + const updateValue = updater(get(obj, resolvedPath)); + let current = obj; + for (let i = 0; i < resolvedPath.length && current != null; i++) { + const key = toKey(resolvedPath[i]); + if (isUnsafeProperty(key)) continue; + let newValue; + if (i === resolvedPath.length - 1) newValue = updateValue; + else { + const objValue = current[key]; + const customizerResult = customizer?.(objValue, key, obj); + newValue = customizerResult !== void 0 ? customizerResult : isObject(objValue) ? objValue : isIndex(resolvedPath[i + 1]) ? [] : {}; + } + assignValue(current, key, newValue); + current = current[key]; + } + return obj; +} +//#endregion +export { updateWith }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/values.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/values.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..cf1546977b1d2cd6a3092b0af8636459e12c0e73 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/values.d.mts @@ -0,0 +1,38 @@ +//#region src/compat/object/values.d.ts +/** + * Creates an array of the own enumerable property values of `object`. + * + * @template T + * @param {Record | Record | ArrayLike | null | undefined} object - The object to query. + * @returns {T[]} Returns an array of property values. + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * values(obj); // => [1, 2, 3] + */ +declare function values(object: Record | Record | ArrayLike | null | undefined): T[]; +/** + * Creates an array of the own enumerable property values of `object`. + * + * @template T + * @param {T | null | undefined} object - The object to query. + * @returns {Array} Returns an array of property values. + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * values(obj); // => [1, 2, 3] + */ +declare function values(object: T | null | undefined): Array; +/** + * Creates an array of the own enumerable property values of `object`. + * + * @param {any} object - The object to query. + * @returns {any[]} Returns an array of property values. + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * values(obj); // => [1, 2, 3] + */ +declare function values(object: any): any[]; +//#endregion +export { values }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/values.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/values.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cf1546977b1d2cd6a3092b0af8636459e12c0e73 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/values.d.ts @@ -0,0 +1,38 @@ +//#region src/compat/object/values.d.ts +/** + * Creates an array of the own enumerable property values of `object`. + * + * @template T + * @param {Record | Record | ArrayLike | null | undefined} object - The object to query. + * @returns {T[]} Returns an array of property values. + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * values(obj); // => [1, 2, 3] + */ +declare function values(object: Record | Record | ArrayLike | null | undefined): T[]; +/** + * Creates an array of the own enumerable property values of `object`. + * + * @template T + * @param {T | null | undefined} object - The object to query. + * @returns {Array} Returns an array of property values. + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * values(obj); // => [1, 2, 3] + */ +declare function values(object: T | null | undefined): Array; +/** + * Creates an array of the own enumerable property values of `object`. + * + * @param {any} object - The object to query. + * @returns {any[]} Returns an array of property values. + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * values(obj); // => [1, 2, 3] + */ +declare function values(object: any): any[]; +//#endregion +export { values }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/values.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/values.js new file mode 100644 index 0000000000000000000000000000000000000000..62d76055c62a4b187f01fb753ac529e98a65a52d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/values.js @@ -0,0 +1,16 @@ +//#region src/compat/object/values.ts +/** +* Creates an array of the own enumerable property values of `object`. +* +* @param {any} object The object to query. +* @returns {any[]} Returns an array of property values. +* @example +* const obj = { a: 1, b: 2, c: 3 }; +* values(obj); // => [1, 2, 3] +*/ +function values(object) { + if (object == null) return []; + return Object.values(object); +} +//#endregion +exports.values = values; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/values.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/values.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e030863cc737902210956b310556d430bb6263dd --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/values.mjs @@ -0,0 +1,16 @@ +//#region src/compat/object/values.ts +/** +* Creates an array of the own enumerable property values of `object`. +* +* @param {any} object The object to query. +* @returns {any[]} Returns an array of property values. +* @example +* const obj = { a: 1, b: 2, c: 3 }; +* values(obj); // => [1, 2, 3] +*/ +function values(object) { + if (object == null) return []; + return Object.values(object); +} +//#endregion +export { values }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/valuesIn.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/object/valuesIn.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..dfc2185e8e2bdcda36da4ea307d8f4770ea415c5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/valuesIn.d.mts @@ -0,0 +1,27 @@ +//#region src/compat/object/valuesIn.d.ts +/** + * Retrieves the values from an object, including those inherited from its prototype. + * + * @template T + * @param {Record | Record | ArrayLike | null | undefined} object - The object to query. + * @returns {T[]} Returns an array of property values. + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * valuesIn(obj); // => [1, 2, 3] + */ +declare function valuesIn(object: Record | Record | ArrayLike | null | undefined): T[]; +/** + * Retrieves the values from an object, including those inherited from its prototype. + * + * @template T + * @param {T | null | undefined} object - The object to query. + * @returns {Array} Returns an array of property values. + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * valuesIn(obj); // => [1, 2, 3] + */ +declare function valuesIn(object: T | null | undefined): Array; +//#endregion +export { valuesIn }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/valuesIn.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/object/valuesIn.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dfc2185e8e2bdcda36da4ea307d8f4770ea415c5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/valuesIn.d.ts @@ -0,0 +1,27 @@ +//#region src/compat/object/valuesIn.d.ts +/** + * Retrieves the values from an object, including those inherited from its prototype. + * + * @template T + * @param {Record | Record | ArrayLike | null | undefined} object - The object to query. + * @returns {T[]} Returns an array of property values. + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * valuesIn(obj); // => [1, 2, 3] + */ +declare function valuesIn(object: Record | Record | ArrayLike | null | undefined): T[]; +/** + * Retrieves the values from an object, including those inherited from its prototype. + * + * @template T + * @param {T | null | undefined} object - The object to query. + * @returns {Array} Returns an array of property values. + * + * @example + * const obj = { a: 1, b: 2, c: 3 }; + * valuesIn(obj); // => [1, 2, 3] + */ +declare function valuesIn(object: T | null | undefined): Array; +//#endregion +export { valuesIn }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/valuesIn.js b/tools/ui/node_modules/es-toolkit/dist/compat/object/valuesIn.js new file mode 100644 index 0000000000000000000000000000000000000000..f3fbdb4ef5b4bc3a9d5fcd94457b0cca5d764018 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/valuesIn.js @@ -0,0 +1,25 @@ +const require_keysIn = require("./keysIn.js"); +//#region src/compat/object/valuesIn.ts +/** +* Retrieves the values from an object, including those inherited from its prototype. +* +* - If the value is not an object, it is converted to an object. +* - Array-like objects are treated like arrays. +* - Sparse arrays with some missing indices are treated like dense arrays. +* - If the value is `null` or `undefined`, an empty array is returned. +* - When handling prototype objects, the `constructor` property is excluded from the results. +* +* @param {any} object The object to query. +* @returns {any[]} Returns an array of property values. +* @example +* const obj = { a: 1, b: 2, c: 3 }; +* valuesIn(obj); // => [1, 2, 3] +*/ +function valuesIn(object) { + const keys = require_keysIn.keysIn(object); + const result = new Array(keys.length); + for (let i = 0; i < keys.length; i++) result[i] = object[keys[i]]; + return result; +} +//#endregion +exports.valuesIn = valuesIn; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/object/valuesIn.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/object/valuesIn.mjs new file mode 100644 index 0000000000000000000000000000000000000000..1f8d60b23b32737a4ed44bac8ac1dfccf8bd6a51 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/object/valuesIn.mjs @@ -0,0 +1,25 @@ +import { keysIn } from "./keysIn.mjs"; +//#region src/compat/object/valuesIn.ts +/** +* Retrieves the values from an object, including those inherited from its prototype. +* +* - If the value is not an object, it is converted to an object. +* - Array-like objects are treated like arrays. +* - Sparse arrays with some missing indices are treated like dense arrays. +* - If the value is `null` or `undefined`, an empty array is returned. +* - When handling prototype objects, the `constructor` property is excluded from the results. +* +* @param {any} object The object to query. +* @returns {any[]} Returns an array of property values. +* @example +* const obj = { a: 1, b: 2, c: 3 }; +* valuesIn(obj); // => [1, 2, 3] +*/ +function valuesIn(object) { + const keys = keysIn(object); + const result = new Array(keys.length); + for (let i = 0; i < keys.length; i++) result[i] = object[keys[i]]; + return result; +} +//#endregion +export { valuesIn }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conforms.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conforms.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..8d662ec78c6d5aa1be6e9203d820e1bbc6070c65 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conforms.d.mts @@ -0,0 +1,25 @@ +import { ConformsPredicateObject } from "../_internal/ConformsPredicateObject.mjs"; + +//#region src/compat/predicate/conforms.d.ts +/** + * Creates a function that invokes the predicate properties of `source` with the corresponding property values of a given object, returning `true` if all predicates return truthy, else `false`. + * + * Note: The created function is equivalent to `conformsTo` with source partially applied. + * + * @param {Record boolean>} source The object of property predicates to conform to. + * @returns {(object: Record) => boolean} Returns the new spec function. + * + * @example + * const isPositive = (n) => n > 0; + * const isEven = (n) => n % 2 === 0; + * const predicates = { a: isPositive, b: isEven }; + * const conform = conforms(predicates); + * + * console.log(conform({ a: 2, b: 4 })); // true + * console.log(conform({ a: -1, b: 4 })); // false + * console.log(conform({ a: 2, b: 3 })); // false + * console.log(conform({ a: 0, b: 2 })); // false + */ +declare function conforms(source: ConformsPredicateObject): (value: T) => boolean; +//#endregion +export { conforms }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conforms.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conforms.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ae6df5f69bbc3132c181e37cfca5d20c55dd1f71 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conforms.d.ts @@ -0,0 +1,25 @@ +import { ConformsPredicateObject } from "../_internal/ConformsPredicateObject.js"; + +//#region src/compat/predicate/conforms.d.ts +/** + * Creates a function that invokes the predicate properties of `source` with the corresponding property values of a given object, returning `true` if all predicates return truthy, else `false`. + * + * Note: The created function is equivalent to `conformsTo` with source partially applied. + * + * @param {Record boolean>} source The object of property predicates to conform to. + * @returns {(object: Record) => boolean} Returns the new spec function. + * + * @example + * const isPositive = (n) => n > 0; + * const isEven = (n) => n % 2 === 0; + * const predicates = { a: isPositive, b: isEven }; + * const conform = conforms(predicates); + * + * console.log(conform({ a: 2, b: 4 })); // true + * console.log(conform({ a: -1, b: 4 })); // false + * console.log(conform({ a: 2, b: 3 })); // false + * console.log(conform({ a: 0, b: 2 })); // false + */ +declare function conforms(source: ConformsPredicateObject): (value: T) => boolean; +//#endregion +export { conforms }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conforms.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conforms.js new file mode 100644 index 0000000000000000000000000000000000000000..3002697585ef12431b3a4acd9b0b4d3f64a815f4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conforms.js @@ -0,0 +1,30 @@ +const require_cloneDeep = require("../../object/cloneDeep.js"); +const require_conformsTo = require("./conformsTo.js"); +//#region src/compat/predicate/conforms.ts +/** +* Creates a function that invokes the predicate properties of `source` with the corresponding property values of a given object, returning `true` if all predicates return truthy, else `false`. +* +* Note: The created function is equivalent to `conformsTo` with source partially applied. +* +* @param {Record boolean>} source The object of property predicates to conform to. +* @returns {(object: Record) => boolean} Returns the new spec function. +* +* @example +* const isPositive = (n) => n > 0; +* const isEven = (n) => n % 2 === 0; +* const predicates = { a: isPositive, b: isEven }; +* const conform = conforms(predicates); +* +* console.log(conform({ a: 2, b: 4 })); // true +* console.log(conform({ a: -1, b: 4 })); // false +* console.log(conform({ a: 2, b: 3 })); // false +* console.log(conform({ a: 0, b: 2 })); // false +*/ +function conforms(source) { + source = require_cloneDeep.cloneDeep(source); + return function(object) { + return require_conformsTo.conformsTo(object, source); + }; +} +//#endregion +exports.conforms = conforms; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conforms.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conforms.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6a3dc65508b0ebd9ab6f2270f4c8fe42756e014b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conforms.mjs @@ -0,0 +1,30 @@ +import { cloneDeep } from "../../object/cloneDeep.mjs"; +import { conformsTo } from "./conformsTo.mjs"; +//#region src/compat/predicate/conforms.ts +/** +* Creates a function that invokes the predicate properties of `source` with the corresponding property values of a given object, returning `true` if all predicates return truthy, else `false`. +* +* Note: The created function is equivalent to `conformsTo` with source partially applied. +* +* @param {Record boolean>} source The object of property predicates to conform to. +* @returns {(object: Record) => boolean} Returns the new spec function. +* +* @example +* const isPositive = (n) => n > 0; +* const isEven = (n) => n % 2 === 0; +* const predicates = { a: isPositive, b: isEven }; +* const conform = conforms(predicates); +* +* console.log(conform({ a: 2, b: 4 })); // true +* console.log(conform({ a: -1, b: 4 })); // false +* console.log(conform({ a: 2, b: 3 })); // false +* console.log(conform({ a: 0, b: 2 })); // false +*/ +function conforms(source) { + source = cloneDeep(source); + return function(object) { + return conformsTo(object, source); + }; +} +//#endregion +export { conforms }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conformsTo.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conformsTo.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..265868d2f30afe162e942d64839e4f0b32560e5f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conformsTo.d.mts @@ -0,0 +1,33 @@ +import { ConformsPredicateObject } from "../_internal/ConformsPredicateObject.mjs"; + +//#region src/compat/predicate/conformsTo.d.ts +/** + * Checks if `object` conforms to `source` by invoking the predicate properties of `source` with the corresponding property values of `object`. + * + * Note: This method is equivalent to `conforms` when source is partially applied. + * + * @template T - The type of the target object. + * @param {T} target The object to inspect. + * @param {ConformsPredicateObject} source The object of property predicates to conform to. + * @returns {boolean} Returns `true` if `object` conforms, else `false`. + * + * @example + * + * const object = { 'a': 1, 'b': 2 }; + * const source = { + * 'a': (n) => n > 0, + * 'b': (n) => n > 1 + * }; + * + * console.log(conformsTo(object, source)); // => true + * + * const source2 = { + * 'a': (n) => n > 1, + * 'b': (n) => n > 1 + * }; + * + * console.log(conformsTo(object, source2)); // => false + */ +declare function conformsTo(target: T, source: ConformsPredicateObject): boolean; +//#endregion +export { conformsTo }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conformsTo.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conformsTo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7c95e2460ec1dcfe18d43d4d6fcdfebb3f56ca19 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conformsTo.d.ts @@ -0,0 +1,33 @@ +import { ConformsPredicateObject } from "../_internal/ConformsPredicateObject.js"; + +//#region src/compat/predicate/conformsTo.d.ts +/** + * Checks if `object` conforms to `source` by invoking the predicate properties of `source` with the corresponding property values of `object`. + * + * Note: This method is equivalent to `conforms` when source is partially applied. + * + * @template T - The type of the target object. + * @param {T} target The object to inspect. + * @param {ConformsPredicateObject} source The object of property predicates to conform to. + * @returns {boolean} Returns `true` if `object` conforms, else `false`. + * + * @example + * + * const object = { 'a': 1, 'b': 2 }; + * const source = { + * 'a': (n) => n > 0, + * 'b': (n) => n > 1 + * }; + * + * console.log(conformsTo(object, source)); // => true + * + * const source2 = { + * 'a': (n) => n > 1, + * 'b': (n) => n > 1 + * }; + * + * console.log(conformsTo(object, source2)); // => false + */ +declare function conformsTo(target: T, source: ConformsPredicateObject): boolean; +//#endregion +export { conformsTo }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conformsTo.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conformsTo.js new file mode 100644 index 0000000000000000000000000000000000000000..63f6e038b894b6df38242d1900aca826ddcaf987 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conformsTo.js @@ -0,0 +1,43 @@ +//#region src/compat/predicate/conformsTo.ts +/** +* Checks if `object` conforms to `source` by invoking the predicate properties of `source` with the corresponding property values of `object`. +* +* Note: This method is equivalent to `conforms` when source is partially applied. +* +* @template T - The type of the target object. +* @param {T} target The object to inspect. +* @param {ConformsPredicateObject} source The object of property predicates to conform to. +* @returns {boolean} Returns `true` if `object` conforms, else `false`. +* +* @example +* +* const object = { 'a': 1, 'b': 2 }; +* const source = { +* 'a': (n) => n > 0, +* 'b': (n) => n > 1 +* }; +* +* console.log(conformsTo(object, source)); // => true +* +* const source2 = { +* 'a': (n) => n > 1, +* 'b': (n) => n > 1 +* }; +* +* console.log(conformsTo(object, source2)); // => false +*/ +function conformsTo(target, source) { + if (source == null) return true; + if (target == null) return Object.keys(source).length === 0; + const keys = Object.keys(source); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const predicate = source[key]; + const value = target[key]; + if (value === void 0 && !(key in target)) return false; + if (typeof predicate === "function" && !predicate(value)) return false; + } + return true; +} +//#endregion +exports.conformsTo = conformsTo; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conformsTo.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conformsTo.mjs new file mode 100644 index 0000000000000000000000000000000000000000..152071637b0d322dc120b3a87395483044687a33 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/conformsTo.mjs @@ -0,0 +1,43 @@ +//#region src/compat/predicate/conformsTo.ts +/** +* Checks if `object` conforms to `source` by invoking the predicate properties of `source` with the corresponding property values of `object`. +* +* Note: This method is equivalent to `conforms` when source is partially applied. +* +* @template T - The type of the target object. +* @param {T} target The object to inspect. +* @param {ConformsPredicateObject} source The object of property predicates to conform to. +* @returns {boolean} Returns `true` if `object` conforms, else `false`. +* +* @example +* +* const object = { 'a': 1, 'b': 2 }; +* const source = { +* 'a': (n) => n > 0, +* 'b': (n) => n > 1 +* }; +* +* console.log(conformsTo(object, source)); // => true +* +* const source2 = { +* 'a': (n) => n > 1, +* 'b': (n) => n > 1 +* }; +* +* console.log(conformsTo(object, source2)); // => false +*/ +function conformsTo(target, source) { + if (source == null) return true; + if (target == null) return Object.keys(source).length === 0; + const keys = Object.keys(source); + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + const predicate = source[key]; + const value = target[key]; + if (value === void 0 && !(key in target)) return false; + if (typeof predicate === "function" && !predicate(value)) return false; + } + return true; +} +//#endregion +export { conformsTo }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArguments.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArguments.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c2d55fe890544f29024e54ae4d28ad25fec22b62 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArguments.d.mts @@ -0,0 +1,24 @@ +//#region src/compat/predicate/isArguments.d.ts +/** + * Checks if the given value is an arguments object. + * + * This function tests whether the provided value is an arguments object or not. + * It returns `true` if the value is an arguments object, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an arguments object. + * + * @param {any} value - The value to test if it is an arguments object. + * @returns {value is IArguments} `true` if the value is an arguments, `false` otherwise. + * + * @example + * const args = (function() { return arguments; })(); + * const strictArgs = (function() { 'use strict'; return arguments; })(); + * const value = [1, 2, 3]; + * + * console.log(isArguments(args)); // true + * console.log(isArguments(strictArgs)); // true + * console.log(isArguments(value)); // false + */ +declare function isArguments(value?: any): value is IArguments; +//#endregion +export { isArguments }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArguments.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArguments.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c2d55fe890544f29024e54ae4d28ad25fec22b62 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArguments.d.ts @@ -0,0 +1,24 @@ +//#region src/compat/predicate/isArguments.d.ts +/** + * Checks if the given value is an arguments object. + * + * This function tests whether the provided value is an arguments object or not. + * It returns `true` if the value is an arguments object, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an arguments object. + * + * @param {any} value - The value to test if it is an arguments object. + * @returns {value is IArguments} `true` if the value is an arguments, `false` otherwise. + * + * @example + * const args = (function() { return arguments; })(); + * const strictArgs = (function() { 'use strict'; return arguments; })(); + * const value = [1, 2, 3]; + * + * console.log(isArguments(args)); // true + * console.log(isArguments(strictArgs)); // true + * console.log(isArguments(value)); // false + */ +declare function isArguments(value?: any): value is IArguments; +//#endregion +export { isArguments }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArguments.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArguments.js new file mode 100644 index 0000000000000000000000000000000000000000..199cdf91e41cff1c2b5b0c188611035832fd9917 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArguments.js @@ -0,0 +1,27 @@ +const require_getTag = require("../_internal/getTag.js"); +//#region src/compat/predicate/isArguments.ts +/** +* Checks if the given value is an arguments object. +* +* This function tests whether the provided value is an arguments object or not. +* It returns `true` if the value is an arguments object, and `false` otherwise. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an arguments object. +* +* @param {any} value - The value to test if it is an arguments object. +* @returns {value is IArguments} `true` if the value is an arguments, `false` otherwise. +* +* @example +* const args = (function() { return arguments; })(); +* const strictArgs = (function() { 'use strict'; return arguments; })(); +* const value = [1, 2, 3]; +* +* console.log(isArguments(args)); // true +* console.log(isArguments(strictArgs)); // true +* console.log(isArguments(value)); // false +*/ +function isArguments(value) { + return value !== null && typeof value === "object" && require_getTag.getTag(value) === "[object Arguments]"; +} +//#endregion +exports.isArguments = isArguments; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArguments.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArguments.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3011cd719bcfc7cf1966762a2250c8cf884243e4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArguments.mjs @@ -0,0 +1,27 @@ +import { getTag } from "../_internal/getTag.mjs"; +//#region src/compat/predicate/isArguments.ts +/** +* Checks if the given value is an arguments object. +* +* This function tests whether the provided value is an arguments object or not. +* It returns `true` if the value is an arguments object, and `false` otherwise. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an arguments object. +* +* @param {any} value - The value to test if it is an arguments object. +* @returns {value is IArguments} `true` if the value is an arguments, `false` otherwise. +* +* @example +* const args = (function() { return arguments; })(); +* const strictArgs = (function() { 'use strict'; return arguments; })(); +* const value = [1, 2, 3]; +* +* console.log(isArguments(args)); // true +* console.log(isArguments(strictArgs)); // true +* console.log(isArguments(value)); // false +*/ +function isArguments(value) { + return value !== null && typeof value === "object" && getTag(value) === "[object Arguments]"; +} +//#endregion +export { isArguments }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArray.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArray.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e7077a3d82227d506d8beb9a2a12a94d19117b26 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArray.d.mts @@ -0,0 +1,46 @@ +//#region src/compat/predicate/isArray.d.ts +/** + * Checks if the given value is an array. + * + * This function tests whether the provided value is an array or not. + * It returns `true` if the value is an array, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an array. + * + * @param {any} value - The value to test if it is an array. + * @returns {value is any[]} `true` if the value is an array, `false` otherwise. + * + * @example + * const value1 = [1, 2, 3]; + * const value2 = 'abc'; + * const value3 = () => {}; + * + * console.log(isArray(value1)); // true + * console.log(isArray(value2)); // false + * console.log(isArray(value3)); // false + */ +declare function isArray(value?: any): value is any[]; +/** + * Checks if the given value is an array with generic type support. + * + * This function tests whether the provided value is an array or not. + * It returns `true` if the value is an array, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an array. + * + * @template T - The type of elements in the array. + * @param {any} value - The value to test if it is an array. + * @returns {value is any[]} `true` if the value is an array, `false` otherwise. + * + * @example + * const value1 = [1, 2, 3]; + * const value2 = 'abc'; + * const value3 = () => {}; + * + * console.log(isArray(value1)); // true + * console.log(isArray(value2)); // false + * console.log(isArray(value3)); // false + */ +declare function isArray(value?: any): value is any[]; +//#endregion +export { isArray }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArray.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArray.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e7077a3d82227d506d8beb9a2a12a94d19117b26 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArray.d.ts @@ -0,0 +1,46 @@ +//#region src/compat/predicate/isArray.d.ts +/** + * Checks if the given value is an array. + * + * This function tests whether the provided value is an array or not. + * It returns `true` if the value is an array, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an array. + * + * @param {any} value - The value to test if it is an array. + * @returns {value is any[]} `true` if the value is an array, `false` otherwise. + * + * @example + * const value1 = [1, 2, 3]; + * const value2 = 'abc'; + * const value3 = () => {}; + * + * console.log(isArray(value1)); // true + * console.log(isArray(value2)); // false + * console.log(isArray(value3)); // false + */ +declare function isArray(value?: any): value is any[]; +/** + * Checks if the given value is an array with generic type support. + * + * This function tests whether the provided value is an array or not. + * It returns `true` if the value is an array, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an array. + * + * @template T - The type of elements in the array. + * @param {any} value - The value to test if it is an array. + * @returns {value is any[]} `true` if the value is an array, `false` otherwise. + * + * @example + * const value1 = [1, 2, 3]; + * const value2 = 'abc'; + * const value3 = () => {}; + * + * console.log(isArray(value1)); // true + * console.log(isArray(value2)); // false + * console.log(isArray(value3)); // false + */ +declare function isArray(value?: any): value is any[]; +//#endregion +export { isArray }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArray.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArray.js new file mode 100644 index 0000000000000000000000000000000000000000..b60ff8b9f7e8fdf570cc05017ec6104bb18fe09b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArray.js @@ -0,0 +1,26 @@ +//#region src/compat/predicate/isArray.ts +/** +* Checks if the given value is an array. +* +* This function tests whether the provided value is an array or not. +* It returns `true` if the value is an array, and `false` otherwise. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an array. +* +* @param {any} value - The value to test if it is an array. +* @returns {value is any[]} `true` if the value is an array, `false` otherwise. +* +* @example +* const value1 = [1, 2, 3]; +* const value2 = 'abc'; +* const value3 = () => {}; +* +* console.log(isArray(value1)); // true +* console.log(isArray(value2)); // false +* console.log(isArray(value3)); // false +*/ +function isArray(value) { + return Array.isArray(value); +} +//#endregion +exports.isArray = isArray; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArray.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArray.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ed3a3464935d6521119a90cde6e2a99cba1bca38 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArray.mjs @@ -0,0 +1,26 @@ +//#region src/compat/predicate/isArray.ts +/** +* Checks if the given value is an array. +* +* This function tests whether the provided value is an array or not. +* It returns `true` if the value is an array, and `false` otherwise. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an array. +* +* @param {any} value - The value to test if it is an array. +* @returns {value is any[]} `true` if the value is an array, `false` otherwise. +* +* @example +* const value1 = [1, 2, 3]; +* const value2 = 'abc'; +* const value3 = () => {}; +* +* console.log(isArray(value1)); // true +* console.log(isArray(value2)); // false +* console.log(isArray(value3)); // false +*/ +function isArray(value) { + return Array.isArray(value); +} +//#endregion +export { isArray }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayBuffer.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayBuffer.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a0fa89f52fb4dc0c7718a1403d554097bfc52e50 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayBuffer.d.mts @@ -0,0 +1,21 @@ +//#region src/compat/predicate/isArrayBuffer.d.ts +/** + * Checks if a given value is `ArrayBuffer`. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `ArrayBuffer`. + * + * @param {any} value The value to check if it is a `ArrayBuffer`. + * @returns {value is ArrayBuffer} Returns `true` if `value` is a `ArrayBuffer`, else `false`. + * + * @example + * const value1 = new ArrayBuffer(); + * const value2 = new Array(); + * const value3 = new Map(); + * + * console.log(isArrayBuffer(value1)); // true + * console.log(isArrayBuffer(value2)); // false + * console.log(isArrayBuffer(value3)); // false + */ +declare function isArrayBuffer(value?: any): value is ArrayBuffer; +//#endregion +export { isArrayBuffer }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayBuffer.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayBuffer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a0fa89f52fb4dc0c7718a1403d554097bfc52e50 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayBuffer.d.ts @@ -0,0 +1,21 @@ +//#region src/compat/predicate/isArrayBuffer.d.ts +/** + * Checks if a given value is `ArrayBuffer`. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `ArrayBuffer`. + * + * @param {any} value The value to check if it is a `ArrayBuffer`. + * @returns {value is ArrayBuffer} Returns `true` if `value` is a `ArrayBuffer`, else `false`. + * + * @example + * const value1 = new ArrayBuffer(); + * const value2 = new Array(); + * const value3 = new Map(); + * + * console.log(isArrayBuffer(value1)); // true + * console.log(isArrayBuffer(value2)); // false + * console.log(isArrayBuffer(value3)); // false + */ +declare function isArrayBuffer(value?: any): value is ArrayBuffer; +//#endregion +export { isArrayBuffer }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayBuffer.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayBuffer.js new file mode 100644 index 0000000000000000000000000000000000000000..daf2917f7af320c3259b4f8a24380b3080eeba78 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayBuffer.js @@ -0,0 +1,24 @@ +const require_isArrayBuffer = require("../../predicate/isArrayBuffer.js"); +//#region src/compat/predicate/isArrayBuffer.ts +/** +* Checks if a given value is `ArrayBuffer`. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `ArrayBuffer`. +* +* @param {any} value The value to check if it is a `ArrayBuffer`. +* @returns {value is ArrayBuffer} Returns `true` if `value` is a `ArrayBuffer`, else `false`. +* +* @example +* const value1 = new ArrayBuffer(); +* const value2 = new Array(); +* const value3 = new Map(); +* +* console.log(isArrayBuffer(value1)); // true +* console.log(isArrayBuffer(value2)); // false +* console.log(isArrayBuffer(value3)); // false +*/ +function isArrayBuffer(value) { + return require_isArrayBuffer.isArrayBuffer(value); +} +//#endregion +exports.isArrayBuffer = isArrayBuffer; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayBuffer.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayBuffer.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2ba6ae88bf47b09c32e00ca935895dcae30d3859 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayBuffer.mjs @@ -0,0 +1,24 @@ +import { isArrayBuffer as isArrayBuffer$1 } from "../../predicate/isArrayBuffer.mjs"; +//#region src/compat/predicate/isArrayBuffer.ts +/** +* Checks if a given value is `ArrayBuffer`. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `ArrayBuffer`. +* +* @param {any} value The value to check if it is a `ArrayBuffer`. +* @returns {value is ArrayBuffer} Returns `true` if `value` is a `ArrayBuffer`, else `false`. +* +* @example +* const value1 = new ArrayBuffer(); +* const value2 = new Array(); +* const value3 = new Map(); +* +* console.log(isArrayBuffer(value1)); // true +* console.log(isArrayBuffer(value2)); // false +* console.log(isArrayBuffer(value3)); // false +*/ +function isArrayBuffer(value) { + return isArrayBuffer$1(value); +} +//#endregion +export { isArrayBuffer }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..4fcece8643cdc7c6478dc09ec94d132bdd83c478 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.d.mts @@ -0,0 +1,28 @@ +//#region src/compat/predicate/isArrayLike.d.ts +/** + * Checks if `value` is array-like. This overload is for compatibility with lodash type checking. + * + * @param {T} t The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + */ +declare function isArrayLike(t: T): boolean; +/** + * Checks if `value` is array-like. Functions, null, and undefined are never array-like. + * + * @param {((...args: any[]) => any) | null | undefined} value The value to check. + * @returns {value is never} Returns `false` for functions, null, and undefined. + */ +declare function isArrayLike(value: ((...args: any[]) => any) | null | undefined): value is never; +/** + * Checks if `value` is array-like. + * + * @param {any} value The value to check. + * @returns {value is { length: number }} Returns `true` if `value` is array-like, else `false`. + */ +declare function isArrayLike(value: any): value is { + length: number; +}; +//#endregion +export { isArrayLike }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4fcece8643cdc7c6478dc09ec94d132bdd83c478 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.d.ts @@ -0,0 +1,28 @@ +//#region src/compat/predicate/isArrayLike.d.ts +/** + * Checks if `value` is array-like. This overload is for compatibility with lodash type checking. + * + * @param {T} t The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + */ +declare function isArrayLike(t: T): boolean; +/** + * Checks if `value` is array-like. Functions, null, and undefined are never array-like. + * + * @param {((...args: any[]) => any) | null | undefined} value The value to check. + * @returns {value is never} Returns `false` for functions, null, and undefined. + */ +declare function isArrayLike(value: ((...args: any[]) => any) | null | undefined): value is never; +/** + * Checks if `value` is array-like. + * + * @param {any} value The value to check. + * @returns {value is { length: number }} Returns `true` if `value` is array-like, else `false`. + */ +declare function isArrayLike(value: any): value is { + length: number; +}; +//#endregion +export { isArrayLike }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.js new file mode 100644 index 0000000000000000000000000000000000000000..892db4bc98f3bafc6ced775cb9107378db030af4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.js @@ -0,0 +1,21 @@ +const require_isLength = require("../../predicate/isLength.js"); +//#region src/compat/predicate/isArrayLike.ts +/** +* Checks if `value` is array-like. +* +* @param {any} value The value to check. +* @returns {boolean} Returns `true` if `value` is array-like, else `false`. +* +* @example +* isArrayLike([1, 2, 3]); // true +* isArrayLike('abc'); // true +* isArrayLike({ 0: 'a', length: 1 }); // true +* isArrayLike({}); // false +* isArrayLike(null); // false +* isArrayLike(undefined); // false +*/ +function isArrayLike(value) { + return value != null && typeof value !== "function" && require_isLength.isLength(value.length); +} +//#endregion +exports.isArrayLike = isArrayLike; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2706da5c76ecb9605a2d41f26aa6cf7d3fcd2030 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.mjs @@ -0,0 +1,21 @@ +import { isLength } from "../../predicate/isLength.mjs"; +//#region src/compat/predicate/isArrayLike.ts +/** +* Checks if `value` is array-like. +* +* @param {any} value The value to check. +* @returns {boolean} Returns `true` if `value` is array-like, else `false`. +* +* @example +* isArrayLike([1, 2, 3]); // true +* isArrayLike('abc'); // true +* isArrayLike({ 0: 'a', length: 1 }); // true +* isArrayLike({}); // false +* isArrayLike(null); // false +* isArrayLike(undefined); // false +*/ +function isArrayLike(value) { + return value != null && typeof value !== "function" && isLength(value.length); +} +//#endregion +export { isArrayLike }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..65667cc662104b651ff6d5719dafb319b966eec5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.d.mts @@ -0,0 +1,10 @@ +//#region src/compat/predicate/isArrayLikeObject.d.ts +declare function isArrayLikeObject(value: T): boolean; +declare function isArrayLikeObject(value: ((...args: any[]) => any) | Function | string | boolean | number | null | undefined): value is never; +declare function isArrayLikeObject(value: any): value is object & { + length: number; +}; +//#endregion +export { isArrayLikeObject }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..65667cc662104b651ff6d5719dafb319b966eec5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.d.ts @@ -0,0 +1,10 @@ +//#region src/compat/predicate/isArrayLikeObject.d.ts +declare function isArrayLikeObject(value: T): boolean; +declare function isArrayLikeObject(value: ((...args: any[]) => any) | Function | string | boolean | number | null | undefined): value is never; +declare function isArrayLikeObject(value: any): value is object & { + length: number; +}; +//#endregion +export { isArrayLikeObject }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.js new file mode 100644 index 0000000000000000000000000000000000000000..5b01798c876b5b7d538427ddd5aa9c477b44d9f6 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.js @@ -0,0 +1,20 @@ +const require_isArrayLike = require("./isArrayLike.js"); +const require_isObjectLike = require("./isObjectLike.js"); +//#region src/compat/predicate/isArrayLikeObject.ts +/** +* Checks if the given value is a non-primitive, array-like object. +* +* @param {any} value The value to check. +* @returns {boolean} `true` if the value is a non-primitive, array-like object, `false` otherwise. +* +* @example +* isArrayLikeObject([1, 2, 3]); // true +* isArrayLikeObject({ 0: 'a', length: 1 }); // true +* isArrayLikeObject('abc'); // false +* isArrayLikeObject(()=>{}); // false +*/ +function isArrayLikeObject(value) { + return require_isObjectLike.isObjectLike(value) && require_isArrayLike.isArrayLike(value); +} +//#endregion +exports.isArrayLikeObject = isArrayLikeObject; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ae5b09db9fad5d1fbd6e11ebc17e6d1b915594d4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.mjs @@ -0,0 +1,20 @@ +import { isArrayLike } from "./isArrayLike.mjs"; +import { isObjectLike } from "./isObjectLike.mjs"; +//#region src/compat/predicate/isArrayLikeObject.ts +/** +* Checks if the given value is a non-primitive, array-like object. +* +* @param {any} value The value to check. +* @returns {boolean} `true` if the value is a non-primitive, array-like object, `false` otherwise. +* +* @example +* isArrayLikeObject([1, 2, 3]); // true +* isArrayLikeObject({ 0: 'a', length: 1 }); // true +* isArrayLikeObject('abc'); // false +* isArrayLikeObject(()=>{}); // false +*/ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} +//#endregion +export { isArrayLikeObject }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBoolean.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBoolean.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..bac131e038f1f91f4a5235034009fe2df16c6ac5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBoolean.d.mts @@ -0,0 +1,26 @@ +//#region src/compat/predicate/isBoolean.d.ts +/** + * Checks if the given value is boolean. + * + * This function tests whether the provided value is strictly `boolean`. + * It returns `true` if the value is `boolean`, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `boolean`. + * + * @param {any} value - The Value to test if it is boolean. + * @returns {value is boolean} True if the value is boolean, false otherwise. + * + * @example + * + * const value1 = true; + * const value2 = 0; + * const value3 = 'abc'; + * + * console.log(isBoolean(value1)); // true + * console.log(isBoolean(value2)); // false + * console.log(isBoolean(value3)); // false + * + */ +declare function isBoolean(value?: any): value is boolean; +//#endregion +export { isBoolean }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBoolean.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBoolean.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bac131e038f1f91f4a5235034009fe2df16c6ac5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBoolean.d.ts @@ -0,0 +1,26 @@ +//#region src/compat/predicate/isBoolean.d.ts +/** + * Checks if the given value is boolean. + * + * This function tests whether the provided value is strictly `boolean`. + * It returns `true` if the value is `boolean`, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `boolean`. + * + * @param {any} value - The Value to test if it is boolean. + * @returns {value is boolean} True if the value is boolean, false otherwise. + * + * @example + * + * const value1 = true; + * const value2 = 0; + * const value3 = 'abc'; + * + * console.log(isBoolean(value1)); // true + * console.log(isBoolean(value2)); // false + * console.log(isBoolean(value3)); // false + * + */ +declare function isBoolean(value?: any): value is boolean; +//#endregion +export { isBoolean }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBoolean.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBoolean.js new file mode 100644 index 0000000000000000000000000000000000000000..d8b85addf78b28b914345c5dcecdaa59ae6a261a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBoolean.js @@ -0,0 +1,28 @@ +//#region src/compat/predicate/isBoolean.ts +/** +* Checks if the given value is boolean. +* +* This function tests whether the provided value is strictly `boolean`. +* It returns `true` if the value is `boolean`, and `false` otherwise. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `boolean`. +* +* @param {any} value - The Value to test if it is boolean. +* @returns {value is boolean} True if the value is boolean, false otherwise. +* +* @example +* +* const value1 = true; +* const value2 = 0; +* const value3 = 'abc'; +* +* console.log(isBoolean(value1)); // true +* console.log(isBoolean(value2)); // false +* console.log(isBoolean(value3)); // false +* +*/ +function isBoolean(value) { + return typeof value === "boolean" || value instanceof Boolean; +} +//#endregion +exports.isBoolean = isBoolean; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBoolean.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBoolean.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4ba90341fca0ab8e04668e5f099ea7a26049ee78 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBoolean.mjs @@ -0,0 +1,28 @@ +//#region src/compat/predicate/isBoolean.ts +/** +* Checks if the given value is boolean. +* +* This function tests whether the provided value is strictly `boolean`. +* It returns `true` if the value is `boolean`, and `false` otherwise. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `boolean`. +* +* @param {any} value - The Value to test if it is boolean. +* @returns {value is boolean} True if the value is boolean, false otherwise. +* +* @example +* +* const value1 = true; +* const value2 = 0; +* const value3 = 'abc'; +* +* console.log(isBoolean(value1)); // true +* console.log(isBoolean(value2)); // false +* console.log(isBoolean(value3)); // false +* +*/ +function isBoolean(value) { + return typeof value === "boolean" || value instanceof Boolean; +} +//#endregion +export { isBoolean }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBuffer.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBuffer.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..2c847b0744ed3a7092d2669f3d614b782da2dd1f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBuffer.d.mts @@ -0,0 +1,22 @@ +//#region src/compat/predicate/isBuffer.d.ts +/** + * Checks if the given value is a Buffer instance. + * + * This function tests whether the provided value is an instance of Buffer. + * It returns `true` if the value is a Buffer, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Buffer`. + * + * @param {any} x - The value to check if it is a Buffer. + * @returns {boolean} Returns `true` if `x` is a Buffer, else `false`. + * + * @example + * const buffer = Buffer.from("test"); + * console.log(isBuffer(buffer)); // true + * + * const notBuffer = "not a buffer"; + * console.log(isBuffer(notBuffer)); // false + */ +declare function isBuffer(x?: any): boolean; +//#endregion +export { isBuffer }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBuffer.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBuffer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2c847b0744ed3a7092d2669f3d614b782da2dd1f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBuffer.d.ts @@ -0,0 +1,22 @@ +//#region src/compat/predicate/isBuffer.d.ts +/** + * Checks if the given value is a Buffer instance. + * + * This function tests whether the provided value is an instance of Buffer. + * It returns `true` if the value is a Buffer, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Buffer`. + * + * @param {any} x - The value to check if it is a Buffer. + * @returns {boolean} Returns `true` if `x` is a Buffer, else `false`. + * + * @example + * const buffer = Buffer.from("test"); + * console.log(isBuffer(buffer)); // true + * + * const notBuffer = "not a buffer"; + * console.log(isBuffer(notBuffer)); // false + */ +declare function isBuffer(x?: any): boolean; +//#endregion +export { isBuffer }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBuffer.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBuffer.js new file mode 100644 index 0000000000000000000000000000000000000000..f2b4814238dc63699a3f8768bfd0de032fa5dac2 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBuffer.js @@ -0,0 +1,25 @@ +const require_isBuffer = require("../../predicate/isBuffer.js"); +//#region src/compat/predicate/isBuffer.ts +/** +* Checks if the given value is a Buffer instance. +* +* This function tests whether the provided value is an instance of Buffer. +* It returns `true` if the value is a Buffer, and `false` otherwise. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Buffer`. +* +* @param {any} x - The value to check if it is a Buffer. +* @returns {boolean} Returns `true` if `x` is a Buffer, else `false`. +* +* @example +* const buffer = Buffer.from("test"); +* console.log(isBuffer(buffer)); // true +* +* const notBuffer = "not a buffer"; +* console.log(isBuffer(notBuffer)); // false +*/ +function isBuffer(x) { + return require_isBuffer.isBuffer(x); +} +//#endregion +exports.isBuffer = isBuffer; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBuffer.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBuffer.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9e375cce3a19f0248f1f6c992722334b7fb04eff --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isBuffer.mjs @@ -0,0 +1,25 @@ +import { isBuffer as isBuffer$1 } from "../../predicate/isBuffer.mjs"; +//#region src/compat/predicate/isBuffer.ts +/** +* Checks if the given value is a Buffer instance. +* +* This function tests whether the provided value is an instance of Buffer. +* It returns `true` if the value is a Buffer, and `false` otherwise. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Buffer`. +* +* @param {any} x - The value to check if it is a Buffer. +* @returns {boolean} Returns `true` if `x` is a Buffer, else `false`. +* +* @example +* const buffer = Buffer.from("test"); +* console.log(isBuffer(buffer)); // true +* +* const notBuffer = "not a buffer"; +* console.log(isBuffer(notBuffer)); // false +*/ +function isBuffer(x) { + return isBuffer$1(x); +} +//#endregion +export { isBuffer }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isDate.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isDate.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..be428aaca9db7b9d9dfb6bf4cb2db1d1a6d8fd1f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isDate.d.mts @@ -0,0 +1,17 @@ +//#region src/compat/predicate/isDate.d.ts +/** + * Checks if `value` is a Date object. + * + * @param {any} value The value to check. + * @returns {value is Date} Returns `true` if `value` is a Date object, `false` otherwise. + * + * @example + * const value1 = new Date(); + * const value2 = '2024-01-01'; + * + * console.log(isDate(value1)); // true + * console.log(isDate(value2)); // false + */ +declare function isDate(value?: any): value is Date; +//#endregion +export { isDate }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isDate.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isDate.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..be428aaca9db7b9d9dfb6bf4cb2db1d1a6d8fd1f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isDate.d.ts @@ -0,0 +1,17 @@ +//#region src/compat/predicate/isDate.d.ts +/** + * Checks if `value` is a Date object. + * + * @param {any} value The value to check. + * @returns {value is Date} Returns `true` if `value` is a Date object, `false` otherwise. + * + * @example + * const value1 = new Date(); + * const value2 = '2024-01-01'; + * + * console.log(isDate(value1)); // true + * console.log(isDate(value2)); // false + */ +declare function isDate(value?: any): value is Date; +//#endregion +export { isDate }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isDate.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isDate.js new file mode 100644 index 0000000000000000000000000000000000000000..7fa0038328fc6dc23c06fe62957e7b18a9cefddc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isDate.js @@ -0,0 +1,20 @@ +const require_isDate = require("../../predicate/isDate.js"); +//#region src/compat/predicate/isDate.ts +/** +* Checks if `value` is a Date object. +* +* @param {any} value The value to check. +* @returns {value is Date} Returns `true` if `value` is a Date object, `false` otherwise. +* +* @example +* const value1 = new Date(); +* const value2 = '2024-01-01'; +* +* console.log(isDate(value1)); // true +* console.log(isDate(value2)); // false +*/ +function isDate(value) { + return require_isDate.isDate(value); +} +//#endregion +exports.isDate = isDate; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isDate.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isDate.mjs new file mode 100644 index 0000000000000000000000000000000000000000..90127b3189d539fee05aa28c2a4db8449bd94803 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isDate.mjs @@ -0,0 +1,20 @@ +import { isDate as isDate$1 } from "../../predicate/isDate.mjs"; +//#region src/compat/predicate/isDate.ts +/** +* Checks if `value` is a Date object. +* +* @param {any} value The value to check. +* @returns {value is Date} Returns `true` if `value` is a Date object, `false` otherwise. +* +* @example +* const value1 = new Date(); +* const value2 = '2024-01-01'; +* +* console.log(isDate(value1)); // true +* console.log(isDate(value2)); // false +*/ +function isDate(value) { + return isDate$1(value); +} +//#endregion +export { isDate }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isElement.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isElement.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e415b38a71f1fe0c05452ee1ffa9d5155a82950d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isElement.d.mts @@ -0,0 +1,14 @@ +//#region src/compat/predicate/isElement.d.ts +/** + * Checks if `value` is likely a DOM element. + * + * @param {any} value The value to check. + * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. + * + * @example + * console.log(isElement(document.body)); // true + * console.log(isElement('')); // false + */ +declare function isElement(value?: any): boolean; +//#endregion +export { isElement }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isElement.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isElement.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e415b38a71f1fe0c05452ee1ffa9d5155a82950d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isElement.d.ts @@ -0,0 +1,14 @@ +//#region src/compat/predicate/isElement.d.ts +/** + * Checks if `value` is likely a DOM element. + * + * @param {any} value The value to check. + * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. + * + * @example + * console.log(isElement(document.body)); // true + * console.log(isElement('')); // false + */ +declare function isElement(value?: any): boolean; +//#endregion +export { isElement }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isElement.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isElement.js new file mode 100644 index 0000000000000000000000000000000000000000..f903f14cea1e8ad99c97249e5d6df5bf0853940c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isElement.js @@ -0,0 +1,18 @@ +const require_isPlainObject = require("./isPlainObject.js"); +const require_isObjectLike = require("./isObjectLike.js"); +//#region src/compat/predicate/isElement.ts +/** +* Checks if `value` is likely a DOM element. +* +* @param {any} value The value to check. +* @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. +* +* @example +* console.log(isElement(document.body)); // true +* console.log(isElement('')); // false +*/ +function isElement(value) { + return require_isObjectLike.isObjectLike(value) && value.nodeType === 1 && !require_isPlainObject.isPlainObject(value); +} +//#endregion +exports.isElement = isElement; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isElement.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isElement.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c14b4d10defc345f2ed827aad53653b8a2ebd97e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isElement.mjs @@ -0,0 +1,18 @@ +import { isPlainObject } from "./isPlainObject.mjs"; +import { isObjectLike } from "./isObjectLike.mjs"; +//#region src/compat/predicate/isElement.ts +/** +* Checks if `value` is likely a DOM element. +* +* @param {any} value The value to check. +* @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. +* +* @example +* console.log(isElement(document.body)); // true +* console.log(isElement('')); // false +*/ +function isElement(value) { + return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); +} +//#endregion +export { isElement }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEmpty.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEmpty.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..9ab4228b648760b129c8e9766cd142cffcae49e1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEmpty.d.mts @@ -0,0 +1,13 @@ +import { EmptyObjectOf } from "../_internal/EmptyObjectOf.mjs"; + +//#region src/compat/predicate/isEmpty.d.ts +declare function isEmpty(value?: T): boolean; +declare function isEmpty(value: string): value is ''; +declare function isEmpty(value: Map | Set | ArrayLike | null | undefined): boolean; +declare function isEmpty(value: object): boolean; +declare function isEmpty(value: T | null | undefined): value is EmptyObjectOf | null | undefined; +declare function isEmpty(value?: any): boolean; +//#endregion +export { isEmpty }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEmpty.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEmpty.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9cda7c1d3ec8c3f13f0b39dea451a8453bca55d7 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEmpty.d.ts @@ -0,0 +1,13 @@ +import { EmptyObjectOf } from "../_internal/EmptyObjectOf.js"; + +//#region src/compat/predicate/isEmpty.d.ts +declare function isEmpty(value?: T): boolean; +declare function isEmpty(value: string): value is ''; +declare function isEmpty(value: Map | Set | ArrayLike | null | undefined): boolean; +declare function isEmpty(value: object): boolean; +declare function isEmpty(value: T | null | undefined): value is EmptyObjectOf | null | undefined; +declare function isEmpty(value?: any): boolean; +//#endregion +export { isEmpty }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEmpty.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEmpty.js new file mode 100644 index 0000000000000000000000000000000000000000..553e7606f05a1ff3b2af3deeb57646076c14e5dd --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEmpty.js @@ -0,0 +1,48 @@ +const require_isBuffer = require("../../predicate/isBuffer.js"); +const require_isArrayLike = require("./isArrayLike.js"); +const require_isArguments = require("./isArguments.js"); +const require_isPrototype = require("../_internal/isPrototype.js"); +const require_isTypedArray = require("./isTypedArray.js"); +//#region src/compat/predicate/isEmpty.ts +/** +* Checks if a given value is empty. +* +* - If the given value is a string, checks if it is an empty string. +* - If the given value is an array, `Map`, or `Set`, checks if its size is 0. +* - If the given value is an [array-like object](../predicate/isArrayLike.md), checks if its length is 0. +* - If the given value is an object, checks if it is an empty object with no properties. +* - Primitive values (booleans, numbers, or bigints) are considered empty. +* +* @param {unknown} [value] - The value to check. +* @returns {boolean} `true` if the value is empty, `false` otherwise. +* +* @example +* isEmpty(); // true +* isEmpty(null); // true +* isEmpty(""); // true +* isEmpty([]); // true +* isEmpty({}); // true +* isEmpty(new Map()); // true +* isEmpty(new Set()); // true +* isEmpty("hello"); // false +* isEmpty([1, 2, 3]); // false +* isEmpty({ a: 1 }); // false +* isEmpty(new Map([["key", "value"]])); // false +* isEmpty(new Set([1, 2, 3])); // false +*/ +function isEmpty(value) { + if (value == null) return true; + if (require_isArrayLike.isArrayLike(value)) { + if (typeof value.splice !== "function" && typeof value !== "string" && !require_isBuffer.isBuffer(value) && !require_isTypedArray.isTypedArray(value) && !require_isArguments.isArguments(value)) return false; + return value.length === 0; + } + if (typeof value === "object") { + if (value instanceof Map || value instanceof Set) return value.size === 0; + const keys = Object.keys(value); + if (require_isPrototype.isPrototype(value)) return keys.filter((x) => x !== "constructor").length === 0; + return keys.length === 0; + } + return true; +} +//#endregion +exports.isEmpty = isEmpty; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEmpty.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEmpty.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e7c41c3b2d65f52e50865cc2de04bc710ae97de3 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEmpty.mjs @@ -0,0 +1,48 @@ +import { isBuffer } from "../../predicate/isBuffer.mjs"; +import { isArrayLike } from "./isArrayLike.mjs"; +import { isArguments } from "./isArguments.mjs"; +import { isPrototype } from "../_internal/isPrototype.mjs"; +import { isTypedArray } from "./isTypedArray.mjs"; +//#region src/compat/predicate/isEmpty.ts +/** +* Checks if a given value is empty. +* +* - If the given value is a string, checks if it is an empty string. +* - If the given value is an array, `Map`, or `Set`, checks if its size is 0. +* - If the given value is an [array-like object](../predicate/isArrayLike.md), checks if its length is 0. +* - If the given value is an object, checks if it is an empty object with no properties. +* - Primitive values (booleans, numbers, or bigints) are considered empty. +* +* @param {unknown} [value] - The value to check. +* @returns {boolean} `true` if the value is empty, `false` otherwise. +* +* @example +* isEmpty(); // true +* isEmpty(null); // true +* isEmpty(""); // true +* isEmpty([]); // true +* isEmpty({}); // true +* isEmpty(new Map()); // true +* isEmpty(new Set()); // true +* isEmpty("hello"); // false +* isEmpty([1, 2, 3]); // false +* isEmpty({ a: 1 }); // false +* isEmpty(new Map([["key", "value"]])); // false +* isEmpty(new Set([1, 2, 3])); // false +*/ +function isEmpty(value) { + if (value == null) return true; + if (isArrayLike(value)) { + if (typeof value.splice !== "function" && typeof value !== "string" && !isBuffer(value) && !isTypedArray(value) && !isArguments(value)) return false; + return value.length === 0; + } + if (typeof value === "object") { + if (value instanceof Map || value instanceof Set) return value.size === 0; + const keys = Object.keys(value); + if (isPrototype(value)) return keys.filter((x) => x !== "constructor").length === 0; + return keys.length === 0; + } + return true; +} +//#endregion +export { isEmpty }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEqualWith.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEqualWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..5fbf12af773b5d30764844abf9c8f62e36aaf77c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEqualWith.d.mts @@ -0,0 +1,41 @@ +import { IsEqualCustomizer } from "../_internal/IsEqualCustomizer.mjs"; + +//#region src/compat/predicate/isEqualWith.d.ts +/** + * Compares two values for equality using a custom comparison function. + * + * The custom function allows for fine-tuned control over the comparison process. If it returns a boolean, that result determines the equality. If it returns undefined, the function falls back to the default equality comparison. + * + * This function also uses the custom equality function to compare values inside objects, + * arrays, maps, sets, and other complex structures, ensuring a deep comparison. + * + * This approach provides flexibility in handling complex comparisons while maintaining efficient default behavior for simpler cases. + * + * The custom comparison function can take up to six parameters: + * - `x`: The value from the first object `a`. + * - `y`: The value from the second object `b`. + * - `property`: The property key used to get `x` and `y`. + * - `xParent`: The parent of the first value `x`. + * - `yParent`: The parent of the second value `y`. + * - `stack`: An internal stack (Map) to handle circular references. + * + * @param {unknown} a - The first value to compare. + * @param {unknown} b - The second value to compare. + * @param {(x: any, y: any, property?: PropertyKey, xParent?: any, yParent?: any, stack?: Map) => boolean | void} [areValuesEqual=noop] - A function to customize the comparison. + * If it returns a boolean, that result will be used. If it returns undefined, + * the default equality comparison will be used. + * @returns {boolean} `true` if the values are equal according to the customizer, otherwise `false`. + * + * @example + * const customizer = (a, b) => { + * if (typeof a === 'string' && typeof b === 'string') { + * return a.toLowerCase() === b.toLowerCase(); + * } + * }; + * isEqualWith('Hello', 'hello', customizer); // true + * isEqualWith({ a: 'Hello' }, { a: 'hello' }, customizer); // true + * isEqualWith([1, 2, 3], [1, 2, 3], customizer); // true + */ +declare function isEqualWith(a: any, b: any, areValuesEqual?: IsEqualCustomizer): boolean; +//#endregion +export { isEqualWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEqualWith.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEqualWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a5c4d9665f4e20ba94e4397b7135314436157e1c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEqualWith.d.ts @@ -0,0 +1,41 @@ +import { IsEqualCustomizer } from "../_internal/IsEqualCustomizer.js"; + +//#region src/compat/predicate/isEqualWith.d.ts +/** + * Compares two values for equality using a custom comparison function. + * + * The custom function allows for fine-tuned control over the comparison process. If it returns a boolean, that result determines the equality. If it returns undefined, the function falls back to the default equality comparison. + * + * This function also uses the custom equality function to compare values inside objects, + * arrays, maps, sets, and other complex structures, ensuring a deep comparison. + * + * This approach provides flexibility in handling complex comparisons while maintaining efficient default behavior for simpler cases. + * + * The custom comparison function can take up to six parameters: + * - `x`: The value from the first object `a`. + * - `y`: The value from the second object `b`. + * - `property`: The property key used to get `x` and `y`. + * - `xParent`: The parent of the first value `x`. + * - `yParent`: The parent of the second value `y`. + * - `stack`: An internal stack (Map) to handle circular references. + * + * @param {unknown} a - The first value to compare. + * @param {unknown} b - The second value to compare. + * @param {(x: any, y: any, property?: PropertyKey, xParent?: any, yParent?: any, stack?: Map) => boolean | void} [areValuesEqual=noop] - A function to customize the comparison. + * If it returns a boolean, that result will be used. If it returns undefined, + * the default equality comparison will be used. + * @returns {boolean} `true` if the values are equal according to the customizer, otherwise `false`. + * + * @example + * const customizer = (a, b) => { + * if (typeof a === 'string' && typeof b === 'string') { + * return a.toLowerCase() === b.toLowerCase(); + * } + * }; + * isEqualWith('Hello', 'hello', customizer); // true + * isEqualWith({ a: 'Hello' }, { a: 'hello' }, customizer); // true + * isEqualWith([1, 2, 3], [1, 2, 3], customizer); // true + */ +declare function isEqualWith(a: any, b: any, areValuesEqual?: IsEqualCustomizer): boolean; +//#endregion +export { isEqualWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEqualWith.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEqualWith.js new file mode 100644 index 0000000000000000000000000000000000000000..1d51992acccd71ee40a399ea540bb30a8924ba7a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEqualWith.js @@ -0,0 +1,49 @@ +const require_after = require("../../function/after.js"); +const require_isEqualWith = require("../../predicate/isEqualWith.js"); +//#region src/compat/predicate/isEqualWith.ts +/** +* Compares two values for equality using a custom comparison function. +* +* The custom function allows for fine-tuned control over the comparison process. If it returns a boolean, that result determines the equality. If it returns undefined, the function falls back to the default equality comparison. +* +* This function also uses the custom equality function to compare values inside objects, +* arrays, maps, sets, and other complex structures, ensuring a deep comparison. +* +* This approach provides flexibility in handling complex comparisons while maintaining efficient default behavior for simpler cases. +* +* The custom comparison function can take up to six parameters: +* - `x`: The value from the first object `a`. +* - `y`: The value from the second object `b`. +* - `property`: The property key used to get `x` and `y`. +* - `xParent`: The parent of the first value `x`. +* - `yParent`: The parent of the second value `y`. +* - `stack`: An internal stack (Map) to handle circular references. +* +* @param {unknown} a - The first value to compare. +* @param {unknown} b - The second value to compare. +* @param {(x: any, y: any, property?: PropertyKey, xParent?: any, yParent?: any, stack?: Map) => boolean | void} [areValuesEqual=noop] - A function to customize the comparison. +* If it returns a boolean, that result will be used. If it returns undefined, +* the default equality comparison will be used. +* @returns {boolean} `true` if the values are equal according to the customizer, otherwise `false`. +* +* @example +* const customizer = (a, b) => { +* if (typeof a === 'string' && typeof b === 'string') { +* return a.toLowerCase() === b.toLowerCase(); +* } +* }; +* isEqualWith('Hello', 'hello', customizer); // true +* isEqualWith({ a: 'Hello' }, { a: 'hello' }, customizer); // true +* isEqualWith([1, 2, 3], [1, 2, 3], customizer); // true +*/ +function isEqualWith(a, b, areValuesEqual) { + if (typeof areValuesEqual !== "function") areValuesEqual = () => void 0; + return require_isEqualWith.isEqualWith(a, b, (...args) => { + const result = areValuesEqual(...args); + if (result !== void 0) return Boolean(result); + if (a instanceof Map && b instanceof Map) return isEqualWith(Array.from(a), Array.from(b), require_after.after(2, areValuesEqual)); + if (a instanceof Set && b instanceof Set) return isEqualWith(Array.from(a), Array.from(b), require_after.after(2, areValuesEqual)); + }); +} +//#endregion +exports.isEqualWith = isEqualWith; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEqualWith.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEqualWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d78f62a7d6ea774b739e23dec1e5b3c3ff4b7553 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isEqualWith.mjs @@ -0,0 +1,49 @@ +import { after } from "../../function/after.mjs"; +import { isEqualWith as isEqualWith$1 } from "../../predicate/isEqualWith.mjs"; +//#region src/compat/predicate/isEqualWith.ts +/** +* Compares two values for equality using a custom comparison function. +* +* The custom function allows for fine-tuned control over the comparison process. If it returns a boolean, that result determines the equality. If it returns undefined, the function falls back to the default equality comparison. +* +* This function also uses the custom equality function to compare values inside objects, +* arrays, maps, sets, and other complex structures, ensuring a deep comparison. +* +* This approach provides flexibility in handling complex comparisons while maintaining efficient default behavior for simpler cases. +* +* The custom comparison function can take up to six parameters: +* - `x`: The value from the first object `a`. +* - `y`: The value from the second object `b`. +* - `property`: The property key used to get `x` and `y`. +* - `xParent`: The parent of the first value `x`. +* - `yParent`: The parent of the second value `y`. +* - `stack`: An internal stack (Map) to handle circular references. +* +* @param {unknown} a - The first value to compare. +* @param {unknown} b - The second value to compare. +* @param {(x: any, y: any, property?: PropertyKey, xParent?: any, yParent?: any, stack?: Map) => boolean | void} [areValuesEqual=noop] - A function to customize the comparison. +* If it returns a boolean, that result will be used. If it returns undefined, +* the default equality comparison will be used. +* @returns {boolean} `true` if the values are equal according to the customizer, otherwise `false`. +* +* @example +* const customizer = (a, b) => { +* if (typeof a === 'string' && typeof b === 'string') { +* return a.toLowerCase() === b.toLowerCase(); +* } +* }; +* isEqualWith('Hello', 'hello', customizer); // true +* isEqualWith({ a: 'Hello' }, { a: 'hello' }, customizer); // true +* isEqualWith([1, 2, 3], [1, 2, 3], customizer); // true +*/ +function isEqualWith(a, b, areValuesEqual) { + if (typeof areValuesEqual !== "function") areValuesEqual = () => void 0; + return isEqualWith$1(a, b, (...args) => { + const result = areValuesEqual(...args); + if (result !== void 0) return Boolean(result); + if (a instanceof Map && b instanceof Map) return isEqualWith(Array.from(a), Array.from(b), after(2, areValuesEqual)); + if (a instanceof Set && b instanceof Set) return isEqualWith(Array.from(a), Array.from(b), after(2, areValuesEqual)); + }); +} +//#endregion +export { isEqualWith }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isError.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isError.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d2831eb8d577e06575df780c20d39b2a27be4ed8 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isError.d.mts @@ -0,0 +1,17 @@ +//#region src/compat/predicate/isError.d.ts +/** + * Checks if `value` is an Error object. + * + * @param {any} value The value to check. + * @returns {value is Error} Returns `true` if `value` is an Error object, `false` otherwise. + * + * @example + * ```typescript + * console.log(isError(new Error())); // true + * console.log(isError('Error')); // false + * console.log(isError({ name: 'Error', message: '' })); // false + * ``` + */ +declare function isError(value: any): value is Error; +//#endregion +export { isError }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isError.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isError.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d2831eb8d577e06575df780c20d39b2a27be4ed8 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isError.d.ts @@ -0,0 +1,17 @@ +//#region src/compat/predicate/isError.d.ts +/** + * Checks if `value` is an Error object. + * + * @param {any} value The value to check. + * @returns {value is Error} Returns `true` if `value` is an Error object, `false` otherwise. + * + * @example + * ```typescript + * console.log(isError(new Error())); // true + * console.log(isError('Error')); // false + * console.log(isError({ name: 'Error', message: '' })); // false + * ``` + */ +declare function isError(value: any): value is Error; +//#endregion +export { isError }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isError.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isError.js new file mode 100644 index 0000000000000000000000000000000000000000..0fad27015c2cb383b8bd0cebc461ca892162adf5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isError.js @@ -0,0 +1,20 @@ +const require_getTag = require("../_internal/getTag.js"); +//#region src/compat/predicate/isError.ts +/** +* Checks if `value` is an Error object. +* +* @param {any} value The value to check. +* @returns {value is Error} Returns `true` if `value` is an Error object, `false` otherwise. +* +* @example +* ```typescript +* console.log(isError(new Error())); // true +* console.log(isError('Error')); // false +* console.log(isError({ name: 'Error', message: '' })); // false +* ``` +*/ +function isError(value) { + return require_getTag.getTag(value) === "[object Error]"; +} +//#endregion +exports.isError = isError; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isError.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isError.mjs new file mode 100644 index 0000000000000000000000000000000000000000..994f129d97ab2643a1add21860a7e99d646b02d9 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isError.mjs @@ -0,0 +1,20 @@ +import { getTag } from "../_internal/getTag.mjs"; +//#region src/compat/predicate/isError.ts +/** +* Checks if `value` is an Error object. +* +* @param {any} value The value to check. +* @returns {value is Error} Returns `true` if `value` is an Error object, `false` otherwise. +* +* @example +* ```typescript +* console.log(isError(new Error())); // true +* console.log(isError('Error')); // false +* console.log(isError({ name: 'Error', message: '' })); // false +* ``` +*/ +function isError(value) { + return getTag(value) === "[object Error]"; +} +//#endregion +export { isError }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFinite.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFinite.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d9be0edd1a53c7c4e3988663e75e0c5f2885e351 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFinite.d.mts @@ -0,0 +1,28 @@ +//#region src/compat/predicate/isFinite.d.ts +/** + * Checks if `value` is a finite number. + * + * Acts as a type guard for `number` values — returning `true` only when `value` + * is of type `number` and finite (not `Infinity`, `-Infinity`, or `NaN`). + * + * @param {unknown} value The value to check. + * @returns {value is number} Returns `true` if `value` is a finite number, `false` otherwise. + * + * @example + * ```typescript + * const value1 = 100; + * const value2 = Infinity; + * const value3 = '100'; + * + * console.log(isFinite(value1)); // true + * console.log(isFinite(value2)); // false + * console.log(isFinite(value3)); // false + * + * if (isFinite(value1)) { + * console.log(value1.toFixed(2)); + * } + * ``` + */ +declare function isFinite(value: unknown): value is number; +//#endregion +export { isFinite }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFinite.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFinite.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d9be0edd1a53c7c4e3988663e75e0c5f2885e351 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFinite.d.ts @@ -0,0 +1,28 @@ +//#region src/compat/predicate/isFinite.d.ts +/** + * Checks if `value` is a finite number. + * + * Acts as a type guard for `number` values — returning `true` only when `value` + * is of type `number` and finite (not `Infinity`, `-Infinity`, or `NaN`). + * + * @param {unknown} value The value to check. + * @returns {value is number} Returns `true` if `value` is a finite number, `false` otherwise. + * + * @example + * ```typescript + * const value1 = 100; + * const value2 = Infinity; + * const value3 = '100'; + * + * console.log(isFinite(value1)); // true + * console.log(isFinite(value2)); // false + * console.log(isFinite(value3)); // false + * + * if (isFinite(value1)) { + * console.log(value1.toFixed(2)); + * } + * ``` + */ +declare function isFinite(value: unknown): value is number; +//#endregion +export { isFinite }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFinite.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFinite.js new file mode 100644 index 0000000000000000000000000000000000000000..3b4a51c1e5ecb7914f4245f64407dd8460d38966 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFinite.js @@ -0,0 +1,30 @@ +//#region src/compat/predicate/isFinite.ts +/** +* Checks if `value` is a finite number. +* +* Acts as a type guard for `number` values — returning `true` only when `value` +* is of type `number` and finite (not `Infinity`, `-Infinity`, or `NaN`). +* +* @param {unknown} value The value to check. +* @returns {value is number} Returns `true` if `value` is a finite number, `false` otherwise. +* +* @example +* ```typescript +* const value1 = 100; +* const value2 = Infinity; +* const value3 = '100'; +* +* console.log(isFinite(value1)); // true +* console.log(isFinite(value2)); // false +* console.log(isFinite(value3)); // false +* +* if (isFinite(value1)) { +* console.log(value1.toFixed(2)); +* } +* ``` +*/ +function isFinite(value) { + return Number.isFinite(value); +} +//#endregion +exports.isFinite = isFinite; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFinite.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFinite.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a1b9ffdf7e2bf830c0fbb4efc519d8c621a0fa26 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFinite.mjs @@ -0,0 +1,30 @@ +//#region src/compat/predicate/isFinite.ts +/** +* Checks if `value` is a finite number. +* +* Acts as a type guard for `number` values — returning `true` only when `value` +* is of type `number` and finite (not `Infinity`, `-Infinity`, or `NaN`). +* +* @param {unknown} value The value to check. +* @returns {value is number} Returns `true` if `value` is a finite number, `false` otherwise. +* +* @example +* ```typescript +* const value1 = 100; +* const value2 = Infinity; +* const value3 = '100'; +* +* console.log(isFinite(value1)); // true +* console.log(isFinite(value2)); // false +* console.log(isFinite(value3)); // false +* +* if (isFinite(value1)) { +* console.log(value1.toFixed(2)); +* } +* ``` +*/ +function isFinite(value) { + return Number.isFinite(value); +} +//#endregion +export { isFinite }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFunction.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFunction.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0940eeace3fb2c35ad5a12086aaace2bafee852a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFunction.d.mts @@ -0,0 +1,17 @@ +//#region src/compat/predicate/isFunction.d.ts +/** + * Checks if `value` is a function. + * + * @param {any} value The value to check. + * @returns {value is (...args: any[]) => any} Returns `true` if `value` is a function, else `false`. + * + * @example + * isFunction(Array.prototype.slice); // true + * isFunction(async function () {}); // true + * isFunction(function* () {}); // true + * isFunction(Proxy); // true + * isFunction(Int8Array); // true + */ +declare function isFunction(value: any): value is (...args: any[]) => any; +//#endregion +export { isFunction }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFunction.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFunction.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0940eeace3fb2c35ad5a12086aaace2bafee852a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFunction.d.ts @@ -0,0 +1,17 @@ +//#region src/compat/predicate/isFunction.d.ts +/** + * Checks if `value` is a function. + * + * @param {any} value The value to check. + * @returns {value is (...args: any[]) => any} Returns `true` if `value` is a function, else `false`. + * + * @example + * isFunction(Array.prototype.slice); // true + * isFunction(async function () {}); // true + * isFunction(function* () {}); // true + * isFunction(Proxy); // true + * isFunction(Int8Array); // true + */ +declare function isFunction(value: any): value is (...args: any[]) => any; +//#endregion +export { isFunction }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFunction.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFunction.js new file mode 100644 index 0000000000000000000000000000000000000000..768f4403797d3aa1224289771b61b34e52763bef --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFunction.js @@ -0,0 +1,19 @@ +//#region src/compat/predicate/isFunction.ts +/** +* Checks if `value` is a function. +* +* @param {any} value The value to check. +* @returns {value is (...args: any[]) => any} Returns `true` if `value` is a function, else `false`. +* +* @example +* isFunction(Array.prototype.slice); // true +* isFunction(async function () {}); // true +* isFunction(function* () {}); // true +* isFunction(Proxy); // true +* isFunction(Int8Array); // true +*/ +function isFunction(value) { + return typeof value === "function"; +} +//#endregion +exports.isFunction = isFunction; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFunction.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFunction.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a2d77bde09b3f3d29398cecd8cffba59ff58e073 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isFunction.mjs @@ -0,0 +1,19 @@ +//#region src/compat/predicate/isFunction.ts +/** +* Checks if `value` is a function. +* +* @param {any} value The value to check. +* @returns {value is (...args: any[]) => any} Returns `true` if `value` is a function, else `false`. +* +* @example +* isFunction(Array.prototype.slice); // true +* isFunction(async function () {}); // true +* isFunction(function* () {}); // true +* isFunction(Proxy); // true +* isFunction(Int8Array); // true +*/ +function isFunction(value) { + return typeof value === "function"; +} +//#endregion +export { isFunction }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isInteger.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isInteger.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6bd3799ac5fa9e3159c988d138c898868beeb55b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isInteger.d.mts @@ -0,0 +1,18 @@ +//#region src/compat/predicate/isInteger.d.ts +/** + * Checks if `value` is an integer. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `number`. + * + * @param {any} value - The value to check + * @returns {boolean} `true` if `value` is integer, otherwise `false`. + * + * @example + * isInteger(3); // Returns: true + * isInteger(Infinity); // Returns: false + * isInteger('3'); // Returns: false + * isInteger([]); // Returns: false + */ +declare function isInteger(value?: any): boolean; +//#endregion +export { isInteger }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isInteger.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isInteger.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6bd3799ac5fa9e3159c988d138c898868beeb55b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isInteger.d.ts @@ -0,0 +1,18 @@ +//#region src/compat/predicate/isInteger.d.ts +/** + * Checks if `value` is an integer. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `number`. + * + * @param {any} value - The value to check + * @returns {boolean} `true` if `value` is integer, otherwise `false`. + * + * @example + * isInteger(3); // Returns: true + * isInteger(Infinity); // Returns: false + * isInteger('3'); // Returns: false + * isInteger([]); // Returns: false + */ +declare function isInteger(value?: any): boolean; +//#endregion +export { isInteger }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isInteger.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isInteger.js new file mode 100644 index 0000000000000000000000000000000000000000..717ab03f5cb3c0b2e92206e0fd7281635c288a35 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isInteger.js @@ -0,0 +1,20 @@ +//#region src/compat/predicate/isInteger.ts +/** +* Checks if `value` is an integer. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `number`. +* +* @param {any} value - The value to check +* @returns {boolean} `true` if `value` is integer, otherwise `false`. +* +* @example +* isInteger(3); // Returns: true +* isInteger(Infinity); // Returns: false +* isInteger('3'); // Returns: false +* isInteger([]); // Returns: false +*/ +function isInteger(value) { + return Number.isInteger(value); +} +//#endregion +exports.isInteger = isInteger; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isInteger.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isInteger.mjs new file mode 100644 index 0000000000000000000000000000000000000000..213be4aa36ba727b8e3dd05ffbba34fa55718b97 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isInteger.mjs @@ -0,0 +1,20 @@ +//#region src/compat/predicate/isInteger.ts +/** +* Checks if `value` is an integer. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `number`. +* +* @param {any} value - The value to check +* @returns {boolean} `true` if `value` is integer, otherwise `false`. +* +* @example +* isInteger(3); // Returns: true +* isInteger(Infinity); // Returns: false +* isInteger('3'); // Returns: false +* isInteger([]); // Returns: false +*/ +function isInteger(value) { + return Number.isInteger(value); +} +//#endregion +export { isInteger }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isLength.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isLength.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a70f4c619f1c0def084c0933aae000a2f3585c89 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isLength.d.mts @@ -0,0 +1,25 @@ +//#region src/compat/predicate/isLength.d.ts +/** + * Checks if a given value is a valid length. + * + * A valid length is of type `number`, is a non-negative integer, and is less than or equal to + * JavaScript's maximum safe integer (`Number.MAX_SAFE_INTEGER`). + * It returns `true` if the value is a valid length, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the + * argument to a valid length (`number`). + * + * @param {any} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * + * @example + * isLength(0); // true + * isLength(42); // true + * isLength(-1); // false + * isLength(1.5); // false + * isLength(Number.MAX_SAFE_INTEGER); // true + * isLength(Number.MAX_SAFE_INTEGER + 1); // false + */ +declare function isLength(value?: any): boolean; +//#endregion +export { isLength }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isLength.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isLength.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a70f4c619f1c0def084c0933aae000a2f3585c89 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isLength.d.ts @@ -0,0 +1,25 @@ +//#region src/compat/predicate/isLength.d.ts +/** + * Checks if a given value is a valid length. + * + * A valid length is of type `number`, is a non-negative integer, and is less than or equal to + * JavaScript's maximum safe integer (`Number.MAX_SAFE_INTEGER`). + * It returns `true` if the value is a valid length, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the + * argument to a valid length (`number`). + * + * @param {any} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * + * @example + * isLength(0); // true + * isLength(42); // true + * isLength(-1); // false + * isLength(1.5); // false + * isLength(Number.MAX_SAFE_INTEGER); // true + * isLength(Number.MAX_SAFE_INTEGER + 1); // false + */ +declare function isLength(value?: any): boolean; +//#endregion +export { isLength }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isLength.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isLength.js new file mode 100644 index 0000000000000000000000000000000000000000..a5b5c8569a58f274f93e882763a000cbe3afc546 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isLength.js @@ -0,0 +1,27 @@ +//#region src/compat/predicate/isLength.ts +/** +* Checks if a given value is a valid length. +* +* A valid length is of type `number`, is a non-negative integer, and is less than or equal to +* JavaScript's maximum safe integer (`Number.MAX_SAFE_INTEGER`). +* It returns `true` if the value is a valid length, and `false` otherwise. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the +* argument to a valid length (`number`). +* +* @param {any} value The value to check. +* @returns {boolean} Returns `true` if `value` is a valid length, else `false`. +* +* @example +* isLength(0); // true +* isLength(42); // true +* isLength(-1); // false +* isLength(1.5); // false +* isLength(Number.MAX_SAFE_INTEGER); // true +* isLength(Number.MAX_SAFE_INTEGER + 1); // false +*/ +function isLength(value) { + return Number.isSafeInteger(value) && value >= 0; +} +//#endregion +exports.isLength = isLength; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isLength.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isLength.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d5af07a286ede8504dabf136a8e6c9170331c261 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isLength.mjs @@ -0,0 +1,27 @@ +//#region src/compat/predicate/isLength.ts +/** +* Checks if a given value is a valid length. +* +* A valid length is of type `number`, is a non-negative integer, and is less than or equal to +* JavaScript's maximum safe integer (`Number.MAX_SAFE_INTEGER`). +* It returns `true` if the value is a valid length, and `false` otherwise. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the +* argument to a valid length (`number`). +* +* @param {any} value The value to check. +* @returns {boolean} Returns `true` if `value` is a valid length, else `false`. +* +* @example +* isLength(0); // true +* isLength(42); // true +* isLength(-1); // false +* isLength(1.5); // false +* isLength(Number.MAX_SAFE_INTEGER); // true +* isLength(Number.MAX_SAFE_INTEGER + 1); // false +*/ +function isLength(value) { + return Number.isSafeInteger(value) && value >= 0; +} +//#endregion +export { isLength }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMap.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMap.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e0b09bf19a6b288cc4f3f18ca4bd3bbc5d218e94 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMap.d.mts @@ -0,0 +1,21 @@ +//#region src/compat/predicate/isMap.d.ts +/** + * Checks if a given value is `Map`. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Map`. + * + * @param {unknown} value The value to check if it is a `Map`. + * @returns {value is Map} Returns `true` if `value` is a `Map`, else `false`. + * + * @example + * const value1 = new Map(); + * const value2 = new Set(); + * const value3 = new WeakMap(); + * + * console.log(isMap(value1)); // true + * console.log(isMap(value2)); // false + * console.log(isMap(value3)); // false + */ +declare function isMap(value?: any): value is Map; +//#endregion +export { isMap }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMap.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMap.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e0b09bf19a6b288cc4f3f18ca4bd3bbc5d218e94 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMap.d.ts @@ -0,0 +1,21 @@ +//#region src/compat/predicate/isMap.d.ts +/** + * Checks if a given value is `Map`. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Map`. + * + * @param {unknown} value The value to check if it is a `Map`. + * @returns {value is Map} Returns `true` if `value` is a `Map`, else `false`. + * + * @example + * const value1 = new Map(); + * const value2 = new Set(); + * const value3 = new WeakMap(); + * + * console.log(isMap(value1)); // true + * console.log(isMap(value2)); // false + * console.log(isMap(value3)); // false + */ +declare function isMap(value?: any): value is Map; +//#endregion +export { isMap }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMap.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMap.js new file mode 100644 index 0000000000000000000000000000000000000000..118e898fcb24c1d8040361628736d23714c5b907 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMap.js @@ -0,0 +1,24 @@ +const require_isMap = require("../../predicate/isMap.js"); +//#region src/compat/predicate/isMap.ts +/** +* Checks if a given value is `Map`. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Map`. +* +* @param {unknown} value The value to check if it is a `Map`. +* @returns {value is Map} Returns `true` if `value` is a `Map`, else `false`. +* +* @example +* const value1 = new Map(); +* const value2 = new Set(); +* const value3 = new WeakMap(); +* +* console.log(isMap(value1)); // true +* console.log(isMap(value2)); // false +* console.log(isMap(value3)); // false +*/ +function isMap(value) { + return require_isMap.isMap(value); +} +//#endregion +exports.isMap = isMap; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMap.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMap.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2910089c1c04db0bba91ca126481d00d242e5fa1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMap.mjs @@ -0,0 +1,24 @@ +import { isMap as isMap$1 } from "../../predicate/isMap.mjs"; +//#region src/compat/predicate/isMap.ts +/** +* Checks if a given value is `Map`. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Map`. +* +* @param {unknown} value The value to check if it is a `Map`. +* @returns {value is Map} Returns `true` if `value` is a `Map`, else `false`. +* +* @example +* const value1 = new Map(); +* const value2 = new Set(); +* const value3 = new WeakMap(); +* +* console.log(isMap(value1)); // true +* console.log(isMap(value2)); // false +* console.log(isMap(value3)); // false +*/ +function isMap(value) { + return isMap$1(value); +} +//#endregion +export { isMap }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatch.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatch.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..479270c9e39202eaea09008fdadc15187ad50011 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatch.d.mts @@ -0,0 +1,32 @@ +//#region src/compat/predicate/isMatch.d.ts +/** + * Checks if the target matches the source by comparing their structures and values. + * This function supports deep comparison for objects, arrays, maps, and sets. + * + * @param {object} target - The target value to match against. + * @param {object} source - The source value to match with. + * @returns {boolean} - Returns `true` if the target matches the source, otherwise `false`. + * + * @example + * // Basic usage + * isMatch({ a: 1, b: 2 }, { a: 1 }); // true + * + * @example + * // Matching arrays + * isMatch([1, 2, 3], [1, 2, 3]); // true + * + * @example + * // Matching maps + * const targetMap = new Map([['key1', 'value1'], ['key2', 'value2']]); + * const sourceMap = new Map([['key1', 'value1']]); + * isMatch(targetMap, sourceMap); // true + * + * @example + * // Matching sets + * const targetSet = new Set([1, 2, 3]); + * const sourceSet = new Set([1, 2]); + * isMatch(targetSet, sourceSet); // true + */ +declare function isMatch(target: object, source: object): boolean; +//#endregion +export { isMatch }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatch.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatch.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..479270c9e39202eaea09008fdadc15187ad50011 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatch.d.ts @@ -0,0 +1,32 @@ +//#region src/compat/predicate/isMatch.d.ts +/** + * Checks if the target matches the source by comparing their structures and values. + * This function supports deep comparison for objects, arrays, maps, and sets. + * + * @param {object} target - The target value to match against. + * @param {object} source - The source value to match with. + * @returns {boolean} - Returns `true` if the target matches the source, otherwise `false`. + * + * @example + * // Basic usage + * isMatch({ a: 1, b: 2 }, { a: 1 }); // true + * + * @example + * // Matching arrays + * isMatch([1, 2, 3], [1, 2, 3]); // true + * + * @example + * // Matching maps + * const targetMap = new Map([['key1', 'value1'], ['key2', 'value2']]); + * const sourceMap = new Map([['key1', 'value1']]); + * isMatch(targetMap, sourceMap); // true + * + * @example + * // Matching sets + * const targetSet = new Set([1, 2, 3]); + * const sourceSet = new Set([1, 2]); + * isMatch(targetSet, sourceSet); // true + */ +declare function isMatch(target: object, source: object): boolean; +//#endregion +export { isMatch }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatch.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatch.js new file mode 100644 index 0000000000000000000000000000000000000000..5c66cfd9dcc32886479d993337268f2d171ea7c6 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatch.js @@ -0,0 +1,35 @@ +const require_isMatchWith = require("./isMatchWith.js"); +//#region src/compat/predicate/isMatch.ts +/** +* Checks if the target matches the source by comparing their structures and values. +* This function supports deep comparison for objects, arrays, maps, and sets. +* +* @param {object} target - The target value to match against. +* @param {object} source - The source value to match with. +* @returns {boolean} - Returns `true` if the target matches the source, otherwise `false`. +* +* @example +* // Basic usage +* isMatch({ a: 1, b: 2 }, { a: 1 }); // true +* +* @example +* // Matching arrays +* isMatch([1, 2, 3], [1, 2, 3]); // true +* +* @example +* // Matching maps +* const targetMap = new Map([['key1', 'value1'], ['key2', 'value2']]); +* const sourceMap = new Map([['key1', 'value1']]); +* isMatch(targetMap, sourceMap); // true +* +* @example +* // Matching sets +* const targetSet = new Set([1, 2, 3]); +* const sourceSet = new Set([1, 2]); +* isMatch(targetSet, sourceSet); // true +*/ +function isMatch(target, source) { + return require_isMatchWith.isMatchWith(target, source, () => void 0); +} +//#endregion +exports.isMatch = isMatch; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatch.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatch.mjs new file mode 100644 index 0000000000000000000000000000000000000000..502ffeadbccef94429fe3382dd129fe1f4fbfc98 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatch.mjs @@ -0,0 +1,35 @@ +import { isMatchWith } from "./isMatchWith.mjs"; +//#region src/compat/predicate/isMatch.ts +/** +* Checks if the target matches the source by comparing their structures and values. +* This function supports deep comparison for objects, arrays, maps, and sets. +* +* @param {object} target - The target value to match against. +* @param {object} source - The source value to match with. +* @returns {boolean} - Returns `true` if the target matches the source, otherwise `false`. +* +* @example +* // Basic usage +* isMatch({ a: 1, b: 2 }, { a: 1 }); // true +* +* @example +* // Matching arrays +* isMatch([1, 2, 3], [1, 2, 3]); // true +* +* @example +* // Matching maps +* const targetMap = new Map([['key1', 'value1'], ['key2', 'value2']]); +* const sourceMap = new Map([['key1', 'value1']]); +* isMatch(targetMap, sourceMap); // true +* +* @example +* // Matching sets +* const targetSet = new Set([1, 2, 3]); +* const sourceSet = new Set([1, 2]); +* isMatch(targetSet, sourceSet); // true +*/ +function isMatch(target, source) { + return isMatchWith(target, source, () => void 0); +} +//#endregion +export { isMatch }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatchWith.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatchWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a8d1108529aa4112bfc80264705c61fa72037b73 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatchWith.d.mts @@ -0,0 +1,31 @@ +import { IsMatchWithCustomizer } from "../_internal/IsMatchWithCustomizer.mjs"; + +//#region src/compat/predicate/isMatchWith.d.ts +/** + * Performs a deep comparison between a target value and a source pattern to determine if they match, + * using a custom comparison function for fine-grained control over the matching logic. + * + * @param {object} target - The value to be tested for matching + * @param {object} source - The pattern/template to match against + * @param {IsMatchWithCustomizer} compare - Custom comparison function for fine-grained control + * @returns {boolean} `true` if the target matches the source pattern, `false` otherwise + * + * @example + * // Basic matching with custom comparator + * const caseInsensitiveCompare = (objVal, srcVal) => { + * if (typeof objVal === 'string' && typeof srcVal === 'string') { + * return objVal.toLowerCase() === srcVal.toLowerCase(); + * } + * return undefined; + * }; + * + * isMatchWith( + * { name: 'JOHN', age: 30 }, + * { name: 'john' }, + * caseInsensitiveCompare + * ); // true + */ +declare function isMatchWith(target: object, source: object, compare: IsMatchWithCustomizer): boolean; +declare function isSetMatch(target: unknown, source: Set, compare: (objValue: any, srcValue: any, key: PropertyKey, object: any, source: any, stack?: Map) => boolean | undefined, stack?: Map): boolean; +//#endregion +export { isMatchWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatchWith.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatchWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fc8bc9f5726d00915db6f29b973c671df941aff5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatchWith.d.ts @@ -0,0 +1,31 @@ +import { IsMatchWithCustomizer } from "../_internal/IsMatchWithCustomizer.js"; + +//#region src/compat/predicate/isMatchWith.d.ts +/** + * Performs a deep comparison between a target value and a source pattern to determine if they match, + * using a custom comparison function for fine-grained control over the matching logic. + * + * @param {object} target - The value to be tested for matching + * @param {object} source - The pattern/template to match against + * @param {IsMatchWithCustomizer} compare - Custom comparison function for fine-grained control + * @returns {boolean} `true` if the target matches the source pattern, `false` otherwise + * + * @example + * // Basic matching with custom comparator + * const caseInsensitiveCompare = (objVal, srcVal) => { + * if (typeof objVal === 'string' && typeof srcVal === 'string') { + * return objVal.toLowerCase() === srcVal.toLowerCase(); + * } + * return undefined; + * }; + * + * isMatchWith( + * { name: 'JOHN', age: 30 }, + * { name: 'john' }, + * caseInsensitiveCompare + * ); // true + */ +declare function isMatchWith(target: object, source: object, compare: IsMatchWithCustomizer): boolean; +declare function isSetMatch(target: unknown, source: Set, compare: (objValue: any, srcValue: any, key: PropertyKey, object: any, source: any, stack?: Map) => boolean | undefined, stack?: Map): boolean; +//#endregion +export { isMatchWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatchWith.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatchWith.js new file mode 100644 index 0000000000000000000000000000000000000000..47fe67fc9301692189bb381dcf3e27e796b0fd57 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatchWith.js @@ -0,0 +1,153 @@ +const require_isPrimitive = require("../../predicate/isPrimitive.js"); +const require_isEqualsSameValueZero = require("../../_internal/isEqualsSameValueZero.js"); +require("../util/eq.js"); +const require_isObject = require("./isObject.js"); +//#region src/compat/predicate/isMatchWith.ts +/** +* Performs a deep comparison between a target value and a source pattern to determine if they match, +* using a custom comparison function for fine-grained control over the matching logic. +* +* This function recursively traverses both values, calling the custom compare function for each +* property/element pair. If the compare function returns a boolean, that result is used directly. +* If it returns undefined, the default matching behavior continues recursively. +* +* The matching behavior varies by data type: +* - **Objects**: Matches if all properties in the source exist in the target and match +* - **Arrays**: Matches if all elements in the source array can be found in the target array (order-independent) +* - **Maps**: Matches if all key-value pairs in the source Map exist and match in the target Map +* - **Sets**: Matches if all elements in the source Set can be found in the target Set +* - **Functions**: Matches using strict equality, or object comparison if the function has properties +* - **Primitives**: Matches using strict equality +* +* Special cases: +* - Empty objects, arrays, Maps, and Sets always match any target +* - `null` and `undefined` source values have specific matching rules +* - Circular references are handled using an internal stack to prevent infinite recursion +* +* @param {object} target - The value to be tested for matching +* @param {object} source - The pattern/template to match against +* @param {function} [compare] - Optional custom comparison function that receives: +* - `objValue` - The value from the target at the current path +* - `srcValue` - The value from the source at the current path +* - `key` - The property key or array index being compared +* - `object` - The parent object/array from the target +* - `source` - The parent object/array from the source +* - `stack` - Internal Map used for circular reference detection +* Should return `true` for a match, `false` for no match, or `undefined` to continue with default behavior +* +* @returns {boolean} `true` if the target matches the source pattern, `false` otherwise +* +* @example +* // Basic matching without custom comparator +* isMatchWith({ a: 1, b: 2 }, { a: 1 }); // true +* isMatchWith([1, 2, 3], [1, 3]); // true +* +* @example +* // Custom comparison for case-insensitive string matching +* const caseInsensitiveCompare = (objVal, srcVal) => { +* if (typeof objVal === 'string' && typeof srcVal === 'string') { +* return objVal.toLowerCase() === srcVal.toLowerCase(); +* } +* return undefined; // Use default behavior for non-strings +* }; +* +* isMatchWith( +* { name: 'JOHN', age: 30 }, +* { name: 'john' }, +* caseInsensitiveCompare +* ); // true +* +* @example +* // Custom comparison for range matching +* const rangeCompare = (objVal, srcVal, key) => { +* if (key === 'age' && typeof srcVal === 'object' && srcVal.min !== undefined) { +* return objVal >= srcVal.min && objVal <= srcVal.max; +* } +* return undefined; +* }; +* +* isMatchWith( +* { name: 'John', age: 25 }, +* { age: { min: 18, max: 30 } }, +* rangeCompare +* ); // true +*/ +function isMatchWith(target, source, compare) { + if (typeof compare !== "function") return isMatchWith(target, source, () => void 0); + return isMatchWithInternal(target, source, function doesMatch(objValue, srcValue, key, object, source, stack) { + const isEqual = compare(objValue, srcValue, key, object, source, stack); + if (isEqual !== void 0) return Boolean(isEqual); + return isMatchWithInternal(objValue, srcValue, doesMatch, stack); + }, /* @__PURE__ */ new Map()); +} +function isMatchWithInternal(target, source, compare, stack) { + if (source === target) return true; + switch (typeof source) { + case "object": return isObjectMatch(target, source, compare, stack); + case "function": + if (Object.keys(source).length > 0) return isMatchWithInternal(target, { ...source }, compare, stack); + return require_isEqualsSameValueZero.isEqualsSameValueZero(target, source); + default: + if (!require_isObject.isObject(target)) return require_isEqualsSameValueZero.isEqualsSameValueZero(target, source); + if (typeof source === "string") return source === ""; + return true; + } +} +function isObjectMatch(target, source, compare, stack) { + if (source == null) return true; + if (Array.isArray(source)) return isArrayMatch(target, source, compare, stack); + if (source instanceof Map) return isMapMatch(target, source, compare, stack); + if (source instanceof Set) return isSetMatch(target, source, compare, stack); + const keys = Object.keys(source); + if (target == null || require_isPrimitive.isPrimitive(target)) return keys.length === 0; + if (keys.length === 0) return true; + if (stack?.has(source)) return stack.get(source) === target; + stack?.set(source, target); + try { + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + if (!require_isPrimitive.isPrimitive(target) && !(key in target)) return false; + if (source[key] === void 0 && target[key] !== void 0) return false; + if (source[key] === null && target[key] !== null) return false; + if (!compare(target[key], source[key], key, target, source, stack)) return false; + } + return true; + } finally { + stack?.delete(source); + } +} +function isMapMatch(target, source, compare, stack) { + if (source.size === 0) return true; + if (!(target instanceof Map)) return false; + for (const [key, sourceValue] of source.entries()) if (compare(target.get(key), sourceValue, key, target, source, stack) === false) return false; + return true; +} +function isArrayMatch(target, source, compare, stack) { + if (source.length === 0) return true; + if (!Array.isArray(target)) return false; + const countedIndex = /* @__PURE__ */ new Set(); + for (let i = 0; i < source.length; i++) { + const sourceItem = source[i]; + let found = false; + for (let j = 0; j < target.length; j++) { + if (countedIndex.has(j)) continue; + const targetItem = target[j]; + let matches = false; + if (compare(targetItem, sourceItem, i, target, source, stack)) matches = true; + if (matches) { + countedIndex.add(j); + found = true; + break; + } + } + if (!found) return false; + } + return true; +} +function isSetMatch(target, source, compare, stack) { + if (source.size === 0) return true; + if (!(target instanceof Set)) return false; + return isArrayMatch([...target], [...source], compare, stack); +} +//#endregion +exports.isMatchWith = isMatchWith; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatchWith.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatchWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..8ae784bf44ef6e74166935ff41698e1994551bc6 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isMatchWith.mjs @@ -0,0 +1,153 @@ +import { isPrimitive } from "../../predicate/isPrimitive.mjs"; +import { isEqualsSameValueZero } from "../../_internal/isEqualsSameValueZero.mjs"; +import "../util/eq.mjs"; +import { isObject } from "./isObject.mjs"; +//#region src/compat/predicate/isMatchWith.ts +/** +* Performs a deep comparison between a target value and a source pattern to determine if they match, +* using a custom comparison function for fine-grained control over the matching logic. +* +* This function recursively traverses both values, calling the custom compare function for each +* property/element pair. If the compare function returns a boolean, that result is used directly. +* If it returns undefined, the default matching behavior continues recursively. +* +* The matching behavior varies by data type: +* - **Objects**: Matches if all properties in the source exist in the target and match +* - **Arrays**: Matches if all elements in the source array can be found in the target array (order-independent) +* - **Maps**: Matches if all key-value pairs in the source Map exist and match in the target Map +* - **Sets**: Matches if all elements in the source Set can be found in the target Set +* - **Functions**: Matches using strict equality, or object comparison if the function has properties +* - **Primitives**: Matches using strict equality +* +* Special cases: +* - Empty objects, arrays, Maps, and Sets always match any target +* - `null` and `undefined` source values have specific matching rules +* - Circular references are handled using an internal stack to prevent infinite recursion +* +* @param {object} target - The value to be tested for matching +* @param {object} source - The pattern/template to match against +* @param {function} [compare] - Optional custom comparison function that receives: +* - `objValue` - The value from the target at the current path +* - `srcValue` - The value from the source at the current path +* - `key` - The property key or array index being compared +* - `object` - The parent object/array from the target +* - `source` - The parent object/array from the source +* - `stack` - Internal Map used for circular reference detection +* Should return `true` for a match, `false` for no match, or `undefined` to continue with default behavior +* +* @returns {boolean} `true` if the target matches the source pattern, `false` otherwise +* +* @example +* // Basic matching without custom comparator +* isMatchWith({ a: 1, b: 2 }, { a: 1 }); // true +* isMatchWith([1, 2, 3], [1, 3]); // true +* +* @example +* // Custom comparison for case-insensitive string matching +* const caseInsensitiveCompare = (objVal, srcVal) => { +* if (typeof objVal === 'string' && typeof srcVal === 'string') { +* return objVal.toLowerCase() === srcVal.toLowerCase(); +* } +* return undefined; // Use default behavior for non-strings +* }; +* +* isMatchWith( +* { name: 'JOHN', age: 30 }, +* { name: 'john' }, +* caseInsensitiveCompare +* ); // true +* +* @example +* // Custom comparison for range matching +* const rangeCompare = (objVal, srcVal, key) => { +* if (key === 'age' && typeof srcVal === 'object' && srcVal.min !== undefined) { +* return objVal >= srcVal.min && objVal <= srcVal.max; +* } +* return undefined; +* }; +* +* isMatchWith( +* { name: 'John', age: 25 }, +* { age: { min: 18, max: 30 } }, +* rangeCompare +* ); // true +*/ +function isMatchWith(target, source, compare) { + if (typeof compare !== "function") return isMatchWith(target, source, () => void 0); + return isMatchWithInternal(target, source, function doesMatch(objValue, srcValue, key, object, source, stack) { + const isEqual = compare(objValue, srcValue, key, object, source, stack); + if (isEqual !== void 0) return Boolean(isEqual); + return isMatchWithInternal(objValue, srcValue, doesMatch, stack); + }, /* @__PURE__ */ new Map()); +} +function isMatchWithInternal(target, source, compare, stack) { + if (source === target) return true; + switch (typeof source) { + case "object": return isObjectMatch(target, source, compare, stack); + case "function": + if (Object.keys(source).length > 0) return isMatchWithInternal(target, { ...source }, compare, stack); + return isEqualsSameValueZero(target, source); + default: + if (!isObject(target)) return isEqualsSameValueZero(target, source); + if (typeof source === "string") return source === ""; + return true; + } +} +function isObjectMatch(target, source, compare, stack) { + if (source == null) return true; + if (Array.isArray(source)) return isArrayMatch(target, source, compare, stack); + if (source instanceof Map) return isMapMatch(target, source, compare, stack); + if (source instanceof Set) return isSetMatch(target, source, compare, stack); + const keys = Object.keys(source); + if (target == null || isPrimitive(target)) return keys.length === 0; + if (keys.length === 0) return true; + if (stack?.has(source)) return stack.get(source) === target; + stack?.set(source, target); + try { + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + if (!isPrimitive(target) && !(key in target)) return false; + if (source[key] === void 0 && target[key] !== void 0) return false; + if (source[key] === null && target[key] !== null) return false; + if (!compare(target[key], source[key], key, target, source, stack)) return false; + } + return true; + } finally { + stack?.delete(source); + } +} +function isMapMatch(target, source, compare, stack) { + if (source.size === 0) return true; + if (!(target instanceof Map)) return false; + for (const [key, sourceValue] of source.entries()) if (compare(target.get(key), sourceValue, key, target, source, stack) === false) return false; + return true; +} +function isArrayMatch(target, source, compare, stack) { + if (source.length === 0) return true; + if (!Array.isArray(target)) return false; + const countedIndex = /* @__PURE__ */ new Set(); + for (let i = 0; i < source.length; i++) { + const sourceItem = source[i]; + let found = false; + for (let j = 0; j < target.length; j++) { + if (countedIndex.has(j)) continue; + const targetItem = target[j]; + let matches = false; + if (compare(targetItem, sourceItem, i, target, source, stack)) matches = true; + if (matches) { + countedIndex.add(j); + found = true; + break; + } + } + if (!found) return false; + } + return true; +} +function isSetMatch(target, source, compare, stack) { + if (source.size === 0) return true; + if (!(target instanceof Set)) return false; + return isArrayMatch([...target], [...source], compare, stack); +} +//#endregion +export { isMatchWith }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNaN.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNaN.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..cba470b3acd765fe5295c2b495757fef4489ea30 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNaN.d.mts @@ -0,0 +1,16 @@ +//#region src/compat/predicate/isNaN.d.ts +/** + * Checks if the value is NaN. + * + * @param {any} value - The value to check. + * @returns {boolean} `true` if the value is NaN, `false` otherwise. + * + * @example + * isNaN(NaN); // true + * isNaN(0); // false + * isNaN('NaN'); // false + * isNaN(undefined); // false + */ +declare function isNaN(value?: any): boolean; +//#endregion +export { isNaN }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNaN.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNaN.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cba470b3acd765fe5295c2b495757fef4489ea30 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNaN.d.ts @@ -0,0 +1,16 @@ +//#region src/compat/predicate/isNaN.d.ts +/** + * Checks if the value is NaN. + * + * @param {any} value - The value to check. + * @returns {boolean} `true` if the value is NaN, `false` otherwise. + * + * @example + * isNaN(NaN); // true + * isNaN(0); // false + * isNaN('NaN'); // false + * isNaN(undefined); // false + */ +declare function isNaN(value?: any): boolean; +//#endregion +export { isNaN }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNaN.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNaN.js new file mode 100644 index 0000000000000000000000000000000000000000..c7c73fd0f2c53af68206df3b1afaabfeede605df --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNaN.js @@ -0,0 +1,18 @@ +//#region src/compat/predicate/isNaN.ts +/** +* Checks if the value is NaN. +* +* @param {any} value - The value to check. +* @returns {boolean} `true` if the value is NaN, `false` otherwise. +* +* @example +* isNaN(NaN); // true +* isNaN(0); // false +* isNaN('NaN'); // false +* isNaN(undefined); // false +*/ +function isNaN(value) { + return Number.isNaN(value); +} +//#endregion +exports.isNaN = isNaN; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNaN.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNaN.mjs new file mode 100644 index 0000000000000000000000000000000000000000..bc15aea34d9c84ed1f01b671d5dc76fa0dd0f089 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNaN.mjs @@ -0,0 +1,18 @@ +//#region src/compat/predicate/isNaN.ts +/** +* Checks if the value is NaN. +* +* @param {any} value - The value to check. +* @returns {boolean} `true` if the value is NaN, `false` otherwise. +* +* @example +* isNaN(NaN); // true +* isNaN(0); // false +* isNaN('NaN'); // false +* isNaN(undefined); // false +*/ +function isNaN(value) { + return Number.isNaN(value); +} +//#endregion +export { isNaN }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNative.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNative.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..129f8dea7aa61bae640d7baa994de940756609d3 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNative.d.mts @@ -0,0 +1,19 @@ +//#region src/compat/predicate/isNative.d.ts +/** + * Checks if a given value is a native function. + * + * This function tests whether the provided value is a native function implemented by the JavaScript engine. + * It returns `true` if the value is a native function, and `false` otherwise. + * + * @param {any} value - The value to test for native function. + * @returns {value is (...args: any[]) => any} `true` if the value is a native function, `false` otherwise. + * + * @example + * const value1 = Array.prototype.push; + * const value2 = () => {}; + * const result1 = isNative(value1); // true + * const result2 = isNative(value2); // false + */ +declare function isNative(value: any): value is (...args: any[]) => any; +//#endregion +export { isNative }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNative.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNative.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..129f8dea7aa61bae640d7baa994de940756609d3 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNative.d.ts @@ -0,0 +1,19 @@ +//#region src/compat/predicate/isNative.d.ts +/** + * Checks if a given value is a native function. + * + * This function tests whether the provided value is a native function implemented by the JavaScript engine. + * It returns `true` if the value is a native function, and `false` otherwise. + * + * @param {any} value - The value to test for native function. + * @returns {value is (...args: any[]) => any} `true` if the value is a native function, `false` otherwise. + * + * @example + * const value1 = Array.prototype.push; + * const value2 = () => {}; + * const result1 = isNative(value1); // true + * const result2 = isNative(value2); // false + */ +declare function isNative(value: any): value is (...args: any[]) => any; +//#endregion +export { isNative }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNative.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNative.js new file mode 100644 index 0000000000000000000000000000000000000000..70bde335baaae146804e405945edb744898388f7 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNative.js @@ -0,0 +1,26 @@ +//#region src/compat/predicate/isNative.ts +const functionToString = Function.prototype.toString; +/** Used to detect if a method is native. */ +const IS_NATIVE_FUNCTION_REGEXP = RegExp(`^${functionToString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?")}$`); +/** +* Checks if a given value is a native function. +* +* This function tests whether the provided value is a native function implemented by the JavaScript engine. +* It returns `true` if the value is a native function, and `false` otherwise. +* +* @param {any} value - The value to test for native function. +* @returns {value is (...args: any[]) => any} `true` if the value is a native function, `false` otherwise. +* +* @example +* const value1 = Array.prototype.push; +* const value2 = () => {}; +* const result1 = isNative(value1); // true +* const result2 = isNative(value2); // false +*/ +function isNative(value) { + if (typeof value !== "function") return false; + if (globalThis?.["__core-js_shared__"] != null) throw new Error("Unsupported core-js use. Try https://npms.io/search?q=ponyfill."); + return IS_NATIVE_FUNCTION_REGEXP.test(functionToString.call(value)); +} +//#endregion +exports.isNative = isNative; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNative.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNative.mjs new file mode 100644 index 0000000000000000000000000000000000000000..843cb61f806f732d0873c8cd31ad974da6dd15fd --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNative.mjs @@ -0,0 +1,26 @@ +//#region src/compat/predicate/isNative.ts +const functionToString = Function.prototype.toString; +/** Used to detect if a method is native. */ +const IS_NATIVE_FUNCTION_REGEXP = RegExp(`^${functionToString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?")}$`); +/** +* Checks if a given value is a native function. +* +* This function tests whether the provided value is a native function implemented by the JavaScript engine. +* It returns `true` if the value is a native function, and `false` otherwise. +* +* @param {any} value - The value to test for native function. +* @returns {value is (...args: any[]) => any} `true` if the value is a native function, `false` otherwise. +* +* @example +* const value1 = Array.prototype.push; +* const value2 = () => {}; +* const result1 = isNative(value1); // true +* const result2 = isNative(value2); // false +*/ +function isNative(value) { + if (typeof value !== "function") return false; + if (globalThis?.["__core-js_shared__"] != null) throw new Error("Unsupported core-js use. Try https://npms.io/search?q=ponyfill."); + return IS_NATIVE_FUNCTION_REGEXP.test(functionToString.call(value)); +} +//#endregion +export { isNative }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNil.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNil.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..4d11fdd8a456502944d4f6a981f68a28a37a0135 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNil.d.mts @@ -0,0 +1,23 @@ +//#region src/compat/predicate/isNil.d.ts +/** + * Checks if a given value is null or undefined. + * + * This function tests whether the provided value is either `null` or `undefined`. + * It returns `true` if the value is `null` or `undefined`, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null` or `undefined`. + * + * @param {any} x - The value to test for null or undefined. + * @returns {x is null | undefined} `true` if the value is null or undefined, `false` otherwise. + * + * @example + * const value1 = null; + * const value2 = undefined; + * const value3 = 42; + * const result1 = isNil(value1); // true + * const result2 = isNil(value2); // true + * const result3 = isNil(value3); // false + */ +declare function isNil(x: any): x is null | undefined; +//#endregion +export { isNil }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNil.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNil.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4d11fdd8a456502944d4f6a981f68a28a37a0135 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNil.d.ts @@ -0,0 +1,23 @@ +//#region src/compat/predicate/isNil.d.ts +/** + * Checks if a given value is null or undefined. + * + * This function tests whether the provided value is either `null` or `undefined`. + * It returns `true` if the value is `null` or `undefined`, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null` or `undefined`. + * + * @param {any} x - The value to test for null or undefined. + * @returns {x is null | undefined} `true` if the value is null or undefined, `false` otherwise. + * + * @example + * const value1 = null; + * const value2 = undefined; + * const value3 = 42; + * const result1 = isNil(value1); // true + * const result2 = isNil(value2); // true + * const result3 = isNil(value3); // false + */ +declare function isNil(x: any): x is null | undefined; +//#endregion +export { isNil }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNil.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNil.js new file mode 100644 index 0000000000000000000000000000000000000000..c4c567e909e993ab50e2141eab94add1326d542f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNil.js @@ -0,0 +1,25 @@ +//#region src/compat/predicate/isNil.ts +/** +* Checks if a given value is null or undefined. +* +* This function tests whether the provided value is either `null` or `undefined`. +* It returns `true` if the value is `null` or `undefined`, and `false` otherwise. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null` or `undefined`. +* +* @param {any} x - The value to test for null or undefined. +* @returns {x is null | undefined} `true` if the value is null or undefined, `false` otherwise. +* +* @example +* const value1 = null; +* const value2 = undefined; +* const value3 = 42; +* const result1 = isNil(value1); // true +* const result2 = isNil(value2); // true +* const result3 = isNil(value3); // false +*/ +function isNil(x) { + return x == null; +} +//#endregion +exports.isNil = isNil; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNil.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNil.mjs new file mode 100644 index 0000000000000000000000000000000000000000..8d04860a183ab424298c206b0ee3007b868f1812 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNil.mjs @@ -0,0 +1,25 @@ +//#region src/compat/predicate/isNil.ts +/** +* Checks if a given value is null or undefined. +* +* This function tests whether the provided value is either `null` or `undefined`. +* It returns `true` if the value is `null` or `undefined`, and `false` otherwise. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null` or `undefined`. +* +* @param {any} x - The value to test for null or undefined. +* @returns {x is null | undefined} `true` if the value is null or undefined, `false` otherwise. +* +* @example +* const value1 = null; +* const value2 = undefined; +* const value3 = 42; +* const result1 = isNil(value1); // true +* const result2 = isNil(value2); // true +* const result3 = isNil(value3); // false +*/ +function isNil(x) { + return x == null; +} +//#endregion +export { isNil }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNull.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNull.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e1bf325db9b2042f5eea7b68278a639c2a50f860 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNull.d.mts @@ -0,0 +1,15 @@ +//#region src/compat/predicate/isNull.d.ts +/** + * Checks if `value` is `null`. + * + * @param {any} value - The value to check. + * @returns {value is null} Returns `true` if `value` is `null`, else `false`. + * + * @example + * isNull(null); // true + * isNull(undefined); // false + * isNull(0); // false + */ +declare function isNull(value: any): value is null; +//#endregion +export { isNull }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNull.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNull.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e1bf325db9b2042f5eea7b68278a639c2a50f860 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNull.d.ts @@ -0,0 +1,15 @@ +//#region src/compat/predicate/isNull.d.ts +/** + * Checks if `value` is `null`. + * + * @param {any} value - The value to check. + * @returns {value is null} Returns `true` if `value` is `null`, else `false`. + * + * @example + * isNull(null); // true + * isNull(undefined); // false + * isNull(0); // false + */ +declare function isNull(value: any): value is null; +//#endregion +export { isNull }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNull.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNull.js new file mode 100644 index 0000000000000000000000000000000000000000..b105b53715c480b7995e401aa7314bd68da9bf08 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNull.js @@ -0,0 +1,17 @@ +//#region src/compat/predicate/isNull.ts +/** +* Checks if `value` is `null`. +* +* @param {any} value - The value to check. +* @returns {value is null} Returns `true` if `value` is `null`, else `false`. +* +* @example +* isNull(null); // true +* isNull(undefined); // false +* isNull(0); // false +*/ +function isNull(value) { + return value === null; +} +//#endregion +exports.isNull = isNull; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNull.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNull.mjs new file mode 100644 index 0000000000000000000000000000000000000000..16ba39dd4224221c78e1b3a3da6f198d2c7443e5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNull.mjs @@ -0,0 +1,17 @@ +//#region src/compat/predicate/isNull.ts +/** +* Checks if `value` is `null`. +* +* @param {any} value - The value to check. +* @returns {value is null} Returns `true` if `value` is `null`, else `false`. +* +* @example +* isNull(null); // true +* isNull(undefined); // false +* isNull(0); // false +*/ +function isNull(value) { + return value === null; +} +//#endregion +export { isNull }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNumber.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNumber.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..94a4f2a7fec933c7850017b01d492626c047c6bf --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNumber.d.mts @@ -0,0 +1,21 @@ +//#region src/compat/predicate/isNumber.d.ts +/** + * Checks if a given value is a number. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `number`. + * + * @param {any} value The value to check if it is a number. + * @returns {value is number} Returns `true` if `value` is a number, else `false`. + * + * @example + * const value1 = 123; + * const value2 = 'abc'; + * const value3 = true; + * + * console.log(isNumber(value1)); // true + * console.log(isNumber(value2)); // false + * console.log(isNumber(value3)); // false + */ +declare function isNumber(value?: any): value is number; +//#endregion +export { isNumber }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNumber.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNumber.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..94a4f2a7fec933c7850017b01d492626c047c6bf --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNumber.d.ts @@ -0,0 +1,21 @@ +//#region src/compat/predicate/isNumber.d.ts +/** + * Checks if a given value is a number. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `number`. + * + * @param {any} value The value to check if it is a number. + * @returns {value is number} Returns `true` if `value` is a number, else `false`. + * + * @example + * const value1 = 123; + * const value2 = 'abc'; + * const value3 = true; + * + * console.log(isNumber(value1)); // true + * console.log(isNumber(value2)); // false + * console.log(isNumber(value3)); // false + */ +declare function isNumber(value?: any): value is number; +//#endregion +export { isNumber }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNumber.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNumber.js new file mode 100644 index 0000000000000000000000000000000000000000..8bcae0b1859aee8df7e0d90f4cb9b46769ce1a54 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNumber.js @@ -0,0 +1,23 @@ +//#region src/compat/predicate/isNumber.ts +/** +* Checks if a given value is a number. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `number`. +* +* @param {any} value The value to check if it is a number. +* @returns {value is number} Returns `true` if `value` is a number, else `false`. +* +* @example +* const value1 = 123; +* const value2 = 'abc'; +* const value3 = true; +* +* console.log(isNumber(value1)); // true +* console.log(isNumber(value2)); // false +* console.log(isNumber(value3)); // false +*/ +function isNumber(value) { + return typeof value === "number" || value instanceof Number; +} +//#endregion +exports.isNumber = isNumber; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNumber.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNumber.mjs new file mode 100644 index 0000000000000000000000000000000000000000..554979fe06ed5be501f55b99723e8ded045e8a28 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isNumber.mjs @@ -0,0 +1,23 @@ +//#region src/compat/predicate/isNumber.ts +/** +* Checks if a given value is a number. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `number`. +* +* @param {any} value The value to check if it is a number. +* @returns {value is number} Returns `true` if `value` is a number, else `false`. +* +* @example +* const value1 = 123; +* const value2 = 'abc'; +* const value3 = true; +* +* console.log(isNumber(value1)); // true +* console.log(isNumber(value2)); // false +* console.log(isNumber(value3)); // false +*/ +function isNumber(value) { + return typeof value === "number" || value instanceof Number; +} +//#endregion +export { isNumber }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObject.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObject.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f6fda232cc66c36ecd5c6d3f1836df9172a39c4b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObject.d.mts @@ -0,0 +1,27 @@ +//#region src/compat/predicate/isObject.d.ts +/** + * Checks if the given value is an object. An object is a value that is + * not a primitive type (string, number, boolean, symbol, null, or undefined). + * + * This function tests whether the provided value is an object or not. + * It returns `true` if the value is an object, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an object value. + * + * @param {any} value - The value to check if it is an object. + * @returns {value is object} `true` if the value is an object, `false` otherwise. + * + * @example + * const value1 = {}; + * const value2 = [1, 2, 3]; + * const value3 = () => {}; + * const value4 = null; + * + * console.log(isObject(value1)); // true + * console.log(isObject(value2)); // true + * console.log(isObject(value3)); // true + * console.log(isObject(value4)); // false + */ +declare function isObject(value?: any): value is object; +//#endregion +export { isObject }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObject.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObject.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f6fda232cc66c36ecd5c6d3f1836df9172a39c4b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObject.d.ts @@ -0,0 +1,27 @@ +//#region src/compat/predicate/isObject.d.ts +/** + * Checks if the given value is an object. An object is a value that is + * not a primitive type (string, number, boolean, symbol, null, or undefined). + * + * This function tests whether the provided value is an object or not. + * It returns `true` if the value is an object, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an object value. + * + * @param {any} value - The value to check if it is an object. + * @returns {value is object} `true` if the value is an object, `false` otherwise. + * + * @example + * const value1 = {}; + * const value2 = [1, 2, 3]; + * const value3 = () => {}; + * const value4 = null; + * + * console.log(isObject(value1)); // true + * console.log(isObject(value2)); // true + * console.log(isObject(value3)); // true + * console.log(isObject(value4)); // false + */ +declare function isObject(value?: any): value is object; +//#endregion +export { isObject }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObject.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObject.js new file mode 100644 index 0000000000000000000000000000000000000000..3b585d0882490103ecef10645a9e0fb0199ed017 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObject.js @@ -0,0 +1,29 @@ +//#region src/compat/predicate/isObject.ts +/** +* Checks if the given value is an object. An object is a value that is +* not a primitive type (string, number, boolean, symbol, null, or undefined). +* +* This function tests whether the provided value is an object or not. +* It returns `true` if the value is an object, and `false` otherwise. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an object value. +* +* @param {any} value - The value to check if it is an object. +* @returns {value is object} `true` if the value is an object, `false` otherwise. +* +* @example +* const value1 = {}; +* const value2 = [1, 2, 3]; +* const value3 = () => {}; +* const value4 = null; +* +* console.log(isObject(value1)); // true +* console.log(isObject(value2)); // true +* console.log(isObject(value3)); // true +* console.log(isObject(value4)); // false +*/ +function isObject(value) { + return value !== null && (typeof value === "object" || typeof value === "function"); +} +//#endregion +exports.isObject = isObject; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObject.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObject.mjs new file mode 100644 index 0000000000000000000000000000000000000000..995d03ea31b0b3cfa5dde7c11939fa69847374c1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObject.mjs @@ -0,0 +1,29 @@ +//#region src/compat/predicate/isObject.ts +/** +* Checks if the given value is an object. An object is a value that is +* not a primitive type (string, number, boolean, symbol, null, or undefined). +* +* This function tests whether the provided value is an object or not. +* It returns `true` if the value is an object, and `false` otherwise. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an object value. +* +* @param {any} value - The value to check if it is an object. +* @returns {value is object} `true` if the value is an object, `false` otherwise. +* +* @example +* const value1 = {}; +* const value2 = [1, 2, 3]; +* const value3 = () => {}; +* const value4 = null; +* +* console.log(isObject(value1)); // true +* console.log(isObject(value2)); // true +* console.log(isObject(value3)); // true +* console.log(isObject(value4)); // false +*/ +function isObject(value) { + return value !== null && (typeof value === "object" || typeof value === "function"); +} +//#endregion +export { isObject }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6fbe35fb1ec1aeb22f5f4a290a66f8fea660724a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.d.mts @@ -0,0 +1,27 @@ +//#region src/compat/predicate/isObjectLike.d.ts +/** + * Checks if the given value is object-like. + * + * A value is object-like if its type is object and it is not null. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an object-like value. + * + * @param {any} value - The value to test if it is an object-like. + * @returns {boolean} `true` if the value is an object-like, `false` otherwise. + * + * @example + * const value1 = { a: 1 }; + * const value2 = [1, 2, 3]; + * const value3 = 'abc'; + * const value4 = () => {}; + * const value5 = null; + * + * console.log(isObjectLike(value1)); // true + * console.log(isObjectLike(value2)); // true + * console.log(isObjectLike(value3)); // false + * console.log(isObjectLike(value4)); // false + * console.log(isObjectLike(value5)); // false + */ +declare function isObjectLike(value?: any): boolean; +//#endregion +export { isObjectLike }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6fbe35fb1ec1aeb22f5f4a290a66f8fea660724a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.d.ts @@ -0,0 +1,27 @@ +//#region src/compat/predicate/isObjectLike.d.ts +/** + * Checks if the given value is object-like. + * + * A value is object-like if its type is object and it is not null. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an object-like value. + * + * @param {any} value - The value to test if it is an object-like. + * @returns {boolean} `true` if the value is an object-like, `false` otherwise. + * + * @example + * const value1 = { a: 1 }; + * const value2 = [1, 2, 3]; + * const value3 = 'abc'; + * const value4 = () => {}; + * const value5 = null; + * + * console.log(isObjectLike(value1)); // true + * console.log(isObjectLike(value2)); // true + * console.log(isObjectLike(value3)); // false + * console.log(isObjectLike(value4)); // false + * console.log(isObjectLike(value5)); // false + */ +declare function isObjectLike(value?: any): boolean; +//#endregion +export { isObjectLike }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.js new file mode 100644 index 0000000000000000000000000000000000000000..cd363aa0f30c0c2d418b4d38c8cc30d5544fa254 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.js @@ -0,0 +1,29 @@ +//#region src/compat/predicate/isObjectLike.ts +/** +* Checks if the given value is object-like. +* +* A value is object-like if its type is object and it is not null. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an object-like value. +* +* @param {any} value - The value to test if it is an object-like. +* @returns {boolean} `true` if the value is an object-like, `false` otherwise. +* +* @example +* const value1 = { a: 1 }; +* const value2 = [1, 2, 3]; +* const value3 = 'abc'; +* const value4 = () => {}; +* const value5 = null; +* +* console.log(isObjectLike(value1)); // true +* console.log(isObjectLike(value2)); // true +* console.log(isObjectLike(value3)); // false +* console.log(isObjectLike(value4)); // false +* console.log(isObjectLike(value5)); // false +*/ +function isObjectLike(value) { + return typeof value === "object" && value !== null; +} +//#endregion +exports.isObjectLike = isObjectLike; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.mjs new file mode 100644 index 0000000000000000000000000000000000000000..bc4bdb678cf3228559b677aba1f4d1c3b04ab554 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.mjs @@ -0,0 +1,29 @@ +//#region src/compat/predicate/isObjectLike.ts +/** +* Checks if the given value is object-like. +* +* A value is object-like if its type is object and it is not null. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an object-like value. +* +* @param {any} value - The value to test if it is an object-like. +* @returns {boolean} `true` if the value is an object-like, `false` otherwise. +* +* @example +* const value1 = { a: 1 }; +* const value2 = [1, 2, 3]; +* const value3 = 'abc'; +* const value4 = () => {}; +* const value5 = null; +* +* console.log(isObjectLike(value1)); // true +* console.log(isObjectLike(value2)); // true +* console.log(isObjectLike(value3)); // false +* console.log(isObjectLike(value4)); // false +* console.log(isObjectLike(value5)); // false +*/ +function isObjectLike(value) { + return typeof value === "object" && value !== null; +} +//#endregion +export { isObjectLike }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..3a4b676a1f5cfa6a8dc8b3f083b37e7bba4d009e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.d.mts @@ -0,0 +1,26 @@ +//#region src/compat/predicate/isPlainObject.d.ts +/** + * Checks if a given value is a plain object. + * + * A plain object is an object created by the `{}` literal, `new Object()`, or + * `Object.create(null)`. + * + * This function also handles objects with custom + * `Symbol.toStringTag` properties. + * + * `Symbol.toStringTag` is a built-in symbol that a constructor can use to customize the + * default string description of objects. + * + * @param {any} [object] - The value to check. + * @returns {boolean} - True if the value is a plain object, otherwise false. + * + * @example + * console.log(isPlainObject({})); // true + * console.log(isPlainObject([])); // false + * console.log(isPlainObject(null)); // false + * console.log(isPlainObject(Object.create(null))); // true + * console.log(isPlainObject(new Map())); // false + */ +declare function isPlainObject(object?: any): boolean; +//#endregion +export { isPlainObject }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3a4b676a1f5cfa6a8dc8b3f083b37e7bba4d009e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.d.ts @@ -0,0 +1,26 @@ +//#region src/compat/predicate/isPlainObject.d.ts +/** + * Checks if a given value is a plain object. + * + * A plain object is an object created by the `{}` literal, `new Object()`, or + * `Object.create(null)`. + * + * This function also handles objects with custom + * `Symbol.toStringTag` properties. + * + * `Symbol.toStringTag` is a built-in symbol that a constructor can use to customize the + * default string description of objects. + * + * @param {any} [object] - The value to check. + * @returns {boolean} - True if the value is a plain object, otherwise false. + * + * @example + * console.log(isPlainObject({})); // true + * console.log(isPlainObject([])); // false + * console.log(isPlainObject(null)); // false + * console.log(isPlainObject(Object.create(null))); // true + * console.log(isPlainObject(new Map())); // false + */ +declare function isPlainObject(object?: any): boolean; +//#endregion +export { isPlainObject }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.js new file mode 100644 index 0000000000000000000000000000000000000000..65dd5484eae38c6ddd9495d9a5967743f967f49e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.js @@ -0,0 +1,39 @@ +//#region src/compat/predicate/isPlainObject.ts +/** +* Checks if a given value is a plain object. +* +* A plain object is an object created by the `{}` literal, `new Object()`, or +* `Object.create(null)`. +* +* This function also handles objects with custom +* `Symbol.toStringTag` properties. +* +* `Symbol.toStringTag` is a built-in symbol that a constructor can use to customize the +* default string description of objects. +* +* @param {any} [object] - The value to check. +* @returns {boolean} - True if the value is a plain object, otherwise false. +* +* @example +* console.log(isPlainObject({})); // true +* console.log(isPlainObject([])); // false +* console.log(isPlainObject(null)); // false +* console.log(isPlainObject(Object.create(null))); // true +* console.log(isPlainObject(new Map())); // false +*/ +function isPlainObject(object) { + if (typeof object !== "object") return false; + if (object == null) return false; + if (Object.getPrototypeOf(object) === null) return true; + if (Object.prototype.toString.call(object) !== "[object Object]") { + const tag = object[Symbol.toStringTag]; + if (tag == null) return false; + if (!Object.getOwnPropertyDescriptor(object, Symbol.toStringTag)?.writable) return false; + return object.toString() === `[object ${tag}]`; + } + let proto = object; + while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto); + return Object.getPrototypeOf(object) === proto; +} +//#endregion +exports.isPlainObject = isPlainObject; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.mjs new file mode 100644 index 0000000000000000000000000000000000000000..716319a7301c0f4e93ab297de97d96cd0ececf2d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.mjs @@ -0,0 +1,39 @@ +//#region src/compat/predicate/isPlainObject.ts +/** +* Checks if a given value is a plain object. +* +* A plain object is an object created by the `{}` literal, `new Object()`, or +* `Object.create(null)`. +* +* This function also handles objects with custom +* `Symbol.toStringTag` properties. +* +* `Symbol.toStringTag` is a built-in symbol that a constructor can use to customize the +* default string description of objects. +* +* @param {any} [object] - The value to check. +* @returns {boolean} - True if the value is a plain object, otherwise false. +* +* @example +* console.log(isPlainObject({})); // true +* console.log(isPlainObject([])); // false +* console.log(isPlainObject(null)); // false +* console.log(isPlainObject(Object.create(null))); // true +* console.log(isPlainObject(new Map())); // false +*/ +function isPlainObject(object) { + if (typeof object !== "object") return false; + if (object == null) return false; + if (Object.getPrototypeOf(object) === null) return true; + if (Object.prototype.toString.call(object) !== "[object Object]") { + const tag = object[Symbol.toStringTag]; + if (tag == null) return false; + if (!Object.getOwnPropertyDescriptor(object, Symbol.toStringTag)?.writable) return false; + return object.toString() === `[object ${tag}]`; + } + let proto = object; + while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto); + return Object.getPrototypeOf(object) === proto; +} +//#endregion +export { isPlainObject }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isRegExp.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isRegExp.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..98c7b9912d0a8a8ea9f93fd9a2a7b82e28096636 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isRegExp.d.mts @@ -0,0 +1,17 @@ +//#region src/compat/predicate/isRegExp.d.ts +/** + * Checks if `value` is a RegExp. + * + * @param {any} value The value to check. + * @returns {boolean} Returns `true` if `value` is a RegExp, `false` otherwise. + * + * @example + * const value1 = /abc/; + * const value2 = '/abc/'; + * + * console.log(isRegExp(value1)); // true + * console.log(isRegExp(value2)); // false + */ +declare function isRegExp(value?: any): value is RegExp; +//#endregion +export { isRegExp }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isRegExp.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isRegExp.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..98c7b9912d0a8a8ea9f93fd9a2a7b82e28096636 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isRegExp.d.ts @@ -0,0 +1,17 @@ +//#region src/compat/predicate/isRegExp.d.ts +/** + * Checks if `value` is a RegExp. + * + * @param {any} value The value to check. + * @returns {boolean} Returns `true` if `value` is a RegExp, `false` otherwise. + * + * @example + * const value1 = /abc/; + * const value2 = '/abc/'; + * + * console.log(isRegExp(value1)); // true + * console.log(isRegExp(value2)); // false + */ +declare function isRegExp(value?: any): value is RegExp; +//#endregion +export { isRegExp }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isRegExp.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isRegExp.js new file mode 100644 index 0000000000000000000000000000000000000000..ca35e346982036166bdd13c6f1406786e1bb03e2 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isRegExp.js @@ -0,0 +1,20 @@ +const require_isRegExp = require("../../predicate/isRegExp.js"); +//#region src/compat/predicate/isRegExp.ts +/** +* Checks if `value` is a RegExp. +* +* @param {any} value The value to check. +* @returns {boolean} Returns `true` if `value` is a RegExp, `false` otherwise. +* +* @example +* const value1 = /abc/; +* const value2 = '/abc/'; +* +* console.log(isRegExp(value1)); // true +* console.log(isRegExp(value2)); // false +*/ +function isRegExp(value) { + return require_isRegExp.isRegExp(value); +} +//#endregion +exports.isRegExp = isRegExp; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isRegExp.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isRegExp.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7d10dbe6ba12fd4fb3b0d7b17654335132271e89 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isRegExp.mjs @@ -0,0 +1,20 @@ +import { isRegExp as isRegExp$1 } from "../../predicate/isRegExp.mjs"; +//#region src/compat/predicate/isRegExp.ts +/** +* Checks if `value` is a RegExp. +* +* @param {any} value The value to check. +* @returns {boolean} Returns `true` if `value` is a RegExp, `false` otherwise. +* +* @example +* const value1 = /abc/; +* const value2 = '/abc/'; +* +* console.log(isRegExp(value1)); // true +* console.log(isRegExp(value2)); // false +*/ +function isRegExp(value) { + return isRegExp$1(value); +} +//#endregion +export { isRegExp }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSafeInteger.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSafeInteger.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..27af88fd5d11576bc8f17a6f42a5dfb34997e00c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSafeInteger.d.mts @@ -0,0 +1,22 @@ +//#region src/compat/predicate/isSafeInteger.d.ts +/** + * Checks if `value` is a safe integer (between -(2^53 – 1) and (2^53 – 1), inclusive). + * + * A safe integer is an integer that can be precisely represented as a `number` in JavaScript, + * without any other integer being rounded to it. + * + * This function also serves as a type predicate in TypeScript, + * narrowing the type of the argument to `number`. + * + * @param {unknown} value - The value to check + * @returns {value is number} `true` if `value` is an integer and between the safe values, otherwise `false` + * + * @example + * isSafeInteger(3); // Returns: true + * isSafeInteger(Number.MIN_SAFE_INTEGER - 1); // Returns: false + * isSafeInteger(1n); // Returns: false + * isSafeInteger('1'); // Returns: false + */ +declare function isSafeInteger(value: unknown): value is number; +//#endregion +export { isSafeInteger }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSafeInteger.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSafeInteger.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..27af88fd5d11576bc8f17a6f42a5dfb34997e00c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSafeInteger.d.ts @@ -0,0 +1,22 @@ +//#region src/compat/predicate/isSafeInteger.d.ts +/** + * Checks if `value` is a safe integer (between -(2^53 – 1) and (2^53 – 1), inclusive). + * + * A safe integer is an integer that can be precisely represented as a `number` in JavaScript, + * without any other integer being rounded to it. + * + * This function also serves as a type predicate in TypeScript, + * narrowing the type of the argument to `number`. + * + * @param {unknown} value - The value to check + * @returns {value is number} `true` if `value` is an integer and between the safe values, otherwise `false` + * + * @example + * isSafeInteger(3); // Returns: true + * isSafeInteger(Number.MIN_SAFE_INTEGER - 1); // Returns: false + * isSafeInteger(1n); // Returns: false + * isSafeInteger('1'); // Returns: false + */ +declare function isSafeInteger(value: unknown): value is number; +//#endregion +export { isSafeInteger }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSafeInteger.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSafeInteger.js new file mode 100644 index 0000000000000000000000000000000000000000..86b8a8c43a7d5161cf30c525f236711abdf00168 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSafeInteger.js @@ -0,0 +1,24 @@ +//#region src/compat/predicate/isSafeInteger.ts +/** +* Checks if `value` is a safe integer (between -(2^53 – 1) and (2^53 – 1), inclusive). +* +* A safe integer is an integer that can be precisely represented as a `number` in JavaScript, +* without any other integer being rounded to it. +* +* This function also serves as a type predicate in TypeScript, +* narrowing the type of the argument to `number`. +* +* @param {unknown} value - The value to check +* @returns {value is number} `true` if `value` is an integer and between the safe values, otherwise `false` +* +* @example +* isSafeInteger(3); // Returns: true +* isSafeInteger(Number.MIN_SAFE_INTEGER - 1); // Returns: false +* isSafeInteger(1n); // Returns: false +* isSafeInteger('1'); // Returns: false +*/ +function isSafeInteger(value) { + return Number.isSafeInteger(value); +} +//#endregion +exports.isSafeInteger = isSafeInteger; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSafeInteger.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSafeInteger.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ca3616d49c66bdffd33db16956d9af2bea69761a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSafeInteger.mjs @@ -0,0 +1,24 @@ +//#region src/compat/predicate/isSafeInteger.ts +/** +* Checks if `value` is a safe integer (between -(2^53 – 1) and (2^53 – 1), inclusive). +* +* A safe integer is an integer that can be precisely represented as a `number` in JavaScript, +* without any other integer being rounded to it. +* +* This function also serves as a type predicate in TypeScript, +* narrowing the type of the argument to `number`. +* +* @param {unknown} value - The value to check +* @returns {value is number} `true` if `value` is an integer and between the safe values, otherwise `false` +* +* @example +* isSafeInteger(3); // Returns: true +* isSafeInteger(Number.MIN_SAFE_INTEGER - 1); // Returns: false +* isSafeInteger(1n); // Returns: false +* isSafeInteger('1'); // Returns: false +*/ +function isSafeInteger(value) { + return Number.isSafeInteger(value); +} +//#endregion +export { isSafeInteger }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSet.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSet.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a7c60dafc9e68309fec00e637c22f6b070ccf0d3 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSet.d.mts @@ -0,0 +1,21 @@ +//#region src/compat/predicate/isSet.d.ts +/** + * Checks if a given value is `Set`. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Set`. + * + * @param {unknown} value The value to check if it is a `Set`. + * @returns {value is Set} Returns `true` if `value` is a `Set`, else `false`. + * + * @example + * const value1 = new Set(); + * const value2 = new Map(); + * const value3 = new WeakSet(); + * + * console.log(isSet(value1)); // true + * console.log(isSet(value2)); // false + * console.log(isSet(value3)); // false + */ +declare function isSet(value?: any): value is Set; +//#endregion +export { isSet }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSet.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSet.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a7c60dafc9e68309fec00e637c22f6b070ccf0d3 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSet.d.ts @@ -0,0 +1,21 @@ +//#region src/compat/predicate/isSet.d.ts +/** + * Checks if a given value is `Set`. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Set`. + * + * @param {unknown} value The value to check if it is a `Set`. + * @returns {value is Set} Returns `true` if `value` is a `Set`, else `false`. + * + * @example + * const value1 = new Set(); + * const value2 = new Map(); + * const value3 = new WeakSet(); + * + * console.log(isSet(value1)); // true + * console.log(isSet(value2)); // false + * console.log(isSet(value3)); // false + */ +declare function isSet(value?: any): value is Set; +//#endregion +export { isSet }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSet.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSet.js new file mode 100644 index 0000000000000000000000000000000000000000..b21f0924b6a1afc9acb200ac8ce40a86c6dc6a08 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSet.js @@ -0,0 +1,24 @@ +const require_isSet = require("../../predicate/isSet.js"); +//#region src/compat/predicate/isSet.ts +/** +* Checks if a given value is `Set`. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Set`. +* +* @param {unknown} value The value to check if it is a `Set`. +* @returns {value is Set} Returns `true` if `value` is a `Set`, else `false`. +* +* @example +* const value1 = new Set(); +* const value2 = new Map(); +* const value3 = new WeakSet(); +* +* console.log(isSet(value1)); // true +* console.log(isSet(value2)); // false +* console.log(isSet(value3)); // false +*/ +function isSet(value) { + return require_isSet.isSet(value); +} +//#endregion +exports.isSet = isSet; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSet.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSet.mjs new file mode 100644 index 0000000000000000000000000000000000000000..49be165534a5af28af93258fa6bb29aa4b8458dd --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSet.mjs @@ -0,0 +1,24 @@ +import { isSet as isSet$1 } from "../../predicate/isSet.mjs"; +//#region src/compat/predicate/isSet.ts +/** +* Checks if a given value is `Set`. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Set`. +* +* @param {unknown} value The value to check if it is a `Set`. +* @returns {value is Set} Returns `true` if `value` is a `Set`, else `false`. +* +* @example +* const value1 = new Set(); +* const value2 = new Map(); +* const value3 = new WeakSet(); +* +* console.log(isSet(value1)); // true +* console.log(isSet(value2)); // false +* console.log(isSet(value3)); // false +*/ +function isSet(value) { + return isSet$1(value); +} +//#endregion +export { isSet }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isString.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isString.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..3bb8943ad3106046fcd0b4a0a20546e7e871f970 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isString.d.mts @@ -0,0 +1,21 @@ +//#region src/compat/predicate/isString.d.ts +/** + * Checks if a given value is string. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `string`. + * + * @param {unknown} value The value to check if it is string. + * @returns {value is string} Returns `true` if `value` is a string, else `false`. + * + * @example + * const value1 = 'abc'; + * const value2 = 123; + * const value3 = true; + * + * console.log(isString(value1)); // true + * console.log(isString(value2)); // false + * console.log(isString(value3)); // false + */ +declare function isString(value?: any): value is string; +//#endregion +export { isString }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isString.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isString.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3bb8943ad3106046fcd0b4a0a20546e7e871f970 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isString.d.ts @@ -0,0 +1,21 @@ +//#region src/compat/predicate/isString.d.ts +/** + * Checks if a given value is string. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `string`. + * + * @param {unknown} value The value to check if it is string. + * @returns {value is string} Returns `true` if `value` is a string, else `false`. + * + * @example + * const value1 = 'abc'; + * const value2 = 123; + * const value3 = true; + * + * console.log(isString(value1)); // true + * console.log(isString(value2)); // false + * console.log(isString(value3)); // false + */ +declare function isString(value?: any): value is string; +//#endregion +export { isString }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isString.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isString.js new file mode 100644 index 0000000000000000000000000000000000000000..33d8ff9dd0f0cacea34bcb8ed4f6be803df48c1b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isString.js @@ -0,0 +1,23 @@ +//#region src/compat/predicate/isString.ts +/** +* Checks if a given value is string. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `string`. +* +* @param {unknown} value The value to check if it is string. +* @returns {value is string} Returns `true` if `value` is a string, else `false`. +* +* @example +* const value1 = 'abc'; +* const value2 = 123; +* const value3 = true; +* +* console.log(isString(value1)); // true +* console.log(isString(value2)); // false +* console.log(isString(value3)); // false +*/ +function isString(value) { + return typeof value === "string" || value instanceof String; +} +//#endregion +exports.isString = isString; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isString.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isString.mjs new file mode 100644 index 0000000000000000000000000000000000000000..8be9f4abaed1ff421092f47f33102e47d98555bb --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isString.mjs @@ -0,0 +1,23 @@ +//#region src/compat/predicate/isString.ts +/** +* Checks if a given value is string. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `string`. +* +* @param {unknown} value The value to check if it is string. +* @returns {value is string} Returns `true` if `value` is a string, else `false`. +* +* @example +* const value1 = 'abc'; +* const value2 = 123; +* const value3 = true; +* +* console.log(isString(value1)); // true +* console.log(isString(value2)); // false +* console.log(isString(value3)); // false +*/ +function isString(value) { + return typeof value === "string" || value instanceof String; +} +//#endregion +export { isString }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSymbol.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSymbol.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..23ef42e03b15f152968743040c2c9ea4230f3be5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSymbol.d.mts @@ -0,0 +1,18 @@ +//#region src/compat/predicate/isSymbol.d.ts +/** + * Check whether a value is a symbol. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `symbol`. + * + * @param {unknown} value The value to check. + * @returns {value is symbol} Returns `true` if `value` is a symbol, else `false`. + * @example + * isSymbol(Symbol.iterator); + * // => true + * + * isSymbol('abc'); + * // => false + */ +declare function isSymbol(value: any): value is symbol; +//#endregion +export { isSymbol }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSymbol.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSymbol.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..23ef42e03b15f152968743040c2c9ea4230f3be5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSymbol.d.ts @@ -0,0 +1,18 @@ +//#region src/compat/predicate/isSymbol.d.ts +/** + * Check whether a value is a symbol. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `symbol`. + * + * @param {unknown} value The value to check. + * @returns {value is symbol} Returns `true` if `value` is a symbol, else `false`. + * @example + * isSymbol(Symbol.iterator); + * // => true + * + * isSymbol('abc'); + * // => false + */ +declare function isSymbol(value: any): value is symbol; +//#endregion +export { isSymbol }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSymbol.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSymbol.js new file mode 100644 index 0000000000000000000000000000000000000000..db23e6635f1f91b9dcf35d5017d9c0392a901a37 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSymbol.js @@ -0,0 +1,20 @@ +//#region src/compat/predicate/isSymbol.ts +/** +* Check whether a value is a symbol. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `symbol`. +* +* @param {unknown} value The value to check. +* @returns {value is symbol} Returns `true` if `value` is a symbol, else `false`. +* @example +* isSymbol(Symbol.iterator); +* // => true +* +* isSymbol('abc'); +* // => false +*/ +function isSymbol(value) { + return typeof value === "symbol" || value instanceof Symbol; +} +//#endregion +exports.isSymbol = isSymbol; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSymbol.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSymbol.mjs new file mode 100644 index 0000000000000000000000000000000000000000..79e79f164ac520a8975347f05ba0aabc411c35c1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isSymbol.mjs @@ -0,0 +1,20 @@ +//#region src/compat/predicate/isSymbol.ts +/** +* Check whether a value is a symbol. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `symbol`. +* +* @param {unknown} value The value to check. +* @returns {value is symbol} Returns `true` if `value` is a symbol, else `false`. +* @example +* isSymbol(Symbol.iterator); +* // => true +* +* isSymbol('abc'); +* // => false +*/ +function isSymbol(value) { + return typeof value === "symbol" || value instanceof Symbol; +} +//#endregion +export { isSymbol }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a6973ae90ea8c986bcec14d10c2b6cb904676008 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.d.mts @@ -0,0 +1,19 @@ +//#region src/compat/predicate/isTypedArray.d.ts +/** + * Checks if a value is a TypedArray. + * @param {any} x The value to check. + * @returns {boolean} Returns true if `x` is a TypedArray, false otherwise. + * + * @example + * const arr = new Uint8Array([1, 2, 3]); + * isTypedArray(arr); // true + * + * const regularArray = [1, 2, 3]; + * isTypedArray(regularArray); // false + * + * const buffer = new ArrayBuffer(16); + * isTypedArray(buffer); // false + */ +declare function isTypedArray(x: any): boolean; +//#endregion +export { isTypedArray }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a6973ae90ea8c986bcec14d10c2b6cb904676008 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.d.ts @@ -0,0 +1,19 @@ +//#region src/compat/predicate/isTypedArray.d.ts +/** + * Checks if a value is a TypedArray. + * @param {any} x The value to check. + * @returns {boolean} Returns true if `x` is a TypedArray, false otherwise. + * + * @example + * const arr = new Uint8Array([1, 2, 3]); + * isTypedArray(arr); // true + * + * const regularArray = [1, 2, 3]; + * isTypedArray(regularArray); // false + * + * const buffer = new ArrayBuffer(16); + * isTypedArray(buffer); // false + */ +declare function isTypedArray(x: any): boolean; +//#endregion +export { isTypedArray }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.js new file mode 100644 index 0000000000000000000000000000000000000000..0296d7906765d46edd69b5a3e4eea7ede466b7d0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.js @@ -0,0 +1,22 @@ +const require_isTypedArray = require("../../predicate/isTypedArray.js"); +//#region src/compat/predicate/isTypedArray.ts +/** +* Checks if a value is a TypedArray. +* @param {any} x The value to check. +* @returns {boolean} Returns true if `x` is a TypedArray, false otherwise. +* +* @example +* const arr = new Uint8Array([1, 2, 3]); +* isTypedArray(arr); // true +* +* const regularArray = [1, 2, 3]; +* isTypedArray(regularArray); // false +* +* const buffer = new ArrayBuffer(16); +* isTypedArray(buffer); // false +*/ +function isTypedArray(x) { + return require_isTypedArray.isTypedArray(x); +} +//#endregion +exports.isTypedArray = isTypedArray; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.mjs new file mode 100644 index 0000000000000000000000000000000000000000..0a95a7f5ae7cfc3cb2c41b2af38ecd72e2ed568f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.mjs @@ -0,0 +1,22 @@ +import { isTypedArray as isTypedArray$1 } from "../../predicate/isTypedArray.mjs"; +//#region src/compat/predicate/isTypedArray.ts +/** +* Checks if a value is a TypedArray. +* @param {any} x The value to check. +* @returns {boolean} Returns true if `x` is a TypedArray, false otherwise. +* +* @example +* const arr = new Uint8Array([1, 2, 3]); +* isTypedArray(arr); // true +* +* const regularArray = [1, 2, 3]; +* isTypedArray(regularArray); // false +* +* const buffer = new ArrayBuffer(16); +* isTypedArray(buffer); // false +*/ +function isTypedArray(x) { + return isTypedArray$1(x); +} +//#endregion +export { isTypedArray }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isUndefined.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isUndefined.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d624f48370db143f2f08e1d4c13cf485c477b697 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isUndefined.d.mts @@ -0,0 +1,24 @@ +//#region src/compat/predicate/isUndefined.d.ts +/** + * Checks if the given value is undefined. + * + * This function tests whether the provided value is strictly equal to `undefined`. + * It returns `true` if the value is `undefined`, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `undefined`. + * + * @param {any} x - The value to test if it is undefined. + * @returns {x is undefined} true if the value is undefined, false otherwise. + * + * @example + * const value1 = undefined; + * const value2 = null; + * const value3 = 42; + * + * console.log(isUndefined(value1)); // true + * console.log(isUndefined(value2)); // false + * console.log(isUndefined(value3)); // false + */ +declare function isUndefined(x: any): x is undefined; +//#endregion +export { isUndefined }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isUndefined.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isUndefined.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d624f48370db143f2f08e1d4c13cf485c477b697 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isUndefined.d.ts @@ -0,0 +1,24 @@ +//#region src/compat/predicate/isUndefined.d.ts +/** + * Checks if the given value is undefined. + * + * This function tests whether the provided value is strictly equal to `undefined`. + * It returns `true` if the value is `undefined`, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `undefined`. + * + * @param {any} x - The value to test if it is undefined. + * @returns {x is undefined} true if the value is undefined, false otherwise. + * + * @example + * const value1 = undefined; + * const value2 = null; + * const value3 = 42; + * + * console.log(isUndefined(value1)); // true + * console.log(isUndefined(value2)); // false + * console.log(isUndefined(value3)); // false + */ +declare function isUndefined(x: any): x is undefined; +//#endregion +export { isUndefined }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isUndefined.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isUndefined.js new file mode 100644 index 0000000000000000000000000000000000000000..99f71e57988b5cdc003550ca9cf4666433483a44 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isUndefined.js @@ -0,0 +1,27 @@ +const require_isUndefined = require("../../predicate/isUndefined.js"); +//#region src/compat/predicate/isUndefined.ts +/** +* Checks if the given value is undefined. +* +* This function tests whether the provided value is strictly equal to `undefined`. +* It returns `true` if the value is `undefined`, and `false` otherwise. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `undefined`. +* +* @param {any} x - The value to test if it is undefined. +* @returns {x is undefined} true if the value is undefined, false otherwise. +* +* @example +* const value1 = undefined; +* const value2 = null; +* const value3 = 42; +* +* console.log(isUndefined(value1)); // true +* console.log(isUndefined(value2)); // false +* console.log(isUndefined(value3)); // false +*/ +function isUndefined(x) { + return require_isUndefined.isUndefined(x); +} +//#endregion +exports.isUndefined = isUndefined; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isUndefined.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isUndefined.mjs new file mode 100644 index 0000000000000000000000000000000000000000..33efa9c0efa98f9eda0ae7b71b0adb6c7bd28501 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isUndefined.mjs @@ -0,0 +1,27 @@ +import { isUndefined as isUndefined$1 } from "../../predicate/isUndefined.mjs"; +//#region src/compat/predicate/isUndefined.ts +/** +* Checks if the given value is undefined. +* +* This function tests whether the provided value is strictly equal to `undefined`. +* It returns `true` if the value is `undefined`, and `false` otherwise. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `undefined`. +* +* @param {any} x - The value to test if it is undefined. +* @returns {x is undefined} true if the value is undefined, false otherwise. +* +* @example +* const value1 = undefined; +* const value2 = null; +* const value3 = 42; +* +* console.log(isUndefined(value1)); // true +* console.log(isUndefined(value2)); // false +* console.log(isUndefined(value3)); // false +*/ +function isUndefined(x) { + return isUndefined$1(x); +} +//#endregion +export { isUndefined }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakMap.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakMap.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6f1ce3bde3c867be704c832bd65440b2a5e7aa8d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakMap.d.mts @@ -0,0 +1,24 @@ +//#region src/compat/predicate/isWeakMap.d.ts +/** + * Checks if the given value is a `WeakMap`. + * + * This function tests whether the provided value is an instance of `WeakMap`. + * It returns `true` if the value is a `WeakMap`, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `WeakMap`. + * + * @param {unknown} value - The value to test if it is a `WeakMap`. + * @returns {value is WeakMap} true if the value is a `WeakMap`, false otherwise. + * + * @example + * const value1 = new WeakMap(); + * const value2 = new Map(); + * const value3 = new Set(); + * + * console.log(isWeakMap(value1)); // true + * console.log(isWeakMap(value2)); // false + * console.log(isWeakMap(value3)); // false + */ +declare function isWeakMap(value?: any): value is WeakMap; +//#endregion +export { isWeakMap }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakMap.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakMap.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6f1ce3bde3c867be704c832bd65440b2a5e7aa8d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakMap.d.ts @@ -0,0 +1,24 @@ +//#region src/compat/predicate/isWeakMap.d.ts +/** + * Checks if the given value is a `WeakMap`. + * + * This function tests whether the provided value is an instance of `WeakMap`. + * It returns `true` if the value is a `WeakMap`, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `WeakMap`. + * + * @param {unknown} value - The value to test if it is a `WeakMap`. + * @returns {value is WeakMap} true if the value is a `WeakMap`, false otherwise. + * + * @example + * const value1 = new WeakMap(); + * const value2 = new Map(); + * const value3 = new Set(); + * + * console.log(isWeakMap(value1)); // true + * console.log(isWeakMap(value2)); // false + * console.log(isWeakMap(value3)); // false + */ +declare function isWeakMap(value?: any): value is WeakMap; +//#endregion +export { isWeakMap }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakMap.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakMap.js new file mode 100644 index 0000000000000000000000000000000000000000..08bd6b036c29f6828e1bfac505d3d5a45423c419 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakMap.js @@ -0,0 +1,27 @@ +const require_isWeakMap = require("../../predicate/isWeakMap.js"); +//#region src/compat/predicate/isWeakMap.ts +/** +* Checks if the given value is a `WeakMap`. +* +* This function tests whether the provided value is an instance of `WeakMap`. +* It returns `true` if the value is a `WeakMap`, and `false` otherwise. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `WeakMap`. +* +* @param {unknown} value - The value to test if it is a `WeakMap`. +* @returns {value is WeakMap} true if the value is a `WeakMap`, false otherwise. +* +* @example +* const value1 = new WeakMap(); +* const value2 = new Map(); +* const value3 = new Set(); +* +* console.log(isWeakMap(value1)); // true +* console.log(isWeakMap(value2)); // false +* console.log(isWeakMap(value3)); // false +*/ +function isWeakMap(value) { + return require_isWeakMap.isWeakMap(value); +} +//#endregion +exports.isWeakMap = isWeakMap; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakMap.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakMap.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e6751449a2da3a707b755880f39650bad27c73f6 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakMap.mjs @@ -0,0 +1,27 @@ +import { isWeakMap as isWeakMap$1 } from "../../predicate/isWeakMap.mjs"; +//#region src/compat/predicate/isWeakMap.ts +/** +* Checks if the given value is a `WeakMap`. +* +* This function tests whether the provided value is an instance of `WeakMap`. +* It returns `true` if the value is a `WeakMap`, and `false` otherwise. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `WeakMap`. +* +* @param {unknown} value - The value to test if it is a `WeakMap`. +* @returns {value is WeakMap} true if the value is a `WeakMap`, false otherwise. +* +* @example +* const value1 = new WeakMap(); +* const value2 = new Map(); +* const value3 = new Set(); +* +* console.log(isWeakMap(value1)); // true +* console.log(isWeakMap(value2)); // false +* console.log(isWeakMap(value3)); // false +*/ +function isWeakMap(value) { + return isWeakMap$1(value); +} +//#endregion +export { isWeakMap }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakSet.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakSet.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f3efe80787090c2a0ce620ccf7da50835488f736 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakSet.d.mts @@ -0,0 +1,24 @@ +//#region src/compat/predicate/isWeakSet.d.ts +/** + * Checks if the given value is a `WeakSet`. + * + * This function tests whether the provided value is an instance of `WeakSet`. + * It returns `true` if the value is a `WeakSet`, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `WeakSet`. + * + * @param {unknown} value - The value to test if it is a `WeakSet`. + * @returns {value is WeakSet} true if the value is a `WeakSet`, false otherwise. + * + * @example + * const value1 = new WeakSet(); + * const value2 = new Map(); + * const value3 = new Set(); + * + * console.log(isWeakSet(value1)); // true + * console.log(isWeakSet(value2)); // false + * console.log(isWeakSet(value3)); // false + */ +declare function isWeakSet(value?: any): value is WeakSet; +//#endregion +export { isWeakSet }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakSet.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakSet.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f3efe80787090c2a0ce620ccf7da50835488f736 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakSet.d.ts @@ -0,0 +1,24 @@ +//#region src/compat/predicate/isWeakSet.d.ts +/** + * Checks if the given value is a `WeakSet`. + * + * This function tests whether the provided value is an instance of `WeakSet`. + * It returns `true` if the value is a `WeakSet`, and `false` otherwise. + * + * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `WeakSet`. + * + * @param {unknown} value - The value to test if it is a `WeakSet`. + * @returns {value is WeakSet} true if the value is a `WeakSet`, false otherwise. + * + * @example + * const value1 = new WeakSet(); + * const value2 = new Map(); + * const value3 = new Set(); + * + * console.log(isWeakSet(value1)); // true + * console.log(isWeakSet(value2)); // false + * console.log(isWeakSet(value3)); // false + */ +declare function isWeakSet(value?: any): value is WeakSet; +//#endregion +export { isWeakSet }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakSet.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakSet.js new file mode 100644 index 0000000000000000000000000000000000000000..4e97cdeb5e86ba561fd62ac5745ac9c044697a88 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakSet.js @@ -0,0 +1,27 @@ +const require_isWeakSet = require("../../predicate/isWeakSet.js"); +//#region src/compat/predicate/isWeakSet.ts +/** +* Checks if the given value is a `WeakSet`. +* +* This function tests whether the provided value is an instance of `WeakSet`. +* It returns `true` if the value is a `WeakSet`, and `false` otherwise. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `WeakSet`. +* +* @param {unknown} value - The value to test if it is a `WeakSet`. +* @returns {value is WeakSet} true if the value is a `WeakSet`, false otherwise. +* +* @example +* const value1 = new WeakSet(); +* const value2 = new Map(); +* const value3 = new Set(); +* +* console.log(isWeakSet(value1)); // true +* console.log(isWeakSet(value2)); // false +* console.log(isWeakSet(value3)); // false +*/ +function isWeakSet(value) { + return require_isWeakSet.isWeakSet(value); +} +//#endregion +exports.isWeakSet = isWeakSet; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakSet.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakSet.mjs new file mode 100644 index 0000000000000000000000000000000000000000..721c6c51a2ab2c1ac79f5dc951de2ee3ed95a1fc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/isWeakSet.mjs @@ -0,0 +1,27 @@ +import { isWeakSet as isWeakSet$1 } from "../../predicate/isWeakSet.mjs"; +//#region src/compat/predicate/isWeakSet.ts +/** +* Checks if the given value is a `WeakSet`. +* +* This function tests whether the provided value is an instance of `WeakSet`. +* It returns `true` if the value is a `WeakSet`, and `false` otherwise. +* +* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `WeakSet`. +* +* @param {unknown} value - The value to test if it is a `WeakSet`. +* @returns {value is WeakSet} true if the value is a `WeakSet`, false otherwise. +* +* @example +* const value1 = new WeakSet(); +* const value2 = new Map(); +* const value3 = new Set(); +* +* console.log(isWeakSet(value1)); // true +* console.log(isWeakSet(value2)); // false +* console.log(isWeakSet(value3)); // false +*/ +function isWeakSet(value) { + return isWeakSet$1(value); +} +//#endregion +export { isWeakSet }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matches.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matches.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c8009c04495d7dbe4c69e5b421a4c20e46ff5368 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matches.d.mts @@ -0,0 +1,30 @@ +//#region src/compat/predicate/matches.d.ts +/** + * Creates a function that performs a deep comparison between a given target and the source object. + * + * @template T + * @param {T} source - The source object to create the matcher from. + * @returns {(value: any) => boolean} Returns a function that takes a target object and returns `true` if the target matches the source, otherwise `false`. + * + * @example + * const matcher = matches({ a: 1, b: 2 }); + * matcher({ a: 1, b: 2, c: 3 }); // true + * matcher({ a: 1, c: 3 }); // false + */ +declare function matches(source: T): (value: any) => boolean; +/** + * Creates a function that performs a deep comparison between a given target and the source object. + * + * @template T + * @template V + * @param {T} source - The source object to create the matcher from. + * @returns {(value: V) => boolean} Returns a function that takes a target object and returns `true` if the target matches the source, otherwise `false`. + * + * @example + * const matcher = matches<{ a: number }, { a: number; b?: number }>({ a: 1 }); + * matcher({ a: 1, b: 2 }); // true + * matcher({ a: 2 }); // false + */ +declare function matches(source: T): (value: V) => boolean; +//#endregion +export { matches }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matches.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matches.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c8009c04495d7dbe4c69e5b421a4c20e46ff5368 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matches.d.ts @@ -0,0 +1,30 @@ +//#region src/compat/predicate/matches.d.ts +/** + * Creates a function that performs a deep comparison between a given target and the source object. + * + * @template T + * @param {T} source - The source object to create the matcher from. + * @returns {(value: any) => boolean} Returns a function that takes a target object and returns `true` if the target matches the source, otherwise `false`. + * + * @example + * const matcher = matches({ a: 1, b: 2 }); + * matcher({ a: 1, b: 2, c: 3 }); // true + * matcher({ a: 1, c: 3 }); // false + */ +declare function matches(source: T): (value: any) => boolean; +/** + * Creates a function that performs a deep comparison between a given target and the source object. + * + * @template T + * @template V + * @param {T} source - The source object to create the matcher from. + * @returns {(value: V) => boolean} Returns a function that takes a target object and returns `true` if the target matches the source, otherwise `false`. + * + * @example + * const matcher = matches<{ a: number }, { a: number; b?: number }>({ a: 1 }); + * matcher({ a: 1, b: 2 }); // true + * matcher({ a: 2 }); // false + */ +declare function matches(source: T): (value: V) => boolean; +//#endregion +export { matches }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matches.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matches.js new file mode 100644 index 0000000000000000000000000000000000000000..17327f54d120a8235d79b56bd6ecd74913a21c48 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matches.js @@ -0,0 +1,37 @@ +const require_cloneDeep = require("../../object/cloneDeep.js"); +const require_isMatch = require("./isMatch.js"); +//#region src/compat/predicate/matches.ts +/** +* Creates a function that performs a deep comparison between a given target and the source object. +* +* @template T +* @template V +* @param {T} source - The source object to create the matcher from. +* @returns {(target: V) => boolean} Returns a function that takes a target object and returns `true` if the target matches the source, otherwise `false`. +* +* @example +* // Basic usage +* const matcher = matches({ a: 1, b: 2 }); +* matcher({ a: 1, b: 2, c: 3 }); // true +* matcher({ a: 1, c: 3 }); // false +* +* @example +* // Matching arrays +* const arrayMatcher = matches([1, 2, 3]); +* arrayMatcher([1, 2, 3, 4]); // true +* arrayMatcher([4, 5, 6]); // false +* +* @example +* // Matching objects with nested structures +* const nestedMatcher = matches({ a: { b: 2 } }); +* nestedMatcher({ a: { b: 2, c: 3 } }); // true +* nestedMatcher({ a: { c: 3 } }); // false +*/ +function matches(source) { + source = require_cloneDeep.cloneDeep(source); + return (target) => { + return require_isMatch.isMatch(target, source); + }; +} +//#endregion +exports.matches = matches; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matches.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matches.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7b62385138f4760291d0bf30b93c547b7f69ee0b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matches.mjs @@ -0,0 +1,37 @@ +import { cloneDeep } from "../../object/cloneDeep.mjs"; +import { isMatch } from "./isMatch.mjs"; +//#region src/compat/predicate/matches.ts +/** +* Creates a function that performs a deep comparison between a given target and the source object. +* +* @template T +* @template V +* @param {T} source - The source object to create the matcher from. +* @returns {(target: V) => boolean} Returns a function that takes a target object and returns `true` if the target matches the source, otherwise `false`. +* +* @example +* // Basic usage +* const matcher = matches({ a: 1, b: 2 }); +* matcher({ a: 1, b: 2, c: 3 }); // true +* matcher({ a: 1, c: 3 }); // false +* +* @example +* // Matching arrays +* const arrayMatcher = matches([1, 2, 3]); +* arrayMatcher([1, 2, 3, 4]); // true +* arrayMatcher([4, 5, 6]); // false +* +* @example +* // Matching objects with nested structures +* const nestedMatcher = matches({ a: { b: 2 } }); +* nestedMatcher({ a: { b: 2, c: 3 } }); // true +* nestedMatcher({ a: { c: 3 } }); // false +*/ +function matches(source) { + source = cloneDeep(source); + return (target) => { + return isMatch(target, source); + }; +} +//#endregion +export { matches }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matchesProperty.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matchesProperty.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d16a4bb61620fec335b13250ddaec31e9a8003e6 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matchesProperty.d.mts @@ -0,0 +1,39 @@ +import { PropertyPath } from "../_internal/PropertyPath.mjs"; + +//#region src/compat/predicate/matchesProperty.d.ts +/** + * Creates a function that checks if a given target object matches a specific property value. + * + * @template T + * @template V + * @param {PropertyPath} path - The property path to check within the target object. + * @param {T} srcValue - The value to compare against the property value in the target object. + * @returns {(value: any) => boolean} Returns a function that takes a target object and returns + * `true` if the property value at the given path in the target object matches the provided value, + * otherwise returns `false`. + * + * @example + * const checkName = matchesProperty('name', 'Alice'); + * console.log(checkName({ name: 'Alice' })); // true + * console.log(checkName({ name: 'Bob' })); // false + */ +declare function matchesProperty(path: PropertyPath, srcValue: T): (value: any) => boolean; +/** + * Creates a function that checks if a given target object matches a specific property value. + * + * @template T + * @template V + * @param {PropertyPath} path - The property path to check within the target object. + * @param {T} srcValue - The value to compare against the property value in the target object. + * @returns {(value: V) => boolean} Returns a function that takes a target object and returns + * `true` if the property value at the given path in the target object matches the provided value, + * otherwise returns `false`. + * + * @example + * const checkNested = matchesProperty(['address', 'city'], 'New York'); + * console.log(checkNested({ address: { city: 'New York' } })); // true + * console.log(checkNested({ address: { city: 'Los Angeles' } })); // false + */ +declare function matchesProperty(path: PropertyPath, srcValue: T): (value: V) => boolean; +//#endregion +export { matchesProperty }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matchesProperty.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matchesProperty.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d015ae191ca3c57c33cd521f4538adcdd5ec9076 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matchesProperty.d.ts @@ -0,0 +1,39 @@ +import { PropertyPath } from "../_internal/PropertyPath.js"; + +//#region src/compat/predicate/matchesProperty.d.ts +/** + * Creates a function that checks if a given target object matches a specific property value. + * + * @template T + * @template V + * @param {PropertyPath} path - The property path to check within the target object. + * @param {T} srcValue - The value to compare against the property value in the target object. + * @returns {(value: any) => boolean} Returns a function that takes a target object and returns + * `true` if the property value at the given path in the target object matches the provided value, + * otherwise returns `false`. + * + * @example + * const checkName = matchesProperty('name', 'Alice'); + * console.log(checkName({ name: 'Alice' })); // true + * console.log(checkName({ name: 'Bob' })); // false + */ +declare function matchesProperty(path: PropertyPath, srcValue: T): (value: any) => boolean; +/** + * Creates a function that checks if a given target object matches a specific property value. + * + * @template T + * @template V + * @param {PropertyPath} path - The property path to check within the target object. + * @param {T} srcValue - The value to compare against the property value in the target object. + * @returns {(value: V) => boolean} Returns a function that takes a target object and returns + * `true` if the property value at the given path in the target object matches the provided value, + * otherwise returns `false`. + * + * @example + * const checkNested = matchesProperty(['address', 'city'], 'New York'); + * console.log(checkNested({ address: { city: 'New York' } })); // true + * console.log(checkNested({ address: { city: 'Los Angeles' } })); // false + */ +declare function matchesProperty(path: PropertyPath, srcValue: T): (value: V) => boolean; +//#endregion +export { matchesProperty }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matchesProperty.js b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matchesProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..cb2bb439e0e3ed6db97392d0a552755ab7efa66f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matchesProperty.js @@ -0,0 +1,50 @@ +const require_toKey = require("../_internal/toKey.js"); +const require_get = require("../object/get.js"); +const require_isMatch = require("./isMatch.js"); +const require_cloneDeep = require("../object/cloneDeep.js"); +const require_has = require("../object/has.js"); +//#region src/compat/predicate/matchesProperty.ts +/** +* Creates a function that checks if a given target object matches a specific property value. +* +* The returned function takes a target object and determines if the property at the +* specified path within the target object is equal to the given value. +* +* @param {PropertyPath} property - The property path to check within the target object. +* This can be a single property key or an array of property keys. +* @param {T} source - The value to compare against the property value in the target object. +* +* @returns {(target?: V) => boolean} - A function that takes a target object and returns +* `true` if the property value at the given path in the target object matches the provided value, +* otherwise returns `false`. +* +* @example +* // Using a single property key +* const checkName = matchesProperty('name', 'Alice'); +* console.log(checkName({ name: 'Alice' })); // true +* console.log(checkName({ name: 'Bob' })); // false +* +* // Using an array of property keys +* const checkNested = matchesProperty(['address', 'city'], 'New York'); +* console.log(checkNested({ address: { city: 'New York' } })); // true +* console.log(checkNested({ address: { city: 'Los Angeles' } })); // false +*/ +function matchesProperty(property, source) { + switch (typeof property) { + case "object": + if (Object.is(property?.valueOf(), -0)) property = "-0"; + break; + case "number": + property = require_toKey.toKey(property); + break; + } + source = require_cloneDeep.cloneDeep(source); + return function(target) { + const result = require_get.get(target, property); + if (result === void 0) return require_has.has(target, property); + if (source === void 0) return result === void 0; + return require_isMatch.isMatch(result, source); + }; +} +//#endregion +exports.matchesProperty = matchesProperty; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matchesProperty.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matchesProperty.mjs new file mode 100644 index 0000000000000000000000000000000000000000..efb0a71a22928093ae47cce2c38ffe3077d36638 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/predicate/matchesProperty.mjs @@ -0,0 +1,50 @@ +import { toKey } from "../_internal/toKey.mjs"; +import { get } from "../object/get.mjs"; +import { isMatch } from "./isMatch.mjs"; +import { cloneDeep } from "../object/cloneDeep.mjs"; +import { has } from "../object/has.mjs"; +//#region src/compat/predicate/matchesProperty.ts +/** +* Creates a function that checks if a given target object matches a specific property value. +* +* The returned function takes a target object and determines if the property at the +* specified path within the target object is equal to the given value. +* +* @param {PropertyPath} property - The property path to check within the target object. +* This can be a single property key or an array of property keys. +* @param {T} source - The value to compare against the property value in the target object. +* +* @returns {(target?: V) => boolean} - A function that takes a target object and returns +* `true` if the property value at the given path in the target object matches the provided value, +* otherwise returns `false`. +* +* @example +* // Using a single property key +* const checkName = matchesProperty('name', 'Alice'); +* console.log(checkName({ name: 'Alice' })); // true +* console.log(checkName({ name: 'Bob' })); // false +* +* // Using an array of property keys +* const checkNested = matchesProperty(['address', 'city'], 'New York'); +* console.log(checkNested({ address: { city: 'New York' } })); // true +* console.log(checkNested({ address: { city: 'Los Angeles' } })); // false +*/ +function matchesProperty(property, source) { + switch (typeof property) { + case "object": + if (Object.is(property?.valueOf(), -0)) property = "-0"; + break; + case "number": + property = toKey(property); + break; + } + source = cloneDeep(source); + return function(target) { + const result = get(target, property); + if (result === void 0) return has(target, property); + if (source === void 0) return result === void 0; + return isMatch(result, source); + }; +} +//#endregion +export { matchesProperty }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/camelCase.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/camelCase.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..735f2c666d280bc1c9c20eaf54793b143712549b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/camelCase.d.mts @@ -0,0 +1,19 @@ +//#region src/compat/string/camelCase.d.ts +/** + * Converts a string to camel case. + * + * Camel case is the naming convention in which the first word is written in lowercase and + * each subsequent word begins with a capital letter, concatenated without any separator characters. + * + * @param {string | object} str - The string that is to be changed to camel case. + * @returns {string} - The converted string to camel case. + * + * @example + * const convertedStr1 = camelCase('camelCase') // returns 'camelCase' + * const convertedStr2 = camelCase('some whitespace') // returns 'someWhitespace' + * const convertedStr3 = camelCase('hyphen-text') // returns 'hyphenText' + * const convertedStr4 = camelCase('HTTPRequest') // returns 'httpRequest' + */ +declare function camelCase(str?: string): string; +//#endregion +export { camelCase }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/camelCase.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/camelCase.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..735f2c666d280bc1c9c20eaf54793b143712549b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/camelCase.d.ts @@ -0,0 +1,19 @@ +//#region src/compat/string/camelCase.d.ts +/** + * Converts a string to camel case. + * + * Camel case is the naming convention in which the first word is written in lowercase and + * each subsequent word begins with a capital letter, concatenated without any separator characters. + * + * @param {string | object} str - The string that is to be changed to camel case. + * @returns {string} - The converted string to camel case. + * + * @example + * const convertedStr1 = camelCase('camelCase') // returns 'camelCase' + * const convertedStr2 = camelCase('some whitespace') // returns 'someWhitespace' + * const convertedStr3 = camelCase('hyphen-text') // returns 'hyphenText' + * const convertedStr4 = camelCase('HTTPRequest') // returns 'httpRequest' + */ +declare function camelCase(str?: string): string; +//#endregion +export { camelCase }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/camelCase.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/camelCase.js new file mode 100644 index 0000000000000000000000000000000000000000..31e3074ec9851a34fd00a605dc0975fcdee17b0d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/camelCase.js @@ -0,0 +1,24 @@ +const require_camelCase = require("../../string/camelCase.js"); +const require_deburr = require("./deburr.js"); +const require_normalizeForCase = require("../_internal/normalizeForCase.js"); +//#region src/compat/string/camelCase.ts +/** +* Converts a string to camel case. +* +* Camel case is the naming convention in which the first word is written in lowercase and +* each subsequent word begins with a capital letter, concatenated without any separator characters. +* +* @param {string | object} str - The string that is to be changed to camel case. +* @returns {string} - The converted string to camel case. +* +* @example +* const convertedStr1 = camelCase('camelCase') // returns 'camelCase' +* const convertedStr2 = camelCase('some whitespace') // returns 'someWhitespace' +* const convertedStr3 = camelCase('hyphen-text') // returns 'hyphenText' +* const convertedStr4 = camelCase('HTTPRequest') // returns 'httpRequest' +*/ +function camelCase(str) { + return require_camelCase.camelCase(require_normalizeForCase.normalizeForCase(require_deburr.deburr(str))); +} +//#endregion +exports.camelCase = camelCase; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/camelCase.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/camelCase.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6a26e66178771a79e7deaf9f6cf1196969267fa8 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/camelCase.mjs @@ -0,0 +1,24 @@ +import { camelCase as camelCase$1 } from "../../string/camelCase.mjs"; +import { deburr } from "./deburr.mjs"; +import { normalizeForCase } from "../_internal/normalizeForCase.mjs"; +//#region src/compat/string/camelCase.ts +/** +* Converts a string to camel case. +* +* Camel case is the naming convention in which the first word is written in lowercase and +* each subsequent word begins with a capital letter, concatenated without any separator characters. +* +* @param {string | object} str - The string that is to be changed to camel case. +* @returns {string} - The converted string to camel case. +* +* @example +* const convertedStr1 = camelCase('camelCase') // returns 'camelCase' +* const convertedStr2 = camelCase('some whitespace') // returns 'someWhitespace' +* const convertedStr3 = camelCase('hyphen-text') // returns 'hyphenText' +* const convertedStr4 = camelCase('HTTPRequest') // returns 'httpRequest' +*/ +function camelCase(str) { + return camelCase$1(normalizeForCase(deburr(str))); +} +//#endregion +export { camelCase }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/capitalize.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/capitalize.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..3d4c54a886d30fdc361a1c253bff958f20cef117 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/capitalize.d.mts @@ -0,0 +1,15 @@ +//#region src/compat/string/capitalize.d.ts +/** + * Converts the first character of string to upper case and the remaining to lower case. + * + * @param {string} string - The string to capitalize. + * @returns {string} - The capitalized string. + * + * @example + * const convertedStr1 = capitalize('fred') // returns 'Fred' + * const convertedStr2 = capitalize('FRED') // returns 'Fred' + * const convertedStr3 = capitalize('') // returns '' + */ +declare function capitalize(str?: T): string extends T ? string : Capitalize>; +//#endregion +export { capitalize }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/capitalize.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/capitalize.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3d4c54a886d30fdc361a1c253bff958f20cef117 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/capitalize.d.ts @@ -0,0 +1,15 @@ +//#region src/compat/string/capitalize.d.ts +/** + * Converts the first character of string to upper case and the remaining to lower case. + * + * @param {string} string - The string to capitalize. + * @returns {string} - The capitalized string. + * + * @example + * const convertedStr1 = capitalize('fred') // returns 'Fred' + * const convertedStr2 = capitalize('FRED') // returns 'Fred' + * const convertedStr3 = capitalize('') // returns '' + */ +declare function capitalize(str?: T): string extends T ? string : Capitalize>; +//#endregion +export { capitalize }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/capitalize.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/capitalize.js new file mode 100644 index 0000000000000000000000000000000000000000..b440f9c19c3be3a6cf735c92015758983ccfd9ff --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/capitalize.js @@ -0,0 +1,19 @@ +const require_capitalize = require("../../string/capitalize.js"); +const require_toString = require("../util/toString.js"); +//#region src/compat/string/capitalize.ts +/** +* Converts the first character of string to upper case and the remaining to lower case. +* +* @param {string} string - The string to capitalize. +* @returns {string} - The capitalized string. +* +* @example +* const convertedStr1 = capitalize('fred') // returns 'Fred' +* const convertedStr2 = capitalize('FRED') // returns 'Fred' +* const convertedStr3 = capitalize('') // returns '' +*/ +function capitalize(str) { + return require_capitalize.capitalize(require_toString.toString(str)); +} +//#endregion +exports.capitalize = capitalize; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/capitalize.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/capitalize.mjs new file mode 100644 index 0000000000000000000000000000000000000000..04b4e1b070da3724f993a1bb375368cec7dbf1d5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/capitalize.mjs @@ -0,0 +1,19 @@ +import { capitalize as capitalize$1 } from "../../string/capitalize.mjs"; +import { toString } from "../util/toString.mjs"; +//#region src/compat/string/capitalize.ts +/** +* Converts the first character of string to upper case and the remaining to lower case. +* +* @param {string} string - The string to capitalize. +* @returns {string} - The capitalized string. +* +* @example +* const convertedStr1 = capitalize('fred') // returns 'Fred' +* const convertedStr2 = capitalize('FRED') // returns 'Fred' +* const convertedStr3 = capitalize('') // returns '' +*/ +function capitalize(str) { + return capitalize$1(toString(str)); +} +//#endregion +export { capitalize }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/deburr.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/deburr.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..802eb28db992f3e06f84903df9986e3f2ee55e76 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/deburr.d.mts @@ -0,0 +1,23 @@ +//#region src/compat/string/deburr.d.ts +/** + * Converts a string by replacing special characters and diacritical marks with their ASCII equivalents. + * For example, "Crème brûlée" becomes "Creme brulee". + * + * @param {string} str - The input string to be deburred. + * @returns {string} - The deburred string with special characters replaced by their ASCII equivalents. + * + * @example + * // Basic usage: + * deburr('Æthelred') // returns 'Aethelred' + * + * @example + * // Handling diacritical marks: + * deburr('München') // returns 'Munchen' + * + * @example + * // Special characters: + * deburr('Crème brûlée') // returns 'Creme brulee' + */ +declare function deburr(str?: string): string; +//#endregion +export { deburr }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/deburr.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/deburr.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..802eb28db992f3e06f84903df9986e3f2ee55e76 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/deburr.d.ts @@ -0,0 +1,23 @@ +//#region src/compat/string/deburr.d.ts +/** + * Converts a string by replacing special characters and diacritical marks with their ASCII equivalents. + * For example, "Crème brûlée" becomes "Creme brulee". + * + * @param {string} str - The input string to be deburred. + * @returns {string} - The deburred string with special characters replaced by their ASCII equivalents. + * + * @example + * // Basic usage: + * deburr('Æthelred') // returns 'Aethelred' + * + * @example + * // Handling diacritical marks: + * deburr('München') // returns 'Munchen' + * + * @example + * // Special characters: + * deburr('Crème brûlée') // returns 'Creme brulee' + */ +declare function deburr(str?: string): string; +//#endregion +export { deburr }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/deburr.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/deburr.js new file mode 100644 index 0000000000000000000000000000000000000000..5165307ddd7a5c53e752477b7e55b652f41701ba --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/deburr.js @@ -0,0 +1,27 @@ +const require_deburr = require("../../string/deburr.js"); +const require_toString = require("../util/toString.js"); +//#region src/compat/string/deburr.ts +/** +* Converts a string by replacing special characters and diacritical marks with their ASCII equivalents. +* For example, "Crème brûlée" becomes "Creme brulee". +* +* @param {string} str - The input string to be deburred. +* @returns {string} - The deburred string with special characters replaced by their ASCII equivalents. +* +* @example +* // Basic usage: +* deburr('Æthelred') // returns 'Aethelred' +* +* @example +* // Handling diacritical marks: +* deburr('München') // returns 'Munchen' +* +* @example +* // Special characters: +* deburr('Crème brûlée') // returns 'Creme brulee' +*/ +function deburr(str) { + return require_deburr.deburr(require_toString.toString(str)); +} +//#endregion +exports.deburr = deburr; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/deburr.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/deburr.mjs new file mode 100644 index 0000000000000000000000000000000000000000..60740280e9a1cc2093b9aa60a33dcdaf6be9d0d2 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/deburr.mjs @@ -0,0 +1,27 @@ +import { deburr as deburr$1 } from "../../string/deburr.mjs"; +import { toString } from "../util/toString.mjs"; +//#region src/compat/string/deburr.ts +/** +* Converts a string by replacing special characters and diacritical marks with their ASCII equivalents. +* For example, "Crème brûlée" becomes "Creme brulee". +* +* @param {string} str - The input string to be deburred. +* @returns {string} - The deburred string with special characters replaced by their ASCII equivalents. +* +* @example +* // Basic usage: +* deburr('Æthelred') // returns 'Aethelred' +* +* @example +* // Handling diacritical marks: +* deburr('München') // returns 'Munchen' +* +* @example +* // Special characters: +* deburr('Crème brûlée') // returns 'Creme brulee' +*/ +function deburr(str) { + return deburr$1(toString(str)); +} +//#endregion +export { deburr }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/endsWith.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/endsWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..4ede6202fd4331f4516b69edee8feeb52f2f0222 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/endsWith.d.mts @@ -0,0 +1,21 @@ +//#region src/compat/string/endsWith.d.ts +/** + * Checks if a string contains another string at the end of the string. + * + * Checks if one string endsWith another string. Optional position parameter to offset searching before a certain index. + * + * @param {string} str - The string that might contain the target string. + * @param {string} target - The string to search for. + * @param {number} position - An optional position from the start to search up to this index + * @returns {boolean} - True if the str string ends with the target string. + * + * @example + * const isPrefix = endsWith('fooBar', 'foo') // returns true + * const isPrefix = endsWith('fooBar', 'bar') // returns false + * const isPrefix = endsWith('fooBar', 'abc') // returns false + * const isPrefix = endsWith('fooBar', 'foo', 3) // returns true + * const isPrefix = endsWith('fooBar', 'abc', 5) // returns false + */ +declare function endsWith(str?: string, target?: string, position?: number): boolean; +//#endregion +export { endsWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/endsWith.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/endsWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4ede6202fd4331f4516b69edee8feeb52f2f0222 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/endsWith.d.ts @@ -0,0 +1,21 @@ +//#region src/compat/string/endsWith.d.ts +/** + * Checks if a string contains another string at the end of the string. + * + * Checks if one string endsWith another string. Optional position parameter to offset searching before a certain index. + * + * @param {string} str - The string that might contain the target string. + * @param {string} target - The string to search for. + * @param {number} position - An optional position from the start to search up to this index + * @returns {boolean} - True if the str string ends with the target string. + * + * @example + * const isPrefix = endsWith('fooBar', 'foo') // returns true + * const isPrefix = endsWith('fooBar', 'bar') // returns false + * const isPrefix = endsWith('fooBar', 'abc') // returns false + * const isPrefix = endsWith('fooBar', 'foo', 3) // returns true + * const isPrefix = endsWith('fooBar', 'abc', 5) // returns false + */ +declare function endsWith(str?: string, target?: string, position?: number): boolean; +//#endregion +export { endsWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/endsWith.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/endsWith.js new file mode 100644 index 0000000000000000000000000000000000000000..1e2880cdd9fd648385fbd2b967b832dcd3254891 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/endsWith.js @@ -0,0 +1,25 @@ +//#region src/compat/string/endsWith.ts +/** +* Checks if a string contains another string at the end of the string. +* +* Checks if one string endsWith another string. Optional position parameter to offset searching before a certain index. +* +* @param {string} str - The string that might contain the target string. +* @param {string} target - The string to search for. +* @param {number} position - An optional position from the start to search up to this index +* @returns {boolean} - True if the str string ends with the target string. +* +* @example +* const isPrefix = endsWith('fooBar', 'foo') // returns true +* const isPrefix = endsWith('fooBar', 'bar') // returns false +* const isPrefix = endsWith('fooBar', 'abc') // returns false +* const isPrefix = endsWith('fooBar', 'foo', 3) // returns true +* const isPrefix = endsWith('fooBar', 'abc', 5) // returns false +*/ +function endsWith(str, target, position) { + if (str == null || target == null) return false; + if (position == null) position = str.length; + return str.endsWith(target, position); +} +//#endregion +exports.endsWith = endsWith; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/endsWith.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/endsWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..58fdf3467be17647169ce6e674f0dc619cd68439 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/endsWith.mjs @@ -0,0 +1,25 @@ +//#region src/compat/string/endsWith.ts +/** +* Checks if a string contains another string at the end of the string. +* +* Checks if one string endsWith another string. Optional position parameter to offset searching before a certain index. +* +* @param {string} str - The string that might contain the target string. +* @param {string} target - The string to search for. +* @param {number} position - An optional position from the start to search up to this index +* @returns {boolean} - True if the str string ends with the target string. +* +* @example +* const isPrefix = endsWith('fooBar', 'foo') // returns true +* const isPrefix = endsWith('fooBar', 'bar') // returns false +* const isPrefix = endsWith('fooBar', 'abc') // returns false +* const isPrefix = endsWith('fooBar', 'foo', 3) // returns true +* const isPrefix = endsWith('fooBar', 'abc', 5) // returns false +*/ +function endsWith(str, target, position) { + if (str == null || target == null) return false; + if (position == null) position = str.length; + return str.endsWith(target, position); +} +//#endregion +export { endsWith }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/escape.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/escape.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..48724e06f13e8e510111bc10aa495580dec76efe --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/escape.d.mts @@ -0,0 +1,17 @@ +//#region src/compat/string/escape.d.ts +/** + * Converts the characters "&", "<", ">", '"', and "'" in `str` to their corresponding HTML entities. + * For example, "<" becomes "<". + * + * @param {string} str The string to escape. + * @returns {string} Returns the escaped string. + * + * @example + * escape('This is a
element.'); // returns 'This is a <div> element.' + * escape('This is a "quote"'); // returns 'This is a "quote"' + * escape("This is a 'quote'"); // returns 'This is a 'quote'' + * escape('This is a & symbol'); // returns 'This is a & symbol' + */ +declare function escape(string?: string): string; +//#endregion +export { escape }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/escape.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/escape.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..48724e06f13e8e510111bc10aa495580dec76efe --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/escape.d.ts @@ -0,0 +1,17 @@ +//#region src/compat/string/escape.d.ts +/** + * Converts the characters "&", "<", ">", '"', and "'" in `str` to their corresponding HTML entities. + * For example, "<" becomes "<". + * + * @param {string} str The string to escape. + * @returns {string} Returns the escaped string. + * + * @example + * escape('This is a
element.'); // returns 'This is a <div> element.' + * escape('This is a "quote"'); // returns 'This is a "quote"' + * escape("This is a 'quote'"); // returns 'This is a 'quote'' + * escape('This is a & symbol'); // returns 'This is a & symbol' + */ +declare function escape(string?: string): string; +//#endregion +export { escape }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/escape.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/escape.js new file mode 100644 index 0000000000000000000000000000000000000000..3522e29a00ddd79264b7bc7927531688c471fcc6 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/escape.js @@ -0,0 +1,21 @@ +const require_escape = require("../../string/escape.js"); +const require_toString = require("../util/toString.js"); +//#region src/compat/string/escape.ts +/** +* Converts the characters "&", "<", ">", '"', and "'" in `str` to their corresponding HTML entities. +* For example, "<" becomes "<". +* +* @param {string} str The string to escape. +* @returns {string} Returns the escaped string. +* +* @example +* escape('This is a
element.'); // returns 'This is a <div> element.' +* escape('This is a "quote"'); // returns 'This is a "quote"' +* escape("This is a 'quote'"); // returns 'This is a 'quote'' +* escape('This is a & symbol'); // returns 'This is a & symbol' +*/ +function escape(string) { + return require_escape.escape(require_toString.toString(string)); +} +//#endregion +exports.escape = escape; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/escape.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/escape.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b1b35cfb4eb1a87685fb6ca559dd40969896f992 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/escape.mjs @@ -0,0 +1,21 @@ +import { escape as escape$1 } from "../../string/escape.mjs"; +import { toString } from "../util/toString.mjs"; +//#region src/compat/string/escape.ts +/** +* Converts the characters "&", "<", ">", '"', and "'" in `str` to their corresponding HTML entities. +* For example, "<" becomes "<". +* +* @param {string} str The string to escape. +* @returns {string} Returns the escaped string. +* +* @example +* escape('This is a
element.'); // returns 'This is a <div> element.' +* escape('This is a "quote"'); // returns 'This is a "quote"' +* escape("This is a 'quote'"); // returns 'This is a 'quote'' +* escape('This is a & symbol'); // returns 'This is a & symbol' +*/ +function escape(string) { + return escape$1(toString(string)); +} +//#endregion +export { escape }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/escapeRegExp.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/escapeRegExp.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..7bf2e0ba485243a56f1e161f7a6da0dcba9c31b2 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/escapeRegExp.d.mts @@ -0,0 +1,15 @@ +//#region src/compat/string/escapeRegExp.d.ts +/** + * Escapes the RegExp special characters "^", "$", "\\", ".", "*", "+", "?", "(", ")", "[", "]", "{", "}", and "|" in `str`. + * + * @param {string} str The string to escape. + * @returns {string} Returns the escaped string. + * + * @example + * import { escapeRegExp } from 'es-toolkit/string'; + * + * escapeRegExp('[es-toolkit](https://es-toolkit.dev/)'); // returns '\[es-toolkit\]\(https://es-toolkit\.dev/\)' + */ +declare function escapeRegExp(str?: string): string; +//#endregion +export { escapeRegExp }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/escapeRegExp.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/escapeRegExp.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7bf2e0ba485243a56f1e161f7a6da0dcba9c31b2 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/escapeRegExp.d.ts @@ -0,0 +1,15 @@ +//#region src/compat/string/escapeRegExp.d.ts +/** + * Escapes the RegExp special characters "^", "$", "\\", ".", "*", "+", "?", "(", ")", "[", "]", "{", "}", and "|" in `str`. + * + * @param {string} str The string to escape. + * @returns {string} Returns the escaped string. + * + * @example + * import { escapeRegExp } from 'es-toolkit/string'; + * + * escapeRegExp('[es-toolkit](https://es-toolkit.dev/)'); // returns '\[es-toolkit\]\(https://es-toolkit\.dev/\)' + */ +declare function escapeRegExp(str?: string): string; +//#endregion +export { escapeRegExp }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/escapeRegExp.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/escapeRegExp.js new file mode 100644 index 0000000000000000000000000000000000000000..b2f3af36645526ba616f096658c62a3b1679d6a4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/escapeRegExp.js @@ -0,0 +1,19 @@ +const require_escapeRegExp = require("../../string/escapeRegExp.js"); +const require_toString = require("../util/toString.js"); +//#region src/compat/string/escapeRegExp.ts +/** +* Escapes the RegExp special characters "^", "$", "\\", ".", "*", "+", "?", "(", ")", "[", "]", "{", "}", and "|" in `str`. +* +* @param {string} str The string to escape. +* @returns {string} Returns the escaped string. +* +* @example +* import { escapeRegExp } from 'es-toolkit/string'; +* +* escapeRegExp('[es-toolkit](https://es-toolkit.dev/)'); // returns '\[es-toolkit\]\(https://es-toolkit\.dev/\)' +*/ +function escapeRegExp(str) { + return require_escapeRegExp.escapeRegExp(require_toString.toString(str)); +} +//#endregion +exports.escapeRegExp = escapeRegExp; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/escapeRegExp.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/escapeRegExp.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2cdaad2e6b8de4c9691415899c3fa3199de2f656 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/escapeRegExp.mjs @@ -0,0 +1,19 @@ +import { escapeRegExp as escapeRegExp$1 } from "../../string/escapeRegExp.mjs"; +import { toString } from "../util/toString.mjs"; +//#region src/compat/string/escapeRegExp.ts +/** +* Escapes the RegExp special characters "^", "$", "\\", ".", "*", "+", "?", "(", ")", "[", "]", "{", "}", and "|" in `str`. +* +* @param {string} str The string to escape. +* @returns {string} Returns the escaped string. +* +* @example +* import { escapeRegExp } from 'es-toolkit/string'; +* +* escapeRegExp('[es-toolkit](https://es-toolkit.dev/)'); // returns '\[es-toolkit\]\(https://es-toolkit\.dev/\)' +*/ +function escapeRegExp(str) { + return escapeRegExp$1(toString(str)); +} +//#endregion +export { escapeRegExp }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/kebabCase.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/kebabCase.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..eab13a48c12643a81711dc0e928356dac3836eb9 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/kebabCase.d.mts @@ -0,0 +1,18 @@ +//#region src/compat/string/kebabCase.d.ts +/** + * Converts a string to kebab case. + * + * Kebab case is the naming convention in which each word is written in lowercase and separated by a dash (-) character. + * + * @param {string | object} str - The string that is to be changed to kebab case. + * @returns {string} - The converted string to kebab case. + * + * @example + * const convertedStr1 = kebabCase('camelCase') // returns 'camel-case' + * const convertedStr2 = kebabCase('some whitespace') // returns 'some-whitespace' + * const convertedStr3 = kebabCase('hyphen-text') // returns 'hyphen-text' + * const convertedStr4 = kebabCase('HTTPRequest') // returns 'http-request' + */ +declare function kebabCase(str?: string): string; +//#endregion +export { kebabCase }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/kebabCase.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/kebabCase.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..eab13a48c12643a81711dc0e928356dac3836eb9 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/kebabCase.d.ts @@ -0,0 +1,18 @@ +//#region src/compat/string/kebabCase.d.ts +/** + * Converts a string to kebab case. + * + * Kebab case is the naming convention in which each word is written in lowercase and separated by a dash (-) character. + * + * @param {string | object} str - The string that is to be changed to kebab case. + * @returns {string} - The converted string to kebab case. + * + * @example + * const convertedStr1 = kebabCase('camelCase') // returns 'camel-case' + * const convertedStr2 = kebabCase('some whitespace') // returns 'some-whitespace' + * const convertedStr3 = kebabCase('hyphen-text') // returns 'hyphen-text' + * const convertedStr4 = kebabCase('HTTPRequest') // returns 'http-request' + */ +declare function kebabCase(str?: string): string; +//#endregion +export { kebabCase }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/kebabCase.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/kebabCase.js new file mode 100644 index 0000000000000000000000000000000000000000..afae3cbcab98770f71c9c1b4b3259bd79eea2cf4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/kebabCase.js @@ -0,0 +1,23 @@ +const require_kebabCase = require("../../string/kebabCase.js"); +const require_deburr = require("./deburr.js"); +const require_normalizeForCase = require("../_internal/normalizeForCase.js"); +//#region src/compat/string/kebabCase.ts +/** +* Converts a string to kebab case. +* +* Kebab case is the naming convention in which each word is written in lowercase and separated by a dash (-) character. +* +* @param {string | object} str - The string that is to be changed to kebab case. +* @returns {string} - The converted string to kebab case. +* +* @example +* const convertedStr1 = kebabCase('camelCase') // returns 'camel-case' +* const convertedStr2 = kebabCase('some whitespace') // returns 'some-whitespace' +* const convertedStr3 = kebabCase('hyphen-text') // returns 'hyphen-text' +* const convertedStr4 = kebabCase('HTTPRequest') // returns 'http-request' +*/ +function kebabCase(str) { + return require_kebabCase.kebabCase(require_normalizeForCase.normalizeForCase(require_deburr.deburr(str))); +} +//#endregion +exports.kebabCase = kebabCase; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/kebabCase.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/kebabCase.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6df0403b149f35d21fbae8fdeb2f67e9faa05b7b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/kebabCase.mjs @@ -0,0 +1,23 @@ +import { kebabCase as kebabCase$1 } from "../../string/kebabCase.mjs"; +import { deburr } from "./deburr.mjs"; +import { normalizeForCase } from "../_internal/normalizeForCase.mjs"; +//#region src/compat/string/kebabCase.ts +/** +* Converts a string to kebab case. +* +* Kebab case is the naming convention in which each word is written in lowercase and separated by a dash (-) character. +* +* @param {string | object} str - The string that is to be changed to kebab case. +* @returns {string} - The converted string to kebab case. +* +* @example +* const convertedStr1 = kebabCase('camelCase') // returns 'camel-case' +* const convertedStr2 = kebabCase('some whitespace') // returns 'some-whitespace' +* const convertedStr3 = kebabCase('hyphen-text') // returns 'hyphen-text' +* const convertedStr4 = kebabCase('HTTPRequest') // returns 'http-request' +*/ +function kebabCase(str) { + return kebabCase$1(normalizeForCase(deburr(str))); +} +//#endregion +export { kebabCase }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerCase.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerCase.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..ff928c7dd73a21a9aed937d0d0894eee22678b0f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerCase.d.mts @@ -0,0 +1,18 @@ +//#region src/compat/string/lowerCase.d.ts +/** + * Converts a string to lower case. + * + * Lower case is the naming convention in which each word is written in lowercase and separated by an space ( ) character. + * + * @param {string | object} str - The string that is to be changed to lower case. + * @returns {string} - The converted string to lower case. + * + * @example + * const convertedStr1 = lowerCase('camelCase') // returns 'camel case' + * const convertedStr2 = lowerCase('some whitespace') // returns 'some whitespace' + * const convertedStr3 = lowerCase('hyphen-text') // returns 'hyphen text' + * const convertedStr4 = lowerCase('HTTPRequest') // returns 'http request' + */ +declare function lowerCase(str?: string): string; +//#endregion +export { lowerCase }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerCase.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerCase.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ff928c7dd73a21a9aed937d0d0894eee22678b0f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerCase.d.ts @@ -0,0 +1,18 @@ +//#region src/compat/string/lowerCase.d.ts +/** + * Converts a string to lower case. + * + * Lower case is the naming convention in which each word is written in lowercase and separated by an space ( ) character. + * + * @param {string | object} str - The string that is to be changed to lower case. + * @returns {string} - The converted string to lower case. + * + * @example + * const convertedStr1 = lowerCase('camelCase') // returns 'camel case' + * const convertedStr2 = lowerCase('some whitespace') // returns 'some whitespace' + * const convertedStr3 = lowerCase('hyphen-text') // returns 'hyphen text' + * const convertedStr4 = lowerCase('HTTPRequest') // returns 'http request' + */ +declare function lowerCase(str?: string): string; +//#endregion +export { lowerCase }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerCase.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerCase.js new file mode 100644 index 0000000000000000000000000000000000000000..819a532a56f8f2b3355d69d6e10bd1743ff6c9be --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerCase.js @@ -0,0 +1,23 @@ +const require_lowerCase = require("../../string/lowerCase.js"); +const require_deburr = require("./deburr.js"); +const require_normalizeForCase = require("../_internal/normalizeForCase.js"); +//#region src/compat/string/lowerCase.ts +/** +* Converts a string to lower case. +* +* Lower case is the naming convention in which each word is written in lowercase and separated by an space ( ) character. +* +* @param {string | object} str - The string that is to be changed to lower case. +* @returns {string} - The converted string to lower case. +* +* @example +* const convertedStr1 = lowerCase('camelCase') // returns 'camel case' +* const convertedStr2 = lowerCase('some whitespace') // returns 'some whitespace' +* const convertedStr3 = lowerCase('hyphen-text') // returns 'hyphen text' +* const convertedStr4 = lowerCase('HTTPRequest') // returns 'http request' +*/ +function lowerCase(str) { + return require_lowerCase.lowerCase(require_normalizeForCase.normalizeForCase(require_deburr.deburr(str))); +} +//#endregion +exports.lowerCase = lowerCase; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerCase.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerCase.mjs new file mode 100644 index 0000000000000000000000000000000000000000..48f7ba6a698c6c29c260027c009afca6904d5bba --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerCase.mjs @@ -0,0 +1,23 @@ +import { lowerCase as lowerCase$1 } from "../../string/lowerCase.mjs"; +import { deburr } from "./deburr.mjs"; +import { normalizeForCase } from "../_internal/normalizeForCase.mjs"; +//#region src/compat/string/lowerCase.ts +/** +* Converts a string to lower case. +* +* Lower case is the naming convention in which each word is written in lowercase and separated by an space ( ) character. +* +* @param {string | object} str - The string that is to be changed to lower case. +* @returns {string} - The converted string to lower case. +* +* @example +* const convertedStr1 = lowerCase('camelCase') // returns 'camel case' +* const convertedStr2 = lowerCase('some whitespace') // returns 'some whitespace' +* const convertedStr3 = lowerCase('hyphen-text') // returns 'hyphen text' +* const convertedStr4 = lowerCase('HTTPRequest') // returns 'http request' +*/ +function lowerCase(str) { + return lowerCase$1(normalizeForCase(deburr(str))); +} +//#endregion +export { lowerCase }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerFirst.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerFirst.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e63b0cfee193f7e40152f8d34e7b4f74806ee8dd --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerFirst.d.mts @@ -0,0 +1,15 @@ +//#region src/compat/string/lowerFirst.d.ts +/** + * Converts the first character of string to lower case. + * + * @param {string} str - The string that is to be changed + * @returns {string} - The converted string. + * + * @example + * const convertedStr1 = lowerCase('fred') // returns 'fred' + * const convertedStr2 = lowerCase('Fred') // returns 'fred' + * const convertedStr3 = lowerCase('FRED') // returns 'fRED' + */ +declare function lowerFirst(str?: T): Uncapitalize; +//#endregion +export { lowerFirst }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerFirst.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerFirst.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e63b0cfee193f7e40152f8d34e7b4f74806ee8dd --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerFirst.d.ts @@ -0,0 +1,15 @@ +//#region src/compat/string/lowerFirst.d.ts +/** + * Converts the first character of string to lower case. + * + * @param {string} str - The string that is to be changed + * @returns {string} - The converted string. + * + * @example + * const convertedStr1 = lowerCase('fred') // returns 'fred' + * const convertedStr2 = lowerCase('Fred') // returns 'fred' + * const convertedStr3 = lowerCase('FRED') // returns 'fRED' + */ +declare function lowerFirst(str?: T): Uncapitalize; +//#endregion +export { lowerFirst }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerFirst.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerFirst.js new file mode 100644 index 0000000000000000000000000000000000000000..efca87acf3309d3f2db85d948d2e8cd92a04640f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerFirst.js @@ -0,0 +1,19 @@ +const require_lowerFirst = require("../../string/lowerFirst.js"); +const require_toString = require("../util/toString.js"); +//#region src/compat/string/lowerFirst.ts +/** +* Converts the first character of string to lower case. +* +* @param {string} str - The string that is to be changed +* @returns {string} - The converted string. +* +* @example +* const convertedStr1 = lowerCase('fred') // returns 'fred' +* const convertedStr2 = lowerCase('Fred') // returns 'fred' +* const convertedStr3 = lowerCase('FRED') // returns 'fRED' +*/ +function lowerFirst(str) { + return require_lowerFirst.lowerFirst(require_toString.toString(str)); +} +//#endregion +exports.lowerFirst = lowerFirst; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerFirst.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerFirst.mjs new file mode 100644 index 0000000000000000000000000000000000000000..1fa30623a08439d9c817743a47ca4a56ef77d43a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/lowerFirst.mjs @@ -0,0 +1,19 @@ +import { lowerFirst as lowerFirst$1 } from "../../string/lowerFirst.mjs"; +import { toString } from "../util/toString.mjs"; +//#region src/compat/string/lowerFirst.ts +/** +* Converts the first character of string to lower case. +* +* @param {string} str - The string that is to be changed +* @returns {string} - The converted string. +* +* @example +* const convertedStr1 = lowerCase('fred') // returns 'fred' +* const convertedStr2 = lowerCase('Fred') // returns 'fred' +* const convertedStr3 = lowerCase('FRED') // returns 'fRED' +*/ +function lowerFirst(str) { + return lowerFirst$1(toString(str)); +} +//#endregion +export { lowerFirst }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/pad.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/pad.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e1c349e80db13cf76306996fb44862487ca65bd0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/pad.d.mts @@ -0,0 +1,20 @@ +//#region src/compat/string/pad.d.ts +/** + * Pads string on the left and right sides if it's shorter than length. Padding characters are truncated if they can't be evenly divided by length. + * If the length is less than or equal to the original string's length, or if the padding character is an empty string, the original string is returned unchanged. + * + * @param {string} str - The string to pad. + * @param {number} [length] - The length of the resulting string once padded. + * @param {string} [chars] - The character(s) to use for padding. + * @returns {string} - The padded string, or the original string if padding is not required. + * + * @example + * const result1 = pad('abc', 8); // result will be ' abc ' + * const result2 = pad('abc', 8, '_-'); // result will be '_-abc_-_' + * const result3 = pad('abc', 3); // result will be 'abc' + * const result4 = pad('abc', 2); // result will be 'abc' + * + */ +declare function pad(str?: string, length?: number, chars?: string): string; +//#endregion +export { pad }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/pad.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/pad.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e1c349e80db13cf76306996fb44862487ca65bd0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/pad.d.ts @@ -0,0 +1,20 @@ +//#region src/compat/string/pad.d.ts +/** + * Pads string on the left and right sides if it's shorter than length. Padding characters are truncated if they can't be evenly divided by length. + * If the length is less than or equal to the original string's length, or if the padding character is an empty string, the original string is returned unchanged. + * + * @param {string} str - The string to pad. + * @param {number} [length] - The length of the resulting string once padded. + * @param {string} [chars] - The character(s) to use for padding. + * @returns {string} - The padded string, or the original string if padding is not required. + * + * @example + * const result1 = pad('abc', 8); // result will be ' abc ' + * const result2 = pad('abc', 8, '_-'); // result will be '_-abc_-_' + * const result3 = pad('abc', 3); // result will be 'abc' + * const result4 = pad('abc', 2); // result will be 'abc' + * + */ +declare function pad(str?: string, length?: number, chars?: string): string; +//#endregion +export { pad }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/pad.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/pad.js new file mode 100644 index 0000000000000000000000000000000000000000..791fbd837ebf1369ebafedba2bed7a8b43eae83d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/pad.js @@ -0,0 +1,24 @@ +const require_pad = require("../../string/pad.js"); +const require_toString = require("../util/toString.js"); +//#region src/compat/string/pad.ts +/** +* Pads string on the left and right sides if it's shorter than length. Padding characters are truncated if they can't be evenly divided by length. +* If the length is less than or equal to the original string's length, or if the padding character is an empty string, the original string is returned unchanged. +* +* @param {string} str - The string to pad. +* @param {number} [length] - The length of the resulting string once padded. +* @param {string} [chars] - The character(s) to use for padding. +* @returns {string} - The padded string, or the original string if padding is not required. +* +* @example +* const result1 = pad('abc', 8); // result will be ' abc ' +* const result2 = pad('abc', 8, '_-'); // result will be '_-abc_-_' +* const result3 = pad('abc', 3); // result will be 'abc' +* const result4 = pad('abc', 2); // result will be 'abc' +* +*/ +function pad(str, length, chars) { + return require_pad.pad(require_toString.toString(str), length, chars); +} +//#endregion +exports.pad = pad; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/pad.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/pad.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f48a6df7c3b68a1d4e6a2767cc109ebe623eacf0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/pad.mjs @@ -0,0 +1,24 @@ +import { pad as pad$1 } from "../../string/pad.mjs"; +import { toString } from "../util/toString.mjs"; +//#region src/compat/string/pad.ts +/** +* Pads string on the left and right sides if it's shorter than length. Padding characters are truncated if they can't be evenly divided by length. +* If the length is less than or equal to the original string's length, or if the padding character is an empty string, the original string is returned unchanged. +* +* @param {string} str - The string to pad. +* @param {number} [length] - The length of the resulting string once padded. +* @param {string} [chars] - The character(s) to use for padding. +* @returns {string} - The padded string, or the original string if padding is not required. +* +* @example +* const result1 = pad('abc', 8); // result will be ' abc ' +* const result2 = pad('abc', 8, '_-'); // result will be '_-abc_-_' +* const result3 = pad('abc', 3); // result will be 'abc' +* const result4 = pad('abc', 2); // result will be 'abc' +* +*/ +function pad(str, length, chars) { + return pad$1(toString(str), length, chars); +} +//#endregion +export { pad }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/padEnd.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/padEnd.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..dd359fc33a19e249b56da44e00695b7861c4e814 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/padEnd.d.mts @@ -0,0 +1,21 @@ +//#region src/compat/string/padEnd.d.ts +/** + * Pads the end of a string with a given character until it reaches the specified length. + * + * If the length is less than or equal to the original string's length, or if the padding character is an empty string, + * the original string is returned unchanged. + * + * @param {string} str - The string to pad. + * @param {number} [length] - The length of the resulting string once padded. + * @param {string} [chars] - The character(s) to use for padding. + * @returns {string} - The padded string, or the original string if padding is not required. + * + * @example + * const result1 = padEnd('abc', 6); // result will be 'abc ' + * const result2 = padEnd('abc', 6, '_-'); // result will be 'abc_-_' + * const result3 = padEnd('abc', 3); // result will be 'abc' + * const result4 = padEnd('abc', 2); // result will be 'abc' + */ +declare function padEnd(str?: string, length?: number, chars?: string): string; +//#endregion +export { padEnd }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/padEnd.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/padEnd.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dd359fc33a19e249b56da44e00695b7861c4e814 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/padEnd.d.ts @@ -0,0 +1,21 @@ +//#region src/compat/string/padEnd.d.ts +/** + * Pads the end of a string with a given character until it reaches the specified length. + * + * If the length is less than or equal to the original string's length, or if the padding character is an empty string, + * the original string is returned unchanged. + * + * @param {string} str - The string to pad. + * @param {number} [length] - The length of the resulting string once padded. + * @param {string} [chars] - The character(s) to use for padding. + * @returns {string} - The padded string, or the original string if padding is not required. + * + * @example + * const result1 = padEnd('abc', 6); // result will be 'abc ' + * const result2 = padEnd('abc', 6, '_-'); // result will be 'abc_-_' + * const result3 = padEnd('abc', 3); // result will be 'abc' + * const result4 = padEnd('abc', 2); // result will be 'abc' + */ +declare function padEnd(str?: string, length?: number, chars?: string): string; +//#endregion +export { padEnd }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/padEnd.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/padEnd.js new file mode 100644 index 0000000000000000000000000000000000000000..49eacf28b35d46dfde62ac05ab0499236e754d9b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/padEnd.js @@ -0,0 +1,24 @@ +const require_toString = require("../util/toString.js"); +//#region src/compat/string/padEnd.ts +/** +* Pads the end of a string with a given character until it reaches the specified length. +* +* If the length is less than or equal to the original string's length, or if the padding character is an empty string, +* the original string is returned unchanged. +* +* @param {string} str - The string to pad. +* @param {number} [length] - The length of the resulting string once padded. +* @param {string} [chars] - The character(s) to use for padding. +* @returns {string} - The padded string, or the original string if padding is not required. +* +* @example +* const result1 = padEnd('abc', 6); // result will be 'abc ' +* const result2 = padEnd('abc', 6, '_-'); // result will be 'abc_-_' +* const result3 = padEnd('abc', 3); // result will be 'abc' +* const result4 = padEnd('abc', 2); // result will be 'abc' +*/ +function padEnd(str, length = 0, chars = " ") { + return require_toString.toString(str).padEnd(length, chars); +} +//#endregion +exports.padEnd = padEnd; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/padEnd.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/padEnd.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f77770173f76612e303e335106529393098d5488 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/padEnd.mjs @@ -0,0 +1,24 @@ +import { toString } from "../util/toString.mjs"; +//#region src/compat/string/padEnd.ts +/** +* Pads the end of a string with a given character until it reaches the specified length. +* +* If the length is less than or equal to the original string's length, or if the padding character is an empty string, +* the original string is returned unchanged. +* +* @param {string} str - The string to pad. +* @param {number} [length] - The length of the resulting string once padded. +* @param {string} [chars] - The character(s) to use for padding. +* @returns {string} - The padded string, or the original string if padding is not required. +* +* @example +* const result1 = padEnd('abc', 6); // result will be 'abc ' +* const result2 = padEnd('abc', 6, '_-'); // result will be 'abc_-_' +* const result3 = padEnd('abc', 3); // result will be 'abc' +* const result4 = padEnd('abc', 2); // result will be 'abc' +*/ +function padEnd(str, length = 0, chars = " ") { + return toString(str).padEnd(length, chars); +} +//#endregion +export { padEnd }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/padStart.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/padStart.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..1632a0c0171a7692c975961d0851f6e93d8ca017 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/padStart.d.mts @@ -0,0 +1,21 @@ +//#region src/compat/string/padStart.d.ts +/** + * Pads the start of a string with a given character until it reaches the specified length. + * + * If the length is less than or equal to the original string's length, or if the padding character is an empty string, + * the original string is returned unchanged. + * + * @param {string} str - The string to pad. + * @param {number} [length] - The length of the resulting string once padded. + * @param {string} [chars] - The character(s) to use for padding. + * @returns {string} - The padded string, or the original string if padding is not required. + * + * @example + * const result1 = padStart('abc', 6); // result will be ' abc' + * const result2 = padStart('abc', 6, '_-'); // result will be '_-_abc' + * const result3 = padStart('abc', 3); // result will be 'abc' + * const result4 = padStart('abc', 2); // result will be 'abc' + */ +declare function padStart(str?: string, length?: number, chars?: string): string; +//#endregion +export { padStart }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/padStart.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/padStart.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1632a0c0171a7692c975961d0851f6e93d8ca017 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/padStart.d.ts @@ -0,0 +1,21 @@ +//#region src/compat/string/padStart.d.ts +/** + * Pads the start of a string with a given character until it reaches the specified length. + * + * If the length is less than or equal to the original string's length, or if the padding character is an empty string, + * the original string is returned unchanged. + * + * @param {string} str - The string to pad. + * @param {number} [length] - The length of the resulting string once padded. + * @param {string} [chars] - The character(s) to use for padding. + * @returns {string} - The padded string, or the original string if padding is not required. + * + * @example + * const result1 = padStart('abc', 6); // result will be ' abc' + * const result2 = padStart('abc', 6, '_-'); // result will be '_-_abc' + * const result3 = padStart('abc', 3); // result will be 'abc' + * const result4 = padStart('abc', 2); // result will be 'abc' + */ +declare function padStart(str?: string, length?: number, chars?: string): string; +//#endregion +export { padStart }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/padStart.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/padStart.js new file mode 100644 index 0000000000000000000000000000000000000000..94457dd39c0690aa681c85a11c5fd49f6c773635 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/padStart.js @@ -0,0 +1,24 @@ +const require_toString = require("../util/toString.js"); +//#region src/compat/string/padStart.ts +/** +* Pads the start of a string with a given character until it reaches the specified length. +* +* If the length is less than or equal to the original string's length, or if the padding character is an empty string, +* the original string is returned unchanged. +* +* @param {string} str - The string to pad. +* @param {number} [length] - The length of the resulting string once padded. +* @param {string} [chars] - The character(s) to use for padding. +* @returns {string} - The padded string, or the original string if padding is not required. +* +* @example +* const result1 = padStart('abc', 6); // result will be ' abc' +* const result2 = padStart('abc', 6, '_-'); // result will be '_-_abc' +* const result3 = padStart('abc', 3); // result will be 'abc' +* const result4 = padStart('abc', 2); // result will be 'abc' +*/ +function padStart(str, length = 0, chars = " ") { + return require_toString.toString(str).padStart(length, chars); +} +//#endregion +exports.padStart = padStart; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/padStart.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/padStart.mjs new file mode 100644 index 0000000000000000000000000000000000000000..8a1962941e1aaccb20029fd1aba5e01932c51533 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/padStart.mjs @@ -0,0 +1,24 @@ +import { toString } from "../util/toString.mjs"; +//#region src/compat/string/padStart.ts +/** +* Pads the start of a string with a given character until it reaches the specified length. +* +* If the length is less than or equal to the original string's length, or if the padding character is an empty string, +* the original string is returned unchanged. +* +* @param {string} str - The string to pad. +* @param {number} [length] - The length of the resulting string once padded. +* @param {string} [chars] - The character(s) to use for padding. +* @returns {string} - The padded string, or the original string if padding is not required. +* +* @example +* const result1 = padStart('abc', 6); // result will be ' abc' +* const result2 = padStart('abc', 6, '_-'); // result will be '_-_abc' +* const result3 = padStart('abc', 3); // result will be 'abc' +* const result4 = padStart('abc', 2); // result will be 'abc' +*/ +function padStart(str, length = 0, chars = " ") { + return toString(str).padStart(length, chars); +} +//#endregion +export { padStart }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/repeat.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/repeat.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b6eb933b0de02de8fd45731c95ff32c1b76756be --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/repeat.d.mts @@ -0,0 +1,18 @@ +//#region src/compat/string/repeat.d.ts +/** + * Repeats the given string n times. + * + * If n is less than 1, an empty string is returned, or if the string is an empty string, + * the original string is returned unchanged. + * + * @param {string} str - The string to repeat. + * @param {number} n - The number of times to repeat the string. + * @returns {string} - The repeated string, or an empty string if n is less than 1. + * + * @example + * repeat('abc', 0); // '' + * repeat('abc', 2); // 'abcabc' + */ +declare function repeat(str?: string, n?: number): string; +//#endregion +export { repeat }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/repeat.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/repeat.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b6eb933b0de02de8fd45731c95ff32c1b76756be --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/repeat.d.ts @@ -0,0 +1,18 @@ +//#region src/compat/string/repeat.d.ts +/** + * Repeats the given string n times. + * + * If n is less than 1, an empty string is returned, or if the string is an empty string, + * the original string is returned unchanged. + * + * @param {string} str - The string to repeat. + * @param {number} n - The number of times to repeat the string. + * @returns {string} - The repeated string, or an empty string if n is less than 1. + * + * @example + * repeat('abc', 0); // '' + * repeat('abc', 2); // 'abcabc' + */ +declare function repeat(str?: string, n?: number): string; +//#endregion +export { repeat }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/repeat.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/repeat.js new file mode 100644 index 0000000000000000000000000000000000000000..7f3f82ca018e1d610336004278c5e234627e328e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/repeat.js @@ -0,0 +1,27 @@ +const require_toInteger = require("../util/toInteger.js"); +const require_toString = require("../util/toString.js"); +const require_isIterateeCall = require("../_internal/isIterateeCall.js"); +const require_MAX_SAFE_INTEGER = require("../_internal/MAX_SAFE_INTEGER.js"); +//#region src/compat/string/repeat.ts +/** +* Repeats the given string n times. +* +* If n is less than 1, an empty string is returned, or if the string is an empty string, +* the original string is returned unchanged. +* +* @param {string} str - The string to repeat. +* @param {number} n - The number of times to repeat the string. +* @returns {string} - The repeated string, or an empty string if n is less than 1. +* +* @example +* repeat('abc', 0); // '' +* repeat('abc', 2); // 'abcabc' +*/ +function repeat(str, n, guard) { + if (guard ? require_isIterateeCall.isIterateeCall(str, n, guard) : n === void 0) n = 1; + else n = require_toInteger.toInteger(n); + if (n < 1 || n > require_MAX_SAFE_INTEGER.MAX_SAFE_INTEGER) return ""; + return require_toString.toString(str).repeat(n); +} +//#endregion +exports.repeat = repeat; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/repeat.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/repeat.mjs new file mode 100644 index 0000000000000000000000000000000000000000..baa43cec814e4ce87208c779f0cec266bfafdd91 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/repeat.mjs @@ -0,0 +1,27 @@ +import { toInteger } from "../util/toInteger.mjs"; +import { toString } from "../util/toString.mjs"; +import { isIterateeCall } from "../_internal/isIterateeCall.mjs"; +import { MAX_SAFE_INTEGER } from "../_internal/MAX_SAFE_INTEGER.mjs"; +//#region src/compat/string/repeat.ts +/** +* Repeats the given string n times. +* +* If n is less than 1, an empty string is returned, or if the string is an empty string, +* the original string is returned unchanged. +* +* @param {string} str - The string to repeat. +* @param {number} n - The number of times to repeat the string. +* @returns {string} - The repeated string, or an empty string if n is less than 1. +* +* @example +* repeat('abc', 0); // '' +* repeat('abc', 2); // 'abcabc' +*/ +function repeat(str, n, guard) { + if (guard ? isIterateeCall(str, n, guard) : n === void 0) n = 1; + else n = toInteger(n); + if (n < 1 || n > MAX_SAFE_INTEGER) return ""; + return toString(str).repeat(n); +} +//#endregion +export { repeat }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/replace.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/replace.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..cf1474ec3cd2111ce6e0305f6a5574d5c3a32c10 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/replace.d.mts @@ -0,0 +1,6 @@ +//#region src/compat/string/replace.d.ts +type ReplaceFunction = (match: string, ...args: any[]) => string; +declare function replace(string: string, pattern: RegExp | string, replacement: ReplaceFunction | string): string; +declare function replace(pattern: RegExp | string, replacement: ReplaceFunction | string): string; +//#endregion +export { replace }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/replace.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/replace.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cf1474ec3cd2111ce6e0305f6a5574d5c3a32c10 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/replace.d.ts @@ -0,0 +1,6 @@ +//#region src/compat/string/replace.d.ts +type ReplaceFunction = (match: string, ...args: any[]) => string; +declare function replace(string: string, pattern: RegExp | string, replacement: ReplaceFunction | string): string; +declare function replace(pattern: RegExp | string, replacement: ReplaceFunction | string): string; +//#endregion +export { replace }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/replace.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/replace.js new file mode 100644 index 0000000000000000000000000000000000000000..356b21e8101d4b9cd1cd96b0e7ea0ddf070b556b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/replace.js @@ -0,0 +1,22 @@ +const require_toString = require("../util/toString.js"); +//#region src/compat/string/replace.ts +/** +* Replaces the matched pattern with the replacement string. +* +* @param {} target - The target string. +* @param {} pattern - The pattern to match. +* @param {} replacement - The replacement string or a function that returns the replacement string. +* @returns {string} The new string with the matched pattern replaced. +* +* @example +* replace('abcde', 'de', '123'); // 'abc123' +* replace('abcde', /[bd]/g, '-'); // 'a-c-e' +* replace('abcde', 'de', substring => substring.toUpperCase()); // 'abcDE' +* replace('abcde', /[bd]/g, substring => substring.toUpperCase()); // 'aBcDe' +*/ +function replace(target, pattern, replacement) { + if (arguments.length < 3) return require_toString.toString(target); + return require_toString.toString(target).replace(pattern, replacement); +} +//#endregion +exports.replace = replace; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/replace.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/replace.mjs new file mode 100644 index 0000000000000000000000000000000000000000..cd73bafd3d6796febf973e469868309b9325a844 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/replace.mjs @@ -0,0 +1,22 @@ +import { toString } from "../util/toString.mjs"; +//#region src/compat/string/replace.ts +/** +* Replaces the matched pattern with the replacement string. +* +* @param {} target - The target string. +* @param {} pattern - The pattern to match. +* @param {} replacement - The replacement string or a function that returns the replacement string. +* @returns {string} The new string with the matched pattern replaced. +* +* @example +* replace('abcde', 'de', '123'); // 'abc123' +* replace('abcde', /[bd]/g, '-'); // 'a-c-e' +* replace('abcde', 'de', substring => substring.toUpperCase()); // 'abcDE' +* replace('abcde', /[bd]/g, substring => substring.toUpperCase()); // 'aBcDe' +*/ +function replace(target, pattern, replacement) { + if (arguments.length < 3) return toString(target); + return toString(target).replace(pattern, replacement); +} +//#endregion +export { replace }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/snakeCase.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/snakeCase.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..b53f50b0475a6a33ed9ac69c2daa62c6d21be818 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/snakeCase.d.mts @@ -0,0 +1,18 @@ +//#region src/compat/string/snakeCase.d.ts +/** + * Converts a string to snake case. + * + * Snake case is the naming convention in which each word is written in lowercase and separated by an underscore (_) character. + * + * @param {string | object} str - The string that is to be changed to snake case. + * @returns {string} - The converted string to snake case. + * + * @example + * const convertedStr1 = snakeCase('camelCase') // returns 'camel_case' + * const convertedStr2 = snakeCase('some whitespace') // returns 'some_whitespace' + * const convertedStr3 = snakeCase('hyphen-text') // returns 'hyphen_text' + * const convertedStr4 = snakeCase('HTTPRequest') // returns 'http_request' + */ +declare function snakeCase(str?: string): string; +//#endregion +export { snakeCase }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/snakeCase.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/snakeCase.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b53f50b0475a6a33ed9ac69c2daa62c6d21be818 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/snakeCase.d.ts @@ -0,0 +1,18 @@ +//#region src/compat/string/snakeCase.d.ts +/** + * Converts a string to snake case. + * + * Snake case is the naming convention in which each word is written in lowercase and separated by an underscore (_) character. + * + * @param {string | object} str - The string that is to be changed to snake case. + * @returns {string} - The converted string to snake case. + * + * @example + * const convertedStr1 = snakeCase('camelCase') // returns 'camel_case' + * const convertedStr2 = snakeCase('some whitespace') // returns 'some_whitespace' + * const convertedStr3 = snakeCase('hyphen-text') // returns 'hyphen_text' + * const convertedStr4 = snakeCase('HTTPRequest') // returns 'http_request' + */ +declare function snakeCase(str?: string): string; +//#endregion +export { snakeCase }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/snakeCase.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/snakeCase.js new file mode 100644 index 0000000000000000000000000000000000000000..58369e95ca4a145afb7e1cd2d9669a32e42b0e27 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/snakeCase.js @@ -0,0 +1,23 @@ +const require_snakeCase = require("../../string/snakeCase.js"); +const require_deburr = require("./deburr.js"); +const require_normalizeForCase = require("../_internal/normalizeForCase.js"); +//#region src/compat/string/snakeCase.ts +/** +* Converts a string to snake case. +* +* Snake case is the naming convention in which each word is written in lowercase and separated by an underscore (_) character. +* +* @param {string | object} str - The string that is to be changed to snake case. +* @returns {string} - The converted string to snake case. +* +* @example +* const convertedStr1 = snakeCase('camelCase') // returns 'camel_case' +* const convertedStr2 = snakeCase('some whitespace') // returns 'some_whitespace' +* const convertedStr3 = snakeCase('hyphen-text') // returns 'hyphen_text' +* const convertedStr4 = snakeCase('HTTPRequest') // returns 'http_request' +*/ +function snakeCase(str) { + return require_snakeCase.snakeCase(require_normalizeForCase.normalizeForCase(require_deburr.deburr(str))); +} +//#endregion +exports.snakeCase = snakeCase; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/snakeCase.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/snakeCase.mjs new file mode 100644 index 0000000000000000000000000000000000000000..02e19ee536194a178a7e3dc22259a780af02f8b9 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/snakeCase.mjs @@ -0,0 +1,23 @@ +import { snakeCase as snakeCase$1 } from "../../string/snakeCase.mjs"; +import { deburr } from "./deburr.mjs"; +import { normalizeForCase } from "../_internal/normalizeForCase.mjs"; +//#region src/compat/string/snakeCase.ts +/** +* Converts a string to snake case. +* +* Snake case is the naming convention in which each word is written in lowercase and separated by an underscore (_) character. +* +* @param {string | object} str - The string that is to be changed to snake case. +* @returns {string} - The converted string to snake case. +* +* @example +* const convertedStr1 = snakeCase('camelCase') // returns 'camel_case' +* const convertedStr2 = snakeCase('some whitespace') // returns 'some_whitespace' +* const convertedStr3 = snakeCase('hyphen-text') // returns 'hyphen_text' +* const convertedStr4 = snakeCase('HTTPRequest') // returns 'http_request' +*/ +function snakeCase(str) { + return snakeCase$1(normalizeForCase(deburr(str))); +} +//#endregion +export { snakeCase }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/split.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/split.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0c9a2d2755b706ac6c26d39b3fcfd2409dbdd4d3 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/split.d.mts @@ -0,0 +1,37 @@ +//#region src/compat/string/split.d.ts +/** + * Splits the input string by the specified `separator` + * and returns a new array containing the split segments. + * + * @param {string | null | undefined} [string=''] The string to split. + * @param {RegExp|string} [separator] The separator pattern to split by. + * @param {number} [limit] The length to truncate results to. + * @returns {Array} Returns the string segments. + * + * @example + * split('a-b-c', '-'); + * // => ['a', 'b', 'c'] + * + * split('a-b-c', '-', 2); + * // => ['a', 'b'] + */ +declare function split(string: string | null | undefined, separator?: RegExp | string, limit?: number): string[]; +/** + * Splits the input string by the specified `separator` + * and returns a new array containing the split segments. + * + * @param {string | null | undefined} [string=''] The string to split. + * @param {RegExp|string} [separator] The separator pattern to split by. + * @param {number} [limit] The length to truncate results to. + * @returns {Array} Returns the string segments. + * + * @example + * split('a-b-c', '-'); + * // => ['a', 'b', 'c'] + * + * split('a-b-c', '-', 2); + * // => ['a', 'b'] + */ +declare function split(string: string | null | undefined, index: string | number, guard: object): string[]; +//#endregion +export { split }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/split.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/split.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0c9a2d2755b706ac6c26d39b3fcfd2409dbdd4d3 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/split.d.ts @@ -0,0 +1,37 @@ +//#region src/compat/string/split.d.ts +/** + * Splits the input string by the specified `separator` + * and returns a new array containing the split segments. + * + * @param {string | null | undefined} [string=''] The string to split. + * @param {RegExp|string} [separator] The separator pattern to split by. + * @param {number} [limit] The length to truncate results to. + * @returns {Array} Returns the string segments. + * + * @example + * split('a-b-c', '-'); + * // => ['a', 'b', 'c'] + * + * split('a-b-c', '-', 2); + * // => ['a', 'b'] + */ +declare function split(string: string | null | undefined, separator?: RegExp | string, limit?: number): string[]; +/** + * Splits the input string by the specified `separator` + * and returns a new array containing the split segments. + * + * @param {string | null | undefined} [string=''] The string to split. + * @param {RegExp|string} [separator] The separator pattern to split by. + * @param {number} [limit] The length to truncate results to. + * @returns {Array} Returns the string segments. + * + * @example + * split('a-b-c', '-'); + * // => ['a', 'b', 'c'] + * + * split('a-b-c', '-', 2); + * // => ['a', 'b'] + */ +declare function split(string: string | null | undefined, index: string | number, guard: object): string[]; +//#endregion +export { split }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/split.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/split.js new file mode 100644 index 0000000000000000000000000000000000000000..3b2d329dc165719fd39ea0a3025e5cdc1d3ada52 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/split.js @@ -0,0 +1,7 @@ +const require_toString = require("../util/toString.js"); +//#region src/compat/string/split.ts +function split(string, separator, limit) { + return require_toString.toString(string).split(separator, limit); +} +//#endregion +exports.split = split; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/split.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/split.mjs new file mode 100644 index 0000000000000000000000000000000000000000..455c394862fdac463636aeacb0afc3ba550ae97b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/split.mjs @@ -0,0 +1,7 @@ +import { toString } from "../util/toString.mjs"; +//#region src/compat/string/split.ts +function split(string, separator, limit) { + return toString(string).split(separator, limit); +} +//#endregion +export { split }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/startCase.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/startCase.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..3f63e7936b007b42a3108f6aa19aefa363a178c6 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/startCase.d.mts @@ -0,0 +1,17 @@ +//#region src/compat/string/startCase.d.ts +/** + * Converts the first character of each word in a string to uppercase and the remaining characters to lowercase. + * + * Start case is the naming convention in which each word is written with an initial capital letter. + * @param {string | object} str - The string to convert. + * @returns {string} The converted string. + * + * @example + * const result1 = startCase('hello world'); // result will be 'Hello World' + * const result2 = startCase('HELLO WORLD'); // result will be 'HELLO WORLD' + * const result3 = startCase('hello-world'); // result will be 'Hello World' + * const result4 = startCase('hello_world'); // result will be 'Hello World' + */ +declare function startCase(str?: string): string; +//#endregion +export { startCase }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/startCase.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/startCase.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3f63e7936b007b42a3108f6aa19aefa363a178c6 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/startCase.d.ts @@ -0,0 +1,17 @@ +//#region src/compat/string/startCase.d.ts +/** + * Converts the first character of each word in a string to uppercase and the remaining characters to lowercase. + * + * Start case is the naming convention in which each word is written with an initial capital letter. + * @param {string | object} str - The string to convert. + * @returns {string} The converted string. + * + * @example + * const result1 = startCase('hello world'); // result will be 'Hello World' + * const result2 = startCase('HELLO WORLD'); // result will be 'HELLO WORLD' + * const result3 = startCase('hello-world'); // result will be 'Hello World' + * const result4 = startCase('hello_world'); // result will be 'Hello World' + */ +declare function startCase(str?: string): string; +//#endregion +export { startCase }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/startCase.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/startCase.js new file mode 100644 index 0000000000000000000000000000000000000000..00d7fdaf5efd37e13c3e08cdcd4377b9e861cb9f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/startCase.js @@ -0,0 +1,30 @@ +const require_words = require("../../string/words.js"); +const require_deburr = require("./deburr.js"); +const require_normalizeForCase = require("../_internal/normalizeForCase.js"); +//#region src/compat/string/startCase.ts +/** +* Converts the first character of each word in a string to uppercase and the remaining characters to lowercase. +* +* Start case is the naming convention in which each word is written with an initial capital letter. +* @param {string | object} str - The string to convert. +* @returns {string} The converted string. +* +* @example +* const result1 = startCase('hello world'); // result will be 'Hello World' +* const result2 = startCase('HELLO WORLD'); // result will be 'HELLO WORLD' +* const result3 = startCase('hello-world'); // result will be 'Hello World' +* const result4 = startCase('hello_world'); // result will be 'Hello World' +*/ +function startCase(str) { + const words$1 = require_words.words(require_normalizeForCase.normalizeForCase(require_deburr.deburr(str)).trim()); + let result = ""; + for (let i = 0; i < words$1.length; i++) { + const word = words$1[i]; + if (result) result += " "; + if (word === word.toUpperCase()) result += word; + else result += word[0].toUpperCase() + word.slice(1).toLowerCase(); + } + return result; +} +//#endregion +exports.startCase = startCase; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/startCase.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/startCase.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f98f2fc8ce5aeca03af96eb155512b9420fbe808 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/startCase.mjs @@ -0,0 +1,30 @@ +import { words } from "../../string/words.mjs"; +import { deburr } from "./deburr.mjs"; +import { normalizeForCase } from "../_internal/normalizeForCase.mjs"; +//#region src/compat/string/startCase.ts +/** +* Converts the first character of each word in a string to uppercase and the remaining characters to lowercase. +* +* Start case is the naming convention in which each word is written with an initial capital letter. +* @param {string | object} str - The string to convert. +* @returns {string} The converted string. +* +* @example +* const result1 = startCase('hello world'); // result will be 'Hello World' +* const result2 = startCase('HELLO WORLD'); // result will be 'HELLO WORLD' +* const result3 = startCase('hello-world'); // result will be 'Hello World' +* const result4 = startCase('hello_world'); // result will be 'Hello World' +*/ +function startCase(str) { + const words$1 = words(normalizeForCase(deburr(str)).trim()); + let result = ""; + for (let i = 0; i < words$1.length; i++) { + const word = words$1[i]; + if (result) result += " "; + if (word === word.toUpperCase()) result += word; + else result += word[0].toUpperCase() + word.slice(1).toLowerCase(); + } + return result; +} +//#endregion +export { startCase }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/startsWith.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/startsWith.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..ee3ac837da49a66689b387c681d1e4f82dbb3c3e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/startsWith.d.mts @@ -0,0 +1,21 @@ +//#region src/compat/string/startsWith.d.ts +/** + * Checks if a string contains another string at the beginning of the string. + * + * Checks if one string startsWith another string. Optional position parameter to start searching from a certain index. + * + * @param {string} str - The string that might contain the target string. + * @param {string} target - The string to search for. + * @param {number} position - An optional offset to start searching in the str string + * @returns {boolean} - True if the str string starts with the target string. + * + * @example + * const isPrefix = startsWith('fooBar', 'foo') // returns true + * const isPrefix = startsWith('fooBar', 'bar') // returns false + * const isPrefix = startsWith('fooBar', 'abc') // returns false + * const isPrefix = startsWith('fooBar', 'Bar', 2) // returns true + * const isPrefix = startsWith('fooBar', 'Bar', 5) // returns false + */ +declare function startsWith(str?: string, target?: string, position?: number): boolean; +//#endregion +export { startsWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/startsWith.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/startsWith.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ee3ac837da49a66689b387c681d1e4f82dbb3c3e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/startsWith.d.ts @@ -0,0 +1,21 @@ +//#region src/compat/string/startsWith.d.ts +/** + * Checks if a string contains another string at the beginning of the string. + * + * Checks if one string startsWith another string. Optional position parameter to start searching from a certain index. + * + * @param {string} str - The string that might contain the target string. + * @param {string} target - The string to search for. + * @param {number} position - An optional offset to start searching in the str string + * @returns {boolean} - True if the str string starts with the target string. + * + * @example + * const isPrefix = startsWith('fooBar', 'foo') // returns true + * const isPrefix = startsWith('fooBar', 'bar') // returns false + * const isPrefix = startsWith('fooBar', 'abc') // returns false + * const isPrefix = startsWith('fooBar', 'Bar', 2) // returns true + * const isPrefix = startsWith('fooBar', 'Bar', 5) // returns false + */ +declare function startsWith(str?: string, target?: string, position?: number): boolean; +//#endregion +export { startsWith }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/startsWith.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/startsWith.js new file mode 100644 index 0000000000000000000000000000000000000000..4f05cd3b8257bb98bffae8d13c3b398c9fd6af9f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/startsWith.js @@ -0,0 +1,25 @@ +//#region src/compat/string/startsWith.ts +/** +* Checks if a string contains another string at the beginning of the string. +* +* Checks if one string startsWith another string. Optional position parameter to start searching from a certain index. +* +* @param {string} str - The string that might contain the target string. +* @param {string} target - The string to search for. +* @param {number} position - An optional offset to start searching in the str string +* @returns {boolean} - True if the str string starts with the target string. +* +* @example +* const isPrefix = startsWith('fooBar', 'foo') // returns true +* const isPrefix = startsWith('fooBar', 'bar') // returns false +* const isPrefix = startsWith('fooBar', 'abc') // returns false +* const isPrefix = startsWith('fooBar', 'Bar', 2) // returns true +* const isPrefix = startsWith('fooBar', 'Bar', 5) // returns false +*/ +function startsWith(str, target, position) { + if (str == null || target == null) return false; + if (position == null) position = 0; + return str.startsWith(target, position); +} +//#endregion +exports.startsWith = startsWith; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/startsWith.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/startsWith.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3790efc77704bacaa4380fcace7fd73479c110dd --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/startsWith.mjs @@ -0,0 +1,25 @@ +//#region src/compat/string/startsWith.ts +/** +* Checks if a string contains another string at the beginning of the string. +* +* Checks if one string startsWith another string. Optional position parameter to start searching from a certain index. +* +* @param {string} str - The string that might contain the target string. +* @param {string} target - The string to search for. +* @param {number} position - An optional offset to start searching in the str string +* @returns {boolean} - True if the str string starts with the target string. +* +* @example +* const isPrefix = startsWith('fooBar', 'foo') // returns true +* const isPrefix = startsWith('fooBar', 'bar') // returns false +* const isPrefix = startsWith('fooBar', 'abc') // returns false +* const isPrefix = startsWith('fooBar', 'Bar', 2) // returns true +* const isPrefix = startsWith('fooBar', 'Bar', 5) // returns false +*/ +function startsWith(str, target, position) { + if (str == null || target == null) return false; + if (position == null) position = 0; + return str.startsWith(target, position); +} +//#endregion +export { startsWith }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/template.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/template.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6e2dec2fa12bc501d19a5036ed1e169f4e6de9e8 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/template.d.mts @@ -0,0 +1,30 @@ +import { escape } from "./escape.mjs"; + +//#region src/compat/string/template.d.ts +declare const templateSettings: { + escape: RegExp; + evaluate: RegExp; + interpolate: RegExp; + variable: string; + imports: { + _: { + escape: typeof escape; + template: typeof template; + }; + }; +}; +interface TemplateOptions { + escape?: RegExp | null | undefined; + evaluate?: RegExp | null | undefined; + interpolate?: RegExp | null | undefined; + variable?: string | undefined; + imports?: Record | undefined; + sourceURL?: string; +} +interface TemplateExecutor { + (data?: object): string; + source: string; +} +declare function template(string?: string, options?: TemplateOptions): TemplateExecutor; +//#endregion +export { template, templateSettings }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/template.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/template.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b9d03406ead4baf661dc3338c28849ba287b2930 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/template.d.ts @@ -0,0 +1,30 @@ +import { escape } from "./escape.js"; + +//#region src/compat/string/template.d.ts +declare const templateSettings: { + escape: RegExp; + evaluate: RegExp; + interpolate: RegExp; + variable: string; + imports: { + _: { + escape: typeof escape; + template: typeof template; + }; + }; +}; +interface TemplateOptions { + escape?: RegExp | null | undefined; + evaluate?: RegExp | null | undefined; + interpolate?: RegExp | null | undefined; + variable?: string | undefined; + imports?: Record | undefined; + sourceURL?: string; +} +interface TemplateExecutor { + (data?: object): string; + source: string; +} +declare function template(string?: string, options?: TemplateOptions): TemplateExecutor; +//#endregion +export { template, templateSettings }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/template.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/template.js new file mode 100644 index 0000000000000000000000000000000000000000..3ba6d980e585106fcf2cd51d8bbde59a9c0422c2 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/template.js @@ -0,0 +1,138 @@ +const require_toString = require("../util/toString.js"); +const require_attempt = require("../function/attempt.js"); +const require_defaults = require("../object/defaults.js"); +const require_escape = require("./escape.js"); +//#region src/compat/string/template.ts +const esTemplateRegExp = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; +const unEscapedRegExp = /['\n\r\u2028\u2029\\]/g; +const noMatchExp = /($^)/; +const escapeMap = new Map([ + ["\\", "\\"], + ["'", "'"], + ["\n", "n"], + ["\r", "r"], + ["\u2028", "u2028"], + ["\u2029", "u2029"] +]); +function escapeString(match) { + return `\\${escapeMap.get(match)}`; +} +const defaultInterpolateRegExp = /<%=([\s\S]+?)%>/g; +const templateSettings = { + escape: /<%-([\s\S]+?)%>/g, + evaluate: /<%([\s\S]+?)%>/g, + interpolate: defaultInterpolateRegExp, + variable: "", + imports: { _: { + escape: require_escape.escape, + template + } } +}; +/** +* Compiles a template string into a function that can interpolate data properties. +* +* This function allows you to create a template with custom delimiters for escaping, +* evaluating, and interpolating values. It can also handle custom variable names and +* imported functions. +* +* @param {string} string - The template string. +* @param {TemplateOptions} [options] - The options object. +* @param {RegExp | null | undefined} [options.escape] - The regular expression for "escape" delimiter. +* @param {RegExp | null | undefined} [options.evaluate] - The regular expression for "evaluate" delimiter. +* @param {RegExp | null | undefined} [options.interpolate] - The regular expression for "interpolate" delimiter. +* @param {string | undefined} [options.variable] - The data object variable name. +* @param {Record | undefined} [options.imports] - The object of imported functions. +* @param {string | undefined} [options.sourceURL] - The source URL of the template. +* @param {object} [guard] - The guard to detect if the function is called with `options`. +* @returns {TemplateExecutor} Returns the compiled template function. +* +* @example +* // Use the "escape" delimiter to escape data properties. +* const compiled = template('<%- value %>'); +* compiled({ value: '
' }); // returns '<div>' +* +* @example +* // Use the "interpolate" delimiter to interpolate data properties. +* const compiled = template('<%= value %>'); +* compiled({ value: 'Hello, World!' }); // returns 'Hello, World!' +* +* @example +* // Use the "evaluate" delimiter to evaluate JavaScript code. +* const compiled = template('<% if (value) { %>Yes<% } else { %>No<% } %>'); +* compiled({ value: true }); // returns 'Yes' +* +* @example +* // Use the "variable" option to specify the data object variable name. +* const compiled = template('<%= data.value %>', { variable: 'data' }); +* compiled({ value: 'Hello, World!' }); // returns 'Hello, World!' +* +* @example +* // Use the "imports" option to import functions. +* const compiled = template('<%= _.toUpper(value) %>', { imports: { _: { toUpper } } }); +* compiled({ value: 'hello, world!' }); // returns 'HELLO, WORLD!' +* +* @example +* // Use the custom "escape" delimiter. +* const compiled = template('<@ value @>', { escape: /<@([\s\S]+?)@>/g }); +* compiled({ value: '
' }); // returns '<div>' +* +* @example +* // Use the custom "evaluate" delimiter. +* const compiled = template('<# if (value) { #>Yes<# } else { #>No<# } #>', { evaluate: /<#([\s\S]+?)#>/g }); +* compiled({ value: true }); // returns 'Yes' +* +* @example +* // Use the custom "interpolate" delimiter. +* const compiled = template('<$ value $>', { interpolate: /<\$([\s\S]+?)\$>/g }); +* compiled({ value: 'Hello, World!' }); // returns 'Hello, World!' +* +* @example +* // Use the "sourceURL" option to specify the source URL of the template. +* const compiled = template('hello <%= user %>!', { sourceURL: 'template.js' }); +*/ +function template(string, options, guard) { + string = require_toString.toString(string); + if (guard) options = templateSettings; + options = require_defaults.defaults({ ...options }, templateSettings); + const delimitersRegExp = new RegExp([ + options.escape?.source ?? noMatchExp.source, + options.interpolate?.source ?? noMatchExp.source, + options.interpolate === defaultInterpolateRegExp ? esTemplateRegExp.source : noMatchExp.source, + options.evaluate?.source ?? noMatchExp.source, + "$" + ].join("|"), "g"); + let lastIndex = 0; + let isEvaluated = false; + let source = `__p += ''`; + for (const match of string.matchAll(delimitersRegExp)) { + const [fullMatch, escapeValue, interpolateValue, esTemplateValue, evaluateValue] = match; + const { index } = match; + source += ` + '${string.slice(lastIndex, index).replace(unEscapedRegExp, escapeString)}'`; + if (escapeValue) source += ` + _.escape(${escapeValue})`; + if (interpolateValue) source += ` + ((${interpolateValue}) == null ? '' : ${interpolateValue})`; + else if (esTemplateValue) source += ` + ((${esTemplateValue}) == null ? '' : ${esTemplateValue})`; + if (evaluateValue) { + source += `;\n${evaluateValue};\n __p += ''`; + isEvaluated = true; + } + lastIndex = index + fullMatch.length; + } + const imports = require_defaults.defaults({ ...options.imports }, templateSettings.imports); + const importsKeys = Object.keys(imports); + const importValues = Object.values(imports); + const sourceURL = `//# sourceURL=${options.sourceURL ? String(options.sourceURL).replace(/[\r\n]/g, " ") : `es-toolkit.templateSource[${Date.now()}]`}\n`; + const compiledFunction = `function(${options.variable || "obj"}) { + let __p = ''; + ${options.variable ? "" : "if (obj == null) { obj = {}; }"} + ${isEvaluated ? `function print() { __p += Array.prototype.join.call(arguments, ''); }` : ""} + ${options.variable ? source : `with(obj) {\n${source}\n}`} + return __p; + }`; + const result = require_attempt.attempt(() => new Function(...importsKeys, `${sourceURL}return ${compiledFunction}`)(...importValues)); + result.source = compiledFunction; + if (result instanceof Error) throw result; + return result; +} +//#endregion +exports.template = template; +exports.templateSettings = templateSettings; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/template.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/template.mjs new file mode 100644 index 0000000000000000000000000000000000000000..00fd1bc059520455e267e13afd37e26536bb0d9f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/template.mjs @@ -0,0 +1,137 @@ +import { toString } from "../util/toString.mjs"; +import { attempt } from "../function/attempt.mjs"; +import { defaults } from "../object/defaults.mjs"; +import { escape } from "./escape.mjs"; +//#region src/compat/string/template.ts +const esTemplateRegExp = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; +const unEscapedRegExp = /['\n\r\u2028\u2029\\]/g; +const noMatchExp = /($^)/; +const escapeMap = new Map([ + ["\\", "\\"], + ["'", "'"], + ["\n", "n"], + ["\r", "r"], + ["\u2028", "u2028"], + ["\u2029", "u2029"] +]); +function escapeString(match) { + return `\\${escapeMap.get(match)}`; +} +const defaultInterpolateRegExp = /<%=([\s\S]+?)%>/g; +const templateSettings = { + escape: /<%-([\s\S]+?)%>/g, + evaluate: /<%([\s\S]+?)%>/g, + interpolate: defaultInterpolateRegExp, + variable: "", + imports: { _: { + escape, + template + } } +}; +/** +* Compiles a template string into a function that can interpolate data properties. +* +* This function allows you to create a template with custom delimiters for escaping, +* evaluating, and interpolating values. It can also handle custom variable names and +* imported functions. +* +* @param {string} string - The template string. +* @param {TemplateOptions} [options] - The options object. +* @param {RegExp | null | undefined} [options.escape] - The regular expression for "escape" delimiter. +* @param {RegExp | null | undefined} [options.evaluate] - The regular expression for "evaluate" delimiter. +* @param {RegExp | null | undefined} [options.interpolate] - The regular expression for "interpolate" delimiter. +* @param {string | undefined} [options.variable] - The data object variable name. +* @param {Record | undefined} [options.imports] - The object of imported functions. +* @param {string | undefined} [options.sourceURL] - The source URL of the template. +* @param {object} [guard] - The guard to detect if the function is called with `options`. +* @returns {TemplateExecutor} Returns the compiled template function. +* +* @example +* // Use the "escape" delimiter to escape data properties. +* const compiled = template('<%- value %>'); +* compiled({ value: '
' }); // returns '<div>' +* +* @example +* // Use the "interpolate" delimiter to interpolate data properties. +* const compiled = template('<%= value %>'); +* compiled({ value: 'Hello, World!' }); // returns 'Hello, World!' +* +* @example +* // Use the "evaluate" delimiter to evaluate JavaScript code. +* const compiled = template('<% if (value) { %>Yes<% } else { %>No<% } %>'); +* compiled({ value: true }); // returns 'Yes' +* +* @example +* // Use the "variable" option to specify the data object variable name. +* const compiled = template('<%= data.value %>', { variable: 'data' }); +* compiled({ value: 'Hello, World!' }); // returns 'Hello, World!' +* +* @example +* // Use the "imports" option to import functions. +* const compiled = template('<%= _.toUpper(value) %>', { imports: { _: { toUpper } } }); +* compiled({ value: 'hello, world!' }); // returns 'HELLO, WORLD!' +* +* @example +* // Use the custom "escape" delimiter. +* const compiled = template('<@ value @>', { escape: /<@([\s\S]+?)@>/g }); +* compiled({ value: '
' }); // returns '<div>' +* +* @example +* // Use the custom "evaluate" delimiter. +* const compiled = template('<# if (value) { #>Yes<# } else { #>No<# } #>', { evaluate: /<#([\s\S]+?)#>/g }); +* compiled({ value: true }); // returns 'Yes' +* +* @example +* // Use the custom "interpolate" delimiter. +* const compiled = template('<$ value $>', { interpolate: /<\$([\s\S]+?)\$>/g }); +* compiled({ value: 'Hello, World!' }); // returns 'Hello, World!' +* +* @example +* // Use the "sourceURL" option to specify the source URL of the template. +* const compiled = template('hello <%= user %>!', { sourceURL: 'template.js' }); +*/ +function template(string, options, guard) { + string = toString(string); + if (guard) options = templateSettings; + options = defaults({ ...options }, templateSettings); + const delimitersRegExp = new RegExp([ + options.escape?.source ?? noMatchExp.source, + options.interpolate?.source ?? noMatchExp.source, + options.interpolate === defaultInterpolateRegExp ? esTemplateRegExp.source : noMatchExp.source, + options.evaluate?.source ?? noMatchExp.source, + "$" + ].join("|"), "g"); + let lastIndex = 0; + let isEvaluated = false; + let source = `__p += ''`; + for (const match of string.matchAll(delimitersRegExp)) { + const [fullMatch, escapeValue, interpolateValue, esTemplateValue, evaluateValue] = match; + const { index } = match; + source += ` + '${string.slice(lastIndex, index).replace(unEscapedRegExp, escapeString)}'`; + if (escapeValue) source += ` + _.escape(${escapeValue})`; + if (interpolateValue) source += ` + ((${interpolateValue}) == null ? '' : ${interpolateValue})`; + else if (esTemplateValue) source += ` + ((${esTemplateValue}) == null ? '' : ${esTemplateValue})`; + if (evaluateValue) { + source += `;\n${evaluateValue};\n __p += ''`; + isEvaluated = true; + } + lastIndex = index + fullMatch.length; + } + const imports = defaults({ ...options.imports }, templateSettings.imports); + const importsKeys = Object.keys(imports); + const importValues = Object.values(imports); + const sourceURL = `//# sourceURL=${options.sourceURL ? String(options.sourceURL).replace(/[\r\n]/g, " ") : `es-toolkit.templateSource[${Date.now()}]`}\n`; + const compiledFunction = `function(${options.variable || "obj"}) { + let __p = ''; + ${options.variable ? "" : "if (obj == null) { obj = {}; }"} + ${isEvaluated ? `function print() { __p += Array.prototype.join.call(arguments, ''); }` : ""} + ${options.variable ? source : `with(obj) {\n${source}\n}`} + return __p; + }`; + const result = attempt(() => new Function(...importsKeys, `${sourceURL}return ${compiledFunction}`)(...importValues)); + result.source = compiledFunction; + if (result instanceof Error) throw result; + return result; +} +//#endregion +export { template, templateSettings }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/templateSettings.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/templateSettings.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..d0b6499b461ff2df374de23aa094d9a3d3414084 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/templateSettings.d.mts @@ -0,0 +1 @@ +import { templateSettings } from "./template.mjs"; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/templateSettings.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/templateSettings.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..63e72273c7ad83e996aa093343a5009337dec986 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/templateSettings.d.ts @@ -0,0 +1 @@ +import { templateSettings } from "./template.js"; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/templateSettings.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/templateSettings.js new file mode 100644 index 0000000000000000000000000000000000000000..49d035734d63b85329bc2ec75c47029d20633064 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/templateSettings.js @@ -0,0 +1 @@ +require("./template.js"); diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/templateSettings.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/templateSettings.mjs new file mode 100644 index 0000000000000000000000000000000000000000..e9c173aa5f1f051bbff72d226b656c2fb1332e9f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/templateSettings.mjs @@ -0,0 +1 @@ +import "./template.mjs"; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/toLower.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/toLower.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6d99497ff539c43613f585f73f6d0a9b3bb02e9c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/toLower.d.mts @@ -0,0 +1,21 @@ +//#region src/compat/string/toLower.d.ts +/** + * Converts the given value to a string and transforms it to lower case. + * The function can handle various input types by first converting them to strings. + * + * @param {unknown} [value=''] The value to convert. + * @returns {string} Returns the lower cased string. + * @example + * + * toLower('--FOO-BAR--'); + * // => '--foo-bar--' + * + * toLower(null); + * // => '' + * + * toLower([1, 2, 3]); + * // => '1,2,3' + */ +declare function toLower(value?: T): Lowercase; +//#endregion +export { toLower }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/toLower.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/toLower.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6d99497ff539c43613f585f73f6d0a9b3bb02e9c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/toLower.d.ts @@ -0,0 +1,21 @@ +//#region src/compat/string/toLower.d.ts +/** + * Converts the given value to a string and transforms it to lower case. + * The function can handle various input types by first converting them to strings. + * + * @param {unknown} [value=''] The value to convert. + * @returns {string} Returns the lower cased string. + * @example + * + * toLower('--FOO-BAR--'); + * // => '--foo-bar--' + * + * toLower(null); + * // => '' + * + * toLower([1, 2, 3]); + * // => '1,2,3' + */ +declare function toLower(value?: T): Lowercase; +//#endregion +export { toLower }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/toLower.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/toLower.js new file mode 100644 index 0000000000000000000000000000000000000000..33c2898cd2bfcd6620d1a42c9df0958c66c8f8ce --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/toLower.js @@ -0,0 +1,24 @@ +const require_toString = require("../util/toString.js"); +//#region src/compat/string/toLower.ts +/** +* Converts the given value to a string and transforms it to lower case. +* The function can handle various input types by first converting them to strings. +* +* @param {unknown} [value=''] The value to convert. +* @returns {string} Returns the lower cased string. +* @example +* +* toLower('--FOO-BAR--'); +* // => '--foo-bar--' +* +* toLower(null); +* // => '' +* +* toLower([1, 2, 3]); +* // => '1,2,3' +*/ +function toLower(value) { + return require_toString.toString(value).toLowerCase(); +} +//#endregion +exports.toLower = toLower; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/toLower.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/toLower.mjs new file mode 100644 index 0000000000000000000000000000000000000000..3871bbc6eea90f3095902d5e22372abd1a3e099c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/toLower.mjs @@ -0,0 +1,24 @@ +import { toString } from "../util/toString.mjs"; +//#region src/compat/string/toLower.ts +/** +* Converts the given value to a string and transforms it to lower case. +* The function can handle various input types by first converting them to strings. +* +* @param {unknown} [value=''] The value to convert. +* @returns {string} Returns the lower cased string. +* @example +* +* toLower('--FOO-BAR--'); +* // => '--foo-bar--' +* +* toLower(null); +* // => '' +* +* toLower([1, 2, 3]); +* // => '1,2,3' +*/ +function toLower(value) { + return toString(value).toLowerCase(); +} +//#endregion +export { toLower }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/toUpper.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/toUpper.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..69e29d7095eaad269c55504de2cc4db54032bd74 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/toUpper.d.mts @@ -0,0 +1,21 @@ +//#region src/compat/string/toUpper.d.ts +/** + * Converts `string`, as a whole, to upper case just like + * [String#toUpperCase](https://mdn.io/toUpperCase). + * + * @param {unknown} [value=''] The value to convert. + * @returns {string} Returns the upper cased string. + * @example + * + * toUpper('--foo-bar--'); + * // => '--FOO-BAR--' + * + * toUpper(null); + * // => '' + * + * toUpper([1, 2, 3]); + * // => '1,2,3' + */ +declare function toUpper(value?: T): Uppercase; +//#endregion +export { toUpper }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/toUpper.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/toUpper.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..69e29d7095eaad269c55504de2cc4db54032bd74 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/toUpper.d.ts @@ -0,0 +1,21 @@ +//#region src/compat/string/toUpper.d.ts +/** + * Converts `string`, as a whole, to upper case just like + * [String#toUpperCase](https://mdn.io/toUpperCase). + * + * @param {unknown} [value=''] The value to convert. + * @returns {string} Returns the upper cased string. + * @example + * + * toUpper('--foo-bar--'); + * // => '--FOO-BAR--' + * + * toUpper(null); + * // => '' + * + * toUpper([1, 2, 3]); + * // => '1,2,3' + */ +declare function toUpper(value?: T): Uppercase; +//#endregion +export { toUpper }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/toUpper.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/toUpper.js new file mode 100644 index 0000000000000000000000000000000000000000..6e0aec6a7806ec9ff80fbde839e74324ad5ffc21 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/toUpper.js @@ -0,0 +1,24 @@ +const require_toString = require("../util/toString.js"); +//#region src/compat/string/toUpper.ts +/** +* Converts `string`, as a whole, to upper case just like +* [String#toUpperCase](https://mdn.io/toUpperCase). +* +* @param {unknown} [value=''] The value to convert. +* @returns {string} Returns the upper cased string. +* @example +* +* toUpper('--foo-bar--'); +* // => '--FOO-BAR--' +* +* toUpper(null); +* // => '' +* +* toUpper([1, 2, 3]); +* // => '1,2,3' +*/ +function toUpper(value) { + return require_toString.toString(value).toUpperCase(); +} +//#endregion +exports.toUpper = toUpper; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/toUpper.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/toUpper.mjs new file mode 100644 index 0000000000000000000000000000000000000000..96561e212ffc0b7b2941d820ceb20fbe73395b05 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/toUpper.mjs @@ -0,0 +1,24 @@ +import { toString } from "../util/toString.mjs"; +//#region src/compat/string/toUpper.ts +/** +* Converts `string`, as a whole, to upper case just like +* [String#toUpperCase](https://mdn.io/toUpperCase). +* +* @param {unknown} [value=''] The value to convert. +* @returns {string} Returns the upper cased string. +* @example +* +* toUpper('--foo-bar--'); +* // => '--FOO-BAR--' +* +* toUpper(null); +* // => '' +* +* toUpper([1, 2, 3]); +* // => '1,2,3' +*/ +function toUpper(value) { + return toString(value).toUpperCase(); +} +//#endregion +export { toUpper }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/trim.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/trim.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..f7311c47f81248d2949b4c650f1456fb117241ff --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/trim.d.mts @@ -0,0 +1,29 @@ +//#region src/compat/string/trim.d.ts +/** + * Removes leading and trailing whitespace or specified characters from a string. + * + * @param {string} str - The string from which leading and trailing characters will be trimmed. + * @param {string | string[]} chars - The character(s) to remove from the end of the string. Defaults to `" "`. + * @returns {string} - The resulting string after the specified leading and trailing characters have been removed. + * + * @example + * trim(" hello "); // "hello" + * trim("--hello--", "-"); // "hello" + * trim("##hello##", ["#", "o"]); // "hell" + */ +declare function trim(string?: string, chars?: string): string; +/** + * Removes leading and trailing whitespace or specified characters from a string. + * + * @param {string} str - The string from which leading and trailing characters will be trimmed. + * @param {string | string[]} chars - The character(s) to remove from the end of the string. Defaults to `" "`. + * @returns {string} - The resulting string after the specified leading and trailing characters have been removed. + * + * @example + * trim(" hello "); // "hello" + * trim("--hello--", "-"); // "hello" + * trim("##hello##", ["#", "o"]); // "hell" + */ +declare function trim(string: string, index: string | number, guard: object): string; +//#endregion +export { trim }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/trim.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/trim.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7311c47f81248d2949b4c650f1456fb117241ff --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/trim.d.ts @@ -0,0 +1,29 @@ +//#region src/compat/string/trim.d.ts +/** + * Removes leading and trailing whitespace or specified characters from a string. + * + * @param {string} str - The string from which leading and trailing characters will be trimmed. + * @param {string | string[]} chars - The character(s) to remove from the end of the string. Defaults to `" "`. + * @returns {string} - The resulting string after the specified leading and trailing characters have been removed. + * + * @example + * trim(" hello "); // "hello" + * trim("--hello--", "-"); // "hello" + * trim("##hello##", ["#", "o"]); // "hell" + */ +declare function trim(string?: string, chars?: string): string; +/** + * Removes leading and trailing whitespace or specified characters from a string. + * + * @param {string} str - The string from which leading and trailing characters will be trimmed. + * @param {string | string[]} chars - The character(s) to remove from the end of the string. Defaults to `" "`. + * @returns {string} - The resulting string after the specified leading and trailing characters have been removed. + * + * @example + * trim(" hello "); // "hello" + * trim("--hello--", "-"); // "hello" + * trim("##hello##", ["#", "o"]); // "hell" + */ +declare function trim(string: string, index: string | number, guard: object): string; +//#endregion +export { trim }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/trim.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/trim.js new file mode 100644 index 0000000000000000000000000000000000000000..b0e881fe48b560c41224ecbdae5f1cc90e180d36 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/trim.js @@ -0,0 +1,13 @@ +const require_trim = require("../../string/trim.js"); +//#region src/compat/string/trim.ts +function trim(str, chars, guard) { + if (str == null) return ""; + if (guard != null || chars == null) return str.toString().trim(); + switch (typeof chars) { + case "object": if (Array.isArray(chars)) return require_trim.trim(str, chars.flatMap((x) => x.toString().split(""))); + else return require_trim.trim(str, chars.toString().split("")); + default: return require_trim.trim(str, chars.toString().split("")); + } +} +//#endregion +exports.trim = trim; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/trim.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/trim.mjs new file mode 100644 index 0000000000000000000000000000000000000000..850092cc1ffa14c2fb15d6e1fec9dd35c655ea88 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/trim.mjs @@ -0,0 +1,13 @@ +import { trim as trim$1 } from "../../string/trim.mjs"; +//#region src/compat/string/trim.ts +function trim(str, chars, guard) { + if (str == null) return ""; + if (guard != null || chars == null) return str.toString().trim(); + switch (typeof chars) { + case "object": if (Array.isArray(chars)) return trim$1(str, chars.flatMap((x) => x.toString().split(""))); + else return trim$1(str, chars.toString().split("")); + default: return trim$1(str, chars.toString().split("")); + } +} +//#endregion +export { trim }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/trimEnd.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/trimEnd.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..479adb1a516f2eb99e480ec1fa0cac75e62092a5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/trimEnd.d.mts @@ -0,0 +1,31 @@ +//#region src/compat/string/trimEnd.d.ts +/** + * Removes trailing whitespace or specified characters from a string. + * + * @param {string} string - The string to trim. + * @param {string} chars - The characters to trim from the end of the string. + * @returns {string} Returns the trimmed string. + * + * @example + * trimEnd(' abc '); + * // => ' abc' + * + * trimEnd('-_-abc-_-', '_-'); + * // => '-_-abc' + */ +declare function trimEnd(string?: string, chars?: string): string; +/** + * Removes trailing whitespace or specified characters from a string. + * + * @param {string} string - The string to trim. + * @param {string | number} index - The index parameter (used with guard). + * @param {object} guard - Enables use as an iteratee for methods like `map`. + * @returns {string} Returns the trimmed string. + * + * @example + * trimEnd(' abc ', 0, {}); + * // => ' abc' + */ +declare function trimEnd(string: string, index: string | number, guard: object): string; +//#endregion +export { trimEnd }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/trimEnd.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/trimEnd.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..479adb1a516f2eb99e480ec1fa0cac75e62092a5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/trimEnd.d.ts @@ -0,0 +1,31 @@ +//#region src/compat/string/trimEnd.d.ts +/** + * Removes trailing whitespace or specified characters from a string. + * + * @param {string} string - The string to trim. + * @param {string} chars - The characters to trim from the end of the string. + * @returns {string} Returns the trimmed string. + * + * @example + * trimEnd(' abc '); + * // => ' abc' + * + * trimEnd('-_-abc-_-', '_-'); + * // => '-_-abc' + */ +declare function trimEnd(string?: string, chars?: string): string; +/** + * Removes trailing whitespace or specified characters from a string. + * + * @param {string} string - The string to trim. + * @param {string | number} index - The index parameter (used with guard). + * @param {object} guard - Enables use as an iteratee for methods like `map`. + * @returns {string} Returns the trimmed string. + * + * @example + * trimEnd(' abc ', 0, {}); + * // => ' abc' + */ +declare function trimEnd(string: string, index: string | number, guard: object): string; +//#endregion +export { trimEnd }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/trimEnd.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/trimEnd.js new file mode 100644 index 0000000000000000000000000000000000000000..ea39dd0fbf0c57cf4cf4f20db8b2324c5b7849bf --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/trimEnd.js @@ -0,0 +1,24 @@ +const require_trimEnd = require("../../string/trimEnd.js"); +//#region src/compat/string/trimEnd.ts +/** +* Removes trailing whitespace or specified characters from a string. +* +* @param {string} str - The string from which trailing characters will be trimmed. +* @param {string | number} chars - The character(s) to remove from the end of the string. +* @param {object} guard - Enables use as an iteratee for methods like `map`. +* @returns {string} Returns the trimmed string. +* +* @example +* trimEnd(' abc '); +* // => ' abc' +* +* trimEnd('-_-abc-_-', '_-'); +* // => '-_-abc' +*/ +function trimEnd(str, chars, guard) { + if (str == null) return ""; + if (guard != null || chars == null) return str.toString().trimEnd(); + return require_trimEnd.trimEnd(str, chars.toString().split("")); +} +//#endregion +exports.trimEnd = trimEnd; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/trimEnd.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/trimEnd.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f807e34e7a0950c7f7071ecf9ef076474f929b3b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/trimEnd.mjs @@ -0,0 +1,24 @@ +import { trimEnd as trimEnd$1 } from "../../string/trimEnd.mjs"; +//#region src/compat/string/trimEnd.ts +/** +* Removes trailing whitespace or specified characters from a string. +* +* @param {string} str - The string from which trailing characters will be trimmed. +* @param {string | number} chars - The character(s) to remove from the end of the string. +* @param {object} guard - Enables use as an iteratee for methods like `map`. +* @returns {string} Returns the trimmed string. +* +* @example +* trimEnd(' abc '); +* // => ' abc' +* +* trimEnd('-_-abc-_-', '_-'); +* // => '-_-abc' +*/ +function trimEnd(str, chars, guard) { + if (str == null) return ""; + if (guard != null || chars == null) return str.toString().trimEnd(); + return trimEnd$1(str, chars.toString().split("")); +} +//#endregion +export { trimEnd }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/trimStart.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/trimStart.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..1dfd9a5c0fba05eab024c857e6fb83f23995c1c1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/trimStart.d.mts @@ -0,0 +1,31 @@ +//#region src/compat/string/trimStart.d.ts +/** + * Removes leading whitespace or specified characters from a string. + * + * @param {string} string - The string to trim. + * @param {string} chars - The characters to trim from the start of the string. + * @returns {string} Returns the trimmed string. + * + * @example + * trimStart(' abc '); + * // => 'abc ' + * + * trimStart('-_-abc-_-', '_-'); + * // => 'abc-_-' + */ +declare function trimStart(string?: string, chars?: string): string; +/** + * Removes leading whitespace or specified characters from a string. + * + * @param {string} string - The string to trim. + * @param {string | number} index - The index parameter (used with guard). + * @param {object} guard - Enables use as an iteratee for methods like `map`. + * @returns {string} Returns the trimmed string. + * + * @example + * trimStart(' abc ', 0, {}); + * // => 'abc ' + */ +declare function trimStart(string: string, index: string | number, guard: object): string; +//#endregion +export { trimStart }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/trimStart.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/trimStart.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1dfd9a5c0fba05eab024c857e6fb83f23995c1c1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/trimStart.d.ts @@ -0,0 +1,31 @@ +//#region src/compat/string/trimStart.d.ts +/** + * Removes leading whitespace or specified characters from a string. + * + * @param {string} string - The string to trim. + * @param {string} chars - The characters to trim from the start of the string. + * @returns {string} Returns the trimmed string. + * + * @example + * trimStart(' abc '); + * // => 'abc ' + * + * trimStart('-_-abc-_-', '_-'); + * // => 'abc-_-' + */ +declare function trimStart(string?: string, chars?: string): string; +/** + * Removes leading whitespace or specified characters from a string. + * + * @param {string} string - The string to trim. + * @param {string | number} index - The index parameter (used with guard). + * @param {object} guard - Enables use as an iteratee for methods like `map`. + * @returns {string} Returns the trimmed string. + * + * @example + * trimStart(' abc ', 0, {}); + * // => 'abc ' + */ +declare function trimStart(string: string, index: string | number, guard: object): string; +//#endregion +export { trimStart }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/trimStart.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/trimStart.js new file mode 100644 index 0000000000000000000000000000000000000000..1f4dd49fc36b58f05d1c1c37f2ea81b32e08c29b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/trimStart.js @@ -0,0 +1,24 @@ +const require_trimStart = require("../../string/trimStart.js"); +//#region src/compat/string/trimStart.ts +/** +* Removes leading whitespace or specified characters from a string. +* +* @param {string} str - The string from which leading characters will be trimmed. +* @param {string | number} chars - The character(s) to remove from the start of the string. +* @param {object} guard - Enables use as an iteratee for methods like `map`. +* @returns {string} Returns the trimmed string. +* +* @example +* trimStart(' abc '); +* // => 'abc ' +* +* trimStart('-_-abc-_-', '_-'); +* // => 'abc-_-' +*/ +function trimStart(str, chars, guard) { + if (str == null) return ""; + if (guard != null || chars == null) return str.toString().trimStart(); + return require_trimStart.trimStart(str, chars.toString().split("")); +} +//#endregion +exports.trimStart = trimStart; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/trimStart.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/trimStart.mjs new file mode 100644 index 0000000000000000000000000000000000000000..9a4d637b76569126b89da7e3396dc5392bd52504 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/trimStart.mjs @@ -0,0 +1,24 @@ +import { trimStart as trimStart$1 } from "../../string/trimStart.mjs"; +//#region src/compat/string/trimStart.ts +/** +* Removes leading whitespace or specified characters from a string. +* +* @param {string} str - The string from which leading characters will be trimmed. +* @param {string | number} chars - The character(s) to remove from the start of the string. +* @param {object} guard - Enables use as an iteratee for methods like `map`. +* @returns {string} Returns the trimmed string. +* +* @example +* trimStart(' abc '); +* // => 'abc ' +* +* trimStart('-_-abc-_-', '_-'); +* // => 'abc-_-' +*/ +function trimStart(str, chars, guard) { + if (str == null) return ""; + if (guard != null || chars == null) return str.toString().trimStart(); + return trimStart$1(str, chars.toString().split("")); +} +//#endregion +export { trimStart }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/truncate.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/truncate.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..5e5b76ad17add3f1da8a0aa0c499ec5bb551fa43 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/truncate.d.mts @@ -0,0 +1,35 @@ +//#region src/compat/string/truncate.d.ts +type TruncateOptions = { + length?: number; + separator?: string | RegExp; + omission?: string; +}; +/** + * This regex might more completely detect unicode, but it is slower and this project + * desires to mimic the behavior of lodash. + */ +/** + * Truncates `string` if it's longer than the given maximum string length. + * The last characters of the truncated string are replaced with the omission + * string which defaults to "...". + * + * @param {string} [string=''] The string to truncate. + * @param {Object} [options={}] The options object. + * @param {number} [options.length=30] The maximum string length. + * @param {string} [options.omission='...'] The string to indicate text is omitted. + * @param {RegExp|string} [options.separator] The separator pattern to truncate to. + * + * @example + * const test = 'hi-diddly-ho there, neighborino'; + * const truncatedStr1 = truncate(test) // returns 'hi-diddly-ho there, neighbo...' + * const truncatedStr2 = truncate(test, { length: 24, separator: ' ' }) // returns 'hi-diddly-ho there,...' + * const truncatedStr3 = truncate(test, { length: 24, separator: /,? +/ }) // returns 'hi-diddly-ho there...' + * const truncatedStr4 = truncate(test, { omission: ' [...]' }) // returns 'hi-diddly-ho there, neig [...]' + * const truncatedStr5 = truncate('ABC', { length: 3 }) // returns 'ABC' + * const truncatedStr6 = truncate('ABC', { length: 2 }) // returns '...' + * const truncatedStr7 = truncate('¥§✈✉🤓', { length: 5 }) // returns '¥§✈✉🤓' + * const truncatedStr8 = truncate('¥§✈✉🤓', { length: 4, omission: '…' }) // returns '¥§✈…' + */ +declare function truncate(string?: string, options?: TruncateOptions): string; +//#endregion +export { truncate }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/truncate.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/truncate.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5e5b76ad17add3f1da8a0aa0c499ec5bb551fa43 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/truncate.d.ts @@ -0,0 +1,35 @@ +//#region src/compat/string/truncate.d.ts +type TruncateOptions = { + length?: number; + separator?: string | RegExp; + omission?: string; +}; +/** + * This regex might more completely detect unicode, but it is slower and this project + * desires to mimic the behavior of lodash. + */ +/** + * Truncates `string` if it's longer than the given maximum string length. + * The last characters of the truncated string are replaced with the omission + * string which defaults to "...". + * + * @param {string} [string=''] The string to truncate. + * @param {Object} [options={}] The options object. + * @param {number} [options.length=30] The maximum string length. + * @param {string} [options.omission='...'] The string to indicate text is omitted. + * @param {RegExp|string} [options.separator] The separator pattern to truncate to. + * + * @example + * const test = 'hi-diddly-ho there, neighborino'; + * const truncatedStr1 = truncate(test) // returns 'hi-diddly-ho there, neighbo...' + * const truncatedStr2 = truncate(test, { length: 24, separator: ' ' }) // returns 'hi-diddly-ho there,...' + * const truncatedStr3 = truncate(test, { length: 24, separator: /,? +/ }) // returns 'hi-diddly-ho there...' + * const truncatedStr4 = truncate(test, { omission: ' [...]' }) // returns 'hi-diddly-ho there, neig [...]' + * const truncatedStr5 = truncate('ABC', { length: 3 }) // returns 'ABC' + * const truncatedStr6 = truncate('ABC', { length: 2 }) // returns '...' + * const truncatedStr7 = truncate('¥§✈✉🤓', { length: 5 }) // returns '¥§✈✉🤓' + * const truncatedStr8 = truncate('¥§✈✉🤓', { length: 4, omission: '…' }) // returns '¥§✈…' + */ +declare function truncate(string?: string, options?: TruncateOptions): string; +//#endregion +export { truncate }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/truncate.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/truncate.js new file mode 100644 index 0000000000000000000000000000000000000000..48a9045758802aa81c3d5c023345dfabe6c810e0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/truncate.js @@ -0,0 +1,72 @@ +const require_isObject = require("../predicate/isObject.js"); +//#region src/compat/string/truncate.ts +/** +* Used to compose unicode character classes. +* @link https://github.com/lodash/lodash/blob/4.17.21-es/_hasUnicode.js +* +* Used to detect strings with zero-width joiners or code points from the astral planes. +* @link http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/ +*/ +const regexMultiByte = /[\u200d\ud800-\udfff\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff\ufe0e\ufe0f]/; +/** +* This regex might more completely detect unicode, but it is slower and this project +* desires to mimic the behavior of lodash. +*/ +/** +* Truncates `string` if it's longer than the given maximum string length. +* The last characters of the truncated string are replaced with the omission +* string which defaults to "...". +* +* @param {string} [string=''] The string to truncate. +* @param {Object} [options={}] The options object. +* @param {number} [options.length=30] The maximum string length. +* @param {string} [options.omission='...'] The string to indicate text is omitted. +* @param {RegExp|string} [options.separator] The separator pattern to truncate to. +* +* @example +* const test = 'hi-diddly-ho there, neighborino'; +* const truncatedStr1 = truncate(test) // returns 'hi-diddly-ho there, neighbo...' +* const truncatedStr2 = truncate(test, { length: 24, separator: ' ' }) // returns 'hi-diddly-ho there,...' +* const truncatedStr3 = truncate(test, { length: 24, separator: /,? +/ }) // returns 'hi-diddly-ho there...' +* const truncatedStr4 = truncate(test, { omission: ' [...]' }) // returns 'hi-diddly-ho there, neig [...]' +* const truncatedStr5 = truncate('ABC', { length: 3 }) // returns 'ABC' +* const truncatedStr6 = truncate('ABC', { length: 2 }) // returns '...' +* const truncatedStr7 = truncate('¥§✈✉🤓', { length: 5 }) // returns '¥§✈✉🤓' +* const truncatedStr8 = truncate('¥§✈✉🤓', { length: 4, omission: '…' }) // returns '¥§✈…' +*/ +function truncate(string, options) { + string = string != null ? `${string}` : ""; + let length = 30; + let omission = "..."; + if (require_isObject.isObject(options)) { + length = parseLength(options.length); + omission = "omission" in options ? `${options.omission}` : "..."; + } + let i = string.length; + const lengthOmission = Array.from(omission).length; + const lengthBase = Math.max(length - lengthOmission, 0); + let strArray = void 0; + if (regexMultiByte.test(string)) { + strArray = Array.from(string); + i = strArray.length; + } + if (length >= i) return string; + if (i <= lengthOmission) return omission; + let base = strArray === void 0 ? string.slice(0, lengthBase) : strArray?.slice(0, lengthBase).join(""); + const separator = options?.separator; + if (!separator) { + base += omission; + return base; + } + const search = separator instanceof RegExp ? separator.source : separator; + const flags = "u" + (separator instanceof RegExp ? separator.flags.replace("u", "") : ""); + const withoutSeparator = new RegExp(`(?.*(?:(?!${search}).))(?:${search})`, flags).exec(base); + return (!withoutSeparator?.groups ? base : withoutSeparator.groups.result) + omission; +} +function parseLength(length) { + if (length == null) return 30; + if (length <= 0) return 0; + return length; +} +//#endregion +exports.truncate = truncate; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/truncate.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/truncate.mjs new file mode 100644 index 0000000000000000000000000000000000000000..fb502fa3f7b6da18e725ee8cb554ad9ef5f7819b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/truncate.mjs @@ -0,0 +1,72 @@ +import { isObject } from "../predicate/isObject.mjs"; +//#region src/compat/string/truncate.ts +/** +* Used to compose unicode character classes. +* @link https://github.com/lodash/lodash/blob/4.17.21-es/_hasUnicode.js +* +* Used to detect strings with zero-width joiners or code points from the astral planes. +* @link http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/ +*/ +const regexMultiByte = /[\u200d\ud800-\udfff\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff\ufe0e\ufe0f]/; +/** +* This regex might more completely detect unicode, but it is slower and this project +* desires to mimic the behavior of lodash. +*/ +/** +* Truncates `string` if it's longer than the given maximum string length. +* The last characters of the truncated string are replaced with the omission +* string which defaults to "...". +* +* @param {string} [string=''] The string to truncate. +* @param {Object} [options={}] The options object. +* @param {number} [options.length=30] The maximum string length. +* @param {string} [options.omission='...'] The string to indicate text is omitted. +* @param {RegExp|string} [options.separator] The separator pattern to truncate to. +* +* @example +* const test = 'hi-diddly-ho there, neighborino'; +* const truncatedStr1 = truncate(test) // returns 'hi-diddly-ho there, neighbo...' +* const truncatedStr2 = truncate(test, { length: 24, separator: ' ' }) // returns 'hi-diddly-ho there,...' +* const truncatedStr3 = truncate(test, { length: 24, separator: /,? +/ }) // returns 'hi-diddly-ho there...' +* const truncatedStr4 = truncate(test, { omission: ' [...]' }) // returns 'hi-diddly-ho there, neig [...]' +* const truncatedStr5 = truncate('ABC', { length: 3 }) // returns 'ABC' +* const truncatedStr6 = truncate('ABC', { length: 2 }) // returns '...' +* const truncatedStr7 = truncate('¥§✈✉🤓', { length: 5 }) // returns '¥§✈✉🤓' +* const truncatedStr8 = truncate('¥§✈✉🤓', { length: 4, omission: '…' }) // returns '¥§✈…' +*/ +function truncate(string, options) { + string = string != null ? `${string}` : ""; + let length = 30; + let omission = "..."; + if (isObject(options)) { + length = parseLength(options.length); + omission = "omission" in options ? `${options.omission}` : "..."; + } + let i = string.length; + const lengthOmission = Array.from(omission).length; + const lengthBase = Math.max(length - lengthOmission, 0); + let strArray = void 0; + if (regexMultiByte.test(string)) { + strArray = Array.from(string); + i = strArray.length; + } + if (length >= i) return string; + if (i <= lengthOmission) return omission; + let base = strArray === void 0 ? string.slice(0, lengthBase) : strArray?.slice(0, lengthBase).join(""); + const separator = options?.separator; + if (!separator) { + base += omission; + return base; + } + const search = separator instanceof RegExp ? separator.source : separator; + const flags = "u" + (separator instanceof RegExp ? separator.flags.replace("u", "") : ""); + const withoutSeparator = new RegExp(`(?.*(?:(?!${search}).))(?:${search})`, flags).exec(base); + return (!withoutSeparator?.groups ? base : withoutSeparator.groups.result) + omission; +} +function parseLength(length) { + if (length == null) return 30; + if (length <= 0) return 0; + return length; +} +//#endregion +export { truncate }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/unescape.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/unescape.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..746d5eba0fb2e66feb8c0bf5db15fa8dfb9f265b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/unescape.d.mts @@ -0,0 +1,17 @@ +//#region src/compat/string/unescape.d.ts +/** + * Converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `str` to their corresponding characters. + * It is the inverse of `escape`. + * + * @param {string} str The string to unescape. + * @returns {string} Returns the unescaped string. + * + * @example + * unescape('This is a <div> element.'); // returns 'This is a
element.' + * unescape('This is a "quote"'); // returns 'This is a "quote"' + * unescape('This is a 'quote''); // returns 'This is a 'quote'' + * unescape('This is a & symbol'); // returns 'This is a & symbol' + */ +declare function unescape(str?: string): string; +//#endregion +export { unescape }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/unescape.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/unescape.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..746d5eba0fb2e66feb8c0bf5db15fa8dfb9f265b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/unescape.d.ts @@ -0,0 +1,17 @@ +//#region src/compat/string/unescape.d.ts +/** + * Converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `str` to their corresponding characters. + * It is the inverse of `escape`. + * + * @param {string} str The string to unescape. + * @returns {string} Returns the unescaped string. + * + * @example + * unescape('This is a <div> element.'); // returns 'This is a
element.' + * unescape('This is a "quote"'); // returns 'This is a "quote"' + * unescape('This is a 'quote''); // returns 'This is a 'quote'' + * unescape('This is a & symbol'); // returns 'This is a & symbol' + */ +declare function unescape(str?: string): string; +//#endregion +export { unescape }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/unescape.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/unescape.js new file mode 100644 index 0000000000000000000000000000000000000000..bdc928f19576d31473b7c483ab7fddf7b3351da9 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/unescape.js @@ -0,0 +1,21 @@ +const require_unescape = require("../../string/unescape.js"); +const require_toString = require("../util/toString.js"); +//#region src/compat/string/unescape.ts +/** +* Converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `str` to their corresponding characters. +* It is the inverse of `escape`. +* +* @param {string} str The string to unescape. +* @returns {string} Returns the unescaped string. +* +* @example +* unescape('This is a <div> element.'); // returns 'This is a
element.' +* unescape('This is a "quote"'); // returns 'This is a "quote"' +* unescape('This is a 'quote''); // returns 'This is a 'quote'' +* unescape('This is a & symbol'); // returns 'This is a & symbol' +*/ +function unescape(str) { + return require_unescape.unescape(require_toString.toString(str)); +} +//#endregion +exports.unescape = unescape; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/unescape.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/unescape.mjs new file mode 100644 index 0000000000000000000000000000000000000000..da03de2c32c8e5f25d28c16b601de8fc8c81c406 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/unescape.mjs @@ -0,0 +1,21 @@ +import { unescape as unescape$1 } from "../../string/unescape.mjs"; +import { toString } from "../util/toString.mjs"; +//#region src/compat/string/unescape.ts +/** +* Converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `str` to their corresponding characters. +* It is the inverse of `escape`. +* +* @param {string} str The string to unescape. +* @returns {string} Returns the unescaped string. +* +* @example +* unescape('This is a <div> element.'); // returns 'This is a
element.' +* unescape('This is a "quote"'); // returns 'This is a "quote"' +* unescape('This is a 'quote''); // returns 'This is a 'quote'' +* unescape('This is a & symbol'); // returns 'This is a & symbol' +*/ +function unescape(str) { + return unescape$1(toString(str)); +} +//#endregion +export { unescape }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/upperCase.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/upperCase.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..8c123a56d794fecdd502034c650315f1945e1f3a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/upperCase.d.mts @@ -0,0 +1,18 @@ +//#region src/compat/string/upperCase.d.ts +/** + * Converts a string to upper case. + * + * Upper case is the naming convention in which each word is written in uppercase and separated by an space ( ) character. + * + * @param {string | object} str - The string that is to be changed to upper case. + * @returns {string} - The converted string to upper case. + * + * @example + * const convertedStr1 = upperCase('camelCase') // returns 'CAMEL CASE' + * const convertedStr2 = upperCase('some whitespace') // returns 'SOME WHITESPACE' + * const convertedStr3 = upperCase('hyphen-text') // returns 'HYPHEN TEXT' + * const convertedStr4 = upperCase('HTTPRequest') // returns 'HTTP REQUEST' + */ +declare function upperCase(str?: string): string; +//#endregion +export { upperCase }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/upperCase.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/upperCase.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8c123a56d794fecdd502034c650315f1945e1f3a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/upperCase.d.ts @@ -0,0 +1,18 @@ +//#region src/compat/string/upperCase.d.ts +/** + * Converts a string to upper case. + * + * Upper case is the naming convention in which each word is written in uppercase and separated by an space ( ) character. + * + * @param {string | object} str - The string that is to be changed to upper case. + * @returns {string} - The converted string to upper case. + * + * @example + * const convertedStr1 = upperCase('camelCase') // returns 'CAMEL CASE' + * const convertedStr2 = upperCase('some whitespace') // returns 'SOME WHITESPACE' + * const convertedStr3 = upperCase('hyphen-text') // returns 'HYPHEN TEXT' + * const convertedStr4 = upperCase('HTTPRequest') // returns 'HTTP REQUEST' + */ +declare function upperCase(str?: string): string; +//#endregion +export { upperCase }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/upperCase.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/upperCase.js new file mode 100644 index 0000000000000000000000000000000000000000..f9b1f63a66228ffe99c28a3ccddf91821b935a89 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/upperCase.js @@ -0,0 +1,23 @@ +const require_upperCase = require("../../string/upperCase.js"); +const require_deburr = require("./deburr.js"); +const require_normalizeForCase = require("../_internal/normalizeForCase.js"); +//#region src/compat/string/upperCase.ts +/** +* Converts a string to upper case. +* +* Upper case is the naming convention in which each word is written in uppercase and separated by an space ( ) character. +* +* @param {string | object} str - The string that is to be changed to upper case. +* @returns {string} - The converted string to upper case. +* +* @example +* const convertedStr1 = upperCase('camelCase') // returns 'CAMEL CASE' +* const convertedStr2 = upperCase('some whitespace') // returns 'SOME WHITESPACE' +* const convertedStr3 = upperCase('hyphen-text') // returns 'HYPHEN TEXT' +* const convertedStr4 = upperCase('HTTPRequest') // returns 'HTTP REQUEST' +*/ +function upperCase(str) { + return require_upperCase.upperCase(require_normalizeForCase.normalizeForCase(require_deburr.deburr(str))); +} +//#endregion +exports.upperCase = upperCase; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/upperCase.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/upperCase.mjs new file mode 100644 index 0000000000000000000000000000000000000000..eb575849216f314101acb4945e8549fd1499e146 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/upperCase.mjs @@ -0,0 +1,23 @@ +import { upperCase as upperCase$1 } from "../../string/upperCase.mjs"; +import { deburr } from "./deburr.mjs"; +import { normalizeForCase } from "../_internal/normalizeForCase.mjs"; +//#region src/compat/string/upperCase.ts +/** +* Converts a string to upper case. +* +* Upper case is the naming convention in which each word is written in uppercase and separated by an space ( ) character. +* +* @param {string | object} str - The string that is to be changed to upper case. +* @returns {string} - The converted string to upper case. +* +* @example +* const convertedStr1 = upperCase('camelCase') // returns 'CAMEL CASE' +* const convertedStr2 = upperCase('some whitespace') // returns 'SOME WHITESPACE' +* const convertedStr3 = upperCase('hyphen-text') // returns 'HYPHEN TEXT' +* const convertedStr4 = upperCase('HTTPRequest') // returns 'HTTP REQUEST' +*/ +function upperCase(str) { + return upperCase$1(normalizeForCase(deburr(str))); +} +//#endregion +export { upperCase }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/upperFirst.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/upperFirst.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..58d4512f4c3aff5fa0c339b0104dd863ca8bf726 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/upperFirst.d.mts @@ -0,0 +1,15 @@ +//#region src/compat/string/upperFirst.d.ts +/** + * Converts the first character of string to upper case. + * + * @param {string} str - The string that is to be changed + * @returns {string} - The converted string. + * + * @example + * const convertedStr1 = upperFirst('fred') // returns 'Fred' + * const convertedStr2 = upperFirst('Fred') // returns 'Fred' + * const convertedStr3 = upperFirst('FRED') // returns 'FRED' + */ +declare function upperFirst(str?: T): Capitalize; +//#endregion +export { upperFirst }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/upperFirst.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/upperFirst.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..58d4512f4c3aff5fa0c339b0104dd863ca8bf726 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/upperFirst.d.ts @@ -0,0 +1,15 @@ +//#region src/compat/string/upperFirst.d.ts +/** + * Converts the first character of string to upper case. + * + * @param {string} str - The string that is to be changed + * @returns {string} - The converted string. + * + * @example + * const convertedStr1 = upperFirst('fred') // returns 'Fred' + * const convertedStr2 = upperFirst('Fred') // returns 'Fred' + * const convertedStr3 = upperFirst('FRED') // returns 'FRED' + */ +declare function upperFirst(str?: T): Capitalize; +//#endregion +export { upperFirst }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/upperFirst.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/upperFirst.js new file mode 100644 index 0000000000000000000000000000000000000000..b47837e8aae61faa820669b7f2c07be80183068f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/upperFirst.js @@ -0,0 +1,19 @@ +const require_upperFirst = require("../../string/upperFirst.js"); +const require_toString = require("../util/toString.js"); +//#region src/compat/string/upperFirst.ts +/** +* Converts the first character of string to upper case. +* +* @param {string} str - The string that is to be changed +* @returns {string} - The converted string. +* +* @example +* const convertedStr1 = upperFirst('fred') // returns 'Fred' +* const convertedStr2 = upperFirst('Fred') // returns 'Fred' +* const convertedStr3 = upperFirst('FRED') // returns 'FRED' +*/ +function upperFirst(str) { + return require_upperFirst.upperFirst(require_toString.toString(str)); +} +//#endregion +exports.upperFirst = upperFirst; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/upperFirst.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/upperFirst.mjs new file mode 100644 index 0000000000000000000000000000000000000000..090551a0d736889999e33ffeb98420ad563f3071 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/upperFirst.mjs @@ -0,0 +1,19 @@ +import { upperFirst as upperFirst$1 } from "../../string/upperFirst.mjs"; +import { toString } from "../util/toString.mjs"; +//#region src/compat/string/upperFirst.ts +/** +* Converts the first character of string to upper case. +* +* @param {string} str - The string that is to be changed +* @returns {string} - The converted string. +* +* @example +* const convertedStr1 = upperFirst('fred') // returns 'Fred' +* const convertedStr2 = upperFirst('Fred') // returns 'Fred' +* const convertedStr3 = upperFirst('FRED') // returns 'FRED' +*/ +function upperFirst(str) { + return upperFirst$1(toString(str)); +} +//#endregion +export { upperFirst }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/words.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/string/words.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..1f28609f8e1074b2940698b604c880b6a7fdf109 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/words.d.mts @@ -0,0 +1,28 @@ +//#region src/compat/string/words.d.ts +/** + * Splits `string` into an array of its words. + * + * @param {string | object} str - The string or object that is to be split into words. + * @param {RegExp | string} [pattern] - The pattern to match words. + * @returns {string[]} - Returns the words of `string`. + * + * @example + * const wordsArray1 = words('fred, barney, & pebbles'); + * // => ['fred', 'barney', 'pebbles'] + * + */ +declare function words(string?: string, pattern?: string | RegExp): string[]; +/** + * Splits `string` into an array of its words. + * + * @param {string | object} str - The string or object that is to be split into words. + * @param {RegExp | string} [pattern] - The pattern to match words. + * @returns {string[]} - Returns the words of `string`. + * + * @example + * const wordsArray1 = words('fred, barney, & pebbles'); + * // => ['fred', 'barney', 'pebbles'] + */ +declare function words(string: string, index: string | number, guard: object): string[]; +//#endregion +export { words }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/words.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/string/words.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1f28609f8e1074b2940698b604c880b6a7fdf109 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/words.d.ts @@ -0,0 +1,28 @@ +//#region src/compat/string/words.d.ts +/** + * Splits `string` into an array of its words. + * + * @param {string | object} str - The string or object that is to be split into words. + * @param {RegExp | string} [pattern] - The pattern to match words. + * @returns {string[]} - Returns the words of `string`. + * + * @example + * const wordsArray1 = words('fred, barney, & pebbles'); + * // => ['fred', 'barney', 'pebbles'] + * + */ +declare function words(string?: string, pattern?: string | RegExp): string[]; +/** + * Splits `string` into an array of its words. + * + * @param {string | object} str - The string or object that is to be split into words. + * @param {RegExp | string} [pattern] - The pattern to match words. + * @returns {string[]} - Returns the words of `string`. + * + * @example + * const wordsArray1 = words('fred, barney, & pebbles'); + * // => ['fred', 'barney', 'pebbles'] + */ +declare function words(string: string, index: string | number, guard: object): string[]; +//#endregion +export { words }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/words.js b/tools/ui/node_modules/es-toolkit/dist/compat/string/words.js new file mode 100644 index 0000000000000000000000000000000000000000..937b9971c5fdb51c1909c2c5e4bd770ef3d719ca --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/words.js @@ -0,0 +1,42 @@ +const require_toString = require("../util/toString.js"); +//#region src/compat/string/words.ts +const rNonCharLatin = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\xd7\\xf7"; +const rUnicodeUpper = "\\p{Lu}"; +const rUnicodeLower = "\\p{Ll}"; +const rMisc = "(?:[\\p{Lm}\\p{Lo}]\\p{M}*)"; +const rNumber = "\\d"; +const rUnicodeOptContrLower = "(?:['’](?:d|ll|m|re|s|t|ve))?"; +const rUnicodeOptContrUpper = "(?:['’](?:D|LL|M|RE|S|T|VE))?"; +const rUnicodeBreak = `[\\p{Z}\\p{P}${rNonCharLatin}]`; +const rUnicodeMiscUpper = `(?:${rUnicodeUpper}|${rMisc})`; +const rUnicodeMiscLower = `(?:${rUnicodeLower}|${rMisc})`; +const rUnicodeWord = RegExp([ + `${rUnicodeUpper}?${rUnicodeLower}+${rUnicodeOptContrLower}(?=${rUnicodeBreak}|${rUnicodeUpper}|$)`, + `${rUnicodeMiscUpper}+${rUnicodeOptContrUpper}(?=${rUnicodeBreak}|${rUnicodeUpper}${rUnicodeMiscLower}|$)`, + `${rUnicodeUpper}?${rUnicodeMiscLower}+${rUnicodeOptContrLower}`, + `${rUnicodeUpper}+${rUnicodeOptContrUpper}`, + `${rNumber}*(?:1ST|2ND|3RD|(?![123])${rNumber}TH)(?=\\b|[a-z_])`, + `${rNumber}*(?:1st|2nd|3rd|(?![123])${rNumber}th)(?=\\b|[A-Z_])`, + `${rNumber}+`, + "\\p{Emoji_Presentation}", + "\\p{Extended_Pictographic}" +].join("|"), "gu"); +/** +* Splits `string` into an array of its words. +* +* @param {string | object} str - The string or object that is to be split into words. +* @param {RegExp | string} [pattern] - The pattern to match words. +* @returns {string[]} - Returns the words of `string`. +* +* @example +* const wordsArray1 = words('fred, barney, & pebbles'); +* // => ['fred', 'barney', 'pebbles'] +*/ +function words(str, pattern = rUnicodeWord, guard) { + const input = require_toString.toString(str); + if (guard) pattern = rUnicodeWord; + if (typeof pattern === "number") pattern = pattern.toString(); + return Array.from(input.match(pattern) ?? []).filter((x) => x !== ""); +} +//#endregion +exports.words = words; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/string/words.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/string/words.mjs new file mode 100644 index 0000000000000000000000000000000000000000..db789a29231f138368ca3149c301bd095363e349 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/string/words.mjs @@ -0,0 +1,42 @@ +import { toString } from "../util/toString.mjs"; +//#region src/compat/string/words.ts +const rNonCharLatin = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\xd7\\xf7"; +const rUnicodeUpper = "\\p{Lu}"; +const rUnicodeLower = "\\p{Ll}"; +const rMisc = "(?:[\\p{Lm}\\p{Lo}]\\p{M}*)"; +const rNumber = "\\d"; +const rUnicodeOptContrLower = "(?:['’](?:d|ll|m|re|s|t|ve))?"; +const rUnicodeOptContrUpper = "(?:['’](?:D|LL|M|RE|S|T|VE))?"; +const rUnicodeBreak = `[\\p{Z}\\p{P}${rNonCharLatin}]`; +const rUnicodeMiscUpper = `(?:${rUnicodeUpper}|${rMisc})`; +const rUnicodeMiscLower = `(?:${rUnicodeLower}|${rMisc})`; +const rUnicodeWord = RegExp([ + `${rUnicodeUpper}?${rUnicodeLower}+${rUnicodeOptContrLower}(?=${rUnicodeBreak}|${rUnicodeUpper}|$)`, + `${rUnicodeMiscUpper}+${rUnicodeOptContrUpper}(?=${rUnicodeBreak}|${rUnicodeUpper}${rUnicodeMiscLower}|$)`, + `${rUnicodeUpper}?${rUnicodeMiscLower}+${rUnicodeOptContrLower}`, + `${rUnicodeUpper}+${rUnicodeOptContrUpper}`, + `${rNumber}*(?:1ST|2ND|3RD|(?![123])${rNumber}TH)(?=\\b|[a-z_])`, + `${rNumber}*(?:1st|2nd|3rd|(?![123])${rNumber}th)(?=\\b|[A-Z_])`, + `${rNumber}+`, + "\\p{Emoji_Presentation}", + "\\p{Extended_Pictographic}" +].join("|"), "gu"); +/** +* Splits `string` into an array of its words. +* +* @param {string | object} str - The string or object that is to be split into words. +* @param {RegExp | string} [pattern] - The pattern to match words. +* @returns {string[]} - Returns the words of `string`. +* +* @example +* const wordsArray1 = words('fred, barney, & pebbles'); +* // => ['fred', 'barney', 'pebbles'] +*/ +function words(str, pattern = rUnicodeWord, guard) { + const input = toString(str); + if (guard) pattern = rUnicodeWord; + if (typeof pattern === "number") pattern = pattern.toString(); + return Array.from(input.match(pattern) ?? []).filter((x) => x !== ""); +} +//#endregion +export { words }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/toolkit.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/toolkit.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..73aefe83285610fda07bb05f1704d62854c7eef1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/toolkit.d.mts @@ -0,0 +1,9 @@ +import { compat_d_exports } from "./compat.mjs"; + +//#region src/compat/toolkit.d.ts +type ToolkitFn = (value: any) => any; +type Compat = typeof compat_d_exports; +interface Toolkit extends ToolkitFn, Compat {} +declare const toolkit: Toolkit; +//#endregion +export { Toolkit, toolkit }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/toolkit.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/toolkit.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..78a21c0543c9a1364e42133908dcac95679ee596 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/toolkit.d.ts @@ -0,0 +1,9 @@ +import { compat_d_exports } from "./compat.js"; + +//#region src/compat/toolkit.d.ts +type ToolkitFn = (value: any) => any; +type Compat = typeof compat_d_exports; +interface Toolkit extends ToolkitFn, Compat {} +declare const toolkit: Toolkit; +//#endregion +export { Toolkit, toolkit }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/toolkit.js b/tools/ui/node_modules/es-toolkit/dist/compat/toolkit.js new file mode 100644 index 0000000000000000000000000000000000000000..f7e1e4a1a3885595893e14e4e0b8df5b644a5dad --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/toolkit.js @@ -0,0 +1,10 @@ +const require_compat = require("./compat.js"); +//#region src/compat/toolkit.ts +const toolkit = ((value) => { + return value; +}); +Object.assign(toolkit, require_compat.compat_exports); +toolkit.partial.placeholder = toolkit; +toolkit.partialRight.placeholder = toolkit; +//#endregion +exports.toolkit = toolkit; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/toolkit.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/toolkit.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a31bbdd2da5f6a39e305c3f114808d760294d233 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/toolkit.mjs @@ -0,0 +1,10 @@ +import { compat_exports } from "./compat.mjs"; +//#region src/compat/toolkit.ts +const toolkit = ((value) => { + return value; +}); +Object.assign(toolkit, compat_exports); +toolkit.partial.placeholder = toolkit; +toolkit.partialRight.placeholder = toolkit; +//#endregion +export { toolkit }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/bindAll.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/bindAll.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..ee690a938dc9651664620823f9bb62096e78d837 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/bindAll.d.mts @@ -0,0 +1,32 @@ +import { Many } from "../_internal/Many.mjs"; + +//#region src/compat/util/bindAll.d.ts +/** + * Binds methods of an object to the object itself, overwriting the existing method. + * Method names may be specified as individual arguments or as arrays of method names. + * + * @template T - The type of the object. + * @param {T} object - The object to bind methods to. + * @param {Array>} [methodNames] - The method names to bind, specified individually or in arrays. + * @returns {T} - Returns the object. + * + * @example + * const view = { + * 'label': 'docs', + * 'click': function() { + * console.log('clicked ' + this.label); + * } + * }; + * + * bindAll(view, ['click']); + * jQuery(element).on('click', view.click); + * // => Logs 'clicked docs' when clicked. + * + * @example + * // Using individual method names + * bindAll(view, 'click'); + * // => Same as above + */ +declare function bindAll(object: T, ...methodNames: Array>): T; +//#endregion +export { bindAll }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/bindAll.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/bindAll.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..412e778119a8636ee70913a7ccd7f049a6089b09 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/bindAll.d.ts @@ -0,0 +1,32 @@ +import { Many } from "../_internal/Many.js"; + +//#region src/compat/util/bindAll.d.ts +/** + * Binds methods of an object to the object itself, overwriting the existing method. + * Method names may be specified as individual arguments or as arrays of method names. + * + * @template T - The type of the object. + * @param {T} object - The object to bind methods to. + * @param {Array>} [methodNames] - The method names to bind, specified individually or in arrays. + * @returns {T} - Returns the object. + * + * @example + * const view = { + * 'label': 'docs', + * 'click': function() { + * console.log('clicked ' + this.label); + * } + * }; + * + * bindAll(view, ['click']); + * jQuery(element).on('click', view.click); + * // => Logs 'clicked docs' when clicked. + * + * @example + * // Using individual method names + * bindAll(view, 'click'); + * // => Same as above + */ +declare function bindAll(object: T, ...methodNames: Array>): T; +//#endregion +export { bindAll }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/bindAll.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/bindAll.js new file mode 100644 index 0000000000000000000000000000000000000000..94bec51aade4b21730ba90e6d646141d80920e42 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/bindAll.js @@ -0,0 +1,53 @@ +const require_isArray = require("../predicate/isArray.js"); +const require_isFunction = require("../../predicate/isFunction.js"); +const require_toString = require("./toString.js"); +const require_isObject = require("../predicate/isObject.js"); +//#region src/compat/util/bindAll.ts +/** +* Binds methods of an object to the object itself, overwriting the existing method. +* Method names may be specified as individual arguments or as arrays of method names. +* +* @template T - The type of the object. +* @param {T} object - The object to bind methods to. +* @param {Array>} [methodNames] - The method names to bind, specified individually or in arrays. +* @returns {T} - Returns the object. +* +* @example +* const view = { +* 'label': 'docs', +* 'click': function() { +* console.log('clicked ' + this.label); +* } +* }; +* +* bindAll(view, ['click']); +* jQuery(element).on('click', view.click); +* // => Logs 'clicked docs' when clicked. +* +* @example +* // Using individual method names +* bindAll(view, 'click'); +* // => Same as above +*/ +function bindAll(object, ...methodNames) { + if (object == null) return object; + if (!require_isObject.isObject(object)) return object; + if (require_isArray.isArray(object) && methodNames.length === 0) return object; + const methods = []; + for (let i = 0; i < methodNames.length; i++) { + const name = methodNames[i]; + if (require_isArray.isArray(name)) methods.push(...name); + else if (name && typeof name === "object" && "length" in name) methods.push(...Array.from(name)); + else methods.push(name); + } + if (methods.length === 0) return object; + for (let i = 0; i < methods.length; i++) { + const key = methods[i]; + const stringKey = require_toString.toString(key); + const func = object[stringKey]; + if (require_isFunction.isFunction(func)) object[stringKey] = func.bind(object); + } + return object; +} +//#endregion +exports.bindAll = bindAll; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/bindAll.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/bindAll.mjs new file mode 100644 index 0000000000000000000000000000000000000000..1e686838c39aaa43866db9a0ab37f1e1431230bc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/bindAll.mjs @@ -0,0 +1,53 @@ +import { isArray } from "../predicate/isArray.mjs"; +import { isFunction } from "../../predicate/isFunction.mjs"; +import { toString } from "./toString.mjs"; +import { isObject } from "../predicate/isObject.mjs"; +//#region src/compat/util/bindAll.ts +/** +* Binds methods of an object to the object itself, overwriting the existing method. +* Method names may be specified as individual arguments or as arrays of method names. +* +* @template T - The type of the object. +* @param {T} object - The object to bind methods to. +* @param {Array>} [methodNames] - The method names to bind, specified individually or in arrays. +* @returns {T} - Returns the object. +* +* @example +* const view = { +* 'label': 'docs', +* 'click': function() { +* console.log('clicked ' + this.label); +* } +* }; +* +* bindAll(view, ['click']); +* jQuery(element).on('click', view.click); +* // => Logs 'clicked docs' when clicked. +* +* @example +* // Using individual method names +* bindAll(view, 'click'); +* // => Same as above +*/ +function bindAll(object, ...methodNames) { + if (object == null) return object; + if (!isObject(object)) return object; + if (isArray(object) && methodNames.length === 0) return object; + const methods = []; + for (let i = 0; i < methodNames.length; i++) { + const name = methodNames[i]; + if (isArray(name)) methods.push(...name); + else if (name && typeof name === "object" && "length" in name) methods.push(...Array.from(name)); + else methods.push(name); + } + if (methods.length === 0) return object; + for (let i = 0; i < methods.length; i++) { + const key = methods[i]; + const stringKey = toString(key); + const func = object[stringKey]; + if (isFunction(func)) object[stringKey] = func.bind(object); + } + return object; +} +//#endregion +export { bindAll }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/cond.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/cond.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..7b91aa5a93e87fdd533c0d584e5ce5828e29ca5e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/cond.d.mts @@ -0,0 +1,59 @@ +//#region src/compat/util/cond.d.ts +/** + * Creates a function that checks conditions one by one and runs the matching function. + * + * Each pair consists of a condition (predicate) and a function to run. + * The function goes through each condition in order until it finds one that's true. + * When it finds a true condition, it runs the corresponding function and returns its result. + * If none of the conditions are true, it returns undefined. + * + * @param {Array} pairs - Array of pairs. Each pair consists of a predicate function and a function to run. + * @returns {(...args: any[]) => unknown} A new composite function that checks conditions and runs the matching function. + * @example + * + * const func = cond([ + * [matches({ a: 1 }), constant('matches A')], + * [conforms({ b: isNumber }), constant('matches B')], + * [stubTrue, constant('no match')] + * ]); + * + * func({ a: 1, b: 2 }); + * // => 'matches A' + * + * func({ a: 0, b: 1 }); + * // => 'matches B' + * + * func({ a: '1', b: '2' }); + * // => 'no match' + */ +declare function cond(pairs: Array<[truthy: () => boolean, falsey: () => R]>): () => R; +/** + * Creates a function that checks conditions one by one and runs the matching function. + * + * Each pair consists of a condition (predicate) and a function to run. + * The function goes through each condition in order until it finds one that's true. + * When it finds a true condition, it runs the corresponding function and returns its result. + * If none of the conditions are true, it returns undefined. + * + * @param {Array} pairs - Array of pairs. Each pair consists of a predicate function and a function to run. + * @returns {(...args: any[]) => unknown} A new composite function that checks conditions and runs the matching function. + * @example + * + * const func = cond([ + * [matches({ a: 1 }), constant('matches A')], + * [conforms({ b: isNumber }), constant('matches B')], + * [stubTrue, constant('no match')] + * ]); + * + * func({ a: 1, b: 2 }); + * // => 'matches A' + * + * func({ a: 0, b: 1 }); + * // => 'matches B' + * + * func({ a: '1', b: '2' }); + * // => 'no match' + */ +declare function cond(pairs: Array<[truthy: (val: T) => boolean, falsey: (val: T) => R]>): (val: T) => R; +//#endregion +export { cond }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/cond.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/cond.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7b91aa5a93e87fdd533c0d584e5ce5828e29ca5e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/cond.d.ts @@ -0,0 +1,59 @@ +//#region src/compat/util/cond.d.ts +/** + * Creates a function that checks conditions one by one and runs the matching function. + * + * Each pair consists of a condition (predicate) and a function to run. + * The function goes through each condition in order until it finds one that's true. + * When it finds a true condition, it runs the corresponding function and returns its result. + * If none of the conditions are true, it returns undefined. + * + * @param {Array} pairs - Array of pairs. Each pair consists of a predicate function and a function to run. + * @returns {(...args: any[]) => unknown} A new composite function that checks conditions and runs the matching function. + * @example + * + * const func = cond([ + * [matches({ a: 1 }), constant('matches A')], + * [conforms({ b: isNumber }), constant('matches B')], + * [stubTrue, constant('no match')] + * ]); + * + * func({ a: 1, b: 2 }); + * // => 'matches A' + * + * func({ a: 0, b: 1 }); + * // => 'matches B' + * + * func({ a: '1', b: '2' }); + * // => 'no match' + */ +declare function cond(pairs: Array<[truthy: () => boolean, falsey: () => R]>): () => R; +/** + * Creates a function that checks conditions one by one and runs the matching function. + * + * Each pair consists of a condition (predicate) and a function to run. + * The function goes through each condition in order until it finds one that's true. + * When it finds a true condition, it runs the corresponding function and returns its result. + * If none of the conditions are true, it returns undefined. + * + * @param {Array} pairs - Array of pairs. Each pair consists of a predicate function and a function to run. + * @returns {(...args: any[]) => unknown} A new composite function that checks conditions and runs the matching function. + * @example + * + * const func = cond([ + * [matches({ a: 1 }), constant('matches A')], + * [conforms({ b: isNumber }), constant('matches B')], + * [stubTrue, constant('no match')] + * ]); + * + * func({ a: 1, b: 2 }); + * // => 'matches A' + * + * func({ a: 0, b: 1 }); + * // => 'matches B' + * + * func({ a: '1', b: '2' }); + * // => 'no match' + */ +declare function cond(pairs: Array<[truthy: (val: T) => boolean, falsey: (val: T) => R]>): (val: T) => R; +//#endregion +export { cond }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/cond.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/cond.js new file mode 100644 index 0000000000000000000000000000000000000000..f183814d92c3dfa76bdeccd3189b4e4359f30a72 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/cond.js @@ -0,0 +1,22 @@ +const require_isFunction = require("../../predicate/isFunction.js"); +const require_iteratee = require("./iteratee.js"); +//#region src/compat/util/cond.ts +function cond(pairs) { + const length = pairs.length; + const processedPairs = pairs.map((pair) => { + const predicate = pair[0]; + const func = pair[1]; + if (!require_isFunction.isFunction(func)) throw new TypeError("Expected a function"); + return [require_iteratee.iteratee(predicate), func]; + }); + return function(...args) { + for (let i = 0; i < length; i++) { + const pair = processedPairs[i]; + const predicate = pair[0]; + const func = pair[1]; + if (predicate.apply(this, args)) return func.apply(this, args); + } + }; +} +//#endregion +exports.cond = cond; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/cond.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/cond.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b82100d6ed5db91aae9b222b151a9769ab2fbb03 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/cond.mjs @@ -0,0 +1,22 @@ +import { isFunction } from "../../predicate/isFunction.mjs"; +import { iteratee } from "./iteratee.mjs"; +//#region src/compat/util/cond.ts +function cond(pairs) { + const length = pairs.length; + const processedPairs = pairs.map((pair) => { + const predicate = pair[0]; + const func = pair[1]; + if (!isFunction(func)) throw new TypeError("Expected a function"); + return [iteratee(predicate), func]; + }); + return function(...args) { + for (let i = 0; i < length; i++) { + const pair = processedPairs[i]; + const predicate = pair[0]; + const func = pair[1]; + if (predicate.apply(this, args)) return func.apply(this, args); + } + }; +} +//#endregion +export { cond }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/constant.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/constant.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..5b829f51f6dbe15dc1c1d754e5a21a419b17e21d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/constant.d.mts @@ -0,0 +1,11 @@ +//#region src/compat/util/constant.d.ts +/** + * Creates a new function that always returns `value`. + * + * @template T - The type of the value to return. + * @param {T} value - The value to return from the new function. + * @returns {() => T} Returns the new constant function. + */ +declare function constant(value: T): () => T; +//#endregion +export { constant }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/constant.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/constant.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5b829f51f6dbe15dc1c1d754e5a21a419b17e21d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/constant.d.ts @@ -0,0 +1,11 @@ +//#region src/compat/util/constant.d.ts +/** + * Creates a new function that always returns `value`. + * + * @template T - The type of the value to return. + * @param {T} value - The value to return from the new function. + * @returns {() => T} Returns the new constant function. + */ +declare function constant(value: T): () => T; +//#endregion +export { constant }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/constant.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/constant.js new file mode 100644 index 0000000000000000000000000000000000000000..49ef9961183ceec24bda90957597dbe6414ef765 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/constant.js @@ -0,0 +1,20 @@ +//#region src/compat/util/constant.ts +/** +* Creates a new function that always returns `value`. +* +* @template T - The type of the value to return. +* @param {T} value - The value to return from the new function. +* @returns {() => T | undefined} Returns the new constant function. +* +* @example +* const object = { a: 1 }; +* const returnsObject = constant(object); +* +* returnsObject(); // => { a: 1 } +* returnsObject() === object; // => true +*/ +function constant(value) { + return () => value; +} +//#endregion +exports.constant = constant; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/constant.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/constant.mjs new file mode 100644 index 0000000000000000000000000000000000000000..65a65e8cda4839d55b9e8852ca46ae73e3112e7d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/constant.mjs @@ -0,0 +1,20 @@ +//#region src/compat/util/constant.ts +/** +* Creates a new function that always returns `value`. +* +* @template T - The type of the value to return. +* @param {T} value - The value to return from the new function. +* @returns {() => T | undefined} Returns the new constant function. +* +* @example +* const object = { a: 1 }; +* const returnsObject = constant(object); +* +* returnsObject(); // => { a: 1 } +* returnsObject() === object; // => true +*/ +function constant(value) { + return () => value; +} +//#endregion +export { constant }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/defaultTo.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/defaultTo.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..a79c8130420373d16a24b08d0eb13bb66298b172 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/defaultTo.d.mts @@ -0,0 +1,22 @@ +//#region src/compat/util/defaultTo.d.ts +/** + * Returns the default value for `null`, `undefined`, and `NaN`. + * + * @template T - The type of the value parameter + * @param {T | null | undefined} value - The value to check. + * @param {T} defaultValue - The default value to return if the first value is null, undefined, or NaN. + * @returns {T} Returns either the first value or the default value. + */ +declare function defaultTo(value: T | null | undefined, defaultValue: T): T; +/** + * Returns the default value for `null`, `undefined`, and `NaN`. + * + * @template T - The type of the value parameter + * @template D - The type of the defaultValue parameter + * @param {T | null | undefined} value - The value to check. + * @param {D} defaultValue - The default value to return if the first value is null, undefined, or NaN. + * @returns {T | D} Returns either the first value or the default value. + */ +declare function defaultTo(value: T | null | undefined, defaultValue: D): T | D; +//#endregion +export { defaultTo }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/defaultTo.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/defaultTo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a79c8130420373d16a24b08d0eb13bb66298b172 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/defaultTo.d.ts @@ -0,0 +1,22 @@ +//#region src/compat/util/defaultTo.d.ts +/** + * Returns the default value for `null`, `undefined`, and `NaN`. + * + * @template T - The type of the value parameter + * @param {T | null | undefined} value - The value to check. + * @param {T} defaultValue - The default value to return if the first value is null, undefined, or NaN. + * @returns {T} Returns either the first value or the default value. + */ +declare function defaultTo(value: T | null | undefined, defaultValue: T): T; +/** + * Returns the default value for `null`, `undefined`, and `NaN`. + * + * @template T - The type of the value parameter + * @template D - The type of the defaultValue parameter + * @param {T | null | undefined} value - The value to check. + * @param {D} defaultValue - The default value to return if the first value is null, undefined, or NaN. + * @returns {T | D} Returns either the first value or the default value. + */ +declare function defaultTo(value: T | null | undefined, defaultValue: D): T | D; +//#endregion +export { defaultTo }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/defaultTo.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/defaultTo.js new file mode 100644 index 0000000000000000000000000000000000000000..2767cb7d39c06a46469d5b84ff11385bbf392294 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/defaultTo.js @@ -0,0 +1,23 @@ +//#region src/compat/util/defaultTo.ts +/** +* Returns the default value for `null`, `undefined`, and `NaN`. +* +* @template T - The type of the value parameter +* @template D - The type of the defaultValue parameter +* @param {T | null | undefined} value - The value to check. +* @param {T | D} defaultValue - The default value to return if the first value is null, undefined, or NaN. +* @returns {T | D} Returns either the first value or the default value. +* +* @example +* defaultTo(null, 'default') // returns 'default' +* defaultTo(undefined, 42) // returns 42 +* defaultTo(NaN, 0) // returns 0 +* defaultTo('actual', 'default') // returns 'actual' +* defaultTo(123, 0) // returns 123 +*/ +function defaultTo(value, defaultValue) { + if (value == null || Number.isNaN(value)) return defaultValue; + return value; +} +//#endregion +exports.defaultTo = defaultTo; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/defaultTo.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/defaultTo.mjs new file mode 100644 index 0000000000000000000000000000000000000000..fdf1f626ab05884c89cdfcf8f2a4767c61306dc0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/defaultTo.mjs @@ -0,0 +1,23 @@ +//#region src/compat/util/defaultTo.ts +/** +* Returns the default value for `null`, `undefined`, and `NaN`. +* +* @template T - The type of the value parameter +* @template D - The type of the defaultValue parameter +* @param {T | null | undefined} value - The value to check. +* @param {T | D} defaultValue - The default value to return if the first value is null, undefined, or NaN. +* @returns {T | D} Returns either the first value or the default value. +* +* @example +* defaultTo(null, 'default') // returns 'default' +* defaultTo(undefined, 42) // returns 42 +* defaultTo(NaN, 0) // returns 0 +* defaultTo('actual', 'default') // returns 'actual' +* defaultTo(123, 0) // returns 123 +*/ +function defaultTo(value, defaultValue) { + if (value == null || Number.isNaN(value)) return defaultValue; + return value; +} +//#endregion +export { defaultTo }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/eq.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/eq.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..57c51c0c58e2947cf78cf24c2387d5ecab3b62f3 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/eq.d.mts @@ -0,0 +1 @@ +import { isEqualsSameValueZero } from "../../_internal/isEqualsSameValueZero.mjs"; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/eq.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/eq.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c742b053e75a21b3eaa8ab1be781b7f41d6c952f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/eq.d.ts @@ -0,0 +1 @@ +import { isEqualsSameValueZero } from "../../_internal/isEqualsSameValueZero.js"; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/eq.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/eq.js new file mode 100644 index 0000000000000000000000000000000000000000..2cda22f2e41e29fdfd53c94fd829c167a7ec8cdd --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/eq.js @@ -0,0 +1 @@ +require("../../_internal/isEqualsSameValueZero.js"); diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/eq.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/eq.mjs new file mode 100644 index 0000000000000000000000000000000000000000..14eb62d53b0635188d2f6dfd81001e9f9c6bafca --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/eq.mjs @@ -0,0 +1 @@ +import "../../_internal/isEqualsSameValueZero.mjs"; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/gt.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/gt.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..3d37a39c516c8a9c3dd2a60a8141da993fbaeefc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/gt.d.mts @@ -0,0 +1,16 @@ +//#region src/compat/util/gt.d.ts +/** + * Checks if value is greater than other. + * + * @param {any} value The value to compare. + * @param {any} other The other value to compare. + * @returns {boolean} Returns `true` if value is greater than other, else `false`. + * + * @example + * gt(3, 1); // true + * gt(3, 3); // false + * gt(1, 3); // false + */ +declare function gt(value: any, other: any): boolean; +//#endregion +export { gt }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/gt.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/gt.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3d37a39c516c8a9c3dd2a60a8141da993fbaeefc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/gt.d.ts @@ -0,0 +1,16 @@ +//#region src/compat/util/gt.d.ts +/** + * Checks if value is greater than other. + * + * @param {any} value The value to compare. + * @param {any} other The other value to compare. + * @returns {boolean} Returns `true` if value is greater than other, else `false`. + * + * @example + * gt(3, 1); // true + * gt(3, 3); // false + * gt(1, 3); // false + */ +declare function gt(value: any, other: any): boolean; +//#endregion +export { gt }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/gt.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/gt.js new file mode 100644 index 0000000000000000000000000000000000000000..599ce336c3b52930af52e00e7a76948587323240 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/gt.js @@ -0,0 +1,20 @@ +const require_toNumber = require("./toNumber.js"); +//#region src/compat/util/gt.ts +/** +* Checks if value is greater than other. +* +* @param {any} value The value to compare. +* @param {any} other The other value to compare. +* @returns {boolean} Returns `true` if value is greater than other, else `false`. +* +* @example +* gt(3, 1); // true +* gt(3, 3); // false +* gt(1, 3); // false +*/ +function gt(value, other) { + if (typeof value === "string" && typeof other === "string") return value > other; + return require_toNumber.toNumber(value) > require_toNumber.toNumber(other); +} +//#endregion +exports.gt = gt; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/gt.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/gt.mjs new file mode 100644 index 0000000000000000000000000000000000000000..a6a2c1e0665ba611ede9c1cfbe7aa30e2b0b24fc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/gt.mjs @@ -0,0 +1,20 @@ +import { toNumber } from "./toNumber.mjs"; +//#region src/compat/util/gt.ts +/** +* Checks if value is greater than other. +* +* @param {any} value The value to compare. +* @param {any} other The other value to compare. +* @returns {boolean} Returns `true` if value is greater than other, else `false`. +* +* @example +* gt(3, 1); // true +* gt(3, 3); // false +* gt(1, 3); // false +*/ +function gt(value, other) { + if (typeof value === "string" && typeof other === "string") return value > other; + return toNumber(value) > toNumber(other); +} +//#endregion +export { gt }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/gte.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/gte.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..81d93d1476d83ad945262334e47ea80976d370cf --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/gte.d.mts @@ -0,0 +1,16 @@ +//#region src/compat/util/gte.d.ts +/** + * Checks if value is greater than or equal to other. + * + * @param {any} value The value to compare. + * @param {any} other The other value to compare. + * @returns {boolean} Returns `true` if value is greater than or equal to other, else `false`. + * + * @example + * gte(3, 1); // => true + * gte(3, 3); // => true + * gte(1, 3); // => false + */ +declare function gte(value: any, other: any): boolean; +//#endregion +export { gte }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/gte.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/gte.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..81d93d1476d83ad945262334e47ea80976d370cf --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/gte.d.ts @@ -0,0 +1,16 @@ +//#region src/compat/util/gte.d.ts +/** + * Checks if value is greater than or equal to other. + * + * @param {any} value The value to compare. + * @param {any} other The other value to compare. + * @returns {boolean} Returns `true` if value is greater than or equal to other, else `false`. + * + * @example + * gte(3, 1); // => true + * gte(3, 3); // => true + * gte(1, 3); // => false + */ +declare function gte(value: any, other: any): boolean; +//#endregion +export { gte }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/gte.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/gte.js new file mode 100644 index 0000000000000000000000000000000000000000..c706d2efede10abf0dd5f3bb22fcec628e933bcc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/gte.js @@ -0,0 +1,20 @@ +const require_toNumber = require("./toNumber.js"); +//#region src/compat/util/gte.ts +/** +* Checks if value is greater than or equal to other. +* +* @param {any} value The value to compare. +* @param {any} other The other value to compare. +* @returns {boolean} Returns `true` if value is greater than or equal to other, else `false`. +* +* @example +* gte(3, 1); // => true +* gte(3, 3); // => true +* gte(1, 3); // => false +*/ +function gte(value, other) { + if (typeof value === "string" && typeof other === "string") return value >= other; + return require_toNumber.toNumber(value) >= require_toNumber.toNumber(other); +} +//#endregion +exports.gte = gte; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/gte.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/gte.mjs new file mode 100644 index 0000000000000000000000000000000000000000..2b24f0ff5b7be91f877504c76802b4147042fa25 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/gte.mjs @@ -0,0 +1,20 @@ +import { toNumber } from "./toNumber.mjs"; +//#region src/compat/util/gte.ts +/** +* Checks if value is greater than or equal to other. +* +* @param {any} value The value to compare. +* @param {any} other The other value to compare. +* @returns {boolean} Returns `true` if value is greater than or equal to other, else `false`. +* +* @example +* gte(3, 1); // => true +* gte(3, 3); // => true +* gte(1, 3); // => false +*/ +function gte(value, other) { + if (typeof value === "string" && typeof other === "string") return value >= other; + return toNumber(value) >= toNumber(other); +} +//#endregion +export { gte }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/invoke.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/invoke.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0594f51142b9abb223ea3c70fef2c9bd9417d590 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/invoke.d.mts @@ -0,0 +1,24 @@ +//#region src/compat/util/invoke.d.ts +/** + * Invokes the method at `path` of `object` with the given arguments. + * + * @param {any} object - The object to query. + * @param {PropertyKey | PropertyKey[]} path - The path of the method to invoke. + * @param {any[]} args - The arguments to invoke the method with. + * @returns {any} - Returns the result of the invoked method. + * + * @example + * const object = { + * a: { + * b: function (x, y) { + * return x + y; + * } + * } + * }; + * + * invoke(object, 'a.b', [1, 2]); // => 3 + * invoke(object, ['a', 'b'], [1, 2]); // => 3 + */ +declare function invoke(object: any, path: PropertyKey | readonly PropertyKey[], ...args: any[]): any; +//#endregion +export { invoke }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/invoke.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/invoke.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0594f51142b9abb223ea3c70fef2c9bd9417d590 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/invoke.d.ts @@ -0,0 +1,24 @@ +//#region src/compat/util/invoke.d.ts +/** + * Invokes the method at `path` of `object` with the given arguments. + * + * @param {any} object - The object to query. + * @param {PropertyKey | PropertyKey[]} path - The path of the method to invoke. + * @param {any[]} args - The arguments to invoke the method with. + * @returns {any} - Returns the result of the invoked method. + * + * @example + * const object = { + * a: { + * b: function (x, y) { + * return x + y; + * } + * } + * }; + * + * invoke(object, 'a.b', [1, 2]); // => 3 + * invoke(object, ['a', 'b'], [1, 2]); // => 3 + */ +declare function invoke(object: any, path: PropertyKey | readonly PropertyKey[], ...args: any[]): any; +//#endregion +export { invoke }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/invoke.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/invoke.js new file mode 100644 index 0000000000000000000000000000000000000000..4a77f10956b564c1e0898fb95eefcd502d01b497 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/invoke.js @@ -0,0 +1,49 @@ +const require_toKey = require("../_internal/toKey.js"); +const require_toPath = require("./toPath.js"); +const require_get = require("../object/get.js"); +const require_last = require("../array/last.js"); +//#region src/compat/util/invoke.ts +/** +* Invokes the method at `path` of `object` with the given arguments. +* +* @param {any} object - The object to query. +* @param {PropertyKey | PropertyKey[]} path - The path of the method to invoke. +* @param {any[]} args - The arguments to invoke the method with. +* @returns {any} - Returns the result of the invoked method. +* +* @example +* const object = { +* a: { +* b: function (x, y) { +* return x + y; +* } +* } +* }; +* +* invoke(object, 'a.b', [1, 2]); // => 3 +* invoke(object, ['a', 'b'], [1, 2]); // => 3 +*/ +function invoke(object, path, ...args) { + args = args.flat(1); + if (object == null) return; + switch (typeof path) { + case "string": + if (typeof object === "object" && Object.hasOwn(object, path)) return invokeImpl(object, [path], args); + return invokeImpl(object, require_toPath.toPath(path), args); + case "number": + case "symbol": return invokeImpl(object, [path], args); + default: if (Array.isArray(path)) return invokeImpl(object, path, args); + else return invokeImpl(object, [path], args); + } +} +function invokeImpl(object, path, args) { + const parent = require_get.get(object, path.slice(0, -1), object); + if (parent == null) return; + let lastKey = require_last.last(path); + const lastValue = lastKey?.valueOf(); + if (typeof lastValue === "number") lastKey = require_toKey.toKey(lastValue); + else lastKey = String(lastKey); + return require_get.get(parent, lastKey)?.apply(parent, args); +} +//#endregion +exports.invoke = invoke; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/invoke.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/invoke.mjs new file mode 100644 index 0000000000000000000000000000000000000000..179479d8fb9c091db3e22517608a8ae375df09cb --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/invoke.mjs @@ -0,0 +1,49 @@ +import { toKey } from "../_internal/toKey.mjs"; +import { toPath } from "./toPath.mjs"; +import { get } from "../object/get.mjs"; +import { last } from "../array/last.mjs"; +//#region src/compat/util/invoke.ts +/** +* Invokes the method at `path` of `object` with the given arguments. +* +* @param {any} object - The object to query. +* @param {PropertyKey | PropertyKey[]} path - The path of the method to invoke. +* @param {any[]} args - The arguments to invoke the method with. +* @returns {any} - Returns the result of the invoked method. +* +* @example +* const object = { +* a: { +* b: function (x, y) { +* return x + y; +* } +* } +* }; +* +* invoke(object, 'a.b', [1, 2]); // => 3 +* invoke(object, ['a', 'b'], [1, 2]); // => 3 +*/ +function invoke(object, path, ...args) { + args = args.flat(1); + if (object == null) return; + switch (typeof path) { + case "string": + if (typeof object === "object" && Object.hasOwn(object, path)) return invokeImpl(object, [path], args); + return invokeImpl(object, toPath(path), args); + case "number": + case "symbol": return invokeImpl(object, [path], args); + default: if (Array.isArray(path)) return invokeImpl(object, path, args); + else return invokeImpl(object, [path], args); + } +} +function invokeImpl(object, path, args) { + const parent = get(object, path.slice(0, -1), object); + if (parent == null) return; + let lastKey = last(path); + const lastValue = lastKey?.valueOf(); + if (typeof lastValue === "number") lastKey = toKey(lastValue); + else lastKey = String(lastKey); + return get(parent, lastKey)?.apply(parent, args); +} +//#endregion +export { invoke }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/iteratee.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/iteratee.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..ab6546ad67ac1b140dc5fb0cfdec73eefb17e5c3 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/iteratee.d.mts @@ -0,0 +1,34 @@ +//#region src/compat/util/iteratee.d.ts +/** + * Returns the provided function as-is when it is a function type. + * + * @template F - The function type + * @param {F} func - The function to return + * @returns {F} Returns the provided function unchanged + * + * @example + * const fn = (x: number) => x * 2; + * const iterateeFn = iteratee(fn); + * iterateeFn(4); // => 8 + */ +declare function iteratee any>(func: F): F; +/** + * Creates an iteratee function based on the provided property key or object. + * If given a property key, returns a function that gets that property from objects. + * If given an object, returns a function that matches objects against the provided one. + * + * @param {PropertyKey | object} func - The value to convert to an iteratee + * @returns {Function} Returns the iteratee function + * + * @example + * // With property key + * const getLength = iteratee('length'); + * getLength([1,2,3]); // => 3 + * + * // With object + * const matchObj = iteratee({ x: 1, y: 2 }); + * matchObj({ x: 1, y: 2, z: 3 }); // => true + */ +declare function iteratee(func: PropertyKey | object): (...args: any[]) => any; +//#endregion +export { iteratee }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/iteratee.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/iteratee.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ab6546ad67ac1b140dc5fb0cfdec73eefb17e5c3 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/iteratee.d.ts @@ -0,0 +1,34 @@ +//#region src/compat/util/iteratee.d.ts +/** + * Returns the provided function as-is when it is a function type. + * + * @template F - The function type + * @param {F} func - The function to return + * @returns {F} Returns the provided function unchanged + * + * @example + * const fn = (x: number) => x * 2; + * const iterateeFn = iteratee(fn); + * iterateeFn(4); // => 8 + */ +declare function iteratee any>(func: F): F; +/** + * Creates an iteratee function based on the provided property key or object. + * If given a property key, returns a function that gets that property from objects. + * If given an object, returns a function that matches objects against the provided one. + * + * @param {PropertyKey | object} func - The value to convert to an iteratee + * @returns {Function} Returns the iteratee function + * + * @example + * // With property key + * const getLength = iteratee('length'); + * getLength([1,2,3]); // => 3 + * + * // With object + * const matchObj = iteratee({ x: 1, y: 2 }); + * matchObj({ x: 1, y: 2, z: 3 }); // => true + */ +declare function iteratee(func: PropertyKey | object): (...args: any[]) => any; +//#endregion +export { iteratee }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/iteratee.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/iteratee.js new file mode 100644 index 0000000000000000000000000000000000000000..27216268ff1cdda814b411400fc923369a8d1eca --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/iteratee.js @@ -0,0 +1,49 @@ +const require_identity = require("../../function/identity.js"); +const require_property = require("../object/property.js"); +const require_matches = require("../predicate/matches.js"); +const require_matchesProperty = require("../predicate/matchesProperty.js"); +//#region src/compat/util/iteratee.ts +/** +* Creates a function that returns a value from an element in a collection. +* +* You can call `iteratee` with the following types of arguments: +* +* - **Function**: Returns the function as-is, which will be called with the element from the collection. +* - **Property name**: Returns the value of the specified property from the element. +* - **Property-value pair**: Returns a boolean indicating whether the element's property matches the given value. +* - **Partial object**: Returns a boolean indicating whether the element matches the properties of the partial object. +* +* If you don't provide any arguments or pass `null`, this function will return a function that simply returns its input unchanged. +* +* @param {symbol | number | string | object | null | ((...args: any[]) => any)} value - The value to convert to an iteratee. +* @returns {(...args: any[]) => unknown} - Returns the new iteratee function. +* @example +* const func = iteratee(); +* [{ a: 1 }, { a: 2 }, { a: 3 }].map(func) // => [{ a: 1 }, { a: 2 }, { a: 3 }] +* +* const func = iteratee((object) => object.a); +* [{ a: 1 }, { a: 2 }, { a: 3 }].map(func) // => [1, 2, 3] +* +* const func = iteratee('a'); +* [{ a: 1 }, { a: 2 }, { a: 3 }].map(func) // => [1, 2, 3] +* +* const func = iteratee({ a: 1 }); +* [{ a: 1 }, { a: 2 }, { a: 3 }].find(func) // => { a: 1 } +* +* const func = iteratee(['a', 1]); +* [{ a: 1 }, { a: 2 }, { a: 3 }].find(func) // => { a: 1 } +*/ +function iteratee(value) { + if (value == null) return require_identity.identity; + switch (typeof value) { + case "function": return value; + case "object": + if (Array.isArray(value) && value.length === 2) return require_matchesProperty.matchesProperty(value[0], value[1]); + return require_matches.matches(value); + case "string": + case "symbol": + case "number": return require_property.property(value); + } +} +//#endregion +exports.iteratee = iteratee; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/iteratee.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/iteratee.mjs new file mode 100644 index 0000000000000000000000000000000000000000..1dcad8abb892390154aa6f7b10dfcbaa1199fb7d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/iteratee.mjs @@ -0,0 +1,49 @@ +import { identity } from "../../function/identity.mjs"; +import { property } from "../object/property.mjs"; +import { matches } from "../predicate/matches.mjs"; +import { matchesProperty } from "../predicate/matchesProperty.mjs"; +//#region src/compat/util/iteratee.ts +/** +* Creates a function that returns a value from an element in a collection. +* +* You can call `iteratee` with the following types of arguments: +* +* - **Function**: Returns the function as-is, which will be called with the element from the collection. +* - **Property name**: Returns the value of the specified property from the element. +* - **Property-value pair**: Returns a boolean indicating whether the element's property matches the given value. +* - **Partial object**: Returns a boolean indicating whether the element matches the properties of the partial object. +* +* If you don't provide any arguments or pass `null`, this function will return a function that simply returns its input unchanged. +* +* @param {symbol | number | string | object | null | ((...args: any[]) => any)} value - The value to convert to an iteratee. +* @returns {(...args: any[]) => unknown} - Returns the new iteratee function. +* @example +* const func = iteratee(); +* [{ a: 1 }, { a: 2 }, { a: 3 }].map(func) // => [{ a: 1 }, { a: 2 }, { a: 3 }] +* +* const func = iteratee((object) => object.a); +* [{ a: 1 }, { a: 2 }, { a: 3 }].map(func) // => [1, 2, 3] +* +* const func = iteratee('a'); +* [{ a: 1 }, { a: 2 }, { a: 3 }].map(func) // => [1, 2, 3] +* +* const func = iteratee({ a: 1 }); +* [{ a: 1 }, { a: 2 }, { a: 3 }].find(func) // => { a: 1 } +* +* const func = iteratee(['a', 1]); +* [{ a: 1 }, { a: 2 }, { a: 3 }].find(func) // => { a: 1 } +*/ +function iteratee(value) { + if (value == null) return identity; + switch (typeof value) { + case "function": return value; + case "object": + if (Array.isArray(value) && value.length === 2) return matchesProperty(value[0], value[1]); + return matches(value); + case "string": + case "symbol": + case "number": return property(value); + } +} +//#endregion +export { iteratee }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/lt.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/lt.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..01061a40d3fddef91379128cc4874f752a3c6f12 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/lt.d.mts @@ -0,0 +1,16 @@ +//#region src/compat/util/lt.d.ts +/** + * Checks if value is less than other. + * + * @param {any} value The value to compare. + * @param {any} other The other value to compare. + * @returns {boolean} Returns `true` if value is less than other, else `false`. + * + * @example + * lt(1, 3); // true + * lt(3, 3); // false + * lt(3, 1); // false + */ +declare function lt(value: any, other: any): boolean; +//#endregion +export { lt }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/lt.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/lt.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..01061a40d3fddef91379128cc4874f752a3c6f12 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/lt.d.ts @@ -0,0 +1,16 @@ +//#region src/compat/util/lt.d.ts +/** + * Checks if value is less than other. + * + * @param {any} value The value to compare. + * @param {any} other The other value to compare. + * @returns {boolean} Returns `true` if value is less than other, else `false`. + * + * @example + * lt(1, 3); // true + * lt(3, 3); // false + * lt(3, 1); // false + */ +declare function lt(value: any, other: any): boolean; +//#endregion +export { lt }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/lt.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/lt.js new file mode 100644 index 0000000000000000000000000000000000000000..1fa22c844107caf40bfafdac13f212c63402f2f9 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/lt.js @@ -0,0 +1,20 @@ +const require_toNumber = require("./toNumber.js"); +//#region src/compat/util/lt.ts +/** +* Checks if value is less than other. +* +* @param {any} value The value to compare. +* @param {any} other The other value to compare. +* @returns {boolean} Returns `true` if value is less than other, else `false`. +* +* @example +* lt(1, 3); // true +* lt(3, 3); // false +* lt(3, 1); // false +*/ +function lt(value, other) { + if (typeof value === "string" && typeof other === "string") return value < other; + return require_toNumber.toNumber(value) < require_toNumber.toNumber(other); +} +//#endregion +exports.lt = lt; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/lt.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/lt.mjs new file mode 100644 index 0000000000000000000000000000000000000000..00110f292689b133e493990878c569ae5c76b60c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/lt.mjs @@ -0,0 +1,20 @@ +import { toNumber } from "./toNumber.mjs"; +//#region src/compat/util/lt.ts +/** +* Checks if value is less than other. +* +* @param {any} value The value to compare. +* @param {any} other The other value to compare. +* @returns {boolean} Returns `true` if value is less than other, else `false`. +* +* @example +* lt(1, 3); // true +* lt(3, 3); // false +* lt(3, 1); // false +*/ +function lt(value, other) { + if (typeof value === "string" && typeof other === "string") return value < other; + return toNumber(value) < toNumber(other); +} +//#endregion +export { lt }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/lte.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/lte.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..bb24b5e5eb0d9fe58515f1fb45907f1b08972817 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/lte.d.mts @@ -0,0 +1,16 @@ +//#region src/compat/util/lte.d.ts +/** + * Checks if value is less than or equal to other. + * + * @param {any} value The value to compare. + * @param {any} other The other value to compare. + * @returns {boolean} Returns `true` if value is less than or equal to other, else `false`. + * + * @example + * lte(1, 3); // => true + * lte(3, 3); // => true + * lte(3, 1); // => false + */ +declare function lte(value: any, other: any): boolean; +//#endregion +export { lte }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/lte.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/lte.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bb24b5e5eb0d9fe58515f1fb45907f1b08972817 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/lte.d.ts @@ -0,0 +1,16 @@ +//#region src/compat/util/lte.d.ts +/** + * Checks if value is less than or equal to other. + * + * @param {any} value The value to compare. + * @param {any} other The other value to compare. + * @returns {boolean} Returns `true` if value is less than or equal to other, else `false`. + * + * @example + * lte(1, 3); // => true + * lte(3, 3); // => true + * lte(3, 1); // => false + */ +declare function lte(value: any, other: any): boolean; +//#endregion +export { lte }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/lte.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/lte.js new file mode 100644 index 0000000000000000000000000000000000000000..1a3ac9643194f7d11eae0ec2e2a91b662fda75a7 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/lte.js @@ -0,0 +1,20 @@ +const require_toNumber = require("./toNumber.js"); +//#region src/compat/util/lte.ts +/** +* Checks if value is less than or equal to other. +* +* @param {any} value The value to compare. +* @param {any} other The other value to compare. +* @returns {boolean} Returns `true` if value is less than or equal to other, else `false`. +* +* @example +* lte(1, 3); // => true +* lte(3, 3); // => true +* lte(3, 1); // => false +*/ +function lte(value, other) { + if (typeof value === "string" && typeof other === "string") return value <= other; + return require_toNumber.toNumber(value) <= require_toNumber.toNumber(other); +} +//#endregion +exports.lte = lte; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/lte.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/lte.mjs new file mode 100644 index 0000000000000000000000000000000000000000..44d42f957da843b09fc5ff8cbd2dff295761834b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/lte.mjs @@ -0,0 +1,20 @@ +import { toNumber } from "./toNumber.mjs"; +//#region src/compat/util/lte.ts +/** +* Checks if value is less than or equal to other. +* +* @param {any} value The value to compare. +* @param {any} other The other value to compare. +* @returns {boolean} Returns `true` if value is less than or equal to other, else `false`. +* +* @example +* lte(1, 3); // => true +* lte(3, 3); // => true +* lte(3, 1); // => false +*/ +function lte(value, other) { + if (typeof value === "string" && typeof other === "string") return value <= other; + return toNumber(value) <= toNumber(other); +} +//#endregion +export { lte }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/method.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/method.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..68f2b20ceffc4077f7ff54292e189ab8b480a656 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/method.d.mts @@ -0,0 +1,23 @@ +//#region src/compat/util/method.d.ts +/** + * Creates a function that invokes the method at `path` of a given object with the provided arguments. + * + * @param {PropertyKey | PropertyKey[]} path - The path of the method to invoke. + * @param {...any} args - The arguments to invoke the method with. + * @returns {(object?: unknown) => any} - Returns a new function that takes an object and invokes the method at `path` with `args`. + * + * @example + * const object = { + * a: { + * b: function (x, y) { + * return x + y; + * } + * } + * }; + * + * const add = method('a.b', 1, 2); + * console.log(add(object)); // => 3 + */ +declare function method(path: PropertyKey | readonly PropertyKey[], ...args: any[]): (object: any) => any; +//#endregion +export { method }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/method.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/method.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..68f2b20ceffc4077f7ff54292e189ab8b480a656 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/method.d.ts @@ -0,0 +1,23 @@ +//#region src/compat/util/method.d.ts +/** + * Creates a function that invokes the method at `path` of a given object with the provided arguments. + * + * @param {PropertyKey | PropertyKey[]} path - The path of the method to invoke. + * @param {...any} args - The arguments to invoke the method with. + * @returns {(object?: unknown) => any} - Returns a new function that takes an object and invokes the method at `path` with `args`. + * + * @example + * const object = { + * a: { + * b: function (x, y) { + * return x + y; + * } + * } + * }; + * + * const add = method('a.b', 1, 2); + * console.log(add(object)); // => 3 + */ +declare function method(path: PropertyKey | readonly PropertyKey[], ...args: any[]): (object: any) => any; +//#endregion +export { method }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/method.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/method.js new file mode 100644 index 0000000000000000000000000000000000000000..333d627c2586537cf23b843035771bc47d254b85 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/method.js @@ -0,0 +1,28 @@ +const require_invoke = require("./invoke.js"); +//#region src/compat/util/method.ts +/** +* Creates a function that invokes the method at `path` of a given object with the provided arguments. +* +* @param {PropertyKey | PropertyKey[]} path - The path of the method to invoke. +* @param {...any} args - The arguments to invoke the method with. +* @returns {(object?: unknown) => any} - Returns a new function that takes an object and invokes the method at `path` with `args`. +* +* @example +* const object = { +* a: { +* b: function (x, y) { +* return x + y; +* } +* } +* }; +* +* const add = method('a.b', 1, 2); +* console.log(add(object)); // => 3 +*/ +function method(path, ...args) { + return function(object) { + return require_invoke.invoke(object, path, args); + }; +} +//#endregion +exports.method = method; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/method.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/method.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7eb2751e35d55b1098f17c1eb61f7ea972dcb69e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/method.mjs @@ -0,0 +1,28 @@ +import { invoke } from "./invoke.mjs"; +//#region src/compat/util/method.ts +/** +* Creates a function that invokes the method at `path` of a given object with the provided arguments. +* +* @param {PropertyKey | PropertyKey[]} path - The path of the method to invoke. +* @param {...any} args - The arguments to invoke the method with. +* @returns {(object?: unknown) => any} - Returns a new function that takes an object and invokes the method at `path` with `args`. +* +* @example +* const object = { +* a: { +* b: function (x, y) { +* return x + y; +* } +* } +* }; +* +* const add = method('a.b', 1, 2); +* console.log(add(object)); // => 3 +*/ +function method(path, ...args) { + return function(object) { + return invoke(object, path, args); + }; +} +//#endregion +export { method }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/methodOf.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/methodOf.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..6ae445118d6f9a8890e496e47f14de96a2b9a999 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/methodOf.d.mts @@ -0,0 +1,23 @@ +//#region src/compat/util/methodOf.d.ts +/** + * Creates a function that invokes the method at a given path of `object` with the provided arguments. + * + * @param {object} object - The object to query. + * @param {...any} args - The arguments to invoke the method with. + * @returns {(path: PropertyKey | PropertyKey[]) => any} - Returns a new function that takes a path and invokes the method at `path` with `args`. + * + * @example + * const object = { + * a: { + * b: function (x, y) { + * return x + y; + * } + * } + * }; + * + * const add = methodOf(object, 1, 2); + * console.log(add('a.b')); // => 3 + */ +declare function methodOf(object: object, ...args: any[]): (path: PropertyKey | readonly PropertyKey[]) => any; +//#endregion +export { methodOf }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/methodOf.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/methodOf.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6ae445118d6f9a8890e496e47f14de96a2b9a999 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/methodOf.d.ts @@ -0,0 +1,23 @@ +//#region src/compat/util/methodOf.d.ts +/** + * Creates a function that invokes the method at a given path of `object` with the provided arguments. + * + * @param {object} object - The object to query. + * @param {...any} args - The arguments to invoke the method with. + * @returns {(path: PropertyKey | PropertyKey[]) => any} - Returns a new function that takes a path and invokes the method at `path` with `args`. + * + * @example + * const object = { + * a: { + * b: function (x, y) { + * return x + y; + * } + * } + * }; + * + * const add = methodOf(object, 1, 2); + * console.log(add('a.b')); // => 3 + */ +declare function methodOf(object: object, ...args: any[]): (path: PropertyKey | readonly PropertyKey[]) => any; +//#endregion +export { methodOf }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/methodOf.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/methodOf.js new file mode 100644 index 0000000000000000000000000000000000000000..3df8846a67c0a1d881b4e1faf782a688e041f5b7 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/methodOf.js @@ -0,0 +1,28 @@ +const require_invoke = require("./invoke.js"); +//#region src/compat/util/methodOf.ts +/** +* Creates a function that invokes the method at a given path of `object` with the provided arguments. +* +* @param {object} object - The object to query. +* @param {...any} args - The arguments to invoke the method with. +* @returns {(path: PropertyKey | PropertyKey[]) => any} - Returns a new function that takes a path and invokes the method at `path` with `args`. +* +* @example +* const object = { +* a: { +* b: function (x, y) { +* return x + y; +* } +* } +* }; +* +* const add = methodOf(object, 1, 2); +* console.log(add('a.b')); // => 3 +*/ +function methodOf(object, ...args) { + return function(path) { + return require_invoke.invoke(object, path, args); + }; +} +//#endregion +exports.methodOf = methodOf; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/methodOf.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/methodOf.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d426bd7e164f72804c69599fb722f6a3bd180839 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/methodOf.mjs @@ -0,0 +1,28 @@ +import { invoke } from "./invoke.mjs"; +//#region src/compat/util/methodOf.ts +/** +* Creates a function that invokes the method at a given path of `object` with the provided arguments. +* +* @param {object} object - The object to query. +* @param {...any} args - The arguments to invoke the method with. +* @returns {(path: PropertyKey | PropertyKey[]) => any} - Returns a new function that takes a path and invokes the method at `path` with `args`. +* +* @example +* const object = { +* a: { +* b: function (x, y) { +* return x + y; +* } +* } +* }; +* +* const add = methodOf(object, 1, 2); +* console.log(add('a.b')); // => 3 +*/ +function methodOf(object, ...args) { + return function(path) { + return invoke(object, path, args); + }; +} +//#endregion +export { methodOf }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/now.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/now.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..c7c872c188e3229b6188473ae2f8ea66950320e7 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/now.d.mts @@ -0,0 +1,19 @@ +//#region src/compat/util/now.d.ts +/** + * Returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC. + * + * @returns {number} The current time in milliseconds. + * + * @example + * const currentTime = now(); + * console.log(currentTime); // Outputs the current time in milliseconds + * + * @example + * const startTime = now(); + * // Some time-consuming operation + * const endTime = now(); + * console.log(`Operation took ${endTime - startTime} milliseconds`); + */ +declare function now(): number; +//#endregion +export { now }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/now.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/now.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c7c872c188e3229b6188473ae2f8ea66950320e7 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/now.d.ts @@ -0,0 +1,19 @@ +//#region src/compat/util/now.d.ts +/** + * Returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC. + * + * @returns {number} The current time in milliseconds. + * + * @example + * const currentTime = now(); + * console.log(currentTime); // Outputs the current time in milliseconds + * + * @example + * const startTime = now(); + * // Some time-consuming operation + * const endTime = now(); + * console.log(`Operation took ${endTime - startTime} milliseconds`); + */ +declare function now(): number; +//#endregion +export { now }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/now.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/now.js new file mode 100644 index 0000000000000000000000000000000000000000..4501b0b4a5f2f0472efdf744d3302710af29db8d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/now.js @@ -0,0 +1,21 @@ +//#region src/compat/util/now.ts +/** +* Returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC. +* +* @returns {number} The current time in milliseconds. +* +* @example +* const currentTime = now(); +* console.log(currentTime); // Outputs the current time in milliseconds +* +* @example +* const startTime = now(); +* // Some time-consuming operation +* const endTime = now(); +* console.log(`Operation took ${endTime - startTime} milliseconds`); +*/ +function now() { + return Date.now(); +} +//#endregion +exports.now = now; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/now.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/now.mjs new file mode 100644 index 0000000000000000000000000000000000000000..ef3ac7953aa3a6fb5c4e330da1e7af50e87ecac1 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/now.mjs @@ -0,0 +1,21 @@ +//#region src/compat/util/now.ts +/** +* Returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC. +* +* @returns {number} The current time in milliseconds. +* +* @example +* const currentTime = now(); +* console.log(currentTime); // Outputs the current time in milliseconds +* +* @example +* const startTime = now(); +* // Some time-consuming operation +* const endTime = now(); +* console.log(`Operation took ${endTime - startTime} milliseconds`); +*/ +function now() { + return Date.now(); +} +//#endregion +export { now }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/over.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/over.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..bc321ffd13b7175676771a6286ca12510c4ee45f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/over.d.mts @@ -0,0 +1,30 @@ +//#region src/compat/util/over.d.ts +/** + * Creates a function that invokes given functions and returns their results as an array. + * + * @param {Array} iteratees - The iteratees to invoke. + * @returns {(...args: any[]) => unknown[]} Returns the new function. + * + * @example + * const func = over([Math.max, Math.min]); + * const func2 = over(Math.max, Math.min); // same as above + * func(1, 2, 3, 4); + * // => [4, 1] + * func2(1, 2, 3, 4); + * // => [4, 1] + * + * const func = over(['a', 'b']); + * func({ a: 1, b: 2 }); + * // => [1, 2] + * + * const func = over([{ a: 1 }, { b: 2 }]); + * func({ a: 1, b: 2 }); + * // => [true, true] + * + * const func = over([['a', 1], ['b', 2]]); + * func({ a: 1, b: 2 }); + * // => [true, true] + */ +declare function over(...iteratees: Array<((...args: any[]) => T) | ReadonlyArray<(...args: any[]) => T>>): (...args: any[]) => T[]; +//#endregion +export { over }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/over.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/over.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bc321ffd13b7175676771a6286ca12510c4ee45f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/over.d.ts @@ -0,0 +1,30 @@ +//#region src/compat/util/over.d.ts +/** + * Creates a function that invokes given functions and returns their results as an array. + * + * @param {Array} iteratees - The iteratees to invoke. + * @returns {(...args: any[]) => unknown[]} Returns the new function. + * + * @example + * const func = over([Math.max, Math.min]); + * const func2 = over(Math.max, Math.min); // same as above + * func(1, 2, 3, 4); + * // => [4, 1] + * func2(1, 2, 3, 4); + * // => [4, 1] + * + * const func = over(['a', 'b']); + * func({ a: 1, b: 2 }); + * // => [1, 2] + * + * const func = over([{ a: 1 }, { b: 2 }]); + * func({ a: 1, b: 2 }); + * // => [true, true] + * + * const func = over([['a', 1], ['b', 2]]); + * func({ a: 1, b: 2 }); + * // => [true, true] + */ +declare function over(...iteratees: Array<((...args: any[]) => T) | ReadonlyArray<(...args: any[]) => T>>): (...args: any[]) => T[]; +//#endregion +export { over }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/over.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/over.js new file mode 100644 index 0000000000000000000000000000000000000000..e3e3d6b80753ae689c745fce7f6e04494a5b34ae --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/over.js @@ -0,0 +1,37 @@ +const require_iteratee = require("./iteratee.js"); +//#region src/compat/util/over.ts +/** +* Creates a function that invokes given functions and returns their results as an array. +* +* @param {Array} iteratees - The iteratees to invoke. +* @returns {(...args: any[]) => unknown[]} Returns the new function. +* +* @example +* const func = over([Math.max, Math.min]); +* const func2 = over(Math.max, Math.min); // same as above +* func(1, 2, 3, 4); +* // => [4, 1] +* func2(1, 2, 3, 4); +* // => [4, 1] +* +* const func = over(['a', 'b']); +* func({ a: 1, b: 2 }); +* // => [1, 2] +* +* const func = over([{ a: 1 }, { b: 2 }]); +* func({ a: 1, b: 2 }); +* // => [true, true] +* +* const func = over([['a', 1], ['b', 2]]); +* func({ a: 1, b: 2 }); +* // => [true, true] +*/ +function over(...iteratees) { + if (iteratees.length === 1 && Array.isArray(iteratees[0])) iteratees = iteratees[0]; + const funcs = iteratees.map((item) => require_iteratee.iteratee(item)); + return function(...args) { + return funcs.map((func) => func.apply(this, args)); + }; +} +//#endregion +exports.over = over; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/over.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/over.mjs new file mode 100644 index 0000000000000000000000000000000000000000..d97cf3e6eb13ab98d870c1b23aa62307b9d68cd9 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/over.mjs @@ -0,0 +1,37 @@ +import { iteratee } from "./iteratee.mjs"; +//#region src/compat/util/over.ts +/** +* Creates a function that invokes given functions and returns their results as an array. +* +* @param {Array} iteratees - The iteratees to invoke. +* @returns {(...args: any[]) => unknown[]} Returns the new function. +* +* @example +* const func = over([Math.max, Math.min]); +* const func2 = over(Math.max, Math.min); // same as above +* func(1, 2, 3, 4); +* // => [4, 1] +* func2(1, 2, 3, 4); +* // => [4, 1] +* +* const func = over(['a', 'b']); +* func({ a: 1, b: 2 }); +* // => [1, 2] +* +* const func = over([{ a: 1 }, { b: 2 }]); +* func({ a: 1, b: 2 }); +* // => [true, true] +* +* const func = over([['a', 1], ['b', 2]]); +* func({ a: 1, b: 2 }); +* // => [true, true] +*/ +function over(...iteratees) { + if (iteratees.length === 1 && Array.isArray(iteratees[0])) iteratees = iteratees[0]; + const funcs = iteratees.map((item) => iteratee(item)); + return function(...args) { + return funcs.map((func) => func.apply(this, args)); + }; +} +//#endregion +export { over }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/overEvery.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/overEvery.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..31b80ee36c58eeebc751078bf170f49aa6779a81 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/overEvery.d.mts @@ -0,0 +1,68 @@ +//#region src/compat/util/overEvery.d.ts +/** + * Creates a predicate function that checks if a value satisfies all of the given predicates. + * + * @template T - The type of the value to be checked. + * @template U - The first possible type that the value could match. + * @template V - The second possible type that the value could match. + * + * @param {(value: T) => value is U} predicate1 - A function that checks if the value matches type `U`. + * @param {(value: T) => value is V} predicate2 - A function that checks if the value matches type `V`. + * + * @returns {(value: T) => value is U & V} A function that takes a value and returns `true` if all predicates return truthy. + * + * @example + * const func = overEvery( + * (value) => typeof value === 'string', + * (value) => value === 'hello' + * ); + * + * func("hello"); // true + * func("world"); // false + * func(42); // false + */ +declare function overEvery(predicate1: (value: T) => value is U, predicate2: (value: T) => value is V): (value: T) => value is U & V; +/** + * Creates a function that checks if all of the given predicates return truthy for the provided values. + * + * @template T - The type of the values to be checked. + * + * @param {...Array<((...values: T[]) => boolean) | ReadonlyArray<(...values: T[]) => boolean>>} predicates - + * A list of predicates or arrays of predicates. Each predicate is a function that takes one or more values of + * type `T` and returns a boolean indicating whether the condition is satisfied for those values. + * + * @returns {(...values: T[]) => boolean} A function that takes a list of values and returns `true` if all of the + * predicates return truthy for the provided values, and `false` otherwise. + * + * @example + * const func = overEvery( + * (value) => typeof value === 'string', + * (value) => value.length > 3 + * ); + * + * func("hello"); // true + * func("hi"); // false + * func(42); // false + * + * @example + * const func = overEvery([ + * (value) => value.a > 0, + * (value) => value.b > 0 + * ]); + * + * func({ a: 1, b: 2 }); // true + * func({ a: 0, b: 2 }); // false + * + * @example + * const func = overEvery( + * (a, b) => typeof a === 'string' && typeof b === 'string', + * (a, b) => a.length > 3 && b.length > 3 + * ); + * + * func("hello", "world"); // true + * func("hi", "world"); // false + * func(1, 10); // false + */ +declare function overEvery(...predicates: Array<((...args: T[]) => boolean) | ReadonlyArray<(...args: T[]) => boolean>>): (...args: T[]) => boolean; +//#endregion +export { overEvery }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/overEvery.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/overEvery.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..31b80ee36c58eeebc751078bf170f49aa6779a81 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/overEvery.d.ts @@ -0,0 +1,68 @@ +//#region src/compat/util/overEvery.d.ts +/** + * Creates a predicate function that checks if a value satisfies all of the given predicates. + * + * @template T - The type of the value to be checked. + * @template U - The first possible type that the value could match. + * @template V - The second possible type that the value could match. + * + * @param {(value: T) => value is U} predicate1 - A function that checks if the value matches type `U`. + * @param {(value: T) => value is V} predicate2 - A function that checks if the value matches type `V`. + * + * @returns {(value: T) => value is U & V} A function that takes a value and returns `true` if all predicates return truthy. + * + * @example + * const func = overEvery( + * (value) => typeof value === 'string', + * (value) => value === 'hello' + * ); + * + * func("hello"); // true + * func("world"); // false + * func(42); // false + */ +declare function overEvery(predicate1: (value: T) => value is U, predicate2: (value: T) => value is V): (value: T) => value is U & V; +/** + * Creates a function that checks if all of the given predicates return truthy for the provided values. + * + * @template T - The type of the values to be checked. + * + * @param {...Array<((...values: T[]) => boolean) | ReadonlyArray<(...values: T[]) => boolean>>} predicates - + * A list of predicates or arrays of predicates. Each predicate is a function that takes one or more values of + * type `T` and returns a boolean indicating whether the condition is satisfied for those values. + * + * @returns {(...values: T[]) => boolean} A function that takes a list of values and returns `true` if all of the + * predicates return truthy for the provided values, and `false` otherwise. + * + * @example + * const func = overEvery( + * (value) => typeof value === 'string', + * (value) => value.length > 3 + * ); + * + * func("hello"); // true + * func("hi"); // false + * func(42); // false + * + * @example + * const func = overEvery([ + * (value) => value.a > 0, + * (value) => value.b > 0 + * ]); + * + * func({ a: 1, b: 2 }); // true + * func({ a: 0, b: 2 }); // false + * + * @example + * const func = overEvery( + * (a, b) => typeof a === 'string' && typeof b === 'string', + * (a, b) => a.length > 3 && b.length > 3 + * ); + * + * func("hello", "world"); // true + * func("hi", "world"); // false + * func(1, 10); // false + */ +declare function overEvery(...predicates: Array<((...args: T[]) => boolean) | ReadonlyArray<(...args: T[]) => boolean>>): (...args: T[]) => boolean; +//#endregion +export { overEvery }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/overEvery.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/overEvery.js new file mode 100644 index 0000000000000000000000000000000000000000..dd21b8396b48dea1d642574a258c51816c672271 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/overEvery.js @@ -0,0 +1,61 @@ +const require_iteratee = require("./iteratee.js"); +//#region src/compat/util/overEvery.ts +/** +* Creates a function that checks if all of the given predicates return truthy for the provided values. +* +* This function takes multiple predicates, which can either be individual predicate functions or arrays of predicates, +* and returns a new function that checks if all of the predicates return truthy when called with the provided values. +* +* @template T - The type of the values to be checked. +* +* @param {...Array<((...values: T[]) => boolean) | ReadonlyArray<(...values: T[]) => boolean>>} predicates - +* A list of predicates or arrays of predicates. Each predicate is a function that takes one or more values of +* type `T` and returns a boolean indicating whether the condition is satisfied for those values. +* +* @returns {(...values: T[]) => boolean} A function that takes a list of values and returns `true` if all of the +* predicates return truthy for the provided values, and `false` otherwise. +* +* @example +* const func = overEvery( +* (value) => typeof value === 'string', +* (value) => value.length > 3 +* ); +* +* func("hello"); // true +* func("hi"); // false +* func(42); // false +* +* @example +* const func = overEvery([ +* (value) => value.a > 0, +* (value) => value.b > 0 +* ]); +* +* func({ a: 1, b: 2 }); // true +* func({ a: 0, b: 2 }); // false +* +* @example +* const func = overEvery( +* (a, b) => typeof a === 'string' && typeof b === 'string', +* (a, b) => a.length > 3 && b.length > 3 +* ); +* +* func("hello", "world"); // true +* func("hi", "world"); // false +* func(1, 10); // false +*/ +function overEvery(...predicates) { + return function(...values) { + for (let i = 0; i < predicates.length; ++i) { + const predicate = predicates[i]; + if (!Array.isArray(predicate)) { + if (!require_iteratee.iteratee(predicate).apply(this, values)) return false; + continue; + } + for (let j = 0; j < predicate.length; ++j) if (!require_iteratee.iteratee(predicate[j]).apply(this, values)) return false; + } + return true; + }; +} +//#endregion +exports.overEvery = overEvery; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/overEvery.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/overEvery.mjs new file mode 100644 index 0000000000000000000000000000000000000000..136eac6f4d3be84fa626ff998cce5a877ff4930f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/overEvery.mjs @@ -0,0 +1,61 @@ +import { iteratee } from "./iteratee.mjs"; +//#region src/compat/util/overEvery.ts +/** +* Creates a function that checks if all of the given predicates return truthy for the provided values. +* +* This function takes multiple predicates, which can either be individual predicate functions or arrays of predicates, +* and returns a new function that checks if all of the predicates return truthy when called with the provided values. +* +* @template T - The type of the values to be checked. +* +* @param {...Array<((...values: T[]) => boolean) | ReadonlyArray<(...values: T[]) => boolean>>} predicates - +* A list of predicates or arrays of predicates. Each predicate is a function that takes one or more values of +* type `T` and returns a boolean indicating whether the condition is satisfied for those values. +* +* @returns {(...values: T[]) => boolean} A function that takes a list of values and returns `true` if all of the +* predicates return truthy for the provided values, and `false` otherwise. +* +* @example +* const func = overEvery( +* (value) => typeof value === 'string', +* (value) => value.length > 3 +* ); +* +* func("hello"); // true +* func("hi"); // false +* func(42); // false +* +* @example +* const func = overEvery([ +* (value) => value.a > 0, +* (value) => value.b > 0 +* ]); +* +* func({ a: 1, b: 2 }); // true +* func({ a: 0, b: 2 }); // false +* +* @example +* const func = overEvery( +* (a, b) => typeof a === 'string' && typeof b === 'string', +* (a, b) => a.length > 3 && b.length > 3 +* ); +* +* func("hello", "world"); // true +* func("hi", "world"); // false +* func(1, 10); // false +*/ +function overEvery(...predicates) { + return function(...values) { + for (let i = 0; i < predicates.length; ++i) { + const predicate = predicates[i]; + if (!Array.isArray(predicate)) { + if (!iteratee(predicate).apply(this, values)) return false; + continue; + } + for (let j = 0; j < predicate.length; ++j) if (!iteratee(predicate[j]).apply(this, values)) return false; + } + return true; + }; +} +//#endregion +export { overEvery }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/overSome.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/overSome.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..1e0372c823074a198428b87b57d899ad7ae3a863 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/overSome.d.mts @@ -0,0 +1,70 @@ +//#region src/compat/util/overSome.d.ts +/** + * Creates a predicate function that checks if a value satisfies at least one of the given predicates. + * + * @template T - The type of the value to be checked. + * @template U - The first possible type that the value could match. + * @template V - The second possible type that the value could match. + * + * @param {(value: T) => value is U} predicate1 - A function that checks if the value matches type `U`. + * @param {(value: T) => value is V} predicate2 - A function that checks if the value matches type `V`. + * + * @returns {(value: T) => value is U | V} A function that takes a value and returns `true` if any predicates return truthy. + * + * @example + * const func = overSome( + * (value) => typeof value === 'string', + * (value) => typeof value === 'number' + * ); + * + * func("hello"); // true + * func(42); // true + * func([]); // false + */ +declare function overSome(predicate1: (value: T) => value is U, predicate2: (value: T) => value is V): (value: T) => value is U | V; +/** + * Creates a function that checks if any of the given predicates return truthy for the provided values. + * + * @template T - The type of the values to be checked. + * + * @param {...Array<((...values: T[]) => boolean) | ReadonlyArray<(...values: T[]) => boolean>>} predicates - + * A list of predicates or arrays of predicates. Each predicate is a function that takes one or more values of + * type `T` and returns a boolean indicating whether the condition is satisfied for those values. + * + * @returns {(...values: T[]) => boolean} A function that takes a list of values and returns `true` if any of the + * predicates return truthy for the provided values, and `false` otherwise. + * + * @example + * const func = overSome( + * (value) => typeof value === 'string', + * (value) => typeof value === 'number', + * (value) => typeof value === 'symbol' + * ); + * + * func("hello"); // true + * func(42); // true + * func(Symbol()); // true + * func([]); // false + * + * @example + * const func = overSome([ + * (value) => value.a > 0, + * (value) => value.b > 0 + * ]); + * + * func({ a: 0, b: 2 }); // true + * func({ a: 0, b: 0 }); // false + * + * @example + * const func = overSome( + * (a, b) => typeof a === 'string' && typeof b === 'string', + * (a, b) => a > 0 && b > 0 + * ); + * + * func("hello", "world"); // true + * func(1, 10); // true + * func(0, 2); // false + */ +declare function overSome(...predicates: Array<((...values: T[]) => boolean) | ReadonlyArray<(...values: T[]) => boolean>>): (...values: T[]) => boolean; +//#endregion +export { overSome }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/overSome.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/overSome.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1e0372c823074a198428b87b57d899ad7ae3a863 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/overSome.d.ts @@ -0,0 +1,70 @@ +//#region src/compat/util/overSome.d.ts +/** + * Creates a predicate function that checks if a value satisfies at least one of the given predicates. + * + * @template T - The type of the value to be checked. + * @template U - The first possible type that the value could match. + * @template V - The second possible type that the value could match. + * + * @param {(value: T) => value is U} predicate1 - A function that checks if the value matches type `U`. + * @param {(value: T) => value is V} predicate2 - A function that checks if the value matches type `V`. + * + * @returns {(value: T) => value is U | V} A function that takes a value and returns `true` if any predicates return truthy. + * + * @example + * const func = overSome( + * (value) => typeof value === 'string', + * (value) => typeof value === 'number' + * ); + * + * func("hello"); // true + * func(42); // true + * func([]); // false + */ +declare function overSome(predicate1: (value: T) => value is U, predicate2: (value: T) => value is V): (value: T) => value is U | V; +/** + * Creates a function that checks if any of the given predicates return truthy for the provided values. + * + * @template T - The type of the values to be checked. + * + * @param {...Array<((...values: T[]) => boolean) | ReadonlyArray<(...values: T[]) => boolean>>} predicates - + * A list of predicates or arrays of predicates. Each predicate is a function that takes one or more values of + * type `T` and returns a boolean indicating whether the condition is satisfied for those values. + * + * @returns {(...values: T[]) => boolean} A function that takes a list of values and returns `true` if any of the + * predicates return truthy for the provided values, and `false` otherwise. + * + * @example + * const func = overSome( + * (value) => typeof value === 'string', + * (value) => typeof value === 'number', + * (value) => typeof value === 'symbol' + * ); + * + * func("hello"); // true + * func(42); // true + * func(Symbol()); // true + * func([]); // false + * + * @example + * const func = overSome([ + * (value) => value.a > 0, + * (value) => value.b > 0 + * ]); + * + * func({ a: 0, b: 2 }); // true + * func({ a: 0, b: 0 }); // false + * + * @example + * const func = overSome( + * (a, b) => typeof a === 'string' && typeof b === 'string', + * (a, b) => a > 0 && b > 0 + * ); + * + * func("hello", "world"); // true + * func(1, 10); // true + * func(0, 2); // false + */ +declare function overSome(...predicates: Array<((...values: T[]) => boolean) | ReadonlyArray<(...values: T[]) => boolean>>): (...values: T[]) => boolean; +//#endregion +export { overSome }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/overSome.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/overSome.js new file mode 100644 index 0000000000000000000000000000000000000000..3eae89f1dfdcec3563c132a72b223f8cf7fb0b9f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/overSome.js @@ -0,0 +1,63 @@ +const require_iteratee = require("./iteratee.js"); +//#region src/compat/util/overSome.ts +/** +* Creates a function that checks if any of the given predicates return truthy for the provided values. +* +* This function takes multiple predicates, which can either be individual predicate functions or arrays of predicates, +* and returns a new function that checks if any of the predicates return truthy when called with the provided values. +* +* @template T - The type of the values to be checked. +* +* @param {...Array<((...values: T[]) => boolean) | ReadonlyArray<(...values: T[]) => boolean>>} predicates - +* A list of predicates or arrays of predicates. Each predicate is a function that takes one or more values of +* type `T` and returns a boolean indicating whether the condition is satisfied for those values. +* +* @returns {(...values: T[]) => boolean} A function that takes a list of values and returns `true` if any of the +* predicates return truthy for the provided values, and `false` otherwise. +* +* @example +* const func = overSome( +* (value) => typeof value === 'string', +* (value) => typeof value === 'number', +* (value) => typeof value === 'symbol' +* ); +* +* func("hello"); // true +* func(42); // true +* func(Symbol()); // true +* func([]); // false +* +* @example +* const func = overSome([ +* (value) => value.a > 0, +* (value) => value.b > 0 +* ]); +* +* func({ a: 0, b: 2 }); // true +* func({ a: 0, b: 0 }); // false +* +* @example +* const func = overSome( +* (a, b) => typeof a === 'string' && typeof b === 'string', +* (a, b) => a > 0 && b > 0 +* ); +* +* func("hello", "world"); // true +* func(1, 10); // true +* func(0, 2); // false +*/ +function overSome(...predicates) { + return function(...values) { + for (let i = 0; i < predicates.length; ++i) { + const predicate = predicates[i]; + if (!Array.isArray(predicate)) { + if (require_iteratee.iteratee(predicate).apply(this, values)) return true; + continue; + } + for (let j = 0; j < predicate.length; ++j) if (require_iteratee.iteratee(predicate[j]).apply(this, values)) return true; + } + return false; + }; +} +//#endregion +exports.overSome = overSome; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/overSome.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/overSome.mjs new file mode 100644 index 0000000000000000000000000000000000000000..10ea4629614aa23eb60d62f950828726928f4fed --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/overSome.mjs @@ -0,0 +1,63 @@ +import { iteratee } from "./iteratee.mjs"; +//#region src/compat/util/overSome.ts +/** +* Creates a function that checks if any of the given predicates return truthy for the provided values. +* +* This function takes multiple predicates, which can either be individual predicate functions or arrays of predicates, +* and returns a new function that checks if any of the predicates return truthy when called with the provided values. +* +* @template T - The type of the values to be checked. +* +* @param {...Array<((...values: T[]) => boolean) | ReadonlyArray<(...values: T[]) => boolean>>} predicates - +* A list of predicates or arrays of predicates. Each predicate is a function that takes one or more values of +* type `T` and returns a boolean indicating whether the condition is satisfied for those values. +* +* @returns {(...values: T[]) => boolean} A function that takes a list of values and returns `true` if any of the +* predicates return truthy for the provided values, and `false` otherwise. +* +* @example +* const func = overSome( +* (value) => typeof value === 'string', +* (value) => typeof value === 'number', +* (value) => typeof value === 'symbol' +* ); +* +* func("hello"); // true +* func(42); // true +* func(Symbol()); // true +* func([]); // false +* +* @example +* const func = overSome([ +* (value) => value.a > 0, +* (value) => value.b > 0 +* ]); +* +* func({ a: 0, b: 2 }); // true +* func({ a: 0, b: 0 }); // false +* +* @example +* const func = overSome( +* (a, b) => typeof a === 'string' && typeof b === 'string', +* (a, b) => a > 0 && b > 0 +* ); +* +* func("hello", "world"); // true +* func(1, 10); // true +* func(0, 2); // false +*/ +function overSome(...predicates) { + return function(...values) { + for (let i = 0; i < predicates.length; ++i) { + const predicate = predicates[i]; + if (!Array.isArray(predicate)) { + if (iteratee(predicate).apply(this, values)) return true; + continue; + } + for (let j = 0; j < predicate.length; ++j) if (iteratee(predicate[j]).apply(this, values)) return true; + } + return false; + }; +} +//#endregion +export { overSome }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/stubArray.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubArray.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e4a8ce25cc548a9fd0d3f27d6e36a02e32640648 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubArray.d.mts @@ -0,0 +1,11 @@ +//#region src/compat/util/stubArray.d.ts +/** + * Returns a new empty array. + * + * @returns {Array} A new empty array. + * @example + * stubArray() // Returns [] + */ +declare function stubArray(): any[]; +//#endregion +export { stubArray }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/stubArray.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubArray.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e4a8ce25cc548a9fd0d3f27d6e36a02e32640648 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubArray.d.ts @@ -0,0 +1,11 @@ +//#region src/compat/util/stubArray.d.ts +/** + * Returns a new empty array. + * + * @returns {Array} A new empty array. + * @example + * stubArray() // Returns [] + */ +declare function stubArray(): any[]; +//#endregion +export { stubArray }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/stubArray.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubArray.js new file mode 100644 index 0000000000000000000000000000000000000000..30f1775a08b2883e79a2c777e92f9d017b3daf2e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubArray.js @@ -0,0 +1,6 @@ +//#region src/compat/util/stubArray.ts +function stubArray() { + return []; +} +//#endregion +exports.stubArray = stubArray; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/stubArray.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubArray.mjs new file mode 100644 index 0000000000000000000000000000000000000000..831dc0337bd20c79f697aa3b178859a632f64a7b --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubArray.mjs @@ -0,0 +1,6 @@ +//#region src/compat/util/stubArray.ts +function stubArray() { + return []; +} +//#endregion +export { stubArray }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/stubFalse.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubFalse.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..cf1c57eda1e040693391f6eac64b7041f38d1754 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubFalse.d.mts @@ -0,0 +1,19 @@ +//#region src/compat/util/stubFalse.d.ts +/** + * Returns false. + * + * @returns {boolean} false. + * @example + * stubFalse() // Returns false + */ +declare function stubFalse(): false; +/** + * Returns false. + * + * @returns {boolean} false. + * @example + * stubFalse() // Returns false + */ +declare function stubFalse(): false; +//#endregion +export { stubFalse }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/stubFalse.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubFalse.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cf1c57eda1e040693391f6eac64b7041f38d1754 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubFalse.d.ts @@ -0,0 +1,19 @@ +//#region src/compat/util/stubFalse.d.ts +/** + * Returns false. + * + * @returns {boolean} false. + * @example + * stubFalse() // Returns false + */ +declare function stubFalse(): false; +/** + * Returns false. + * + * @returns {boolean} false. + * @example + * stubFalse() // Returns false + */ +declare function stubFalse(): false; +//#endregion +export { stubFalse }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/stubFalse.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubFalse.js new file mode 100644 index 0000000000000000000000000000000000000000..782f4e39e674f4d86e812ded506b3cbd5fbfdc9e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubFalse.js @@ -0,0 +1,6 @@ +//#region src/compat/util/stubFalse.ts +function stubFalse() { + return false; +} +//#endregion +exports.stubFalse = stubFalse; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/stubFalse.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubFalse.mjs new file mode 100644 index 0000000000000000000000000000000000000000..956ce09ac280ba8223877dc2eb3ce3bb3dc6c8f0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubFalse.mjs @@ -0,0 +1,6 @@ +//#region src/compat/util/stubFalse.ts +function stubFalse() { + return false; +} +//#endregion +export { stubFalse }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/stubObject.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubObject.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..e15fa578d195d2fbd5431152f32ee88651598525 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubObject.d.mts @@ -0,0 +1,11 @@ +//#region src/compat/util/stubObject.d.ts +/** + * Returns an empty object. + * + * @returns {Object} An empty object. + * @example + * stubObject() // Returns {} + */ +declare function stubObject(): any; +//#endregion +export { stubObject }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/stubObject.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubObject.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e15fa578d195d2fbd5431152f32ee88651598525 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubObject.d.ts @@ -0,0 +1,11 @@ +//#region src/compat/util/stubObject.d.ts +/** + * Returns an empty object. + * + * @returns {Object} An empty object. + * @example + * stubObject() // Returns {} + */ +declare function stubObject(): any; +//#endregion +export { stubObject }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/stubObject.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubObject.js new file mode 100644 index 0000000000000000000000000000000000000000..0ed9f236b1c7d8fe3ee34b6bd80cf1d160f85645 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubObject.js @@ -0,0 +1,13 @@ +//#region src/compat/util/stubObject.ts +/** +* Returns an empty object. +* +* @returns {Object} An empty object. +* @example +* stubObject() // Returns {} +*/ +function stubObject() { + return {}; +} +//#endregion +exports.stubObject = stubObject; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/stubObject.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubObject.mjs new file mode 100644 index 0000000000000000000000000000000000000000..94428395366acd8103dcd859f73609f968116962 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubObject.mjs @@ -0,0 +1,13 @@ +//#region src/compat/util/stubObject.ts +/** +* Returns an empty object. +* +* @returns {Object} An empty object. +* @example +* stubObject() // Returns {} +*/ +function stubObject() { + return {}; +} +//#endregion +export { stubObject }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/stubString.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubString.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..4aa03c66e8d39f50eb01d1f633c0b5fb86962c91 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubString.d.mts @@ -0,0 +1,11 @@ +//#region src/compat/util/stubString.d.ts +/** + * Returns an empty string. + * + * @returns {string} An empty string. + * @example + * stubString() // Returns '' + */ +declare function stubString(): string; +//#endregion +export { stubString }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/stubString.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubString.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4aa03c66e8d39f50eb01d1f633c0b5fb86962c91 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubString.d.ts @@ -0,0 +1,11 @@ +//#region src/compat/util/stubString.d.ts +/** + * Returns an empty string. + * + * @returns {string} An empty string. + * @example + * stubString() // Returns '' + */ +declare function stubString(): string; +//#endregion +export { stubString }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/stubString.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubString.js new file mode 100644 index 0000000000000000000000000000000000000000..4922f56da3a774b2c692c6b2080942032e75ea6d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubString.js @@ -0,0 +1,6 @@ +//#region src/compat/util/stubString.ts +function stubString() { + return ""; +} +//#endregion +exports.stubString = stubString; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/stubString.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubString.mjs new file mode 100644 index 0000000000000000000000000000000000000000..4cafaaf7c2c2e443a1bd6644295e2e49eb6cb311 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubString.mjs @@ -0,0 +1,6 @@ +//#region src/compat/util/stubString.ts +function stubString() { + return ""; +} +//#endregion +export { stubString }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/stubTrue.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubTrue.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..145246d2bd2a7f6936c38e0daa0baaf07f42b006 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubTrue.d.mts @@ -0,0 +1,19 @@ +//#region src/compat/util/stubTrue.d.ts +/** + * Returns true. + * + * @returns {boolean} true. + * @example + * stubTrue() // Returns true + */ +declare function stubTrue(): true; +/** + * Returns true. + * + * @returns {boolean} true. + * @example + * stubTrue() // Returns true + */ +declare function stubTrue(): true; +//#endregion +export { stubTrue }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/stubTrue.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubTrue.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..145246d2bd2a7f6936c38e0daa0baaf07f42b006 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubTrue.d.ts @@ -0,0 +1,19 @@ +//#region src/compat/util/stubTrue.d.ts +/** + * Returns true. + * + * @returns {boolean} true. + * @example + * stubTrue() // Returns true + */ +declare function stubTrue(): true; +/** + * Returns true. + * + * @returns {boolean} true. + * @example + * stubTrue() // Returns true + */ +declare function stubTrue(): true; +//#endregion +export { stubTrue }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/stubTrue.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubTrue.js new file mode 100644 index 0000000000000000000000000000000000000000..98af579d7190cf9ad5215d01f9be455b2b8d831a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubTrue.js @@ -0,0 +1,6 @@ +//#region src/compat/util/stubTrue.ts +function stubTrue() { + return true; +} +//#endregion +exports.stubTrue = stubTrue; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/stubTrue.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubTrue.mjs new file mode 100644 index 0000000000000000000000000000000000000000..aef26b7f87b84a2e43306aed8db2df1484519cdf --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/stubTrue.mjs @@ -0,0 +1,6 @@ +//#region src/compat/util/stubTrue.ts +function stubTrue() { + return true; +} +//#endregion +export { stubTrue }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/times.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/times.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..79b06629e555b7249dcf095c4c579322ea0392e0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/times.d.mts @@ -0,0 +1,24 @@ +//#region src/compat/util/times.d.ts +/** + * Invokes the iteratee function n times, returning an array of the results. + * + * @template T The return type of the iteratee function. + * @param {number} n - The number of times to invoke iteratee. + * @param {(num: number) => T} iteratee - The function to invoke for each index. + * @returns {T[]} An array containing the results of invoking iteratee n times. + * @example + * times(3, (i) => i * 2); // => [0, 2, 4] + * times(2, () => 'es-toolkit'); // => ['es-toolkit', 'es-toolkit'] + */ +declare function times(n: number, iteratee: (num: number) => T): T[]; +/** + * Invokes the default iteratee function n times, returning an array of indices. + * + * @param {number} n - The number of times to invoke the default iteratee. + * @returns {number[]} An array containing indices from 0 to n-1. + * @example + * times(3); // => [0, 1, 2] + */ +declare function times(n: number): number[]; +//#endregion +export { times }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/times.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/times.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..79b06629e555b7249dcf095c4c579322ea0392e0 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/times.d.ts @@ -0,0 +1,24 @@ +//#region src/compat/util/times.d.ts +/** + * Invokes the iteratee function n times, returning an array of the results. + * + * @template T The return type of the iteratee function. + * @param {number} n - The number of times to invoke iteratee. + * @param {(num: number) => T} iteratee - The function to invoke for each index. + * @returns {T[]} An array containing the results of invoking iteratee n times. + * @example + * times(3, (i) => i * 2); // => [0, 2, 4] + * times(2, () => 'es-toolkit'); // => ['es-toolkit', 'es-toolkit'] + */ +declare function times(n: number, iteratee: (num: number) => T): T[]; +/** + * Invokes the default iteratee function n times, returning an array of indices. + * + * @param {number} n - The number of times to invoke the default iteratee. + * @returns {number[]} An array containing indices from 0 to n-1. + * @example + * times(3); // => [0, 1, 2] + */ +declare function times(n: number): number[]; +//#endregion +export { times }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/times.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/times.js new file mode 100644 index 0000000000000000000000000000000000000000..6237d7af73f9c3a3eeefd90e9b7eba641fc5aec3 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/times.js @@ -0,0 +1,22 @@ +const require_toInteger = require("./toInteger.js"); +//#region src/compat/util/times.ts +/** +* Invokes the getValue function n times, returning an array of the results. +* +* @template R The return type of the getValue function. +* @param {number} n - The number of times to invoke getValue. +* @param {(index: number) => R} getValue - The function to invoke for each index. +* @returns {R[]} An array containing the results of invoking getValue n times. +* @example +* times(3, (i) => i * 2); // => [0, 2, 4] +* times(2, () => 'es-toolkit'); // => ['es-toolkit', 'es-toolkit'] +*/ +function times(n, getValue) { + n = require_toInteger.toInteger(n); + if (n < 1 || !Number.isSafeInteger(n)) return []; + const result = new Array(n); + for (let i = 0; i < n; i++) result[i] = typeof getValue === "function" ? getValue(i) : i; + return result; +} +//#endregion +exports.times = times; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/times.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/times.mjs new file mode 100644 index 0000000000000000000000000000000000000000..6db84c81e10c3bf02e33d745ca92224365f07f46 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/times.mjs @@ -0,0 +1,22 @@ +import { toInteger } from "./toInteger.mjs"; +//#region src/compat/util/times.ts +/** +* Invokes the getValue function n times, returning an array of the results. +* +* @template R The return type of the getValue function. +* @param {number} n - The number of times to invoke getValue. +* @param {(index: number) => R} getValue - The function to invoke for each index. +* @returns {R[]} An array containing the results of invoking getValue n times. +* @example +* times(3, (i) => i * 2); // => [0, 2, 4] +* times(2, () => 'es-toolkit'); // => ['es-toolkit', 'es-toolkit'] +*/ +function times(n, getValue) { + n = toInteger(n); + if (n < 1 || !Number.isSafeInteger(n)) return []; + const result = new Array(n); + for (let i = 0; i < n; i++) result[i] = typeof getValue === "function" ? getValue(i) : i; + return result; +} +//#endregion +export { times }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toArray.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/toArray.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..88f05f3d53ff18eb19bd37dcef9a883d8b8a69b8 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toArray.d.mts @@ -0,0 +1,36 @@ +//#region src/compat/util/toArray.d.ts +/** + * Converts a record or null/undefined to an array of its values. + * + * @template T + * @param {Record | Record | null | undefined} value - The record or null/undefined to convert. + * @returns {T[]} Returns an array of the record's values or an empty array if null/undefined. + * + * @example + * toArray({ 'a': 1, 'b': 2 }) // => returns [1, 2] + * toArray(null) // => returns [] + */ +declare function toArray(value: Record | Record | null | undefined): T[]; +/** + * Converts a value to an array of its values. + * + * @template T + * @param {T} value - The value to convert. + * @returns {Array} Returns an array of the value's values. + * + * @example + * toArray({ x: 10, y: 20 }) // => returns [10, 20] + * toArray('abc') // => returns ['a', 'b', 'c'] + */ +declare function toArray(value: T): Array; +/** + * Converts an undefined value to an empty array. + * + * @returns {any[]} Returns an empty array. + * + * @example + * toArray() // => returns [] + */ +declare function toArray(): any[]; +//#endregion +export { toArray }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toArray.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/toArray.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..88f05f3d53ff18eb19bd37dcef9a883d8b8a69b8 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toArray.d.ts @@ -0,0 +1,36 @@ +//#region src/compat/util/toArray.d.ts +/** + * Converts a record or null/undefined to an array of its values. + * + * @template T + * @param {Record | Record | null | undefined} value - The record or null/undefined to convert. + * @returns {T[]} Returns an array of the record's values or an empty array if null/undefined. + * + * @example + * toArray({ 'a': 1, 'b': 2 }) // => returns [1, 2] + * toArray(null) // => returns [] + */ +declare function toArray(value: Record | Record | null | undefined): T[]; +/** + * Converts a value to an array of its values. + * + * @template T + * @param {T} value - The value to convert. + * @returns {Array} Returns an array of the value's values. + * + * @example + * toArray({ x: 10, y: 20 }) // => returns [10, 20] + * toArray('abc') // => returns ['a', 'b', 'c'] + */ +declare function toArray(value: T): Array; +/** + * Converts an undefined value to an empty array. + * + * @returns {any[]} Returns an empty array. + * + * @example + * toArray() // => returns [] + */ +declare function toArray(): any[]; +//#endregion +export { toArray }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toArray.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/toArray.js new file mode 100644 index 0000000000000000000000000000000000000000..e8a2aed839bff82d9b225690f32e55383f7d3a9a --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toArray.js @@ -0,0 +1,23 @@ +const require_isArrayLike = require("../predicate/isArrayLike.js"); +const require_isMap = require("../predicate/isMap.js"); +//#region src/compat/util/toArray.ts +/** +* Converts a value to an array. +* +* @param {unknown} value - The value to convert. +* @returns {any[]} Returns the converted array. +* +* @example +* toArray({ 'a': 1, 'b': 2 }) // => returns [1,2] +* toArray('abc') // => returns ['a', 'b', 'c'] +* toArray(1) // => returns [] +* toArray(null) // => returns [] +*/ +function toArray(value) { + if (value == null) return []; + if (require_isArrayLike.isArrayLike(value) || require_isMap.isMap(value)) return Array.from(value); + if (typeof value === "object") return Object.values(value); + return []; +} +//#endregion +exports.toArray = toArray; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toArray.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/toArray.mjs new file mode 100644 index 0000000000000000000000000000000000000000..5b4f79504d868c2ea1e5dff864ffd43f55d4ed28 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toArray.mjs @@ -0,0 +1,23 @@ +import { isArrayLike } from "../predicate/isArrayLike.mjs"; +import { isMap } from "../predicate/isMap.mjs"; +//#region src/compat/util/toArray.ts +/** +* Converts a value to an array. +* +* @param {unknown} value - The value to convert. +* @returns {any[]} Returns the converted array. +* +* @example +* toArray({ 'a': 1, 'b': 2 }) // => returns [1,2] +* toArray('abc') // => returns ['a', 'b', 'c'] +* toArray(1) // => returns [] +* toArray(null) // => returns [] +*/ +function toArray(value) { + if (value == null) return []; + if (isArrayLike(value) || isMap(value)) return Array.from(value); + if (typeof value === "object") return Object.values(value); + return []; +} +//#endregion +export { toArray }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toFinite.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/toFinite.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..607d1563610e66e1958555fa0486ca30535dbe09 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toFinite.d.mts @@ -0,0 +1,18 @@ +//#region src/compat/util/toFinite.d.ts +/** + * Converts `value` to a finite number. + * + * @param {unknown} value - The value to convert. + * @returns {number} Returns the number. + * + * @example + * toFinite(3.2); // => 3.2 + * toFinite(Number.MIN_VALUE); // => 5e-324 + * toFinite(Infinity); // => 1.7976931348623157e+308 + * toFinite('3.2'); // => 3.2 + * toFinite(Symbol.iterator); // => 0 + * toFinite(NaN); // => 0 + */ +declare function toFinite(value: any): number; +//#endregion +export { toFinite }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toFinite.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/toFinite.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..607d1563610e66e1958555fa0486ca30535dbe09 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toFinite.d.ts @@ -0,0 +1,18 @@ +//#region src/compat/util/toFinite.d.ts +/** + * Converts `value` to a finite number. + * + * @param {unknown} value - The value to convert. + * @returns {number} Returns the number. + * + * @example + * toFinite(3.2); // => 3.2 + * toFinite(Number.MIN_VALUE); // => 5e-324 + * toFinite(Infinity); // => 1.7976931348623157e+308 + * toFinite('3.2'); // => 3.2 + * toFinite(Symbol.iterator); // => 0 + * toFinite(NaN); // => 0 + */ +declare function toFinite(value: any): number; +//#endregion +export { toFinite }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toFinite.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/toFinite.js new file mode 100644 index 0000000000000000000000000000000000000000..d52b81d7ff399d778256ffe69edb4c53db34295f --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toFinite.js @@ -0,0 +1,24 @@ +const require_toNumber = require("./toNumber.js"); +//#region src/compat/util/toFinite.ts +/** +* Converts `value` to a finite number. +* +* @param {unknown} value - The value to convert. +* @returns {number} Returns the number. +* +* @example +* toFinite(3.2); // => 3.2 +* toFinite(Number.MIN_VALUE); // => 5e-324 +* toFinite(Infinity); // => 1.7976931348623157e+308 +* toFinite('3.2'); // => 3.2 +* toFinite(Symbol.iterator); // => 0 +* toFinite(NaN); // => 0 +*/ +function toFinite(value) { + if (!value) return value === 0 ? value : 0; + value = require_toNumber.toNumber(value); + if (value === Infinity || value === -Infinity) return (value < 0 ? -1 : 1) * Number.MAX_VALUE; + return value === value ? value : 0; +} +//#endregion +exports.toFinite = toFinite; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toFinite.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/toFinite.mjs new file mode 100644 index 0000000000000000000000000000000000000000..8d513c88e054f85c2e4acc48ad9461a5f7b02467 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toFinite.mjs @@ -0,0 +1,24 @@ +import { toNumber } from "./toNumber.mjs"; +//#region src/compat/util/toFinite.ts +/** +* Converts `value` to a finite number. +* +* @param {unknown} value - The value to convert. +* @returns {number} Returns the number. +* +* @example +* toFinite(3.2); // => 3.2 +* toFinite(Number.MIN_VALUE); // => 5e-324 +* toFinite(Infinity); // => 1.7976931348623157e+308 +* toFinite('3.2'); // => 3.2 +* toFinite(Symbol.iterator); // => 0 +* toFinite(NaN); // => 0 +*/ +function toFinite(value) { + if (!value) return value === 0 ? value : 0; + value = toNumber(value); + if (value === Infinity || value === -Infinity) return (value < 0 ? -1 : 1) * Number.MAX_VALUE; + return value === value ? value : 0; +} +//#endregion +export { toFinite }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toInteger.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/toInteger.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..25ee06fba0eba5a7f2b5db201220d6b32ecae1cc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toInteger.d.mts @@ -0,0 +1,21 @@ +//#region src/compat/util/toInteger.d.ts +/** + * Converts `value` to an integer. + * + * This function first converts `value` to a finite number. If the result has any decimal places, + * they are removed by rounding down to the nearest whole number. + * + * @param {unknown} value - The value to convert. + * @returns {number} Returns the number. + * + * @example + * toInteger(3.2); // => 3 + * toInteger(Number.MIN_VALUE); // => 0 + * toInteger(Infinity); // => 1.7976931348623157e+308 + * toInteger('3.2'); // => 3 + * toInteger(Symbol.iterator); // => 0 + * toInteger(NaN); // => 0 + */ +declare function toInteger(value: any): number; +//#endregion +export { toInteger }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toInteger.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/toInteger.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..25ee06fba0eba5a7f2b5db201220d6b32ecae1cc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toInteger.d.ts @@ -0,0 +1,21 @@ +//#region src/compat/util/toInteger.d.ts +/** + * Converts `value` to an integer. + * + * This function first converts `value` to a finite number. If the result has any decimal places, + * they are removed by rounding down to the nearest whole number. + * + * @param {unknown} value - The value to convert. + * @returns {number} Returns the number. + * + * @example + * toInteger(3.2); // => 3 + * toInteger(Number.MIN_VALUE); // => 0 + * toInteger(Infinity); // => 1.7976931348623157e+308 + * toInteger('3.2'); // => 3 + * toInteger(Symbol.iterator); // => 0 + * toInteger(NaN); // => 0 + */ +declare function toInteger(value: any): number; +//#endregion +export { toInteger }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toInteger.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/toInteger.js new file mode 100644 index 0000000000000000000000000000000000000000..c49219d0abaaf8dea398b368f0003d511ec944f9 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toInteger.js @@ -0,0 +1,26 @@ +const require_toFinite = require("./toFinite.js"); +//#region src/compat/util/toInteger.ts +/** +* Converts `value` to an integer. +* +* This function first converts `value` to a finite number. If the result has any decimal places, +* they are removed by rounding down to the nearest whole number. +* +* @param {unknown} value - The value to convert. +* @returns {number} Returns the number. +* +* @example +* toInteger(3.2); // => 3 +* toInteger(Number.MIN_VALUE); // => 0 +* toInteger(Infinity); // => 1.7976931348623157e+308 +* toInteger('3.2'); // => 3 +* toInteger(Symbol.iterator); // => 0 +* toInteger(NaN); // => 0 +*/ +function toInteger(value) { + const finite = require_toFinite.toFinite(value); + const remainder = finite % 1; + return remainder ? finite - remainder : finite; +} +//#endregion +exports.toInteger = toInteger; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toInteger.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/toInteger.mjs new file mode 100644 index 0000000000000000000000000000000000000000..755a2d578155a558fc5520cf9559eafdb328a111 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toInteger.mjs @@ -0,0 +1,26 @@ +import { toFinite } from "./toFinite.mjs"; +//#region src/compat/util/toInteger.ts +/** +* Converts `value` to an integer. +* +* This function first converts `value` to a finite number. If the result has any decimal places, +* they are removed by rounding down to the nearest whole number. +* +* @param {unknown} value - The value to convert. +* @returns {number} Returns the number. +* +* @example +* toInteger(3.2); // => 3 +* toInteger(Number.MIN_VALUE); // => 0 +* toInteger(Infinity); // => 1.7976931348623157e+308 +* toInteger('3.2'); // => 3 +* toInteger(Symbol.iterator); // => 0 +* toInteger(NaN); // => 0 +*/ +function toInteger(value) { + const finite = toFinite(value); + const remainder = finite % 1; + return remainder ? finite - remainder : finite; +} +//#endregion +export { toInteger }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toLength.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/toLength.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..fbe7518c2a569306dcfcbaf845c02fab099a6399 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toLength.d.mts @@ -0,0 +1,19 @@ +//#region src/compat/util/toLength.d.ts +/** + * Converts the value to a valid index. A valid index is an integer that is greater than or equal to `0` and less than or equal to `2^32 - 1`. + * + * It converts the given value to a number and floors it to an integer. If the value is less than `0`, it returns `0`. If the value exceeds `2^32 - 1`, it returns `2^32 - 1`. + * + * @param {unknown} value - The value to convert to a valid index. + * @returns {number} The converted value. + * + * @example + * toLength(3.2) // => 3 + * toLength(-1) // => 0 + * toLength(1.9) // => 1 + * toLength('42') // => 42 + * toLength(null) // => 0 + */ +declare function toLength(value: any): number; +//#endregion +export { toLength }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toLength.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/toLength.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fbe7518c2a569306dcfcbaf845c02fab099a6399 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toLength.d.ts @@ -0,0 +1,19 @@ +//#region src/compat/util/toLength.d.ts +/** + * Converts the value to a valid index. A valid index is an integer that is greater than or equal to `0` and less than or equal to `2^32 - 1`. + * + * It converts the given value to a number and floors it to an integer. If the value is less than `0`, it returns `0`. If the value exceeds `2^32 - 1`, it returns `2^32 - 1`. + * + * @param {unknown} value - The value to convert to a valid index. + * @returns {number} The converted value. + * + * @example + * toLength(3.2) // => 3 + * toLength(-1) // => 0 + * toLength(1.9) // => 1 + * toLength('42') // => 42 + * toLength(null) // => 0 + */ +declare function toLength(value: any): number; +//#endregion +export { toLength }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toLength.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/toLength.js new file mode 100644 index 0000000000000000000000000000000000000000..be06d57b0d645593ad4adac802c0b536539bf51d --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toLength.js @@ -0,0 +1,25 @@ +const require_clamp = require("../math/clamp.js"); +const require_MAX_ARRAY_LENGTH = require("../_internal/MAX_ARRAY_LENGTH.js"); +//#region src/compat/util/toLength.ts +/** +* Converts the value to a valid index. A valid index is an integer that is greater than or equal to `0` and less than or equal to `2^32 - 1`. +* +* It converts the given value to a number and floors it to an integer. If the value is less than `0`, it returns `0`. If the value exceeds `2^32 - 1`, it returns `2^32 - 1`. +* +* @param {unknown} value - The value to convert to a valid index. +* @returns {number} The converted value. +* +* @example +* toLength(3.2) // => 3 +* toLength(-1) // => 0 +* toLength(1.9) // => 1 +* toLength('42') // => 42 +* toLength(null) // => 0 +*/ +function toLength(value) { + if (value == null) return 0; + const length = Math.floor(Number(value)); + return require_clamp.clamp(length, 0, require_MAX_ARRAY_LENGTH.MAX_ARRAY_LENGTH); +} +//#endregion +exports.toLength = toLength; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toLength.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/toLength.mjs new file mode 100644 index 0000000000000000000000000000000000000000..7b504e26fff95fa454c7ffb40bf0373b2f1d79e4 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toLength.mjs @@ -0,0 +1,24 @@ +import { clamp } from "../math/clamp.mjs"; +import { MAX_ARRAY_LENGTH } from "../_internal/MAX_ARRAY_LENGTH.mjs"; +//#region src/compat/util/toLength.ts +/** +* Converts the value to a valid index. A valid index is an integer that is greater than or equal to `0` and less than or equal to `2^32 - 1`. +* +* It converts the given value to a number and floors it to an integer. If the value is less than `0`, it returns `0`. If the value exceeds `2^32 - 1`, it returns `2^32 - 1`. +* +* @param {unknown} value - The value to convert to a valid index. +* @returns {number} The converted value. +* +* @example +* toLength(3.2) // => 3 +* toLength(-1) // => 0 +* toLength(1.9) // => 1 +* toLength('42') // => 42 +* toLength(null) // => 0 +*/ +function toLength(value) { + if (value == null) return 0; + return clamp(Math.floor(Number(value)), 0, MAX_ARRAY_LENGTH); +} +//#endregion +export { toLength }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toNumber.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/toNumber.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..8ca539656fde9d0b59538829c4c0cc1a32ae34fc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toNumber.d.mts @@ -0,0 +1,20 @@ +//#region src/compat/util/toNumber.d.ts +/** + * Converts `value` to a number. + * + * Unlike `Number()`, this function returns `NaN` for symbols. + * + * @param {unknown} value - The value to convert. + * @returns {number} Returns the number. + * + * @example + * toNumber(3.2); // => 3.2 + * toNumber(Number.MIN_VALUE); // => 5e-324 + * toNumber(Infinity); // => Infinity + * toNumber('3.2'); // => 3.2 + * toNumber(Symbol.iterator); // => NaN + * toNumber(NaN); // => NaN + */ +declare function toNumber(value: any): number; +//#endregion +export { toNumber }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toNumber.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/toNumber.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8ca539656fde9d0b59538829c4c0cc1a32ae34fc --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toNumber.d.ts @@ -0,0 +1,20 @@ +//#region src/compat/util/toNumber.d.ts +/** + * Converts `value` to a number. + * + * Unlike `Number()`, this function returns `NaN` for symbols. + * + * @param {unknown} value - The value to convert. + * @returns {number} Returns the number. + * + * @example + * toNumber(3.2); // => 3.2 + * toNumber(Number.MIN_VALUE); // => 5e-324 + * toNumber(Infinity); // => Infinity + * toNumber('3.2'); // => 3.2 + * toNumber(Symbol.iterator); // => NaN + * toNumber(NaN); // => NaN + */ +declare function toNumber(value: any): number; +//#endregion +export { toNumber }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toNumber.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/toNumber.js new file mode 100644 index 0000000000000000000000000000000000000000..12d110ff164c29dba60454a37af7f1321e497693 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toNumber.js @@ -0,0 +1,24 @@ +const require_isSymbol = require("../predicate/isSymbol.js"); +//#region src/compat/util/toNumber.ts +/** +* Converts `value` to a number. +* +* Unlike `Number()`, this function returns `NaN` for symbols. +* +* @param {unknown} value - The value to convert. +* @returns {number} Returns the number. +* +* @example +* toNumber(3.2); // => 3.2 +* toNumber(Number.MIN_VALUE); // => 5e-324 +* toNumber(Infinity); // => Infinity +* toNumber('3.2'); // => 3.2 +* toNumber(Symbol.iterator); // => NaN +* toNumber(NaN); // => NaN +*/ +function toNumber(value) { + if (require_isSymbol.isSymbol(value)) return NaN; + return Number(value); +} +//#endregion +exports.toNumber = toNumber; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toNumber.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/toNumber.mjs new file mode 100644 index 0000000000000000000000000000000000000000..48869859612617b3f7aa044de0554b1565855391 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toNumber.mjs @@ -0,0 +1,24 @@ +import { isSymbol } from "../predicate/isSymbol.mjs"; +//#region src/compat/util/toNumber.ts +/** +* Converts `value` to a number. +* +* Unlike `Number()`, this function returns `NaN` for symbols. +* +* @param {unknown} value - The value to convert. +* @returns {number} Returns the number. +* +* @example +* toNumber(3.2); // => 3.2 +* toNumber(Number.MIN_VALUE); // => 5e-324 +* toNumber(Infinity); // => Infinity +* toNumber('3.2'); // => 3.2 +* toNumber(Symbol.iterator); // => NaN +* toNumber(NaN); // => NaN +*/ +function toNumber(value) { + if (isSymbol(value)) return NaN; + return Number(value); +} +//#endregion +export { toNumber }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toPath.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/toPath.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..2d52935551060e2eaddeb7f4bb57c7487a8794d2 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toPath.d.mts @@ -0,0 +1,21 @@ +//#region src/compat/util/toPath.d.ts +/** + * Converts a deep key string into an array of path segments. + * + * This function takes a string representing a deep key (e.g., 'a.b.c' or 'a[b][c]') and breaks it down into an array of strings, each representing a segment of the path. + * + * @param {any} deepKey - The deep key string to convert. + * @returns {string[]} An array of strings, each representing a segment of the path. + * + * Examples: + * + * toPath('a.b.c') // Returns ['a', 'b', 'c'] + * toPath('a[b][c]') // Returns ['a', 'b', 'c'] + * toPath('.a.b.c') // Returns ['', 'a', 'b', 'c'] + * toPath('a["b.c"].d') // Returns ['a', 'b.c', 'd'] + * toPath('') // Returns [] + * toPath('.a[b].c.d[e]["f.g"].h') // Returns ['', 'a', 'b', 'c', 'd', 'e', 'f.g', 'h'] + */ +declare function toPath(deepKey: any): string[]; +//#endregion +export { toPath }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toPath.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/toPath.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2d52935551060e2eaddeb7f4bb57c7487a8794d2 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toPath.d.ts @@ -0,0 +1,21 @@ +//#region src/compat/util/toPath.d.ts +/** + * Converts a deep key string into an array of path segments. + * + * This function takes a string representing a deep key (e.g., 'a.b.c' or 'a[b][c]') and breaks it down into an array of strings, each representing a segment of the path. + * + * @param {any} deepKey - The deep key string to convert. + * @returns {string[]} An array of strings, each representing a segment of the path. + * + * Examples: + * + * toPath('a.b.c') // Returns ['a', 'b', 'c'] + * toPath('a[b][c]') // Returns ['a', 'b', 'c'] + * toPath('.a.b.c') // Returns ['', 'a', 'b', 'c'] + * toPath('a["b.c"].d') // Returns ['a', 'b.c', 'd'] + * toPath('') // Returns [] + * toPath('.a[b].c.d[e]["f.g"].h') // Returns ['', 'a', 'b', 'c', 'd', 'e', 'f.g', 'h'] + */ +declare function toPath(deepKey: any): string[]; +//#endregion +export { toPath }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toPath.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/toPath.js new file mode 100644 index 0000000000000000000000000000000000000000..753b492fea675e606eaa51340bd664e36a875e5c --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toPath.js @@ -0,0 +1,67 @@ +const require_toKey = require("../_internal/toKey.js"); +const require_toString = require("./toString.js"); +//#region src/compat/util/toPath.ts +/** +* Converts a deep key string into an array of path segments. +* +* This function takes a string representing a deep key (e.g., 'a.b.c' or 'a[b][c]') and breaks it down into an array of strings, each representing a segment of the path. +* +* @param {any} deepKey - The deep key string to convert. +* @returns {string[]} An array of strings, each representing a segment of the path. +* +* Examples: +* +* toPath('a.b.c') // Returns ['a', 'b', 'c'] +* toPath('a[b][c]') // Returns ['a', 'b', 'c'] +* toPath('.a.b.c') // Returns ['', 'a', 'b', 'c'] +* toPath('a["b.c"].d') // Returns ['a', 'b.c', 'd'] +* toPath('') // Returns [] +* toPath('.a[b].c.d[e]["f.g"].h') // Returns ['', 'a', 'b', 'c', 'd', 'e', 'f.g', 'h'] +*/ +function toPath(deepKey) { + if (Array.isArray(deepKey)) return deepKey.map(require_toKey.toKey); + if (typeof deepKey === "symbol") return [deepKey]; + deepKey = require_toString.toString(deepKey); + const result = []; + const length = deepKey.length; + if (length === 0) return result; + let index = 0; + let key = ""; + let quoteChar = ""; + let bracket = false; + if (deepKey.charCodeAt(0) === 46) { + result.push(""); + index++; + } + while (index < length) { + const char = deepKey[index]; + if (quoteChar) if (char === "\\" && index + 1 < length) { + index++; + key += deepKey[index]; + } else if (char === quoteChar) quoteChar = ""; + else key += char; + else if (bracket) if (char === "\"" || char === "'") quoteChar = char; + else if (char === "]") { + bracket = false; + result.push(key); + key = ""; + } else key += char; + else if (char === "[") { + bracket = true; + if (key) { + result.push(key); + key = ""; + } + } else if (char === ".") { + if (key) { + result.push(key); + key = ""; + } + } else key += char; + index++; + } + if (key) result.push(key); + return result; +} +//#endregion +exports.toPath = toPath; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toPath.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/toPath.mjs new file mode 100644 index 0000000000000000000000000000000000000000..dbcef569c5bd24b7952d4881972b5926a01261f8 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toPath.mjs @@ -0,0 +1,67 @@ +import { toKey } from "../_internal/toKey.mjs"; +import { toString } from "./toString.mjs"; +//#region src/compat/util/toPath.ts +/** +* Converts a deep key string into an array of path segments. +* +* This function takes a string representing a deep key (e.g., 'a.b.c' or 'a[b][c]') and breaks it down into an array of strings, each representing a segment of the path. +* +* @param {any} deepKey - The deep key string to convert. +* @returns {string[]} An array of strings, each representing a segment of the path. +* +* Examples: +* +* toPath('a.b.c') // Returns ['a', 'b', 'c'] +* toPath('a[b][c]') // Returns ['a', 'b', 'c'] +* toPath('.a.b.c') // Returns ['', 'a', 'b', 'c'] +* toPath('a["b.c"].d') // Returns ['a', 'b.c', 'd'] +* toPath('') // Returns [] +* toPath('.a[b].c.d[e]["f.g"].h') // Returns ['', 'a', 'b', 'c', 'd', 'e', 'f.g', 'h'] +*/ +function toPath(deepKey) { + if (Array.isArray(deepKey)) return deepKey.map(toKey); + if (typeof deepKey === "symbol") return [deepKey]; + deepKey = toString(deepKey); + const result = []; + const length = deepKey.length; + if (length === 0) return result; + let index = 0; + let key = ""; + let quoteChar = ""; + let bracket = false; + if (deepKey.charCodeAt(0) === 46) { + result.push(""); + index++; + } + while (index < length) { + const char = deepKey[index]; + if (quoteChar) if (char === "\\" && index + 1 < length) { + index++; + key += deepKey[index]; + } else if (char === quoteChar) quoteChar = ""; + else key += char; + else if (bracket) if (char === "\"" || char === "'") quoteChar = char; + else if (char === "]") { + bracket = false; + result.push(key); + key = ""; + } else key += char; + else if (char === "[") { + bracket = true; + if (key) { + result.push(key); + key = ""; + } + } else if (char === ".") { + if (key) { + result.push(key); + key = ""; + } + } else key += char; + index++; + } + if (key) result.push(key); + return result; +} +//#endregion +export { toPath }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toPlainObject.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/toPlainObject.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..aa4fc52bf820cb99b3135963692ecbe9166e4c8e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toPlainObject.d.mts @@ -0,0 +1,17 @@ +//#region src/compat/util/toPlainObject.d.ts +/** + * Converts value to a plain object flattening inherited enumerable string keyed properties of value to own properties of the plain object. + * + * @param {any} value The value to convert. + * @returns {any} Returns the converted plain object. + * + * @example + * function Foo() { + * this.b = 2; + * } + * Foo.prototype.c = 3; + * toPlainObject(new Foo()); // { b: 2, c: 3 } + */ +declare function toPlainObject(value?: any): any; +//#endregion +export { toPlainObject }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toPlainObject.d.ts b/tools/ui/node_modules/es-toolkit/dist/compat/util/toPlainObject.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..aa4fc52bf820cb99b3135963692ecbe9166e4c8e --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toPlainObject.d.ts @@ -0,0 +1,17 @@ +//#region src/compat/util/toPlainObject.d.ts +/** + * Converts value to a plain object flattening inherited enumerable string keyed properties of value to own properties of the plain object. + * + * @param {any} value The value to convert. + * @returns {any} Returns the converted plain object. + * + * @example + * function Foo() { + * this.b = 2; + * } + * Foo.prototype.c = 3; + * toPlainObject(new Foo()); // { b: 2, c: 3 } + */ +declare function toPlainObject(value?: any): any; +//#endregion +export { toPlainObject }; \ No newline at end of file diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toPlainObject.js b/tools/ui/node_modules/es-toolkit/dist/compat/util/toPlainObject.js new file mode 100644 index 0000000000000000000000000000000000000000..4a99034ac2074490d14a5ada766092a368e8df17 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toPlainObject.js @@ -0,0 +1,33 @@ +const require_keysIn = require("../object/keysIn.js"); +//#region src/compat/util/toPlainObject.ts +/** +* Converts value to a plain object flattening inherited enumerable string keyed properties of value to own properties of the plain object. +* +* @param {any} value The value to convert. +* @returns {any} Returns the converted plain object. +* +* @example +* function Foo() { +* this.b = 2; +* } +* Foo.prototype.c = 3; +* toPlainObject(new Foo()); // { b: 2, c: 3 } +*/ +function toPlainObject(value) { + const plainObject = {}; + const valueKeys = require_keysIn.keysIn(value); + for (let i = 0; i < valueKeys.length; i++) { + const key = valueKeys[i]; + const objValue = value[key]; + if (key === "__proto__") Object.defineProperty(plainObject, key, { + configurable: true, + enumerable: true, + value: objValue, + writable: true + }); + else plainObject[key] = objValue; + } + return plainObject; +} +//#endregion +exports.toPlainObject = toPlainObject; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toPlainObject.mjs b/tools/ui/node_modules/es-toolkit/dist/compat/util/toPlainObject.mjs new file mode 100644 index 0000000000000000000000000000000000000000..483949163412023a5c3d471b1ed218e4352f47e5 --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toPlainObject.mjs @@ -0,0 +1,33 @@ +import { keysIn } from "../object/keysIn.mjs"; +//#region src/compat/util/toPlainObject.ts +/** +* Converts value to a plain object flattening inherited enumerable string keyed properties of value to own properties of the plain object. +* +* @param {any} value The value to convert. +* @returns {any} Returns the converted plain object. +* +* @example +* function Foo() { +* this.b = 2; +* } +* Foo.prototype.c = 3; +* toPlainObject(new Foo()); // { b: 2, c: 3 } +*/ +function toPlainObject(value) { + const plainObject = {}; + const valueKeys = keysIn(value); + for (let i = 0; i < valueKeys.length; i++) { + const key = valueKeys[i]; + const objValue = value[key]; + if (key === "__proto__") Object.defineProperty(plainObject, key, { + configurable: true, + enumerable: true, + value: objValue, + writable: true + }); + else plainObject[key] = objValue; + } + return plainObject; +} +//#endregion +export { toPlainObject }; diff --git a/tools/ui/node_modules/es-toolkit/dist/compat/util/toSafeInteger.d.mts b/tools/ui/node_modules/es-toolkit/dist/compat/util/toSafeInteger.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..bf17df99ff3949d1c20c400b74f9b3007cb59dee --- /dev/null +++ b/tools/ui/node_modules/es-toolkit/dist/compat/util/toSafeInteger.d.mts @@ -0,0 +1,21 @@ +//#region src/compat/util/toSafeInteger.d.ts +/** + * Converts `value` to a safe integer. + * + * A safe integer can be compared and represented correctly. + * + * @param {any} value - The value to convert. + * @returns {number} Returns the value converted to a safe integer. + * + * @example + * toSafeInteger(3.2); // => 3 + * toSafeInteger(Number.MAX_VALUE); // => 9007199254740991 + * toSafeInteger(Infinity); // => 9007199254740991 + * toSafeInteger('3.2'); // => 3 + * toSafeInteger(NaN); // => 0 + * toSafeInteger(null); // => 0 + * toSafeInteger(-Infinity); // => -9007199254740991 + */ +declare function toSafeInteger(value: any): number; +//#endregion +export { toSafeInteger }; \ No newline at end of file