@mtkruto/node 0.0.6

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 (167) hide show
  1. package/LICENSE +165 -0
  2. package/README.md +1 -0
  3. package/esm/_dnt.shims.js +68 -0
  4. package/esm/client/client.js +169 -0
  5. package/esm/client/client_abstract.js +51 -0
  6. package/esm/client/client_plain.js +112 -0
  7. package/esm/connection/connection.js +2 -0
  8. package/esm/connection/connection_web_socket.js +90 -0
  9. package/esm/constants.js +60 -0
  10. package/esm/deps/deno.land/std@0.186.0/fmt/colors.js +474 -0
  11. package/esm/deps/deno.land/std@0.186.0/testing/_diff.js +311 -0
  12. package/esm/deps/deno.land/std@0.186.0/testing/_format.js +23 -0
  13. package/esm/deps/deno.land/std@0.186.0/testing/asserts.js +633 -0
  14. package/esm/deps/deno.land/x/crc32@v0.2.0/mod.js +105 -0
  15. package/esm/deps/deno.land/x/tgcrypto@0.1.1/mod.js +68 -0
  16. package/esm/deps/deno.land/x/tgcrypto@0.1.1/tgcrypto.js +1127 -0
  17. package/esm/deps/raw.githubusercontent.com/MTKruto/compress/master/gzip/gzip.js +239 -0
  18. package/esm/deps/raw.githubusercontent.com/MTKruto/compress/master/utils/uint8.js +10 -0
  19. package/esm/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/deflate.js +139 -0
  20. package/esm/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/inflate.js +176 -0
  21. package/esm/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/mod.js +2 -0
  22. package/esm/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/adler32.js +19 -0
  23. package/esm/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/crc32.js +25 -0
  24. package/esm/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/deflate.js +1941 -0
  25. package/esm/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/gzheader.js +85 -0
  26. package/esm/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/inffast.js +321 -0
  27. package/esm/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/inflate.js +1658 -0
  28. package/esm/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/inftrees.js +355 -0
  29. package/esm/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/messages.js +11 -0
  30. package/esm/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/status.js +42 -0
  31. package/esm/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/trees.js +1107 -0
  32. package/esm/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/zstream.js +86 -0
  33. package/esm/deps.js +4 -0
  34. package/esm/mod.js +4 -0
  35. package/esm/package.json +3 -0
  36. package/esm/tl/0_tl_raw_reader.js +62 -0
  37. package/esm/tl/0_tl_raw_writer.js +60 -0
  38. package/esm/tl/1_tl_object.js +149 -0
  39. package/esm/tl/2_types.js +48220 -0
  40. package/esm/tl/3_functions.js +19856 -0
  41. package/esm/tl/3_tl_object_deserializer.js +72 -0
  42. package/esm/tl/3_tl_reader.js +16 -0
  43. package/esm/tl/3_tl_writer.js +7 -0
  44. package/esm/tl/4_rpc_result.js +27 -0
  45. package/esm/tl/5_message.js +54 -0
  46. package/esm/tl/6_message_container.js +35 -0
  47. package/esm/transport/transport.js +32 -0
  48. package/esm/transport/transport_intermediate.js +56 -0
  49. package/esm/transport/transport_provider.js +23 -0
  50. package/esm/types.js +1 -0
  51. package/esm/utilities/0_bigint.js +37 -0
  52. package/esm/utilities/0_buffer.js +33 -0
  53. package/esm/utilities/0_crypto.js +35 -0
  54. package/esm/utilities/0_hash.js +7 -0
  55. package/esm/utilities/1_auth.js +29 -0
  56. package/esm/utilities/1_message.js +94 -0
  57. package/esm/utilities/1_obfuscation.js +33 -0
  58. package/package.json +40 -0
  59. package/script/_dnt.shims.js +77 -0
  60. package/script/client/client.js +173 -0
  61. package/script/client/client_abstract.js +55 -0
  62. package/script/client/client_plain.js +116 -0
  63. package/script/connection/connection.js +6 -0
  64. package/script/connection/connection_web_socket.js +117 -0
  65. package/script/constants.js +63 -0
  66. package/script/deps/deno.land/std@0.186.0/fmt/colors.js +548 -0
  67. package/script/deps/deno.land/std@0.186.0/testing/_diff.js +317 -0
  68. package/script/deps/deno.land/std@0.186.0/testing/_format.js +50 -0
  69. package/script/deps/deno.land/std@0.186.0/testing/asserts.js +659 -0
  70. package/script/deps/deno.land/x/crc32@v0.2.0/mod.js +113 -0
  71. package/script/deps/deno.land/x/tgcrypto@0.1.1/mod.js +82 -0
  72. package/script/deps/deno.land/x/tgcrypto@0.1.1/tgcrypto.js +1152 -0
  73. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/gzip/gzip.js +271 -0
  74. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/utils/uint8.js +14 -0
  75. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/deflate.js +172 -0
  76. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/inflate.js +208 -0
  77. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/mod.js +18 -0
  78. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/adler32.js +22 -0
  79. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/crc32.js +30 -0
  80. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/deflate.js +1976 -0
  81. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/gzheader.js +88 -0
  82. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/inffast.js +324 -0
  83. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/inflate.js +1674 -0
  84. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/inftrees.js +358 -0
  85. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/messages.js +14 -0
  86. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/status.js +44 -0
  87. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/trees.js +1115 -0
  88. package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/zstream.js +89 -0
  89. package/script/deps.js +30 -0
  90. package/script/mod.js +32 -0
  91. package/script/package.json +3 -0
  92. package/script/tl/0_tl_raw_reader.js +66 -0
  93. package/script/tl/0_tl_raw_writer.js +64 -0
  94. package/script/tl/1_tl_object.js +156 -0
  95. package/script/tl/2_types.js +49824 -0
  96. package/script/tl/3_functions.js +20413 -0
  97. package/script/tl/3_tl_object_deserializer.js +76 -0
  98. package/script/tl/3_tl_reader.js +20 -0
  99. package/script/tl/3_tl_writer.js +11 -0
  100. package/script/tl/4_rpc_result.js +31 -0
  101. package/script/tl/5_message.js +58 -0
  102. package/script/tl/6_message_container.js +39 -0
  103. package/script/transport/transport.js +36 -0
  104. package/script/transport/transport_intermediate.js +60 -0
  105. package/script/transport/transport_provider.js +27 -0
  106. package/script/types.js +2 -0
  107. package/script/utilities/0_bigint.js +67 -0
  108. package/script/utilities/0_buffer.js +38 -0
  109. package/script/utilities/0_crypto.js +39 -0
  110. package/script/utilities/0_hash.js +35 -0
  111. package/script/utilities/1_auth.js +56 -0
  112. package/script/utilities/1_message.js +102 -0
  113. package/script/utilities/1_obfuscation.js +60 -0
  114. package/types/_dnt.shims.d.ts +10 -0
  115. package/types/client/client.d.ts +19 -0
  116. package/types/client/client_abstract.d.ts +20 -0
  117. package/types/client/client_plain.d.ts +10 -0
  118. package/types/connection/connection.d.ts +7 -0
  119. package/types/connection/connection_web_socket.d.ts +13 -0
  120. package/types/constants.d.ts +2 -0
  121. package/types/deps/deno.land/std@0.186.0/fmt/colors.d.ts +270 -0
  122. package/types/deps/deno.land/std@0.186.0/testing/_diff.d.ts +26 -0
  123. package/types/deps/deno.land/std@0.186.0/testing/_format.d.ts +1 -0
  124. package/types/deps/deno.land/std@0.186.0/testing/asserts.d.ts +284 -0
  125. package/types/deps/deno.land/x/crc32@v0.2.0/mod.d.ts +15 -0
  126. package/types/deps/deno.land/x/tgcrypto@0.1.1/mod.d.ts +47 -0
  127. package/types/deps/deno.land/x/tgcrypto@0.1.1/tgcrypto.d.ts +2 -0
  128. package/types/deps/raw.githubusercontent.com/MTKruto/compress/master/gzip/gzip.d.ts +16 -0
  129. package/types/deps/raw.githubusercontent.com/MTKruto/compress/master/utils/uint8.d.ts +1 -0
  130. package/types/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/deflate.d.ts +29 -0
  131. package/types/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/inflate.d.ts +23 -0
  132. package/types/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/mod.d.ts +2 -0
  133. package/types/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/adler32.d.ts +1 -0
  134. package/types/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/crc32.d.ts +2 -0
  135. package/types/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/deflate.d.ts +78 -0
  136. package/types/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/gzheader.d.ts +12 -0
  137. package/types/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/inffast.d.ts +1 -0
  138. package/types/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/inflate.d.ts +47 -0
  139. package/types/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/inftrees.d.ts +1 -0
  140. package/types/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/messages.d.ts +12 -0
  141. package/types/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/status.d.ts +30 -0
  142. package/types/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/trees.d.ts +5 -0
  143. package/types/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/zstream.d.ts +14 -0
  144. package/types/deps.d.ts +4 -0
  145. package/types/mod.d.ts +4 -0
  146. package/types/tl/0_tl_raw_reader.d.ts +13 -0
  147. package/types/tl/0_tl_raw_writer.d.ts +13 -0
  148. package/types/tl/1_tl_object.d.ts +36 -0
  149. package/types/tl/2_types.d.ts +14815 -0
  150. package/types/tl/3_functions.d.ts +6122 -0
  151. package/types/tl/3_tl_object_deserializer.d.ts +3 -0
  152. package/types/tl/3_tl_reader.d.ts +4 -0
  153. package/types/tl/3_tl_writer.d.ts +5 -0
  154. package/types/tl/4_rpc_result.d.ts +8 -0
  155. package/types/tl/5_message.d.ts +11 -0
  156. package/types/tl/6_message_container.d.ts +9 -0
  157. package/types/transport/transport.d.ts +15 -0
  158. package/types/transport/transport_intermediate.d.ts +11 -0
  159. package/types/transport/transport_provider.d.ts +12 -0
  160. package/types/types.d.ts +1 -0
  161. package/types/utilities/0_bigint.d.ts +4 -0
  162. package/types/utilities/0_buffer.d.ts +2 -0
  163. package/types/utilities/0_crypto.d.ts +8 -0
  164. package/types/utilities/0_hash.d.ts +2 -0
  165. package/types/utilities/1_auth.d.ts +1 -0
  166. package/types/utilities/1_message.d.ts +10 -0
  167. package/types/utilities/1_obfuscation.d.ts +6 -0
