@0xmaxma/claude-gateway 1.8.3 → 1.8.4

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 (41) hide show
  1. package/README.md +56 -0
  2. package/dist/cli/commands/debug-bundle.d.ts.map +1 -1
  3. package/dist/cli/commands/debug-bundle.js +9 -52
  4. package/dist/cli/commands/debug-bundle.js.map +1 -1
  5. package/dist/cli/commands/gateway.d.ts +6 -1
  6. package/dist/cli/commands/gateway.d.ts.map +1 -1
  7. package/dist/cli/commands/gateway.js +14 -3
  8. package/dist/cli/commands/gateway.js.map +1 -1
  9. package/dist/cli/commands/logs.d.ts +37 -0
  10. package/dist/cli/commands/logs.d.ts.map +1 -0
  11. package/dist/cli/commands/logs.js +356 -0
  12. package/dist/cli/commands/logs.js.map +1 -0
  13. package/dist/cli/index.d.ts.map +1 -1
  14. package/dist/cli/index.js +16 -5
  15. package/dist/cli/index.js.map +1 -1
  16. package/dist/cli/logs-dir.d.ts +69 -0
  17. package/dist/cli/logs-dir.d.ts.map +1 -0
  18. package/dist/cli/logs-dir.js +166 -0
  19. package/dist/cli/logs-dir.js.map +1 -0
  20. package/dist/config/watcher.d.ts.map +1 -1
  21. package/dist/config/watcher.js +5 -0
  22. package/dist/config/watcher.js.map +1 -1
  23. package/dist/index.js +26 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/logger.d.ts +52 -1
  26. package/dist/logger.d.ts.map +1 -1
  27. package/dist/logger.js +264 -2
  28. package/dist/logger.js.map +1 -1
  29. package/dist/shell/bypass-dialog.d.ts +104 -12
  30. package/dist/shell/bypass-dialog.d.ts.map +1 -1
  31. package/dist/shell/bypass-dialog.js +146 -14
  32. package/dist/shell/bypass-dialog.js.map +1 -1
  33. package/dist/shell/claude-pty-shell.js +29 -4
  34. package/dist/shell/claude-pty-shell.js.map +1 -1
  35. package/dist/shell/screen.d.ts +15 -11
  36. package/dist/shell/screen.d.ts.map +1 -1
  37. package/dist/shell/screen.js +42 -33
  38. package/dist/shell/screen.js.map +1 -1
  39. package/dist/types.d.ts +20 -0
  40. package/dist/types.d.ts.map +1 -1
  41. package/package.json +1 -1
package/README.md CHANGED
@@ -135,6 +135,7 @@ Once installed, drive it through the CLI — it detects whichever manager owns t
135
135
  claude-gateway gateway status # manager, URL, health
136
136
  claude-gateway gateway restart
137
137
  claude-gateway gateway stop
138
+ claude-gateway gateway logs # tail the gateway's own log (works even when it is dead)
138
139
  ```
139
140
 
140
141
  Managing PM2 directly still works too:
@@ -214,6 +215,12 @@ Config lives at `~/.claude-gateway/config.json` (or set `GATEWAY_CONFIG` env var
214
215
  "configVersion": "1.0.0",
215
216
  "gateway": {
216
217
  "logDir": "~/.claude-gateway/logs",
218
+ "logs": {
219
+ "level": "info",
220
+ "maxFileBytes": 16777216,
221
+ "maxFiles": 3,
222
+ "retentionDays": 14
223
+ },
217
224
  "timezone": "Asia/Bangkok",
218
225
  "api": {
219
226
  "keys": [
@@ -277,6 +284,31 @@ public base — e.g. LINE, which derives its host from the inbound webhook — b
277
284
  `<base>/shared/<token>` themselves. HTTP is accepted only for local development
278
285
  hosts such as `http://host.docker.internal:10850/gateway`.
279
286
 
