@shell-shock/plugin-completions 0.2.3 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/_virtual/_rolldown/runtime.mjs +3 -0
  2. package/dist/components/bash-command.cjs +59 -58
  3. package/dist/components/bash-command.d.cts +2 -2
  4. package/dist/components/bash-command.d.cts.map +1 -1
  5. package/dist/components/bash-command.d.mts +2 -2
  6. package/dist/components/bash-command.d.mts.map +1 -1
  7. package/dist/components/bash-command.mjs.map +1 -1
  8. package/dist/components/fish-command.cjs +124 -123
  9. package/dist/components/fish-command.d.cts +2 -2
  10. package/dist/components/fish-command.d.cts.map +1 -1
  11. package/dist/components/fish-command.d.mts.map +1 -1
  12. package/dist/components/fish-command.mjs.map +1 -1
  13. package/dist/components/index.cjs +1 -0
  14. package/dist/components/powershell-command.cjs +82 -81
  15. package/dist/components/powershell-command.d.cts.map +1 -1
  16. package/dist/components/powershell-command.d.mts +2 -2
  17. package/dist/components/powershell-command.d.mts.map +1 -1
  18. package/dist/components/powershell-command.mjs +1 -1
  19. package/dist/components/powershell-command.mjs.map +1 -1
  20. package/dist/components/zsh-command.cjs +91 -90
  21. package/dist/components/zsh-command.d.cts.map +1 -1
  22. package/dist/components/zsh-command.d.mts.map +1 -1
  23. package/dist/components/zsh-command.mjs.map +1 -1
  24. package/dist/helpers/complete-command.cjs +1 -0
  25. package/dist/helpers/complete-command.d.cts.map +1 -1
  26. package/dist/helpers/complete-command.d.mts.map +1 -1
  27. package/dist/helpers/complete-command.mjs.map +1 -1
  28. package/dist/helpers/completion-directive-constants.cjs +1 -0
  29. package/dist/helpers/completion-directive-constants.d.cts.map +1 -1
  30. package/dist/helpers/completion-directive-constants.d.mts.map +1 -1
  31. package/dist/helpers/completion-directive-constants.mjs.map +1 -1
  32. package/dist/helpers/index.cjs +1 -0
  33. package/dist/index.cjs +22 -23
  34. package/dist/index.d.cts +0 -1
  35. package/dist/index.d.cts.map +1 -1
  36. package/dist/index.d.mts +0 -1
  37. package/dist/index.d.mts.map +1 -1
  38. package/dist/index.mjs +1 -2
  39. package/dist/index.mjs.map +1 -1
  40. package/dist/types/index.cjs +1 -0
  41. package/dist/types/plugin.d.cts.map +1 -1
  42. package/dist/types/plugin.d.mts.map +1 -1
  43. package/dist/types/shell-type.cjs +1 -0
  44. package/dist/types/shell-type.d.cts.map +1 -1
  45. package/dist/types/shell-type.d.mts.map +1 -1
  46. package/dist/types/shell-type.mjs.map +1 -1
  47. package/package.json +12 -12
@@ -0,0 +1,3 @@
1
+ import "node:module";
2
+
3
+ export { };
@@ -1,27 +1,28 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
2
  const require_helpers_complete_command = require('../helpers/complete-command.cjs');
2
3
  const require_helpers_completion_directive_constants = require('../helpers/completion-directive-constants.cjs');
3
4
  require('../helpers/index.cjs');
4
- let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
- let __shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
6
- let __stryke_path = require("@stryke/path");
7
- let __alloy_js_core = require("@alloy-js/core");
8
- let __alloy_js_typescript = require("@alloy-js/typescript");
9
- let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
10
- let __powerlines_plugin_alloy_core = require("@powerlines/plugin-alloy/core");
11
- let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
12
- let __powerlines_plugin_alloy_typescript = require("@powerlines/plugin-alloy/typescript");
13
- let __powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
14
- let __stryke_string_format_snake_case = require("@stryke/string-format/snake-case");
5
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
+ let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
7
+ let _stryke_path = require("@stryke/path");
8
+ let _alloy_js_core = require("@alloy-js/core");
9
+ let _alloy_js_typescript = require("@alloy-js/typescript");
10
+ let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
11
+ let _powerlines_plugin_alloy_core = require("@powerlines/plugin-alloy/core");
12
+ let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
13
+ let _powerlines_plugin_alloy_typescript = require("@powerlines/plugin-alloy/typescript");
14
+ let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
15
+ let _stryke_string_format_snake_case = require("@stryke/string-format/snake-case");
15
16
 
16
17
  //#region src/components/bash-command.tsx
