commandkit 1.2.0-rc.1 → 1.2.0-rc.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (254) hide show
  1. package/COPYING.md +684 -0
  2. package/README.md +4 -12
  3. package/dist/{ActionRow-CmTHbo2t.js → ActionRow-CbdGFWMT.js} +3 -2
  4. package/dist/{ActionRow-CmTHbo2t.js.map → ActionRow-CbdGFWMT.js.map} +1 -1
  5. package/dist/{CommandKitEventsChannel-Bgw0XCOl.js → CommandKitEventsChannel-BtRzr3Tz.js} +3 -2
  6. package/dist/{CommandKitEventsChannel-Bgw0XCOl.js.map → CommandKitEventsChannel-BtRzr3Tz.js.map} +1 -1
  7. package/dist/{CommandsRouter-Ci1Pe8Vd.js → CommandsRouter-Dmzw-ikm.js} +18 -13
  8. package/dist/{CommandsRouter-Ci1Pe8Vd.js.map → CommandsRouter-Dmzw-ikm.js.map} +1 -1
  9. package/dist/{CompilerPlugin-CjoZAAR8.js → CompilerPlugin-M8r3yNAl.js} +2 -2
  10. package/dist/{CompilerPlugin-CjoZAAR8.js.map → CompilerPlugin-M8r3yNAl.js.map} +1 -1
  11. package/dist/{DefaultLogger-Cy55-uPl.d.ts → DefaultLogger-XCOl5nLd.d.ts} +19 -12
  12. package/dist/{EventInterceptor-CQ4PBpBJ.js → EventInterceptor-CQEXyUTp.js} +3 -5
  13. package/dist/{EventInterceptor-CQ4PBpBJ.js.map → EventInterceptor-CQEXyUTp.js.map} +1 -1
  14. package/dist/{EventWorkerContext-CSlD9rbx.js → EventWorkerContext-Dq29tieI.js} +3 -2
  15. package/dist/{EventWorkerContext-CSlD9rbx.js.map → EventWorkerContext-Dq29tieI.js.map} +1 -1
  16. package/dist/{EventWorkerContext-DJUi1W3T.d.ts → EventWorkerContext-XNgriym3.d.ts} +2 -2
  17. package/dist/{EventsRouter-C_J0M3uO.js → EventsRouter-3Gygh-km.js} +9 -5
  18. package/dist/{EventsRouter-C_J0M3uO.js.map → EventsRouter-3Gygh-km.js.map} +1 -1
  19. package/dist/ILogger-BW8GM-YZ.d.ts +64 -0
  20. package/dist/{Logger-iSjA-DWN.d.ts → Logger-DyfkPk7u.d.ts} +2 -2
  21. package/dist/{MessageCommandParser-ROLibZPX.d.ts → MessageCommandParser-BsGMOTDo.d.ts} +3 -3
  22. package/dist/{MessageCommandParser-B_BEQ3p8.js → MessageCommandParser-Dl0xxtdr.js} +9 -4
  23. package/dist/MessageCommandParser-Dl0xxtdr.js.map +1 -0
  24. package/dist/{PluginCommon-Di1xIa8d.js → PluginCommon-Cvl5yYM_.js} +3 -2
  25. package/dist/{PluginCommon-Di1xIa8d.js.map → PluginCommon-Cvl5yYM_.js.map} +1 -1
  26. package/dist/{RuntimePlugin-CBgBLXTG.js → RuntimePlugin-BUecuBIU.js} +3 -2
  27. package/dist/RuntimePlugin-BUecuBIU.js.map +1 -0
  28. package/dist/analytics/analytics-engine.d.ts +6 -6
  29. package/dist/analytics/analytics-engine.js +29 -28
  30. package/dist/analytics/analytics-provider.d.ts +6 -6
  31. package/dist/analytics/constants.js +1 -1
  32. package/dist/analytics/utils.js +29 -28
  33. package/dist/{analytics-engine-vA4MaJYx.d.ts → analytics-engine-AaAl3kQM.d.ts} +97 -32
  34. package/dist/app/commands/AppCommandRunner.d.ts +6 -6
  35. package/dist/app/commands/AppCommandRunner.js +29 -28
  36. package/dist/app/commands/Context.d.ts +6 -6
  37. package/dist/app/commands/Context.js +29 -28
  38. package/dist/app/commands/MessageCommandParser.d.ts +1 -1
  39. package/dist/app/commands/MessageCommandParser.js +2 -2
  40. package/dist/app/commands/helpers.js +1 -1
  41. package/dist/app/events/EventWorkerContext.d.ts +7 -7
  42. package/dist/app/events/EventWorkerContext.js +1 -1
  43. package/dist/app/handlers/AppCommandHandler.d.ts +6 -6
  44. package/dist/app/handlers/AppCommandHandler.js +29 -28
  45. package/dist/app/handlers/AppEventsHandler.d.ts +6 -6
  46. package/dist/app/handlers/AppEventsHandler.js +29 -28
  47. package/dist/app/index.d.ts +7 -7
  48. package/dist/app/index.js +31 -31
  49. package/dist/app/interrupt/signals.d.ts +2 -2
  50. package/dist/app/interrupt/signals.js +5 -5
  51. package/dist/app/middlewares/permissions.d.ts +42 -0
  52. package/dist/app/middlewares/permissions.js +39 -0
  53. package/dist/app/register/CommandRegistrar.d.ts +6 -6
  54. package/dist/app/register/CommandRegistrar.js +29 -28
  55. package/dist/app/router/CommandsRouter.js +1 -1
  56. package/dist/app/router/EventsRouter.js +1 -1
  57. package/dist/app/router/index.d.ts +1 -1
  58. package/dist/app/router/index.js +3 -3
  59. package/dist/{app-process-CjMovpoZ.js → app-process-cj2vF12T.js} +8 -5
  60. package/dist/{app-process-CjMovpoZ.js.map → app-process-cj2vF12T.js.map} +1 -1
  61. package/dist/{build-DXl8uEv4.js → build-B5qTswWF.js} +18 -14
  62. package/dist/build-B5qTswWF.js.map +1 -0
  63. package/dist/cli/app-process.js +4 -4
  64. package/dist/cli/build.d.ts +6 -6
  65. package/dist/cli/build.js +31 -30
  66. package/dist/cli/common.d.ts +13 -7
  67. package/dist/cli/common.js +4 -3
  68. package/dist/cli/development.js +45 -44
  69. package/dist/cli/development.js.map +1 -1
  70. package/dist/cli/generators.js +42 -11
  71. package/dist/cli/generators.js.map +1 -1
  72. package/dist/cli/information.js +14 -19
  73. package/dist/cli/information.js.map +1 -1
  74. package/dist/cli/init.js +30 -29
  75. package/dist/cli/production.js +34 -32
  76. package/dist/cli/production.js.map +1 -1
  77. package/dist/cli/type-checker.js +4 -4
  78. package/dist/{colors-Cd4Oz-r-.js → colors-DL3ucTiT.js} +3 -2
  79. package/dist/{colors-Cd4Oz-r-.js.map → colors-DL3ucTiT.js.map} +1 -1
  80. package/dist/{commandkit-DMEW0kJg.js → commandkit-ZoBBh0Q_.js} +528 -359
  81. package/dist/commandkit-ZoBBh0Q_.js.map +1 -0
  82. package/dist/commandkit.d.ts +6 -6
  83. package/dist/commandkit.js +29 -28
  84. package/dist/{common-DNADUU3_.js → common-CrqwC-sx.js} +33 -18
  85. package/dist/common-CrqwC-sx.js.map +1 -0
  86. package/dist/common-vnMIelAE.js.map +1 -1
  87. package/dist/components/common/EventInterceptor.js +1 -1
  88. package/dist/components/index.d.ts +2 -2
  89. package/dist/components/index.js +29 -28
  90. package/dist/components/v1/action-row/ActionRow.js +1 -1
  91. package/dist/components/v1/button/Button.js +29 -28
  92. package/dist/components/v1/button/ButtonKit.js +29 -28
  93. package/dist/components/v1/modal/Modal.js +29 -28
  94. package/dist/components/v1/modal/ModalKit.js +29 -28
  95. package/dist/components/v1/select-menu/ChannelSelectMenuKit.js +29 -28
  96. package/dist/components/v1/select-menu/MentionableSelectMenuKit.js +29 -28
  97. package/dist/components/v1/select-menu/RoleSelectMenuKit.js +29 -28
  98. package/dist/components/v1/select-menu/SelectMenu.js +29 -28
  99. package/dist/components/v1/select-menu/StringSelectMenuKit.js +29 -28
  100. package/dist/components/v1/select-menu/UserSelectMenuKit.js +29 -28
  101. package/dist/components/v2/container.js +1 -1
  102. package/dist/components/v2/file.js +1 -1
  103. package/dist/components/v2/index.d.ts +1 -1
  104. package/dist/components/v2/index.js +6 -6
  105. package/dist/components/v2/media-gallery.js +1 -1
  106. package/dist/components/v2/section.js +1 -1
  107. package/dist/components/v2/separator.js +1 -1
  108. package/dist/components/v2/text-display.js +1 -1
  109. package/dist/config/config.d.ts +7 -7
  110. package/dist/config/config.js +29 -28
  111. package/dist/config/default.d.ts +6 -6
  112. package/dist/config/default.js +29 -28
  113. package/dist/config/loader.d.ts +6 -6
  114. package/dist/config/loader.js +29 -28
  115. package/dist/config/types.d.ts +6 -6
  116. package/dist/config/utils.d.ts +6 -6
  117. package/dist/config/utils.js +1 -1
  118. package/dist/{config-CcWJ-vz5.d.ts → config-D-JMp2IO.d.ts} +2 -2
  119. package/dist/constants-4oxxvaJA.js.map +1 -1
  120. package/dist/constants-B5_Ta7PR.js.map +1 -1
  121. package/dist/{constants-CUND8XkG.js → constants-BOOGN85p.js} +3 -2
  122. package/dist/{constants-CUND8XkG.js.map → constants-BOOGN85p.js.map} +1 -1
  123. package/dist/{constants-DrjIvQd6.d.ts → constants-D8PMA9on.d.ts} +1 -1
  124. package/dist/{container-z621KfH5.js → container-C6GtfAPW.js} +3 -2
  125. package/dist/{container-z621KfH5.js.map → container-C6GtfAPW.js.map} +1 -1
  126. package/dist/context/async-context.d.ts +7 -7
  127. package/dist/context/async-context.js +31 -29
  128. package/dist/context/environment.d.ts +6 -6
  129. package/dist/context/environment.js +29 -28
  130. package/dist/{dotprops-C_4L7RPD.js → dotprops-tnhpnszJ.js} +2 -2
  131. package/dist/{dotprops-C_4L7RPD.js.map → dotprops-tnhpnszJ.js.map} +1 -1
  132. package/dist/element-Bak9llw_.js.map +1 -1
  133. package/dist/env-_68PRRoA.js.map +1 -1
  134. package/dist/error-codes-B4TyW4Ct.d.ts +54 -0
  135. package/dist/{error-codes-C-ViHyu-.js → error-codes-Ds0bnPvT.js} +2 -2
  136. package/dist/error-codes-Ds0bnPvT.js.map +1 -0
  137. package/dist/events/CommandKitEventsChannel.d.ts +6 -6
  138. package/dist/events/CommandKitEventsChannel.js +1 -1
  139. package/dist/{feature-flags-Cxl9JtVG.js → feature-flags-CKNrjgqg.js} +11 -16
  140. package/dist/{feature-flags-Cxl9JtVG.js.map → feature-flags-CKNrjgqg.js.map} +1 -1
  141. package/dist/{file-DVZC0QXI.js → file-DVOELoNv.js} +3 -2
  142. package/dist/{file-DVZC0QXI.js.map → file-DVOELoNv.js.map} +1 -1
  143. package/dist/flags/FlagProvider.d.ts +6 -6
  144. package/dist/flags/FlagProvider.js.map +1 -1
  145. package/dist/flags/feature-flags.d.ts +6 -6
  146. package/dist/flags/feature-flags.js +30 -29
  147. package/dist/flags/store.d.ts +6 -6
  148. package/dist/flags/store.js +1 -1
  149. package/dist/{helpers-BUlN3lIz.js → helpers-Dl8wW6aO.js} +3 -2
  150. package/dist/{helpers-BUlN3lIz.js.map → helpers-Dl8wW6aO.js.map} +1 -1
  151. package/dist/index-CUPkUUOR.d.ts +1 -0
  152. package/dist/index-Dw5cCt-A.d.ts +1 -0
  153. package/dist/index-E7Wvm5uX.d.ts +1 -0
  154. package/dist/index.d.ts +13 -12
  155. package/dist/index.js +47 -38
  156. package/dist/index.js.map +1 -0
  157. package/dist/{init-DTBFphOg.js → init-_7_QDifv.js} +11 -8
  158. package/dist/{init-DTBFphOg.js.map → init-_7_QDifv.js.map} +1 -1
  159. package/dist/kv/constants.d.ts +1 -1
  160. package/dist/kv/dotprops.js +1 -1
  161. package/dist/kv/kv.d.ts +2 -2
  162. package/dist/kv/kv.js +8 -10
  163. package/dist/kv/kv.js.map +1 -1
  164. package/dist/kv/serde.d.ts +2 -2
  165. package/dist/kv/serde.js +1 -1
  166. package/dist/logger/DefaultLogger.d.ts +2 -2
  167. package/dist/logger/DefaultLogger.js +29 -28
  168. package/dist/logger/ILogger.d.ts +1 -1
  169. package/dist/logger/Logger.d.ts +2 -2
  170. package/dist/logger/Logger.js +29 -28
  171. package/dist/logger/NoopLogger.d.ts +41 -11
  172. package/dist/logger/NoopLogger.js +5 -25
  173. package/dist/logger/NoopLogger.js.map +1 -1
  174. package/dist/{media-gallery-CIKypjbJ.js → media-gallery-zDtJ3kxb.js} +3 -2
  175. package/dist/{media-gallery-CIKypjbJ.js.map → media-gallery-zDtJ3kxb.js.map} +1 -1
  176. package/dist/plugins/CompilerPlugin.d.ts +6 -6
  177. package/dist/plugins/CompilerPlugin.js +2 -2
  178. package/dist/plugins/PluginCommon.d.ts +6 -6
  179. package/dist/plugins/PluginCommon.js +1 -1
  180. package/dist/plugins/RuntimePlugin.d.ts +6 -6
  181. package/dist/plugins/RuntimePlugin.js +2 -2
  182. package/dist/plugins/index.d.ts +6 -6
  183. package/dist/plugins/index.js +29 -28
  184. package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +6 -6
  185. package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +29 -28
  186. package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +6 -6
  187. package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +29 -28
  188. package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +6 -6
  189. package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +29 -28
  190. package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +6 -6
  191. package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +29 -28
  192. package/dist/plugins/plugin-runtime/runtime.d.ts +6 -6
  193. package/dist/plugins/plugin-runtime/runtime.js +1 -1
  194. package/dist/plugins/types.d.ts +6 -6
  195. package/dist/{resolve-file-url-DHTQj2mU.js → resolve-file-url-ChIyw-Vf.js} +4 -4
  196. package/dist/{resolve-file-url-DHTQj2mU.js.map → resolve-file-url-ChIyw-Vf.js.map} +1 -1
  197. package/dist/{section-CuYr0Inu.js → section-DlvrDoJK.js} +4 -4
  198. package/dist/{section-CuYr0Inu.js.map → section-DlvrDoJK.js.map} +1 -1
  199. package/dist/{separator-DLdWBjSN.js → separator-DL6QH5H1.js} +4 -4
  200. package/dist/{separator-DLdWBjSN.js.map → separator-DL6QH5H1.js.map} +1 -1
  201. package/dist/{serde-BUDI03pX.d.ts → serde-BYaKrsOV.d.ts} +2 -2
  202. package/dist/{serde-CHySNpFr.js → serde-Cc8iUa9J.js} +2 -2
  203. package/dist/{serde-CHySNpFr.js.map → serde-Cc8iUa9J.js.map} +1 -1
  204. package/dist/{signals-DHdYrd-n.js → signals-ChFMD7mB.js} +12 -15
  205. package/dist/signals-ChFMD7mB.js.map +1 -0
  206. package/dist/{signals-BQbEfy3X.d.ts → signals-SHg7J1U_.d.ts} +4 -7
  207. package/dist/{store-CiqLHedg.js → store-CM6pWVZh.js} +3 -2
  208. package/dist/{store-CiqLHedg.js.map → store-CM6pWVZh.js.map} +1 -1
  209. package/dist/{text-display--p2-BoUa.js → text-display-DbMumig_.js} +3 -2
  210. package/dist/{text-display--p2-BoUa.js.map → text-display-DbMumig_.js.map} +1 -1
  211. package/dist/{type-checker-1Iu1jJcy.js → type-checker-ocNSZh0W.js} +7 -5
  212. package/dist/{type-checker-1Iu1jJcy.js.map → type-checker-ocNSZh0W.js.map} +1 -1
  213. package/dist/{types-package-DrnIdWLg.js → types-package-BWArjyBF.js} +7 -4
  214. package/dist/{types-package-DrnIdWLg.js.map → types-package-BWArjyBF.js.map} +1 -1
  215. package/dist/types.d.ts +7 -7
  216. package/dist/utils/colors.js +1 -1
  217. package/dist/utils/dev-hooks.d.ts +6 -6
  218. package/dist/utils/dev-hooks.js +29 -28
  219. package/dist/utils/error-codes.d.ts +2 -54
  220. package/dist/utils/error-codes.js +1 -1
  221. package/dist/utils/resolve-file-url.js +1 -1
  222. package/dist/utils/types-package.js +1 -1
  223. package/dist/utils/useful-stuff/async-queue.js.map +1 -1
  224. package/dist/utils/useful-stuff/mutex.js +1 -2
  225. package/dist/utils/useful-stuff/mutex.js.map +1 -1
  226. package/dist/utils/useful-stuff/ratelimiter.js +2 -4
  227. package/dist/utils/useful-stuff/ratelimiter.js.map +1 -1
  228. package/dist/utils/useful-stuff/semaphore.js +2 -4
  229. package/dist/utils/useful-stuff/semaphore.js.map +1 -1
  230. package/dist/utils/utilities.js +29 -28
  231. package/dist/utils/warn-unstable.js.map +1 -1
  232. package/dist/utils-DCSnVAZ6.js.map +1 -1
  233. package/dist/{utils-BnXM4eKk.js → utils-KsNof0Xz.js} +1 -1
  234. package/dist/{utils-BnXM4eKk.js.map → utils-KsNof0Xz.js.map} +1 -1
  235. package/dist/{version-rfStvlqX.js → version--Q1nmlBz.js} +2 -2
  236. package/dist/{version-rfStvlqX.js.map → version--Q1nmlBz.js.map} +1 -1
  237. package/dist/version.js +1 -1
  238. package/hooks.cjs +2 -0
  239. package/hooks.d.ts +3 -1
  240. package/package.json +61 -60
  241. package/LICENSE +0 -5
  242. package/dist/ILogger-DBGON5wx.d.ts +0 -34
  243. package/dist/MessageCommandParser-B_BEQ3p8.js.map +0 -1
  244. package/dist/RuntimePlugin-CBgBLXTG.js.map +0 -1
  245. package/dist/build-DXl8uEv4.js.map +0 -1
  246. package/dist/commandkit-DMEW0kJg.js.map +0 -1
  247. package/dist/common-DNADUU3_.js.map +0 -1
  248. package/dist/error-codes-C-ViHyu-.js.map +0 -1
  249. package/dist/index-DKcmsWXw.d.ts +0 -1
  250. package/dist/index-DSBMRX9A.d.ts +0 -1
  251. package/dist/index-DdqikUQD.d.ts +0 -1
  252. package/dist/signals-DHdYrd-n.js.map +0 -1
  253. /package/dist/{router-DHnFRADH.js → router-Dn35v30f.js} +0 -0
  254. /package/dist/{runtime-5fxB4uhe.js → runtime-DB9CiPfe.js} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageCommandParser-Dl0xxtdr.js","names":[],"sources":["../src/app/commands/MessageCommandParser.ts"],"sourcesContent":["import { Channel } from 'diagnostics_channel';\nimport {\n Message,\n ApplicationCommandOptionType,\n GuildMember,\n Attachment,\n User,\n Role,\n CommandInteractionOption,\n} from 'discord.js';\nimport {\n CommandKitErrorCodes,\n createCommandKitError,\n} from '../../utils/error-codes';\n\n/**\n * Represents a parsed message command with its components.\n */\nexport interface ParsedMessageCommand {\n command: string;\n options: { name: string; value: unknown }[];\n subcommand?: string;\n subcommandGroup?: string;\n}\n\n/**\n * Schema defining the types of options for a message command.\n */\nexport type MessageCommandOptionsSchema = Record<\n string,\n ApplicationCommandOptionType\n>;\n\n/**\n * Parses message content into structured command data with options and subcommands.\n */\nexport class MessageCommandParser {\n /**\n * @private\n * @internal\n */\n #parsed: ParsedMessageCommand | null = null;\n\n /**\n * @private\n * @internal\n */\n #options: MessageCommandOptions | null = null;\n\n /**\n * @private\n * @internal\n */\n #args: string[] = [];\n\n /**\n * Creates a new message command parser.\n * @param message - The Discord message to parse\n * @param prefix - Array of valid command prefixes or a regular expression\n * @param schema - Function that returns the options schema for a command\n */\n public constructor(\n public message: Message,\n private prefix: string[] | RegExp,\n private schema: (command: string) => MessageCommandOptionsSchema,\n ) {}\n\n /**\n * Gets the parsed command arguments.\n * @returns Array of command arguments\n */\n public getArgs() {\n void this.parse();\n return this.#args;\n }\n\n /**\n * Gets the message command options object for easy access to typed option values.\n */\n public get options() {\n if (!this.#options) {\n this.#options = new MessageCommandOptions(this);\n }\n\n return this.#options;\n }\n\n /**\n * Gets a specific option value by name.\n * @param name - The option name\n * @returns The option value or undefined if not found\n */\n public getOption<T>(name: string): T | undefined {\n return this.parse().options.find((o) => o.name === name)?.value as T;\n }\n\n /**\n * Gets the main command name.\n * @returns The command name\n */\n public getCommand(): string {\n return this.parse().command;\n }\n\n /**\n * Gets the subcommand name if present.\n * @returns The subcommand name or undefined\n */\n public getSubcommand(): string | undefined {\n return this.parse().subcommand;\n }\n\n /**\n * Gets the subcommand group name if present.\n * @returns The subcommand group name or undefined\n */\n public getSubcommandGroup(): string | undefined {\n return this.parse().subcommandGroup;\n }\n\n /**\n * Gets the prefix used in the message.\n * @returns The matched prefix or undefined\n */\n public getPrefix() {\n if (this.prefix instanceof RegExp) {\n const match = this.message.content.match(this.prefix);\n return match?.[0];\n }\n\n for (const p of this.prefix) {\n if (this.message.content.startsWith(p)) {\n return p;\n }\n }\n }\n\n /**\n * Gets the full command including subcommand group and subcommand.\n * @returns The complete command string\n */\n public getFullCommand() {\n return [this.getCommand(), this.getSubcommandGroup(), this.getSubcommand()]\n .filter((v) => v)\n .join(' ');\n }\n\n /**\n * Parses the message content into structured command data.\n * @returns The parsed command data\n */\n public parse(): ParsedMessageCommand {\n if (this.#parsed) {\n return this.#parsed;\n }\n\n const content = this.message.content;\n\n const prefix = this.getPrefix();\n\n if (!prefix) {\n throw createCommandKitError(CommandKitErrorCodes.InvalidCommandPrefix);\n }\n\n const parts = content.slice(prefix.length).trim().split(' ');\n const command = parts.shift();\n\n this.#args = parts;\n\n let subcommandGroup: string | undefined;\n let subcommand: string | undefined;\n\n if (command?.includes(':')) {\n const [, group, cmd] = command.split(':');\n\n if (!cmd && group) {\n subcommand = group;\n } else if (cmd && group) {\n subcommandGroup = group;\n subcommand = cmd;\n }\n }\n\n const schema = this.schema(\n [command, subcommandGroup, subcommand].filter(Boolean).join(' ').trim(),\n );\n\n const options = parts\n .map((part) => {\n try {\n const [name, value] = part.split(':');\n\n if (!(name in schema)) return null;\n\n switch (schema[name]) {\n case ApplicationCommandOptionType.Boolean:\n return { name, value: value === 'true' };\n case ApplicationCommandOptionType.Integer:\n return { name, value: parseInt(value, 10) };\n case ApplicationCommandOptionType.Number:\n return { name, value: parseFloat(value) };\n case ApplicationCommandOptionType.String:\n return { name, value };\n case ApplicationCommandOptionType.User:\n return {\n name,\n value: this.message.mentions.users.find((u) => {\n return u.id === value.replace(/[<@!>]/g, '');\n }),\n };\n case ApplicationCommandOptionType.Channel:\n return {\n name,\n value: this.message.mentions.channels.find((c) => {\n return c.id === value.replace(/[<#>]/g, '');\n }),\n };\n case ApplicationCommandOptionType.Role:\n return {\n name,\n value: this.message.mentions.roles.find((r) => {\n return r.id === value.replace(/[<@&>]/g, '');\n }),\n };\n case ApplicationCommandOptionType.Attachment:\n return {\n name,\n value: this.message.attachments.find((a) => {\n return a.name === value;\n }),\n };\n default:\n return null;\n }\n } catch {\n // Invalid option\n return null;\n }\n })\n .filter((v) => v !== null);\n\n this.#parsed = {\n command: command!,\n options,\n subcommand,\n subcommandGroup,\n };\n\n return this.#parsed;\n }\n}\n\n/**\n * Provides typed access to message command options with methods similar to Discord.js interaction options.\n */\nexport class MessageCommandOptions {\n /**\n * Creates a new message command options instance.\n * @param parser - The message command parser instance\n */\n public constructor(private parser: MessageCommandParser) {}\n\n /**\n * @private\n * @internal\n */\n private assertOption<T>(name: string, required = false) {\n const option = this.parser.getOption<T>(name);\n\n if (required && option === undefined) {\n throw new Error(`Option \"${name}\" is required.`);\n }\n\n return option ?? null;\n }\n\n /**\n * Gets a guild member from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The guild member or null if not found\n */\n getMember(name: string): GuildMember | null;\n getMember(name: string, required: true): GuildMember;\n getMember(name: string, required = false) {\n const user = this.assertOption<User>(name, required);\n const member = this.parser.message.guild?.members.cache.get(user?.id!);\n\n if (required && !member) {\n throw new Error(`Member \"${name}\" is required.`);\n }\n\n return member ?? null;\n }\n\n /**\n * Gets an attachment from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The attachment or null if not found\n */\n getAttachment(name: string): Attachment | null;\n getAttachment(name: string, required: true): Attachment;\n getAttachment(name: string, required = false) {\n return this.assertOption<Attachment>(name, required);\n }\n\n /**\n * Gets a boolean value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The boolean value or null if not found\n */\n getBoolean(name: string): boolean | null;\n getBoolean(name: string, required: true): boolean;\n getBoolean(name: string, required = false) {\n return this.assertOption<boolean>(name, required);\n }\n\n /**\n * Gets a number value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The number value or null if not found\n */\n getNumber(name: string): number | null;\n getNumber(name: string, required: true): number;\n getNumber(name: string, required = false) {\n return this.assertOption<number>(name, required);\n }\n\n /**\n * Gets a string value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The string value or null if not found\n */\n getString(name: string): string | null;\n getString(name: string, required: true): string;\n getString(name: string, required = false) {\n return this.assertOption<string>(name, required);\n }\n\n /**\n * Gets an integer value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The integer value or null if not found\n */\n getInteger(name: string): number | null;\n getInteger(name: string, required: true): number;\n getInteger(name: string, required = false) {\n return this.assertOption<number>(name, required);\n }\n\n /**\n * Gets a user from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The user or null if not found\n */\n getUser(name: string): User | null;\n getUser(name: string, required: true): User;\n getUser(name: string, required = false) {\n return this.assertOption<User>(name, required);\n }\n\n /**\n * Gets a channel from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The channel or null if not found\n */\n getChannel(name: string): Channel | null;\n getChannel(name: string, required: true): Channel;\n getChannel(name: string, required = false) {\n return this.assertOption<Channel>(name, required);\n }\n\n /**\n * Gets a role from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The role or null if not found\n */\n getRole(name: string): Role | null;\n getRole(name: string, required: true): Role;\n getRole(name: string, required = false) {\n return this.assertOption<Role>(name, required);\n }\n\n /**\n * Gets a mentionable (user, member, or role) from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The mentionable or null if not found\n */\n getMentionable(\n name: string,\n ): NonNullable<CommandInteractionOption['member' | 'role' | 'user']> | null;\n getMentionable(\n name: string,\n required: true,\n ): NonNullable<CommandInteractionOption['member' | 'role' | 'user']>;\n getMentionable(\n name: string,\n required = false,\n ): NonNullable<CommandInteractionOption['member' | 'role' | 'user']> | null {\n const target = this.assertOption(name, required);\n\n if (\n target instanceof GuildMember ||\n target instanceof User ||\n target instanceof Role\n ) {\n return target;\n }\n\n if (required) {\n throw new Error(`Mentionable \"${name}\" is required.`);\n }\n\n return null;\n }\n\n /**\n * Gets the subcommand name from the command.\n * @param required - Whether the subcommand is required\n * @returns The subcommand name or null if not found\n */\n getSubcommand(): string | null;\n getSubcommand(required: true): string;\n getSubcommand(required = false) {\n const sub = this.parser.getSubcommand();\n\n if (required && sub === undefined) {\n throw new Error('Subcommand is required.');\n }\n\n return sub ?? null;\n }\n\n /**\n * Gets the subcommand group name from the command.\n * @param required - Whether the subcommand group is required\n * @returns The subcommand group name or null if not found\n */\n getSubcommandGroup(): string | null;\n getSubcommandGroup(required: true): string;\n getSubcommandGroup(required = false) {\n const sub = this.parser.getSubcommandGroup();\n\n if (required && sub === undefined) {\n throw new Error('Subcommand group is required.');\n }\n\n return sub ?? null;\n }\n}\n"],"mappings":"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"}
@@ -1,5 +1,6 @@
1
1
  const require_chunk = require('./chunk-nOFOJqeH.js');
2
- const node_crypto = require_chunk.__toESM(require("node:crypto"));
2
+ let node_crypto = require("node:crypto");
3
+ node_crypto = require_chunk.__toESM(node_crypto);
3
4
 
4
5
  //#region src/plugins/PluginCommon.ts
5
6
  /**
@@ -67,4 +68,4 @@ Object.defineProperty(exports, 'isPlugin', {
67
68
  return isPlugin;
68
69
  }
69
70
  });
70
- //# sourceMappingURL=PluginCommon-Di1xIa8d.js.map
71
+ //# sourceMappingURL=PluginCommon-Cvl5yYM_.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PluginCommon-Di1xIa8d.js","names":[],"sources":["../src/plugins/PluginCommon.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport { CommonPluginRuntime } from './plugin-runtime/runtime';\n\n/**\n * The options for a CommandKit plugin.\n */\nexport type PluginOptions = Record<string, any>;\n\n/**\n * Enum representing the type of plugin.\n * - Compiler: A plugin that runs at compile time.\n * - Runtime: A plugin that runs at runtime.\n */\nexport enum PluginType {\n Compiler = 'compiler',\n Runtime = 'runtime',\n}\n\n/**\n * Base class for CommandKit plugins.\n */\nexport abstract class PluginCommon<\n T extends PluginOptions = PluginOptions,\n C extends CommonPluginRuntime = CommonPluginRuntime,\n> {\n /**\n * The type of the plugin, either Compiler or Runtime.\n */\n public abstract readonly type: PluginType;\n /**\n * Unique identifier for the plugin instance.\n */\n public readonly id = randomUUID();\n /**\n * The time when the plugin was loaded, in milliseconds since the Unix epoch.\n */\n public readonly loadedAt = Date.now();\n /**\n * The name of the plugin.\n */\n public abstract readonly name: string;\n\n /**\n * Creates a new instance of the plugin.\n */\n public constructor(protected readonly options: T) {}\n\n /**\n * Called when this plugin is activated\n */\n public async activate(ctx: C): Promise<void> {}\n\n /**\n * Called when this plugin is deactivated\n */\n public async deactivate(ctx: C): Promise<void> {}\n}\n\n/**\n * Whether the given object is a CommandKit plugin.\n * @param plugin The object to check.\n * @returns Boolean indicating whether the object is a plugin.\n */\nexport function isPlugin(\n plugin: unknown,\n): plugin is PluginCommon<PluginOptions> {\n return plugin instanceof PluginCommon;\n}\n"],"mappings":";;;;;;;;;AAaA,IAAY,oDAAL;AACL;AACA;;AACF;;;;AAKA,IAAsB,eAAtB,MAGA;;;;CAQE,AAAgB;;;;CAIhB,AAAgB,WAAW,KAAK;;;;CAShC,AAAO,YAAY,AAAmB,SAAY;EAAZ;CAAa;;;;CAKnD,MAAa,SAAS,KAAuB,CAAC;;;;CAK9C,MAAa,WAAW,KAAuB,CAAC;AAClD;;;;;;AAOA,SAAgB,SAChB,QACwC;AACtC,QAAO,kBAAkB;AAC3B"}
1
+ {"version":3,"file":"PluginCommon-Cvl5yYM_.js","names":[],"sources":["../src/plugins/PluginCommon.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport { CommonPluginRuntime } from './plugin-runtime/runtime';\n\n/**\n * The options for a CommandKit plugin.\n */\nexport type PluginOptions = Record<string, any>;\n\n/**\n * Enum representing the type of plugin.\n * - Compiler: A plugin that runs at compile time.\n * - Runtime: A plugin that runs at runtime.\n */\nexport enum PluginType {\n Compiler = 'compiler',\n Runtime = 'runtime',\n}\n\n/**\n * Base class for CommandKit plugins.\n */\nexport abstract class PluginCommon<\n T extends PluginOptions = PluginOptions,\n C extends CommonPluginRuntime = CommonPluginRuntime,\n> {\n /**\n * The type of the plugin, either Compiler or Runtime.\n */\n public abstract readonly type: PluginType;\n /**\n * Unique identifier for the plugin instance.\n */\n public readonly id = randomUUID();\n /**\n * The time when the plugin was loaded, in milliseconds since the Unix epoch.\n */\n public readonly loadedAt = Date.now();\n /**\n * The name of the plugin.\n */\n public abstract readonly name: string;\n\n /**\n * Creates a new instance of the plugin.\n */\n public constructor(protected readonly options: T) {}\n\n /**\n * Called when this plugin is activated\n */\n public async activate(ctx: C): Promise<void> {}\n\n /**\n * Called when this plugin is deactivated\n */\n public async deactivate(ctx: C): Promise<void> {}\n}\n\n/**\n * Whether the given object is a CommandKit plugin.\n * @param plugin The object to check.\n * @returns Boolean indicating whether the object is a plugin.\n */\nexport function isPlugin(\n plugin: unknown,\n): plugin is PluginCommon<PluginOptions> {\n return plugin instanceof PluginCommon;\n}\n"],"mappings":";;;;;;;;;;AAaA,IAAY,oDAAL;AACL;AACA;;;;;;AAMF,IAAsB,eAAtB,MAGA;;;;CAQE,AAAgB,kCAAiB;;;;CAIjC,AAAgB,WAAW,KAAK,KAAK;;;;CASrC,AAAO,YAAY,AAAmB,SAAY;EAAZ;;;;;CAKtC,MAAa,SAAS,KAAuB;;;;CAK7C,MAAa,WAAW,KAAuB;;;;;;;AAQjD,SAAgB,SAChB,QACwC;AACtC,QAAO,kBAAkB"}
@@ -1,4 +1,4 @@
1
- const require_PluginCommon = require('./PluginCommon-Di1xIa8d.js');
1
+ const require_PluginCommon = require('./PluginCommon-Cvl5yYM_.js');
2
2
 
3
3
  //#region src/plugins/RuntimePlugin.ts
4
4
  /**
@@ -6,6 +6,7 @@ const require_PluginCommon = require('./PluginCommon-Di1xIa8d.js');
6
6
  */
7
7
  var RuntimePlugin = class extends require_PluginCommon.PluginCommon {
8
8
  type = require_PluginCommon.PluginType.Runtime;
9
+ preload = /* @__PURE__ */ new Set();
9
10
  /**
10
11
  * Called before commands are loaded
11
12
  */
@@ -130,4 +131,4 @@ Object.defineProperty(exports, 'isRuntimePlugin', {
130
131
  return isRuntimePlugin;
131
132
  }
132
133
  });
133
- //# sourceMappingURL=RuntimePlugin-CBgBLXTG.js.map
134
+ //# sourceMappingURL=RuntimePlugin-BUecuBIU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RuntimePlugin-BUecuBIU.js","names":[],"sources":["../src/plugins/RuntimePlugin.ts"],"sourcesContent":["import { Interaction, Message } from 'discord.js';\nimport {\n isPlugin,\n PluginCommon,\n PluginOptions,\n PluginType,\n} from './PluginCommon';\nimport type { CommandKitPluginRuntime } from './plugin-runtime/CommandKitPluginRuntime';\nimport { CommandBuilderLike, PreparedAppCommandExecution } from '../app';\nimport { CommandKitEnvironment } from '../context/environment';\nimport { CommandKitHMREvent } from '../utils/dev-hooks';\nimport { PreRegisterCommandsEvent } from '../app/register/CommandRegistrar';\nimport { CommandKitEventDispatch } from './types';\n\n/**\n * CommandKit plugin that runs at the runtime.\n */\nexport abstract class RuntimePlugin<\n T extends PluginOptions = PluginOptions,\n> extends PluginCommon<T, CommandKitPluginRuntime> {\n public readonly type = PluginType.Runtime;\n public readonly preload = new Set<string>();\n\n /**\n * Called before commands are loaded\n */\n public async onBeforeCommandsLoad(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called after commands are loaded\n */\n public async onAfterCommandsLoad(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called before events are loaded\n */\n public async onBeforeEventsLoad(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called after events are loaded\n */\n public async onAfterEventsLoad(ctx: CommandKitPluginRuntime): Promise<void> {}\n\n /**\n * Called before the client logs in\n */\n public async onBeforeClientLogin(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called after the client logs in\n */\n public async onAfterClientLogin(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called before interaction is handled\n * @param interaction The interaction\n */\n public async onBeforeInteraction(\n ctx: CommandKitPluginRuntime,\n interaction: Interaction,\n ): Promise<void> {}\n\n /**\n * Called before message command is processed\n * @param message The message\n */\n public async onBeforeMessageCommand(\n ctx: CommandKitPluginRuntime,\n message: Message,\n ): Promise<void> {}\n\n /**\n * Called before command is executed. This method can execute the command itself.\n * @param source The source that triggered the command\n * @param command The command\n * @param execute The function that executes the command\n */\n public async executeCommand(\n ctx: CommandKitPluginRuntime,\n env: CommandKitEnvironment,\n source: Interaction | Message,\n command: PreparedAppCommandExecution,\n execute: () => Promise<any>,\n ): Promise<boolean> {\n return false;\n }\n\n /**\n * Called after events router is initialized\n * @param ctx The context\n */\n public async onEventsRouterInit(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called after commands router is initialized\n * @param ctx The context\n */\n public async onCommandsRouterInit(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called when HMR event is received\n * @param ctx The context\n * @param event The event\n */\n public async performHMR(\n ctx: CommandKitPluginRuntime,\n event: CommandKitHMREvent,\n ): Promise<void> {}\n\n /**\n * Called before command is loaded for registration. This method can be used to modify the command data before it is loaded.\n * @param ctx The context\n * @param commands The command that is being loaded. This is a CommandBuilderLike object which represents Discord's command\n */\n async prepareCommand(\n ctx: CommandKitPluginRuntime,\n commands: CommandBuilderLike,\n ): Promise<CommandBuilderLike | null> {\n return null;\n }\n\n /**\n * Called before command is registered to discord. This method can cancel the registration of the command and handle it manually.\n * @param ctx The context\n * @param data The command registration data\n */\n async onBeforeRegisterCommands(\n ctx: CommandKitPluginRuntime,\n event: PreRegisterCommandsEvent,\n ): Promise<void> {}\n\n /**\n * Called before global commands registration. This method can cancel the registration of the command and handle it manually.\n * This method is called after `onBeforeRegisterCommands` if that stage was not handled.\n * @param ctx The context\n * @param event The command registration data\n */\n async onBeforeRegisterGlobalCommands(\n ctx: CommandKitPluginRuntime,\n event: PreRegisterCommandsEvent,\n ): Promise<void> {}\n\n /**\n * Called before guild commands registration. This method can cancel the registration of the command and handle it manually.\n * This method is called before guilds of the command are resolved. It is called after `onBeforeRegisterCommands` if that stage was not handled.\n * @param ctx The context\n * @param event The command registration data\n */\n async onBeforePrepareGuildCommandsRegistration(\n ctx: CommandKitPluginRuntime,\n event: PreRegisterCommandsEvent,\n ): Promise<void> {}\n\n /**\n * Called before guild commands registration. This method can cancel the registration of the command and handle it manually.\n * This method is called after guilds of the command are resolved. It is called after `onBeforePrepareGuildCommandsRegistration` if that stage was not handled.\n * @param ctx The context\n * @param event The command registration data\n */\n async onBeforeRegisterGuildCommands(\n ctx: CommandKitPluginRuntime,\n event: PreRegisterCommandsEvent,\n ): Promise<void> {}\n\n /**\n * Called after command and all of its deferred functions are executed.\n * @param ctx The context\n * @param env The environment of the command. This environment contains the command execution data such as command context and more.\n */\n async onAfterCommand(\n ctx: CommandKitPluginRuntime,\n env: CommandKitEnvironment,\n ) {}\n\n /**\n * Called before emitting an event\n * @param ctx The context\n * @param event The event that is being emitted\n */\n public async willEmitEvent(\n ctx: CommandKitPluginRuntime,\n event: CommandKitEventDispatch,\n ) {}\n}\n\nexport function isRuntimePlugin(plugin: unknown): plugin is RuntimePlugin {\n return (\n plugin instanceof RuntimePlugin ||\n (isPlugin(plugin) && plugin.type === PluginType.Runtime)\n );\n}\n"],"mappings":";;;;;;AAiBA,IAAsB,gBAAtB,cAEA,kCAAyC;CACvC,AAAgB,OAAO,gCAAW;CAClC,AAAgB,0BAAU,IAAI,KAAa;;;;CAK3C,MAAa,qBACb,KACgB;;;;CAKhB,MAAa,oBACb,KACgB;;;;CAKhB,MAAa,mBACb,KACgB;;;;CAKhB,MAAa,kBAAkB,KAA6C;;;;CAK5E,MAAa,oBACb,KACgB;;;;CAKhB,MAAa,mBACb,KACgB;;;;;CAMhB,MAAa,oBACb,KACA,aACgB;;;;;CAMhB,MAAa,uBACb,KACA,SACgB;;;;;;;CAQhB,MAAa,eACb,KACA,KACA,QACA,SACA,SACmB;AACjB,SAAO;;;;;;CAOT,MAAa,mBACb,KACgB;;;;;CAMhB,MAAa,qBACb,KACgB;;;;;;CAOhB,MAAa,WACb,KACA,OACgB;;;;;;CAOhB,MAAM,eACN,KACA,UACqC;AACnC,SAAO;;;;;;;CAQT,MAAM,yBACN,KACA,OACgB;;;;;;;CAQhB,MAAM,+BACN,KACA,OACgB;;;;;;;CAQhB,MAAM,yCACN,KACA,OACgB;;;;;;;CAQhB,MAAM,8BACN,KACA,OACgB;;;;;;CAOhB,MAAM,eACN,KACA,KACA;;;;;;CAOA,MAAa,cACb,KACA,OACA;;AAGF,SAAgB,gBAAgB,QAA0C;AACxE,QACE,kBAAkB,iBAClB,8BAAS,OAAO,IAAI,OAAO,SAAS,gCAAW"}
@@ -1,4 +1,4 @@
1
- import { AnalyticsEngine, FilterFunction } from "../analytics-engine-vA4MaJYx.js";
1
+ import { AnalyticsEngine, FilterFunction } from "../analytics-engine-AaAl3kQM.js";
2
2
  import "../EventInterceptor-x-R2qshQ.js";
3
3
  import "../ButtonKit-C7r7RPNf.js";
4
4
  import "../ModalKit-Btz58KYn.js";
@@ -20,13 +20,13 @@ import "../media-gallery-BMsXSot3.js";
20
20
  import "../section-Dh_FhPeC.js";
21
21
  import "../separator-CMf6Cyy5.js";
22
22
  import "../text-display-DRw3r_lK.js";
23
- import "../index-DSBMRX9A.js";
24
- import "../index-DdqikUQD.js";
25
- import "../MessageCommandParser-ROLibZPX.js";
26
- import "../signals-BQbEfy3X.js";
23
+ import "../index-Dw5cCt-A.js";
24
+ import "../index-E7Wvm5uX.js";
25
+ import "../MessageCommandParser-BsGMOTDo.js";
26
+ import "../signals-SHg7J1U_.js";
27
27
  import "../helpers-Wg6P5fRQ.js";
28
28
  import "../CommandsRouter-CoOA7hkf.js";
29
29
  import "../EventsRouter-BacqK6z3.js";
30
- import "../index-DKcmsWXw.js";
30
+ import "../index-CUPkUUOR.js";
31
31
  import "../constants-MKu-Q1jh.js";
32
32
  export { AnalyticsEngine, FilterFunction };
@@ -1,37 +1,38 @@
1
- require('../colors-Cd4Oz-r-.js');
2
- require('../ActionRow-CmTHbo2t.js');
3
- require('../error-codes-C-ViHyu-.js');
4
- const require_commandkit = require('../commandkit-DMEW0kJg.js');
1
+ require('../colors-DL3ucTiT.js');
2
+ require('../ActionRow-CbdGFWMT.js');
3
+ require('../error-codes-Ds0bnPvT.js');
4
+ const require_commandkit = require('../commandkit-ZoBBh0Q_.js');
5
5
  require('../common-CcfjYnPG.js');
6
6
  require('../common-vnMIelAE.js');
7
- require('../container-z621KfH5.js');
8
- require('../file-DVZC0QXI.js');
9
- require('../media-gallery-CIKypjbJ.js');
10
- require('../section-CuYr0Inu.js');
11
- require('../separator-DLdWBjSN.js');
12
- require('../text-display--p2-BoUa.js');
7
+ require('../container-C6GtfAPW.js');
8
+ require('../file-DVOELoNv.js');
9
+ require('../media-gallery-zDtJ3kxb.js');
10
+ require('../section-DlvrDoJK.js');
11
+ require('../separator-DL6QH5H1.js');
12
+ require('../text-display-DbMumig_.js');
13
13
  require('../v2-DofkPKHs.js');
14
14
  require('../element-Bak9llw_.js');
15
15
  require('../types-CUZOquUl.js');
16
- require('../EventInterceptor-CQ4PBpBJ.js');
16
+ require('../EventInterceptor-CQEXyUTp.js');
17
17
  require('../constants-B5_Ta7PR.js');
18
- require('../PluginCommon-Di1xIa8d.js');
19
- require('../CompilerPlugin-CjoZAAR8.js');
20
- require('../RuntimePlugin-CBgBLXTG.js');
18
+ require('../PluginCommon-Cvl5yYM_.js');
19
+ require('../CompilerPlugin-M8r3yNAl.js');
20
+ require('../RuntimePlugin-BUecuBIU.js');
21
21
  require('../types-q0Nm882H.js');
22
- require('../runtime-5fxB4uhe.js');
23
- require('../utils-BnXM4eKk.js');
24
- require('../resolve-file-url-DHTQj2mU.js');
25
- require('../types-package-DrnIdWLg.js');
26
- require('../EventWorkerContext-CSlD9rbx.js');
27
- require('../signals-DHdYrd-n.js');
28
- require('../constants-CUND8XkG.js');
29
- require('../MessageCommandParser-B_BEQ3p8.js');
30
- require('../CommandsRouter-Ci1Pe8Vd.js');
31
- require('../EventsRouter-C_J0M3uO.js');
32
- require('../router-DHnFRADH.js');
33
- require('../common-DNADUU3_.js');
34
- require('../CommandKitEventsChannel-Bgw0XCOl.js');
35
- require('../store-CiqLHedg.js');
22
+ require('../resolve-file-url-ChIyw-Vf.js');
23
+ require('../runtime-DB9CiPfe.js');
24
+ require('../utils-KsNof0Xz.js');
25
+ require('../types-package-BWArjyBF.js');
26
+ require('../constants-BOOGN85p.js');
27
+ require('../EventWorkerContext-Dq29tieI.js');
28
+ require('../signals-ChFMD7mB.js');
29
+ require('../helpers-Dl8wW6aO.js');
30
+ require('../MessageCommandParser-Dl0xxtdr.js');
31
+ require('../CommandsRouter-Dmzw-ikm.js');
32
+ require('../EventsRouter-3Gygh-km.js');
33
+ require('../router-Dn35v30f.js');
34
+ require('../common-CrqwC-sx.js');
35
+ require('../CommandKitEventsChannel-BtRzr3Tz.js');
36
+ require('../store-CM6pWVZh.js');
36
37
 
37
38
  exports.AnalyticsEngine = require_commandkit.AnalyticsEngine;
@@ -1,4 +1,4 @@
1
- import { AnalyticsEvent, AnalyticsProvider, IdentifyEvent } from "../analytics-engine-vA4MaJYx.js";
1
+ import { AnalyticsEvent, AnalyticsProvider, IdentifyEvent } from "../analytics-engine-AaAl3kQM.js";
2
2
  import "../EventInterceptor-x-R2qshQ.js";
3
3
  import "../ButtonKit-C7r7RPNf.js";
4
4
  import "../ModalKit-Btz58KYn.js";
@@ -20,13 +20,13 @@ import "../media-gallery-BMsXSot3.js";
20
20
  import "../section-Dh_FhPeC.js";
21
21
  import "../separator-CMf6Cyy5.js";
22
22
  import "../text-display-DRw3r_lK.js";
23
- import "../index-DSBMRX9A.js";
24
- import "../index-DdqikUQD.js";
25
- import "../MessageCommandParser-ROLibZPX.js";
26
- import "../signals-BQbEfy3X.js";
23
+ import "../index-Dw5cCt-A.js";
24
+ import "../index-E7Wvm5uX.js";
25
+ import "../MessageCommandParser-BsGMOTDo.js";
26
+ import "../signals-SHg7J1U_.js";
27
27
  import "../helpers-Wg6P5fRQ.js";
28
28
  import "../CommandsRouter-CoOA7hkf.js";
29
29
  import "../EventsRouter-BacqK6z3.js";
30
- import "../index-DKcmsWXw.js";
30
+ import "../index-CUPkUUOR.js";
31
31
  import "../constants-MKu-Q1jh.js";
32
32
  export { AnalyticsEvent, AnalyticsProvider, IdentifyEvent };
@@ -1,4 +1,4 @@
1
- const require_constants = require('../constants-CUND8XkG.js');
1
+ const require_constants = require('../constants-BOOGN85p.js');
2
2
 
3
3
  exports.AnalyticsEvents = require_constants.AnalyticsEvents;
4
4
  exports.DO_NOT_TRACK_KEY = require_constants.DO_NOT_TRACK_KEY;
@@ -1,38 +1,39 @@
1
- require('../colors-Cd4Oz-r-.js');
2
- require('../ActionRow-CmTHbo2t.js');
3
- require('../error-codes-C-ViHyu-.js');
4
- const require_commandkit = require('../commandkit-DMEW0kJg.js');
1
+ require('../colors-DL3ucTiT.js');
2
+ require('../ActionRow-CbdGFWMT.js');
3
+ require('../error-codes-Ds0bnPvT.js');
4
+ const require_commandkit = require('../commandkit-ZoBBh0Q_.js');
5
5
  require('../common-CcfjYnPG.js');
6
6
  require('../common-vnMIelAE.js');
7
- require('../container-z621KfH5.js');
8
- require('../file-DVZC0QXI.js');
9
- require('../media-gallery-CIKypjbJ.js');
10
- require('../section-CuYr0Inu.js');
11
- require('../separator-DLdWBjSN.js');
12
- require('../text-display--p2-BoUa.js');
7
+ require('../container-C6GtfAPW.js');
8
+ require('../file-DVOELoNv.js');
9
+ require('../media-gallery-zDtJ3kxb.js');
10
+ require('../section-DlvrDoJK.js');
11
+ require('../separator-DL6QH5H1.js');
12
+ require('../text-display-DbMumig_.js');
13
13
  require('../v2-DofkPKHs.js');
14
14
  require('../element-Bak9llw_.js');
15
15
  require('../types-CUZOquUl.js');
16
- require('../EventInterceptor-CQ4PBpBJ.js');
16
+ require('../EventInterceptor-CQEXyUTp.js');
17
17
  require('../constants-B5_Ta7PR.js');
18
- require('../PluginCommon-Di1xIa8d.js');
19
- require('../CompilerPlugin-CjoZAAR8.js');
20
- require('../RuntimePlugin-CBgBLXTG.js');
18
+ require('../PluginCommon-Cvl5yYM_.js');
19
+ require('../CompilerPlugin-M8r3yNAl.js');
20
+ require('../RuntimePlugin-BUecuBIU.js');
21
21
  require('../types-q0Nm882H.js');
22
- require('../runtime-5fxB4uhe.js');
23
- require('../utils-BnXM4eKk.js');
24
- require('../resolve-file-url-DHTQj2mU.js');
25
- require('../types-package-DrnIdWLg.js');
26
- require('../EventWorkerContext-CSlD9rbx.js');
27
- require('../signals-DHdYrd-n.js');
28
- require('../constants-CUND8XkG.js');
29
- require('../MessageCommandParser-B_BEQ3p8.js');
30
- require('../CommandsRouter-Ci1Pe8Vd.js');
31
- require('../EventsRouter-C_J0M3uO.js');
32
- require('../router-DHnFRADH.js');
33
- require('../common-DNADUU3_.js');
34
- require('../CommandKitEventsChannel-Bgw0XCOl.js');
35
- require('../store-CiqLHedg.js');
22
+ require('../resolve-file-url-ChIyw-Vf.js');
23
+ require('../runtime-DB9CiPfe.js');
24
+ require('../utils-KsNof0Xz.js');
25
+ require('../types-package-BWArjyBF.js');
26
+ require('../constants-BOOGN85p.js');
27
+ require('../EventWorkerContext-Dq29tieI.js');
28
+ require('../signals-ChFMD7mB.js');
29
+ require('../helpers-Dl8wW6aO.js');
30
+ require('../MessageCommandParser-Dl0xxtdr.js');
31
+ require('../CommandsRouter-Dmzw-ikm.js');
32
+ require('../EventsRouter-3Gygh-km.js');
33
+ require('../router-Dn35v30f.js');
34
+ require('../common-CrqwC-sx.js');
35
+ require('../CommandKitEventsChannel-BtRzr3Tz.js');
36
+ require('../store-CM6pWVZh.js');
36
37
 
37
38
  exports.getDoNotTrack = require_commandkit.getDoNotTrack;
38
39
  exports.noAnalytics = require_commandkit.noAnalytics;
@@ -1,12 +1,12 @@
1
1
  import { EventInterceptor } from "./EventInterceptor-x-R2qshQ.js";
2
2
  import { Fragment, createElement } from "./element-CAXu1XtK.js";
3
3
  import { MaybeArray } from "./types-CJ-XvOFN.js";
4
- import { MessageCommandOptions, MessageCommandParser } from "./MessageCommandParser-ROLibZPX.js";
4
+ import { MessageCommandOptions, MessageCommandParser } from "./MessageCommandParser-BsGMOTDo.js";
5
5
  import { Command, CommandsRouter, Middleware } from "./CommandsRouter-CoOA7hkf.js";
6
6
  import { EventsRouter, ParsedEvent } from "./EventsRouter-BacqK6z3.js";
7
7
  import { HMREventType } from "./constants-MKu-Q1jh.js";
8
8
  import EventEmitter from "node:events";
9
- import { AutocompleteInteraction, Awaitable, CacheType, ChatInputCommandInteraction, Client, ClientEvents, Collection, Constructable, ContextMenuCommandBuilder, ContextMenuCommandInteraction, Guild, Interaction, Locale, Message, MessageContextMenuCommandInteraction, RESTPostAPIApplicationCommandsJSONBody, SlashCommandBuilder, TextBasedChannel, UserContextMenuCommandInteraction } from "discord.js";
9
+ import { AutocompleteInteraction, Awaitable, CacheType, ChatInputCommandInteraction, Client, ClientEvents, Collection, Constructable, ContextMenuCommandBuilder, ContextMenuCommandInteraction, Guild, Interaction, Locale, Message, MessageContextMenuCommandInteraction, PermissionsString, RESTPostAPIApplicationCommandsJSONBody, SlashCommandBuilder, TextBasedChannel, UserContextMenuCommandInteraction } from "discord.js";
10
10
  import { DirectiveTransformerOptions } from "directive-to-hof";
11
11
  import { Options } from "tsdown";
12
12
 
@@ -38,18 +38,48 @@ interface CommandContext<T extends Interaction, Cached extends CacheType> {
38
38
  */
39
39
  handler: CommandKit;
40
40
  }
41
+ /**
42
+ * Represents the command metadata.
43
+ */
44
+ interface CommandMetadata {
45
+ /**
46
+ * The guilds that the command is available in.
47
+ */
48
+ guilds?: string[];
49
+ /**
50
+ * The aliases of the command.
51
+ */
52
+ aliases?: string[];
53
+ /**
54
+ * The user permissions required to execute the command.
55
+ */
56
+ userPermissions?: PermissionsString | PermissionsString[];
57
+ /**
58
+ * The bot permissions required to execute the command.
59
+ */
60
+ botPermissions?: PermissionsString | PermissionsString[];
61
+ /**
62
+ * The name aliases for the `user` and `message` context menu commands. When i18n plugin is in use, this option will be ignored if the translation for the context menu command name is provided.
63
+ */
64
+ nameAliases?: Record<'user' | 'message', string>;
65
+ }
41
66
  /**
42
67
  * Represents a command that can be executed by CommandKit.
43
68
  */
44
69
  type CommandData = Prettify<Omit<RESTPostAPIApplicationCommandsJSONBody, 'description'> & {
70
+ /**
71
+ * The description of the command.
72
+ */
45
73
  description?: string;
46
- guilds?: string[];
47
- aliases?: string[];
48
74
  }>;
49
75
  /**
50
76
  * Represents an event handler for a specific event.
51
77
  */
52
- type EventHandler<K extends keyof ClientEvents> = (...args: ClientEvents[K]) => void | Promise<void>;
78
+ type EventHandler<K extends keyof ClientEvents> = (...args: [...ClientEvents[K], Client<true>, CommandKit]) => void | Promise<void>;
79
+ /**
80
+ * The command metadata function
81
+ */
82
+ type CommandMetadataFunction = () => Promise<CommandMetadata> | CommandMetadata;
53
83
  //#endregion
54
84
  //#region src/app/commands/Context.d.ts
55
85
  /**
@@ -77,7 +107,7 @@ interface ContextParameters<T extends CommandExecutionMode, Args = Record<string
77
107
  message: T extends 'message' ? Message : never;
78
108
  forwarded?: boolean;
79
109
  messageCommandParser?: T extends 'message' ? MessageCommandParser : never;
80
- store?: Map<string, any>;
110
+ store?: Collection<string, any>;
81
111
  customArgs?: Args;
82
112
  }
83
113
  /**
@@ -217,7 +247,7 @@ declare class Context<ExecutionMode extends CommandExecutionMode = CommandExecut
217
247
  * The shared key-value store for this context. This can be used to store data that needs to be shared between middlewares or commands.
218
248
  * This store is shared across all contexts in the same command execution, including the cloned contexts and middleware contexts.
219
249
  */
220
- get store(): Map<string, any>;
250
+ get store(): Collection<any, any>;
221
251
  /**
222
252
  * Gets the name of the current command.
223
253
  */
@@ -300,27 +330,11 @@ declare class Context<ExecutionMode extends CommandExecutionMode = CommandExecut
300
330
  * @returns Array of command arguments
301
331
  */
302
332
  args(): string[];
303
- /**
304
- * Stops upcoming middleware or current command execution.
305
- * If this is called inside pre-stage middleware, the next run will be the actual command, skipping all other pre-stage middlewares.
306
- * If this is called inside a command itself, it will skip all post-stage middlewares.
307
- * If this is called inside post-stage middleware, it will skip all other post-stage middlewares.
308
- */
309
- exit(): never;
310
333
  }
