ahegao 1.69.46 → 1.69.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/index.d.ts +9 -0
  2. package/dist/index.js +25 -9
  3. package/dist/index.js.map +1 -0
  4. package/dist/json/downside.json +75 -0
  5. package/dist/json/hiragana.json +527 -0
  6. package/dist/json/homoglyphs.json +31790 -0
  7. package/dist/json/letterArray.json +254 -0
  8. package/dist/json/superscript.json +96 -0
  9. package/dist/json/upside.json +78 -0
  10. package/dist/structures/structs.d.ts +77 -0
  11. package/dist/structures/structs.js +46 -45
  12. package/dist/structures/structs.js.map +1 -0
  13. package/dist/types/classes.d.ts +214 -0
  14. package/dist/types/classes.js +121 -122
  15. package/dist/types/classes.js.map +1 -0
  16. package/dist/types/discord_classes.d.ts +93 -0
  17. package/dist/types/discord_classes.js +140 -106
  18. package/dist/types/discord_classes.js.map +1 -0
  19. package/dist/types/discord_fields.d.ts +27 -0
  20. package/dist/types/discord_fields.js +28 -24
  21. package/dist/types/discord_fields.js.map +1 -0
  22. package/dist/types/discord_types.d.ts +51 -0
  23. package/dist/types/discord_types.js +6 -4
  24. package/dist/types/discord_types.js.map +1 -0
  25. package/dist/types/fields.d.ts +163 -0
  26. package/dist/types/fields.js +238 -232
  27. package/dist/types/fields.js.map +1 -0
  28. package/dist/types/types.d.ts +99 -0
  29. package/dist/types/types.js +3 -1
  30. package/dist/types/types.js.map +1 -0
  31. package/dist/utils/discord-util.d.ts +198 -0
  32. package/dist/utils/discord-util.js +370 -235
  33. package/dist/utils/discord-util.js.map +1 -0
  34. package/dist/utils/util.d.ts +504 -0
  35. package/dist/utils/util.js +1146 -694
  36. package/dist/utils/util.js.map +1 -0
  37. package/package.json +56 -57
@@ -1,38 +1,467 @@
1
- import * as cheerio from "cheerio";
2
- import { chmodSync, copyFileSync, createWriteStream, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmdirSync, rmSync, statSync, unlinkSync, writeFileSync } from "fs";
3
- import { get } from "https";
4
- import puppeteer from "puppeteer";
5
- import { FileInfo, RangedNumber } from "../structures/structs";
6
- import chalkImport from 'chalk';
7
- import { exec, execSync, spawn } from "child_process";
8
- import { createHash } from "crypto";
9
- import { appendFileSync } from "fs";
10
- import path, { basename } from "path";
11
- import { MUSIC_ARTIST_ALIASES, Timer, TitleAndArtists, WeightedMap } from "../types/classes";
12
- import { ACRONYM_REGEX, ACRONYM_REGEXES, AFTER_SIDES_SANITIZE_REGEXES, AUDIO_CONTAINING_EXTENSION_TYPES, BEFORE_SIDES_SANITIZE_REGEXES, CHALK_RAINBOW_COLORS, COLOR_CODE_REGEX, CONTRIBUTORS_REGEX, CUSTOM_EMOJI_REGEX, CUTE_ASCII, DAYS_IN_WEEK, DEFAULT_HTTPS_CONNECTION_OPTIONS, DEGREES_TO_RADIANS, DISCORD_MESSAGE_LENGTH_LIMIT, DOWNSIDE_MAP, EMOJI_REGEX, EMPTY, EMPTY_ARRAY, EXEC_NO_WINDOWS, FEAT_WITH_PARENTHESIS_REGEX, HOMOGLYPHS_AS_REGEXP_OR, HOURS_IN_DAY, HOURS_IN_WEEK, JSON_NEXT_LINE_BRACKET_FROM_REGEX, JSON_NEXT_LINE_BRACKET_TO, MILLISECONDS_IN_DAY, MILLISECONDS_IN_HOUR, MILLISECONDS_IN_MINUTE, MILLISECONDS_IN_SECOND, MILLISECONDS_IN_WEEK, MINUTES_IN_DAY, MINUTES_IN_HOUR, MINUTES_IN_WEEK, NANOSECONDS_IN_DAY, NANOSECONDS_IN_HOUR, NANOSECONDS_IN_MILLISECOND, NANOSECONDS_IN_MINUTE, NANOSECONDS_IN_SECOND, NANOSECONDS_IN_WEEK, NEW_LINE_REGEX, NIGHT_SKY_ITEMS, NIGHT_SKY_ITEMS_TOTAL_WEIGHT, NON_NUMBER_OR_CHAR_REGEX, NON_NUMBER_REGEX, NOT_UNICODE_LETTERS_REGEX, NUMBER_REGEX, PRESS_ENTER_TO_EXIT_SH, RADIANS_TO_DEGREES, SECONDS_IN_DAY, SECONDS_IN_HOUR, SECONDS_IN_MINUTE, SECONDS_IN_WEEK, SEP, SEPARATOR_REGEX, START_OF_PATH_REGEX, SUBTITLE_METADATA_REGEX, TRIM_REGEX, TSCONFIG_JSON, UNICODE_LETTERS_REGEX, UNSYNCEDLYRICS_FLAC_ID, UPSIDE_MAP, VERBOSE_DATE_TIME_FORMAT_OPTIONS, VSCODE_TS_LAUNCH_JSON, WORDS_REGEX } from "../types/fields";
13
- import { musicMetadata } from "./util";
14
- import { platform } from "os";
15
- import mic from "mic";
16
- export { default as musicMetadata } from 'music-metadata';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.MUSICAL_NOTES = exports.classifyExt = exports.isImageSequence = exports.isModel = exports.isCode = exports.isDocument = exports.isArchive = exports.isFont = exports.isSubtitle = exports.isAudio = exports.isVideo = exports.isPicture = exports.getZeroBigInt = exports.getZero = exports.ZERO_BIG_INT = exports.sherpa_onnx = exports.geniusClient = exports.chalk = exports.musicMetadata = void 0;
40
+ exports.toExtension = toExtension;
41
+ exports.removeExtension = removeExtension;
42
+ exports.rtl = rtl;
43
+ exports.random = random;
44
+ exports.randomBoolean = randomBoolean;
45
+ exports.randomFromArray = randomFromArray;
46
+ exports.randomFromArrayButNot = randomFromArrayButNot;
47
+ exports.upsideMapDown = upsideMapDown;
48
+ exports.forEachInfo = forEachInfo;
49
+ exports.forEachFilePath = forEachFilePath;
50
+ exports.forEachFileInfo = forEachFileInfo;
51
+ exports.forEachFile = forEachFile;
52
+ exports.forEachDirInfo = forEachDirInfo;
53
+ exports.forEachDir = forEachDir;
54
+ exports.forEachInfoRecursive = forEachInfoRecursive;
55
+ exports.forEachRecursive = forEachRecursive;
56
+ exports.forEachFileInfoRecursive = forEachFileInfoRecursive;
57
+ exports.getEachFileInfoRecursive = getEachFileInfoRecursive;
58
+ exports.getEachFileInfo = getEachFileInfo;
59
+ exports.forEachFileRecursive = forEachFileRecursive;
60
+ exports.forEachDirInfoRecursive = forEachDirInfoRecursive;
61
+ exports.getEachDirInfoRecursive = getEachDirInfoRecursive;
62
+ exports.getEachDirInfo = getEachDirInfo;
63
+ exports.forEachDirRecursive = forEachDirRecursive;
64
+ exports.purgeEmptyDirectoriesRecursive = purgeEmptyDirectoriesRecursive;
65
+ exports.firstUpperLowerRest = firstUpperLowerRest;
66
+ exports.firstUpperLowerRestEachWord = firstUpperLowerRestEachWord;
67
+ exports.countChars = countChars;
68
+ exports.countWords = countWords;
69
+ exports.countEmoji = countEmoji;
70
+ exports.incrementMap = incrementMap;
71
+ exports.incrementObjNumber = incrementObjNumber;
72
+ exports.addObjs = addObjs;
73
+ exports.mergeObjs = mergeObjs;
74
+ exports.sumValues = sumValues;
75
+ exports.getOrDefaultObj = getOrDefaultObj;
76
+ exports.getOrDefaultMap = getOrDefaultMap;
77
+ exports.getOrDefault = getOrDefault;
78
+ exports.runSoft = runSoft;
79
+ exports.blacklistArray = blacklistArray;
80
+ exports.getChars = getChars;
81
+ exports.getDiff = getDiff;
82
+ exports.formatDate = formatDate;
83
+ exports.decide = decide;
84
+ exports.decideAsync = decideAsync;
85
+ exports.make = make;
86
+ exports.makeAsync = makeAsync;
87
+ exports.extractElementsIntoArray = extractElementsIntoArray;
88
+ exports.extractItemsIntoArray = extractItemsIntoArray;
89
+ exports.mapArrayOfObjsByElement = mapArrayOfObjsByElement;
90
+ exports.mapToArray = mapToArray;
91
+ exports.stringify = stringify;
92
+ exports.acronymStringIfTooLong = acronymStringIfTooLong;
93
+ exports.mkdirSoftRecursive = mkdirSoftRecursive;
94
+ exports.mkdirSoft = mkdirSoft;
95
+ exports.goUpDir = goUpDir;
96
+ exports.writeFileIfNotPresent = writeFileIfNotPresent;
97
+ exports.requireSoft = requireSoft;
98
+ exports.clone = clone;
99
+ exports.getBit = getBit;
100
+ exports.isBit = isBit;
101
+ exports.map = map;
102
+ exports.logMap = logMap;
103
+ exports.clamp = clamp;
104
+ exports.clamp0 = clamp0;
105
+ exports.datesDiff = datesDiff;
106
+ exports.datesDiffToStamp = datesDiffToStamp;
107
+ exports.datesGapToStamp = datesGapToStamp;
108
+ exports.dateToStamp = dateToStamp;
109
+ exports.toStamp = toStamp;
110
+ exports.convertNumberBase = convertNumberBase;
111
+ exports.moveSync = moveSync;
112
+ exports.download = download;
113
+ exports.isCharUpperCase = isCharUpperCase;
114
+ exports.isCharLowerCase = isCharLowerCase;
115
+ exports.isStandardLetter = isStandardLetter;
116
+ exports.getOrCreateAppendedLinesFile = getOrCreateAppendedLinesFile;
117
+ exports.rmSoft = rmSoft;
118
+ exports.saveAppendedLinesFile = saveAppendedLinesFile;
119
+ exports.getOrCreateFromKeys = getOrCreateFromKeys;
120
+ exports.getOrCreate = getOrCreate;
121
+ exports.getOrCreateObj = getOrCreateObj;
122
+ exports.appendObjArray = appendObjArray;
123
+ exports.organiseByKey = organiseByKey;
124
+ exports.millisecondsToNanoseconds = millisecondsToNanoseconds;
125
+ exports.secondsToNanoseconds = secondsToNanoseconds;
126
+ exports.minutesToNanoseconds = minutesToNanoseconds;
127
+ exports.hoursToNanoseconds = hoursToNanoseconds;
128
+ exports.daysToNanoseconds = daysToNanoseconds;
129
+ exports.weeksToNanoseconds = weeksToNanoseconds;
130
+ exports.nanosecondsToMilliseconds = nanosecondsToMilliseconds;
131
+ exports.secondsToMilliseconds = secondsToMilliseconds;
132
+ exports.minutesToMilliseconds = minutesToMilliseconds;
133
+ exports.hoursToMilliseconds = hoursToMilliseconds;
134
+ exports.daysToMilliseconds = daysToMilliseconds;
135
+ exports.weeksToMilliseconds = weeksToMilliseconds;
136
+ exports.nanosecondsToSeconds = nanosecondsToSeconds;
137
+ exports.millisecondsToSeconds = millisecondsToSeconds;
138
+ exports.minutesToSeconds = minutesToSeconds;
139
+ exports.hoursToSeconds = hoursToSeconds;
140
+ exports.daysToSeconds = daysToSeconds;
141
+ exports.weeksToSeconds = weeksToSeconds;
142
+ exports.nanosecondsToMinutes = nanosecondsToMinutes;
143
+ exports.millisecondsToMinutes = millisecondsToMinutes;
144
+ exports.secondsToMinutes = secondsToMinutes;
145
+ exports.hoursToMinutes = hoursToMinutes;
146
+ exports.daysToMinutes = daysToMinutes;
147
+ exports.weeksToMinutes = weeksToMinutes;
148
+ exports.nanosecondsToHours = nanosecondsToHours;
149
+ exports.millisecondsToHours = millisecondsToHours;
150
+ exports.secondsToHours = secondsToHours;
151
+ exports.minutesToHours = minutesToHours;
152
+ exports.daysToHours = daysToHours;
153
+ exports.weeksToHours = weeksToHours;
154
+ exports.nanosecondsToDays = nanosecondsToDays;
155
+ exports.millisecondsToDays = millisecondsToDays;
156
+ exports.secondsToDays = secondsToDays;
157
+ exports.minutesToDays = minutesToDays;
158
+ exports.hoursToDays = hoursToDays;
159
+ exports.weeksToDays = weeksToDays;
160
+ exports.nanosecondsToWeeks = nanosecondsToWeeks;
161
+ exports.millisecondsToWeeks = millisecondsToWeeks;
162
+ exports.secondsToWeeks = secondsToWeeks;
163
+ exports.minutesToWeeks = minutesToWeeks;
164
+ exports.hoursToWeeks = hoursToWeeks;
165
+ exports.daysToWeeks = daysToWeeks;
166
+ exports.minutesToHoursMinutes = minutesToHoursMinutes;
167
+ exports.parsedFileInfoNameToIntSort = parsedFileInfoNameToIntSort;
168
+ exports.parsedStringToIntSort = parsedStringToIntSort;
169
+ exports.degreesToRadians = degreesToRadians;
170
+ exports.toRads = toRads;
171
+ exports.radiansToDegrees = radiansToDegrees;
172
+ exports.toDegs = toDegs;
173
+ exports.getDayMonthYearDateString = getDayMonthYearDateString;
174
+ exports.touchSoft = touchSoft;
175
+ exports.increment = increment;
176
+ exports.readFileInt = readFileInt;
177
+ exports.hashCode = hashCode;
178
+ exports.chalkColor = chalkColor;
179
+ exports.chalkRainbowColor = chalkRainbowColor;
180
+ exports.chalkNextRainbowColor = chalkNextRainbowColor;
181
+ exports.seededChalkRainbowColor = seededChalkRainbowColor;
182
+ exports.randomChalkRainbowColor = randomChalkRainbowColor;
183
+ exports.padLeft = padLeft;
184
+ exports.padRight = padRight;
185
+ exports.getCuteAscii = getCuteAscii;
186
+ exports.isEmpty = isEmpty;
187
+ exports.singleSpacesOnly = singleSpacesOnly;
188
+ exports.getWeekDayString = getWeekDayString;
189
+ exports.getFirstRegexGroupMatchElse = getFirstRegexGroupMatchElse;
190
+ exports.getFirstRegexGroupMatchAsIntElse = getFirstRegexGroupMatchAsIntElse;
191
+ exports.getFirstRegexGroupMatchAsFloatElse = getFirstRegexGroupMatchAsFloatElse;
192
+ exports.getFirstRegexGroupMatchElseUndefined = getFirstRegexGroupMatchElseUndefined;
193
+ exports.getFirstRegexGroupMatchAsIntElseUndefined = getFirstRegexGroupMatchAsIntElseUndefined;
194
+ exports.getFirstRegexGroupMatchAsFloatElseUndefined = getFirstRegexGroupMatchAsFloatElseUndefined;
195
+ exports.allRegexesMatched = allRegexesMatched;
196
+ exports.countOccurrences = countOccurrences;
197
+ exports.occursAtleastTimes = occursAtleastTimes;
198
+ exports.removeColorCodes = removeColorCodes;
199
+ exports.replaceAllRegexAsGlobalArray = replaceAllRegexAsGlobalArray;
200
+ exports.replaceAllRegexAsGlobal = replaceAllRegexAsGlobal;
201
+ exports.setToJSON = setToJSON;
202
+ exports.mapToJSON = mapToJSON;
203
+ exports.toJSON = toJSON;
204
+ exports.jsonToSet = jsonToSet;
205
+ exports.jsonToMap = jsonToMap;
206
+ exports.fromJSON = fromJSON;
207
+ exports.htmlAsCheerio = htmlAsCheerio;
208
+ exports.getPageCheerio = getPageCheerio;
209
+ exports.getPageHtml = getPageHtml;
210
+ exports.humanReadableJsonToHumanReadableNextLineBracketsJson = humanReadableJsonToHumanReadableNextLineBracketsJson;
211
+ exports.toJson = toJson;
212
+ exports.charToRegexOrHomoglyphs = charToRegexOrHomoglyphs;
213
+ exports.stringToRegexOrHomoglyphs = stringToRegexOrHomoglyphs;
214
+ exports.toInsanelyAccurateRegex = toInsanelyAccurateRegex;
215
+ exports.noop = noop;
216
+ exports.noop1 = noop1;
217
+ exports.noop2 = noop2;
218
+ exports.noop3 = noop3;
219
+ exports.forEachKeyValue = forEachKeyValue;
220
+ exports.keyValueToOdt = keyValueToOdt;
221
+ exports.orElse = orElse;
222
+ exports.getClosestValue = getClosestValue;
223
+ exports.getClosestNumber = getClosestNumber;
224
+ exports.convertTime = convertTime;
225
+ exports.getNs = getNs;
226
+ exports.startTimer = startTimer;
227
+ exports.getTimer = getTimer;
228
+ exports.getTimerString = getTimerString;
229
+ exports.printTimer = printTimer;
230
+ exports.isString = isString;
231
+ exports.reverseString = reverseString;
232
+ exports.wipeAllLetters = wipeAllLetters;
233
+ exports.keepOnlyAllLetters = keepOnlyAllLetters;
234
+ exports.wipeNumbers = wipeNumbers;
235
+ exports.keepOnlyNumbers = keepOnlyNumbers;
236
+ exports.wipeAllLettersAndNumbers = wipeAllLettersAndNumbers;
237
+ exports.keepOnlyAllLettersAndNumbers = keepOnlyAllLettersAndNumbers;
238
+ exports.fromArrayOrNull = fromArrayOrNull;
239
+ exports.setClipboard = setClipboard;
240
+ exports.readClipboard = readClipboard;
241
+ exports.toDDMMYYYY = toDDMMYYYY;
242
+ exports.toMMDDYYYY = toMMDDYYYY;
243
+ exports.downloadItem = downloadItem;
244
+ exports.getChild = getChild;
245
+ exports.getDynamicContentCheerio = getDynamicContentCheerio;
246
+ exports.getDynamicContent = getDynamicContent;
247
+ exports.randomTimeout = randomTimeout;
248
+ exports.randomTimeoutVerbose = randomTimeoutVerbose;
249
+ exports.getLast = getLast;
250
+ exports.getLastX = getLastX;
251
+ exports.forLastX = forLastX;
252
+ exports.joinToXCounts = joinToXCounts;
253
+ exports.asyncMap = asyncMap;
254
+ exports.emptyIfEmpty = emptyIfEmpty;
255
+ exports.getRandomWeighedItem = getRandomWeighedItem;
256
+ exports.getWeightOfKeys = getWeightOfKeys;
257
+ exports.getWeightOfValues = getWeightOfValues;
258
+ exports.getSum = getSum;
259
+ exports.getCurrentMs = getCurrentMs;
260
+ exports.getCurrentSecond = getCurrentSecond;
261
+ exports.getCurrentMinute = getCurrentMinute;
262
+ exports.getCurrentHour = getCurrentHour;
263
+ exports.getCurrentDay = getCurrentDay;
264
+ exports.reverseMap = reverseMap;
265
+ exports.toArray = toArray;
266
+ exports.sortDateOldestFirst = sortDateOldestFirst;
267
+ exports.sortDateNewestFirst = sortDateNewestFirst;
268
+ exports.dateValuesMapToSortedKeysArray = dateValuesMapToSortedKeysArray;
269
+ exports.getCount = getCount;
270
+ exports.sumStringNumberObj = sumStringNumberObj;
271
+ exports.splitWords = splitWords;
272
+ exports.filterMap = filterMap;
273
+ exports.filterMapCopy = filterMapCopy;
274
+ exports.filterSet = filterSet;
275
+ exports.filterSetCopy = filterSetCopy;
276
+ exports.prismaDeleteIfExists = prismaDeleteIfExists;
277
+ exports.getWeekSince1980 = getWeekSince1980;
278
+ exports.getDaySince1980 = getDaySince1980;
279
+ exports.runCommand = runCommand;
280
+ exports.runCommandRejectAsResolve = runCommandRejectAsResolve;
281
+ exports.sanitizeStringForFFMPEG = sanitizeStringForFFMPEG;
282
+ exports.getArtistsFromFlacMetadata = getArtistsFromFlacMetadata;
283
+ exports.getTitleFromFlacMetadata = getTitleFromFlacMetadata;
284
+ exports.getAlbumFromFlacMetadata = getAlbumFromFlacMetadata;
285
+ exports.getAlbumArtistFromFlacMetadata = getAlbumArtistFromFlacMetadata;
286
+ exports.getLyricsFromFlacVorbisTags = getLyricsFromFlacVorbisTags;
287
+ exports.generateHash = generateHash;
288
+ exports.extensionHasAudio = extensionHasAudio;
289
+ exports.songTitleExtractSide = songTitleExtractSide;
290
+ exports.sanitizeStringForSeed = sanitizeStringForSeed;
291
+ exports.addAllSetToSet = addAllSetToSet;
292
+ exports.addAllArrayToSet = addAllArrayToSet;
293
+ exports.addAllSetToArray = addAllSetToArray;
294
+ exports.addAllArrayToArray = addAllArrayToArray;
295
+ exports.addAllArrayToMap = addAllArrayToMap;
296
+ exports.addSetArrayToMap = addSetArrayToMap;
297
+ exports.replaceAllArray = replaceAllArray;
298
+ exports.librarySplitMultipleArtists = librarySplitMultipleArtists;
299
+ exports.libraryFindFeaturing = libraryFindFeaturing;
300
+ exports.libraryCleanUpStartAndEndOfString = libraryCleanUpStartAndEndOfString;
301
+ exports.generateWeightedItemsGridString = generateWeightedItemsGridString;
302
+ exports.promptYesOrNo = promptYesOrNo;
303
+ exports.musicFileInfoToM3uEntry = musicFileInfoToM3uEntry;
304
+ exports.toM3uEntry = toM3uEntry;
305
+ exports.getStepString = getStepString;
306
+ exports.sliceOffLastSlash = sliceOffLastSlash;
307
+ exports.sliceOffLast = sliceOffLast;
308
+ exports.sliceOffUntil = sliceOffUntil;
309
+ exports.countOccurances = countOccurances;
310
+ exports.countPathDepth = countPathDepth;
311
+ exports.getPathEscapeString = getPathEscapeString;
312
+ exports.getFullPathEscapeString = getFullPathEscapeString;
313
+ exports.jsonLookupToMap = jsonLookupToMap;
314
+ exports.extractElementFromJsonAndRemove = extractElementFromJsonAndRemove;
315
+ exports.extractLookupFromJsonAndRemove = extractLookupFromJsonAndRemove;
316
+ exports.forEachValueAndPathOfObj = forEachValueAndPathOfObj;
317
+ exports.forEachLookUpValueAndPathOfObjRecursive = forEachLookUpValueAndPathOfObjRecursive;
318
+ exports.findGeniusSongs = findGeniusSongs;
319
+ exports.trimToCharNumbersOnly = trimToCharNumbersOnly;
320
+ exports.trimStartToCharNumbersOnly = trimStartToCharNumbersOnly;
321
+ exports.trimEndToCharNumbersOnly = trimEndToCharNumbersOnly;
322
+ exports.trim = trim;
323
+ exports.trimStart = trimStart;
324
+ exports.trimEnd = trimEnd;
325
+ exports.findGeniusLyrics = findGeniusLyrics;
326
+ exports.softSliceFrom = softSliceFrom;
327
+ exports.trimFirstLinesWhileIncludes = trimFirstLinesWhileIncludes;
328
+ exports.getFirstLine = getFirstLine;
329
+ exports.skyify = skyify;
330
+ exports.dateToFilename = dateToFilename;
331
+ exports.makeMap = makeMap;
332
+ exports.makeWeightedMap = makeWeightedMap;
333
+ exports.makeWeightedTextCompMap = makeWeightedTextCompMap;
334
+ exports.generateLinesUntilCharacterLimit = generateLinesUntilCharacterLimit;
335
+ exports.lastIndexOfSeparator = lastIndexOfSeparator;
336
+ exports.timestamp = timestamp;
337
+ exports.timestampWithMs = timestampWithMs;
338
+ exports.isSilent = isSilent;
339
+ exports.waitMs = waitMs;
340
+ exports.waitS = waitS;
341
+ exports.whileFalseAsyncS = whileFalseAsyncS;
342
+ exports.whileFalseAsyncMs = whileFalseAsyncMs;
343
+ exports.repeatForAsyncS = repeatForAsyncS;
344
+ exports.repeatForAsyncMs = repeatForAsyncMs;
345
+ exports.replaceLastTerminalLine = replaceLastTerminalLine;
346
+ exports.setTerminalOutput = setTerminalOutput;
347
+ exports.clearSetTerminalOutput = clearSetTerminalOutput;
348
+ exports.clearTerminalLines = clearTerminalLines;
349
+ exports.sIfNot1 = sIfNot1;
350
+ exports.if1Else = if1Else;
351
+ exports.makePath = makePath;
352
+ exports.makeUnixPath = makeUnixPath;
353
+ exports.makeWindowsPath = makeWindowsPath;
354
+ exports.overflow = overflow;
355
+ exports.overflow0 = overflow0;
356
+ exports.isWithin = isWithin;
357
+ exports.startShiftItemsMenu = startShiftItemsMenu;
358
+ exports.getRelativeOverflow = getRelativeOverflow;
359
+ exports.shiftMenuItemsFunction = shiftMenuItemsFunction;
360
+ exports.startNumbersEditMenu = startNumbersEditMenu;
361
+ exports.startMenu = startMenu;
362
+ exports.navigationKeysToNumber = navigationKeysToNumber;
363
+ exports.editNumberByInput = editNumberByInput;
364
+ exports.toMenuString = toMenuString;
365
+ exports.toPrintString = toPrintString;
366
+ exports.getStackTrace = getStackTrace;
367
+ exports.getStackTraceLine = getStackTraceLine;
368
+ exports.getCallerErrorLine = getCallerErrorLine;
369
+ exports.isCallerTs = isCallerTs;
370
+ exports.printError = printError;
371
+ exports.printWarn = printWarn;
372
+ exports.print = print;
373
+ exports.softToFixed = softToFixed;
374
+ exports.extractEpisodeNumber = extractEpisodeNumber;
375
+ exports.trashSoft = trashSoft;
376
+ exports.isOfType = isOfType;
377
+ exports.subtitlesStreamInfoToString = subtitlesStreamInfoToString;
378
+ exports.extractsubtitlesStreamsInfo = extractsubtitlesStreamsInfo;
379
+ exports.tryExtractSubtitles = tryExtractSubtitles;
380
+ exports.addSubtitles = addSubtitles;
381
+ exports.noteFromMIDI = noteFromMIDI;
382
+ exports.octaveFromMIDI = octaveFromMIDI;
383
+ exports.fullNoteFromMIDI = fullNoteFromMIDI;
384
+ exports.clearTerminal = clearTerminal;
385
+ exports.connectMidiByName = connectMidiByName;
386
+ exports.joinSet = joinSet;
387
+ exports.verboseModText = verboseModText;
388
+ exports.printDifferenceIfDifferent = printDifferenceIfDifferent;
389
+ exports.highlightDifference = highlightDifference;
390
+ exports.toRegexpAsExactString = toRegexpAsExactString;
391
+ exports.greenUnderlineBold = greenUnderlineBold;
392
+ exports.greenUnderline = greenUnderline;
393
+ exports.redUnderlineBold = redUnderlineBold;
394
+ exports.redUnderline = redUnderline;
395
+ exports.yellowUnderline = yellowUnderline;
396
+ exports.underlineBold = underlineBold;
397
+ exports.modAllMatchAndNotMatch = modAllMatchAndNotMatch;
398
+ exports.modMatchAndNotMatch = modMatchAndNotMatch;
399
+ exports.createRunnableScriptFiles = createRunnableScriptFiles;
400
+ exports.createProject = createProject;
401
+ exports.spawnLiveCmd = spawnLiveCmd;
402
+ exports.spawnLivePowershell = spawnLivePowershell;
403
+ exports.spawnLiveSilent = spawnLiveSilent;
404
+ exports.spawnLive = spawnLive;
405
+ exports.isWindows = isWindows;
406
+ exports.isMacOS = isMacOS;
407
+ exports.isLinux = isLinux;
408
+ exports.isUnixLike = isUnixLike;
409
+ exports.makeRunnable = makeRunnable;
410
+ exports.acceptUserInput = acceptUserInput;
411
+ exports.writeFileSyncCheck = writeFileSyncCheck;
412
+ exports.isLibTs = isLibTs;
413
+ exports.removeDuplicateLines = removeDuplicateLines;
414
+ exports.openCDTray = openCDTray;
415
+ exports.closeCDTray = closeCDTray;
416
+ exports.toggleCDTray = toggleCDTray;
417
+ exports.recordAudioUntilX = recordAudioUntilX;
418
+ exports.createSherpaCanaryOfflineSpeechRecognizer = createSherpaCanaryOfflineSpeechRecognizer;
419
+ exports.createSherpaOfflineSpeechRecognizer = createSherpaOfflineSpeechRecognizer;
420
+ exports.isTerminalAvailable = isTerminalAvailable;
421
+ exports.interpretWave = interpretWave;
422
+ exports.getAudioFileDuration = getAudioFileDuration;
423
+ exports.getDebugPaths = getDebugPaths;
424
+ exports.setDebugPaths = setDebugPaths;
425
+ exports.dogPaths = dogPaths;
426
+ exports.getTempPath = getTempPath;
427
+ exports.patchMicLib = patchMicLib;
428
+ exports.softSyncGitRepo = softSyncGitRepo;
429
+ const cheerio = __importStar(require("cheerio"));
430
+ const fs_1 = require("fs");
431
+ const https_1 = require("https");
432
+ const puppeteer_1 = __importDefault(require("puppeteer"));
433
+ const structs_1 = require("../structures/structs");
434
+ const chalk_1 = __importDefault(require("chalk"));
435
+ const child_process_1 = require("child_process");
436
+ const crypto_1 = require("crypto");
437
+ const fs_2 = require("fs");
438
+ const path_1 = __importStar(require("path"));
439
+ const classes_1 = require("../types/classes");
440
+ const fields_1 = require("../types/fields");
441
+ const util_1 = require("./util");
442
+ const os_1 = require("os");
443
+ const mic_1 = __importDefault(require("mic"));
444
+ var music_metadata_1 = require("music-metadata");
445
+ Object.defineProperty(exports, "musicMetadata", { enumerable: true, get: function () { return __importDefault(music_metadata_1).default; } });
17
446
  const ncp = require('node-clipboardy');
