@arcnow/mcp 0.1.0
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.
- package/LICENSE +674 -0
- package/README.md +624 -0
- package/dist/client-options.d.ts +16 -0
- package/dist/client-options.d.ts.map +1 -0
- package/dist/client-options.js +22 -0
- package/dist/client-options.js.map +1 -0
- package/dist/config.d.ts +223 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +516 -0
- package/dist/config.js.map +1 -0
- package/dist/format.d.ts +79 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +164 -0
- package/dist/format.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -0
- package/dist/sdk-port.d.ts +227 -0
- package/dist/sdk-port.d.ts.map +1 -0
- package/dist/sdk-port.js +144 -0
- package/dist/sdk-port.js.map +1 -0
- package/dist/server.d.ts +25 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +103 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/errors.d.ts +44 -0
- package/dist/tools/errors.d.ts.map +1 -0
- package/dist/tools/errors.js +231 -0
- package/dist/tools/errors.js.map +1 -0
- package/dist/tools/index.d.ts +35 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +59 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/launch-params.d.ts +27 -0
- package/dist/tools/launch-params.d.ts.map +1 -0
- package/dist/tools/launch-params.js +29 -0
- package/dist/tools/launch-params.js.map +1 -0
- package/dist/tools/pool.d.ts +84 -0
- package/dist/tools/pool.d.ts.map +1 -0
- package/dist/tools/pool.js +249 -0
- package/dist/tools/pool.js.map +1 -0
- package/dist/tools/quote.d.ts +53 -0
- package/dist/tools/quote.d.ts.map +1 -0
- package/dist/tools/quote.js +85 -0
- package/dist/tools/quote.js.map +1 -0
- package/dist/tools/read.d.ts +26 -0
- package/dist/tools/read.d.ts.map +1 -0
- package/dist/tools/read.js +920 -0
- package/dist/tools/read.js.map +1 -0
- package/dist/tools/resolve.d.ts +45 -0
- package/dist/tools/resolve.d.ts.map +1 -0
- package/dist/tools/resolve.js +75 -0
- package/dist/tools/resolve.js.map +1 -0
- package/dist/tools/schema.d.ts +98 -0
- package/dist/tools/schema.d.ts.map +1 -0
- package/dist/tools/schema.js +143 -0
- package/dist/tools/schema.js.map +1 -0
- package/dist/tools/spend.d.ts +45 -0
- package/dist/tools/spend.d.ts.map +1 -0
- package/dist/tools/spend.js +99 -0
- package/dist/tools/spend.js.map +1 -0
- package/dist/tools/venue.d.ts +67 -0
- package/dist/tools/venue.d.ts.map +1 -0
- package/dist/tools/venue.js +110 -0
- package/dist/tools/venue.js.map +1 -0
- package/dist/tools/write.d.ts +56 -0
- package/dist/tools/write.d.ts.map +1 -0
- package/dist/tools/write.js +950 -0
- package/dist/tools/write.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a token trades, and what a tool has to refuse because of it.
|
|
3
|
+
*
|
|
4
|
+
* A token's market moves exactly once, irreversibly, in the middle of its life.
|
|
5
|
+
* Before graduation it is its bonding curve. After graduation **and
|
|
6
|
+
* migration** it is a Uniswap v4 pool, reached only through arcnow.io's router.
|
|
7
|
+
* And in between there is a third state that is easy to miss and expensive to
|
|
8
|
+
* misreport: **graduated but never migrated**, where the curve has stopped for
|
|
9
|
+
* good and no pool exists, so the token trades nowhere at all until somebody
|
|
10
|
+
* runs the permissionless `migrate()`.
|
|
11
|
+
*
|
|
12
|
+
* # The venue is the SDK's answer, not this server's
|
|
13
|
+
*
|
|
14
|
+
* `client.trade(token).venue()` decides curve or pool, and every buy and sell
|
|
15
|
+
* this server sends goes through that same handle. The curve's own state is
|
|
16
|
+
* read only to tell "on the curve" apart from "stranded", which the SDK's venue
|
|
17
|
+
* cannot: a stranded token's venue is still `"curve"`, and a curve that has
|
|
18
|
+
* graduated reverts on every trade.
|
|
19
|
+
*
|
|
20
|
+
* # Parameters that do not apply are refused, never dropped
|
|
21
|
+
*
|
|
22
|
+
* The two venues take different arguments. A curve pays `msg.sender` and has
|
|
23
|
+
* no recipient; a pool swap has no referrer or developer and cannot graduate
|
|
24
|
+
* anything, so a gas limit guards nothing there. The SDK refuses each of these
|
|
25
|
+
* on the wrong venue, and so does this server — earlier, before anything is
|
|
26
|
+
* quoted or sent, and in words that say why. A parameter silently ignored is a
|
|
27
|
+
* referrer promised a share the chain never saw, or a payout sent to an address
|
|
28
|
+
* nobody named.
|
|
29
|
+
*
|
|
30
|
+
* @module
|
|
31
|
+
*/
|
|
32
|
+
import type { Address } from "viem";
|
|
33
|
+
import type { CurveState, NetworkConfig } from "@arcnow/sdk";
|
|
34
|
+
import type { CurveHandle, TradeHandle } from "../sdk-port.js";
|
|
35
|
+
import type { ToolContext } from "./schema.js";
|
|
36
|
+
/** Where a token can be traded right now. */
|
|
37
|
+
export type MarketVenue = "curve" | "pool" | "stranded";
|
|
38
|
+
export interface Market {
|
|
39
|
+
readonly curve: CurveHandle;
|
|
40
|
+
readonly state: CurveState;
|
|
41
|
+
/** True when the caller gave the token address and it was followed to the curve. */
|
|
42
|
+
readonly viaToken: boolean;
|
|
43
|
+
/** `client.trade(state.token)`: what every quote and trade goes through. */
|
|
44
|
+
readonly trade: TradeHandle;
|
|
45
|
+
readonly venue: MarketVenue;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Resolve a token-or-curve address to its curve, its trade handle, and where it
|
|
49
|
+
* trades now.
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveMarket(ctx: ToolContext, address: Address): Promise<Market>;
|
|
52
|
+
/** The network's v4 router, or `undefined` — and on Arc the zero address is a real account. */
|
|
53
|
+
export declare function configuredRouter(config: NetworkConfig): Address | undefined;
|
|
54
|
+
export declare function routerName(config: NetworkConfig): string;
|
|
55
|
+
/** The refusal for a token that graduated and never migrated. */
|
|
56
|
+
export declare function strandedText(tool: string): string;
|
|
57
|
+
/** Refuse `referrer`, `developer` or `gasLimit` on a token that trades in its pool. */
|
|
58
|
+
export declare function refuseCurveOnly(tool: string, fields: readonly string[], nothing: "sent" | "quoted"): string;
|
|
59
|
+
/** Refuse `recipient` on a token still on its curve. */
|
|
60
|
+
export declare function refusePoolOnlyRecipient(tool: string): string;
|
|
61
|
+
/** Refuse `approveRouter` on a curve sell, which needs no approval at all. */
|
|
62
|
+
export declare function refuseCurveApproval(): string;
|
|
63
|
+
/** The venue changed between the read and the quote: the token migrated mid-call. */
|
|
64
|
+
export declare function venueMovedText(tool: string): string;
|
|
65
|
+
/** "0x… (the signing address)", or the same address flagged as somebody else's. */
|
|
66
|
+
export declare function payee(recipient: Address, signer: Address | undefined): string;
|
|
67
|
+
//# sourceMappingURL=venue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"venue.d.ts","sourceRoot":"","sources":["../../src/tools/venue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG7D,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,6CAA6C;AAC7C,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;AAExD,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,oFAAoF;IACpF,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAMvF;AAED,+FAA+F;AAC/F,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,GAAG,SAAS,CAI3E;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAGxD;AAED,iEAAiE;AACjE,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAajD;AAED,uFAAuF;AACvF,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,OAAO,EAAE,MAAM,GAAG,QAAQ,GACzB,MAAM,CAiBR;AAED,wDAAwD;AACxD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAa5D;AAED,8EAA8E;AAC9E,wBAAgB,mBAAmB,IAAI,MAAM,CAU5C;AAED,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOnD;AAED,mFAAmF;AACnF,wBAAgB,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAI7E"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a token trades, and what a tool has to refuse because of it.
|
|
3
|
+
*
|
|
4
|
+
* A token's market moves exactly once, irreversibly, in the middle of its life.
|
|
5
|
+
* Before graduation it is its bonding curve. After graduation **and
|
|
6
|
+
* migration** it is a Uniswap v4 pool, reached only through arcnow.io's router.
|
|
7
|
+
* And in between there is a third state that is easy to miss and expensive to
|
|
8
|
+
* misreport: **graduated but never migrated**, where the curve has stopped for
|
|
9
|
+
* good and no pool exists, so the token trades nowhere at all until somebody
|
|
10
|
+
* runs the permissionless `migrate()`.
|
|
11
|
+
*
|
|
12
|
+
* # The venue is the SDK's answer, not this server's
|
|
13
|
+
*
|
|
14
|
+
* `client.trade(token).venue()` decides curve or pool, and every buy and sell
|
|
15
|
+
* this server sends goes through that same handle. The curve's own state is
|
|
16
|
+
* read only to tell "on the curve" apart from "stranded", which the SDK's venue
|
|
17
|
+
* cannot: a stranded token's venue is still `"curve"`, and a curve that has
|
|
18
|
+
* graduated reverts on every trade.
|
|
19
|
+
*
|
|
20
|
+
* # Parameters that do not apply are refused, never dropped
|
|
21
|
+
*
|
|
22
|
+
* The two venues take different arguments. A curve pays `msg.sender` and has
|
|
23
|
+
* no recipient; a pool swap has no referrer or developer and cannot graduate
|
|
24
|
+
* anything, so a gas limit guards nothing there. The SDK refuses each of these
|
|
25
|
+
* on the wrong venue, and so does this server — earlier, before anything is
|
|
26
|
+
* quoted or sent, and in words that say why. A parameter silently ignored is a
|
|
27
|
+
* referrer promised a share the chain never saw, or a payout sent to an address
|
|
28
|
+
* nobody named.
|
|
29
|
+
*
|
|
30
|
+
* @module
|
|
31
|
+
*/
|
|
32
|
+
import { addr, note, report, ZERO_ADDRESS } from "../format.js";
|
|
33
|
+
import { resolveCurve } from "./resolve.js";
|
|
34
|
+
/**
|
|
35
|
+
* Resolve a token-or-curve address to its curve, its trade handle, and where it
|
|
36
|
+
* trades now.
|
|
37
|
+
*/
|
|
38
|
+
export async function resolveMarket(ctx, address) {
|
|
39
|
+
const resolved = await resolveCurve(ctx.port, address);
|
|
40
|
+
const trade = ctx.port.trade(resolved.state.token);
|
|
41
|
+
const venue = await trade.venue();
|
|
42
|
+
if (venue === "pool")
|
|
43
|
+
return { ...resolved, trade, venue: "pool" };
|
|
44
|
+
return { ...resolved, trade, venue: resolved.state.graduated ? "stranded" : "curve" };
|
|
45
|
+
}
|
|
46
|
+
/** The network's v4 router, or `undefined` — and on Arc the zero address is a real account. */
|
|
47
|
+
export function configuredRouter(config) {
|
|
48
|
+
const router = config.contracts.v4Router;
|
|
49
|
+
if (router === undefined || router.toLowerCase() === ZERO_ADDRESS)
|
|
50
|
+
return undefined;
|
|
51
|
+
return router;
|
|
52
|
+
}
|
|
53
|
+
export function routerName(config) {
|
|
54
|
+
const router = configuredRouter(config);
|
|
55
|
+
return router === undefined ? "(no v4 router configured)" : addr(router);
|
|
56
|
+
}
|
|
57
|
+
/** The refusal for a token that graduated and never migrated. */
|
|
58
|
+
export function strandedText(tool) {
|
|
59
|
+
return report(`${tool}: this token has GRADUATED but has NOT MIGRATED, so it is not tradeable anywhere.`, note("Its bonding curve stopped trading permanently when it reached its target, and its "
|
|
60
|
+
+ "Uniswap v4 pool was never created — the migration that should have run inside the "
|
|
61
|
+
+ "graduating buy ran out of gas and was caught, which happens with no revert and no "
|
|
62
|
+
+ "error. Until somebody calls migrate() there is no market to quote, buy or sell in. "
|
|
63
|
+
+ "migrate() is permissionless and costs only gas: on this server it is arcnow_migrate, "
|
|
64
|
+
+ "available when the operator has enabled writes. Once it has run, the token trades in "
|
|
65
|
+
+ "its pool and this tool routes there. Nothing was quoted and nothing was sent."));
|
|
66
|
+
}
|
|
67
|
+
/** Refuse `referrer`, `developer` or `gasLimit` on a token that trades in its pool. */
|
|
68
|
+
export function refuseCurveOnly(tool, fields, nothing) {
|
|
69
|
+
const list = fields.join(" and ");
|
|
70
|
+
const one = fields.length === 1;
|
|
71
|
+
return report(`Refused: ${list} ${one ? "is a curve-only parameter" : "are curve-only parameters"}, and `
|
|
72
|
+
+ "this token has graduated — it trades in its Uniswap v4 pool, through arcnow.io's "
|
|
73
|
+
+ `router. Nothing was ${nothing}.`, note("A pool swap has no argument for a referrer or a developer: arcnow.io's fee hook pays "
|
|
74
|
+
+ "those two shares of its 1% to the platform recipient, deliberately, because a hook "
|
|
75
|
+
+ "that took them from the trade would let any trader name themselves the referrer and "
|
|
76
|
+
+ "skim the share. And gasLimit guards a bonding curve's graduation, which a pool buy "
|
|
77
|
+
+ `cannot trigger. ${list} ${one ? "is" : "are"} refused rather than ignored, so that `
|
|
78
|
+
+ "nobody is told a share was credited, or a limit was set, that the chain was never "
|
|
79
|
+
+ `asked for. Call ${tool} again without ${one ? "it" : "them"}.`));
|
|
80
|
+
}
|
|
81
|
+
/** Refuse `recipient` on a token still on its curve. */
|
|
82
|
+
export function refusePoolOnlyRecipient(tool) {
|
|
83
|
+
return report("Refused: recipient is a pool-only parameter, and this token is still on its bonding "
|
|
84
|
+
+ "curve. Nothing was sent.", note("A bonding-curve trade always pays msg.sender — the signing address — and has no "
|
|
85
|
+
+ "recipient argument anywhere in it, so there is no way to honour one. It is refused "
|
|
86
|
+
+ "rather than ignored, because a trade that paid somebody other than the address named "
|
|
87
|
+
+ `is the worst possible way to find that out. Call ${tool} again without recipient and `
|
|
88
|
+
+ "move the proceeds afterwards; once the token graduates and migrates, its pool trades "
|
|
89
|
+
+ "can pay another address."));
|
|
90
|
+
}
|
|
91
|
+
/** Refuse `approveRouter` on a curve sell, which needs no approval at all. */
|
|
92
|
+
export function refuseCurveApproval() {
|
|
93
|
+
return report("Refused: approveRouter is a pool-only parameter, and this token is still on its bonding "
|
|
94
|
+
+ "curve. Nothing was sent and nothing was approved.", note("A bonding-curve sell needs no approval, ever: the curve pulls the tokens through a "
|
|
95
|
+
+ "privileged path that reads no allowance at all. This server will not grant spending "
|
|
96
|
+
+ "rights that nothing is going to use. Call arcnow_sell again without approveRouter."));
|
|
97
|
+
}
|
|
98
|
+
/** The venue changed between the read and the quote: the token migrated mid-call. */
|
|
99
|
+
export function venueMovedText(tool) {
|
|
100
|
+
return report(`${tool}: this token's venue changed while the call was running — it was on one venue `
|
|
101
|
+
+ "when it was read and on the other when it was quoted. Nothing was sent.", note("A token moves from its curve to its pool once, at migration. Call again and it will "
|
|
102
|
+
+ "be quoted where it trades now."));
|
|
103
|
+
}
|
|
104
|
+
/** "0x… (the signing address)", or the same address flagged as somebody else's. */
|
|
105
|
+
export function payee(recipient, signer) {
|
|
106
|
+
return signer !== undefined && recipient.toLowerCase() === signer.toLowerCase()
|
|
107
|
+
? `${addr(recipient)} (the signing address)`
|
|
108
|
+
: `${addr(recipient)} — NOT the signing address. Whatever reaches a wrong address is gone.`;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=venue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"venue.js","sourceRoot":"","sources":["../../src/tools/venue.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The write tools: everything that can cost somebody something.
|
|
3
|
+
*
|
|
4
|
+
* # What guards these, in order
|
|
5
|
+
*
|
|
6
|
+
* 1. **The operator's opt-in.** These are not published at all unless the
|
|
7
|
+
* process was started with `--allow-writes` and a key in the environment.
|
|
8
|
+
* A model cannot turn them on, and asking for a key will not help it: see
|
|
9
|
+
* `config.ts`.
|
|
10
|
+
* 2. **The operator's ceilings.** One per quote token — `ARCNOW_MCP_MAX_SPEND_USDC`
|
|
11
|
+
* for native USDC, `ARCNOW_MCP_MAX_SPEND_<SYMBOL>` for each other quote, in its
|
|
12
|
+
* own units — bound every single call, whatever an argument says. A quote with
|
|
13
|
+
* no cap is refused outright. See `./spend.ts`.
|
|
14
|
+
* 3. **The caller's stated ceiling.** Every spending tool requires
|
|
15
|
+
* `maxTotalCost`, in the token's quote: the most the caller believes this call will cost. A
|
|
16
|
+
* fresh quote is taken inside the call and compared against it, so a quote
|
|
17
|
+
* that went stale between being shown to a person and being acted on is
|
|
18
|
+
* caught, and so is a model that was talked into a bigger number than the
|
|
19
|
+
* conversation agreed to.
|
|
20
|
+
* 4. **Nothing that does not apply.** A buy or sell goes wherever the token
|
|
21
|
+
* trades — its curve or its pool, as `client.trade(token)` decides — and a
|
|
22
|
+
* parameter the venue has no notion of is refused before anything is
|
|
23
|
+
* quoted or sent, never silently dropped. See `./venue.ts`.
|
|
24
|
+
* 5. **The report.** Every one of these states the exact cost and the exact,
|
|
25
|
+
* permanent effect before it sends anything, and says afterwards what
|
|
26
|
+
* actually happened — including the two things about graduation that are
|
|
27
|
+
* invisible from a receipt.
|
|
28
|
+
*
|
|
29
|
+
* # The one write here that grants rights rather than spending money
|
|
30
|
+
*
|
|
31
|
+
* A sell in a Uniswap v4 pool needs an ERC-20 approval to the router first: a
|
|
32
|
+
* separate transaction giving the router the right to move the seller's
|
|
33
|
+
* tokens. `arcnow_sell` never sends one unless the call says
|
|
34
|
+
* `approveRouter: true`; never for more than the amount being sold; never when
|
|
35
|
+
* the existing allowance already covers the sale; and always reports it —
|
|
36
|
+
* token, owner, spender, amount, transaction, the allowance left afterwards —
|
|
37
|
+
* including when the sell that followed it then failed.
|
|
38
|
+
*
|
|
39
|
+
* None of that makes an assistant trustworthy with money. It makes the blast
|
|
40
|
+
* radius a number somebody chose.
|
|
41
|
+
*
|
|
42
|
+
* @module
|
|
43
|
+
*/
|
|
44
|
+
import type { AnyTool, ToolOutput } from "./schema.js";
|
|
45
|
+
export declare const WRITE_TOOLS: readonly AnyTool[];
|
|
46
|
+
/**
|
|
47
|
+
* What a write tool says when the server is read-only.
|
|
48
|
+
*
|
|
49
|
+
* Deliberately a refusal by name rather than "unknown tool". A model that gets
|
|
50
|
+
* "unknown tool" concludes the server is broken or that it guessed the name
|
|
51
|
+
* wrong, and tries variations; a model that gets this stops, and can tell the
|
|
52
|
+
* user the one true thing — that this is a configuration the operator controls
|
|
53
|
+
* and the conversation cannot.
|
|
54
|
+
*/
|
|
55
|
+
export declare function writeRefusal(name: string): ToolOutput;
|
|
56
|
+
//# sourceMappingURL=write.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/tools/write.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAmDH,OAAO,KAAK,EAAE,OAAO,EAAe,UAAU,EAAE,MAAM,aAAa,CAAC;AA6jCpE,eAAO,MAAM,WAAW,EAAE,SAAS,OAAO,EAOzC,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAoBrD"}
|