@@ -0,0 +1,548 @@
1
+ "use strict";
2
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
3
+ // This module is browser compatible.
4
+ // A module to print ANSI terminal colors. Inspired by chalk, kleur, and colors
5
+ // on npm.
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __importStar = (this && this.__importStar) || function (mod) {
23
+ if (mod && mod.__esModule) return mod;
24
+ var result = {};
25
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
26
+ __setModuleDefault(result, mod);
27
+ return result;
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.stripColor = exports.bgRgb24 = exports.rgb24 = exports.bgRgb8 = exports.rgb8 = exports.bgBrightWhite = exports.bgBrightCyan = exports.bgBrightMagenta = exports.bgBrightBlue = exports.bgBrightYellow = exports.bgBrightGreen = exports.bgBrightRed = exports.bgBrightBlack = exports.bgWhite = exports.bgCyan = exports.bgMagenta = exports.bgBlue = exports.bgYellow = exports.bgGreen = exports.bgRed = exports.bgBlack = exports.brightWhite = exports.brightCyan = exports.brightMagenta = exports.brightBlue = exports.brightYellow = exports.brightGreen = exports.brightRed = exports.brightBlack = exports.gray = exports.white = exports.cyan = exports.magenta = exports.blue = exports.yellow = exports.green = exports.red = exports.black = exports.strikethrough = exports.hidden = exports.inverse = exports.underline = exports.italic = exports.dim = exports.bold = exports.reset = exports.getColorEnabled = exports.setColorEnabled = void 0;
31
+ /**
32
+ * String formatters and utilities for dealing with ANSI color codes.
33
+ *
34
+ * This module is browser compatible.
35
+ *
36
+ * This module supports `NO_COLOR` environmental variable disabling any coloring
37
+ * if `NO_COLOR` is set.
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * import {
42
+ * bgBlue,
43
+ * bgRgb24,
44
+ * bgRgb8,
45
+ * bold,
46
+ * italic,
47
+ * red,
48
+ * rgb24,
49
+ * rgb8,
50
+ * } from "https://deno.land/std@$STD_VERSION/fmt/colors.ts";
51
+ *
52
+ * console.log(bgBlue(italic(red(bold("Hello, World!")))));
53
+ *
54
+ * // also supports 8bit colors
55
+ *
56
+ * console.log(rgb8("Hello, World!", 42));
57
+ *
58
+ * console.log(bgRgb8("Hello, World!", 42));
59
+ *
60
+ * // and 24bit rgb
61
+ *
62
+ * console.log(rgb24("Hello, World!", {
63
+ * r: 41,
64
+ * g: 42,
65
+ * b: 43,
66
+ * }));
67
+ *
68
+ * console.log(bgRgb24("Hello, World!", {
69
+ * r: 41,
70
+ * g: 42,
71
+ * b: 43,
72
+ * }));
73
+ * ```
74
+ *
75
+ * @module
76
+ */
77
+ // deno-lint-ignore no-explicit-any
78
+ const dntShim = __importStar(require("../../../../_dnt.shims.js"));
79
+ const { Deno } = dntShim.dntGlobalThis;
80
+ const noColor = typeof Deno?.noColor === "boolean"
81
+ ? Deno.noColor
82
+ : true;
83
+ let enabled = !noColor;
84
+ /**
85
+ * Set changing text color to enabled or disabled
86
+ * @param value
87
+ */
88
+ function setColorEnabled(value) {
89
+ if (noColor) {
90
+ return;
91
+ }
92
+ enabled = value;
93
+ }
94
+ exports.setColorEnabled = setColorEnabled;
95
+ /** Get whether text color change is enabled or disabled. */
96
+ function getColorEnabled() {
97
+ return enabled;
98
+ }
99
+ exports.getColorEnabled = getColorEnabled;
100
+ /**
101
+ * Builds color code
102
+ * @param open
103
+ * @param close
104
+ */
105
+ function code(open, close) {
106
+ return {
107
+ open: `\x1b[${open.join(";")}m`,
108
+ close: `\x1b[${close}m`,
109
+ regexp: new RegExp(`\\x1b\\[${close}m`, "g"),
110
+ };
111
+ }
112
+ /**
113
+ * Applies color and background based on color code and its associated text
114
+ * @param str text to apply color settings to
115
+ * @param code color code to apply
116
+ */
117
+ function run(str, code) {
118
+ return enabled
119
+ ? `${code.open}${str.replace(code.regexp, code.open)}${code.close}`
120
+ : str;
121
+ }
122
+ /**
123
+ * Reset the text modified
124
+ * @param str text to reset
125
+ */
126
+ function reset(str) {
127
+ return run(str, code([0], 0));
128
+ }
129
+ exports.reset = reset;
130
+ /**
131
+ * Make the text bold.
132
+ * @param str text to make bold
133
+ */
134
+ function bold(str) {
135
+ return run(str, code([1], 22));
136
+ }
137
+ exports.bold = bold;
138
+ /**
139
+ * The text emits only a small amount of light.
140
+ * @param str text to dim
141
+ */
142
+ function dim(str) {
143
+ return run(str, code([2], 22));
144
+ }
145
+ exports.dim = dim;
146
+ /**
147
+ * Make the text italic.
148
+ * @param str text to make italic
149
+ */
150
+ function italic(str) {
151
+ return run(str, code([3], 23));
152
+ }
153
+ exports.italic = italic;
154
+ /**
155
+ * Make the text underline.
156
+ * @param str text to underline
157
+ */
158
+ function underline(str) {
159
+ return run(str, code([4], 24));
160
+ }
161
+ exports.underline = underline;
162
+ /**
163
+ * Invert background color and text color.
164
+ * @param str text to invert its color
165
+ */
166
+ function inverse(str) {
167
+ return run(str, code([7], 27));
168
+ }
169
+ exports.inverse = inverse;
170
+ /**
171
+ * Make the text hidden.
172
+ * @param str text to hide
173
+ */
174
+ function hidden(str) {
175
+ return run(str, code([8], 28));
176
+ }
177
+ exports.hidden = hidden;
178
+ /**
179
+ * Put horizontal line through the center of the text.
180
+ * @param str text to strike through
181
+ */
182
+ function strikethrough(str) {
183
+ return run(str, code([9], 29));
184
+ }
185
+ exports.strikethrough = strikethrough;
186
+ /**
187
+ * Set text color to black.
188
+ * @param str text to make black
189
+ */
190
+ function black(str) {
191
+ return run(str, code([30], 39));
192
+ }
193
+ exports.black = black;
194
+ /**
195
+ * Set text color to red.
196
+ * @param str text to make red
197
+ */
198
+ function red(str) {
199
+ return run(str, code([31], 39));
200
+ }
201
+ exports.red = red;
202
+ /**
203
+ * Set text color to green.
204
+ * @param str text to make green
205
+ */
206
+ function green(str) {
207
+ return run(str, code([32], 39));
208
+ }
209
+ exports.green = green;
210
+ /**
211
+ * Set text color to yellow.
212
+ * @param str text to make yellow
213
+ */
214
+ function yellow(str) {
215
+ return run(str, code([33], 39));
216
+ }
217
+ exports.yellow = yellow;
218
+ /**
219
+ * Set text color to blue.
220
+ * @param str text to make blue
221
+ */
222
+ function blue(str) {
223
+ return run(str, code([34], 39));
224
+ }
225
+ exports.blue = blue;
226
+ /**
227
+ * Set text color to magenta.
228
+ * @param str text to make magenta
229
+ */
230
+ function magenta(str) {
231
+ return run(str, code([35], 39));
232
+ }
233
+ exports.magenta = magenta;
234
+ /**
235
+ * Set text color to cyan.
236
+ * @param str text to make cyan
237
+ */
238
+ function cyan(str) {
239
+ return run(str, code([36], 39));
240
+ }
241
+ exports.cyan = cyan;
242
+ /**
243
+ * Set text color to white.
244
+ * @param str text to make white
245
+ */
246
+ function white(str) {
247
+ return run(str, code([37], 39));
248
+ }
249
+ exports.white = white;
250
+ /**
251
+ * Set text color to gray.
252
+ * @param str text to make gray
253
+ */
254
+ function gray(str) {
255
+ return brightBlack(str);
256
+ }
257
+ exports.gray = gray;
258
+ /**
259
+ * Set text color to bright black.
260
+ * @param str text to make bright-black
261
+ */
262
+ function brightBlack(str) {
263
+ return run(str, code([90], 39));
264
+ }
265
+ exports.brightBlack = brightBlack;
266
+ /**
267
+ * Set text color to bright red.
268
+ * @param str text to make bright-red
269
+ */
270
+ function brightRed(str) {
271
+ return run(str, code([91], 39));
272
+ }
273
+ exports.brightRed = brightRed;
274
+ /**
275
+ * Set text color to bright green.
276
+ * @param str text to make bright-green
277
+ */
278
+ function brightGreen(str) {
279
+ return run(str, code([92], 39));
280
+ }
281
+ exports.brightGreen = brightGreen;
282
+ /**
283
+ * Set text color to bright yellow.
284
+ * @param str text to make bright-yellow
285
+ */
286
+ function brightYellow(str) {
287
+ return run(str, code([93], 39));
288
+ }
289
+ exports.brightYellow = brightYellow;
290
+ /**
291
+ * Set text color to bright blue.
292
+ * @param str text to make bright-blue
293
+ */
294
+ function brightBlue(str) {
295
+ return run(str, code([94], 39));
296
+ }
297
+ exports.brightBlue = brightBlue;
298
+ /**
299
+ * Set text color to bright magenta.
300
+ * @param str text to make bright-magenta
301
+ */
302
+ function brightMagenta(str) {
303
+ return run(str, code([95], 39));
304
+ }
305
+ exports.brightMagenta = brightMagenta;
306
+ /**
307
+ * Set text color to bright cyan.
308
+ * @param str text to make bright-cyan
309
+ */
310
+ function brightCyan(str) {
311
+ return run(str, code([96], 39));
312
+ }
313
+ exports.brightCyan = brightCyan;
314
+ /**
315
+ * Set text color to bright white.
316
+ * @param str text to make bright-white
317
+ */
318
+ function brightWhite(str) {
319
+ return run(str, code([97], 39));
320
+ }
321
+ exports.brightWhite = brightWhite;
322
+ /**
323
+ * Set background color to black.
324
+ * @param str text to make its background black
325
+ */
326
+ function bgBlack(str) {
327
+ return run(str, code([40], 49));
328
+ }
329
+ exports.bgBlack = bgBlack;
330
+ /**
331
+ * Set background color to red.
332
+ * @param str text to make its background red
333
+ */
334
+ function bgRed(str) {
335
+ return run(str, code([41], 49));
336
+ }
337
+ exports.bgRed = bgRed;
338
+ /**
339
+ * Set background color to green.
340
+ * @param str text to make its background green
341
+ */
342
+ function bgGreen(str) {
343
+ return run(str, code([42], 49));
344
+ }
345
+ exports.bgGreen = bgGreen;
346
+ /**
347
+ * Set background color to yellow.
348
+ * @param str text to make its background yellow
349
+ */
350
+ function bgYellow(str) {
351
+ return run(str, code([43], 49));
352
+ }
353
+ exports.bgYellow = bgYellow;
354
+ /**
355
+ * Set background color to blue.
356
+ * @param str text to make its background blue
357
+ */
358
+ function bgBlue(str) {
359
+ return run(str, code([44], 49));
360
+ }
361
+ exports.bgBlue = bgBlue;
362
+ /**
363
+ * Set background color to magenta.
364
+ * @param str text to make its background magenta
365
+ */
366
+ function bgMagenta(str) {
367
+ return run(str, code([45], 49));
368
+ }
369
+ exports.bgMagenta = bgMagenta;
370
+ /**
371
+ * Set background color to cyan.
372
+ * @param str text to make its background cyan
373
+ */
374
+ function bgCyan(str) {
375
+ return run(str, code([46], 49));
376
+ }
377
+ exports.bgCyan = bgCyan;
378
+ /**
379
+ * Set background color to white.
380
+ * @param str text to make its background white
381
+ */
382
+ function bgWhite(str) {
383
+ return run(str, code([47], 49));
384
+ }
385
+ exports.bgWhite = bgWhite;
386
+ /**
387
+ * Set background color to bright black.
388
+ * @param str text to make its background bright-black
389
+ */
390
+ function bgBrightBlack(str) {
391
+ return run(str, code([100], 49));
392
+ }
393
+ exports.bgBrightBlack = bgBrightBlack;
394
+ /**
395
+ * Set background color to bright red.
396
+ * @param str text to make its background bright-red
397
+ */
398
+ function bgBrightRed(str) {
399
+ return run(str, code([101], 49));
400
+ }
401
+ exports.bgBrightRed = bgBrightRed;
402
+ /**
403
+ * Set background color to bright green.
404
+ * @param str text to make its background bright-green
405
+ */
406
+ function bgBrightGreen(str) {
407
+ return run(str, code([102], 49));
408
+ }
409
+ exports.bgBrightGreen = bgBrightGreen;
410
+ /**
411
+ * Set background color to bright yellow.
412
+ * @param str text to make its background bright-yellow
413
+ */
414
+ function bgBrightYellow(str) {
415
+ return run(str, code([103], 49));
416
+ }
417
+ exports.bgBrightYellow = bgBrightYellow;
418
+ /**
419
+ * Set background color to bright blue.
420
+ * @param str text to make its background bright-blue
421
+ */
422
+ function bgBrightBlue(str) {
423
+ return run(str, code([104], 49));
424
+ }
425
+ exports.bgBrightBlue = bgBrightBlue;
426
+ /**
427
+ * Set background color to bright magenta.
428
+ * @param str text to make its background bright-magenta
429
+ */
430
+ function bgBrightMagenta(str) {
431
+ return run(str, code([105], 49));
432
+ }
433
+ exports.bgBrightMagenta = bgBrightMagenta;
434
+ /**
435
+ * Set background color to bright cyan.
436
+ * @param str text to make its background bright-cyan
437
+ */
438
+ function bgBrightCyan(str) {
439
+ return run(str, code([106], 49));
440
+ }
441
+ exports.bgBrightCyan = bgBrightCyan;
442
+ /**
443
+ * Set background color to bright white.
444
+ * @param str text to make its background bright-white
445
+ */
446
+ function bgBrightWhite(str) {
447
+ return run(str, code([107], 49));
448
+ }
449
+ exports.bgBrightWhite = bgBrightWhite;
450
+ /* Special Color Sequences */
451
+ /**
452
+ * Clam and truncate color codes
453
+ * @param n
454
+ * @param max number to truncate to
455
+ * @param min number to truncate from
456
+ */
457
+ function clampAndTruncate(n, max = 255, min = 0) {
458
+ return Math.trunc(Math.max(Math.min(n, max), min));
459
+ }
460
+ /**
461
+ * Set text color using paletted 8bit colors.
462
+ * https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
463
+ * @param str text color to apply paletted 8bit colors to
464
+ * @param color code
465
+ */
466
+ function rgb8(str, color) {
467
+ return run(str, code([38, 5, clampAndTruncate(color)], 39));
468
+ }
469
+ exports.rgb8 = rgb8;
470
+ /**
471
+ * Set background color using paletted 8bit colors.
472
+ * https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
473
+ * @param str text color to apply paletted 8bit background colors to
474
+ * @param color code
475
+ */
476
+ function bgRgb8(str, color) {
477
+ return run(str, code([48, 5, clampAndTruncate(color)], 49));
478
+ }
479
+ exports.bgRgb8 = bgRgb8;
480
+ /**
481
+ * Set text color using 24bit rgb.
482
+ * `color` can be a number in range `0x000000` to `0xffffff` or
483
+ * an `Rgb`.
484
+ *
485
+ * To produce the color magenta:
486
+ *
487
+ * ```ts
488
+ * import { rgb24 } from "https://deno.land/std@$STD_VERSION/fmt/colors.ts";
489
+ * rgb24("foo", 0xff00ff);
490
+ * rgb24("foo", {r: 255, g: 0, b: 255});
491
+ * ```
492
+ * @param str text color to apply 24bit rgb to
493
+ * @param color code
494
+ */
495
+ function rgb24(str, color) {
496
+ if (typeof color === "number") {
497
+ return run(str, code([38, 2, (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff], 39));
498
+ }
499
+ return run(str, code([
500
+ 38,
501
+ 2,
502
+ clampAndTruncate(color.r),
503
+ clampAndTruncate(color.g),
504
+ clampAndTruncate(color.b),
505
+ ], 39));
506
+ }
507
+ exports.rgb24 = rgb24;
508
+ /**
509
+ * Set background color using 24bit rgb.
510
+ * `color` can be a number in range `0x000000` to `0xffffff` or
511
+ * an `Rgb`.
512
+ *
513
+ * To produce the color magenta:
514
+ *
515
+ * ```ts
516
+ * import { bgRgb24 } from "https://deno.land/std@$STD_VERSION/fmt/colors.ts";
517
+ * bgRgb24("foo", 0xff00ff);
518
+ * bgRgb24("foo", {r: 255, g: 0, b: 255});
519
+ * ```
520
+ * @param str text color to apply 24bit rgb to
521
+ * @param color code
522
+ */
523
+ function bgRgb24(str, color) {
524
+ if (typeof color === "number") {
525
+ return run(str, code([48, 2, (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff], 49));
526
+ }
527
+ return run(str, code([
528
+ 48,
529
+ 2,
530
+ clampAndTruncate(color.r),
531
+ clampAndTruncate(color.g),
532
+ clampAndTruncate(color.b),
533
+ ], 49));
534
+ }
535
+ exports.bgRgb24 = bgRgb24;
536
+ // https://github.com/chalk/ansi-regex/blob/02fa893d619d3da85411acc8fd4e2eea0e95a9d9/index.js
537
+ const ANSI_PATTERN = new RegExp([
538
+ "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
539
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))",
540
+ ].join("|"), "g");
541
+ /**
542
+ * Remove ANSI escape codes from the string.
543
+ * @param string to remove ANSI escape codes from
544
+ */
545
+ function stripColor(string) {
546
+ return string.replace(ANSI_PATTERN, "");
547
+ }
548
+ exports.stripColor = stripColor;