311
334
  /**
312
335
  * Extended context class for middleware execution with additional control methods.
313
336
  */
314
337
  declare class MiddlewareContext<T extends CommandExecutionMode = CommandExecutionMode> extends Context<T, MiddlewareContextArgs> {
315
- #private;
316
- /**
317
- * Whether the command execution was cancelled.
318
- */
319
- get cancelled(): boolean;
320
- /**
321
- * Cancels the command execution.
322
- */
323
- cancel(): void;
324
338
  /**
325
339
  * Sets command runner function to wrap the command execution.
326
340
  * @param fn The function to set.
@@ -359,7 +373,9 @@ declare class CommandRegistrar {
359
373
  /**
360
374
  * Gets the commands data.
361
375
  */
362
- getCommandsData(): CommandData[];
376
+ getCommandsData(): (CommandData & {
377
+ __metadata?: CommandMetadata;
378
+ })[];
363
379
  /**
364
380
  * Registers loaded commands.
365
381
  */
@@ -367,11 +383,15 @@ declare class CommandRegistrar {
367
383
  /**
368
384
  * Updates the global commands.
369
385
  */
370
- updateGlobalCommands(commands: CommandData[]): Promise<void>;
386
+ updateGlobalCommands(commands: (CommandData & {
387
+ __metadata?: CommandMetadata;
388
+ })[]): Promise<void>;
371
389
  /**
372
390
  * Updates the guild commands.
373
391
  */
374
- updateGuildCommands(commands: CommandData[]): Promise<void>;
392
+ updateGuildCommands(commands: (CommandData & {
393
+ __metadata?: CommandMetadata;
394
+ })[]): Promise<void>;
375
395
  }
376
396
  //#endregion
377
397
  //#region src/context/environment.d.ts
@@ -417,6 +437,10 @@ interface CommandKitEnvironmentInternalData {
417
437
  * This can be used to access request-specific data or application state.
418
438
  */
419
439
  context: Context | null;
440
+ /**
441
+ * Shared collection instance for arbitrary data storage
442
+ */
443
+ store: Collection<any, any>;
420
444
  }
421
445
  /**
422
446
  * Represents the execution environment for CommandKit commands.
@@ -464,6 +488,10 @@ declare class CommandKitEnvironment {
464
488
  * The variables store for this environment.
465
489
  */
466
490
  get variables(): Map<string, any>;
491
+ /**
492
+ * The shared store for this environment
493
+ */
494
+ get store(): Collection<any, any>;
467
495
  /**
468
496
  * Register a deferred function.
469
497
  * @param fn - The deferred function to register.
@@ -594,6 +622,10 @@ declare function getContext(): CommandKitEnvironment | undefined;
594
622
  * Use current commandkit context. Throws an error if no context is found.
595
623
  */
596
624
  declare function useEnvironment(): CommandKitEnvironment;
625
+ /**
626
+ * Use the shared data store in the current environment. Throws an error if no context is found.
627
+ */
628
+ declare function useStore(): Collection<any, any>;
597
629
  //#endregion
598
630
  //#region src/app/commands/AppCommandRunner.d.ts
599
631
  /**
@@ -631,6 +663,7 @@ declare class AppCommandRunner {
631
663
  * Handles the complete command lifecycle including before/after middleware execution.
632
664
  * @param prepared - The prepared command execution data
633
665
  * @param source - The source interaction or message that triggered the command
666
+ * @param options - The options for running the command
634
667
  */
635
668
  runCommand(prepared: PreparedAppCommandExecution, source: Interaction | Message, options?: RunCommandOptions): Promise<any>;
636
669
  /**
@@ -653,6 +686,8 @@ type RunCommand = <T extends AsyncFunction>(fn: T) => T;
653
686
  */
654
687
  interface AppCommandNative {
655
688
  command: CommandData | Record<string, any>;
689
+ generateMetadata?: CommandMetadataFunction;
690
+ metadata?: CommandMetadata;
656
691
  chatInput?: (ctx: Context) => Awaitable<unknown>;
657
692
  autocomplete?: (ctx: Context) => Awaitable<unknown>;
658
693
  message?: (ctx: Context) => Awaitable<unknown>;
@@ -684,8 +719,8 @@ interface AppCommandMiddleware {
684
719
  */
685
720
  interface LoadedCommand {
686
721
  command: Command;
722
+ metadata: CommandMetadata;
687
723
  data: AppCommand;
688
- guilds?: string[];
689
724
  }
690
725
  /**
691
726
  * Type representing command data identifier.
@@ -727,8 +762,20 @@ declare const commandDataSchema: {
727
762
  messageContextMenu: (c: unknown) => c is Function;
728
763
  userContextMenu: (c: unknown) => c is Function;
729
764
  };
765
+ /**
766
+ * @private
767
+ * @internal
768
+ */
730
769
  type CommandDataSchema = typeof commandDataSchema;
770
+ /**
771
+ * @private
772
+ * @internal
773
+ */
731
774
  type CommandDataSchemaKey = keyof CommandDataSchema;
775
+ /**
776
+ * @private
777
+ * @internal
778
+ */
732
779
  type CommandDataSchemaValue = CommandDataSchema[CommandDataSchemaKey];
733
780
  /**
734
781
  * Handles application commands for CommandKit, including loading, registration, and execution.
@@ -800,6 +847,7 @@ declare class AppCommandHandler {
800
847
  /**
801
848
  * Finds a command by name.
802
849
  * @param name - The command name to search for
850
+ * @param hint - The hint for the command type (user or message)
803
851
  * @returns The loaded command or null if not found
804
852
  */
805
853
  private findCommandByName;
@@ -841,6 +889,13 @@ declare class AppCommandHandler {
841
889
  * @internal
842
890
  */
843
891
  private loadCommand;
892
+ /**
893
+ * Gets the metadata for a command.
894
+ * @param command - The command name to get metadata for
895
+ * @param hint - The hint for the command type (user or message)
896
+ * @returns The command metadata or null if not found
897
+ */
898
+ getMetadataFor(command: string, hint?: 'user' | 'message'): CommandMetadata | null;
844
899
  }
845
900
  //#endregion
846
901
  //#region src/events/CommandKitEventsChannel.d.ts
@@ -1039,6 +1094,7 @@ declare function registerDevHooks(commandkit: CommandKit): void;
1039
1094
  */
1040
1095
  declare abstract class RuntimePlugin<T extends PluginOptions = PluginOptions> extends PluginCommon<T, CommandKitPluginRuntime> {
1041
1096
  readonly type = PluginType.Runtime;
1097
+ readonly preload: Set<string>;
1042
1098
  /**
1043
1099
  * Called before commands are loaded
1044
1100
  */
@@ -1426,6 +1482,11 @@ declare class CommandKitPluginRuntime {
1426
1482
  * @param plugin The plugin to be fetched.
1427
1483
  */
1428
1484
  get<T extends Constructable<any>>(plugin: T): InstanceType<T> | null;
1485
+ /**
1486
+ * Pre-loads the specified entrypoints for the given plugin.
1487
+ * @param plugin The plugin to pre-load.
1488
+ */
1489
+ preload(plugin: RuntimePlugin): Promise<void>;
1429
1490
  /**
1430
1491
  * Soft registers a plugin in the runtime.
1431
1492
  * @param plugin The plugin to be registered.
@@ -1864,6 +1925,11 @@ interface CommandKitConfig {
1864
1925
  * @default false
1865
1926
  */
1866
1927
  disablePrefixCommands?: boolean;
1928
+ /**
1929
+ * Whether or not to disable the built-in permissions middleware. This only affects `botPermissions` and `userPermissions` in the command metadata.
1930
+ * @default false
1931
+ */
1932
+ disablePermissionsMiddleware?: boolean;
1867
1933
  /**
1868
1934
  * Whether or not to show a warning when a prefix command is not found. This only affects development mode.
1869
1935
  * @default true
@@ -1909,7 +1975,7 @@ interface CommandKitConfiguration {
1909
1975
  * @param message The message to get the command prefix for.
1910
1976
  * @returns The command prefix or an array of prefixes.
1911
1977
  */
1912
- getMessageCommandPrefix: (message: Message) => Awaitable<string | string[]>;
1978
+ getMessageCommandPrefix: (message: Message) => Awaitable<string | string[] | RegExp>;
1913
1979
  }
1914
1980
  /**
1915
1981
  * Represents the function executed during the bootstrap phase of CommandKit.
@@ -2014,7 +2080,6 @@ declare class CommandKit extends EventEmitter {
2014
2080
  /**
2015
2081
  * Create a new command and event handler with CommandKit.
2016
2082
  * @param options - The default CommandKit configuration.
2017
- * @see {@link https://commandkit.js.org/docs/guide/commandkit-setup}
2018
2083
  */
2019
2084
  constructor(options?: CommandKitOptions);
2020
2085
  /**
@@ -2034,7 +2099,7 @@ declare class CommandKit extends EventEmitter {
2034
2099
  * Sets the prefix resolver for the command handler.
2035
2100
  * @param resolver The resolver function.
2036
2101
  */
2037
- setPrefixResolver(resolver: (message: Message) => Awaitable<string | string[]>): this;
2102
+ setPrefixResolver(resolver: (message: Message) => Awaitable<string | string[] | RegExp>): this;
2038
2103
  /**
2039
2104
  * Sets the default locale for the command handler.
2040
2105
  * @param locale The default locale.
@@ -2179,5 +2244,5 @@ declare class AnalyticsEngine {
2179
2244
  track(event: AnalyticsEvent): Promise<void>;
2180
2245
  }
2181
2246
  //#endregion
2182
- export { AnalyticsEngine, AnalyticsEvent, AnalyticsProvider, AnyCommandExecute, AppCommand, AppCommandHandler, AppCommandNative, AppCommandRunner, AppEventsHandler, AppEventsHandlerLoadedData, AsyncFunction, AutocompleteCommand, AutocompleteCommandContext, AutocompleteCommandMiddlewareContext, BootstrapFunction, ChatInputCommand, ChatInputCommandContext, CommandBuilderLike, CommandContext, CommandContextOptions, CommandData, CommandDataSchema, CommandDataSchemaKey, CommandDataSchemaValue, CommandExecutionMode, CommandFlagContext, CommandKit, CommandKitCompilerOptions, CommandKitConfig, CommandKitConfiguration, CommandKitEnvironment, CommandKitEnvironmentInternalData, CommandKitEnvironmentType, CommandKitEventDispatch, CommandKitEventsChannel, CommandKitHMREvent, CommandKitOptions, CommandKitPlugin, CommandKitPluginRuntime, CommandRegistrar, CommandTypeData, CommonDirectiveTransformer, CommonDirectiveTransformerOptions, CommonPluginRuntime, CompilerPlugin, CompilerPluginRuntime, Context, ContextParameters, CustomAppCommandProps, CustomEvaluationContext, CustomEvaluationFunction, DecideFunction, DeepPartial, DeepRequired, EvaluationContext, EventFlagContext, EventHandler, EventListener, FeatureFlag, FeatureFlagDefinition, FilterFunction, FlagConfiguration, FlagProvider, FlagRunner, FlagStore, GenericFunction, IdentifyEvent, IdentifyFunction, InteractionCommandContext, InteractionCommandMiddlewareContext, IpcMessageCommand, JsonFlagProvider, ListenerFunction, LoadedCommand, LoadedEvent, MaybeFalsey, MaybePromise, MessageCommand, MessageCommandContext, MessageCommandMiddlewareContext, MessageContextMenuCommand, MessageContextMenuCommandContext, MessageContextMenuCommandMiddlewareContext, MiddlewareContext, MiddlewareContextArgs, PluginCommon, PluginOptions, PluginTransformParameters, PluginType, PreRegisterCommandsEvent, PreparedAppCommandExecution, ResolvableCommand, ResolvedCommandKitConfig, RunCommand, RunCommandOptions, RuntimePlugin, SlashCommandMiddlewareContext, TemplateHandler, TransformedResult, UserContextMenuCommand, UserContextMenuCommandContext, UserContextMenuCommandMiddlewareContext, after, cancelAfter, commandkit, exitContext, flag, getCommandKit, getContext, isCommandWorkerContext, isCompilerPlugin, isPlugin, isRuntimePlugin, makeContextAwareFunction, mergeDeep, onApplicationBootstrap, onBootstrap, provideContext, registerDevHooks, setFlagProvider, useEnvironment };
2183
- //# sourceMappingURL=analytics-engine-vA4MaJYx.d.ts.map
2247
+ export { AnalyticsEngine, AnalyticsEvent, AnalyticsProvider, AnyCommandExecute, AppCommand, AppCommandHandler, AppCommandNative, AppCommandRunner, AppEventsHandler, AppEventsHandlerLoadedData, AsyncFunction, AutocompleteCommand, AutocompleteCommandContext, AutocompleteCommandMiddlewareContext, BootstrapFunction, ChatInputCommand, ChatInputCommandContext, CommandBuilderLike, CommandContext, CommandContextOptions, CommandData, CommandDataSchema, CommandDataSchemaKey, CommandDataSchemaValue, CommandExecutionMode, CommandFlagContext, CommandKit, CommandKitCompilerOptions, CommandKitConfig, CommandKitConfiguration, CommandKitEnvironment, CommandKitEnvironmentInternalData, CommandKitEnvironmentType, CommandKitEventDispatch, CommandKitEventsChannel, CommandKitHMREvent, CommandKitOptions, CommandKitPlugin, CommandKitPluginRuntime, CommandMetadata, CommandMetadataFunction, CommandRegistrar, CommandTypeData, CommonDirectiveTransformer, CommonDirectiveTransformerOptions, CommonPluginRuntime, CompilerPlugin, CompilerPluginRuntime, Context, ContextParameters, CustomAppCommandProps, CustomEvaluationContext, CustomEvaluationFunction, DecideFunction, DeepPartial, DeepRequired, EvaluationContext, EventFlagContext, EventHandler, EventListener, FeatureFlag, FeatureFlagDefinition, FilterFunction, FlagConfiguration, FlagProvider, FlagRunner, FlagStore, GenericFunction, IdentifyEvent, IdentifyFunction, InteractionCommandContext, InteractionCommandMiddlewareContext, IpcMessageCommand, JsonFlagProvider, ListenerFunction, LoadedCommand, LoadedEvent, MaybeFalsey, MaybePromise, MessageCommand, MessageCommandContext, MessageCommandMiddlewareContext, MessageContextMenuCommand, MessageContextMenuCommandContext, MessageContextMenuCommandMiddlewareContext, MiddlewareContext, MiddlewareContextArgs, PluginCommon, PluginOptions, PluginTransformParameters, PluginType, PreRegisterCommandsEvent, PreparedAppCommandExecution, ResolvableCommand, ResolvedCommandKitConfig, RunCommand, RunCommandOptions, RuntimePlugin, SlashCommandMiddlewareContext, TemplateHandler, TransformedResult, UserContextMenuCommand, UserContextMenuCommandContext, UserContextMenuCommandMiddlewareContext, after, cancelAfter, commandkit, exitContext, flag, getCommandKit, getContext, isCommandWorkerContext, isCompilerPlugin, isPlugin, isRuntimePlugin, makeContextAwareFunction, mergeDeep, onApplicationBootstrap, onBootstrap, provideContext, registerDevHooks, setFlagProvider, useEnvironment, useStore };
2248
+ //# sourceMappingURL=analytics-engine-AaAl3kQM.d.ts.map
@@ -1,4 +1,4 @@
1
- import { AppCommandRunner, RunCommandOptions } from "../../analytics-engine-vA4MaJYx.js";
1
+ import { AppCommandRunner, RunCommandOptions } from "../../analytics-engine-AaAl3kQM.js";
2
2
  import "../../EventInterceptor-x-R2qshQ.js";
3
3
  import "../../ButtonKit-C7r7RPNf.js";
4
4
  import "../../ModalKit-Btz58KYn.js";
@@ -20,13 +20,13 @@ import "../../media-gallery-BMsXSot3.js";
20
20
  import "../../section-Dh_FhPeC.js";
21
21
  import "../../separator-CMf6Cyy5.js";
22
22
  import "../../text-display-DRw3r_lK.js";
23
- import "../../index-DSBMRX9A.js";
24
- import "../../index-DdqikUQD.js";
25
- import "../../MessageCommandParser-ROLibZPX.js";
26
- import "../../signals-BQbEfy3X.js";
23
+ import "../../index-Dw5cCt-A.js";
24
+ import "../../index-E7Wvm5uX.js";
25
+ import "../../MessageCommandParser-BsGMOTDo.js";
26
+ import "../../signals-SHg7J1U_.js";
27
27
  import "../../helpers-Wg6P5fRQ.js";
28
28
  import "../../CommandsRouter-CoOA7hkf.js";
29
29
  import "../../EventsRouter-BacqK6z3.js";
30
- import "../../index-DKcmsWXw.js";
30
+ import "../../index-CUPkUUOR.js";
31
31
  import "../../constants-MKu-Q1jh.js";
32
32
  export { AppCommandRunner, RunCommandOptions };