@discordeno/utils 19.0.0-next.fd518cb → 19.0.0-next.fda3003

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 (124) hide show
  1. package/dist/cjs/Collection.cjs +123 -0
  2. package/dist/cjs/base64.cjs +276 -0
  3. package/dist/cjs/bucket.cjs +96 -0
  4. package/dist/cjs/builders/embeds.cjs +292 -0
  5. package/dist/cjs/builders.cjs +27 -0
  6. package/dist/cjs/casing.cjs +75 -0
  7. package/dist/cjs/colors.cjs +456 -0
  8. package/dist/cjs/hash.cjs +37 -0
  9. package/dist/cjs/images.cjs +136 -0
  10. package/dist/cjs/index.cjs +35 -0
  11. package/dist/cjs/logger.cjs +157 -0
  12. package/dist/cjs/oauth2.cjs +26 -0
  13. package/dist/cjs/permissions.cjs +35 -0
  14. package/dist/cjs/reactions.cjs +21 -0
  15. package/dist/cjs/token.cjs +39 -0
  16. package/dist/cjs/typeguards.cjs +45 -0
  17. package/dist/cjs/urlToBase64.cjs +19 -0
  18. package/dist/cjs/utils.cjs +30 -0
  19. package/dist/esm/Collection.js +113 -0
  20. package/dist/esm/base64.js +262 -0
  21. package/dist/esm/bucket.js +81 -0
  22. package/dist/esm/builders/embeds.js +295 -0
  23. package/dist/esm/builders.js +5 -0
  24. package/dist/esm/casing.js +51 -0
  25. package/dist/esm/colors.js +467 -0
  26. package/dist/esm/hash.js +19 -0
  27. package/dist/esm/images.js +179 -0
  28. package/dist/esm/index.js +18 -0
  29. package/dist/esm/logger.js +130 -0
  30. package/dist/esm/oauth2.js +16 -0
  31. package/dist/esm/permissions.js +17 -0
  32. package/dist/esm/reactions.js +11 -0
  33. package/dist/esm/token.js +21 -0
  34. package/dist/esm/typeguards.js +18 -0
  35. package/dist/esm/urlToBase64.js +9 -0
  36. package/dist/esm/utils.js +15 -0
  37. package/dist/tsconfig.tsbuildinfo +1 -0
  38. package/dist/{Collection.d.ts → types/Collection.d.ts} +2 -2
  39. package/dist/types/Collection.d.ts.map +1 -0
  40. package/dist/types/base64.d.ts.map +1 -0
  41. package/dist/{bucket.d.ts → types/bucket.d.ts} +9 -1
  42. package/dist/types/bucket.d.ts.map +1 -0
  43. package/dist/types/builders/embeds.d.ts +146 -0
  44. package/dist/types/builders/embeds.d.ts.map +1 -0
  45. package/dist/types/builders.d.ts +4 -0
  46. package/dist/types/builders.d.ts.map +1 -0
  47. package/dist/types/casing.d.ts.map +1 -0
  48. package/dist/types/colors.d.ts.map +1 -0
  49. package/dist/types/hash.d.ts.map +1 -0
  50. package/dist/types/images.d.ts +202 -0
  51. package/dist/types/images.d.ts.map +1 -0
  52. package/dist/{index.d.ts → types/index.d.ts} +3 -1
  53. package/dist/types/index.d.ts.map +1 -0
  54. package/dist/types/logger.d.ts.map +1 -0
  55. package/dist/types/oauth2.d.ts +69 -0
  56. package/dist/types/oauth2.d.ts.map +1 -0
  57. package/dist/types/permissions.d.ts.map +1 -0
  58. package/dist/types/reactions.d.ts.map +1 -0
  59. package/dist/{token.d.ts → types/token.d.ts} +1 -1
  60. package/dist/types/token.d.ts.map +1 -0
  61. package/dist/{typeguards.d.ts → types/typeguards.d.ts} +2 -1
  62. package/dist/types/typeguards.d.ts.map +1 -0
  63. package/dist/types/urlToBase64.d.ts.map +1 -0
  64. package/dist/types/utils.d.ts.map +1 -0
  65. package/package.json +26 -20
  66. package/dist/Collection.d.ts.map +0 -1
  67. package/dist/Collection.js +0 -113
  68. package/dist/Collection.js.map +0 -1
  69. package/dist/base64.d.ts.map +0 -1
  70. package/dist/base64.js +0 -262
  71. package/dist/base64.js.map +0 -1
  72. package/dist/bucket.d.ts.map +0 -1
  73. package/dist/bucket.js +0 -74
  74. package/dist/bucket.js.map +0 -1
  75. package/dist/casing.d.ts.map +0 -1
  76. package/dist/casing.js +0 -51
  77. package/dist/casing.js.map +0 -1
  78. package/dist/colors.d.ts.map +0 -1
  79. package/dist/colors.js +0 -467
  80. package/dist/colors.js.map +0 -1
  81. package/dist/hash.d.ts.map +0 -1
  82. package/dist/hash.js +0 -19
  83. package/dist/hash.js.map +0 -1
  84. package/dist/images.d.ts +0 -68
  85. package/dist/images.d.ts.map +0 -1
  86. package/dist/images.js +0 -66
  87. package/dist/images.js.map +0 -1
  88. package/dist/index.d.ts.map +0 -1
  89. package/dist/index.js +0 -16
  90. package/dist/index.js.map +0 -1
  91. package/dist/interactions.d.ts +0 -3
  92. package/dist/interactions.d.ts.map +0 -1
  93. package/dist/interactions.js +0 -41
  94. package/dist/interactions.js.map +0 -1
  95. package/dist/logger.d.ts.map +0 -1
  96. package/dist/logger.js +0 -130
  97. package/dist/logger.js.map +0 -1
  98. package/dist/permissions.d.ts.map +0 -1
  99. package/dist/permissions.js +0 -17
  100. package/dist/permissions.js.map +0 -1
  101. package/dist/reactions.d.ts.map +0 -1
  102. package/dist/reactions.js +0 -11
  103. package/dist/reactions.js.map +0 -1
  104. package/dist/token.d.ts.map +0 -1
  105. package/dist/token.js +0 -16
  106. package/dist/token.js.map +0 -1
  107. package/dist/typeguards.d.ts.map +0 -1
  108. package/dist/typeguards.js +0 -15
  109. package/dist/typeguards.js.map +0 -1
  110. package/dist/urlToBase64.d.ts.map +0 -1
  111. package/dist/urlToBase64.js +0 -9
  112. package/dist/urlToBase64.js.map +0 -1
  113. package/dist/utils.d.ts.map +0 -1
  114. package/dist/utils.js +0 -15
  115. package/dist/utils.js.map +0 -1
  116. /package/dist/{base64.d.ts → types/base64.d.ts} +0 -0
  117. /package/dist/{casing.d.ts → types/casing.d.ts} +0 -0
  118. /package/dist/{colors.d.ts → types/colors.d.ts} +0 -0
  119. /package/dist/{hash.d.ts → types/hash.d.ts} +0 -0
  120. /package/dist/{logger.d.ts → types/logger.d.ts} +0 -0
  121. /package/dist/{permissions.d.ts → types/permissions.d.ts} +0 -0
  122. /package/dist/{reactions.d.ts → types/reactions.d.ts} +0 -0
  123. /package/dist/{urlToBase64.d.ts → types/urlToBase64.d.ts} +0 -0
  124. /package/dist/{utils.d.ts → types/utils.d.ts} +0 -0
