@utilix-tech/sdk 0.74.0 → 0.76.0

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.
package/dist/index.cjs CHANGED
@@ -2103,6 +2103,7 @@ __export(text_exports, {
2103
2103
  applyOps: () => applyOps,
2104
2104
  calculateStringDistance: () => calculateStringDistance,
2105
2105
  centerText: () => centerText,
2106
+ checkOxfordCommaConsistency: () => checkOxfordCommaConsistency,
2106
2107
  convertAll: () => convertAll,
2107
2108
  convertCase: () => convertCase,
2108
2109
  countWords: () => countWords,
@@ -2111,6 +2112,7 @@ __export(text_exports, {
2111
2112
  detectDelimiter: () => detectDelimiter,
2112
2113
  detectFillerWords: () => detectFillerWords,
2113
2114
  detectPassiveVoice: () => detectPassiveVoice,
2115
+ detectWordyPhrases: () => detectWordyPhrases,
2114
2116
  diffLines: () => diffLines,
2115
2117
  diffLinesSimple: () => diffLinesSimple,
2116
2118
  diffStats: () => diffStats,
@@ -5180,6 +5182,100 @@ function getEmojiByCategory(category) {
5180
5182
  function getEmojiCategories() {
5181
5183
  return Array.from(new Set(EMOJI_TABLE.map((e) => e.category)));
5182
5184
  }
5185
+ var WORDY_PHRASES = [
5186
+ { phrase: "due to the fact that", suggestion: "because" },
5187
+ { phrase: "in spite of the fact that", suggestion: "although" },
5188
+ { phrase: "despite the fact that", suggestion: "although" },
5189
+ { phrase: "in order to", suggestion: "to" },
5190
+ { phrase: "for the purpose of", suggestion: "for" },
5191
+ { phrase: "in the event that", suggestion: "if" },
5192
+ { phrase: "in the near future", suggestion: "soon" },
5193
+ { phrase: "at this point in time", suggestion: "now" },
5194
+ { phrase: "at the present time", suggestion: "now" },
5195
+ { phrase: "on a daily basis", suggestion: "daily" },
5196
+ { phrase: "on a regular basis", suggestion: "regularly" },
5197
+ { phrase: "in a timely manner", suggestion: "promptly" },
5198
+ { phrase: "with regard to", suggestion: "regarding" },
5199
+ { phrase: "with respect to", suggestion: "regarding" },
5200
+ { phrase: "in regards to", suggestion: "regarding" },
5201
+ { phrase: "with the exception of", suggestion: "except" },
5202
+ { phrase: "in close proximity to", suggestion: "near" },
5203
+ { phrase: "take into consideration", suggestion: "consider" },
5204
+ { phrase: "give consideration to", suggestion: "consider" },
5205
+ { phrase: "make a decision", suggestion: "decide" },
5206
+ { phrase: "is able to", suggestion: "can" },
5207
+ { phrase: "are able to", suggestion: "can" },
5208
+ { phrase: "a large number of", suggestion: "many" },
5209
+ { phrase: "a majority of", suggestion: "most" },
5210
+ { phrase: "each and every", suggestion: "each" },
5211
+ { phrase: "first and foremost", suggestion: "first" },
5212
+ { phrase: "last but not least", suggestion: "finally" },
5213
+ { phrase: "null and void", suggestion: "void" },
5214
+ { phrase: "whether or not", suggestion: "whether" },
5215
+ { phrase: "the reason why", suggestion: "the reason" },
5216
+ { phrase: "end result", suggestion: "result" },
5217
+ { phrase: "future plans", suggestion: "plans" },
5218
+ { phrase: "past history", suggestion: "history" },
5219
+ { phrase: "basic fundamentals", suggestion: "fundamentals" },
5220
+ { phrase: "absolutely essential", suggestion: "essential" },
5221
+ { phrase: "it is important to note that", suggestion: "(often removable)" },
5222
+ { phrase: "as a matter of fact", suggestion: "in fact" },
5223
+ { phrase: "in the process of", suggestion: "(often removable)" }
5224
+ ];
5225
+ function _wordyRegex(phrase) {
5226
+ const tokens = phrase.split(/\s+/).map((t) => t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
5227
+ return new RegExp("\\b" + tokens.join("\\s+") + "\\b", "gi");
5228
+ }
5229
+ function detectWordyPhrases(text) {
5230
+ const totalWords = (text.match(/[A-Za-z0-9']+/g) ?? []).length;
5231
+ const matches = [];
5232
+ for (const entry of WORDY_PHRASES) {
5233
+ const re = _wordyRegex(entry.phrase);
5234
+ const indices = [];
5235
+ let m;
5236
+ while ((m = re.exec(text)) !== null) {
5237
+ indices.push(m.index);
5238
+ if (m.index === re.lastIndex) re.lastIndex++;
5239
+ }
5240
+ if (indices.length > 0) {
5241
+ matches.push({ phrase: entry.phrase, suggestion: entry.suggestion, count: indices.length, indices });
5242
+ }
5243
+ }
5244
+ matches.sort((a, b) => b.count - a.count || a.phrase.localeCompare(b.phrase));
5245
+ const totalMatches = matches.reduce((s, m) => s + m.count, 0);
5246
+ const density = totalWords > 0 ? Math.round(totalMatches / totalWords * 1e3) / 10 : 0;
5247
+ return { totalWords, totalMatches, density, matches };
5248
+ }
5249
+ var _OXFORD_CONJ_RE = /(,)?\s+\b(?:and|or)\b\s+/gi;
5250
+ function checkOxfordCommaConsistency(text) {
5251
+ const instances = [];
5252
+ _OXFORD_CONJ_RE.lastIndex = 0;
5253
+ let m;
5254
+ while ((m = _OXFORD_CONJ_RE.exec(text)) !== null) {
5255
+ const matchStart = m.index;
5256
+ const hasCommaBefore = !!m[1];
5257
+ let clauseStart = -1;
5258
+ for (const ch of [".", "!", "?", "\n"]) {
5259
+ const idx = text.lastIndexOf(ch, matchStart - 1);
5260
+ if (idx > clauseStart) clauseStart = idx;
5261
+ }
5262
+ clauseStart += 1;
5263
+ const clause = text.slice(clauseStart, matchStart);
5264
+ const commaCount = (clause.match(/,/g) ?? []).length;
5265
+ if (commaCount < 1) continue;
5266
+ const snippetStart = Math.max(clauseStart, matchStart - 60);
5267
+ const afterConjEnd = _OXFORD_CONJ_RE.lastIndex;
5268
+ const tail = text.slice(afterConjEnd);
5269
+ const boundaryOffset = tail.search(/[.!?\n,]/);
5270
+ const snippetEnd = boundaryOffset === -1 ? Math.min(text.length, afterConjEnd + 40) : afterConjEnd + boundaryOffset;
5271
+ const snippet = text.slice(snippetStart, snippetEnd).trim();
5272
+ instances.push({ snippet, hasOxfordComma: hasCommaBefore, index: matchStart });
5273
+ }
5274
+ const withOxfordComma = instances.filter((i) => i.hasOxfordComma).length;
5275
+ const withoutOxfordComma = instances.length - withOxfordComma;
5276
+ const consistent = withOxfordComma === 0 || withoutOxfordComma === 0;
5277
+ return { totalLists: instances.length, withOxfordComma, withoutOxfordComma, consistent, instances };
5278
+ }
5183
5279
 
5184
5280
  // src/tools/data.ts
5185
5281
  var data_exports = {};
@@ -8578,6 +8674,7 @@ __export(units_exports, {
8578
8674
  calculateMovingAverages: () => calculateMovingAverages,
8579
8675
  calculatePaybackPeriod: () => calculatePaybackPeriod,
8580
8676
  calculatePercentageChange: () => calculatePercentageChange,
8677
+ calculateRequiredBandwidth: () => calculateRequiredBandwidth,
8581
8678
  calculateRoi: () => calculateRoi,
8582
8679
  calculateRuleOf72: () => calculateRuleOf72,
8583
8680
  calculateSavingsGoal: () => calculateSavingsGoal,
@@ -8586,6 +8683,7 @@ __export(units_exports, {
8586
8683
  calculateTaxEquivalentYield: () => calculateTaxEquivalentYield,
8587
8684
  calculateTimeValue: () => calculateTimeValue,
8588
8685
  calculateTipSplit: () => calculateTipSplit,
8686
+ calculateTransferTime: () => calculateTransferTime,
8589
8687
  calculateVideoBitrate: () => calculateVideoBitrate,
8590
8688
  compareSemver: () => compareSemver,
8591
8689
  compareUnitPrices: () => compareUnitPrices,
@@ -11231,6 +11329,69 @@ function calculateLoanPrepaymentPenalty(payoffBalance, penaltyType, params) {
11231
11329
  totalPayoffCost: round2(payoffBalance + penaltyAmount)
11232
11330
  };
11233
11331
  }
11332
+ var FILE_SIZE_UNIT_BYTES = {
11333
+ B: 1,
11334
+ KB: 1e3,
11335
+ MB: 1e6,
11336
+ GB: 1e9,
11337
+ TB: 1e12
11338
+ };
11339
+ var SPEED_UNIT_BITS_PER_SECOND = {
11340
+ Kbps: 1e3,
11341
+ Mbps: 1e6,
11342
+ Gbps: 1e9,
11343
+ KBps: 1e3 * 8,
11344
+ MBps: 1e6 * 8,
11345
+ GBps: 1e9 * 8
11346
+ };
11347
+ function formatDurationSeconds(totalSeconds) {
11348
+ if (totalSeconds < 1) return `${(totalSeconds * 1e3).toFixed(0)}ms`;
11349
+ if (totalSeconds < 60) {
11350
+ const decimals = totalSeconds < 10 && totalSeconds % 1 !== 0 ? 1 : 0;
11351
+ return `${totalSeconds.toFixed(decimals)}s`;
11352
+ }
11353
+ const days = Math.floor(totalSeconds / 86400);
11354
+ const hours = Math.floor(totalSeconds % 86400 / 3600);
11355
+ const minutes = Math.floor(totalSeconds % 3600 / 60);
11356
+ const seconds = Math.round(totalSeconds % 60);
11357
+ const parts = [];
11358
+ if (days > 0) parts.push(`${days}d`);
11359
+ if (hours > 0) parts.push(`${hours}h`);
11360
+ if (minutes > 0) parts.push(`${minutes}m`);
11361
+ if (seconds > 0 || parts.length === 0) parts.push(`${seconds}s`);
11362
+ return parts.join(" ");
11363
+ }
11364
+ function calculateTransferTime(fileSize, fileSizeUnit, speed, speedUnit) {
11365
+ if (!Number.isFinite(fileSize) || fileSize <= 0) return { error: "File size must be a positive number" };
11366
+ if (!Number.isFinite(speed) || speed <= 0) return { error: "Connection speed must be a positive number" };
11367
+ if (!(fileSizeUnit in FILE_SIZE_UNIT_BYTES)) return { error: `Unsupported file size unit: ${fileSizeUnit}` };
11368
+ if (!(speedUnit in SPEED_UNIT_BITS_PER_SECOND)) return { error: `Unsupported speed unit: ${speedUnit}` };
11369
+ const fileSizeBytes = fileSize * FILE_SIZE_UNIT_BYTES[fileSizeUnit];
11370
+ const speedBitsPerSecond = speed * SPEED_UNIT_BITS_PER_SECOND[speedUnit];
11371
+ const transferTimeSeconds = fileSizeBytes * 8 / speedBitsPerSecond;
11372
+ return {
11373
+ fileSizeBytes,
11374
+ speedBitsPerSecond,
11375
+ transferTimeSeconds,
11376
+ formattedTime: formatDurationSeconds(transferTimeSeconds)
11377
+ };
11378
+ }
11379
+ function calculateRequiredBandwidth(fileSize, fileSizeUnit, targetSeconds) {
11380
+ if (!Number.isFinite(fileSize) || fileSize <= 0) return { error: "File size must be a positive number" };
11381
+ if (!Number.isFinite(targetSeconds) || targetSeconds <= 0) {
11382
+ return { error: "Target time must be a positive number of seconds" };
11383
+ }
11384
+ if (!(fileSizeUnit in FILE_SIZE_UNIT_BYTES)) return { error: `Unsupported file size unit: ${fileSizeUnit}` };
11385
+ const fileSizeBytes = fileSize * FILE_SIZE_UNIT_BYTES[fileSizeUnit];
11386
+ const requiredBitsPerSecond = fileSizeBytes * 8 / targetSeconds;
11387
+ return {
11388
+ fileSizeBytes,
11389
+ targetSeconds,
11390
+ requiredBitsPerSecond,
11391
+ requiredMbps: requiredBitsPerSecond / 1e6,
11392
+ requiredMBps: requiredBitsPerSecond / 8 / 1e6
11393
+ };
11394
+ }
11234
11395
 
11235
11396
  // src/tools/network.ts
11236
11397
  var network_exports = {};
@@ -14789,7 +14950,8 @@ __export(api_exports, {
14789
14950
  signJwt: () => signJwt,
14790
14951
  validateCorsConfig: () => validateCorsConfig,
14791
14952
  validateCspConfig: () => validateCspConfig,
14792
- validateOgTags: () => validateOgTags
14953
+ validateOgTags: () => validateOgTags,
14954
+ verifyWebhookSignature: () => verifyWebhookSignature
14793
14955
  });
14794
14956
  function escapeShell(value) {
14795
14957
  return `'${value.replace(/'/g, "'\\''")}'`;
@@ -16122,6 +16284,40 @@ function generateTotp(secret, options = {}) {
16122
16284
  const secondsRemaining = periodSeconds - timestamp % periodSeconds;
16123
16285
  return { ...hotp, periodSeconds, secondsRemaining };
16124
16286
  }
16287
+ var WEBHOOK_HASH_ALGORITHMS = ["sha1", "sha256", "sha512"];
16288
+ function constantTimeEqual(a, b) {
16289
+ if (a.length !== b.length) return false;
16290
+ let diff = 0;
16291
+ for (let i = 0; i < a.length; i++) diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
16292
+ return diff === 0;
16293
+ }
16294
+ function verifyWebhookSignature(payload, secret, signature, algorithm = "sha256") {
16295
+ if (!payload) return { error: "Payload is required" };
16296
+ if (!secret) return { error: "Secret is required" };
16297
+ if (!signature || !signature.trim()) return { error: "Signature is required" };
16298
+ if (!WEBHOOK_HASH_ALGORITHMS.includes(algorithm)) {
16299
+ return { error: "Algorithm must be one of sha1, sha256, sha512" };
16300
+ }
16301
+ const trimmedSignature = signature.trim();
16302
+ const prefixMatch = trimmedSignature.match(/^(sha1|sha256|sha512)=(.+)$/i);
16303
+ const providedSignature = prefixMatch ? prefixMatch[2].trim() : trimmedSignature;
16304
+ const expectedHex = crypto.createHmac(algorithm, secret).update(payload, "utf8").digest("hex");
16305
+ const expectedBase64 = crypto.createHmac(algorithm, secret).update(payload, "utf8").digest("base64");
16306
+ let matchedEncoding = null;
16307
+ if (constantTimeEqual(providedSignature.toLowerCase(), expectedHex.toLowerCase())) {
16308
+ matchedEncoding = "hex";
16309
+ } else if (constantTimeEqual(providedSignature, expectedBase64)) {
16310
+ matchedEncoding = "base64";
16311
+ }
16312
+ return {
16313
+ valid: matchedEncoding !== null,
16314
+ algorithm,
16315
+ expectedHex,
16316
+ expectedBase64,
16317
+ providedSignature: trimmedSignature,
16318
+ matchedEncoding
16319
+ };
16320
+ }
16125
16321
 
16126
16322
  // src/tools/code.ts
16127
16323
  var code_exports = {};
package/dist/index.d.cts CHANGED
@@ -1,13 +1,13 @@
1
1
  export { j as json } from './json-CaiYsGDQ.cjs';
2
2
  export { e as encoding } from './encoding-Dk3wpmb3.cjs';
3
3
  export { h as hashing } from './hashing-CJjlvqS_.cjs';
4
- export { t as text } from './text-DWUcY8H1.cjs';
4
+ export { t as text } from './text-CNn3whZA.cjs';
5
5
  export { d as data } from './data-26TALa9U.cjs';
6
6
  export { g as generators } from './generators-DAXXrMvG.cjs';
7
7
  export { t as time } from './time-KqJjdqII.cjs';
8
- export { u as units } from './units-BAwyBk4x.cjs';
8
+ export { u as units } from './units-BqegyALA.cjs';
9
9
  export { n as network } from './network-Da3meCWM.cjs';
10
- export { a as api } from './api-C8rImfka.cjs';
10
+ export { a as api } from './api-CQnIUrVB.cjs';
11
11
  export { c as code } from './code-46xO9xFf.cjs';
12
12
  export { c as color } from './color-tPwZCr9H.cjs';
13
13
  export { c as css } from './css-Cf7AMGM-.cjs';
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  export { j as json } from './json-CaiYsGDQ.js';
2
2
  export { e as encoding } from './encoding-Dk3wpmb3.js';
3
3
  export { h as hashing } from './hashing-CJjlvqS_.js';
4
- export { t as text } from './text-DWUcY8H1.js';
4
+ export { t as text } from './text-CNn3whZA.js';
5
5
  export { d as data } from './data-26TALa9U.js';
6
6
  export { g as generators } from './generators-DAXXrMvG.js';
7
7
  export { t as time } from './time-KqJjdqII.js';
8
- export { u as units } from './units-BAwyBk4x.js';
8
+ export { u as units } from './units-BqegyALA.js';
9
9
  export { n as network } from './network-Da3meCWM.js';
10
- export { a as api } from './api-C8rImfka.js';
10
+ export { a as api } from './api-CQnIUrVB.js';
11
11
  export { c as code } from './code-46xO9xFf.js';
12
12
  export { c as color } from './color-tPwZCr9H.js';
13
13
  export { c as css } from './css-Cf7AMGM-.js';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export { media_exports as media } from './chunk-PT4N4UBL.js';
2
- export { units_exports as units } from './chunk-AKVWWLNJ.js';
2
+ export { units_exports as units } from './chunk-RP574L5Z.js';
3
3
  export { network_exports as network } from './chunk-CXUOV672.js';
4
- export { api_exports as api } from './chunk-4S63T7Y4.js';
4
+ export { api_exports as api } from './chunk-U2HREMZU.js';
5
5
  export { code_exports as code } from './chunk-XT2BQWXT.js';
6
6
  export { color_exports as color } from './chunk-BPVAB4P2.js';
7
7
  export { css_exports as css } from './chunk-6YPV2AB5.js';
@@ -10,7 +10,7 @@ export { ai_agent_exports as ai_agent } from './chunk-EKIXOA7B.js';
10
10
  export { json_exports as json } from './chunk-34C6GXCC.js';
11
11
  export { encoding_exports as encoding } from './chunk-DOWQZUTP.js';
12
12
  export { hashing_exports as hashing } from './chunk-PET2CGTH.js';
13
- export { text_exports as text } from './chunk-P7TXG7CI.js';
13
+ export { text_exports as text } from './chunk-QVOK3BXM.js';
14
14
  export { data_exports as data } from './chunk-HJVSH7FQ.js';
15
15
  export { generators_exports as generators } from './chunk-422ICOZX.js';
16
16
  export { time_exports as time } from './chunk-IEPWZERQ.js';
@@ -409,6 +409,53 @@ declare function getEmojiByChar(char: string): EmojiEntry | undefined;
409
409
  declare function getEmojiByCategory(category: string): EmojiEntry[];
410
410
  /** All distinct category names present in the table, in table order. */
411
411
  declare function getEmojiCategories(): string[];
412
+ interface WordyPhraseMatch {
413
+ phrase: string;
414
+ suggestion: string;
415
+ count: number;
416
+ indices: number[];
417
+ }
418
+ interface WordyPhraseResult {
419
+ totalWords: number;
420
+ totalMatches: number;
421
+ /** Matches per 100 words, to one decimal place. */
422
+ density: number;
423
+ matches: WordyPhraseMatch[];
424
+ }
425
+ /**
426
+ * Scan text against a curated table of wordy/redundant phrases ("due to the
427
+ * fact that", "in order to", "at this point in time") and flag each
428
+ * occurrence with a suggested concise replacement and character offsets.
429
+ * Dictionary-based heuristic, same shape as detectFillerWords: a flagged
430
+ * phrase is a candidate to tighten, not always wrong in context.
431
+ */
432
+ declare function detectWordyPhrases(text: string): WordyPhraseResult;
433
+ interface OxfordCommaInstance {
434
+ /** A short readable window of text around the matched "and"/"or". */
435
+ snippet: string;
436
+ hasOxfordComma: boolean;
437
+ index: number;
438
+ }
439
+ interface OxfordCommaResult {
440
+ totalLists: number;
441
+ withOxfordComma: number;
442
+ withoutOxfordComma: number;
443
+ /** True when every detected list uses the same Oxford-comma style, or when no lists were found. */
444
+ consistent: boolean;
445
+ instances: OxfordCommaInstance[];
446
+ }
447
+ /**
448
+ * Scan a document for comma-before-and/or usage in three-or-more-item lists
449
+ * and flag inconsistency: some lists using the Oxford (serial) comma while
450
+ * others in the same document don't. For each "and"/"or" conjunction found,
451
+ * it counts the commas since the start of the enclosing sentence; one or
452
+ * more prior commas means the conjunction is closing a list of at least
453
+ * three items, which is where the Oxford comma question applies. This is a
454
+ * heuristic over punctuation, not a grammar parser, so an unrelated comma
455
+ * earlier in the same sentence (e.g. an introductory clause) can occasionally
456
+ * be counted as part of a list.
457
+ */
458
+ declare function checkOxfordCommaConsistency(text: string): OxfordCommaResult;
412
459
 
413
460
  type text_AsciiFont = AsciiFont;
414
461
  type text_AsciiOptions = AsciiOptions;
@@ -439,6 +486,8 @@ type text_LoremUnit = LoremUnit;
439
486
  declare const text_MORSE_CODE: typeof MORSE_CODE;
440
487
  type text_MarkdownResult = MarkdownResult;
441
488
  type text_MorseOptions = MorseOptions;
489
+ type text_OxfordCommaInstance = OxfordCommaInstance;
490
+ type text_OxfordCommaResult = OxfordCommaResult;
442
491
  type text_ParsedDiff = ParsedDiff;
443
492
  type text_ParsedTable = ParsedTable;
444
493
  type text_PassiveVoiceMatch = PassiveVoiceMatch;
@@ -454,6 +503,8 @@ type text_StringDistanceResult = StringDistanceResult;
454
503
  type text_TableOptions = TableOptions;
455
504
  type text_TextAnalysis = TextAnalysis;
456
505
  type text_WordCountResult = WordCountResult;
506
+ type text_WordyPhraseMatch = WordyPhraseMatch;
507
+ type text_WordyPhraseResult = WordyPhraseResult;
457
508
  declare const text_addBorder: typeof addBorder;
458
509
  declare const text_analyzeKeywordDensity: typeof analyzeKeywordDensity;
459
510
  declare const text_analyzeSentenceLengths: typeof analyzeSentenceLengths;
@@ -462,6 +513,7 @@ declare const text_applyOp: typeof applyOp;
462
513
  declare const text_applyOps: typeof applyOps;
463
514
  declare const text_calculateStringDistance: typeof calculateStringDistance;
464
515
  declare const text_centerText: typeof centerText;
516
+ declare const text_checkOxfordCommaConsistency: typeof checkOxfordCommaConsistency;
465
517
  declare const text_convertAll: typeof convertAll;
466
518
  declare const text_convertCase: typeof convertCase;
467
519
  declare const text_countWords: typeof countWords;
@@ -470,6 +522,7 @@ declare const text_csvToMarkdown: typeof csvToMarkdown;
470
522
  declare const text_detectDelimiter: typeof detectDelimiter;
471
523
  declare const text_detectFillerWords: typeof detectFillerWords;
472
524
  declare const text_detectPassiveVoice: typeof detectPassiveVoice;
525
+ declare const text_detectWordyPhrases: typeof detectWordyPhrases;
473
526
  declare const text_diffLines: typeof diffLines;
474
527
  declare const text_diffLinesSimple: typeof diffLinesSimple;
475
528
  declare const text_diffStats: typeof diffStats;
@@ -515,7 +568,7 @@ declare const text_textToMorse: typeof textToMorse;
515
568
  declare const text_unescapeString: typeof unescapeString;
516
569
  declare const text_wordFrequency: typeof wordFrequency;
517
570
  declare namespace text {
518
- export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_EMOJI_TABLE as EMOJI_TABLE, text_ESCAPE_MODES as ESCAPE_MODES, type text_EmojiEntry as EmojiEntry, type text_EscapeMode as EscapeMode, type text_FillerCategory as FillerCategory, type text_FillerMatch as FillerMatch, type text_FillerWordResult as FillerWordResult, type text_KeywordDensityEntry as KeywordDensityEntry, type text_KeywordDensityOptions as KeywordDensityOptions, type text_KeywordDensityResult as KeywordDensityResult, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SentenceLengthBucket as SentenceLengthBucket, type text_SentenceLengthDistribution as SentenceLengthDistribution, type text_SlugSeparator as SlugSeparator, type text_StringDistanceMode as StringDistanceMode, type text_StringDistanceResult as StringDistanceResult, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, text_addBorder as addBorder, text_analyzeKeywordDensity as analyzeKeywordDensity, text_analyzeSentenceLengths as analyzeSentenceLengths, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_calculateStringDistance as calculateStringDistance, text_centerText as centerText, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectFillerWords as detectFillerWords, text_detectPassiveVoice as detectPassiveVoice, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getEmojiByCategory as getEmojiByCategory, text_getEmojiByChar as getEmojiByChar, text_getEmojiByShortcode as getEmojiByShortcode, text_getEmojiCategories as getEmojiCategories, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_searchEmoji as searchEmoji, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
571
+ export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_EMOJI_TABLE as EMOJI_TABLE, text_ESCAPE_MODES as ESCAPE_MODES, type text_EmojiEntry as EmojiEntry, type text_EscapeMode as EscapeMode, type text_FillerCategory as FillerCategory, type text_FillerMatch as FillerMatch, type text_FillerWordResult as FillerWordResult, type text_KeywordDensityEntry as KeywordDensityEntry, type text_KeywordDensityOptions as KeywordDensityOptions, type text_KeywordDensityResult as KeywordDensityResult, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_OxfordCommaInstance as OxfordCommaInstance, type text_OxfordCommaResult as OxfordCommaResult, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SentenceLengthBucket as SentenceLengthBucket, type text_SentenceLengthDistribution as SentenceLengthDistribution, type text_SlugSeparator as SlugSeparator, type text_StringDistanceMode as StringDistanceMode, type text_StringDistanceResult as StringDistanceResult, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, type text_WordyPhraseMatch as WordyPhraseMatch, type text_WordyPhraseResult as WordyPhraseResult, text_addBorder as addBorder, text_analyzeKeywordDensity as analyzeKeywordDensity, text_analyzeSentenceLengths as analyzeSentenceLengths, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_calculateStringDistance as calculateStringDistance, text_centerText as centerText, text_checkOxfordCommaConsistency as checkOxfordCommaConsistency, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectFillerWords as detectFillerWords, text_detectPassiveVoice as detectPassiveVoice, text_detectWordyPhrases as detectWordyPhrases, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getEmojiByCategory as getEmojiByCategory, text_getEmojiByChar as getEmojiByChar, text_getEmojiByShortcode as getEmojiByShortcode, text_getEmojiCategories as getEmojiCategories, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_searchEmoji as searchEmoji, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
519
572
  }
520
573
 
521
- export { convertAll as $, type AsciiFont as A, type ReadabilityScore as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, EMOJI_TABLE as E, type FillerCategory as F, type SentenceLengthDistribution as G, type SlugSeparator as H, type StringDistanceMode as I, type StringDistanceResult as J, type KeywordDensityEntry as K, LINE_OPS as L, MORSE_CODE as M, type TextAnalysis as N, addBorder as O, type ParsedDiff as P, analyzeKeywordDensity as Q, type ReadabilityResult as R, type SentenceLengthBucket as S, type TableOptions as T, analyzeSentenceLengths as U, analyzeText as V, type WordCountResult as W, applyOp as X, applyOps as Y, calculateStringDistance as Z, centerText as _, type AsciiOptions as a, convertCase as a0, countWords as a1, csvToHtml as a2, csvToMarkdown as a3, detectDelimiter as a4, detectFillerWords as a5, detectPassiveVoice as a6, diffLines as a7, diffLinesSimple as a8, diffStats as a9, parseDiff as aA, parseTableData as aB, readabilityScore as aC, renderMarkdown as aD, romanToNumber as aE, scoreReadability as aF, searchEmoji as aG, sentenceCount as aH, slugify as aI, slugifyAll as aJ, syllableCount as aK, textToAscii as aL, textToMorse as aM, unescapeString as aN, wordFrequency as aO, escapeAll as aa, escapeString as ab, extractHeadings as ac, formatReadingTime as ad, generate as ae, generateDiff as af, generateHtmlTable as ag, generateMarkdownTable as ah, generateParagraphs as ai, generateSentences as aj, generateWords as ak, getAvailableFonts as al, getEmojiByCategory as am, getEmojiByChar as an, getEmojiByShortcode as ao, getEmojiCategories as ap, getMorseForChar as aq, getMorseTiming as ar, htmlToMarkdown as as, isValidMorse as at, markdownToHtml as au, morseToText as av, numberToOrdinal as aw, numberToRoman as ax, numberToWords as ay, ordinalWords as az, type CaseFormat as b, type ConvertOptions as c, type DiffFile as d, type DiffHunk as e, type DiffLine as f, type DiffResult as g, type DiffType as h, type DiffViewerLine as i, ESCAPE_MODES as j, type EmojiEntry as k, type EscapeMode as l, type FillerMatch as m, type FillerWordResult as n, type KeywordDensityOptions as o, type KeywordDensityResult as p, type LineOp as q, type LineType as r, type LoremUnit as s, text as t, type MarkdownResult as u, type MorseOptions as v, type ParsedTable as w, type PassiveVoiceMatch as x, type PassiveVoiceResult as y, type PassiveVoiceSentence as z };
574
+ export { applyOp as $, type AsciiFont as A, type PassiveVoiceSentence as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, EMOJI_TABLE as E, type FillerCategory as F, type ReadabilityScore as G, type SentenceLengthDistribution as H, type SlugSeparator as I, type StringDistanceMode as J, type KeywordDensityEntry as K, LINE_OPS as L, MORSE_CODE as M, type StringDistanceResult as N, type OxfordCommaInstance as O, type ParsedDiff as P, type TextAnalysis as Q, type ReadabilityResult as R, type SentenceLengthBucket as S, type TableOptions as T, type WordyPhraseMatch as U, type WordyPhraseResult as V, type WordCountResult as W, addBorder as X, analyzeKeywordDensity as Y, analyzeSentenceLengths as Z, analyzeText as _, type AsciiOptions as a, applyOps as a0, calculateStringDistance as a1, centerText as a2, checkOxfordCommaConsistency as a3, convertAll as a4, convertCase as a5, countWords as a6, csvToHtml as a7, csvToMarkdown as a8, detectDelimiter as a9, markdownToHtml as aA, morseToText as aB, numberToOrdinal as aC, numberToRoman as aD, numberToWords as aE, ordinalWords as aF, parseDiff as aG, parseTableData as aH, readabilityScore as aI, renderMarkdown as aJ, romanToNumber as aK, scoreReadability as aL, searchEmoji as aM, sentenceCount as aN, slugify as aO, slugifyAll as aP, syllableCount as aQ, textToAscii as aR, textToMorse as aS, unescapeString as aT, wordFrequency as aU, detectFillerWords as aa, detectPassiveVoice as ab, detectWordyPhrases as ac, diffLines as ad, diffLinesSimple as ae, diffStats as af, escapeAll as ag, escapeString as ah, extractHeadings as ai, formatReadingTime as aj, generate as ak, generateDiff as al, generateHtmlTable as am, generateMarkdownTable as an, generateParagraphs as ao, generateSentences as ap, generateWords as aq, getAvailableFonts as ar, getEmojiByCategory as as, getEmojiByChar as at, getEmojiByShortcode as au, getEmojiCategories as av, getMorseForChar as aw, getMorseTiming as ax, htmlToMarkdown as ay, isValidMorse as az, type CaseFormat as b, type ConvertOptions as c, type DiffFile as d, type DiffHunk as e, type DiffLine as f, type DiffResult as g, type DiffType as h, type DiffViewerLine as i, ESCAPE_MODES as j, type EmojiEntry as k, type EscapeMode as l, type FillerMatch as m, type FillerWordResult as n, type KeywordDensityOptions as o, type KeywordDensityResult as p, type LineOp as q, type LineType as r, type LoremUnit as s, text as t, type MarkdownResult as u, type MorseOptions as v, type OxfordCommaResult as w, type ParsedTable as x, type PassiveVoiceMatch as y, type PassiveVoiceResult as z };
@@ -409,6 +409,53 @@ declare function getEmojiByChar(char: string): EmojiEntry | undefined;
409
409
  declare function getEmojiByCategory(category: string): EmojiEntry[];
410
410
  /** All distinct category names present in the table, in table order. */
411
411
  declare function getEmojiCategories(): string[];
412
+ interface WordyPhraseMatch {
413
+ phrase: string;
414
+ suggestion: string;
415
+ count: number;
416
+ indices: number[];
417
+ }
418
+ interface WordyPhraseResult {
419
+ totalWords: number;
420
+ totalMatches: number;
421
+ /** Matches per 100 words, to one decimal place. */
422
+ density: number;
423
+ matches: WordyPhraseMatch[];
424
+ }
425
+ /**
426
+ * Scan text against a curated table of wordy/redundant phrases ("due to the
427
+ * fact that", "in order to", "at this point in time") and flag each
428
+ * occurrence with a suggested concise replacement and character offsets.
429
+ * Dictionary-based heuristic, same shape as detectFillerWords: a flagged
430
+ * phrase is a candidate to tighten, not always wrong in context.
431
+ */
432
+ declare function detectWordyPhrases(text: string): WordyPhraseResult;
433
+ interface OxfordCommaInstance {
434
+ /** A short readable window of text around the matched "and"/"or". */
435
+ snippet: string;
436
+ hasOxfordComma: boolean;
437
+ index: number;
438
+ }
439
+ interface OxfordCommaResult {
440
+ totalLists: number;
441
+ withOxfordComma: number;
442
+ withoutOxfordComma: number;
443
+ /** True when every detected list uses the same Oxford-comma style, or when no lists were found. */
444
+ consistent: boolean;
445
+ instances: OxfordCommaInstance[];
446
+ }
447
+ /**
448
+ * Scan a document for comma-before-and/or usage in three-or-more-item lists
449
+ * and flag inconsistency: some lists using the Oxford (serial) comma while
450
+ * others in the same document don't. For each "and"/"or" conjunction found,
451
+ * it counts the commas since the start of the enclosing sentence; one or
452
+ * more prior commas means the conjunction is closing a list of at least
453
+ * three items, which is where the Oxford comma question applies. This is a
454
+ * heuristic over punctuation, not a grammar parser, so an unrelated comma
455
+ * earlier in the same sentence (e.g. an introductory clause) can occasionally
456
+ * be counted as part of a list.
457
+ */
458
+ declare function checkOxfordCommaConsistency(text: string): OxfordCommaResult;
412
459
 
413
460
  type text_AsciiFont = AsciiFont;
414
461
  type text_AsciiOptions = AsciiOptions;
@@ -439,6 +486,8 @@ type text_LoremUnit = LoremUnit;
439
486
  declare const text_MORSE_CODE: typeof MORSE_CODE;
440
487
  type text_MarkdownResult = MarkdownResult;
441
488
  type text_MorseOptions = MorseOptions;
489
+ type text_OxfordCommaInstance = OxfordCommaInstance;
490
+ type text_OxfordCommaResult = OxfordCommaResult;
442
491
  type text_ParsedDiff = ParsedDiff;
443
492
  type text_ParsedTable = ParsedTable;
444
493
  type text_PassiveVoiceMatch = PassiveVoiceMatch;
@@ -454,6 +503,8 @@ type text_StringDistanceResult = StringDistanceResult;
454
503
  type text_TableOptions = TableOptions;
455
504
  type text_TextAnalysis = TextAnalysis;
456
505
  type text_WordCountResult = WordCountResult;
506
+ type text_WordyPhraseMatch = WordyPhraseMatch;
507
+ type text_WordyPhraseResult = WordyPhraseResult;
457
508
  declare const text_addBorder: typeof addBorder;
458
509
  declare const text_analyzeKeywordDensity: typeof analyzeKeywordDensity;
459
510
  declare const text_analyzeSentenceLengths: typeof analyzeSentenceLengths;
@@ -462,6 +513,7 @@ declare const text_applyOp: typeof applyOp;
462
513
  declare const text_applyOps: typeof applyOps;
463
514
  declare const text_calculateStringDistance: typeof calculateStringDistance;
464
515
  declare const text_centerText: typeof centerText;
516
+ declare const text_checkOxfordCommaConsistency: typeof checkOxfordCommaConsistency;
465
517
  declare const text_convertAll: typeof convertAll;
466
518
  declare const text_convertCase: typeof convertCase;
467
519
  declare const text_countWords: typeof countWords;
@@ -470,6 +522,7 @@ declare const text_csvToMarkdown: typeof csvToMarkdown;
470
522
  declare const text_detectDelimiter: typeof detectDelimiter;
471
523
  declare const text_detectFillerWords: typeof detectFillerWords;
472
524
  declare const text_detectPassiveVoice: typeof detectPassiveVoice;
525
+ declare const text_detectWordyPhrases: typeof detectWordyPhrases;
473
526
  declare const text_diffLines: typeof diffLines;
474
527
  declare const text_diffLinesSimple: typeof diffLinesSimple;
475
528
  declare const text_diffStats: typeof diffStats;
@@ -515,7 +568,7 @@ declare const text_textToMorse: typeof textToMorse;
515
568
  declare const text_unescapeString: typeof unescapeString;
516
569
  declare const text_wordFrequency: typeof wordFrequency;
517
570
  declare namespace text {
518
- export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_EMOJI_TABLE as EMOJI_TABLE, text_ESCAPE_MODES as ESCAPE_MODES, type text_EmojiEntry as EmojiEntry, type text_EscapeMode as EscapeMode, type text_FillerCategory as FillerCategory, type text_FillerMatch as FillerMatch, type text_FillerWordResult as FillerWordResult, type text_KeywordDensityEntry as KeywordDensityEntry, type text_KeywordDensityOptions as KeywordDensityOptions, type text_KeywordDensityResult as KeywordDensityResult, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SentenceLengthBucket as SentenceLengthBucket, type text_SentenceLengthDistribution as SentenceLengthDistribution, type text_SlugSeparator as SlugSeparator, type text_StringDistanceMode as StringDistanceMode, type text_StringDistanceResult as StringDistanceResult, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, text_addBorder as addBorder, text_analyzeKeywordDensity as analyzeKeywordDensity, text_analyzeSentenceLengths as analyzeSentenceLengths, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_calculateStringDistance as calculateStringDistance, text_centerText as centerText, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectFillerWords as detectFillerWords, text_detectPassiveVoice as detectPassiveVoice, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getEmojiByCategory as getEmojiByCategory, text_getEmojiByChar as getEmojiByChar, text_getEmojiByShortcode as getEmojiByShortcode, text_getEmojiCategories as getEmojiCategories, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_searchEmoji as searchEmoji, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
571
+ export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_EMOJI_TABLE as EMOJI_TABLE, text_ESCAPE_MODES as ESCAPE_MODES, type text_EmojiEntry as EmojiEntry, type text_EscapeMode as EscapeMode, type text_FillerCategory as FillerCategory, type text_FillerMatch as FillerMatch, type text_FillerWordResult as FillerWordResult, type text_KeywordDensityEntry as KeywordDensityEntry, type text_KeywordDensityOptions as KeywordDensityOptions, type text_KeywordDensityResult as KeywordDensityResult, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_OxfordCommaInstance as OxfordCommaInstance, type text_OxfordCommaResult as OxfordCommaResult, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SentenceLengthBucket as SentenceLengthBucket, type text_SentenceLengthDistribution as SentenceLengthDistribution, type text_SlugSeparator as SlugSeparator, type text_StringDistanceMode as StringDistanceMode, type text_StringDistanceResult as StringDistanceResult, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, type text_WordyPhraseMatch as WordyPhraseMatch, type text_WordyPhraseResult as WordyPhraseResult, text_addBorder as addBorder, text_analyzeKeywordDensity as analyzeKeywordDensity, text_analyzeSentenceLengths as analyzeSentenceLengths, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_calculateStringDistance as calculateStringDistance, text_centerText as centerText, text_checkOxfordCommaConsistency as checkOxfordCommaConsistency, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectFillerWords as detectFillerWords, text_detectPassiveVoice as detectPassiveVoice, text_detectWordyPhrases as detectWordyPhrases, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getEmojiByCategory as getEmojiByCategory, text_getEmojiByChar as getEmojiByChar, text_getEmojiByShortcode as getEmojiByShortcode, text_getEmojiCategories as getEmojiCategories, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_searchEmoji as searchEmoji, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
519
572
  }
520
573
 
521
- export { convertAll as $, type AsciiFont as A, type ReadabilityScore as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, EMOJI_TABLE as E, type FillerCategory as F, type SentenceLengthDistribution as G, type SlugSeparator as H, type StringDistanceMode as I, type StringDistanceResult as J, type KeywordDensityEntry as K, LINE_OPS as L, MORSE_CODE as M, type TextAnalysis as N, addBorder as O, type ParsedDiff as P, analyzeKeywordDensity as Q, type ReadabilityResult as R, type SentenceLengthBucket as S, type TableOptions as T, analyzeSentenceLengths as U, analyzeText as V, type WordCountResult as W, applyOp as X, applyOps as Y, calculateStringDistance as Z, centerText as _, type AsciiOptions as a, convertCase as a0, countWords as a1, csvToHtml as a2, csvToMarkdown as a3, detectDelimiter as a4, detectFillerWords as a5, detectPassiveVoice as a6, diffLines as a7, diffLinesSimple as a8, diffStats as a9, parseDiff as aA, parseTableData as aB, readabilityScore as aC, renderMarkdown as aD, romanToNumber as aE, scoreReadability as aF, searchEmoji as aG, sentenceCount as aH, slugify as aI, slugifyAll as aJ, syllableCount as aK, textToAscii as aL, textToMorse as aM, unescapeString as aN, wordFrequency as aO, escapeAll as aa, escapeString as ab, extractHeadings as ac, formatReadingTime as ad, generate as ae, generateDiff as af, generateHtmlTable as ag, generateMarkdownTable as ah, generateParagraphs as ai, generateSentences as aj, generateWords as ak, getAvailableFonts as al, getEmojiByCategory as am, getEmojiByChar as an, getEmojiByShortcode as ao, getEmojiCategories as ap, getMorseForChar as aq, getMorseTiming as ar, htmlToMarkdown as as, isValidMorse as at, markdownToHtml as au, morseToText as av, numberToOrdinal as aw, numberToRoman as ax, numberToWords as ay, ordinalWords as az, type CaseFormat as b, type ConvertOptions as c, type DiffFile as d, type DiffHunk as e, type DiffLine as f, type DiffResult as g, type DiffType as h, type DiffViewerLine as i, ESCAPE_MODES as j, type EmojiEntry as k, type EscapeMode as l, type FillerMatch as m, type FillerWordResult as n, type KeywordDensityOptions as o, type KeywordDensityResult as p, type LineOp as q, type LineType as r, type LoremUnit as s, text as t, type MarkdownResult as u, type MorseOptions as v, type ParsedTable as w, type PassiveVoiceMatch as x, type PassiveVoiceResult as y, type PassiveVoiceSentence as z };
574
+ export { applyOp as $, type AsciiFont as A, type PassiveVoiceSentence as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, EMOJI_TABLE as E, type FillerCategory as F, type ReadabilityScore as G, type SentenceLengthDistribution as H, type SlugSeparator as I, type StringDistanceMode as J, type KeywordDensityEntry as K, LINE_OPS as L, MORSE_CODE as M, type StringDistanceResult as N, type OxfordCommaInstance as O, type ParsedDiff as P, type TextAnalysis as Q, type ReadabilityResult as R, type SentenceLengthBucket as S, type TableOptions as T, type WordyPhraseMatch as U, type WordyPhraseResult as V, type WordCountResult as W, addBorder as X, analyzeKeywordDensity as Y, analyzeSentenceLengths as Z, analyzeText as _, type AsciiOptions as a, applyOps as a0, calculateStringDistance as a1, centerText as a2, checkOxfordCommaConsistency as a3, convertAll as a4, convertCase as a5, countWords as a6, csvToHtml as a7, csvToMarkdown as a8, detectDelimiter as a9, markdownToHtml as aA, morseToText as aB, numberToOrdinal as aC, numberToRoman as aD, numberToWords as aE, ordinalWords as aF, parseDiff as aG, parseTableData as aH, readabilityScore as aI, renderMarkdown as aJ, romanToNumber as aK, scoreReadability as aL, searchEmoji as aM, sentenceCount as aN, slugify as aO, slugifyAll as aP, syllableCount as aQ, textToAscii as aR, textToMorse as aS, unescapeString as aT, wordFrequency as aU, detectFillerWords as aa, detectPassiveVoice as ab, detectWordyPhrases as ac, diffLines as ad, diffLinesSimple as ae, diffStats as af, escapeAll as ag, escapeString as ah, extractHeadings as ai, formatReadingTime as aj, generate as ak, generateDiff as al, generateHtmlTable as am, generateMarkdownTable as an, generateParagraphs as ao, generateSentences as ap, generateWords as aq, getAvailableFonts as ar, getEmojiByCategory as as, getEmojiByChar as at, getEmojiByShortcode as au, getEmojiCategories as av, getMorseForChar as aw, getMorseTiming as ax, htmlToMarkdown as ay, isValidMorse as az, type CaseFormat as b, type ConvertOptions as c, type DiffFile as d, type DiffHunk as e, type DiffLine as f, type DiffResult as g, type DiffType as h, type DiffViewerLine as i, ESCAPE_MODES as j, type EmojiEntry as k, type EscapeMode as l, type FillerMatch as m, type FillerWordResult as n, type KeywordDensityOptions as o, type KeywordDensityResult as p, type LineOp as q, type LineType as r, type LoremUnit as s, text as t, type MarkdownResult as u, type MorseOptions as v, type OxfordCommaResult as w, type ParsedTable as x, type PassiveVoiceMatch as y, type PassiveVoiceResult as z };
@@ -1334,6 +1334,40 @@ function generateTotp(secret, options = {}) {
1334
1334
  const secondsRemaining = periodSeconds - timestamp % periodSeconds;
1335
1335
  return { ...hotp, periodSeconds, secondsRemaining };
1336
1336
  }
1337
+ var WEBHOOK_HASH_ALGORITHMS = ["sha1", "sha256", "sha512"];
1338
+ function constantTimeEqual(a, b) {
1339
+ if (a.length !== b.length) return false;
1340
+ let diff = 0;
1341
+ for (let i = 0; i < a.length; i++) diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
1342
+ return diff === 0;
1343
+ }
1344
+ function verifyWebhookSignature(payload, secret, signature, algorithm = "sha256") {
1345
+ if (!payload) return { error: "Payload is required" };
1346
+ if (!secret) return { error: "Secret is required" };
1347
+ if (!signature || !signature.trim()) return { error: "Signature is required" };
1348
+ if (!WEBHOOK_HASH_ALGORITHMS.includes(algorithm)) {
1349
+ return { error: "Algorithm must be one of sha1, sha256, sha512" };
1350
+ }
1351
+ const trimmedSignature = signature.trim();
1352
+ const prefixMatch = trimmedSignature.match(/^(sha1|sha256|sha512)=(.+)$/i);
1353
+ const providedSignature = prefixMatch ? prefixMatch[2].trim() : trimmedSignature;
1354
+ const expectedHex = crypto.createHmac(algorithm, secret).update(payload, "utf8").digest("hex");
1355
+ const expectedBase64 = crypto.createHmac(algorithm, secret).update(payload, "utf8").digest("base64");
1356
+ let matchedEncoding = null;
1357
+ if (constantTimeEqual(providedSignature.toLowerCase(), expectedHex.toLowerCase())) {
1358
+ matchedEncoding = "hex";
1359
+ } else if (constantTimeEqual(providedSignature, expectedBase64)) {
1360
+ matchedEncoding = "base64";
1361
+ }
1362
+ return {
1363
+ valid: matchedEncoding !== null,
1364
+ algorithm,
1365
+ expectedHex,
1366
+ expectedBase64,
1367
+ providedSignature: trimmedSignature,
1368
+ matchedEncoding
1369
+ };
1370
+ }
1337
1371
 
1338
1372
  exports.COMMON_HEADERS = COMMON_HEADERS;
1339
1373
  exports.COMMON_PRESETS = COMMON_PRESETS;
@@ -1378,3 +1412,4 @@ exports.signJwt = signJwt;
1378
1412
  exports.validateCorsConfig = validateCorsConfig;
1379
1413
  exports.validateCspConfig = validateCspConfig;
1380
1414
  exports.validateOgTags = validateOgTags;
1415
+ exports.verifyWebhookSignature = verifyWebhookSignature;
@@ -1 +1 @@
1
- export { C as COMMON_HEADERS, b as COMMON_PRESETS, c as CORS_COMMON_HEADERS, d as CorsConfig, e as CorsOutput, f as CspConfig, g as CspDirective, h as CspSource, i as CurlCommand, j as CurlConfig, D as DEFAULT_CORS_CONFIG, k as DIRECTIVE_DESCRIPTIONS, l as DirectiveConfig, F as FormatResult, H as HTTP_METHODS, m as Header, n as HotpResult, o as HttpMethod, J as JwkSummary, p as JwkThumbprintErrorResult, q as JwkThumbprintHash, r as JwkThumbprintOutcome, s as JwkThumbprintResult, t as JwksError, u as JwksParseResult, v as JwksResult, w as JwtAlgorithm, x as JwtDecodeError, y as JwtDecodeResult, z as JwtExpiry, A as JwtPart, B as JwtResult, E as JwtSignOptions, M as MetaTags, O as OgTags, G as OtpAlgorithm, I as OtpOptions, P as ParsedUrl, R as ResponseFormat, S as SUPPORTED_LANGUAGES, T as TargetLanguage, K as TotpOptions, L as TotpResult, N as TwitterTags, Q as addParam, U as base64urlDecode, V as base64urlEncode, W as buildCurl, X as buildCurlMultiline, Y as buildUrl, Z as computeJwkThumbprint, _ as convertToCode, $ as decodeJwt, a0 as decodeUrlComponent, a1 as detectFormat, a2 as encodeUrlComponent, a3 as extractJsonPaths, a4 as formatJwtJson, a5 as formatResponse, a6 as generateCors, a7 as generateCspHeader, a8 as generateFullHeader, a9 as generateHotp, aa as generateMetaHtml, ab as generateTotp, ac as getParam, ad as getStats, ae as isValidUrl, af as normalizeUrl, ag as parseCspHeader, ah as parseCurl, ai as parseCurlCommand, aj as parseJwks, ak as parseMetaTags, al as parseUrl, am as removeParam, an as signJwt, ao as validateCorsConfig, ap as validateCspConfig, aq as validateOgTags } from '../api-C8rImfka.cjs';
1
+ export { C as COMMON_HEADERS, b as COMMON_PRESETS, c as CORS_COMMON_HEADERS, d as CorsConfig, e as CorsOutput, f as CspConfig, g as CspDirective, h as CspSource, i as CurlCommand, j as CurlConfig, D as DEFAULT_CORS_CONFIG, k as DIRECTIVE_DESCRIPTIONS, l as DirectiveConfig, F as FormatResult, H as HTTP_METHODS, m as Header, n as HotpResult, o as HttpMethod, J as JwkSummary, p as JwkThumbprintErrorResult, q as JwkThumbprintHash, r as JwkThumbprintOutcome, s as JwkThumbprintResult, t as JwksError, u as JwksParseResult, v as JwksResult, w as JwtAlgorithm, x as JwtDecodeError, y as JwtDecodeResult, z as JwtExpiry, A as JwtPart, B as JwtResult, E as JwtSignOptions, M as MetaTags, O as OgTags, G as OtpAlgorithm, I as OtpOptions, P as ParsedUrl, R as ResponseFormat, S as SUPPORTED_LANGUAGES, T as TargetLanguage, K as TotpOptions, L as TotpResult, N as TwitterTags, W as WebhookHashAlgorithm, Q as WebhookSignatureResult, U as addParam, V as base64urlDecode, X as base64urlEncode, Y as buildCurl, Z as buildCurlMultiline, _ as buildUrl, $ as computeJwkThumbprint, a0 as convertToCode, a1 as decodeJwt, a2 as decodeUrlComponent, a3 as detectFormat, a4 as encodeUrlComponent, a5 as extractJsonPaths, a6 as formatJwtJson, a7 as formatResponse, a8 as generateCors, a9 as generateCspHeader, aa as generateFullHeader, ab as generateHotp, ac as generateMetaHtml, ad as generateTotp, ae as getParam, af as getStats, ag as isValidUrl, ah as normalizeUrl, ai as parseCspHeader, aj as parseCurl, ak as parseCurlCommand, al as parseJwks, am as parseMetaTags, an as parseUrl, ao as removeParam, ap as signJwt, aq as validateCorsConfig, ar as validateCspConfig, as as validateOgTags, at as verifyWebhookSignature } from '../api-CQnIUrVB.cjs';
@@ -1 +1 @@
1
- export { C as COMMON_HEADERS, b as COMMON_PRESETS, c as CORS_COMMON_HEADERS, d as CorsConfig, e as CorsOutput, f as CspConfig, g as CspDirective, h as CspSource, i as CurlCommand, j as CurlConfig, D as DEFAULT_CORS_CONFIG, k as DIRECTIVE_DESCRIPTIONS, l as DirectiveConfig, F as FormatResult, H as HTTP_METHODS, m as Header, n as HotpResult, o as HttpMethod, J as JwkSummary, p as JwkThumbprintErrorResult, q as JwkThumbprintHash, r as JwkThumbprintOutcome, s as JwkThumbprintResult, t as JwksError, u as JwksParseResult, v as JwksResult, w as JwtAlgorithm, x as JwtDecodeError, y as JwtDecodeResult, z as JwtExpiry, A as JwtPart, B as JwtResult, E as JwtSignOptions, M as MetaTags, O as OgTags, G as OtpAlgorithm, I as OtpOptions, P as ParsedUrl, R as ResponseFormat, S as SUPPORTED_LANGUAGES, T as TargetLanguage, K as TotpOptions, L as TotpResult, N as TwitterTags, Q as addParam, U as base64urlDecode, V as base64urlEncode, W as buildCurl, X as buildCurlMultiline, Y as buildUrl, Z as computeJwkThumbprint, _ as convertToCode, $ as decodeJwt, a0 as decodeUrlComponent, a1 as detectFormat, a2 as encodeUrlComponent, a3 as extractJsonPaths, a4 as formatJwtJson, a5 as formatResponse, a6 as generateCors, a7 as generateCspHeader, a8 as generateFullHeader, a9 as generateHotp, aa as generateMetaHtml, ab as generateTotp, ac as getParam, ad as getStats, ae as isValidUrl, af as normalizeUrl, ag as parseCspHeader, ah as parseCurl, ai as parseCurlCommand, aj as parseJwks, ak as parseMetaTags, al as parseUrl, am as removeParam, an as signJwt, ao as validateCorsConfig, ap as validateCspConfig, aq as validateOgTags } from '../api-C8rImfka.js';
1
+ export { C as COMMON_HEADERS, b as COMMON_PRESETS, c as CORS_COMMON_HEADERS, d as CorsConfig, e as CorsOutput, f as CspConfig, g as CspDirective, h as CspSource, i as CurlCommand, j as CurlConfig, D as DEFAULT_CORS_CONFIG, k as DIRECTIVE_DESCRIPTIONS, l as DirectiveConfig, F as FormatResult, H as HTTP_METHODS, m as Header, n as HotpResult, o as HttpMethod, J as JwkSummary, p as JwkThumbprintErrorResult, q as JwkThumbprintHash, r as JwkThumbprintOutcome, s as JwkThumbprintResult, t as JwksError, u as JwksParseResult, v as JwksResult, w as JwtAlgorithm, x as JwtDecodeError, y as JwtDecodeResult, z as JwtExpiry, A as JwtPart, B as JwtResult, E as JwtSignOptions, M as MetaTags, O as OgTags, G as OtpAlgorithm, I as OtpOptions, P as ParsedUrl, R as ResponseFormat, S as SUPPORTED_LANGUAGES, T as TargetLanguage, K as TotpOptions, L as TotpResult, N as TwitterTags, W as WebhookHashAlgorithm, Q as WebhookSignatureResult, U as addParam, V as base64urlDecode, X as base64urlEncode, Y as buildCurl, Z as buildCurlMultiline, _ as buildUrl, $ as computeJwkThumbprint, a0 as convertToCode, a1 as decodeJwt, a2 as decodeUrlComponent, a3 as detectFormat, a4 as encodeUrlComponent, a5 as extractJsonPaths, a6 as formatJwtJson, a7 as formatResponse, a8 as generateCors, a9 as generateCspHeader, aa as generateFullHeader, ab as generateHotp, ac as generateMetaHtml, ad as generateTotp, ae as getParam, af as getStats, ag as isValidUrl, ah as normalizeUrl, ai as parseCspHeader, aj as parseCurl, ak as parseCurlCommand, al as parseJwks, am as parseMetaTags, an as parseUrl, ao as removeParam, ap as signJwt, aq as validateCorsConfig, ar as validateCspConfig, as as validateOgTags, at as verifyWebhookSignature } from '../api-CQnIUrVB.js';
package/dist/tools/api.js CHANGED
@@ -1,2 +1,2 @@
1
- export { COMMON_HEADERS, COMMON_PRESETS, CORS_COMMON_HEADERS, DEFAULT_CORS_CONFIG, DIRECTIVE_DESCRIPTIONS, HTTP_METHODS, SUPPORTED_LANGUAGES, addParam, base64urlDecode, base64urlEncode, buildCurl, buildCurlMultiline, buildUrl, computeJwkThumbprint, convertToCode, decodeJwt, decodeUrlComponent, detectFormat, encodeUrlComponent, extractJsonPaths, formatJwtJson, formatResponse, generateCors, generateCspHeader, generateFullHeader, generateHotp, generateMetaHtml, generateTotp, getParam, getStats, isValidUrl, normalizeUrl, parseCspHeader, parseCurl, parseCurlCommand, parseJwks, parseMetaTags, parseUrl, removeParam, signJwt, validateCorsConfig, validateCspConfig, validateOgTags } from '../chunk-4S63T7Y4.js';
1
+ export { COMMON_HEADERS, COMMON_PRESETS, CORS_COMMON_HEADERS, DEFAULT_CORS_CONFIG, DIRECTIVE_DESCRIPTIONS, HTTP_METHODS, SUPPORTED_LANGUAGES, addParam, base64urlDecode, base64urlEncode, buildCurl, buildCurlMultiline, buildUrl, computeJwkThumbprint, convertToCode, decodeJwt, decodeUrlComponent, detectFormat, encodeUrlComponent, extractJsonPaths, formatJwtJson, formatResponse, generateCors, generateCspHeader, generateFullHeader, generateHotp, generateMetaHtml, generateTotp, getParam, getStats, isValidUrl, normalizeUrl, parseCspHeader, parseCurl, parseCurlCommand, parseJwks, parseMetaTags, parseUrl, removeParam, signJwt, validateCorsConfig, validateCspConfig, validateOgTags, verifyWebhookSignature } from '../chunk-U2HREMZU.js';
2
2
  import '../chunk-MLKGABMK.js';