abbasyk60 commited on
Commit
69d74c6
·
1 Parent(s): 5fc279e

Add bot startup script and fix reasoning_content fallback

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. bot-err.log +25 -0
  2. bot.js +4 -1
  3. bot.log +3 -0
  4. node_modules/.package-lock.json +115 -0
  5. node_modules/@grammyjs/types/LICENSE +21 -0
  6. node_modules/@grammyjs/types/README.md +107 -0
  7. node_modules/@grammyjs/types/api.d.ts +22 -0
  8. node_modules/@grammyjs/types/checklist.d.ts +72 -0
  9. node_modules/@grammyjs/types/inline.d.ts +692 -0
  10. node_modules/@grammyjs/types/langs.d.ts +193 -0
  11. node_modules/@grammyjs/types/manage.d.ts +1144 -0
  12. node_modules/@grammyjs/types/markup.d.ts +268 -0
  13. node_modules/@grammyjs/types/message.d.ts +1537 -0
  14. node_modules/@grammyjs/types/methods.d.ts +0 -0
  15. node_modules/@grammyjs/types/mod.d.ts +14 -0
  16. node_modules/@grammyjs/types/mod.js +2 -0
  17. node_modules/@grammyjs/types/package.json +34 -0
  18. node_modules/@grammyjs/types/passport.d.ts +163 -0
  19. node_modules/@grammyjs/types/payment.d.ts +570 -0
  20. node_modules/@grammyjs/types/rich.d.ts +1010 -0
  21. node_modules/@grammyjs/types/settings.d.ts +120 -0
  22. node_modules/@grammyjs/types/story.d.ts +89 -0
  23. node_modules/@grammyjs/types/update.d.ts +84 -0
  24. node_modules/abort-controller/LICENSE +21 -0
  25. node_modules/abort-controller/README.md +98 -0
  26. node_modules/abort-controller/browser.js +13 -0
  27. node_modules/abort-controller/browser.mjs +11 -0
  28. node_modules/abort-controller/dist/abort-controller.d.ts +43 -0
  29. node_modules/abort-controller/dist/abort-controller.js +127 -0
  30. node_modules/abort-controller/dist/abort-controller.js.map +1 -0
  31. node_modules/abort-controller/dist/abort-controller.mjs +118 -0
  32. node_modules/abort-controller/dist/abort-controller.mjs.map +1 -0
  33. node_modules/abort-controller/dist/abort-controller.umd.js +5 -0
  34. node_modules/abort-controller/dist/abort-controller.umd.js.map +1 -0
  35. node_modules/abort-controller/package.json +97 -0
  36. node_modules/abort-controller/polyfill.js +21 -0
  37. node_modules/abort-controller/polyfill.mjs +19 -0
  38. node_modules/debug/LICENSE +20 -0
  39. node_modules/debug/README.md +481 -0
  40. node_modules/debug/package.json +64 -0
  41. node_modules/debug/src/browser.js +272 -0
  42. node_modules/debug/src/common.js +292 -0
  43. node_modules/debug/src/index.js +10 -0
  44. node_modules/debug/src/node.js +263 -0
  45. node_modules/event-target-shim/LICENSE +22 -0
  46. node_modules/event-target-shim/README.md +293 -0
  47. node_modules/event-target-shim/dist/event-target-shim.js +871 -0
  48. node_modules/event-target-shim/dist/event-target-shim.js.map +1 -0
  49. node_modules/event-target-shim/dist/event-target-shim.mjs +862 -0
  50. node_modules/event-target-shim/dist/event-target-shim.mjs.map +1 -0
bot-err.log ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ C:\Users\abbasyk\Documents\opencode-hf-space\node_modules\grammy\out\core\error.js:47
2
+ return new GrammyError(`Call to '${method}' failed!`, err, method, payload);
3
+ ^
4
+
5
+ GrammyError: Call to 'getUpdates' failed! (409: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running)
6
+ at toGrammyError (C:\Users\abbasyk\Documents\opencode-hf-space\node_modules\grammy\out\core\error.js:47:12)
7
+ at ApiClient.callApi (C:\Users\abbasyk\Documents\opencode-hf-space\node_modules\grammy\out\core\client.js:100:48)
8
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
9
+ at async Bot.fetchUpdates (C:\Users\abbasyk\Documents\opencode-hf-space\node_modules\grammy\out\bot.js:426:27)
10
+ at async Bot.loop (C:\Users\abbasyk\Documents\opencode-hf-space\node_modules\grammy\out\bot.js:397:33)
11
+ at async Bot.start (C:\Users\abbasyk\Documents\opencode-hf-space\node_modules\grammy\out\bot.js:318:9) {
12
+ method: 'getUpdates',
13
+ payload: {
14
+ offset: 1,
15
+ limit: undefined,
16
+ timeout: 30,
17
+ allowed_updates: undefined
18
+ },
19
+ ok: false,
20
+ error_code: 409,
21
+ description: 'Conflict: terminated by other getUpdates request; make sure that only one bot instance is running',
22
+ parameters: {}
23
+ }
24
+
25
+ Node.js v24.18.0
bot.js CHANGED
@@ -62,7 +62,10 @@ async function callZenAPI(messages, modelId) {
62
  return data.content.map((c) => c.text || "").join("");
63
  }
64
  if (data.choices && data.choices[0]) {
65
- return data.choices[0].message.content;
 
 
 
66
  }
67
  return JSON.stringify(data).substring(0, 2000);
68
  }
 
62
  return data.content.map((c) => c.text || "").join("");
63
  }
64
  if (data.choices && data.choices[0]) {
65
+ const msg = data.choices[0].message;
66
+ if (msg.content && msg.content.trim()) return msg.content;
67
+ if (msg.reasoning_content && msg.reasoning_content.trim()) return msg.reasoning_content;
68
+ return "(empty response - try another model)";
69
  }
70
  return JSON.stringify(data).substring(0, 2000);
71
  }
bot.log ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [OK] Starting Telegram bot...
2
+ [OK] Telegram bot is running!
3
+ [OK] Chat ID filter: 6922119748
node_modules/.package-lock.json ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "opencode-telegram-bot",
3
+ "version": "1.0.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "node_modules/@grammyjs/types": {
8
+ "version": "4.0.0",
9
+ "resolved": "https://registry.npmjs.org/@grammyjs/types/-/types-4.0.0.tgz",
10
+ "integrity": "sha512-Z8lDLTvOlo12e5Vnly/vQh3JC9ppaitS1dGZ3w068gNitOd/y8tTSiib+Xm38aBGbtYGmUZwOc6afYrLs2CSTg==",
11
+ "license": "MIT"
12
+ },
13
+ "node_modules/abort-controller": {
14
+ "version": "3.0.0",
15
+ "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
16
+ "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
17
+ "license": "MIT",
18
+ "dependencies": {
19
+ "event-target-shim": "^5.0.0"
20
+ },
21
+ "engines": {
22
+ "node": ">=6.5"
23
+ }
24
+ },
25
+ "node_modules/debug": {
26
+ "version": "4.4.3",
27
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
28
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
29
+ "license": "MIT",
30
+ "dependencies": {
31
+ "ms": "^2.1.3"
32
+ },
33
+ "engines": {
34
+ "node": ">=6.0"
35
+ },
36
+ "peerDependenciesMeta": {
37
+ "supports-color": {
38
+ "optional": true
39
+ }
40
+ }
41
+ },
42
+ "node_modules/event-target-shim": {
43
+ "version": "5.0.1",
44
+ "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
45
+ "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
46
+ "license": "MIT",
47
+ "engines": {
48
+ "node": ">=6"
49
+ }
50
+ },
51
+ "node_modules/grammy": {
52
+ "version": "1.45.1",
53
+ "resolved": "https://registry.npmjs.org/grammy/-/grammy-1.45.1.tgz",
54
+ "integrity": "sha512-Y4VL/hqJMZZxwlUr5ZgM68CFu2iIeEkNLR1cY3+Ww68CIvWARDsoXFix7+31rmyC0+7L85ZI+Pq3E5JSG5+nLQ==",
55
+ "license": "MIT",
56
+ "dependencies": {
57
+ "@grammyjs/types": "4.0.0",
58
+ "abort-controller": "^3.0.0",
59
+ "debug": "^4.4.3",
60
+ "node-fetch": "^2.7.0"
61
+ },
62
+ "engines": {
63
+ "node": "^12.20.0 || >=14.13.1"
64
+ }
65
+ },
66
+ "node_modules/ms": {
67
+ "version": "2.1.3",
68
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
69
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
70
+ "license": "MIT"
71
+ },
72
+ "node_modules/node-fetch": {
73
+ "version": "2.7.0",
74
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
75
+ "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
76
+ "license": "MIT",
77
+ "dependencies": {
78
+ "whatwg-url": "^5.0.0"
79
+ },
80
+ "engines": {
81
+ "node": "4.x || >=6.0.0"
82
+ },
83
+ "peerDependencies": {
84
+ "encoding": "^0.1.0"
85
+ },
86
+ "peerDependenciesMeta": {
87
+ "encoding": {
88
+ "optional": true
89
+ }
90
+ }
91
+ },
92
+ "node_modules/tr46": {
93
+ "version": "0.0.3",
94
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
95
+ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
96
+ "license": "MIT"
97
+ },
98
+ "node_modules/webidl-conversions": {
99
+ "version": "3.0.1",
100
+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
101
+ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
102
+ "license": "BSD-2-Clause"
103
+ },
104
+ "node_modules/whatwg-url": {
105
+ "version": "5.0.0",
106
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
107
+ "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
108
+ "license": "MIT",
109
+ "dependencies": {
110
+ "tr46": "~0.0.3",
111
+ "webidl-conversions": "^3.0.0"
112
+ }
113
+ }
114
+ }
115
+ }
node_modules/@grammyjs/types/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2021-2024 KnorpelSenf
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
node_modules/@grammyjs/types/README.md ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Telegram Bot API types for grammY
2
+
3
+ [grammY](https://github.com/grammyjs/grammY) makes writing Telegram bots easy. Check it out!
4
+
5
+ This package just provides type annotations for the complete Telegram Bot API, and aims at making them usable for grammY. It contains no runnable code.
6
+
7
+ Originally, this package is based on `typegram`, but since the update to Telegram Bot API 5.1, `typegram` is no longer directly updated. Instead, this package is maintained and its updates are backported to `typegram`. Hence, both packages are kept up to date with the Telegram Bot API for now.
8
+
9
+ ## Available Types
10
+
11
+ Generally this package just exposes a huge load of `interface`s that correspond to the **types** used throughout the Telegram Bot API.
12
+
13
+ Note that the API specification sometimes only has one name for multiple variants of a type, e.g. there is a number of different `Update`s you can receive, but they're all just called `Update`.
14
+ If you need to access the individual variants of an `Update`, refer to `Update.MessageUpdate` and its siblings.
15
+
16
+ In fact, this pattern is used for various types, namely:
17
+
18
+ - `CallbackQuery`
19
+ - `Chat`
20
+ - `ChatFullInfo`
21
+ - `InlineKeyboardButton`
22
+ - `KeyboardButton`
23
+ - `Message`
24
+ - `MessageEntity`
25
+ - `Location`
26
+ - `Update`
27
+
28
+ Naturally, when the API specification is actually modelling types to be unions (e.g. `InlineQueryResult`), this is reflected here as a union type, too.
29
+ Those types are not closed.
30
+
31
+ ## Available Methods
32
+
33
+ In addition to the types, this package provides you with another type `Telegram` which contains all available **methods** of the API.
34
+ There is no further structure applied to this, but if you can come up with something reasonable, please suggest it in an issue or directly open a PR.
35
+ In grammY, these types are what defines the `bot.api.raw` object.
36
+
37
+ Each method takes just a single argument with a structure that corresponds to the object expected by Telegram.
38
+ The helper type `Opts<M>` (where `M` is the method name) allows grammY to access that type directly.
39
+
40
+ ## Handling JSON-Serialized Objects
41
+
42
+ Some methods of the Telegram Bot API are expected to be called with JSON-serialized objects contained in a property of the payload, rather than an actual JSON payload.
43
+ In other words, the objects are serialized twice—the first time in order to conform with the docs, and the second time when the payload is actually sent in the POST body to the API server.
44
+
45
+ The most prominent example is the `reply_markup` property that appears in a number of different methods, but more than a dozen other properties like this can be found throughout the API.
46
+
47
+ Strictly speaking, the `@grammyjs/types` types do not reflect this accurately.
48
+ Instead of using `string` (representing a serialized object) as the type, `@grammyjs/types` uses the type of the object itself, thus ignoring the serialization step.
49
+ For instance, instead of declaring `reply_markup: string`, it declares the property as `reply_markup: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply` because that is what is supposed to be serialized to `string` before calling the respective method.
50
+
51
+ That makes sense for the reason that grammY uses the types in its wrapper code around the Telegram Bot API, exposed as `bot.raw.api`.
52
+ This wrapper code does the necessary JSON serialization automatically for the required properties.
53
+ Bots written with grammY then do not need to care about which properties to serialize and which not.
54
+ Given that `@grammyjs/types` refers to the objects themselves instead of their serialized strings, the wrapper code can now simply expose the `@grammyjs/types` types to its consumers without having to transform them before.
55
+
56
+ Consequently, the descriptions of all methods are adjusted in order to reflect this, i.e. the JSDoc comments do not mention JSON serialization (in contrast to their official equivalents).
57
+
58
+ ## Customizing `InputFile`
59
+
60
+ The Telegram Bot API lets bots send files in [three different ways](https://core.telegram.org/bots/api#sending-files).
61
+ Two of those ways are by specifying a `string`—either a `file_id` or a URL.
62
+ The third option, however, is by uploading files to the server using multipart/form-data.
63
+
64
+ The first two means to send a file are already covered by the type annotations across the library.
65
+ In all places where a `file_id` or a URL is permitted, the corresponding property allows a `string`.
66
+
67
+ We will now look at the type declarations that are relevant for uploading files directly.
68
+ grammY automatically translates calls to `sendDocument` and the like to multipart/form-data uploads when supplied with an `InputFile` object in the `document` property of the argument object.
69
+
70
+ `@grammyjs/types` should not have to know what objects you want to support as `InputFile`s.
71
+ Consequently, the type `InputFile` is not defined in this library.
72
+
73
+ Instead, grammY specifies its own version of what an `InputFile` is, hence automatically adjusting `@grammyjs/types` with a custom `InputFile` type used throughout all affected methods and interfaces.
74
+ This is possible by adding a type parameter to all affected types.
75
+ grammY then import types parametrises these types with its version of `InputFile`, and re-exports the adjusted types.
76
+ This is why you should always import Bot API as described here: <https://grammy.dev/guide/api.html#type-definitions-for-the-api>.
77
+
78
+ ## Differences to the Bot API
79
+
80
+ Some documentation strings are intentionally different from what is written on the website.
81
+ The actual type definitions themselves are never different.
82
+
83
+ 1. No formatting.
84
+ We do not leverage the markdown capabilities of JSDoc for the sake of easier copying and thus reduced maintenance efforts.
85
+ 2. No mentions of `JSON-serialized`.
86
+ As underlying libraries handle serialization, these words are removed from the explanations.
87
+ 3. No mentions of integer numbers that exceed 2^31 but not 2^51.
88
+ All numbers are 64-bit floats in JS, so this is irrelevant.
89
+ Note that JS bit operators cast numbers to 32-bit integers and back, but we deliberately ignore this because people who use bit operators on identifiers or file sizes should know what they're doing, and they should also know that it's a bad idea.
90
+ 4. No `More info on Sending Files »`.
91
+ File handling is abstracted away by the underlying library.
92
+ Also, without the links, it's useless anyway.
93
+ The same is true for the links to more info about requesting chats, users, payments, and games.
94
+ 5. No images.
95
+ Documentation strings containing an image are adjusted to make sense without the images, too.
96
+
97
+ ## Contributing
98
+
99
+ This is a Deno project.
100
+ All the files are TypeScript files that are published on <https://deno.land/x/grammy_types>.
101
+ This project uses [deno2node](https://github.com/fromdeno/deno2node) to emit declaration files which are then published on npm.
102
+
103
+ If you want to work on this, you do not need to have Node.js installed.
104
+ You also should not run `npm install`.
105
+ You only need [Deno](https://deno.land) and the VSCode extensions recommended in this repo.
106
+
107
+ Run `deno task` to see available development scripts.
node_modules/@grammyjs/types/api.d.ts ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export interface ApiError {
2
+ ok: false;
3
+ error_code: number;
4
+ description: string;
5
+ parameters?: ResponseParameters;
6
+ }
7
+ export interface ApiSuccess<T> {
8
+ ok: true;
9
+ result: T;
10
+ }
11
+ /** The response contains an object, which always has a Boolean field 'ok' and may have an optional String field 'description' with a human-readable description of the result. If 'ok' equals True, the request was successful and the result of the query can be found in the 'result' field. In case of an unsuccessful request, 'ok' equals False and the error is explained in the 'description'. An Integer 'error_code' field is also returned, but its contents are subject to change in the future. Some errors may also have an optional field 'parameters' of the type ResponseParameters, which can help to automatically handle the error.
12
+
13
+ - All methods in the Bot API are case-insensitive.
14
+ - All queries must be made using UTF-8. */
15
+ export type ApiResponse<T> = ApiError | ApiSuccess<T>;
16
+ /** Describes why a request was unsuccessful. */
17
+ export interface ResponseParameters {
18
+ /** The group has been migrated to a supergroup with the specified identifier. */
19
+ migrate_to_chat_id?: number;
20
+ /** In case of exceeding flood control, the number of seconds left to wait before the request can be repeated */
21
+ retry_after?: number;
22
+ }
node_modules/@grammyjs/types/checklist.d.ts ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { Chat, User } from "./manage.js";
2
+ import type { Message, MessageEntity, ParseMode } from "./message.js";
3
+ /** Describes a task in a checklist. */
4
+ export interface ChecklistTask {
5
+ /** Unique identifier of the task */
6
+ id: number;
7
+ /** Text of the task */
8
+ text: string;
9
+ /** Special entities that appear in the task text */
10
+ text_entities?: MessageEntity[];
11
+ /** User that completed the task; omitted if the task wasn't completed by a user */
12
+ completed_by_user?: User;
13
+ /** Chat that completed the task; omitted if the task wasn't completed by a chat */
14
+ completed_by_chat?: Chat;
15
+ /** Point in time (Unix timestamp) when the task was completed; 0 if the task wasn't completed */
16
+ completion_date?: number;
17
+ }
18
+ /** Describes a checklist. */
19
+ export interface Checklist {
20
+ /** Title of the checklist */
21
+ title: string;
22
+ /** Special entities that appear in the checklist title */
23
+ title_entities?: MessageEntity[];
24
+ /** List of tasks in the checklist */
25
+ tasks: ChecklistTask[];
26
+ /** True, if users other than the creator of the list can add tasks to the list */
27
+ others_can_add_tasks?: true;
28
+ /** True, if users other than the creator of the list can mark tasks as done or not done */
29
+ others_can_mark_tasks_as_done?: true;
30
+ }
31
+ /** Describes a task to add to a checklist. */
32
+ export interface InputChecklistTask {
33
+ /** Unique identifier of the task; must be positive and unique among all task identifiers currently present in the checklist */
34
+ id: number;
35
+ /** Text of the task; 1-100 characters after entities parsing */
36
+ text: string;
37
+ /** Mode for parsing entities in the text. See formatting options for more details. */
38
+ parse_mode?: ParseMode;
39
+ /** List of special entities that appear in the text, which can be specified instead of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, custom_emoji, and date_time entities are allowed. */
40
+ text_entities?: MessageEntity[];
41
+ }
42
+ /** Describes a checklist to create. */
43
+ export interface InputChecklist {
44
+ /** Title of the checklist; 1-255 characters after entities parsing */
45
+ title: string;
46
+ /** Mode for parsing entities in the title. See formatting options for more details. */
47
+ parse_mode?: ParseMode;
48
+ /** List of special entities that appear in the title, which can be specified instead of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, custom_emoji, and date_time entities are allowed. */
49
+ title_entities?: MessageEntity[];
50
+ /** List of 1-30 tasks in the checklist */
51
+ tasks: InputChecklistTask[];
52
+ /** Pass True if other users can add tasks to the checklist */
53
+ others_can_add_tasks?: boolean;
54
+ /** Pass True if other users can mark tasks as done or not done in the checklist */
55
+ others_can_mark_tasks_as_done?: true;
56
+ }
57
+ /** Describes a service message about checklist tasks marked as done or not done. */
58
+ export interface ChecklistTasksDone {
59
+ /** Message containing the checklist whose tasks were marked as done or not done. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */
60
+ checklist_message?: Message;
61
+ /** Identifiers of the tasks that were marked as done */
62
+ marked_as_done_task_ids?: number[];
63
+ /** Identifiers of the tasks that were marked as not done */
64
+ marked_as_not_done_task_ids?: number[];
65
+ }
66
+ /** Describes a service message about tasks added to a checklist. */
67
+ export interface ChecklistTasksAdded {
68
+ /** Message containing the checklist to which the tasks were added. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */
69
+ checklist_message?: Message;
70
+ /** List of tasks added to the checklist */
71
+ tasks: ChecklistTask[];
72
+ }
node_modules/@grammyjs/types/inline.d.ts ADDED
@@ -0,0 +1,692 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { Chat, User } from "./manage.js";
2
+ import type { InlineKeyboardMarkup, WebAppInfo } from "./markup.js";
3
+ import type { LinkPreviewOptions, Location, MessageEntity, ParseMode } from "./message.js";
4
+ import type { LabeledPrice } from "./payment.js";
5
+ import type { InputRichMessage } from "./rich.js";
6
+ /** This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results. */
7
+ export interface InlineQuery {
8
+ /** Unique identifier for this query */
9
+ id: string;
10
+ /** Sender */
11
+ from: User;
12
+ /** Text of the query (up to 256 characters) */
13
+ query: string;
14
+ /** Offset of the results to be returned, can be controlled by the bot */
15
+ offset: string;
16
+ /** Type of the chat from which the inline query was sent. Can be either “sender” for a private chat with the inline query sender, “private”, “group”, “supergroup”, or “channel”. The chat type should be always known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat. */
17
+ chat_type?: "sender" | Chat["type"];
18
+ /** Sender location, only for bots that request user location */
19
+ location?: Location;
20
+ }
21
+ /** This object represents one result of an inline query. Telegram clients currently support results of the following 20 types:
22
+
23
+ - InlineQueryResultCachedAudio
24
+ - InlineQueryResultCachedDocument
25
+ - InlineQueryResultCachedGif
26
+ - InlineQueryResultCachedMpeg4Gif
27
+ - InlineQueryResultCachedPhoto
28
+ - InlineQueryResultCachedSticker
29
+ - InlineQueryResultCachedVideo
30
+ - InlineQueryResultCachedVoice
31
+ - InlineQueryResultArticle
32
+ - InlineQueryResultAudio
33
+ - InlineQueryResultContact
34
+ - InlineQueryResultGame
35
+ - InlineQueryResultDocument
36
+ - InlineQueryResultGif
37
+ - InlineQueryResultLocation
38
+ - InlineQueryResultMpeg4Gif
39
+ - InlineQueryResultPhoto
40
+ - InlineQueryResultVenue
41
+ - InlineQueryResultVideo
42
+ - InlineQueryResultVoice
43
+
44
+ Note: All URLs passed in inline query results will be available to end users and therefore must be assumed to be public. */
45
+ export type InlineQueryResult<F> = InlineQueryResultCachedAudio<F> | InlineQueryResultCachedDocument<F> | InlineQueryResultCachedGif<F> | InlineQueryResultCachedMpeg4Gif<F> | InlineQueryResultCachedPhoto<F> | InlineQueryResultCachedSticker<F> | InlineQueryResultCachedVideo<F> | InlineQueryResultCachedVoice<F> | InlineQueryResultArticle<F> | InlineQueryResultAudio<F> | InlineQueryResultContact<F> | InlineQueryResultGame | InlineQueryResultDocument<F> | InlineQueryResultGif<F> | InlineQueryResultLocation<F> | InlineQueryResultMpeg4Gif<F> | InlineQueryResultPhoto<F> | InlineQueryResultVenue<F> | InlineQueryResultVideo<F> | InlineQueryResultVoice<F>;
46
+ /** Represents a link to an article or web page. */
47
+ export interface InlineQueryResultArticle<F> {
48
+ /** Type of the result, must be article */
49
+ type: "article";
50
+ /** Unique identifier for this result, 1-64 Bytes */
51
+ id: string;
52
+ /** Title of the result */
53
+ title: string;
54
+ /** Content of the message to be sent */
55
+ input_message_content: InputMessageContent<F>;
56
+ /** Inline keyboard attached to the message */
57
+ reply_markup?: InlineKeyboardMarkup;
58
+ /** URL of the result */
59
+ url?: string;
60
+ /** Short description of the result */
61
+ description?: string;
62
+ /** Url of the thumbnail for the result */
63
+ thumbnail_url?: string;
64
+ /** Thumbnail width */
65
+ thumbnail_width?: number;
66
+ /** Thumbnail height */
67
+ thumbnail_height?: number;
68
+ }
69
+ /** Represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo. */
70
+ export interface InlineQueryResultPhoto<F> {
71
+ /** Type of the result, must be photo */
72
+ type: "photo";
73
+ /** Unique identifier for this result, 1-64 bytes */
74
+ id: string;
75
+ /** A valid URL of the photo. Photo must be in JPEG format. Photo size must not exceed 5MB. */
76
+ photo_url: string;
77
+ /** URL of the thumbnail for the photo */
78
+ thumbnail_url: string;
79
+ /** Width of the photo */
80
+ photo_width?: number;
81
+ /** Height of the photo */
82
+ photo_height?: number;
83
+ /** Title for the result */
84
+ title?: string;
85
+ /** Short description of the result */
86
+ description?: string;
87
+ /** Caption of the photo to be sent, 0-1024 characters after entities parsing */
88
+ caption?: string;
89
+ /** Pass True if the caption must be shown above the message media */
90
+ show_caption_above_media?: boolean;
91
+ /** Mode for parsing entities in the photo caption. See formatting options for more details. */
92
+ parse_mode?: ParseMode;
93
+ /** List of special entities that appear in the caption, which can be specified instead of parse_mode */
94
+ caption_entities?: MessageEntity[];
95
+ /** Inline keyboard attached to the message */
96
+ reply_markup?: InlineKeyboardMarkup;
97
+ /** Content of the message to be sent instead of the photo */
98
+ input_message_content?: InputMessageContent<F>;
99
+ }
100
+ /** Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. */
101
+ export interface InlineQueryResultGif<F> {
102
+ /** Type of the result, must be gif */
103
+ type: "gif";
104
+ /** Unique identifier for this result, 1-64 bytes */
105
+ id: string;
106
+ /** A valid URL for the GIF file */
107
+ gif_url: string;
108
+ /** Width of the GIF */
109
+ gif_width?: number;
110
+ /** Height of the GIF */
111
+ gif_height?: number;
112
+ /** Duration of the GIF in seconds */
113
+ gif_duration?: number;
114
+ /** URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result */
115
+ thumbnail_url: string;
116
+ /** MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg”. */
117
+ thumbnail_mime_type?: "image/jpeg" | "image/gif" | "video/mp4";
118
+ /** Title for the result */
119
+ title?: string;
120
+ /** Caption of the GIF file to be sent, 0-1024 characters after entities parsing */
121
+ caption?: string;
122
+ /** Pass True if the caption must be shown above the message media */
123
+ show_caption_above_media?: boolean;
124
+ /** Mode for parsing entities in the caption. See formatting options for more details. */
125
+ parse_mode?: ParseMode;
126
+ /** List of special entities that appear in the caption, which can be specified instead of parse_mode */
127
+ caption_entities?: MessageEntity[];
128
+ /** Inline keyboard attached to the message */
129
+ reply_markup?: InlineKeyboardMarkup;
130
+ /** Content of the message to be sent instead of the GIF animation */
131
+ input_message_content?: InputMessageContent<F>;
132
+ }
133
+ /** Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. */
134
+ export interface InlineQueryResultMpeg4Gif<F> {
135
+ /** Type of the result, must be mpeg4_gif */
136
+ type: "mpeg4_gif";
137
+ /** Unique identifier for this result, 1-64 bytes */
138
+ id: string;
139
+ /** A valid URL for the MPEG4 file */
140
+ mpeg4_url: string;
141
+ /** Video width */
142
+ mpeg4_width?: number;
143
+ /** Video height */
144
+ mpeg4_height?: number;
145
+ /** Video duration in seconds */
146
+ mpeg4_duration?: number;
147
+ /** URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result */
148
+ thumbnail_url: string;
149
+ /** MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg”. */
150
+ thumbnail_mime_type?: "image/jpeg" | "image/gif" | "video/mp4";
151
+ /** Title for the result */
152
+ title?: string;
153
+ /** Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing */
154
+ caption?: string;
155
+ /** Pass True if the caption must be shown above the message media */
156
+ show_caption_above_media?: boolean;
157
+ /** Mode for parsing entities in the caption. See formatting options for more details. */
158
+ parse_mode?: ParseMode;
159
+ /** List of special entities that appear in the caption, which can be specified instead of parse_mode */
160
+ caption_entities?: MessageEntity[];
161
+ /** Inline keyboard attached to the message */
162
+ reply_markup?: InlineKeyboardMarkup;
163
+ /** Content of the message to be sent instead of the video animation */
164
+ input_message_content?: InputMessageContent<F>;
165
+ }
166
+ /** Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
167
+
168
+ > If an InlineQueryResultVideo<F> message contains an embedded video (e.g., YouTube), you must replace its content using input_message_content. */
169
+ export interface InlineQueryResultVideo<F> {
170
+ /** Type of the result, must be video */
171
+ type: "video";
172
+ /** Unique identifier for this result, 1-64 bytes */
173
+ id: string;
174
+ /** A valid URL for the embedded video player or video file */
175
+ video_url: string;
176
+ /** MIME type of the content of the video URL, “text/html” or “video/mp4” */
177
+ mime_type: "text/html" | "video/mp4";
178
+ /** URL of the thumbnail (JPEG only) for the video */
179
+ thumbnail_url: string;
180
+ /** Title for the result */
181
+ title: string;
182
+ /** Caption of the video to be sent, 0-1024 characters after entities parsing */
183
+ caption?: string;
184
+ /** Pass True if the caption must be shown above the message media */
185
+ show_caption_above_media?: boolean;
186
+ /** Mode for parsing entities in the video caption. See formatting options for more details. */
187
+ parse_mode?: ParseMode;
188
+ /** List of special entities that appear in the caption, which can be specified instead of parse_mode */
189
+ caption_entities?: MessageEntity[];
190
+ /** Video width */
191
+ video_width?: number;
192
+ /** Video height */
193
+ video_height?: number;
194
+ /** Video duration in seconds */
195
+ video_duration?: number;
196
+ /** Short description of the result */
197
+ description?: string;
198
+ /** Inline keyboard attached to the message */
199
+ reply_markup?: InlineKeyboardMarkup;
200
+ /** Content of the message to be sent instead of the video. This field is required if InlineQueryResultVideo<F> is used to send an HTML-page as a result (e.g., a YouTube video). */
201
+ input_message_content?: InputMessageContent<F>;
202
+ }
203
+ /** Represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio. */
204
+ export interface InlineQueryResultAudio<F> {
205
+ /** Type of the result, must be audio */
206
+ type: "audio";
207
+ /** Unique identifier for this result, 1-64 bytes */
208
+ id: string;
209
+ /** A valid URL for the audio file */
210
+ audio_url: string;
211
+ /** Title */
212
+ title: string;
213
+ /** Caption, 0-1024 characters after entities parsing */
214
+ caption?: string;
215
+ /** Mode for parsing entities in the audio caption. See formatting options for more details. */
216
+ parse_mode?: ParseMode;
217
+ /** List of special entities that appear in the caption, which can be specified instead of parse_mode */
218
+ caption_entities?: MessageEntity[];
219
+ /** Performer */
220
+ performer?: string;
221
+ /** Audio duration in seconds */
222
+ audio_duration?: number;
223
+ /** Inline keyboard attached to the message */
224
+ reply_markup?: InlineKeyboardMarkup;
225
+ /** Content of the message to be sent instead of the audio */
226
+ input_message_content?: InputMessageContent<F>;
227
+ }
228
+ /** Represents a link to a voice recording in an .OGG container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message. */
229
+ export interface InlineQueryResultVoice<F> {
230
+ /** Type of the result, must be voice */
231
+ type: "voice";
232
+ /** Unique identifier for this result, 1-64 bytes */
233
+ id: string;
234
+ /** A valid URL for the voice recording */
235
+ voice_url: string;
236
+ /** Recording title */
237
+ title: string;
238
+ /** Caption, 0-1024 characters after entities parsing */
239
+ caption?: string;
240
+ /** Mode for parsing entities in the voice message caption. See formatting options for more details. */
241
+ parse_mode?: ParseMode;
242
+ /** List of special entities that appear in the caption, which can be specified instead of parse_mode */
243
+ caption_entities?: MessageEntity[];
244
+ /** Recording duration in seconds */
245
+ voice_duration?: number;
246
+ /** Inline keyboard attached to the message */
247
+ reply_markup?: InlineKeyboardMarkup;
248
+ /** Content of the message to be sent instead of the voice recording */
249
+ input_message_content?: InputMessageContent<F>;
250
+ }
251
+ /** Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method. */
252
+ export interface InlineQueryResultDocument<F> {
253
+ /** Type of the result, must be document */
254
+ type: "document";
255
+ /** Unique identifier for this result, 1-64 bytes */
256
+ id: string;
257
+ /** Title for the result */
258
+ title: string;
259
+ /** Caption of the document to be sent, 0-1024 characters after entities parsing */
260
+ caption?: string;
261
+ /** Mode for parsing entities in the document caption. See formatting options for more details. */
262
+ parse_mode?: ParseMode;
263
+ /** List of special entities that appear in the caption, which can be specified instead of parse_mode */
264
+ caption_entities?: MessageEntity[];
265
+ /** A valid URL for the file */
266
+ document_url: string;
267
+ /** MIME type of the content of the file, either “application/pdf” or “application/zip” */
268
+ mime_type: "application/pdf" | "application/zip";
269
+ /** Short description of the result */
270
+ description?: string;
271
+ /** Inline keyboard attached to the message */
272
+ reply_markup?: InlineKeyboardMarkup;
273
+ /** Content of the message to be sent instead of the file */
274
+ input_message_content?: InputMessageContent<F>;
275
+ /** URL of the thumbnail (JPEG only) for the file */
276
+ thumbnail_url?: string;
277
+ /** Thumbnail width */
278
+ thumbnail_width?: number;
279
+ /** Thumbnail height */
280
+ thumbnail_height?: number;
281
+ }
282
+ /** Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location. */
283
+ export interface InlineQueryResultLocation<F> {
284
+ /** Type of the result, must be location */
285
+ type: "location";
286
+ /** Unique identifier for this result, 1-64 Bytes */
287
+ id: string;
288
+ /** Location latitude in degrees */
289
+ latitude: number;
290
+ /** Location longitude in degrees */
291
+ longitude: number;
292
+ /** Location title */
293
+ title: string;
294
+ /** The radius of uncertainty for the location, measured in meters; 0-1500 */
295
+ horizontal_accuracy?: number;
296
+ /** Period in seconds during which the location can be updated, must be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely */
297
+ live_period?: number;
298
+ /** For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. */
299
+ heading?: number;
300
+ /** For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. */
301
+ proximity_alert_radius?: number;
302
+ /** Inline keyboard attached to the message */
303
+ reply_markup?: InlineKeyboardMarkup;
304
+ /** Content of the message to be sent instead of the location */
305
+ input_message_content?: InputMessageContent<F>;
306
+ /** Url of the thumbnail for the result */
307
+ thumbnail_url?: string;
308
+ /** Thumbnail width */
309
+ thumbnail_width?: number;
310
+ /** Thumbnail height */
311
+ thumbnail_height?: number;
312
+ }
313
+ /** Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue. */
314
+ export interface InlineQueryResultVenue<F> {
315
+ /** Type of the result, must be venue */
316
+ type: "venue";
317
+ /** Unique identifier for this result, 1-64 Bytes */
318
+ id: string;
319
+ /** Latitude of the venue location in degrees */
320
+ latitude: number;
321
+ /** Longitude of the venue location in degrees */
322
+ longitude: number;
323
+ /** Title of the venue */
324
+ title: string;
325
+ /** Address of the venue */
326
+ address: string;
327
+ /** Foursquare identifier of the venue if known */
328
+ foursquare_id?: string;
329
+ /** Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) */
330
+ foursquare_type?: string;
331
+ /** Google Places identifier of the venue */
332
+ google_place_id?: string;
333
+ /** Google Places type of the venue. (See supported types.) */
334
+ google_place_type?: string;
335
+ /** Inline keyboard attached to the message */
336
+ reply_markup?: InlineKeyboardMarkup;
337
+ /** Content of the message to be sent instead of the venue */
338
+ input_message_content?: InputMessageContent<F>;
339
+ /** Url of the thumbnail for the result */
340
+ thumbnail_url?: string;
341
+ /** Thumbnail width */
342
+ thumbnail_width?: number;
343
+ /** Thumbnail height */
344
+ thumbnail_height?: number;
345
+ }
346
+ /** Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact. */
347
+ export interface InlineQueryResultContact<F> {
348
+ /** Type of the result, must be contact */
349
+ type: "contact";
350
+ /** Unique identifier for this result, 1-64 Bytes */
351
+ id: string;
352
+ /** Contact's phone number */
353
+ phone_number: string;
354
+ /** Contact's first name */
355
+ first_name: string;
356
+ /** Contact's last name */
357
+ last_name?: string;
358
+ /** Additional data about the contact in the form of a vCard, 0-2048 bytes */
359
+ vcard?: string;
360
+ /** Inline keyboard attached to the message */
361
+ reply_markup?: InlineKeyboardMarkup;
362
+ /** Content of the message to be sent instead of the contact */
363
+ input_message_content?: InputMessageContent<F>;
364
+ /** Url of the thumbnail for the result */
365
+ thumbnail_url?: string;
366
+ /** Thumbnail width */
367
+ thumbnail_width?: number;
368
+ /** Thumbnail height */
369
+ thumbnail_height?: number;
370
+ }
371
+ /** Represents a Game. */
372
+ export interface InlineQueryResultGame {
373
+ /** Type of the result, must be game */
374
+ type: "game";
375
+ /** Unique identifier for this result, 1-64 bytes */
376
+ id: string;
377
+ /** Short name of the game */
378
+ game_short_name: string;
379
+ /** Inline keyboard attached to the message */
380
+ reply_markup?: InlineKeyboardMarkup;
381
+ }
382
+ /** Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo. */
383
+ export interface InlineQueryResultCachedPhoto<F> {
384
+ /** Type of the result, must be photo */
385
+ type: "photo";
386
+ /** Unique identifier for this result, 1-64 bytes */
387
+ id: string;
388
+ /** A valid file identifier of the photo */
389
+ photo_file_id: string;
390
+ /** Title for the result */
391
+ title?: string;
392
+ /** Short description of the result */
393
+ description?: string;
394
+ /** Caption of the photo to be sent, 0-1024 characters after entities parsing */
395
+ caption?: string;
396
+ /** Pass True if the caption must be shown above the message media */
397
+ show_caption_above_media?: boolean;
398
+ /** Mode for parsing entities in the photo caption. See formatting options for more details. */
399
+ parse_mode?: ParseMode;
400
+ /** List of special entities that appear in the caption, which can be specified instead of parse_mode */
401
+ caption_entities?: MessageEntity[];
402
+ /** Inline keyboard attached to the message */
403
+ reply_markup?: InlineKeyboardMarkup;
404
+ /** Content of the message to be sent instead of the photo */
405
+ input_message_content?: InputMessageContent<F>;
406
+ }
407
+ /** Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation. */
408
+ export interface InlineQueryResultCachedGif<F> {
409
+ /** Type of the result, must be gif */
410
+ type: "gif";
411
+ /** Unique identifier for this result, 1-64 bytes */
412
+ id: string;
413
+ /** A valid file identifier for the GIF file */
414
+ gif_file_id: string;
415
+ /** Title for the result */
416
+ title?: string;
417
+ /** Caption of the GIF file to be sent, 0-1024 characters after entities parsing */
418
+ caption?: string;
419
+ /** Pass True if the caption must be shown above the message media */
420
+ show_caption_above_media?: boolean;
421
+ /** Mode for parsing entities in the caption. See formatting options for more details. */
422
+ parse_mode?: ParseMode;
423
+ /** List of special entities that appear in the caption, which can be specified instead of parse_mode */
424
+ caption_entities?: MessageEntity[];
425
+ /** Inline keyboard attached to the message */
426
+ reply_markup?: InlineKeyboardMarkup;
427
+ /** Content of the message to be sent instead of the GIF animation */
428
+ input_message_content?: InputMessageContent<F>;
429
+ }
430
+ /** Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. */
431
+ export interface InlineQueryResultCachedMpeg4Gif<F> {
432
+ /** Type of the result, must be mpeg4_gif */
433
+ type: "mpeg4_gif";
434
+ /** Unique identifier for this result, 1-64 bytes */
435
+ id: string;
436
+ /** A valid file identifier for the MPEG4 file */
437
+ mpeg4_file_id: string;
438
+ /** Title for the result */
439
+ title?: string;
440
+ /** Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing */
441
+ caption?: string;
442
+ /** Pass True if the caption must be shown above the message media */
443
+ show_caption_above_media?: boolean;
444
+ /** Mode for parsing entities in the caption. See formatting options for more details. */
445
+ parse_mode?: ParseMode;
446
+ /** List of special entities that appear in the caption, which can be specified instead of parse_mode */
447
+ caption_entities?: MessageEntity[];
448
+ /** Inline keyboard attached to the message */
449
+ reply_markup?: InlineKeyboardMarkup;
450
+ /** Content of the message to be sent instead of the video animation */
451
+ input_message_content?: InputMessageContent<F>;
452
+ }
453
+ /** Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker. */
454
+ export interface InlineQueryResultCachedSticker<F> {
455
+ /** Type of the result, must be sticker */
456
+ type: "sticker";
457
+ /** Unique identifier for this result, 1-64 bytes */
458
+ id: string;
459
+ /** A valid file identifier of the sticker */
460
+ sticker_file_id: string;
461
+ /** Inline keyboard attached to the message */
462
+ reply_markup?: InlineKeyboardMarkup;
463
+ /** Content of the message to be sent instead of the sticker */
464
+ input_message_content?: InputMessageContent<F>;
465
+ }
466
+ /** Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. */
467
+ export interface InlineQueryResultCachedDocument<F> {
468
+ /** Type of the result, must be document */
469
+ type: "document";
470
+ /** Unique identifier for this result, 1-64 bytes */
471
+ id: string;
472
+ /** Title for the result */
473
+ title: string;
474
+ /** A valid file identifier for the file */
475
+ document_file_id: string;
476
+ /** Short description of the result */
477
+ description?: string;
478
+ /** Caption of the document to be sent, 0-1024 characters after entities parsing */
479
+ caption?: string;
480
+ /** Mode for parsing entities in the document caption. See formatting options for more details. */
481
+ parse_mode?: ParseMode;
482
+ /** List of special entities that appear in the caption, which can be specified instead of parse_mode */
483
+ caption_entities?: MessageEntity[];
484
+ /** Inline keyboard attached to the message */
485
+ reply_markup?: InlineKeyboardMarkup;
486
+ /** Content of the message to be sent instead of the file */
487
+ input_message_content?: InputMessageContent<F>;
488
+ }
489
+ /** Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video. */
490
+ export interface InlineQueryResultCachedVideo<F> {
491
+ /** Type of the result, must be video */
492
+ type: "video";
493
+ /** Unique identifier for this result, 1-64 bytes */
494
+ id: string;
495
+ /** A valid file identifier for the video file */
496
+ video_file_id: string;
497
+ /** Title for the result */
498
+ title: string;
499
+ /** Short description of the result */
500
+ description?: string;
501
+ /** Caption of the video to be sent, 0-1024 characters after entities parsing */
502
+ caption?: string;
503
+ /** Pass True if the caption must be shown above the message media */
504
+ show_caption_above_media?: boolean;
505
+ /** Mode for parsing entities in the video caption. See formatting options for more details. */
506
+ parse_mode?: ParseMode;
507
+ /** List of special entities that appear in the caption, which can be specified instead of parse_mode */
508
+ caption_entities?: MessageEntity[];
509
+ /** Inline keyboard attached to the message */
510
+ reply_markup?: InlineKeyboardMarkup;
511
+ /** Content of the message to be sent instead of the video */
512
+ input_message_content?: InputMessageContent<F>;
513
+ }
514
+ /** Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message. */
515
+ export interface InlineQueryResultCachedVoice<F> {
516
+ /** Type of the result, must be voice */
517
+ type: "voice";
518
+ /** Unique identifier for this result, 1-64 bytes */
519
+ id: string;
520
+ /** A valid file identifier for the voice message */
521
+ voice_file_id: string;
522
+ /** Voice message title */
523
+ title: string;
524
+ /** Caption, 0-1024 characters after entities parsing */
525
+ caption?: string;
526
+ /** Mode for parsing entities in the voice message caption. See formatting options for more details. */
527
+ parse_mode?: ParseMode;
528
+ /** List of special entities that appear in the caption, which can be specified instead of parse_mode */
529
+ caption_entities?: MessageEntity[];
530
+ /** Inline keyboard attached to the message */
531
+ reply_markup?: InlineKeyboardMarkup;
532
+ /** Content of the message to be sent instead of the voice message */
533
+ input_message_content?: InputMessageContent<F>;
534
+ }
535
+ /** Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio. */
536
+ export interface InlineQueryResultCachedAudio<F> {
537
+ /** Type of the result, must be audio */
538
+ type: "audio";
539
+ /** Unique identifier for this result, 1-64 bytes */
540
+ id: string;
541
+ /** A valid file identifier for the audio file */
542
+ audio_file_id: string;
543
+ /** Caption, 0-1024 characters after entities parsing */
544
+ caption?: string;
545
+ /** Mode for parsing entities in the audio caption. See formatting options for more details. */
546
+ parse_mode?: ParseMode;
547
+ /** List of special entities that appear in the caption, which can be specified instead of parse_mode */
548
+ caption_entities?: MessageEntity[];
549
+ /** Inline keyboard attached to the message */
550
+ reply_markup?: InlineKeyboardMarkup;
551
+ /** Content of the message to be sent instead of the audio */
552
+ input_message_content?: InputMessageContent<F>;
553
+ }
554
+ /** This object represents the content of a message to be sent as a result of an inline query. Telegram clients currently support the following types:
555
+
556
+ - InputTextMessageContent
557
+ - InputRichMessageContent
558
+ - InputLocationMessageContent
559
+ - InputVenueMessageContent
560
+ - InputContactMessageContent
561
+ - InputInvoiceMessageContent */
562
+ export type InputMessageContent<F> = InputTextMessageContent | InputRichMessageContent<F> | InputLocationMessageContent | InputVenueMessageContent | InputContactMessageContent | InputInvoiceMessageContent;
563
+ /** Represents the content of a text message to be sent as the result of an inline query. */
564
+ export interface InputTextMessageContent {
565
+ /** Text of the message to be sent, 1-4096 characters */
566
+ message_text: string;
567
+ /** Mode for parsing entities in the message text. See formatting options for more details. */
568
+ parse_mode?: ParseMode;
569
+ /** List of special entities that appear in message text, which can be specified instead of parse_mode */
570
+ entities?: MessageEntity[];
571
+ /** Link preview generation options for the message */
572
+ link_preview_options?: LinkPreviewOptions;
573
+ }
574
+ /** Represents the content of a rich message to be sent as the result of an inline query. */
575
+ export interface InputRichMessageContent<F> {
576
+ /** The message to be sent */
577
+ rich_message: InputRichMessage<F>;
578
+ }
579
+ /** Represents the content of a location message to be sent as the result of an inline query. */
580
+ export interface InputLocationMessageContent {
581
+ /** Latitude of the location in degrees */
582
+ latitude: number;
583
+ /** Longitude of the location in degrees */
584
+ longitude: number;
585
+ /** The radius of uncertainty for the location, measured in meters; 0-1500 */
586
+ horizontal_accuracy?: number;
587
+ /** Period in seconds during which the location can be updated, must be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely */
588
+ live_period?: number;
589
+ /** For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. */
590
+ heading?: number;
591
+ /** For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. */
592
+ proximity_alert_radius?: number;
593
+ }
594
+ /** Represents the content of a venue message to be sent as the result of an inline query. */
595
+ export interface InputVenueMessageContent {
596
+ /** Latitude of the venue in degrees */
597
+ latitude: number;
598
+ /** Longitude of the venue in degrees */
599
+ longitude: number;
600
+ /** Name of the venue */
601
+ title: string;
602
+ /** Address of the venue */
603
+ address: string;
604
+ /** Foursquare identifier of the venue, if known */
605
+ foursquare_id?: string;
606
+ /** Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) */
607
+ foursquare_type?: string;
608
+ /** Google Places identifier of the venue */
609
+ google_place_id?: string;
610
+ /** Google Places type of the venue. (See supported types.) */
611
+ google_place_type?: string;
612
+ }
613
+ /** Represents the content of a contact message to be sent as the result of an inline query. */
614
+ export interface InputContactMessageContent {
615
+ /** Contact's phone number */
616
+ phone_number: string;
617
+ /** Contact's first name */
618
+ first_name: string;
619
+ /** Contact's last name */
620
+ last_name?: string;
621
+ /** Additional data about the contact in the form of a vCard, 0-2048 bytes */
622
+ vcard?: string;
623
+ }
624
+ /** Represents the content of an invoice message to be sent as the result of an inline query. */
625
+ export interface InputInvoiceMessageContent {
626
+ /** Product name, 1-32 characters */
627
+ title: string;
628
+ /** Product description, 1-255 characters */
629
+ description: string;
630
+ /** Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes. */
631
+ payload: string;
632
+ /** Payment provider token, obtained via `@BotFather`. Pass an empty string for payments in Telegram Stars. */
633
+ provider_token?: string;
634
+ /** Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars. */
635
+ currency: string;
636
+ /** Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars. */
637
+ prices: LabeledPrice[];
638
+ /** The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars. */
639
+ max_tip_amount?: number;
640
+ /** An Array of suggested amounts of tip in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. */
641
+ suggested_tip_amounts?: number[];
642
+ /** Data about the invoice, which will be shared with the payment provider. A detailed description of the required fields should be provided by the payment provider. */
643
+ provider_data?: string;
644
+ /** URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. */
645
+ photo_url?: string;
646
+ /** Photo size in bytes */
647
+ photo_size?: number;
648
+ /** Photo width */
649
+ photo_width?: number;
650
+ /** Photo height */
651
+ photo_height?: number;
652
+ /** Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars. */
653
+ need_name?: boolean;
654
+ /** Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars. */
655
+ need_phone_number?: boolean;
656
+ /** Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars. */
657
+ need_email?: boolean;
658
+ /** Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars. */
659
+ need_shipping_address?: boolean;
660
+ /** Pass True if the user's phone number should be sent to provider. Ignored for payments in Telegram Stars. */
661
+ send_phone_number_to_provider?: boolean;
662
+ /** Pass True if the user's email address should be sent to provider. Ignored for payments in Telegram Stars. */
663
+ send_email_to_provider?: boolean;
664
+ /** Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars. */
665
+ is_flexible?: boolean;
666
+ }
667
+ /** Represents a result of an inline query that was chosen by the user and sent to their chat partner.
668
+
669
+ Note: It is necessary to enable inline feedback via `@BotFather` in order to receive these objects in updates. */
670
+ export interface ChosenInlineResult {
671
+ /** The unique identifier for the result that was chosen */
672
+ result_id: string;
673
+ /** The user that chose the result */
674
+ from: User;
675
+ /** Sender location, only for bots that require user location */
676
+ location?: Location;
677
+ /** Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message. */
678
+ inline_message_id?: string;
679
+ /** The query that was used to obtain the result */
680
+ query: string;
681
+ }
682
+ /** This object represents a button to be shown above inline query results. You must use exactly one of the optional fields.
683
+
684
+ Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities. */
685
+ export interface InlineQueryResultsButton {
686
+ /** Label text on the button */
687
+ text: string;
688
+ /** Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method web_app_switch_inline_query inside the Web App. */
689
+ web_app?: WebAppInfo;
690
+ /** Deep-linking parameter for the /start message sent to the bot when a user presses the button. 1-64 characters, only `A-Z`, `a-z`, `0-9`, `_` and `-` are allowed. */
691
+ start_parameter?: string;
692
+ }
node_modules/@grammyjs/types/langs.d.ts ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /** A two-letter ISO 639-1 language code.
2
+ * @see https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes
3
+ * @see https://www.loc.gov/standards/iso639-2/php/code_list.php
4
+ */
5
+ export type LanguageCode = typeof LanguageCodes[keyof typeof LanguageCodes];
6
+ /**
7
+ * @see {@link LanguageCode}
8
+ */
9
+ export declare const LanguageCodes: {
10
+ readonly Abkhazian: "ab";
11
+ readonly Afar: "aa";
12
+ readonly Afrikaans: "af";
13
+ readonly Akan: "ak";
14
+ readonly Albanian: "sq";
15
+ readonly Amharic: "am";
16
+ readonly Arabic: "ar";
17
+ readonly Aragonese: "an";
18
+ readonly Armenian: "hy";
19
+ readonly Assamese: "as";
20
+ readonly Avaric: "av";
21
+ readonly Avestan: "ae";
22
+ readonly Aymara: "ay";
23
+ readonly Azerbaijani: "az";
24
+ readonly Bambara: "bm";
25
+ readonly Bashkir: "ba";
26
+ readonly Basque: "eu";
27
+ readonly Belarusian: "be";
28
+ readonly Bengali: "bn";
29
+ readonly Bislama: "bi";
30
+ readonly Bosnian: "bs";
31
+ readonly Breton: "br";
32
+ readonly Bulgarian: "bg";
33
+ readonly Burmese: "my";
34
+ readonly Catalan: "ca";
35
+ readonly Chamorro: "ch";
36
+ readonly Chechen: "ce";
37
+ readonly Chichewa: "ny";
38
+ readonly Chinese: "zh";
39
+ readonly ChurchSlavonic: "cu";
40
+ readonly Chuvash: "cv";
41
+ readonly Cornish: "kw";
42
+ readonly Corsican: "co";
43
+ readonly Cree: "cr";
44
+ readonly Croatian: "hr";
45
+ readonly Czech: "cs";
46
+ readonly Danish: "da";
47
+ readonly Divehi: "dv";
48
+ readonly Dutch: "nl";
49
+ readonly Dzongkha: "dz";
50
+ readonly English: "en";
51
+ readonly Esperanto: "eo";
52
+ readonly Estonian: "et";
53
+ readonly Ewe: "ee";
54
+ readonly Faroese: "fo";
55
+ readonly Fijian: "fj";
56
+ readonly Finnish: "fi";
57
+ readonly French: "fr";
58
+ readonly WesternFrisian: "fy";
59
+ readonly Fulah: "ff";
60
+ readonly Gaelic: "gd";
61
+ readonly Galician: "gl";
62
+ readonly Ganda: "lg";
63
+ readonly Georgian: "ka";
64
+ readonly German: "de";
65
+ readonly Greek: "el";
66
+ readonly Kalaallisut: "kl";
67
+ readonly Guarani: "gn";
68
+ readonly Gujarati: "gu";
69
+ readonly Haitian: "ht";
70
+ readonly Hausa: "ha";
71
+ readonly Hebrew: "he";
72
+ readonly Herero: "hz";
73
+ readonly Hindi: "hi";
74
+ readonly HiriMotu: "ho";
75
+ readonly Hungarian: "hu";
76
+ readonly Icelandic: "is";
77
+ readonly Ido: "io";
78
+ readonly Igbo: "ig";
79
+ readonly Indonesian: "id";
80
+ readonly Interlingua: "ia";
81
+ readonly Interlingue: "ie";
82
+ readonly Inuktitut: "iu";
83
+ readonly Inupiaq: "ik";
84
+ readonly Irish: "ga";
85
+ readonly Italian: "it";
86
+ readonly Japanese: "ja";
87
+ readonly Javanese: "jv";
88
+ readonly Kannada: "kn";
89
+ readonly Kanuri: "kr";
90
+ readonly Kashmiri: "ks";
91
+ readonly Kazakh: "kk";
92
+ readonly CentralKhmer: "km";
93
+ readonly Kikuyu: "ki";
94
+ readonly Kinyarwanda: "rw";
95
+ readonly Kirghiz: "ky";
96
+ readonly Komi: "kv";
97
+ readonly Kongo: "kg";
98
+ readonly Korean: "ko";
99
+ readonly Kuanyama: "kj";
100
+ readonly Kurdish: "ku";
101
+ readonly Lao: "lo";
102
+ readonly Latin: "la";
103
+ readonly Latvian: "lv";
104
+ readonly Limburgan: "li";
105
+ readonly Lingala: "ln";
106
+ readonly Lithuanian: "lt";
107
+ readonly LubaKatanga: "lu";
108
+ readonly Luxembourgish: "lb";
109
+ readonly Macedonian: "mk";
110
+ readonly Malagasy: "mg";
111
+ readonly Malay: "ms";
112
+ readonly Malayalam: "ml";
113
+ readonly Maltese: "mt";
114
+ readonly Manx: "gv";
115
+ readonly Maori: "mi";
116
+ readonly Marathi: "mr";
117
+ readonly Marshallese: "mh";
118
+ readonly Mongolian: "mn";
119
+ readonly Nauru: "na";
120
+ readonly Navajo: "nv";
121
+ readonly NorthNdebele: "nd";
122
+ readonly SouthNdebele: "nr";
123
+ readonly Ndonga: "ng";
124
+ readonly Nepali: "ne";
125
+ readonly Norwegian: "no";
126
+ readonly NorwegianBokmål: "nb";
127
+ readonly NorwegianNynorsk: "nn";
128
+ readonly SichuanYi: "ii";
129
+ readonly Occitan: "oc";
130
+ readonly Ojibwa: "oj";
131
+ readonly Oriya: "or";
132
+ readonly Oromo: "om";
133
+ readonly Ossetian: "os";
134
+ readonly Pali: "pi";
135
+ readonly Pashto: "ps";
136
+ readonly Persian: "fa";
137
+ readonly Polish: "pl";
138
+ readonly Portuguese: "pt";
139
+ readonly Punjabi: "pa";
140
+ readonly Quechua: "qu";
141
+ readonly Romanian: "ro";
142
+ readonly Romansh: "rm";
143
+ readonly Rundi: "rn";
144
+ readonly Russian: "ru";
145
+ readonly NorthernSami: "se";
146
+ readonly Samoan: "sm";
147
+ readonly Sango: "sg";
148
+ readonly Sanskrit: "sa";
149
+ readonly Sardinian: "sc";
150
+ readonly Serbian: "sr";
151
+ readonly Shona: "sn";
152
+ readonly Sindhi: "sd";
153
+ readonly Sinhala: "si";
154
+ readonly Slovak: "sk";
155
+ readonly Slovenian: "sl";
156
+ readonly Somali: "so";
157
+ readonly SouthernSotho: "st";
158
+ readonly Spanish: "es";
159
+ readonly Sundanese: "su";
160
+ readonly Swahili: "sw";
161
+ readonly Swati: "ss";
162
+ readonly Swedish: "sv";
163
+ readonly Tagalog: "tl";
164
+ readonly Tahitian: "ty";
165
+ readonly Tajik: "tg";
166
+ readonly Tamil: "ta";
167
+ readonly Tatar: "tt";
168
+ readonly Telugu: "te";
169
+ readonly Thai: "th";
170
+ readonly Tibetan: "bo";
171
+ readonly Tigrinya: "ti";
172
+ readonly Tonga: "to";
173
+ readonly Tsonga: "ts";
174
+ readonly Tswana: "tn";
175
+ readonly Turkish: "tr";
176
+ readonly Turkmen: "tk";
177
+ readonly Twi: "tw";
178
+ readonly Uighur: "ug";
179
+ readonly Ukrainian: "uk";
180
+ readonly Urdu: "ur";
181
+ readonly Uzbek: "uz";
182
+ readonly Venda: "ve";
183
+ readonly Vietnamese: "vi";
184
+ readonly Volapük: "vo";
185
+ readonly Walloon: "wa";
186
+ readonly Welsh: "cy";
187
+ readonly Wolof: "wo";
188
+ readonly Xhosa: "xh";
189
+ readonly Yiddish: "yi";
190
+ readonly Yoruba: "yo";
191
+ readonly Zhuang: "za";
192
+ readonly Zulu: "zu";
193
+ };
node_modules/@grammyjs/types/manage.d.ts ADDED
@@ -0,0 +1,1144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { Audio, Location, Message, PhotoSize, ReactionType, Sticker } from "./message.js";
2
+ import type { UniqueGiftColors } from "./payment.js";
3
+ import type { Update } from "./update.js";
4
+ /** Describes the current status of a webhook. */
5
+ export interface WebhookInfo {
6
+ /** Webhook URL, may be empty if webhook is not set up */
7
+ url?: string;
8
+ /** True, if a custom certificate was provided for webhook certificate checks */
9
+ has_custom_certificate: boolean;
10
+ /** Number of updates awaiting delivery */
11
+ pending_update_count: number;
12
+ /** Currently used webhook IP address */
13
+ ip_address?: string;
14
+ /** Unix time for the most recent error that happened when trying to deliver an update via webhook */
15
+ last_error_date?: number;
16
+ /** Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook */
17
+ last_error_message?: string;
18
+ /** Unix time of the most recent error that happened when trying to synchronize available updates with Telegram datacenters */
19
+ last_synchronization_error_date?: number;
20
+ /** The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery */
21
+ max_connections?: number;
22
+ /** A list of update types the bot is subscribed to. Defaults to all update types except chat_member, message_reaction, and message_reaction_count. */
23
+ allowed_updates?: Array<Exclude<keyof Update, "update_id">>;
24
+ }
25
+ /** This object describes the types of gifts that can be gifted to a user or a chat. */
26
+ export interface AcceptedGiftTypes {
27
+ /** True, if unlimited regular gifts are accepted */
28
+ unlimited_gifts: boolean;
29
+ /** True, if limited regular gifts are accepted */
30
+ limited_gifts: boolean;
31
+ /** True, if unique gifts or gifts that can be upgraded to unique for free are accepted */
32
+ unique_gifts: boolean;
33
+ /** True, if a Telegram Premium subscription is accepted */
34
+ premium_subscription: boolean;
35
+ /** True, if transfers of unique gifts from channels are accepted */
36
+ gifts_from_channels: boolean;
37
+ }
38
+ /** This object represents a Telegram user or bot. */
39
+ export interface User {
40
+ /** Unique identifier for this user or bot. */
41
+ id: number;
42
+ /** True, if this user is a bot */
43
+ is_bot: boolean;
44
+ /** User's or bot's first name */
45
+ first_name: string;
46
+ /** User's or bot's last name */
47
+ last_name?: string;
48
+ /** User's or bot's username */
49
+ username?: string;
50
+ /** IETF language tag of the user's language */
51
+ language_code?: string;
52
+ /** True, if this user is a Telegram Premium user */
53
+ is_premium?: true;
54
+ /** True, if this user added the bot to the attachment menu */
55
+ added_to_attachment_menu?: true;
56
+ }
57
+ /** This object represents a Telegram user or bot that was returned by `getMe`. */
58
+ export interface UserFromGetMe extends User {
59
+ is_bot: true;
60
+ username: string;
61
+ /** True, if the bot can be invited to groups. Returned only in getMe. */
62
+ can_join_groups: boolean;
63
+ /** True, if privacy mode is disabled for the bot. Returned only in getMe. */
64
+ can_read_all_group_messages: boolean;
65
+ /** True, if the bot supports guest queries from chats it is not a member of. Returned only in getMe. */
66
+ supports_guest_queries?: boolean;
67
+ /** True, if the bot supports inline queries. Returned only in getMe. */
68
+ supports_inline_queries: boolean;
69
+ /** True, if the bot can be connected to a user account to manage it. Returned only in getMe. */
70
+ can_connect_to_business: boolean;
71
+ /** True, if the bot has main Web App. Returned only in getMe. */
72
+ has_main_web_app: boolean;
73
+ /** True, if the bot has forum topic mode enabled in private chats. Returned only in getMe. */
74
+ has_topics_enabled: boolean;
75
+ /** True, if the bot allows users to create and delete topics in private chats. Returned only in getMe. */
76
+ allows_users_to_create_topics: boolean;
77
+ /** True, if other bots can be created to be controlled by the bot. Returned only in getMe. */
78
+ can_manage_bots: boolean;
79
+ /** True, if the bot supports join request queries and can be assigned to process them. Returned only in getMe. */
80
+ supports_join_request_queries: boolean;
81
+ }
82
+ /** This object contains information about the bot that was created to be managed by the current bot. */
83
+ export interface ManagedBotCreated {
84
+ /** Information about the bot. The bot's token can be fetched using the method getManagedBotToken. */
85
+ bot: User;
86
+ }
87
+ /** This object contains information about the creation, token update, or owner update of a bot that is managed by the current bot. */
88
+ export interface ManagedBotUpdated {
89
+ /** User that created the bot */
90
+ user: User;
91
+ /** Information about the bot. Token of the bot can be fetched using the method getManagedBotToken. */
92
+ bot: User;
93
+ }
94
+ /** Describes a service message about the chat owner leaving the chat. */
95
+ export interface ChatOwnerLeft {
96
+ /** The user who will become the new owner of the chat if the previous owner does not return to the chat */
97
+ new_owner?: User;
98
+ }
99
+ /** Describes a service message about an ownership change in the chat. */
100
+ export interface ChatOwnerChanged {
101
+ /** The new owner of the chat */
102
+ new_owner: User;
103
+ }
104
+ /** This object describes the rating of a user based on their Telegram Star spendings. */
105
+ export interface UserRating {
106
+ /** Current level of the user, indicating their reliability when purchasing digital goods and services. A higher level suggests a more trustworthy customer; a negative level is likely reason for concern. */
107
+ level: number;
108
+ /** Numerical value of the user's rating; the higher the rating, the better */
109
+ rating: number;
110
+ /** The rating value required to get the current level */
111
+ current_level_rating: number;
112
+ /** The rating value required to get to the next level; omitted if the maximum level was reached */
113
+ next_level_rating?: number;
114
+ }
115
+ export declare namespace Chat {
116
+ /** Internal type for private chats */
117
+ interface PrivateChat {
118
+ /** Unique identifier for this chat. */
119
+ id: number;
120
+ /** Type of the chat, can be either “private”, “group”, “supergroup” or “channel” */
121
+ type: "private";
122
+ /** Title, for supergroups, channels and group chats */
123
+ title?: undefined;
124
+ /** Username, for private chats, supergroups and channels if available */
125
+ username?: string;
126
+ /** First name of the other party in a private chat */
127
+ first_name: string;
128
+ /** Last name of the other party in a private chat */
129
+ last_name?: string;
130
+ /** True, if the supergroup chat is a forum (has topics enabled) */
131
+ is_forum?: undefined;
132
+ /** True, if the chat is the direct messages chat of a channel */
133
+ is_direct_messages?: undefined;
134
+ }
135
+ /** Internal type for group chats */
136
+ interface GroupChat {
137
+ /** Unique identifier for this chat. */
138
+ id: number;
139
+ /** Type of the chat, can be either “private”, “group”, “supergroup” or “channel” */
140
+ type: "group";
141
+ /** Title, for supergroups, channels and group chats */
142
+ title: string;
143
+ /** Username, for private chats, supergroups and channels if available */
144
+ username?: undefined;
145
+ /** First name of the other party in a private chat */
146
+ first_name?: undefined;
147
+ /** Last name of the other party in a private chat */
148
+ last_name?: undefined;
149
+ /** True, if the supergroup chat is a forum (has topics enabled) */
150
+ is_forum?: undefined;
151
+ /** True, if the chat is the direct messages chat of a channel */
152
+ is_direct_messages?: undefined;
153
+ }
154
+ /** Internal type for supergroup chats */
155
+ interface SupergroupChat {
156
+ /** Unique identifier for this chat. */
157
+ id: number;
158
+ /** Type of the chat, can be either “private”, “group”, “supergroup” or “channel” */
159
+ type: "supergroup";
160
+ /** Title, for supergroups, channels and group chats */
161
+ title: string;
162
+ /** Username, for private chats, supergroups and channels if available */
163
+ username?: string;
164
+ /** First name of the other party in a private chat */
165
+ first_name?: undefined;
166
+ /** Last name of the other party in a private chat */
167
+ last_name?: undefined;
168
+ /** True, if the supergroup chat is a forum (has topics enabled) */
169
+ is_forum?: true;
170
+ /** True, if the chat is the direct messages chat of a channel */
171
+ is_direct_messages?: true;
172
+ }
173
+ /** Internal type for channel chats */
174
+ interface ChannelChat {
175
+ /** Unique identifier for this chat. */
176
+ id: number;
177
+ /** Type of the chat, can be either “private”, “group”, “supergroup” or “channel” */
178
+ type: "channel";
179
+ /** Title, for supergroups, channels and group chats */
180
+ title: string;
181
+ /** Username, for private chats, supergroups and channels if available */
182
+ username?: string;
183
+ /** First name of the other party in a private chat */
184
+ first_name?: undefined;
185
+ /** Last name of the other party in a private chat */
186
+ last_name?: undefined;
187
+ /** True, if the supergroup chat is a forum (has topics enabled) */
188
+ is_forum?: undefined;
189
+ /** True, if the chat is the direct messages chat of a channel */
190
+ is_direct_messages?: undefined;
191
+ }
192
+ }
193
+ /** This object represents a chat. */
194
+ export type Chat = Chat.PrivateChat | Chat.GroupChat | Chat.SupergroupChat | Chat.ChannelChat;
195
+ export declare namespace ChatFullInfo {
196
+ /** Internal type for private chats */
197
+ interface PrivateChat {
198
+ /** Unique identifier for this chat. */
199
+ id: number;
200
+ /** Type of the chat, can be either “private”, “group”, “supergroup” or “channel” */
201
+ type: "private";
202
+ /** Title, for supergroups, channels and group chats */
203
+ title?: undefined;
204
+ /** Username, for private chats, supergroups and channels if available */
205
+ username?: string;
206
+ /** First name of the other party in a private chat */
207
+ first_name: string;
208
+ /** Last name of the other party in a private chat */
209
+ last_name?: string;
210
+ /** True, if the supergroup chat is a forum (has topics enabled) */
211
+ is_forum?: undefined;
212
+ /** True, if the chat is the direct messages chat of a channel */
213
+ is_direct_messages?: undefined;
214
+ /** Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview. See accent colors for more details. */
215
+ accent_color_id: number;
216
+ /** The maximum number of reactions that can be set on a message in the chat */
217
+ max_reaction_count: number;
218
+ /** Chat photo */
219
+ photo?: ChatPhoto;
220
+ /** For private chats, the first audio added to the profile of the user */
221
+ first_profile_audio?: Audio;
222
+ /** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels */
223
+ active_usernames?: string[];
224
+ /** For private chats, the date of birth of the user */
225
+ birthdate?: Birthdate;
226
+ /** For private chats with business accounts, the intro of the business */
227
+ business_intro?: BusinessIntro;
228
+ /** For private chats with business accounts, the location of the business */
229
+ business_location?: BusinessLocation;
230
+ /** For private chats with business accounts, the opening hours of the business */
231
+ business_opening_hours?: BusinessOpeningHours;
232
+ /** For private chats, the rating of the user if any */
233
+ rating?: UserRating;
234
+ /** The color scheme based on a unique gift that must be used for the chat's name, message replies and link previews */
235
+ unique_gift_colors?: UniqueGiftColors;
236
+ /** For private chats, the personal channel of the user */
237
+ personal_chat?: Chat;
238
+ /** Information about the corresponding channel chat; for direct messages chats only */
239
+ parent_chat?: undefined;
240
+ /** List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. */
241
+ available_reactions?: ReactionType[];
242
+ /** Custom emoji identifier of the emoji chosen by the chat for the reply header and link preview background */
243
+ background_custom_emoji_id?: string;
244
+ /** Identifier of the accent color for the chat's profile background. See profile accent colors for more details. */
245
+ profile_accent_color_id?: number;
246
+ /** Custom emoji identifier of the emoji chosen by the chat for its profile background */
247
+ profile_background_custom_emoji_id?: string;
248
+ /** Custom emoji identifier of the emoji status of the chat or the other party in a private chat */
249
+ emoji_status_custom_emoji_id?: string;
250
+ /** Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if any */
251
+ emoji_status_expiration_date?: number;
252
+ /** Bio of the other party in a private chat */
253
+ bio?: string;
254
+ /** True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user */
255
+ has_private_forwards?: true;
256
+ /** True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat */
257
+ has_restricted_voice_and_video_messages?: true;
258
+ /** True, if users need to join the supergroup before they can send messages */
259
+ join_to_send_messages?: undefined;
260
+ /** True, if all users directly joining the supergroup without using an invite link need to be approved by supergroup administrators */
261
+ join_by_request?: undefined;
262
+ /** Description, for groups, supergroups and channel chats */
263
+ description?: undefined;
264
+ /** Primary invite link, for groups, supergroups and channel chats */
265
+ invite_link?: undefined;
266
+ /** The most recent pinned message (by sending date) */
267
+ pinned_message?: Message;
268
+ /** Default chat member permissions, for groups and supergroups */
269
+ permissions?: undefined;
270
+ /** Information about types of gifts that are accepted by the chat or by the corresponding user for private chats */
271
+ accepted_gift_types: AcceptedGiftTypes;
272
+ /** True, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats. */
273
+ can_send_paid_media?: undefined;
274
+ /** For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds */
275
+ slow_mode_delay?: undefined;
276
+ /** For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions */
277
+ unrestrict_boost_count?: undefined;
278
+ /** The time after which all messages sent to the chat will be automatically deleted; in seconds */
279
+ message_auto_delete_time?: number;
280
+ /** True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. */
281
+ has_aggressive_anti_spam_enabled?: undefined;
282
+ /** True, if non-administrators can only get the list of bots and administrators in the chat */
283
+ has_hidden_members?: undefined;
284
+ /** True, if messages from the chat can't be forwarded to other chats */
285
+ has_protected_content?: true;
286
+ /** True, if new chat members will have access to old messages; available only to chat administrators */
287
+ has_visible_history?: undefined;
288
+ /** For supergroups, name of the group sticker set */
289
+ sticker_set_name?: undefined;
290
+ /** True, if the bot can change the group sticker set */
291
+ can_set_sticker_set?: undefined;
292
+ /** For supergroups, the name of the group's custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group. */
293
+ custom_emoji_sticker_set_name?: undefined;
294
+ /** Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. */
295
+ linked_chat_id?: undefined;
296
+ /** For supergroups, the location to which the supergroup is connected */
297
+ location?: undefined;
298
+ /** The number of Telegram Stars a general user have to pay to send a message to the chat */
299
+ paid_message_star_count?: number;
300
+ /** The bot that processes join request queries in the chat. The field is only available to chat administrators. */
301
+ guard_bot?: undefined;
302
+ /** The Community to which the chat belongs */
303
+ community?: Community;
304
+ }
305
+ /** Internal type for group chats */
306
+ interface GroupChat {
307
+ /** Unique identifier for this chat. */
308
+ id: number;
309
+ /** Type of the chat, can be either “private”, “group”, “supergroup” or “channel” */
310
+ type: "group";
311
+ /** Title, for supergroups, channels and group chats */
312
+ title: string;
313
+ /** Username, for private chats, supergroups and channels if available */
314
+ username?: undefined;
315
+ /** First name of the other party in a private chat */
316
+ first_name?: undefined;
317
+ /** Last name of the other party in a private chat */
318
+ last_name?: undefined;
319
+ /** True, if the supergroup chat is a forum (has topics enabled) */
320
+ is_forum?: undefined;
321
+ /** True, if the chat is the direct messages chat of a channel */
322
+ is_direct_messages?: undefined;
323
+ /** Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview. See accent colors for more details. */
324
+ accent_color_id: number;
325
+ /** The maximum number of reactions that can be set on a message in the chat */
326
+ max_reaction_count: number;
327
+ /** Chat photo */
328
+ photo?: ChatPhoto;
329
+ /** For private chats, the first audio added to the profile of the user */
330
+ first_profile_audio?: undefined;
331
+ /** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels */
332
+ active_usernames?: undefined;
333
+ /** For private chats, the date of birth of the user */
334
+ birthdate?: undefined;
335
+ /** For private chats with business accounts, the intro of the business */
336
+ business_intro?: undefined;
337
+ /** For private chats with business accounts, the location of the business */
338
+ business_location?: undefined;
339
+ /** For private chats with business accounts, the opening hours of the business */
340
+ business_opening_hours?: undefined;
341
+ /** For private chats, the rating of the user if any */
342
+ rating?: undefined;
343
+ /** The color scheme based on a unique gift that must be used for the chat's name, message replies and link previews */
344
+ unique_gift_colors?: UniqueGiftColors;
345
+ /** For private chats, the personal channel of the user */
346
+ personal_chat?: undefined;
347
+ /** Information about the corresponding channel chat; for direct messages chats only */
348
+ parent_chat?: undefined;
349
+ /** List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. */
350
+ available_reactions?: ReactionType[];
351
+ /** Custom emoji identifier of the emoji chosen by the chat for the reply header and link preview background */
352
+ background_custom_emoji_id?: string;
353
+ /** Identifier of the accent color for the chat's profile background. See profile accent colors for more details. */
354
+ profile_accent_color_id?: number;
355
+ /** Custom emoji identifier of the emoji chosen by the chat for its profile background */
356
+ profile_background_custom_emoji_id?: string;
357
+ /** Custom emoji identifier of the emoji status of the chat or the other party in a private chat */
358
+ emoji_status_custom_emoji_id?: string;
359
+ /** Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if any */
360
+ emoji_status_expiration_date?: number;
361
+ /** Bio of the other party in a private chat */
362
+ bio?: undefined;
363
+ /** True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user */
364
+ has_private_forwards?: undefined;
365
+ /** True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat */
366
+ has_restricted_voice_and_video_messages?: undefined;
367
+ /** True, if users need to join the supergroup before they can send messages */
368
+ join_to_send_messages?: undefined;
369
+ /** True, if all users directly joining the supergroup without using an invite link need to be approved by supergroup administrators */
370
+ join_by_request?: undefined;
371
+ /** Description, for groups, supergroups and channel chats */
372
+ description?: string;
373
+ /** Primary invite link, for groups, supergroups and channel chats */
374
+ invite_link?: string;
375
+ /** The most recent pinned message (by sending date) */
376
+ pinned_message?: Message;
377
+ /** Default chat member permissions, for groups and supergroups */
378
+ permissions?: ChatPermissions;
379
+ /** Information about types of gifts that are accepted by the chat or by the corresponding user for private chats */
380
+ accepted_gift_types: AcceptedGiftTypes;
381
+ /** True, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats. */
382
+ can_send_paid_media?: undefined;
383
+ /** For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds */
384
+ slow_mode_delay?: undefined;
385
+ /** For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions */
386
+ unrestrict_boost_count?: undefined;
387
+ /** The time after which all messages sent to the chat will be automatically deleted; in seconds */
388
+ message_auto_delete_time?: number;
389
+ /** True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. */
390
+ has_aggressive_anti_spam_enabled?: undefined;
391
+ /** True, if non-administrators can only get the list of bots and administrators in the chat */
392
+ has_hidden_members?: true;
393
+ /** True, if messages from the chat can't be forwarded to other chats */
394
+ has_protected_content?: true;
395
+ /** True, if new chat members will have access to old messages; available only to chat administrators */
396
+ has_visible_history?: true;
397
+ /** For supergroups, name of the group sticker set */
398
+ sticker_set_name?: undefined;
399
+ /** True, if the bot can change the group sticker set */
400
+ can_set_sticker_set?: true;
401
+ /** For supergroups, the name of the group's custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group. */
402
+ custom_emoji_sticker_set_name?: undefined;
403
+ /** Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. */
404
+ linked_chat_id?: undefined;
405
+ /** For supergroups, the location to which the supergroup is connected */
406
+ location?: undefined;
407
+ /** The number of Telegram Stars a general user have to pay to send a message to the chat */
408
+ paid_message_star_count?: number;
409
+ /** The bot that processes join request queries in the chat. The field is only available to chat administrators. */
410
+ guard_bot?: User;
411
+ /** The Community to which the chat belongs */
412
+ community?: Community;
413
+ }
414
+ /** Internal type for supergroup chats */
415
+ interface SupergroupChat {
416
+ /** Unique identifier for this chat. */
417
+ id: number;
418
+ /** Type of the chat, can be either “private”, “group”, “supergroup” or “channel” */
419
+ type: "supergroup";
420
+ /** Title, for supergroups, channels and group chats */
421
+ title: string;
422
+ /** Username, for private chats, supergroups and channels if available */
423
+ username?: string;
424
+ /** First name of the other party in a private chat */
425
+ first_name?: undefined;
426
+ /** Last name of the other party in a private chat */
427
+ last_name?: undefined;
428
+ /** True, if the supergroup chat is a forum (has topics enabled) */
429
+ is_forum?: true;
430
+ /** True, if the chat is the direct messages chat of a channel */
431
+ is_direct_messages?: true;
432
+ /** Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview. See accent colors for more details. */
433
+ accent_color_id: number;
434
+ /** The maximum number of reactions that can be set on a message in the chat */
435
+ max_reaction_count: number;
436
+ /** Chat photo */
437
+ photo?: ChatPhoto;
438
+ /** For private chats, the first audio added to the profile of the user */
439
+ first_profile_audio?: undefined;
440
+ /** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels */
441
+ active_usernames?: string[];
442
+ /** For private chats, the date of birth of the user */
443
+ birthdate?: undefined;
444
+ /** For private chats with business accounts, the intro of the business */
445
+ business_intro?: undefined;
446
+ /** For private chats with business accounts, the location of the business */
447
+ business_location?: undefined;
448
+ /** For private chats with business accounts, the opening hours of the business */
449
+ business_opening_hours?: undefined;
450
+ /** For private chats, the rating of the user if any */
451
+ rating?: undefined;
452
+ /** The color scheme based on a unique gift that must be used for the chat's name, message replies and link previews */
453
+ unique_gift_colors?: UniqueGiftColors;
454
+ /** For private chats, the personal channel of the user */
455
+ personal_chat?: undefined;
456
+ /** Information about the corresponding channel chat; for direct messages chats only */
457
+ parent_chat?: Chat.ChannelChat;
458
+ /** List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. */
459
+ available_reactions?: ReactionType[];
460
+ /** Custom emoji identifier of the emoji chosen by the chat for the reply header and link preview background */
461
+ background_custom_emoji_id?: string;
462
+ /** Identifier of the accent color for the chat's profile background. See profile accent colors for more details. */
463
+ profile_accent_color_id?: number;
464
+ /** Custom emoji identifier of the emoji chosen by the chat for its profile background */
465
+ profile_background_custom_emoji_id?: string;
466
+ /** Custom emoji identifier of the emoji status of the chat or the other party in a private chat */
467
+ emoji_status_custom_emoji_id?: string;
468
+ /** Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if any */
469
+ emoji_status_expiration_date?: number;
470
+ /** Bio of the other party in a private chat */
471
+ bio?: string;
472
+ /** True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user */
473
+ has_private_forwards?: undefined;
474
+ /** True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat */
475
+ has_restricted_voice_and_video_messages?: undefined;
476
+ /** True, if users need to join the supergroup before they can send messages */
477
+ join_to_send_messages?: true;
478
+ /** True, if all users directly joining the supergroup without using an invite link need to be approved by supergroup administrators */
479
+ join_by_request?: true;
480
+ /** Description, for groups, supergroups and channel chats */
481
+ description?: string;
482
+ /** Primary invite link, for groups, supergroups and channel chats */
483
+ invite_link?: string;
484
+ /** The most recent pinned message (by sending date) */
485
+ pinned_message?: Message;
486
+ /** Default chat member permissions, for groups and supergroups */
487
+ permissions?: ChatPermissions;
488
+ /** Information about types of gifts that are accepted by the chat or by the corresponding user for private chats */
489
+ accepted_gift_types: AcceptedGiftTypes;
490
+ /** True, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats. */
491
+ can_send_paid_media?: undefined;
492
+ /** For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds */
493
+ slow_mode_delay?: number;
494
+ /** For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions */
495
+ unrestrict_boost_count?: number;
496
+ /** The time after which all messages sent to the chat will be automatically deleted; in seconds */
497
+ message_auto_delete_time?: number;
498
+ /** True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. */
499
+ has_aggressive_anti_spam_enabled?: true;
500
+ /** True, if non-administrators can only get the list of bots and administrators in the chat */
501
+ has_hidden_members?: true;
502
+ /** True, if messages from the chat can't be forwarded to other chats */
503
+ has_protected_content?: true;
504
+ /** True, if new chat members will have access to old messages; available only to chat administrators */
505
+ has_visible_history?: true;
506
+ /** For supergroups, name of the group sticker set */
507
+ sticker_set_name?: string;
508
+ /** True, if the bot can change the group sticker set */
509
+ can_set_sticker_set?: true;
510
+ /** For supergroups, the name of the group's custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group. */
511
+ custom_emoji_sticker_set_name?: string;
512
+ /** Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. */
513
+ linked_chat_id?: number;
514
+ /** For supergroups, the location to which the supergroup is connected */
515
+ location?: ChatLocation;
516
+ /** The number of Telegram Stars a general user have to pay to send a message to the chat */
517
+ paid_message_star_count?: number;
518
+ /** The bot that processes join request queries in the chat. The field is only available to chat administrators. */
519
+ guard_bot?: User;
520
+ /** The Community to which the chat belongs */
521
+ community?: Community;
522
+ }
523
+ /** Internal type for channel chats */
524
+ interface ChannelChat {
525
+ /** Unique identifier for this chat. */
526
+ id: number;
527
+ /** Type of the chat, can be either “private”, “group”, “supergroup” or “channel” */
528
+ type: "channel";
529
+ /** Title, for supergroups, channels and group chats */
530
+ title: string;
531
+ /** Username, for private chats, supergroups and channels if available */
532
+ username?: string;
533
+ /** First name of the other party in a private chat */
534
+ first_name?: undefined;
535
+ /** Last name of the other party in a private chat */
536
+ last_name?: undefined;
537
+ /** True, if the supergroup chat is a forum (has topics enabled) */
538
+ is_forum?: undefined;
539
+ /** True, if the chat is the direct messages chat of a channel */
540
+ is_direct_messages?: undefined;
541
+ /** Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview. See accent colors for more details. */
542
+ accent_color_id: number;
543
+ /** The maximum number of reactions that can be set on a message in the chat */
544
+ max_reaction_count: number;
545
+ /** Chat photo */
546
+ photo?: ChatPhoto;
547
+ /** For private chats, the first audio added to the profile of the user */
548
+ first_profile_audio?: undefined;
549
+ /** If non-empty, the list of all active chat usernames; for private chats, supergroups and channels */
550
+ active_usernames?: string[];
551
+ /** For private chats, the date of birth of the user */
552
+ birthdate?: undefined;
553
+ /** For private chats with business accounts, the intro of the business */
554
+ business_intro?: undefined;
555
+ /** For private chats with business accounts, the location of the business */
556
+ business_location?: undefined;
557
+ /** For private chats with business accounts, the opening hours of the business */
558
+ business_opening_hours?: undefined;
559
+ /** For private chats, the rating of the user if any */
560
+ rating?: undefined;
561
+ /** The color scheme based on a unique gift that must be used for the chat's name, message replies and link previews */
562
+ unique_gift_colors?: UniqueGiftColors;
563
+ /** For private chats, the personal channel of the user */
564
+ personal_chat?: undefined;
565
+ /** Information about the corresponding channel chat; for direct messages chats only */
566
+ parent_chat?: undefined;
567
+ /** List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. */
568
+ available_reactions?: ReactionType[];
569
+ /** Custom emoji identifier of the emoji chosen by the chat for the reply header and link preview background */
570
+ background_custom_emoji_id?: string;
571
+ /** Identifier of the accent color for the chat's profile background. See profile accent colors for more details. */
572
+ profile_accent_color_id?: number;
573
+ /** Custom emoji identifier of the emoji chosen by the chat for its profile background */
574
+ profile_background_custom_emoji_id?: string;
575
+ /** Custom emoji identifier of the emoji status of the chat or the other party in a private chat */
576
+ emoji_status_custom_emoji_id?: string;
577
+ /** Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if any */
578
+ emoji_status_expiration_date?: number;
579
+ /** Bio of the other party in a private chat */
580
+ bio?: undefined;
581
+ /** True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user */
582
+ has_private_forwards?: undefined;
583
+ /** True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat */
584
+ has_restricted_voice_and_video_messages?: undefined;
585
+ /** True, if users need to join the supergroup before they can send messages */
586
+ join_to_send_messages?: true;
587
+ /** True, if all users directly joining the supergroup without using an invite link need to be approved by supergroup administrators */
588
+ join_by_request?: undefined;
589
+ /** Description, for groups, supergroups and channel chats */
590
+ description?: string;
591
+ /** Primary invite link, for groups, supergroups and channel chats */
592
+ invite_link?: string;
593
+ /** The most recent pinned message (by sending date) */
594
+ pinned_message?: Message;
595
+ /** Default chat member permissions, for groups and supergroups */
596
+ permissions?: undefined;
597
+ /** Information about types of gifts that are accepted by the chat or by the corresponding user for private chats */
598
+ accepted_gift_types: AcceptedGiftTypes;
599
+ /** True, if paid media messages can be sent or forwarded to the channel chat. The field is available only for channel chats. */
600
+ can_send_paid_media?: true;
601
+ /** For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds */
602
+ slow_mode_delay?: undefined;
603
+ /** For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions */
604
+ unrestrict_boost_count?: undefined;
605
+ /** The time after which all messages sent to the chat will be automatically deleted; in seconds */
606
+ message_auto_delete_time?: number;
607
+ /** True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. */
608
+ has_aggressive_anti_spam_enabled?: undefined;
609
+ /** True, if non-administrators can only get the list of bots and administrators in the chat */
610
+ has_hidden_members?: undefined;
611
+ /** True, if messages from the chat can't be forwarded to other chats */
612
+ has_protected_content?: true;
613
+ /** True, if new chat members will have access to old messages; available only to chat administrators */
614
+ has_visible_history?: undefined;
615
+ /** For supergroups, name of the group sticker set */
616
+ sticker_set_name?: undefined;
617
+ /** True, if the bot can change the group sticker set */
618
+ can_set_sticker_set?: undefined;
619
+ /** For supergroups, the name of the group's custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group. */
620
+ custom_emoji_sticker_set_name?: undefined;
621
+ /** Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. */
622
+ linked_chat_id?: number;
623
+ /** For supergroups, the location to which the supergroup is connected */
624
+ location?: undefined;
625
+ /** The number of Telegram Stars a general user have to pay to send a message to the chat */
626
+ paid_message_star_count?: number;
627
+ /** The bot that processes join request queries in the chat. The field is only available to chat administrators. */
628
+ guard_bot?: User;
629
+ /** The Community to which the chat belongs */
630
+ community?: Community;
631
+ }
632
+ }
633
+ /** This object contains full information about a chat. */
634
+ export type ChatFullInfo = ChatFullInfo.PrivateChat | ChatFullInfo.GroupChat | ChatFullInfo.SupergroupChat | ChatFullInfo.ChannelChat;
635
+ /** @deprecated use ChatFullInfo instead */
636
+ export type ChatFromGetChat = ChatFullInfo;
637
+ /** This object represent a user's profile pictures. */
638
+ export interface UserProfilePhotos {
639
+ /** Total number of profile pictures the target user has */
640
+ total_count: number;
641
+ /** Requested profile pictures (in up to 4 sizes each) */
642
+ photos: PhotoSize[][];
643
+ }
644
+ /** This object represents the audios displayed on a user's profile. */
645
+ export interface UserProfileAudios {
646
+ /** Total number of profile audios for the target user */
647
+ total_count: number;
648
+ /** Requested profile audios */
649
+ audios: Audio[];
650
+ }
651
+ /** This object represents a chat photo. */
652
+ export interface ChatPhoto {
653
+ /** File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. */
654
+ small_file_id: string;
655
+ /** Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
656
+ small_file_unique_id: string;
657
+ /** File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. */
658
+ big_file_id: string;
659
+ /** Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
660
+ big_file_unique_id: string;
661
+ }
662
+ /** Represents an invite link for a chat. */
663
+ export interface ChatInviteLink {
664
+ /** The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with "...". */
665
+ invite_link: string;
666
+ /** Creator of the link */
667
+ creator: User;
668
+ /** True, if users joining the chat via the link need to be approved by chat administrators */
669
+ creates_join_request: boolean;
670
+ /** True, if the link is primary */
671
+ is_primary: boolean;
672
+ /** True, if the link is revoked */
673
+ is_revoked: boolean;
674
+ /** Invite link name */
675
+ name?: string;
676
+ /** Point in time (Unix timestamp) when the link will expire or has been expired */
677
+ expire_date?: number;
678
+ /** The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 */
679
+ member_limit?: number;
680
+ /** Number of pending join requests created using this link */
681
+ pending_join_request_count?: number;
682
+ /** The number of seconds the subscription will be active for before the next payment */
683
+ subscription_period?: number;
684
+ /** The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat using the link */
685
+ subscription_price?: number;
686
+ }
687
+ /** Represents the rights of an administrator in a chat. */
688
+ export interface ChatAdministratorRights {
689
+ /** True, if the user's presence in the chat is hidden */
690
+ is_anonymous: boolean;
691
+ /** True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other administrator privilege. */
692
+ can_manage_chat: boolean;
693
+ /** True, if the administrator can delete messages of other users */
694
+ can_delete_messages: boolean;
695
+ /** True, if the administrator can manage video chats */
696
+ can_manage_video_chats: boolean;
697
+ /** True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics */
698
+ can_restrict_members: boolean;
699
+ /** True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by the user) */
700
+ can_promote_members: boolean;
701
+ /** True, if the user is allowed to change the chat title, photo and other settings */
702
+ can_change_info: boolean;
703
+ /** True, if the user is allowed to invite new users to the chat */
704
+ can_invite_users: boolean;
705
+ /** True, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted, defaults to the value of can_pin_messages. */
706
+ can_manage_tags?: boolean;
707
+ /** True, if the administrator can post stories to the chat */
708
+ can_post_stories: boolean;
709
+ /** True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive */
710
+ can_edit_stories: boolean;
711
+ /** True, if the administrator can delete stories posted by other users */
712
+ can_delete_stories: boolean;
713
+ /** True, if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only */
714
+ can_post_messages?: boolean;
715
+ /** True, if the administrator can edit messages of other users and can pin messages; for channels only */
716
+ can_edit_messages?: boolean;
717
+ /** True, if the user is allowed to pin messages; for groups and supergroups only */
718
+ can_pin_messages?: boolean;
719
+ /** True, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only */
720
+ can_manage_topics?: boolean;
721
+ /** True, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only */
722
+ can_manage_direct_messages?: boolean;
723
+ }
724
+ /** This object represents changes in the status of a chat member. */
725
+ export interface ChatMemberUpdated {
726
+ /** Chat the user belongs to */
727
+ chat: Chat;
728
+ /** Performer of the action, which resulted in the change */
729
+ from: User;
730
+ /** Date the change was done in Unix time */
731
+ date: number;
732
+ /** Previous information about the chat member */
733
+ old_chat_member: ChatMember;
734
+ /** New information about the chat member */
735
+ new_chat_member: ChatMember;
736
+ /** Chat invite link, which was used by the user to join the chat; for joining by invite link events only */
737
+ invite_link?: ChatInviteLink;
738
+ /** True, if the user joined the chat after sending a direct join request without using an invite link without using an invite link and being approved by an administrator */
739
+ via_join_request?: boolean;
740
+ /** True, if the user joined the chat via a chat folder invite link */
741
+ via_chat_folder_invite_link?: boolean;
742
+ }
743
+ /** This object contains information about one member of a chat. Currently, the following 6 types of chat members are supported:
744
+ - ChatMemberOwner
745
+ - ChatMemberAdministrator
746
+ - ChatMemberMember
747
+ - ChatMemberRestricted
748
+ - ChatMemberLeft
749
+ - ChatMemberBanned */
750
+ export type ChatMember = ChatMemberOwner | ChatMemberAdministrator | ChatMemberMember | ChatMemberRestricted | ChatMemberLeft | ChatMemberBanned;
751
+ /** Represents a chat member that owns the chat and has all administrator privileges. */
752
+ export interface ChatMemberOwner {
753
+ /** The member's status in the chat */
754
+ status: "creator";
755
+ /** Information about the user */
756
+ user: User;
757
+ /** True, if the user's presence in the chat is hidden */
758
+ is_anonymous: boolean;
759
+ /** Custom title for this user */
760
+ custom_title?: string;
761
+ }
762
+ /** Represents a chat member that has some additional privileges. */
763
+ export interface ChatMemberAdministrator {
764
+ /** The member's status in the chat */
765
+ status: "administrator";
766
+ /** Information about the user */
767
+ user: User;
768
+ /** True, if the bot is allowed to edit administrator privileges of that user */
769
+ can_be_edited: boolean;
770
+ /** True, if the user's presence in the chat is hidden */
771
+ is_anonymous: boolean;
772
+ /** True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other administrator privilege. */
773
+ can_manage_chat: boolean;
774
+ /** True, if the administrator can delete messages of other users */
775
+ can_delete_messages: boolean;
776
+ /** True, if the administrator can manage video chats */
777
+ can_manage_video_chats: boolean;
778
+ /** True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics */
779
+ can_restrict_members: boolean;
780
+ /** True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by the user) */
781
+ can_promote_members: boolean;
782
+ /** True, if the user is allowed to change the chat title, photo and other settings */
783
+ can_change_info: boolean;
784
+ /** True, if the user is allowed to invite new users to the chat */
785
+ can_invite_users: boolean;
786
+ /** True, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted, defaults to the value of can_pin_messages. */
787
+ can_manage_tags?: boolean;
788
+ /** True, if the administrator can post stories to the chat */
789
+ can_post_stories: boolean;
790
+ /** True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive */
791
+ can_edit_stories: boolean;
792
+ /** True, if the administrator can delete stories posted by other users */
793
+ can_delete_stories: boolean;
794
+ /** True, if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only */
795
+ can_post_messages?: boolean;
796
+ /** True, if the administrator can edit messages of other users and can pin messages; for channels only */
797
+ can_edit_messages?: boolean;
798
+ /** True, if the user is allowed to pin messages; for groups and supergroups only */
799
+ can_pin_messages?: boolean;
800
+ /** True, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only */
801
+ can_manage_topics?: boolean;
802
+ /** True, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only */
803
+ can_manage_direct_messages?: boolean;
804
+ /** Custom title for this user */
805
+ custom_title?: string;
806
+ }
807
+ /** Represents a chat member that has no additional privileges or restrictions. */
808
+ export interface ChatMemberMember {
809
+ /** The member's status in the chat */
810
+ status: "member";
811
+ /** Information about the user */
812
+ user: User;
813
+ /** Tag of the member */
814
+ tag?: string;
815
+ /** Date when the user's subscription will expire; Unix time */
816
+ until_date?: number;
817
+ }
818
+ /** Represents a chat member that is under certain restrictions in the chat. Supergroups only. */
819
+ export interface ChatMemberRestricted {
820
+ /** The member's status in the chat */
821
+ status: "restricted";
822
+ /** Information about the user */
823
+ user: User;
824
+ /** Tag of the member */
825
+ tag?: string;
826
+ /** True, if the user is a member of the chat at the moment of the request */
827
+ is_member: boolean;
828
+ /** True, if the user is allowed to send text messages, rich messages, contacts, giveaways, giveaway winners, invoices, locations and venues */
829
+ can_send_messages: boolean;
830
+ /** True, if the user is allowed to send audios */
831
+ can_send_audios: boolean;
832
+ /** True, if the user is allowed to send documents */
833
+ can_send_documents: boolean;
834
+ /** True, if the user is allowed to send photos */
835
+ can_send_photos: boolean;
836
+ /** True, if the user is allowed to send videos */
837
+ can_send_videos: boolean;
838
+ /** True, if the user is allowed to send video notes */
839
+ can_send_video_notes: boolean;
840
+ /** True, if the user is allowed to send voice notes */
841
+ can_send_voice_notes: boolean;
842
+ /** True, if the user is allowed to send polls and checklists */
843
+ can_send_polls: boolean;
844
+ /** True, if the user is allowed to send animations, games, stickers and use inline bots */
845
+ can_send_other_messages: boolean;
846
+ /** True, if the user is allowed to add web page previews to their messages */
847
+ can_add_web_page_previews: boolean;
848
+ /** True, if the user is allowed to react to messages */
849
+ can_react_to_messages: boolean;
850
+ /** True, if the user is allowed to change the chat title, photo and other settings */
851
+ can_change_info: boolean;
852
+ /** True, if the user is allowed to invite new users to the chat */
853
+ can_invite_users: boolean;
854
+ /** True, if the user is allowed to edit their own tag */
855
+ can_edit_tag: boolean;
856
+ /** True, if the user is allowed to pin messages */
857
+ can_pin_messages: boolean;
858
+ /** True, if the user is allowed to create forum topics */
859
+ can_manage_topics: boolean;
860
+ /** Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever. */
861
+ until_date: number;
862
+ }
863
+ /** Represents a chat member that isn't currently a member of the chat, but may join it themselves. */
864
+ export interface ChatMemberLeft {
865
+ /** The member's status in the chat */
866
+ status: "left";
867
+ /** Information about the user */
868
+ user: User;
869
+ }
870
+ /** Represents a chat member that was banned in the chat and can't return to the chat or view chat messages. */
871
+ export interface ChatMemberBanned {
872
+ /** The member's status in the chat */
873
+ status: "kicked";
874
+ /** Information about the user */
875
+ user: User;
876
+ /** Date when restrictions will be lifted for this user; Unix time. If 0, then the user is banned forever. */
877
+ until_date: number;
878
+ }
879
+ /** Represents a join request sent to a chat. */
880
+ export interface ChatJoinRequest {
881
+ /** Chat to which the request was sent */
882
+ chat: Chat.SupergroupChat | Chat.ChannelChat;
883
+ /** User that sent the join request */
884
+ from: User;
885
+ /** Identifier of a private chat with the user who sent the join request. The bot can use this identifier for 5 minutes to send messages until the join request is processed, assuming no other administrator contacted the user. */
886
+ user_chat_id: number;
887
+ /** Date the request was sent in Unix time */
888
+ date: number;
889
+ /** Bio of the user */
890
+ bio?: string;
891
+ /** Chat invite link that was used by the user to send the join request */
892
+ invite_link?: ChatInviteLink;
893
+ /** Identifier of the join request query; for bots assigned to process join requests only. If present, then the bot must call sendChatJoinRequestWebApp or directly call answerChatJoinRequestQuery within 10 seconds. */
894
+ query_id?: string;
895
+ }
896
+ /** Describes actions that a non-administrator user is allowed to take in a chat. */
897
+ export interface ChatPermissions {
898
+ /** True, if the user is allowed to send text messages, rich messages, contacts, giveaways, giveaway winners, invoices, locations and venues */
899
+ can_send_messages?: boolean;
900
+ /** True, if the user is allowed to send audios */
901
+ can_send_audios?: boolean;
902
+ /** True, if the user is allowed to send documents */
903
+ can_send_documents?: boolean;
904
+ /** True, if the user is allowed to send photos */
905
+ can_send_photos?: boolean;
906
+ /** True, if the user is allowed to send videos */
907
+ can_send_videos?: boolean;
908
+ /** True, if the user is allowed to send video notes */
909
+ can_send_video_notes?: boolean;
910
+ /** True, if the user is allowed to send voice notes */
911
+ can_send_voice_notes?: boolean;
912
+ /** True, if the user is allowed to send polls and checklists */
913
+ can_send_polls?: boolean;
914
+ /** True, if the user is allowed to send animations, games, stickers and use inline bots */
915
+ can_send_other_messages?: boolean;
916
+ /** True, if the user is allowed to add web page previews to their messages */
917
+ can_add_web_page_previews?: boolean;
918
+ /** True, if the user is allowed to react to messages. If omitted, defaults to the value of can_send_messages. */
919
+ can_react_to_messages?: boolean;
920
+ /** True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups. */
921
+ can_change_info?: boolean;
922
+ /** True, if the user is allowed to invite new users to the chat */
923
+ can_invite_users?: boolean;
924
+ /** True, if the user is allowed to edit their own tag. If omitted, defaults to the value of can_pin_messages. */
925
+ can_edit_tag?: boolean;
926
+ /** True, if the user is allowed to pin messages. Ignored in public supergroups. */
927
+ can_pin_messages?: boolean;
928
+ /** True, if the user is allowed to create forum topics. If omitted, defaults to the value of can_pin_messages. */
929
+ can_manage_topics?: boolean;
930
+ }
931
+ /** Describes the birthdate of a user. */
932
+ export interface Birthdate {
933
+ /** Day of the user's birth; 1-31 */
934
+ day: number;
935
+ /** Month of the user's birth; 1-12 */
936
+ month: number;
937
+ /** Year of the user's birth */
938
+ year?: number;
939
+ }
940
+ /** Contains information about the start page settings of a Telegram Business account. */
941
+ export interface BusinessIntro {
942
+ /** Title text of the business intro */
943
+ title?: string;
944
+ /** Message text of the business intro */
945
+ message?: string;
946
+ /** Sticker of the business intro */
947
+ sticker?: Sticker;
948
+ }
949
+ /** Contains information about the location of a Telegram Business account. */
950
+ export interface BusinessLocation {
951
+ /** Address of the business */
952
+ address: string;
953
+ /** Location of the business */
954
+ location?: Location;
955
+ }
956
+ /** Describes an interval of time during which a business is open. */
957
+ export interface BusinessOpeningHoursInterval {
958
+ /** The minute's sequence number in a week, starting on Monday, marking the start of the time interval during which the business is open; 0 - 7 * 24 * 60 */
959
+ opening_minute: number;
960
+ /** The minute's sequence number in a week, starting on Monday, marking the end of the time interval during which the business is open; 0 - 8 * 24 * 60 */
961
+ closing_minute: number;
962
+ }
963
+ /** Describes the opening hours of a business. */
964
+ export interface BusinessOpeningHours {
965
+ /** Unique name of the time zone for which the opening hours are defined */
966
+ time_zone_name: string;
967
+ /** List of time intervals describing business opening hours */
968
+ opening_hours: BusinessOpeningHoursInterval[];
969
+ }
970
+ /** Represents a location to which a chat is connected. */
971
+ export interface ChatLocation {
972
+ /** The location to which the supergroup is connected. Can't be a live location. */
973
+ location: Location;
974
+ /** Location address; 1-64 characters, as defined by the chat owner */
975
+ address: string;
976
+ }
977
+ /** This object represents a forum topic. */
978
+ export interface ForumTopic {
979
+ /** Unique identifier of the forum topic */
980
+ message_thread_id: number;
981
+ /** Name of the topic */
982
+ name: string;
983
+ /** True, if the name of the topic wasn't specified explicitly by its creator and likely needs to be changed by the bot */
984
+ is_name_implicit?: true;
985
+ /** Color of the topic icon in RGB format */
986
+ icon_color: number;
987
+ /** Unique identifier of the custom emoji shown as the topic icon */
988
+ icon_custom_emoji_id?: string;
989
+ }
990
+ /** This object represents a bot command. */
991
+ export interface BotCommand {
992
+ /** Text of the command; 1-32 characters. Can contain only lowercase English letters, digits and underscores. */
993
+ command: string;
994
+ /** Description of the command; 1-256 characters */
995
+ description: string;
996
+ /** True, if the command sends an ephemeral message, which can be seen only by the sender of the message and the bot */
997
+ is_ephemeral?: boolean;
998
+ }
999
+ /** This object describes the source of a chat boost. It can be one of
1000
+
1001
+ - ChatBoostSourcePremium
1002
+ - ChatBoostSourceGiftCode
1003
+ - ChatBoostSourceGiveaway */
1004
+ export type ChatBoostSource = ChatBoostSourcePremium | ChatBoostSourceGiftCode | ChatBoostSourceGiveaway;
1005
+ /** The boost was obtained by subscribing to Telegram Premium or by gifting a Telegram Premium subscription to another user. */
1006
+ export interface ChatBoostSourcePremium {
1007
+ /** Source of the boost, always “premium” */
1008
+ source: "premium";
1009
+ /** User that boosted the chat */
1010
+ user: User;
1011
+ }
1012
+ /** The boost was obtained by the creation of Telegram Premium gift codes to boost a chat. Each such code boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription. */
1013
+ export interface ChatBoostSourceGiftCode {
1014
+ /** Source of the boost, always “gift_code” */
1015
+ source: "gift_code";
1016
+ /** User for which the gift code was created */
1017
+ user: User;
1018
+ }
1019
+ /** The boost was obtained by the creation of a Telegram Premium or a Telegram Star giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription for Telegram Premium giveaways and prize_star_count / 500 times for one year for Telegram Star giveaways. */
1020
+ export interface ChatBoostSourceGiveaway {
1021
+ /** Source of the boost, always “giveaway” */
1022
+ source: "giveaway";
1023
+ /** Identifier of a message in the chat with the giveaway; the message could have been deleted already */
1024
+ giveaway_message_id: number;
1025
+ /** User that won the prize in the giveaway if any; for Telegram Premium giveaways only */
1026
+ user?: User;
1027
+ /** The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only */
1028
+ prize_star_count?: number;
1029
+ /** True, if the giveaway was completed, but there was no user to win the prize */
1030
+ is_unclaimed?: true;
1031
+ }
1032
+ /** This object contains information about a chat boost. */
1033
+ export interface ChatBoost {
1034
+ /** Unique identifier of the boost */
1035
+ boost_id: string;
1036
+ /** Point in time (Unix timestamp) when the chat was boosted */
1037
+ add_date: number;
1038
+ /** Point in time (Unix timestamp) when the boost will automatically expire, unless the booster's Telegram Premium subscription is prolonged */
1039
+ expiration_date: number;
1040
+ /** Source of the added boost */
1041
+ source: ChatBoostSource;
1042
+ }
1043
+ /** This object represents a boost added to a chat or changed. */
1044
+ export interface ChatBoostUpdated {
1045
+ /** Chat which was boosted */
1046
+ chat: Chat;
1047
+ /** Information about the chat boost */
1048
+ boost: ChatBoost;
1049
+ }
1050
+ /** This object represents a boost removed from a chat. */
1051
+ export interface ChatBoostRemoved {
1052
+ /** Chat which was boosted */
1053
+ chat: Chat;
1054
+ /** Unique identifier of the boost */
1055
+ boost_id: string;
1056
+ /** Point in time (Unix timestamp) when the boost was removed */
1057
+ remove_date: number;
1058
+ /** Source of the removed boost */
1059
+ source: ChatBoostSource;
1060
+ }
1061
+ /** This object represents a list of boosts added to a chat by a user. */
1062
+ export interface UserChatBoosts {
1063
+ /** The list of boosts added to the chat by the user */
1064
+ boosts: ChatBoost[];
1065
+ }
1066
+ /** Represents the rights of a business bot. */
1067
+ export interface BusinessBotRights {
1068
+ /** True, if the bot can send and edit messages in the private chats that had incoming messages in the last 24 hours */
1069
+ can_reply?: true;
1070
+ /** True, if the bot can mark incoming private messages as read */
1071
+ can_read_messages?: true;
1072
+ /** True, if the bot can delete messages sent by the bot */
1073
+ can_delete_outgoing_messages?: true;
1074
+ /** True, if the bot can delete all private messages in managed chats */
1075
+ can_delete_all_messages?: true;
1076
+ /** True, if the bot can edit the first and last name of the business account */
1077
+ can_edit_name?: true;
1078
+ /** True, if the bot can edit the bio of the business account */
1079
+ can_edit_bio?: true;
1080
+ /** True, if the bot can edit the profile photo of the business account */
1081
+ can_edit_profile_photo?: true;
1082
+ /** True, if the bot can edit the username of the business account */
1083
+ can_edit_username?: true;
1084
+ /** True, if the bot can change the privacy settings pertaining to gifts for the business account */
1085
+ can_change_gift_settings?: true;
1086
+ /** True, if the bot can view gifts and the amount of Telegram Stars owned by the business account */
1087
+ can_view_gifts_and_stars?: true;
1088
+ /** True, if the bot can convert regular gifts owned by the business account to Telegram Stars */
1089
+ can_convert_gifts_to_stars?: true;
1090
+ /** True, if the bot can transfer and upgrade gifts owned by the business account */
1091
+ can_transfer_and_upgrade_gifts?: true;
1092
+ /** True, if the bot can transfer Telegram Stars received by the business account to its own account, or use them to upgrade and transfer gifts */
1093
+ can_transfer_stars?: true;
1094
+ /** True, if the bot can post, edit and delete stories on behalf of the business account */
1095
+ can_manage_stories?: true;
1096
+ }
1097
+ /** Describes the connection of the bot with a business account. */
1098
+ export interface BusinessConnection {
1099
+ /** Unique identifier of the business connection */
1100
+ id: string;
1101
+ /** Business account user that created the business connection */
1102
+ user: User;
1103
+ /** Identifier of a private chat with the user who created the business connection. */
1104
+ user_chat_id: number;
1105
+ /** Date the connection was established in Unix time */
1106
+ date: number;
1107
+ /** Rights of the business bot */
1108
+ rights?: BusinessBotRights;
1109
+ /** True, if the connection is active */
1110
+ is_enabled: boolean;
1111
+ }
1112
+ /** This object is received when messages are deleted from a connected business account. */
1113
+ export interface BusinessMessagesDeleted {
1114
+ /** Unique identifier of the business connection */
1115
+ business_connection_id: string;
1116
+ /** Information about a chat in the business account. The bot may not have access to the chat or the corresponding user. */
1117
+ chat: Chat.PrivateChat;
1118
+ /** The list of identifiers of deleted messages in the chat of the business account */
1119
+ message_ids: number[];
1120
+ }
1121
+ /** This object contains information about changes to a user payment subscription toward the current bot. */
1122
+ export interface BotSubscriptionUpdated {
1123
+ /** User who subscribed for payments toward the bot */
1124
+ user: User;
1125
+ /** Bot-specified invoice payload */
1126
+ invoice_payload: string;
1127
+ /** The new state of the subscription. Currently, it can be one of “canceled” if the user canceled the subscription, “active” if the user re-enabled a previously canceled subscription, or “failed” if payment for the subscription failed. */
1128
+ state: "canceled" | "active" | "failed";
1129
+ }
1130
+ /** Describes a service message about a chat being added to a community. */
1131
+ export interface CommunityChatAdded {
1132
+ /** The new community to which the chat belongs */
1133
+ community: Community;
1134
+ }
1135
+ /** Describes a service message about a chat being removed from a community. Currently holds no information. */
1136
+ export interface CommunityChatRemoved {
1137
+ }
1138
+ /** Represents a community (a group of chats). */
1139
+ export interface Community {
1140
+ /** Unique identifier for this community */
1141
+ id: number;
1142
+ /** Name of the community */
1143
+ name: string;
1144
+ }
node_modules/@grammyjs/types/markup.d.ts ADDED
@@ -0,0 +1,268 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { ChatAdministratorRights, User } from "./manage.js";
2
+ import type { MaybeInaccessibleMessage } from "./message.js";
3
+ /** This object represents one button of an inline keyboard. Exactly one of the optional fields must be used to specify type of the button. */
4
+ export interface InlineKeyboardMarkup {
5
+ /** Array of button rows, each represented by an Array of InlineKeyboardButton objects */
6
+ inline_keyboard: InlineKeyboardButton[][];
7
+ }
8
+ export declare namespace InlineKeyboardButton {
9
+ interface AbstractInlineKeyboardButton {
10
+ /** Label text on the button */
11
+ text: string;
12
+ /** Unique identifier of the custom emoji shown before the text of the button. Can only be used by bots that purchased additional usernames on Fragment or in the messages directly sent by the bot to private, group and supergroup chats if the owner of the bot has a Telegram Premium subscription. */
13
+ icon_custom_emoji_id?: string;
14
+ /** Style of the button. Must be one of “danger” (red), “success” (green) or “primary” (blue). If omitted, then an app-specific style is used. */
15
+ style?: "danger" | "success" | "primary";
16
+ }
17
+ interface UrlButton extends AbstractInlineKeyboardButton {
18
+ /** HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings. */
19
+ url: string;
20
+ }
21
+ interface CallbackButton extends AbstractInlineKeyboardButton {
22
+ /** Data to be sent in a callback query to the bot when the button is pressed, 1-64 bytes */
23
+ callback_data: string;
24
+ }
25
+ interface WebAppButton extends AbstractInlineKeyboardButton {
26
+ /** Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Available only in private chats between a user and the bot. Not supported for messages sent on behalf of a business account. */
27
+ web_app: WebAppInfo;
28
+ }
29
+ interface LoginButton extends AbstractInlineKeyboardButton {
30
+ /** An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget. */
31
+ login_url: LoginUrl;
32
+ }
33
+ interface SwitchInlineButton extends AbstractInlineKeyboardButton {
34
+ /** If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted. Not supported for messages sent in channel direct messages chats and on behalf of a business account. */
35
+ switch_inline_query: string;
36
+ }
37
+ interface SwitchInlineCurrentChatButton extends AbstractInlineKeyboardButton {
38
+ /** If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. May be empty, in which case only the bot's username will be inserted.
39
+
40
+ This offers a quick way for the user to open your bot in inline mode in the same chat - good for selecting something from multiple options. Not supported in channels and for messages sent in channel direct messages chats and on behalf of a business account. */
41
+ switch_inline_query_current_chat: string;
42
+ }
43
+ interface SwitchInlineChosenChatButton extends AbstractInlineKeyboardButton {
44
+ /** If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field. Not supported for messages sent in channel direct messages chats and on behalf of a business account. */
45
+ switch_inline_query_chosen_chat: SwitchInlineQueryChosenChat;
46
+ }
47
+ interface CopyTextButtonButton extends AbstractInlineKeyboardButton {
48
+ /** Description of the button that copies the specified text to the clipboard */
49
+ copy_text: CopyTextButton;
50
+ }
51
+ interface GameButton extends AbstractInlineKeyboardButton {
52
+ /** Description of the game that will be launched when the user presses the button.
53
+
54
+ NOTE: This type of button must always be the first button in the first row. */
55
+ callback_game: CallbackGame;
56
+ }
57
+ interface PayButton extends AbstractInlineKeyboardButton {
58
+ /** Specify True, to send a Pay button. Substrings “⭐” and “XTR” in the buttons's text will be replaced with a Telegram Star icon.
59
+
60
+ NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages. */
61
+ pay: boolean;
62
+ }
63
+ }
64
+ /** This object represents one button of an inline keyboard. Exactly one of the fields other than text, icon_custom_emoji_id, and style must be used to specify the type of the button. */
65
+ export type InlineKeyboardButton = InlineKeyboardButton.CallbackButton | InlineKeyboardButton.GameButton | InlineKeyboardButton.LoginButton | InlineKeyboardButton.PayButton | InlineKeyboardButton.SwitchInlineButton | InlineKeyboardButton.SwitchInlineCurrentChatButton | InlineKeyboardButton.SwitchInlineChosenChatButton | InlineKeyboardButton.CopyTextButtonButton | InlineKeyboardButton.UrlButton | InlineKeyboardButton.WebAppButton;
66
+ /** This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in.
67
+ Telegram apps support these buttons as of version 5.7. */
68
+ export interface LoginUrl {
69
+ /** An HTTPS URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in Receiving authorization data.
70
+
71
+ NOTE: You must always check the hash of the received data to verify the authentication and the integrity of the data as described in Checking authorization. */
72
+ url: string;
73
+ /** New text of the button in forwarded messages */
74
+ forward_text?: string;
75
+ /** Username of a bot, which will be used for user authorization. See Setting up a bot for more details. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See Linking your domain to the bot for more details. */
76
+ bot_username?: string;
77
+ /** Pass True to request the permission for your bot to send messages to the user */
78
+ request_write_access?: boolean;
79
+ }
80
+ /** This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query. */
81
+ export interface SwitchInlineQueryChosenChat {
82
+ /** The default inline query to be inserted in the input field. If left empty, only the bot's username will be inserted. */
83
+ query?: string;
84
+ /** True, if private chats with users can be chosen */
85
+ allow_user_chats?: boolean;
86
+ /** True, if private chats with bots can be chosen */
87
+ allow_bot_chats?: boolean;
88
+ /** True, if group and supergroup chats can be chosen */
89
+ allow_group_chats?: boolean;
90
+ /** True, if channel chats can be chosen */
91
+ allow_channel_chats?: boolean;
92
+ }
93
+ /** A placeholder, currently holds no information. Use BotFather to set up your game. */
94
+ export interface CallbackGame {
95
+ }
96
+ /** This object represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.
97
+
98
+ NOTE: After the user presses a callback button, Telegram clients will display a progress bar until you call answerCallbackQuery. It is, therefore, necessary to react by calling answerCallbackQuery even if no notification to the user is needed (e.g., without specifying any of the optional parameters). */
99
+ export interface CallbackQuery {
100
+ /** Unique identifier for this query */
101
+ id: string;
102
+ /** Sender */
103
+ from: User;
104
+ /** Message sent by the bot with the callback button that originated the query */
105
+ message?: MaybeInaccessibleMessage;
106
+ /** Identifier of the message sent via the bot in inline mode, that originated the query */
107
+ inline_message_id?: string;
108
+ /** Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games. */
109
+ chat_instance: string;
110
+ /** Data associated with the callback button. Be aware that the message originated the query can contain no callback buttons with this data. */
111
+ data?: string;
112
+ /** Short name of a Game to be returned, serves as the unique identifier for the game */
113
+ game_short_name?: string;
114
+ }
115
+ /** This object represents a custom keyboard with reply options (see Introduction to bots for details and examples). Not supported in channels and for messages sent on behalf of a business account. */
116
+ export interface ReplyKeyboardMarkup {
117
+ /** Array of button rows, each represented by an Array of KeyboardButton objects */
118
+ keyboard: KeyboardButton[][];
119
+ /** Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults to False, in which case the custom keyboard can be hidden and opened with a keyboard icon. */
120
+ is_persistent?: boolean;
121
+ /** Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to False, in which case the custom keyboard is always of the same height as the app's standard keyboard. */
122
+ resize_keyboard?: boolean;
123
+ /** Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. Defaults to False. */
124
+ one_time_keyboard?: boolean;
125
+ /** The placeholder to be shown in the input field when the keyboard is active; 1-64 characters */
126
+ input_field_placeholder?: string;
127
+ /** Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are `@mentioned` in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message.
128
+
129
+ Example: A user requests to change the bot's language, bot replies to the request with a keyboard to select the new language. Other users in the group don't see the keyboard. */
130
+ selective?: boolean;
131
+ }
132
+ export declare namespace KeyboardButton {
133
+ interface CommonButton {
134
+ /** Text of the button. If none of the fields other than text, icon_custom_emoji_id, and style are used, it will be sent as a message when the button is pressed. */
135
+ text: string;
136
+ /** Unique identifier of the custom emoji shown before the text of the button. Can only be used by bots that purchased additional usernames on Fragment or in the messages directly sent by the bot to private, group and supergroup chats if the owner of the bot has a Telegram Premium subscription. */
137
+ icon_custom_emoji_id?: string;
138
+ /** Style of the button. Must be one of “danger” (red), “success” (green) or “primary” (blue). If omitted, then an app-specific style is used. */
139
+ style?: "danger" | "success" | "primary";
140
+ }
141
+ interface RequestUsersButton extends CommonButton {
142
+ /** If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a “users_shared” service message. Available in private chats only. */
143
+ request_users: KeyboardButtonRequestUsers;
144
+ }
145
+ interface RequestChatButton extends CommonButton {
146
+ /** If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a “chat_shared” service message. Available in private chats only. */
147
+ request_chat: KeyboardButtonRequestChat;
148
+ }
149
+ interface RequestContactButton extends CommonButton {
150
+ /** If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only. */
151
+ request_contact: boolean;
152
+ }
153
+ interface RequestLocationButton extends CommonButton {
154
+ /** If True, the user's current location will be sent when the button is pressed. Available in private chats only. */
155
+ request_location: boolean;
156
+ }
157
+ interface RequestPollButton extends CommonButton {
158
+ /** If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only. */
159
+ request_poll: KeyboardButtonPollType;
160
+ }
161
+ interface RequestManagedBotButton extends CommonButton {
162
+ /** If specified, pressing the button will ask the user to create and share a bot that will be managed by the current bot. Available for bots that enabled management of other bots in the \@BotFather Mini App. Available in private chats only. */
163
+ request_managed_bot: KeyboardButtonRequestManagedBot;
164
+ }
165
+ interface WebAppButton extends CommonButton {
166
+ /** If specified, the described Web App will be launched when the button is pressed. The Web App will be able to send a “web_app_data” service message. Available in private chats only. */
167
+ web_app: WebAppInfo;
168
+ }
169
+ }
170
+ /** This object represents one button of the reply keyboard. At most one of the fields other than text, icon_custom_emoji_id, and style must be used to specify the type of the button. For simple text buttons, String can be used instead of this object to specify the button text. */
171
+ export type KeyboardButton = KeyboardButton.CommonButton | KeyboardButton.RequestUsersButton | KeyboardButton.RequestChatButton | KeyboardButton.RequestContactButton | KeyboardButton.RequestLocationButton | KeyboardButton.RequestPollButton | KeyboardButton.RequestManagedBotButton | KeyboardButton.WebAppButton | string;
172
+ /** This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed. */
173
+ export interface KeyboardButtonPollType {
174
+ /** If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type. */
175
+ type?: "quiz" | "regular";
176
+ }
177
+ /** Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup). Not supported in channels and for messages sent on behalf of a business account. */
178
+ export interface ReplyKeyboardRemove {
179
+ /** Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup) */
180
+ remove_keyboard: true;
181
+ /** Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are `@mentioned` in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message.
182
+
183
+ Example: A user votes in a poll, bot returns confirmation message in reply to the vote and removes the keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet. */
184
+ selective?: boolean;
185
+ }
186
+ /** Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode. Not supported in channels and for messages sent on behalf of a user account.
187
+
188
+ Example: A poll bot for groups runs in privacy mode (only receives commands, replies to its messages and mentions). There could be two ways to create a new poll:
189
+
190
+ Explain the user how to send a command with parameters (e.g. /newpoll question answer1 answer2). May be appealing for hardcore users but lacks modern day polish.
191
+
192
+ Guide the user through a step-by-step process. 'Please send me your question', 'Cool, now let's add the first answer option', 'Great. Keep adding answer options, then send /done when you're ready'.
193
+
194
+ The last option is definitely more attractive. And if you use ForceReply in your bot's questions, it will receive the user's answers even if it only receives replies, commands and mentions - without any extra work for the user. */
195
+ export interface ForceReply {
196
+ /** Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply' */
197
+ force_reply: true;
198
+ /** The placeholder to be shown in the input field when the reply is active; 1-64 characters */
199
+ input_field_placeholder?: string;
200
+ /** Use this parameter if you want to force reply from specific users only. Targets: 1) users that are `@mentioned` in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message. */
201
+ selective?: boolean;
202
+ }
203
+ /** This object represents an inline keyboard button that copies specified text to the clipboard. */
204
+ export interface CopyTextButton {
205
+ /** The text to be copied to the clipboard; 1-256 characters */
206
+ text: string;
207
+ }
208
+ /** Describes a Web App. */
209
+ export interface WebAppInfo {
210
+ /** An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps */
211
+ url: string;
212
+ }
213
+ /** This object defines the criteria used to request suitable users. Information about the selected users will be shared with the bot when the corresponding button is pressed. */
214
+ export interface KeyboardButtonRequestUsers {
215
+ /** Signed 32-bit identifier of the request that will be received back in the UsersShared object. Must be unique within the message. */
216
+ request_id: number;
217
+ /** Pass True to request bots, pass False to request regular users. If not specified, no additional restrictions are applied. */
218
+ user_is_bot?: boolean;
219
+ /** Pass True to request premium users, pass False to request non-premium users. If not specified, no additional restrictions are applied. */
220
+ user_is_premium?: boolean;
221
+ /** The maximum number of users to be selected; 1-10. Defaults to 1. */
222
+ max_quantity?: number;
223
+ /** Pass True to request the users' first and last names */
224
+ request_name?: boolean;
225
+ /** Pass True to request the users' usernames */
226
+ request_username?: boolean;
227
+ /** Pass True to request the users' photos */
228
+ request_photo?: boolean;
229
+ }
230
+ /** This object defines the criteria used to request a suitable chat. Information about the selected chat will be shared with the bot when the corresponding button is pressed. The bot will be granted requested rights in the chat if appropriate. */
231
+ export interface KeyboardButtonRequestChat {
232
+ /** Signed 32-bit identifier of the request, which will be received back in the ChatShared object. Must be unique within the message. */
233
+ request_id: number;
234
+ /** Pass True to request a channel chat, pass False to request a group or a supergroup chat */
235
+ chat_is_channel: boolean;
236
+ /** Pass True to request a forum supergroup, pass False to request a non-forum chat. If not specified, no additional restrictions are applied. */
237
+ chat_is_forum?: boolean;
238
+ /** Pass True to request a supergroup or a channel with a username, pass False to request a chat without a username. If not specified, no additional restrictions are applied. */
239
+ chat_has_username?: boolean;
240
+ /** Pass True to request a chat owned by the user. Otherwise, no additional restrictions are applied. */
241
+ chat_is_created?: boolean;
242
+ /** An object listing the required administrator rights of the user in the chat. The rights must be a superset of bot_administrator_rights. If not specified, no additional restrictions are applied. */
243
+ user_administrator_rights?: ChatAdministratorRights;
244
+ /** An object listing the required administrator rights of the bot in the chat. The rights must be a subset of user_administrator_rights. If not specified, no additional restrictions are applied. */
245
+ bot_administrator_rights?: ChatAdministratorRights;
246
+ /** Pass True to request a chat with the bot as a member. Otherwise, no additional restrictions are applied. */
247
+ bot_is_member?: boolean;
248
+ /** Pass True to request the chat's title */
249
+ request_title?: boolean;
250
+ /** Pass True to request the chat's username */
251
+ request_username?: boolean;
252
+ /** Pass True to request the chat's photo */
253
+ request_photo?: boolean;
254
+ }
255
+ /** This object defines the parameters for the creation of a managed bot. Information about the created bot will be shared with the bot using the update managed_bot and a Message with the field managed_bot_created. */
256
+ export interface KeyboardButtonRequestManagedBot {
257
+ /** Signed 32-bit identifier of the request. Must be unique within the message. */
258
+ request_id: number;
259
+ /** Suggested name for the bot */
260
+ suggested_name?: string;
261
+ /** Suggested username for the bot */
262
+ suggested_username?: string;
263
+ }
264
+ /** Describes a keyboard button to be used by a user of a Mini App. */
265
+ export interface PreparedKeyboardButton {
266
+ /** Unique identifier of the keyboard button */
267
+ id: string;
268
+ }
node_modules/@grammyjs/types/message.d.ts ADDED
@@ -0,0 +1,1537 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { Checklist, ChecklistTasksAdded, ChecklistTasksDone } from "./checklist.js";
2
+ import type { Chat, ChatOwnerChanged, ChatOwnerLeft, CommunityChatAdded, CommunityChatRemoved, ManagedBotCreated, User } from "./manage.js";
3
+ import type { InlineKeyboardMarkup } from "./markup.js";
4
+ import type { PassportData } from "./passport.js";
5
+ import type { GiftInfo, Invoice, PaidMessagePriceChanged, RefundedPayment, SuccessfulPayment, SuggestedPostApprovalFailed, SuggestedPostApproved, SuggestedPostDeclined, SuggestedPostInfo, SuggestedPostPaid, SuggestedPostPrice, SuggestedPostRefunded, UniqueGiftInfo } from "./payment.js";
6
+ import type { RichBlock } from "./rich.js";
7
+ type MsgWith<P extends keyof Message> = Record<P, NonNullable<Message[P]>>;
8
+ export declare namespace Message {
9
+ interface ServiceMessage {
10
+ /** Unique message identifier inside this chat; 0 for ephemeral messages. In specific instances (e.g., a message containing a video sent to a big chat), the server might automatically schedule a message instead of sending it immediately. In such cases, this field will be 0 and the relevant message will be unusable until it is actually sent. */
11
+ message_id: number;
12
+ /** Unique identifier of a message thread or forum topic to which the message belongs; for supergroups and private chats only */
13
+ message_thread_id?: number;
14
+ /** Sender of the message; may be empty for messages sent to channels. For backward compatibility, if the message was sent on behalf of a chat, the field contains a fake sender user in non-channel chats. */
15
+ from?: User;
16
+ /** Sender of the message when sent on behalf of a chat. For example, the supergroup itself for messages sent by its anonymous administrators or a linked channel for messages automatically forwarded to the channel's discussion group. For backward compatibility, if the message was sent on behalf of a chat, the field from contains a fake sender user in non-channel chats. */
17
+ sender_chat?: Chat;
18
+ /** Date the message was sent in Unix time. It is always a positive number, representing a valid date. */
19
+ date: number;
20
+ /** The unique identifier for the guest query. Use this identifier with the method answerGuestQuery to send a response message. If non-empty, the message belongs to the chat where the guest bot was summoned, which may not coincide with other existing bot chats sharing the same identifier. */
21
+ guest_query_id?: string;
22
+ /** Unique identifier of the business connection from which the message was received. If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier. */
23
+ business_connection_id?: string;
24
+ /** Chat the message belongs to */
25
+ chat: Chat;
26
+ /** True, if the message is sent to a topic in a forum supergroup or a private chat with the bot */
27
+ is_topic_message?: boolean;
28
+ /** Information about the direct messages chat topic that contains the message */
29
+ direct_messages_topic?: DirectMessagesTopic;
30
+ }
31
+ interface CommonMessage extends ServiceMessage {
32
+ /** Tag or custom title of the sender of the message; for supergroups only */
33
+ sender_tag?: string;
34
+ /** For ephemeral messages, the user who received the message */
35
+ receiver_user?: User;
36
+ /** For ephemeral messages, identifier of the ephemeral message inside this chat. The identifier may be reused for another ephemeral message after the message is deleted or expires. */
37
+ ephemeral_message_id?: number;
38
+ /** If the sender of the message boosted the chat, the number of boosts added by the user */
39
+ sender_boost_count?: number;
40
+ /** The bot that actually sent the message on behalf of the business account. Available only for outgoing messages sent on behalf of the connected business account. */
41
+ sender_business_bot?: User;
42
+ /** Information about the original message for forwarded messages */
43
+ forward_origin?: MessageOrigin;
44
+ /** True, if the message is a channel post that was automatically forwarded to the connected discussion group */
45
+ is_automatic_forward?: true;
46
+ /** For replies in the same chat and message thread, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. If the message is a reply to an ephemeral message, then this field may be omitted. */
47
+ reply_to_message?: ReplyMessage;
48
+ /** Identifier of the specific checklist task that is being replied to */
49
+ reply_to_checklist_task_id?: number;
50
+ /** Persistent identifier of the specific poll option that is being replied to */
51
+ reply_to_poll_option_id?: string;
52
+ /** True, if the message is a paid post. Note that such posts must not be deleted for 24 hours to receive the payment and can't be edited. */
53
+ is_paid_post?: true;
54
+ /** Information about the message that is being replied to, which may come from another chat or forum topic */
55
+ external_reply?: ExternalReplyInfo;
56
+ /** For replies that quote part of the original message, the quoted part of the message */
57
+ quote?: TextQuote;
58
+ /** For replies to a story, the original message */
59
+ reply_to_story?: Story;
60
+ /** Bot through which the message was sent */
61
+ via_bot?: User;
62
+ /** For a message sent by a guest bot, this is the user whose original message triggered the bot's response. */
63
+ guest_bot_caller_user?: User;
64
+ /** For a message sent by a guest bot, this is the chat whose original message triggered the bot's response. */
65
+ guest_bot_caller_chat?: Chat;
66
+ /** Date the message was last edited in Unix time */
67
+ edit_date?: number;
68
+ /** True, if the message can't be forwarded */
69
+ has_protected_content?: true;
70
+ /** True, if the caption must be shown above the message media */
71
+ show_caption_above_media?: true;
72
+ /** True, if the message was sent by an implicit action, for example, as an away or a greeting business message, or as a scheduled message */
73
+ is_from_offline?: true;
74
+ /** Signature of the post author for messages in channels, or the custom title of an anonymous group administrator */
75
+ author_signature?: string;
76
+ /** Options used for link preview generation for the message, if it is a text message and link preview options were changed */
77
+ link_preview_options?: LinkPreviewOptions;
78
+ /** Unique identifier of the message effect added to the message */
79
+ effect_id?: string;
80
+ /** The number of Telegram Stars that were paid by the sender of the message to send it */
81
+ paid_star_count?: number;
82
+ /** Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. */
83
+ reply_markup?: InlineKeyboardMarkup;
84
+ }
85
+ interface CaptionableMessage extends CommonMessage {
86
+ /** Caption for the animation, audio, document, photo, video or voice */
87
+ caption?: string;
88
+ /** For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption */
89
+ caption_entities?: MessageEntity[];
90
+ }
91
+ interface MediaMessage extends CaptionableMessage {
92
+ /** The unique identifier inside this chat of a media message group this message belongs to */
93
+ media_group_id?: string;
94
+ /** True, if the message media is covered by a spoiler animation */
95
+ has_media_spoiler?: true;
96
+ }
97
+ type TextMessage = CommonMessage & MsgWith<"text"> & Partial<MsgWith<"entities">>;
98
+ type RichMessageMessage = CommonMessage & MsgWith<"rich_message">;
99
+ type AnimationMessage = DocumentMessage & MsgWith<"animation">;
100
+ type AudioMessage = CaptionableMessage & MsgWith<"audio">;
101
+ type DocumentMessage = CaptionableMessage & MsgWith<"document">;
102
+ type LivePhotoMessage = MediaMessage & MsgWith<"live_photo">;
103
+ type PaidMediaMessage = CommonMessage & MsgWith<"paid_media">;
104
+ type PhotoMessage = MediaMessage & MsgWith<"photo">;
105
+ type StickerMessage = CommonMessage & MsgWith<"sticker">;
106
+ type StoryMessage = CommonMessage & MsgWith<"story">;
107
+ type VideoMessage = MediaMessage & MsgWith<"video">;
108
+ type VideoNoteMessage = CommonMessage & MsgWith<"video_note">;
109
+ type VoiceMessage = CaptionableMessage & MsgWith<"voice">;
110
+ type ContactMessage = CommonMessage & MsgWith<"contact">;
111
+ type DiceMessage = CommonMessage & MsgWith<"dice">;
112
+ type GameMessage = CommonMessage & MsgWith<"game">;
113
+ type PollMessage = CommonMessage & MsgWith<"poll">;
114
+ type VenueMessage = LocationMessage & MsgWith<"venue">;
115
+ type LocationMessage = CommonMessage & MsgWith<"location">;
116
+ type DirectMessagePriceChangedMessage = ServiceMessage & MsgWith<"direct_message_price_changed">;
117
+ type ChecklistMessage = CommonMessage & MsgWith<"checklist">;
118
+ type ChecklistTasksDoneMessage = ServiceMessage & MsgWith<"checklist_tasks_done">;
119
+ type ChecklistTasksAddedMessage = ServiceMessage & MsgWith<"checklist_tasks_added">;
120
+ type SuggestedPostInfoMessage = ServiceMessage & MsgWith<"suggested_post_info">;
121
+ type SuggestedPostApprovedMessage = ServiceMessage & MsgWith<"suggested_post_approved">;
122
+ type SuggestedPostApprovalFailedMessage = ServiceMessage & MsgWith<"suggested_post_approval_failed">;
123
+ type SuggestedPostDeclinedMessage = ServiceMessage & MsgWith<"suggested_post_declined">;
124
+ type SuggestedPostPaidMessage = ServiceMessage & MsgWith<"suggested_post_paid">;
125
+ type SuggestedPostRefundedMessage = ServiceMessage & MsgWith<"suggested_post_refunded">;
126
+ type ChatOwnerLeftMessage = ServiceMessage & MsgWith<"chat_owner_left">;
127
+ type ChatOwnerChangedMessage = ServiceMessage & MsgWith<"chat_owner_changed">;
128
+ type NewChatMembersMessage = ServiceMessage & MsgWith<"new_chat_members">;
129
+ type LeftChatMemberMessage = ServiceMessage & MsgWith<"left_chat_member">;
130
+ type NewChatTitleMessage = ServiceMessage & MsgWith<"new_chat_title">;
131
+ type NewChatPhotoMessage = ServiceMessage & MsgWith<"new_chat_photo">;
132
+ type DeleteChatPhotoMessage = ServiceMessage & MsgWith<"delete_chat_photo">;
133
+ type GroupChatCreatedMessage = ServiceMessage & MsgWith<"group_chat_created">;
134
+ type SupergroupChatCreated = ServiceMessage & MsgWith<"supergroup_chat_created">;
135
+ type ChannelChatCreatedMessage = ServiceMessage & MsgWith<"channel_chat_created">;
136
+ type ManagedBotCreatedMessage = ServiceMessage & MsgWith<"managed_bot_created">;
137
+ type PollOptionAddedMessage = ServiceMessage & MsgWith<"poll_option_added">;
138
+ type PollOptionDeletedMessage = ServiceMessage & MsgWith<"poll_option_deleted">;
139
+ type MessageAutoDeleteTimerChangedMessage = ServiceMessage & MsgWith<"message_auto_delete_timer_changed">;
140
+ type MigrateToChatIdMessage = ServiceMessage & MsgWith<"migrate_to_chat_id">;
141
+ type MigrateFromChatIdMessage = ServiceMessage & MsgWith<"migrate_from_chat_id">;
142
+ type PinnedMessageMessage = ServiceMessage & MsgWith<"pinned_message">;
143
+ type InvoiceMessage = ServiceMessage & MsgWith<"invoice">;
144
+ type SuccessfulPaymentMessage = ServiceMessage & MsgWith<"successful_payment">;
145
+ type RefundedPaymentMessage = ServiceMessage & MsgWith<"refunded_payment">;
146
+ type UsersSharedMessage = ServiceMessage & MsgWith<"users_shared">;
147
+ type ChatSharedMessage = ServiceMessage & MsgWith<"chat_shared">;
148
+ type ConnectedWebsiteMessage = ServiceMessage & MsgWith<"connected_website">;
149
+ type WriteAccessAllowedMessage = ServiceMessage & MsgWith<"write_access_allowed">;
150
+ type PassportDataMessage = ServiceMessage & MsgWith<"passport_data">;
151
+ type ProximityAlertTriggeredMessage = ServiceMessage & MsgWith<"proximity_alert_triggered">;
152
+ type BoostAddedMessage = ServiceMessage & MsgWith<"boost_added">;
153
+ type ChatBackgroundSetMessage = ServiceMessage & MsgWith<"chat_background_set">;
154
+ type ForumTopicCreatedMessage = ServiceMessage & MsgWith<"forum_topic_created">;
155
+ type ForumTopicEditedMessage = ServiceMessage & MsgWith<"forum_topic_edited">;
156
+ type ForumTopicClosedMessage = ServiceMessage & MsgWith<"forum_topic_closed">;
157
+ type ForumTopicReopenedMessage = ServiceMessage & MsgWith<"forum_topic_reopened">;
158
+ type GeneralForumTopicHiddenMessage = ServiceMessage & MsgWith<"general_forum_topic_hidden">;
159
+ type GeneralForumTopicUnhiddenMessage = ServiceMessage & MsgWith<"general_forum_topic_unhidden">;
160
+ type GiveawayCreatedMessage = ServiceMessage & MsgWith<"giveaway_created">;
161
+ type GiveawayMessage = ServiceMessage & MsgWith<"giveaway">;
162
+ type GiveawayWinnersMessage = ServiceMessage & MsgWith<"giveaway_winners">;
163
+ type GiveawayCompletedMessage = ServiceMessage & MsgWith<"giveaway_completed">;
164
+ type GiftMessage = ServiceMessage & MsgWith<"gift">;
165
+ type UniqueGiftMessage = ServiceMessage & MsgWith<"unique_gift">;
166
+ type GiftUpgradeSentMessage = ServiceMessage & MsgWith<"gift_upgrade_sent">;
167
+ type PaidMessagePriceChangedMessage = ServiceMessage & MsgWith<"paid_message_price_changed">;
168
+ type VideoChatScheduledMessage = ServiceMessage & MsgWith<"video_chat_scheduled">;
169
+ type VideoChatStartedMessage = ServiceMessage & MsgWith<"video_chat_started">;
170
+ type VideoChatEndedMessage = ServiceMessage & MsgWith<"video_chat_ended">;
171
+ type VideoChatParticipantsInvitedMessage = ServiceMessage & MsgWith<"video_chat_participants_invited">;
172
+ type WebAppDataMessage = ServiceMessage & MsgWith<"web_app_data">;
173
+ }
174
+ type ReplyMessage = Message & {
175
+ reply_to_message: undefined;
176
+ };
177
+ /** This object represents a message. */
178
+ export interface Message extends Message.MediaMessage {
179
+ /** For text messages, the actual UTF-8 text of the message */
180
+ text?: string;
181
+ /** For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text */
182
+ entities?: MessageEntity[];
183
+ /** Message is a rich formatted message */
184
+ rich_message?: RichMessage;
185
+ /** Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set. */
186
+ animation?: Animation;
187
+ /** Message is an audio file, information about the file */
188
+ audio?: Audio;
189
+ /** Message is a general file, information about the file */
190
+ document?: Document;
191
+ /** Message is a live photo, information about the live photo. For backward compatibility, when this field is set, the photo field will also be set */
192
+ live_photo?: LivePhoto;
193
+ /** Message contains paid media; information about the paid media */
194
+ paid_media?: PaidMediaInfo;
195
+ /** Message is a photo, available sizes of the photo */
196
+ photo?: PhotoSize[];
197
+ /** Message is a sticker, information about the sticker */
198
+ sticker?: Sticker;
199
+ /** Message is a forwarded story */
200
+ story?: Story;
201
+ /** Message is a video, information about the video */
202
+ video?: Video;
203
+ /** Message is a video note, information about the video message */
204
+ video_note?: VideoNote;
205
+ /** Message is a voice message, information about the file */
206
+ voice?: Voice;
207
+ /** Message is a shared contact, information about the contact */
208
+ contact?: Contact;
209
+ /** Message is a dice with random value */
210
+ dice?: Dice;
211
+ /** Message is a game, information about the game. */
212
+ game?: Game;
213
+ /** Message is a native poll, information about the poll */
214
+ poll?: Poll;
215
+ /** Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set. */
216
+ venue?: Venue;
217
+ /** Message is a shared location, information about the location */
218
+ location?: Location;
219
+ /** Message is a checklist */
220
+ checklist?: Checklist;
221
+ /** Service message: some tasks in a checklist were marked as done or not done */
222
+ checklist_tasks_done?: ChecklistTasksDone;
223
+ /** Service message: tasks were added to a checklist */
224
+ checklist_tasks_added?: ChecklistTasksAdded;
225
+ /** Service message: chat added to a Community */
226
+ community_chat_added?: CommunityChatAdded;
227
+ /** Service message: chat removed from a Community */
228
+ community_chat_removed?: CommunityChatRemoved;
229
+ /** Information about suggested post parameters if the message is a suggested post in a channel direct messages chat. If the message is an approved or declined suggested post, then it can't be edited. */
230
+ suggested_post_info?: SuggestedPostInfo;
231
+ /** Service message: a suggested post was approved */
232
+ suggested_post_approved?: SuggestedPostApproved;
233
+ /** Service message: approval of a suggested post has failed */
234
+ suggested_post_approval_failed?: SuggestedPostApprovalFailed;
235
+ /** Service message: a suggested post was declined */
236
+ suggested_post_declined?: SuggestedPostDeclined;
237
+ /** Service message: payment for a suggested post was received */
238
+ suggested_post_paid?: SuggestedPostPaid;
239
+ /** Service message: payment for a suggested post was refunded */
240
+ suggested_post_refunded?: SuggestedPostRefunded;
241
+ /** Service message: chat owner has left */
242
+ chat_owner_left?: ChatOwnerLeft;
243
+ /** Service message: chat owner has changed */
244
+ chat_owner_changed?: ChatOwnerChanged;
245
+ /** New members that were added to the group or supergroup and information about them (the bot itself may be one of these members) */
246
+ new_chat_members?: User[];
247
+ /** A member was removed from the group, information about them (this member may be the bot itself) */
248
+ left_chat_member?: User;
249
+ /** A chat title was changed to this value */
250
+ new_chat_title?: string;
251
+ /** A chat photo was change to this value */
252
+ new_chat_photo?: PhotoSize[];
253
+ /** Service message: the chat photo was deleted */
254
+ delete_chat_photo?: true;
255
+ /** Service message: the group has been created */
256
+ group_chat_created?: true;
257
+ /** Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup. */
258
+ supergroup_chat_created?: true;
259
+ /** Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel. */
260
+ channel_chat_created?: true;
261
+ /** Service message: user created a bot that will be managed by the current bot */
262
+ managed_bot_created?: ManagedBotCreated;
263
+ /** Service message: answer option was added to a poll */
264
+ poll_option_added?: PollOptionAdded;
265
+ /** Service message: answer option was deleted from a poll */
266
+ poll_option_deleted?: PollOptionDeleted;
267
+ /** Service message: auto-delete timer settings changed in the chat */
268
+ message_auto_delete_timer_changed?: MessageAutoDeleteTimerChanged;
269
+ /** The group has been migrated to a supergroup with the specified identifier. */
270
+ migrate_to_chat_id?: number;
271
+ /** The supergroup has been migrated from a group with the specified identifier. */
272
+ migrate_from_chat_id?: number;
273
+ /** Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. */
274
+ pinned_message?: MaybeInaccessibleMessage;
275
+ /** Message is an invoice for a payment, information about the invoice. */
276
+ invoice?: Invoice;
277
+ /** Message is a service message about a successful payment, information about the payment. */
278
+ successful_payment?: SuccessfulPayment;
279
+ /** Message is a service message about a refunded payment, information about the payment. */
280
+ refunded_payment?: RefundedPayment;
281
+ /** Service message: users were shared with the bot */
282
+ users_shared?: UsersShared;
283
+ /** Service message: a chat was shared with the bot */
284
+ chat_shared?: ChatShared;
285
+ /** The domain name of the website on which the user has logged in. */
286
+ connected_website?: string;
287
+ /** Service message: the user allowed the bot to write messages after adding it to the attachment or side menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess */
288
+ write_access_allowed?: WriteAccessAllowed;
289
+ /** Telegram Passport data */
290
+ passport_data?: PassportData;
291
+ /** Service message: a user in the chat triggered another user's proximity alert while sharing Live Location. */
292
+ proximity_alert_triggered?: ProximityAlertTriggered;
293
+ /** Service message: user boosted the chat */
294
+ boost_added?: ChatBoostAdded;
295
+ chat_background_set?: ChatBackground;
296
+ /** Service message: forum topic created */
297
+ forum_topic_created?: ForumTopicCreated;
298
+ /** Service message: forum topic edited */
299
+ forum_topic_edited?: ForumTopicEdited;
300
+ /** Service message: forum topic closed */
301
+ forum_topic_closed?: ForumTopicClosed;
302
+ /** Service message: forum topic reopened */
303
+ forum_topic_reopened?: ForumTopicReopened;
304
+ /** Service message: the 'General' forum topic hidden */
305
+ general_forum_topic_hidden?: GeneralForumTopicHidden;
306
+ /** Service message: the 'General' forum topic unhidden */
307
+ general_forum_topic_unhidden?: GeneralForumTopicUnhidden;
308
+ /** Service message: a scheduled giveaway was created */
309
+ giveaway_created?: GiveawayCreated;
310
+ /** The message is a scheduled giveaway message */
311
+ giveaway?: Giveaway;
312
+ /** A giveaway with public winners was completed */
313
+ giveaway_winners?: GiveawayWinners;
314
+ /** Service message: a giveaway without public winners was completed */
315
+ giveaway_completed?: GiveawayCompleted;
316
+ /** Service message: a regular gift was sent or received */
317
+ gift?: GiftInfo;
318
+ /** Service message: upgrade of a gift was purchased after the gift was sent */
319
+ gift_upgrade_sent?: GiftInfo;
320
+ /** Service message: a unique gift was sent or received */
321
+ unique_gift?: UniqueGiftInfo;
322
+ /** Service message: the price for paid messages has changed in the chat */
323
+ paid_message_price_changed?: PaidMessagePriceChanged;
324
+ /** Service message: the price for paid messages in the corresponding direct messages chat of a channel has changed */
325
+ direct_message_price_changed?: DirectMessagePriceChanged;
326
+ /** Service message: video chat scheduled */
327
+ video_chat_scheduled?: VideoChatScheduled;
328
+ /** Service message: video chat started */
329
+ video_chat_started?: VideoChatStarted;
330
+ /** Service message: video chat ended */
331
+ video_chat_ended?: VideoChatEnded;
332
+ /** Service message: new participants invited to a video chat */
333
+ video_chat_participants_invited?: VideoChatParticipantsInvited;
334
+ /** Service message: data sent by a Web App */
335
+ web_app_data?: WebAppData;
336
+ }
337
+ /** This object represents a unique message identifier. */
338
+ export interface MessageId {
339
+ /** Unique message identifier. In specific instances (e.g., message containing a video sent to a big chat), the server might automatically schedule a message instead of sending it immediately. In such cases, this field will be 0 and the relevant message will be unusable until it is actually sent. */
340
+ message_id: number;
341
+ }
342
+ /** Describes an inline message sent by a Web App on behalf of a user. */
343
+ export interface SentWebAppMessage {
344
+ /** Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. */
345
+ inline_message_id: string;
346
+ }
347
+ /** Describes an inline message sent by a guest bot. */
348
+ export interface SentGuestMessage {
349
+ /** Identifier of the sent inline message */
350
+ inline_message_id: string;
351
+ }
352
+ /** Describes an inline message to be sent by a user of a Mini App. */
353
+ export interface PreparedInlineMessage {
354
+ /** Unique identifier of the prepared message */
355
+ id: string;
356
+ /** Expiration date of the prepared message, in Unix time. Expired prepared messages can no longer be used. */
357
+ expiration_date: number;
358
+ }
359
+ /** This object describes a message that was deleted or is otherwise inaccessible to the bot. */
360
+ export interface InaccessibleMessage extends Omit<Message, "chat" | "message_id" | "date"> {
361
+ /** Chat the message belonged to */
362
+ chat: Chat;
363
+ /** Unique message identifier inside the chat */
364
+ message_id: number;
365
+ /** Always 0. The field can be used to differentiate regular and inaccessible messages. */
366
+ date: 0;
367
+ }
368
+ /** This object describes a message that can be inaccessible to the bot. It can be one of
369
+
370
+ - Message
371
+ - InaccessibleMessage */
372
+ export type MaybeInaccessibleMessage = Message | InaccessibleMessage;
373
+ /** The Bot API supports basic formatting for messages. You can use bold, italic, underlined, strikethrough, spoiler text, block quotations as well as inline links and pre-formatted code in your bots' messages. Telegram clients will render them accordingly. You can specify text entities directly, or use markdown-style or HTML-style formatting.
374
+ *
375
+ * Note that Telegram clients will display an **alert** to the user before opening an inline link ('Open this link?' together with the full URL).
376
+ *
377
+ * Message entities can be nested, providing following restrictions are met:
378
+ * - If two entities have common characters, then one of them is fully contained inside another.
379
+ * - bold, italic, underline, strikethrough, and spoiler entities can contain and can be part of any other entities, except pre and code.
380
+ * - blockquote and expandable_blockquote entities can't be nested.
381
+ * - All other entities can't contain each other.
382
+ *
383
+ * Links `tg://user?id=<user_id>` can be used to mention a user by their identifier without using a username. Please note:
384
+ *
385
+ * - These links will work only if they are used inside an inline link or in an inline keyboard button. For example, they will not work, when used in a message text.
386
+ * - Unless the user is a member of the chat where they were mentioned, these mentions are only guaranteed to work if the user has contacted the bot in private in the past or has sent a callback query to the bot via an inline button and doesn't have Forwarded Messages privacy enabled for the bot.
387
+ *
388
+ * You can find the list of programming and markup languages for which syntax highlighting is supported at [libprisma#supported-languages](https://github.com/TelegramMessenger/libprisma#supported-languages).
389
+ *
390
+ * #### Date-time entity formatting
391
+ *
392
+ * Date-time entity formatting is specified by a format string, which must adhere to the following regular expression: `r|w?[dD]?[tT]?`.
393
+ *
394
+ * If the format string is empty, the underlying text is displayed as-is; however, the user can still receive the underlying date in their local format. When populated, the format string determines the output based on the presence of the following control characters:
395
+ *
396
+ * - `r`: Displays the time relative to the current time. Cannot be combined with any other control characters.
397
+ * - `w`: Displays the day of the week in the user's localized language.
398
+ * - `d`: Displays the date in short form (e.g., “17.03.22”).
399
+ * - `D`: Displays the date in long form (e.g., “March 17, 2022”).
400
+ * - `t`: Displays the time in short form (e.g., “22:45”).
401
+ * - `T`: Displays the time in long form (e.g., “22:45:00”).
402
+ *
403
+ * #### MarkdownV2 style
404
+ * To use this mode, pass *MarkdownV2* in the *parse_mode* field. Use the following syntax in your message:
405
+ *
406
+ * ````markdown
407
+ * *bold \*text*
408
+ * _italic \*text_
409
+ * __underline__
410
+ * ~strikethrough~
411
+ * ||spoiler||
412
+ * *bold _italic bold ~italic bold strikethrough ||italic bold strikethrough spoiler||~ __underline italic bold___ bold*
413
+ * [inline URL](http://www.example.com/)
414
+ * [inline mention of a user](tg://user?id=123456789)
415
+ * ![👍](tg://emoji?id=5368324170671202286)
416
+ * ![22:45 tomorrow](tg://time?unix=1647531900&format=wDT)
417
+ * ![22:45 tomorrow](tg://time?unix=1647531900&format=t)
418
+ * ![22:45 tomorrow](tg://time?unix=1647531900&format=r)
419
+ * ![22:45 tomorrow](tg://time?unix=1647531900)
420
+ * `inline fixed-width code`
421
+ * ```
422
+ * pre-formatted fixed-width code block
423
+ * ```
424
+ * ```python
425
+ * pre-formatted fixed-width code block written in the Python programming language
426
+ * ```
427
+ * >Block quotation started
428
+ * >Block quotation continued
429
+ * >Block quotation continued
430
+ * >Block quotation continued
431
+ * >The last line of the block quotation
432
+ * ***>The second expandable block quotation started right after the previous
433
+ * >It is separated from the previous block quotation by an empty bold entity
434
+ * >Expandable block quotation continued
435
+ * >Hidden by default part of the expandable block quotation started
436
+ * >Expandable block quotation continued
437
+ * >The last line of the expandable block quotation with the expandability mark||
438
+ * ````
439
+ * Please note:
440
+ *
441
+ * - Any character with code between 1 and 126 inclusively can be escaped anywhere with a preceding '\' character, in which case it is treated as an ordinary character and not a part of the markup. This implies that '\' character usually must be escaped with a preceding '\' character.
442
+ * - Inside `pre` and `code` entities, all '`' and '\' characters must be escaped with a preceding '\' character.
443
+ * - Inside the `(...)` part of the inline link and custom emoji definition, all ')' and '\' must be escaped with a preceding '\' character.
444
+ * - In all other places characters '_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!' must be escaped with the preceding character '\'.
445
+ * - In case of ambiguity between `italic` and `underline` entities `__` is always greedily treated from left to right as beginning or end of an `underline` entity, so instead of `___italic underline___` use `___italic underline_**__`, adding an empty bold entity as a separator.
446
+ * - A valid emoji must be provided as an alternative value for the custom emoji. The emoji will be shown instead of the custom emoji in places where a custom emoji cannot be displayed (e.g., system notifications) or if the message is forwarded by a non-premium user. It is recommended to use the emoji from the emoji field of the custom emoji sticker.
447
+ * - Custom emoji entities can only be used by bots that purchased additional usernames on Fragment.
448
+ * - See date-time entity formatting for more details about supported date-time formats.
449
+ *
450
+ * #### HTML style
451
+ * To use this mode, pass *HTML* in the *parse_mode* field. The following tags are currently supported:
452
+ *
453
+ * ```html
454
+ * <b>bold</b>, <strong>bold</strong>
455
+ * <i>italic</i>, <em>italic</em>
456
+ * <u>underline</u>, <ins>underline</ins>
457
+ * <s>strikethrough</s>, <strike>strikethrough</strike>, <del>strikethrough</del>
458
+ * <span class="tg-spoiler">spoiler</span>, <tg-spoiler>spoiler</tg-spoiler>
459
+ * <b>bold <i>italic bold <s>italic bold strikethrough <span class="tg-spoiler">italic bold strikethrough spoiler</span></s> <u>underline italic bold</u></i> bold</b>
460
+ * <a href="http://www.example.com/">inline URL</a>
461
+ * <a href="tg://user?id=123456789">inline mention of a user</a>
462
+ * <tg-emoji emoji-id="5368324170671202286">👍</tg-emoji>
463
+ * <tg-time unix="1647531900" format="wDT">22:45 tomorrow</tg-time>
464
+ * <tg-time unix="1647531900" format="t">22:45 tomorrow</tg-time>
465
+ * <tg-time unix="1647531900" format="r">22:45 tomorrow</tg-time>
466
+ * <tg-time unix="1647531900">22:45 tomorrow</tg-time>
467
+ * <code>inline fixed-width code</code>
468
+ * <pre>pre-formatted fixed-width code block</pre>
469
+ * <pre><code class="language-python">pre-formatted fixed-width code block written in the Python programming language</code></pre>
470
+ * <blockquote>Block quotation started\nBlock quotation continued\nThe last line of the block quotation</blockquote>
471
+ * <blockquote expandable>Expandable block quotation started\nExpandable block quotation continued\nExpandable block quotation continued\nHidden by default part of the block quotation started\nExpandable block quotation continued\nThe last line of the block quotation</blockquote>
472
+ * ```
473
+ * Please note:
474
+ *
475
+ * - Only the tags mentioned above are currently supported.
476
+ * - All `<`, `>` and `&` symbols that are not a part of a tag or an HTML entity must be replaced with the corresponding HTML entities (`<` with `&lt;`, `>` with `&gt;` and `&` with `&amp;`).
477
+ * - All numerical HTML entities are supported.
478
+ * - The API currently supports only the following named HTML entities: `&lt;`, `&gt;`, `&amp;` and `&quot;`.
479
+ * - Use nested `pre` and `code` tags, to define programming language for pre entity.
480
+ * - Programming language can't be specified for standalone `code` tags.
481
+ * - A valid emoji must be used as the content of the tg-emoji tag. The emoji will be shown instead of the custom emoji in places where a custom emoji cannot be displayed (e.g., system notifications) or if the message is forwarded by a non-premium user. It is recommended to use the emoji from the emoji field of the custom emoji sticker.
482
+ * - Custom emoji entities can only be used by bots that purchased additional usernames on Fragment.
483
+ * - See date-time entity formatting for more details about supported date-time formats.
484
+ *
485
+ * #### Markdown style
486
+ * This is a legacy mode, retained for backward compatibility. To use this mode, pass *Markdown* in the *parse_mode* field. Use the following syntax in your message:
487
+ *
488
+ * ````markdown
489
+ * *bold text*
490
+ * _italic text_
491
+ * [inline URL](http://www.example.com/)
492
+ * [inline mention of a user](tg://user?id=123456789)
493
+ * `inline fixed-width code`
494
+ * ```
495
+ * pre-formatted fixed-width code block
496
+ * ```
497
+ * ```python
498
+ * pre-formatted fixed-width code block written in the Python programming language
499
+ * ```
500
+ * ````
501
+ * Please note:
502
+ *
503
+ * - Entities must not be nested, use parse mode MarkdownV2 instead.
504
+ * - There is no way to specify “underline”, “strikethrough”, “spoiler”, “blockquote”, “expandable_blockquote”, “custom_emoji”, and “date_time” entities, use parse mode MarkdownV2 instead.
505
+ * - To escape characters '_', '*', '`', '[' outside of an entity, prepend the character '\' before them.
506
+ * - Escaping inside entities is not allowed, so entity must be closed first and reopened again: use `_snake_\__case_` for italic `snake_case` and `*2*\**2=4*` for bold `2*2=4`. */
507
+ export type ParseMode = "Markdown" | "MarkdownV2" | "HTML";
508
+ export declare namespace MessageEntity {
509
+ interface AbstractMessageEntity {
510
+ /** Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag or #hashtag@chatusername), “cashtag” ($USD or $USD@chatusername), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “expandable_blockquote” (collapsed-by-default block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers), or “date_time” (for formatted date and time). */
511
+ type: string;
512
+ /** Offset in UTF-16 code units to the start of the entity */
513
+ offset: number;
514
+ /** Length of the entity in UTF-16 code units */
515
+ length: number;
516
+ }
517
+ interface CommonMessageEntity extends AbstractMessageEntity {
518
+ type: "mention" | "hashtag" | "cashtag" | "bot_command" | "url" | "email" | "phone_number" | "bold" | "italic" | "underline" | "strikethrough" | "spoiler" | "blockquote" | "expandable_blockquote" | "code";
519
+ }
520
+ interface PreMessageEntity extends AbstractMessageEntity {
521
+ type: "pre";
522
+ /** For “pre” only, the programming language of the entity text */
523
+ language?: string;
524
+ }
525
+ interface TextLinkMessageEntity extends AbstractMessageEntity {
526
+ type: "text_link";
527
+ /** For “text_link” only, URL that will be opened after user taps on the text */
528
+ url: string;
529
+ }
530
+ interface TextMentionMessageEntity extends AbstractMessageEntity {
531
+ type: "text_mention";
532
+ /** For “text_mention” only, the mentioned user */
533
+ user: User;
534
+ }
535
+ interface CustomEmojiMessageEntity extends AbstractMessageEntity {
536
+ type: "custom_emoji";
537
+ /** For “custom_emoji” only, unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker. */
538
+ custom_emoji_id: string;
539
+ }
540
+ interface DateTimeMessageEntity extends AbstractMessageEntity {
541
+ type: "date_time";
542
+ /** For “date_time” only, the Unix time associated with the entity */
543
+ unix_time: number;
544
+ /** For “date_time” only, the string that defines the formatting of the date and time. See date-time entity formatting for more details. */
545
+ date_time_format: "r" | `${"w" | ""}${"d" | "D" | ""}${"t" | "T" | ""}`;
546
+ }
547
+ }
548
+ /** This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc. */
549
+ export type MessageEntity = MessageEntity.CommonMessageEntity | MessageEntity.CustomEmojiMessageEntity | MessageEntity.PreMessageEntity | MessageEntity.TextLinkMessageEntity | MessageEntity.TextMentionMessageEntity | MessageEntity.DateTimeMessageEntity;
550
+ /** This object contains information about the quoted part of a message that is replied to by the given message. */
551
+ export interface TextQuote {
552
+ /** Text of the quoted part of a message that is replied to by the given message */
553
+ text: string;
554
+ /** Special entities that appear in the quote. Currently, only bold, italic, underline, strikethrough, spoiler, custom_emoji, and date_time entities are kept in quotes. */
555
+ entities?: MessageEntity[];
556
+ /** Approximate quote position in the original message in UTF-16 code units as specified by the sender */
557
+ position: number;
558
+ /** True, if the quote was chosen manually by the message sender. Otherwise, the quote was added automatically by the server. */
559
+ is_manual?: true;
560
+ }
561
+ /** This object contains information about a message that is being replied to, which may come from another chat or forum topic. */
562
+ export interface ExternalReplyInfo {
563
+ /** Origin of the message replied to by the given message */
564
+ origin: MessageOrigin;
565
+ /** Chat the original message belongs to. Available only if the chat is a supergroup or a channel. */
566
+ chat?: Chat;
567
+ /** Unique message identifier inside the original chat. Available only if the original chat is a supergroup or a channel. */
568
+ message_id?: number;
569
+ /** Options used for link preview generation for the original message, if it is a text message */
570
+ link_preview_options?: LinkPreviewOptions;
571
+ /** Message is an animation, information about the animation */
572
+ animation?: Animation;
573
+ /** Message is an audio file, information about the file */
574
+ audio?: Audio;
575
+ /** Message is a general file, information about the file */
576
+ document?: Document;
577
+ /** Message is a live photo, information about the live photo */
578
+ live_photo?: LivePhoto;
579
+ /** Message is a photo, available sizes of the photo */
580
+ photo?: PhotoSize[];
581
+ /** Message is a sticker, information about the sticker */
582
+ sticker?: Sticker;
583
+ /** Message is a forwarded story */
584
+ story?: Story;
585
+ /** Message is a video, information about the video */
586
+ video?: Video;
587
+ /** Message is a video note, information about the video message */
588
+ video_note?: VideoNote;
589
+ /** Message is a voice message, information about the file */
590
+ voice?: Voice;
591
+ /** True, if the message media is covered by a spoiler animation */
592
+ has_media_spoiler?: true;
593
+ /** Message is a shared contact, information about the contact */
594
+ contact?: Contact;
595
+ /** Message is a dice with random value */
596
+ dice?: Dice;
597
+ /** Message is a game, information about the game. */
598
+ game?: Game;
599
+ /** Message is a scheduled giveaway, information about the giveaway */
600
+ giveaway?: Giveaway;
601
+ /** A giveaway with public winners was completed */
602
+ giveaway_winners?: GiveawayWinners;
603
+ /** Message is an invoice for a payment, information about the invoice. */
604
+ invoice?: Invoice;
605
+ /** Message is a shared location, information about the location */
606
+ location?: Location;
607
+ /** Message contains paid media; information about the paid media */
608
+ paid_media?: PaidMediaInfo;
609
+ /** Message is a native poll, information about the poll */
610
+ poll?: Poll;
611
+ /** Message is a checklist */
612
+ checklist?: Checklist;
613
+ /** Message is a venue, information about the venue */
614
+ venue?: Venue;
615
+ }
616
+ /** Describes reply parameters for the message that is being sent. */
617
+ export interface ReplyParameters {
618
+ /** Identifier of the message that will be replied to in the current chat, or in the chat chat_id if it is specified. Required if ephemeral_message_id isn't specified. */
619
+ message_id?: number;
620
+ /** If the message to be replied to is from a different chat, unique identifier for the chat or username of the bot, supergroup or channel in the format `@username`. Not supported for messages sent on behalf of a business account, messages from channel direct messages chats and ephemeral messages. */
621
+ chat_id?: number | string;
622
+ /** Identifier of the incoming ephemeral message that will be replied to in the current chat. A reply to an ephemeral message must itself be an ephemeral message. An ephemeral message may only be replied to within 15 seconds of being sent. Required if message_id isn't specified. */
623
+ ephemeral_message_id?: number;
624
+ /** Identifier of the specific checklist task to be replied to */
625
+ checklist_task_id?: number;
626
+ /** Persistent identifier of the specific poll option to be replied to */
627
+ poll_option_id?: string;
628
+ /** Pass True if the message should be sent even if the specified message to be replied to is not found. Always False for replies in another chat or forum topic, and sent ephemeral messages. Always True for messages sent on behalf of a business account. */
629
+ allow_sending_without_reply?: boolean;
630
+ /** Quoted part of the message to be replied to; 0-1024 characters after entities parsing. The quote must be an exact substring of the message to be replied to, including bold, italic, underline, strikethrough, spoiler, custom_emoji, and date_time entities. The message will fail to send if the quote isn't found in the original message. Ignored for ephemeral messages. */
631
+ quote?: string;
632
+ /** Mode for parsing entities in the quote. See formatting options for more details. */
633
+ quote_parse_mode?: ParseMode;
634
+ /** A JSON-serialized list of special entities that appear in the quote. It can be specified instead of quote_parse_mode. */
635
+ quote_entities?: MessageEntity[];
636
+ /** Position of the quote in the original message in UTF-16 code units */
637
+ quote_position?: number;
638
+ }
639
+ /** This object describes the origin of a message. It can be one of
640
+
641
+ - MessageOriginUser
642
+ - MessageOriginHiddenUser
643
+ - MessageOriginChat
644
+ - MessageOriginChannel */
645
+ export type MessageOrigin = MessageOriginUser | MessageOriginHiddenUser | MessageOriginChat | MessageOriginChannel;
646
+ /** The message was originally sent by a known user. */
647
+ export interface MessageOriginUser {
648
+ /** Type of the message origin, always “user” */
649
+ type: "user";
650
+ /** Date the message was sent originally in Unix time */
651
+ date: number;
652
+ /** User that sent the message originally */
653
+ sender_user: User;
654
+ }
655
+ /** The message was originally sent by an unknown user. */
656
+ export interface MessageOriginHiddenUser {
657
+ /** Type of the message origin, always “hidden_user” */
658
+ type: "hidden_user";
659
+ /** Date the message was sent originally in Unix time */
660
+ date: number;
661
+ /** Name of the user that sent the message originally */
662
+ sender_user_name: string;
663
+ }
664
+ /** The message was originally sent on behalf of a chat to a group chat. */
665
+ export interface MessageOriginChat {
666
+ /** Type of the message origin, always “chat” */
667
+ type: "chat";
668
+ /** Date the message was sent originally in Unix time */
669
+ date: number;
670
+ /** Chat that sent the message originally */
671
+ sender_chat: Chat;
672
+ /** For messages originally sent by an anonymous chat administrator, original message author signature */
673
+ author_signature?: string;
674
+ }
675
+ /** The message was originally sent to a channel chat. */
676
+ export interface MessageOriginChannel {
677
+ /** Type of the message origin, always “channel” */
678
+ type: "channel";
679
+ /** Date the message was sent originally in Unix time */
680
+ date: number;
681
+ /** Channel chat to which the message was originally sent */
682
+ chat: Chat.ChannelChat;
683
+ /** Unique message identifier inside the chat */
684
+ message_id: number;
685
+ /** Signature of the original post author */
686
+ author_signature?: string;
687
+ }
688
+ /** This object represents one size of a photo or a file / sticker thumbnail. */
689
+ export interface PhotoSize {
690
+ /** Identifier for this file, which can be used to download or reuse the file */
691
+ file_id: string;
692
+ /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
693
+ file_unique_id: string;
694
+ /** Photo width */
695
+ width: number;
696
+ /** Photo height */
697
+ height: number;
698
+ /** File size in bytes */
699
+ file_size?: number;
700
+ }
701
+ /** This object represents a live photo. */
702
+ export interface LivePhoto {
703
+ /** Available sizes of the corresponding static photo */
704
+ photo?: PhotoSize[];
705
+ /** Identifier for the video file which can be used to download or reuse the file */
706
+ file_id: string;
707
+ /** Unique identifier for the video file which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
708
+ file_unique_id: string;
709
+ /** Video width as defined by the sender */
710
+ width: number;
711
+ /** Video height as defined by the sender */
712
+ height: number;
713
+ /** Duration of the video in seconds as defined by the sender */
714
+ duration: number;
715
+ /** MIME type of the file as defined by the sender */
716
+ mime_type?: string;
717
+ /** File size in bytes */
718
+ file_size?: number;
719
+ }
720
+ /** Rich formatted message. */
721
+ export interface RichMessage {
722
+ /** Content of the message */
723
+ blocks: RichBlock[];
724
+ /** True, if the rich message must be shown right-to-left */
725
+ is_rtl?: boolean;
726
+ }
727
+ /** This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound). */
728
+ export interface Animation {
729
+ /** Identifier for this file, which can be used to download or reuse the file */
730
+ file_id: string;
731
+ /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
732
+ file_unique_id: string;
733
+ /** Video width as defined by sender */
734
+ width: number;
735
+ /** Video height as defined by sender */
736
+ height: number;
737
+ /** Duration of the video in seconds as defined by sender */
738
+ duration: number;
739
+ /** Animation thumbnail as defined by sender */
740
+ thumbnail?: PhotoSize;
741
+ /** Original animation filename as defined by sender */
742
+ file_name?: string;
743
+ /** MIME type of the file as defined by sender */
744
+ mime_type?: string;
745
+ /** File size in bytes */
746
+ file_size?: number;
747
+ }
748
+ /** This object represents an audio file to be treated as music by the Telegram clients. */
749
+ export interface Audio {
750
+ /** Identifier for this file, which can be used to download or reuse the file */
751
+ file_id: string;
752
+ /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
753
+ file_unique_id: string;
754
+ /** Duration of the audio in seconds as defined by sender */
755
+ duration: number;
756
+ /** Performer of the audio as defined by sender or by audio tags */
757
+ performer?: string;
758
+ /** Title of the audio as defined by sender or by audio tags */
759
+ title?: string;
760
+ /** Original filename as defined by sender */
761
+ file_name?: string;
762
+ /** MIME type of the file as defined by sender */
763
+ mime_type?: string;
764
+ /** File size in bytes */
765
+ file_size?: number;
766
+ /** Thumbnail of the album cover to which the music file belongs */
767
+ thumbnail?: PhotoSize;
768
+ }
769
+ /** This object represents a general file (as opposed to photos, voice messages and audio files). */
770
+ export interface Document {
771
+ /** Identifier for this file, which can be used to download or reuse the file */
772
+ file_id: string;
773
+ /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
774
+ file_unique_id: string;
775
+ /** Document thumbnail as defined by sender */
776
+ thumbnail?: PhotoSize;
777
+ /** Original filename as defined by sender */
778
+ file_name?: string;
779
+ /** MIME type of the file as defined by sender */
780
+ mime_type?: string;
781
+ /** File size in bytes */
782
+ file_size?: number;
783
+ }
784
+ /** This object represents a story. */
785
+ export interface Story {
786
+ /** Chat that posted the story */
787
+ chat: Chat;
788
+ /** Unique identifier for the story in the chat */
789
+ id: number;
790
+ }
791
+ /** This object represents a video file. */
792
+ export interface Video {
793
+ /** Identifier for this file, which can be used to download or reuse the file */
794
+ file_id: string;
795
+ /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
796
+ file_unique_id: string;
797
+ /** Video width as defined by sender */
798
+ width: number;
799
+ /** Video height as defined by sender */
800
+ height: number;
801
+ /** Duration of the video in seconds as defined by sender */
802
+ duration: number;
803
+ /** Video thumbnail */
804
+ thumbnail?: PhotoSize;
805
+ /** Available sizes of the cover of the video in the message */
806
+ cover?: PhotoSize[];
807
+ /** Timestamp in seconds from which the video will play in the message */
808
+ start_timestamp?: number;
809
+ /** Original filename as defined by sender */
810
+ file_name?: string;
811
+ /** MIME type of the file as defined by sender */
812
+ mime_type?: string;
813
+ /** File size in bytes */
814
+ file_size?: number;
815
+ /** List of available qualities of the video. */
816
+ qualities?: VideoQuality[];
817
+ }
818
+ /** This object represents a video file of a specific quality. */
819
+ export interface VideoQuality {
820
+ /** Identifier for this file, which can be used to download or reuse the file */
821
+ file_id: string;
822
+ /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
823
+ file_unique_id: string;
824
+ /** Video width */
825
+ width: number;
826
+ /** Video height */
827
+ height: number;
828
+ /** Codec that was used to encode the video, for example, “h264”, “h265”, or “av01” */
829
+ codec: string;
830
+ /** File size in bytes */
831
+ file_size?: number;
832
+ }
833
+ /** This object represents a video message (available in Telegram apps as of v.4.0). */
834
+ export interface VideoNote {
835
+ /** Identifier for this file, which can be used to download or reuse the file */
836
+ file_id: string;
837
+ /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
838
+ file_unique_id: string;
839
+ /** Video width and height (diameter of the video message) as defined by sender */
840
+ length: number;
841
+ /** Duration of the video in seconds as defined by sender */
842
+ duration: number;
843
+ /** Video thumbnail */
844
+ thumbnail?: PhotoSize;
845
+ /** File size in bytes */
846
+ file_size?: number;
847
+ }
848
+ /** This object represents a voice note. */
849
+ export interface Voice {
850
+ /** Identifier for this file, which can be used to download or reuse the file */
851
+ file_id: string;
852
+ /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
853
+ file_unique_id: string;
854
+ /** Duration of the audio in seconds as defined by sender */
855
+ duration: number;
856
+ /** MIME type of the file as defined by sender */
857
+ mime_type?: string;
858
+ /** File size in bytes */
859
+ file_size?: number;
860
+ }
861
+ /** This object represents a phone contact. */
862
+ export interface Contact {
863
+ /** Contact's phone number */
864
+ phone_number: string;
865
+ /** Contact's first name */
866
+ first_name: string;
867
+ /** Contact's last name */
868
+ last_name?: string;
869
+ /** Contact's user identifier in Telegram. */
870
+ user_id?: number;
871
+ /** Additional data about the contact in the form of a vCard */
872
+ vcard?: string;
873
+ }
874
+ /** This object represents an animated emoji that displays a random value. */
875
+ export interface Dice {
876
+ /** Emoji on which the dice throw animation is based */
877
+ emoji: string;
878
+ /** Value of the dice, 1-6 for "🎲", "🎯" and "🎳" base emoji, 1-5 for "🏀" and "⚽" base emoji, 1-64 for "🎰" base emoji */
879
+ value: number;
880
+ }
881
+ /** Represents an HTTP link. */
882
+ export interface Link {
883
+ /** URL of the link */
884
+ url: string;
885
+ }
886
+ /** At most one of the optional fields can be present in any given object. */
887
+ export interface PollMedia {
888
+ /** Media is an animation, information about the animation */
889
+ animation?: Animation;
890
+ /** Media is an audio file, information about the file; currently, can't be received in a poll option */
891
+ audio?: Audio;
892
+ /** Media is a general file, information about the file; currently, can't be received in a poll option */
893
+ document?: Document;
894
+ /** The HTTP link attached to the poll option */
895
+ link?: Link;
896
+ /** Media is a live photo, information about the live photo */
897
+ live_photo?: LivePhoto;
898
+ /** Media is a shared location, information about the location */
899
+ location?: Location;
900
+ /** Media is a photo, available sizes of the photo */
901
+ photo?: PhotoSize[];
902
+ /** Media is a sticker, information about the sticker; currently, for poll options only */
903
+ sticker?: Sticker;
904
+ /** Media is a venue, information about the venue */
905
+ venue?: Venue;
906
+ /** Media is a video, information about the video */
907
+ video?: Video;
908
+ }
909
+ /** This object contains information about one answer option in a poll. */
910
+ export interface PollOption {
911
+ /** Unique identifier of the option, persistent on option addition and deletion */
912
+ persistent_id: string;
913
+ /** Option text, 1-100 characters */
914
+ text: string;
915
+ /** Special entities that appear in the option text. Currently, only custom emoji entities are allowed in poll option texts */
916
+ text_entities?: MessageEntity[];
917
+ /** Media added to the poll option */
918
+ media?: PollMedia;
919
+ /** Number of users who voted for this option; may be 0 if unknown */
920
+ voter_count: number;
921
+ /** User who added the option; omitted if the option wasn't added by a user after poll creation */
922
+ added_by_user?: User;
923
+ /** Chat that added the option; omitted if the option wasn't added by a chat after poll creation */
924
+ added_by_chat?: Chat;
925
+ /** Point in time (Unix timestamp) when the option was added; omitted if the option existed in the original poll */
926
+ addition_date?: number;
927
+ }
928
+ /** This object represents an answer of a user in a non-anonymous poll. */
929
+ export interface PollAnswer {
930
+ /** Unique poll identifier */
931
+ poll_id: string;
932
+ /** The chat that changed the answer to the poll, if the voter is anonymous */
933
+ voter_chat?: Chat;
934
+ /** The user that changed the answer to the poll, if the voter isn't anonymous */
935
+ user?: User;
936
+ /** 0-based identifiers of chosen answer options. May be empty if the vote was retracted. */
937
+ option_ids: number[];
938
+ /** Persistent identifiers of the chosen answer options. May be empty if the vote was retracted. */
939
+ option_persistent_ids: string[];
940
+ }
941
+ /** Describes a service message about an option added to a poll. */
942
+ export interface PollOptionAdded {
943
+ /** Message containing the poll to which the option was added. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */
944
+ poll_message?: MaybeInaccessibleMessage;
945
+ /** Unique identifier of the added option */
946
+ option_persistent_id: string;
947
+ /** Option text */
948
+ option_text: string;
949
+ /** Special entities that appear in the option_text */
950
+ option_text_entities?: MessageEntity[];
951
+ }
952
+ /** Describes a service message about an option deleted from a poll. */
953
+ export interface PollOptionDeleted {
954
+ /** Message containing the poll from which the option was deleted. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */
955
+ poll_message?: MaybeInaccessibleMessage;
956
+ /** Unique identifier of the deleted option */
957
+ option_persistent_id: string;
958
+ /** Option text */
959
+ option_text: string;
960
+ /** Special entities that appear in the option_text */
961
+ option_text_entities?: MessageEntity[];
962
+ }
963
+ /** This object contains information about a poll. */
964
+ export interface Poll {
965
+ /** Unique poll identifier */
966
+ id: string;
967
+ /** Poll question, 1-300 characters */
968
+ question: string;
969
+ /** Special entities that appear in the question. Currently, only custom emoji entities are allowed in poll questions */
970
+ question_entities?: MessageEntity[];
971
+ /** List of poll options */
972
+ options: PollOption[];
973
+ /** Total number of users that voted in the poll */
974
+ total_voter_count: number;
975
+ /** True, if the poll is closed */
976
+ is_closed: boolean;
977
+ /** True, if the poll is anonymous */
978
+ is_anonymous: boolean;
979
+ /** Poll type, currently can be “regular” or “quiz” */
980
+ type: "regular" | "quiz";
981
+ /** True, if the poll allows multiple answers */
982
+ allows_multiple_answers: boolean;
983
+ /** True, if the poll allows to change the chosen answer options */
984
+ allows_revoting: boolean;
985
+ /** True if voting is limited to users who have been members of the chat where the poll was originally sent for more than 24 hours */
986
+ members_only: boolean;
987
+ /** A list of two-letter ISO 3166-1 alpha-2 country codes indicating the countries from which users can vote in the poll. The country code “FT” is used for users with anonymous numbers. If omitted, then users from any country can participate in the poll. */
988
+ country_codes?: string[];
989
+ /** Array of 0-based identifiers of the correct answer options. Available only for polls in quiz mode which are closed or were sent (not forwarded) by the bot or to the private chat with the bot. */
990
+ correct_option_ids?: number[];
991
+ /** Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters */
992
+ explanation?: string;
993
+ /** Special entities like usernames, URLs, bot commands, etc. that appear in the explanation */
994
+ explanation_entities?: MessageEntity[];
995
+ /** Media added to the quiz explanation */
996
+ explanation_media?: PollMedia;
997
+ /** Amount of time in seconds the poll will be active after creation */
998
+ open_period?: number;
999
+ /** Point in time (Unix timestamp) when the poll will be automatically closed */
1000
+ close_date?: number;
1001
+ /** Description of the poll; for polls inside the Message object only */
1002
+ description?: string;
1003
+ /** Special entities like usernames, URLs, bot commands, etc. that appear in the description */
1004
+ description_entities?: MessageEntity[];
1005
+ /** Media added to the poll description; for polls inside the Message object only */
1006
+ media?: PollMedia;
1007
+ }
1008
+ /** This object represents a point on the map. */
1009
+ export interface Location {
1010
+ /** Latitude as defined by sender */
1011
+ latitude: number;
1012
+ /** Longitude as defined by sender */
1013
+ longitude: number;
1014
+ /** The radius of uncertainty for the location, measured in meters; 0-1500 */
1015
+ horizontal_accuracy?: number;
1016
+ /** Time relative to the message sending date, during which the location can be updated; in seconds. For active live locations only. */
1017
+ live_period?: number;
1018
+ /** The direction in which user is moving, in degrees; 1-360. For active live locations only. */
1019
+ heading?: number;
1020
+ /** The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */
1021
+ proximity_alert_radius?: number;
1022
+ }
1023
+ /** Describes the paid media added to a message. */
1024
+ export interface PaidMediaInfo {
1025
+ /** The number of Telegram Stars that must be paid to buy access to the media */
1026
+ star_count: number;
1027
+ /** Information about the paid media */
1028
+ paid_media: PaidMedia[];
1029
+ }
1030
+ /** This object describes paid media. Currently, it can be one of
1031
+
1032
+ - PaidMediaLivePhoto
1033
+ - PaidMediaPhoto
1034
+ - PaidMediaPreview
1035
+ - PaidMediaVideo */
1036
+ export type PaidMedia = PaidMediaLivePhoto | PaidMediaPhoto | PaidMediaPreview | PaidMediaVideo;
1037
+ export interface PaidMediaLivePhoto {
1038
+ /** Type of the paid media, always “live_photo” */
1039
+ type: "live_photo";
1040
+ /** The photo */
1041
+ live_photo: LivePhoto;
1042
+ }
1043
+ /** The paid media is a photo. */
1044
+ export interface PaidMediaPhoto {
1045
+ /** Type of the paid media, always “photo” */
1046
+ type: "photo";
1047
+ /** The photo */
1048
+ photo: PhotoSize[];
1049
+ }
1050
+ /** The paid media isn't available before the payment. */
1051
+ export interface PaidMediaPreview {
1052
+ /** Type of the paid media, always “preview” */
1053
+ type: "preview";
1054
+ /** Media width as defined by the sender */
1055
+ width?: number;
1056
+ /** Media height as defined by the sender */
1057
+ height?: number;
1058
+ /** Duration of the media in seconds as defined by the sender */
1059
+ duration?: number;
1060
+ }
1061
+ /** The paid media is a video. */
1062
+ export interface PaidMediaVideo {
1063
+ /** Type of the paid media, always “video” */
1064
+ type: "video";
1065
+ /** The video */
1066
+ video: Video;
1067
+ }
1068
+ /** This object represents a venue. */
1069
+ export interface Venue {
1070
+ /** Venue location. Can't be a live location. */
1071
+ location: Location;
1072
+ /** Name of the venue */
1073
+ title: string;
1074
+ /** Address of the venue */
1075
+ address: string;
1076
+ /** Foursquare identifier of the venue */
1077
+ foursquare_id?: string;
1078
+ /** Foursquare type of the venue. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) */
1079
+ foursquare_type?: string;
1080
+ /** Google Places identifier of the venue */
1081
+ google_place_id?: string;
1082
+ /** Google Places type of the venue. (See supported types.) */
1083
+ google_place_type?: string;
1084
+ }
1085
+ /** Describes data sent from a Web App to the bot. */
1086
+ export interface WebAppData {
1087
+ /** The data. Be aware that a bad client can send arbitrary data in this field. */
1088
+ data: string;
1089
+ /** Text of the web_app keyboard button from which the Web App was opened. Be aware that a bad client can send arbitrary data in this field. */
1090
+ button_text: string;
1091
+ }
1092
+ /** This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user. */
1093
+ export interface ProximityAlertTriggered {
1094
+ /** User that triggered the alert */
1095
+ traveler: User;
1096
+ /** User that set the alert */
1097
+ watcher: User;
1098
+ /** The distance between the users */
1099
+ distance: number;
1100
+ }
1101
+ /** This object represents a service message about a change in auto-delete timer settings. */
1102
+ export interface MessageAutoDeleteTimerChanged {
1103
+ /** New auto-delete time for messages in the chat; in seconds */
1104
+ message_auto_delete_time: number;
1105
+ }
1106
+ /** This object represents a service message about a user boosting a chat. */
1107
+ export interface ChatBoostAdded {
1108
+ /** Number of boosts added by the user */
1109
+ boost_count: number;
1110
+ }
1111
+ /** This object describes the way a background is filled based on the selected colors. Currently, it can be one of
1112
+
1113
+ - BackgroundFillSolid
1114
+ - BackgroundFillGradient
1115
+ - BackgroundFillFreeformGradient */
1116
+ export type BackgroundFill = BackgroundFillSolid | BackgroundFillGradient | BackgroundFillFreeformGradient;
1117
+ /** The background is filled using the selected color. */
1118
+ export interface BackgroundFillSolid {
1119
+ /** Type of the background fill, always “solid” */
1120
+ type: "solid";
1121
+ /** The color of the background fill in the RGB24 format */
1122
+ color: number;
1123
+ }
1124
+ /** The background is a gradient fill. */
1125
+ export interface BackgroundFillGradient {
1126
+ /** Type of the background fill, always “gradient” */
1127
+ type: "gradient";
1128
+ /** Top color of the gradient in the RGB24 format */
1129
+ top_color: number;
1130
+ /** Bottom color of the gradient in the RGB24 format */
1131
+ bottom_color: number;
1132
+ /** Clockwise rotation angle of the background fill in degrees; 0-359 */
1133
+ rotation_angle: number;
1134
+ }
1135
+ /** The background is a freeform gradient that rotates after every message in the chat. */
1136
+ export interface BackgroundFillFreeformGradient {
1137
+ /** Type of the background fill, always “freeform_gradient” */
1138
+ type: "freeform_gradient";
1139
+ /** A list of the 3 or 4 base colors that are used to generate the freeform gradient in the RGB24 format */
1140
+ colors: number[];
1141
+ }
1142
+ /** This object describes the type of a background. Currently, it can be one of
1143
+
1144
+ - BackgroundTypeFill
1145
+ - BackgroundTypeWallpaper
1146
+ - BackgroundTypePattern
1147
+ - BackgroundTypeChatTheme
1148
+ - BackgroundTypeFill */
1149
+ export type BackgroundType = BackgroundTypeFill | BackgroundTypeWallpaper | BackgroundTypePattern | BackgroundTypeChatTheme;
1150
+ /** The background is automatically filled based on the selected colors. */
1151
+ export interface BackgroundTypeFill {
1152
+ /** Type of the background, always “fill” */
1153
+ type: "fill";
1154
+ /** The background fill */
1155
+ fill: BackgroundFill;
1156
+ /** Dimming of the background in dark themes, as a percentage; 0-100 */
1157
+ dark_theme_dimming: number;
1158
+ }
1159
+ /** The background is a wallpaper in the JPEG format. */
1160
+ export interface BackgroundTypeWallpaper {
1161
+ /** Type of the background, always “wallpaper” */
1162
+ type: "wallpaper";
1163
+ /** Document with the wallpaper */
1164
+ document: Document;
1165
+ /** Dimming of the background in dark themes, as a percentage; 0-100 */
1166
+ dark_theme_dimming: number;
1167
+ /** True, if the wallpaper is downscaled to fit in a 450x450 square and then box-blurred with radius 12 */
1168
+ is_blurred?: true;
1169
+ /** True, if the background moves slightly when the device is tilted */
1170
+ is_moving?: true;
1171
+ }
1172
+ /** The background is a .PNG or .TGV (gzipped subset of SVG with MIME type “application/x-tgwallpattern”) pattern to be combined with the background fill chosen by the user. */
1173
+ export interface BackgroundTypePattern {
1174
+ /** Type of the background, always “pattern” */
1175
+ type: "pattern";
1176
+ /** Document with the pattern */
1177
+ document: Document;
1178
+ /** The background fill that is combined with the pattern */
1179
+ fill: BackgroundFill;
1180
+ /** Intensity of the pattern when it is shown above the filled background; 0-100 */
1181
+ intensity: number;
1182
+ /** True, if the background fill must be applied only to the pattern itself. All other pixels are black in this case. For dark themes only. */
1183
+ is_inverted?: true;
1184
+ /** True, if the background moves slightly when the device is tilted */
1185
+ is_moving?: true;
1186
+ }
1187
+ /** The background is taken directly from a built-in chat theme. */
1188
+ export interface BackgroundTypeChatTheme {
1189
+ /** Type of the background, always “chat_theme” */
1190
+ type: "chat_theme";
1191
+ /** Name of the chat theme, which is usually an emoji */
1192
+ theme_name: string;
1193
+ }
1194
+ /** This object represents a chat background. */
1195
+ export interface ChatBackground {
1196
+ /** Type of the background*/
1197
+ type: BackgroundType;
1198
+ }
1199
+ /** This object represents a service message about a new forum topic created in the chat. */
1200
+ export interface ForumTopicCreated {
1201
+ /** Name of the topic */
1202
+ name: string;
1203
+ /** True, if the name of the topic wasn't specified explicitly by its creator and likely needs to be changed by the bot */
1204
+ is_name_implicit?: true;
1205
+ /** Color of the topic icon in RGB format */
1206
+ icon_color: number;
1207
+ /** Unique identifier of the custom emoji shown as the topic icon */
1208
+ icon_custom_emoji_id?: string;
1209
+ }
1210
+ /** This object represents a service message about an edited forum topic. */
1211
+ export interface ForumTopicEdited {
1212
+ /** New name of the topic, if it was edited */
1213
+ name?: string;
1214
+ /** New identifier of the custom emoji shown as the topic icon, if it was edited; an empty string if the icon was removed */
1215
+ icon_custom_emoji_id?: string;
1216
+ }
1217
+ /** This object represents a service message about a forum topic closed in the chat. Currently holds no information. */
1218
+ export interface ForumTopicClosed {
1219
+ }
1220
+ /** This object represents a service message about a forum topic reopened in the chat. Currently holds no information. */
1221
+ export interface ForumTopicReopened {
1222
+ }
1223
+ /** This object represents a service message about General forum topic hidden in the chat. Currently holds no information. */
1224
+ export interface GeneralForumTopicHidden {
1225
+ }
1226
+ /** This object represents a service message about General forum topic unhidden in the chat. Currently holds no information. */
1227
+ export interface GeneralForumTopicUnhidden {
1228
+ }
1229
+ /** This object contains information about a user that was shared with the bot using a KeyboardButtonRequestUsers button. */
1230
+ export interface SharedUser {
1231
+ /** Identifier of the shared user. The bot may not have access to the user and could be unable to use this identifier, unless the user is already known to the bot by some other means. */
1232
+ user_id: number;
1233
+ /** First name of the user, if the name was requested by the bot */
1234
+ first_name?: string;
1235
+ /** Last name of the user, if the name was requested by the bot */
1236
+ last_name?: string;
1237
+ /** Username of the user, if the username was requested by the bot */
1238
+ username?: string;
1239
+ /** Available sizes of the chat photo, if the photo was requested by the bot */
1240
+ photo?: PhotoSize[];
1241
+ }
1242
+ /** This object contains information about the user whose identifier was shared with the bot using a KeyboardButtonRequestUsers button. */
1243
+ export interface UsersShared {
1244
+ /** Identifier of the request */
1245
+ request_id: number;
1246
+ /** Information about users shared with the bot */
1247
+ users: SharedUser[];
1248
+ }
1249
+ /** This object contains information about a chat that was shared with the bot using a KeyboardButtonRequestChat button. */
1250
+ export interface ChatShared {
1251
+ /** Identifier of the request */
1252
+ request_id: number;
1253
+ /** Identifier of the shared chat. The bot may not have access to the chat and could be unable to use this identifier, unless the chat is already known to the bot by some other means. */
1254
+ chat_id: number;
1255
+ /** Title of the chat, if the title was requested by the bot */
1256
+ title?: string;
1257
+ /** Username of the chat, if the username was requested by the bot and available */
1258
+ username?: string;
1259
+ /** Available sizes of the chat photo, if the photo was requested by the bot */
1260
+ photo?: PhotoSize[];
1261
+ }
1262
+ /** This object represents a service message about a user allowing a bot to write messages after adding it to the attachment menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess. */
1263
+ export interface WriteAccessAllowed {
1264
+ /** True, if the access was granted after the user accepted an explicit request from a Web App sent by the method requestWriteAccess */
1265
+ from_request?: boolean;
1266
+ /** Name of the Web App, if the access was granted when the Web App was launched from a link */
1267
+ web_app_name?: string;
1268
+ /** True, if the access was granted when the bot was added to the attachment or side menu */
1269
+ from_attachment_menu?: boolean;
1270
+ }
1271
+ /** Describes a service message about a change in the price of direct messages sent to a channel chat. */
1272
+ export interface DirectMessagePriceChanged {
1273
+ /** True, if direct messages are enabled for the channel chat; False otherwise */
1274
+ are_direct_messages_enabled: boolean;
1275
+ /** The new number of Telegram Stars that must be paid by users for each direct message sent to the channel. Defaults to 0. */
1276
+ direct_message_star_count?: number;
1277
+ }
1278
+ /** This object represents a service message about a video chat scheduled in the chat. */
1279
+ export interface VideoChatScheduled {
1280
+ /** Point in time (Unix timestamp) when the video chat is supposed to be started by a chat administrator */
1281
+ start_date: number;
1282
+ }
1283
+ /** This object represents a service message about a video chat started in the chat. Currently holds no information. */
1284
+ export interface VideoChatStarted {
1285
+ }
1286
+ /** This object represents a service message about a video chat ended in the chat. */
1287
+ export interface VideoChatEnded {
1288
+ /** Video chat duration in seconds */
1289
+ duration: number;
1290
+ }
1291
+ /** This object represents a service message about new members invited to a video chat. */
1292
+ export interface VideoChatParticipantsInvited {
1293
+ /** New members that were invited to the video chat */
1294
+ users: User[];
1295
+ }
1296
+ /** This object represents a service message about the creation of a scheduled giveaway. */
1297
+ export interface GiveawayCreated {
1298
+ /** The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only */
1299
+ prize_star_count?: number;
1300
+ }
1301
+ /** This object represents a message about a scheduled giveaway. */
1302
+ export interface Giveaway {
1303
+ /** The list of chats which the user must join to participate in the giveaway */
1304
+ chats: Chat[];
1305
+ /** Point in time (Unix timestamp) when winners of the giveaway will be selected */
1306
+ winners_selection_date: number;
1307
+ /** The number of users which are supposed to be selected as winners of the giveaway */
1308
+ winner_count: number;
1309
+ /** True, if only users who join the chats after the giveaway started should be eligible to win */
1310
+ only_new_members?: true;
1311
+ /** True, if the list of giveaway winners will be visible to everyone */
1312
+ has_public_winners?: true;
1313
+ /** Description of additional giveaway prize */
1314
+ prize_description?: string;
1315
+ /** A list of two-letter ISO 3166-1 alpha-2 country codes indicating the countries from which eligible users for the giveaway must come. If empty, then all users can participate in the giveaway. Users with a phone number that was bought on Fragment can always participate in giveaways. */
1316
+ country_codes?: string[];
1317
+ /** The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only */
1318
+ prize_star_count?: number;
1319
+ /** The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only */
1320
+ premium_subscription_month_count?: number;
1321
+ }
1322
+ /** This object represents a message about the completion of a giveaway with public winners. */
1323
+ export interface GiveawayWinners {
1324
+ /** The chat that created the giveaway */
1325
+ chat: Chat;
1326
+ /** Identifier of the message with the giveaway in the chat */
1327
+ giveaway_message_id: number;
1328
+ /** Point in time (Unix timestamp) when winners of the giveaway were selected */
1329
+ winners_selection_date: number;
1330
+ /** Total number of winners in the giveaway */
1331
+ winner_count: number;
1332
+ /** List of up to 100 winners of the giveaway */
1333
+ winners: User[];
1334
+ /** The number of other chats the user had to join in order to be eligible for the giveaway */
1335
+ additional_chat_count?: number;
1336
+ /** The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only */
1337
+ prize_star_count?: number;
1338
+ /** The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only */
1339
+ premium_subscription_month_count?: number;
1340
+ /** Number of undistributed prizes */
1341
+ unclaimed_prize_count?: number;
1342
+ /** True, if only users who had joined the chats after the giveaway started were eligible to win */
1343
+ only_new_members?: true;
1344
+ /** True, if the giveaway was canceled because the payment for it was refunded */
1345
+ was_refunded?: true;
1346
+ /** Description of additional giveaway prize */
1347
+ prize_description?: string;
1348
+ }
1349
+ /** This object represents a service message about the completion of a giveaway without public winners. */
1350
+ export interface GiveawayCompleted {
1351
+ /** Number of winners in the giveaway */
1352
+ winner_count: number;
1353
+ /** Number of undistributed prizes */
1354
+ unclaimed_prize_count?: number;
1355
+ /** Message with the giveaway that was completed, if it wasn't deleted */
1356
+ giveaway_message?: Message;
1357
+ /** True, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway. */
1358
+ is_star_giveaway?: true;
1359
+ }
1360
+ /** Describes the options used for link preview generation. */
1361
+ export interface LinkPreviewOptions {
1362
+ /** True, if the link preview is disabled */
1363
+ is_disabled?: boolean;
1364
+ /** URL to use for the link preview. If empty, then the first URL found in the message text will be used. */
1365
+ url?: string;
1366
+ /** True, if the media in the link preview is supposed to be shrunk; ignored if the URL isn't explicitly specified or media size change isn't supported for the preview */
1367
+ prefer_small_media?: boolean;
1368
+ /** True, if the media in the link preview is supposed to be enlarged; ignored if the URL isn't explicitly specified or media size change isn't supported for the preview */
1369
+ prefer_large_media?: boolean;
1370
+ /** True, if the link preview must be shown above the message text; otherwise, the link preview will be shown below the message text */
1371
+ show_above_text?: boolean;
1372
+ }
1373
+ /** This object represents a sticker. */
1374
+ export interface Sticker {
1375
+ /** Identifier for this file, which can be used to download or reuse the file */
1376
+ file_id: string;
1377
+ /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
1378
+ file_unique_id: string;
1379
+ /** Type of the sticker, currently one of “regular”, “mask”, “custom_emoji”. The type of the sticker is independent from its format, which is determined by the fields is_animated and is_video. */
1380
+ type: "regular" | "mask" | "custom_emoji";
1381
+ /** Sticker width */
1382
+ width: number;
1383
+ /** Sticker height */
1384
+ height: number;
1385
+ /** True, if the sticker is animated */
1386
+ is_animated: boolean;
1387
+ /** True, if the sticker is a video sticker */
1388
+ is_video: boolean;
1389
+ /** Sticker thumbnail in the .WEBP or .JPG format */
1390
+ thumbnail?: PhotoSize;
1391
+ /** Emoji associated with the sticker */
1392
+ emoji?: string;
1393
+ /** Name of the sticker set to which the sticker belongs */
1394
+ set_name?: string;
1395
+ /** For premium regular stickers, premium animation for the sticker */
1396
+ premium_animation?: File;
1397
+ /** For mask stickers, the position where the mask should be placed */
1398
+ mask_position?: MaskPosition;
1399
+ /** For custom emoji stickers, unique identifier of the custom emoji */
1400
+ custom_emoji_id?: string;
1401
+ /** File size in bytes */
1402
+ file_size?: number;
1403
+ }
1404
+ /** This object represents a sticker set. */
1405
+ export interface StickerSet {
1406
+ /** Sticker set name */
1407
+ name: string;
1408
+ /** Sticker set title */
1409
+ title: string;
1410
+ /** Type of stickers in the set, currently one of “regular”, “mask”, “custom_emoji” */
1411
+ sticker_type: "regular" | "mask" | "custom_emoji";
1412
+ /** List of all set stickers */
1413
+ stickers: Sticker[];
1414
+ /** Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format */
1415
+ thumbnail?: PhotoSize;
1416
+ }
1417
+ /** This object describes the position on faces where a mask should be placed by default. */
1418
+ export interface MaskPosition {
1419
+ /** The part of the face relative to which the mask should be placed. One of “forehead”, “eyes”, “mouth”, or “chin”. */
1420
+ point: "forehead" | "eyes" | "mouth" | "chin";
1421
+ /** Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position. */
1422
+ x_shift: number;
1423
+ /** Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position. */
1424
+ y_shift: number;
1425
+ /** Mask scaling coefficient. For example, 2.0 means double size. */
1426
+ scale: number;
1427
+ }
1428
+ /** This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers. */
1429
+ export interface Game {
1430
+ /** Title of the game */
1431
+ title: string;
1432
+ /** Description of the game */
1433
+ description: string;
1434
+ /** Photo that will be displayed in the game message in chats */
1435
+ photo: PhotoSize[];
1436
+ /** Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters. */
1437
+ text: string;
1438
+ /** Special entities that appear in text, such as usernames, URLs, bot commands, etc. */
1439
+ text_entities: MessageEntity[];
1440
+ /** Animation that will be displayed in the game message in chats. Upload via BotFather. */
1441
+ animation: Animation;
1442
+ }
1443
+ /** This object represents one row of the high scores table for a game. */
1444
+ export interface GameHighScore {
1445
+ /** Position in high score table for the game */
1446
+ position: number;
1447
+ /** User */
1448
+ user: User;
1449
+ /** Score */
1450
+ score: number;
1451
+ }
1452
+ /** This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/\<file_path>. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile. */
1453
+ export interface File {
1454
+ /** Identifier for this file, which can be used to download or reuse the file */
1455
+ file_id: string;
1456
+ /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
1457
+ file_unique_id: string;
1458
+ /** File size in bytes */
1459
+ file_size?: number;
1460
+ /** File path. Use https://api.telegram.org/file/bot<token>/\<file_path> to get the file. */
1461
+ file_path?: string;
1462
+ }
1463
+ /** This object describes the type of a reaction. Currently, it can be one of
1464
+
1465
+ - ReactionTypeEmoji
1466
+ - ReactionTypeCustomEmoji
1467
+ - ReactionTypePaid */
1468
+ export type ReactionType = ReactionTypeEmoji | ReactionTypeCustomEmoji | ReactionTypePaid;
1469
+ /** The reaction is based on an emoji. */
1470
+ export interface ReactionTypeEmoji {
1471
+ /** Type of the reaction, always “emoji” */
1472
+ type: "emoji";
1473
+ /** Reaction emoji. Currently, it can be one of "👍", "👎", "❤", "🔥", "🥰", "👏", "😁", "🤔", "🤯", "😱", "🤬", "😢", "🎉", "🤩", "🤮", "💩", "🙏", "👌", "🕊", "🤡", "🥱", "🥴", "😍", "🐳", "❤‍🔥", "🌚", "🌭", "💯", "🤣", "⚡", "🍌", "🏆", "💔", "🤨", "😐", "🍓", "🍾", "💋", "🖕", "😈", "😴", "😭", "🤓", "👻", "👨‍💻", "👀", "🎃", "🙈", "😇", "😨", "🤝", "✍", "🤗", "🫡", "🎅", "🎄", "☃", "💅", "🤪", "🗿", "🆒", "💘", "🙉", "🦄", "😘", "💊", "🙊", "😎", "👾", "🤷‍♂", "🤷", "🤷‍♀", "😡". */
1474
+ emoji: "👍" | "👎" | "❤" | "🔥" | "🥰" | "👏" | "😁" | "🤔" | "🤯" | "😱" | "🤬" | "😢" | "🎉" | "🤩" | "🤮" | "💩" | "🙏" | "👌" | "🕊" | "🤡" | "🥱" | "🥴" | "😍" | "🐳" | "❤‍🔥" | "🌚" | "🌭" | "💯" | "🤣" | "⚡" | "🍌" | "🏆" | "💔" | "🤨" | "😐" | "🍓" | "🍾" | "💋" | "🖕" | "😈" | "😴" | "😭" | "🤓" | "👻" | "👨‍💻" | "👀" | "🎃" | "🙈" | "😇" | "😨" | "🤝" | "✍" | "🤗" | "🫡" | "🎅" | "🎄" | "☃" | "💅" | "🤪" | "🗿" | "🆒" | "💘" | "🙉" | "🦄" | "😘" | "💊" | "🙊" | "😎" | "👾" | "🤷‍♂" | "🤷" | "🤷‍♀" | "😡";
1475
+ }
1476
+ /** The reaction is based on a custom emoji. */
1477
+ export interface ReactionTypeCustomEmoji {
1478
+ /** Type of the reaction, always “custom_emoji” */
1479
+ type: "custom_emoji";
1480
+ /** Custom emoji identifier */
1481
+ custom_emoji_id: string;
1482
+ }
1483
+ /** The reaction is paid. */
1484
+ export interface ReactionTypePaid {
1485
+ /** Type of the reaction, always “paid” */
1486
+ type: "paid";
1487
+ }
1488
+ /** Represents a reaction added to a message along with the number of times it was added. */
1489
+ export interface ReactionCount {
1490
+ /** Type of the reaction */
1491
+ type: ReactionType;
1492
+ /** Number of times the reaction was added */
1493
+ total_count: number;
1494
+ }
1495
+ /** This object represents a change of a reaction on a message performed by a user. */
1496
+ export interface MessageReactionUpdated {
1497
+ /** The chat containing the message the user reacted to */
1498
+ chat: Chat;
1499
+ /** Unique identifier of the message inside the chat */
1500
+ message_id: number;
1501
+ /** The user that changed the reaction, if the user isn't anonymous */
1502
+ user?: User;
1503
+ /** The chat on behalf of which the reaction was changed, if the user is anonymous */
1504
+ actor_chat?: Chat;
1505
+ /** Date of the change in Unix time */
1506
+ date: number;
1507
+ /** Previous list of reaction types that were set by the user */
1508
+ old_reaction: ReactionType[];
1509
+ /** New list of reaction types that have been set by the user */
1510
+ new_reaction: ReactionType[];
1511
+ }
1512
+ /** This object represents reaction changes on a message with anonymous reactions. */
1513
+ export interface MessageReactionCountUpdated {
1514
+ /** The chat containing the message */
1515
+ chat: Chat;
1516
+ /** Unique message identifier inside the chat */
1517
+ message_id: number;
1518
+ /** Date of the change in Unix time */
1519
+ date: number;
1520
+ /** List of reactions that are present on the message */
1521
+ reactions: ReactionCount[];
1522
+ }
1523
+ /** Describes a topic of a direct messages chat. */
1524
+ export interface DirectMessagesTopic {
1525
+ /** Unique identifier of the topic */
1526
+ topic_id: number;
1527
+ /** Information about the user that created the topic. Currently, it is always present. */
1528
+ user: User;
1529
+ }
1530
+ /** Contains parameters of a post that is being suggested by the bot. */
1531
+ export interface SuggestedPostParameters {
1532
+ /** Proposed price for the post. If the field is omitted, then the post is unpaid. */
1533
+ price?: SuggestedPostPrice;
1534
+ /** Proposed send date of the post. If specified, then the date must be between 300 second and 2678400 seconds (30 days) in the future. If the field is omitted, then the post can be published at any time within 30 days at the sole discretion of the user who approves it. */
1535
+ send_date?: number;
1536
+ }
1537
+ export {};
node_modules/@grammyjs/types/methods.d.ts ADDED
The diff for this file is too large to render. See raw diff
 
node_modules/@grammyjs/types/mod.d.ts ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export * from "./api.js";
2
+ export * from "./checklist.js";
3
+ export * from "./inline.js";
4
+ export * from "./langs.js";
5
+ export * from "./manage.js";
6
+ export * from "./markup.js";
7
+ export * from "./message.js";
8
+ export * from "./methods.js";
9
+ export * from "./passport.js";
10
+ export * from "./payment.js";
11
+ export * from "./rich.js";
12
+ export * from "./settings.js";
13
+ export * from "./story.js";
14
+ export * from "./update.js";
node_modules/@grammyjs/types/mod.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ /* The comment below makes Vite recognize an empty main file as a valid CJS module. */
2
+ // module.exports
node_modules/@grammyjs/types/package.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@grammyjs/types",
3
+ "version": "4.0.0",
4
+ "description": "Telegram Bot API type declarations for grammY",
5
+ "main": "mod.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/grammyjs/types.git"
9
+ },
10
+ "keywords": [
11
+ "grammy",
12
+ "telegram",
13
+ "bot",
14
+ "api",
15
+ "types"
16
+ ],
17
+ "scripts": {
18
+ "prepare": "deno task build"
19
+ },
20
+ "author": "KnorpelSenf",
21
+ "types": "mod.d.ts",
22
+ "license": "MIT",
23
+ "bugs": {
24
+ "url": "https://github.com/grammyjs/types/issues"
25
+ },
26
+ "files": [
27
+ "*.d.ts",
28
+ "mod.js"
29
+ ],
30
+ "homepage": "https://grammy.dev/",
31
+ "devDependencies": {
32
+ "deno-bin": "^1.31.1"
33
+ }
34
+ }
node_modules/@grammyjs/types/passport.d.ts ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /** Describes Telegram Passport data shared with the bot by the user. */
2
+ export interface PassportData {
3
+ /** Array with information about documents and other Telegram Passport elements that was shared with the bot */
4
+ data: EncryptedPassportElement[];
5
+ /** Encrypted credentials required to decrypt the data */
6
+ credentials: EncryptedCredentials;
7
+ }
8
+ /** This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB. */
9
+ export interface PassportFile {
10
+ /** Identifier for this file, which can be used to download or reuse the file */
11
+ file_id: string;
12
+ /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */
13
+ file_unique_id: string;
14
+ /** File size in bytes */
15
+ file_size: number;
16
+ /** Unix time when the file was uploaded */
17
+ file_date: number;
18
+ }
19
+ /** Describes documents or other Telegram Passport elements shared with the bot by the user. */
20
+ export interface EncryptedPassportElement {
21
+ /** Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”. */
22
+ type: "personal_details" | "passport" | "driver_license" | "identity_card" | "internal_passport" | "address" | "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration" | "phone_number" | "email";
23
+ /** Base64-encoded encrypted Telegram Passport element data provided by the user; available only for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types. Can be decrypted and verified using the accompanying EncryptedCredentials. */
24
+ data?: string;
25
+ /** User's verified phone number; available only for “phone_number” type */
26
+ phone_number?: string;
27
+ /** User's verified email address; available only for “email” type */
28
+ email?: string;
29
+ /** Array of encrypted files with documents provided by the user; available only for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials. */
30
+ files?: PassportFile[];
31
+ /** Encrypted file with the front side of the document, provided by the user; available only for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */
32
+ front_side?: PassportFile;
33
+ /** Encrypted file with the reverse side of the document, provided by the user; available only for “driver_license” and “identity_card”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */
34
+ reverse_side?: PassportFile;
35
+ /** Encrypted file with the selfie of the user holding a document, provided by the user; available if requested for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */
36
+ selfie?: PassportFile;
37
+ /** Array of encrypted files with translated versions of documents provided by the user; available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials. */
38
+ translation?: PassportFile[];
39
+ /** Base64-encoded element hash for using in PassportElementErrorUnspecified */
40
+ hash: string;
41
+ }
42
+ /** Describes data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes. */
43
+ export interface EncryptedCredentials {
44
+ /** Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and secrets required for EncryptedPassportElement decryption and authentication */
45
+ data: string;
46
+ /** Base64-encoded data hash for data authentication */
47
+ hash: string;
48
+ /** Base64-encoded secret, encrypted with the bot's public RSA key, required for data decryption */
49
+ secret: string;
50
+ }
51
+ /** This object represents an error in the Telegram Passport element which was submitted that should be resolved by the user. It should be one of:
52
+ - PassportElementErrorDataField
53
+ - PassportElementErrorFrontSide
54
+ - PassportElementErrorReverseSide
55
+ - PassportElementErrorSelfie
56
+ - PassportElementErrorFile
57
+ - PassportElementErrorFiles
58
+ - PassportElementErrorTranslationFile
59
+ - PassportElementErrorTranslationFiles
60
+ - PassportElementErrorUnspecified
61
+ */
62
+ export type PassportElementError = PassportElementErrorDataField | PassportElementErrorFrontSide | PassportElementErrorReverseSide | PassportElementErrorSelfie | PassportElementErrorFile | PassportElementErrorFiles | PassportElementErrorTranslationFile | PassportElementErrorTranslationFiles | PassportElementErrorUnspecified;
63
+ /** Represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes. */
64
+ export interface PassportElementErrorDataField {
65
+ /** Error source, must be data */
66
+ source: "data";
67
+ /** The section of the user's Telegram Passport which has the error, one of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address” */
68
+ type: "personal_details" | "passport" | "driver_license" | "identity_card" | "internal_passport" | "address";
69
+ /** Name of the data field which has the error */
70
+ field_name: string;
71
+ /** Base64-encoded data hash */
72
+ data_hash: string;
73
+ /** Error message */
74
+ message: string;
75
+ }
76
+ /** Represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes. */
77
+ export interface PassportElementErrorFrontSide {
78
+ /** Error source, must be front_side */
79
+ source: "front_side";
80
+ /** The section of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport” */
81
+ type: "passport" | "driver_license" | "identity_card" | "internal_passport";
82
+ /** Base64-encoded hash of the file with the front side of the document */
83
+ file_hash: string;
84
+ /** Error message */
85
+ message: string;
86
+ }
87
+ /** Represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes. */
88
+ export interface PassportElementErrorReverseSide {
89
+ /** Error source, must be reverse_side */
90
+ source: "reverse_side";
91
+ /** The section of the user's Telegram Passport which has the issue, one of “driver_license”, “identity_card” */
92
+ type: "driver_license" | "identity_card";
93
+ /** Base64-encoded hash of the file with the reverse side of the document */
94
+ file_hash: string;
95
+ /** Error message */
96
+ message: string;
97
+ }
98
+ /** Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes. */
99
+ export interface PassportElementErrorSelfie {
100
+ /** Error source, must be selfie */
101
+ source: "selfie";
102
+ /** The section of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport” */
103
+ type: "passport" | "driver_license" | "identity_card" | "internal_passport";
104
+ /** Base64-encoded hash of the file with the selfie */
105
+ file_hash: string;
106
+ /** Error message */
107
+ message: string;
108
+ }
109
+ /** Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes. */
110
+ export interface PassportElementErrorFile {
111
+ /** Error source, must be file */
112
+ source: "file";
113
+ /** The section of the user's Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” */
114
+ type: "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration";
115
+ /** Base64-encoded file hash */
116
+ file_hash: string;
117
+ /** Error message */
118
+ message: string;
119
+ }
120
+ /** Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes. */
121
+ export interface PassportElementErrorFiles {
122
+ /** Error source, must be files */
123
+ source: "files";
124
+ /** The section of the user's Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” */
125
+ type: "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration";
126
+ /** List of base64-encoded file hashes */
127
+ file_hashes: string[];
128
+ /** Error message */
129
+ message: string;
130
+ }
131
+ /** Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes. */
132
+ export interface PassportElementErrorTranslationFile {
133
+ /** Error source, must be translation_file */
134
+ source: "translation_file";
135
+ /** Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” */
136
+ type: "passport" | "driver_license" | "identity_card" | "internal_passport" | "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration";
137
+ /** Base64-encoded file hash */
138
+ file_hash: string;
139
+ /** Error message */
140
+ message: string;
141
+ }
142
+ /** Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change. */
143
+ export interface PassportElementErrorTranslationFiles {
144
+ /** Error source, must be translation_files */
145
+ source: "translation_files";
146
+ /** Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” */
147
+ type: "passport" | "driver_license" | "identity_card" | "internal_passport" | "utility_bill" | "bank_statement" | "rental_agreement" | "passport_registration" | "temporary_registration";
148
+ /** List of base64-encoded file hashes */
149
+ file_hashes: string[];
150
+ /** Error message */
151
+ message: string;
152
+ }
153
+ /** Represents an issue in an unspecified place. The error is considered resolved when new data is added. */
154
+ export interface PassportElementErrorUnspecified {
155
+ /** Error source, must be unspecified */
156
+ source: "unspecified";
157
+ /** Type of element of the user's Telegram Passport which has the issue */
158
+ type: string;
159
+ /** Base64-encoded element hash */
160
+ element_hash: string;
161
+ /** Error message */
162
+ message: string;
163
+ }
node_modules/@grammyjs/types/payment.d.ts ADDED
@@ -0,0 +1,570 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { Chat, User } from "./manage.js";
2
+ import type { Message, MessageEntity, PaidMedia, Sticker } from "./message.js";
3
+ /** This object represents a portion of the price for goods or services. */
4
+ export interface LabeledPrice {
5
+ /** Portion label */
6
+ label: string;
7
+ /** Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */
8
+ amount: number;
9
+ }
10
+ /** This object contains basic information about an invoice. */
11
+ export interface Invoice {
12
+ /** Product name */
13
+ title: string;
14
+ /** Product description */
15
+ description: string;
16
+ /** Unique bot deep-linking parameter that can be used to generate this invoice */
17
+ start_parameter: string;
18
+ /** Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars */
19
+ currency: string;
20
+ /** Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */
21
+ total_amount: number;
22
+ }
23
+ /** This object represents a shipping address. */
24
+ export interface ShippingAddress {
25
+ /** Two-letter ISO 3166-1 alpha-2 country code */
26
+ country_code: string;
27
+ /** State, if applicable */
28
+ state: string;
29
+ /** City */
30
+ city: string;
31
+ /** First line for the address */
32
+ street_line1: string;
33
+ /** Second line for the address */
34
+ street_line2: string;
35
+ /** Address post code */
36
+ post_code: string;
37
+ }
38
+ /** This object represents information about an order. */
39
+ export interface OrderInfo {
40
+ /** User name */
41
+ name?: string;
42
+ /** User's phone number */
43
+ phone_number?: string;
44
+ /** User email */
45
+ email?: string;
46
+ /** User shipping address */
47
+ shipping_address?: ShippingAddress;
48
+ }
49
+ /** This object represents one shipping option. */
50
+ export interface ShippingOption {
51
+ /** Shipping option identifier */
52
+ id: string;
53
+ /** Option title */
54
+ title: string;
55
+ /** List of price portions */
56
+ prices: LabeledPrice[];
57
+ }
58
+ /** This object contains basic information about a successful payment. Note that if the buyer initiates a chargeback with the relevant payment provider following this transaction, the funds may be debited from your balance. This is outside of Telegram's control. */
59
+ export interface SuccessfulPayment {
60
+ /** Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars */
61
+ currency: string;
62
+ /** Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */
63
+ total_amount: number;
64
+ /** Bot specified invoice payload */
65
+ invoice_payload: string;
66
+ /** Expiration date of the subscription, in Unix time; for recurring payments only */
67
+ subscription_expiration_date?: number;
68
+ /** True, if the payment is a recurring payment for a subscription */
69
+ is_recurring?: true;
70
+ /** True, if the payment is the first payment for a subscription */
71
+ is_first_recurring?: true;
72
+ /** Identifier of the shipping option chosen by the user */
73
+ shipping_option_id?: string;
74
+ /** Order information provided by the user */
75
+ order_info?: OrderInfo;
76
+ /** Telegram payment identifier */
77
+ telegram_payment_charge_id: string;
78
+ /** Provider payment identifier */
79
+ provider_payment_charge_id: string;
80
+ }
81
+ /** This object contains basic information about a refunded payment. */
82
+ export interface RefundedPayment {
83
+ /** Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars. Currently, always “XTR”. */
84
+ currency: string;
85
+ /** Total refunded price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45, total_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */
86
+ total_amount: number;
87
+ /** Bot-specified invoice payload */
88
+ invoice_payload: string;
89
+ /** Telegram payment identifier */
90
+ telegram_payment_charge_id: string;
91
+ /** Provider payment identifier */
92
+ provider_payment_charge_id?: string;
93
+ }
94
+ /** This object contains information about an incoming shipping query. */
95
+ export interface ShippingQuery {
96
+ /** Unique query identifier */
97
+ id: string;
98
+ /** User who sent the query */
99
+ from: User;
100
+ /** Bot specified invoice payload */
101
+ invoice_payload: string;
102
+ /** User specified shipping address */
103
+ shipping_address: ShippingAddress;
104
+ }
105
+ /** This object contains information about an incoming pre-checkout query. */
106
+ export interface PreCheckoutQuery {
107
+ /** Unique query identifier */
108
+ id: string;
109
+ /** User who sent the query */
110
+ from: User;
111
+ /** Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars */
112
+ currency: string;
113
+ /** Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */
114
+ total_amount: number;
115
+ /** Bot specified invoice payload */
116
+ invoice_payload: string;
117
+ /** Identifier of the shipping option chosen by the user */
118
+ shipping_option_id?: string;
119
+ /** Order information provided by the user */
120
+ order_info?: OrderInfo;
121
+ }
122
+ /** This object describes the state of a revenue withdrawal operation. Currently, it can be one of
123
+
124
+ - RevenueWithdrawalStatePending
125
+ - RevenueWithdrawalStateSucceeded
126
+ - RevenueWithdrawalStateFailed */
127
+ export type RevenueWithdrawalState = RevenueWithdrawalStatePending | RevenueWithdrawalStateSucceeded | RevenueWithdrawalStateFailed;
128
+ /** The withdrawal is in progress. */
129
+ export interface RevenueWithdrawalStatePending {
130
+ /** Type of the state, always “pending” */
131
+ type: "pending";
132
+ }
133
+ /** The withdrawal succeeded. */
134
+ export interface RevenueWithdrawalStateSucceeded {
135
+ /** Type of the state, always “succeeded” */
136
+ type: "succeeded";
137
+ /** Date the withdrawal was completed in Unix time */
138
+ date: number;
139
+ /** An HTTPS URL that can be used to see transaction details */
140
+ url: string;
141
+ }
142
+ /** The withdrawal failed and the transaction was refunded. */
143
+ export interface RevenueWithdrawalStateFailed {
144
+ /** Type of the state, always “failed” */
145
+ type: "failed";
146
+ }
147
+ /** Contains information about the affiliate that received a commission via this transaction. */
148
+ export interface AffiliateInfo {
149
+ /** The bot or the user that received an affiliate commission if it was received by a bot or a user */
150
+ affiliate_user?: User;
151
+ /** The chat that received an affiliate commission if it was received by a chat */
152
+ affiliate_chat?: Chat;
153
+ /** The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred users */
154
+ commission_per_mille: number;
155
+ /** Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0; can be negative for refunds */
156
+ amount: number;
157
+ /** The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to 999999999; can be negative for refunds */
158
+ nanostar_amount?: number;
159
+ }
160
+ /** This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of
161
+
162
+ - TransactionPartnerUser
163
+ - TransactionPartnerChat
164
+ - TransactionPartnerAffiliateProgram
165
+ - TransactionPartnerFragment
166
+ - TransactionPartnerTelegramAds
167
+ - TransactionPartnerTelegramApi
168
+ - TransactionPartnerOther */
169
+ export type TransactionPartner = TransactionPartnerUser | TransactionPartnerChat | TransactionPartnerAffiliateProgram | TransactionPartnerFragment | TransactionPartnerTelegramAds | TransactionPartnerTelegramApi | TransactionPartnerOther;
170
+ /** Describes a transaction with a user. */
171
+ export interface TransactionPartnerUser {
172
+ /** Type of the transaction partner, always “user” */
173
+ type: "user";
174
+ /** Type of the transaction, currently one of “invoice_payment” for payments via invoices, “paid_media_payment” for payments for paid media, “gift_purchase” for gifts sent by the bot, “premium_purchase” for Telegram Premium subscriptions gifted by the bot, “business_account_transfer” for direct transfers from managed business accounts */
175
+ transaction_type: "invoice_payment" | "paid_media_payment" | "gift_purchase" | "premium_purchase" | "business_account_transfer";
176
+ /** Information about the user */
177
+ user: User;
178
+ /** Information about the affiliate that received a commission via this transaction. Can be available only for “invoice_payment” and “paid_media_payment” transactions. */
179
+ affiliate?: AffiliateInfo;
180
+ /** Bot-specified invoice payload. Can be available only for “invoice_payment” transactions. */
181
+ invoice_payload?: string;
182
+ /** The duration of the paid subscription. Can be available only for “invoice_payment” transactions. */
183
+ subscription_period?: number;
184
+ /** Information about the paid media bought by the user; for “paid_media_payment” transactions only */
185
+ paid_media?: PaidMedia[];
186
+ /** Bot-specified paid media payload. Can be available only for “paid_media_payment” transactions. */
187
+ paid_media_payload?: string;
188
+ /** The gift sent to the user by the bot; for “gift_purchase” transactions only */
189
+ gift?: Gift;
190
+ /** Number of months the gifted Telegram Premium subscription will be active for; for ���premium_purchase” transactions only */
191
+ premium_subscription_duration?: number;
192
+ }
193
+ /** Describes a transaction with a chat. */
194
+ export interface TransactionPartnerChat {
195
+ /** Type of the transaction partner, always “chat” */
196
+ type: "chat";
197
+ /** Information about the chat */
198
+ chat: Chat;
199
+ /** The gift sent to the chat by the bot */
200
+ gift?: Gift;
201
+ }
202
+ /** Describes the affiliate program that issued the affiliate commission received via this transaction. */
203
+ export interface TransactionPartnerAffiliateProgram {
204
+ /** Type of the transaction partner, always “affiliate_program” */
205
+ type: "affiliate_program";
206
+ /** Information about the bot that sponsored the affiliate program */
207
+ sponsor_user?: User;
208
+ /** The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program sponsor from referred users */
209
+ commission_per_mille: number;
210
+ }
211
+ /** Describes a withdrawal transaction with Fragment. */
212
+ export interface TransactionPartnerFragment {
213
+ /** Type of the transaction partner, always “fragment” */
214
+ type: "fragment";
215
+ /** State of the transaction if the transaction is outgoing */
216
+ withdrawal_state?: RevenueWithdrawalState;
217
+ }
218
+ /** Describes a withdrawal transaction to the Telegram Ads platform. */
219
+ export interface TransactionPartnerTelegramAds {
220
+ /** Type of the transaction partner, always “telegram_ads” */
221
+ type: "telegram_ads";
222
+ }
223
+ /** Describes a transaction with payment for paid broadcasting. */
224
+ export interface TransactionPartnerTelegramApi {
225
+ /** Type of the transaction partner, always “telegram_api” */
226
+ type: "telegram_api";
227
+ /** The number of successful requests that exceeded regular limits and were therefore billed */
228
+ request_count: number;
229
+ }
230
+ /** Describes a transaction with an unknown source or recipient. */
231
+ export interface TransactionPartnerOther {
232
+ /** Type of the transaction partner, always “other” */
233
+ type: "other";
234
+ }
235
+ /** Describes a Telegram Star transaction. Note that if the buyer initiates a chargeback with the payment provider from whom they acquired Stars (e.g., Apple, Google) following this transaction, the refunded Stars will be deducted from the bot's balance. This is outside of Telegram's control. */
236
+ export interface StarTransaction {
237
+ /** Unique identifier of the transaction. Coincides with the identifier of the original transaction for refund transactions. Coincides with SuccessfulPayment.telegram_payment_charge_id for successful incoming payments from users. */
238
+ id: string;
239
+ /** Integer amount of Telegram Stars transferred by the transaction */
240
+ amount: number;
241
+ /** The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999 */
242
+ nanostar_amount?: number;
243
+ /** Date the transaction was created in Unix time */
244
+ date: number;
245
+ /** Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions. */
246
+ source?: TransactionPartner;
247
+ /** Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions. */
248
+ receiver?: TransactionPartner;
249
+ }
250
+ /** Contains a list of Telegram Star transactions. */
251
+ export interface StarTransactions {
252
+ /** The list of transactions */
253
+ transactions: StarTransaction[];
254
+ }
255
+ /** This object contains information about a paid media purchase. */
256
+ export interface PaidMediaPurchased {
257
+ /** User who purchased the media */
258
+ from: User;
259
+ /** Bot-specified paid media payload */
260
+ paid_media_payload: string;
261
+ }
262
+ /** This object describes the background of a gift. */
263
+ export interface GiftBackground {
264
+ /** Center color of the background in RGB format */
265
+ center_color: number;
266
+ /** Edge color of the background in RGB format */
267
+ edge_color: number;
268
+ /** Text color of the background in RGB format */
269
+ text_color: number;
270
+ }
271
+ /** This object represents a gift that can be sent by the bot. */
272
+ export interface Gift {
273
+ /** Unique identifier of the gift */
274
+ id: string;
275
+ /** Information about the chat that published the gift */
276
+ publisher_chat?: Chat;
277
+ /** The sticker that represents the gift */
278
+ sticker: Sticker;
279
+ /** Background of the gift */
280
+ background?: GiftBackground;
281
+ /** True, if the gift can only be purchased by Telegram Premium subscribers */
282
+ is_premium?: true;
283
+ /** True, if the gift can be used (after being upgraded) to customize a user's appearance */
284
+ has_colors?: true;
285
+ /** The number of Telegram Stars that must be paid to send the sticker */
286
+ star_count: number;
287
+ /** The number of Telegram Stars that must be paid to upgrade the gift to a unique one */
288
+ upgrade_star_count?: number;
289
+ /** The total number of different unique gifts that can be obtained by upgrading the gift */
290
+ unique_gift_variant_count?: number;
291
+ /** The total number of gifts of this type that can be sent by all users; for limited gifts only */
292
+ total_count?: number;
293
+ /** The number of remaining gifts of this type that can be sent by all users; for limited gifts only */
294
+ remaining_count?: number;
295
+ /** The total number of gifts of this type that can be sent by the bot; for limited gifts only */
296
+ personal_total_count?: number;
297
+ /** The number of remaining gifts of this type that can be sent by the bot; for limited gifts only */
298
+ personal_remaining_count?: number;
299
+ }
300
+ /** This object represent a list of gifts. */
301
+ export interface Gifts {
302
+ /** The list of gifts */
303
+ gifts: Gift[];
304
+ }
305
+ /** This object describes the model of a unique gift. */
306
+ export interface UniqueGiftModel {
307
+ /** Name of the model */
308
+ name: string;
309
+ /** The sticker that represents the unique gift */
310
+ sticker: Sticker;
311
+ /** The number of unique gifts that receive this model for every 1000 gift upgrades. Always 0 for crafted gifts. */
312
+ rarity_per_mille: number;
313
+ /** Rarity of the model if it is a crafted model. Currently, can be “uncommon”, “rare”, “epic”, or “legendary”. */
314
+ rarity?: "uncommon" | "rare" | "epic" | "legendary";
315
+ }
316
+ /** This object describes the symbol shown on the pattern of a unique gift. */
317
+ export interface UniqueGiftSymbol {
318
+ /** Name of the symbol */
319
+ name: string;
320
+ /** The sticker that represents the unique gift */
321
+ sticker: Sticker;
322
+ /** The number of unique gifts that receive this model for every 1000 gifts upgraded */
323
+ rarity_per_mille: number;
324
+ }
325
+ /** This object describes the colors of the backdrop of a unique gift. */
326
+ export interface UniqueGiftBackdropColors {
327
+ /** The color in the center of the backdrop in RGB format */
328
+ center_color: number;
329
+ /** The color on the edges of the backdrop in RGB format */
330
+ edge_color: number;
331
+ /** The color to be applied to the symbol in RGB format */
332
+ symbol_color: number;
333
+ /** The color for the text on the backdrop in RGB format */
334
+ text_color: number;
335
+ }
336
+ /** This object describes the backdrop of a unique gift. */
337
+ export interface UniqueGiftBackdrop {
338
+ /** Name of the backdrop */
339
+ name: string;
340
+ /** Colors of the backdrop */
341
+ colors: UniqueGiftBackdropColors;
342
+ /** The number of unique gifts that receive this backdrop for every 1000 gifts upgraded */
343
+ rarity_per_mille: number;
344
+ }
345
+ /** This object describes a unique gift that was upgraded from a regular gift. */
346
+ export interface UniqueGift {
347
+ /** Identifier of the regular gift from which the gift was upgraded */
348
+ gift_id: string;
349
+ /** Human-readable name of the regular gift from which this unique gift was upgraded */
350
+ base_name: string;
351
+ /** Unique name of the gift. This name can be used in https://t.me/nft/... links and story areas. */
352
+ name: string;
353
+ /** Information about the chat that published the gift */
354
+ publisher_chat?: Chat;
355
+ /** True, if the original regular gift was exclusively purchaseable by Telegram Premium subscribers */
356
+ is_premium?: true;
357
+ /** True, if the gift is assigned from the TON blockchain and can't be resold or transferred in Telegram */
358
+ is_from_blockchain?: true;
359
+ /** Unique number of the upgraded gift among gifts upgraded from the same regular gift */
360
+ number: number;
361
+ /** Model of the gift */
362
+ model: UniqueGiftModel;
363
+ /** Symbol of the gift */
364
+ symbol: UniqueGiftSymbol;
365
+ /** Backdrop of the gift */
366
+ backdrop: UniqueGiftBackdrop;
367
+ /** The color scheme that can be used by the gift's owner for the chat's name, replies to messages and link previews */
368
+ colors?: UniqueGiftColors;
369
+ /** True, if the gift was used to craft another gift and isn't available anymore */
370
+ is_burned?: true;
371
+ }
372
+ /** This object contains information about the color scheme for a user's name, message replies and link previews based on a unique gift. */
373
+ export interface UniqueGiftColors {
374
+ /** Custom emoji identifier of the unique gift's model */
375
+ model_custom_emoji_id: string;
376
+ /** Custom emoji identifier of the unique gift's symbol */
377
+ symbol_custom_emoji_id: string;
378
+ /** Main color used in light themes; RGB format */
379
+ light_theme_main_color: number;
380
+ /** List of 1-3 additional colors used in light themes; RGB format */
381
+ light_theme_other_colors: number[];
382
+ /** Main color used in dark themes; RGB format */
383
+ dark_theme_main_color: number;
384
+ /** List of 1-3 additional colors used in dark themes; RGB format */
385
+ dark_theme_other_colors: number[];
386
+ }
387
+ /** Describes a service message about a regular gift that was sent or received. */
388
+ export interface GiftInfo {
389
+ /** Information about the gift */
390
+ gift: Gift;
391
+ /** Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts */
392
+ owned_gift_id?: string;
393
+ /** Number of Telegram Stars that can be claimed by the receiver by converting the gift; omitted if conversion to Telegram Stars is impossible */
394
+ convert_star_count?: number;
395
+ /** Number of Telegram Stars that were prepaid by the sender for the ability to upgrade the gift */
396
+ prepaid_upgrade_star_count?: number;
397
+ /** True, if the gift can be upgraded to a unique gift */
398
+ can_be_upgraded?: true;
399
+ /** True, if the gift's upgrade was purchased after the gift was sent */
400
+ is_upgrade_separate?: true;
401
+ /** Unique number reserved for this gift when upgraded. See the number field in UniqueGift. */
402
+ unique_gift_number?: number;
403
+ /** Text of the message that was added to the gift */
404
+ text?: string;
405
+ /** Special entities that appear in the text */
406
+ entities?: MessageEntity[];
407
+ /** True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them */
408
+ is_private?: true;
409
+ }
410
+ /** Describes a service message about a unique gift that was sent or received. */
411
+ export interface UniqueGiftInfo {
412
+ /** Information about the gift */
413
+ gift: UniqueGift;
414
+ /** Origin of the gift. Currently, either “upgrade” for gifts upgraded from regular gifts, “transfer” for gifts transferred from other users or channels, “resale” for gifts bought from other users, “gifted_upgrade” for upgrades purchased after the gift was sent, or “offer” for gifts bought or sold through gift purchase offers. */
415
+ origin: "upgrade" | "transfer" | "resale" | "gifted_upgrade" | "offer";
416
+ /** Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts */
417
+ owned_gift_id?: string;
418
+ /** Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift */
419
+ transfer_star_count?: number;
420
+ /** For gifts bought from other users, the currency in which the payment for the gift was done. Currently, one of “XTR” for Telegram Stars or “TON” for TON grams. */
421
+ last_resale_currency?: "XTR" | "TON";
422
+ /** For gifts bought from other users, the price paid for the gift in either Telegram Stars or nanograms */
423
+ last_resale_amount?: number;
424
+ /** Point in time (Unix timestamp) when the gift can be transferred. If it is in the past, then the gift can be transferred now. */
425
+ next_transfer_date?: number;
426
+ }
427
+ /** Describes a service message about a change in the price of paid messages within a chat. */
428
+ export interface PaidMessagePriceChanged {
429
+ /** The new number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message */
430
+ paid_message_star_count: number;
431
+ }
432
+ /** Describes an amount of Telegram Stars. */
433
+ export interface StarAmount {
434
+ /** Integer amount of Telegram Stars, rounded to 0; can be negative */
435
+ amount: number;
436
+ /** The number of 1/1000000000 shares of Telegram Stars; from -999999999 to 999999999; can be negative if and only if amount is non-positive */
437
+ nanostar_amount?: number;
438
+ }
439
+ /** This object describes a gift received and owned by a user or a chat. Currently, it can be one of
440
+
441
+ - OwnedGiftRegular
442
+ - OwnedGiftUnique */
443
+ export type OwnedGift = OwnedGiftRegular | OwnedGiftUnique;
444
+ /** Describes a regular gift owned by a user or a chat. */
445
+ export interface OwnedGiftRegular {
446
+ /** Type of the gift, always “regular” */
447
+ type: "regular";
448
+ /** Information about the regular gift */
449
+ gift: Gift;
450
+ /** Unique identifier of the gift for the bot; for gifts received on behalf of business accounts only */
451
+ owned_gift_id?: string;
452
+ /** Sender of the gift if it is a known user */
453
+ sender_user?: User;
454
+ /** Date the gift was sent in Unix time */
455
+ send_date: number;
456
+ /** Unique number reserved for this gift when upgraded. See the number field in UniqueGift. */
457
+ unique_gift_number?: number;
458
+ /** Text of the message that was added to the gift */
459
+ text?: string;
460
+ /** Special entities that appear in the text */
461
+ entities?: MessageEntity[];
462
+ /** True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them */
463
+ is_private?: true;
464
+ /** True, if the gift is displayed on the account's profile page; for gifts received on behalf of business accounts only */
465
+ is_saved?: true;
466
+ /** True, if the gift can be upgraded to a unique gift; for gifts received on behalf of business accounts only */
467
+ can_be_upgraded?: true;
468
+ /** True, if the gift's upgrade was purchased after the gift was sent */
469
+ is_upgrade_separate?: true;
470
+ /** True, if the gift was refunded and isn't available anymore */
471
+ was_refunded?: true;
472
+ /** Number of Telegram Stars that can be claimed by the receiver instead of the gift; omitted if the gift cannot be converted to Telegram Stars */
473
+ convert_star_count?: number;
474
+ /** Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift */
475
+ prepaid_upgrade_star_count?: number;
476
+ }
477
+ /** Describes a unique gift received and owned by a user or a chat. */
478
+ export interface OwnedGiftUnique {
479
+ /** Type of the gift, always “unique” */
480
+ type: "unique";
481
+ /** Information about the unique gift */
482
+ gift: UniqueGift;
483
+ /** Unique identifier of the received gift for the bot; for gifts received on behalf of business accounts only */
484
+ owned_gift_id?: string;
485
+ /** Sender of the gift if it is a known user */
486
+ sender_user?: User;
487
+ /** Date the gift was sent in Unix time */
488
+ send_date: number;
489
+ /** True, if the gift is displayed on the account's profile page; for gifts received on behalf of business accounts only */
490
+ is_saved?: true;
491
+ /** True, if the gift can be transferred to another owner; for gifts received on behalf of business accounts only */
492
+ can_be_transferred?: true;
493
+ /** Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift */
494
+ transfer_star_count?: number;
495
+ /** Point in time (Unix timestamp) when the gift can be transferred. If it is in the past, then the gift can be transferred now. */
496
+ next_transfer_date?: number;
497
+ }
498
+ /** Contains the list of gifts received and owned by a user or a chat. */
499
+ export interface OwnedGifts {
500
+ /** The total number of gifts owned by the user or the chat */
501
+ total_count: number;
502
+ /** The list of gifts */
503
+ gifts: OwnedGift[];
504
+ /** Offset for the next request. If empty, then there are no more results */
505
+ next_offset?: string;
506
+ }
507
+ /** This object describes the access settings of a bot. */
508
+ export interface BotAccessSettings {
509
+ /** True, if only selected users can access the bot. The bot's owner can always access it. */
510
+ is_access_restricted: boolean;
511
+ /** The list of other users who have access to the bot if the access is restricted */
512
+ added_users?: User[];
513
+ }
514
+ /** Describes the price of a suggested post. */
515
+ export interface SuggestedPostPrice {
516
+ /** Currency in which the post will be paid. Currently, must be one of “XTR” for Telegram Stars or “TON” for TON grams. */
517
+ currency: "XTR" | "TON";
518
+ /** The amount of the currency that will be paid for the post in the smallest units of the currency, i.e. Telegram Stars or nanograms. Currently, price in Telegram Stars must be between 5 and 100000, and price in nanograms must be between 10000000 and 10000000000000. */
519
+ amount: number;
520
+ }
521
+ /** Contains information about a suggested post. */
522
+ export interface SuggestedPostInfo {
523
+ /** State of the suggested post. Currently, it can be one of “pending”, “approved”, “declined”. */
524
+ state: "pending" | "approved" | "declined";
525
+ /** Proposed price of the post. If the field is omitted, then the post is unpaid. */
526
+ price?: SuggestedPostPrice;
527
+ /** Proposed send date of the post. If the field is omitted, then the post can be published at any time within 30 days at the sole discretion of the user or administrator who approves it. */
528
+ send_date?: number;
529
+ }
530
+ /** Describes a service message about the approval of a suggested post. */
531
+ export interface SuggestedPostApproved {
532
+ /** Message containing the suggested post. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */
533
+ suggested_post_message?: Message;
534
+ /** Amount paid for the post */
535
+ price?: SuggestedPostPrice;
536
+ /** Date when the post will be published */
537
+ send_date: number;
538
+ }
539
+ /** Describes a service message about the failed approval of a suggested post. Currently, only caused by insufficient user funds at the time of approval. */
540
+ export interface SuggestedPostApprovalFailed {
541
+ /** Message containing the suggested post whose approval has failed. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */
542
+ suggested_post_message?: Message;
543
+ /** Expected price of the post */
544
+ price: SuggestedPostPrice;
545
+ }
546
+ /** Describes a service message about the rejection of a suggested post. */
547
+ export interface SuggestedPostDeclined {
548
+ /** Message containing the suggested post. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */
549
+ suggested_post_message?: Message;
550
+ /** Comment with which the post was declined */
551
+ comment?: string;
552
+ }
553
+ /** Describes a service message about a successful payment for a suggested post. */
554
+ export interface SuggestedPostPaid {
555
+ /** Message containing the suggested post. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */
556
+ suggested_post_message?: Message;
557
+ /** Currency in which the payment was made. Currently, one of “XTR” for Telegram Stars or “TON” for TON grams. */
558
+ currency: "XTR" | "TON";
559
+ /** The amount of the currency that was received by the channel in nanograms; for payments in TON grams only */
560
+ amount?: number;
561
+ /** The amount of Telegram Stars that was received by the channel; for payments in Telegram Stars only */
562
+ star_amount?: StarAmount;
563
+ }
564
+ /** Describes a service message about a payment refund for a suggested post. */
565
+ export interface SuggestedPostRefunded {
566
+ /** Message containing the suggested post. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */
567
+ suggested_post_message?: Message;
568
+ /** Reason for the refund. Currently, one of “post_deleted” if the post was deleted within 24 hours of being posted or removed from scheduled messages without being posted, or “payment_refunded” if the payer refunded their payment. */
569
+ reason: string;
570
+ }
node_modules/@grammyjs/types/rich.d.ts ADDED
@@ -0,0 +1,1010 @@
 
 
 
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, Location, PhotoSize, Video, Voice } from "./message.js";
3
+ import type { InputMediaAnimation, InputMediaAudio, InputMediaPhoto, InputMediaVideo, InputMediaVoiceNote } from "./methods.js";
4
+ /** Describes a rich message to be sent. Exactly one of the fields html, markdown, or blocks must be used.
5
+ *
6
+ * Rich messages support advanced structured formatting options like headings, lists, tables, media, block quotations, collapsible blocks, footnotes, and formulas. Telegram clients will render them accordingly. You can specify rich message content using Markdown-style or HTML-style formatting, or explicit blocks.
7
+ *
8
+ * Plain URLs, e-mail addresses, username mentions, hashtags, cashtags, bot commands, phone numbers, and bank card numbers are detected automatically. To disable automatic entity detection, pass True in the skip_entity_detection field. Note that Telegram clients will display an alert to the user before opening an inline link ('Open this link?' together with the full URL).
9
+ *
10
+ * When Markdown-style or HTML-style formatting is used, you can use links in the form tg://photo?id=..., tg://video?id=..., and tg://audio?id=... instead of an HTTP URL to reuse previously uploaded files or upload a new file.
11
+ *
12
+ * #### Rich Message Limits
13
+ *
14
+ * Rich messages are subject to the following limits:
15
+ *
16
+ * - Up to 32768 UTF-8 characters in the rich message text, including custom emoji alternative text and formula source.
17
+ * - Up to 500 blocks, including nested blocks, list items, ordered list items, table rows, quotation blocks, and details blocks.
18
+ * - Up to 16 levels of nested formatting and blocks.
19
+ * - Up to 50 media attachments in total, including photos, videos, and audio files.
20
+ * - Up to 20 columns in a table.
21
+ *
22
+ * #### Rich Markdown style
23
+ *
24
+ * To use this mode, pass rich message content in the markdown field. Use the following syntax in your message:
25
+ *
26
+ * ````markdown
27
+ * **bold text**
28
+ * __bold text__
29
+ * *italic text*
30
+ * _italic text_
31
+ * ~~strikethrough text~~
32
+ * `inline fixed-width code`
33
+ * ==marked text==
34
+ * ||spoiler||
35
+ *
36
+ * [inline URL](https://t.me/)
37
+ * [inline e-mail](mailto:user@example.com)
38
+ * [inline phone number](tel:+123456789)
39
+ * [inline mention of a user](tg://user?id=123456789)
40
+ * ![👍](tg://emoji?id=5368324170671202286)
41
+ * ![22:45 tomorrow](tg://time?unix=1647531900&format=wDT)
42
+ * $x^2 + y^2$
43
+ * \#hashtag $USD +12345678901, card: 4242 4242 4242 4242, https://t.me t.me a@t.me /command @username
44
+ * all the text above was on the same line
45
+ *
46
+ * # Heading 1
47
+ * ## Heading 2
48
+ * ### Heading 3
49
+ * #### Heading 4
50
+ * ##### Heading 5
51
+ * ###### Heading 6
52
+ *
53
+ * Paragraph text
54
+ *
55
+ * ```python
56
+ * print('pre-formatted fixed-width code block written in the Python programming language')
57
+ * ```
58
+ *
59
+ * ---
60
+ *
61
+ * - unordered list item
62
+ * * unordered list item
63
+ * + unordered list item
64
+ *
65
+ * 1. ordered list item
66
+ * 2. ordered list item
67
+ *
68
+ * - [ ] task list item
69
+ * - [x] completed task list item
70
+ *
71
+ * >Block quotation started
72
+ * >
73
+ * >Block quotation continued on the next line
74
+ * >Block quotation continued on the same line
75
+ * >
76
+ * >The last line of the block quotation
77
+ *
78
+ * ![](https://telegram.org/example/photo.jpg)
79
+ * ![](https://telegram.org/example/video.mp4)
80
+ * ![](https://telegram.org/example/audio.mp3)
81
+ * ![](https://telegram.org/example/audio.ogg)
82
+ * ![](https://telegram.org/example/animation.gif)
83
+ *
84
+ * ![](https://telegram.org/example/photo.jpg "Photo caption")
85
+ * ![](https://telegram.org/example/video.mp4 "Video caption")
86
+ * ![](https://telegram.org/example/audio.mp3 "Audio caption")
87
+ * ![](https://telegram.org/example/audio.ogg "Voice note caption")
88
+ * ![](https://telegram.org/example/animation.gif "Animation caption")
89
+ *
90
+ * | Header 1 | Header 2 |
91
+ * |:---------|:--------:|
92
+ * | left | center |
93
+ *
94
+ * Text with a reference[^id1] and another one[^id2].
95
+ *
96
+ * [^id1]: Definition of the first footnote.
97
+ * [^id2]: Definition of the second footnote.
98
+ *
99
+ * $$E = mc^2$$
100
+ *
101
+ * ```math
102
+ * E = mc^2
103
+ * ```
104
+ *
105
+ * ## Example Nested Syntax Report for _Q1_
106
+ * Intro with <u>underlined text</u>, ==marked text==, and $x^2 + y^2$.
107
+ * **Bold _italic <u>underlined italic bold</u> italic_ bold**
108
+ * <u>In inline tags, nested **markdown** is parsed</u>
109
+ * >Quote with **bold text, ~~strikethrough, and <tg-spoiler>spoiler</tg-spoiler>~~**, plus [a link](https://t.me/).
110
+ *
111
+ * - List item with `code`, <sup>superscript</sup>, <sub>subscript</sub>, and a footnote[^note]
112
+ * - Another item with **bold <tg-spoiler><code>spoiler code</code></tg-spoiler>**
113
+ * - Another item with ~~strikethrough and <ins>inserted text</ins>~~
114
+ *
115
+ * | Metric | Value |
116
+ * |:-------|------:|
117
+ * | Speed | **42** <sup>ms</sup> |
118
+ * | Status | <tg-spoiler>ready</tg-spoiler> |
119
+ *
120
+ * [^note]: Footnote with _italic text_ and <u>HTML underline</u>.
121
+ *
122
+ * ---
123
+ *
124
+ * # Details blocks can contain Markdown content:
125
+ *
126
+ * <details open><summary>Summary with **bold text**</summary>
127
+ *
128
+ * ### Details heading
129
+ * - List item with _italic text_
130
+ * - List item with <tg-spoiler>spoiler</tg-spoiler>
131
+ *
132
+ * </details>
133
+ *
134
+ * # Collages and slideshows can contain Markdown media blocks:
135
+ *
136
+ * <tg-collage>
137
+ *
138
+ * ![](https://telegram.org/example/photo.jpg)
139
+ * ![](https://telegram.org/example/video.mp4)
140
+ *
141
+ * </tg-collage>
142
+ *
143
+ * <tg-slideshow>
144
+ *
145
+ * ![](https://telegram.org/example/photo.jpg)
146
+ * ![](https://telegram.org/example/video.mp4)
147
+ *
148
+ * </tg-slideshow>
149
+ * ````
150
+ *
151
+ * For formatting features that don't have Markdown syntax, use HTML tags:
152
+ *
153
+ * ```html
154
+ * <u>underlined text</u>, <ins>underlined text</ins>
155
+ * <sub>subscript text</sub>
156
+ * <sup>superscript text</sup>
157
+ * <a name="chapter-1"></a>
158
+ * <aside>Pull quote<cite>The Author</cite></aside>
159
+ * <details open><summary>Title</summary>Content</details>
160
+ * <tg-map lat="41.9" long="12.5" zoom="14"/>
161
+ * <tg-collage><img src="https://telegram.org/example/photo.jpg"/><figcaption>Caption<cite>The Author</cite></figcaption></tg-collage>
162
+ * <tg-slideshow><img src="https://telegram.org/example/photo.jpg"/><video src="https://telegram.org/example/video.mp4"/><figcaption>Slideshow caption<cite>The Author</cite></figcaption></tg-slideshow>
163
+ * ```
164
+ *
165
+ * Please note:
166
+ *
167
+ * - Rich Markdown is compatible with GitHub Flavored Markdown where possible and can contain arbitrary HTML. Supported rich message HTML tags are parsed as described in Rich HTML style.
168
+ * - Media can be specified only as a separate block.
169
+ * - Media blocks support only HTTP and HTTPS URLs.
170
+ * - Media type is determined by the MIME type and the URL of the media.
171
+ * - In media syntax, the optional title after the URL is used as the caption; for example, displays “Photo caption” under the media.
172
+ * - Table cells can contain only inline formatting.
173
+ * - Formula source is treated as raw LaTeX.
174
+ * - See date-time entity formatting for more details about supported date-time formats.
175
+ *
176
+ * #### Rich HTML style
177
+ *
178
+ * To use this mode, pass rich message content in the html field. The following tags are currently supported:
179
+ *
180
+ * ```html
181
+ * <a name="chapter-0"></a>
182
+ * <b>bold text</b>, <strong>bold text</strong>
183
+ * <i>italic text</i>, <em>italic text</em>
184
+ * <u>underlined text</u>, <ins>underlined text</ins>
185
+ * <s>strikethrough text</s>, <strike>strikethrough text</strike>, <del>strikethrough text</del>
186
+ * <code>inline fixed-width code</code>
187
+ * <mark>marked text</mark>
188
+ * <sub>subscript text</sub>
189
+ * <sup>superscript text</sup>
190
+ * <tg-spoiler>spoiler</tg-spoiler>
191
+ *
192
+ * <a href="#note-1">Reference</a>
193
+ * <a href="https://t.me/">inline URL</a>
194
+ * <a href="mailto:user@example.com">inline e-mail</a>
195
+ * <a href="tel:+123456789">inline phone number</a>
196
+ * <a href="tg://user?id=123456789">inline mention of a user</a>
197
+ * <a href="#chapter-1">in-document link</a>
198
+ * <a name="chapter-1"></a>
199
+ *
200
+ * <tg-reference name="note-1">Referenced text</tg-reference>
201
+ * <tg-emoji emoji-id="5368324170671202286">👍</tg-emoji>
202
+ * <img src="tg://emoji?id=5368324170671202286" alt="👍"/>
203
+ * <tg-time unix="1647531900" format="wDT">22:45 tomorrow</tg-time>
204
+ * <tg-math>x^2 + y^2</tg-math>
205
+ *
206
+ * #hashtag $USD +12345678901, card: 4242 4242 4242 4242, https://t.me t.me a@t.me /command @username
207
+ *
208
+ * all the text above was on the same line
209
+ *
210
+ * <h1>Heading 1</h1>
211
+ * <h2>Heading 2</h2>
212
+ * <h3>Heading 3</h3>
213
+ * <h4>Heading 4</h4>
214
+ * <h5>Heading 5</h5>
215
+ * <h6>Heading 6</h6>
216
+ *
217
+ * <a name="chapter-2"></a>
218
+ *
219
+ * <p>Paragraph text</p>
220
+ * <pre>pre-formatted fixed-width code block</pre>
221
+ * <pre><code class="language-python"> print('pre-formatted fixed-width code block written in the Python programming language')</code></pre>
222
+ * <footer>Footer text</footer>
223
+ * <hr/>
224
+ * <ul><li>unordered list item</li></ul>
225
+ * <ol><li>ordered list item</li></ol>
226
+ * <ol start="3" type="a" reversed><li>ordered list item</li></ol>
227
+ * <ol><li value="7" type="i">ordered list item with explicit number</li></ol>
228
+ * <ul>
229
+ * <li><input type="checkbox" checked>Checked checkbox</li>
230
+ * <li><input type="checkbox">Unchecked checkbox</li>
231
+ * </ul>
232
+ *
233
+ * <blockquote>Block quotation started<br>Block quotation continued<br>The last line of the block quotation<cite>The Author</cite></blockquote>
234
+ * <aside>Pull quote<cite>The Author</cite></aside>
235
+ *
236
+ * <img src="https://telegram.org/example/photo.jpg"/>
237
+ * <video src="https://telegram.org/example/video.mp4"></video>
238
+ * <audio src="https://telegram.org/example/audio.mp3"></audio>
239
+ * <audio src="https://telegram.org/example/audio.ogg"></audio>
240
+ * <video src="https://telegram.org/example/animation.gif"></video>
241
+ *
242
+ * <figure><img src="https://telegram.org/example/photo.jpg" tg-spoiler/><figcaption>Photo caption<cite>Photo credit</cite></figcaption></figure>
243
+ * <figure><video src="https://telegram.org/example/video.mp4" tg-spoiler></video><figcaption>Video caption</figcaption></figure>
244
+ * <figure><audio src="https://telegram.org/example/audio.mp3"></audio><figcaption>Audio caption</figcaption></figure>
245
+ * <figure><audio src="https://telegram.org/example/audio.ogg"></audio><figcaption>Voice note caption</figcaption></figure>
246
+ * <figure><video src="https://telegram.org/example/animation.gif" tg-spoiler></video><figcaption>Animation caption</figcaption></figure>
247
+ *
248
+ * <tg-map lat="41.9" long="12.5" zoom="14"/>
249
+ * <figure><tg-map lat="41.9" long="12.5" zoom="14"/><figcaption>Map caption</figcaption></figure>
250
+ *
251
+ * <tg-collage><img src="https://telegram.org/example/photo.jpg"/><video src="https://telegram.org/example/video.mp4"/></tg-collage>
252
+ * <tg-collage><video src="https://telegram.org/example/video.mp4"/><img src="https://telegram.org/example/photo.jpg"/><figcaption>Collage caption</figcaption></tg-collage>
253
+ * <tg-slideshow><img src="https://telegram.org/example/photo.jpg"/><video src="https://telegram.org/example/video.mp4"/></tg-slideshow>
254
+ * <tg-slideshow><video src="https://telegram.org/example/video.mp4"/><img src="https://telegram.org/example/photo.jpg"/><figcaption>Slideshow caption</figcaption></tg-slideshow>
255
+ *
256
+ * <table><tr><th>Header 1</th><th>Header 2</th></tr><tr><td>Value 1</td><td>Value 2</td></tr></table>
257
+ * <table bordered striped><caption>Table caption</caption>
258
+ * <tr><td colspan="2" rowspan="2" align="left">Value</td><td align="center">Value2</td><td align="right">Value3</td></tr>
259
+ * <tr><td valign="top">Value4</td><td valign="middle">Value5</td><td valign="bottom">Value6</td></tr>
260
+ * <tr><td>Value7</td></tr></table>
261
+ *
262
+ * <details><summary>Title</summary>Content</details>
263
+ * <details open><summary>Title</summary>Content</details>
264
+ * <tg-math-block>E = mc^2</tg-math-block>
265
+ * ```
266
+ *
267
+ * Please note:
268
+ *
269
+ * - Only the tags mentioned above are currently supported.
270
+ * - All numerical HTML entities are supported.
271
+ * - The API currently supports only the following named HTML entities: &lt;, &gt;, &amp;, &quot;, &apos;, &nbsp;, &hellip;, &mdash;, &ndash;, &lsquo;, &rsquo;, &ldquo; and &rdquo;.
272
+ * - Use nested pre and code tags to define the programming language for a pre-formatted block.
273
+ * - Programming language can't be specified for standalone code tags.
274
+ * - Links mailto:..., tel:..., and tg://user?id=... are rendered as e-mail links, phone links, and inline mentions respectively. Other supported links are rendered as regular inline links.
275
+ * - Images, videos, and audio files can be specified only as separate media blocks.
276
+ * - Media blocks support only HTTP and HTTPS URLs.
277
+ * - An empty \<a name="..."></a> on its own creates an anchor that can be linked to with \<a href="#...">...</a>.
278
+ * - In \<figcaption>, you can use \<cite> tags to specify caption credit.
279
+ * - Use \<tg-reference name="...">...</tg-reference> to define referenced text that can be linked to with \<a href="#...">...</a>.
280
+ * - The body of a \<details> tag can contain rich message content. If the open attribute is specified, the block is expanded by default.
281
+ * - Formula source is treated as raw LaTeX.
282
+ * - See date-time entity formatting for more details about supported date-time formats. */
283
+ export interface InputRichMessage<F> {
284
+ /** Content of the rich message to send described as a list of blocks */
285
+ blocks?: InputRichBlock<F>[];
286
+ /** Content of the rich message to send described using HTML formatting. See rich message formatting options for more details. Use media field to specify the media used in the message. */
287
+ html?: string;
288
+ /** Content of the rich message to send described using Markdown formatting. See rich message formatting options for more details. Use media field to specify the media used in the message. */
289
+ markdown?: string;
290
+ /** List of media that are specified in the markdown or html fields using tg://photo?id=, tg://video?id=, and tg://audio?id= links */
291
+ media?: InputRichMessageMedia<F>[];
292
+ /** Pass True if the rich message must be shown right-to-left */
293
+ is_rtl?: boolean;
294
+ /** Pass True to skip automatic detection of entities (e.g., URLs, email addresses, username mentions, hashtags, cashtags, bot commands, or phone numbers) in the text */
295
+ skip_entity_detection?: boolean;
296
+ }
297
+ /** Describes a media element embedded in an outgoing rich message. */
298
+ export interface InputRichMessageMedia<F> {
299
+ /** Unique identifier of the media used in a tg://photo?id=, tg://video?id=, or tg://audio?id= link. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed. */
300
+ id: string;
301
+ /** The media to be sent. Everything except the media itself and its properties is ignored. */
302
+ media: InputMediaAnimation<F> | InputMediaAudio<F> | InputMediaPhoto<F> | InputMediaVideo<F> | InputMediaVoiceNote<F>;
303
+ }
304
+ /** This object represents a rich formatted text. Currently, it can be either a String for plain text, an Array of RichText, or any of the following types:
305
+
306
+ - RichTextBold
307
+ - RichTextItalic
308
+ - RichTextUnderline
309
+ - RichTextStrikethrough
310
+ - RichTextSpoiler
311
+ - RichTextDateTime
312
+ - RichTextTextMention
313
+ - RichTextSubscript
314
+ - RichTextSuperscript
315
+ - RichTextMarked
316
+ - RichTextCode
317
+ - RichTextCustomEmoji
318
+ - RichTextMathematicalExpression
319
+ - RichTextUrl
320
+ - RichTextEmailAddress
321
+ - RichTextPhoneNumber
322
+ - RichTextBankCardNumber
323
+ - RichTextMention
324
+ - RichTextHashtag
325
+ - RichTextCashtag
326
+ - RichTextBotCommand
327
+ - RichTextAnchor
328
+ - RichTextAnchorLink
329
+ - RichTextReference
330
+ - RichTextReferenceLink */
331
+ export type RichText = string | RichText[] | RichTextBold | RichTextItalic | RichTextUnderline | RichTextStrikethrough | RichTextSpoiler | RichTextDateTime | RichTextTextMention | RichTextSubscript | RichTextSuperscript | RichTextMarked | RichTextCode | RichTextCustomEmoji | RichTextMathematicalExpression | RichTextUrl | RichTextEmailAddress | RichTextPhoneNumber | RichTextBankCardNumber | RichTextMention | RichTextHashtag | RichTextCashtag | RichTextBotCommand | RichTextAnchor | RichTextAnchorLink | RichTextReference | RichTextReferenceLink;
332
+ /** A bold text. */
333
+ export interface RichTextBold {
334
+ /** Type of the rich text, always “bold” */
335
+ type: "bold";
336
+ /** The text */
337
+ text: RichText;
338
+ }
339
+ /** An italicized text. */
340
+ export interface RichTextItalic {
341
+ /** Type of the rich text, always “italic” */
342
+ type: "italic";
343
+ /** The text */
344
+ text: RichText;
345
+ }
346
+ /** An underlined text. */
347
+ export interface RichTextUnderline {
348
+ /** Type of the rich text, always “underline” */
349
+ type: "underline";
350
+ /** The text */
351
+ text: RichText;
352
+ }
353
+ /** A strikethrough text. */
354
+ export interface RichTextStrikethrough {
355
+ /** Type of the rich text, always “strikethrough” */
356
+ type: "strikethrough";
357
+ /** The text */
358
+ text: RichText;
359
+ }
360
+ /** A text covered by a spoiler. */
361
+ export interface RichTextSpoiler {
362
+ /** Type of the rich text, always “spoiler” */
363
+ type: "spoiler";
364
+ /** The text */
365
+ text: RichText;
366
+ }
367
+ /** Formatted date and time. */
368
+ export interface RichTextDateTime {
369
+ /** Type of the rich text, always “date_time” */
370
+ type: "date_time";
371
+ /** The text */
372
+ text: RichText;
373
+ /** The Unix time associated with the entity */
374
+ unix_time: number;
375
+ /** The string that defines the formatting of the date and time. See date-time entity formatting for more details. */
376
+ date_time_format: "r" | `${"w" | ""}${"d" | "D" | ""}${"t" | "T" | ""}`;
377
+ }
378
+ /** A mention of a Telegram user by their identifier. */
379
+ export interface RichTextTextMention {
380
+ /** Type of the rich text, always “text_mention” */
381
+ type: "text_mention";
382
+ /** The text */
383
+ text: RichText;
384
+ /** The mentioned user */
385
+ user: User;
386
+ }
387
+ /** A subscript text. */
388
+ export interface RichTextSubscript {
389
+ /** Type of the rich text, always “subscript” */
390
+ type: "subscript";
391
+ /** The text */
392
+ text: RichText;
393
+ }
394
+ /** A superscript text. */
395
+ export interface RichTextSuperscript {
396
+ /** Type of the rich text, always “superscript” */
397
+ type: "superscript";
398
+ /** The text */
399
+ text: RichText;
400
+ }
401
+ /** A marked text. */
402
+ export interface RichTextMarked {
403
+ /** Type of the rich text, always “marked” */
404
+ type: "marked";
405
+ /** The text */
406
+ text: RichText;
407
+ }
408
+ /** A monowidth text. */
409
+ export interface RichTextCode {
410
+ /** Type of the rich text, always “code” */
411
+ type: "code";
412
+ /** The text */
413
+ text: RichText;
414
+ }
415
+ /** A custom emoji. */
416
+ export interface RichTextCustomEmoji {
417
+ /** Type of the rich text, always “custom_emoji” */
418
+ type: "custom_emoji";
419
+ /** Unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker. */
420
+ custom_emoji_id: string;
421
+ /** Alternative emoji for the custom emoji */
422
+ alternative_text: string;
423
+ }
424
+ /** A mathematical expression. */
425
+ export interface RichTextMathematicalExpression {
426
+ /** Type of the rich text, always “mathematical_expression” */
427
+ type: "mathematical_expression";
428
+ /** The expression in LaTeX format */
429
+ expression: string;
430
+ }
431
+ /** A text with a link. */
432
+ export interface RichTextUrl {
433
+ /** Type of the rich text, always “url” */
434
+ type: "url";
435
+ /** The text */
436
+ text: RichText;
437
+ /** URL of the link */
438
+ url: string;
439
+ }
440
+ /** A text with an email address. */
441
+ export interface RichTextEmailAddress {
442
+ /** Type of the rich text, always “email_address” */
443
+ type: "email_address";
444
+ /** The text */
445
+ text: RichText;
446
+ /** The email address */
447
+ email_address: string;
448
+ }
449
+ /** A text with a phone number. */
450
+ export interface RichTextPhoneNumber {
451
+ /** Type of the rich text, always “phone_number” */
452
+ type: "phone_number";
453
+ /** The text */
454
+ text: RichText;
455
+ /** The phone number */
456
+ phone_number: string;
457
+ }
458
+ /** A text with a bank card number. */
459
+ export interface RichTextBankCardNumber {
460
+ /** Type of the rich text, always “bank_card_number” */
461
+ type: "bank_card_number";
462
+ /** The text */
463
+ text: RichText;
464
+ /** The bank card number */
465
+ bank_card_number: string;
466
+ }
467
+ /** A mention by a username. */
468
+ export interface RichTextMention {
469
+ /** Type of the rich text, always “mention” */
470
+ type: "mention";
471
+ /** The text */
472
+ text: RichText;
473
+ /** The mentioned user */
474
+ username: string;
475
+ }
476
+ /** A hashtag. */
477
+ export interface RichTextHashtag {
478
+ /** Type of the rich text, always “hashtag” */
479
+ type: "hashtag";
480
+ /** The text */
481
+ text: RichText;
482
+ /** The hashtag */
483
+ hashtag: string;
484
+ }
485
+ /** A cashtag. */
486
+ export interface RichTextCashtag {
487
+ /** Type of the rich text, always “cashtag” */
488
+ type: "cashtag";
489
+ /** The text */
490
+ text: RichText;
491
+ /** The cashtag */
492
+ cashtag: string;
493
+ }
494
+ /** A bot command. */
495
+ export interface RichTextBotCommand {
496
+ /** Type of the rich text, always “bot_command” */
497
+ type: "bot_command";
498
+ /** The text */
499
+ text: RichText;
500
+ /** The bot command */
501
+ bot_command: string;
502
+ }
503
+ /** An anchor. */
504
+ export interface RichTextAnchor {
505
+ /** Type of the rich text, always “anchor” */
506
+ type: "anchor";
507
+ /** The name of the anchor */
508
+ name: string;
509
+ }
510
+ /** A link to an anchor. */
511
+ export interface RichTextAnchorLink {
512
+ /** Type of the rich text, always “anchor_link” */
513
+ type: "anchor_link";
514
+ /** The link text */
515
+ text: RichText;
516
+ /** The name of the anchor. If the name is empty, then the link brings back to the top of the message. */
517
+ anchor_name: string;
518
+ }
519
+ /** A reference. */
520
+ export interface RichTextReference {
521
+ /** Type of the rich text, always “reference” */
522
+ type: "reference";
523
+ /** Text of the reference */
524
+ text: RichText;
525
+ /** The name of the reference */
526
+ name: string;
527
+ }
528
+ /** A link to a reference. */
529
+ export interface RichTextReferenceLink {
530
+ /** Type of the rich text, always “reference_link” */
531
+ type: "reference_link";
532
+ /** The link text */
533
+ text: RichText;
534
+ /** The name of the reference */
535
+ reference_name: string;
536
+ }
537
+ /** Caption of a rich formatted block. */
538
+ export interface RichBlockCaption {
539
+ /** Block caption */
540
+ text: RichText;
541
+ /** Block credit which corresponds to the HTML tag \<cite> */
542
+ credit?: RichText;
543
+ }
544
+ /** Cell in a table. */
545
+ export interface RichBlockTableCell {
546
+ /** Text in the cell. If omitted, then the cell is invisible. */
547
+ text?: RichText;
548
+ /** True, if the cell is a header cell */
549
+ is_header?: true;
550
+ /** The number of columns the cell spans if it is bigger than 1 */
551
+ colspan?: number;
552
+ /** The number of rows the cell spans if it is bigger than 1 */
553
+ rowspan?: number;
554
+ /** Horizontal cell content alignment. Currently, must be one of “left”, “center”, or “right”. */
555
+ align: "left" | "center" | "right";
556
+ /** Vertical cell content alignment. Currently, must be one of “top”, “middle”, or “bottom”. */
557
+ valign: "top" | "middle" | "bottom";
558
+ }
559
+ /** An item of a list. */
560
+ export interface RichBlockListItem {
561
+ /** Label of the item */
562
+ label: string;
563
+ /** The content of the item */
564
+ blocks: RichBlock[];
565
+ /** True, if the item has a checkbox */
566
+ has_checkbox?: true;
567
+ /** True, if the item has a checked checkbox */
568
+ is_checked?: true;
569
+ /** For ordered lists, the numeric value of the item label */
570
+ value?: number;
571
+ /** For ordered lists, the type of the item label; must be one of “a” for lowercase letters, “A” for uppercase letters, “i” for lowercase Roman numerals, “I” for uppercase Roman numerals, or “1” for decimal numbers */
572
+ type?: "a" | "A" | "i" | "I" | "1";
573
+ }
574
+ /** This object represents a block in a rich formatted message. Currently, it can be any of the following types:
575
+
576
+ - RichBlockParagraph
577
+ - RichBlockSectionHeading
578
+ - RichBlockPreformatted
579
+ - RichBlockFooter
580
+ - RichBlockDivider
581
+ - RichBlockMathematicalExpression
582
+ - RichBlockAnchor
583
+ - RichBlockList
584
+ - RichBlockBlockQuotation
585
+ - RichBlockPullQuotation
586
+ - RichBlockCollage
587
+ - RichBlockSlideshow
588
+ - RichBlockTable
589
+ - RichBlockDetails
590
+ - RichBlockMap
591
+ - RichBlockAnimation
592
+ - RichBlockAudio
593
+ - RichBlockPhoto
594
+ - RichBlockVideo
595
+ - RichBlockVoiceNote
596
+ - RichBlockThinking */
597
+ export type RichBlock = RichBlockParagraph | RichBlockSectionHeading | RichBlockPreformatted | RichBlockFooter | RichBlockDivider | RichBlockMathematicalExpression | RichBlockAnchor | RichBlockList | RichBlockBlockQuotation | RichBlockPullQuotation | RichBlockCollage | RichBlockSlideshow | RichBlockTable | RichBlockDetails | RichBlockMap | RichBlockAnimation | RichBlockAudio | RichBlockPhoto | RichBlockVideo | RichBlockVoiceNote | RichBlockThinking;
598
+ /** A text paragraph, corresponding to the HTML tag \<p>. */
599
+ export interface RichBlockParagraph {
600
+ /** Type of the block, always “paragraph” */
601
+ type: "paragraph";
602
+ /** Text of the block */
603
+ text: RichText;
604
+ }
605
+ /** A section heading, corresponding to the HTML tags \<h1>, \<h2>, \<h3>, \<h4>, \<h5>, or \<h6>. */
606
+ export interface RichBlockSectionHeading {
607
+ /** Type of the block, always “heading” */
608
+ type: "heading";
609
+ /** Text of the block */
610
+ text: RichText;
611
+ /** Relative size of the text font; 1-6, 1 is the largest, 6 is the smallest */
612
+ size: 1 | 2 | 3 | 4 | 5 | 6;
613
+ }
614
+ /** A preformatted text block, corresponding to the nested HTML tags \<pre> and \<code>. */
615
+ export interface RichBlockPreformatted {
616
+ /** Type of the block, always “pre” */
617
+ type: "pre";
618
+ /** Text of the block */
619
+ text: RichText;
620
+ /** The programming language of the text */
621
+ language?: string;
622
+ }
623
+ /** A footer, corresponding to the HTML tag \<footer>. */
624
+ export interface RichBlockFooter {
625
+ /** Type of the block, always “footer” */
626
+ type: "footer";
627
+ /** Text of the block */
628
+ text: RichText;
629
+ }
630
+ /** A divider, corresponding to the HTML tag \<hr/>. */
631
+ export interface RichBlockDivider {
632
+ /** Type of the block, always “divider” */
633
+ type: "divider";
634
+ }
635
+ /** A block with a mathematical expression in LaTeX format, corresponding to the custom HTML tag \<tg-math-block>. */
636
+ export interface RichBlockMathematicalExpression {
637
+ /** Type of the block, always “mathematical_expression” */
638
+ type: "mathematical_expression";
639
+ /** The mathematical expression in LaTeX format */
640
+ expression: string;
641
+ }
642
+ /** A block with an anchor, corresponding to the HTML tag \<a> with the attribute name. */
643
+ export interface RichBlockAnchor {
644
+ /** Type of the block, always “anchor” */
645
+ type: "anchor";
646
+ /** The name of the anchor */
647
+ name: string;
648
+ }
649
+ /** A list of blocks, corresponding to the HTML tag \<ul> or \<ol> with multiple nested tags \<li>. */
650
+ export interface RichBlockList {
651
+ /** Type of the block, always “list” */
652
+ type: "list";
653
+ /** Items of the list */
654
+ items: RichBlockListItem[];
655
+ }
656
+ /** A block quotation, corresponding to the HTML tag \<blockquote>. */
657
+ export interface RichBlockBlockQuotation {
658
+ /** Type of the block, always “blockquote” */
659
+ type: "blockquote";
660
+ /** Content of the block */
661
+ blocks: RichBlock[];
662
+ /** Credit of the block */
663
+ credit?: RichText;
664
+ }
665
+ /** A quotation with centered text, loosely corresponding to the HTML tag \<aside>. */
666
+ export interface RichBlockPullQuotation {
667
+ /** Type of the block, always “pullquote” */
668
+ type: "pullquote";
669
+ /** Text of the block */
670
+ text: RichText;
671
+ /** Credit of the block */
672
+ credit?: RichText;
673
+ }
674
+ /** A collage, corresponding to the custom HTML tag \<tg-collage>. */
675
+ export interface RichBlockCollage {
676
+ /** Type of the block, always “collage” */
677
+ type: "collage";
678
+ /** Elements of the collage */
679
+ blocks: RichBlock[];
680
+ /** Caption of the block */
681
+ caption?: RichBlockCaption;
682
+ }
683
+ /** A slideshow, corresponding to the custom HTML tag \<tg-slideshow>. */
684
+ export interface RichBlockSlideshow {
685
+ /** Type of the block, always “slideshow” */
686
+ type: "slideshow";
687
+ /** Elements of the slideshow */
688
+ blocks: RichBlock[];
689
+ /** Caption of the block */
690
+ caption?: RichBlockCaption;
691
+ }
692
+ /** A table, corresponding to the HTML tag \<table>. */
693
+ export interface RichBlockTable {
694
+ /** Type of the block, always “table” */
695
+ type: "table";
696
+ /** Cells of the table */
697
+ cells: RichBlockTableCell[][];
698
+ /** True, if the table has borders */
699
+ is_bordered?: true;
700
+ /** True, if the table is striped */
701
+ is_striped?: true;
702
+ /** Caption of the table */
703
+ caption?: RichText;
704
+ }
705
+ /** An expandable block for details disclosure, corresponding to the HTML tag \<details>. */
706
+ export interface RichBlockDetails {
707
+ /** Type of the block, always “details” */
708
+ type: "details";
709
+ /** Always shown summary of the block */
710
+ summary: RichText;
711
+ /** Content of the block */
712
+ blocks: RichBlock[];
713
+ /** True, if the content of the block is visible by default */
714
+ is_open?: true;
715
+ }
716
+ /** A block with a map, corresponding to the custom HTML tag \<tg-map>. */
717
+ export interface RichBlockMap {
718
+ /** Type of the block, always “map” */
719
+ type: "map";
720
+ /** Location of the center of the map */
721
+ location: Location;
722
+ /** Map zoom level; 13-20 */
723
+ zoom: 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
724
+ /** Expected width of the map */
725
+ width: number;
726
+ /** Expected height of the map */
727
+ height: number;
728
+ /** Caption of the block */
729
+ caption?: RichBlockCaption;
730
+ }
731
+ /** A block with an animation, corresponding to the HTML tag \<video>. */
732
+ export interface RichBlockAnimation {
733
+ /** Type of the block, always “animation” */
734
+ type: "animation";
735
+ /** The animation */
736
+ animation: Animation;
737
+ /** True, if the media preview is covered by a spoiler animation */
738
+ has_spoiler?: true;
739
+ /** Caption of the block */
740
+ caption?: RichBlockCaption;
741
+ }
742
+ /** A block with a music file, corresponding to the HTML tag \<audio>. */
743
+ export interface RichBlockAudio {
744
+ /** Type of the block, always “audio” */
745
+ type: "audio";
746
+ /** The audio */
747
+ audio: Audio;
748
+ /** Caption of the block */
749
+ caption?: RichBlockCaption;
750
+ }
751
+ /** A block with a photo, corresponding to the HTML tag \<photo>. */
752
+ export interface RichBlockPhoto {
753
+ /** Type of the block, always “photo” */
754
+ type: "photo";
755
+ /** Available sizes of the photo */
756
+ photo: PhotoSize[];
757
+ /** True, if the media preview is covered by a spoiler animation */
758
+ has_spoiler?: true;
759
+ /** Caption of the block */
760
+ caption?: RichBlockCaption;
761
+ }
762
+ /** A block with a video, corresponding to the HTML tag \<video>. */
763
+ export interface RichBlockVideo {
764
+ /** Type of the block, always “video” */
765
+ type: "video";
766
+ /** The video */
767
+ video: Video;
768
+ /** True, if the media preview is covered by a spoiler animation */
769
+ has_spoiler?: true;
770
+ /** Caption of the block */
771
+ caption?: RichBlockCaption;
772
+ }
773
+ /** A block with a voice note, corresponding to the HTML tag \<audio>. */
774
+ export interface RichBlockVoiceNote {
775
+ /** Type of the block, always “voice_note” */
776
+ type: "voice_note";
777
+ /** The voice note */
778
+ voice_note: Voice;
779
+ /** Caption of the block */
780
+ caption?: RichBlockCaption;
781
+ }
782
+ /** A block with a “Thinking…” placeholder, corresponding to the custom HTML tag \<tg-thinking>. The block may be used only in sendRichMessageDraft, therefore it can't be received in messages. See https://t.me/addemoji/AIActions for examples of custom emoji that are recommended for usage in the block. */
783
+ export interface RichBlockThinking {
784
+ /** Type of the block, always “thinking” */
785
+ type: "thinking";
786
+ /** Text of the block. See https://t.me/addemoji/AIActions for examples of custom emoji that are recommended for usage in the block. */
787
+ text: RichText;
788
+ }
789
+ /** An item of a list to be sent. */
790
+ export interface InputRichBlockListItem<F> {
791
+ /** The content of the item */
792
+ blocks: InputRichBlock<F>[];
793
+ /** Pass True if the item has a checkbox */
794
+ has_checkbox?: true;
795
+ /** Pass True if the item has a checked checkbox */
796
+ is_checked?: true;
797
+ /** For ordered lists, the numeric value of the item label */
798
+ value?: number;
799
+ /** For ordered lists, the type of the item label; must be one of “a” for lowercase letters, “A” for uppercase letters, “i” for lowercase Roman numerals, “I” for uppercase Roman numerals, or “1” for decimal numbers */
800
+ type?: "a" | "A" | "i" | "I" | "1";
801
+ }
802
+ /** This object represents a block in a rich formatted message to be sent. Currently, it can be any of the following types:
803
+
804
+ - InputRichBlockParagraph
805
+ - InputRichBlockSectionHeading
806
+ - InputRichBlockPreformatted
807
+ - InputRichBlockFooter
808
+ - InputRichBlockDivider
809
+ - InputRichBlockMathematicalExpression
810
+ - InputRichBlockAnchor
811
+ - InputRichBlockList
812
+ - InputRichBlockBlockQuotation
813
+ - InputRichBlockPullQuotation
814
+ - InputRichBlockCollage
815
+ - InputRichBlockSlideshow
816
+ - InputRichBlockTable
817
+ - InputRichBlockDetails
818
+ - InputRichBlockMap
819
+ - InputRichBlockAnimation
820
+ - InputRichBlockAudio
821
+ - InputRichBlockPhoto
822
+ - InputRichBlockVideo
823
+ - InputRichBlockVoiceNote
824
+ - InputRichBlockThinking */
825
+ export type InputRichBlock<F> = InputRichBlockParagraph | InputRichBlockSectionHeading | InputRichBlockPreformatted | InputRichBlockFooter | InputRichBlockDivider | InputRichBlockMathematicalExpression | InputRichBlockAnchor | InputRichBlockList<F> | InputRichBlockBlockQuotation<F> | InputRichBlockPullQuotation | InputRichBlockCollage<F> | InputRichBlockSlideshow<F> | InputRichBlockTable | InputRichBlockDetails<F> | InputRichBlockMap | InputRichBlockAnimation<F> | InputRichBlockAudio<F> | InputRichBlockPhoto<F> | InputRichBlockVideo<F> | InputRichBlockVoiceNote<F> | InputRichBlockThinking;
826
+ /** A text paragraph, corresponding to the HTML tag \<p>. */
827
+ export interface InputRichBlockParagraph {
828
+ /** Type of the block, always “paragraph” */
829
+ type: "paragraph";
830
+ /** Text of the block */
831
+ text: RichText;
832
+ }
833
+ /** A section heading, corresponding to the HTML tags \<h1>, \<h2>, \<h3>, \<h4>, \<h5>, or \<h6>. */
834
+ export interface InputRichBlockSectionHeading {
835
+ /** Type of the block, always “heading” */
836
+ type: "heading";
837
+ /** Text of the block */
838
+ text: RichText;
839
+ /** Relative size of the text font; 1-6, 1 is the largest, 6 is the smallest */
840
+ size: 1 | 2 | 3 | 4 | 5 | 6;
841
+ }
842
+ /** A preformatted text block, corresponding to the nested HTML tags \<pre> and \<code>. */
843
+ export interface InputRichBlockPreformatted {
844
+ /** Type of the block, always “pre” */
845
+ type: "pre";
846
+ /** Text of the block */
847
+ text: RichText;
848
+ /** The programming language of the text */
849
+ language?: string;
850
+ }
851
+ /** A footer, corresponding to the HTML tag \<footer>. */
852
+ export interface InputRichBlockFooter {
853
+ /** Type of the block, always “footer” */
854
+ type: "footer";
855
+ /** Text of the block */
856
+ text: RichText;
857
+ }
858
+ /** A divider, corresponding to the HTML tag \<hr/>. */
859
+ export interface InputRichBlockDivider {
860
+ /** Type of the block, always “divider” */
861
+ type: "divider";
862
+ }
863
+ /** A block with a mathematical expression in LaTeX format, corresponding to the custom HTML tag \<tg-math-block>. */
864
+ export interface InputRichBlockMathematicalExpression {
865
+ /** Type of the block, always “mathematical_expression” */
866
+ type: "mathematical_expression";
867
+ /** The mathematical expression in LaTeX format */
868
+ expression: string;
869
+ }
870
+ /** A block with an anchor, corresponding to the HTML tag \<a> with the attribute name. */
871
+ export interface InputRichBlockAnchor {
872
+ /** Type of the block, always “anchor” */
873
+ type: "anchor";
874
+ /** The name of the anchor */
875
+ name: string;
876
+ }
877
+ /** A list of blocks, corresponding to the HTML tag \<ul> or \<ol> with multiple nested tags \<li>. */
878
+ export interface InputRichBlockList<F> {
879
+ /** Type of the block, always “list” */
880
+ type: "list";
881
+ /** Items of the list */
882
+ items: InputRichBlockListItem<F>[];
883
+ }
884
+ /** A block quotation, corresponding to the HTML tag \<blockquote>. */
885
+ export interface InputRichBlockBlockQuotation<F> {
886
+ /** Type of the block, always “blockquote” */
887
+ type: "blockquote";
888
+ /** Content of the block */
889
+ blocks: InputRichBlock<F>[];
890
+ /** Credit of the block */
891
+ credit?: RichText;
892
+ }
893
+ /** A quotation with centered text, loosely corresponding to the HTML tag \<aside>. */
894
+ export interface InputRichBlockPullQuotation {
895
+ /** Type of the block, always “pullquote” */
896
+ type: "pullquote";
897
+ /** Text of the block */
898
+ text: RichText;
899
+ /** Credit of the block */
900
+ credit?: RichText;
901
+ }
902
+ /** A collage, corresponding to the custom HTML tag \<tg-collage>. */
903
+ export interface InputRichBlockCollage<F> {
904
+ /** Type of the block, always “collage” */
905
+ type: "collage";
906
+ /** Elements of the collage */
907
+ blocks: InputRichBlock<F>[];
908
+ /** Caption of the block */
909
+ caption?: RichBlockCaption;
910
+ }
911
+ /** A slideshow, corresponding to the custom HTML tag \<tg-slideshow>. */
912
+ export interface InputRichBlockSlideshow<F> {
913
+ /** Type of the block, always “slideshow” */
914
+ type: "slideshow";
915
+ /** Elements of the slideshow */
916
+ blocks: InputRichBlock<F>[];
917
+ /** Caption of the block */
918
+ caption?: RichBlockCaption;
919
+ }
920
+ /** A table, corresponding to the HTML tag \<table>. */
921
+ export interface InputRichBlockTable {
922
+ /** Type of the block, always “table” */
923
+ type: "table";
924
+ /** Cells of the table */
925
+ cells: RichBlockTableCell[][];
926
+ /** Pass True if the table has borders */
927
+ is_bordered?: true;
928
+ /** Pass True if the table is striped */
929
+ is_striped?: true;
930
+ /** Caption of the table */
931
+ caption?: RichText;
932
+ }
933
+ /** An expandable block for details disclosure, corresponding to the HTML tag \<details>. */
934
+ export interface InputRichBlockDetails<F> {
935
+ /** Type of the block, always “details” */
936
+ type: "details";
937
+ /** Always shown summary of the block */
938
+ summary: RichText;
939
+ /** Content of the block */
940
+ blocks: InputRichBlock<F>[];
941
+ /** Pass True if the content of the block is visible by default */
942
+ is_open?: true;
943
+ }
944
+ /** A block with a map, corresponding to the custom HTML tag \<tg-map>. The map's width and height must not exceed 10000 in total. The width and height ratio must be at most 20. */
945
+ export interface InputRichBlockMap {
946
+ /** Type of the block, always “map” */
947
+ type: "map";
948
+ /** Location of the center of the map */
949
+ location: Location;
950
+ /** Map zoom level; 0-24 */
951
+ zoom: number;
952
+ /** Map width; 0-10000 */
953
+ width: number;
954
+ /** Map height; 0-10000 */
955
+ height: number;
956
+ /** Caption of the block */
957
+ caption?: RichBlockCaption;
958
+ }
959
+ /** A block with an animation, corresponding to the HTML tag \<video>. */
960
+ export interface InputRichBlockAnimation<F> {
961
+ /** Type of the block, always “animation” */
962
+ type: "animation";
963
+ /** The animation. Caption is ignored. */
964
+ animation: InputMediaAnimation<F>;
965
+ /** Caption of the block */
966
+ caption?: RichBlockCaption;
967
+ }
968
+ /** A block with a music file, corresponding to the HTML tag \<audio>. */
969
+ export interface InputRichBlockAudio<F> {
970
+ /** Type of the block, always “audio” */
971
+ type: "audio";
972
+ /** The audio. Caption is ignored. */
973
+ audio: InputMediaAudio<F>;
974
+ /** Caption of the block */
975
+ caption?: RichBlockCaption;
976
+ }
977
+ /** A block with a photo, corresponding to the HTML tag \<img>. */
978
+ export interface InputRichBlockPhoto<F> {
979
+ /** Type of the block, always “photo” */
980
+ type: "photo";
981
+ /** The photo. Caption is ignored. */
982
+ photo: InputMediaPhoto<F>;
983
+ /** Caption of the block */
984
+ caption?: RichBlockCaption;
985
+ }
986
+ /** A block with a video, corresponding to the HTML tag \<video>. */
987
+ export interface InputRichBlockVideo<F> {
988
+ /** Type of the block, always “video” */
989
+ type: "video";
990
+ /** The video. Caption is ignored. */
991
+ video: InputMediaVideo<F>;
992
+ /** Caption of the block */
993
+ caption?: RichBlockCaption;
994
+ }
995
+ /** A block with a voice note, corresponding to the HTML tag \<audio>. */
996
+ export interface InputRichBlockVoiceNote<F> {
997
+ /** Type of the block, always “voice_note” */
998
+ type: "voice_note";
999
+ /** The voice note. Caption is ignored. */
1000
+ voice_note: InputMediaVoiceNote<F>;
1001
+ /** Caption of the block */
1002
+ caption?: RichBlockCaption;
1003
+ }
1004
+ /** A block with a “Thinking…” placeholder, corresponding to the custom HTML tag \<tg-thinking>. The block may be used only in sendRichMessageDraft, therefore it can't be received in messages. See https://t.me/addemoji/AIActions for examples of custom emoji that are recommended for usage in the block. */
1005
+ export interface InputRichBlockThinking {
1006
+ /** Type of the block, always “thinking” */
1007
+ type: "thinking";
1008
+ /** Text of the block. See https://t.me/addemoji/AIActions for examples of custom emoji that are recommended for usage in the block. */
1009
+ text: RichText;
1010
+ }
node_modules/@grammyjs/types/settings.d.ts ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { WebAppInfo } from "./markup.js";
2
+ /** This object represents the bot's name. */
3
+ export interface BotName {
4
+ /** The bot's name */
5
+ name: string;
6
+ }
7
+ /** This object represents the bot's description. */
8
+ export interface BotDescription {
9
+ /** The bot's description */
10
+ description: string;
11
+ }
12
+ /** This object represents the bot's short description. */
13
+ export interface BotShortDescription {
14
+ /** The bot's short description */
15
+ short_description: string;
16
+ }
17
+ /** This object describes the bot's menu button in a private chat. It should be one of
18
+ - MenuButtonCommands
19
+ - MenuButtonWebApp
20
+ - MenuButtonDefault
21
+
22
+ If a menu button other than MenuButtonDefault is set for a private chat, then it is applied in the chat. Otherwise the default menu button is applied. By default, the menu button opens the list of bot commands. */
23
+ export type MenuButton = MenuButtonCommands | MenuButtonWebApp | MenuButtonDefault;
24
+ /** Represents a menu button, which opens the bot's list of commands. */
25
+ export interface MenuButtonCommands {
26
+ /** Type of the button, must be commands */
27
+ type: "commands";
28
+ }
29
+ /** Represents a menu button, which launches a Web App. */
30
+ export interface MenuButtonWebApp {
31
+ /** Button type, must be web_app */
32
+ type: "web_app";
33
+ /** Text on the button */
34
+ text: string;
35
+ /** Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Alternatively, a t.me link to a Web App can be specified in the object instead of the Web App's URL, in which case the Web App will be opened as if the user pressed the link. */
36
+ web_app: WebAppInfo;
37
+ }
38
+ /** Describes that no specific value for the menu button was set. */
39
+ export interface MenuButtonDefault {
40
+ /** Type of the button, must be default */
41
+ type: "default";
42
+ }
43
+ /** This object represents the scope to which bot commands are applied. Currently, the following 7 scopes are supported:
44
+ - BotCommandScopeDefault
45
+ - BotCommandScopeAllPrivateChats
46
+ - BotCommandScopeAllGroupChats
47
+ - BotCommandScopeAllChatAdministrators
48
+ - BotCommandScopeChat
49
+ - BotCommandScopeChatAdministrators
50
+ - BotCommandScopeChatMember
51
+
52
+ ## Determining list of commands
53
+
54
+ The following algorithm is used to determine the list of commands for a particular user viewing the bot menu. The first list of commands which is set is returned:
55
+
56
+ ### Commands in the chat with the bot
57
+ - botCommandScopeChat + language_code
58
+ - botCommandScopeChat
59
+ - botCommandScopeAllPrivateChats + language_code
60
+ - botCommandScopeAllPrivateChats
61
+ - botCommandScopeDefault + language_code
62
+ - botCommandScopeDefault
63
+
64
+ ### Commands in group and supergroup chats
65
+ - botCommandScopeChatMember + language_code
66
+ - botCommandScopeChatMember
67
+ - botCommandScopeChatAdministrators + language_code (administrators only)
68
+ - botCommandScopeChatAdministrators (administrators only)
69
+ - botCommandScopeChat + language_code
70
+ - botCommandScopeChat
71
+ - botCommandScopeAllChatAdministrators + language_code (administrators only)
72
+ - botCommandScopeAllChatAdministrators (administrators only)
73
+ - botCommandScopeAllGroupChats + language_code
74
+ - botCommandScopeAllGroupChats
75
+ - botCommandScopeDefault + language_code
76
+ - botCommandScopeDefault */
77
+ export type BotCommandScope = BotCommandScopeDefault | BotCommandScopeAllPrivateChats | BotCommandScopeAllGroupChats | BotCommandScopeAllChatAdministrators | BotCommandScopeChat | BotCommandScopeChatAdministrators | BotCommandScopeChatMember;
78
+ /** Represents the default scope of bot commands. Default commands are used if no commands with a narrower scope are specified for the user. */
79
+ export interface BotCommandScopeDefault {
80
+ /** Scope type, must be default */
81
+ type: "default";
82
+ }
83
+ /** Represents the scope of bot commands, covering all private chats. */
84
+ export interface BotCommandScopeAllPrivateChats {
85
+ /** Scope type, must be all_private_chats */
86
+ type: "all_private_chats";
87
+ }
88
+ /** Represents the scope of bot commands, covering all group and supergroup chats. */
89
+ export interface BotCommandScopeAllGroupChats {
90
+ /** Scope type, must be all_group_chats */
91
+ type: "all_group_chats";
92
+ }
93
+ /** Represents the scope of bot commands, covering all group and supergroup chat administrators. */
94
+ export interface BotCommandScopeAllChatAdministrators {
95
+ /** Scope type, must be all_chat_administrators */
96
+ type: "all_chat_administrators";
97
+ }
98
+ /** Represents the scope of bot commands, covering a specific chat. */
99
+ export interface BotCommandScopeChat {
100
+ /** Scope type, must be chat */
101
+ type: "chat";
102
+ /** Unique identifier for the target chat or username of the target supergroup in the format `@username`. Channel direct messages chats and channel chats aren't supported. */
103
+ chat_id: number | string;
104
+ }
105
+ /** Represents the scope of bot commands, covering all administrators of a specific group or supergroup chat. */
106
+ export interface BotCommandScopeChatAdministrators {
107
+ /** Scope type, must be chat_administrators */
108
+ type: "chat_administrators";
109
+ /** Unique identifier for the target chat or username of the target supergroup in the format `@username`. Channel direct messages chats and channel chats aren't supported. */
110
+ chat_id: number | string;
111
+ }
112
+ /** Represents the scope of bot commands, covering a specific member of a group or supergroup chat. */
113
+ export interface BotCommandScopeChatMember {
114
+ /** Scope type, must be chat_member */
115
+ type: "chat_member";
116
+ /** Unique identifier for the target chat or username of the target supergroup in the format `@username`. Channel direct messages chats and channel chats aren't supported. */
117
+ chat_id: number | string;
118
+ /** Unique identifier of the target user */
119
+ user_id: number;
120
+ }
node_modules/@grammyjs/types/story.d.ts ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { ReactionType } from "./message.js";
2
+ /** Describes the position of a clickable area within a story. */
3
+ export interface StoryAreaPosition {
4
+ /** The abscissa of the area's center, as a percentage of the media width */
5
+ x_percentage: number;
6
+ /** The ordinate of the area's center, as a percentage of the media height */
7
+ y_percentage: number;
8
+ /** The width of the area's rectangle, as a percentage of the media width */
9
+ width_percentage: number;
10
+ /** The height of the area's rectangle, as a percentage of the media height */
11
+ height_percentage: number;
12
+ /** The clockwise rotation angle of the rectangle, in degrees; 0-360 */
13
+ rotation_angle: number;
14
+ /** The radius of the rectangle corner rounding, as a percentage of the media width */
15
+ corner_radius_percentage: number;
16
+ }
17
+ /** Describes the physical address of a location. */
18
+ export interface LocationAddress {
19
+ /** The two-letter ISO 3166-1 alpha-2 country code of the country where the location is located */
20
+ country_code: string;
21
+ /** State of the location */
22
+ state?: string;
23
+ /** City of the location */
24
+ city?: string;
25
+ /** Street address of the location */
26
+ street?: string;
27
+ }
28
+ /** Describes the type of a clickable area on a story. Currently, it can be one of
29
+
30
+ - StoryAreaTypeLocation
31
+ - StoryAreaTypeSuggestedReaction
32
+ - StoryAreaTypeLink
33
+ - StoryAreaTypeWeather
34
+ - StoryAreaTypeUniqueGift */
35
+ export type StoryAreaType = StoryAreaTypeLocation | StoryAreaTypeSuggestedReaction | StoryAreaTypeLink | StoryAreaTypeWeather | StoryAreaTypeUniqueGift;
36
+ /** Describes a story area pointing to a location. Currently, a story can have up to 10 location areas. */
37
+ export interface StoryAreaTypeLocation {
38
+ /** Type of the area, always “location” */
39
+ type: "location";
40
+ /** Location latitude in degrees */
41
+ latitude: number;
42
+ /** Location longitude in degrees */
43
+ longitude: number;
44
+ /** Address of the location */
45
+ address?: LocationAddress;
46
+ }
47
+ /** Describes a story area pointing to a suggested reaction. Currently, a story can have up to 5 suggested reaction areas. */
48
+ export interface StoryAreaTypeSuggestedReaction {
49
+ /** Type of the area, always “suggested_reaction” */
50
+ type: "suggested_reaction";
51
+ /** Type of the reaction */
52
+ reaction_type: ReactionType;
53
+ /** Pass True if the reaction area has a dark background */
54
+ is_dark?: boolean;
55
+ /** Pass True if reaction area corner is flipped */
56
+ is_flipped?: boolean;
57
+ }
58
+ /** Describes a story area pointing to an HTTP or tg:// link. Currently, a story can have up to 3 link areas. */
59
+ export interface StoryAreaTypeLink {
60
+ /** Type of the area, always “link” */
61
+ type: "link";
62
+ /** HTTP or tg:// URL to be opened when the area is clicked */
63
+ url: string;
64
+ }
65
+ /** Describes a story area containing weather information. Currently, a story can have up to 3 weather areas. */
66
+ export interface StoryAreaTypeWeather {
67
+ /** Type of the area, always “weather” */
68
+ type: "weather";
69
+ /** Temperature, in degree Celsius */
70
+ temperature: number;
71
+ /** Emoji representing the weather */
72
+ emoji: string;
73
+ /** A color of the area background in the ARGB format */
74
+ background_color: number;
75
+ }
76
+ /** Describes a story area pointing to a unique gift. Currently, a story can have at most 1 unique gift area. */
77
+ export interface StoryAreaTypeUniqueGift {
78
+ /** Type of the area, always “unique_gift” */
79
+ type: "unique_gift";
80
+ /** Unique name of the gift */
81
+ name: string;
82
+ }
83
+ /** Describes a clickable area on a story media. */
84
+ export interface StoryArea {
85
+ /** Position of the area */
86
+ position: StoryAreaPosition;
87
+ /** Type of the area */
88
+ type: StoryAreaType;
89
+ }
node_modules/@grammyjs/types/update.d.ts ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { ChosenInlineResult, InlineQuery } from "./inline.js";
2
+ import type { BotSubscriptionUpdated, BusinessConnection, BusinessMessagesDeleted, Chat, ChatBoostRemoved, ChatBoostUpdated, ChatJoinRequest, ChatMemberUpdated, ManagedBotUpdated, User } from "./manage.js";
3
+ import type { CallbackQuery } from "./markup.js";
4
+ import type { Message, MessageReactionCountUpdated, MessageReactionUpdated, Poll, PollAnswer } from "./message.js";
5
+ import type { PaidMediaPurchased, PreCheckoutQuery, ShippingQuery } from "./payment.js";
6
+ /** Internal namespace used to make some message types more accurate */
7
+ export declare namespace Update {
8
+ /** Internal type holding properties that message updates in private chats share. */
9
+ interface Private {
10
+ chat: Chat.PrivateChat;
11
+ }
12
+ /** Internal type holding properties that message updates in channels share. */
13
+ interface Channel {
14
+ chat: Chat.ChannelChat;
15
+ }
16
+ /** Internal type holding properties that message updates outside of channels share. */
17
+ interface NonChannel {
18
+ chat: Exclude<Chat, Chat.ChannelChat>;
19
+ from: User;
20
+ }
21
+ /** Internal type holding properties that updates about edited messages share. */
22
+ interface Edited {
23
+ /** Date the message was last edited in Unix time */
24
+ edit_date: number;
25
+ }
26
+ }
27
+ /** This object represents an incoming update.
28
+ At most one of the optional fields can be present in any given update. */
29
+ export interface Update {
30
+ /** The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This identifier becomes especially handy if you're using webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially. */
31
+ update_id: number;
32
+ /** New incoming message of any kind - text, photo, sticker, etc. */
33
+ message?: Message & Update.NonChannel;
34
+ /** New version of a message that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot. */
35
+ edited_message?: Message & Update.Edited & Update.NonChannel;
36
+ /** New incoming channel post of any kind - text, photo, sticker, etc. */
37
+ channel_post?: Message & Update.Channel;
38
+ /** New version of a channel post that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot. */
39
+ edited_channel_post?: Message & Update.Edited & Update.Channel;
40
+ /** The bot was connected to or disconnected from a business account, or a user edited an existing connection with the bot */
41
+ business_connection?: BusinessConnection;
42
+ /** New message from a connected business account */
43
+ business_message?: Message & Update.Private;
44
+ /** New version of a message from a connected business account */
45
+ edited_business_message?: Message & Update.Edited & Update.Private;
46
+ /** Messages were deleted from a connected business account */
47
+ deleted_business_messages?: BusinessMessagesDeleted;
48
+ /** New guest message. The bot can use the field Message.guest_query_id and the method answerGuestQuery to send a message in response. */
49
+ guest_message?: Message & Update.NonChannel;
50
+ /** A reaction to a message was changed by a user. The bot must be an administrator in the chat and must explicitly specify "message_reaction" in the list of allowed_updates to receive these updates. The update isn't received for reactions set by bots. */
51
+ message_reaction?: MessageReactionUpdated;
52
+ /** Reactions to a message with anonymous reactions were changed. The bot must be an administrator in the chat and must explicitly specify "message_reaction_count" in the list of allowed_updates to receive these updates. The updates are grouped and can be sent with delay up to a few minutes. */
53
+ message_reaction_count?: MessageReactionCountUpdated;
54
+ /** New incoming inline query */
55
+ inline_query?: InlineQuery;
56
+ /** The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot. */
57
+ chosen_inline_result?: ChosenInlineResult;
58
+ /** New incoming callback query */
59
+ callback_query?: CallbackQuery;
60
+ /** New incoming shipping query. Only for invoices with flexible price. */
61
+ shipping_query?: ShippingQuery;
62
+ /** New incoming pre-checkout query. Contains full information about checkout. */
63
+ pre_checkout_query?: PreCheckoutQuery;
64
+ /** A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat */
65
+ purchased_paid_media?: PaidMediaPurchased;
66
+ /** New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot. */
67
+ poll?: Poll;
68
+ /** A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself. */
69
+ poll_answer?: PollAnswer;
70
+ /** The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user. */
71
+ my_chat_member?: ChatMemberUpdated;
72
+ /** A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify “chat_member” in the list of allowed_updates to receive these updates. */
73
+ chat_member?: ChatMemberUpdated;
74
+ /** A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates. */
75
+ chat_join_request?: ChatJoinRequest;
76
+ /** A chat boost was added or changed. The bot must be an administrator in the chat to receive these updates. */
77
+ chat_boost?: ChatBoostUpdated;
78
+ /** A boost was removed from a chat. The bot must be an administrator in the chat to receive these updates. */
79
+ removed_chat_boost?: ChatBoostRemoved;
80
+ /** A new bot was created to be managed by the bot, or token or owner of a managed bot was changed */
81
+ managed_bot?: ManagedBotUpdated;
82
+ /** User payment subscription has changed */
83
+ subscription?: BotSubscriptionUpdated;
84
+ }
node_modules/abort-controller/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Toru Nagashima
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
node_modules/abort-controller/README.md ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # abort-controller
2
+
3
+ [![npm version](https://img.shields.io/npm/v/abort-controller.svg)](https://www.npmjs.com/package/abort-controller)
4
+ [![Downloads/month](https://img.shields.io/npm/dm/abort-controller.svg)](http://www.npmtrends.com/abort-controller)
5
+ [![Build Status](https://travis-ci.org/mysticatea/abort-controller.svg?branch=master)](https://travis-ci.org/mysticatea/abort-controller)
6
+ [![Coverage Status](https://codecov.io/gh/mysticatea/abort-controller/branch/master/graph/badge.svg)](https://codecov.io/gh/mysticatea/abort-controller)
7
+ [![Dependency Status](https://david-dm.org/mysticatea/abort-controller.svg)](https://david-dm.org/mysticatea/abort-controller)
8
+
9
+ An implementation of [WHATWG AbortController interface](https://dom.spec.whatwg.org/#interface-abortcontroller).
10
+
11
+ ```js
12
+ import AbortController from "abort-controller"
13
+
14
+ const controller = new AbortController()
15
+ const signal = controller.signal
16
+
17
+ signal.addEventListener("abort", () => {
18
+ console.log("aborted!")
19
+ })
20
+
21
+ controller.abort()
22
+ ```
23
+
24
+ > https://jsfiddle.net/1r2994qp/1/
25
+
26
+ ## 💿 Installation
27
+
28
+ Use [npm](https://www.npmjs.com/) to install then use a bundler.
29
+
30
+ ```
31
+ npm install abort-controller
32
+ ```
33
+
34
+ Or download from [`dist` directory](./dist).
35
+
36
+ - [dist/abort-controller.mjs](dist/abort-controller.mjs) ... ES modules version.
37
+ - [dist/abort-controller.js](dist/abort-controller.js) ... Common JS version.
38
+ - [dist/abort-controller.umd.js](dist/abort-controller.umd.js) ... UMD (Universal Module Definition) version. This is transpiled by [Babel](https://babeljs.io/) for IE 11.
39
+
40
+ ## 📖 Usage
41
+
42
+ ### Basic
43
+
44
+ ```js
45
+ import AbortController from "abort-controller"
46
+ // or
47
+ const AbortController = require("abort-controller")
48
+
49
+ // or UMD version defines a global variable:
50
+ const AbortController = window.AbortControllerShim
51
+ ```
52
+
53
+ If your bundler recognizes `browser` field of `package.json`, the imported `AbortController` is the native one and it doesn't contain shim (even if the native implementation was nothing).
54
+ If you wanted to polyfill `AbortController` for IE, use `abort-controller/polyfill`.
55
+
56
+ ### Polyfilling
57
+
58
+ Importing `abort-controller/polyfill` assigns the `AbortController` shim to the `AbortController` global variable if the native implementation was nothing.
59
+
60
+ ```js
61
+ import "abort-controller/polyfill"
62
+ // or
63
+ require("abort-controller/polyfill")
64
+ ```
65
+
66
+ ### API
67
+
68
+ #### AbortController
69
+
70
+ > https://dom.spec.whatwg.org/#interface-abortcontroller
71
+
72
+ ##### controller.signal
73
+
74
+ The [AbortSignal](https://dom.spec.whatwg.org/#interface-AbortSignal) object which is associated to this controller.
75
+
76
+ ##### controller.abort()
77
+
78
+ Notify `abort` event to listeners that the `signal` has.
79
+
80
+ ## 📰 Changelog
81
+
82
+ - See [GitHub releases](https://github.com/mysticatea/abort-controller/releases).
83
+
84
+ ## 🍻 Contributing
85
+
86
+ Contributing is welcome ❤️
87
+
88
+ Please use GitHub issues/PRs.
89
+
90
+ ### Development tools
91
+
92
+ - `npm install` installs dependencies for development.
93
+ - `npm test` runs tests and measures code coverage.
94
+ - `npm run clean` removes temporary files of tests.
95
+ - `npm run coverage` opens code coverage of the previous test with your default browser.
96
+ - `npm run lint` runs ESLint.
97
+ - `npm run build` generates `dist` codes.
98
+ - `npm run watch` runs tests on each file change.
node_modules/abort-controller/browser.js ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*globals self, window */
2
+ "use strict"
3
+
4
+ /*eslint-disable @mysticatea/prettier */
5
+ const { AbortController, AbortSignal } =
6
+ typeof self !== "undefined" ? self :
7
+ typeof window !== "undefined" ? window :
8
+ /* otherwise */ undefined
9
+ /*eslint-enable @mysticatea/prettier */
10
+
11
+ module.exports = AbortController
12
+ module.exports.AbortSignal = AbortSignal
13
+ module.exports.default = AbortController
node_modules/abort-controller/browser.mjs ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*globals self, window */
2
+
3
+ /*eslint-disable @mysticatea/prettier */
4
+ const { AbortController, AbortSignal } =
5
+ typeof self !== "undefined" ? self :
6
+ typeof window !== "undefined" ? window :
7
+ /* otherwise */ undefined
8
+ /*eslint-enable @mysticatea/prettier */
9
+
10
+ export default AbortController
11
+ export { AbortController, AbortSignal }
node_modules/abort-controller/dist/abort-controller.d.ts ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { EventTarget } from "event-target-shim"
2
+
3
+ type Events = {
4
+ abort: any
5
+ }
6
+ type EventAttributes = {
7
+ onabort: any
8
+ }
9
+ /**
10
+ * The signal class.
11
+ * @see https://dom.spec.whatwg.org/#abortsignal
12
+ */
13
+ declare class AbortSignal extends EventTarget<Events, EventAttributes> {
14
+ /**
15
+ * AbortSignal cannot be constructed directly.
16
+ */
17
+ constructor()
18
+ /**
19
+ * Returns `true` if this `AbortSignal`"s `AbortController` has signaled to abort, and `false` otherwise.
20
+ */
21
+ readonly aborted: boolean
22
+ }
23
+ /**
24
+ * The AbortController.
25
+ * @see https://dom.spec.whatwg.org/#abortcontroller
26
+ */
27
+ declare class AbortController {
28
+ /**
29
+ * Initialize this controller.
30
+ */
31
+ constructor()
32
+ /**
33
+ * Returns the `AbortSignal` object associated with this object.
34
+ */
35
+ readonly signal: AbortSignal
36
+ /**
37
+ * Abort and signal to any observers that the associated activity is to be aborted.
38
+ */
39
+ abort(): void
40
+ }
41
+
42
+ export default AbortController
43
+ export { AbortController, AbortSignal }
node_modules/abort-controller/dist/abort-controller.js ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author Toru Nagashima <https://github.com/mysticatea>
3
+ * See LICENSE file in root directory for full license.
4
+ */
5
+ 'use strict';
6
+
7
+ Object.defineProperty(exports, '__esModule', { value: true });
8
+
9
+ var eventTargetShim = require('event-target-shim');
10
+
11
+ /**
12
+ * The signal class.
13
+ * @see https://dom.spec.whatwg.org/#abortsignal
14
+ */
15
+ class AbortSignal extends eventTargetShim.EventTarget {
16
+ /**
17
+ * AbortSignal cannot be constructed directly.
18
+ */
19
+ constructor() {
20
+ super();
21
+ throw new TypeError("AbortSignal cannot be constructed directly");
22
+ }
23
+ /**
24
+ * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.
25
+ */
26
+ get aborted() {
27
+ const aborted = abortedFlags.get(this);
28
+ if (typeof aborted !== "boolean") {
29
+ throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`);
30
+ }
31
+ return aborted;
32
+ }
33
+ }
34
+ eventTargetShim.defineEventAttribute(AbortSignal.prototype, "abort");
35
+ /**
36
+ * Create an AbortSignal object.
37
+ */
38
+ function createAbortSignal() {
39
+ const signal = Object.create(AbortSignal.prototype);
40
+ eventTargetShim.EventTarget.call(signal);
41
+ abortedFlags.set(signal, false);
42
+ return signal;
43
+ }
44
+ /**
45
+ * Abort a given signal.
46
+ */
47
+ function abortSignal(signal) {
48
+ if (abortedFlags.get(signal) !== false) {
49
+ return;
50
+ }
51
+ abortedFlags.set(signal, true);
52
+ signal.dispatchEvent({ type: "abort" });
53
+ }
54
+ /**
55
+ * Aborted flag for each instances.
56
+ */
57
+ const abortedFlags = new WeakMap();
58
+ // Properties should be enumerable.
59
+ Object.defineProperties(AbortSignal.prototype, {
60
+ aborted: { enumerable: true },
61
+ });
62
+ // `toString()` should return `"[object AbortSignal]"`
63
+ if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
64
+ Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {
65
+ configurable: true,
66
+ value: "AbortSignal",
67
+ });
68
+ }
69
+
70
+ /**
71
+ * The AbortController.
72
+ * @see https://dom.spec.whatwg.org/#abortcontroller
73
+ */
74
+ class AbortController {
75
+ /**
76
+ * Initialize this controller.
77
+ */
78
+ constructor() {
79
+ signals.set(this, createAbortSignal());
80
+ }
81
+ /**
82
+ * Returns the `AbortSignal` object associated with this object.
83
+ */
84
+ get signal() {
85
+ return getSignal(this);
86
+ }
87
+ /**
88
+ * Abort and signal to any observers that the associated activity is to be aborted.
89
+ */
90
+ abort() {
91
+ abortSignal(getSignal(this));
92
+ }
93
+ }
94
+ /**
95
+ * Associated signals.
96
+ */
97
+ const signals = new WeakMap();
98
+ /**
99
+ * Get the associated signal of a given controller.
100
+ */
101
+ function getSignal(controller) {
102
+ const signal = signals.get(controller);
103
+ if (signal == null) {
104
+ throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`);
105
+ }
106
+ return signal;
107
+ }
108
+ // Properties should be enumerable.
109
+ Object.defineProperties(AbortController.prototype, {
110
+ signal: { enumerable: true },
111
+ abort: { enumerable: true },
112
+ });
113
+ if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
114
+ Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {
115
+ configurable: true,
116
+ value: "AbortController",
117
+ });
118
+ }
119
+
120
+ exports.AbortController = AbortController;
121
+ exports.AbortSignal = AbortSignal;
122
+ exports.default = AbortController;
123
+
124
+ module.exports = AbortController
125
+ module.exports.AbortController = module.exports["default"] = AbortController
126
+ module.exports.AbortSignal = AbortSignal
127
+ //# sourceMappingURL=abort-controller.js.map
node_modules/abort-controller/dist/abort-controller.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"abort-controller.js","sources":["../src/abort-signal.ts","../src/abort-controller.ts"],"sourcesContent":["import {\n // Event,\n EventTarget,\n // Type,\n defineEventAttribute,\n} from \"event-target-shim\"\n\n// Known Limitation\n// Use `any` because the type of `AbortSignal` in `lib.dom.d.ts` is wrong and\n// to make assignable our `AbortSignal` into that.\n// https://github.com/Microsoft/TSJS-lib-generator/pull/623\ntype Events = {\n abort: any // Event & Type<\"abort\">\n}\ntype EventAttributes = {\n onabort: any // Event & Type<\"abort\">\n}\n\n/**\n * The signal class.\n * @see https://dom.spec.whatwg.org/#abortsignal\n */\nexport default class AbortSignal extends EventTarget<Events, EventAttributes> {\n /**\n * AbortSignal cannot be constructed directly.\n */\n public constructor() {\n super()\n throw new TypeError(\"AbortSignal cannot be constructed directly\")\n }\n\n /**\n * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.\n */\n public get aborted(): boolean {\n const aborted = abortedFlags.get(this)\n if (typeof aborted !== \"boolean\") {\n throw new TypeError(\n `Expected 'this' to be an 'AbortSignal' object, but got ${\n this === null ? \"null\" : typeof this\n }`,\n )\n }\n return aborted\n }\n}\ndefineEventAttribute(AbortSignal.prototype, \"abort\")\n\n/**\n * Create an AbortSignal object.\n */\nexport function createAbortSignal(): AbortSignal {\n const signal = Object.create(AbortSignal.prototype)\n EventTarget.call(signal)\n abortedFlags.set(signal, false)\n return signal\n}\n\n/**\n * Abort a given signal.\n */\nexport function abortSignal(signal: AbortSignal): void {\n if (abortedFlags.get(signal) !== false) {\n return\n }\n\n abortedFlags.set(signal, true)\n signal.dispatchEvent<\"abort\">({ type: \"abort\" })\n}\n\n/**\n * Aborted flag for each instances.\n */\nconst abortedFlags = new WeakMap<AbortSignal, boolean>()\n\n// Properties should be enumerable.\nObject.defineProperties(AbortSignal.prototype, {\n aborted: { enumerable: true },\n})\n\n// `toString()` should return `\"[object AbortSignal]\"`\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortSignal\",\n })\n}\n","import AbortSignal, { abortSignal, createAbortSignal } from \"./abort-signal\"\n\n/**\n * The AbortController.\n * @see https://dom.spec.whatwg.org/#abortcontroller\n */\nexport default class AbortController {\n /**\n * Initialize this controller.\n */\n public constructor() {\n signals.set(this, createAbortSignal())\n }\n\n /**\n * Returns the `AbortSignal` object associated with this object.\n */\n public get signal(): AbortSignal {\n return getSignal(this)\n }\n\n /**\n * Abort and signal to any observers that the associated activity is to be aborted.\n */\n public abort(): void {\n abortSignal(getSignal(this))\n }\n}\n\n/**\n * Associated signals.\n */\nconst signals = new WeakMap<AbortController, AbortSignal>()\n\n/**\n * Get the associated signal of a given controller.\n */\nfunction getSignal(controller: AbortController): AbortSignal {\n const signal = signals.get(controller)\n if (signal == null) {\n throw new TypeError(\n `Expected 'this' to be an 'AbortController' object, but got ${\n controller === null ? \"null\" : typeof controller\n }`,\n )\n }\n return signal\n}\n\n// Properties should be enumerable.\nObject.defineProperties(AbortController.prototype, {\n signal: { enumerable: true },\n abort: { enumerable: true },\n})\n\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortController\",\n })\n}\n\nexport { AbortController, AbortSignal }\n"],"names":["EventTarget","defineEventAttribute"],"mappings":";;;;;;;;;;AAkBA;;;;AAIA,MAAqB,WAAY,SAAQA,2BAAoC;;;;IAIzE;QACI,KAAK,EAAE,CAAA;QACP,MAAM,IAAI,SAAS,CAAC,4CAA4C,CAAC,CAAA;KACpE;;;;IAKD,IAAW,OAAO;QACd,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACtC,IAAI,OAAO,OAAO,KAAK,SAAS,EAAE;YAC9B,MAAM,IAAI,SAAS,CACf,0DACI,IAAI,KAAK,IAAI,GAAG,MAAM,GAAG,OAAO,IACpC,EAAE,CACL,CAAA;SACJ;QACD,OAAO,OAAO,CAAA;KACjB;CACJ;AACDC,oCAAoB,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;;;;AAKpD,SAAgB,iBAAiB;IAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;IACnDD,2BAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACxB,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IAC/B,OAAO,MAAM,CAAA;CAChB;;;;AAKD,SAAgB,WAAW,CAAC,MAAmB;IAC3C,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,KAAK,EAAE;QACpC,OAAM;KACT;IAED,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC9B,MAAM,CAAC,aAAa,CAAU,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;CACnD;;;;AAKD,MAAM,YAAY,GAAG,IAAI,OAAO,EAAwB,CAAA;;AAGxD,MAAM,CAAC,gB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CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE;QACjE,YAAY,EAAE,IAAI;QAClB,KAAK,EAAE,iBAAiB;KAC3B,CAAC,CAAA;CACL;;;;;;;;;;;;;"}
node_modules/abort-controller/dist/abort-controller.mjs ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author Toru Nagashima <https://github.com/mysticatea>
3
+ * See LICENSE file in root directory for full license.
4
+ */
5
+ import { EventTarget, defineEventAttribute } from 'event-target-shim';
6
+
7
+ /**
8
+ * The signal class.
9
+ * @see https://dom.spec.whatwg.org/#abortsignal
10
+ */
11
+ class AbortSignal extends EventTarget {
12
+ /**
13
+ * AbortSignal cannot be constructed directly.
14
+ */
15
+ constructor() {
16
+ super();
17
+ throw new TypeError("AbortSignal cannot be constructed directly");
18
+ }
19
+ /**
20
+ * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.
21
+ */
22
+ get aborted() {
23
+ const aborted = abortedFlags.get(this);
24
+ if (typeof aborted !== "boolean") {
25
+ throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`);
26
+ }
27
+ return aborted;
28
+ }
29
+ }
30
+ defineEventAttribute(AbortSignal.prototype, "abort");
31
+ /**
32
+ * Create an AbortSignal object.
33
+ */
34
+ function createAbortSignal() {
35
+ const signal = Object.create(AbortSignal.prototype);
36
+ EventTarget.call(signal);
37
+ abortedFlags.set(signal, false);
38
+ return signal;
39
+ }
40
+ /**
41
+ * Abort a given signal.
42
+ */
43
+ function abortSignal(signal) {
44
+ if (abortedFlags.get(signal) !== false) {
45
+ return;
46
+ }
47
+ abortedFlags.set(signal, true);
48
+ signal.dispatchEvent({ type: "abort" });
49
+ }
50
+ /**
51
+ * Aborted flag for each instances.
52
+ */
53
+ const abortedFlags = new WeakMap();
54
+ // Properties should be enumerable.
55
+ Object.defineProperties(AbortSignal.prototype, {
56
+ aborted: { enumerable: true },
57
+ });
58
+ // `toString()` should return `"[object AbortSignal]"`
59
+ if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
60
+ Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {
61
+ configurable: true,
62
+ value: "AbortSignal",
63
+ });
64
+ }
65
+
66
+ /**
67
+ * The AbortController.
68
+ * @see https://dom.spec.whatwg.org/#abortcontroller
69
+ */
70
+ class AbortController {
71
+ /**
72
+ * Initialize this controller.
73
+ */
74
+ constructor() {
75
+ signals.set(this, createAbortSignal());
76
+ }
77
+ /**
78
+ * Returns the `AbortSignal` object associated with this object.
79
+ */
80
+ get signal() {
81
+ return getSignal(this);
82
+ }
83
+ /**
84
+ * Abort and signal to any observers that the associated activity is to be aborted.
85
+ */
86
+ abort() {
87
+ abortSignal(getSignal(this));
88
+ }
89
+ }
90
+ /**
91
+ * Associated signals.
92
+ */
93
+ const signals = new WeakMap();
94
+ /**
95
+ * Get the associated signal of a given controller.
96
+ */
97
+ function getSignal(controller) {
98
+ const signal = signals.get(controller);
99
+ if (signal == null) {
100
+ throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`);
101
+ }
102
+ return signal;
103
+ }
104
+ // Properties should be enumerable.
105
+ Object.defineProperties(AbortController.prototype, {
106
+ signal: { enumerable: true },
107
+ abort: { enumerable: true },
108
+ });
109
+ if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
110
+ Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {
111
+ configurable: true,
112
+ value: "AbortController",
113
+ });
114
+ }
115
+
116
+ export default AbortController;
117
+ export { AbortController, AbortSignal };
118
+ //# sourceMappingURL=abort-controller.mjs.map
node_modules/abort-controller/dist/abort-controller.mjs.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"abort-controller.mjs","sources":["../src/abort-signal.ts","../src/abort-controller.ts"],"sourcesContent":["import {\n // Event,\n EventTarget,\n // Type,\n defineEventAttribute,\n} from \"event-target-shim\"\n\n// Known Limitation\n// Use `any` because the type of `AbortSignal` in `lib.dom.d.ts` is wrong and\n// to make assignable our `AbortSignal` into that.\n// https://github.com/Microsoft/TSJS-lib-generator/pull/623\ntype Events = {\n abort: any // Event & Type<\"abort\">\n}\ntype EventAttributes = {\n onabort: any // Event & Type<\"abort\">\n}\n\n/**\n * The signal class.\n * @see https://dom.spec.whatwg.org/#abortsignal\n */\nexport default class AbortSignal extends EventTarget<Events, EventAttributes> {\n /**\n * AbortSignal cannot be constructed directly.\n */\n public constructor() {\n super()\n throw new TypeError(\"AbortSignal cannot be constructed directly\")\n }\n\n /**\n * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.\n */\n public get aborted(): boolean {\n const aborted = abortedFlags.get(this)\n if (typeof aborted !== \"boolean\") {\n throw new TypeError(\n `Expected 'this' to be an 'AbortSignal' object, but got ${\n this === null ? \"null\" : typeof this\n }`,\n )\n }\n return aborted\n }\n}\ndefineEventAttribute(AbortSignal.prototype, \"abort\")\n\n/**\n * Create an AbortSignal object.\n */\nexport function createAbortSignal(): AbortSignal {\n const signal = Object.create(AbortSignal.prototype)\n EventTarget.call(signal)\n abortedFlags.set(signal, false)\n return signal\n}\n\n/**\n * Abort a given signal.\n */\nexport function abortSignal(signal: AbortSignal): void {\n if (abortedFlags.get(signal) !== false) {\n return\n }\n\n abortedFlags.set(signal, true)\n signal.dispatchEvent<\"abort\">({ type: \"abort\" })\n}\n\n/**\n * Aborted flag for each instances.\n */\nconst abortedFlags = new WeakMap<AbortSignal, boolean>()\n\n// Properties should be enumerable.\nObject.defineProperties(AbortSignal.prototype, {\n aborted: { enumerable: true },\n})\n\n// `toString()` should return `\"[object AbortSignal]\"`\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortSignal\",\n })\n}\n","import AbortSignal, { abortSignal, createAbortSignal } from \"./abort-signal\"\n\n/**\n * The AbortController.\n * @see https://dom.spec.whatwg.org/#abortcontroller\n */\nexport default class AbortController {\n /**\n * Initialize this controller.\n */\n public constructor() {\n signals.set(this, createAbortSignal())\n }\n\n /**\n * Returns the `AbortSignal` object associated with this object.\n */\n public get signal(): AbortSignal {\n return getSignal(this)\n }\n\n /**\n * Abort and signal to any observers that the associated activity is to be aborted.\n */\n public abort(): void {\n abortSignal(getSignal(this))\n }\n}\n\n/**\n * Associated signals.\n */\nconst signals = new WeakMap<AbortController, AbortSignal>()\n\n/**\n * Get the associated signal of a given controller.\n */\nfunction getSignal(controller: AbortController): AbortSignal {\n const signal = signals.get(controller)\n if (signal == null) {\n throw new TypeError(\n `Expected 'this' to be an 'AbortController' object, but got ${\n controller === null ? \"null\" : typeof controller\n }`,\n )\n }\n return signal\n}\n\n// Properties should be enumerable.\nObject.defineProperties(AbortController.prototype, {\n signal: { enumerable: true },\n abort: { enumerable: true },\n})\n\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortController\",\n })\n}\n\nexport { AbortController, AbortSignal }\n"],"names":[],"mappings":";;;;;;AAkBA;;;;AAIA,MAAqB,WAAY,SAAQ,WAAoC;;;;IAIzE;QACI,KAAK,EAAE,CAAA;QACP,MAAM,IAAI,SAAS,CAAC,4CAA4C,CAAC,CAAA;KACpE;;;;IAKD,IAAW,OAAO;QACd,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACtC,IAAI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EAAE,iBAAiB,EAAE,CAAC,CAAA;KACzC;;;;IAKD,IAAW,MAAM;QACb,OAAO,SAAS,CAAC,IAAI,CAAC,CAAA;KACzB;;;;IAKM,KAAK;QACR,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;KAC/B;CACJ;;;;AAKD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAgC,CAAA;;;;AAK3D,SAAS,SAAS,CAAC,UAA2B;IAC1C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IACtC,IAAI,MAAM,IAAI,IAAI,EAAE;QAChB,MAAM,IAAI,SAAS,CACf,8DACI,UAAU,KAAK,IAAI,GAAG,MAAM,GAAG,OAAO,UAC1C,EAAE,CACL,CAAA;KACJ;IACD,OAAO,MAAM,CAAA;CAChB;;AAGD,MAAM,CAAC,gBAAgB,CAAC,eAAe,CAAC,SAAS,EAAE;IAC/C,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;IAC5B,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;CAC9B,CAAC,CAAA;AAEF,IAAI,OAAO,MAAM,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,EAAE;IACxE,MAAM,CAAC,cAAc,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE;QACjE,YAAY,EAAE,IAAI;QAClB,KAAK,EAAE,iBAAiB;KAC3B,CAAC,CAAA;CACL;;;;;"}
node_modules/abort-controller/dist/abort-controller.umd.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ /**
2
+ * @author Toru Nagashima <https://github.com/mysticatea>
3
+ * See LICENSE file in root directory for full license.
4
+ */(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports):"function"==typeof define&&define.amd?define(["exports"],b):(a=a||self,b(a.AbortControllerShim={}))})(this,function(a){'use strict';function b(a){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},b(a)}function c(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function d(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function e(a,b,c){return b&&d(a.prototype,b),c&&d(a,c),a}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),b&&h(a,b)}function g(a){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},g(a)}function h(a,b){return h=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a},h(a,b)}function i(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function j(a,b){return b&&("object"==typeof b||"function"==typeof b)?b:i(a)}function k(a){var b=F.get(a);return console.assert(null!=b,"'this' is expected an Event object, but got",a),b}function l(a){return null==a.passiveListener?void(!a.event.cancelable||(a.canceled=!0,"function"==typeof a.event.preventDefault&&a.event.preventDefault())):void("undefined"!=typeof console&&"function"==typeof console.error&&console.error("Unable to preventDefault inside passive event listener invocation.",a.passiveListener))}function m(a,b){F.set(this,{eventTarget:a,event:b,eventPhase:2,currentTarget:a,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:b.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});for(var c,d=Object.keys(b),e=0;e<d.length;++e)c=d[e],c in this||Object.defineProperty(this,c,n(c))}function n(a){return{get:function(){return k(this).event[a]},set:function(b){k(this).event[a]=b},configurable:!0,enumerable:!0}}function o(a){return{value:function(){var b=k(this).event;return b[a].apply(b,arguments)},configurable:!0,enumerable:!0}}function p(a,b){function c(b,c){a.call(this,b,c)}var d=Object.keys(b);if(0===d.length)return a;c.prototype=Object.create(a.prototype,{constructor:{value:c,configurable:!0,writable:!0}});for(var e,f=0;f<d.length;++f)if(e=d[f],!(e in a.prototype)){var g=Object.getOwnPropertyDescriptor(b,e),h="function"==typeof g.value;Object.defineProperty(c.prototype,e,h?o(e):n(e))}return c}function q(a){if(null==a||a===Object.prototype)return m;var b=G.get(a);return null==b&&(b=p(q(Object.getPrototypeOf(a)),a),G.set(a,b)),b}function r(a,b){var c=q(Object.getPrototypeOf(b));return new c(a,b)}function s(a){return k(a).immediateStopped}function t(a,b){k(a).eventPhase=b}function u(a,b){k(a).currentTarget=b}function v(a,b){k(a).passiveListener=b}function w(a){return null!==a&&"object"===b(a)}function x(a){var b=H.get(a);if(null==b)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return b}function y(a){return{get:function(){for(var b=x(this),c=b.get(a);null!=c;){if(3===c.listenerType)return c.listener;c=c.next}return null},set:function(b){"function"==typeof b||w(b)||(b=null);for(var c=x(this),d=null,e=c.get(a);null!=e;)3===e.listenerType?null===d?null===e.next?c.delete(a):c.set(a,e.next):d.next=e.next:d=e,e=e.next;if(null!==b){var f={listener:b,listenerType:3,passive:!1,once:!1,next:null};null===d?c.set(a,f):d.next=f}},configurable:!0,enumerable:!0}}function z(a,b){Object.defineProperty(a,"on".concat(b),y(b))}function A(a){function b(){B.call(this)}b.prototype=Object.create(B.prototype,{constructor:{value:b,configurable:!0,writable:!0}});for(var c=0;c<a.length;++c)z(b.prototype,a[c]);return b}function B(){if(this instanceof B)return void H.set(this,new Map);if(1===arguments.length&&Array.isArray(arguments[0]))return A(arguments[0]);if(0<arguments.length){for(var a=Array(arguments.length),b=0;b<arguments.length;++b)a[b]=arguments[b];return A(a)}throw new TypeError("Cannot call a class as a function")}function C(){var a=Object.create(K.prototype);return B.call(a),L.set(a,!1),a}function D(a){!1!==L.get(a)||(L.set(a,!0),a.dispatchEvent({type:"abort"}))}function E(a){var c=N.get(a);if(null==c)throw new TypeError("Expected 'this' to be an 'AbortController' object, but got ".concat(null===a?"null":b(a)));return c}var F=new WeakMap,G=new WeakMap;m.prototype={get type(){return k(this).event.type},get target(){return k(this).eventTarget},get currentTarget(){return k(this).currentTarget},composedPath:function(){var a=k(this).currentTarget;return null==a?[]:[a]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return k(this).eventPhase},stopPropagation:function(){var a=k(this);a.stopped=!0,"function"==typeof a.event.stopPropagation&&a.event.stopPropagation()},stopImmediatePropagation:function(){var a=k(this);a.stopped=!0,a.immediateStopped=!0,"function"==typeof a.event.stopImmediatePropagation&&a.event.stopImmediatePropagation()},get bubbles(){return!!k(this).event.bubbles},get cancelable(){return!!k(this).event.cancelable},preventDefault:function(){l(k(this))},get defaultPrevented(){return k(this).canceled},get composed(){return!!k(this).event.composed},get timeStamp(){return k(this).timeStamp},get srcElement(){return k(this).eventTarget},get cancelBubble(){return k(this).stopped},set cancelBubble(a){if(a){var b=k(this);b.stopped=!0,"boolean"==typeof b.event.cancelBubble&&(b.event.cancelBubble=!0)}},get returnValue(){return!k(this).canceled},set returnValue(a){a||l(k(this))},initEvent:function(){}},Object.defineProperty(m.prototype,"constructor",{value:m,configurable:!0,writable:!0}),"undefined"!=typeof window&&"undefined"!=typeof window.Event&&(Object.setPrototypeOf(m.prototype,window.Event.prototype),G.set(window.Event.prototype,m));var H=new WeakMap,I=1,J=2;B.prototype={addEventListener:function(a,b,c){if(null!=b){if("function"!=typeof b&&!w(b))throw new TypeError("'listener' should be a function or an object.");var d=x(this),e=w(c),f=e?!!c.capture:!!c,g=f?I:J,h={listener:b,listenerType:g,passive:e&&!!c.passive,once:e&&!!c.once,next:null},i=d.get(a);if(void 0===i)return void d.set(a,h);for(var j=null;null!=i;){if(i.listener===b&&i.listenerType===g)return;j=i,i=i.next}j.next=h}},removeEventListener:function(a,b,c){if(null!=b)for(var d=x(this),e=w(c)?!!c.capture:!!c,f=e?I:J,g=null,h=d.get(a);null!=h;){if(h.listener===b&&h.listenerType===f)return void(null===g?null===h.next?d.delete(a):d.set(a,h.next):g.next=h.next);g=h,h=h.next}},dispatchEvent:function(a){if(null==a||"string"!=typeof a.type)throw new TypeError("\"event.type\" should be a string.");var b=x(this),c=a.type,d=b.get(c);if(null==d)return!0;for(var e=r(this,a),f=null;null!=d;){if(d.once?null===f?null===d.next?b.delete(c):b.set(c,d.next):f.next=d.next:f=d,v(e,d.passive?d.listener:null),"function"==typeof d.listener)try{d.listener.call(this,e)}catch(a){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(a)}else d.listenerType!==3&&"function"==typeof d.listener.handleEvent&&d.listener.handleEvent(e);if(s(e))break;d=d.next}return v(e,null),t(e,0),u(e,null),!e.defaultPrevented}},Object.defineProperty(B.prototype,"constructor",{value:B,configurable:!0,writable:!0}),"undefined"!=typeof window&&"undefined"!=typeof window.EventTarget&&Object.setPrototypeOf(B.prototype,window.EventTarget.prototype);var K=function(a){function d(){var a;throw c(this,d),a=j(this,g(d).call(this)),new TypeError("AbortSignal cannot be constructed directly")}return f(d,a),e(d,[{key:"aborted",get:function(){var a=L.get(this);if("boolean"!=typeof a)throw new TypeError("Expected 'this' to be an 'AbortSignal' object, but got ".concat(null===this?"null":b(this)));return a}}]),d}(B);z(K.prototype,"abort");var L=new WeakMap;Object.defineProperties(K.prototype,{aborted:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"===b(Symbol.toStringTag)&&Object.defineProperty(K.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});var M=function(){function a(){c(this,a),N.set(this,C())}return e(a,[{key:"abort",value:function(){D(E(this))}},{key:"signal",get:function(){return E(this)}}]),a}(),N=new WeakMap;if(Object.defineProperties(M.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"===b(Symbol.toStringTag)&&Object.defineProperty(M.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"}),a.AbortController=M,a.AbortSignal=K,a.default=M,Object.defineProperty(a,"__esModule",{value:!0}),"undefined"==typeof module&&"undefined"==typeof define){var O=Function("return this")();"undefined"==typeof O.AbortController&&(O.AbortController=M,O.AbortSignal=K)}});
5
+ //# sourceMappingURL=abort-controller.umd.js.map
node_modules/abort-controller/dist/abort-controller.umd.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"abort-controller.umd.js","sources":["../node_modules/event-target-shim/dist/event-target-shim.mjs","../src/abort-signal.ts","../src/abort-controller.ts"],"sourcesContent":["/**\n * @author Toru Nagashima <https://github.com/mysticatea>\n * @copyright 2015 Toru Nagashima. All rights reserved.\n * See LICENSE file in root directory for full license.\n */\n/**\n * @typedef {object} PrivateData\n * @property {EventTarget} eventTarget The event target.\n * @property {{type:string}} event The original event object.\n * @property {number} eventPhase The current event phase.\n * @property {EventTarget|null} currentTarget The current event target.\n * @property {boolean} canceled The flag to prevent default.\n * @property {boolean} stopped The flag to stop propagation.\n * @property {boolean} immediateStopped The flag to stop propagation immediately.\n * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.\n * @property {number} timeStamp The unix time.\n * @private\n */\n\n/**\n * Private data for event wrappers.\n * @type {WeakMap<Event, PrivateData>}\n * @private\n */\nconst privateData = new WeakMap();\n\n/**\n * Cache for wrapper classes.\n * @type {WeakMap<Object, Function>}\n * @private\n */\nconst wrappers = new WeakMap();\n\n/**\n * Get private data.\n * @param {Event} event The event object to get private data.\n * @returns {PrivateData} The private data of the event.\n * @private\n */\nfunction pd(event) {\n const retv = privateData.get(event);\n console.assert(\n retv != null,\n \"'this' is expected an Event object, but got\",\n event\n );\n return retv\n}\n\n/**\n * https://dom.spec.whatwg.org/#set-the-canceled-flag\n * @param data {PrivateData} private data.\n */\nfunction setCancelFlag(data) {\n if (data.passiveListener != null) {\n if (\n typeof console !== \"undefined\" &&\n typeof console.error === \"function\"\n ) {\n console.error(\n \"Unable to preventDefault inside passive event listener invocation.\",\n data.passiveListener\n );\n }\n return\n }\n if (!data.event.cancelable) {\n return\n }\n\n data.canceled = true;\n if (typeof data.event.preventDefault === \"function\") {\n data.event.preventDefault();\n }\n}\n\n/**\n * @see https://dom.spec.whatwg.org/#interface-event\n * @private\n */\n/**\n * The event wrapper.\n * @constructor\n * @param {EventTarget} eventTarget The event target of this dispatching.\n * @param {Event|{type:string}} event The original event to wrap.\n */\nfunction Event(eventTarget, event) {\n privateData.set(this, {\n eventTarget,\n event,\n eventPhase: 2,\n currentTarget: eventTarget,\n canceled: false,\n stopped: false,\n immediateStopped: false,\n passiveListener: null,\n timeStamp: event.timeStamp || Date.now(),\n });\n\n // https://heycam.github.io/webidl/#Unforgeable\n Object.defineProperty(this, \"isTrusted\", { value: false, enumerable: true });\n\n // Define accessors\n const keys = Object.keys(event);\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i];\n if (!(key in this)) {\n Object.defineProperty(this, key, defineRedirectDescriptor(key));\n }\n }\n}\n\n// Should be enumerable, but class methods are not enumerable.\nEvent.prototype = {\n /**\n * The type of this event.\n * @type {string}\n */\n get type() {\n return pd(this).event.type\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get target() {\n return pd(this).eventTarget\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get currentTarget() {\n return pd(this).currentTarget\n },\n\n /**\n * @returns {EventTarget[]} The composed path of this event.\n */\n composedPath() {\n const currentTarget = pd(this).currentTarget;\n if (currentTarget == null) {\n return []\n }\n return [currentTarget]\n },\n\n /**\n * Constant of NONE.\n * @type {number}\n */\n get NONE() {\n return 0\n },\n\n /**\n * Constant of CAPTURING_PHASE.\n * @type {number}\n */\n get CAPTURING_PHASE() {\n return 1\n },\n\n /**\n * Constant of AT_TARGET.\n * @type {number}\n */\n get AT_TARGET() {\n return 2\n },\n\n /**\n * Constant of BUBBLING_PHASE.\n * @type {number}\n */\n get BUBBLING_PHASE() {\n return 3\n },\n\n /**\n * The target of this event.\n * @type {number}\n */\n get eventPhase() {\n return pd(this).eventPhase\n },\n\n /**\n * Stop event bubbling.\n * @returns {void}\n */\n stopPropagation() {\n const data = pd(this);\n\n data.stopped = true;\n if (typeof data.event.stopPropagation === \"function\") {\n data.event.stopPropagation();\n }\n },\n\n /**\n * Stop event bubbling.\n * @returns {void}\n */\n stopImmediatePropagation() {\n const data = pd(this);\n\n data.stopped = true;\n data.immediateStopped = true;\n if (typeof data.event.stopImmediatePropagation === \"function\") {\n data.event.stopImmediatePropagation();\n }\n },\n\n /**\n * The flag to be bubbling.\n * @type {boolean}\n */\n get bubbles() {\n return Boolean(pd(this).event.bubbles)\n },\n\n /**\n * The flag to be cancelable.\n * @type {boolean}\n */\n get cancelable() {\n return Boolean(pd(this).event.cancelable)\n },\n\n /**\n * Cancel this event.\n * @returns {void}\n */\n preventDefault() {\n setCancelFlag(pd(this));\n },\n\n /**\n * The flag to indicate cancellation state.\n * @type {boolean}\n */\n get defaultPrevented() {\n return pd(this).canceled\n },\n\n /**\n * The flag to be composed.\n * @type {boolean}\n */\n get composed() {\n return Boolean(pd(this).event.composed)\n },\n\n /**\n * The unix time of this event.\n * @type {number}\n */\n get timeStamp() {\n return pd(this).timeStamp\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n * @deprecated\n */\n get srcElement() {\n return pd(this).eventTarget\n },\n\n /**\n * The flag to stop event bubbling.\n * @type {boolean}\n * @deprecated\n */\n get cancelBubble() {\n return pd(this).stopped\n },\n set cancelBubble(value) {\n if (!value) {\n return\n }\n const data = pd(this);\n\n data.stopped = true;\n if (typeof data.event.cancelBubble === \"boolean\") {\n data.event.cancelBubble = true;\n }\n },\n\n /**\n * The flag to indicate cancellation state.\n * @type {boolean}\n * @deprecated\n */\n get returnValue() {\n return !pd(this).canceled\n },\n set returnValue(value) {\n if (!value) {\n setCancelFlag(pd(this));\n }\n },\n\n /**\n * Initialize this event object. But do nothing under event dispatching.\n * @param {string} type The event type.\n * @param {boolean} [bubbles=false] The flag to be possible to bubble up.\n * @param {boolean} [cancelable=false] The flag to be possible to cancel.\n * @deprecated\n */\n initEvent() {\n // Do nothing.\n },\n};\n\n// `constructor` is not enumerable.\nObject.defineProperty(Event.prototype, \"constructor\", {\n value: Event,\n configurable: true,\n writable: true,\n});\n\n// Ensure `event instanceof window.Event` is `true`.\nif (typeof window !== \"undefined\" && typeof window.Event !== \"undefined\") {\n Object.setPrototypeOf(Event.prototype, window.Event.prototype);\n\n // Make association for wrappers.\n wrappers.set(window.Event.prototype, Event);\n}\n\n/**\n * Get the property descriptor to redirect a given property.\n * @param {string} key Property name to define property descriptor.\n * @returns {PropertyDescriptor} The property descriptor to redirect the property.\n * @private\n */\nfunction defineRedirectDescriptor(key) {\n return {\n get() {\n return pd(this).event[key]\n },\n set(value) {\n pd(this).event[key] = value;\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Get the property descriptor to call a given method property.\n * @param {string} key Property name to define property descriptor.\n * @returns {PropertyDescriptor} The property descriptor to call the method property.\n * @private\n */\nfunction defineCallDescriptor(key) {\n return {\n value() {\n const event = pd(this).event;\n return event[key].apply(event, arguments)\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Define new wrapper class.\n * @param {Function} BaseEvent The base wrapper class.\n * @param {Object} proto The prototype of the original event.\n * @returns {Function} The defined wrapper class.\n * @private\n */\nfunction defineWrapper(BaseEvent, proto) {\n const keys = Object.keys(proto);\n if (keys.length === 0) {\n return BaseEvent\n }\n\n /** CustomEvent */\n function CustomEvent(eventTarget, event) {\n BaseEvent.call(this, eventTarget, event);\n }\n\n CustomEvent.prototype = Object.create(BaseEvent.prototype, {\n constructor: { value: CustomEvent, configurable: true, writable: true },\n });\n\n // Define accessors.\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i];\n if (!(key in BaseEvent.prototype)) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, key);\n const isFunc = typeof descriptor.value === \"function\";\n Object.defineProperty(\n CustomEvent.prototype,\n key,\n isFunc\n ? defineCallDescriptor(key)\n : defineRedirectDescriptor(key)\n );\n }\n }\n\n return CustomEvent\n}\n\n/**\n * Get the wrapper class of a given prototype.\n * @param {Object} proto The prototype of the original event to get its wrapper.\n * @returns {Function} The wrapper class.\n * @private\n */\nfunction getWrapper(proto) {\n if (proto == null || proto === Object.prototype) {\n return Event\n }\n\n let wrapper = wrappers.get(proto);\n if (wrapper == null) {\n wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto);\n wrappers.set(proto, wrapper);\n }\n return wrapper\n}\n\n/**\n * Wrap a given event to management a dispatching.\n * @param {EventTarget} eventTarget The event target of this dispatching.\n * @param {Object} event The event to wrap.\n * @returns {Event} The wrapper instance.\n * @private\n */\nfunction wrapEvent(eventTarget, event) {\n const Wrapper = getWrapper(Object.getPrototypeOf(event));\n return new Wrapper(eventTarget, event)\n}\n\n/**\n * Get the immediateStopped flag of a given event.\n * @param {Event} event The event to get.\n * @returns {boolean} The flag to stop propagation immediately.\n * @private\n */\nfunction isStopped(event) {\n return pd(event).immediateStopped\n}\n\n/**\n * Set the current event phase of a given event.\n * @param {Event} event The event to set current target.\n * @param {number} eventPhase New event phase.\n * @returns {void}\n * @private\n */\nfunction setEventPhase(event, eventPhase) {\n pd(event).eventPhase = eventPhase;\n}\n\n/**\n * Set the current target of a given event.\n * @param {Event} event The event to set current target.\n * @param {EventTarget|null} currentTarget New current target.\n * @returns {void}\n * @private\n */\nfunction setCurrentTarget(event, currentTarget) {\n pd(event).currentTarget = currentTarget;\n}\n\n/**\n * Set a passive listener of a given event.\n * @param {Event} event The event to set current target.\n * @param {Function|null} passiveListener New passive listener.\n * @returns {void}\n * @private\n */\nfunction setPassiveListener(event, passiveListener) {\n pd(event).passiveListener = passiveListener;\n}\n\n/**\n * @typedef {object} ListenerNode\n * @property {Function} listener\n * @property {1|2|3} listenerType\n * @property {boolean} passive\n * @property {boolean} once\n * @property {ListenerNode|null} next\n * @private\n */\n\n/**\n * @type {WeakMap<object, Map<string, ListenerNode>>}\n * @private\n */\nconst listenersMap = new WeakMap();\n\n// Listener types\nconst CAPTURE = 1;\nconst BUBBLE = 2;\nconst ATTRIBUTE = 3;\n\n/**\n * Check whether a given value is an object or not.\n * @param {any} x The value to check.\n * @returns {boolean} `true` if the value is an object.\n */\nfunction isObject(x) {\n return x !== null && typeof x === \"object\" //eslint-disable-line no-restricted-syntax\n}\n\n/**\n * Get listeners.\n * @param {EventTarget} eventTarget The event target to get.\n * @returns {Map<string, ListenerNode>} The listeners.\n * @private\n */\nfunction getListeners(eventTarget) {\n const listeners = listenersMap.get(eventTarget);\n if (listeners == null) {\n throw new TypeError(\n \"'this' is expected an EventTarget object, but got another value.\"\n )\n }\n return listeners\n}\n\n/**\n * Get the property descriptor for the event attribute of a given event.\n * @param {string} eventName The event name to get property descriptor.\n * @returns {PropertyDescriptor} The property descriptor.\n * @private\n */\nfunction defineEventAttributeDescriptor(eventName) {\n return {\n get() {\n const listeners = getListeners(this);\n let node = listeners.get(eventName);\n while (node != null) {\n if (node.listenerType === ATTRIBUTE) {\n return node.listener\n }\n node = node.next;\n }\n return null\n },\n\n set(listener) {\n if (typeof listener !== \"function\" && !isObject(listener)) {\n listener = null; // eslint-disable-line no-param-reassign\n }\n const listeners = getListeners(this);\n\n // Traverse to the tail while removing old value.\n let prev = null;\n let node = listeners.get(eventName);\n while (node != null) {\n if (node.listenerType === ATTRIBUTE) {\n // Remove old value.\n if (prev !== null) {\n prev.next = node.next;\n } else if (node.next !== null) {\n listeners.set(eventName, node.next);\n } else {\n listeners.delete(eventName);\n }\n } else {\n prev = node;\n }\n\n node = node.next;\n }\n\n // Add new value.\n if (listener !== null) {\n const newNode = {\n listener,\n listenerType: ATTRIBUTE,\n passive: false,\n once: false,\n next: null,\n };\n if (prev === null) {\n listeners.set(eventName, newNode);\n } else {\n prev.next = newNode;\n }\n }\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Define an event attribute (e.g. `eventTarget.onclick`).\n * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.\n * @param {string} eventName The event name to define.\n * @returns {void}\n */\nfunction defineEventAttribute(eventTargetPrototype, eventName) {\n Object.defineProperty(\n eventTargetPrototype,\n `on${eventName}`,\n defineEventAttributeDescriptor(eventName)\n );\n}\n\n/**\n * Define a custom EventTarget with event attributes.\n * @param {string[]} eventNames Event names for event attributes.\n * @returns {EventTarget} The custom EventTarget.\n * @private\n */\nfunction defineCustomEventTarget(eventNames) {\n /** CustomEventTarget */\n function CustomEventTarget() {\n EventTarget.call(this);\n }\n\n CustomEventTarget.prototype = Object.create(EventTarget.prototype, {\n constructor: {\n value: CustomEventTarget,\n configurable: true,\n writable: true,\n },\n });\n\n for (let i = 0; i < eventNames.length; ++i) {\n defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);\n }\n\n return CustomEventTarget\n}\n\n/**\n * EventTarget.\n *\n * - This is constructor if no arguments.\n * - This is a function which returns a CustomEventTarget constructor if there are arguments.\n *\n * For example:\n *\n * class A extends EventTarget {}\n * class B extends EventTarget(\"message\") {}\n * class C extends EventTarget(\"message\", \"error\") {}\n * class D extends EventTarget([\"message\", \"error\"]) {}\n */\nfunction EventTarget() {\n /*eslint-disable consistent-return */\n if (this instanceof EventTarget) {\n listenersMap.set(this, new Map());\n return\n }\n if (arguments.length === 1 && Array.isArray(arguments[0])) {\n return defineCustomEventTarget(arguments[0])\n }\n if (arguments.length > 0) {\n const types = new Array(arguments.length);\n for (let i = 0; i < arguments.length; ++i) {\n types[i] = arguments[i];\n }\n return defineCustomEventTarget(types)\n }\n throw new TypeError(\"Cannot call a class as a function\")\n /*eslint-enable consistent-return */\n}\n\n// Should be enumerable, but class methods are not enumerable.\nEventTarget.prototype = {\n /**\n * Add a given listener to this event target.\n * @param {string} eventName The event name to add.\n * @param {Function} listener The listener to add.\n * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.\n * @returns {void}\n */\n addEventListener(eventName, listener, options) {\n if (listener == null) {\n return\n }\n if (typeof listener !== \"function\" && !isObject(listener)) {\n throw new TypeError(\"'listener' should be a function or an object.\")\n }\n\n const listeners = getListeners(this);\n const optionsIsObj = isObject(options);\n const capture = optionsIsObj\n ? Boolean(options.capture)\n : Boolean(options);\n const listenerType = capture ? CAPTURE : BUBBLE;\n const newNode = {\n listener,\n listenerType,\n passive: optionsIsObj && Boolean(options.passive),\n once: optionsIsObj && Boolean(options.once),\n next: null,\n };\n\n // Set it as the first node if the first node is null.\n let node = listeners.get(eventName);\n if (node === undefined) {\n listeners.set(eventName, newNode);\n return\n }\n\n // Traverse to the tail while checking duplication..\n let prev = null;\n while (node != null) {\n if (\n node.listener === listener &&\n node.listenerType === listenerType\n ) {\n // Should ignore duplication.\n return\n }\n prev = node;\n node = node.next;\n }\n\n // Add it.\n prev.next = newNode;\n },\n\n /**\n * Remove a given listener from this event target.\n * @param {string} eventName The event name to remove.\n * @param {Function} listener The listener to remove.\n * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.\n * @returns {void}\n */\n removeEventListener(eventName, listener, options) {\n if (listener == null) {\n return\n }\n\n const listeners = getListeners(this);\n const capture = isObject(options)\n ? Boolean(options.capture)\n : Boolean(options);\n const listenerType = capture ? CAPTURE : BUBBLE;\n\n let prev = null;\n let node = listeners.get(eventName);\n while (node != null) {\n if (\n node.listener === listener &&\n node.listenerType === listenerType\n ) {\n if (prev !== null) {\n prev.next = node.next;\n } else if (node.next !== null) {\n listeners.set(eventName, node.next);\n } else {\n listeners.delete(eventName);\n }\n return\n }\n\n prev = node;\n node = node.next;\n }\n },\n\n /**\n * Dispatch a given event.\n * @param {Event|{type:string}} event The event to dispatch.\n * @returns {boolean} `false` if canceled.\n */\n dispatchEvent(event) {\n if (event == null || typeof event.type !== \"string\") {\n throw new TypeError('\"event.type\" should be a string.')\n }\n\n // If listeners aren't registered, terminate.\n const listeners = getListeners(this);\n const eventName = event.type;\n let node = listeners.get(eventName);\n if (node == null) {\n return true\n }\n\n // Since we cannot rewrite several properties, so wrap object.\n const wrappedEvent = wrapEvent(this, event);\n\n // This doesn't process capturing phase and bubbling phase.\n // This isn't participating in a tree.\n let prev = null;\n while (node != null) {\n // Remove this listener if it's once\n if (node.once) {\n if (prev !== null) {\n prev.next = node.next;\n } else if (node.next !== null) {\n listeners.set(eventName, node.next);\n } else {\n listeners.delete(eventName);\n }\n } else {\n prev = node;\n }\n\n // Call this listener\n setPassiveListener(\n wrappedEvent,\n node.passive ? node.listener : null\n );\n if (typeof node.listener === \"function\") {\n try {\n node.listener.call(this, wrappedEvent);\n } catch (err) {\n if (\n typeof console !== \"undefined\" &&\n typeof console.error === \"function\"\n ) {\n console.error(err);\n }\n }\n } else if (\n node.listenerType !== ATTRIBUTE &&\n typeof node.listener.handleEvent === \"function\"\n ) {\n node.listener.handleEvent(wrappedEvent);\n }\n\n // Break if `event.stopImmediatePropagation` was called.\n if (isStopped(wrappedEvent)) {\n break\n }\n\n node = node.next;\n }\n setPassiveListener(wrappedEvent, null);\n setEventPhase(wrappedEvent, 0);\n setCurrentTarget(wrappedEvent, null);\n\n return !wrappedEvent.defaultPrevented\n },\n};\n\n// `constructor` is not enumerable.\nObject.defineProperty(EventTarget.prototype, \"constructor\", {\n value: EventTarget,\n configurable: true,\n writable: true,\n});\n\n// Ensure `eventTarget instanceof window.EventTarget` is `true`.\nif (\n typeof window !== \"undefined\" &&\n typeof window.EventTarget !== \"undefined\"\n) {\n Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype);\n}\n\nexport default EventTarget;\nexport { defineEventAttribute, EventTarget };\n//# sourceMappingURL=event-target-shim.mjs.map\n","import {\n // Event,\n EventTarget,\n // Type,\n defineEventAttribute,\n} from \"event-target-shim\"\n\n// Known Limitation\n// Use `any` because the type of `AbortSignal` in `lib.dom.d.ts` is wrong and\n// to make assignable our `AbortSignal` into that.\n// https://github.com/Microsoft/TSJS-lib-generator/pull/623\ntype Events = {\n abort: any // Event & Type<\"abort\">\n}\ntype EventAttributes = {\n onabort: any // Event & Type<\"abort\">\n}\n\n/**\n * The signal class.\n * @see https://dom.spec.whatwg.org/#abortsignal\n */\nexport default class AbortSignal extends EventTarget<Events, EventAttributes> {\n /**\n * AbortSignal cannot be constructed directly.\n */\n public constructor() {\n super()\n throw new TypeError(\"AbortSignal cannot be constructed directly\")\n }\n\n /**\n * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise.\n */\n public get aborted(): boolean {\n const aborted = abortedFlags.get(this)\n if (typeof aborted !== \"boolean\") {\n throw new TypeError(\n `Expected 'this' to be an 'AbortSignal' object, but got ${\n this === null ? \"null\" : typeof this\n }`,\n )\n }\n return aborted\n }\n}\ndefineEventAttribute(AbortSignal.prototype, \"abort\")\n\n/**\n * Create an AbortSignal object.\n */\nexport function createAbortSignal(): AbortSignal {\n const signal = Object.create(AbortSignal.prototype)\n EventTarget.call(signal)\n abortedFlags.set(signal, false)\n return signal\n}\n\n/**\n * Abort a given signal.\n */\nexport function abortSignal(signal: AbortSignal): void {\n if (abortedFlags.get(signal) !== false) {\n return\n }\n\n abortedFlags.set(signal, true)\n signal.dispatchEvent<\"abort\">({ type: \"abort\" })\n}\n\n/**\n * Aborted flag for each instances.\n */\nconst abortedFlags = new WeakMap<AbortSignal, boolean>()\n\n// Properties should be enumerable.\nObject.defineProperties(AbortSignal.prototype, {\n aborted: { enumerable: true },\n})\n\n// `toString()` should return `\"[object AbortSignal]\"`\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortSignal\",\n })\n}\n","import AbortSignal, { abortSignal, createAbortSignal } from \"./abort-signal\"\n\n/**\n * The AbortController.\n * @see https://dom.spec.whatwg.org/#abortcontroller\n */\nexport default class AbortController {\n /**\n * Initialize this controller.\n */\n public constructor() {\n signals.set(this, createAbortSignal())\n }\n\n /**\n * Returns the `AbortSignal` object associated with this object.\n */\n public get signal(): AbortSignal {\n return getSignal(this)\n }\n\n /**\n * Abort and signal to any observers that the associated activity is to be aborted.\n */\n public abort(): void {\n abortSignal(getSignal(this))\n }\n}\n\n/**\n * Associated signals.\n */\nconst signals = new WeakMap<AbortController, AbortSignal>()\n\n/**\n * Get the associated signal of a given controller.\n */\nfunction getSignal(controller: AbortController): AbortSignal {\n const signal = signals.get(controller)\n if (signal == null) {\n throw new TypeError(\n `Expected 'this' to be an 'AbortController' object, but got ${\n controller === null ? \"null\" : typeof controller\n }`,\n )\n }\n return signal\n}\n\n// Properties should be enumerable.\nObject.defineProperties(AbortController.prototype, {\n signal: { enumerable: true },\n abort: { enumerable: true },\n})\n\nif (typeof Symbol === \"function\" && typeof Symbol.toStringTag === \"symbol\") {\n Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {\n configurable: true,\n value: \"AbortController\",\n })\n}\n\nexport { AbortController, AbortSignal }\n"],"names":["pd","event","retv","privateData","get","console","assert","setCancelFlag","data","passiveListener","cancelable","canceled","preventDefault","error","Event","eventTarget","set","eventPhase","currentTarget","stopped","immediateStopped","timeStamp","Date","now","Object","defineProperty","value","enumerable","key","keys","i","length","defineRedirectDescriptor","configurable","defineCallDescriptor","apply","arguments","defineWrapper","BaseEvent","proto","CustomEvent","call","prototype","create","constructor","writable","descriptor","getOwnPropertyDescriptor","isFunc","getWrapper","wrapper","wrappers","getPrototypeOf","wrapEvent","Wrapper","isStopped","setEventPhase","setCurrentTarget","setPassiveListener","createAbortSignal","signal","AbortSignal","EventTarget","abortedFlags","abortSignal","dispatchEvent","type","getSignal","controller","signals","TypeError","WeakMap","target","composedPath","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","stopPropagation","stopImmediatePropagation","bubbles","defaultPrevented","composed","srcElement","cancelBubble","returnValue","initEvent","window","setPrototypeOf","aborted","defineEventAttribute","defineProperties","Symbol","_typeof","toStringTag","AbortController","abort"],"mappings":";;;+3CAkCA,QAASA,CAAAA,CAAT,CAAYC,CAAZ,CAAmB,IACTC,CAAAA,CAAI,CAAGC,CAAW,CAACC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,KAAK,CAAE,iBAF0D,CAArEF"}
node_modules/abort-controller/package.json ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "abort-controller",
3
+ "version": "3.0.0",
4
+ "description": "An implementation of WHATWG AbortController interface.",
5
+ "main": "dist/abort-controller",
6
+ "files": [
7
+ "dist",
8
+ "polyfill.*",
9
+ "browser.*"
10
+ ],
11
+ "engines": {
12
+ "node": ">=6.5"
13
+ },
14
+ "dependencies": {
15
+ "event-target-shim": "^5.0.0"
16
+ },
17
+ "browser": "./browser.js",
18
+ "devDependencies": {
19
+ "@babel/core": "^7.2.2",
20
+ "@babel/plugin-transform-modules-commonjs": "^7.2.0",
21
+ "@babel/preset-env": "^7.3.0",
22
+ "@babel/register": "^7.0.0",
23
+ "@mysticatea/eslint-plugin": "^8.0.1",
24
+ "@mysticatea/spy": "^0.1.2",
25
+ "@types/mocha": "^5.2.5",
26
+ "@types/node": "^10.12.18",
27
+ "assert": "^1.4.1",
28
+ "codecov": "^3.1.0",
29
+ "dts-bundle-generator": "^2.0.0",
30
+ "eslint": "^5.12.1",
31
+ "karma": "^3.1.4",
32
+ "karma-chrome-launcher": "^2.2.0",
33
+ "karma-coverage": "^1.1.2",
34
+ "karma-firefox-launcher": "^1.1.0",
35
+ "karma-growl-reporter": "^1.0.0",
36
+ "karma-ie-launcher": "^1.0.0",
37
+ "karma-mocha": "^1.3.0",
38
+ "karma-rollup-preprocessor": "^7.0.0-rc.2",
39
+ "mocha": "^5.2.0",
40
+ "npm-run-all": "^4.1.5",
41
+ "nyc": "^13.1.0",
42
+ "opener": "^1.5.1",
43
+ "rimraf": "^2.6.3",
44
+ "rollup": "^1.1.2",
45
+ "rollup-plugin-babel": "^4.3.2",
46
+ "rollup-plugin-babel-minify": "^7.0.0",
47
+ "rollup-plugin-commonjs": "^9.2.0",
48
+ "rollup-plugin-node-resolve": "^4.0.0",
49
+ "rollup-plugin-sourcemaps": "^0.4.2",
50
+ "rollup-plugin-typescript": "^1.0.0",
51
+ "rollup-watch": "^4.3.1",
52
+ "ts-node": "^8.0.1",
53
+ "type-tester": "^1.0.0",
54
+ "typescript": "^3.2.4"
55
+ },
56
+ "scripts": {
57
+ "preversion": "npm test",
58
+ "version": "npm run -s build && git add dist/*",
59
+ "postversion": "git push && git push --tags",
60
+ "clean": "rimraf .nyc_output coverage",
61
+ "coverage": "opener coverage/lcov-report/index.html",
62
+ "lint": "eslint . --ext .ts",
63
+ "build": "run-s -s build:*",
64
+ "build:rollup": "rollup -c",
65
+ "build:dts": "dts-bundle-generator -o dist/abort-controller.d.ts src/abort-controller.ts && ts-node scripts/fix-dts",
66
+ "test": "run-s -s lint test:*",
67
+ "test:mocha": "nyc mocha test/*.ts",
68
+ "test:karma": "karma start --single-run",
69
+ "watch": "run-p -s watch:*",
70
+ "watch:mocha": "mocha test/*.ts --require ts-node/register --watch-extensions ts --watch --growl",
71
+ "watch:karma": "karma start --watch",
72
+ "codecov": "codecov"
73
+ },
74
+ "repository": {
75
+ "type": "git",
76
+ "url": "git+https://github.com/mysticatea/abort-controller.git"
77
+ },
78
+ "keywords": [
79
+ "w3c",
80
+ "whatwg",
81
+ "event",
82
+ "events",
83
+ "abort",
84
+ "cancel",
85
+ "abortcontroller",
86
+ "abortsignal",
87
+ "controller",
88
+ "signal",
89
+ "shim"
90
+ ],
91
+ "author": "Toru Nagashima (https://github.com/mysticatea)",
92
+ "license": "MIT",
93
+ "bugs": {
94
+ "url": "https://github.com/mysticatea/abort-controller/issues"
95
+ },
96
+ "homepage": "https://github.com/mysticatea/abort-controller#readme"
97
+ }
node_modules/abort-controller/polyfill.js ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*globals require, self, window */
2
+ "use strict"
3
+
4
+ const ac = require("./dist/abort-controller")
5
+
6
+ /*eslint-disable @mysticatea/prettier */
7
+ const g =
8
+ typeof self !== "undefined" ? self :
9
+ typeof window !== "undefined" ? window :
10
+ typeof global !== "undefined" ? global :
11
+ /* otherwise */ undefined
12
+ /*eslint-enable @mysticatea/prettier */
13
+
14
+ if (g) {
15
+ if (typeof g.AbortController === "undefined") {
16
+ g.AbortController = ac.AbortController
17
+ }
18
+ if (typeof g.AbortSignal === "undefined") {
19
+ g.AbortSignal = ac.AbortSignal
20
+ }
21
+ }
node_modules/abort-controller/polyfill.mjs ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*globals self, window */
2
+ import * as ac from "./dist/abort-controller"
3
+
4
+ /*eslint-disable @mysticatea/prettier */
5
+ const g =
6
+ typeof self !== "undefined" ? self :
7
+ typeof window !== "undefined" ? window :
8
+ typeof global !== "undefined" ? global :
9
+ /* otherwise */ undefined
10
+ /*eslint-enable @mysticatea/prettier */
11
+
12
+ if (g) {
13
+ if (typeof g.AbortController === "undefined") {
14
+ g.AbortController = ac.AbortController
15
+ }
16
+ if (typeof g.AbortSignal === "undefined") {
17
+ g.AbortSignal = ac.AbortSignal
18
+ }
19
+ }
node_modules/debug/LICENSE ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
4
+ Copyright (c) 2018-2021 Josh Junon
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software
7
+ and associated documentation files (the 'Software'), to deal in the Software without restriction,
8
+ including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
9
+ and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all copies or substantial
13
+ portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
16
+ LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+
node_modules/debug/README.md ADDED
@@ -0,0 +1,481 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # debug
2
+ [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers)
3
+ [![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors)
4
+
5
+ <img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
6
+
7
+ A tiny JavaScript debugging utility modelled after Node.js core's debugging
8
+ technique. Works in Node.js and web browsers.
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ $ npm install debug
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ `debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.
19
+
20
+ Example [_app.js_](./examples/node/app.js):
21
+
22
+ ```js
23
+ var debug = require('debug')('http')
24
+ , http = require('http')
25
+ , name = 'My App';
26
+
27
+ // fake app
28
+
29
+ debug('booting %o', name);
30
+
31
+ http.createServer(function(req, res){
32
+ debug(req.method + ' ' + req.url);
33
+ res.end('hello\n');
34
+ }).listen(3000, function(){
35
+ debug('listening');
36
+ });
37
+
38
+ // fake worker of some kind
39
+
40
+ require('./worker');
41
+ ```
42
+
43
+ Example [_worker.js_](./examples/node/worker.js):
44
+
45
+ ```js
46
+ var a = require('debug')('worker:a')
47
+ , b = require('debug')('worker:b');
48
+
49
+ function work() {
50
+ a('doing lots of uninteresting work');
51
+ setTimeout(work, Math.random() * 1000);
52
+ }
53
+
54
+ work();
55
+
56
+ function workb() {
57
+ b('doing some work');
58
+ setTimeout(workb, Math.random() * 2000);
59
+ }
60
+
61
+ workb();
62
+ ```
63
+
64
+ The `DEBUG` environment variable is then used to enable these based on space or
65
+ comma-delimited names.
66
+
67
+ Here are some examples:
68
+
69
+ <img width="647" alt="screen shot 2017-08-08 at 12 53 04 pm" src="https://user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png">
70
+ <img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png">
71
+ <img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png">
72
+
73
+ #### Windows command prompt notes
74
+
75
+ ##### CMD
76
+
77
+ On Windows the environment variable is set using the `set` command.
78
+
79
+ ```cmd
80
+ set DEBUG=*,-not_this
81
+ ```
82
+
83
+ Example:
84
+
85
+ ```cmd
86
+ set DEBUG=* & node app.js
87
+ ```
88
+
89
+ ##### PowerShell (VS Code default)
90
+
91
+ PowerShell uses different syntax to set environment variables.
92
+
93
+ ```cmd
94
+ $env:DEBUG = "*,-not_this"
95
+ ```
96
+
97
+ Example:
98
+
99
+ ```cmd
100
+ $env:DEBUG='app';node app.js
101
+ ```
102
+
103
+ Then, run the program to be debugged as usual.
104
+
105
+ npm script example:
106
+ ```js
107
+ "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js",
108
+ ```
109
+
110
+ ## Namespace Colors
111
+
112
+ Every debug instance has a color generated for it based on its namespace name.
113
+ This helps when visually parsing the debug output to identify which debug instance
114
+ a debug line belongs to.
115
+
116
+ #### Node.js
117
+
118
+ In Node.js, colors are enabled when stderr is a TTY. You also _should_ install
119
+ the [`supports-color`](https://npmjs.org/supports-color) module alongside debug,
120
+ otherwise debug will only use a small handful of basic colors.
121
+
122
+ <img width="521" src="https://user-images.githubusercontent.com/71256/29092181-47f6a9e6-7c3a-11e7-9a14-1928d8a711cd.png">
123
+
124
+ #### Web Browser
125
+
126
+ Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
127
+ option. These are WebKit web inspectors, Firefox ([since version
128
+ 31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
129
+ and the Firebug plugin for Firefox (any version).
130
+
131
+ <img width="524" src="https://user-images.githubusercontent.com/71256/29092033-b65f9f2e-7c39-11e7-8e32-f6f0d8e865c1.png">
132
+
133
+
134
+ ## Millisecond diff
135
+
136
+ When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
137
+
138
+ <img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
139
+
140
+ When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below:
141
+
142
+ <img width="647" src="https://user-images.githubusercontent.com/71256/29091956-6bd78372-7c39-11e7-8c55-c948396d6edd.png">
143
+
144
+
145
+ ## Conventions
146
+
147
+ If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output.
148
+
149
+ ## Wildcards
150
+
151
+ The `*` character may be used as a wildcard. Suppose for example your library has
152
+ debuggers named "connect:bodyParser", "connect:compress", "connect:session",
153
+ instead of listing all three with
154
+ `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do
155
+ `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
156
+
157
+ You can also exclude specific debuggers by prefixing them with a "-" character.
158
+ For example, `DEBUG=*,-connect:*` would include all debuggers except those
159
+ starting with "connect:".
160
+
161
+ ## Environment Variables
162
+
163
+ When running through Node.js, you can set a few environment variables that will
164
+ change the behavior of the debug logging:
165
+
166
+ | Name | Purpose |
167
+ |-----------|-------------------------------------------------|
168
+ | `DEBUG` | Enables/disables specific debugging namespaces. |
169
+ | `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). |
170
+ | `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
171
+ | `DEBUG_DEPTH` | Object inspection depth. |
172
+ | `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
173
+
174
+
175
+ __Note:__ The environment variables beginning with `DEBUG_` end up being
176
+ converted into an Options object that gets used with `%o`/`%O` formatters.
177
+ See the Node.js documentation for
178
+ [`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
179
+ for the complete list.
180
+
181
+ ## Formatters
182
+
183
+ Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting.
184
+ Below are the officially supported formatters:
185
+
186
+ | Formatter | Representation |
187
+ |-----------|----------------|
188
+ | `%O` | Pretty-print an Object on multiple lines. |
189
+ | `%o` | Pretty-print an Object all on a single line. |
190
+ | `%s` | String. |
191
+ | `%d` | Number (both integer and float). |
192
+ | `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
193
+ | `%%` | Single percent sign ('%'). This does not consume an argument. |
194
+
195
+
196
+ ### Custom formatters
197
+
198
+ You can add custom formatters by extending the `debug.formatters` object.
199
+ For example, if you wanted to add support for rendering a Buffer as hex with
200
+ `%h`, you could do something like:
201
+
202
+ ```js
203
+ const createDebug = require('debug')
204
+ createDebug.formatters.h = (v) => {
205
+ return v.toString('hex')
206
+ }
207
+
208
+ // …elsewhere
209
+ const debug = createDebug('foo')
210
+ debug('this is hex: %h', new Buffer('hello world'))
211
+ // foo this is hex: 68656c6c6f20776f726c6421 +0ms
212
+ ```
213
+
214
+
215
+ ## Browser Support
216
+
217
+ You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
218
+ or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
219
+ if you don't want to build it yourself.
220
+
221
+ Debug's enable state is currently persisted by `localStorage`.
222
+ Consider the situation shown below where you have `worker:a` and `worker:b`,
223
+ and wish to debug both. You can enable this using `localStorage.debug`:
224
+
225
+ ```js
226
+ localStorage.debug = 'worker:*'
227
+ ```
228
+
229
+ And then refresh the page.
230
+
231
+ ```js
232
+ a = debug('worker:a');
233
+ b = debug('worker:b');
234
+
235
+ setInterval(function(){
236
+ a('doing some work');
237
+ }, 1000);
238
+
239
+ setInterval(function(){
240
+ b('doing some work');
241
+ }, 1200);
242
+ ```
243
+
244
+ In Chromium-based web browsers (e.g. Brave, Chrome, and Electron), the JavaScript console will—by default—only show messages logged by `debug` if the "Verbose" log level is _enabled_.
245
+
246
+ <img width="647" src="https://user-images.githubusercontent.com/7143133/152083257-29034707-c42c-4959-8add-3cee850e6fcf.png">
247
+
248
+ ## Output streams
249
+
250
+ By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
251
+
252
+ Example [_stdout.js_](./examples/node/stdout.js):
253
+
254
+ ```js
255
+ var debug = require('debug');
256
+ var error = debug('app:error');
257
+
258
+ // by default stderr is used
259
+ error('goes to stderr!');
260
+
261
+ var log = debug('app:log');
262
+ // set this namespace to log via console.log
263
+ log.log = console.log.bind(console); // don't forget to bind to console!
264
+ log('goes to stdout');
265
+ error('still goes to stderr!');
266
+
267
+ // set all output to go via console.info
268
+ // overrides all per-namespace log settings
269
+ debug.log = console.info.bind(console);
270
+ error('now goes to stdout via console.info');
271
+ log('still goes to stdout, but via console.info now');
272
+ ```
273
+
274
+ ## Extend
275
+ You can simply extend debugger
276
+ ```js
277
+ const log = require('debug')('auth');
278
+
279
+ //creates new debug instance with extended namespace
280
+ const logSign = log.extend('sign');
281
+ const logLogin = log.extend('login');
282
+
283
+ log('hello'); // auth hello
284
+ logSign('hello'); //auth:sign hello
285
+ logLogin('hello'); //auth:login hello
286
+ ```
287
+
288
+ ## Set dynamically
289
+
290
+ You can also enable debug dynamically by calling the `enable()` method :
291
+
292
+ ```js
293
+ let debug = require('debug');
294
+
295
+ console.log(1, debug.enabled('test'));
296
+
297
+ debug.enable('test');
298
+ console.log(2, debug.enabled('test'));
299
+
300
+ debug.disable();
301
+ console.log(3, debug.enabled('test'));
302
+
303
+ ```
304
+
305
+ print :
306
+ ```
307
+ 1 false
308
+ 2 true
309
+ 3 false
310
+ ```
311
+
312
+ Usage :
313
+ `enable(namespaces)`
314
+ `namespaces` can include modes separated by a colon and wildcards.
315
+
316
+ Note that calling `enable()` completely overrides previously set DEBUG variable :
317
+
318
+ ```
319
+ $ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))'
320
+ => false
321
+ ```
322
+
323
+ `disable()`
324
+
325
+ Will disable all namespaces. The functions returns the namespaces currently
326
+ enabled (and skipped). This can be useful if you want to disable debugging
327
+ temporarily without knowing what was enabled to begin with.
328
+
329
+ For example:
330
+
331
+ ```js
332
+ let debug = require('debug');
333
+ debug.enable('foo:*,-foo:bar');
334
+ let namespaces = debug.disable();
335
+ debug.enable(namespaces);
336
+ ```
337
+
338
+ Note: There is no guarantee that the string will be identical to the initial
339
+ enable string, but semantically they will be identical.
340
+
341
+ ## Checking whether a debug target is enabled
342
+
343
+ After you've created a debug instance, you can determine whether or not it is
344
+ enabled by checking the `enabled` property:
345
+
346
+ ```javascript
347
+ const debug = require('debug')('http');
348
+
349
+ if (debug.enabled) {
350
+ // do stuff...
351
+ }
352
+ ```
353
+
354
+ You can also manually toggle this property to force the debug instance to be
355
+ enabled or disabled.
356
+
357
+ ## Usage in child processes
358
+
359
+ Due to the way `debug` detects if the output is a TTY or not, colors are not shown in child processes when `stderr` is piped. A solution is to pass the `DEBUG_COLORS=1` environment variable to the child process.
360
+ For example:
361
+
362
+ ```javascript
363
+ worker = fork(WORKER_WRAP_PATH, [workerPath], {
364
+ stdio: [
365
+ /* stdin: */ 0,
366
+ /* stdout: */ 'pipe',
367
+ /* stderr: */ 'pipe',
368
+ 'ipc',
369
+ ],
370
+ env: Object.assign({}, process.env, {
371
+ DEBUG_COLORS: 1 // without this settings, colors won't be shown
372
+ }),
373
+ });
374
+
375
+ worker.stderr.pipe(process.stderr, { end: false });
376
+ ```
377
+
378
+
379
+ ## Authors
380
+
381
+ - TJ Holowaychuk
382
+ - Nathan Rajlich
383
+ - Andrew Rhyne
384
+ - Josh Junon
385
+
386
+ ## Backers
387
+
388
+ Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]
389
+
390
+ <a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a>
391
+ <a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a>
392
+ <a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a>
393
+ <a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a>
394
+ <a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a>
395
+ <a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a>
396
+ <a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a>
397
+ <a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a>
398
+ <a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a>
399
+ <a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a>
400
+ <a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a>
401
+ <a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a>
402
+ <a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a>
403
+ <a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a>
404
+ <a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a>
405
+ <a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a>
406
+ <a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a>
407
+ <a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a>
408
+ <a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a>
409
+ <a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a>
410
+ <a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a>
411
+ <a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a>
412
+ <a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a>
413
+ <a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a>
414
+ <a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a>
415
+ <a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a>
416
+ <a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a>
417
+ <a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a>
418
+ <a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a>
419
+ <a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a>
420
+
421
+
422
+ ## Sponsors
423
+
424
+ Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]
425
+
426
+ <a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a>
427
+ <a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a>
428
+ <a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a>
429
+ <a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a>
430
+ <a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a>
431
+ <a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a>
432
+ <a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a>
433
+ <a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a>
434
+ <a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a>
435
+ <a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a>
436
+ <a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a>
437
+ <a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a>
438
+ <a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a>
439
+ <a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a>
440
+ <a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a>
441
+ <a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a>
442
+ <a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a>
443
+ <a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a>
444
+ <a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a>
445
+ <a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a>
446
+ <a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a>
447
+ <a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a>
448
+ <a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a>
449
+ <a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a>
450
+ <a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a>
451
+ <a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a>
452
+ <a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a>
453
+ <a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a>
454
+ <a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a>
455
+ <a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a>
456
+
457
+ ## License
458
+
459
+ (The MIT License)
460
+
461
+ Copyright (c) 2014-2017 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
462
+ Copyright (c) 2018-2021 Josh Junon
463
+
464
+ Permission is hereby granted, free of charge, to any person obtaining
465
+ a copy of this software and associated documentation files (the
466
+ 'Software'), to deal in the Software without restriction, including
467
+ without limitation the rights to use, copy, modify, merge, publish,
468
+ distribute, sublicense, and/or sell copies of the Software, and to
469
+ permit persons to whom the Software is furnished to do so, subject to
470
+ the following conditions:
471
+
472
+ The above copyright notice and this permission notice shall be
473
+ included in all copies or substantial portions of the Software.
474
+
475
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
476
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
477
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
478
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
479
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
480
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
481
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
node_modules/debug/package.json ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "debug",
3
+ "version": "4.4.3",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git://github.com/debug-js/debug.git"
7
+ },
8
+ "description": "Lightweight debugging utility for Node.js and the browser",
9
+ "keywords": [
10
+ "debug",
11
+ "log",
12
+ "debugger"
13
+ ],
14
+ "files": [
15
+ "src",
16
+ "LICENSE",
17
+ "README.md"
18
+ ],
19
+ "author": "Josh Junon (https://github.com/qix-)",
20
+ "contributors": [
21
+ "TJ Holowaychuk <tj@vision-media.ca>",
22
+ "Nathan Rajlich <nathan@tootallnate.net> (http://n8.io)",
23
+ "Andrew Rhyne <rhyneandrew@gmail.com>"
24
+ ],
25
+ "license": "MIT",
26
+ "scripts": {
27
+ "lint": "xo",
28
+ "test": "npm run test:node && npm run test:browser && npm run lint",
29
+ "test:node": "mocha test.js test.node.js",
30
+ "test:browser": "karma start --single-run",
31
+ "test:coverage": "cat ./coverage/lcov.info | coveralls"
32
+ },
33
+ "dependencies": {
34
+ "ms": "^2.1.3"
35
+ },
36
+ "devDependencies": {
37
+ "brfs": "^2.0.1",
38
+ "browserify": "^16.2.3",
39
+ "coveralls": "^3.0.2",
40
+ "karma": "^3.1.4",
41
+ "karma-browserify": "^6.0.0",
42
+ "karma-chrome-launcher": "^2.2.0",
43
+ "karma-mocha": "^1.3.0",
44
+ "mocha": "^5.2.0",
45
+ "mocha-lcov-reporter": "^1.2.0",
46
+ "sinon": "^14.0.0",
47
+ "xo": "^0.23.0"
48
+ },
49
+ "peerDependenciesMeta": {
50
+ "supports-color": {
51
+ "optional": true
52
+ }
53
+ },
54
+ "main": "./src/index.js",
55
+ "browser": "./src/browser.js",
56
+ "engines": {
57
+ "node": ">=6.0"
58
+ },
59
+ "xo": {
60
+ "rules": {
61
+ "import/extensions": "off"
62
+ }
63
+ }
64
+ }
node_modules/debug/src/browser.js ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* eslint-env browser */
2
+
3
+ /**
4
+ * This is the web browser implementation of `debug()`.
5
+ */
6
+
7
+ exports.formatArgs = formatArgs;
8
+ exports.save = save;
9
+ exports.load = load;
10
+ exports.useColors = useColors;
11
+ exports.storage = localstorage();
12
+ exports.destroy = (() => {
13
+ let warned = false;
14
+
15
+ return () => {
16
+ if (!warned) {
17
+ warned = true;
18
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
19
+ }
20
+ };
21
+ })();
22
+
23
+ /**
24
+ * Colors.
25
+ */
26
+
27
+ exports.colors = [
28
+ '#0000CC',
29
+ '#0000FF',
30
+ '#0033CC',
31
+ '#0033FF',
32
+ '#0066CC',
33
+ '#0066FF',
34
+ '#0099CC',
35
+ '#0099FF',
36
+ '#00CC00',
37
+ '#00CC33',
38
+ '#00CC66',
39
+ '#00CC99',
40
+ '#00CCCC',
41
+ '#00CCFF',
42
+ '#3300CC',
43
+ '#3300FF',
44
+ '#3333CC',
45
+ '#3333FF',
46
+ '#3366CC',
47
+ '#3366FF',
48
+ '#3399CC',
49
+ '#3399FF',
50
+ '#33CC00',
51
+ '#33CC33',
52
+ '#33CC66',
53
+ '#33CC99',
54
+ '#33CCCC',
55
+ '#33CCFF',
56
+ '#6600CC',
57
+ '#6600FF',
58
+ '#6633CC',
59
+ '#6633FF',
60
+ '#66CC00',
61
+ '#66CC33',
62
+ '#9900CC',
63
+ '#9900FF',
64
+ '#9933CC',
65
+ '#9933FF',
66
+ '#99CC00',
67
+ '#99CC33',
68
+ '#CC0000',
69
+ '#CC0033',
70
+ '#CC0066',
71
+ '#CC0099',
72
+ '#CC00CC',
73
+ '#CC00FF',
74
+ '#CC3300',
75
+ '#CC3333',
76
+ '#CC3366',
77
+ '#CC3399',
78
+ '#CC33CC',
79
+ '#CC33FF',
80
+ '#CC6600',
81
+ '#CC6633',
82
+ '#CC9900',
83
+ '#CC9933',
84
+ '#CCCC00',
85
+ '#CCCC33',
86
+ '#FF0000',
87
+ '#FF0033',
88
+ '#FF0066',
89
+ '#FF0099',
90
+ '#FF00CC',
91
+ '#FF00FF',
92
+ '#FF3300',
93
+ '#FF3333',
94
+ '#FF3366',
95
+ '#FF3399',
96
+ '#FF33CC',
97
+ '#FF33FF',
98
+ '#FF6600',
99
+ '#FF6633',
100
+ '#FF9900',
101
+ '#FF9933',
102
+ '#FFCC00',
103
+ '#FFCC33'
104
+ ];
105
+
106
+ /**
107
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
108
+ * and the Firebug extension (any Firefox version) are known
109
+ * to support "%c" CSS customizations.
110
+ *
111
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
112
+ */
113
+
114
+ // eslint-disable-next-line complexity
115
+ function useColors() {
116
+ // NB: In an Electron preload script, document will be defined but not fully
117
+ // initialized. Since we know we're in Chrome, we'll just detect this case
118
+ // explicitly
119
+ if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
120
+ return true;
121
+ }
122
+
123
+ // Internet Explorer and Edge do not support colors.
124
+ if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
125
+ return false;
126
+ }
127
+
128
+ let m;
129
+
130
+ // Is webkit? http://stackoverflow.com/a/16459606/376773
131
+ // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
132
+ // eslint-disable-next-line no-return-assign
133
+ return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
134
+ // Is firebug? http://stackoverflow.com/a/398120/376773
135
+ (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
136
+ // Is firefox >= v31?
137
+ // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
138
+ (typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) ||
139
+ // Double check webkit in userAgent just in case we are in a worker
140
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
141
+ }
142
+
143
+ /**
144
+ * Colorize log arguments if enabled.
145
+ *
146
+ * @api public
147
+ */
148
+
149
+ function formatArgs(args) {
150
+ args[0] = (this.useColors ? '%c' : '') +
151
+ this.namespace +
152
+ (this.useColors ? ' %c' : ' ') +
153
+ args[0] +
154
+ (this.useColors ? '%c ' : ' ') +
155
+ '+' + module.exports.humanize(this.diff);
156
+
157
+ if (!this.useColors) {
158
+ return;
159
+ }
160
+
161
+ const c = 'color: ' + this.color;
162
+ args.splice(1, 0, c, 'color: inherit');
163
+
164
+ // The final "%c" is somewhat tricky, because there could be other
165
+ // arguments passed either before or after the %c, so we need to
166
+ // figure out the correct index to insert the CSS into
167
+ let index = 0;
168
+ let lastC = 0;
169
+ args[0].replace(/%[a-zA-Z%]/g, match => {
170
+ if (match === '%%') {
171
+ return;
172
+ }
173
+ index++;
174
+ if (match === '%c') {
175
+ // We only are interested in the *last* %c
176
+ // (the user may have provided their own)
177
+ lastC = index;
178
+ }
179
+ });
180
+
181
+ args.splice(lastC, 0, c);
182
+ }
183
+
184
+ /**
185
+ * Invokes `console.debug()` when available.
186
+ * No-op when `console.debug` is not a "function".
187
+ * If `console.debug` is not available, falls back
188
+ * to `console.log`.
189
+ *
190
+ * @api public
191
+ */
192
+ exports.log = console.debug || console.log || (() => {});
193
+
194
+ /**
195
+ * Save `namespaces`.
196
+ *
197
+ * @param {String} namespaces
198
+ * @api private
199
+ */
200
+ function save(namespaces) {
201
+ try {
202
+ if (namespaces) {
203
+ exports.storage.setItem('debug', namespaces);
204
+ } else {
205
+ exports.storage.removeItem('debug');
206
+ }
207
+ } catch (error) {
208
+ // Swallow
209
+ // XXX (@Qix-) should we be logging these?
210
+ }
211
+ }
212
+
213
+ /**
214
+ * Load `namespaces`.
215
+ *
216
+ * @return {String} returns the previously persisted debug modes
217
+ * @api private
218
+ */
219
+ function load() {
220
+ let r;
221
+ try {
222
+ r = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ;
223
+ } catch (error) {
224
+ // Swallow
225
+ // XXX (@Qix-) should we be logging these?
226
+ }
227
+
228
+ // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
229
+ if (!r && typeof process !== 'undefined' && 'env' in process) {
230
+ r = process.env.DEBUG;
231
+ }
232
+
233
+ return r;
234
+ }
235
+
236
+ /**
237
+ * Localstorage attempts to return the localstorage.
238
+ *
239
+ * This is necessary because safari throws
240
+ * when a user disables cookies/localstorage
241
+ * and you attempt to access it.
242
+ *
243
+ * @return {LocalStorage}
244
+ * @api private
245
+ */
246
+
247
+ function localstorage() {
248
+ try {
249
+ // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
250
+ // The Browser also has localStorage in the global context.
251
+ return localStorage;
252
+ } catch (error) {
253
+ // Swallow
254
+ // XXX (@Qix-) should we be logging these?
255
+ }
256
+ }
257
+
258
+ module.exports = require('./common')(exports);
259
+
260
+ const {formatters} = module.exports;
261
+
262
+ /**
263
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
264
+ */
265
+
266
+ formatters.j = function (v) {
267
+ try {
268
+ return JSON.stringify(v);
269
+ } catch (error) {
270
+ return '[UnexpectedJSONParseError]: ' + error.message;
271
+ }
272
+ };
node_modules/debug/src/common.js ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /**
3
+ * This is the common logic for both the Node.js and web browser
4
+ * implementations of `debug()`.
5
+ */
6
+
7
+ function setup(env) {
8
+ createDebug.debug = createDebug;
9
+ createDebug.default = createDebug;
10
+ createDebug.coerce = coerce;
11
+ createDebug.disable = disable;
12
+ createDebug.enable = enable;
13
+ createDebug.enabled = enabled;
14
+ createDebug.humanize = require('ms');
15
+ createDebug.destroy = destroy;
16
+
17
+ Object.keys(env).forEach(key => {
18
+ createDebug[key] = env[key];
19
+ });
20
+
21
+ /**
22
+ * The currently active debug mode names, and names to skip.
23
+ */
24
+
25
+ createDebug.names = [];
26
+ createDebug.skips = [];
27
+
28
+ /**
29
+ * Map of special "%n" handling functions, for the debug "format" argument.
30
+ *
31
+ * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
32
+ */
33
+ createDebug.formatters = {};
34
+
35
+ /**
36
+ * Selects a color for a debug namespace
37
+ * @param {String} namespace The namespace string for the debug instance to be colored
38
+ * @return {Number|String} An ANSI color code for the given namespace
39
+ * @api private
40
+ */
41
+ function selectColor(namespace) {
42
+ let hash = 0;
43
+
44
+ for (let i = 0; i < namespace.length; i++) {
45
+ hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
46
+ hash |= 0; // Convert to 32bit integer
47
+ }
48
+
49
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
50
+ }
51
+ createDebug.selectColor = selectColor;
52
+
53
+ /**
54
+ * Create a debugger with the given `namespace`.
55
+ *
56
+ * @param {String} namespace
57
+ * @return {Function}
58
+ * @api public
59
+ */
60
+ function createDebug(namespace) {
61
+ let prevTime;
62
+ let enableOverride = null;
63
+ let namespacesCache;
64
+ let enabledCache;
65
+
66
+ function debug(...args) {
67
+ // Disabled?
68
+ if (!debug.enabled) {
69
+ return;
70
+ }
71
+
72
+ const self = debug;
73
+
74
+ // Set `diff` timestamp
75
+ const curr = Number(new Date());
76
+ const ms = curr - (prevTime || curr);
77
+ self.diff = ms;
78
+ self.prev = prevTime;
79
+ self.curr = curr;
80
+ prevTime = curr;
81
+
82
+ args[0] = createDebug.coerce(args[0]);
83
+
84
+ if (typeof args[0] !== 'string') {
85
+ // Anything else let's inspect with %O
86
+ args.unshift('%O');
87
+ }
88
+
89
+ // Apply any `formatters` transformations
90
+ let index = 0;
91
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
92
+ // If we encounter an escaped % then don't increase the array index
93
+ if (match === '%%') {
94
+ return '%';
95
+ }
96
+ index++;
97
+ const formatter = createDebug.formatters[format];
98
+ if (typeof formatter === 'function') {
99
+ const val = args[index];
100
+ match = formatter.call(self, val);
101
+
102
+ // Now we need to remove `args[index]` since it's inlined in the `format`
103
+ args.splice(index, 1);
104
+ index--;
105
+ }
106
+ return match;
107
+ });
108
+
109
+ // Apply env-specific formatting (colors, etc.)
110
+ createDebug.formatArgs.call(self, args);
111
+
112
+ const logFn = self.log || createDebug.log;
113
+ logFn.apply(self, args);
114
+ }
115
+
116
+ debug.namespace = namespace;
117
+ debug.useColors = createDebug.useColors();
118
+ debug.color = createDebug.selectColor(namespace);
119
+ debug.extend = extend;
120
+ debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
121
+
122
+ Object.defineProperty(debug, 'enabled', {
123
+ enumerable: true,
124
+ configurable: false,
125
+ get: () => {
126
+ if (enableOverride !== null) {
127
+ return enableOverride;
128
+ }
129
+ if (namespacesCache !== createDebug.namespaces) {
130
+ namespacesCache = createDebug.namespaces;
131
+ enabledCache = createDebug.enabled(namespace);
132
+ }
133
+
134
+ return enabledCache;
135
+ },
136
+ set: v => {
137
+ enableOverride = v;
138
+ }
139
+ });
140
+
141
+ // Env-specific initialization logic for debug instances
142
+ if (typeof createDebug.init === 'function') {
143
+ createDebug.init(debug);
144
+ }
145
+
146
+ return debug;
147
+ }
148
+
149
+ function extend(namespace, delimiter) {
150
+ const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
151
+ newDebug.log = this.log;
152
+ return newDebug;
153
+ }
154
+
155
+ /**
156
+ * Enables a debug mode by namespaces. This can include modes
157
+ * separated by a colon and wildcards.
158
+ *
159
+ * @param {String} namespaces
160
+ * @api public
161
+ */
162
+ function enable(namespaces) {
163
+ createDebug.save(namespaces);
164
+ createDebug.namespaces = namespaces;
165
+
166
+ createDebug.names = [];
167
+ createDebug.skips = [];
168
+
169
+ const split = (typeof namespaces === 'string' ? namespaces : '')
170
+ .trim()
171
+ .replace(/\s+/g, ',')
172
+ .split(',')
173
+ .filter(Boolean);
174
+
175
+ for (const ns of split) {
176
+ if (ns[0] === '-') {
177
+ createDebug.skips.push(ns.slice(1));
178
+ } else {
179
+ createDebug.names.push(ns);
180
+ }
181
+ }
182
+ }
183
+
184
+ /**
185
+ * Checks if the given string matches a namespace template, honoring
186
+ * asterisks as wildcards.
187
+ *
188
+ * @param {String} search
189
+ * @param {String} template
190
+ * @return {Boolean}
191
+ */
192
+ function matchesTemplate(search, template) {
193
+ let searchIndex = 0;
194
+ let templateIndex = 0;
195
+ let starIndex = -1;
196
+ let matchIndex = 0;
197
+
198
+ while (searchIndex < search.length) {
199
+ if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {
200
+ // Match character or proceed with wildcard
201
+ if (template[templateIndex] === '*') {
202
+ starIndex = templateIndex;
203
+ matchIndex = searchIndex;
204
+ templateIndex++; // Skip the '*'
205
+ } else {
206
+ searchIndex++;
207
+ templateIndex++;
208
+ }
209
+ } else if (starIndex !== -1) { // eslint-disable-line no-negated-condition
210
+ // Backtrack to the last '*' and try to match more characters
211
+ templateIndex = starIndex + 1;
212
+ matchIndex++;
213
+ searchIndex = matchIndex;
214
+ } else {
215
+ return false; // No match
216
+ }
217
+ }
218
+
219
+ // Handle trailing '*' in template
220
+ while (templateIndex < template.length && template[templateIndex] === '*') {
221
+ templateIndex++;
222
+ }
223
+
224
+ return templateIndex === template.length;
225
+ }
226
+
227
+ /**
228
+ * Disable debug output.
229
+ *
230
+ * @return {String} namespaces
231
+ * @api public
232
+ */
233
+ function disable() {
234
+ const namespaces = [
235
+ ...createDebug.names,
236
+ ...createDebug.skips.map(namespace => '-' + namespace)
237
+ ].join(',');
238
+ createDebug.enable('');
239
+ return namespaces;
240
+ }
241
+
242
+ /**
243
+ * Returns true if the given mode name is enabled, false otherwise.
244
+ *
245
+ * @param {String} name
246
+ * @return {Boolean}
247
+ * @api public
248
+ */
249
+ function enabled(name) {
250
+ for (const skip of createDebug.skips) {
251
+ if (matchesTemplate(name, skip)) {
252
+ return false;
253
+ }
254
+ }
255
+
256
+ for (const ns of createDebug.names) {
257
+ if (matchesTemplate(name, ns)) {
258
+ return true;
259
+ }
260
+ }
261
+
262
+ return false;
263
+ }
264
+
265
+ /**
266
+ * Coerce `val`.
267
+ *
268
+ * @param {Mixed} val
269
+ * @return {Mixed}
270
+ * @api private
271
+ */
272
+ function coerce(val) {
273
+ if (val instanceof Error) {
274
+ return val.stack || val.message;
275
+ }
276
+ return val;
277
+ }
278
+
279
+ /**
280
+ * XXX DO NOT USE. This is a temporary stub function.
281
+ * XXX It WILL be removed in the next major release.
282
+ */
283
+ function destroy() {
284
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
285
+ }
286
+
287
+ createDebug.enable(createDebug.load());
288
+
289
+ return createDebug;
290
+ }
291
+
292
+ module.exports = setup;
node_modules/debug/src/index.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Detect Electron renderer / nwjs process, which is node, but we should
3
+ * treat as a browser.
4
+ */
5
+
6
+ if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
7
+ module.exports = require('./browser.js');
8
+ } else {
9
+ module.exports = require('./node.js');
10
+ }
node_modules/debug/src/node.js ADDED
@@ -0,0 +1,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Module dependencies.
3
+ */
4
+
5
+ const tty = require('tty');
6
+ const util = require('util');
7
+
8
+ /**
9
+ * This is the Node.js implementation of `debug()`.
10
+ */
11
+
12
+ exports.init = init;
13
+ exports.log = log;
14
+ exports.formatArgs = formatArgs;
15
+ exports.save = save;
16
+ exports.load = load;
17
+ exports.useColors = useColors;
18
+ exports.destroy = util.deprecate(
19
+ () => {},
20
+ 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
21
+ );
22
+
23
+ /**
24
+ * Colors.
25
+ */
26
+
27
+ exports.colors = [6, 2, 3, 4, 5, 1];
28
+
29
+ try {
30
+ // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
31
+ // eslint-disable-next-line import/no-extraneous-dependencies
32
+ const supportsColor = require('supports-color');
33
+
34
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
35
+ exports.colors = [
36
+ 20,
37
+ 21,
38
+ 26,
39
+ 27,
40
+ 32,
41
+ 33,
42
+ 38,
43
+ 39,
44
+ 40,
45
+ 41,
46
+ 42,
47
+ 43,
48
+ 44,
49
+ 45,
50
+ 56,
51
+ 57,
52
+ 62,
53
+ 63,
54
+ 68,
55
+ 69,
56
+ 74,
57
+ 75,
58
+ 76,
59
+ 77,
60
+ 78,
61
+ 79,
62
+ 80,
63
+ 81,
64
+ 92,
65
+ 93,
66
+ 98,
67
+ 99,
68
+ 112,
69
+ 113,
70
+ 128,
71
+ 129,
72
+ 134,
73
+ 135,
74
+ 148,
75
+ 149,
76
+ 160,
77
+ 161,
78
+ 162,
79
+ 163,
80
+ 164,
81
+ 165,
82
+ 166,
83
+ 167,
84
+ 168,
85
+ 169,
86
+ 170,
87
+ 171,
88
+ 172,
89
+ 173,
90
+ 178,
91
+ 179,
92
+ 184,
93
+ 185,
94
+ 196,
95
+ 197,
96
+ 198,
97
+ 199,
98
+ 200,
99
+ 201,
100
+ 202,
101
+ 203,
102
+ 204,
103
+ 205,
104
+ 206,
105
+ 207,
106
+ 208,
107
+ 209,
108
+ 214,
109
+ 215,
110
+ 220,
111
+ 221
112
+ ];
113
+ }
114
+ } catch (error) {
115
+ // Swallow - we only care if `supports-color` is available; it doesn't have to be.
116
+ }
117
+
118
+ /**
119
+ * Build up the default `inspectOpts` object from the environment variables.
120
+ *
121
+ * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
122
+ */
123
+
124
+ exports.inspectOpts = Object.keys(process.env).filter(key => {
125
+ return /^debug_/i.test(key);
126
+ }).reduce((obj, key) => {
127
+ // Camel-case
128
+ const prop = key
129
+ .substring(6)
130
+ .toLowerCase()
131
+ .replace(/_([a-z])/g, (_, k) => {
132
+ return k.toUpperCase();
133
+ });
134
+
135
+ // Coerce string value into JS value
136
+ let val = process.env[key];
137
+ if (/^(yes|on|true|enabled)$/i.test(val)) {
138
+ val = true;
139
+ } else if (/^(no|off|false|disabled)$/i.test(val)) {
140
+ val = false;
141
+ } else if (val === 'null') {
142
+ val = null;
143
+ } else {
144
+ val = Number(val);
145
+ }
146
+
147
+ obj[prop] = val;
148
+ return obj;
149
+ }, {});
150
+
151
+ /**
152
+ * Is stdout a TTY? Colored output is enabled when `true`.
153
+ */
154
+
155
+ function useColors() {
156
+ return 'colors' in exports.inspectOpts ?
157
+ Boolean(exports.inspectOpts.colors) :
158
+ tty.isatty(process.stderr.fd);
159
+ }
160
+
161
+ /**
162
+ * Adds ANSI color escape codes if enabled.
163
+ *
164
+ * @api public
165
+ */
166
+
167
+ function formatArgs(args) {
168
+ const {namespace: name, useColors} = this;
169
+
170
+ if (useColors) {
171
+ const c = this.color;
172
+ const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
173
+ const prefix = ` ${colorCode};1m${name} \u001B[0m`;
174
+
175
+ args[0] = prefix + args[0].split('\n').join('\n' + prefix);
176
+ args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
177
+ } else {
178
+ args[0] = getDate() + name + ' ' + args[0];
179
+ }
180
+ }
181
+
182
+ function getDate() {
183
+ if (exports.inspectOpts.hideDate) {
184
+ return '';
185
+ }
186
+ return new Date().toISOString() + ' ';
187
+ }
188
+
189
+ /**
190
+ * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
191
+ */
192
+
193
+ function log(...args) {
194
+ return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n');
195
+ }
196
+
197
+ /**
198
+ * Save `namespaces`.
199
+ *
200
+ * @param {String} namespaces
201
+ * @api private
202
+ */
203
+ function save(namespaces) {
204
+ if (namespaces) {
205
+ process.env.DEBUG = namespaces;
206
+ } else {
207
+ // If you set a process.env field to null or undefined, it gets cast to the
208
+ // string 'null' or 'undefined'. Just delete instead.
209
+ delete process.env.DEBUG;
210
+ }
211
+ }
212
+
213
+ /**
214
+ * Load `namespaces`.
215
+ *
216
+ * @return {String} returns the previously persisted debug modes
217
+ * @api private
218
+ */
219
+
220
+ function load() {
221
+ return process.env.DEBUG;
222
+ }
223
+
224
+ /**
225
+ * Init logic for `debug` instances.
226
+ *
227
+ * Create a new `inspectOpts` object in case `useColors` is set
228
+ * differently for a particular `debug` instance.
229
+ */
230
+
231
+ function init(debug) {
232
+ debug.inspectOpts = {};
233
+
234
+ const keys = Object.keys(exports.inspectOpts);
235
+ for (let i = 0; i < keys.length; i++) {
236
+ debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
237
+ }
238
+ }
239
+
240
+ module.exports = require('./common')(exports);
241
+
242
+ const {formatters} = module.exports;
243
+
244
+ /**
245
+ * Map %o to `util.inspect()`, all on a single line.
246
+ */
247
+
248
+ formatters.o = function (v) {
249
+ this.inspectOpts.colors = this.useColors;
250
+ return util.inspect(v, this.inspectOpts)
251
+ .split('\n')
252
+ .map(str => str.trim())
253
+ .join(' ');
254
+ };
255
+
256
+ /**
257
+ * Map %O to `util.inspect()`, allowing multiple lines if needed.
258
+ */
259
+
260
+ formatters.O = function (v) {
261
+ this.inspectOpts.colors = this.useColors;
262
+ return util.inspect(v, this.inspectOpts);
263
+ };
node_modules/event-target-shim/LICENSE ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Toru Nagashima
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
node_modules/event-target-shim/README.md ADDED
@@ -0,0 +1,293 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # event-target-shim
2
+
3
+ [![npm version](https://img.shields.io/npm/v/event-target-shim.svg)](https://www.npmjs.com/package/event-target-shim)
4
+ [![Downloads/month](https://img.shields.io/npm/dm/event-target-shim.svg)](http://www.npmtrends.com/event-target-shim)
5
+ [![Build Status](https://travis-ci.org/mysticatea/event-target-shim.svg?branch=master)](https://travis-ci.org/mysticatea/event-target-shim)
6
+ [![Coverage Status](https://codecov.io/gh/mysticatea/event-target-shim/branch/master/graph/badge.svg)](https://codecov.io/gh/mysticatea/event-target-shim)
7
+ [![Dependency Status](https://david-dm.org/mysticatea/event-target-shim.svg)](https://david-dm.org/mysticatea/event-target-shim)
8
+
9
+ An implementation of [WHATWG EventTarget interface](https://dom.spec.whatwg.org/#interface-eventtarget), plus few extensions.
10
+
11
+ - This provides `EventTarget` constructor that can inherit for your custom object.
12
+ - This provides an utility that defines properties of attribute listeners (e.g. `obj.onclick`).
13
+
14
+ ```js
15
+ import {EventTarget, defineEventAttribute} from "event-target-shim"
16
+
17
+ class Foo extends EventTarget {
18
+ // ...
19
+ }
20
+
21
+ // Define `foo.onhello` property.
22
+ defineEventAttribute(Foo.prototype, "hello")
23
+
24
+ // Use
25
+ const foo = new Foo()
26
+ foo.addEventListener("hello", e => console.log("hello", e))
27
+ foo.onhello = e => console.log("onhello:", e)
28
+ foo.dispatchEvent(new CustomEvent("hello"))
29
+ ```
30
+
31
+ ## 💿 Installation
32
+
33
+ Use [npm](https://www.npmjs.com/) to install then use a bundler.
34
+
35
+ ```
36
+ npm install event-target-shim
37
+ ```
38
+
39
+ Or download from [`dist` directory](./dist).
40
+
41
+ - [dist/event-target-shim.mjs](dist/event-target-shim.mjs) ... ES modules version.
42
+ - [dist/event-target-shim.js](dist/event-target-shim.js) ... Common JS version.
43
+ - [dist/event-target-shim.umd.js](dist/event-target-shim.umd.js) ... UMD (Universal Module Definition) version. This is transpiled by [Babel](https://babeljs.io/) for IE 11.
44
+
45
+ ## 📖 Usage
46
+
47
+ ```js
48
+ import {EventTarget, defineEventAttribute} from "event-target-shim"
49
+ // or
50
+ const {EventTarget, defineEventAttribute} = require("event-target-shim")
51
+
52
+ // or UMD version defines a global variable:
53
+ const {EventTarget, defineEventAttribute} = window.EventTargetShim
54
+ ```
55
+
56
+ ### EventTarget
57
+
58
+ > https://dom.spec.whatwg.org/#interface-eventtarget
59
+
60
+ #### eventTarget.addEventListener(type, callback, options)
61
+
62
+ Register an event listener.
63
+
64
+ - `type` is a string. This is the event name to register.
65
+ - `callback` is a function. This is the event listener to register.
66
+ - `options` is a boolean or an object `{ capture?: boolean, passive?: boolean, once?: boolean }`. If this is a boolean, it's same meaning as `{ capture: options }`.
67
+ - `capture` is the flag to register the event listener for capture phase.
68
+ - `passive` is the flag to ignore `event.preventDefault()` method in the event listener.
69
+ - `once` is the flag to remove the event listener automatically after the first call.
70
+
71
+ #### eventTarget.removeEventListener(type, callback, options)
72
+
73
+ Unregister an event listener.
74
+
75
+ - `type` is a string. This is the event name to unregister.
76
+ - `callback` is a function. This is the event listener to unregister.
77
+ - `options` is a boolean or an object `{ capture?: boolean }`. If this is a boolean, it's same meaning as `{ capture: options }`.
78
+ - `capture` is the flag to register the event listener for capture phase.
79
+
80
+ #### eventTarget.dispatchEvent(event)
81
+
82
+ Dispatch an event.
83
+
84
+ - `event` is a [Event](https://dom.spec.whatwg.org/#event) object or an object `{ type: string, [key: string]: any }`. The latter is non-standard but useful. In both cases, listeners receive the event as implementing [Event](https://dom.spec.whatwg.org/#event) interface.
85
+
86
+ ### defineEventAttribute(proto, type)
87
+
88
+ Define an event attribute (e.g. `onclick`) to `proto`. This is non-standard.
89
+
90
+ - `proto` is an object (assuming it's a prototype object). This function defines a getter/setter pair for the event attribute.
91
+ - `type` is a string. This is the event name to define.
92
+
93
+ For example:
94
+
95
+ ```js
96
+ class AbortSignal extends EventTarget {
97
+ constructor() {
98
+ this.aborted = false
99
+ }
100
+ }
101
+ // Define `onabort` property.
102
+ defineEventAttribute(AbortSignal.prototype, "abort")
103
+ ```
104
+
105
+ ### EventTarget(types)
106
+
107
+ Define a custom `EventTarget` class with event attributes. This is non-standard.
108
+
109
+ - `types` is a string or an array of strings. This is the event name to define.
110
+
111
+ For example:
112
+
113
+ ```js
114
+ // This has `onabort` property.
115
+ class AbortSignal extends EventTarget("abort") {
116
+ constructor() {
117
+ this.aborted = false
118
+ }
119
+ }
120
+ ```
121
+
122
+ ## 📚 Examples
123
+
124
+ ### ES2015 and later
125
+
126
+ > https://jsfiddle.net/636vea92/
127
+
128
+ ```js
129
+ const {EventTarget, defineEventAttribute} = EventTargetShim
130
+
131
+ // Define a derived class.
132
+ class Foo extends EventTarget {
133
+ // ...
134
+ }
135
+
136
+ // Define `foo.onhello` property.
137
+ defineEventAttribute(Foo.prototype, "hello")
138
+
139
+ // Register event listeners.
140
+ const foo = new Foo()
141
+ foo.addEventListener("hello", (e) => {
142
+ console.log("hello", e)
143
+ })
144
+ foo.onhello = (e) => {
145
+ console.log("onhello", e)
146
+ }
147
+
148
+ // Dispatching events
149
+ foo.dispatchEvent(new CustomEvent("hello", { detail: "detail" }))
150
+ ```
151
+
152
+ ### Typescript
153
+
154
+ ```ts
155
+ import { EventTarget, defineEventAttribute } from "event-target-shim";
156
+
157
+ // Define events
158
+ type FooEvents = {
159
+ hello: CustomEvent
160
+ }
161
+ type FooEventAttributes = {
162
+ onhello: CustomEvent
163
+ }
164
+
165
+ // Define a derived class.
166
+ class Foo extends EventTarget<FooEvents, FooEventAttributes> {
167
+ // ...
168
+ }
169
+ // Define `foo.onhello` property's implementation.
170
+ defineEventAttribute(Foo.prototype, "hello")
171
+
172
+ // Register event listeners.
173
+ const foo = new Foo()
174
+ foo.addEventListener("hello", (e) => {
175
+ console.log("hello", e.detail)
176
+ })
177
+ foo.onhello = (e) => {
178
+ console.log("onhello", e.detail)
179
+ }
180
+
181
+ // Dispatching events
182
+ foo.dispatchEvent(new CustomEvent("hello", { detail: "detail" }))
183
+ ```
184
+
185
+ Unfortunately, both `FooEvents` and `FooEventAttributes` are needed because TypeScript doesn't allow the mutation of string literal types. If TypeScript allowed us to compute `"onhello"` from `"hello"` in types, `FooEventAttributes` will be optional.
186
+
187
+ This `EventTarget` type is compatible with `EventTarget` interface of `lib.dom.d.ts`.
188
+
189
+ #### To disallow unknown events
190
+
191
+ By default, methods such as `addEventListener` accept unknown events. You can disallow unknown events by the third type parameter `"strict"`.
192
+
193
+ ```ts
194
+ type FooEvents = {
195
+ hello: CustomEvent
196
+ }
197
+ class Foo extends EventTarget<FooEvents, {}, "strict"> {
198
+ // ...
199
+ }
200
+
201
+ // OK because `hello` is defined in FooEvents.
202
+ foo.addEventListener("hello", (e) => {
203
+ })
204
+ // Error because `unknown` is not defined in FooEvents.
205
+ foo.addEventListener("unknown", (e) => {
206
+ })
207
+ ```
208
+
209
+ However, if you use `"strict"` parameter, it loses compatibility with `EventTarget` interface of `lib.dom.d.ts`.
210
+
211
+ #### To infer the type of `dispatchEvent()` method
212
+
213
+ TypeScript cannot infer the event type of `dispatchEvent()` method properly from the argument in most cases. You can improve this behavior with the following steps:
214
+
215
+ 1. Use the third type parameter `"strict"`. This prevents inferring to `dispatchEvent<string>()`.
216
+ 2. Make the `type` property of event definitions stricter.
217
+
218
+ ```ts
219
+ type FooEvents = {
220
+ hello: CustomEvent & { type: "hello" }
221
+ hey: Event & { type: "hey" }
222
+ }
223
+ class Foo extends EventTarget<FooEvents, {}, "strict"> {
224
+ // ...
225
+ }
226
+
227
+ // Error because `detail` property is lacking.
228
+ foo.dispatchEvent({ type: "hello" })
229
+ ```
230
+
231
+ ### ES5
232
+
233
+ > https://jsfiddle.net/522zc9de/
234
+
235
+ ```js
236
+ // Define a derived class.
237
+ function Foo() {
238
+ EventTarget.call(this)
239
+ }
240
+ Foo.prototype = Object.create(EventTarget.prototype, {
241
+ constructor: { value: Foo, configurable: true, writable: true }
242
+ // ...
243
+ })
244
+
245
+ // Define `foo.onhello` property.
246
+ defineEventAttribute(Foo.prototype, "hello")
247
+
248
+ // Register event listeners.
249
+ var foo = new Foo()
250
+ foo.addEventListener("hello", function(e) {
251
+ console.log("hello", e)
252
+ })
253
+ foo.onhello = function(e) {
254
+ console.log("onhello", e)
255
+ }
256
+
257
+ // Dispatching events
258
+ function isSupportEventConstrucor() { // IE does not support.
259
+ try {
260
+ new CusomEvent("hello")
261
+ return true
262
+ } catch (_err) {
263
+ return false
264
+ }
265
+ }
266
+ if (isSupportEventConstrucor()) {
267
+ foo.dispatchEvent(new CustomEvent("hello", { detail: "detail" }))
268
+ } else {
269
+ var e = document.createEvent("CustomEvent")
270
+ e.initCustomEvent("hello", false, false, "detail")
271
+ foo.dispatchEvent(e)
272
+ }
273
+ ```
274
+
275
+ ## 📰 Changelog
276
+
277
+ - See [GitHub releases](https://github.com/mysticatea/event-target-shim/releases).
278
+
279
+ ## 🍻 Contributing
280
+
281
+ Contributing is welcome ❤️
282
+
283
+ Please use GitHub issues/PRs.
284
+
285
+ ### Development tools
286
+
287
+ - `npm install` installs dependencies for development.
288
+ - `npm test` runs tests and measures code coverage.
289
+ - `npm run clean` removes temporary files of tests.
290
+ - `npm run coverage` opens code coverage of the previous test with your default browser.
291
+ - `npm run lint` runs ESLint.
292
+ - `npm run build` generates `dist` codes.
293
+ - `npm run watch` runs tests on each file change.
node_modules/event-target-shim/dist/event-target-shim.js ADDED
@@ -0,0 +1,871 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author Toru Nagashima <https://github.com/mysticatea>
3
+ * @copyright 2015 Toru Nagashima. All rights reserved.
4
+ * See LICENSE file in root directory for full license.
5
+ */
6
+ 'use strict';
7
+
8
+ Object.defineProperty(exports, '__esModule', { value: true });
9
+
10
+ /**
11
+ * @typedef {object} PrivateData
12
+ * @property {EventTarget} eventTarget The event target.
13
+ * @property {{type:string}} event The original event object.
14
+ * @property {number} eventPhase The current event phase.
15
+ * @property {EventTarget|null} currentTarget The current event target.
16
+ * @property {boolean} canceled The flag to prevent default.
17
+ * @property {boolean} stopped The flag to stop propagation.
18
+ * @property {boolean} immediateStopped The flag to stop propagation immediately.
19
+ * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.
20
+ * @property {number} timeStamp The unix time.
21
+ * @private
22
+ */
23
+
24
+ /**
25
+ * Private data for event wrappers.
26
+ * @type {WeakMap<Event, PrivateData>}
27
+ * @private
28
+ */
29
+ const privateData = new WeakMap();
30
+
31
+ /**
32
+ * Cache for wrapper classes.
33
+ * @type {WeakMap<Object, Function>}
34
+ * @private
35
+ */
36
+ const wrappers = new WeakMap();
37
+
38
+ /**
39
+ * Get private data.
40
+ * @param {Event} event The event object to get private data.
41
+ * @returns {PrivateData} The private data of the event.
42
+ * @private
43
+ */
44
+ function pd(event) {
45
+ const retv = privateData.get(event);
46
+ console.assert(
47
+ retv != null,
48
+ "'this' is expected an Event object, but got",
49
+ event
50
+ );
51
+ return retv
52
+ }
53
+
54
+ /**
55
+ * https://dom.spec.whatwg.org/#set-the-canceled-flag
56
+ * @param data {PrivateData} private data.
57
+ */
58
+ function setCancelFlag(data) {
59
+ if (data.passiveListener != null) {
60
+ if (
61
+ typeof console !== "undefined" &&
62
+ typeof console.error === "function"
63
+ ) {
64
+ console.error(
65
+ "Unable to preventDefault inside passive event listener invocation.",
66
+ data.passiveListener
67
+ );
68
+ }
69
+ return
70
+ }
71
+ if (!data.event.cancelable) {
72
+ return
73
+ }
74
+
75
+ data.canceled = true;
76
+ if (typeof data.event.preventDefault === "function") {
77
+ data.event.preventDefault();
78
+ }
79
+ }
80
+
81
+ /**
82
+ * @see https://dom.spec.whatwg.org/#interface-event
83
+ * @private
84
+ */
85
+ /**
86
+ * The event wrapper.
87
+ * @constructor
88
+ * @param {EventTarget} eventTarget The event target of this dispatching.
89
+ * @param {Event|{type:string}} event The original event to wrap.
90
+ */
91
+ function Event(eventTarget, event) {
92
+ privateData.set(this, {
93
+ eventTarget,
94
+ event,
95
+ eventPhase: 2,
96
+ currentTarget: eventTarget,
97
+ canceled: false,
98
+ stopped: false,
99
+ immediateStopped: false,
100
+ passiveListener: null,
101
+ timeStamp: event.timeStamp || Date.now(),
102
+ });
103
+
104
+ // https://heycam.github.io/webidl/#Unforgeable
105
+ Object.defineProperty(this, "isTrusted", { value: false, enumerable: true });
106
+
107
+ // Define accessors
108
+ const keys = Object.keys(event);
109
+ for (let i = 0; i < keys.length; ++i) {
110
+ const key = keys[i];
111
+ if (!(key in this)) {
112
+ Object.defineProperty(this, key, defineRedirectDescriptor(key));
113
+ }
114
+ }
115
+ }
116
+
117
+ // Should be enumerable, but class methods are not enumerable.
118
+ Event.prototype = {
119
+ /**
120
+ * The type of this event.
121
+ * @type {string}
122
+ */
123
+ get type() {
124
+ return pd(this).event.type
125
+ },
126
+
127
+ /**
128
+ * The target of this event.
129
+ * @type {EventTarget}
130
+ */
131
+ get target() {
132
+ return pd(this).eventTarget
133
+ },
134
+
135
+ /**
136
+ * The target of this event.
137
+ * @type {EventTarget}
138
+ */
139
+ get currentTarget() {
140
+ return pd(this).currentTarget
141
+ },
142
+
143
+ /**
144
+ * @returns {EventTarget[]} The composed path of this event.
145
+ */
146
+ composedPath() {
147
+ const currentTarget = pd(this).currentTarget;
148
+ if (currentTarget == null) {
149
+ return []
150
+ }
151
+ return [currentTarget]
152
+ },
153
+
154
+ /**
155
+ * Constant of NONE.
156
+ * @type {number}
157
+ */
158
+ get NONE() {
159
+ return 0
160
+ },
161
+
162
+ /**
163
+ * Constant of CAPTURING_PHASE.
164
+ * @type {number}
165
+ */
166
+ get CAPTURING_PHASE() {
167
+ return 1
168
+ },
169
+
170
+ /**
171
+ * Constant of AT_TARGET.
172
+ * @type {number}
173
+ */
174
+ get AT_TARGET() {
175
+ return 2
176
+ },
177
+
178
+ /**
179
+ * Constant of BUBBLING_PHASE.
180
+ * @type {number}
181
+ */
182
+ get BUBBLING_PHASE() {
183
+ return 3
184
+ },
185
+
186
+ /**
187
+ * The target of this event.
188
+ * @type {number}
189
+ */
190
+ get eventPhase() {
191
+ return pd(this).eventPhase
192
+ },
193
+
194
+ /**
195
+ * Stop event bubbling.
196
+ * @returns {void}
197
+ */
198
+ stopPropagation() {
199
+ const data = pd(this);
200
+
201
+ data.stopped = true;
202
+ if (typeof data.event.stopPropagation === "function") {
203
+ data.event.stopPropagation();
204
+ }
205
+ },
206
+
207
+ /**
208
+ * Stop event bubbling.
209
+ * @returns {void}
210
+ */
211
+ stopImmediatePropagation() {
212
+ const data = pd(this);
213
+
214
+ data.stopped = true;
215
+ data.immediateStopped = true;
216
+ if (typeof data.event.stopImmediatePropagation === "function") {
217
+ data.event.stopImmediatePropagation();
218
+ }
219
+ },
220
+
221
+ /**
222
+ * The flag to be bubbling.
223
+ * @type {boolean}
224
+ */
225
+ get bubbles() {
226
+ return Boolean(pd(this).event.bubbles)
227
+ },
228
+
229
+ /**
230
+ * The flag to be cancelable.
231
+ * @type {boolean}
232
+ */
233
+ get cancelable() {
234
+ return Boolean(pd(this).event.cancelable)
235
+ },
236
+
237
+ /**
238
+ * Cancel this event.
239
+ * @returns {void}
240
+ */
241
+ preventDefault() {
242
+ setCancelFlag(pd(this));
243
+ },
244
+
245
+ /**
246
+ * The flag to indicate cancellation state.
247
+ * @type {boolean}
248
+ */
249
+ get defaultPrevented() {
250
+ return pd(this).canceled
251
+ },
252
+
253
+ /**
254
+ * The flag to be composed.
255
+ * @type {boolean}
256
+ */
257
+ get composed() {
258
+ return Boolean(pd(this).event.composed)
259
+ },
260
+
261
+ /**
262
+ * The unix time of this event.
263
+ * @type {number}
264
+ */
265
+ get timeStamp() {
266
+ return pd(this).timeStamp
267
+ },
268
+
269
+ /**
270
+ * The target of this event.
271
+ * @type {EventTarget}
272
+ * @deprecated
273
+ */
274
+ get srcElement() {
275
+ return pd(this).eventTarget
276
+ },
277
+
278
+ /**
279
+ * The flag to stop event bubbling.
280
+ * @type {boolean}
281
+ * @deprecated
282
+ */
283
+ get cancelBubble() {
284
+ return pd(this).stopped
285
+ },
286
+ set cancelBubble(value) {
287
+ if (!value) {
288
+ return
289
+ }
290
+ const data = pd(this);
291
+
292
+ data.stopped = true;
293
+ if (typeof data.event.cancelBubble === "boolean") {
294
+ data.event.cancelBubble = true;
295
+ }
296
+ },
297
+
298
+ /**
299
+ * The flag to indicate cancellation state.
300
+ * @type {boolean}
301
+ * @deprecated
302
+ */
303
+ get returnValue() {
304
+ return !pd(this).canceled
305
+ },
306
+ set returnValue(value) {
307
+ if (!value) {
308
+ setCancelFlag(pd(this));
309
+ }
310
+ },
311
+
312
+ /**
313
+ * Initialize this event object. But do nothing under event dispatching.
314
+ * @param {string} type The event type.
315
+ * @param {boolean} [bubbles=false] The flag to be possible to bubble up.
316
+ * @param {boolean} [cancelable=false] The flag to be possible to cancel.
317
+ * @deprecated
318
+ */
319
+ initEvent() {
320
+ // Do nothing.
321
+ },
322
+ };
323
+
324
+ // `constructor` is not enumerable.
325
+ Object.defineProperty(Event.prototype, "constructor", {
326
+ value: Event,
327
+ configurable: true,
328
+ writable: true,
329
+ });
330
+
331
+ // Ensure `event instanceof window.Event` is `true`.
332
+ if (typeof window !== "undefined" && typeof window.Event !== "undefined") {
333
+ Object.setPrototypeOf(Event.prototype, window.Event.prototype);
334
+
335
+ // Make association for wrappers.
336
+ wrappers.set(window.Event.prototype, Event);
337
+ }
338
+
339
+ /**
340
+ * Get the property descriptor to redirect a given property.
341
+ * @param {string} key Property name to define property descriptor.
342
+ * @returns {PropertyDescriptor} The property descriptor to redirect the property.
343
+ * @private
344
+ */
345
+ function defineRedirectDescriptor(key) {
346
+ return {
347
+ get() {
348
+ return pd(this).event[key]
349
+ },
350
+ set(value) {
351
+ pd(this).event[key] = value;
352
+ },
353
+ configurable: true,
354
+ enumerable: true,
355
+ }
356
+ }
357
+
358
+ /**
359
+ * Get the property descriptor to call a given method property.
360
+ * @param {string} key Property name to define property descriptor.
361
+ * @returns {PropertyDescriptor} The property descriptor to call the method property.
362
+ * @private
363
+ */
364
+ function defineCallDescriptor(key) {
365
+ return {
366
+ value() {
367
+ const event = pd(this).event;
368
+ return event[key].apply(event, arguments)
369
+ },
370
+ configurable: true,
371
+ enumerable: true,
372
+ }
373
+ }
374
+
375
+ /**
376
+ * Define new wrapper class.
377
+ * @param {Function} BaseEvent The base wrapper class.
378
+ * @param {Object} proto The prototype of the original event.
379
+ * @returns {Function} The defined wrapper class.
380
+ * @private
381
+ */
382
+ function defineWrapper(BaseEvent, proto) {
383
+ const keys = Object.keys(proto);
384
+ if (keys.length === 0) {
385
+ return BaseEvent
386
+ }
387
+
388
+ /** CustomEvent */
389
+ function CustomEvent(eventTarget, event) {
390
+ BaseEvent.call(this, eventTarget, event);
391
+ }
392
+
393
+ CustomEvent.prototype = Object.create(BaseEvent.prototype, {
394
+ constructor: { value: CustomEvent, configurable: true, writable: true },
395
+ });
396
+
397
+ // Define accessors.
398
+ for (let i = 0; i < keys.length; ++i) {
399
+ const key = keys[i];
400
+ if (!(key in BaseEvent.prototype)) {
401
+ const descriptor = Object.getOwnPropertyDescriptor(proto, key);
402
+ const isFunc = typeof descriptor.value === "function";
403
+ Object.defineProperty(
404
+ CustomEvent.prototype,
405
+ key,
406
+ isFunc
407
+ ? defineCallDescriptor(key)
408
+ : defineRedirectDescriptor(key)
409
+ );
410
+ }
411
+ }
412
+
413
+ return CustomEvent
414
+ }
415
+
416
+ /**
417
+ * Get the wrapper class of a given prototype.
418
+ * @param {Object} proto The prototype of the original event to get its wrapper.
419
+ * @returns {Function} The wrapper class.
420
+ * @private
421
+ */
422
+ function getWrapper(proto) {
423
+ if (proto == null || proto === Object.prototype) {
424
+ return Event
425
+ }
426
+
427
+ let wrapper = wrappers.get(proto);
428
+ if (wrapper == null) {
429
+ wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto);
430
+ wrappers.set(proto, wrapper);
431
+ }
432
+ return wrapper
433
+ }
434
+
435
+ /**
436
+ * Wrap a given event to management a dispatching.
437
+ * @param {EventTarget} eventTarget The event target of this dispatching.
438
+ * @param {Object} event The event to wrap.
439
+ * @returns {Event} The wrapper instance.
440
+ * @private
441
+ */
442
+ function wrapEvent(eventTarget, event) {
443
+ const Wrapper = getWrapper(Object.getPrototypeOf(event));
444
+ return new Wrapper(eventTarget, event)
445
+ }
446
+
447
+ /**
448
+ * Get the immediateStopped flag of a given event.
449
+ * @param {Event} event The event to get.
450
+ * @returns {boolean} The flag to stop propagation immediately.
451
+ * @private
452
+ */
453
+ function isStopped(event) {
454
+ return pd(event).immediateStopped
455
+ }
456
+
457
+ /**
458
+ * Set the current event phase of a given event.
459
+ * @param {Event} event The event to set current target.
460
+ * @param {number} eventPhase New event phase.
461
+ * @returns {void}
462
+ * @private
463
+ */
464
+ function setEventPhase(event, eventPhase) {
465
+ pd(event).eventPhase = eventPhase;
466
+ }
467
+
468
+ /**
469
+ * Set the current target of a given event.
470
+ * @param {Event} event The event to set current target.
471
+ * @param {EventTarget|null} currentTarget New current target.
472
+ * @returns {void}
473
+ * @private
474
+ */
475
+ function setCurrentTarget(event, currentTarget) {
476
+ pd(event).currentTarget = currentTarget;
477
+ }
478
+
479
+ /**
480
+ * Set a passive listener of a given event.
481
+ * @param {Event} event The event to set current target.
482
+ * @param {Function|null} passiveListener New passive listener.
483
+ * @returns {void}
484
+ * @private
485
+ */
486
+ function setPassiveListener(event, passiveListener) {
487
+ pd(event).passiveListener = passiveListener;
488
+ }
489
+
490
+ /**
491
+ * @typedef {object} ListenerNode
492
+ * @property {Function} listener
493
+ * @property {1|2|3} listenerType
494
+ * @property {boolean} passive
495
+ * @property {boolean} once
496
+ * @property {ListenerNode|null} next
497
+ * @private
498
+ */
499
+
500
+ /**
501
+ * @type {WeakMap<object, Map<string, ListenerNode>>}
502
+ * @private
503
+ */
504
+ const listenersMap = new WeakMap();
505
+
506
+ // Listener types
507
+ const CAPTURE = 1;
508
+ const BUBBLE = 2;
509
+ const ATTRIBUTE = 3;
510
+
511
+ /**
512
+ * Check whether a given value is an object or not.
513
+ * @param {any} x The value to check.
514
+ * @returns {boolean} `true` if the value is an object.
515
+ */
516
+ function isObject(x) {
517
+ return x !== null && typeof x === "object" //eslint-disable-line no-restricted-syntax
518
+ }
519
+
520
+ /**
521
+ * Get listeners.
522
+ * @param {EventTarget} eventTarget The event target to get.
523
+ * @returns {Map<string, ListenerNode>} The listeners.
524
+ * @private
525
+ */
526
+ function getListeners(eventTarget) {
527
+ const listeners = listenersMap.get(eventTarget);
528
+ if (listeners == null) {
529
+ throw new TypeError(
530
+ "'this' is expected an EventTarget object, but got another value."
531
+ )
532
+ }
533
+ return listeners
534
+ }
535
+
536
+ /**
537
+ * Get the property descriptor for the event attribute of a given event.
538
+ * @param {string} eventName The event name to get property descriptor.
539
+ * @returns {PropertyDescriptor} The property descriptor.
540
+ * @private
541
+ */
542
+ function defineEventAttributeDescriptor(eventName) {
543
+ return {
544
+ get() {
545
+ const listeners = getListeners(this);
546
+ let node = listeners.get(eventName);
547
+ while (node != null) {
548
+ if (node.listenerType === ATTRIBUTE) {
549
+ return node.listener
550
+ }
551
+ node = node.next;
552
+ }
553
+ return null
554
+ },
555
+
556
+ set(listener) {
557
+ if (typeof listener !== "function" && !isObject(listener)) {
558
+ listener = null; // eslint-disable-line no-param-reassign
559
+ }
560
+ const listeners = getListeners(this);
561
+
562
+ // Traverse to the tail while removing old value.
563
+ let prev = null;
564
+ let node = listeners.get(eventName);
565
+ while (node != null) {
566
+ if (node.listenerType === ATTRIBUTE) {
567
+ // Remove old value.
568
+ if (prev !== null) {
569
+ prev.next = node.next;
570
+ } else if (node.next !== null) {
571
+ listeners.set(eventName, node.next);
572
+ } else {
573
+ listeners.delete(eventName);
574
+ }
575
+ } else {
576
+ prev = node;
577
+ }
578
+
579
+ node = node.next;
580
+ }
581
+
582
+ // Add new value.
583
+ if (listener !== null) {
584
+ const newNode = {
585
+ listener,
586
+ listenerType: ATTRIBUTE,
587
+ passive: false,
588
+ once: false,
589
+ next: null,
590
+ };
591
+ if (prev === null) {
592
+ listeners.set(eventName, newNode);
593
+ } else {
594
+ prev.next = newNode;
595
+ }
596
+ }
597
+ },
598
+ configurable: true,
599
+ enumerable: true,
600
+ }
601
+ }
602
+
603
+ /**
604
+ * Define an event attribute (e.g. `eventTarget.onclick`).
605
+ * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.
606
+ * @param {string} eventName The event name to define.
607
+ * @returns {void}
608
+ */
609
+ function defineEventAttribute(eventTargetPrototype, eventName) {
610
+ Object.defineProperty(
611
+ eventTargetPrototype,
612
+ `on${eventName}`,
613
+ defineEventAttributeDescriptor(eventName)
614
+ );
615
+ }
616
+
617
+ /**
618
+ * Define a custom EventTarget with event attributes.
619
+ * @param {string[]} eventNames Event names for event attributes.
620
+ * @returns {EventTarget} The custom EventTarget.
621
+ * @private
622
+ */
623
+ function defineCustomEventTarget(eventNames) {
624
+ /** CustomEventTarget */
625
+ function CustomEventTarget() {
626
+ EventTarget.call(this);
627
+ }
628
+
629
+ CustomEventTarget.prototype = Object.create(EventTarget.prototype, {
630
+ constructor: {
631
+ value: CustomEventTarget,
632
+ configurable: true,
633
+ writable: true,
634
+ },
635
+ });
636
+
637
+ for (let i = 0; i < eventNames.length; ++i) {
638
+ defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);
639
+ }
640
+
641
+ return CustomEventTarget
642
+ }
643
+
644
+ /**
645
+ * EventTarget.
646
+ *
647
+ * - This is constructor if no arguments.
648
+ * - This is a function which returns a CustomEventTarget constructor if there are arguments.
649
+ *
650
+ * For example:
651
+ *
652
+ * class A extends EventTarget {}
653
+ * class B extends EventTarget("message") {}
654
+ * class C extends EventTarget("message", "error") {}
655
+ * class D extends EventTarget(["message", "error"]) {}
656
+ */
657
+ function EventTarget() {
658
+ /*eslint-disable consistent-return */
659
+ if (this instanceof EventTarget) {
660
+ listenersMap.set(this, new Map());
661
+ return
662
+ }
663
+ if (arguments.length === 1 && Array.isArray(arguments[0])) {
664
+ return defineCustomEventTarget(arguments[0])
665
+ }
666
+ if (arguments.length > 0) {
667
+ const types = new Array(arguments.length);
668
+ for (let i = 0; i < arguments.length; ++i) {
669
+ types[i] = arguments[i];
670
+ }
671
+ return defineCustomEventTarget(types)
672
+ }
673
+ throw new TypeError("Cannot call a class as a function")
674
+ /*eslint-enable consistent-return */
675
+ }
676
+
677
+ // Should be enumerable, but class methods are not enumerable.
678
+ EventTarget.prototype = {
679
+ /**
680
+ * Add a given listener to this event target.
681
+ * @param {string} eventName The event name to add.
682
+ * @param {Function} listener The listener to add.
683
+ * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
684
+ * @returns {void}
685
+ */
686
+ addEventListener(eventName, listener, options) {
687
+ if (listener == null) {
688
+ return
689
+ }
690
+ if (typeof listener !== "function" && !isObject(listener)) {
691
+ throw new TypeError("'listener' should be a function or an object.")
692
+ }
693
+
694
+ const listeners = getListeners(this);
695
+ const optionsIsObj = isObject(options);
696
+ const capture = optionsIsObj
697
+ ? Boolean(options.capture)
698
+ : Boolean(options);
699
+ const listenerType = capture ? CAPTURE : BUBBLE;
700
+ const newNode = {
701
+ listener,
702
+ listenerType,
703
+ passive: optionsIsObj && Boolean(options.passive),
704
+ once: optionsIsObj && Boolean(options.once),
705
+ next: null,
706
+ };
707
+
708
+ // Set it as the first node if the first node is null.
709
+ let node = listeners.get(eventName);
710
+ if (node === undefined) {
711
+ listeners.set(eventName, newNode);
712
+ return
713
+ }
714
+
715
+ // Traverse to the tail while checking duplication..
716
+ let prev = null;
717
+ while (node != null) {
718
+ if (
719
+ node.listener === listener &&
720
+ node.listenerType === listenerType
721
+ ) {
722
+ // Should ignore duplication.
723
+ return
724
+ }
725
+ prev = node;
726
+ node = node.next;
727
+ }
728
+
729
+ // Add it.
730
+ prev.next = newNode;
731
+ },
732
+
733
+ /**
734
+ * Remove a given listener from this event target.
735
+ * @param {string} eventName The event name to remove.
736
+ * @param {Function} listener The listener to remove.
737
+ * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
738
+ * @returns {void}
739
+ */
740
+ removeEventListener(eventName, listener, options) {
741
+ if (listener == null) {
742
+ return
743
+ }
744
+
745
+ const listeners = getListeners(this);
746
+ const capture = isObject(options)
747
+ ? Boolean(options.capture)
748
+ : Boolean(options);
749
+ const listenerType = capture ? CAPTURE : BUBBLE;
750
+
751
+ let prev = null;
752
+ let node = listeners.get(eventName);
753
+ while (node != null) {
754
+ if (
755
+ node.listener === listener &&
756
+ node.listenerType === listenerType
757
+ ) {
758
+ if (prev !== null) {
759
+ prev.next = node.next;
760
+ } else if (node.next !== null) {
761
+ listeners.set(eventName, node.next);
762
+ } else {
763
+ listeners.delete(eventName);
764
+ }
765
+ return
766
+ }
767
+
768
+ prev = node;
769
+ node = node.next;
770
+ }
771
+ },
772
+
773
+ /**
774
+ * Dispatch a given event.
775
+ * @param {Event|{type:string}} event The event to dispatch.
776
+ * @returns {boolean} `false` if canceled.
777
+ */
778
+ dispatchEvent(event) {
779
+ if (event == null || typeof event.type !== "string") {
780
+ throw new TypeError('"event.type" should be a string.')
781
+ }
782
+
783
+ // If listeners aren't registered, terminate.
784
+ const listeners = getListeners(this);
785
+ const eventName = event.type;
786
+ let node = listeners.get(eventName);
787
+ if (node == null) {
788
+ return true
789
+ }
790
+
791
+ // Since we cannot rewrite several properties, so wrap object.
792
+ const wrappedEvent = wrapEvent(this, event);
793
+
794
+ // This doesn't process capturing phase and bubbling phase.
795
+ // This isn't participating in a tree.
796
+ let prev = null;
797
+ while (node != null) {
798
+ // Remove this listener if it's once
799
+ if (node.once) {
800
+ if (prev !== null) {
801
+ prev.next = node.next;
802
+ } else if (node.next !== null) {
803
+ listeners.set(eventName, node.next);
804
+ } else {
805
+ listeners.delete(eventName);
806
+ }
807
+ } else {
808
+ prev = node;
809
+ }
810
+
811
+ // Call this listener
812
+ setPassiveListener(
813
+ wrappedEvent,
814
+ node.passive ? node.listener : null
815
+ );
816
+ if (typeof node.listener === "function") {
817
+ try {
818
+ node.listener.call(this, wrappedEvent);
819
+ } catch (err) {
820
+ if (
821
+ typeof console !== "undefined" &&
822
+ typeof console.error === "function"
823
+ ) {
824
+ console.error(err);
825
+ }
826
+ }
827
+ } else if (
828
+ node.listenerType !== ATTRIBUTE &&
829
+ typeof node.listener.handleEvent === "function"
830
+ ) {
831
+ node.listener.handleEvent(wrappedEvent);
832
+ }
833
+
834
+ // Break if `event.stopImmediatePropagation` was called.
835
+ if (isStopped(wrappedEvent)) {
836
+ break
837
+ }
838
+
839
+ node = node.next;
840
+ }
841
+ setPassiveListener(wrappedEvent, null);
842
+ setEventPhase(wrappedEvent, 0);
843
+ setCurrentTarget(wrappedEvent, null);
844
+
845
+ return !wrappedEvent.defaultPrevented
846
+ },
847
+ };
848
+
849
+ // `constructor` is not enumerable.
850
+ Object.defineProperty(EventTarget.prototype, "constructor", {
851
+ value: EventTarget,
852
+ configurable: true,
853
+ writable: true,
854
+ });
855
+
856
+ // Ensure `eventTarget instanceof window.EventTarget` is `true`.
857
+ if (
858
+ typeof window !== "undefined" &&
859
+ typeof window.EventTarget !== "undefined"
860
+ ) {
861
+ Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype);
862
+ }
863
+
864
+ exports.defineEventAttribute = defineEventAttribute;
865
+ exports.EventTarget = EventTarget;
866
+ exports.default = EventTarget;
867
+
868
+ module.exports = EventTarget
869
+ module.exports.EventTarget = module.exports["default"] = EventTarget
870
+ module.exports.defineEventAttribute = defineEventAttribute
871
+ //# sourceMappingURL=event-target-shim.js.map
node_modules/event-target-shim/dist/event-target-shim.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"event-target-shim.js","sources":["../src/event.mjs","../src/event-target.mjs"],"sourcesContent":["/**\n * @typedef {object} PrivateData\n * @property {EventTarget} eventTarget The event target.\n * @property {{type:string}} event The original event object.\n * @property {number} eventPhase The current event phase.\n * @property {EventTarget|null} currentTarget The current event target.\n * @property {boolean} canceled The flag to prevent default.\n * @property {boolean} stopped The flag to stop propagation.\n * @property {boolean} immediateStopped The flag to stop propagation immediately.\n * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.\n * @property {number} timeStamp The unix time.\n * @private\n */\n\n/**\n * Private data for event wrappers.\n * @type {WeakMap<Event, PrivateData>}\n * @private\n */\nconst privateData = new WeakMap()\n\n/**\n * Cache for wrapper classes.\n * @type {WeakMap<Object, Function>}\n * @private\n */\nconst wrappers = new WeakMap()\n\n/**\n * Get private data.\n * @param {Event} event The event object to get private data.\n * @returns {PrivateData} The private data of the event.\n * @private\n */\nfunction pd(event) {\n const retv = privateData.get(event)\n console.assert(\n retv != null,\n \"'this' is expected an Event object, but got\",\n event\n )\n return retv\n}\n\n/**\n * https://dom.spec.whatwg.org/#set-the-canceled-flag\n * @param data {PrivateData} private data.\n */\nfunction setCancelFlag(data) {\n if (data.passiveListener != null) {\n if (\n typeof console !== \"undefined\" &&\n typeof console.error === \"function\"\n ) {\n console.error(\n \"Unable to preventDefault inside passive event listener invocation.\",\n data.passiveListener\n )\n }\n return\n }\n if (!data.event.cancelable) {\n return\n }\n\n data.canceled = true\n if (typeof data.event.preventDefault === \"function\") {\n data.event.preventDefault()\n }\n}\n\n/**\n * @see https://dom.spec.whatwg.org/#interface-event\n * @private\n */\n/**\n * The event wrapper.\n * @constructor\n * @param {EventTarget} eventTarget The event target of this dispatching.\n * @param {Event|{type:string}} event The original event to wrap.\n */\nfunction Event(eventTarget, event) {\n privateData.set(this, {\n eventTarget,\n event,\n eventPhase: 2,\n currentTarget: eventTarget,\n canceled: false,\n stopped: false,\n immediateStopped: false,\n passiveListener: null,\n timeStamp: event.timeStamp || Date.now(),\n })\n\n // https://heycam.github.io/webidl/#Unforgeable\n Object.defineProperty(this, \"isTrusted\", { value: false, enumerable: true })\n\n // Define accessors\n const keys = Object.keys(event)\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i]\n if (!(key in this)) {\n Object.defineProperty(this, key, defineRedirectDescriptor(key))\n }\n }\n}\n\n// Should be enumerable, but class methods are not enumerable.\nEvent.prototype = {\n /**\n * The type of this event.\n * @type {string}\n */\n get type() {\n return pd(this).event.type\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get target() {\n return pd(this).eventTarget\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get currentTarget() {\n return pd(this).currentTarget\n },\n\n /**\n * @returns {EventTarget[]} The composed path of this event.\n */\n composedPath() {\n const currentTarget = pd(this).currentTarget\n if (currentTarget == null) {\n return []\n }\n return [currentTarget]\n },\n\n /**\n * Constant of NONE.\n * @type {number}\n */\n get NONE() {\n return 0\n },\n\n /**\n * Constant of CAPTURING_PHASE.\n * @type {number}\n */\n get CAPTURING_PHASE() {\n return 1\n },\n\n /**\n * Constant of AT_TARGET.\n * @type {number}\n */\n get AT_TARGET() {\n return 2\n },\n\n /**\n * Constant of BUBBLING_PHASE.\n * @type {number}\n */\n get BUBBLING_PHASE() {\n return 3\n },\n\n /**\n * The target of this event.\n * @type {number}\n */\n get eventPhase() {\n return pd(this).eventPhase\n },\n\n /**\n * Stop event bubbling.\n * @returns {void}\n */\n stopPropagation() {\n const data = pd(this)\n\n data.stopped = true\n if (typeof data.event.stopPropagation === \"function\") {\n data.event.stopPropagation()\n }\n },\n\n /**\n * Stop event bubbling.\n * @returns {void}\n */\n stopImmediatePropagation() {\n const data = pd(this)\n\n data.stopped = true\n data.immediateStopped = true\n if (typeof data.event.stopImmediatePropagation === \"function\") {\n data.event.stopImmediatePropagation()\n }\n },\n\n /**\n * The flag to be bubbling.\n * @type {boolean}\n */\n get bubbles() {\n return Boolean(pd(this).event.bubbles)\n },\n\n /**\n * The flag to be cancelable.\n * @type {boolean}\n */\n get cancelable() {\n return Boolean(pd(this).event.cancelable)\n },\n\n /**\n * Cancel this event.\n * @returns {void}\n */\n preventDefault() {\n setCancelFlag(pd(this))\n },\n\n /**\n * The flag to indicate cancellation state.\n * @type {boolean}\n */\n get defaultPrevented() {\n return pd(this).canceled\n },\n\n /**\n * The flag to be composed.\n * @type {boolean}\n */\n get composed() {\n return Boolean(pd(this).event.composed)\n },\n\n /**\n * The unix time of this event.\n * @type {number}\n */\n get timeStamp() {\n return pd(this).timeStamp\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n * @deprecated\n */\n get srcElement() {\n return pd(this).eventTarget\n },\n\n /**\n * The flag to stop event bubbling.\n * @type {boolean}\n * @deprecated\n */\n get cancelBubble() {\n return pd(this).stopped\n },\n set cancelBubble(value) {\n if (!value) {\n return\n }\n const data = pd(this)\n\n data.stopped = true\n if (typeof data.event.cancelBubble === \"boolean\") {\n data.event.cancelBubble = true\n }\n },\n\n /**\n * The flag to indicate cancellation state.\n * @type {boolean}\n * @deprecated\n */\n get returnValue() {\n return !pd(this).canceled\n },\n set returnValue(value) {\n if (!value) {\n setCancelFlag(pd(this))\n }\n },\n\n /**\n * Initialize this event object. But do nothing under event dispatching.\n * @param {string} type The event type.\n * @param {boolean} [bubbles=false] The flag to be possible to bubble up.\n * @param {boolean} [cancelable=false] The flag to be possible to cancel.\n * @deprecated\n */\n initEvent() {\n // Do nothing.\n },\n}\n\n// `constructor` is not enumerable.\nObject.defineProperty(Event.prototype, \"constructor\", {\n value: Event,\n configurable: true,\n writable: true,\n})\n\n// Ensure `event instanceof window.Event` is `true`.\nif (typeof window !== \"undefined\" && typeof window.Event !== \"undefined\") {\n Object.setPrototypeOf(Event.prototype, window.Event.prototype)\n\n // Make association for wrappers.\n wrappers.set(window.Event.prototype, Event)\n}\n\n/**\n * Get the property descriptor to redirect a given property.\n * @param {string} key Property name to define property descriptor.\n * @returns {PropertyDescriptor} The property descriptor to redirect the property.\n * @private\n */\nfunction defineRedirectDescriptor(key) {\n return {\n get() {\n return pd(this).event[key]\n },\n set(value) {\n pd(this).event[key] = value\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Get the property descriptor to call a given method property.\n * @param {string} key Property name to define property descriptor.\n * @returns {PropertyDescriptor} The property descriptor to call the method property.\n * @private\n */\nfunction defineCallDescriptor(key) {\n return {\n value() {\n const event = pd(this).event\n return event[key].apply(event, arguments)\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Define new wrapper class.\n * @param {Function} BaseEvent The base wrapper class.\n * @param {Object} proto The prototype of the original event.\n * @returns {Function} The defined wrapper class.\n * @private\n */\nfunction defineWrapper(BaseEvent, proto) {\n const keys = Object.keys(proto)\n if (keys.length === 0) {\n return BaseEvent\n }\n\n /** CustomEvent */\n function CustomEvent(eventTarget, event) {\n BaseEvent.call(this, eventTarget, event)\n }\n\n CustomEvent.prototype = Object.create(BaseEvent.prototype, {\n constructor: { value: CustomEvent, configurable: true, writable: true },\n })\n\n // Define accessors.\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i]\n if (!(key in BaseEvent.prototype)) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, key)\n const isFunc = typeof descriptor.value === \"function\"\n Object.defineProperty(\n CustomEvent.prototype,\n key,\n isFunc\n ? defineCallDescriptor(key)\n : defineRedirectDescriptor(key)\n )\n }\n }\n\n return CustomEvent\n}\n\n/**\n * Get the wrapper class of a given prototype.\n * @param {Object} proto The prototype of the original event to get its wrapper.\n * @returns {Function} The wrapper class.\n * @private\n */\nfunction getWrapper(proto) {\n if (proto == null || proto === Object.prototype) {\n return Event\n }\n\n let wrapper = wrappers.get(proto)\n if (wrapper == null) {\n wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto)\n wrappers.set(proto, wrapper)\n }\n return wrapper\n}\n\n/**\n * Wrap a given event to management a dispatching.\n * @param {EventTarget} eventTarget The event target of this dispatching.\n * @param {Object} event The event to wrap.\n * @returns {Event} The wrapper instance.\n * @private\n */\nexport function wrapEvent(eventTarget, event) {\n const Wrapper = getWrapper(Object.getPrototypeOf(event))\n return new Wrapper(eventTarget, event)\n}\n\n/**\n * Get the immediateStopped flag of a given event.\n * @param {Event} event The event to get.\n * @returns {boolean} The flag to stop propagation immediately.\n * @private\n */\nexport function isStopped(event) {\n return pd(event).immediateStopped\n}\n\n/**\n * Set the current event phase of a given event.\n * @param {Event} event The event to set current target.\n * @param {number} eventPhase New event phase.\n * @returns {void}\n * @private\n */\nexport function setEventPhase(event, eventPhase) {\n pd(event).eventPhase = eventPhase\n}\n\n/**\n * Set the current target of a given event.\n * @param {Event} event The event to set current target.\n * @param {EventTarget|null} currentTarget New current target.\n * @returns {void}\n * @private\n */\nexport function setCurrentTarget(event, currentTarget) {\n pd(event).currentTarget = currentTarget\n}\n\n/**\n * Set a passive listener of a given event.\n * @param {Event} event The event to set current target.\n * @param {Function|null} passiveListener New passive listener.\n * @returns {void}\n * @private\n */\nexport function setPassiveListener(event, passiveListener) {\n pd(event).passiveListener = passiveListener\n}\n","import {\n isStopped,\n setCurrentTarget,\n setEventPhase,\n setPassiveListener,\n wrapEvent,\n} from \"./event.mjs\"\n\n/**\n * @typedef {object} ListenerNode\n * @property {Function} listener\n * @property {1|2|3} listenerType\n * @property {boolean} passive\n * @property {boolean} once\n * @property {ListenerNode|null} next\n * @private\n */\n\n/**\n * @type {WeakMap<object, Map<string, ListenerNode>>}\n * @private\n */\nconst listenersMap = new WeakMap()\n\n// Listener types\nconst CAPTURE = 1\nconst BUBBLE = 2\nconst ATTRIBUTE = 3\n\n/**\n * Check whether a given value is an object or not.\n * @param {any} x The value to check.\n * @returns {boolean} `true` if the value is an object.\n */\nfunction isObject(x) {\n return x !== null && typeof x === \"object\" //eslint-disable-line no-restricted-syntax\n}\n\n/**\n * Get listeners.\n * @param {EventTarget} eventTarget The event target to get.\n * @returns {Map<string, ListenerNode>} The listeners.\n * @private\n */\nfunction getListeners(eventTarget) {\n const listeners = listenersMap.get(eventTarget)\n if (listeners == null) {\n throw new TypeError(\n \"'this' is expected an EventTarget object, but got another value.\"\n )\n }\n return listeners\n}\n\n/**\n * Get the property descriptor for the event attribute of a given event.\n * @param {string} eventName The event name to get property descriptor.\n * @returns {PropertyDescriptor} The property descriptor.\n * @private\n */\nfunction defineEventAttributeDescriptor(eventName) {\n return {\n get() {\n const listeners = getListeners(this)\n let node = listeners.get(eventName)\n while (node != null) {\n if (node.listenerType === ATTRIBUTE) {\n return node.listener\n }\n node = node.next\n }\n return null\n },\n\n set(listener) {\n if (typeof listener !== \"function\" && !isObject(listener)) {\n listener = null // eslint-disable-line no-param-reassign\n }\n const listeners = getListeners(this)\n\n // Traverse to the tail while removing old value.\n let prev = null\n let node = listeners.get(eventName)\n while (node != null) {\n if (node.listenerType === ATTRIBUTE) {\n // Remove old value.\n if (prev !== null) {\n prev.next = node.next\n } else if (node.next !== null) {\n listeners.set(eventName, node.next)\n } else {\n listeners.delete(eventName)\n }\n } else {\n prev = node\n }\n\n node = node.next\n }\n\n // Add new value.\n if (listener !== null) {\n const newNode = {\n listener,\n listenerType: ATTRIBUTE,\n passive: false,\n once: false,\n next: null,\n }\n if (prev === null) {\n listeners.set(eventName, newNode)\n } else {\n prev.next = newNode\n }\n }\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Define an event attribute (e.g. `eventTarget.onclick`).\n * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.\n * @param {string} eventName The event name to define.\n * @returns {void}\n */\nfunction defineEventAttribute(eventTargetPrototype, eventName) {\n Object.defineProperty(\n eventTargetPrototype,\n `on${eventName}`,\n defineEventAttributeDescriptor(eventName)\n )\n}\n\n/**\n * Define a custom EventTarget with event attributes.\n * @param {string[]} eventNames Event names for event attributes.\n * @returns {EventTarget} The custom EventTarget.\n * @private\n */\nfunction defineCustomEventTarget(eventNames) {\n /** CustomEventTarget */\n function CustomEventTarget() {\n EventTarget.call(this)\n }\n\n CustomEventTarget.prototype = Object.create(EventTarget.prototype, {\n constructor: {\n value: CustomEventTarget,\n configurable: true,\n writable: true,\n },\n })\n\n for (let i = 0; i < eventNames.length; ++i) {\n defineEventAttribute(CustomEventTarget.prototype, eventNames[i])\n }\n\n return CustomEventTarget\n}\n\n/**\n * EventTarget.\n *\n * - This is constructor if no arguments.\n * - This is a function which returns a CustomEventTarget constructor if there are arguments.\n *\n * For example:\n *\n * class A extends EventTarget {}\n * class B extends EventTarget(\"message\") {}\n * class C extends EventTarget(\"message\", \"error\") {}\n * class D extends EventTarget([\"message\", \"error\"]) {}\n */\nfunction EventTarget() {\n /*eslint-disable consistent-return */\n if (this instanceof EventTarget) {\n listenersMap.set(this, new Map())\n return\n }\n if (arguments.length === 1 && Array.isArray(arguments[0])) {\n return defineCustomEventTarget(arguments[0])\n }\n if (arguments.length > 0) {\n const types = new Array(arguments.length)\n for (let i = 0; i < arguments.length; ++i) {\n types[i] = arguments[i]\n }\n return defineCustomEventTarget(types)\n }\n throw new TypeError(\"Cannot call a class as a function\")\n /*eslint-enable consistent-return */\n}\n\n// Should be enumerable, but class methods are not enumerable.\nEventTarget.prototype = {\n /**\n * Add a given listener to this event target.\n * @param {string} eventName The event name to add.\n * @param {Function} listener The listener to add.\n * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.\n * @returns {void}\n */\n addEventListener(eventName, listener, options) {\n if (listener == null) {\n return\n }\n if (typeof listener !== \"function\" && !isObject(listener)) {\n throw new TypeError(\"'listener' should be a function or an object.\")\n }\n\n const listeners = getListeners(this)\n const optionsIsObj = isObject(options)\n const capture = optionsIsObj\n ? Boolean(options.capture)\n : Boolean(options)\n const listenerType = capture ? CAPTURE : BUBBLE\n const newNode = {\n listener,\n listenerType,\n passive: optionsIsObj && Boolean(options.passive),\n once: optionsIsObj && Boolean(options.once),\n next: null,\n }\n\n // Set it as the first node if the first node is null.\n let node = listeners.get(eventName)\n if (node === undefined) {\n listeners.set(eventName, newNode)\n return\n }\n\n // Traverse to the tail while checking duplication..\n let prev = null\n while (node != null) {\n if (\n node.listener === listener &&\n node.listenerType === listenerType\n ) {\n // Should ignore duplication.\n return\n }\n prev = node\n node = node.next\n }\n\n // Add it.\n prev.next = newNode\n },\n\n /**\n * Remove a given listener from this event target.\n * @param {string} eventName The event name to remove.\n * @param {Function} listener The listener to remove.\n * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.\n * @returns {void}\n */\n removeEventListener(eventName, listener, options) {\n if (listener == null) {\n return\n }\n\n const listeners = getListeners(this)\n const capture = isObject(options)\n ? Boolean(options.capture)\n : Boolean(options)\n const listenerType = capture ? CAPTURE : BUBBLE\n\n let prev = null\n let node = listeners.get(eventName)\n while (node != null) {\n if (\n node.listener === listener &&\n node.listenerType === listenerType\n ) {\n if (prev !== null) {\n prev.next = node.next\n } else if (node.next !== null) {\n listeners.set(eventName, node.next)\n } else {\n listeners.delete(eventName)\n }\n return\n }\n\n prev = node\n node = node.next\n }\n },\n\n /**\n * Dispatch a given event.\n * @param {Event|{type:string}} event The event to dispatch.\n * @returns {boolean} `false` if canceled.\n */\n dispatchEvent(event) {\n if (event == null || typeof event.type !== \"string\") {\n throw new TypeError('\"event.type\" should be a string.')\n }\n\n // If listeners aren't registered, terminate.\n const listeners = getListeners(this)\n const eventName = event.type\n let node = listeners.get(eventName)\n if (node == null) {\n return true\n }\n\n // Since we cannot rewrite several properties, so wrap object.\n const wrappedEvent = wrapEvent(this, event)\n\n // This doesn't process capturing phase and bubbling phase.\n // This isn't participating in a tree.\n let prev = null\n while (node != null) {\n // Remove this listener if it's once\n if (node.once) {\n if (prev !== null) {\n prev.next = node.next\n } else if (node.next !== null) {\n listeners.set(eventName, node.next)\n } else {\n listeners.delete(eventName)\n }\n } else {\n prev = node\n }\n\n // Call this listener\n setPassiveListener(\n wrappedEvent,\n node.passive ? node.listener : null\n )\n if (typeof node.listener === \"function\") {\n try {\n node.listener.call(this, wrappedEvent)\n } catch (err) {\n if (\n typeof console !== \"undefined\" &&\n typeof console.error === \"function\"\n ) {\n console.error(err)\n }\n }\n } else if (\n node.listenerType !== ATTRIBUTE &&\n typeof node.listener.handleEvent === \"function\"\n ) {\n node.listener.handleEvent(wrappedEvent)\n }\n\n // Break if `event.stopImmediatePropagation` was called.\n if (isStopped(wrappedEvent)) {\n break\n }\n\n node = node.next\n }\n setPassiveListener(wrappedEvent, null)\n setEventPhase(wrappedEvent, 0)\n setCurrentTarget(wrappedEvent, null)\n\n return !wrappedEvent.defaultPrevented\n },\n}\n\n// `constructor` is not enumerable.\nObject.defineProperty(EventTarget.prototype, \"constructor\", {\n value: EventTarget,\n configurable: true,\n writable: true,\n})\n\n// Ensure `eventTarget instanceof window.EventTarget` is `true`.\nif (\n typeof window !== \"undefined\" &&\n typeof window.EventTarget !== \"undefined\"\n) {\n Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype)\n}\n\nexport { defineEventAttribute, EventTarget }\nexport default EventTarget\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,WAAW,GAAG,IAAI,OAAO,GAAE;;;;;;;AAOjC,MAAM,QAAQ,GAAG,IAAI,OAAO,GAAE;;;;;;;;AAQ9B,SAAS,EAAE,CAAC,KAAK,EAAE;IACf,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,KAAK,EAAC;IACnC,OAAO,CAAC,MAAM;QACV,IAAI,IAAI,IAAI;QACZ,6CAA6C;QAC7C,KAAK;MACR;IACD,OAAO,IAAI;CACd;;;;;;AAMD,SAA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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @author Toru Nagashima <https://github.com/mysticatea>
3
+ * @copyright 2015 Toru Nagashima. All rights reserved.
4
+ * See LICENSE file in root directory for full license.
5
+ */
6
+ /**
7
+ * @typedef {object} PrivateData
8
+ * @property {EventTarget} eventTarget The event target.
9
+ * @property {{type:string}} event The original event object.
10
+ * @property {number} eventPhase The current event phase.
11
+ * @property {EventTarget|null} currentTarget The current event target.
12
+ * @property {boolean} canceled The flag to prevent default.
13
+ * @property {boolean} stopped The flag to stop propagation.
14
+ * @property {boolean} immediateStopped The flag to stop propagation immediately.
15
+ * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.
16
+ * @property {number} timeStamp The unix time.
17
+ * @private
18
+ */
19
+
20
+ /**
21
+ * Private data for event wrappers.
22
+ * @type {WeakMap<Event, PrivateData>}
23
+ * @private
24
+ */
25
+ const privateData = new WeakMap();
26
+
27
+ /**
28
+ * Cache for wrapper classes.
29
+ * @type {WeakMap<Object, Function>}
30
+ * @private
31
+ */
32
+ const wrappers = new WeakMap();
33
+
34
+ /**
35
+ * Get private data.
36
+ * @param {Event} event The event object to get private data.
37
+ * @returns {PrivateData} The private data of the event.
38
+ * @private
39
+ */
40
+ function pd(event) {
41
+ const retv = privateData.get(event);
42
+ console.assert(
43
+ retv != null,
44
+ "'this' is expected an Event object, but got",
45
+ event
46
+ );
47
+ return retv
48
+ }
49
+
50
+ /**
51
+ * https://dom.spec.whatwg.org/#set-the-canceled-flag
52
+ * @param data {PrivateData} private data.
53
+ */
54
+ function setCancelFlag(data) {
55
+ if (data.passiveListener != null) {
56
+ if (
57
+ typeof console !== "undefined" &&
58
+ typeof console.error === "function"
59
+ ) {
60
+ console.error(
61
+ "Unable to preventDefault inside passive event listener invocation.",
62
+ data.passiveListener
63
+ );
64
+ }
65
+ return
66
+ }
67
+ if (!data.event.cancelable) {
68
+ return
69
+ }
70
+
71
+ data.canceled = true;
72
+ if (typeof data.event.preventDefault === "function") {
73
+ data.event.preventDefault();
74
+ }
75
+ }
76
+
77
+ /**
78
+ * @see https://dom.spec.whatwg.org/#interface-event
79
+ * @private
80
+ */
81
+ /**
82
+ * The event wrapper.
83
+ * @constructor
84
+ * @param {EventTarget} eventTarget The event target of this dispatching.
85
+ * @param {Event|{type:string}} event The original event to wrap.
86
+ */
87
+ function Event(eventTarget, event) {
88
+ privateData.set(this, {
89
+ eventTarget,
90
+ event,
91
+ eventPhase: 2,
92
+ currentTarget: eventTarget,
93
+ canceled: false,
94
+ stopped: false,
95
+ immediateStopped: false,
96
+ passiveListener: null,
97
+ timeStamp: event.timeStamp || Date.now(),
98
+ });
99
+
100
+ // https://heycam.github.io/webidl/#Unforgeable
101
+ Object.defineProperty(this, "isTrusted", { value: false, enumerable: true });
102
+
103
+ // Define accessors
104
+ const keys = Object.keys(event);
105
+ for (let i = 0; i < keys.length; ++i) {
106
+ const key = keys[i];
107
+ if (!(key in this)) {
108
+ Object.defineProperty(this, key, defineRedirectDescriptor(key));
109
+ }
110
+ }
111
+ }
112
+
113
+ // Should be enumerable, but class methods are not enumerable.
114
+ Event.prototype = {
115
+ /**
116
+ * The type of this event.
117
+ * @type {string}
118
+ */
119
+ get type() {
120
+ return pd(this).event.type
121
+ },
122
+
123
+ /**
124
+ * The target of this event.
125
+ * @type {EventTarget}
126
+ */
127
+ get target() {
128
+ return pd(this).eventTarget
129
+ },
130
+
131
+ /**
132
+ * The target of this event.
133
+ * @type {EventTarget}
134
+ */
135
+ get currentTarget() {
136
+ return pd(this).currentTarget
137
+ },
138
+
139
+ /**
140
+ * @returns {EventTarget[]} The composed path of this event.
141
+ */
142
+ composedPath() {
143
+ const currentTarget = pd(this).currentTarget;
144
+ if (currentTarget == null) {
145
+ return []
146
+ }
147
+ return [currentTarget]
148
+ },
149
+
150
+ /**
151
+ * Constant of NONE.
152
+ * @type {number}
153
+ */
154
+ get NONE() {
155
+ return 0
156
+ },
157
+
158
+ /**
159
+ * Constant of CAPTURING_PHASE.
160
+ * @type {number}
161
+ */
162
+ get CAPTURING_PHASE() {
163
+ return 1
164
+ },
165
+
166
+ /**
167
+ * Constant of AT_TARGET.
168
+ * @type {number}
169
+ */
170
+ get AT_TARGET() {
171
+ return 2
172
+ },
173
+
174
+ /**
175
+ * Constant of BUBBLING_PHASE.
176
+ * @type {number}
177
+ */
178
+ get BUBBLING_PHASE() {
179
+ return 3
180
+ },
181
+
182
+ /**
183
+ * The target of this event.
184
+ * @type {number}
185
+ */
186
+ get eventPhase() {
187
+ return pd(this).eventPhase
188
+ },
189
+
190
+ /**
191
+ * Stop event bubbling.
192
+ * @returns {void}
193
+ */
194
+ stopPropagation() {
195
+ const data = pd(this);
196
+
197
+ data.stopped = true;
198
+ if (typeof data.event.stopPropagation === "function") {
199
+ data.event.stopPropagation();
200
+ }
201
+ },
202
+
203
+ /**
204
+ * Stop event bubbling.
205
+ * @returns {void}
206
+ */
207
+ stopImmediatePropagation() {
208
+ const data = pd(this);
209
+
210
+ data.stopped = true;
211
+ data.immediateStopped = true;
212
+ if (typeof data.event.stopImmediatePropagation === "function") {
213
+ data.event.stopImmediatePropagation();
214
+ }
215
+ },
216
+
217
+ /**
218
+ * The flag to be bubbling.
219
+ * @type {boolean}
220
+ */
221
+ get bubbles() {
222
+ return Boolean(pd(this).event.bubbles)
223
+ },
224
+
225
+ /**
226
+ * The flag to be cancelable.
227
+ * @type {boolean}
228
+ */
229
+ get cancelable() {
230
+ return Boolean(pd(this).event.cancelable)
231
+ },
232
+
233
+ /**
234
+ * Cancel this event.
235
+ * @returns {void}
236
+ */
237
+ preventDefault() {
238
+ setCancelFlag(pd(this));
239
+ },
240
+
241
+ /**
242
+ * The flag to indicate cancellation state.
243
+ * @type {boolean}
244
+ */
245
+ get defaultPrevented() {
246
+ return pd(this).canceled
247
+ },
248
+
249
+ /**
250
+ * The flag to be composed.
251
+ * @type {boolean}
252
+ */
253
+ get composed() {
254
+ return Boolean(pd(this).event.composed)
255
+ },
256
+
257
+ /**
258
+ * The unix time of this event.
259
+ * @type {number}
260
+ */
261
+ get timeStamp() {
262
+ return pd(this).timeStamp
263
+ },
264
+
265
+ /**
266
+ * The target of this event.
267
+ * @type {EventTarget}
268
+ * @deprecated
269
+ */
270
+ get srcElement() {
271
+ return pd(this).eventTarget
272
+ },
273
+
274
+ /**
275
+ * The flag to stop event bubbling.
276
+ * @type {boolean}
277
+ * @deprecated
278
+ */
279
+ get cancelBubble() {
280
+ return pd(this).stopped
281
+ },
282
+ set cancelBubble(value) {
283
+ if (!value) {
284
+ return
285
+ }
286
+ const data = pd(this);
287
+
288
+ data.stopped = true;
289
+ if (typeof data.event.cancelBubble === "boolean") {
290
+ data.event.cancelBubble = true;
291
+ }
292
+ },
293
+
294
+ /**
295
+ * The flag to indicate cancellation state.
296
+ * @type {boolean}
297
+ * @deprecated
298
+ */
299
+ get returnValue() {
300
+ return !pd(this).canceled
301
+ },
302
+ set returnValue(value) {
303
+ if (!value) {
304
+ setCancelFlag(pd(this));
305
+ }
306
+ },
307
+
308
+ /**
309
+ * Initialize this event object. But do nothing under event dispatching.
310
+ * @param {string} type The event type.
311
+ * @param {boolean} [bubbles=false] The flag to be possible to bubble up.
312
+ * @param {boolean} [cancelable=false] The flag to be possible to cancel.
313
+ * @deprecated
314
+ */
315
+ initEvent() {
316
+ // Do nothing.
317
+ },
318
+ };
319
+
320
+ // `constructor` is not enumerable.
321
+ Object.defineProperty(Event.prototype, "constructor", {
322
+ value: Event,
323
+ configurable: true,
324
+ writable: true,
325
+ });
326
+
327
+ // Ensure `event instanceof window.Event` is `true`.
328
+ if (typeof window !== "undefined" && typeof window.Event !== "undefined") {
329
+ Object.setPrototypeOf(Event.prototype, window.Event.prototype);
330
+
331
+ // Make association for wrappers.
332
+ wrappers.set(window.Event.prototype, Event);
333
+ }
334
+
335
+ /**
336
+ * Get the property descriptor to redirect a given property.
337
+ * @param {string} key Property name to define property descriptor.
338
+ * @returns {PropertyDescriptor} The property descriptor to redirect the property.
339
+ * @private
340
+ */
341
+ function defineRedirectDescriptor(key) {
342
+ return {
343
+ get() {
344
+ return pd(this).event[key]
345
+ },
346
+ set(value) {
347
+ pd(this).event[key] = value;
348
+ },
349
+ configurable: true,
350
+ enumerable: true,
351
+ }
352
+ }
353
+
354
+ /**
355
+ * Get the property descriptor to call a given method property.
356
+ * @param {string} key Property name to define property descriptor.
357
+ * @returns {PropertyDescriptor} The property descriptor to call the method property.
358
+ * @private
359
+ */
360
+ function defineCallDescriptor(key) {
361
+ return {
362
+ value() {
363
+ const event = pd(this).event;
364
+ return event[key].apply(event, arguments)
365
+ },
366
+ configurable: true,
367
+ enumerable: true,
368
+ }
369
+ }
370
+
371
+ /**
372
+ * Define new wrapper class.
373
+ * @param {Function} BaseEvent The base wrapper class.
374
+ * @param {Object} proto The prototype of the original event.
375
+ * @returns {Function} The defined wrapper class.
376
+ * @private
377
+ */
378
+ function defineWrapper(BaseEvent, proto) {
379
+ const keys = Object.keys(proto);
380
+ if (keys.length === 0) {
381
+ return BaseEvent
382
+ }
383
+
384
+ /** CustomEvent */
385
+ function CustomEvent(eventTarget, event) {
386
+ BaseEvent.call(this, eventTarget, event);
387
+ }
388
+
389
+ CustomEvent.prototype = Object.create(BaseEvent.prototype, {
390
+ constructor: { value: CustomEvent, configurable: true, writable: true },
391
+ });
392
+
393
+ // Define accessors.
394
+ for (let i = 0; i < keys.length; ++i) {
395
+ const key = keys[i];
396
+ if (!(key in BaseEvent.prototype)) {
397
+ const descriptor = Object.getOwnPropertyDescriptor(proto, key);
398
+ const isFunc = typeof descriptor.value === "function";
399
+ Object.defineProperty(
400
+ CustomEvent.prototype,
401
+ key,
402
+ isFunc
403
+ ? defineCallDescriptor(key)
404
+ : defineRedirectDescriptor(key)
405
+ );
406
+ }
407
+ }
408
+
409
+ return CustomEvent
410
+ }
411
+
412
+ /**
413
+ * Get the wrapper class of a given prototype.
414
+ * @param {Object} proto The prototype of the original event to get its wrapper.
415
+ * @returns {Function} The wrapper class.
416
+ * @private
417
+ */
418
+ function getWrapper(proto) {
419
+ if (proto == null || proto === Object.prototype) {
420
+ return Event
421
+ }
422
+
423
+ let wrapper = wrappers.get(proto);
424
+ if (wrapper == null) {
425
+ wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto);
426
+ wrappers.set(proto, wrapper);
427
+ }
428
+ return wrapper
429
+ }
430
+
431
+ /**
432
+ * Wrap a given event to management a dispatching.
433
+ * @param {EventTarget} eventTarget The event target of this dispatching.
434
+ * @param {Object} event The event to wrap.
435
+ * @returns {Event} The wrapper instance.
436
+ * @private
437
+ */
438
+ function wrapEvent(eventTarget, event) {
439
+ const Wrapper = getWrapper(Object.getPrototypeOf(event));
440
+ return new Wrapper(eventTarget, event)
441
+ }
442
+
443
+ /**
444
+ * Get the immediateStopped flag of a given event.
445
+ * @param {Event} event The event to get.
446
+ * @returns {boolean} The flag to stop propagation immediately.
447
+ * @private
448
+ */
449
+ function isStopped(event) {
450
+ return pd(event).immediateStopped
451
+ }
452
+
453
+ /**
454
+ * Set the current event phase of a given event.
455
+ * @param {Event} event The event to set current target.
456
+ * @param {number} eventPhase New event phase.
457
+ * @returns {void}
458
+ * @private
459
+ */
460
+ function setEventPhase(event, eventPhase) {
461
+ pd(event).eventPhase = eventPhase;
462
+ }
463
+
464
+ /**
465
+ * Set the current target of a given event.
466
+ * @param {Event} event The event to set current target.
467
+ * @param {EventTarget|null} currentTarget New current target.
468
+ * @returns {void}
469
+ * @private
470
+ */
471
+ function setCurrentTarget(event, currentTarget) {
472
+ pd(event).currentTarget = currentTarget;
473
+ }
474
+
475
+ /**
476
+ * Set a passive listener of a given event.
477
+ * @param {Event} event The event to set current target.
478
+ * @param {Function|null} passiveListener New passive listener.
479
+ * @returns {void}
480
+ * @private
481
+ */
482
+ function setPassiveListener(event, passiveListener) {
483
+ pd(event).passiveListener = passiveListener;
484
+ }
485
+
486
+ /**
487
+ * @typedef {object} ListenerNode
488
+ * @property {Function} listener
489
+ * @property {1|2|3} listenerType
490
+ * @property {boolean} passive
491
+ * @property {boolean} once
492
+ * @property {ListenerNode|null} next
493
+ * @private
494
+ */
495
+
496
+ /**
497
+ * @type {WeakMap<object, Map<string, ListenerNode>>}
498
+ * @private
499
+ */
500
+ const listenersMap = new WeakMap();
501
+
502
+ // Listener types
503
+ const CAPTURE = 1;
504
+ const BUBBLE = 2;
505
+ const ATTRIBUTE = 3;
506
+
507
+ /**
508
+ * Check whether a given value is an object or not.
509
+ * @param {any} x The value to check.
510
+ * @returns {boolean} `true` if the value is an object.
511
+ */
512
+ function isObject(x) {
513
+ return x !== null && typeof x === "object" //eslint-disable-line no-restricted-syntax
514
+ }
515
+
516
+ /**
517
+ * Get listeners.
518
+ * @param {EventTarget} eventTarget The event target to get.
519
+ * @returns {Map<string, ListenerNode>} The listeners.
520
+ * @private
521
+ */
522
+ function getListeners(eventTarget) {
523
+ const listeners = listenersMap.get(eventTarget);
524
+ if (listeners == null) {
525
+ throw new TypeError(
526
+ "'this' is expected an EventTarget object, but got another value."
527
+ )
528
+ }
529
+ return listeners
530
+ }
531
+
532
+ /**
533
+ * Get the property descriptor for the event attribute of a given event.
534
+ * @param {string} eventName The event name to get property descriptor.
535
+ * @returns {PropertyDescriptor} The property descriptor.
536
+ * @private
537
+ */
538
+ function defineEventAttributeDescriptor(eventName) {
539
+ return {
540
+ get() {
541
+ const listeners = getListeners(this);
542
+ let node = listeners.get(eventName);
543
+ while (node != null) {
544
+ if (node.listenerType === ATTRIBUTE) {
545
+ return node.listener
546
+ }
547
+ node = node.next;
548
+ }
549
+ return null
550
+ },
551
+
552
+ set(listener) {
553
+ if (typeof listener !== "function" && !isObject(listener)) {
554
+ listener = null; // eslint-disable-line no-param-reassign
555
+ }
556
+ const listeners = getListeners(this);
557
+
558
+ // Traverse to the tail while removing old value.
559
+ let prev = null;
560
+ let node = listeners.get(eventName);
561
+ while (node != null) {
562
+ if (node.listenerType === ATTRIBUTE) {
563
+ // Remove old value.
564
+ if (prev !== null) {
565
+ prev.next = node.next;
566
+ } else if (node.next !== null) {
567
+ listeners.set(eventName, node.next);
568
+ } else {
569
+ listeners.delete(eventName);
570
+ }
571
+ } else {
572
+ prev = node;
573
+ }
574
+
575
+ node = node.next;
576
+ }
577
+
578
+ // Add new value.
579
+ if (listener !== null) {
580
+ const newNode = {
581
+ listener,
582
+ listenerType: ATTRIBUTE,
583
+ passive: false,
584
+ once: false,
585
+ next: null,
586
+ };
587
+ if (prev === null) {
588
+ listeners.set(eventName, newNode);
589
+ } else {
590
+ prev.next = newNode;
591
+ }
592
+ }
593
+ },
594
+ configurable: true,
595
+ enumerable: true,
596
+ }
597
+ }
598
+
599
+ /**
600
+ * Define an event attribute (e.g. `eventTarget.onclick`).
601
+ * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.
602
+ * @param {string} eventName The event name to define.
603
+ * @returns {void}
604
+ */
605
+ function defineEventAttribute(eventTargetPrototype, eventName) {
606
+ Object.defineProperty(
607
+ eventTargetPrototype,
608
+ `on${eventName}`,
609
+ defineEventAttributeDescriptor(eventName)
610
+ );
611
+ }
612
+
613
+ /**
614
+ * Define a custom EventTarget with event attributes.
615
+ * @param {string[]} eventNames Event names for event attributes.
616
+ * @returns {EventTarget} The custom EventTarget.
617
+ * @private
618
+ */
619
+ function defineCustomEventTarget(eventNames) {
620
+ /** CustomEventTarget */
621
+ function CustomEventTarget() {
622
+ EventTarget.call(this);
623
+ }
624
+
625
+ CustomEventTarget.prototype = Object.create(EventTarget.prototype, {
626
+ constructor: {
627
+ value: CustomEventTarget,
628
+ configurable: true,
629
+ writable: true,
630
+ },
631
+ });
632
+
633
+ for (let i = 0; i < eventNames.length; ++i) {
634
+ defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);
635
+ }
636
+
637
+ return CustomEventTarget
638
+ }
639
+
640
+ /**
641
+ * EventTarget.
642
+ *
643
+ * - This is constructor if no arguments.
644
+ * - This is a function which returns a CustomEventTarget constructor if there are arguments.
645
+ *
646
+ * For example:
647
+ *
648
+ * class A extends EventTarget {}
649
+ * class B extends EventTarget("message") {}
650
+ * class C extends EventTarget("message", "error") {}
651
+ * class D extends EventTarget(["message", "error"]) {}
652
+ */
653
+ function EventTarget() {
654
+ /*eslint-disable consistent-return */
655
+ if (this instanceof EventTarget) {
656
+ listenersMap.set(this, new Map());
657
+ return
658
+ }
659
+ if (arguments.length === 1 && Array.isArray(arguments[0])) {
660
+ return defineCustomEventTarget(arguments[0])
661
+ }
662
+ if (arguments.length > 0) {
663
+ const types = new Array(arguments.length);
664
+ for (let i = 0; i < arguments.length; ++i) {
665
+ types[i] = arguments[i];
666
+ }
667
+ return defineCustomEventTarget(types)
668
+ }
669
+ throw new TypeError("Cannot call a class as a function")
670
+ /*eslint-enable consistent-return */
671
+ }
672
+
673
+ // Should be enumerable, but class methods are not enumerable.
674
+ EventTarget.prototype = {
675
+ /**
676
+ * Add a given listener to this event target.
677
+ * @param {string} eventName The event name to add.
678
+ * @param {Function} listener The listener to add.
679
+ * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
680
+ * @returns {void}
681
+ */
682
+ addEventListener(eventName, listener, options) {
683
+ if (listener == null) {
684
+ return
685
+ }
686
+ if (typeof listener !== "function" && !isObject(listener)) {
687
+ throw new TypeError("'listener' should be a function or an object.")
688
+ }
689
+
690
+ const listeners = getListeners(this);
691
+ const optionsIsObj = isObject(options);
692
+ const capture = optionsIsObj
693
+ ? Boolean(options.capture)
694
+ : Boolean(options);
695
+ const listenerType = capture ? CAPTURE : BUBBLE;
696
+ const newNode = {
697
+ listener,
698
+ listenerType,
699
+ passive: optionsIsObj && Boolean(options.passive),
700
+ once: optionsIsObj && Boolean(options.once),
701
+ next: null,
702
+ };
703
+
704
+ // Set it as the first node if the first node is null.
705
+ let node = listeners.get(eventName);
706
+ if (node === undefined) {
707
+ listeners.set(eventName, newNode);
708
+ return
709
+ }
710
+
711
+ // Traverse to the tail while checking duplication..
712
+ let prev = null;
713
+ while (node != null) {
714
+ if (
715
+ node.listener === listener &&
716
+ node.listenerType === listenerType
717
+ ) {
718
+ // Should ignore duplication.
719
+ return
720
+ }
721
+ prev = node;
722
+ node = node.next;
723
+ }
724
+
725
+ // Add it.
726
+ prev.next = newNode;
727
+ },
728
+
729
+ /**
730
+ * Remove a given listener from this event target.
731
+ * @param {string} eventName The event name to remove.
732
+ * @param {Function} listener The listener to remove.
733
+ * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
734
+ * @returns {void}
735
+ */
736
+ removeEventListener(eventName, listener, options) {
737
+ if (listener == null) {
738
+ return
739
+ }
740
+
741
+ const listeners = getListeners(this);
742
+ const capture = isObject(options)
743
+ ? Boolean(options.capture)
744
+ : Boolean(options);
745
+ const listenerType = capture ? CAPTURE : BUBBLE;
746
+
747
+ let prev = null;
748
+ let node = listeners.get(eventName);
749
+ while (node != null) {
750
+ if (
751
+ node.listener === listener &&
752
+ node.listenerType === listenerType
753
+ ) {
754
+ if (prev !== null) {
755
+ prev.next = node.next;
756
+ } else if (node.next !== null) {
757
+ listeners.set(eventName, node.next);
758
+ } else {
759
+ listeners.delete(eventName);
760
+ }
761
+ return
762
+ }
763
+
764
+ prev = node;
765
+ node = node.next;
766
+ }
767
+ },
768
+
769
+ /**
770
+ * Dispatch a given event.
771
+ * @param {Event|{type:string}} event The event to dispatch.
772
+ * @returns {boolean} `false` if canceled.
773
+ */
774
+ dispatchEvent(event) {
775
+ if (event == null || typeof event.type !== "string") {
776
+ throw new TypeError('"event.type" should be a string.')
777
+ }
778
+
779
+ // If listeners aren't registered, terminate.
780
+ const listeners = getListeners(this);
781
+ const eventName = event.type;
782
+ let node = listeners.get(eventName);
783
+ if (node == null) {
784
+ return true
785
+ }
786
+
787
+ // Since we cannot rewrite several properties, so wrap object.
788
+ const wrappedEvent = wrapEvent(this, event);
789
+
790
+ // This doesn't process capturing phase and bubbling phase.
791
+ // This isn't participating in a tree.
792
+ let prev = null;
793
+ while (node != null) {
794
+ // Remove this listener if it's once
795
+ if (node.once) {
796
+ if (prev !== null) {
797
+ prev.next = node.next;
798
+ } else if (node.next !== null) {
799
+ listeners.set(eventName, node.next);
800
+ } else {
801
+ listeners.delete(eventName);
802
+ }
803
+ } else {
804
+ prev = node;
805
+ }
806
+
807
+ // Call this listener
808
+ setPassiveListener(
809
+ wrappedEvent,
810
+ node.passive ? node.listener : null
811
+ );
812
+ if (typeof node.listener === "function") {
813
+ try {
814
+ node.listener.call(this, wrappedEvent);
815
+ } catch (err) {
816
+ if (
817
+ typeof console !== "undefined" &&
818
+ typeof console.error === "function"
819
+ ) {
820
+ console.error(err);
821
+ }
822
+ }
823
+ } else if (
824
+ node.listenerType !== ATTRIBUTE &&
825
+ typeof node.listener.handleEvent === "function"
826
+ ) {
827
+ node.listener.handleEvent(wrappedEvent);
828
+ }
829
+
830
+ // Break if `event.stopImmediatePropagation` was called.
831
+ if (isStopped(wrappedEvent)) {
832
+ break
833
+ }
834
+
835
+ node = node.next;
836
+ }
837
+ setPassiveListener(wrappedEvent, null);
838
+ setEventPhase(wrappedEvent, 0);
839
+ setCurrentTarget(wrappedEvent, null);
840
+
841
+ return !wrappedEvent.defaultPrevented
842
+ },
843
+ };
844
+
845
+ // `constructor` is not enumerable.
846
+ Object.defineProperty(EventTarget.prototype, "constructor", {
847
+ value: EventTarget,
848
+ configurable: true,
849
+ writable: true,
850
+ });
851
+
852
+ // Ensure `eventTarget instanceof window.EventTarget` is `true`.
853
+ if (
854
+ typeof window !== "undefined" &&
855
+ typeof window.EventTarget !== "undefined"
856
+ ) {
857
+ Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype);
858
+ }
859
+
860
+ export default EventTarget;
861
+ export { defineEventAttribute, EventTarget };
862
+ //# sourceMappingURL=event-target-shim.mjs.map
node_modules/event-target-shim/dist/event-target-shim.mjs.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"event-target-shim.mjs","sources":["../src/event.mjs","../src/event-target.mjs"],"sourcesContent":["/**\n * @typedef {object} PrivateData\n * @property {EventTarget} eventTarget The event target.\n * @property {{type:string}} event The original event object.\n * @property {number} eventPhase The current event phase.\n * @property {EventTarget|null} currentTarget The current event target.\n * @property {boolean} canceled The flag to prevent default.\n * @property {boolean} stopped The flag to stop propagation.\n * @property {boolean} immediateStopped The flag to stop propagation immediately.\n * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.\n * @property {number} timeStamp The unix time.\n * @private\n */\n\n/**\n * Private data for event wrappers.\n * @type {WeakMap<Event, PrivateData>}\n * @private\n */\nconst privateData = new WeakMap()\n\n/**\n * Cache for wrapper classes.\n * @type {WeakMap<Object, Function>}\n * @private\n */\nconst wrappers = new WeakMap()\n\n/**\n * Get private data.\n * @param {Event} event The event object to get private data.\n * @returns {PrivateData} The private data of the event.\n * @private\n */\nfunction pd(event) {\n const retv = privateData.get(event)\n console.assert(\n retv != null,\n \"'this' is expected an Event object, but got\",\n event\n )\n return retv\n}\n\n/**\n * https://dom.spec.whatwg.org/#set-the-canceled-flag\n * @param data {PrivateData} private data.\n */\nfunction setCancelFlag(data) {\n if (data.passiveListener != null) {\n if (\n typeof console !== \"undefined\" &&\n typeof console.error === \"function\"\n ) {\n console.error(\n \"Unable to preventDefault inside passive event listener invocation.\",\n data.passiveListener\n )\n }\n return\n }\n if (!data.event.cancelable) {\n return\n }\n\n data.canceled = true\n if (typeof data.event.preventDefault === \"function\") {\n data.event.preventDefault()\n }\n}\n\n/**\n * @see https://dom.spec.whatwg.org/#interface-event\n * @private\n */\n/**\n * The event wrapper.\n * @constructor\n * @param {EventTarget} eventTarget The event target of this dispatching.\n * @param {Event|{type:string}} event The original event to wrap.\n */\nfunction Event(eventTarget, event) {\n privateData.set(this, {\n eventTarget,\n event,\n eventPhase: 2,\n currentTarget: eventTarget,\n canceled: false,\n stopped: false,\n immediateStopped: false,\n passiveListener: null,\n timeStamp: event.timeStamp || Date.now(),\n })\n\n // https://heycam.github.io/webidl/#Unforgeable\n Object.defineProperty(this, \"isTrusted\", { value: false, enumerable: true })\n\n // Define accessors\n const keys = Object.keys(event)\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i]\n if (!(key in this)) {\n Object.defineProperty(this, key, defineRedirectDescriptor(key))\n }\n }\n}\n\n// Should be enumerable, but class methods are not enumerable.\nEvent.prototype = {\n /**\n * The type of this event.\n * @type {string}\n */\n get type() {\n return pd(this).event.type\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get target() {\n return pd(this).eventTarget\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n */\n get currentTarget() {\n return pd(this).currentTarget\n },\n\n /**\n * @returns {EventTarget[]} The composed path of this event.\n */\n composedPath() {\n const currentTarget = pd(this).currentTarget\n if (currentTarget == null) {\n return []\n }\n return [currentTarget]\n },\n\n /**\n * Constant of NONE.\n * @type {number}\n */\n get NONE() {\n return 0\n },\n\n /**\n * Constant of CAPTURING_PHASE.\n * @type {number}\n */\n get CAPTURING_PHASE() {\n return 1\n },\n\n /**\n * Constant of AT_TARGET.\n * @type {number}\n */\n get AT_TARGET() {\n return 2\n },\n\n /**\n * Constant of BUBBLING_PHASE.\n * @type {number}\n */\n get BUBBLING_PHASE() {\n return 3\n },\n\n /**\n * The target of this event.\n * @type {number}\n */\n get eventPhase() {\n return pd(this).eventPhase\n },\n\n /**\n * Stop event bubbling.\n * @returns {void}\n */\n stopPropagation() {\n const data = pd(this)\n\n data.stopped = true\n if (typeof data.event.stopPropagation === \"function\") {\n data.event.stopPropagation()\n }\n },\n\n /**\n * Stop event bubbling.\n * @returns {void}\n */\n stopImmediatePropagation() {\n const data = pd(this)\n\n data.stopped = true\n data.immediateStopped = true\n if (typeof data.event.stopImmediatePropagation === \"function\") {\n data.event.stopImmediatePropagation()\n }\n },\n\n /**\n * The flag to be bubbling.\n * @type {boolean}\n */\n get bubbles() {\n return Boolean(pd(this).event.bubbles)\n },\n\n /**\n * The flag to be cancelable.\n * @type {boolean}\n */\n get cancelable() {\n return Boolean(pd(this).event.cancelable)\n },\n\n /**\n * Cancel this event.\n * @returns {void}\n */\n preventDefault() {\n setCancelFlag(pd(this))\n },\n\n /**\n * The flag to indicate cancellation state.\n * @type {boolean}\n */\n get defaultPrevented() {\n return pd(this).canceled\n },\n\n /**\n * The flag to be composed.\n * @type {boolean}\n */\n get composed() {\n return Boolean(pd(this).event.composed)\n },\n\n /**\n * The unix time of this event.\n * @type {number}\n */\n get timeStamp() {\n return pd(this).timeStamp\n },\n\n /**\n * The target of this event.\n * @type {EventTarget}\n * @deprecated\n */\n get srcElement() {\n return pd(this).eventTarget\n },\n\n /**\n * The flag to stop event bubbling.\n * @type {boolean}\n * @deprecated\n */\n get cancelBubble() {\n return pd(this).stopped\n },\n set cancelBubble(value) {\n if (!value) {\n return\n }\n const data = pd(this)\n\n data.stopped = true\n if (typeof data.event.cancelBubble === \"boolean\") {\n data.event.cancelBubble = true\n }\n },\n\n /**\n * The flag to indicate cancellation state.\n * @type {boolean}\n * @deprecated\n */\n get returnValue() {\n return !pd(this).canceled\n },\n set returnValue(value) {\n if (!value) {\n setCancelFlag(pd(this))\n }\n },\n\n /**\n * Initialize this event object. But do nothing under event dispatching.\n * @param {string} type The event type.\n * @param {boolean} [bubbles=false] The flag to be possible to bubble up.\n * @param {boolean} [cancelable=false] The flag to be possible to cancel.\n * @deprecated\n */\n initEvent() {\n // Do nothing.\n },\n}\n\n// `constructor` is not enumerable.\nObject.defineProperty(Event.prototype, \"constructor\", {\n value: Event,\n configurable: true,\n writable: true,\n})\n\n// Ensure `event instanceof window.Event` is `true`.\nif (typeof window !== \"undefined\" && typeof window.Event !== \"undefined\") {\n Object.setPrototypeOf(Event.prototype, window.Event.prototype)\n\n // Make association for wrappers.\n wrappers.set(window.Event.prototype, Event)\n}\n\n/**\n * Get the property descriptor to redirect a given property.\n * @param {string} key Property name to define property descriptor.\n * @returns {PropertyDescriptor} The property descriptor to redirect the property.\n * @private\n */\nfunction defineRedirectDescriptor(key) {\n return {\n get() {\n return pd(this).event[key]\n },\n set(value) {\n pd(this).event[key] = value\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Get the property descriptor to call a given method property.\n * @param {string} key Property name to define property descriptor.\n * @returns {PropertyDescriptor} The property descriptor to call the method property.\n * @private\n */\nfunction defineCallDescriptor(key) {\n return {\n value() {\n const event = pd(this).event\n return event[key].apply(event, arguments)\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Define new wrapper class.\n * @param {Function} BaseEvent The base wrapper class.\n * @param {Object} proto The prototype of the original event.\n * @returns {Function} The defined wrapper class.\n * @private\n */\nfunction defineWrapper(BaseEvent, proto) {\n const keys = Object.keys(proto)\n if (keys.length === 0) {\n return BaseEvent\n }\n\n /** CustomEvent */\n function CustomEvent(eventTarget, event) {\n BaseEvent.call(this, eventTarget, event)\n }\n\n CustomEvent.prototype = Object.create(BaseEvent.prototype, {\n constructor: { value: CustomEvent, configurable: true, writable: true },\n })\n\n // Define accessors.\n for (let i = 0; i < keys.length; ++i) {\n const key = keys[i]\n if (!(key in BaseEvent.prototype)) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, key)\n const isFunc = typeof descriptor.value === \"function\"\n Object.defineProperty(\n CustomEvent.prototype,\n key,\n isFunc\n ? defineCallDescriptor(key)\n : defineRedirectDescriptor(key)\n )\n }\n }\n\n return CustomEvent\n}\n\n/**\n * Get the wrapper class of a given prototype.\n * @param {Object} proto The prototype of the original event to get its wrapper.\n * @returns {Function} The wrapper class.\n * @private\n */\nfunction getWrapper(proto) {\n if (proto == null || proto === Object.prototype) {\n return Event\n }\n\n let wrapper = wrappers.get(proto)\n if (wrapper == null) {\n wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto)\n wrappers.set(proto, wrapper)\n }\n return wrapper\n}\n\n/**\n * Wrap a given event to management a dispatching.\n * @param {EventTarget} eventTarget The event target of this dispatching.\n * @param {Object} event The event to wrap.\n * @returns {Event} The wrapper instance.\n * @private\n */\nexport function wrapEvent(eventTarget, event) {\n const Wrapper = getWrapper(Object.getPrototypeOf(event))\n return new Wrapper(eventTarget, event)\n}\n\n/**\n * Get the immediateStopped flag of a given event.\n * @param {Event} event The event to get.\n * @returns {boolean} The flag to stop propagation immediately.\n * @private\n */\nexport function isStopped(event) {\n return pd(event).immediateStopped\n}\n\n/**\n * Set the current event phase of a given event.\n * @param {Event} event The event to set current target.\n * @param {number} eventPhase New event phase.\n * @returns {void}\n * @private\n */\nexport function setEventPhase(event, eventPhase) {\n pd(event).eventPhase = eventPhase\n}\n\n/**\n * Set the current target of a given event.\n * @param {Event} event The event to set current target.\n * @param {EventTarget|null} currentTarget New current target.\n * @returns {void}\n * @private\n */\nexport function setCurrentTarget(event, currentTarget) {\n pd(event).currentTarget = currentTarget\n}\n\n/**\n * Set a passive listener of a given event.\n * @param {Event} event The event to set current target.\n * @param {Function|null} passiveListener New passive listener.\n * @returns {void}\n * @private\n */\nexport function setPassiveListener(event, passiveListener) {\n pd(event).passiveListener = passiveListener\n}\n","import {\n isStopped,\n setCurrentTarget,\n setEventPhase,\n setPassiveListener,\n wrapEvent,\n} from \"./event.mjs\"\n\n/**\n * @typedef {object} ListenerNode\n * @property {Function} listener\n * @property {1|2|3} listenerType\n * @property {boolean} passive\n * @property {boolean} once\n * @property {ListenerNode|null} next\n * @private\n */\n\n/**\n * @type {WeakMap<object, Map<string, ListenerNode>>}\n * @private\n */\nconst listenersMap = new WeakMap()\n\n// Listener types\nconst CAPTURE = 1\nconst BUBBLE = 2\nconst ATTRIBUTE = 3\n\n/**\n * Check whether a given value is an object or not.\n * @param {any} x The value to check.\n * @returns {boolean} `true` if the value is an object.\n */\nfunction isObject(x) {\n return x !== null && typeof x === \"object\" //eslint-disable-line no-restricted-syntax\n}\n\n/**\n * Get listeners.\n * @param {EventTarget} eventTarget The event target to get.\n * @returns {Map<string, ListenerNode>} The listeners.\n * @private\n */\nfunction getListeners(eventTarget) {\n const listeners = listenersMap.get(eventTarget)\n if (listeners == null) {\n throw new TypeError(\n \"'this' is expected an EventTarget object, but got another value.\"\n )\n }\n return listeners\n}\n\n/**\n * Get the property descriptor for the event attribute of a given event.\n * @param {string} eventName The event name to get property descriptor.\n * @returns {PropertyDescriptor} The property descriptor.\n * @private\n */\nfunction defineEventAttributeDescriptor(eventName) {\n return {\n get() {\n const listeners = getListeners(this)\n let node = listeners.get(eventName)\n while (node != null) {\n if (node.listenerType === ATTRIBUTE) {\n return node.listener\n }\n node = node.next\n }\n return null\n },\n\n set(listener) {\n if (typeof listener !== \"function\" && !isObject(listener)) {\n listener = null // eslint-disable-line no-param-reassign\n }\n const listeners = getListeners(this)\n\n // Traverse to the tail while removing old value.\n let prev = null\n let node = listeners.get(eventName)\n while (node != null) {\n if (node.listenerType === ATTRIBUTE) {\n // Remove old value.\n if (prev !== null) {\n prev.next = node.next\n } else if (node.next !== null) {\n listeners.set(eventName, node.next)\n } else {\n listeners.delete(eventName)\n }\n } else {\n prev = node\n }\n\n node = node.next\n }\n\n // Add new value.\n if (listener !== null) {\n const newNode = {\n listener,\n listenerType: ATTRIBUTE,\n passive: false,\n once: false,\n next: null,\n }\n if (prev === null) {\n listeners.set(eventName, newNode)\n } else {\n prev.next = newNode\n }\n }\n },\n configurable: true,\n enumerable: true,\n }\n}\n\n/**\n * Define an event attribute (e.g. `eventTarget.onclick`).\n * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.\n * @param {string} eventName The event name to define.\n * @returns {void}\n */\nfunction defineEventAttribute(eventTargetPrototype, eventName) {\n Object.defineProperty(\n eventTargetPrototype,\n `on${eventName}`,\n defineEventAttributeDescriptor(eventName)\n )\n}\n\n/**\n * Define a custom EventTarget with event attributes.\n * @param {string[]} eventNames Event names for event attributes.\n * @returns {EventTarget} The custom EventTarget.\n * @private\n */\nfunction defineCustomEventTarget(eventNames) {\n /** CustomEventTarget */\n function CustomEventTarget() {\n EventTarget.call(this)\n }\n\n CustomEventTarget.prototype = Object.create(EventTarget.prototype, {\n constructor: {\n value: CustomEventTarget,\n configurable: true,\n writable: true,\n },\n })\n\n for (let i = 0; i < eventNames.length; ++i) {\n defineEventAttribute(CustomEventTarget.prototype, eventNames[i])\n }\n\n return CustomEventTarget\n}\n\n/**\n * EventTarget.\n *\n * - This is constructor if no arguments.\n * - This is a function which returns a CustomEventTarget constructor if there are arguments.\n *\n * For example:\n *\n * class A extends EventTarget {}\n * class B extends EventTarget(\"message\") {}\n * class C extends EventTarget(\"message\", \"error\") {}\n * class D extends EventTarget([\"message\", \"error\"]) {}\n */\nfunction EventTarget() {\n /*eslint-disable consistent-return */\n if (this instanceof EventTarget) {\n listenersMap.set(this, new Map())\n return\n }\n if (arguments.length === 1 && Array.isArray(arguments[0])) {\n return defineCustomEventTarget(arguments[0])\n }\n if (arguments.length > 0) {\n const types = new Array(arguments.length)\n for (let i = 0; i < arguments.length; ++i) {\n types[i] = arguments[i]\n }\n return defineCustomEventTarget(types)\n }\n throw new TypeError(\"Cannot call a class as a function\")\n /*eslint-enable consistent-return */\n}\n\n// Should be enumerable, but class methods are not enumerable.\nEventTarget.prototype = {\n /**\n * Add a given listener to this event target.\n * @param {string} eventName The event name to add.\n * @param {Function} listener The listener to add.\n * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.\n * @returns {void}\n */\n addEventListener(eventName, listener, options) {\n if (listener == null) {\n return\n }\n if (typeof listener !== \"function\" && !isObject(listener)) {\n throw new TypeError(\"'listener' should be a function or an object.\")\n }\n\n const listeners = getListeners(this)\n const optionsIsObj = isObject(options)\n const capture = optionsIsObj\n ? Boolean(options.capture)\n : Boolean(options)\n const listenerType = capture ? CAPTURE : BUBBLE\n const newNode = {\n listener,\n listenerType,\n passive: optionsIsObj && Boolean(options.passive),\n once: optionsIsObj && Boolean(options.once),\n next: null,\n }\n\n // Set it as the first node if the first node is null.\n let node = listeners.get(eventName)\n if (node === undefined) {\n listeners.set(eventName, newNode)\n return\n }\n\n // Traverse to the tail while checking duplication..\n let prev = null\n while (node != null) {\n if (\n node.listener === listener &&\n node.listenerType === listenerType\n ) {\n // Should ignore duplication.\n return\n }\n prev = node\n node = node.next\n }\n\n // Add it.\n prev.next = newNode\n },\n\n /**\n * Remove a given listener from this event target.\n * @param {string} eventName The event name to remove.\n * @param {Function} listener The listener to remove.\n * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.\n * @returns {void}\n */\n removeEventListener(eventName, listener, options) {\n if (listener == null) {\n return\n }\n\n const listeners = getListeners(this)\n const capture = isObject(options)\n ? Boolean(options.capture)\n : Boolean(options)\n const listenerType = capture ? CAPTURE : BUBBLE\n\n let prev = null\n let node = listeners.get(eventName)\n while (node != null) {\n if (\n node.listener === listener &&\n node.listenerType === listenerType\n ) {\n if (prev !== null) {\n prev.next = node.next\n } else if (node.next !== null) {\n listeners.set(eventName, node.next)\n } else {\n listeners.delete(eventName)\n }\n return\n }\n\n prev = node\n node = node.next\n }\n },\n\n /**\n * Dispatch a given event.\n * @param {Event|{type:string}} event The event to dispatch.\n * @returns {boolean} `false` if canceled.\n */\n dispatchEvent(event) {\n if (event == null || typeof event.type !== \"string\") {\n throw new TypeError('\"event.type\" should be a string.')\n }\n\n // If listeners aren't registered, terminate.\n const listeners = getListeners(this)\n const eventName = event.type\n let node = listeners.get(eventName)\n if (node == null) {\n return true\n }\n\n // Since we cannot rewrite several properties, so wrap object.\n const wrappedEvent = wrapEvent(this, event)\n\n // This doesn't process capturing phase and bubbling phase.\n // This isn't participating in a tree.\n let prev = null\n while (node != null) {\n // Remove this listener if it's once\n if (node.once) {\n if (prev !== null) {\n prev.next = node.next\n } else if (node.next !== null) {\n listeners.set(eventName, node.next)\n } else {\n listeners.delete(eventName)\n }\n } else {\n prev = node\n }\n\n // Call this listener\n setPassiveListener(\n wrappedEvent,\n node.passive ? node.listener : null\n )\n if (typeof node.listener === \"function\") {\n try {\n node.listener.call(this, wrappedEvent)\n } catch (err) {\n if (\n typeof console !== \"undefined\" &&\n typeof console.error === \"function\"\n ) {\n console.error(err)\n }\n }\n } else if (\n node.listenerType !== ATTRIBUTE &&\n typeof node.listener.handleEvent === \"function\"\n ) {\n node.listener.handleEvent(wrappedEvent)\n }\n\n // Break if `event.stopImmediatePropagation` was called.\n if (isStopped(wrappedEvent)) {\n break\n }\n\n node = node.next\n }\n setPassiveListener(wrappedEvent, null)\n setEventPhase(wrappedEvent, 0)\n setCurrentTarget(wrappedEvent, null)\n\n return !wrappedEvent.defaultPrevented\n },\n}\n\n// `constructor` is not enumerable.\nObject.defineProperty(EventTarget.prototype, \"constructor\", {\n value: EventTarget,\n configurable: true,\n writable: true,\n})\n\n// Ensure `eventTarget instanceof window.EventTarget` is `true`.\nif (\n typeof window !== \"undefined\" &&\n typeof window.EventTarget !== \"undefined\"\n) {\n Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype)\n}\n\nexport { defineEventAttribute, EventTarget }\nexport default EventTarget\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;;;;AAmBA,MAAM,WAAW,GAAG,IAAI,OAAO,GAAE;;;;;;;AAOjC,MAAM,QAAQ,GAAG,IAAI,OAAO,GAAE;;;;;;;;AAQ9B,SAAS,EAAE,CAAC,KAAK,EAAE;IACf,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,KAAK,EAAC;IACnC,OAAO,CAAC,MAAM;QACV,IAAI,IAAI,IAAI;QACZ,6CAA6C;QAC7C,KAAK;MACR;IACD,OAAO,IAAI;CACd;;;;;;AAMD,SAAS,aAAa,CAAC,IAAI,EAAE;IACzB,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,EAAE;QAC9B;YACI,OAAO,OAAO,KAAK,WAAW;YAC9B,OAAO,OAAO,CAAC,KAAK,KAAK,UAAU;UACrC;YACE,OAAO,CAAC,KAAK;gBACT,oEAAoE;gBACpE,IAAI,CAAC,eAAe;cACvB;SACJ;QACD,MAAM;KACT;IACD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;QACxB,MAAM;KACT;;IAED,IAAI,CAAC,QAAQ,GAAG,KAAI;IACpB,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,KAAK,UAAU,EAAE;QACjD,IAAI,CAAC,KAAK,CAAC,cAAc,GAAE;KAC9B;CACJ;;;;;;;;;;;;AAYD,SAAS,KAAK,CAAC,WAAW,EAAE,KAAK,EAAE;IAC/B,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE;QAClB,WAAW;QACX,KAAK;QACL,UAAU,EAAE,CAAC;QACb,aAAa,EAAE,WAAW;QAC1B,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,KAAK;QACd,gBAAgB,EAAE,KAAK;QACvB,eAAe,EAAE,IAAI;QACrB,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,IAAI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