287
+ ### `gateway.logs` (optional)
288
+
289
+ Verbosity, rotation and retention for the files in `logDir`. The whole block is optional —
290
+ omit it and the defaults below apply.
291
+
292
+ | Field | Default | Description |
293
+ |-------|---------|-------------|
294
+ | `level` | `"info"` | Minimum level written, to both the file and stdout. One of `debug`, `info`, `warn`, `error` |
295
+ | `maxFileBytes` | `16777216` (16 MiB) | Rotate `<name>.log` to `<name>.log.1` once an append would carry it past this size |
296
+ | `maxFiles` | `3` | Rotated generations kept per stream; the oldest is deleted. Lowering it collects the generations it orphans at the next rotation. `0` = keep none |
297
+ | `retentionDays` | `14` | Delete logs (live and rotated) older than this, at boot and once a day. `0` = keep forever |
298
+
299
+ `level` is the one that governs disk usage. Session processes log every stream event at `debug`,
300
+ which on a live host measured 19,995 `debug` lines to 5 `info` lines inside a single 217 MB file —
301
+ so `debug` is off by default. Set `"level": "debug"` when you are actually chasing something, and
302
+ expect the directory to grow quickly while it is on. Rotation and retention bound what is *kept*;
303
+ only the level bounds what is *written*.
304
+
305
+ Retention is age-based because each session writes its own `<agent>:session:<uuid>.log` and never
306
+ returns to it — `maxFiles` prunes generations of one stream, so it can never reach them.
307
+
308
+ This block is **hot-reloaded**: edit it in `config.json` and it applies on the next config reload,
309
+ no restart. That matters because turning the level up is something you do while chasing a live
310
+ problem, and a restart would kill the sessions you are trying to observe.
311
+
280
312
  ### `session`
281
313
 
282
314
  | Field | Default | Description |
@@ -715,6 +747,7 @@ The `claude-gateway` binary doubles as a command-line client for a running gatew
715
747
  claude-gateway # help (never starts a server)
716
748
  claude-gateway gateway start # run the gateway in the foreground
717
749
  claude-gateway gateway status # is it running? which manager owns it?
750
+ claude-gateway gateway logs --follow # stream the gateway log (reads files, needs no server)
718
751
  claude-gateway service install # run it as a systemd-user (or --manager pm2) service
719
752
  claude-gateway update check # newer claude-gateway published?
720
753
  claude-gateway claude update # update Claude Code via its own updater
@@ -727,6 +760,28 @@ claude-gateway debug-bundle # small redacted bundle for a stuck s
727
760
  claude-gateway api GET /v1/agents # escape hatch: call any endpoint directly
