@mastra/observability 0.0.0-sidebar-window-undefined-fix-20251029233656 → 0.0.0-standard-schema-20260123120255

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 (57) hide show
  1. package/CHANGELOG.md +945 -3
  2. package/README.md +54 -0
  3. package/dist/config.d.ts +553 -0
  4. package/dist/config.d.ts.map +1 -0
  5. package/dist/default.d.ts +29 -0
  6. package/dist/default.d.ts.map +1 -0
  7. package/dist/exporters/base.d.ts +161 -0
  8. package/dist/exporters/base.d.ts.map +1 -0
  9. package/dist/exporters/cloud.d.ts +36 -0
  10. package/dist/exporters/cloud.d.ts.map +1 -0
  11. package/dist/exporters/console.d.ts +10 -0
  12. package/dist/exporters/console.d.ts.map +1 -0
  13. package/dist/exporters/default.d.ts +96 -0
  14. package/dist/exporters/default.d.ts.map +1 -0
  15. package/dist/exporters/index.d.ts +11 -0
  16. package/dist/exporters/index.d.ts.map +1 -0
  17. package/dist/exporters/span-formatters.d.ts +35 -0
  18. package/dist/exporters/span-formatters.d.ts.map +1 -0
  19. package/dist/exporters/test.d.ts +13 -0
  20. package/dist/exporters/test.d.ts.map +1 -0
  21. package/dist/exporters/tracking.d.ts +470 -0
  22. package/dist/exporters/tracking.d.ts.map +1 -0
  23. package/dist/index.cjs +7865 -0
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.ts +9 -2
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +7836 -0
  28. package/dist/index.js.map +1 -1
  29. package/dist/instances/base.d.ts +142 -0
  30. package/dist/instances/base.d.ts.map +1 -0
  31. package/dist/instances/default.d.ts +8 -0
  32. package/dist/instances/default.d.ts.map +1 -0
  33. package/dist/instances/index.d.ts +6 -0
  34. package/dist/instances/index.d.ts.map +1 -0
  35. package/dist/model-tracing.d.ts +55 -0
  36. package/dist/model-tracing.d.ts.map +1 -0
  37. package/dist/registry.d.ts +49 -0
  38. package/dist/registry.d.ts.map +1 -0
  39. package/dist/span_processors/index.d.ts +5 -0
  40. package/dist/span_processors/index.d.ts.map +1 -0
  41. package/dist/span_processors/sensitive-data-filter.d.ts +92 -0
  42. package/dist/span_processors/sensitive-data-filter.d.ts.map +1 -0
  43. package/dist/spans/base.d.ts +102 -0
  44. package/dist/spans/base.d.ts.map +1 -0
  45. package/dist/spans/default.d.ts +13 -0
  46. package/dist/spans/default.d.ts.map +1 -0
  47. package/dist/spans/index.d.ts +8 -0
  48. package/dist/spans/index.d.ts.map +1 -0
  49. package/dist/spans/no-op.d.ts +15 -0
  50. package/dist/spans/no-op.d.ts.map +1 -0
  51. package/dist/spans/serialization.d.ts +46 -0
  52. package/dist/spans/serialization.d.ts.map +1 -0
  53. package/dist/tracing-options.d.ts +27 -0
  54. package/dist/tracing-options.d.ts.map +1 -0
  55. package/dist/usage.d.ts +21 -0
  56. package/dist/usage.d.ts.map +1 -0
  57. package/package.json +18 -12
