'use strict'; // utils.ts function isDefined(value) { return !isNil(value); } function isNil(value) { return value === null || value === void 0; } function isBoolean(value) { return typeof value === "boolean"; } function isNumber(value) { return typeof value === "number"; } function isString(value) { return typeof value === "string"; } function isSymbol(value) { return typeof value === "symbol"; } function isFunction(value) { return typeof value === "function"; } function isObject(value) { return typeof value === "object" && value !== null; } function isArray(value) { return Array.isArray(value); } function isMap(value) { return value instanceof Map; } function isSet(value) { return value instanceof Set; } function isPromise(value) { return value instanceof Promise; } function isDate(value) { return value instanceof Date; } function isRegExp(value) { return value instanceof RegExp; } function isBigInt(value) { return typeof value === "bigint"; } // array.ts function add(...args) { return args.reduce((acc, val) => acc + val, 0); } function sum(arr) { return arr.reduce((acc, val) => acc + val, 0); } function sumBy(arr, prop) { return arr.reduce((acc, val) => acc + prop(val), 0); } function compact(arr) { return arr.filter((val) => isDefined(val)); } function compactMap(arr, map) { return compact(arr.map(map)); } function uniq(arr) { const seen = /* @__PURE__ */ new Set(); return arr.filter((val) => { if (seen.has(val)) return false; seen.add(val); return true; }); } function uniqBy(arr, prop) { const seen = /* @__PURE__ */ new Set(); return arr.filter((val) => { const key = prop(val); if (seen.has(key)) return false; seen.add(key); return true; }); } function sort(arr) { return [...arr].sort(); } function sortBy(arr, ...keys2) { return [...arr].sort((a, b) => { for (const key of keys2) { const keyA = key(a); const keyB = key(b); if (keyA < keyB) return -1; if (keyA > keyB) return 1; } return 0; }); } function partition(arr, predicate) { return [ arr.filter((val) => predicate(val)), arr.filter((val) => !predicate(val)) ]; } function groupBy(arr, key) { return arr.reduce((acc, val) => { const k = key(val); if (!acc[k]) acc[k] = []; acc[k].push(val); return acc; }, {}); } function zip(arr1, arr2) { return arr1.map((val, i) => [val, arr2[i]]); } var remove = (arr, element) => { const index = arr.indexOf(element); return arr.filter((_, i) => i !== index); }; var removeFirst = (arr, predicate) => { const index = arr.findIndex(predicate); return arr.filter((_, i) => i !== index); }; var fill = (amount, initial) => Array.from({ length: amount }).fill(null).map(() => initial()); // frozen.ts function frz(arg) { return Object.freeze(arg); } // number.ts var clamp = (num, args) => Math.max(Math.min(num, args.max), args.min); // object.ts function entries(obj) { return Object.entries(obj); } function keys(obj) { return Object.keys(obj); } function values(obj) { return Object.values(obj); } var mapValues = (obj, fn) => { const res = {}; for (const key in obj) { const value = obj[key]; res[key] = fn(value, key); } return res; }; var mapEntries = (obj, fn) => { const res = {}; for (const key in obj) { const value = obj[key]; const [k, v] = fn({ key, value }); res[k] = v; } return res; }; // random.ts var randomInt = (args) => Math.floor(random(args)); var random = ({ start, end }) => { const begin = start != null ? start : 0; return Math.random() * (end - begin) + begin; }; var randomElement = (iter) => iter[randomInt({ start: 0, end: iter.length })]; var weightedRandomElement = (iter) => randomElement(iter.flatMap(({ weight, value }) => fill(weight, () => value))); // string.ts function capitalize(str) { return str.charAt(0).toUpperCase() + str.slice(1); } function capitalizePhrase(word) { return word.split(" ").map(capitalize).join(" "); } function cleanTrim(src) { return src.toLowerCase().replaceAll(" ", "").replaceAll("\n", "").replaceAll(" ", ""); } function fuzzyIncludes(src, query) { return src ? cleanTrim(src).includes(cleanTrim(query)) : false; } function fuzzyStartsWith(src, query) { return src ? cleanTrim(src).startsWith(cleanTrim(query)) : false; } function ngrams(word, n = 2) { const ngrams2 = /* @__PURE__ */ new Set(); for (let i = 0; i < word.length - 1; i++) { ngrams2.add(word.slice(i, i + n)); } return ngrams2; } function ngramSimilarity(word1, word2, n = 2) { const ngrams1 = ngrams(word1, n); const ngrams2 = ngrams(word2, n); const intersection = new Set([...ngrams1].filter((x) => ngrams2.has(x))); return intersection.size / Math.max(ngrams1.size, ngrams2.size); } // tup.ts function tup(...args) { return args; } exports.add = add; exports.capitalize = capitalize; exports.capitalizePhrase = capitalizePhrase; exports.clamp = clamp; exports.cleanTrim = cleanTrim; exports.compact = compact; exports.compactMap = compactMap; exports.entries = entries; exports.fill = fill; exports.frz = frz; exports.fuzzyIncludes = fuzzyIncludes; exports.fuzzyStartsWith = fuzzyStartsWith; exports.groupBy = groupBy; exports.isArray = isArray; exports.isBigInt = isBigInt; exports.isBoolean = isBoolean; exports.isDate = isDate; exports.isDefined = isDefined; exports.isFunction = isFunction; exports.isMap = isMap; exports.isNil = isNil; exports.isNumber = isNumber; exports.isObject = isObject; exports.isPromise = isPromise; exports.isRegExp = isRegExp; exports.isSet = isSet; exports.isString = isString; exports.isSymbol = isSymbol; exports.keys = keys; exports.mapEntries = mapEntries; exports.mapValues = mapValues; exports.ngramSimilarity = ngramSimilarity; exports.ngrams = ngrams; exports.partition = partition; exports.random = random; exports.randomElement = randomElement; exports.randomInt = randomInt; exports.remove = remove; exports.removeFirst = removeFirst; exports.sort = sort; exports.sortBy = sortBy; exports.sum = sum; exports.sumBy = sumBy; exports.tup = tup; exports.uniq = uniq; exports.uniqBy = uniqBy; exports.values = values; exports.weightedRandomElement = weightedRandomElement; exports.zip = zip;