17
18
  /**
18
19
  * The Bash Completions commands' handler wrapper for the Shell Shock project.
19
20
  */
20
21
  function BashCompletionsCommand() {
21
- const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
22
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript.TypescriptFile, {
22
+ const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
23
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TypescriptFile, {
23
24
  get path() {
24
- return (0, __stryke_path.joinPaths)(context.entryPath, "completions", "bash", "command.ts");
25
+ return (0, _stryke_path.joinPaths)(context.entryPath, "completions", "bash", "command.ts");
25
26
  },
26
27
  imports: {
27
28
  "node:os": ["os"],
@@ -36,43 +37,43 @@ function BashCompletionsCommand() {
36
37
  ] },
37
38
  get children() {
38
39
  return [
39
- (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Options for the Bash completions command." }),
40
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.InterfaceDeclaration, {
40
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Options for the Bash completions command." }),
41
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
41
42
  "export": true,
42
43
  name: "BashCompletionsOptions",
43
44
  get children() {
44
45
  return [
45
- (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
46
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
46
47
  heading: "The path to write the completion script to.",
47
48
  get children() {
48
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `If no extension is provided, the \`.bash\` extension will be used.` }), (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
49
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `If no extension is provided, the \`.bash\` extension will be used.` }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
49
50
  get type() {
50
- return __powerlines_deepkit_vendor_type.ReflectionKind.string;
51
+ return _powerlines_deepkit_vendor_type.ReflectionKind.string;
51
52
  },
52
53
  get defaultValue() {
53
- return `${(0, __shell_shock_core_plugin_utils.getAppBin)(context)}-completions.bash`;
54
+ return `${(0, _shell_shock_core_plugin_utils.getAppBin)(context)}-completions.bash`;
54
55
  }
55
56
  })];
56
57
  }
57
58
  }),
58
- (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript.InterfaceMember, {
59
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
59
60
  name: "script",
60
61
  optional: true,
61
62
  type: "string | true"
62
63
  }),
63
- (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core.Spacing, {}),
64
- (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
64
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
65
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
65
66
  heading: "The Bash configuration file to append the completion script to.",
66
67
  get children() {
67
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The generated completion script will be appended to the specified configuration file. Possible values for the Bash configuration file include: \\n- \`~/.bashrc\` \\n- \`~/.bash_profile\`` }), (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
68
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The generated completion script will be appended to the specified configuration file. Possible values for the Bash configuration file include: \\n- \`~/.bashrc\` \\n- \`~/.bash_profile\`` }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
68
69
  get type() {
69
- return __powerlines_deepkit_vendor_type.ReflectionKind.string;
70
+ return _powerlines_deepkit_vendor_type.ReflectionKind.string;
70
71
  },
71
72
  defaultValue: "~/.bashrc"
72
73
  })];
73
74
  }
74
75
  }),
75
- (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript.InterfaceMember, {
76
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
76
77
  name: "config",
77
78
  optional: true,
78
79
  type: "string | true"
@@ -80,9 +81,9 @@ function BashCompletionsCommand() {
80
81
  ];
81
82
  }
82
83
  }),
83
- (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core.Spacing, {}),
84
- (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Handler logic for the \\`completions bash\\` command." }),
85
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
84
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
85
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Handler logic for the \\`completions bash\\` command." }),
86
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
86
87
  "export": true,
87
88
  "default": true,
88
89
  async: true,
@@ -93,12 +94,12 @@ function BashCompletionsCommand() {
93
94
  }],