18
- export const chalk = chalkImport;
447
+ exports.chalk = chalk_1.default;
19
448
  const Genius = require("genius-lyrics");
20
- export const geniusClient = new Genius.Client(undefined);
449
+ exports.geniusClient = new Genius.Client(undefined);
21
450
  const readline = require('readline');
22
- export const sherpa_onnx = require('sherpa-onnx');
451
+ exports.sherpa_onnx = require('sherpa-onnx');
23
452
  //region Functions
24
- export function toExtension(input) {
453
+ function toExtension(input) {
25
454
  const indexOfPeriod = input.lastIndexOf(".");
26
455
  return indexOfPeriod == -1 ? "" : input.substring(indexOfPeriod + 1);
27
456
  }
28
- export function removeExtension(input) {
457
+ function removeExtension(input) {
29
458
  if (input[0] == ".") {
30
459
  return input;
31
460
  }
32
461
  const indexOfPeriod = input.lastIndexOf(".");
33
462
  return indexOfPeriod == -1 ? input : input.substring(0, indexOfPeriod);
34
463
  }
35
- export function rtl(text, amount, emptyChar = '') {
464
+ function rtl(text, amount, emptyChar = '') {
36
465
  text = text.toString();
37
466
  let temp = "";
38
467
  for (let i = text.length; i < amount; ++i) {
@@ -40,7 +469,7 @@ export function rtl(text, amount, emptyChar = '') {
40
469
  }
41
470
  return temp + text;
42
471
  }
43
- export function random(min, max) {
472
+ function random(min, max) {
44
473
  if (min > max) {
45
474
  const temp = min;
46
475
  min = max;
@@ -48,13 +477,13 @@ export function random(min, max) {
48
477
  }
49
478
  return (Math.floor(Math.random() * (Math.floor(max) - Math.floor(min) + 1) + Math.floor(min)));
50
479
  }
51
- export function randomBoolean(chance = 0.5) {
480
+ function randomBoolean(chance = 0.5) {
52
481
  return Math.random() < chance;
53
482
  }
54
- export function randomFromArray(array) {
483
+ function randomFromArray(array) {
55
484
  return array[random(0, array.length - 1)];
56
485
  }
57
- export function randomFromArrayButNot(array, not) {
486
+ function randomFromArrayButNot(array, not) {
58
487
  while (true) {
59
488
  const item = array[random(0, array.length - 1)];
60
489
  if (item != not) {
@@ -63,25 +492,25 @@ export function randomFromArrayButNot(array, not) {
63
492
  }
64
493
  }
65
494
  const troublesomeupsideMapdown = ["[", "]", "{", "}", "<", ">", "\\", "/", "3", "Ɛ"];
66
- export function upsideMapDown(text, reverse) {
495
+ function upsideMapDown(text, reverse) {
67
496
  if (!text) {
68
497
  return "You forgot the text!";
69
498
  }
70
499
  let returnText = "";
71
500
  for (var i = 0; i < text.length; ++i) {
72
501
  if (reverse) {
73
- if (UPSIDE_MAP[text[text.length - i - 1]])
74
- returnText += UPSIDE_MAP[text[text.length - i - 1]];
75
- else if (DOWNSIDE_MAP[text[text.length - i - 1]])
76
- returnText += DOWNSIDE_MAP[text[text.length - i - 1]];
502
+ if (fields_1.UPSIDE_MAP[text[text.length - i - 1]])
503
+ returnText += fields_1.UPSIDE_MAP[text[text.length - i - 1]];
504
+ else if (fields_1.DOWNSIDE_MAP[text[text.length - i - 1]])
505
+ returnText += fields_1.DOWNSIDE_MAP[text[text.length - i - 1]];
77
506
  else
78
507
  returnText += text[text.length - i - 1];
79
508
  }
80
509
  else {
81
- if (UPSIDE_MAP[text[i]] && !troublesomeupsideMapdown.includes(text[i]))
82
- returnText += UPSIDE_MAP[text[i]];
83
- else if (DOWNSIDE_MAP[text[i]] && !troublesomeupsideMapdown.includes(text[i]))
84
- returnText += DOWNSIDE_MAP[text[i]];
510
+ if (fields_1.UPSIDE_MAP[text[i]] && !troublesomeupsideMapdown.includes(text[i]))
511
+ returnText += fields_1.UPSIDE_MAP[text[i]];
512
+ else if (fields_1.DOWNSIDE_MAP[text[i]] && !troublesomeupsideMapdown.includes(text[i]))
513
+ returnText += fields_1.DOWNSIDE_MAP[text[i]];
85
514
  else
86
515
  returnText += text[i];
87
516
  }
@@ -89,17 +518,17 @@ export function upsideMapDown(text, reverse) {
89
518
  return returnText;
90
519
  }
91
520
  //START for each file/directory
92
- export function forEachInfo(basePath, func) {
93
- forEachFilePath(basePath, filePath => func(new FileInfo(filePath)));
521
+ function forEachInfo(basePath, func) {
522
+ forEachFilePath(basePath, filePath => func(new structs_1.FileInfo(filePath)));
94
523
  }
95
- export function forEachFilePath(basePath, func) {
524
+ function forEachFilePath(basePath, func) {
96
525
  //Can only iterate through a directory
97
- if (!statSync(basePath).isDirectory()) {
526
+ if (!(0, fs_1.statSync)(basePath).isDirectory()) {
98
527
  return;
99
528
  }
100
- for (const file of readdirSync(basePath)) {
101
- const filePath = `${basePath}${SEP}${file}`;
102
- if (!existsSync(filePath)) //Nani the fuck?
529
+ for (const file of (0, fs_1.readdirSync)(basePath)) {
530
+ const filePath = `${basePath}${fields_1.SEP}${file}`;
531
+ if (!(0, fs_1.existsSync)(filePath)) //Nani the fuck?
103
532
  {
104
533
  continue;
105
534
  }
@@ -108,34 +537,34 @@ export function forEachFilePath(basePath, func) {
108
537
  }
109
538
  //END for each file/directory
110
539
  //START for each file
111
- export function forEachFileInfo(basePath, func) {
112
- forEachFile(basePath, filePath => func(new FileInfo(filePath)));
540
+ function forEachFileInfo(basePath, func) {
541
+ forEachFile(basePath, filePath => func(new structs_1.FileInfo(filePath)));
113
542
  }
114
- export function forEachFile(basePath, func) {
543
+ function forEachFile(basePath, func) {
115
544
  forEachFilePath(basePath, filePath => {
116
- if (statSync(filePath).isDirectory())
545
+ if ((0, fs_1.statSync)(filePath).isDirectory())
117
546
  return;
118
547
  func(filePath);
119
548
  });
120
549
  }
121
550
  //END for each file
122
551
  //START for each directory
123
- export function forEachDirInfo(basePath, func) {
124
- forEachDir(basePath, filePath => func(new FileInfo(filePath)));
552
+ function forEachDirInfo(basePath, func) {
553
+ forEachDir(basePath, filePath => func(new structs_1.FileInfo(filePath)));
125
554
  }
126
- export function forEachDir(basePath, func) {
555
+ function forEachDir(basePath, func) {
127
556
  forEachFilePath(basePath, filePath => {
128
- if (!statSync(filePath).isDirectory())
557
+ if (!(0, fs_1.statSync)(filePath).isDirectory())
129
558
  return;
130
559
  func(filePath);
131
560
  });
132
561
  }
133
562
  //END for each directory
134
563
  //START for each file/directory recursive
135
- export function forEachInfoRecursive(basePath, func) {
136
- forEachRecursive(basePath, filePath => func(new FileInfo(filePath)));
564
+ function forEachInfoRecursive(basePath, func) {
565
+ forEachRecursive(basePath, filePath => func(new structs_1.FileInfo(filePath)));
137
566
  }
138
- export function forEachRecursive(basePath, func) {
567
+ function forEachRecursive(basePath, func) {
139
568
  forEachFilePath(basePath, filePath => {
140
569
  const result = func(filePath);
141
570
  if (result != null && !result)
@@ -145,31 +574,31 @@ export function forEachRecursive(basePath, func) {
145
574
  }
146
575
  //END for each file/directory recursive
147
576
  //START for each file recursive
148
- export function forEachFileInfoRecursive(basePath, func) {
149
- forEachFileRecursive(basePath, filePath => func(new FileInfo(filePath)));
577
+ function forEachFileInfoRecursive(basePath, func) {
578
+ forEachFileRecursive(basePath, filePath => func(new structs_1.FileInfo(filePath)));
150
579
  }
151
- export function getEachFileInfoRecursive(basePath) {
580
+ function getEachFileInfoRecursive(basePath) {
152
581
  const fileInfos = [];
153
582
  forEachFileInfoRecursive(basePath, fileInfo => fileInfos.push(fileInfo));
154
583
  return fileInfos;
155
584
  }
156
- export function getEachFileInfo(basePath) {
585
+ function getEachFileInfo(basePath) {
157
586
  const fileInfos = [];
158
587
  forEachFileInfo(basePath, fileInfo => fileInfos.push(fileInfo));
159
588
  return fileInfos;
160
589
  }
161
- export function forEachFileRecursive(basePath, func) {
590
+ function forEachFileRecursive(basePath, func) {
162
591
  forEachRecursive(basePath, filePath => {
163
- if (!statSync(filePath).isDirectory())
592
+ if (!(0, fs_1.statSync)(filePath).isDirectory())
164
593
  func(filePath);
165
594
  });
166
595
  }
167
596
  //END for each file recursive
168
597
  //START for each directory recursive
169
- export function forEachDirInfoRecursive(basePath, func) {
170
- forEachDirRecursive(basePath, filePath => func(new FileInfo(filePath)));
598
+ function forEachDirInfoRecursive(basePath, func) {
599
+ forEachDirRecursive(basePath, filePath => func(new structs_1.FileInfo(filePath)));
171
600
  }
172
- export function getEachDirInfoRecursive(basePath) {
601
+ function getEachDirInfoRecursive(basePath) {
173
602
  const fileInfos = [];
174
603
  forEachDirInfoRecursive(basePath, fileInfo => {
175
604
  fileInfos.push(fileInfo);
@@ -177,7 +606,7 @@ export function getEachDirInfoRecursive(basePath) {
177
606
  });
178
607
  return fileInfos;
179
608
  }
180
- export function getEachDirInfo(basePath) {
609
+ function getEachDirInfo(basePath) {
181
610
  const fileInfos = [];
182
611
  forEachDirInfo(basePath, fileInfo => {
183
612
  fileInfos.push(fileInfo);
@@ -185,7 +614,7 @@ export function getEachDirInfo(basePath) {
185
614
  });
186
615
  return fileInfos;
187
616
  }
188
- export function forEachDirRecursive(basePath, func) {
617
+ function forEachDirRecursive(basePath, func) {
189
618
  forEachDir(basePath, filePath => {
190
619
  const result = func(filePath);
191
620
  if (result != null && !result)
@@ -194,55 +623,56 @@ export function forEachDirRecursive(basePath, func) {
194
623
  });
195
624
  }
196
625
  //END for each directory recursive
197
- export function purgeEmptyDirectoriesRecursive(basePath) {
626
+ function purgeEmptyDirectoriesRecursive(basePath) {
198
627
  let removedDirectoriesCount = 0;
199
628
  getEachDirInfoRecursive(basePath).forEach(dirInfo => {
200
- const stat = statSync(dirInfo.path);
629
+ const stat = (0, fs_1.statSync)(dirInfo.path);
201
630
  if (!stat.isDirectory()) {
202
631
  return;
203
632
  }
204
- const items = readdirSync(dirInfo.path);
633
+ const items = (0, fs_1.readdirSync)(dirInfo.path);
205
634
  if (items.length > 0) {
206
635
  return;
207
636
  }
208
637
  ++removedDirectoriesCount;
209
- rmdirSync(dirInfo.path);
638
+ (0, fs_1.rmdirSync)(dirInfo.path);
210
639
  });
211
640
  return removedDirectoriesCount;
212
641
  }
213
- export function firstUpperLowerRest(input) {
642
+ function firstUpperLowerRest(input) {
214
643
  return input[0].toUpperCase() + input.slice(1).toLowerCase();
215
644
  }
216
- export function firstUpperLowerRestEachWord(input) {
645
+ function firstUpperLowerRestEachWord(input) {
217
646
  return input.split(" ")
218
647
  .filter(word => word.length > 0)
219
648
  .map(word => firstUpperLowerRest(word))
220
649
  .join(" ");
221
650
  }
222
- export function countChars(input) {
651
+ function countChars(input) {
223
652
  const charCount = {};
224
653
  for (const char of input)
225
654
  incrementObjNumber(charCount, char);
226
655
  return charCount;
227
656
  }
228
- export function countWords(input) {
657
+ function countWords(input) {
229
658
  const wordCount = {};
230
- for (const word of input.matchAll(WORDS_REGEX))
659
+ for (const word of input.matchAll(fields_1.WORDS_REGEX))
231
660
  incrementObjNumber(wordCount, word[0]);
232
661
  return wordCount;
233
662
  }
234
- export function countEmoji(input) {
663
+ function countEmoji(input) {
235
664
  const emojiCount = {};
236
- for (const match of input.matchAll(EMOJI_REGEX)) {
665
+ for (const match of input.matchAll(fields_1.EMOJI_REGEX)) {
237
666
  incrementObjNumber(emojiCount, match[0]);
238
667
  }
239
- for (const match of input.matchAll(CUSTOM_EMOJI_REGEX)) {
668
+ for (const match of input.matchAll(fields_1.CUSTOM_EMOJI_REGEX)) {
240
669
  incrementObjNumber(emojiCount, match[1]);
241
670
  }
242
671
  return emojiCount;
243
672
  }
244
- export function incrementMap(map, key, incrementBy = 1) {
245
- const existingValue = map.get(key) ?? 0;
673
+ function incrementMap(map, key, incrementBy = 1) {
674
+ var _a;
675
+ const existingValue = (_a = map.get(key)) !== null && _a !== void 0 ? _a : 0;
246
676
  if (incrementBy == 0) {
247
677
  return existingValue;
248
678
  }
@@ -250,8 +680,9 @@ export function incrementMap(map, key, incrementBy = 1) {
250
680
  map.set(key, newValue);
251
681
  return newValue;
252
682
  }
253
- export function incrementObjNumber(obj, key, incrementBy = 1) {
254
- const existingValue = obj[key] ?? 0;
683
+ function incrementObjNumber(obj, key, incrementBy = 1) {
684
+ var _a;
685
+ const existingValue = (_a = obj[key]) !== null && _a !== void 0 ? _a : 0;
255
686
  if (incrementBy == 0) {
256
687
  return existingValue;
257
688
  }
@@ -259,41 +690,41 @@ export function incrementObjNumber(obj, key, incrementBy = 1) {
259
690
  obj[key] = newValue;
260
691
  return newValue;
261
692
  }
262
- export function addObjs(obj1, obj2) {
693
+ function addObjs(obj1, obj2) {
263
694
  for (const [key, value] of Object.entries(obj2)) {
264
695
  incrementObjNumber(obj1, key, value);
265
696
  }
266
697
  return obj1;
267
698
  }
268
- export function mergeObjs(...objs) {
699
+ function mergeObjs(...objs) {
269
700
  const obj = {};
270
701
  for (const o of objs) {
271
702
  Object.assign(obj, o);
272
703
  }
273
704
  return obj;
274
705
  }
275
- export function sumValues(obj) {
706
+ function sumValues(obj) {
276
707
  let sum = 0;
277
708
  for (const key of Object.keys(obj))
278
709
  sum += obj[key];
279
710
  return sum;
280
711
  }
281
- export function getOrDefaultObj(input, key, elseValue) {
712
+ function getOrDefaultObj(input, key, elseValue) {
282
713
  if (input[key])
283
714
  return input[key];
284
715
  else
285
716
  return elseValue;
286
717
  }
287
- export function getOrDefaultMap(input, key, elseValue) {
718
+ function getOrDefaultMap(input, key, elseValue) {
288
719
  if (input.has(key))
289
720
  return input.get(key);
290
721
  else
291
722
  return elseValue;
292
723
  }
293
- export function getOrDefault(input, ifNull) {
724
+ function getOrDefault(input, ifNull) {
294
725
  return input == undefined ? ifNull : input;
295
726
  }
296
- export async function runSoft(func) {
727
+ async function runSoft(func) {
297
728
  try {
298
729
  await func.apply(null);
299
730
  }
@@ -301,7 +732,7 @@ export async function runSoft(func) {
301
732
  console.log(e);
302
733
  }
303
734
  }
304
- export function blacklistArray(elements, blacklist = []) {
735
+ function blacklistArray(elements, blacklist = []) {
305
736
  const output = [];
306
737
  for (const element of elements) {
307
738
  if (blacklist.includes(element))
@@ -310,7 +741,7 @@ export function blacklistArray(elements, blacklist = []) {
310
741
  }
311
742
  return output;
312
743
  }
313
- export function getChars(word) {
744
+ function getChars(word) {
314
745
  word = word.toLowerCase();
315
746
  let chars = {};
316
747
  for (let i = 0; i < word.length; ++i) {
@@ -319,7 +750,7 @@ export function getChars(word) {
319
750
  }
320
751
  return chars;
321
752
  }
322
- export function getDiff(mAChars, mBChars) {
753
+ function getDiff(mAChars, mBChars) {
323
754
  let diff = 0;
324
755
  const merged = {};
325
756
  const mAKeys = Object.keys(mAChars);
@@ -347,24 +778,24 @@ export function getDiff(mAChars, mBChars) {
347
778
  });
348
779
  return diff;
349
780
  }
350
- export function formatDate(date) {
781
+ function formatDate(date) {
351
782
  return date.toISOString().replace(/T/, ' ').replace(/\..+/, '');
352
783
  }
353
- export function decide(decision) {
784
+ function decide(decision) {
354
785
  return decision();
355
786
  }
356
- export async function decideAsync(decision) {
787
+ async function decideAsync(decision) {
357
788
  return await decision();
358
789
  }
359
- export function make(obj, init) {
790
+ function make(obj, init) {
360
791
  init(obj);
361
792
  return obj;
362
793
  }
363
- export async function makeAsync(obj, init) {
794
+ async function makeAsync(obj, init) {
364
795
  await init(obj);
365
796
  return obj;
366
797
  }
367
- export function extractElementsIntoArray(obj, elementKey) {
798
+ function extractElementsIntoArray(obj, elementKey) {
368
799
  const elements = [];
369
800
  for (const key of Object.keys(obj)) {
370
801
  const item = obj[key];
@@ -374,7 +805,7 @@ export function extractElementsIntoArray(obj, elementKey) {
374
805
  }
375
806
  return elements;
376
807
  }
377
- export function extractItemsIntoArray(obj, predicate) {
808
+ function extractItemsIntoArray(obj, predicate) {
378
809
  const items = [];
379
810
  for (const key of Object.keys(obj)) {
380
811
  const item = obj[key];
@@ -383,7 +814,7 @@ export function extractItemsIntoArray(obj, predicate) {
383
814
  }
384
815
  return items;
385
816
  }
386
- export function mapArrayOfObjsByElement(obj, elementKey) {
817
+ function mapArrayOfObjsByElement(obj, elementKey) {
387
818
  const map = new Map;
388
819
  for (const key of Object.keys(obj)) {
389
820
  const item = obj[key];
@@ -392,13 +823,13 @@ export function mapArrayOfObjsByElement(obj, elementKey) {
392
823
  }
393
824
  return map;
394
825
  }
395
- export function mapToArray(items, mapFunction) {
826
+ function mapToArray(items, mapFunction) {
396
827
  return make([], (array) => {
397
828
  for (const item of items)
398
829
  array.push(mapFunction(item));
399
830
  });
400
831
  }
401
- export function stringify(obj, ignoreEmpty = false) {
832
+ function stringify(obj, ignoreEmpty = false) {
402
833
  for (const key of Object.keys(obj)) {
403
834
  const value = obj[key];
404
835
  const isBigInt = typeof value == "bigint";
@@ -411,17 +842,17 @@ export function stringify(obj, ignoreEmpty = false) {
411
842
  }
412
843
  return JSON.stringify(obj, null, "\t").replace(/: ([{\[])\n([\t]*)\t/g, ":\n$2$1\n$2\t");
413
844
  }
414
- export function acronymStringIfTooLong(input, limit = 10, includeFillers = true) {
845
+ function acronymStringIfTooLong(input, limit = 10, includeFillers = true) {
415
846
  let processedInput = input.replaceAll(/['"]/g, "").replaceAll(/[^\p{L}0-9]/giu, " ").trim();
416
847
  if (!includeFillers) {
417
- processedInput = processedInput.replaceAll(ACRONYM_REGEXES, "");
848
+ processedInput = processedInput.replaceAll(fields_1.ACRONYM_REGEXES, "");
418
849
  }
419
850
  if (processedInput.length <= 0) {
420
851
  return processedInput;
421
852
  }
422
853
  if (processedInput.length >= limit) {
423
854
  let output = "";
424
- for (const result of processedInput.matchAll(ACRONYM_REGEX)) {
855
+ for (const result of processedInput.matchAll(fields_1.ACRONYM_REGEX)) {
425
856
  const match = result[0];
426
857
  output += match.charAt(match.length - 1);
427
858
  }
@@ -429,46 +860,47 @@ export function acronymStringIfTooLong(input, limit = 10, includeFillers = true)
429
860
  }
430
861
  return input;
431
862
  }
432
- export function mkdirSoftRecursive(fullPath) {
433
- fullPath = fullPath.replaceAll(SEPARATOR_REGEX, SEP);
434
- let path = fullPath.match(START_OF_PATH_REGEX)?.[0] ?? "";
863
+ function mkdirSoftRecursive(fullPath) {
864
+ var _a, _b;
865
+ fullPath = fullPath.replaceAll(fields_1.SEPARATOR_REGEX, fields_1.SEP);
866
+ let path = (_b = (_a = fullPath.match(fields_1.START_OF_PATH_REGEX)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : "";
435
867
  const parts = fullPath.slice(path.length).split(/[\\\/]/);
436
868
  for (const part of parts) {
437
- path += part + SEP;
869
+ path += part + fields_1.SEP;
438
870
  mkdirSoft(`${path}`);
439
871
  }
440
872
  }
441
- export function mkdirSoft(path) {
442
- if (!existsSync(path)) {
443
- mkdirSync(path);
873
+ function mkdirSoft(path) {
874
+ if (!(0, fs_1.existsSync)(path)) {
875
+ (0, fs_1.mkdirSync)(path);
444
876
  }
445
877
  }
446
- export function goUpDir(dir, times = 1) {
878
+ function goUpDir(dir, times = 1) {
447
879
  for (let i = 0; i < times; ++i)
448
880
  dir = dir.slice(0, lastIndexOfSeparator(dir));
449
881
  return dir;
450
882
  }
451
- export function writeFileIfNotPresent(path, data, options) {
452
- if (!existsSync(path))
453
- writeFileSync(path, data);
883
+ function writeFileIfNotPresent(path, data, options) {
884
+ if (!(0, fs_1.existsSync)(path))
885
+ (0, fs_1.writeFileSync)(path, data);
454
886
  }
455
- export function requireSoft(path, data, options) {
887
+ function requireSoft(path, data, options) {
456
888
  writeFileIfNotPresent(path, data);
457
889
  return require(path);
458
890
  }
459
- export function clone(obj) {
891
+ function clone(obj) {
460
892
  return Object.assign({}, obj);
461
893
  }
462
- export function getBit(number, bit) {
894
+ function getBit(number, bit) {
463
895
  return (number >> bit) & 1;
464
896
  }
465
- export function isBit(number, bit) {
897
+ function isBit(number, bit) {
466
898
  return getBit(number, bit) == 1;
467
899
  }
468
- export function map(input, min1, max1, min2, max2) {
900
+ function map(input, min1, max1, min2, max2) {
469
901
  return ((input - min1) / (max1 - min1)) * (max2 - min2) + min2;
470
902
  }
471
- export function logMap(input, inputStart, inputEnd, outputStart, outputEnd, curveIntensity) {
903
+ function logMap(input, inputStart, inputEnd, outputStart, outputEnd, curveIntensity) {
472
904
  // Validate and clamp curve intensity
473
905
  // curveIntensity = Math.max(-1, Math.min(1, curveIntensity || 0))
474
906
  // Handle linear case (curveIntensity = 0)
@@ -493,29 +925,29 @@ export function logMap(input, inputStart, inputEnd, outputStart, outputEnd, curv
493
925
  // Map to output range
494
926
  return outputStart + mappedValue * (outputEnd - outputStart);
495
927
  }
496
- export function clamp(input, min, max) {
928
+ function clamp(input, min, max) {
497
929
  return Math.max(min, Math.min(max, input));
498
930
  }
499
- export function clamp0(input, max) {
931
+ function clamp0(input, max) {
500
932
  return clamp(input, 0, max);
501
933
  }
502
934
  /**
503
935
  * @param startDate in ms
504
936
  * @param endDate in ms
505
937
  */
506
- export function datesDiff(dates) {
938
+ function datesDiff(dates) {
507
939
  return dates.endDate.valueOf() - (dates.startDate ? dates.startDate : new Date()).valueOf();
508
940
  }
509
- export function datesDiffToStamp(dates) {
941
+ function datesDiffToStamp(dates) {
510
942
  return toStamp(datesDiff(dates) / 1000);
511
943
  }
512
- export function datesGapToStamp(startDate, endDate) {
944
+ function datesGapToStamp(startDate, endDate) {
513
945
  return toStamp((endDate.valueOf() - startDate.valueOf()) / 1000);
514
946
  }
515
- export function dateToStamp(date) {
947
+ function dateToStamp(date) {
516
948
  return toStamp(date.valueOf() / 1000);
517
949
  }
518
- export function toStamp(toStamp) {
950
+ function toStamp(toStamp) {
519
951
  if (isNaN(toStamp) || toStamp == Infinity || toStamp == -Infinity) {
520
952
  toStamp = 0;
521
953
  }
@@ -543,7 +975,7 @@ export function toStamp(toStamp) {
543
975
  else
544
976
  return stamped;
545
977
  }
546
- export function convertNumberBase(num, fromBase, toBase) {
978
+ function convertNumberBase(num, fromBase, toBase) {
547
979
  const decimalValue = parseInt(num, fromBase);
548
980
  let convertedValue = '';
549
981
  let quotient = decimalValue;
@@ -554,45 +986,45 @@ export function convertNumberBase(num, fromBase, toBase) {
554
986
  }
555
987
  return convertedValue;
556
988
  }
557
- export function moveSync(oldPath, newPath) {
989
+ function moveSync(oldPath, newPath) {
558
990
  try {
559
- renameSync(oldPath, newPath);
991
+ (0, fs_1.renameSync)(oldPath, newPath);
560
992
  }
561
993
  catch (err) {
562
994
  if (err.code == "EXDEV") {
563
- copyFileSync(oldPath, newPath);
564
- unlinkSync(oldPath);
995
+ (0, fs_1.copyFileSync)(oldPath, newPath);
996
+ (0, fs_1.unlinkSync)(oldPath);
565
997
  }
566
998
  }
567
999
  }
568
- export async function download(url, dir) {
1000
+ async function download(url, dir) {
569
1001
  return new Promise((resolve, reject) => {
570
- const file = createWriteStream(dir);
571
- const request = get(url, function (response) {
1002
+ const file = (0, fs_1.createWriteStream)(dir);
1003
+ const request = (0, https_1.get)(url, function (response) {
572
1004
  response.pipe(file);
573
1005
  resolve(`success\nurl:${url}\ndir:${dir}`);
574
1006
  }).on("error", reject);
575
1007
  });
576
1008
  }
577
- export function isCharUpperCase(char) {
1009
+ function isCharUpperCase(char) {
578
1010
  return char.charCodeAt(0) >= 65 && char.charCodeAt(0) <= 90;
579
1011
  }
580
- export function isCharLowerCase(char) {
1012
+ function isCharLowerCase(char) {
581
1013
  return char.charCodeAt(0) >= 97 && char.charCodeAt(0) <= 122;
582
1014
  }
583
- export function isStandardLetter(char) {
1015
+ function isStandardLetter(char) {
584
1016
  return isCharLowerCase(char) || isCharUpperCase(char);
585
1017
  }
586
- export function getOrCreateAppendedLinesFile(path) {
1018
+ function getOrCreateAppendedLinesFile(path) {
587
1019
  writeFileIfNotPresent(path, "");
588
- return new Set(readFileSync(path, "utf8").split(/[\r\n]/));
1020
+ return new Set((0, fs_1.readFileSync)(path, "utf8").split(/[\r\n]/));
589
1021
  }
590
- export function rmSoft(path) {
591
- if (existsSync(path)) {
592
- rmSync(path);
1022
+ function rmSoft(path) {
1023
+ if ((0, fs_1.existsSync)(path)) {
1024
+ (0, fs_1.rmSync)(path);
593
1025
  }
594
1026
  }
595
- export function saveAppendedLinesFile(path, lines, excludeEmpty = true, trim = true) {
1027
+ function saveAppendedLinesFile(path, lines, excludeEmpty = true, trim = true) {
596
1028
  rmSoft(path);
597
1029
  const slashIndex = lastIndexOfSeparator(path);
598
1030
  if (slashIndex != -1) {
@@ -603,28 +1035,28 @@ export function saveAppendedLinesFile(path, lines, excludeEmpty = true, trim = t
603
1035
  if (excludeEmpty && line.length <= 0) {
604
1036
  continue;
605
1037
  }
606
- appendFileSync(path, `${trim ? line.trim() : line}\n`);
1038
+ (0, fs_2.appendFileSync)(path, `${trim ? line.trim() : line}\n`);
607
1039
  }
608
1040
  }
609
- export function getOrCreateFromKeys(map, keys, maker) {
1041
+ function getOrCreateFromKeys(map, keys, maker) {
610
1042
  for (const key of keys) {
611
1043
  getOrCreate(map, key, maker);
612
1044
  }
613
1045
  return map;
614
1046
  }
615
- export function getOrCreate(map, key, maker) {
1047
+ function getOrCreate(map, key, maker) {
616
1048
  if (!map.has(key)) {
617
1049
  map.set(key, maker());
618
1050
  }
619
1051
  return map.get(key);
620
1052
  }
621
- export function getOrCreateObj(obj, key, ifNullMaker) {
1053
+ function getOrCreateObj(obj, key, ifNullMaker) {
622
1054
  if (obj[key] == null) {
623
1055
  obj[key] = ifNullMaker();
624
1056
  }
625
1057
  return obj[key];
626
1058
  }
627
- export function appendObjArray(obj, key, item) {
1059
+ function appendObjArray(obj, key, item) {
628
1060
  let array = obj[key];
629
1061
  if (array == null) {
630
1062
  array = [];
@@ -633,7 +1065,7 @@ export function appendObjArray(obj, key, item) {
633
1065
  array.push(item);
634
1066
  return obj[key];
635
1067
  }
636
- export function organiseByKey(items, keyRetriever) {
1068
+ function organiseByKey(items, keyRetriever) {
637
1069
  const obj = {};
638
1070
  for (const item of items) {
639
1071
  appendObjArray(obj, keyRetriever(item), item);
@@ -641,196 +1073,196 @@ export function organiseByKey(items, keyRetriever) {
641
1073
  return obj;
642
1074
  }
643
1075
  //To Nanoseconds
644
- export function millisecondsToNanoseconds(milliseconds) {
645
- return milliseconds * NANOSECONDS_IN_MILLISECOND;
1076
+ function millisecondsToNanoseconds(milliseconds) {
1077
+ return milliseconds * fields_1.NANOSECONDS_IN_MILLISECOND;
646
1078
  }
647
- export function secondsToNanoseconds(nanoseconds) {
648
- return nanoseconds * NANOSECONDS_IN_SECOND;
1079
+ function secondsToNanoseconds(nanoseconds) {
1080
+ return nanoseconds * fields_1.NANOSECONDS_IN_SECOND;
649
1081
  }
650
- export function minutesToNanoseconds(minutes) {
651
- return minutes * NANOSECONDS_IN_MINUTE;
1082
+ function minutesToNanoseconds(minutes) {
1083
+ return minutes * fields_1.NANOSECONDS_IN_MINUTE;
652
1084
  }
653
- export function hoursToNanoseconds(hours) {
654
- return hours * NANOSECONDS_IN_HOUR;
1085
+ function hoursToNanoseconds(hours) {
1086
+ return hours * fields_1.NANOSECONDS_IN_HOUR;
655
1087
  }
656
- export function daysToNanoseconds(days) {
657
- return days * NANOSECONDS_IN_DAY;
1088
+ function daysToNanoseconds(days) {
1089
+ return days * fields_1.NANOSECONDS_IN_DAY;
658
1090
  }
659
- export function weeksToNanoseconds(weeks) {
660
- return weeks * NANOSECONDS_IN_WEEK;
1091
+ function weeksToNanoseconds(weeks) {
1092
+ return weeks * fields_1.NANOSECONDS_IN_WEEK;
661
1093
  }
662
1094
  //!To Nanoseconds
663
1095
  //To Milliseconds
664
- export function nanosecondsToMilliseconds(nanoseconds) {
665
- return nanoseconds / NANOSECONDS_IN_MILLISECOND;
1096
+ function nanosecondsToMilliseconds(nanoseconds) {
1097
+ return nanoseconds / fields_1.NANOSECONDS_IN_MILLISECOND;
666
1098
  }
667
- export function secondsToMilliseconds(milliseconds) {
668
- return milliseconds * MILLISECONDS_IN_SECOND;
1099
+ function secondsToMilliseconds(milliseconds) {
1100
+ return milliseconds * fields_1.MILLISECONDS_IN_SECOND;
669
1101
  }
670
- export function minutesToMilliseconds(minutes) {
671
- return minutes * MILLISECONDS_IN_MINUTE;
1102
+ function minutesToMilliseconds(minutes) {
1103
+ return minutes * fields_1.MILLISECONDS_IN_MINUTE;
672
1104
  }
673
- export function hoursToMilliseconds(hours) {
674
- return hours * MILLISECONDS_IN_HOUR;
1105
+ function hoursToMilliseconds(hours) {
1106
+ return hours * fields_1.MILLISECONDS_IN_HOUR;
675
1107
  }
676
- export function daysToMilliseconds(days) {
677
- return days * MILLISECONDS_IN_DAY;
1108
+ function daysToMilliseconds(days) {
1109
+ return days * fields_1.MILLISECONDS_IN_DAY;
678
1110
  }
679
- export function weeksToMilliseconds(weeks) {
680
- return weeks * MILLISECONDS_IN_WEEK;
1111
+ function weeksToMilliseconds(weeks) {
1112
+ return weeks * fields_1.MILLISECONDS_IN_WEEK;
681
1113
  }
682
1114
  //!To Milliseconds
683
1115
  //To Seconds
684
- export function nanosecondsToSeconds(nanoseconds) {
685
- return nanoseconds / NANOSECONDS_IN_SECOND;
1116
+ function nanosecondsToSeconds(nanoseconds) {
1117
+ return nanoseconds / fields_1.NANOSECONDS_IN_SECOND;
686
1118
  }
687
- export function millisecondsToSeconds(milliseconds) {
688
- return milliseconds / MILLISECONDS_IN_SECOND;
1119
+ function millisecondsToSeconds(milliseconds) {
1120
+ return milliseconds / fields_1.MILLISECONDS_IN_SECOND;
689
1121
  }
690
- export function minutesToSeconds(minutes) {
691
- return minutes * SECONDS_IN_MINUTE;
1122
+ function minutesToSeconds(minutes) {
1123
+ return minutes * fields_1.SECONDS_IN_MINUTE;
692
1124
  }
693
- export function hoursToSeconds(hours) {
694
- return hours * SECONDS_IN_HOUR;
1125
+ function hoursToSeconds(hours) {
1126
+ return hours * fields_1.SECONDS_IN_HOUR;
695
1127
  }
696
- export function daysToSeconds(days) {
697
- return days * SECONDS_IN_DAY;
1128
+ function daysToSeconds(days) {
1129
+ return days * fields_1.SECONDS_IN_DAY;
698
1130
  }
699
- export function weeksToSeconds(weeks) {
700
- return weeks * SECONDS_IN_WEEK;
1131
+ function weeksToSeconds(weeks) {
1132
+ return weeks * fields_1.SECONDS_IN_WEEK;
701
1133
  }
702
1134
  //!To Seconds
703
1135
  //To Minutes
704
- export function nanosecondsToMinutes(nanoseconds) {
705
- return nanoseconds / NANOSECONDS_IN_MINUTE;
1136
+ function nanosecondsToMinutes(nanoseconds) {
1137
+ return nanoseconds / fields_1.NANOSECONDS_IN_MINUTE;
706
1138
  }
707
- export function millisecondsToMinutes(milliseconds) {
708
- return milliseconds / MILLISECONDS_IN_MINUTE;
1139
+ function millisecondsToMinutes(milliseconds) {
1140
+ return milliseconds / fields_1.MILLISECONDS_IN_MINUTE;
709
1141
  }
710
- export function secondsToMinutes(minutes) {
711
- return minutes / SECONDS_IN_MINUTE;
1142
+ function secondsToMinutes(minutes) {
1143
+ return minutes / fields_1.SECONDS_IN_MINUTE;
712
1144
  }
713
- export function hoursToMinutes(hours) {
714
- return hours * MINUTES_IN_HOUR;
1145
+ function hoursToMinutes(hours) {
1146
+ return hours * fields_1.MINUTES_IN_HOUR;
715
1147
  }
716
- export function daysToMinutes(days) {
717
- return days * MINUTES_IN_DAY;
1148
+ function daysToMinutes(days) {
1149
+ return days * fields_1.MINUTES_IN_DAY;
718
1150
  }
719
- export function weeksToMinutes(weeks) {
720
- return weeks * MINUTES_IN_WEEK;
1151
+ function weeksToMinutes(weeks) {
1152
+ return weeks * fields_1.MINUTES_IN_WEEK;
721
1153
  }
722
1154
  //!To Minutes
723
1155
  //To Hours
724
- export function nanosecondsToHours(nanoseconds) {
725
- return nanoseconds / NANOSECONDS_IN_HOUR;
1156
+ function nanosecondsToHours(nanoseconds) {
1157
+ return nanoseconds / fields_1.NANOSECONDS_IN_HOUR;
726
1158
  }
727
- export function millisecondsToHours(milliseconds) {
728
- return milliseconds / MILLISECONDS_IN_HOUR;
1159
+ function millisecondsToHours(milliseconds) {
1160
+ return milliseconds / fields_1.MILLISECONDS_IN_HOUR;
729
1161
  }
730
- export function secondsToHours(seconds) {
731
- return seconds / SECONDS_IN_HOUR;
1162
+ function secondsToHours(seconds) {
1163
+ return seconds / fields_1.SECONDS_IN_HOUR;
732
1164
  }
733
- export function minutesToHours(minutes) {
734
- return minutes / MINUTES_IN_HOUR;
1165
+ function minutesToHours(minutes) {
1166
+ return minutes / fields_1.MINUTES_IN_HOUR;
735
1167
  }
736
- export function daysToHours(days) {
737
- return days * HOURS_IN_DAY;
1168
+ function daysToHours(days) {
1169
+ return days * fields_1.HOURS_IN_DAY;
738
1170
  }
739
- export function weeksToHours(weeks) {
740
- return weeks * HOURS_IN_WEEK;
1171
+ function weeksToHours(weeks) {
1172
+ return weeks * fields_1.HOURS_IN_WEEK;
741
1173
  }
742
1174
  //!To Hours
743
1175
  //To Days
744
- export function nanosecondsToDays(nanoseconds) {
745
- return nanoseconds / NANOSECONDS_IN_DAY;
1176
+ function nanosecondsToDays(nanoseconds) {
1177
+ return nanoseconds / fields_1.NANOSECONDS_IN_DAY;
746
1178
  }
747
- export function millisecondsToDays(milliseconds) {
748
- return milliseconds / MILLISECONDS_IN_DAY;
1179
+ function millisecondsToDays(milliseconds) {
1180
+ return milliseconds / fields_1.MILLISECONDS_IN_DAY;
749
1181
  }
750
- export function secondsToDays(seconds) {
751
- return seconds / SECONDS_IN_DAY;
1182
+ function secondsToDays(seconds) {
1183
+ return seconds / fields_1.SECONDS_IN_DAY;
752
1184
  }
753
- export function minutesToDays(minutes) {
754
- return minutes / MINUTES_IN_DAY;
1185
+ function minutesToDays(minutes) {
1186
+ return minutes / fields_1.MINUTES_IN_DAY;
755
1187
  }
756
- export function hoursToDays(hours) {
757
- return hours / HOURS_IN_DAY;
1188
+ function hoursToDays(hours) {
1189
+ return hours / fields_1.HOURS_IN_DAY;
758
1190
  }
759
- export function weeksToDays(weeks) {
760
- return weeks * DAYS_IN_WEEK;
1191
+ function weeksToDays(weeks) {
1192
+ return weeks * fields_1.DAYS_IN_WEEK;
761
1193
  }
762
1194
  //!To Days
763
1195
  //To Weeks
764
- export function nanosecondsToWeeks(nanoseconds) {
765
- return nanoseconds / NANOSECONDS_IN_WEEK;
1196
+ function nanosecondsToWeeks(nanoseconds) {
1197
+ return nanoseconds / fields_1.NANOSECONDS_IN_WEEK;
766
1198
  }
767
- export function millisecondsToWeeks(milliseconds) {
768
- return milliseconds / MILLISECONDS_IN_WEEK;
1199
+ function millisecondsToWeeks(milliseconds) {
1200
+ return milliseconds / fields_1.MILLISECONDS_IN_WEEK;
769
1201
  }
770
- export function secondsToWeeks(seconds) {
771
- return seconds / SECONDS_IN_WEEK;
1202
+ function secondsToWeeks(seconds) {
1203
+ return seconds / fields_1.SECONDS_IN_WEEK;
772
1204
  }
773
- export function minutesToWeeks(minutes) {
774
- return minutes / MINUTES_IN_WEEK;
1205
+ function minutesToWeeks(minutes) {
1206
+ return minutes / fields_1.MINUTES_IN_WEEK;
775
1207
  }
776
- export function hoursToWeeks(hours) {
777
- return hours / HOURS_IN_WEEK;
1208
+ function hoursToWeeks(hours) {
1209
+ return hours / fields_1.HOURS_IN_WEEK;
778
1210
  }
779
- export function daysToWeeks(days) {
780
- return days / DAYS_IN_WEEK;
1211
+ function daysToWeeks(days) {
1212
+ return days / fields_1.DAYS_IN_WEEK;
781
1213
  }
782
1214
  //!To Weeks
783
- export function minutesToHoursMinutes(totalMinutes) {
1215
+ function minutesToHoursMinutes(totalMinutes) {
784
1216
  let minutes = Math.floor(totalMinutes % 60);
785
1217
  return padLeft("" + Math.floor(totalMinutes / 60), 2, "0") + ":" + padLeft("" + minutes, 2, "0");
786
1218
  }
787
- export function parsedFileInfoNameToIntSort(a, b, ascending = true) {
1219
+ function parsedFileInfoNameToIntSort(a, b, ascending = true) {
788
1220
  return parsedStringToIntSort(a.name, b.name, ascending);
789
1221
  }
790
- export function parsedStringToIntSort(a, b, ascending = true) {
791
- const valueA = parseInt(a.replaceAll(NON_NUMBER_REGEX, ""));
792
- const valueB = parseInt(b.replaceAll(NON_NUMBER_REGEX, ""));
1222
+ function parsedStringToIntSort(a, b, ascending = true) {
1223
+ const valueA = parseInt(a.replaceAll(fields_1.NON_NUMBER_REGEX, ""));
1224
+ const valueB = parseInt(b.replaceAll(fields_1.NON_NUMBER_REGEX, ""));
793
1225
  return ascending ? valueA - valueB : valueB - valueA;
794
1226
  }
795
- export function degreesToRadians(degrees) {
796
- return degrees * DEGREES_TO_RADIANS;
1227
+ function degreesToRadians(degrees) {
1228
+ return degrees * fields_1.DEGREES_TO_RADIANS;
797
1229
  }
798
- export function toRads(degrees) {
799
- return degrees * DEGREES_TO_RADIANS;
1230
+ function toRads(degrees) {
1231
+ return degrees * fields_1.DEGREES_TO_RADIANS;
800
1232
  }
801
- export function radiansToDegrees(radians) {
802
- return radians * RADIANS_TO_DEGREES;
1233
+ function radiansToDegrees(radians) {
1234
+ return radians * fields_1.RADIANS_TO_DEGREES;
803
1235
  }
804
- export function toDegs(radians) {
805
- return radians * RADIANS_TO_DEGREES;
1236
+ function toDegs(radians) {
1237
+ return radians * fields_1.RADIANS_TO_DEGREES;
806
1238
  }
807
- export function getDayMonthYearDateString() {
1239
+ function getDayMonthYearDateString() {
808
1240
  const nowDate = new Date();
809
1241
  const dateStr = `${nowDate.getDate()}-${nowDate.getMonth() + 1}-${nowDate.getFullYear()}`;
810
1242
  return dateStr;
811
1243
  }
812
- export function touchSoft(path, defaultContent = "") {
813
- if (!existsSync(path)) {
814
- writeFileSync(path, defaultContent);
1244
+ function touchSoft(path, defaultContent = "") {
1245
+ if (!(0, fs_1.existsSync)(path)) {
1246
+ (0, fs_1.writeFileSync)(path, defaultContent);
815
1247
  }
816
1248
  }
817
- export function increment(path, amount = 1, float = false) {
818
- if (!existsSync(path)) {
819
- writeFileSync(path, "" + amount);
1249
+ function increment(path, amount = 1, float = false) {
1250
+ if (!(0, fs_1.existsSync)(path)) {
1251
+ (0, fs_1.writeFileSync)(path, "" + amount);
820
1252
  return amount;
821
1253
  }
822
- const parsedNumber = float ? parseFloat(readFileSync(path, "utf8")) : parseInt(readFileSync(path, "utf8"));
1254
+ const parsedNumber = float ? parseFloat((0, fs_1.readFileSync)(path, "utf8")) : parseInt((0, fs_1.readFileSync)(path, "utf8"));
823
1255
  const newValue = (isNaN(parsedNumber) ? 0 : parsedNumber) + amount;
824
- writeFileSync(path, "" + newValue);
1256
+ (0, fs_1.writeFileSync)(path, "" + newValue);
825
1257
  return newValue;
826
1258
  }
827
- export function readFileInt(path) {
828
- if (existsSync(path)) {
829
- return parseInt(readFileSync(path, "utf8"));
1259
+ function readFileInt(path) {
1260
+ if ((0, fs_1.existsSync)(path)) {
1261
+ return parseInt((0, fs_1.readFileSync)(path, "utf8"));
830
1262
  }
831
1263
  return -1;
832
1264
  }
833
- export function hashCode(str) {
1265
+ function hashCode(str) {
834
1266
  let hash = 0;
835
1267
  if (str.length === 0) {
836
1268
  return hash;
@@ -842,97 +1274,97 @@ export function hashCode(str) {
842
1274
  }
843
1275
  return hash;
844
1276
  }
845
- export function chalkColor(input, color) {
846
- return chalk.keyword(color)(input);
1277
+ function chalkColor(input, color) {
1278
+ return exports.chalk.keyword(color)(input);
847
1279
  }
848
- export function chalkRainbowColor(input, color) {
849
- return chalk.keyword(CHALK_RAINBOW_COLORS[Math.abs(color) % CHALK_RAINBOW_COLORS.length])(input);
1280
+ function chalkRainbowColor(input, color) {
1281
+ return exports.chalk.keyword(fields_1.CHALK_RAINBOW_COLORS[Math.abs(color) % fields_1.CHALK_RAINBOW_COLORS.length])(input);
850
1282
  }
851
- export function chalkNextRainbowColor(input) {
1283
+ function chalkNextRainbowColor(input) {
852
1284
  return chalkRainbowColor(input, rainbowIndex++);
853
1285
  }
854
- export function seededChalkRainbowColor(input) {
855
- return chalk.keyword(randomFromArray(CHALK_RAINBOW_COLORS))(input);
1286
+ function seededChalkRainbowColor(input) {
1287
+ return exports.chalk.keyword(randomFromArray(fields_1.CHALK_RAINBOW_COLORS))(input);
856
1288
  }
857
- export function randomChalkRainbowColor(input) {
1289
+ function randomChalkRainbowColor(input) {
858
1290
  return chalkRainbowColor(input, hashCode(input));
859
1291
  }
860
- export function padLeft(input, leftPad, padCharacter = " ") {
1292
+ function padLeft(input, leftPad, padCharacter = " ") {
861
1293
  const padAmount = leftPad - input.length;
862
1294
  for (let i = 0; i < padAmount; ++i) {
863
1295
  input = padCharacter + input;
864
1296
  }
865
1297
  return input;
866
1298
  }
867
- export function padRight(input, rightPad, padCharacter = " ") {
1299
+ function padRight(input, rightPad, padCharacter = " ") {
868
1300
  const padAmount = rightPad - input.length;
869
1301
  for (let i = 0; i < padAmount; ++i) {
870
1302
  input += padCharacter;
871
1303
  }
872
1304
  return input;
873
1305
  }
874
- export function getCuteAscii() {
875
- return randomFromArray(CUTE_ASCII);
1306
+ function getCuteAscii() {
1307
+ return randomFromArray(fields_1.CUTE_ASCII);
876
1308
  }
877
- export function isEmpty(char) {
1309
+ function isEmpty(char) {
878
1310
  if (char === " ") {
879
1311
  return true;
880
1312
  }
881
1313
  return false;
882
1314
  }
883
- export function singleSpacesOnly(input, trim = true) {
1315
+ function singleSpacesOnly(input, trim = true) {
884
1316
  input = input.replaceAll(/[ ]{2,}/g, " ");
885
1317
  if (trim) {
886
1318
  input = input.trim();
887
1319
  }
888
1320
  return input;
889
1321
  }
890
- export function getWeekDayString(date, lang = "en-US") {
891
- return date.toLocaleDateString(lang, VERBOSE_DATE_TIME_FORMAT_OPTIONS);
1322
+ function getWeekDayString(date, lang = "en-US") {
1323
+ return date.toLocaleDateString(lang, fields_1.VERBOSE_DATE_TIME_FORMAT_OPTIONS);
892
1324
  }
893
- export function getFirstRegexGroupMatchElse(input, regex, defaultValue) {
1325
+ function getFirstRegexGroupMatchElse(input, regex, defaultValue) {
894
1326
  const match = input.match(regex);
895
1327
  if (match == undefined || match[1] == undefined) {
896
1328
  return defaultValue;
897
1329
  }
898
1330
  return match[1];
899
1331
  }
900
- export function getFirstRegexGroupMatchAsIntElse(input, regex, defaultValue) {
1332
+ function getFirstRegexGroupMatchAsIntElse(input, regex, defaultValue) {
901
1333
  const match = input.match(regex);
902
1334
  if (match == undefined || match[1] == undefined) {
903
1335
  return defaultValue;
904
1336
  }
905
1337
  return parseInt(match[1]);
906
1338
  }
907
- export function getFirstRegexGroupMatchAsFloatElse(input, regex, defaultValue) {
1339
+ function getFirstRegexGroupMatchAsFloatElse(input, regex, defaultValue) {
908
1340
  const match = input.match(regex);
909
1341
  if (match == undefined || match[1] == undefined) {
910
1342
  return defaultValue;
911
1343
  }
912
1344
  return parseFloat(match[1]);
913
1345
  }
914
- export function getFirstRegexGroupMatchElseUndefined(input, regex) {
1346
+ function getFirstRegexGroupMatchElseUndefined(input, regex) {
915
1347
  const match = input.match(regex);
916
1348
  if (match == undefined || match[1] == undefined) {
917
1349
  return undefined;
918
1350
  }
919
1351
  return match[1];
920
1352
  }
921
- export function getFirstRegexGroupMatchAsIntElseUndefined(input, regex) {
1353
+ function getFirstRegexGroupMatchAsIntElseUndefined(input, regex) {
922
1354
  const match = input.match(regex);
923
1355
  if (match == undefined || match[1] == undefined) {
924
1356
  return undefined;
925
1357
  }
926
1358
  return parseInt(match[1]);
927
1359
  }
928
- export function getFirstRegexGroupMatchAsFloatElseUndefined(input, regex) {
1360
+ function getFirstRegexGroupMatchAsFloatElseUndefined(input, regex) {
929
1361
  const match = input.match(regex);
930
1362
  if (match == undefined || match[1] == undefined) {
931
1363
  return undefined;
932
1364
  }
933
1365
  return parseFloat(match[1]);
934
1366
  }
935
- export function allRegexesMatched(regexes, toMatchOn) {
1367
+ function allRegexesMatched(regexes, toMatchOn) {
936
1368
  for (const regex of regexes) {
937
1369
  if (toMatchOn.match(regex) == undefined) {
938
1370
  return false;
@@ -940,7 +1372,7 @@ export function allRegexesMatched(regexes, toMatchOn) {
940
1372
  }
941
1373
  return true;
942
1374
  }
943
- export function countOccurrences(stringToCountFrom, stringToCountOccurenceOf) {
1375
+ function countOccurrences(stringToCountFrom, stringToCountOccurenceOf) {
944
1376
  let count = 0;
945
1377
  let lastIndex = -1;
946
1378
  while ((lastIndex = stringToCountFrom.indexOf(stringToCountOccurenceOf, lastIndex + 1)) !== -1) {
@@ -948,7 +1380,7 @@ export function countOccurrences(stringToCountFrom, stringToCountOccurenceOf) {
948
1380
  }
949
1381
  return count;
950
1382
  }
951
- export function occursAtleastTimes(stringToCountFrom, stringToCountOccurenceOf, requiredOccuranceCount) {
1383
+ function occursAtleastTimes(stringToCountFrom, stringToCountOccurenceOf, requiredOccuranceCount) {
952
1384
  let count = 0;
953
1385
  let lastIndex = -1;
954
1386
  while ((lastIndex = stringToCountFrom.indexOf(stringToCountOccurenceOf, lastIndex + 1)) !== -1) {
@@ -959,19 +1391,19 @@ export function occursAtleastTimes(stringToCountFrom, stringToCountOccurenceOf,
959
1391
  }
960
1392
  return false;
961
1393
  }
962
- export function removeColorCodes(input) {
963
- return input.replace(COLOR_CODE_REGEX, '');
1394
+ function removeColorCodes(input) {
1395
+ return input.replace(fields_1.COLOR_CODE_REGEX, '');
964
1396
  }
965
- export function replaceAllRegexAsGlobalArray(input, regexes, replaceWith) {
1397
+ function replaceAllRegexAsGlobalArray(input, regexes, replaceWith) {
966
1398
  for (const regex of regexes) {
967
1399
  input = replaceAllRegexAsGlobal(input, regex, "**$&**");
968
1400
  }
969
1401
  return input;
970
1402
  }
971
- export function replaceAllRegexAsGlobal(input, regex, replaceWith) {
1403
+ function replaceAllRegexAsGlobal(input, regex, replaceWith) {
972
1404
  return input.replaceAll(new RegExp(regex.source, "g"), replaceWith);
973
1405
  }
974
- export function setToJSON(set) {
1406
+ function setToJSON(set) {
975
1407
  const array = [];
976
1408
  set.forEach((value) => {
977
1409
  if (value instanceof Set) {
@@ -986,7 +1418,7 @@ export function setToJSON(set) {
986
1418
  });
987
1419
  return array;
988
1420
  }
989
- export function mapToJSON(map) {
1421
+ function mapToJSON(map) {
990
1422
  const obj = {};
991
1423
  map.forEach((value, key) => {
992
1424
  if (value instanceof Set) {
@@ -1001,7 +1433,7 @@ export function mapToJSON(map) {
1001
1433
  });
1002
1434
  return obj;
1003
1435
  }
1004
- export function toJSON(input) {
1436
+ function toJSON(input) {
1005
1437
  if (input instanceof Set) {
1006
1438
  return setToJSON(input);
1007
1439
  }
@@ -1012,7 +1444,7 @@ export function toJSON(input) {
1012
1444
  throw new Error('Input must be a Set or Map');
1013
1445
  }
1014
1446
  }
1015
- export function jsonToSet(jsonArray) {
1447
+ function jsonToSet(jsonArray) {
1016
1448
  const set = new Set();
1017
1449
  jsonArray.forEach((item) => {
1018
1450
  if (Array.isArray(item)) {
@@ -1027,7 +1459,7 @@ export function jsonToSet(jsonArray) {
1027
1459
  });
1028
1460
  return set;
1029
1461
  }
1030
- export function jsonToMap(jsonObject) {
1462
+ function jsonToMap(jsonObject) {
1031
1463
  const map = new Map();
1032
1464
  Object.keys(jsonObject).forEach((key) => {
1033
1465
  const value = jsonObject[key];
@@ -1043,7 +1475,7 @@ export function jsonToMap(jsonObject) {
1043
1475
  });
1044
1476
  return map;
1045
1477
  }
1046
- export function fromJSON(json) {
1478
+ function fromJSON(json) {
1047
1479
  if (Array.isArray(json)) {
1048
1480
  return jsonToSet(json);
1049
1481
  }
@@ -1054,15 +1486,15 @@ export function fromJSON(json) {
1054
1486
  throw new Error('JSON must be an array or object');
1055
1487
  }
1056
1488
  }
1057
- export function htmlAsCheerio(html) {
1489
+ function htmlAsCheerio(html) {
1058
1490
  return cheerio.load(html);
1059
1491
  }
1060
- export async function getPageCheerio(url, options = DEFAULT_HTTPS_CONNECTION_OPTIONS) {
1492
+ async function getPageCheerio(url, options = fields_1.DEFAULT_HTTPS_CONNECTION_OPTIONS) {
1061
1493
  return htmlAsCheerio(await getPageHtml(url, options));
1062
1494
  }
1063
- export async function getPageHtml(url, options = DEFAULT_HTTPS_CONNECTION_OPTIONS) {
1495
+ async function getPageHtml(url, options = fields_1.DEFAULT_HTTPS_CONNECTION_OPTIONS) {
1064
1496
  return new Promise((resolve, reject) => {
1065
- get(url, options, (response) => {
1497
+ (0, https_1.get)(url, options, (response) => {
1066
1498
  let data = '';
1067
1499
  response.on('data', (chunk) => {
1068
1500
  data += chunk;
@@ -1076,17 +1508,17 @@ export async function getPageHtml(url, options = DEFAULT_HTTPS_CONNECTION_OPTION
1076
1508
  });
1077
1509
  });
1078
1510
  }
1079
- export function humanReadableJsonToHumanReadableNextLineBracketsJson(json) {
1080
- return json.replaceAll(JSON_NEXT_LINE_BRACKET_FROM_REGEX, JSON_NEXT_LINE_BRACKET_TO);
1511
+ function humanReadableJsonToHumanReadableNextLineBracketsJson(json) {
1512
+ return json.replaceAll(fields_1.JSON_NEXT_LINE_BRACKET_FROM_REGEX, fields_1.JSON_NEXT_LINE_BRACKET_TO);
1081
1513
  }
1082
1514
  /**
1083
1515
  * @returns Stringified JSON version of the object in Human Readable, Next Line Bracket string.
1084
1516
  */
1085
- export function toJson(obj) {
1517
+ function toJson(obj) {
1086
1518
  return humanReadableJsonToHumanReadableNextLineBracketsJson(JSON.stringify(obj, null, "\t"));
1087
1519
  }
1088
- export function charToRegexOrHomoglyphs(char) {
1089
- const homoglyphRegexpOr = HOMOGLYPHS_AS_REGEXP_OR[char];
1520
+ function charToRegexOrHomoglyphs(char) {
1521
+ const homoglyphRegexpOr = fields_1.HOMOGLYPHS_AS_REGEXP_OR[char];
1090
1522
  if (homoglyphRegexpOr == undefined) {
1091
1523
  return char;
1092
1524
  }
@@ -1094,7 +1526,7 @@ export function charToRegexOrHomoglyphs(char) {
1094
1526
  return homoglyphRegexpOr;
1095
1527
  }
1096
1528
  }
1097
- export function stringToRegexOrHomoglyphs(text, suffix = "+") {
1529
+ function stringToRegexOrHomoglyphs(text, suffix = "+") {
1098
1530
  let output = "";
1099
1531
  let lastChar = "";
1100
1532
  const groupChars = suffix == "+" || suffix == "*";
@@ -1120,36 +1552,36 @@ export function stringToRegexOrHomoglyphs(text, suffix = "+") {
1120
1552
  }
1121
1553
  return output;
1122
1554
  }
1123
- export function toInsanelyAccurateRegex(regex, flags = "i") {
1555
+ function toInsanelyAccurateRegex(regex, flags = "i") {
1124
1556
  return new RegExp(stringToRegexOrHomoglyphs(regex, "+"));
1125
1557
  }
1126
- export function noop() { }
1127
- export function noop1(arg1) { }
1128
- export function noop2(arg1, arg2) { }
1129
- export function noop3(arg1, arg2, arg3) { }
1130
- export function forEachKeyValue(obj, consumer) {
1558
+ function noop() { }
1559
+ function noop1(arg1) { }
1560
+ function noop2(arg1, arg2) { }
1561
+ function noop3(arg1, arg2, arg3) { }
1562
+ function forEachKeyValue(obj, consumer) {
1131
1563
  for (const key of Object.keys(obj)) {
1132
1564
  consumer(obj[key], key);
1133
1565
  }
1134
1566
  }
1135
- export function keyValueToOdt(obj) {
1567
+ function keyValueToOdt(obj) {
1136
1568
  let output = "";
1137
1569
  forEachKeyValue(obj, (value, key) => {
1138
1570
  output += `${key}\t${value}\n`;
1139
1571
  });
1140
1572
  return output;
1141
1573
  }
1142
- export function orElse(item, orElse) {
1574
+ function orElse(item, orElse) {
1143
1575
  if (item == null) {
1144
1576
  return orElse();
1145
1577
  }
1146
1578
  return item;
1147
1579
  }
1148
- export function getClosestValue(map, input) {
1580
+ function getClosestValue(map, input) {
1149
1581
  const closestKey = getClosestNumber(input, Array.from(map.keys()).sort());
1150
1582
  return map.get(closestKey);
1151
1583
  }
1152
- export function getClosestNumber(input, options) {
1584
+ function getClosestNumber(input, options) {
1153
1585
  if (options.length <= 0) {
1154
1586
  return input;
1155
1587
  }
@@ -1330,7 +1762,7 @@ const TO_WEEK_CONVERSION_TYPES = [
1330
1762
  "w_to_w",
1331
1763
  ];
1332
1764
  //!~~~~~To~~~~~
1333
- export function convertTime(input, type) {
1765
+ function convertTime(input, type) {
1334
1766
  switch (type) {
1335
1767
  case "ns_to_s":
1336
1768
  return nanosecondsToSeconds(input);
@@ -1418,62 +1850,64 @@ export function convertTime(input, type) {
1418
1850
  return weeksToDays(input);
1419
1851
  }
1420
1852
  }
1421
- export const ZERO_BIG_INT = BigInt(0);
1422
- export const getZero = () => 0;
1423
- export const getZeroBigInt = () => ZERO_BIG_INT;
1853
+ exports.ZERO_BIG_INT = BigInt(0);
1854
+ const getZero = () => 0;
1855
+ exports.getZero = getZero;
1856
+ const getZeroBigInt = () => exports.ZERO_BIG_INT;
1857
+ exports.getZeroBigInt = getZeroBigInt;
1424
1858
  const timeTrackers = new Map();
1425
- export function getNs() {
1859
+ function getNs() {
1426
1860
  return process.hrtime.bigint();
1427
1861
  }
1428
- export function startTimer(key) {
1862
+ function startTimer(key) {
1429
1863
  timeTrackers.set(key, getNs());
1430
1864
  }
1431
- export function getTimer(key) {
1432
- return orElse(timeTrackers.get(key), getZeroBigInt);
1865
+ function getTimer(key) {
1866
+ return orElse(timeTrackers.get(key), exports.getZeroBigInt);
1433
1867
  }
1434
- export function getTimerString(key, format = "ns_to_s") {
1868
+ function getTimerString(key, format = "ns_to_s") {
1435
1869
  return `${key}: ${convertTime(Number(getTimer(key)), format)}`;
1436
1870
  }
1437
- export function printTimer(key, format = "ns_to_s") {
1871
+ function printTimer(key, format = "ns_to_s") {
1438
1872
  console.log(getTimerString(key, format));
1439
1873
  }
1440
- export function isString(input) {
1874
+ function isString(input) {
1441
1875
  return typeof input === 'string' || input instanceof String;
1442
1876
  }
1443
- export function reverseString(str) {
1877
+ function reverseString(str) {
1444
1878
  return str.split('').reverse().join('');
1445
1879
  }
1446
- export function wipeAllLetters(input) {
1447
- return input.replaceAll(UNICODE_LETTERS_REGEX, "");
1880
+ function wipeAllLetters(input) {
1881
+ return input.replaceAll(fields_1.UNICODE_LETTERS_REGEX, "");
1448
1882
  }
1449
- export function keepOnlyAllLetters(input) {
1450
- return input.replaceAll(NOT_UNICODE_LETTERS_REGEX, "");
1883
+ function keepOnlyAllLetters(input) {
1884
+ return input.replaceAll(fields_1.NOT_UNICODE_LETTERS_REGEX, "");
1451
1885
  }
1452
- export function wipeNumbers(input) {
1453
- return input.replaceAll(NUMBER_REGEX, "");
1886
+ function wipeNumbers(input) {
1887
+ return input.replaceAll(fields_1.NUMBER_REGEX, "");
1454
1888
  }
1455
- export function keepOnlyNumbers(input) {
1456
- return input.replaceAll(NON_NUMBER_REGEX, "");
1889
+ function keepOnlyNumbers(input) {
1890
+ return input.replaceAll(fields_1.NON_NUMBER_REGEX, "");
1457
1891
  }
1458
- export function wipeAllLettersAndNumbers(input) {
1892
+ function wipeAllLettersAndNumbers(input) {
1459
1893
  return wipeAllLetters(wipeNumbers(input));
1460
1894
  }
1461
- export function keepOnlyAllLettersAndNumbers(input) {
1895
+ function keepOnlyAllLettersAndNumbers(input) {
1462
1896
  return keepOnlyAllLetters(keepOnlyNumbers(input));
1463
1897
  }
1464
- export function fromArrayOrNull(array, index) {
1898
+ function fromArrayOrNull(array, index) {
1465
1899
  if (index >= 0 && index < array.length) {
1466
1900
  return array[index];
1467
1901
  }
1468
1902
  return null;
1469
1903
  }
1470
- export function setClipboard(text) {
1904
+ function setClipboard(text) {
1471
1905
  ncp.writeSync(text);
1472
1906
  }
1473
- export function readClipboard() {
1907
+ function readClipboard() {
1474
1908
  return ncp.readSync();
1475
1909
  }
1476
- export function toDDMMYYYY(date = null) {
1910
+ function toDDMMYYYY(date = null) {
1477
1911
  if (date == null) {
1478
1912
  date = new Date();
1479
1913
  }
@@ -1482,7 +1916,7 @@ export function toDDMMYYYY(date = null) {
1482
1916
  const year = date.getFullYear().toString();
1483
1917
  return `${day}-${month}-${year}`;
1484
1918
  }
1485
- export function toMMDDYYYY(date = null) {
1919
+ function toMMDDYYYY(date = null) {
1486
1920
  if (date == null) {
1487
1921
  date = new Date();
1488
1922
  }
@@ -1491,23 +1925,23 @@ export function toMMDDYYYY(date = null) {
1491
1925
  const year = date.getFullYear().toString();
1492
1926
  return `${month}-${day}-${year}`;
1493
1927
  }
1494
- export async function downloadItem(url, destination) {
1928
+ async function downloadItem(url, destination) {
1495
1929
  const tempDestination = `${destination}_TEMP`;
1496
- if (existsSync(tempDestination)) {
1497
- unlinkSync(tempDestination);
1930
+ if ((0, fs_1.existsSync)(tempDestination)) {
1931
+ (0, fs_1.unlinkSync)(tempDestination);
1498
1932
  }
1499
1933
  return new Promise(resolve => {
1500
- const file = createWriteStream(tempDestination);
1501
- get(url, (response) => {
1934
+ const file = (0, fs_1.createWriteStream)(tempDestination);
1935
+ (0, https_1.get)(url, (response) => {
1502
1936
  response.pipe(file);
1503
1937
  file.on('finish', () => {
1504
1938
  file.close();
1505
- if (existsSync(destination)) {
1506
- unlinkSync(destination);
1939
+ if ((0, fs_1.existsSync)(destination)) {
1940
+ (0, fs_1.unlinkSync)(destination);
1507
1941
  }
1508
- if (existsSync(tempDestination)) {
1509
- renameSync(tempDestination, destination);
1510
- const stat = statSync(destination);
1942
+ if ((0, fs_1.existsSync)(tempDestination)) {
1943
+ (0, fs_1.renameSync)(tempDestination, destination);
1944
+ const stat = (0, fs_1.statSync)(destination);
1511
1945
  if (stat.size <= 0) {
1512
1946
  console.log(`low size: ${stat.size}`);
1513
1947
  resolve(false);
@@ -1521,25 +1955,25 @@ export async function downloadItem(url, destination) {
1521
1955
  });
1522
1956
  }).on('error', (err) => {
1523
1957
  console.log(`Failed download ${destination}`);
1524
- if (existsSync(tempDestination)) {
1525
- unlinkSync(tempDestination);
1958
+ if ((0, fs_1.existsSync)(tempDestination)) {
1959
+ (0, fs_1.unlinkSync)(tempDestination);
1526
1960
  }
1527
1961
  resolve(false);
1528
1962
  });
1529
1963
  });
1530
1964
  }
1531
- export function getChild(element, childIndex = 0) {
1965
+ function getChild(element, childIndex = 0) {
1532
1966
  if (element.children.length <= childIndex) {
1533
1967
  return element.children[element.children.length - 1];
1534
1968
  }
1535
1969
  return element.children[childIndex];
1536
1970
  }
1537
- export async function getDynamicContentCheerio(url, options) {
1971
+ async function getDynamicContentCheerio(url, options) {
1538
1972
  const html = await getDynamicContent(url, options);
1539
1973
  return cheerio.load(html);
1540
1974
  }
1541
- export async function getDynamicContent(url, options) {
1542
- const browser = await puppeteer.launch();
1975
+ async function getDynamicContent(url, options) {
1976
+ const browser = await puppeteer_1.default.launch();
1543
1977
  const page = await browser.newPage();
1544
1978
  try {
1545
1979
  await page.goto(url, options);
@@ -1554,39 +1988,39 @@ export async function getDynamicContent(url, options) {
1554
1988
  await browser.close();
1555
1989
  }
1556
1990
  }
1557
- export async function randomTimeout(minMs = 1523, maxMs = 3251) {
1991
+ async function randomTimeout(minMs = 1523, maxMs = 3251) {
1558
1992
  return await new Promise(resolve => setTimeout(resolve, random(minMs, maxMs)));
1559
1993
  }
1560
- export async function randomTimeoutVerbose(minMs, maxMs, timeoutGapMs = 1523) {
1994
+ async function randomTimeoutVerbose(minMs, maxMs, timeoutGapMs = 1523) {
1561
1995
  const waitingForMs = random(minMs, maxMs);
1562
1996
  let waitedFor = 0;
1563
1997
  let waitFor = clamp(waitingForMs - waitedFor, 0, timeoutGapMs);
1564
1998
  while (waitedFor < waitingForMs) {
1565
- console.log(`Waiting for ${chalk.magentaBright(waitingForMs - waitedFor) + "ms"}...`);
1999
+ console.log(`Waiting for ${exports.chalk.magentaBright(waitingForMs - waitedFor) + "ms"}...`);
1566
2000
  await new Promise(resolve => setTimeout(resolve, waitFor));
1567
2001
  waitedFor += timeoutGapMs;
1568
2002
  waitFor = clamp(waitingForMs - waitedFor, 0, timeoutGapMs);
1569
2003
  }
1570
2004
  return await new Promise(resolve => setTimeout(resolve, waitFor));
1571
2005
  }
1572
- export function getLast(items) {
2006
+ function getLast(items) {
1573
2007
  if (items.length <= 0) {
1574
2008
  return undefined;
1575
2009
  }
1576
2010
  return items[items.length - 1];
1577
2011
  }
1578
- export function getLastX(items, lastCount) {
2012
+ function getLastX(items, lastCount) {
1579
2013
  const startIndex = Math.max(0, items.length - lastCount);
1580
2014
  return items.slice(startIndex);
1581
2015
  }
1582
- export function forLastX(items, lastCount, consumer) {
2016
+ function forLastX(items, lastCount, consumer) {
1583
2017
  const itemsLength = items.length;
1584
2018
  const startIndex = Math.max(0, itemsLength - lastCount);
1585
2019
  for (let i = startIndex; i < itemsLength; ++i) {
1586
2020
  consumer(items[i]);
1587
2021
  }
1588
2022
  }
1589
- export function joinToXCounts(items, maxCount, joinWith = "\n") {
2023
+ function joinToXCounts(items, maxCount, joinWith = "\n") {
1590
2024
  const output = [];
1591
2025
  let msg = "";
1592
2026
  let count = 0;
@@ -1603,17 +2037,17 @@ export function joinToXCounts(items, maxCount, joinWith = "\n") {
1603
2037
  }
1604
2038
  return output;
1605
2039
  }
1606
- export async function asyncMap(items, mapper) {
2040
+ async function asyncMap(items, mapper) {
1607
2041
  const output = [];
1608
2042
  for (const item of items) {
1609
2043
  output.push(await mapper(item));
1610
2044
  }
1611
2045
  return output;
1612
2046
  }
1613
- export function emptyIfEmpty(text) {
1614
- return text.trim().length == 0 ? EMPTY : text.trim();
2047
+ function emptyIfEmpty(text) {
2048
+ return text.trim().length == 0 ? fields_1.EMPTY : text.trim();
1615
2049
  }
1616
- export function getRandomWeighedItem(map, total = getWeightOfValues(map)) {
2050
+ function getRandomWeighedItem(map, total = getWeightOfValues(map)) {
1617
2051
  let rand = Math.random() * total;
1618
2052
  let item = null;
1619
2053
  for (const [key, value] of map.entries()) {
@@ -1625,42 +2059,42 @@ export function getRandomWeighedItem(map, total = getWeightOfValues(map)) {
1625
2059
  }
1626
2060
  return item;
1627
2061
  }
1628
- export function getWeightOfKeys(map) {
2062
+ function getWeightOfKeys(map) {
1629
2063
  return getSum(map.keys());
1630
2064
  }
1631
- export function getWeightOfValues(map) {
2065
+ function getWeightOfValues(map) {
1632
2066
  return getSum(map.values());
1633
2067
  }
1634
- export function getSum(numbers) {
2068
+ function getSum(numbers) {
1635
2069
  let sum = 0;
1636
2070
  for (const number of numbers) {
1637
2071
  sum += number;
1638
2072
  }
1639
2073
  return sum;
1640
2074
  }
1641
- export function getCurrentMs() {
2075
+ function getCurrentMs() {
1642
2076
  return Date.now();
1643
2077
  }
1644
- export function getCurrentSecond() {
2078
+ function getCurrentSecond() {
1645
2079
  return millisecondsToSeconds(getCurrentMs());
1646
2080
  }
1647
- export function getCurrentMinute() {
2081
+ function getCurrentMinute() {
1648
2082
  return millisecondsToMinutes(getCurrentMs());
1649
2083
  }
1650
- export function getCurrentHour() {
2084
+ function getCurrentHour() {
1651
2085
  return millisecondsToHours(getCurrentMs());
1652
2086
  }
1653
- export function getCurrentDay() {
2087
+ function getCurrentDay() {
1654
2088
  return millisecondsToDays(getCurrentMs());
1655
2089
  }
1656
- export function reverseMap(map) {
2090
+ function reverseMap(map) {
1657
2091
  const reversedMap = new Map();
1658
2092
  for (const [key, value] of map.entries()) {
1659
2093
  reversedMap.set(value, key);
1660
2094
  }
1661
2095
  return reversedMap;
1662
2096
  }
1663
- export function toArray(iterator) {
2097
+ function toArray(iterator) {
1664
2098
  const array = [];
1665
2099
  let result = iterator.next();
1666
2100
  while (!result.done) {
@@ -1669,13 +2103,13 @@ export function toArray(iterator) {
1669
2103
  }
1670
2104
  return array;
1671
2105
  }
1672
- export function sortDateOldestFirst(a, b) {
2106
+ function sortDateOldestFirst(a, b) {
1673
2107
  return a.getTime() - b.getTime();
1674
2108
  }
1675
- export function sortDateNewestFirst(a, b) {
2109
+ function sortDateNewestFirst(a, b) {
1676
2110
  return b.getTime() - a.getTime();
1677
2111
  }
1678
- export function dateValuesMapToSortedKeysArray(map, newestFirst) {
2112
+ function dateValuesMapToSortedKeysArray(map, newestFirst) {
1679
2113
  const sortedKeys = [];
1680
2114
  const reversedMap = reverseMap(map);
1681
2115
  const sortedDates = toArray(map.values());
@@ -1685,31 +2119,31 @@ export function dateValuesMapToSortedKeysArray(map, newestFirst) {
1685
2119
  }
1686
2120
  return sortedKeys;
1687
2121
  }
1688
- export function getCount(iterable) {
2122
+ function getCount(iterable) {
1689
2123
  let count = 0;
1690
2124
  for (const item of iterable) {
1691
2125
  ++count;
1692
2126
  }
1693
2127
  return count;
1694
2128
  }
1695
- export function sumStringNumberObj(obj) {
2129
+ function sumStringNumberObj(obj) {
1696
2130
  let sum = 0;
1697
2131
  for (const [key, value] of Object.entries(obj)) {
1698
2132
  sum += value;
1699
2133
  }
1700
2134
  return sum;
1701
2135
  }
1702
- export function splitWords(input) {
2136
+ function splitWords(input) {
1703
2137
  return input.split(/[ \r\n]/).filter(word => word.length > 0);
1704
2138
  }
1705
- export function filterMap(map, filter) {
2139
+ function filterMap(map, filter) {
1706
2140
  for (const [key, value] of map.entries()) {
1707
2141
  if (!filter(key, value)) {
1708
2142
  map.delete(key);
1709
2143
  }
1710
2144
  }
1711
2145
  }
1712
- export function filterMapCopy(map, filter) {
2146
+ function filterMapCopy(map, filter) {
1713
2147
  const newMap = new Map();
1714
2148
  for (const [key, value] of map.entries()) {
1715
2149
  if (filter(key, value)) {
@@ -1718,14 +2152,14 @@ export function filterMapCopy(map, filter) {
1718
2152
  }
1719
2153
  return newMap;
1720
2154
  }
1721
- export function filterSet(set, filter) {
2155
+ function filterSet(set, filter) {
1722
2156
  for (const item of set) {
1723
2157
  if (!filter(item)) {
1724
2158
  set.delete(item);
1725
2159
  }
1726
2160
  }
1727
2161
  }
1728
- export function filterSetCopy(set, filter) {
2162
+ function filterSetCopy(set, filter) {
1729
2163
  const newSet = new Set();
1730
2164
  for (const item of set) {
1731
2165
  if (!filter(item)) {
@@ -1734,7 +2168,7 @@ export function filterSetCopy(set, filter) {
1734
2168
  }
1735
2169
  return newSet;
1736
2170
  }
1737
- export async function prismaDeleteIfExists(db, where) {
2171
+ async function prismaDeleteIfExists(db, where) {
1738
2172
  const item = await db.findFirst({ where });
1739
2173
  if (item == null) {
1740
2174
  return false;
@@ -1742,18 +2176,18 @@ export async function prismaDeleteIfExists(db, where) {
1742
2176
  await db.delete({ where });
1743
2177
  return true;
1744
2178
  }
1745
- export function getWeekSince1980() {
2179
+ function getWeekSince1980() {
1746
2180
  return Math.floor(millisecondsToWeeks(Date.now()));
1747
2181
  }
1748
- export function getDaySince1980() {
2182
+ function getDaySince1980() {
1749
2183
  return Math.floor(millisecondsToDays(Date.now()));
1750
2184
  }
1751
- export async function runCommand(command, as_user, options) {
2185
+ async function runCommand(command, as_user, options) {
1752
2186
  return new Promise((resolve, reject) => {
1753
2187
  if (as_user != null) {
1754
2188
  command = `sudo -u ${as_user} sh -c '${command}'`;
1755
2189
  }
1756
- exec(command, options, (error, stdout, stderr) => {
2190
+ (0, child_process_1.exec)(command, options, (error, stdout, stderr) => {
1757
2191
  if (error) {
1758
2192
  reject(stderr || error.message || error);
1759
2193
  }
@@ -1763,7 +2197,7 @@ export async function runCommand(command, as_user, options) {
1763
2197
  });
1764
2198
  });
1765
2199
  }
1766
- export async function runCommandRejectAsResolve(command, as_user, options) {
2200
+ async function runCommandRejectAsResolve(command, as_user, options) {
1767
2201
  try {
1768
2202
  return await runCommand(command, as_user, options);
1769
2203
  }
@@ -1771,10 +2205,10 @@ export async function runCommandRejectAsResolve(command, as_user, options) {
1771
2205
  return String(error);
1772
2206
  }
1773
2207
  }
1774
- export function sanitizeStringForFFMPEG(input) {
2208
+ function sanitizeStringForFFMPEG(input) {
1775
2209
  return input.replaceAll(/([$!"`])/g, "\\$1");
1776
2210
  }
1777
- export function getArtistsFromFlacMetadata(tags, aliases = MUSIC_ARTIST_ALIASES) {
2211
+ function getArtistsFromFlacMetadata(tags, aliases = classes_1.MUSIC_ARTIST_ALIASES) {
1778
2212
  const artists = new Set;
1779
2213
  if (tags.common != null) {
1780
2214
  if (tags.common.artists != null) {
@@ -1802,31 +2236,34 @@ export function getArtistsFromFlacMetadata(tags, aliases = MUSIC_ARTIST_ALIASES)
1802
2236
  }
1803
2237
  return artists;
1804
2238
  }
1805
- export function getTitleFromFlacMetadata(tags) {
1806
- return tags.common.title ?? "";
2239
+ function getTitleFromFlacMetadata(tags) {
2240
+ var _a;
2241
+ return (_a = tags.common.title) !== null && _a !== void 0 ? _a : "";
1807
2242
  }
1808
- export function getAlbumFromFlacMetadata(tags) {
1809
- return tags.common.album ?? "";
2243
+ function getAlbumFromFlacMetadata(tags) {
2244
+ var _a;
2245
+ return (_a = tags.common.album) !== null && _a !== void 0 ? _a : "";
1810
2246
  }
1811
- export function getAlbumArtistFromFlacMetadata(tags) {
1812
- return tags.common.albumartist ?? "";
2247
+ function getAlbumArtistFromFlacMetadata(tags) {
2248
+ var _a;
2249
+ return (_a = tags.common.albumartist) !== null && _a !== void 0 ? _a : "";
1813
2250
  }
1814
- export function getLyricsFromFlacVorbisTags(vorbisTags) {
1815
- let lyrics = vorbisTags[UNSYNCEDLYRICS_FLAC_ID];
2251
+ function getLyricsFromFlacVorbisTags(vorbisTags) {
2252
+ let lyrics = vorbisTags[fields_1.UNSYNCEDLYRICS_FLAC_ID];
1816
2253
  if (lyrics == null) {
1817
2254
  return "";
1818
2255
  }
1819
2256
  return lyrics.trim();
1820
2257
  }
1821
- export function generateHash(seed) {
1822
- const hash = createHash('sha256');
2258
+ function generateHash(seed) {
2259
+ const hash = (0, crypto_1.createHash)('sha256');
1823
2260
  hash.update(seed);
1824
2261
  return hash.digest('hex');
1825
2262
  }
1826
- export function extensionHasAudio(extension) {
1827
- return AUDIO_CONTAINING_EXTENSION_TYPES.has(extension);
2263
+ function extensionHasAudio(extension) {
2264
+ return fields_1.AUDIO_CONTAINING_EXTENSION_TYPES.has(extension);
1828
2265
  }
1829
- export function songTitleExtractSide(input, doSides, side) {
2266
+ function songTitleExtractSide(input, doSides, side) {
1830
2267
  let output = input;
1831
2268
  if (doSides) {
1832
2269
  const indexOfDash = output.lastIndexOf(" - ");
@@ -1845,12 +2282,12 @@ export function songTitleExtractSide(input, doSides, side) {
1845
2282
  output = output.trim();
1846
2283
  return output;
1847
2284
  }
1848
- export function sanitizeStringForSeed(input) {
2285
+ function sanitizeStringForSeed(input) {
1849
2286
  let output = input.toLowerCase();
1850
- for (const [name, regex] of BEFORE_SIDES_SANITIZE_REGEXES) {
2287
+ for (const [name, regex] of fields_1.BEFORE_SIDES_SANITIZE_REGEXES) {
1851
2288
  output = output.replaceAll(regex, "");
1852
2289
  }
1853
- for (const [name, regex] of AFTER_SIDES_SANITIZE_REGEXES) {
2290
+ for (const [name, regex] of fields_1.AFTER_SIDES_SANITIZE_REGEXES) {
1854
2291
  output = output.replaceAll(regex, "");
1855
2292
  }
1856
2293
  while (output.includes(" ")) {
@@ -1859,52 +2296,52 @@ export function sanitizeStringForSeed(input) {
1859
2296
  output = output.trim();
1860
2297
  return output;
1861
2298
  }
1862
- export function addAllSetToSet(input, outputSet) {
2299
+ function addAllSetToSet(input, outputSet) {
1863
2300
  for (const item of input) {
1864
2301
  outputSet.add(item);
1865
2302
  }
1866
2303
  return outputSet;
1867
2304
  }
1868
- export function addAllArrayToSet(input, outputSet) {
2305
+ function addAllArrayToSet(input, outputSet) {
1869
2306
  for (const item of input) {
1870
2307
  outputSet.add(item);
1871
2308
  }
1872
2309
  return outputSet;
1873
2310
  }
1874
- export function addAllSetToArray(input, outputArray) {
2311
+ function addAllSetToArray(input, outputArray) {
1875
2312
  for (const item of input) {
1876
2313
  outputArray.push(item);
1877
2314
  }
1878
2315
  return outputArray;
1879
2316
  }
1880
- export function addAllArrayToArray(input, outputArray) {
2317
+ function addAllArrayToArray(input, outputArray) {
1881
2318
  for (const item of input) {
1882
2319
  outputArray.push(item);
1883
2320
  }
1884
2321
  return outputArray;
1885
2322
  }
1886
- export function addAllArrayToMap(items, map, keyGetter) {
2323
+ function addAllArrayToMap(items, map, keyGetter) {
1887
2324
  for (const item of items) {
1888
2325
  map.set(keyGetter(item), item);
1889
2326
  }
1890
2327
  }
1891
- export function addSetArrayToMap(items, map, keyGetter) {
2328
+ function addSetArrayToMap(items, map, keyGetter) {
1892
2329
  for (const item of items) {
1893
2330
  map.set(keyGetter(item), item);
1894
2331
  }
1895
2332
  }
1896
- export function replaceAllArray(input, replaceInputs, replaceWith) {
2333
+ function replaceAllArray(input, replaceInputs, replaceWith) {
1897
2334
  let output = input;
1898
2335
  for (const replaceInput of replaceInputs) {
1899
2336
  output = output.replaceAll(replaceInput, replaceWith);
1900
2337
  }
1901
2338
  return output;
1902
2339
  }
1903
- export function librarySplitMultipleArtists(input, aliases = MUSIC_ARTIST_ALIASES) {
2340
+ function librarySplitMultipleArtists(input, aliases = classes_1.MUSIC_ARTIST_ALIASES) {
1904
2341
  const inputs = input.split(/(?:[,+;]|\W(?:[&x]|and|with|fixes|befriends|vs\.?)\W|\/)/gi);
1905
2342
  return inputs.map(artist => {
1906
2343
  artist = aliases.get(singleSpacesOnly(artist.replaceAll("​", " ").replaceAll(" - Topic", ""))).trim();
1907
- const parenthesisFeatMatch = artist.match(FEAT_WITH_PARENTHESIS_REGEX);
2344
+ const parenthesisFeatMatch = artist.match(fields_1.FEAT_WITH_PARENTHESIS_REGEX);
1908
2345
  if (parenthesisFeatMatch != null) {
1909
2346
  artist = artist.slice(0, parenthesisFeatMatch.index).trim();
1910
2347
  }
@@ -1917,9 +2354,9 @@ export function librarySplitMultipleArtists(input, aliases = MUSIC_ARTIST_ALIASE
1917
2354
  return singleSpacesOnly(artist);
1918
2355
  }).filter(artist => artist.length > 0);
1919
2356
  }
1920
- export function libraryFindFeaturing(originalInput, aliases = MUSIC_ARTIST_ALIASES) {
2357
+ function libraryFindFeaturing(originalInput, aliases = classes_1.MUSIC_ARTIST_ALIASES) {
1921
2358
  let input = originalInput;
1922
- const featMatch = input.match(FEAT_WITH_PARENTHESIS_REGEX);
2359
+ const featMatch = input.match(fields_1.FEAT_WITH_PARENTHESIS_REGEX);
1923
2360
  if (featMatch == null) {
1924
2361
  return { newName: input, artists: [] };
1925
2362
  }
@@ -1943,7 +2380,7 @@ export function libraryFindFeaturing(originalInput, aliases = MUSIC_ARTIST_ALIAS
1943
2380
  artists: featuring
1944
2381
  };
1945
2382
  }
1946
- export function libraryCleanUpStartAndEndOfString(input) {
2383
+ function libraryCleanUpStartAndEndOfString(input) {
1947
2384
  input = input.trim();
1948
2385
  if (input.length == 0) {
1949
2386
  return input;
@@ -1966,7 +2403,7 @@ export function libraryCleanUpStartAndEndOfString(input) {
1966
2403
  }
1967
2404
  return singleSpacesOnly(input).trim();
1968
2405
  }
1969
- export function generateWeightedItemsGridString(width, height, symbols, totalWeight) {
2406
+ function generateWeightedItemsGridString(width, height, symbols, totalWeight) {
1970
2407
  let grid = '';
1971
2408
  let lastItem = '';
1972
2409
  for (let y = 0; y < height; ++y) {
@@ -1988,7 +2425,7 @@ export function generateWeightedItemsGridString(width, height, symbols, totalWei
1988
2425
  }
1989
2426
  return grid;
1990
2427
  }
1991
- export async function promptYesOrNo(actionName = "Proceed?") {
2428
+ async function promptYesOrNo(actionName = "Proceed?") {
1992
2429
  return new Promise(resolve => {
1993
2430
  process.stdout.write(`${actionName} [y/n]: `);
1994
2431
  process.stdin.setRawMode(true);
@@ -2012,27 +2449,28 @@ export async function promptYesOrNo(actionName = "Proceed?") {
2012
2449
  process.stdin.on('data', onKeyPress);
2013
2450
  });
2014
2451
  }
2015
- export async function musicFileInfoToM3uEntry(fileInfo) {
2016
- const titleAndArtists = await TitleAndArtists.fromFileInfo(fileInfo);
2017
- const tags = await musicMetadata.parseFile(fileInfo.path, { skipCovers: true });
2452
+ async function musicFileInfoToM3uEntry(fileInfo) {
2453
+ var _a;
2454
+ const titleAndArtists = await classes_1.TitleAndArtists.fromFileInfo(fileInfo);
2455
+ const tags = await util_1.musicMetadata.parseFile(fileInfo.path, { skipCovers: true });
2018
2456
  const formatTags = tags.format;
2019
- const durationS = formatTags.duration ?? -1;
2457
+ const durationS = (_a = formatTags.duration) !== null && _a !== void 0 ? _a : -1;
2020
2458
  return toM3uEntry(fileInfo.path, titleAndArtists.artistsDashTitle, durationS);
2021
2459
  }
2022
- export function toM3uEntry(path, title = "", durationS = -1) {
2023
- const safeTitle = title.trim().length == 0 ? basename(path) : title;
2460
+ function toM3uEntry(path, title = "", durationS = -1) {
2461
+ const safeTitle = title.trim().length == 0 ? (0, path_1.basename)(path) : title;
2024
2462
  return `#EXTINF:${Math.floor(durationS)},${safeTitle}\n${path}`;
2025
2463
  }
2026
- export function getStepString(step, totalSteps = -1) {
2464
+ function getStepString(step, totalSteps = -1) {
2027
2465
  if (totalSteps > 0) {
2028
2466
  return `Step ${step}/${totalSteps}:`;
2029
2467
  }
2030
2468
  return `Step ${step}:`;
2031
2469
  }
2032
- export function sliceOffLastSlash(path, times = 1) {
2033
- return sliceOffLast(path, SEP, times);
2470
+ function sliceOffLastSlash(path, times = 1) {
2471
+ return sliceOffLast(path, fields_1.SEP, times);
2034
2472
  }
2035
- export function sliceOffLast(path, lastMatch, times = 1) {
2473
+ function sliceOffLast(path, lastMatch, times = 1) {
2036
2474
  do {
2037
2475
  const lastSlashIndex = path.lastIndexOf(lastMatch);
2038
2476
  if (lastSlashIndex == -1) {
@@ -2042,7 +2480,7 @@ export function sliceOffLast(path, lastMatch, times = 1) {
2042
2480
  } while (--times > 0);
2043
2481
  return path;
2044
2482
  }
2045
- export function sliceOffUntil(text, lastMatch) {
2483
+ function sliceOffUntil(text, lastMatch) {
2046
2484
  const lastSlashIndex = text.lastIndexOf(lastMatch);
2047
2485
  if (lastSlashIndex == -1) {
2048
2486
  return text;
@@ -2062,7 +2500,7 @@ function sliceOffNonProject(path) {
2062
2500
  }
2063
2501
  return path.substring(lastSlashIndex + 1);
2064
2502
  }
2065
- export function countOccurances(path, match) {
2503
+ function countOccurances(path, match) {
2066
2504
  let count = 0;
2067
2505
  let index = path.indexOf(match);
2068
2506
  while (index != -1) {
@@ -2071,21 +2509,21 @@ export function countOccurances(path, match) {
2071
2509
  }
2072
2510
  return count;
2073
2511
  }
2074
- export function countPathDepth(path) {
2512
+ function countPathDepth(path) {
2075
2513
  return countOccurances(path, "/");
2076
2514
  }
2077
- export function getPathEscapeString(depth) {
2515
+ function getPathEscapeString(depth) {
2078
2516
  let pathEscapeString = "";
2079
2517
  for (let i = 0; i < depth; ++i) {
2080
2518
  pathEscapeString += "../";
2081
2519
  }
2082
2520
  return pathEscapeString;
2083
2521
  }
2084
- export function getFullPathEscapeString(path) {
2522
+ function getFullPathEscapeString(path) {
2085
2523
  const depth = countPathDepth(path);
2086
2524
  return getPathEscapeString(depth);
2087
2525
  }
2088
- export function jsonLookupToMap(json) {
2526
+ function jsonLookupToMap(json) {
2089
2527
  const map = new Map();
2090
2528
  for (const [key, value] of Object.entries(json)) {
2091
2529
  const numberKey = parseInt(key);
@@ -2097,19 +2535,19 @@ export function jsonLookupToMap(json) {
2097
2535
  }
2098
2536
  return map;
2099
2537
  }
2100
- export function extractElementFromJsonAndRemove(obj, key) {
2538
+ function extractElementFromJsonAndRemove(obj, key) {
2101
2539
  const element = obj[key];
2102
2540
  delete obj[key];
2103
2541
  return element;
2104
2542
  }
2105
- export function extractLookupFromJsonAndRemove(obj) {
2543
+ function extractLookupFromJsonAndRemove(obj) {
2106
2544
  const keys = jsonLookupToMap(extractElementFromJsonAndRemove(obj, "lookup"));
2107
2545
  return keys;
2108
2546
  }
2109
- export function forEachValueAndPathOfObj(obj, callback, lookup = new Map) {
2547
+ function forEachValueAndPathOfObj(obj, callback, lookup = new Map) {
2110
2548
  return forEachLookUpValueAndPathOfObjRecursive(lookup, obj, callback);
2111
2549
  }
2112
- export function forEachLookUpValueAndPathOfObjRecursive(lookup, obj, callback, inputPath = "") {
2550
+ function forEachLookUpValueAndPathOfObjRecursive(lookup, obj, callback, inputPath = "") {
2113
2551
  for (const [key, value] of Object.entries(obj)) {
2114
2552
  const path = inputPath.length == 0 ? key : `${inputPath}/${key}`;
2115
2553
  if (Array.isArray(value)) {
@@ -2125,48 +2563,48 @@ export function forEachLookUpValueAndPathOfObjRecursive(lookup, obj, callback, i
2125
2563
  }
2126
2564
  }
2127
2565
  }
2128
- export async function findGeniusSongs(search) {
2129
- const songs = await geniusClient.songs.search(search);
2566
+ async function findGeniusSongs(search) {
2567
+ const songs = await exports.geniusClient.songs.search(search);
2130
2568
  return songs;
2131
2569
  }
2132
- export function trimToCharNumbersOnly(input) {
2133
- return trim(input, NON_NUMBER_OR_CHAR_REGEX);
2570
+ function trimToCharNumbersOnly(input) {
2571
+ return trim(input, fields_1.NON_NUMBER_OR_CHAR_REGEX);
2134
2572
  }
2135
- export function trimStartToCharNumbersOnly(input) {
2136
- return trimStart(input, NON_NUMBER_OR_CHAR_REGEX);
2573
+ function trimStartToCharNumbersOnly(input) {
2574
+ return trimStart(input, fields_1.NON_NUMBER_OR_CHAR_REGEX);
2137
2575
  }
2138
- export function trimEndToCharNumbersOnly(input) {
2139
- return trimEnd(input, NON_NUMBER_OR_CHAR_REGEX);
2576
+ function trimEndToCharNumbersOnly(input) {
2577
+ return trimEnd(input, fields_1.NON_NUMBER_OR_CHAR_REGEX);
2140
2578
  }
2141
- export function trim(input, regex = TRIM_REGEX) {
2579
+ function trim(input, regex = fields_1.TRIM_REGEX) {
2142
2580
  return trimStart(trimEnd(input, regex), regex);
2143
2581
  }
2144
- export function trimStart(input, regex) {
2582
+ function trimStart(input, regex) {
2145
2583
  let startIndex = 0;
2146
2584
  while (startIndex < input.length && regex.test(input[startIndex])) {
2147
2585
  ++startIndex;
2148
2586
  }
2149
2587
  return input.slice(startIndex, input.length);
2150
2588
  }
2151
- export function trimEnd(input, regex) {
2589
+ function trimEnd(input, regex) {
2152
2590
  let endIndex = input.length - 1;
2153
2591
  while (endIndex >= 0 && regex.test(input[endIndex])) {
2154
2592
  --endIndex;
2155
2593
  }
2156
2594
  return input.slice(0, endIndex + 1);
2157
2595
  }
2158
- export async function findGeniusLyrics(query, artistsToMatch = []) {
2596
+ async function findGeniusLyrics(query, artistsToMatch = []) {
2159
2597
  const geniusSongs = await findGeniusSongs(query);
2160
2598
  for (const geniusSong of geniusSongs) {
2161
2599
  const geniusArtistsDashTitle = `${geniusSong.artist.name} - ${geniusSong.title}`;
2162
- const geniusSongArtist = MUSIC_ARTIST_ALIASES.get(geniusSong.artist.name);
2600
+ const geniusSongArtist = classes_1.MUSIC_ARTIST_ALIASES.get(geniusSong.artist.name);
2163
2601
  let correctArtist = false;
2164
2602
  if (artistsToMatch.length == 0) {
2165
2603
  correctArtist = true;
2166
2604
  }
2167
2605
  else {
2168
2606
  for (const artist of artistsToMatch) {
2169
- if (geniusSongArtist === MUSIC_ARTIST_ALIASES.get(artist)) {
2607
+ if (geniusSongArtist === classes_1.MUSIC_ARTIST_ALIASES.get(artist)) {
2170
2608
  correctArtist = true;
2171
2609
  break;
2172
2610
  }
@@ -2174,16 +2612,16 @@ export async function findGeniusLyrics(query, artistsToMatch = []) {
2174
2612
  }
2175
2613
  if (correctArtist) {
2176
2614
  try {
2177
- const geniusLyrics = (await geniusSong.lyrics()).replaceAll(CONTRIBUTORS_REGEX, "");
2615
+ const geniusLyrics = (await geniusSong.lyrics()).replaceAll(fields_1.CONTRIBUTORS_REGEX, "");
2178
2616
  return geniusLyrics;
2179
2617
  }
2180
2618
  catch (err) {
2181
- console.log(chalk.redBright(`Error getting Genius lyrics for ${geniusArtistsDashTitle}:\n${err}`));
2619
+ console.log(exports.chalk.redBright(`Error getting Genius lyrics for ${geniusArtistsDashTitle}:\n${err}`));
2182
2620
  }
2183
2621
  }
2184
2622
  }
2185
2623
  }
2186
- export function softSliceFrom(input, sliceFrom, anyCase = true, fromElseTo = true) {
2624
+ function softSliceFrom(input, sliceFrom, anyCase = true, fromElseTo = true) {
2187
2625
  const regex = new RegExp(`(${sliceFrom})`, `${anyCase ? "i" : ""}`);
2188
2626
  const match = input.match(regex);
2189
2627
  if (match != null) {
@@ -2197,10 +2635,10 @@ export function softSliceFrom(input, sliceFrom, anyCase = true, fromElseTo = tru
2197
2635
  }
2198
2636
  return input.trim();
2199
2637
  }
2200
- export function trimFirstLinesWhileIncludes(input, blacklistLineTerm) {
2638
+ function trimFirstLinesWhileIncludes(input, blacklistLineTerm) {
2201
2639
  input = input.trim();
2202
2640
  do {
2203
- const nextLineMatch = input.match(NEW_LINE_REGEX);
2641
+ const nextLineMatch = input.match(fields_1.NEW_LINE_REGEX);
2204
2642
  if (nextLineMatch == null) {
2205
2643
  break;
2206
2644
  }
@@ -2215,8 +2653,8 @@ export function trimFirstLinesWhileIncludes(input, blacklistLineTerm) {
2215
2653
  } while (true);
2216
2654
  return input;
2217
2655
  }
2218
- export function getFirstLine(input) {
2219
- const nextLineMatch = input.match(NEW_LINE_REGEX);
2656
+ function getFirstLine(input) {
2657
+ const nextLineMatch = input.match(fields_1.NEW_LINE_REGEX);
2220
2658
  if (nextLineMatch == null) {
2221
2659
  return undefined;
2222
2660
  }
@@ -2224,19 +2662,19 @@ export function getFirstLine(input) {
2224
2662
  const firstLine = input.slice(0, nextLineIndex);
2225
2663
  return firstLine;
2226
2664
  }
2227
- export function skyify(input) {
2228
- return input.replaceAll(/[^\n\r ]/g, (_) => getRandomWeighedItem(NIGHT_SKY_ITEMS, NIGHT_SKY_ITEMS_TOTAL_WEIGHT)).slice(0, DISCORD_MESSAGE_LENGTH_LIMIT);
2665
+ function skyify(input) {
2666
+ return input.replaceAll(/[^\n\r ]/g, (_) => getRandomWeighedItem(fields_1.NIGHT_SKY_ITEMS, fields_1.NIGHT_SKY_ITEMS_TOTAL_WEIGHT)).slice(0, fields_1.DISCORD_MESSAGE_LENGTH_LIMIT);
2229
2667
  }
2230
- export function dateToFilename(date) {
2668
+ function dateToFilename(date) {
2231
2669
  const year = date.getFullYear();
2232
2670
  const month = String(date.getMonth() + 1).padStart(2, '0');
2233
2671
  const day = String(date.getDate()).padStart(2, '0');
2234
2672
  return `${year}-${month}-${day}_${date.getHours()}-${date.getMinutes()}-${date.getSeconds()}`;
2235
2673
  }
2236
- export function makeMap(preparer) {
2674
+ function makeMap(preparer) {
2237
2675
  return make(new Map, preparer);
2238
2676
  }
2239
- export function makeWeightedMap(input) {
2677
+ function makeWeightedMap(input) {
2240
2678
  if (input instanceof Array) {
2241
2679
  return makeWeightedMap(map => {
2242
2680
  for (const item of input) {
@@ -2244,9 +2682,9 @@ export function makeWeightedMap(input) {
2244
2682
  }
2245
2683
  });
2246
2684
  }
2247
- return make(new WeightedMap, input);
2685
+ return make(new classes_1.WeightedMap, input);
2248
2686
  }
2249
- export function makeWeightedTextCompMap(input) {
2687
+ function makeWeightedTextCompMap(input) {
2250
2688
  if (input instanceof Array) {
2251
2689
  return makeWeightedTextCompMap(map => {
2252
2690
  for (const item of input) {
@@ -2254,9 +2692,9 @@ export function makeWeightedTextCompMap(input) {
2254
2692
  }
2255
2693
  });
2256
2694
  }
2257
- return make(new WeightedMap, input);
2695
+ return make(new classes_1.WeightedMap, input);
2258
2696
  }
2259
- export function generateLinesUntilCharacterLimit(generator, amount = 1, limit = DISCORD_MESSAGE_LENGTH_LIMIT) {
2697
+ function generateLinesUntilCharacterLimit(generator, amount = 1, limit = fields_1.DISCORD_MESSAGE_LENGTH_LIMIT) {
2260
2698
  let output = "";
2261
2699
  for (let i = 0; i < amount; ++i) {
2262
2700
  const nextLine = generator();
@@ -2267,18 +2705,18 @@ export function generateLinesUntilCharacterLimit(generator, amount = 1, limit =
2267
2705
  }
2268
2706
  return output;
2269
2707
  }
2270
- export function lastIndexOfSeparator(path) {
2708
+ function lastIndexOfSeparator(path) {
2271
2709
  return Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
2272
2710
  }
2273
- export function timestamp() {
2711
+ function timestamp() {
2274
2712
  const now = new Date();
2275
2713
  return `[${padLeft(now.getHours().toString(), 2, "0")}:${padLeft(now.getMinutes().toString(), 2, "0")}:${padLeft(now.getSeconds().toString(), 2, "0")}]`;
2276
2714
  }
2277
- export function timestampWithMs() {
2715
+ function timestampWithMs() {
2278
2716
  const now = new Date();
2279
2717
  return `${timestamp().slice(0, -1)}.${padLeft(now.getMilliseconds().toString(), 3, "0")}]`;
2280
2718
  }
2281
- export function isSilent(buffer) {
2719
+ function isSilent(buffer) {
2282
2720
  var speechSample;
2283
2721
  for (var i = 0; i < buffer.length; i = i + 2) {
2284
2722
  if (buffer[i + 1] > 128) {
@@ -2294,16 +2732,16 @@ export function isSilent(buffer) {
2294
2732
  }
2295
2733
  return true;
2296
2734
  }
2297
- export async function waitMs(ms) {
2735
+ async function waitMs(ms) {
2298
2736
  return new Promise(resolve => setTimeout(resolve, ms));
2299
2737
  }
2300
- export async function waitS(s) {
2738
+ async function waitS(s) {
2301
2739
  return new Promise(resolve => setTimeout(resolve, s * 1000));
2302
2740
  }
2303
- export async function whileFalseAsyncS(intervalS, stopIfTrue) {
2741
+ async function whileFalseAsyncS(intervalS, stopIfTrue) {
2304
2742
  return whileFalseAsyncMs(intervalS * 1000, stopIfTrue);
2305
2743
  }
2306
- export async function whileFalseAsyncMs(intervalMs, stopIfTrue) {
2744
+ async function whileFalseAsyncMs(intervalMs, stopIfTrue) {
2307
2745
  return new Promise(async (resolve, reject) => {
2308
2746
  let task = null;
2309
2747
  task = setInterval(() => {
@@ -2314,10 +2752,10 @@ export async function whileFalseAsyncMs(intervalMs, stopIfTrue) {
2314
2752
  }, intervalMs);
2315
2753
  });
2316
2754
  }
2317
- export async function repeatForAsyncS(durationS, intervalS, stopIfTrue) {
2755
+ async function repeatForAsyncS(durationS, intervalS, stopIfTrue) {
2318
2756
  return repeatForAsyncMs(durationS * 1000, intervalS * 1000, stopIfTrue);
2319
2757
  }
2320
- export async function repeatForAsyncMs(durationMs, intervalMs, stopIfTrue) {
2758
+ async function repeatForAsyncMs(durationMs, intervalMs, stopIfTrue) {
2321
2759
  const endTime = Date.now() + durationMs;
2322
2760
  return whileFalseAsyncMs(intervalMs, () => {
2323
2761
  if (Date.now() <= endTime || stopIfTrue()) {
@@ -2338,7 +2776,7 @@ export async function repeatForAsyncMs(durationMs, intervalMs, stopIfTrue) {
2338
2776
  // }
2339
2777
  // }
2340
2778
  let lastSetTerminalLine = "";
2341
- export function replaceLastTerminalLine(text) {
2779
+ function replaceLastTerminalLine(text) {
2342
2780
  try {
2343
2781
  process.stdout.clearLine(0);
2344
2782
  process.stdout.cursorTo(0);
@@ -2352,7 +2790,7 @@ export function replaceLastTerminalLine(text) {
2352
2790
  }
2353
2791
  }
2354
2792
  let lastTerminalOutputLines = 0;
2355
- export function setTerminalOutput(text, newSession = false) {
2793
+ function setTerminalOutput(text, newSession = false) {
2356
2794
  try {
2357
2795
  clearTerminalLines(lastTerminalOutputLines);
2358
2796
  if (newSession) {
@@ -2366,11 +2804,11 @@ export function setTerminalOutput(text, newSession = false) {
2366
2804
  print(`Tried to set terminal output, but failed.\n${getStackTrace()}\n${e}`);
2367
2805
  }
2368
2806
  }
2369
- export function clearSetTerminalOutput() {
2807
+ function clearSetTerminalOutput() {
2370
2808
  clearTerminalLines(lastTerminalOutputLines);
2371
2809
  lastTerminalOutputLines = 0;
2372
2810
  }
2373
- export function clearTerminalLines(amount) {
2811
+ function clearTerminalLines(amount) {
2374
2812
  try {
2375
2813
  process.stdout.write('\x1b[0G'); // Move to start of line
2376
2814
  for (let i = 0; i < amount + 1; i++) {
@@ -2384,22 +2822,22 @@ export function clearTerminalLines(amount) {
2384
2822
  print(`Tried to clear terminal lines, but failed.\n${getStackTrace()}\n${e}`);
2385
2823
  }
2386
2824
  }
2387
- export function sIfNot1(count) {
2825
+ function sIfNot1(count) {
2388
2826
  return count == 1 ? "" : "s";
2389
2827
  }
2390
- export function if1Else(count, if1, or) {
2828
+ function if1Else(count, if1, or) {
2391
2829
  return count == 1 ? if1 : or;
2392
2830
  }
2393
- export function makePath(...paths) {
2394
- return paths.join(path.sep).replaceAll(/[/\\]/g, path.sep);
2831
+ function makePath(...paths) {
2832
+ return paths.join(path_1.default.sep).replaceAll(/[/\\]/g, path_1.default.sep);
2395
2833
  }
2396
- export function makeUnixPath(...paths) {
2834
+ function makeUnixPath(...paths) {
2397
2835
  return paths.join("/").replaceAll("\\", "/");
2398
2836
  }
2399
- export function makeWindowsPath(...paths) {
2837
+ function makeWindowsPath(...paths) {
2400
2838
  return paths.join("\\").replaceAll("/", "\\");
2401
2839
  }
2402
- export function overflow(value, min, max) {
2840
+ function overflow(value, min, max) {
2403
2841
  if (value < min) {
2404
2842
  const gap = max - min + 1;
2405
2843
  const minGap = min - value - 1;
@@ -2412,14 +2850,14 @@ export function overflow(value, min, max) {
2412
2850
  }
2413
2851
  return value;
2414
2852
  }
2415
- export function overflow0(value, max) {
2853
+ function overflow0(value, max) {
2416
2854
  return overflow(value, 0, max);
2417
2855
  }
2418
- export function isWithin(value, min, max) {
2856
+ function isWithin(value, min, max) {
2419
2857
  return min <= value && value <= max;
2420
2858
  }
2421
2859
  //region Menu
2422
- export async function startShiftItemsMenu(items, itemValueMap, values, selectedIndex = 0, rainbow = true, itemToString = objectToString, valueToString = objectToString) {
2860
+ async function startShiftItemsMenu(items, itemValueMap, values, selectedIndex = 0, rainbow = true, itemToString = objectToString, valueToString = objectToString) {
2423
2861
  if (values.length === 0) {
2424
2862
  throw new Error("startShiftItemsMenu: No values to select from!");
2425
2863
  }
@@ -2442,10 +2880,10 @@ export async function startShiftItemsMenu(items, itemValueMap, values, selectedI
2442
2880
  update();
2443
2881
  }, rainbow, itemToString, valueToString);
2444
2882
  }
2445
- export function getRelativeOverflow(startIndex, values, moveBy) {
2883
+ function getRelativeOverflow(startIndex, values, moveBy) {
2446
2884
  return values[overflow0(startIndex + moveBy, values.length - 1)];
2447
2885
  }
2448
- export function shiftMenuItemsFunction(valueIndex, values, value, info) {
2886
+ function shiftMenuItemsFunction(valueIndex, values, value, info) {
2449
2887
  if (valueIndex === -1) {
2450
2888
  valueIndex = clamp0(values.indexOf(value), values.length - 1);
2451
2889
  }
@@ -2456,7 +2894,7 @@ export function shiftMenuItemsFunction(valueIndex, values, value, info) {
2456
2894
  index: valueIndex
2457
2895
  };
2458
2896
  }
2459
- export async function startNumbersEditMenu(items, itemValueMap, selectedIndex = 0, rainbow = true, itemToString = objectToString, valueToString = objectToString) {
2897
+ async function startNumbersEditMenu(items, itemValueMap, selectedIndex = 0, rainbow = true, itemToString = objectToString, valueToString = objectToString) {
2460
2898
  getOrCreateFromKeys(itemValueMap, items, () => 0);
2461
2899
  return startMenu(items, itemValueMap, selectedIndex, (selectedIndex, info, update, setSelectedIndex) => {
2462
2900
  switch (info.name) {
@@ -2484,14 +2922,14 @@ export async function startNumbersEditMenu(items, itemValueMap, selectedIndex =
2484
2922
  }
2485
2923
  }, rainbow, itemToString, valueToString);
2486
2924
  }
2487
- export async function startMenu(items, itemValueMap, selectedIndex = 0, onKeyPress, rainbow = true, itemToString = objectToString, valueToString = objectToString) {
2925
+ async function startMenu(items, itemValueMap, selectedIndex = 0, onKeyPress, rainbow = true, itemToString = objectToString, valueToString = objectToString) {
2488
2926
  selectedIndex = clamp0(selectedIndex, items.length - 1);
2489
2927
  return new Promise((resolve, reject) => {
2490
2928
  if (items.length === 0) {
2491
2929
  reject('startMenu: No items to select from!');
2492
2930
  return;
2493
2931
  }
2494
- const itemsRange = RangedNumber.range(0, items.length - 1);
2932
+ const itemsRange = structs_1.RangedNumber.range(0, items.length - 1);
2495
2933
  let item;
2496
2934
  const update = () => {
2497
2935
  item = items[selectedIndex];
@@ -2534,7 +2972,7 @@ export async function startMenu(items, itemValueMap, selectedIndex = 0, onKeyPre
2534
2972
  });
2535
2973
  });
2536
2974
  }
2537
- export function navigationKeysToNumber(info) {
2975
+ function navigationKeysToNumber(info) {
2538
2976
  const key = info.name.toLowerCase();
2539
2977
  switch (key) {
2540
2978
  case 'up':
@@ -2558,7 +2996,7 @@ export function navigationKeysToNumber(info) {
2558
2996
  }
2559
2997
  return 0;
2560
2998
  }
2561
- export function editNumberByInput(value, key, overflowLimits, control = false, shift = false, meta = false) {
2999
+ function editNumberByInput(value, key, overflowLimits, control = false, shift = false, meta = false) {
2562
3000
  switch (key.toLowerCase()) {
2563
3001
  case 'up':
2564
3002
  case 'down':
@@ -2593,7 +3031,7 @@ export function editNumberByInput(value, key, overflowLimits, control = false, s
2593
3031
  return value;
2594
3032
  }
2595
3033
  const objectToString = (obj) => obj.toString();
2596
- export function toMenuString(items, itemValueMap, selectedIndex = 0, rainbow = true, itemToString = objectToString, valueToString = objectToString) {
3034
+ function toMenuString(items, itemValueMap, selectedIndex = 0, rainbow = true, itemToString = objectToString, valueToString = objectToString) {
2597
3035
  let output = '';
2598
3036
  let longest = 0;
2599
3037
  for (const [item, value] of itemValueMap) {
@@ -2605,11 +3043,11 @@ export function toMenuString(items, itemValueMap, selectedIndex = 0, rainbow = t
2605
3043
  let itemIndex = 0;
2606
3044
  for (const [item, value] of itemValueMap) {
2607
3045
  const selected = itemIndex === selectedIndex;
2608
- const prefix = selected ? '>' : EMPTY;
3046
+ const prefix = selected ? '>' : fields_1.EMPTY;
2609
3047
  const valueText = valueToString(value);
2610
- let itemText = `${prefix}${`[${padRight(valueText, longest, EMPTY)}]`} | ${itemToString(item)}`;
3048
+ let itemText = `${prefix}${`[${padRight(valueText, longest, fields_1.EMPTY)}]`} | ${itemToString(item)}`;
2611
3049
  if (selected) {
2612
- itemText = chalk.bold(itemText);
3050
+ itemText = exports.chalk.bold(itemText);
2613
3051
  }
2614
3052
  if (rainbow) {
2615
3053
  itemText = chalkRainbowColor(itemText, itemIndex);
@@ -2620,29 +3058,31 @@ export function toMenuString(items, itemValueMap, selectedIndex = 0, rainbow = t
2620
3058
  return output.trim();
2621
3059
  }
2622
3060
  //endregion Menu
2623
- export function toPrintString(fileName, functionName, lineNumber) {
2624
- return `${timestamp()} ${chalk.cyanBright(sliceOffNonProject(fileName))}:${chalk.greenBright(lineNumber)}${functionName ? ` | ${chalk.magentaBright(functionName)}` : ""}`;
3061
+ function toPrintString(fileName, functionName, lineNumber) {
3062
+ return `${timestamp()} ${exports.chalk.cyanBright(sliceOffNonProject(fileName))}:${exports.chalk.greenBright(lineNumber)}${functionName ? ` | ${exports.chalk.magentaBright(functionName)}` : ""}`;
2625
3063
  }
2626
3064
  let rainbowIndex = 0;
2627
- export function getStackTrace() {
3065
+ function getStackTrace() {
2628
3066
  return new Error().stack;
2629
3067
  }
2630
- export function getStackTraceLine(depth) {
2631
- return new Error().stack?.split('\n')[depth]?.trim();
3068
+ function getStackTraceLine(depth) {
3069
+ var _a, _b;
3070
+ return (_b = (_a = new Error().stack) === null || _a === void 0 ? void 0 : _a.split('\n')[depth]) === null || _b === void 0 ? void 0 : _b.trim();
2632
3071
  }
2633
- export function getCallerErrorLine() {
3072
+ function getCallerErrorLine() {
2634
3073
  return getStackTraceLine(4);
2635
3074
  }
2636
- export function isCallerTs() {
2637
- return getCallerErrorLine()?.toLowerCase().includes(".ts:") ?? false;
3075
+ function isCallerTs() {
3076
+ var _a, _b;
3077
+ return (_b = (_a = getCallerErrorLine()) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(".ts:")) !== null && _b !== void 0 ? _b : false;
2638
3078
  }
2639
- export function printError(message) {
2640
- print(chalk.redBright(`ERROR${message ? `: ${message}` : undefined}`), false);
3079
+ function printError(message) {
3080
+ print(exports.chalk.redBright(`ERROR${message ? `: ${message}` : undefined}`), false);
2641
3081
  }
2642
- export function printWarn(message) {
2643
- print(chalk.yellowBright(`WARN${message ? `: ${message}` : undefined}`), false);
3082
+ function printWarn(message) {
3083
+ print(exports.chalk.yellowBright(`WARN${message ? `: ${message}` : undefined}`), false);
2644
3084
  }
2645
- export function print(message, rainbow = false) {
3085
+ function print(message, rainbow = false) {
2646
3086
  message = message ? `: ${message}` : "";
2647
3087
  const stack = new Error().stack;
2648
3088
  if (stack) {
@@ -2672,7 +3112,7 @@ export function print(message, rainbow = false) {
2672
3112
  }
2673
3113
  }
2674
3114
  }
2675
- export function softToFixed(num, maxDecimals = 2) {
3115
+ function softToFixed(num, maxDecimals = 2) {
2676
3116
  if (!isFinite(num)) {
2677
3117
  return String(num);
2678
3118
  }
@@ -2680,41 +3120,41 @@ export function softToFixed(num, maxDecimals = 2) {
2680
3120
  const rounded = Math.round(num * factor) / factor;
2681
3121
  return rounded.toString();
2682
3122
  }
2683
- export function extractEpisodeNumber(filename) {
3123
+ function extractEpisodeNumber(filename) {
2684
3124
  const match = filename.match(/(?:e\s*)?(\d{1,3})(?!\d)/i);
2685
3125
  return match ? parseInt(match[1], 10) : -1;
2686
3126
  }
2687
- export function trashSoft(filePath) {
2688
- if (!existsSync(filePath)) {
3127
+ function trashSoft(filePath) {
3128
+ if (!(0, fs_1.existsSync)(filePath)) {
2689
3129
  return false;
2690
3130
  }
2691
- const plat = platform();
3131
+ const plat = (0, os_1.platform)();
2692
3132
  try {
2693
3133
  switch (plat) {
2694
3134
  case "win32":
2695
3135
  {
2696
- execSync(`powershell -Command "Add-Type -AssemblyName Microsoft.VisualBasic; [Microsoft.VisualBasic.FileIO.FileSystem]::DeleteFile('${filePath.replace(/'/g, "''")}', 'OnlyErrorDialogs', 'SendToRecycleBin')"`);
3136
+ (0, child_process_1.execSync)(`powershell -Command "Add-Type -AssemblyName Microsoft.VisualBasic; [Microsoft.VisualBasic.FileIO.FileSystem]::DeleteFile('${filePath.replace(/'/g, "''")}', 'OnlyErrorDialogs', 'SendToRecycleBin')"`);
2697
3137
  }
2698
3138
  break;
2699
3139
  case "darwin":
2700
3140
  {
2701
- execSync(`osascript -e 'tell app "Finder" to delete POSIX file "${filePath.replace(/"/g, '\\"')}"'`);
3141
+ (0, child_process_1.execSync)(`osascript -e 'tell app "Finder" to delete POSIX file "${filePath.replace(/"/g, '\\"')}"'`);
2702
3142
  }
2703
3143
  break;
2704
3144
  default:
2705
3145
  {
2706
3146
  try {
2707
- execSync(`gio trash "${filePath.replace(/"/g, '\\"')}"`);
3147
+ (0, child_process_1.execSync)(`gio trash "${filePath.replace(/"/g, '\\"')}"`);
2708
3148
  }
2709
- catch {
2710
- execSync(`trash "${filePath.replace(/"/g, '\\"')}"`);
3149
+ catch (_a) {
3150
+ (0, child_process_1.execSync)(`trash "${filePath.replace(/"/g, '\\"')}"`);
2711
3151
  }
2712
3152
  }
2713
3153
  break;
2714
3154
  }
2715
3155
  }
2716
3156
  catch (e) {
2717
- rmSync(filePath);
3157
+ (0, fs_1.rmSync)(filePath);
2718
3158
  }
2719
3159
  return true;
2720
3160
  }
@@ -2754,21 +3194,31 @@ const modelExtensions = new Set([
2754
3194
  const imageSequenceExtensions = new Set([
2755
3195
  'dpx', 'exr', 'tga'
2756
3196
  ]);
2757
- export function isOfType(extension, extensions) {
3197
+ function isOfType(extension, extensions) {
2758
3198
  return extensions.has(extension);
2759
3199
  }
2760
3200
  // --- Exports ---
2761
- export const isPicture = (extension) => isOfType(extension, pictureExtensions);
2762
- export const isVideo = (extension) => isOfType(extension, videoExtensions);
2763
- export const isAudio = (extension) => isOfType(extension, audioExtensions);
2764
- export const isSubtitle = (extension) => isOfType(extension, subtitleExtensions);
2765
- export const isFont = (extension) => isOfType(extension, fontExtensions);
2766
- export const isArchive = (extension) => isOfType(extension, archiveExtensions);
2767
- export const isDocument = (extension) => isOfType(extension, documentExtensions);
2768
- export const isCode = (extension) => isOfType(extension, codeExtensions);
2769
- export const isModel = (extension) => isOfType(extension, modelExtensions);
2770
- export const isImageSequence = (extension) => isOfType(extension, imageSequenceExtensions);
2771
- export const classifyExt = (ext) => {
3201
+ const isPicture = (extension) => isOfType(extension, pictureExtensions);
3202
+ exports.isPicture = isPicture;
3203
+ const isVideo = (extension) => isOfType(extension, videoExtensions);
3204
+ exports.isVideo = isVideo;
3205
+ const isAudio = (extension) => isOfType(extension, audioExtensions);
3206
+ exports.isAudio = isAudio;
3207
+ const isSubtitle = (extension) => isOfType(extension, subtitleExtensions);
3208
+ exports.isSubtitle = isSubtitle;
3209
+ const isFont = (extension) => isOfType(extension, fontExtensions);
3210
+ exports.isFont = isFont;
3211
+ const isArchive = (extension) => isOfType(extension, archiveExtensions);
3212
+ exports.isArchive = isArchive;
3213
+ const isDocument = (extension) => isOfType(extension, documentExtensions);
3214
+ exports.isDocument = isDocument;
3215
+ const isCode = (extension) => isOfType(extension, codeExtensions);
3216
+ exports.isCode = isCode;
3217
+ const isModel = (extension) => isOfType(extension, modelExtensions);
3218
+ exports.isModel = isModel;
3219
+ const isImageSequence = (extension) => isOfType(extension, imageSequenceExtensions);
3220
+ exports.isImageSequence = isImageSequence;
3221
+ const classifyExt = (ext) => {
2772
3222
  ext = ext.toLowerCase();
2773
3223
  switch (true) {
2774
3224
  case pictureExtensions.has(ext): return 'picture';
@@ -2784,15 +3234,16 @@ export const classifyExt = (ext) => {
2784
3234
  default: return 'unknown';
2785
3235
  }
2786
3236
  };
3237
+ exports.classifyExt = classifyExt;
2787
3238
  //endregion extensions
2788
- export function subtitlesStreamInfoToString(info) {
3239
+ function subtitlesStreamInfoToString(info) {
2789
3240
  return `${info.language}:${info.streamIndex}`;
2790
3241
  }
2791
- export async function extractsubtitlesStreamsInfo(videoWithSubtitlesPath) {
3242
+ async function extractsubtitlesStreamsInfo(videoWithSubtitlesPath) {
2792
3243
  const command = `ffmpeg -i "${sanitizeStringForFFMPEG(videoWithSubtitlesPath)}"`;
2793
3244
  const result = await runCommandRejectAsResolve(command);
2794
3245
  const subtitles = [];
2795
- for (const match of result.matchAll(SUBTITLE_METADATA_REGEX)) {
3246
+ for (const match of result.matchAll(fields_1.SUBTITLE_METADATA_REGEX)) {
2796
3247
  let format = null;
2797
3248
  const formatGroup1 = match[3].toLowerCase();
2798
3249
  switch (formatGroup1) {
@@ -2834,7 +3285,7 @@ export async function extractsubtitlesStreamsInfo(videoWithSubtitlesPath) {
2834
3285
  }
2835
3286
  return subtitles;
2836
3287
  }
2837
- export async function tryExtractSubtitles(videoWithSubtitlesPath, subtitlesOutputPath, streamId = 0) {
3288
+ async function tryExtractSubtitles(videoWithSubtitlesPath, subtitlesOutputPath, streamId = 0) {
2838
3289
  const command = `ffmpeg -y -i "${sanitizeStringForFFMPEG(videoWithSubtitlesPath)}" -map 0:${streamId} -c copy "${sanitizeStringForFFMPEG(subtitlesOutputPath)}"`;
2839
3290
  try {
2840
3291
  trashSoft(subtitlesOutputPath);
@@ -2847,7 +3298,7 @@ export async function tryExtractSubtitles(videoWithSubtitlesPath, subtitlesOutpu
2847
3298
  return false;
2848
3299
  }
2849
3300
  }
2850
- export async function addSubtitles(videoToAddSubtitlesToFile, subtitlesFile, customSubtitlesName = "", clearExistingSubtitles = false) {
3301
+ async function addSubtitles(videoToAddSubtitlesToFile, subtitlesFile, customSubtitlesName = "", clearExistingSubtitles = false) {
2851
3302
  const tempOutputFile = `${videoToAddSubtitlesToFile.directory}/temp_${videoToAddSubtitlesToFile.fullName}`;
2852
3303
  trashSoft(tempOutputFile);
2853
3304
  // let command = `ffmpeg -i "${sanitizeStringForFFMPEG(videoToAddSubtitlesToFile.path)}" -i "${sanitizeStringForFFMPEG(subtitlesFile.path)}" -c copy -map 0 -map 1`
@@ -2868,23 +3319,23 @@ export async function addSubtitles(videoToAddSubtitlesToFile, subtitlesFile, cus
2868
3319
  return false;
2869
3320
  }
2870
3321
  trashSoft(videoToAddSubtitlesToFile.path);
2871
- renameSync(tempOutputFile, videoToAddSubtitlesToFile.path);
3322
+ (0, fs_1.renameSync)(tempOutputFile, videoToAddSubtitlesToFile.path);
2872
3323
  return true;
2873
3324
  }
2874
- export const MUSICAL_NOTES = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'];
2875
- export function noteFromMIDI(n) {
2876
- return MUSICAL_NOTES[n % MUSICAL_NOTES.length];
3325
+ exports.MUSICAL_NOTES = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'];
3326
+ function noteFromMIDI(n) {
3327
+ return exports.MUSICAL_NOTES[n % exports.MUSICAL_NOTES.length];
2877
3328
  }
2878
- export function octaveFromMIDI(n) {
2879
- return `${Math.floor(n / MUSICAL_NOTES.length - 1)}`;
3329
+ function octaveFromMIDI(n) {
3330
+ return `${Math.floor(n / exports.MUSICAL_NOTES.length - 1)}`;
2880
3331
  }
2881
- export function fullNoteFromMIDI(n) {
3332
+ function fullNoteFromMIDI(n) {
2882
3333
  return `${noteFromMIDI(n)}${octaveFromMIDI(n)}`;
2883
3334
  }
2884
- export function clearTerminal() {
3335
+ function clearTerminal() {
2885
3336
  process.stdout.write('\x1B[2J\x1B[0f');
2886
3337
  }
2887
- export async function connectMidiByName(midiInput, targetName) {
3338
+ async function connectMidiByName(midiInput, targetName) {
2888
3339
  const ports = [];
2889
3340
  let foundPort = -1;
2890
3341
  let attemptCount = 0;
@@ -2892,7 +3343,7 @@ export async function connectMidiByName(midiInput, targetName) {
2892
3343
  ++attemptCount;
2893
3344
  let output = "";
2894
3345
  if (midiInput.getPortCount() === 0) {
2895
- output += chalk.red('No MIDI devices found!');
3346
+ output += exports.chalk.red('No MIDI devices found!');
2896
3347
  output += "\n";
2897
3348
  }
2898
3349
  else {
@@ -2907,7 +3358,7 @@ export async function connectMidiByName(midiInput, targetName) {
2907
3358
  }
2908
3359
  }
2909
3360
  if (foundPort === -1) {
2910
- output += chalk.yellow(`\n[${attemptCount}] No MIDI device matching "${targetName}" found. Retrying in 1s...`);
3361
+ output += exports.chalk.yellow(`\n[${attemptCount}] No MIDI device matching "${targetName}" found. Retrying in 1s...`);
2911
3362
  }
2912
3363
  setTerminalOutput(output);
2913
3364
  if (foundPort === -1) {
@@ -2918,7 +3369,7 @@ export async function connectMidiByName(midiInput, targetName) {
2918
3369
  midiInput.openPort(foundPort);
2919
3370
  return foundPort;
2920
3371
  }
2921
- export function joinSet(set, joinText = ", ", itemToString = objectToString) {
3372
+ function joinSet(set, joinText = ", ", itemToString = objectToString) {
2922
3373
  let output = "";
2923
3374
  if (set.size <= 0) {
2924
3375
  return output;
@@ -2933,7 +3384,7 @@ export function joinSet(set, joinText = ", ", itemToString = objectToString) {
2933
3384
  }
2934
3385
  return output;
2935
3386
  }
2936
- export function verboseModText(originalText, modifications) {
3387
+ function verboseModText(originalText, modifications) {
2937
3388
  let text = originalText;
2938
3389
  let oldText;
2939
3390
  for (const modify of modifications) {
@@ -2942,51 +3393,52 @@ export function verboseModText(originalText, modifications) {
2942
3393
  }
2943
3394
  return text;
2944
3395
  }
2945
- export function printDifferenceIfDifferent(oldText, newText, prefix = "") {
3396
+ function printDifferenceIfDifferent(oldText, newText, prefix = "") {
2946
3397
  if (oldText !== newText) {
2947
3398
  print(`${prefix}${highlightDifference(oldText, newText)}`);
2948
3399
  }
2949
3400
  return newText;
2950
3401
  }
2951
- export function highlightDifference(oldText, newText) {
3402
+ function highlightDifference(oldText, newText) {
2952
3403
  if (oldText.includes(newText)) {
2953
3404
  return yellowUnderline(modMatchAndNotMatch(oldText, newText));
2954
3405
  }
2955
3406
  else if (newText.includes(oldText)) {
2956
- return greenUnderline(modMatchAndNotMatch(newText, oldText, chalk.yellowBright, greenUnderlineBold));
3407
+ return greenUnderline(modMatchAndNotMatch(newText, oldText, exports.chalk.yellowBright, greenUnderlineBold));
2957
3408
  }
2958
3409
  else {
2959
- return chalk.yellowBright(`${redUnderline(oldText)}\nto\n${greenUnderlineBold(newText)}`);
3410
+ return exports.chalk.yellowBright(`${redUnderline(oldText)}\nto\n${greenUnderlineBold(newText)}`);
2960
3411
  }
2961
3412
  }
2962
- export function toRegexpAsExactString(text, flags = "i") {
3413
+ function toRegexpAsExactString(text, flags = "i") {
2963
3414
  return new RegExp(`${text.replaceAll(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')}`, "i");
2964
3415
  }
2965
- export function greenUnderlineBold(text) {
2966
- return underlineBold(chalk.greenBright(text));
3416
+ function greenUnderlineBold(text) {
3417
+ return underlineBold(exports.chalk.greenBright(text));
2967
3418
  }
2968
- export function greenUnderline(text) {
2969
- return chalk.underline(chalk.greenBright(text));
3419
+ function greenUnderline(text) {
3420
+ return exports.chalk.underline(exports.chalk.greenBright(text));
2970
3421
  }
2971
- export function redUnderlineBold(text) {
2972
- return underlineBold(chalk.redBright(text));
3422
+ function redUnderlineBold(text) {
3423
+ return underlineBold(exports.chalk.redBright(text));
2973
3424
  }
2974
- export function redUnderline(text) {
2975
- return chalk.underline(chalk.redBright(text));
3425
+ function redUnderline(text) {
3426
+ return exports.chalk.underline(exports.chalk.redBright(text));
2976
3427
  }
2977
- export function yellowUnderline(text) {
2978
- return chalk.underline(chalk.yellowBright(text));
3428
+ function yellowUnderline(text) {
3429
+ return exports.chalk.underline(exports.chalk.yellowBright(text));
2979
3430
  }
2980
- export function underlineBold(text) {
2981
- return chalk.underline(chalk.bold(text));
3431
+ function underlineBold(text) {
3432
+ return exports.chalk.underline(exports.chalk.bold(text));
2982
3433
  }
2983
- export function modAllMatchAndNotMatch(fullText, partsToModify, insideTextModifier = greenUnderlineBold, outsideTextModifier = redUnderline) {
3434
+ function modAllMatchAndNotMatch(fullText, partsToModify, insideTextModifier = greenUnderlineBold, outsideTextModifier = redUnderline) {
3435
+ var _a;
2984
3436
  fullText = fullText.trim();
2985
3437
  const regex = typeof partsToModify === "string" ? toRegexpAsExactString(partsToModify.trim(), "gi") : partsToModify;
2986
3438
  let result = "";
2987
3439
  let lastIndex = 0;
2988
3440
  for (const match of fullText.matchAll(regex)) {
2989
- const start = match.index ?? 0;
3441
+ const start = (_a = match.index) !== null && _a !== void 0 ? _a : 0;
2990
3442
  const end = start + match[0].length;
2991
3443
  result += outsideTextModifier(fullText.slice(lastIndex, start));
2992
3444
  result += insideTextModifier(match[0]);
@@ -2995,14 +3447,15 @@ export function modAllMatchAndNotMatch(fullText, partsToModify, insideTextModifi
2995
3447
  result += outsideTextModifier(fullText.slice(lastIndex));
2996
3448
  return result;
2997
3449
  }
2998
- export function modMatchAndNotMatch(fullText, partsToModify, insideTextModifier = greenUnderlineBold, outsideTextModifier = redUnderline) {
3450
+ function modMatchAndNotMatch(fullText, partsToModify, insideTextModifier = greenUnderlineBold, outsideTextModifier = redUnderline) {
3451
+ var _a;
2999
3452
  fullText = fullText.trim();
3000
3453
  const regex = typeof partsToModify === "string" ? toRegexpAsExactString(partsToModify.trim(), "i") : partsToModify;
3001
3454
  const match = fullText.match(regex);
3002
3455
  if (!match) {
3003
3456
  return outsideTextModifier(fullText);
3004
3457
  }
3005
- const start = match.index ?? 0;
3458
+ const start = (_a = match.index) !== null && _a !== void 0 ? _a : 0;
3006
3459
  const end = start + match[0].length;
3007
3460
  let result = "";
3008
3461
  result += outsideTextModifier(fullText.slice(0, start));
@@ -3010,7 +3463,7 @@ export function modMatchAndNotMatch(fullText, partsToModify, insideTextModifier
3010
3463
  result += outsideTextModifier(fullText.slice(end));
3011
3464
  return result;
3012
3465
  }
3013
- export function createRunnableScriptFiles(scriptPath, scriptName, scriptCommand) {
3466
+ function createRunnableScriptFiles(scriptPath, scriptName, scriptCommand) {
3014
3467
  let wroteCount = 0;
3015
3468
  let scriptCommandWindows = scriptCommand.replaceAll("/", "\\");
3016
3469
  let scriptCommandLinux = scriptCommand.replaceAll("\\", "/");
@@ -3019,25 +3472,25 @@ export function createRunnableScriptFiles(scriptPath, scriptName, scriptCommand)
3019
3472
  // .map(line => `call ${line}`)
3020
3473
  // .join("\n")) ? 0 : 1
3021
3474
  // wroteCount += writeFileSyncCheck(path.resolve(scriptPath, `${scriptName}_pause.bat`), `.\\${scriptName}.bat\nPAUSE`) ? 0 : 1
3022
- wroteCount += writeFileSyncCheck(path.resolve(scriptPath, `${scriptName}.ps1`), scriptCommandWindows) ? 0 : 1;
3023
- wroteCount += writeFileSyncCheck(path.resolve(scriptPath, `${scriptName}_pause.ps1`), `.\\${scriptName}.ps1\nPAUSE`) ? 0 : 1;
3024
- let linuxScriptPath = path.resolve(scriptPath, `${scriptName}.sh`);
3475
+ wroteCount += writeFileSyncCheck(path_1.default.resolve(scriptPath, `${scriptName}.ps1`), scriptCommandWindows) ? 0 : 1;
3476
+ wroteCount += writeFileSyncCheck(path_1.default.resolve(scriptPath, `${scriptName}_pause.ps1`), `.\\${scriptName}.ps1\nPAUSE`) ? 0 : 1;
3477
+ let linuxScriptPath = path_1.default.resolve(scriptPath, `${scriptName}.sh`);
3025
3478
  wroteCount += writeFileSyncCheck(linuxScriptPath, `#!/bin/bash\n${scriptCommandLinux}`) ? 0 : 1;
3026
3479
  makeRunnable(linuxScriptPath);
3027
- linuxScriptPath = path.resolve(scriptPath, `${scriptName}_pause.sh`);
3028
- wroteCount += writeFileSyncCheck(linuxScriptPath, `#!/bin/bash\n./${scriptName}.sh\n${PRESS_ENTER_TO_EXIT_SH}`) ? 0 : 1;
3480
+ linuxScriptPath = path_1.default.resolve(scriptPath, `${scriptName}_pause.sh`);
3481
+ wroteCount += writeFileSyncCheck(linuxScriptPath, `#!/bin/bash\n./${scriptName}.sh\n${fields_1.PRESS_ENTER_TO_EXIT_SH}`) ? 0 : 1;
3029
3482
  makeRunnable(linuxScriptPath);
3030
3483
  return wroteCount;
3031
3484
  }
3032
- export async function createProject(projectPath, projectName) {
3033
- projectPath = projectPath.replaceAll(SEPARATOR_REGEX, SEP);
3485
+ async function createProject(projectPath, projectName) {
3486
+ projectPath = projectPath.replaceAll(fields_1.SEPARATOR_REGEX, fields_1.SEP);
3034
3487
  mkdirSoftRecursive(projectPath);
3035
- projectPath = path.resolve(projectPath, projectName);
3036
- const pathAlreadyExists = existsSync(projectPath);
3488
+ projectPath = path_1.default.resolve(projectPath, projectName);
3489
+ const pathAlreadyExists = (0, fs_1.existsSync)(projectPath);
3037
3490
  if (pathAlreadyExists) {
3038
- const stat = statSync(projectPath);
3491
+ const stat = (0, fs_1.statSync)(projectPath);
3039
3492
  if (!stat.isDirectory()) {
3040
- print(chalk.redBright(`A file with the name "${projectPath.replaceAll(SEPARATOR_REGEX, SEP)}" already exists.`));
3493
+ print(exports.chalk.redBright(`A file with the name "${projectPath.replaceAll(fields_1.SEPARATOR_REGEX, fields_1.SEP)}" already exists.`));
3041
3494
  return false;
3042
3495
  }
3043
3496
  }
@@ -3050,91 +3503,92 @@ export async function createProject(projectPath, projectName) {
3050
3503
  newScriptsCount += createRunnableScriptFiles(projectPath, "brun", `${buildScript}\nnode ./build/index.js`);
3051
3504
  newScriptsCount += createRunnableScriptFiles(projectPath, "update", `pnpm i ahegao@latest`);
3052
3505
  if (pathAlreadyExists) {
3053
- if (readdirSync(projectPath).length > 0) {
3054
- print(chalk.yellowBright(`Project folder "${projectPath.replaceAll(SEPARATOR_REGEX, SEP)}" already exists.`));
3506
+ if ((0, fs_1.readdirSync)(projectPath).length > 0) {
3507
+ print(exports.chalk.yellowBright(`Project folder "${projectPath.replaceAll(fields_1.SEPARATOR_REGEX, fields_1.SEP)}" already exists.`));
3055
3508
  if (newScriptsCount > 0) {
3056
- print(chalk.greenBright(`Added ${newScriptsCount} script${sIfNot1(newScriptsCount)} to the existing folder!`));
3509
+ print(exports.chalk.greenBright(`Added ${newScriptsCount} script${sIfNot1(newScriptsCount)} to the existing folder!`));
3057
3510
  }
3058
3511
  return false;
3059
3512
  }
3060
3513
  }
3061
- const vsCodePath = path.resolve(projectPath, ".vscode");
3514
+ const vsCodePath = path_1.default.resolve(projectPath, ".vscode");
3062
3515
  mkdirSoft(vsCodePath);
3063
- writeFileSync(path.resolve(vsCodePath, "launch.json"), VSCODE_TS_LAUNCH_JSON);
3064
- writeFileSync(path.resolve(projectPath, "pnpm-workspace.yaml"), "dangerouslyAllowAllBuilds: true\n");
3065
- writeFileSync(path.resolve(projectPath, "tsconfig.json"), TSCONFIG_JSON);
3516
+ (0, fs_1.writeFileSync)(path_1.default.resolve(vsCodePath, "launch.json"), fields_1.VSCODE_TS_LAUNCH_JSON);
3517
+ (0, fs_1.writeFileSync)(path_1.default.resolve(projectPath, "pnpm-workspace.yaml"), "dangerouslyAllowAllBuilds: true\n");
3518
+ (0, fs_1.writeFileSync)(path_1.default.resolve(projectPath, "tsconfig.json"), fields_1.TSCONFIG_JSON);
3066
3519
  const options = { cwd: projectPath };
3067
- await spawnLiveCmd(`pnpm`, ["init", "--type", "module"], options);
3068
- await spawnLiveCmd(`pnpm`, [`pkg`, `set`, `name='${projectName}'`, `version='1.0.0'`, `description='${projectName}'`], options);
3520
+ await spawnLiveCmd(`pnpm`, ["init"], options);
3521
+ await spawnLiveCmd(`pnpm`, [`pkg`, `set`, `name="${projectName}"`, `version="1.0.0"`, `description="${projectName}"`], options);
3069
3522
  await spawnLiveCmd(`pnpm`, ["add", "-D", "ts-node"], options);
3070
3523
  await spawnLiveCmd(`pnpm`, ["add", "-D", "@types/node"], options);
3071
3524
  await spawnLiveCmd(`pnpm`, ["add", "-D", "tsconfig-paths"], options);
3072
3525
  await spawnLiveCmd(`pnpm`, [`i`, `ahegao@latest`], options);
3073
- const srcPath = path.resolve(projectPath, "src");
3526
+ const srcPath = path_1.default.resolve(projectPath, "src");
3074
3527
  mkdirSoft(srcPath);
3075
- writeFileSync(path.resolve(srcPath, "index.ts"), `import { print, chalk } from "ahegao/dist"\n\n`);
3076
- print(chalk.greenBright(`Successfully created project "${projectPath}"!`));
3528
+ (0, fs_1.writeFileSync)(path_1.default.resolve(srcPath, "index.ts"), `import { print, chalk } from "ahegao/dist"\n\n`);
3529
+ print(exports.chalk.greenBright(`Successfully created project "${projectPath}"!`));
3077
3530
  return true;
3078
3531
  }
3079
- export async function spawnLiveCmd(command, args = EMPTY_ARRAY, options = EXEC_NO_WINDOWS) {
3532
+ async function spawnLiveCmd(command, args = fields_1.EMPTY_ARRAY, options = fields_1.EXEC_NO_WINDOWS) {
3080
3533
  return spawnLive("cmd", ["/c", command, ...args], options);
3081
3534
  }
3082
- export async function spawnLivePowershell(command, args = EMPTY_ARRAY, options = EXEC_NO_WINDOWS) {
3535
+ async function spawnLivePowershell(command, args = fields_1.EMPTY_ARRAY, options = fields_1.EXEC_NO_WINDOWS) {
3083
3536
  return spawnLive("powershell", ["/c", command, ...args], options);
3084
3537
  }
3085
- export async function spawnLiveSilent(command, args = EMPTY_ARRAY, options = EXEC_NO_WINDOWS) {
3538
+ async function spawnLiveSilent(command, args = fields_1.EMPTY_ARRAY, options = fields_1.EXEC_NO_WINDOWS) {
3086
3539
  return spawnLive(command, args, options, false);
3087
3540
  }
3088
- export async function spawnLive(command, args = EMPTY_ARRAY, options = EXEC_NO_WINDOWS, verbose = true, onData = noop) {
3541
+ async function spawnLive(command, args = fields_1.EMPTY_ARRAY, options = fields_1.EXEC_NO_WINDOWS, verbose = true, onData = noop) {
3089
3542
  return new Promise((resolve, reject) => {
3543
+ var _a, _b;
3090
3544
  const identifier = `"${command} ${args.join(" ")}"`;
3091
3545
  if (verbose) {
3092
- print(chalk.blueBright(`Spawning process: ${identifier}`));
3546
+ print(exports.chalk.blueBright(`Spawning process: ${identifier}`));
3093
3547
  }
3094
- const task = spawn(command, args, options);
3548
+ const task = (0, child_process_1.spawn)(command, args, options);
3095
3549
  if (verbose) {
3096
- task.stdout?.on('data', (data) => {
3550
+ (_a = task.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (data) => {
3097
3551
  const text = data.toString().trim();
3098
3552
  onData(text, true);
3099
- print(chalk.greenBright(text));
3553
+ print(exports.chalk.greenBright(text));
3100
3554
  });
3101
- task.stderr?.on('data', (data) => {
3555
+ (_b = task.stderr) === null || _b === void 0 ? void 0 : _b.on('data', (data) => {
3102
3556
  const text = data.toString().trim();
3103
3557
  onData(text, true);
3104
- print(chalk.redBright(text));
3558
+ print(exports.chalk.redBright(text));
3105
3559
  });
3106
3560
  }
3107
3561
  task.on('error', (err) => {
3108
3562
  if (verbose) {
3109
- print(chalk.redBright(`${args}: Process error: ${err.message}`));
3563
+ print(exports.chalk.redBright(`${args}: Process error: ${err.message}`));
3110
3564
  }
3111
3565
  reject(err);
3112
3566
  });
3113
3567
  task.on('close', (code) => {
3114
3568
  if (verbose) {
3115
- const colorer = code === 0 ? chalk.greenBright : chalk.redBright;
3569
+ const colorer = code === 0 ? exports.chalk.greenBright : exports.chalk.redBright;
3116
3570
  print(colorer(`${identifier}: Process exited with code ${code}`));
3117
3571
  }
3118
- resolve(code?.toString() || "0");
3572
+ resolve((code === null || code === void 0 ? void 0 : code.toString()) || "0");
3119
3573
  });
3120
3574
  });
3121
3575
  }
3122
- export function isWindows() {
3123
- return platform() === "win32";
3576
+ function isWindows() {
3577
+ return (0, os_1.platform)() === "win32";
3124
3578
  }
3125
- export function isMacOS() {
3126
- return platform() === "darwin";
3579
+ function isMacOS() {
3580
+ return (0, os_1.platform)() === "darwin";
3127
3581
  }
3128
- export function isLinux() {
3129
- return platform() === "linux";
3582
+ function isLinux() {
3583
+ return (0, os_1.platform)() === "linux";
3130
3584
  }
3131
- export function isUnixLike() {
3585
+ function isUnixLike() {
3132
3586
  return isLinux() || isMacOS();
3133
3587
  }
3134
- export function makeRunnable(filePath) {
3135
- chmodSync(filePath, '755');
3588
+ function makeRunnable(filePath) {
3589
+ (0, fs_1.chmodSync)(filePath, '755');
3136
3590
  }
3137
- export async function acceptUserInput(prefix = "") {
3591
+ async function acceptUserInput(prefix = "") {
3138
3592
  const rl = readline.createInterface({
3139
3593
  input: process.stdin,
3140
3594
  output: process.stdout
@@ -3146,19 +3600,19 @@ export async function acceptUserInput(prefix = "") {
3146
3600
  });
3147
3601
  });
3148
3602
  }
3149
- export function writeFileSyncCheck(filePath, data) {
3150
- const existed = existsSync(filePath);
3151
- writeFileSync(filePath, data);
3603
+ function writeFileSyncCheck(filePath, data) {
3604
+ const existed = (0, fs_1.existsSync)(filePath);
3605
+ (0, fs_1.writeFileSync)(filePath, data);
3152
3606
  return existed;
3153
3607
  }
3154
- export function isLibTs() {
3608
+ function isLibTs() {
3155
3609
  return __filename.endsWith("ts");
3156
3610
  }
3157
- export function removeDuplicateLines(path) {
3611
+ function removeDuplicateLines(path) {
3158
3612
  const itemsSet = new Set();
3159
3613
  const items = [];
3160
3614
  const duplicateItems = new Set();
3161
- for (const item of readFileSync(path, "utf-8").split(/[\n\r]/)) {
3615
+ for (const item of (0, fs_1.readFileSync)(path, "utf-8").split(/[\n\r]/)) {
3162
3616
  if (item.length === 0) {
3163
3617
  continue;
3164
3618
  }
@@ -3170,46 +3624,46 @@ export function removeDuplicateLines(path) {
3170
3624
  items.push(item);
3171
3625
  }
3172
3626
  if (duplicateItems.size > 0) {
3173
- writeFileSync(path, items.join("\n"));
3627
+ (0, fs_1.writeFileSync)(path, items.join("\n"));
3174
3628
  }
3175
3629
  return duplicateItems;
3176
3630
  }
3177
3631
  //#region Audio
3178
- export function openCDTray() {
3632
+ function openCDTray() {
3179
3633
  if (process.platform === 'win32') {
3180
- exec('powershell (new-object -comObject WMPlayer.OCX.7).cdromCollection.item(0).Eject()');
3634
+ (0, child_process_1.exec)('powershell (new-object -comObject WMPlayer.OCX.7).cdromCollection.item(0).Eject()');
3181
3635
  }
3182
3636
  else if (process.platform === 'darwin') {
3183
- exec('drutil tray eject');
3637
+ (0, child_process_1.exec)('drutil tray eject');
3184
3638
  }
3185
3639
  else {
3186
- exec('eject');
3640
+ (0, child_process_1.exec)('eject');
3187
3641
  }
3188
3642
  }
3189
- export function closeCDTray() {
3643
+ function closeCDTray() {
3190
3644
  if (process.platform === 'win32') {
3191
- exec('powershell (new-object -comObject WMPlayer.OCX.7).cdromCollection.item(0).Eject()');
3645
+ (0, child_process_1.exec)('powershell (new-object -comObject WMPlayer.OCX.7).cdromCollection.item(0).Eject()');
3192
3646
  }
3193
3647
  else if (process.platform === 'darwin') {
3194
- exec('drutil tray close');
3648
+ (0, child_process_1.exec)('drutil tray close');
3195
3649
  }
3196
3650
  else {
3197
- exec('eject -t');
3651
+ (0, child_process_1.exec)('eject -t');
3198
3652
  }
3199
3653
  }
3200
- export function toggleCDTray() {
3654
+ function toggleCDTray() {
3201
3655
  if (process.platform === 'win32') {
3202
- exec('powershell (new-object -comObject WMPlayer.OCX.7).cdromCollection.item(0).Eject()');
3656
+ (0, child_process_1.exec)('powershell (new-object -comObject WMPlayer.OCX.7).cdromCollection.item(0).Eject()');
3203
3657
  }
3204
3658
  else if (process.platform === 'darwin') {
3205
- exec('drutil tray close || drutil tray eject');
3659
+ (0, child_process_1.exec)('drutil tray close || drutil tray eject');
3206
3660
  }
3207
3661
  else {
3208
- exec('eject -T');
3662
+ (0, child_process_1.exec)('eject -T');
3209
3663
  }
3210
3664
  }
3211
3665
  const SPEECH_COUNT_THRESHOLD = 2;
3212
- export async function recordAudioUntilX(wavePath = "./recording.wav", bitrate = 48000, exitIfSilentForS = 0, maxRecordingLengthS = 0, channels = 1, debug = false) {
3666
+ async function recordAudioUntilX(wavePath = "./recording.wav", bitrate = 48000, exitIfSilentForS = 0, maxRecordingLengthS = 0, channels = 1, debug = false) {
3213
3667
  return new Promise((resolve, reject) => {
3214
3668
  let stopOnSilence = maxRecordingLengthS <= 0;
3215
3669
  let speechCount = 0;
@@ -3217,9 +3671,9 @@ export async function recordAudioUntilX(wavePath = "./recording.wav", bitrate =
3217
3671
  let forceStopTask = null;
3218
3672
  const startTime = Date.now();
3219
3673
  if (debug) {
3220
- print(chalk.blueBright(`${timestampWithMs()} Starting recording~`));
3674
+ print(exports.chalk.blueBright(`${timestampWithMs()} Starting recording~`));
3221
3675
  }
3222
- const micInstance = mic({
3676
+ const micInstance = (0, mic_1.default)({
3223
3677
  rate: bitrate.toString(),
3224
3678
  channels: channels.toString(),
3225
3679
  debug,
@@ -3227,11 +3681,11 @@ export async function recordAudioUntilX(wavePath = "./recording.wav", bitrate =
3227
3681
  });
3228
3682
  const micInputStream = micInstance.getAudioStream();
3229
3683
  rmSoft(wavePath);
3230
- const outputFileStream = createWriteStream(wavePath);
3684
+ const outputFileStream = (0, fs_1.createWriteStream)(wavePath);
3231
3685
  micInputStream.pipe(outputFileStream);
3232
3686
  micInstance.start();
3233
3687
  micInputStream.on("error", (err) => {
3234
- print(chalk.redBright(`${timestampWithMs()} Error in Input Stream: ${err}`));
3688
+ print(exports.chalk.redBright(`${timestampWithMs()} Error in Input Stream: ${err}`));
3235
3689
  micInstance.stop();
3236
3690
  outputFileStream.end();
3237
3691
  if (stopOnSilenceTask != null) {
@@ -3246,7 +3700,7 @@ export async function recordAudioUntilX(wavePath = "./recording.wav", bitrate =
3246
3700
  if (SPEECH_COUNT_THRESHOLD <= speechCount) {
3247
3701
  if (stopOnSilence) {
3248
3702
  if (debug) {
3249
- print(chalk.yellowBright(`${timestampWithMs()} Silence detected, stopping recording...`));
3703
+ print(exports.chalk.yellowBright(`${timestampWithMs()} Silence detected, stopping recording...`));
3250
3704
  }
3251
3705
  micInstance.stop();
3252
3706
  }
@@ -3261,7 +3715,7 @@ export async function recordAudioUntilX(wavePath = "./recording.wav", bitrate =
3261
3715
  });
3262
3716
  micInputStream.on("stopComplete", () => {
3263
3717
  if (debug) {
3264
- print(chalk.blueBright(`${timestampWithMs()} Finished recording ${(statSync(wavePath).size / 1024).toFixed(2)}kb in ${Date.now() - startTime}ms! Saved to: ${wavePath}`));
3718
+ print(exports.chalk.blueBright(`${timestampWithMs()} Finished recording ${((0, fs_1.statSync)(wavePath).size / 1024).toFixed(2)}kb in ${Date.now() - startTime}ms! Saved to: ${wavePath}`));
3265
3719
  }
3266
3720
  if (stopOnSilenceTask != null) {
3267
3721
  clearTimeout(stopOnSilenceTask);
@@ -3285,7 +3739,7 @@ export async function recordAudioUntilX(wavePath = "./recording.wav", bitrate =
3285
3739
  }
3286
3740
  });
3287
3741
  }
3288
- export function createSherpaCanaryOfflineSpeechRecognizer(encoderPath, decoderPath, tokensPath, sourceLanguage = "en", targetLanguage = "en", debug = false) {
3742
+ function createSherpaCanaryOfflineSpeechRecognizer(encoderPath, decoderPath, tokensPath, sourceLanguage = "en", targetLanguage = "en", debug = false) {
3289
3743
  const config = {
3290
3744
  modelConfig: {
3291
3745
  canary: {
@@ -3301,46 +3755,46 @@ export function createSherpaCanaryOfflineSpeechRecognizer(encoderPath, decoderPa
3301
3755
  };
3302
3756
  return createSherpaOfflineSpeechRecognizer(config, debug);
3303
3757
  }
3304
- export function createSherpaOfflineSpeechRecognizer(config, debug = false) {
3758
+ function createSherpaOfflineSpeechRecognizer(config, debug = false) {
3305
3759
  let timer = null;
3306
3760
  if (debug) {
3307
- timer = new Timer();
3308
- console.log(chalk.yellowBright(`Loading Offline Speech Recognition Model...\n${stringify(config)}`));
3761
+ timer = new classes_1.Timer();
3762
+ console.log(exports.chalk.yellowBright(`Loading Offline Speech Recognition Model...\n${stringify(config)}`));
3309
3763
  }
3310
- const recognizer = sherpa_onnx.createOfflineRecognizer(config);
3764
+ const recognizer = exports.sherpa_onnx.createOfflineRecognizer(config);
3311
3765
  if (debug) {
3312
- console.log(chalk.greenBright(`Model loaded in ${timer.elapsedS}s!`));
3766
+ console.log(exports.chalk.greenBright(`Model loaded in ${timer.elapsedS}s!`));
3313
3767
  }
3314
3768
  return recognizer;
3315
3769
  }
3316
- export function isTerminalAvailable() {
3770
+ function isTerminalAvailable() {
3317
3771
  return process.stdout.isTTY && process.stdin.isTTY;
3318
3772
  }
3319
- export function interpretWave(recognizer, waveFilePath, debug = false) {
3320
- const timer = new Timer();
3773
+ function interpretWave(recognizer, waveFilePath, debug = false) {
3774
+ const timer = new classes_1.Timer();
3321
3775
  if (debug) {
3322
- console.log(chalk.yellowBright(`Reading samples from ${waveFilePath}...`));
3776
+ console.log(exports.chalk.yellowBright(`Reading samples from ${waveFilePath}...`));
3323
3777
  timer.reset();
3324
3778
  }
3325
3779
  const stream = recognizer.createStream();
3326
- const wave = sherpa_onnx.readWave(waveFilePath);
3780
+ const wave = exports.sherpa_onnx.readWave(waveFilePath);
3327
3781
  stream.acceptWaveform(wave.sampleRate, wave.samples);
3328
3782
  if (debug) {
3329
- console.log(chalk.greenBright(`Accepted ${wave.samples.length} samples in ${timer.elapsedS}s!`));
3330
- console.log(chalk.yellowBright(`Recognizing Speech...`));
3783
+ console.log(exports.chalk.greenBright(`Accepted ${wave.samples.length} samples in ${timer.elapsedS}s!`));
3784
+ console.log(exports.chalk.yellowBright(`Recognizing Speech...`));
3331
3785
  timer.reset();
3332
3786
  }
3333
3787
  recognizer.decode(stream);
3334
3788
  const speech = recognizer.getResult(stream).text.trim();
3335
3789
  if (debug) {
3336
- console.log(chalk.greenBright(`Recognized "${chalk.magentaBright(chalk.bold(speech))}" in ${timer.elapsedS}s!`));
3790
+ console.log(exports.chalk.greenBright(`Recognized "${exports.chalk.magentaBright(exports.chalk.bold(speech))}" in ${timer.elapsedS}s!`));
3337
3791
  }
3338
3792
  stream.free();
3339
3793
  return speech;
3340
3794
  }
3341
- export async function getAudioFileDuration(filePath) {
3795
+ async function getAudioFileDuration(filePath) {
3342
3796
  return new Promise((resolve, reject) => {
3343
- exec(`ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "${filePath}"`, (error, stdout) => {
3797
+ (0, child_process_1.exec)(`ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "${filePath}"`, (error, stdout) => {
3344
3798
  if (error) {
3345
3799
  reject(error);
3346
3800
  }
@@ -3352,27 +3806,27 @@ export async function getAudioFileDuration(filePath) {
3352
3806
  }
3353
3807
  //#endregion Audio
3354
3808
  let DEBUG_PATHS = false;
3355
- export function getDebugPaths() {
3809
+ function getDebugPaths() {
3356
3810
  return DEBUG_PATHS;
3357
3811
  }
3358
- export function setDebugPaths(value) {
3812
+ function setDebugPaths(value) {
3359
3813
  DEBUG_PATHS = value;
3360
3814
  }
3361
- export function dogPaths(text) {
3815
+ function dogPaths(text) {
3362
3816
  if (DEBUG_PATHS) {
3363
3817
  print(text);
3364
3818
  }
3365
3819
  }
3366
- export function getTempPath() {
3820
+ function getTempPath() {
3367
3821
  return process.env.TEMP || process.env.TMPDIR || process.env.TMP || require("os").tmpdir();
3368
3822
  }
3369
- export function patchMicLib(libPath = "./node_modules/mic/lib/mic.js") {
3823
+ function patchMicLib(libPath = "./node_modules/mic/lib/mic.js") {
3370
3824
  try {
3371
- if (!existsSync(libPath)) {
3372
- print(chalk.redBright(`Mic lib path does not exist, cannot patch: ${path.resolve(libPath)}`));
3825
+ if (!(0, fs_1.existsSync)(libPath)) {
3826
+ print(exports.chalk.redBright(`Mic lib path does not exist, cannot patch: ${path_1.default.resolve(libPath)}`));
3373
3827
  return false;
3374
3828
  }
3375
- const micLibFile = readFileSync(libPath, "utf-8");
3829
+ const micLibFile = (0, fs_1.readFileSync)(libPath, "utf-8");
3376
3830
  const patchedMicLibFile = micLibFile.replace(`var audioProcessOptions = {
3377
3831
  stdio: ['ignore', 'pipe', 'ignore']
3378
3832
  };`, `var audioProcessOptions = {
@@ -3380,23 +3834,20 @@ export function patchMicLib(libPath = "./node_modules/mic/lib/mic.js") {
3380
3834
  windowsHide: true,
3381
3835
  };`);
3382
3836
  if (micLibFile !== patchedMicLibFile) {
3383
- print(chalk.yellowBright(`Patching mic lib to hide windows terminal... ${path.resolve(libPath)}`));
3384
- writeFileSync(libPath, patchedMicLibFile, "utf-8");
3385
- print(chalk.greenBright(`Patched mic lib successfully!`));
3837
+ print(exports.chalk.yellowBright(`Patching mic lib to hide windows terminal... ${path_1.default.resolve(libPath)}`));
3838
+ (0, fs_1.writeFileSync)(libPath, patchedMicLibFile, "utf-8");
3839
+ print(exports.chalk.greenBright(`Patched mic lib successfully!`));
3386
3840
  return true;
3387
3841
  }
3388
3842
  }
3389
3843
  catch (e) {
3390
- print(chalk.redBright(`Failed to patch mic lib: ${e}`));
3844
+ print(exports.chalk.redBright(`Failed to patch mic lib: ${e}`));
3391
3845
  }
3392
3846
  return false;
3393
3847
  }
3394
- export async function softSyncGitRepo(repoInfo) {
3848
+ async function softSyncGitRepo(repoInfo) {
3395
3849
  try {
3396
- const options = {
3397
- ...EXEC_NO_WINDOWS,
3398
- cwd: repoInfo.path,
3399
- };
3850
+ const options = Object.assign(Object.assign({}, fields_1.EXEC_NO_WINDOWS), { cwd: repoInfo.path });
3400
3851
  const stopIfFailed = (response) => {
3401
3852
  if (response !== "0") {
3402
3853
  return true;
@@ -3413,9 +3864,10 @@ export async function softSyncGitRepo(repoInfo) {
3413
3864
  return;
3414
3865
  if (stopIfFailed(await spawnLive(`git`, [`push`], options, false)))
3415
3866
  return;
3416
- print(chalk.greenBright(`Successfully synced repository: ${repoInfo.path}`));
3867
+ print(exports.chalk.greenBright(`Successfully synced repository: ${repoInfo.path}`));
3417
3868
  }
3418
3869
  catch (e) {
3419
3870
  printError(`Failed to sync repository at: ${repoInfo.path}\n${e}`);
3420
3871
  }
3421
3872
  }
3873
+ //# sourceMappingURL=util.js.map