@@ -0,0 +1,161 @@
1
+ /**
2
+ * Base Exporter for Observability
3
+ *
4
+ * Provides common functionality shared by all observability exporters:
5
+ * - Logger initialization with proper Mastra logger support
6
+ * - Disabled state management
7
+ * - Graceful shutdown lifecycle
8
+ */
9
+ import { LogLevel } from '@mastra/core/logger';
10
+ import type { IMastraLogger } from '@mastra/core/logger';
11
+ import type { TracingEvent, ObservabilityExporter, InitExporterOptions, CustomSpanFormatter } from '@mastra/core/observability';
12
+ /**
13
+ * Base configuration that all exporters should support
14
+ */
15
+ export interface BaseExporterConfig {
16
+ /** Optional Mastra logger instance */
17
+ logger?: IMastraLogger;
18
+ /** Log level for the exporter (defaults to INFO) - accepts both enum and string */
19
+ logLevel?: LogLevel | 'debug' | 'info' | 'warn' | 'error';
20
+ /**
21
+ * Custom span formatter function to transform exported spans before they are
22
+ * processed by the exporter. This allows customization of how spans appear
23
+ * in vendor-specific observability platforms.
24
+ *
25
+ * Use cases:
26
+ * - Extract plain text from structured AI SDK messages for better readability
27
+ * - Transform input/output format for specific vendor requirements
28
+ * - Add or remove fields based on the target platform
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * const exporter = new BraintrustExporter({
33
+ * customSpanFormatter: (span) => {
34
+ * // Extract plain text user message for AGENT_RUN spans
35
+ * if (span.type === SpanType.AGENT_RUN && Array.isArray(span.input)) {
36
+ * const userMsg = span.input.find(m => m.role === 'user');
37
+ * return { ...span, input: userMsg?.content ?? span.input };
38
+ * }
39
+ * return span;
40
+ * },
41
+ * });
42
+ * ```
43
+ */
44
+ customSpanFormatter?: CustomSpanFormatter;
45
+ }
46
+ /**
47
+ * Abstract base class for observability exporters
48
+ *
49
+ * Handles common concerns:
50
+ * - Logger setup with proper Mastra logger
51
+ * - Disabled state management
52
+ * - Basic lifecycle methods
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * class MyExporter extends BaseExporter {
57
+ * name = 'my-exporter';
58
+ *
59
+ * constructor(config: MyExporterConfig) {
60
+ * super(config);
61
+ *
62
+ * if (!config.apiKey) {
63
+ * this.setDisabled('Missing API key');
64
+ * return;
65
+ * }
66
+ *
67
+ * // Initialize exporter-specific logic
68
+ * }
69
+ *
70
+ * async _exportEvent(event: TracingEvent): Promise<void> {
71
+ * // Export logic
72
+ * }
73
+ * }
74
+ * ```
75
+ */
76
+ export declare abstract class BaseExporter implements ObservabilityExporter {
77
+ #private;
78
+ /** Exporter name - must be implemented by subclasses */
79
+ abstract name: string;
80
+ /** Mastra logger instance */
81
+ protected logger: IMastraLogger;
82
+ /** Base configuration (accessible by subclasses) */
83
+ protected readonly baseConfig: BaseExporterConfig;
84
+ /** Public getter for disabled state */
85
+ get isDisabled(): boolean;
86
+ /**
87
+ * Initialize the base exporter with logger
88
+ */
89
+ constructor(config?: BaseExporterConfig);
90
+ /**
91
+ * Set the logger for the exporter (called by Mastra/ObservabilityInstance during initialization)
92
+ */
93
+ __setLogger(logger: IMastraLogger): void;
94
+ /**
95
+ * Convert string log level to LogLevel enum
96
+ */
97
+ private resolveLogLevel;
98
+ /**
99
+ * Mark the exporter as disabled and log a message
100
+ *
101
+ * @param reason - Reason why the exporter is disabled
102
+ */
103
+ protected setDisabled(reason: string): void;
104
+ /**
105
+ * Apply the customSpanFormatter if configured.
106
+ * This is called automatically by exportTracingEvent before _exportTracingEvent.
107
+ *
108
+ * Supports both synchronous and asynchronous formatters. If the formatter
109
+ * returns a Promise, it will be awaited.
110
+ *
111
+ * @param event - The incoming tracing event
112
+ * @returns The (possibly modified) event to process
113
+ */
114
+ protected applySpanFormatter(event: TracingEvent): Promise<TracingEvent>;
115
+ /**
116
+ * Export a tracing event
117
+ *
118
+ * This method checks if the exporter is disabled, applies the customSpanFormatter,
119
+ * then calls _exportTracingEvent.
120
+ * Subclasses should implement _exportTracingEvent instead of overriding this method.
121
+ */
122
+ exportTracingEvent(event: TracingEvent): Promise<void>;
123
+ /**
124
+ * Export a tracing event - must be implemented by subclasses
125
+ *
126
+ * This method is called by exportTracingEvent after checking if the exporter is disabled.
127
+ */
128
+ protected abstract _exportTracingEvent(event: TracingEvent): Promise<void>;
129
+ /**
130
+ * Optional initialization hook called after Mastra is fully configured
131
+ */
132
+ init?(_options: InitExporterOptions): void;
133
+ /**
134
+ * Optional method to add scores to traces
135
+ */
136
+ addScoreToTrace?(_args: {
137
+ traceId: string;
138
+ spanId?: string;
139
+ score: number;
140
+ reason?: string;
141
+ scorerName: string;
142
+ metadata?: Record<string, any>;
143
+ }): Promise<void>;
144
+ /**
145
+ * Force flush any buffered/queued spans without shutting down the exporter.
146
+ *
147
+ * This is useful in serverless environments where you need to ensure spans
148
+ * are exported before the runtime instance is terminated, while keeping
149
+ * the exporter active for future requests.
150
+ *
151
+ * Default implementation is a no-op. Override to add flush logic.
152
+ */
153
+ flush(): Promise<void>;
154
+ /**
155
+ * Shutdown the exporter and clean up resources
156
+ *
157
+ * Default implementation just logs. Override to add custom cleanup.
158
+ */
159
+ shutdown(): Promise<void>;
160
+ }
161
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.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EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ5D;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAE1E;;OAEG;IACH,IAAI,CAAC,CAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI;IAE1C;;OAEG;IACH,eAAe,CAAC,CAAC,KAAK,EAAE;QACtB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAChC,GAAG,OAAO,CAAC,IAAI,CAAC;IAEjB;;;;;;;;OAQG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAGhC"}
@@ -0,0 +1,36 @@
1
+ import type { TracingEvent } from '@mastra/core/observability';
2
+ import { BaseExporter } from './base.js';
3
+ import type { BaseExporterConfig } from './base.js';
4
+ export interface CloudExporterConfig extends BaseExporterConfig {
5
+ maxBatchSize?: number;
6
+ maxBatchWaitMs?: number;
7
+ maxRetries?: number;
8
+ accessToken?: string;
9
+ endpoint?: string;
10
+ }
11
+ export declare class CloudExporter extends BaseExporter {
12
+ name: string;
13
+ private cloudConfig;
14
+ private buffer;
15
+ private flushTimer;
16
+ constructor(config?: CloudExporterConfig);
17
+ protected _exportTracingEvent(event: TracingEvent): Promise<void>;
18
+ private addToBuffer;
19
+ private formatSpan;
20
+ private shouldFlush;
21
+ private scheduleFlush;
22
+ private flushBuffer;
23
+ /**
24
+ * Uploads spans to cloud API using fetchWithRetry for all retry logic
25
+ */
26
+ private batchUpload;
27
+ private resetBuffer;
28
+ /**
29
+ * Force flush any buffered spans without shutting down the exporter.
30
+ * This is useful in serverless environments where you need to ensure spans
31
+ * are exported before the runtime instance is terminated.
32
+ */
33
+ flush(): Promise<void>;
34
+ shutdown(): Promise<void>;
35
+ }
36
+ //# sourceMappingURL=cloud.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud.d.ts","sourceRoot":"","sources":["../../src/exporters/cloud.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,4BAA4B,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEjD,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAgCD,qBAAa,aAAc,SAAQ,YAAY;IAC7C,IAAI,SAAyC;IAE7C,OAAO,CAAC,WAAW,CAAsB;IACzC,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,UAAU,CAA+B;gBAErC,MAAM,GAAE,mBAAwB;cA2B5B,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBvE,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,UAAU;IAsBlB,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,aAAa;YAoBP,WAAW;IA8CzB;;OAEG;YACW,WAAW;IAezB,OAAO,CAAC,WAAW;IAMnB;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IActB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAkChC"}
@@ -0,0 +1,10 @@
1
+ import type { TracingEvent } from '@mastra/core/observability';
2
+ import { BaseExporter } from './base.js';
3
+ import type { BaseExporterConfig } from './base.js';
4
+ export declare class ConsoleExporter extends BaseExporter {
5
+ name: string;
6
+ constructor(config?: BaseExporterConfig);
7
+ protected _exportTracingEvent(event: TracingEvent): Promise<void>;
8
+ shutdown(): Promise<void>;
9
+ }
10
+ //# sourceMappingURL=console.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../src/exporters/console.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEjD,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,IAAI,SAA8B;gBAEtB,MAAM,GAAE,kBAAuB;cAI3B,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IA+EjE,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAGhC"}
@@ -0,0 +1,96 @@
1
+ import type { TracingEvent, InitExporterOptions } from '@mastra/core/observability';
2
+ import type { TracingStorageStrategy } from '@mastra/core/storage';
3
+ import type { BaseExporterConfig } from './base.js';
4
+ import { BaseExporter } from './base.js';
5
+ interface DefaultExporterConfig extends BaseExporterConfig {
6
+ maxBatchSize?: number;
7
+ maxBufferSize?: number;
8
+ maxBatchWaitMs?: number;
9
+ maxRetries?: number;
10
+ retryDelayMs?: number;
11
+ strategy?: TracingStorageStrategy | 'auto';
12
+ }
13
+ export declare class DefaultExporter extends BaseExporter {
14
+ #private;
15
+ name: string;
16
+ private buffer;
17
+ private allCreatedSpans;
18
+ constructor(config?: DefaultExporterConfig);
19
+ /**
20
+ * Initialize the exporter (called after all dependencies are ready)
21
+ */
22
+ init(options: InitExporterOptions): Promise<void>;
23
+ /**
24
+ * Initialize the resolved strategy once observability store is available
25
+ */
26
+ private initializeStrategy;
27
+ /**
28
+ * Builds a unique span key for tracking
29
+ */
30
+ private buildSpanKey;
31
+ /**
32
+ * Gets the next sequence number for a span
33
+ */
34
+ private getNextSequence;
35
+ /**
36
+ * Handles out-of-order span updates by logging and skipping
37
+ */
38
+ private handleOutOfOrderUpdate;
39
+ /**
40
+ * Adds an event to the appropriate buffer based on strategy
41
+ */
42
+ private addToBuffer;
43
+ /**
44
+ * Checks if buffer should be flushed based on size or time triggers
45
+ */
46
+ private shouldFlush;
47
+ /**
48
+ * Resets the buffer after successful flush
49
+ */
50
+ private resetBuffer;
51
+ /**
52
+ * Schedules a flush using setTimeout
53
+ */
54
+ private scheduleFlush;
55
+ /**
56
+ * Serializes span attributes to storage record format
57
+ * Handles all Span types and their specific attributes
58
+ */
59
+ private serializeAttributes;
60
+ private buildCreateRecord;
61
+ private buildUpdateRecord;
62
+ /**
63
+ * Handles realtime strategy - processes each event immediately
64
+ */
65
+ private handleRealtimeEvent;
66
+ /**
67
+ * Handles batch-with-updates strategy - buffers events and processes in batches
68
+ */
69
+ private handleBatchWithUpdatesEvent;
70
+ /**
71
+ * Handles insert-only strategy - only processes SPAN_ENDED events in batches
72
+ */
73
+ private handleInsertOnlyEvent;
74
+ /**
75
+ * Calculates retry delay using exponential backoff
76
+ */
77
+ private calculateRetryDelay;
78
+ /**
79
+ * Flushes the current buffer to storage with retry logic (internal implementation)
80
+ */
81
+ private flushBuffer;
82
+ /**
83
+ * Attempts to flush with exponential backoff retry logic
84
+ */
85
+ private flushWithRetries;
86
+ _exportTracingEvent(event: TracingEvent): Promise<void>;
87
+ /**
88
+ * Force flush any buffered spans without shutting down the exporter.
89
+ * This is useful in serverless environments where you need to ensure spans
90
+ * are exported before the runtime instance is terminated.
91
+ */
92
+ flush(): Promise<void>;
93
+ shutdown(): Promise<void>;
94
+ }
95
+ export {};
96
+ //# sourceMappingURL=default.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default.d.ts","sourceRoot":"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H,OAAO,CAAC,2BAA2B;IAgBnC;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAoB7B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAI3B;;OAEG;YACW,WAAW;IAsDzB;;OAEG;YACW,gBAAgB;IA+DxB,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAyB7D;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAStB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAYhC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Mastra Tracing Exporters
3
+ */
4
+ export * from './base.js';
5
+ export * from './tracking.js';
6
+ export * from './span-formatters.js';
7
+ export * from './cloud.js';
8
+ export * from './console.js';
9
+ export * from './default.js';
10
+ export * from './test.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exporters/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAG3B,cAAc,mBAAmB,CAAC;AAGlC,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Utility functions for working with custom span formatters.
3
+ */
4
+ import type { CustomSpanFormatter } from '@mastra/core/observability';
5
+ /**
6
+ * Chains multiple span formatters into a single formatter.
7
+ *
8
+ * Formatters are applied in order, with each receiving the output of the previous.
9
+ * Supports both synchronous and asynchronous formatters - if any formatter returns
10
+ * a Promise, the entire chain will return a Promise.
11
+ *
12
+ * @param formatters - Array of formatters to chain (can be sync or async)
13
+ * @returns A single formatter that applies all formatters in sequence
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * // Chain sync formatters
18
+ * const chainedFormatter = chainFormatters([
19
+ * myPlainTextFormatter,
20
+ * myRedactionFormatter,
21
+ * ]);
22
+ *
23
+ * // Chain mixed sync and async formatters
24
+ * const asyncChainedFormatter = chainFormatters([
25
+ * myPlainTextFormatter, // sync
26
+ * myAsyncEnrichmentFormatter, // async
27
+ * ]);
28
+ *
29
+ * const exporter = new BraintrustExporter({
30
+ * customSpanFormatter: chainedFormatter,
31
+ * });
32
+ * ```
33
+ */
34
+ export declare function chainFormatters(formatters: CustomSpanFormatter[]): CustomSpanFormatter;
35
+ //# sourceMappingURL=span-formatters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"span-formatters.d.ts","sourceRoot":"","sources":["../../src/exporters/span-formatters.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAmB,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEvF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,mBAAmB,EAAE,GAAG,mBAAmB,CAQtF"}
@@ -0,0 +1,13 @@
1
+ import type { TracingEvent } from '@mastra/core/observability';
2
+ import { BaseExporter } from './base.js';
3
+ import type { BaseExporterConfig } from './base.js';
4
+ export declare class TestExporter extends BaseExporter {
5
+ #private;
6
+ name: string;
7
+ constructor(config?: BaseExporterConfig);
8
+ protected _exportTracingEvent(event: TracingEvent): Promise<void>;
9
+ clearEvents(): void;
10
+ get events(): TracingEvent[];
11
+ shutdown(): Promise<void>;
12
+ }
13
+ //# sourceMappingURL=test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/exporters/test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEjD,qBAAa,YAAa,SAAQ,YAAY;;IAC5C,IAAI,SAA2B;gBAGnB,MAAM,GAAE,kBAAuB;cAI3B,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvE,WAAW;IAIX,IAAI,MAAM,IAAI,YAAY,EAAE,CAE3B;IAEK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAGhC"}