package/dist/bucket.js DELETED
@@ -1,74 +0,0 @@
1
- import logger from './logger.js';
2
- import { delay } from './utils.js';
3
- export class LeakyBucket {
4
- constructor(options){
5
- /** The amount of requests that have been used up already. */ this.used = 0;
6
- /** The queue of requests to acquire an available request. Mapped by <shardId, resolve()> */ this.queue = [];
7
- /** Whether or not the queue is already processing. */ this.processing = false;
8
- this.max = options?.max ?? 1;
9
- this.refillAmount = options?.refillAmount ? options.refillAmount > this.max ? this.max : options.refillAmount : 1;
10
- this.refillInterval = options?.refillInterval ?? 5000;
11
- }
12
- /** The amount of requests that still remain. */ get remaining() {
13
- return this.max < this.used ? 0 : this.max - this.used;
14
- }
15
- /** Refills the bucket as needed. */ refillBucket() {
16
- logger.debug(`[LeakyBucket] Timeout for leaky bucket requests executed. Refilling bucket.`);
17
- // Lower the used amount by the refill amount
18
- this.used = this.refillAmount > this.used ? 0 : this.used - this.refillAmount;
19
- // Reset the refillsAt timestamp since it just got refilled
20
- this.refillsAt = undefined;
21
- if (this.used > 0) {
22
- if (this.timeoutId) clearTimeout(this.timeoutId);
23
- this.timeoutId = setTimeout(()=>{
24
- this.refillBucket();
25
- }, this.refillInterval);
26
- this.refillsAt = Date.now() + this.refillInterval;
27
- }
28
- }
29
- /** Begin processing the queue. */ async processQueue() {
30
- logger.debug('[Gateway] Processing queue');
31
- // There is already a queue that is processing
32
- if (this.processing) return logger.debug('[Gateway] Queue is already processing.');
33
- // Begin going through the queue.
34
- while(this.queue.length){
35
- if (this.remaining) {
36
- logger.debug(`[LeakyBucket] Processing queue. Remaining: ${this.remaining} Length: ${this.queue.length}`);
37
- // Resolves the promise allowing the paused execution of this request to resolve and continue.
38
- this.queue.shift()?.();
39
- // A request can be made
40
- this.used++;
41
- // Create a new timeout for this request if none exists.
42
- if (!this.timeoutId) {
43
- logger.debug(`[LeakyBucket] Creating new timeout for leaky bucket requests.`);
44
- this.timeoutId = setTimeout(()=>{
45
- this.refillBucket();
46
- }, this.refillInterval);
47
- // Set the time for when this refill will occur.
48
- this.refillsAt = Date.now() + this.refillInterval;
49
- }
50
- } else if (this.refillsAt) {
51
- const now = Date.now();
52
- // If there is time left until next refill, just delay execution.
53
- if (this.refillsAt > now) {
54
- logger.debug(`[LeakyBucket] Delaying execution of leaky bucket requests for ${this.refillsAt - now}ms`);
55
- await delay(this.refillsAt - now);
56
- logger.debug(`[LeakyBucket] Resuming execution`);
57
- }
58
- }
59
- }
60
- // Loop has ended mark false so it can restart later when needed
61
- this.processing = false;
62
- }
63
- /** Pauses the execution until the request is available to be made. */ async acquire(highPriority) {
64
- return await new Promise((resolve)=>{
65
- // High priority requests get added to the start of the queue
66
- if (highPriority) this.queue.unshift(resolve);
67
- else this.queue.push(resolve);
68
- // Each request should trigger the queue to be processesd.
69
- void this.processQueue();
70
- });
71
- }
72
- }
73
-
74
- //# sourceMappingURL=bucket.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/bucket.ts"],"sourcesContent":["import logger from './logger.js'\nimport { delay } from './utils.js'\n\nexport class LeakyBucket implements LeakyBucketOptions {\n max: number\n refillInterval: number\n refillAmount: number\n\n /** The amount of requests that have been used up already. */\n used: number = 0\n /** The queue of requests to acquire an available request. Mapped by <shardId, resolve()> */\n queue: Array<(value: void | PromiseLike<void>) => void> = []\n /** Whether or not the queue is already processing. */\n processing: boolean = false\n /** The timeout id for the timer to reduce the used amount by the refill amount. */\n timeoutId?: NodeJS.Timeout\n /** The timestamp in milliseconds when the next refill is scheduled. */\n refillsAt?: number\n\n constructor(options?: LeakyBucketOptions) {\n this.max = options?.max ?? 1\n this.refillAmount = options?.refillAmount ? (options.refillAmount > this.max ? this.max : options.refillAmount) : 1\n this.refillInterval = options?.refillInterval ?? 5000\n }\n\n /** The amount of requests that still remain. */\n get remaining(): number {\n return this.max < this.used ? 0 : this.max - this.used\n }\n\n /** Refills the bucket as needed. */\n refillBucket(): void {\n logger.debug(`[LeakyBucket] Timeout for leaky bucket requests executed. Refilling bucket.`)\n // Lower the used amount by the refill amount\n this.used = this.refillAmount > this.used ? 0 : this.used - this.refillAmount\n // Reset the refillsAt timestamp since it just got refilled\n this.refillsAt = undefined\n\n if (this.used > 0) {\n if (this.timeoutId) clearTimeout(this.timeoutId)\n this.timeoutId = setTimeout(() => {\n this.refillBucket()\n }, this.refillInterval)\n this.refillsAt = Date.now() + this.refillInterval\n }\n }\n\n /** Begin processing the queue. */\n async processQueue(): Promise<void> {\n logger.debug('[Gateway] Processing queue')\n // There is already a queue that is processing\n if (this.processing) return logger.debug('[Gateway] Queue is already processing.')\n\n // Begin going through the queue.\n while (this.queue.length) {\n if (this.remaining) {\n logger.debug(`[LeakyBucket] Processing queue. Remaining: ${this.remaining} Length: ${this.queue.length}`)\n // Resolves the promise allowing the paused execution of this request to resolve and continue.\n this.queue.shift()?.()\n // A request can be made\n this.used++\n\n // Create a new timeout for this request if none exists.\n if (!this.timeoutId) {\n logger.debug(`[LeakyBucket] Creating new timeout for leaky bucket requests.`)\n\n this.timeoutId = setTimeout(() => {\n this.refillBucket()\n }, this.refillInterval)\n // Set the time for when this refill will occur.\n this.refillsAt = Date.now() + this.refillInterval\n }\n }\n\n // Check if a refill is scheduled, since we have used up all available requests\n else if (this.refillsAt) {\n const now = Date.now()\n // If there is time left until next refill, just delay execution.\n if (this.refillsAt > now) {\n logger.debug(`[LeakyBucket] Delaying execution of leaky bucket requests for ${this.refillsAt - now}ms`)\n await delay(this.refillsAt - now)\n logger.debug(`[LeakyBucket] Resuming execution`)\n }\n }\n }\n\n // Loop has ended mark false so it can restart later when needed\n this.processing = false\n }\n\n /** Pauses the execution until the request is available to be made. */\n async acquire(highPriority?: boolean): Promise<void> {\n return await new Promise((resolve) => {\n // High priority requests get added to the start of the queue\n if (highPriority) this.queue.unshift(resolve)\n // All other requests get pushed to the end.\n else this.queue.push(resolve)\n\n // Each request should trigger the queue to be processesd.\n void this.processQueue()\n })\n }\n}\n\nexport interface LeakyBucketOptions {\n /**\n * Max requests allowed at once.\n * @default 1\n */\n max?: number\n /**\n * Interval in milliseconds between refills.\n * @default 5000\n */\n refillInterval?: number\n /**\n * Amount of requests to refill at each interval.\n * @default 1\n */\n refillAmount?: number\n}\n"],"names":["logger","delay","LeakyBucket","constructor","options","used","queue","processing","max","refillAmount","refillInterval","remaining","refillBucket","debug","refillsAt","undefined","timeoutId","clearTimeout","setTimeout","Date","now","processQueue","length","shift","acquire","highPriority","Promise","resolve","unshift","push"],"mappings":"AAAA,OAAOA,YAAY,cAAa;AAChC,SAASC,KAAK,QAAQ,aAAY;AAElC,OAAO,MAAMC;IAgBXC,YAAYC,OAA4B,CAAE;QAX1C,2DAA2D,QAC3DC,OAAe;QACf,0FAA0F,QAC1FC,QAA0D,EAAE;QAC5D,oDAAoD,QACpDC,aAAsB,KAAK;QAOzB,IAAI,CAACC,GAAG,GAAGJ,SAASI,OAAO;QAC3B,IAAI,CAACC,YAAY,GAAGL,SAASK,eAAgBL,QAAQK,YAAY,GAAG,IAAI,CAACD,GAAG,GAAG,IAAI,CAACA,GAAG,GAAGJ,QAAQK,YAAY,GAAI,CAAC;QACnH,IAAI,CAACC,cAAc,GAAGN,SAASM,kBAAkB;IACnD;IAEA,8CAA8C,GAC9C,IAAIC,YAAoB;QACtB,OAAO,IAAI,CAACH,GAAG,GAAG,IAAI,CAACH,IAAI,GAAG,IAAI,IAAI,CAACG,GAAG,GAAG,IAAI,CAACH,IAAI;IACxD;IAEA,kCAAkC,GAClCO,eAAqB;QACnBZ,OAAOa,KAAK,CAAC,CAAC,2EAA2E,CAAC;QAC1F,6CAA6C;QAC7C,IAAI,CAACR,IAAI,GAAG,IAAI,CAACI,YAAY,GAAG,IAAI,CAACJ,IAAI,GAAG,IAAI,IAAI,CAACA,IAAI,GAAG,IAAI,CAACI,YAAY;QAC7E,2DAA2D;QAC3D,IAAI,CAACK,SAAS,GAAGC;QAEjB,IAAI,IAAI,CAACV,IAAI,GAAG,GAAG;YACjB,IAAI,IAAI,CAACW,SAAS,EAAEC,aAAa,IA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CAACa,SAAS,GAAGM;oBAC7BpB,OAAOa,KAAK,CAAC,CAAC,gCAAgC,CAAC;gBACjD,CAAC;YACH,CAAC;QACH;QAEA,gEAAgE;QAChE,IAAI,CAACN,UAAU,GAAG,KAAK;IACzB;IAEA,oEAAoE,GACpE,MAAMiB,QAAQC,YAAsB,EAAiB;QACnD,OAAO,MAAM,IAAIC,QAAQ,CAACC,UAAY;YACpC,6DAA6D;YAC7D,IAAIF,cAAc,IAAI,CAACnB,KAAK,CAACsB,OAAO,CAACD;iBAEhC,IAAI,CAACrB,KAAK,CAACuB,IAAI,CAACF;YAErB,0DAA0D;YAC1D,KAAK,IAAI,CAACN,YAAY;QACxB;IACF;AACF,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"casing.d.ts","sourceRoot":"","sources":["../src/casing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAE5D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAclD;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAcpD;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAepD;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAapD"}
package/dist/casing.js DELETED
@@ -1,51 +0,0 @@
1
- export function camelize(object) {
2
- if (Array.isArray(object)) {
3
- return object.map((element)=>camelize(element));
4
- }
5
- if (typeof object === 'object' && object !== null) {
6
- const obj = {};
7
- Object.keys(object).forEach((key)=>{
8
- obj[snakeToCamelCase(key)] = camelize(object[key]);
9
- });
10
- return obj;
11
- }
12
- return object;
13
- }
14
- export function snakelize(object) {
15
- if (Array.isArray(object)) {
16
- return object.map((element)=>snakelize(element));
17
- }
18
- if (typeof object === 'object' && object !== null) {
19
- const obj = {};
20
- Object.keys(object).forEach((key)=>{
21
- obj[camelToSnakeCase(key)] = snakelize(object[key]);
22
- });
23
- return obj;
24
- }
25
- return object;
26
- }
27
- export function snakeToCamelCase(str) {
28
- if (!str.includes('_')) return str;
29
- let result = '';
30
- for(let i = 0, len = str.length; i < len; ++i){
31
- if (str[i] === '_') {
32
- result += str[++i].toUpperCase();
33
- continue;
34
- }
35
- result += str[i];
36
- }
37
- return result;
38
- }
39
- export function camelToSnakeCase(str) {
40
- let result = '';
41
- for(let i = 0, len = str.length; i < len; ++i){
42
- if (str[i] >= 'A' && str[i] <= 'Z') {
43
- result += `_${str[i].toLowerCase()}`;
44
- continue;
45
- }
46
- result += str[i];
47
- }
48
- return result;
49
- }
50
-
51
- //# sourceMappingURL=casing.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/casing.ts"],"sourcesContent":["import type { Camelize, Snakelize } from '@discordeno/types'\n\nexport function camelize<T>(object: T): Camelize<T> {\n if (Array.isArray(object)) {\n return object.map((element) => camelize(element)) as Camelize<T>\n }\n\n if (typeof object === 'object' && object !== null) {\n const obj = {} as Camelize<T>\n ;(Object.keys(object) as Array<keyof T>).forEach((key) => {\n // @ts-expect-error js hack\n ;(obj[snakeToCamelCase(key)] as Camelize<(T & object)[keyof T]>) = camelize(object[key])\n })\n return obj\n }\n return object as Camelize<T>\n}\n\nexport function snakelize<T>(object: T): Snakelize<T> {\n if (Array.isArray(object)) {\n return object.map((element) => snakelize(element)) as Snakelize<T>\n }\n\n if (typeof object === 'object' && object !== null) {\n const obj = {} as Snakelize<T>\n ;(Object.keys(object) as Array<keyof T>).forEach((key) => {\n // @ts-expect-error js hack\n ;(obj[camelToSnakeCase(key)] as Snakelize<(T & object)[keyof T]>) = snakelize(object[key])\n })\n return obj\n }\n return object as Snakelize<T>\n}\n\nexport function snakeToCamelCase(str: string): string {\n if (!str.includes('_')) return str\n\n let result = ''\n for (let i = 0, len = str.length; i < len; ++i) {\n if (str[i] === '_') {\n result += str[++i].toUpperCase()\n\n continue\n }\n\n result += str[i]\n }\n\n return result\n}\n\nexport function camelToSnakeCase(str: string): string {\n let result = ''\n for (let i = 0, len = str.length; i < len; ++i) {\n if (str[i] >= 'A' && str[i] <= 'Z') {\n result += `_${str[i].toLowerCase()}`\n\n continue\n }\n\n result += str[i]\n }\n\n return result\n}\n"],"names":["camelize","object","Array","isArray","map","element","obj","Object","keys","forEach","key","snakeToCamelCase","snakelize","camelToSnakeCase","str","includes","result","i","len","length","toUpperCase","toLowerCase"],"mappings":"AAEA,OAAO,SAASA,SAAYC,MAAS,EAAe;IAClD,IAAIC,MAAMC,OAAO,CAACF,SAAS;QACzB,OAAOA,OAAOG,GAAG,CAAC,CAACC,UAAYL,SAASK;IAC1C,CAAC;IAED,IAAI,OAAOJ,WAAW,YAAYA,WAAW,IAAI,EAAE;QACjD,MAAMK,MAAM,CAAC;QACXC,OAAOC,IAAI,CAACP,QAA2BQ,OAAO,CAAC,CAACC,MAAQ;YAEtDJ,GAAG,CAACK,iBAAiBD,KAAK,GAAuCV,SAASC,MAAM,CAACS,IAAI;QACzF;QACA,OAAOJ;IACT,CAAC;IACD,OAAOL;AACT,CAAC;AAED,OAAO,SAASW,UAAaX,MAAS,EAAgB;IACpD,IAAIC,MAAMC,OAAO,CAACF,SAAS;QACzB,OAAOA,OAAOG,GAAG,CAAC,CAACC,UAAYO,UAAUP;IAC3C,CAAC;IAED,IAAI,OAAOJ,WAAW,YAAYA,WAAW,IAAI,EAAE;QACjD,MAAMK,MAAM,CAAC;QACXC,OAAOC,IAAI,CAACP,QAA2BQ,OAAO,CAAC,CAACC,MAAQ;YAEtDJ,GAAG,CAACO,iBAAiBH,KAAK,GAAwCE,UAAUX,MAAM,CAACS,IAAI;QAC3F;QACA,OAAOJ;IACT,CAAC;IACD,OAAOL;AACT,CAAC;AAED,OAAO,SAASU,iBAAiBG,GAAW,EAAU;IACpD,IAAI,CAACA,IAAIC,QAAQ,CAAC,MAAM,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AM,CAEjD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAcD;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAK9D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAKhE;AAWD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEjD"}
package/dist/colors.js DELETED
@@ -1,467 +0,0 @@
1
- /* eslint-disable @typescript-eslint/explicit-function-return-type */ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
2
- // A module to print ANSI terminal colors. Inspired by chalk, kleur, and colors
3
- // on npm.
4
- // https://deno.land/std@0.153.0/fmt/colors.ts?source
5
- let enabled = true;
6
- /**
7
- * Set changing text color to enabled or disabled
8
- * @param value
9
- */ export function setColorEnabled(value) {
10
- enabled = value;
11
- }
12
- /** Get whether text color change is enabled or disabled. */ export function getColorEnabled() {
13
- return enabled;
14
- }
15
- /**
16
- * Builds color code
17
- * @param open
18
- * @param close
19
- */ function code(open, close) {
20
- return {
21
- open: `\x1b[${open.join(';')}m`,
22
- close: `\x1b[${close}m`,
23
- regexp: new RegExp(`\\x1b\\[${close}m`, 'g')
24
- };
25
- }
26
- /**
27
- * Applies color and background based on color code and its associated text
28
- * @param str text to apply color settings to
29
- * @param code color code to apply
30
- */ function run(str, code) {
31
- return enabled ? `${code.open}${str.replace(code.regexp, code.open)}${code.close}` : str;
32
- }
33
- /**
34
- * Reset the text modified
35
- * @param str text to reset
36
- */ export function reset(str) {
37
- return run(str, code([
38
- 0
39
- ], 0));
40
- }
41
- /**
42
- * Make the text bold.
43
- * @param str text to make bold
44
- */ export function bold(str) {
45
- return run(str, code([
46
- 1
47
- ], 22));
48
- }
49
- /**
50
- * The text emits only a small amount of light.
51
- * @param str text to dim
52
- */ export function dim(str) {
53
- return run(str, code([
54
- 2
55
- ], 22));
56
- }
57
- /**
58
- * Make the text italic.
59
- * @param str text to make italic
60
- */ export function italic(str) {
61
- return run(str, code([
62
- 3
63
- ], 23));
64
- }
65
- /**
66
- * Make the text underline.
67
- * @param str text to underline
68
- */ export function underline(str) {
69
- return run(str, code([
70
- 4
71
- ], 24));
72
- }
73
- /**
74
- * Invert background color and text color.
75
- * @param str text to invert its color
76
- */ export function inverse(str) {
77
- return run(str, code([
78
- 7
79
- ], 27));
80
- }
81
- /**
82
- * Make the text hidden.
83
- * @param str text to hide
84
- */ export function hidden(str) {
85
- return run(str, code([
86
- 8
87
- ], 28));
88
- }
89
- /**
90
- * Put horizontal line through the center of the text.
91
- * @param str text to strike through
92
- */ export function strikethrough(str) {
93
- return run(str, code([
94
- 9
95
- ], 29));
96
- }
97
- /**
98
- * Set text color to black.
99
- * @param str text to make black
100
- */ export function black(str) {
101
- return run(str, code([
102
- 30
103
- ], 39));
104
- }
105
- /**
106
- * Set text color to red.
107
- * @param str text to make red
108
- */ export function red(str) {
109
- return run(str, code([
110
- 31
111
- ], 39));
112
- }
113
- /**
114
- * Set text color to green.
115
- * @param str text to make green
116
- */ export function green(str) {
117
- return run(str, code([
118
- 32
119
- ], 39));
120
- }
121
- /**
122
- * Set text color to yellow.
123
- * @param str text to make yellow
124
- */ export function yellow(str) {
125
- return run(str, code([
126
- 33
127
- ], 39));
128
- }
129
- /**
130
- * Set text color to blue.
131
- * @param str text to make blue
132
- */ export function blue(str) {
133
- return run(str, code([
134
- 34
135
- ], 39));
136
- }
137
- /**
138
- * Set text color to magenta.
139
- * @param str text to make magenta
140
- */ export function magenta(str) {
141
- return run(str, code([
142
- 35
143
- ], 39));
144
- }
145
- /**
146
- * Set text color to cyan.
147
- * @param str text to make cyan
148
- */ export function cyan(str) {
149
- return run(str, code([
150
- 36
151
- ], 39));
152
- }
153
- /**
154
- * Set text color to white.
155
- * @param str text to make white
156
- */ export function white(str) {
157
- return run(str, code([
158
- 37
159
- ], 39));
160
- }
161
- /**
162
- * Set text color to gray.
163
- * @param str text to make gray
164
- */ export function gray(str) {
165
- return brightBlack(str);
166
- }
167
- /**
168
- * Set text color to bright black.
169
- * @param str text to make bright-black
170
- */ export function brightBlack(str) {
171
- return run(str, code([
172
- 90
173
- ], 39));
174
- }
175
- /**
176
- * Set text color to bright red.
177
- * @param str text to make bright-red
178
- */ export function brightRed(str) {
179
- return run(str, code([
180
- 91
181
- ], 39));
182
- }
183
- /**
184
- * Set text color to bright green.
185
- * @param str text to make bright-green
186
- */ export function brightGreen(str) {
187
- return run(str, code([
188
- 92
189
- ], 39));
190
- }
191
- /**
192
- * Set text color to bright yellow.
193
- * @param str text to make bright-yellow
194
- */ export function brightYellow(str) {
195
- return run(str, code([
196
- 93
197
- ], 39));
198
- }
199
- /**
200
- * Set text color to bright blue.
201
- * @param str text to make bright-blue
202
- */ export function brightBlue(str) {
203
- return run(str, code([
204
- 94
205
- ], 39));
206
- }
207
- /**
208
- * Set text color to bright magenta.
209
- * @param str text to make bright-magenta
210
- */ export function brightMagenta(str) {
211
- return run(str, code([
212
- 95
213
- ], 39));
214
- }
215
- /**
216
- * Set text color to bright cyan.
217
- * @param str text to make bright-cyan
218
- */ export function brightCyan(str) {
219
- return run(str, code([
220
- 96
221
- ], 39));
222
- }
223
- /**
224
- * Set text color to bright white.
225
- * @param str text to make bright-white
226
- */ export function brightWhite(str) {
227
- return run(str, code([
228
- 97
229
- ], 39));
230
- }
231
- /**
232
- * Set background color to black.
233
- * @param str text to make its background black
234
- */ export function bgBlack(str) {
235
- return run(str, code([
236
- 40
237
- ], 49));
238
- }
239
- /**
240
- * Set background color to red.
241
- * @param str text to make its background red
242
- */ export function bgRed(str) {
243
- return run(str, code([
244
- 41
245
- ], 49));
246
- }
247
- /**
248
- * Set background color to green.
249
- * @param str text to make its background green
250
- */ export function bgGreen(str) {
251
- return run(str, code([
252
- 42
253
- ], 49));
254
- }
255
- /**
256
- * Set background color to yellow.
257
- * @param str text to make its background yellow
258
- */ export function bgYellow(str) {
259
- return run(str, code([
260
- 43
261
- ], 49));
262
- }
263
- /**
264
- * Set background color to blue.
265
- * @param str text to make its background blue
266
- */ export function bgBlue(str) {
267
- return run(str, code([
268
- 44
269
- ], 49));
270
- }
271
- /**
272
- * Set background color to magenta.
273
- * @param str text to make its background magenta
274
- */ export function bgMagenta(str) {
275
- return run(str, code([
276
- 45
277
- ], 49));
278
- }
279
- /**
280
- * Set background color to cyan.
281
- * @param str text to make its background cyan
282
- */ export function bgCyan(str) {
283
- return run(str, code([
284
- 46
285
- ], 49));
286
- }
287
- /**
288
- * Set background color to white.
289
- * @param str text to make its background white
290
- */ export function bgWhite(str) {
291
- return run(str, code([
292
- 47
293
- ], 49));
294
- }
295
- /**
296
- * Set background color to bright black.
297
- * @param str text to make its background bright-black
298
- */ export function bgBrightBlack(str) {
299
- return run(str, code([
300
- 100
301
- ], 49));
302
- }
303
- /**
304
- * Set background color to bright red.
305
- * @param str text to make its background bright-red
306
- */ export function bgBrightRed(str) {
307
- return run(str, code([
308
- 101
309
- ], 49));
310
- }
311
- /**
312
- * Set background color to bright green.
313
- * @param str text to make its background bright-green
314
- */ export function bgBrightGreen(str) {
315
- return run(str, code([
316
- 102
317
- ], 49));
318
- }
319
- /**
320
- * Set background color to bright yellow.
321
- * @param str text to make its background bright-yellow
322
- */ export function bgBrightYellow(str) {
323
- return run(str, code([
324
- 103
325
- ], 49));
326
- }
327
- /**
328
- * Set background color to bright blue.
329
- * @param str text to make its background bright-blue
330
- */ export function bgBrightBlue(str) {
331
- return run(str, code([
332
- 104
333
- ], 49));
334
- }
335
- /**
336
- * Set background color to bright magenta.
337
- * @param str text to make its background bright-magenta
338
- */ export function bgBrightMagenta(str) {
339
- return run(str, code([
340
- 105
341
- ], 49));
342
- }
343
- /**
344
- * Set background color to bright cyan.
345
- * @param str text to make its background bright-cyan
346
- */ export function bgBrightCyan(str) {
347
- return run(str, code([
348
- 106
349
- ], 49));
350
- }
351
- /**
352
- * Set background color to bright white.
353
- * @param str text to make its background bright-white
354
- */ export function bgBrightWhite(str) {
355
- return run(str, code([
356
- 107
357
- ], 49));
358
- }
359
- /* Special Color Sequences */ /**
360
- * Clam and truncate color codes
361
- * @param n
362
- * @param max number to truncate to
363
- * @param min number to truncate from
364
- */ function clampAndTruncate(n, max = 255, min = 0) {
365
- return Math.trunc(Math.max(Math.min(n, max), min));
366
- }
367
- /**
368
- * Set text color using paletted 8bit colors.
369
- * https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
370
- * @param str text color to apply paletted 8bit colors to
371
- * @param color code
372
- */ export function rgb8(str, color) {
373
- return run(str, code([
374
- 38,
375
- 5,
376
- clampAndTruncate(color)
377
- ], 39));
378
- }
379
- /**
380
- * Set background color using paletted 8bit colors.
381
- * https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
382
- * @param str text color to apply paletted 8bit background colors to
383
- * @param color code
384
- */ export function bgRgb8(str, color) {
385
- return run(str, code([
386
- 48,
387
- 5,
388
- clampAndTruncate(color)
389
- ], 49));
390
- }
391
- /**
392
- * Set text color using 24bit rgb.
393
- * `color` can be a number in range `0x000000` to `0xffffff` or
394
- * an `Rgb`.
395
- *
396
- * To produce the color magenta:
397
- *
398
- * ```ts
399
- * import { rgb24 } from "./colors.ts";
400
- * rgb24("foo", 0xff00ff);
401
- * rgb24("foo", {r: 255, g: 0, b: 255});
402
- * ```
403
- * @param str text color to apply 24bit rgb to
404
- * @param color code
405
- */ export function rgb24(str, color) {
406
- if (typeof color === 'number') {
407
- return run(str, code([
408
- 38,
409
- 2,
410
- color >> 16 & 0xff,
411
- color >> 8 & 0xff,
412
- color & 0xff
413
- ], 39));
414
- }
415
- return run(str, code([
416
- 38,
417
- 2,
418
- clampAndTruncate(color.r),
419
- clampAndTruncate(color.g),
420
- clampAndTruncate(color.b)
421
- ], 39));
422
- }
423
- /**
424
- * Set background color using 24bit rgb.
425
- * `color` can be a number in range `0x000000` to `0xffffff` or
426
- * an `Rgb`.
427
- *
428
- * To produce the color magenta:
429
- *
430
- * ```ts
431
- * import { bgRgb24 } from "./colors.ts";
432
- * bgRgb24("foo", 0xff00ff);
433
- * bgRgb24("foo", {r: 255, g: 0, b: 255});
434
- * ```
435
- * @param str text color to apply 24bit rgb to
436
- * @param color code
437
- */ export function bgRgb24(str, color) {
438
- if (typeof color === 'number') {
439
- return run(str, code([
440
- 48,
441
- 2,
442
- color >> 16 & 0xff,
443
- color >> 8 & 0xff,
444
- color & 0xff
445
- ], 49));
446
- }
447
- return run(str, code([
448
- 48,
449
- 2,
450
- clampAndTruncate(color.r),
451
- clampAndTruncate(color.g),
452
- clampAndTruncate(color.b)
453
- ], 49));
454
- }
455
- // https://github.com/chalk/ansi-regex/blob/02fa893d619d3da85411acc8fd4e2eea0e95a9d9/index.js
456
- const ANSI_PATTERN = new RegExp([
457
- '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
458
- '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))'
459
- ].join('|'), 'g');
460
- /**
461
- * Remove ANSI escape codes from the string.
462
- * @param string to remove ANSI escape codes from
463
- */ export function stripColor(string) {
464
- return string.replace(ANSI_PATTERN, '');
465
- }
466
-
467
- //# sourceMappingURL=colors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/colors.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\n\n// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.\n// A module to print ANSI terminal colors. Inspired by chalk, kleur, and colors\n// on npm.\n// https://deno.land/std@0.153.0/fmt/colors.ts?source\n\nexport interface Code {\n open: string\n close: string\n regexp: RegExp\n}\n\n/** RGB 8-bits per channel. Each in range `0->255` or `0x00->0xff` */\nexport interface Rgb {\n r: number\n g: number\n b: number\n}\n\nlet enabled = true\n\n/**\n * Set changing text color to enabled or disabled\n * @param value\n */\nexport function setColorEnabled(value: boolean) {\n enabled = value\n}\n\n/** Get whether text color change is enabled or disabled. */\nexport function getColorEnabled(): boolean {\n return enabled\n}\n\n/**\n * Builds color code\n * @param open\n * @param close\n */\nfunction code(open: number[], close: number): Code {\n return {\n open: `\\x1b[${open.join(';')}m`,\n close: `\\x1b[${close}m`,\n regexp: new RegExp(`\\\\x1b\\\\[${close}m`, 'g'),\n }\n}\n\n/**\n * Applies color and background based on color code and its associated text\n * @param str text to apply color settings to\n * @param code color code to apply\n */\nfunction run(str: string, code: Code): string {\n return enabled ? `${code.open}${str.replace(code.regexp, code.open)}${code.close}` : str\n}\n\n/**\n * Reset the text modified\n * @param str text to reset\n */\nexport function reset(str: string): string {\n return run(str, code([0], 0))\n}\n\n/**\n * Make the text bold.\n * @param str text to make bold\n */\nexport function bold(str: string): string {\n return run(str, code([1], 22))\n}\n\n/**\n * The text emits only a small amount of light.\n * @param str text to dim\n */\nexport function dim(str: string): string {\n return run(str, code([2], 22))\n}\n\n/**\n * Make the text italic.\n * @param str text to make italic\n */\nexport function italic(str: string): string {\n return run(str, code([3], 23))\n}\n\n/**\n * Make the text underline.\n * @param str text to underline\n */\nexport function underline(str: string): string {\n return run(str, code([4], 24))\n}\n\n/**\n * Invert background color and text color.\n * @param str text to invert its color\n */\nexport function inverse(str: string): string {\n return run(str, code([7], 27))\n}\n\n/**\n * Make the text hidden.\n * @param str text to hide\n */\nexport function hidden(str: string): string {\n return run(str, code([8], 28))\n}\n\n/**\n * Put horizontal line through the center of the text.\n * @param str text to strike through\n */\nexport function strikethrough(str: string): string {\n return run(str, code([9], 29))\n}\n\n/**\n * Set text color to black.\n * @param str text to make black\n */\nexport function black(str: string): string {\n return run(str, code([30], 39))\n}\n\n/**\n * Set text color to red.\n * @param str text to make red\n */\nexport function red(str: string): string {\n return run(str, code([31], 39))\n}\n\n/**\n * Set text color to green.\n * @param str text to make green\n */\nexport function green(str: string): string {\n return run(str, code([32], 39))\n}\n\n/**\n * Set text color to yellow.\n * @param str text to make yellow\n */\nexport function yellow(str: string): string {\n return run(str, code([33], 39))\n}\n\n/**\n * Set text color to blue.\n * @param str text to make blue\n */\nexport function blue(str: string): string {\n return run(str, code([34], 39))\n}\n\n/**\n * Set text color to magenta.\n * @param str text to make magenta\n */\nexport function magenta(str: string): string {\n return run(str, code([35], 39))\n}\n\n/**\n * Set text color to cyan.\n * @param str text to make cyan\n */\nexport function cyan(str: string): string {\n return run(str, code([36], 39))\n}\n\n/**\n * Set text color to white.\n * @param str text to make white\n */\nexport function white(str: string): string {\n return run(str, code([37], 39))\n}\n\n/**\n * Set text color to gray.\n * @param str text to make gray\n */\nexport function gray(str: string): string {\n return brightBlack(str)\n}\n\n/**\n * Set text color to bright black.\n * @param str text to make bright-black\n */\nexport function brightBlack(str: string): string {\n return run(str, code([90], 39))\n}\n\n/**\n * Set text color to bright red.\n * @param str text to make bright-red\n */\nexport function brightRed(str: string): string {\n return run(str, code([91], 39))\n}\n\n/**\n * Set text color to bright green.\n * @param str text to make bright-green\n */\nexport function brightGreen(str: string): string {\n return run(str, code([92], 39))\n}\n\n/**\n * Set text color to bright yellow.\n * @param str text to make bright-yellow\n */\nexport function brightYellow(str: string): string {\n return run(str, code([93], 39))\n}\n\n/**\n * Set text color to bright blue.\n * @param str text to make bright-blue\n */\nexport function brightBlue(str: string): string {\n return run(str, code([94], 39))\n}\n\n/**\n * Set text color to bright magenta.\n * @param str text to make bright-magenta\n */\nexport function brightMagenta(str: string): string {\n return run(str, code([95], 39))\n}\n\n/**\n * Set text color to bright cyan.\n * @param str text to make bright-cyan\n */\nexport function brightCyan(str: string): string {\n return run(str, code([96], 39))\n}\n\n/**\n * Set text color to bright white.\n * @param str text to make bright-white\n */\nexport function brightWhite(str: string): string {\n return run(str, code([97], 39))\n}\n\n/**\n * Set background color to black.\n * @param str text to make its background black\n */\nexport function bgBlack(str: string): string {\n return run(str, code([40], 49))\n}\n\n/**\n * Set background color to red.\n * @param str text to make its background red\n */\nexport function bgRed(str: string): string {\n return run(str, code([41], 49))\n}\n\n/**\n * Set background color to green.\n * @param str text to make its background green\n */\nexport function bgGreen(str: string): string {\n return run(str, code([42], 49))\n}\n\n/**\n * Set background color to yellow.\n * @param str text to make its background yellow\n */\nexport function bgYellow(str: string): string {\n return run(str, code([43], 49))\n}\n\n/**\n * Set background color to blue.\n * @param str text to make its background blue\n */\nexport function bgBlue(str: string): string {\n return run(str, code([44], 49))\n}\n\n/**\n * Set background color to magenta.\n * @param str text to make its background magenta\n */\nexport function bgMagenta(str: string): string {\n return run(str, code([45], 49))\n}\n\n/**\n * Set background color to cyan.\n * @param str text to make its background cyan\n */\nexport function bgCyan(str: string): string {\n return run(str, code([46], 49))\n}\n\n/**\n * Set background color to white.\n * @param str text to make its background white\n */\nexport function bgWhite(str: string): string {\n return run(str, code([47], 49))\n}\n\n/**\n * Set background color to bright black.\n * @param str text to make its background bright-black\n */\nexport function bgBrightBlack(str: string): string {\n return run(str, code([100], 49))\n}\n\n/**\n * Set background color to bright red.\n * @param str text to make its background bright-red\n */\nexport function bgBrightRed(str: string): string {\n return run(str, code([101], 49))\n}\n\n/**\n * Set background color to bright green.\n * @param str text to make its background bright-green\n */\nexport function bgBrightGreen(str: string): string {\n return run(str, code([102], 49))\n}\n\n/**\n * Set background color to bright yellow.\n * @param str text to make its background bright-yellow\n */\nexport function bgBrightYellow(str: string): string {\n return run(str, code([103], 49))\n}\n\n/**\n * Set background color to bright blue.\n * @param str text to make its background bright-blue\n */\nexport function bgBrightBlue(str: string): string {\n return run(str, code([104], 49))\n}\n\n/**\n * Set background color to bright magenta.\n * @param str text to make its background bright-magenta\n */\nexport function bgBrightMagenta(str: string): string {\n return run(str, code([105], 49))\n}\n\n/**\n * Set background color to bright cyan.\n * @param str text to make its background bright-cyan\n */\nexport function bgBrightCyan(str: string): string {\n return run(str, code([106], 49))\n}\n\n/**\n * Set background color to bright white.\n * @param str text to make its background bright-white\n */\nexport function bgBrightWhite(str: string): string {\n return run(str, code([107], 49))\n}\n\n/* Special Color Sequences */\n\n/**\n * Clam and truncate color codes\n * @param n\n * @param max number to truncate to\n * @param min number to truncate from\n */\nfunction clampAndTruncate(n: number, max = 255, min = 0): number {\n return Math.trunc(Math.max(Math.min(n, max), min))\n}\n\n/**\n * Set text color using paletted 8bit colors.\n * https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit\n * @param str text color to apply paletted 8bit colors to\n * @param color code\n */\nexport function rgb8(str: string, color: number): string {\n return run(str, code([38, 5, clampAndTruncate(color)], 39))\n}\n\n/**\n * Set background color using paletted 8bit colors.\n * https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit\n * @param str text color to apply paletted 8bit background colors to\n * @param color code\n */\nexport function bgRgb8(str: string, color: number): string {\n return run(str, code([48, 5, clampAndTruncate(color)], 49))\n}\n\n/**\n * Set text color using 24bit rgb.\n * `color` can be a number in range `0x000000` to `0xffffff` or\n * an `Rgb`.\n *\n * To produce the color magenta:\n *\n * ```ts\n * import { rgb24 } from \"./colors.ts\";\n * rgb24(\"foo\", 0xff00ff);\n * rgb24(\"foo\", {r: 255, g: 0, b: 255});\n * ```\n * @param str text color to apply 24bit rgb to\n * @param color code\n */\nexport function rgb24(str: string, color: number | Rgb): string {\n if (typeof color === 'number') {\n return run(str, code([38, 2, (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff], 39))\n }\n return run(str, code([38, 2, clampAndTruncate(color.r), clampAndTruncate(color.g), clampAndTruncate(color.b)], 39))\n}\n\n/**\n * Set background color using 24bit rgb.\n * `color` can be a number in range `0x000000` to `0xffffff` or\n * an `Rgb`.\n *\n * To produce the color magenta:\n *\n * ```ts\n * import { bgRgb24 } from \"./colors.ts\";\n * bgRgb24(\"foo\", 0xff00ff);\n * bgRgb24(\"foo\", {r: 255, g: 0, b: 255});\n * ```\n * @param str text color to apply 24bit rgb to\n * @param color code\n */\nexport function bgRgb24(str: string, color: number | Rgb): string {\n if (typeof color === 'number') {\n return run(str, code([48, 2, (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff], 49))\n }\n return run(str, code([48, 2, clampAndTruncate(color.r), clampAndTruncate(color.g), clampAndTruncate(color.b)], 49))\n}\n\n// https://github.com/chalk/ansi-regex/blob/02fa893d619d3da85411acc8fd4e2eea0e95a9d9/index.js\nconst ANSI_PATTERN = new RegExp(\n [\n '[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)',\n '(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]))',\n ].join('|'),\n 'g',\n)\n\n/**\n * Remove ANSI escape codes from the string.\n * @param string to remove ANSI escape codes from\n */\nexport function stripColor(string: string): string {\n return string.replace(ANSI_PATTERN, '')\n}\n"],"names":["enabled","setColorEnabled","value","getColorEnabled","code","open","close","join","regexp","RegExp","run","str","replace","reset","bold","dim","italic","underline","inverse","hidden","strikethrough","black","red","green","yellow","blue","magenta","cyan","white","gray","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite","bgBlack","bgRed","bgGreen","bgYellow","bgBlue","bgMagenta","bgCyan","bgWhite","bgBrightBlack","bgBrightRed","bgBrightGreen","bgBrightYellow","bgBrightBlue","bgBrightMagenta","bgBrightCyan","bgBrightWhite","clampAndTruncate","n","max","min","Math","trunc","rgb8","color","bgRgb8","rgb24","r","g","b","bgRgb24","ANSI_PATTERN","stripColor","string"],"mappings":"AAAA,mEAAmE,GAEnE,0EAA0E;AAC1E,+EAA+E;AAC/E,UAAU;AACV,qDAAqD;AAerD,IAAIA,UAAU,IAAI;AAElB;;;CAGC,GACD,OAAO,SAASC,gBAAgBC,KAAc,EAAE;IAC9CF,UAAUE;AACZ,CAAC;AAED,0DAA0D,GAC1D,OAAO,SAASC,kBAA2B;IACzC,OAAOH;AACT,CAAC;AAED;;;;CAIC,GACD,SAASI,KAAKC,IAAc,EAAEC,KAAa,EAAQ;IACjD,OAAO;QACLD,MAAM,CAAC,KAAK,EAAEA,KAAKE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/BD,OAAO,CAAC,KAAK,EAAEA,MAAM,CAAC,CAAC;QACvBE,QAAQ,IAAIC,OAAO,CAAC,QAAQ,EAAEH,MAAM,CAAC,CAAC,EAAE;IAC1C;AACF;AAEA;;;;CAIC,GACD,SAASI,IAAIC,GAAW,EAAEP,IAAU,EAAU;IAC5C,OAAOJ,UAAU,CAAC,EAAEI,KAAKC,IAAI,CAAC,EAAEM,IAAIC,OAAO,CAACR,KAAKI,MAAM,E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