728
761
  ```
729
762
 
763
+ ### Reading the logs
764
+
765
+ `gateway logs` reads the log files directly, so it answers whether or not the gateway is
766
+ running — which is usually exactly when you need it.
767
+
768
+ ```bash
769
+ claude-gateway gateway logs # last 50 lines of logs/gateway.log
770
+ claude-gateway gateway logs --lines 200 --follow # more history, then stream
771
+ claude-gateway gateway logs --agent alfred # that agent's stream instead
772
+ claude-gateway gateway logs --json # the stored JSON lines, verbatim
773
+ ```
774
+
775
+ Each line is stored as one JSON object and rendered as `<ts> <LEVEL> <message>` with `data`
776
+ appended; `--json` prints the stored line unchanged, for piping into `jq`. `--agent <id>` takes
777
+ any stream id in the log directory — agents (`alfred`), receivers (`alfred:receiver`), and
778
+ sessions (`alfred:session:<uuid>`) each get their own file — and an unknown id lists the ids that
779
+ do exist rather than reporting an empty result. `--follow` survives a rotation: when the file it
780
+ is watching is renamed away it reopens the new one instead of going quiet.
781
+
782
+ Unlike `debug-bundle`, this output is **not redacted** — it is the local file you could already
783
+ `cat`. Skim before pasting it anywhere.
784
+
730
785
  > **Upgrading from < 1.8:** a service unit that runs the binary with no command still starts the
731
786
  > gateway, with a deprecation warning. Point `ExecStart` at `claude-gateway gateway start`, or
732
787
  > reinstall the unit with `claude-gateway service install`.
@@ -961,6 +1016,7 @@ claude-gateway/
961
1016
  ├── config.json ← gateway config
962
1017
  ├── logs/
963
1018
  │ ├── alfred.log
1019
+ │ ├── alfred.log.1 ← rotated generation (see `gateway.logs`)
964
1020
  │ └── warrior.log
965
1021
  ├── shared-skills/ ← shared skills (synced to ~/.claude/skills/ on boot and on change)
966
1022
  │ └── <skill-name>/
@@ -1 +1 @@
1
- {"version":3,"file":"debug-bundle.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/debug-bundle.ts"],"names":[],"mappings":"AA8BA;;2BAE2B;AAC3B,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,SAAiB,EAAE,aAAa,SAAkB,GAAG,MAAM,EAAE,CAQ3H;AAgFD,wBAAsB,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAyE7F"}
1
+ {"version":3,"file":"debug-bundle.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/debug-bundle.ts"],"names":[],"mappings":"AA8BA;;2BAE2B;AAC3B,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,SAAiB,EAAE,aAAa,SAAkB,GAAG,MAAM,EAAE,CAQ3H;AAmCD,wBAAsB,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CA8E7F"}
@@ -39,7 +39,7 @@ const child_process_1 = require("child_process");
39
39
  const fs = __importStar(require("fs"));
40
40
  const os = __importStar(require("os"));
41
41
  const path = __importStar(require("path"));
42
- const http_client_1 = require("../http-client");
42
+ const logs_dir_1 = require("../logs-dir");
43
43
  const redact_1 = require("../redact");
44
44
  const output_1 = require("../output");
45
45
  /**
@@ -74,55 +74,6 @@ function selectDiagnosticLines(content, maxLines = MAX_DIAG_LINES, maxLineLength
74
74
  }
75
75
  return picked.length > maxLines ? picked.slice(picked.length - maxLines) : picked;
76
76
  }
77
- /** The config file stores `logDir` exactly as written, and the shipped template
78
- * writes `~/.claude-gateway/logs`. The server expands that itself on boot, so
79
- * the literal tilde survives on disk and only bites a reader that forgets to
80
- * expand it — `readdirSync('~/...')` throws ENOENT and looks like "no logs". */
81
- function resolveLogDir(flags) {
82
- if (typeof flags.logDir === 'string')
83
- return (0, http_client_1.expandHome)(flags.logDir);
84
- const cfg = (0, http_client_1.loadCliConfig)(typeof flags.config === 'string' ? flags.config : undefined);
85
- if (cfg.logDir)
86
- return (0, http_client_1.expandHome)(cfg.logDir);
87
- return path.join(os.homedir(), '.claude-gateway', 'logs');
88
- }
89
- /**
90
- * Session logs in `dir`, or the reason the directory could not be read.
91
- *
92
- * The read used to be wrapped in a bare `catch { return [] }`, which reported
93
- * every failure as "no session logs found". That is how the unexpanded `~`
94
- * stayed invisible: an ENOENT on a path that was never resolved looked exactly
95
- * like an empty directory, and a permission problem still would. The caller
96
- * needs the errno to say anything useful, so it is returned rather than eaten.
97
- */
98
- function listSessionLogs(dir) {
99
- let names;
100
- try {
101
- names = fs.readdirSync(dir);
102
- }
103
- catch (err) {
104
- const e = err;
105
- if (e.code === 'ENOENT')
106
- return { logs: [], error: `${dir} does not exist` };
107
- if (e.code === 'ENOTDIR')
108
- return { logs: [], error: `${dir} is not a directory` };
109
- return { logs: [], error: `${dir} could not be read (${e.code ?? e.message})` };
110
- }
111
- const logs = names
112
- .filter((n) => n.endsWith('.log') && /session/i.test(n))
113
- .map((n) => {
114
- const file = path.join(dir, n);
115
- let mtimeMs = 0;
116
- try {
117
- mtimeMs = fs.statSync(file).mtimeMs;
118
- }
119
- catch {
120
- /* ignore */
121
- }
122
- return { file, mtimeMs };
123
- });
124
- return { logs };
125
- }
126
77
  function claudeCodeVersion() {
127
78
  try {
128
79
  return (0, child_process_1.execSync)('claude --version', { stdio: ['ignore', 'pipe', 'ignore'], timeout: 3000 }).toString().trim();
@@ -156,9 +107,15 @@ async function runDebugBundle(flags) {
156
107
  printHelp();
157
108
  return 0;
158
109
  }
159
- const logDir = resolveLogDir(flags);
110
+ const logDir = (0, logs_dir_1.resolveLogDir)(flags);
111
+ // A `--config` that could not be read leaves this pointing at the default
112
+ // directory, which would otherwise be reported as though it were the one
113
+ // asked for.
114
+ const configWarning = (0, logs_dir_1.explicitConfigWarning)(flags);
115
+ if (configWarning)
116
+ process.stderr.write(`${configWarning}\n`);
160
117
  const sessionFilter = typeof flags.session === 'string' ? flags.session : undefined;
161
- const found = listSessionLogs(logDir);
118
+ const found = (0, logs_dir_1.listSessionLogs)(logDir);
162
119
  // A directory that could not be read is a different answer from one holding
163
120
  // no logs, and only one of them is the operator's to fix.
164
121
  if (found.error) {
@@ -1 +1 @@
1
- {"version":3,"file":"debug-bundle.js","sourceRoot":"","sources":["../../../src/cli/commands/debug-bundle.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,sDAQC;AAgFD,wCAyEC;AAlMD,iDAAyC;AACzC,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAC7B,gDAA2D;AAC3D,sCAAuC;AACvC,sCAA6C;AAE7C;;;;;;;;GAQG;AAEH,MAAM,cAAc,GAAG,IAAI,CAAC;AAC5B;;;iDAGiD;AACjD,MAAM,eAAe,GAAG,IAAI,CAAC;AAE7B,SAAS,YAAY,CAAC,IAAY,EAAE,SAAiB;IACnD,IAAI,IAAI,CAAC,MAAM,IAAI,SAAS;QAAE,OAAO,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CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,QAAQ,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,iBAAkB,GAAa,CAAC,OAAO,OAAO,CAAC,CAAC;YACxF,SAAS;QACX,CAAC;QACD,MAAM,KAAK,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAC7C,QAAQ,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,MAAM,wBAAwB,CAAC,CAAC;QACnF,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpB,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAC7D,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,gBAAgB,KAAK,MAAM,CAAC,CAAC;IACtE,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;IACrC,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,uBAAuB,OAAO,IAAI;QAChC,kJAAkJ,CACrJ,CAAC;IACF,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -1,12 +1,17 @@
1
1
  import { CliConfigView } from '../http-client';
2
2
  /**
3
- * `gateway start|status|restart|stop` — whole-process lifecycle.
3
+ * `gateway start|status|restart|stop|logs` — whole-process lifecycle.
4
4
  *
5
5
  * `start` is handled by the boot entry point (src/index.ts), which recognises
6
6
  * it before the CLI is ever imported; it is listed here only so the usage text
7
7
  * and an unknown-verb error stay honest. Restart/stop must be performed by
8
8
  * whatever manager owns the process (it has to stop the very process serving
9
9
  * HTTP), so detection resolves the manager and the action is delegated to it.
10
+ *
11
+ * `logs` is the odd one out: it touches no process at all, reading the log
12
+ * files directly so it still answers when the gateway is wedged or dead. It
13
+ * lives here because the logs are the gateway's, and an operator looking for
14
+ * them looks under the noun they already know.
10
15
  */
11
16
  export declare function runGatewayLifecycle(positionals: string[], flags: Record<string, string | boolean>, config: CliConfigView): Promise<number>;
12
17
  //# sourceMappingURL=gateway.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/gateway.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAmB,MAAM,gBAAgB,CAAC;AAMhE;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,MAAM,EAAE,EACrB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EACvC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,MAAM,CAAC,CA8BjB"}
1
+ {"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/gateway.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAmB,MAAM,gBAAgB,CAAC;AAOhE;;;;;;;;;;;;;GAaG;AACH,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,MAAM,EAAE,EACrB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EACvC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,MAAM,CAAC,CAmCjB"}
@@ -41,20 +41,29 @@ const health_1 = require("../health");
41
41
  const manager_1 = require("../manager");
42
42
  const output_1 = require("../output");
43
43
  const output_2 = require("../output");
44
+ const logs_1 = require("./logs");
44
45
  /**
45
- * `gateway start|status|restart|stop` — whole-process lifecycle.
46
+ * `gateway start|status|restart|stop|logs` — whole-process lifecycle.
46
47
  *
47
48
  * `start` is handled by the boot entry point (src/index.ts), which recognises
48
49
  * it before the CLI is ever imported; it is listed here only so the usage text
49
50
  * and an unknown-verb error stay honest. Restart/stop must be performed by
50
51
  * whatever manager owns the process (it has to stop the very process serving
51
52
  * HTTP), so detection resolves the manager and the action is delegated to it.
53
+ *
54
+ * `logs` is the odd one out: it touches no process at all, reading the log
55
+ * files directly so it still answers when the gateway is wedged or dead. It
56
+ * lives here because the logs are the gateway's, and an operator looking for
57
+ * them looks under the noun they already know.
52
58
  */
53
59
  async function runGatewayLifecycle(positionals, flags, config) {
54
60
  const verb = positionals[0];
55
61
  if (!verb) {
56
62
  // `gateway --help` is a help request (0); a bare `gateway` is a usage error (1).
57
- (0, output_2.writeCommandHelp)(flags.help === true, 'gateway', 'manage the gateway process on this host', 'claude-gateway gateway <start|status|restart|stop>', [' start is the only command that boots a server; the rest are manager-aware.']);
63
+ (0, output_2.writeCommandHelp)(flags.help === true, 'gateway', 'manage the gateway process on this host', 'claude-gateway gateway <start|status|restart|stop|logs>', [
64
+ ' start is the only command that boots a server; status/restart/stop are manager-aware.',
65
+ ' logs reads the log files directly and works even when the gateway is dead.',
66
+ ]);
58
67
  return flags.help === true ? 0 : 1;
59
68
  }
60
69
  switch (verb) {
@@ -69,8 +78,10 @@ async function runGatewayLifecycle(positionals, flags, config) {
69
78
  return gatewayAction('restart');
70
79
  case 'stop':
71
80
  return gatewayAction('stop');
81
+ case 'logs':
82
+ return (0, logs_1.runGatewayLogs)(flags);
72
83
  default:
73
- process.stderr.write(`Unknown: gateway ${verb} (expected start|status|restart|stop)\n`);
84
+ process.stderr.write(`Unknown: gateway ${verb} (expected start|status|restart|stop|logs)\n`);
74
85
  return 1;
75
86
  }
76
87
  }
@@ -1 +1 @@
1
- {"version":3,"file":"gateway.js","sourceRoot":"","sources":["../../../src/cli/commands/gateway.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,kDAkCC;AAnDD,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AAM,YAAa,GAAa,CAAC,OAAO,IAAI,CAAC,CAAC;QAC9E,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;AACH,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Render one stored line as `<ts> <level> <message>` with `data` appended
3
+ * compactly.
4
+ *
5
+ * A line that is not a gateway log record is passed through verbatim rather
6
+ * than dropped or replaced with a placeholder: anything already in the file is
7
+ * something the operator may need to see, and a reader that silently discards
8
+ * what it does not recognise is how a corrupt tail looks like an idle gateway.
9
+ */
10
+ export declare function formatLogLine(line: string): string;
11
+ /**
12
+ * The last `count` lines of `file`, oldest first, with the offset they were
13
+ * read to.
14
+ *
15
+ * Reads backwards in chunks so the cost is bounded by what is asked for rather
16
+ * than by the size of the file.
17
+ *
18
+ * `endPos` is what `--follow` must resume from. Following from a *later*
19
+ * `statSync` would skip whatever the gateway appended in between: those bytes
20
+ * are past the tail's read and before the follower's start, so nothing would
21
+ * ever print them. Nothing can interleave here within this process — the read
22
+ * is synchronous — but the writer is a different process, which is the whole
23
+ * reason the command exists.
24
+ */
25
+ export declare function tailFrom(file: string, count: number): {
26
+ lines: string[];
27
+ endPos: number;
28
+ };
29
+ /** The last `count` lines of `file`, oldest first. */
30
+ export declare function tailLines(file: string, count: number): string[];
31
+ export interface LogsRunOptions {
32
+ /** Stops `--follow`. Tests pass one; the CLI wires it to SIGINT. */
33
+ signal?: AbortSignal;
34
+ pollMs?: number;
35
+ }
36
+ export declare function runGatewayLogs(flags: Record<string, string | boolean>, opts?: LogsRunOptions): Promise<number>;
37
+ //# sourceMappingURL=logs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/logs.ts"],"names":[],"mappings":"AAsCA;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAmBlD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CA8BzF;AAED,sDAAsD;AACtD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAE/D;AAQD,MAAM,WAAW,cAAc;IAC7B,oEAAoE;IACpE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA+BD,wBAAsB,cAAc,CAClC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EACvC,IAAI,GAAE,cAAmB,GACxB,OAAO,CAAC,MAAM,CAAC,CAsEjB"}