@dxos/functions-testing 0.8.4-main.1068cf700f
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 +8 -0
- package/README.md +21 -0
- package/dist/lib/node-esm/index.mjs +2 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/testing/index.mjs +114 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -0
- package/dist/types/src/bundle.test.d.ts +2 -0
- package/dist/types/src/bundle.test.d.ts.map +1 -0
- package/dist/types/src/cpu-limit.test.d.ts +2 -0
- package/dist/types/src/cpu-limit.test.d.ts.map +1 -0
- package/dist/types/src/functions/fib.d.ts +7 -0
- package/dist/types/src/functions/fib.d.ts.map +1 -0
- package/dist/types/src/functions/forex-effect.d.ts +6 -0
- package/dist/types/src/functions/forex-effect.d.ts.map +1 -0
- package/dist/types/src/functions/query.d.ts +3 -0
- package/dist/types/src/functions/query.d.ts.map +1 -0
- package/dist/types/src/functions/reply.d.ts +3 -0
- package/dist/types/src/functions/reply.d.ts.map +1 -0
- package/dist/types/src/functions/sleep.d.ts +5 -0
- package/dist/types/src/functions/sleep.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/util.d.ts +16 -0
- package/dist/types/src/testing/util.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +56 -0
- package/src/bundle.test.ts +21 -0
- package/src/cpu-limit.test.ts +149 -0
- package/src/functions/fib.ts +32 -0
- package/src/functions/forex-effect.ts +44 -0
- package/src/functions/query.ts +21 -0
- package/src/functions/reply.ts +21 -0
- package/src/functions/sleep.ts +24 -0
- package/src/index.ts +5 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/util.ts +129 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
Copyright (c) 2022 DXOS
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
5
|
+
|
|
6
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# @dxos/functions-testing
|
|
2
|
+
|
|
3
|
+
Functions tests
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm i @dxos/functions-testing
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## DXOS Resources
|
|
12
|
+
|
|
13
|
+
- [Website](https://dxos.org)
|
|
14
|
+
- [Developer Documentation](https://docs.dxos.org)
|
|
15
|
+
- Talk to us on [Discord](https://dxos.org/discord)
|
|
16
|
+
|
|
17
|
+
## Contributions
|
|
18
|
+
|
|
19
|
+
Your ideas, issues, and code are most welcome. Please take a look at our [community code of conduct](https://github.com/dxos/dxos/blob/main/CODE_OF_CONDUCT.md), the [issue guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-issues), and the [PR contribution guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-prs).
|
|
20
|
+
|
|
21
|
+
License: [MIT](./LICENSE) Copyright 2022 © DXOS
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/index.ts":{"bytes":414,"imports":[],"format":"esm"},"src/testing/util.ts":{"bytes":15297,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime/edge","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime/native","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/echo/metadata","kind":"import-statement","external":true}],"format":"esm"},"src/testing/index.ts":{"bytes":458,"imports":[{"path":"src/testing/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/node-esm/index.mjs":{"imports":[],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":127},"dist/lib/node-esm/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":8253},"dist/lib/node-esm/testing/index.mjs":{"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/functions","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime/edge","kind":"import-statement","external":true},{"path":"@dxos/functions-runtime/native","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/echo/metadata","kind":"import-statement","external":true}],"exports":["deployFunction","observeInvocations","setup","sync","writeBundle"],"entryPoint":"src/testing/index.ts","inputs":{"src/testing/util.ts":{"bytesInOutput":3620},"src/testing/index.ts":{"bytesInOutput":0}},"bytes":3854}}}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/testing/util.ts
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import { sleep } from "@dxos/async";
|
|
6
|
+
import { Client } from "@dxos/client";
|
|
7
|
+
import { Filter, Obj, Query } from "@dxos/echo";
|
|
8
|
+
import { Function } from "@dxos/functions";
|
|
9
|
+
import { Trigger } from "@dxos/functions";
|
|
10
|
+
import { InvocationTraceEndEvent, InvocationTraceStartEvent } from "@dxos/functions-runtime";
|
|
11
|
+
import { FunctionsServiceClient } from "@dxos/functions-runtime/edge";
|
|
12
|
+
import { bundleFunction } from "@dxos/functions-runtime/native";
|
|
13
|
+
import { ErrorCodec } from "@dxos/protocols";
|
|
14
|
+
import { EdgeReplicationSetting } from "@dxos/protocols/proto/dxos/echo/metadata";
|
|
15
|
+
var writeBundle = (path, bundle) => {
|
|
16
|
+
fs.mkdirSync(path, {
|
|
17
|
+
recursive: true
|
|
18
|
+
});
|
|
19
|
+
Object.entries(bundle.assets).forEach(([name, content]) => {
|
|
20
|
+
fs.writeFileSync(path + "/" + name, content);
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var setup = async (config) => {
|
|
24
|
+
const client = await new Client({
|
|
25
|
+
config,
|
|
26
|
+
types: [
|
|
27
|
+
Function.Function,
|
|
28
|
+
Trigger.Trigger
|
|
29
|
+
]
|
|
30
|
+
}).initialize();
|
|
31
|
+
await client.halo.createIdentity();
|
|
32
|
+
const space = await client.spaces.create();
|
|
33
|
+
await space.waitUntilReady();
|
|
34
|
+
await space.internal.setEdgeReplicationPreference(EdgeReplicationSetting.ENABLED);
|
|
35
|
+
const functionsServiceClient = FunctionsServiceClient.fromClient(client);
|
|
36
|
+
return {
|
|
37
|
+
client,
|
|
38
|
+
space,
|
|
39
|
+
functionsServiceClient
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
var sync = async (space) => {
|
|
43
|
+
await space.db.flush({
|
|
44
|
+
indexes: true
|
|
45
|
+
});
|
|
46
|
+
await space.internal.syncToEdge({
|
|
47
|
+
onProgress: (state) => console.log(state ? `${state.unsyncedDocumentCount} documents syncing...` : "connecting to edge...")
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
var deployFunction = async (space, functionsServiceClient, entryPoint, runtime) => {
|
|
51
|
+
const artifact = await bundleFunction({
|
|
52
|
+
entryPoint,
|
|
53
|
+
verbose: true
|
|
54
|
+
});
|
|
55
|
+
const func = await functionsServiceClient.deploy({
|
|
56
|
+
version: "0.0.1",
|
|
57
|
+
ownerPublicKey: space.key,
|
|
58
|
+
entryPoint: artifact.entryPoint,
|
|
59
|
+
assets: artifact.assets,
|
|
60
|
+
runtime
|
|
61
|
+
});
|
|
62
|
+
space.db.add(func);
|
|
63
|
+
return func;
|
|
64
|
+
};
|
|
65
|
+
var observeInvocations = async (space, maxCount) => {
|
|
66
|
+
let initialCount = null;
|
|
67
|
+
const invocationData = /* @__PURE__ */ new Map();
|
|
68
|
+
let count = 0;
|
|
69
|
+
while (true) {
|
|
70
|
+
try {
|
|
71
|
+
const invocations = await space.properties.invocationTraceQueue?.target.query(Query.select(Filter.everything())).run() ?? [];
|
|
72
|
+
for (const invocation of invocations) {
|
|
73
|
+
if (Obj.instanceOf(InvocationTraceStartEvent, invocation)) {
|
|
74
|
+
if (invocationData.has(invocation.invocationId)) {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
invocationData.set(invocation.invocationId, {
|
|
78
|
+
count: count++,
|
|
79
|
+
begin: invocation
|
|
80
|
+
});
|
|
81
|
+
console.log(`${count.toString().padStart(3, " ")}: BEGIN ${invocation.runtime ?? "(unknown runtime)"} ${JSON.stringify(invocation.input)}`);
|
|
82
|
+
} else if (Obj.instanceOf(InvocationTraceEndEvent, invocation)) {
|
|
83
|
+
const data = invocationData.get(invocation.invocationId);
|
|
84
|
+
if (!data || !!data.end) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
data.end = invocation;
|
|
88
|
+
const outcome = data.end.outcome;
|
|
89
|
+
console.log(`${data.count.toString().padStart(3, " ")}: END outcome=${outcome} duration=${data.end.timestamp - data.begin.timestamp}`);
|
|
90
|
+
if (outcome === "failure" && data.end.error) {
|
|
91
|
+
console.error(ErrorCodec.decode(data.end.error));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (initialCount === null) {
|
|
96
|
+
initialCount = invocations.length;
|
|
97
|
+
}
|
|
98
|
+
if (maxCount !== null && invocationData.size >= maxCount + initialCount) {
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
} catch (err) {
|
|
102
|
+
console.error(err);
|
|
103
|
+
}
|
|
104
|
+
await sleep(1e3);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
export {
|
|
108
|
+
deployFunction,
|
|
109
|
+
observeInvocations,
|
|
110
|
+
setup,
|
|
111
|
+
sync,
|
|
112
|
+
writeBundle
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/testing/util.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport fs from 'node:fs';\n\nimport { sleep } from '@dxos/async';\nimport { Client, type Config } from '@dxos/client';\nimport { type Space } from '@dxos/client/echo';\nimport { Filter, Obj, Query } from '@dxos/echo';\nimport { Function } from '@dxos/functions';\nimport { Trigger } from '@dxos/functions';\nimport { InvocationTraceEndEvent, InvocationTraceStartEvent } from '@dxos/functions-runtime';\nimport { FunctionsServiceClient } from '@dxos/functions-runtime/edge';\nimport { bundleFunction } from '@dxos/functions-runtime/native';\nimport type { BundleResult } from '@dxos/functions-runtime/native';\nimport { ErrorCodec, type FunctionRuntimeKind } from '@dxos/protocols';\nimport { EdgeReplicationSetting } from '@dxos/protocols/proto/dxos/echo/metadata';\n\nexport const writeBundle = (path: string, bundle: BundleResult) => {\n fs.mkdirSync(path, { recursive: true });\n Object.entries(bundle.assets).forEach(([name, content]) => {\n fs.writeFileSync(path + '/' + name, content);\n });\n};\n\nexport const setup = async (config: Config) => {\n const client = await new Client({\n config,\n types: [Function.Function, Trigger.Trigger],\n }).initialize();\n await client.halo.createIdentity();\n\n const space = await client.spaces.create();\n await space.waitUntilReady();\n await space.internal.setEdgeReplicationPreference(EdgeReplicationSetting.ENABLED);\n\n const functionsServiceClient = FunctionsServiceClient.fromClient(client);\n\n return { client, space, functionsServiceClient };\n};\n\nexport const sync = async (space: Space) => {\n await space.db.flush({ indexes: true });\n await space.internal.syncToEdge({\n onProgress: (state) =>\n console.log(state ? `${state.unsyncedDocumentCount} documents syncing...` : 'connecting to edge...'),\n });\n};\n\nexport const deployFunction = async (\n space: Space,\n functionsServiceClient: FunctionsServiceClient,\n entryPoint: string,\n runtime: FunctionRuntimeKind,\n) => {\n const artifact = await bundleFunction({\n entryPoint,\n verbose: true,\n });\n const func = await functionsServiceClient.deploy({\n version: '0.0.1',\n ownerPublicKey: space.key,\n entryPoint: artifact.entryPoint,\n assets: artifact.assets,\n runtime,\n });\n space.db.add(func);\n\n return func;\n};\n\nexport const observeInvocations = async (space: Space, maxCount: number | null) => {\n let initialCount = null;\n const invocationData = new Map<\n string,\n {\n count: number;\n begin: InvocationTraceStartEvent;\n end?: InvocationTraceEndEvent;\n }\n >();\n let count = 0;\n while (true) {\n try {\n const invocations =\n (await space.properties.invocationTraceQueue?.target!.query(Query.select(Filter.everything())).run()) ?? [];\n\n for (const invocation of invocations) {\n if (Obj.instanceOf(InvocationTraceStartEvent, invocation)) {\n if (invocationData.has(invocation.invocationId)) {\n continue;\n }\n invocationData.set(invocation.invocationId, {\n count: count++,\n begin: invocation,\n });\n console.log(\n `${count.toString().padStart(3, ' ')}: BEGIN ${invocation.runtime ?? '(unknown runtime)'} ${JSON.stringify(invocation.input)}`,\n );\n } else if (Obj.instanceOf(InvocationTraceEndEvent, invocation)) {\n const data = invocationData.get(invocation.invocationId);\n if (!data || !!data.end) {\n continue;\n }\n data.end = invocation;\n\n const outcome = data.end.outcome;\n console.log(\n `${data.count.toString().padStart(3, ' ')}: END outcome=${outcome} duration=${data.end.timestamp - data.begin.timestamp}`,\n );\n if (outcome === 'failure' && data.end.error) {\n console.error(ErrorCodec.decode(data.end.error));\n }\n }\n }\n if (initialCount === null) {\n initialCount = invocations.length;\n }\n\n if (maxCount !== null && invocationData.size >= maxCount + initialCount) {\n break;\n }\n } catch (err) {\n console.error(err);\n }\n await sleep(1_000);\n }\n};\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["fs", "sleep", "Client", "Filter", "Obj", "Query", "Function", "Trigger", "InvocationTraceEndEvent", "InvocationTraceStartEvent", "FunctionsServiceClient", "bundleFunction", "ErrorCodec", "EdgeReplicationSetting", "writeBundle", "path", "bundle", "fs", "mkdirSync", "recursive", "Object", "entries", "assets", "forEach", "name", "content", "writeFileSync", "setup", "config", "client", "Client", "types", "Function", "Trigger", "initialize", "halo", "createIdentity", "space", "spaces", "create", "waitUntilReady", "internal", "setEdgeReplicationPreference", "EdgeReplicationSetting", "ENABLED", "functionsServiceClient", "FunctionsServiceClient", "fromClient", "sync", "db", "flush", "indexes", "syncToEdge", "onProgress", "state", "console", "log", "unsyncedDocumentCount", "deployFunction", "entryPoint", "runtime", "artifact", "bundleFunction", "verbose", "func", "deploy", "version", "ownerPublicKey", "key", "add", "observeInvocations", "maxCount", "initialCount", "invocationData", "Map", "count", "invocations", "properties", "invocationTraceQueue", "target", "query", "Query", "select", "Filter", "everything", "run", "invocation", "Obj", "instanceOf", "InvocationTraceStartEvent", "has", "invocationId", "set", "begin", "toString", "padStart", "JSON", "stringify", "input", "InvocationTraceEndEvent", "data", "get", "end", "outcome", "timestamp", "error", "ErrorCodec", "decode", "length", "size", "err", "sleep"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.test.d.ts","sourceRoot":"","sources":["../../../src/bundle.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cpu-limit.test.d.ts","sourceRoot":"","sources":["../../../src/cpu-limit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fib.d.ts","sourceRoot":"","sources":["../../../../src/functions/fib.ts"],"names":[],"mappings":";;;;;AASA,wBAsBG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forex-effect.d.ts","sourceRoot":"","sources":["../../../../src/functions/forex-effect.ts"],"names":[],"mappings":";;;;AAcA,wBA6BG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../../src/functions/query.ts"],"names":[],"mappings":";AAUA,wBAUG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reply.d.ts","sourceRoot":"","sources":["../../../../src/functions/reply.ts"],"names":[],"mappings":";AAUA,wBAUG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../../../src/functions/sleep.ts"],"names":[],"mappings":";;;AASA,wBAcG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Client, type Config } from '@dxos/client';
|
|
2
|
+
import { type Space } from '@dxos/client/echo';
|
|
3
|
+
import { Function } from '@dxos/functions';
|
|
4
|
+
import { FunctionsServiceClient } from '@dxos/functions-runtime/edge';
|
|
5
|
+
import type { BundleResult } from '@dxos/functions-runtime/native';
|
|
6
|
+
import { type FunctionRuntimeKind } from '@dxos/protocols';
|
|
7
|
+
export declare const writeBundle: (path: string, bundle: BundleResult) => void;
|
|
8
|
+
export declare const setup: (config: Config) => Promise<{
|
|
9
|
+
client: Client;
|
|
10
|
+
space: Space;
|
|
11
|
+
functionsServiceClient: FunctionsServiceClient;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const sync: (space: Space) => Promise<void>;
|
|
14
|
+
export declare const deployFunction: (space: Space, functionsServiceClient: FunctionsServiceClient, entryPoint: string, runtime: FunctionRuntimeKind) => Promise<Function.Function>;
|
|
15
|
+
export declare const observeInvocations: (space: Space, maxCount: number | null) => Promise<void>;
|
|
16
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../src/testing/util.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAc,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGvE,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,QAAQ,YAAY,SAK7D,CAAC;AAEF,eAAO,MAAM,KAAK,GAAU,QAAQ,MAAM;;;;EAczC,CAAC;AAEF,eAAO,MAAM,IAAI,GAAU,OAAO,KAAK,kBAMtC,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,OAAO,KAAK,EACZ,wBAAwB,sBAAsB,EAC9C,YAAY,MAAM,EAClB,SAAS,mBAAmB,+BAgB7B,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAU,OAAO,KAAK,EAAE,UAAU,MAAM,GAAG,IAAI,kBAwD7E,CAAC"}
|