ahegao 1.69.43 → 1.69.46

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