@statewalker/webrun-streams-libp2p 0.6.0 → 0.7.1

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.
@@ -1,31 +1,61 @@
1
1
  import type { Libp2p, PeerId } from "@libp2p/interface";
2
2
  import type { Multiaddr } from "@multiformats/multiaddr";
3
- import type { Connect, Duplex, Serve } from "@statewalker/webrun-streams";
4
- export declare const DEFAULT_PROTOCOL = "/webrun-streams/1.0.0";
3
+ import type { Connect, Serve } from "@statewalker/webrun-streams";
4
+ import { type ConnectionContext, DEFAULT_PROTOCOL, type ServeConnectionsHandler } from "./shared.js";
5
+ export { type ConnectionContext, DEFAULT_PROTOCOL, type ServeConnectionsHandler };
6
+ /**
7
+ * 4 MiB: the port window `connect`/`serve` grant unless told otherwise — the
8
+ * most one call moves per round trip, and the most a producer runs ahead of a
9
+ * consumer that stopped reading (statewalker/webrun-wire#153).
10
+ *
11
+ * A call moves at most `window / RTT`, so the window should be at least the
12
+ * link's bandwidth-delay product: 4 MiB covers 200 Mbit/s at 100 ms
13
+ * (2.5 MB). Raise it for faster or longer links; lower it (not below 64 KiB)
14
+ * to bound memory per call more tightly where the BDP is small — a window far
15
+ * above the bottleneck's queue only adds latency (bufferbloat).
16
+ */
17
+ export declare const DEFAULT_WINDOW: number;
18
+ /**
19
+ * The protocol a call's stream negotiates for `connect`/`serve` configured
20
+ * with `protocol`: `protocol` with `/ports` appended, and `/window` after it
21
+ * when both ends run the window (always, between two releases from this one
22
+ * on). `protocol` itself is the deprecated protocol, still served, and dialled
23
+ * when a peer refuses this one.
24
+ */
25
+ export declare function portProtocolOf(protocol: string): string;
5
26
  export interface ConnectLibp2pParams {
6
27
  node: Libp2p;
7
28
  peer: PeerId | Multiaddr;
8
- /** libp2p protocol id; defaults to `/webrun-streams/1.0.0`. */
29
+ /**
30
+ * The protocol id both ends are configured with; defaults to
31
+ * {@link DEFAULT_PROTOCOL}. Calls negotiate {@link portProtocolOf} it, and
32
+ * fall back to it (the deprecated protocol) against an older server.
33
+ */
9
34
  protocol?: string;
10
35
  /**
11
- * How long to wait for a backpressured stream to drain before dropping the
12
- * peer; defaults to `DEFAULT_DRAIN_TIMEOUT_MS` (5 minutes).
36
+ * The port window in bytes (default {@link DEFAULT_WINDOW}, at least 64 KiB):
37
+ * the most this end holds of a call's response delivered and not yet read.
38
+ * It is also the most this end sends ahead of the server: a call's request
39
+ * runs at most min(the server's window, this window) ahead
40
+ * (statewalker/webrun-wire#195). Size it at least to the bandwidth-delay
41
+ * product of the link (see {@link DEFAULT_WINDOW}).
13
42
  */
14
- drainTimeoutMs?: number;
43
+ window?: number;
15
44
  /**
16
- * Response bytes held while the caller is not reading before the stream is
17
- * paused; see `DuplexOverStreamOptions.readHighWaterBytes` (default 64 KiB).
45
+ * Per-call inactivity timeout in ms, reset by any chunk in either direction
46
+ * (`webrun-rpc`'s `timeout`). Unset, the default, means none: a slow
47
+ * consumer is throttled, never failed.
18
48
  */
19
- readHighWaterBytes?: number;
49
+ timeout?: number;
20
50
  /**
21
- * The largest frame payload accepted from the peer; past it, or on a
22
- * malformed frame header, the call fails and the stream is aborted. See
23
- * `DuplexOverStreamOptions.maxFrameBytes` (default 64 MiB).
51
+ * The largest frame accepted from the peer on a call's stream; past it, or
52
+ * on a malformed frame header, the call fails and the stream is aborted.
53
+ * Default 64 MiB.
24
54
  */
25
55
  maxFrameBytes?: number;
26
56
  /**
27
- * How many outgoing streams for this protocol libp2p allows to be open at
28
- * the same time on one connection; passed through to `node.dialProtocol`.
57
+ * How many outgoing streams for the calls' protocol libp2p allows to be open
58
+ * at the same time on one connection; passed through to `node.dialProtocol`.
29
59
  * Left unset, libp2p's own default (64) applies.
30
60
  */
31
61
  maxOutboundStreams?: number;
@@ -33,86 +63,119 @@ export interface ConnectLibp2pParams {
33
63
  * Opt-in to dialing over a connection with limits on how much data can be
34
64
  * transferred or how long it can be open for (e.g. a relayed circuit);
35
65
  * passed through to `node.dialProtocol`. Left unset, libp2p refuses to open
36
- * this protocol's stream on such a connection — this package does not
37
- * decide that trade-off for the caller, it only exposes the knob.
66
+ * the calls' streams on such a connection — this package does not decide
67
+ * that trade-off for the caller, it only exposes the knob.
38
68
  */
39
69
  runOnLimitedConnection?: boolean;
40
- }
41
- export interface ServeLibp2pParams {
42
- node: Libp2p;
43
- /** libp2p protocol id; defaults to `/webrun-streams/1.0.0`. */
44
- protocol?: string;
45
70
  /**
46
- * How long to wait for a backpressured stream to drain before dropping the
47
- * peer; defaults to `DEFAULT_DRAIN_TIMEOUT_MS` (5 minutes). This is the only
48
- * bound on a peer that requests something and then stops reading without
49
- * closing, since the caller-side `.return`/abort escape does not exist here.
71
+ * How long, in ms, a write may wait for a call's stream to drain (the
72
+ * server stopped reading at the transport) before the stream is reset and
73
+ * the call fails; defaults to `DEFAULT_DRAIN_TIMEOUT_MS` (5 minutes). Only
74
+ * a write blocked on drain counts: a quiet call is never timed out. Applies
75
+ * to the port protocol (statewalker/webrun-wire#195) and to the deprecated
76
+ * one. On the port protocol, 0 or `Infinity` means no bound (the deprecated
77
+ * protocol drops a backpressured stream at once on 0).
50
78
  */
51
79
  drainTimeoutMs?: number;
52
80
  /**
53
- * Request bytes held while the handler is not reading before the stream is
54
- * paused; see `DuplexOverStreamOptions.readHighWaterBytes` (default 64 KiB).
81
+ * The deprecated protocol only (an older server): response bytes held while
82
+ * the caller is not reading before the stream is paused (default 64 KiB).
83
+ *
84
+ * @deprecated Removed with the deprecated protocol, in the next release.
55
85
  */
56
86
  readHighWaterBytes?: number;
87
+ }
88
+ export interface ServeLibp2pParams {
89
+ node: Libp2p;
57
90
  /**
58
- * The largest frame payload accepted from the peer; past it, or on a
59
- * malformed frame header, the call fails and the stream is aborted. See
60
- * `DuplexOverStreamOptions.maxFrameBytes` (default 64 MiB).
91
+ * The protocol id both ends are configured with; defaults to
92
+ * {@link DEFAULT_PROTOCOL}. Calls arrive on {@link portProtocolOf} it; the
93
+ * id itself is served too, for older callers (the deprecated protocol).
61
94
  */
95
+ protocol?: string;
96
+ /**
97
+ * The port window in bytes (default {@link DEFAULT_WINDOW}, at least 64 KiB):
98
+ * the most this end holds of a call's request delivered and not yet read by
99
+ * the handler. It is also the most a response runs ahead of its caller,
100
+ * whatever window the caller announces (up to 4 GiB): min(the caller's
101
+ * window, this window) (statewalker/webrun-wire#195). See
102
+ * {@link ConnectLibp2pParams.window}.
103
+ */
104
+ window?: number;
105
+ /** Per-call inactivity timeout in ms; see {@link ConnectLibp2pParams.timeout}. */
106
+ timeout?: number;
107
+ /** The largest frame accepted from the peer; see {@link ConnectLibp2pParams.maxFrameBytes}. */
62
108
  maxFrameBytes?: number;
63
109
  /**
64
- * How many incoming streams for this protocol libp2p allows to be open at
65
- * the same time on one connection; passed through to `node.handle`. Left
66
- * unset, libp2p's own default (32) applies — past it, a new inbound stream
67
- * is reset rather than queued, so a caller that opens one stream per
68
- * in-flight request will start seeing rejected calls above that count.
110
+ * How many incoming streams for each served protocol libp2p allows to be
111
+ * open at the same time on one connection; passed through to
112
+ * `node.handle`. Left unset, libp2p's own default (32) applies — past it, a
113
+ * new inbound stream is reset rather than queued, so a caller with more
114
+ * calls in flight starts seeing rejected calls above that count.
69
115
  */
70
116
  maxInboundStreams?: number;
71
117
  /**
72
- * How many outgoing streams for this protocol libp2p allows to be open at
73
- * the same time on one connection; passed through to `node.handle`. Left
74
- * unset, libp2p's own default (64) applies.
118
+ * How many outgoing streams for each served protocol libp2p allows to be
119
+ * open at the same time on one connection; passed through to `node.handle`.
120
+ * Left unset, libp2p's own default (64) applies.
75
121
  */
76
122
  maxOutboundStreams?: number;
77
123
  /**
78
- * Opt-in to accepting streams for this protocol over a connection with
79
- * limits on how much data can be transferred or how long it can be open
80
- * for (e.g. a relayed circuit); passed through to `node.handle`. Left
81
- * unset, libp2p refuses to open this protocol's stream on such a
82
- * connection — this package does not decide that trade-off for the
83
- * consumer, it only exposes the knob.
124
+ * Opt-in to accepting calls over a connection with limits on how much data
125
+ * can be transferred or how long it can be open for (e.g. a relayed
126
+ * circuit); passed through to `node.handle`.
84
127
  */
85
128
  runOnLimitedConnection?: boolean;
129
+ /**
130
+ * How long, in ms, a write may wait for a call's stream to drain (the
131
+ * caller stopped reading at the transport) before the stream is reset and
132
+ * the handler's output is abandoned; defaults to `DEFAULT_DRAIN_TIMEOUT_MS`
133
+ * (5 minutes). This bounds what a stalled caller holds on the server: with
134
+ * the window (at most min(the caller's window, `window`) ahead) and the
135
+ * stream's backpressure (nothing written while it needs to drain), a
136
+ * stalled call holds about one frame, for at most this long. Only a write
137
+ * blocked on drain counts: a quiet call (an event stream between events) is
138
+ * never timed out. Credit for the caller's upload is held back while the
139
+ * stream needs to drain, and counts too (a caller that uploads and never
140
+ * reads is dropped). Applies to the port protocol
141
+ * (statewalker/webrun-wire#195) and to the deprecated one. On the port
142
+ * protocol, 0 or `Infinity` means no bound (the deprecated protocol drops a
143
+ * backpressured stream at once on 0).
144
+ */
145
+ drainTimeoutMs?: number;
146
+ /**
147
+ * The deprecated protocol only (older callers): request bytes held while the
148
+ * handler is not reading before the stream is paused (default 64 KiB).
149
+ *
150
+ * @deprecated Removed with the deprecated protocol, in the next release.
151
+ */
152
+ readHighWaterBytes?: number;
86
153
  }
87
154
  /**
88
- * Caller-side: each `call(input)` opens a new libp2p `Stream` via
89
- * `node.dialProtocol(peer, [protocol])` and runs the call over it.
155
+ * Caller-side: each `call(input)` is one port of a windowed native port mux
156
+ * (`libp2pPortMux`): one libp2p stream negotiating {@link portProtocolOf}
157
+ * `protocol` with `/window`, over which `webrun-rpc`'s stream tier runs the
158
+ * call, pipelining up to the server's window per round trip. Streams are
159
+ * opened through the early-stream gate, so a burst of calls on a fresh
160
+ * connection does not kill its muxer.
161
+ *
162
+ * Against an older server, which refuses that protocol, the call falls back to
163
+ * the deprecated protocol on `protocol` itself, and the node remembers that
164
+ * for the connection, so later calls to that peer dial it directly. The
165
+ * fallback is removed in the next release.
90
166
  */
91
167
  export declare const connect: Connect<ConnectLibp2pParams>;
92
168
  /**
93
- * Server-side: registers `node.handle(protocol, ...)`. Each inbound stream is
94
- * wrapped as a `Duplex` and handed to `handler`. Identity-unaware; use
95
- * `serveConnections` when the handler needs to know who is calling.
169
+ * Server-side: serves each call as one port of a windowed native port mux
170
+ * (`<protocol>/ports`, with and without `/window`), and runs `handler` on it.
171
+ * Older callers are still answered on `protocol` itself, the deprecated
172
+ * protocol, until the next release. Identity-unaware; use `serveConnections`
173
+ * when the handler needs to know who is calling.
96
174
  */
97
175
  export declare const serve: Serve<ServeLibp2pParams>;
98
- /** What the serving side knows about the connection a stream arrived on. */
99
- export interface ConnectionContext {
100
- /**
101
- * The peer id libp2p's Noise handshake proved for this connection. This is
102
- * the only identity claim on the serving side that cannot be forged by the
103
- * request payload.
104
- */
105
- remotePeer: PeerId;
106
- }
107
- /**
108
- * Builds a handler for one inbound connection. Called once per stream, so the
109
- * connection stays reachable in the returned Duplex's closure — `Duplex` is
110
- * bytes-only (ADR-0004) and gains no new parameter.
111
- */
112
- export type ServeConnectionsHandler = (context: ConnectionContext) => Duplex;
113
176
  /**
114
- * Like `serve`, but the handler is built per inbound stream and is told which
115
- * peer libp2p proved on that connection.
177
+ * Like `serve`, but the handler is built per call and is told which peer
178
+ * libp2p proved on the connection the call came on.
116
179
  */
117
- export declare function serveConnections({ node, protocol, drainTimeoutMs, readHighWaterBytes, maxFrameBytes, maxInboundStreams, maxOutboundStreams, runOnLimitedConnection, }: ServeLibp2pParams, makeHandler: ServeConnectionsHandler): Promise<() => Promise<void>>;
180
+ export declare function serveConnections(params: ServeLibp2pParams, makeHandler: ServeConnectionsHandler): Promise<() => Promise<void>>;
118
181
  //# sourceMappingURL=connect-serve.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connect-serve.d.ts","sourceRoot":"","sources":["../src/connect-serve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,MAAM,EACN,MAAM,EAGP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,SAA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a,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;;OAMG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+FAA+F;IAC/F,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC;;;;;;;;;;;;;;;OAeG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO,EAAE,OAAO,CAAC,mBAAmB,CAqDhD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,iBAAiB,CACF,CAAC;AAE1C;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,iBAAiB,EACzB,WAAW,EAAE,uBAAuB,GACnC,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CA0E9B"}
@@ -14,6 +14,10 @@ import type { Stream } from "@libp2p/interface";
14
14
  * the transfer would complete anyway; a peer slower than that is
15
15
  * indistinguishable from one that has stopped reading altogether. Override via
16
16
  * `drainTimeoutMs` when a deployment knows better.
17
+ *
18
+ * Also the default stall bound of the port protocol (`connect`, `serve`,
19
+ * `serveConnections`, `libp2pPortMux`): a write on a call's stream that has
20
+ * waited for drain this long resets the stream (statewalker/webrun-wire#195).
17
21
  */
18
22
  export declare const DEFAULT_DRAIN_TIMEOUT_MS = 300000;
19
23
  /**
@@ -43,6 +47,9 @@ export declare const DEFAULT_DRAIN_TIMEOUT_MS = 300000;
43
47
  * of sixty.
44
48
  *
45
49
  * Exported so a deployment that knows its links can lower it deliberately.
50
+ *
51
+ * @deprecated The deprecated protocol's (statewalker/webrun-wire#153): kept for
52
+ * one release, as the shim `connect`/`serve` run for older peers, then removed.
46
53
  */
47
54
  export declare const DEFAULT_CLOSE_TIMEOUT_MS = 300000;
48
55
  /**
@@ -76,6 +83,9 @@ export declare class PeerGoneError extends Error {
76
83
  * exhausts — without it, the server-side `serve` would deadlock waiting for the
77
84
  * outbound pump to finish, which itself waits for the handler, which waits for
78
85
  * inputQueue.done.
86
+ *
87
+ * @deprecated The deprecated protocol's (statewalker/webrun-wire#153): kept for
88
+ * one release, as the shim `connect`/`serve` run for older peers, then removed.
79
89
  */
80
90
  export interface DuplexOverStreamOptions {
81
91
  /**
@@ -125,6 +135,9 @@ export interface DuplexOverStreamOptions {
125
135
  * JSON-serialised `Error`). Normal end-of-input is signalled by libp2p's
126
136
  * `close()`. The frame layer exists so we can preserve `Error` fidelity
127
137
  * across the wire (yamux's native stream reset only carries "stream reset").
138
+ *
139
+ * @deprecated The deprecated protocol's (statewalker/webrun-wire#153): kept for
140
+ * one release, as the shim `connect`/`serve` run for older peers, then removed.
128
141
  */
129
142
  export declare function duplexOverStream(stream: Stream, input: AsyncIterable<Uint8Array> | Iterable<Uint8Array>, opts?: DuplexOverStreamOptions): AsyncGenerator<Uint8Array>;
130
143
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"duplex-over-stream.d.ts","sourceRoot":"","sources":["../src/duplex-over-stream.ts"],"names":[],"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E,UAAU,GAAG,IAAI,CAW/B;IAED,8DAA8D;IAC9D,MAAM,IAAI,UAAU,CAEnB;IAED,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAGvB;CACF;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,MAAM,GACX;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAO/C;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,CAOxD;AA8BD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAYtD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAa9F"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { type ConnectionContext, type ConnectLibp2pParams, connect, DEFAULT_PROTOCOL, type ServeConnectionsHandler, type ServeLibp2pParams, serve, serveConnections, } from "./connect-serve.js";
1
+ export { type ConnectionContext, type ConnectLibp2pParams, connect, DEFAULT_PROTOCOL, DEFAULT_WINDOW, portProtocolOf, type ServeConnectionsHandler, type ServeLibp2pParams, serve, serveConnections, } from "./connect-serve.js";
2
2
  export { DEFAULT_CLOSE_TIMEOUT_MS, DEFAULT_DRAIN_TIMEOUT_MS, DEFAULT_MAX_FRAME_BYTES, type DuplexOverStreamOptions, duplexOverStream, PeerGoneError, } from "./duplex-over-stream.js";
3
3
  export { DEFAULT_MAX_MESSAGE_BYTES, type MessageTargetOverStreamOptions, messageTargetOverStream, type StreamMessageTarget, } from "./message-target-over-stream.js";
4
4
  export { DEFAULT_PORT_MAX_MESSAGE_SIZE, DEFAULT_PORT_PROTOCOL, DEFAULT_PORT_STREAM_LIMIT, type InboundPortInfo, type Libp2pPortMux, type Libp2pPortMuxOptions, libp2pPortMux, type StreamPort, type ValueCodec, } from "./port-mux.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,OAAO,EACP,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,EACL,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,uBAAuB,EAC5B,gBAAgB,EAChB,aAAa,GACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,yBAAyB,EACzB,KAAK,8BAA8B,EACnC,uBAAuB,EACvB,KAAK,mBAAmB,GACzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,yBAAyB,EACzB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,aAAa,EACb,KAAK,UAAU,EACf,KAAK,UAAU,GAChB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,OAAO,EACP,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,EACL,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,uBAAuB,EAC5B,gBAAgB,EAChB,aAAa,GACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,yBAAyB,EACzB,KAAK,8BAA8B,EACnC,uBAAuB,EACvB,KAAK,mBAAmB,GACzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,yBAAyB,EACzB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,aAAa,EACb,KAAK,UAAU,EACf,KAAK,UAAU,GAChB,MAAM,eAAe,CAAC"}