94
95
  get children() {
95
96
  return [
96
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
97
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
97
98
  "const": true,
98
99
  name: "completions",
99
100
  type: "string",
100
101
  get initializer() {
101
- return __alloy_js_core.code`# bash completion for ${(0, __shell_shock_core_plugin_utils.getAppTitle)(context)}
102
+ return _alloy_js_core.code`# bash completion for ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)}
102
103
 
103
104
  # Define shell completion directives
104
105
  readonly ShellCompDirectiveError=${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveError}
@@ -109,14 +110,14 @@ readonly ShellCompDirectiveFilterDirs=${require_helpers_completion_directive_con
109
110
  readonly ShellCompDirectiveKeepOrder=${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveKeepOrder}
110
111
 
111
112
  # Function to debug completion
112
- __${(0, __stryke_string_format_snake_case.snakeCase)((0, __shell_shock_core_plugin_utils.getAppBin)(context))}_debug() {
113
+ __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug() {
113
114
  if [[ -n \${BASH_COMP_DEBUG_FILE:-} ]]; then
114
115
  echo "$*" >> "\${BASH_COMP_DEBUG_FILE}"
115
116
  fi
116
117
  }
117
118
 
118
119
  # Function to handle completions
119
- __${(0, __stryke_string_format_snake_case.snakeCase)((0, __shell_shock_core_plugin_utils.getAppBin)(context))}_complete() {
120
+ __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_complete() {
120
121
  local cur prev words cword
121
122
  _get_comp_words_by_ref -n "=:" cur prev words cword
122
123
 
@@ -198,35 +199,35 @@ __${(0, __stryke_string_format_snake_case.snakeCase)((0, __shell_shock_core_plug
198
199
  }
199
200
 
200
201
  # Register completion function
201
- complete -F __${(0, __stryke_string_format_snake_case.snakeCase)((0, __shell_shock_core_plugin_utils.getAppBin)(context))}_complete ${(0, __shell_shock_core_plugin_utils.getAppBin)(context)}
202
+ complete -F __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_complete ${(0, _shell_shock_core_plugin_utils.getAppBin)(context)}
202
203
  \`); `;
203
204
  }
204
205
  }),
205
- (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core.Spacing, {}),
206
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
207
- condition: __alloy_js_core.code`options.config`,
206
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
207
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
208
+ condition: _alloy_js_core.code`options.config`,
208
209
  get children() {
209
210
  return [
210
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
211
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
211
212
  "let": true,
212
213
  name: "configFilePath",
213
214
  type: "string",
214
- initializer: __alloy_js_core.code`options.config === true ? "~/.bashrc" : options.config`
215
+ initializer: _alloy_js_core.code`options.config === true ? "~/.bashrc" : options.config`
215
216
  }),
216
- (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core.Spacing, {}),
217
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
218
- condition: __alloy_js_core.code`configFilePath.startsWith("~")`,
219
- children: __alloy_js_core.code`configFilePath = join(os.homedir(), configFilePath.replace("~", "")); `
217
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
218
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
219
+ condition: _alloy_js_core.code`configFilePath.startsWith("~")`,
220
+ children: _alloy_js_core.code`configFilePath = join(os.homedir(), configFilePath.replace("~", "")); `
220
221
  }),
221
- (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core.Spacing, {}),
222
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
222
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
223
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
223
224
  "let": true,
224
225
  name: "configFileContent",
225
226
  type: "string",
226
- initializer: __alloy_js_core.code`"";`
227
+ initializer: _alloy_js_core.code`"";`
227
228
  }),
228
- (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core.Spacing, {}),
229
- (0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`try {
229
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
230
+ (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`try {
230
231
  configFileContent = await readFile(configFilePath, "utf8");
231
232
  } catch (error) {
232
233
  if (error.code === "ENOENT") {
@@ -239,24 +240,24 @@ complete -F __${(0, __stryke_string_format_snake_case.snakeCase)((0, __shell_sho
239
240
 
240
241
  await writeFile(configFilePath, \`\${configFileContent}\\n\\n\${stripAnsi(completions)}\`);
241
242
 
242
- success(\`${(0, __shell_shock_core_plugin_utils.getAppTitle)(context)} Bash completion script has been generated and appended to \${colors.bold(configFilePath)}. Please restart your terminal or run \`source \${configFilePath}\` to apply the changes.\`); `)
243
+ success(\`${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Bash completion script has been generated and appended to \${colors.bold(configFilePath)}. Please restart your terminal or run \`source \${configFilePath}\` to apply the changes.\`); `)
243
244
  ];
244
245
  }
245
246
  }),
246
- (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core.Spacing, {}),
247
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
248
- condition: __alloy_js_core.code`options.script`,
247
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
248
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
249
+ condition: _alloy_js_core.code`options.script`,
249
250
  get children() {
250
- return __alloy_js_core.code`const outputPath = options.script === true ? "${(0, __shell_shock_core_plugin_utils.getAppBin)(context)}-completions.bash" : options.script;
251
+ return _alloy_js_core.code`const outputPath = options.script === true ? "${(0, _shell_shock_core_plugin_utils.getAppBin)(context)}-completions.bash" : options.script;
251
252
  await writeFile(outputPath, stripAnsi(completions));
252
253
 
253
- success(\`${(0, __shell_shock_core_plugin_utils.getAppTitle)(context)} Bash completion script has been generated at \${colors.bold(outputPath)}.\`);`;
254
+ success(\`${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Bash completion script has been generated at \${colors.bold(outputPath)}.\`);`;
254
255
  }
255
256
  }),
256
- (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core.Spacing, {}),
257
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
258
- condition: __alloy_js_core.code`!options.config && !options.script`,
259
- children: __alloy_js_core.code`writeLine(" ------------------------------------------------- ");
257
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
258
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
259
+ condition: _alloy_js_core.code`!options.config && !options.script`,
260
+ children: _alloy_js_core.code`writeLine(" ------------------------------------------------- ");
260
261
  writeLine(completions);
261
262
  writeLine(" ------------------------------------------------- ");`
262
263
  })
@@ -1,10 +1,10 @@
1
- import * as _alloy_js_core1 from "@alloy-js/core";
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
2
 
3
3
  //#region src/components/bash-command.d.ts
4
4
  /**
5
5
  * The Bash Completions commands' handler wrapper for the Shell Shock project.
6
6
  */
7
- declare function BashCompletionsCommand(): _alloy_js_core1.Children;
7
+ declare function BashCompletionsCommand(): _alloy_js_core0.Children;
8
8
  //#endregion
9
9
  export { BashCompletionsCommand };
10
10
  //# sourceMappingURL=bash-command.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bash-command.d.cts","names":[],"sources":["../../src/components/bash-command.tsx"],"sourcesContent":[],"mappings":";;;;;;AA+CgB,iBAAA,sBAAA,CAAA,CAAsB,EAAA,eAAA,CAAA,QAAA"}
1
+ {"version":3,"file":"bash-command.d.cts","names":[],"sources":["../../src/components/bash-command.tsx"],"mappings":";;;;;;iBA+CgB,sBAAA,CAAA,GAAsB,eAAA,CAAA,QAAA"}
@@ -1,10 +1,10 @@
1
- import * as _alloy_js_core1 from "@alloy-js/core";
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
2
 
3
3
  //#region src/components/bash-command.d.ts
4
4
  /**
5
5
  * The Bash Completions commands' handler wrapper for the Shell Shock project.
6
6
  */
7
- declare function BashCompletionsCommand(): _alloy_js_core1.Children;
7
+ declare function BashCompletionsCommand(): _alloy_js_core0.Children;
8
8
  //#endregion
9
9
  export { BashCompletionsCommand };
10
10
  //# sourceMappingURL=bash-command.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bash-command.d.mts","names":[],"sources":["../../src/components/bash-command.tsx"],"sourcesContent":[],"mappings":";;;;;;AA+CgB,iBAAA,sBAAA,CAAA,CAAsB,EAAA,eAAA,CAAA,QAAA"}
1
+ {"version":3,"file":"bash-command.d.mts","names":[],"sources":["../../src/components/bash-command.tsx"],"mappings":";;;;;;iBA+CgB,sBAAA,CAAA,GAAsB,eAAA,CAAA,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"bash-command.mjs","names":["code","FunctionDeclaration","IfStatement","InterfaceDeclaration","VarDeclaration","ReflectionKind","Spacing","usePowerlines","InterfaceMember","TypescriptFile","TSDoc","TSDocDefaultValue","TSDocRemarks","getAppBin","getAppTitle","joinPaths","snakeCase","CompletionDirective","exec","BashCompletionsCommand","context","_$createComponent","path","entryPath","imports","builtinImports","children","heading","name","type","string","defaultValue","optional","async","parameters","initializer","CompletionDirectiveError","CompletionDirectiveNoSpace","CompletionDirectiveNoFileComp","CompletionDirectiveFilterFileExt","CompletionDirectiveFilterDirs","CompletionDirectiveKeepOrder","condition","_$memo"],"sources":["../../src/components/bash-command.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code } from \"@alloy-js/core\";\nimport {\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n InterfaceMember,\n TypescriptFile\n} from \"@powerlines/plugin-alloy/typescript\";\nimport {\n TSDoc,\n TSDocDefaultValue,\n TSDocRemarks\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppBin, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport { CompletionDirective } from \"../helpers\";\nimport { exec } from \"../helpers/complete-command\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The Bash Completions commands' handler wrapper for the Shell Shock project.\n */\nexport function BashCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n return (\n <TypescriptFile\n path={joinPaths(context.entryPath, \"completions\", \"bash\", \"command.ts\")}\n imports={{\n \"node:os\": [\"os\"],\n \"node:fs/promises\": [\"readFile\", \"writeFile\"]\n }}\n builtinImports={{\n \"shell-shock:console\": [\n \"colors\",\n \"writeLine\",\n \"success\",\n \"warn\",\n \"stripAnsi\"\n ]\n }}>\n <TSDoc heading=\"Options for the Bash completions command.\" />\n <InterfaceDeclaration export name=\"BashCompletionsOptions\">\n <TSDoc heading=\"The path to write the completion script to.\">\n <TSDocRemarks>{`If no extension is provided, the \\`.bash\\` extension will be used.`}</TSDocRemarks>\n <TSDocDefaultValue\n type={ReflectionKind.string}\n defaultValue={`${getAppBin(context)}-completions.bash`}\n />\n </TSDoc>\n <InterfaceMember name=\"script\" optional type=\"string | true\" />\n <Spacing />\n <TSDoc heading=\"The Bash configuration file to append the completion script to.\">\n <TSDocRemarks>{`The generated completion script will be appended to the specified configuration file. Possible values for the Bash configuration file include: \\\\n- \\`~/.bashrc\\` \\\\n- \\`~/.bash_profile\\``}</TSDocRemarks>\n <TSDocDefaultValue\n type={ReflectionKind.string}\n defaultValue=\"~/.bashrc\"\n />\n </TSDoc>\n <InterfaceMember name=\"config\" optional type=\"string | true\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Handler logic for the \\`completions bash\\` command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[{ name: \"options\", type: \"BashCompletionsOptions\" }]}>\n <VarDeclaration\n const\n name=\"completions\"\n type=\"string\"\n initializer={code`# bash completion for ${getAppTitle(context)}\n\n# Define shell completion directives\nreadonly ShellCompDirectiveError=${CompletionDirective.CompletionDirectiveError}\nreadonly ShellCompDirectiveNoSpace=${\n CompletionDirective.CompletionDirectiveNoSpace\n }\nreadonly ShellCompDirectiveNoFileComp=${\n CompletionDirective.CompletionDirectiveNoFileComp\n }\nreadonly ShellCompDirectiveFilterFileExt=${\n CompletionDirective.CompletionDirectiveFilterFileExt\n }\nreadonly ShellCompDirectiveFilterDirs=${\n CompletionDirective.CompletionDirectiveFilterDirs\n }\nreadonly ShellCompDirectiveKeepOrder=${\n CompletionDirective.CompletionDirectiveKeepOrder\n }\n\n# Function to debug completion\n__${snakeCase(getAppBin(context))}_debug() {\n if [[ -n \\${BASH_COMP_DEBUG_FILE:-} ]]; then\n echo \"$*\" >> \"\\${BASH_COMP_DEBUG_FILE}\"\n fi\n}\n\n# Function to handle completions\n__${snakeCase(getAppBin(context))}_complete() {\n local cur prev words cword\n _get_comp_words_by_ref -n \"=:\" cur prev words cword\n\n local requestComp out directive\n\n # Build the command to get completions\n requestComp=\"${exec} complete -- \\${words[@]:1}\"\n\n # Add an empty parameter if the last parameter is complete\n if [[ -z \"$cur\" ]]; then\n requestComp=\"$requestComp ''\"\n fi\n\n # Get completions from the program\n out=$(eval \"$requestComp\" 2>/dev/null)\n\n # Extract directive if present\n directive=0\n if [[ \"$out\" == *:* ]]; then\n directive=\\${out##*:}\n out=\\${out%:*}\n fi\n\n # Process completions based on directive\n if [[ $((directive & $ShellCompDirectiveError)) -ne 0 ]]; then\n # Error, no completion\n return\n fi\n\n # Apply directives\n if [[ $((directive & $ShellCompDirectiveNoSpace)) -ne 0 ]]; then\n compopt -o nospace\n fi\n if [[ $((directive & $ShellCompDirectiveKeepOrder)) -ne 0 ]]; then\n compopt -o nosort\n fi\n if [[ $((directive & $ShellCompDirectiveNoFileComp)) -ne 0 ]]; then\n compopt +o default\n fi\n\n # Handle file extension filtering\n if [[ $((directive & $ShellCompDirectiveFilterFileExt)) -ne 0 ]]; then\n local filter=\"\"\n for ext in $out; do\n filter=\"$filter|$ext\"\n done\n filter=\"\\\\.($filter)\"\n compopt -o filenames\n COMPREPLY=( $(compgen -f -X \"!$filter\" -- \"$cur\") )\n return\n fi\n\n # Handle directory filtering\n if [[ $((directive & $ShellCompDirectiveFilterDirs)) -ne 0 ]]; then\n compopt -o dirnames\n COMPREPLY=( $(compgen -d -- \"$cur\") )\n return\n fi\n\n # Process completions\n local IFS=$'\\\\n'\n local tab=$(printf '\\\\t')\n\n # Parse completions with descriptions\n local completions=()\n while read -r comp; do\n if [[ \"$comp\" == *$tab* ]]; then\n # Split completion and description\n local value=\\${comp%%$tab*}\n local desc=\\${comp#*$tab}\n completions+=(\"$value\")\n else\n completions+=(\"$comp\")\n fi\n done <<< \"$out\"\n\n # Return completions\n COMPREPLY=( $(compgen -W \"\\${completions[*]}\" -- \"$cur\") )\n}\n\n# Register completion function\ncomplete -F __${snakeCase(getAppBin(context))}_complete ${getAppBin(context)}\n\\`); `}\n />\n <Spacing />\n <IfStatement condition={code`options.config`}>\n <VarDeclaration\n let\n name=\"configFilePath\"\n type=\"string\"\n initializer={code`options.config === true ? \"~/.bashrc\" : options.config`}\n />\n <Spacing />\n <IfStatement condition={code`configFilePath.startsWith(\"~\")`}>\n {code`configFilePath = join(os.homedir(), configFilePath.replace(\"~\", \"\")); `}\n </IfStatement>\n <Spacing />\n <VarDeclaration\n let\n name=\"configFileContent\"\n type=\"string\"\n initializer={code`\"\";`}\n />\n <Spacing />\n {code`try {\n configFileContent = await readFile(configFilePath, \"utf8\");\n } catch (error) {\n if (error.code === \"ENOENT\") {\n // If the file doesn't exist, we can create it later when writing the completion script.\n warn(\\`Configuration file \\${colors.bold(configFilePath)} does not exist. It will be created when the completion script is written.\\`);\n } else {\n return { error };\n }\n }\n\n await writeFile(configFilePath, \\`\\${configFileContent}\\\\n\\\\n\\${stripAnsi(completions)}\\`);\n\n success(\\`${getAppTitle(context)} Bash completion script has been generated and appended to \\${colors.bold(configFilePath)}. Please restart your terminal or run \\`source \\${configFilePath}\\` to apply the changes.\\`); `}\n </IfStatement>\n <Spacing />\n <IfStatement condition={code`options.script`}>\n {code`const outputPath = options.script === true ? \"${getAppBin(context)}-completions.bash\" : options.script;\n await writeFile(outputPath, stripAnsi(completions));\n\n success(\\`${getAppTitle(context)} Bash completion script has been generated at \\${colors.bold(outputPath)}.\\`);`}\n </IfStatement>\n <Spacing />\n <IfStatement condition={code`!options.config && !options.script`}>\n {code`writeLine(\" ------------------------------------------------- \");\n writeLine(completions);\n writeLine(\" ------------------------------------------------- \");`}\n </IfStatement>\n </FunctionDeclaration>\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+CA,SAAgBmB,yBAAyB;CACvC,MAAMC,UAAUb,eAAyC;AAEzD,QAAAc,gBACGZ,gBAAc;EAAA,IACba,OAAI;AAAA,UAAEP,UAAUK,QAAQG,WAAW,eAAe,QAAQ,aAAa;;EACvEC,SAAS;GACP,WAAW,CAAC,KAAK;GACjB,oBAAoB,CAAC,YAAY,YAAW;GAC7C;EACDC,gBAAgB,EACd,uBAAuB;GACrB;GACA;GACA;GACA;GACA;GAAW,EAEd;EAAA,IAAAC,WAAA;AAAA,UAAA;IAAAL,gBACAX,OAAK,EAACiB,SAAO,6CAAA,CAAA;IAAAN,gBACblB,sBAAoB;KAAA,UAAA;KAAQyB,MAAI;KAAA,IAAAF,WAAA;AAAA,aAAA;OAAAL,gBAC9BX,OAAK;QAACiB,SAAO;QAAA,IAAAD,WAAA;AAAA,gBAAA,CAAAL,gBACXT,cAAY,EAAAc,UAAE,sEAAoE,CAAA,EAAAL,gBAClFV,mBAAiB;UAAA,IAChB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AOdF,KAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA2EPF,UAAUH,UAAUO,QAAQ,CAAC,CAAA,YAAaP,UAAUO,QAAQ,CAAA;;;QACtE,CAAA;OAAAC,gBAEGf,SAAO,EAAA,CAAA;OAAAe,gBACPnB,aAAW;QAACwC,WAAW1C,IAAI;QAAgB,IAAA0B,WAAA;AAAA,gBAAA;UAAAL,gBACzCjB,gBAAc;WAAA,OAAA;WAEbwB,MAAI;WACJC,MAAI;WACJM,aAAanC,IAAI;WAAwD,CAAA;UAAAqB,gBAE1Ef,SAAO,EAAA,CAAA;UAAAe,gBACPnB,aAAW;WAACwC,WAAW1C,IAAI;WAAgC0B,UACzD1B,IAAI;WAAwE,CAAA;UAAAqB,gBAE9Ef,SAAO,EAAA,CAAA;UAAAe,gBACPjB,gBAAc;WAAA,OAAA;WAEbwB,MAAI;WACJC,MAAI;WACJM,aAAanC,IAAI;WAAK,CAAA;UAAAqB,gBAEvBf,SAAO,EAAA,CAAA;UAAAqC,WACP3C,IAAI;;;;;;;;;;;;;sBAaOc,YAAYM,QAAQ,CAAA,0LAA0L;UAAA;;QAAA,CAAA;OAAAC,gBAE3Nf,SAAO,EAAA,CAAA;OAAAe,gBACPnB,aAAW;QAACwC,WAAW1C,IAAI;QAAgB,IAAA0B,WAAA;AAAA,gBACzC1B,IAAI,iDAAiDa,UAAUO,QAAQ,CAAA;;;sBAG5DN,YAAYM,QAAQ,CAAA;;QAAgF,CAAA;OAAAC,gBAEjHf,SAAO,EAAA,CAAA;OAAAe,gBACPnB,aAAW;QAACwC,WAAW1C,IAAI;QAAoC0B,UAC7D1B,IAAI;;;QAE6D,CAAA;OAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA"}
1
+ {"version":3,"file":"bash-command.mjs","names":[],"sources":["../../src/components/bash-command.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code } from \"@alloy-js/core\";\nimport {\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n InterfaceMember,\n TypescriptFile\n} from \"@powerlines/plugin-alloy/typescript\";\nimport {\n TSDoc,\n TSDocDefaultValue,\n TSDocRemarks\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppBin, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport { CompletionDirective } from \"../helpers\";\nimport { exec } from \"../helpers/complete-command\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The Bash Completions commands' handler wrapper for the Shell Shock project.\n */\nexport function BashCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n return (\n <TypescriptFile\n path={joinPaths(context.entryPath, \"completions\", \"bash\", \"command.ts\")}\n imports={{\n \"node:os\": [\"os\"],\n \"node:fs/promises\": [\"readFile\", \"writeFile\"]\n }}\n builtinImports={{\n \"shell-shock:console\": [\n \"colors\",\n \"writeLine\",\n \"success\",\n \"warn\",\n \"stripAnsi\"\n ]\n }}>\n <TSDoc heading=\"Options for the Bash completions command.\" />\n <InterfaceDeclaration export name=\"BashCompletionsOptions\">\n <TSDoc heading=\"The path to write the completion script to.\">\n <TSDocRemarks>{`If no extension is provided, the \\`.bash\\` extension will be used.`}</TSDocRemarks>\n <TSDocDefaultValue\n type={ReflectionKind.string}\n defaultValue={`${getAppBin(context)}-completions.bash`}\n />\n </TSDoc>\n <InterfaceMember name=\"script\" optional type=\"string | true\" />\n <Spacing />\n <TSDoc heading=\"The Bash configuration file to append the completion script to.\">\n <TSDocRemarks>{`The generated completion script will be appended to the specified configuration file. Possible values for the Bash configuration file include: \\\\n- \\`~/.bashrc\\` \\\\n- \\`~/.bash_profile\\``}</TSDocRemarks>\n <TSDocDefaultValue\n type={ReflectionKind.string}\n defaultValue=\"~/.bashrc\"\n />\n </TSDoc>\n <InterfaceMember name=\"config\" optional type=\"string | true\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Handler logic for the \\`completions bash\\` command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[{ name: \"options\", type: \"BashCompletionsOptions\" }]}>\n <VarDeclaration\n const\n name=\"completions\"\n type=\"string\"\n initializer={code`# bash completion for ${getAppTitle(context)}\n\n# Define shell completion directives\nreadonly ShellCompDirectiveError=${CompletionDirective.CompletionDirectiveError}\nreadonly ShellCompDirectiveNoSpace=${\n CompletionDirective.CompletionDirectiveNoSpace\n }\nreadonly ShellCompDirectiveNoFileComp=${\n CompletionDirective.CompletionDirectiveNoFileComp\n }\nreadonly ShellCompDirectiveFilterFileExt=${\n CompletionDirective.CompletionDirectiveFilterFileExt\n }\nreadonly ShellCompDirectiveFilterDirs=${\n CompletionDirective.CompletionDirectiveFilterDirs\n }\nreadonly ShellCompDirectiveKeepOrder=${\n CompletionDirective.CompletionDirectiveKeepOrder\n }\n\n# Function to debug completion\n__${snakeCase(getAppBin(context))}_debug() {\n if [[ -n \\${BASH_COMP_DEBUG_FILE:-} ]]; then\n echo \"$*\" >> \"\\${BASH_COMP_DEBUG_FILE}\"\n fi\n}\n\n# Function to handle completions\n__${snakeCase(getAppBin(context))}_complete() {\n local cur prev words cword\n _get_comp_words_by_ref -n \"=:\" cur prev words cword\n\n local requestComp out directive\n\n # Build the command to get completions\n requestComp=\"${exec} complete -- \\${words[@]:1}\"\n\n # Add an empty parameter if the last parameter is complete\n if [[ -z \"$cur\" ]]; then\n requestComp=\"$requestComp ''\"\n fi\n\n # Get completions from the program\n out=$(eval \"$requestComp\" 2>/dev/null)\n\n # Extract directive if present\n directive=0\n if [[ \"$out\" == *:* ]]; then\n directive=\\${out##*:}\n out=\\${out%:*}\n fi\n\n # Process completions based on directive\n if [[ $((directive & $ShellCompDirectiveError)) -ne 0 ]]; then\n # Error, no completion\n return\n fi\n\n # Apply directives\n if [[ $((directive & $ShellCompDirectiveNoSpace)) -ne 0 ]]; then\n compopt -o nospace\n fi\n if [[ $((directive & $ShellCompDirectiveKeepOrder)) -ne 0 ]]; then\n compopt -o nosort\n fi\n if [[ $((directive & $ShellCompDirectiveNoFileComp)) -ne 0 ]]; then\n compopt +o default\n fi\n\n # Handle file extension filtering\n if [[ $((directive & $ShellCompDirectiveFilterFileExt)) -ne 0 ]]; then\n local filter=\"\"\n for ext in $out; do\n filter=\"$filter|$ext\"\n done\n filter=\"\\\\.($filter)\"\n compopt -o filenames\n COMPREPLY=( $(compgen -f -X \"!$filter\" -- \"$cur\") )\n return\n fi\n\n # Handle directory filtering\n if [[ $((directive & $ShellCompDirectiveFilterDirs)) -ne 0 ]]; then\n compopt -o dirnames\n COMPREPLY=( $(compgen -d -- \"$cur\") )\n return\n fi\n\n # Process completions\n local IFS=$'\\\\n'\n local tab=$(printf '\\\\t')\n\n # Parse completions with descriptions\n local completions=()\n while read -r comp; do\n if [[ \"$comp\" == *$tab* ]]; then\n # Split completion and description\n local value=\\${comp%%$tab*}\n local desc=\\${comp#*$tab}\n completions+=(\"$value\")\n else\n completions+=(\"$comp\")\n fi\n done <<< \"$out\"\n\n # Return completions\n COMPREPLY=( $(compgen -W \"\\${completions[*]}\" -- \"$cur\") )\n}\n\n# Register completion function\ncomplete -F __${snakeCase(getAppBin(context))}_complete ${getAppBin(context)}\n\\`); `}\n />\n <Spacing />\n <IfStatement condition={code`options.config`}>\n <VarDeclaration\n let\n name=\"configFilePath\"\n type=\"string\"\n initializer={code`options.config === true ? \"~/.bashrc\" : options.config`}\n />\n <Spacing />\n <IfStatement condition={code`configFilePath.startsWith(\"~\")`}>\n {code`configFilePath = join(os.homedir(), configFilePath.replace(\"~\", \"\")); `}\n </IfStatement>\n <Spacing />\n <VarDeclaration\n let\n name=\"configFileContent\"\n type=\"string\"\n initializer={code`\"\";`}\n />\n <Spacing />\n {code`try {\n configFileContent = await readFile(configFilePath, \"utf8\");\n } catch (error) {\n if (error.code === \"ENOENT\") {\n // If the file doesn't exist, we can create it later when writing the completion script.\n warn(\\`Configuration file \\${colors.bold(configFilePath)} does not exist. It will be created when the completion script is written.\\`);\n } else {\n return { error };\n }\n }\n\n await writeFile(configFilePath, \\`\\${configFileContent}\\\\n\\\\n\\${stripAnsi(completions)}\\`);\n\n success(\\`${getAppTitle(context)} Bash completion script has been generated and appended to \\${colors.bold(configFilePath)}. Please restart your terminal or run \\`source \\${configFilePath}\\` to apply the changes.\\`); `}\n </IfStatement>\n <Spacing />\n <IfStatement condition={code`options.script`}>\n {code`const outputPath = options.script === true ? \"${getAppBin(context)}-completions.bash\" : options.script;\n await writeFile(outputPath, stripAnsi(completions));\n\n success(\\`${getAppTitle(context)} Bash completion script has been generated at \\${colors.bold(outputPath)}.\\`);`}\n </IfStatement>\n <Spacing />\n <IfStatement condition={code`!options.config && !options.script`}>\n {code`writeLine(\" ------------------------------------------------- \");\n writeLine(completions);\n writeLine(\" ------------------------------------------------- \");`}\n </IfStatement>\n </FunctionDeclaration>\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoCA,SAAS,yBAAwB;CACjC,MAAQ,UAAU,eAAwC;AAC1D,QAAS,gBAAkB,gBAAa;EACxC,IAAQ,OAAC;A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