@drawcall/market 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.
Files changed (47) hide show
  1. package/dist/cli.d.ts +3 -0
  2. package/dist/cli.d.ts.map +1 -0
  3. package/dist/cli.js +61 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/client.d.ts +12 -0
  6. package/dist/client.d.ts.map +1 -0
  7. package/dist/client.js +26 -0
  8. package/dist/client.js.map +1 -0
  9. package/dist/constants.d.ts +5 -0
  10. package/dist/constants.d.ts.map +1 -0
  11. package/dist/constants.js +16 -0
  12. package/dist/constants.js.map +1 -0
  13. package/dist/contract.d.ts +198 -0
  14. package/dist/contract.d.ts.map +1 -0
  15. package/dist/contract.js +64 -0
  16. package/dist/contract.js.map +1 -0
  17. package/dist/index.d.ts +13 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +12 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/install.d.ts +20 -0
  22. package/dist/install.d.ts.map +1 -0
  23. package/dist/install.js +67 -0
  24. package/dist/install.js.map +1 -0
  25. package/dist/internal-contract.d.ts +19 -0
  26. package/dist/internal-contract.d.ts.map +1 -0
  27. package/dist/internal-contract.js +19 -0
  28. package/dist/internal-contract.js.map +1 -0
  29. package/dist/resolve.d.ts +32 -0
  30. package/dist/resolve.d.ts.map +1 -0
  31. package/dist/resolve.js +145 -0
  32. package/dist/resolve.js.map +1 -0
  33. package/dist/schemas.d.ts +65 -0
  34. package/dist/schemas.d.ts.map +1 -0
  35. package/dist/schemas.js +53 -0
  36. package/dist/schemas.js.map +1 -0
  37. package/package.json +31 -0
  38. package/src/cli.ts +72 -0
  39. package/src/client.ts +38 -0
  40. package/src/constants.ts +19 -0
  41. package/src/contract.ts +188 -0
  42. package/src/index.ts +46 -0
  43. package/src/install.ts +101 -0
  44. package/src/internal-contract.ts +26 -0
  45. package/src/resolve.ts +215 -0
  46. package/src/schemas.ts +70 -0
  47. package/tsconfig.json +8 -0
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import chalk from 'chalk';
4
+ import { createMarketClient } from './client.js';
5
+ import { resolve, ResolutionError } from './resolve.js';
6
+ import { install } from './install.js';
7
+ const program = new Command();
8
+ program.name('market').description('Install assets from the drawcall.ai market').version('0.1.0');
9
+ program
10
+ .command('install')
11
+ .description('Install assets into your project')
12
+ .argument('<assets...>', 'Assets to install (e.g. my-model, my-model@^2.0.0)')
13
+ .option('--unapproved', 'Include unapproved versions', false)
14
+ .option('--api <url>', 'API base URL', process.env.MARKET_API_URL ?? 'http://localhost:8787')
15
+ .option('--cwd <dir>', 'Project directory', process.cwd())
16
+ .action(async (assetArgs, opts) => {
17
+ const client = createMarketClient({ baseUrl: opts.api });
18
+ // Parse asset[@range] arguments
19
+ const requests = assetArgs.map((arg) => {
20
+ const atIdx = arg.indexOf('@', 1);
21
+ if (atIdx > 0) {
22
+ return { name: arg.slice(0, atIdx), range: arg.slice(atIdx + 1) };
23
+ }
24
+ return { name: arg, range: '*' };
25
+ });
26
+ // Resolve
27
+ console.log(chalk.bold('Resolving dependencies...\n'));
28
+ let resolution;
29
+ try {
30
+ resolution = await resolve(client.asset, requests, {
31
+ includeUnapproved: opts.unapproved,
32
+ });
33
+ }
34
+ catch (err) {
35
+ if (err instanceof ResolutionError) {
36
+ console.error(chalk.red('Resolution failed:\n') + err.message);
37
+ process.exit(1);
38
+ }
39
+ throw err;
40
+ }
41
+ console.log(chalk.green(` ${resolution.assets.length} asset(s) resolved:\n`));
42
+ for (const asset of resolution.assets) {
43
+ console.log(` ${chalk.cyan(asset.name)}${chalk.dim('@' + asset.version)}`);
44
+ }
45
+ const npmCount = Object.keys(resolution.npmDependencies).length;
46
+ if (npmCount > 0) {
47
+ console.log(chalk.green(`\n ${npmCount} npm dependenc${npmCount === 1 ? 'y' : 'ies'}:\n`));
48
+ for (const [pkg, range] of Object.entries(resolution.npmDependencies)) {
49
+ console.log(` ${pkg} ${chalk.dim(range)}`);
50
+ }
51
+ }
52
+ // Install
53
+ console.log(chalk.bold('\nInstalling...\n'));
54
+ await install(client, resolution, {
55
+ cwd: opts.cwd,
56
+ onProgress: (msg) => console.log(chalk.dim(` ${msg}`)),
57
+ });
58
+ console.log(chalk.bold.green('\nDone!'));
59
+ });
60
+ program.parse();
61
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAsB,MAAM,cAAc,CAAA;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAA;AAE7B,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,4CAA4C,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;AAEjG,OAAO;KACJ,OAAO,CAAC,SAAS,CAAC;KAClB,WAAW,CAAC,kCAAkC,CAAC;KAC/C,QAAQ,CAAC,aAAa,EAAE,oDAAoD,CAAC;KAC7E,MAAM,CAAC,cAAc,EAAE,6BAA6B,EAAE,KAAK,CAAC;KAC5D,MAAM,CAAC,aAAa,EAAE,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,uBAAuB,CAAC;KAC5F,MAAM,CAAC,a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AAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAA;AAC1C,CAAC,CAAC,CAAA;AAEJ,OAAO,CAAC,KAAK,EAAE,CAAA"}
@@ -0,0 +1,12 @@
1
+ import type { ContractRouterClient } from '@orpc/contract';
2
+ import type { AppContract } from './contract.js';
3
+ import type { InternalContract } from './internal-contract.js';
4
+ export type MarketClient = ContractRouterClient<AppContract>;
5
+ export type InternalClient = ContractRouterClient<InternalContract>;
6
+ export interface MarketClientOptions {
7
+ baseUrl: string;
8
+ fetch?: typeof globalThis.fetch;
9
+ }
10
+ export declare function createMarketClient(opts: MarketClientOptions): MarketClient;
11
+ export declare function createInternalClient(opts: MarketClientOptions): InternalClient;
12
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAE9D,MAAM,MAAM,YAAY,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAA;AAC5D,MAAM,MAAM,cAAc,GAAG,oBAAoB,CAAC,gBAAgB,CAAC,CAAA;AAEnE,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAA;CAChC;AAWD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,mBAAmB,GAAG,YAAY,CAM1E;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,mBAAmB,GAAG,cAAc,CAM9E"}
package/dist/client.js ADDED
@@ -0,0 +1,26 @@
1
+ import { createORPCClient } from '@orpc/client';
2
+ import { RPCLink } from '@orpc/client/fetch';
3
+ function resolveUrl(baseUrl, path) {
4
+ if (baseUrl)
5
+ return `${baseUrl}${path}`;
6
+ // In browser environments, use the current origin for relative URLs
7
+ if (typeof globalThis !== 'undefined' && 'location' in globalThis) {
8
+ return `${globalThis.location.origin}${path}`;
9
+ }
10
+ throw new Error('baseUrl is required in non-browser environments');
11
+ }
12
+ export function createMarketClient(opts) {
13
+ const link = new RPCLink({
14
+ url: resolveUrl(opts.baseUrl, '/api/rpc'),
15
+ fetch: opts.fetch,
16
+ });
17
+ return createORPCClient(link);
18
+ }
19
+ export function createInternalClient(opts) {
20
+ const link = new RPCLink({
21
+ url: resolveUrl(opts.baseUrl, '/api/internal-rpc'),
22
+ fetch: opts.fetch,
23
+ });
24
+ return createORPCClient(link);
25
+ }
26
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAa5C,SAAS,UAAU,CAAC,OAAe,EAAE,IAAY;IAC/C,IAAI,OAAO;QAAE,OAAO,GAAG,OAAO,GAAG,IAAI,EAAE,CAAA;IACvC,oEAAoE;IACpE,IAAI,OAAO,UAAU,KAAK,WAAW,IAAI,UAAU,IAAI,UAAU,EAAE,CAAC;QAClE,OAAO,GAAI,UAA0D,CAAC,QAAQ,CAAC,MAAM,GAAG,IAAI,EAAE,CAAA;IAChG,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAA;AACpE,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAyB;IAC1D,MAAM,IAAI,GAAG,IAAI,OAAO,CAAC;QACvB,GAAG,EAAE,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC;QACzC,KAAK,EAAE,IAAI,CAAC,KAAK;KAClB,CAAC,CAAA;IACF,OAAO,gBAAgB,CAAe,IAAI,CAAC,CAAA;AAC7C,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,IAAyB;IAC5D,MAAM,IAAI,GAAG,IAAI,OAAO,CAAC;QACvB,GAAG,EAAE,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,mBAAmB,CAAC;QAClD,KAAK,EAAE,IAAI,CAAC,KAAK;KAClB,CAAC,CAAA;IACF,OAAO,gBAAgB,CAAiB,IAAI,CAAC,CAAA;AAC/C,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { AssetType } from './schemas.js';
2
+ export declare const MAX_FILE_SIZE: number;
3
+ export declare const ALLOWED_EXTENSIONS: Record<AssetType, string[]>;
4
+ export declare const ASSET_TYPE_LABELS: Record<AssetType, string>;
5
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,eAAO,MAAM,aAAa,QAAoB,CAAA;AAE9C,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,CAM1D,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAMvD,CAAA"}
@@ -0,0 +1,16 @@
1
+ export const MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB
2
+ export const ALLOWED_EXTENSIONS = {
3
+ generic: ['.zip'],
4
+ model: ['.gltf', '.glb'],
5
+ hdri: ['.hdr', '.exr'],
6
+ material: [], // material is submitted as JSON, no file upload
7
+ music: ['.mp3', '.wav', '.ogg', '.flac'],
8
+ };
9
+ export const ASSET_TYPE_LABELS = {
10
+ generic: 'Generic',
11
+ model: '3D Model',
12
+ hdri: 'HDRI',
13
+ material: 'Material',
14
+ music: 'Audio',
15
+ };
16
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAA,CAAC,QAAQ;AAEvD,MAAM,CAAC,MAAM,kBAAkB,GAAgC;IAC7D,OAAO,EAAE,CAAC,MAAM,CAAC;IACjB,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,EAAE,EAAE,gDAAgD;IAC9D,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;CACzC,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAA8B;IAC1D,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,UAAU;IACjB,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;CACf,CAAA"}
@@ -0,0 +1,198 @@
1
+ import { z } from 'zod';
2
+ export interface AssetVersion {
3
+ id: number;
4
+ assetId: number;
5
+ version: string;
6
+ approved: boolean;
7
+ npmDependencies: string;
8
+ assetDependencies: string;
9
+ sourceKey: string;
10
+ buildOutputKey: string | null;
11
+ thumbnailKey: string | null;
12
+ buildError: string | null;
13
+ readme: string | null;
14
+ createdAt: Date;
15
+ }
16
+ export interface Asset {
17
+ id: number;
18
+ name: string;
19
+ type: string;
20
+ description: string | null;
21
+ ownerId: string;
22
+ createdAt: Date;
23
+ updatedAt: Date;
24
+ }
25
+ export interface AssetWithVersionsAndTags extends Asset {
26
+ versions: AssetVersion[];
27
+ tags: string[];
28
+ }
29
+ export interface AssetListItem {
30
+ id: number;
31
+ name: string;
32
+ type: string;
33
+ description: string | null;
34
+ ownerId: string;
35
+ createdAt: Date;
36
+ updatedAt: Date;
37
+ latestVersion: string;
38
+ thumbnailKey: string | null;
39
+ approved: boolean;
40
+ }
41
+ export interface PaginatedList<T> {
42
+ items: T[];
43
+ total: number;
44
+ page: number;
45
+ limit: number;
46
+ totalPages: number;
47
+ }
48
+ export interface User {
49
+ id: string;
50
+ name: string;
51
+ email: string;
52
+ emailVerified: boolean;
53
+ image: string | null;
54
+ role: string;
55
+ createdAt: Date;
56
+ updatedAt: Date;
57
+ }
58
+ export interface AssetWithVersions extends Asset {
59
+ versions: AssetVersion[];
60
+ }
61
+ export interface UnapprovedItem {
62
+ versionId: number;
63
+ assetId: number;
64
+ assetName: string;
65
+ assetType: string;
66
+ version: string;
67
+ buildError: string | null;
68
+ buildOutputKey: string | null;
69
+ thumbnailKey: string | null;
70
+ createdAt: Date;
71
+ ownerName: string;
72
+ ownerEmail: string;
73
+ }
74
+ export interface TagWithCount {
75
+ id: number;
76
+ name: string;
77
+ count: number;
78
+ }
79
+ export interface FileTreeEntry {
80
+ path: string;
81
+ size: number;
82
+ }
83
+ export declare const contract: {
84
+ asset: {
85
+ getByName: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
86
+ name: z.ZodString;
87
+ }, z.core.$strip>, z.ZodCustom<AssetWithVersionsAndTags | null, AssetWithVersionsAndTags | null>, Record<never, never>, Record<never, never>>;
88
+ list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
89
+ page: z.ZodDefault<z.ZodNumber>;
90
+ limit: z.ZodDefault<z.ZodNumber>;
91
+ type: z.ZodOptional<z.ZodEnum<{
92
+ generic: "generic";
93
+ model: "model";
94
+ hdri: "hdri";
95
+ material: "material";
96
+ music: "music";
97
+ }>>;
98
+ tag: z.ZodOptional<z.ZodString>;
99
+ search: z.ZodOptional<z.ZodString>;
100
+ sort: z.ZodDefault<z.ZodEnum<{
101
+ newest: "newest";
102
+ alphabetical: "alphabetical";
103
+ relevance: "relevance";
104
+ }>>;
105
+ }, z.core.$strip>, z.ZodCustom<PaginatedList<AssetListItem>, PaginatedList<AssetListItem>>, Record<never, never>, Record<never, never>>;
106
+ getVersionTree: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
107
+ name: z.ZodString;
108
+ version: z.ZodString;
109
+ }, z.core.$strip>, z.ZodCustom<FileTreeEntry[], FileTreeEntry[]>, Record<never, never>, Record<never, never>>;
110
+ getRawFile: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
111
+ name: z.ZodString;
112
+ version: z.ZodString;
113
+ path: z.ZodString;
114
+ }, z.core.$strip>, z.ZodCustom<Blob, Blob>, Record<never, never>, Record<never, never>>;
115
+ };
116
+ upload: {
117
+ generic: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
118
+ name: z.ZodString;
119
+ version: z.ZodString;
120
+ description: z.ZodOptional<z.ZodString>;
121
+ npmDependencies: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
122
+ assetDependencies: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
123
+ tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
124
+ file: z.ZodCustom<File, File>;
125
+ }, z.core.$strip>, z.ZodCustom<AssetVersion, AssetVersion>, Record<never, never>, Record<never, never>>;
126
+ model: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
127
+ name: z.ZodString;
128
+ version: z.ZodString;
129
+ description: z.ZodOptional<z.ZodString>;
130
+ tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
131
+ file: z.ZodCustom<File, File>;
132
+ }, z.core.$strip>, z.ZodCustom<AssetVersion, AssetVersion>, Record<never, never>, Record<never, never>>;
133
+ hdri: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
134
+ name: z.ZodString;
135
+ version: z.ZodString;
136
+ description: z.ZodOptional<z.ZodString>;
137
+ tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
138
+ file: z.ZodCustom<File, File>;
139
+ }, z.core.$strip>, z.ZodCustom<AssetVersion, AssetVersion>, Record<never, never>, Record<never, never>>;
140
+ music: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
141
+ name: z.ZodString;
142
+ version: z.ZodString;
143
+ description: z.ZodOptional<z.ZodString>;
144
+ tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
145
+ file: z.ZodCustom<File, File>;
146
+ }, z.core.$strip>, z.ZodCustom<AssetVersion, AssetVersion>, Record<never, never>, Record<never, never>>;
147
+ material: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
148
+ name: z.ZodString;
149
+ version: z.ZodString;
150
+ description: z.ZodOptional<z.ZodString>;
151
+ tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
152
+ properties: z.ZodObject<{
153
+ color: z.ZodDefault<z.ZodString>;
154
+ roughness: z.ZodDefault<z.ZodNumber>;
155
+ metalness: z.ZodDefault<z.ZodNumber>;
156
+ normalScale: z.ZodDefault<z.ZodNumber>;
157
+ emissive: z.ZodDefault<z.ZodString>;
158
+ emissiveIntensity: z.ZodDefault<z.ZodNumber>;
159
+ }, z.core.$strip>;
160
+ }, z.core.$strip>, z.ZodCustom<AssetVersion, AssetVersion>, Record<never, never>, Record<never, never>>;
161
+ };
162
+ admin: {
163
+ listUnapproved: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodCustom<UnapprovedItem[], UnapprovedItem[]>, Record<never, never>, Record<never, never>>;
164
+ approve: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
165
+ assetName: z.ZodString;
166
+ version: z.ZodString;
167
+ }, z.core.$strip>, z.ZodObject<{
168
+ success: z.ZodBoolean;
169
+ }, z.core.$strip>, Record<never, never>, Record<never, never>>;
170
+ backfillEmbeddings: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
171
+ indexed: z.ZodNumber;
172
+ }, z.core.$strip>, Record<never, never>, Record<never, never>>;
173
+ };
174
+ user: {
175
+ getProfile: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodCustom<User | null, User | null>, Record<never, never>, Record<never, never>>;
176
+ updateProfile: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
177
+ name: z.ZodOptional<z.ZodString>;
178
+ image: z.ZodOptional<z.ZodString>;
179
+ }, z.core.$strip>, z.ZodCustom<User, User>, Record<never, never>, Record<never, never>>;
180
+ getApiKey: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodCustom<{
181
+ prefix: string;
182
+ createdAt: Date;
183
+ } | null, {
184
+ prefix: string;
185
+ createdAt: Date;
186
+ } | null>, Record<never, never>, Record<never, never>>;
187
+ regenerateApiKey: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
188
+ key: z.ZodString;
189
+ prefix: z.ZodString;
190
+ }, z.core.$strip>, Record<never, never>, Record<never, never>>;
191
+ myAssets: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodCustom<AssetWithVersions[], AssetWithVersions[]>, Record<never, never>, Record<never, never>>;
192
+ };
193
+ tag: {
194
+ list: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodCustom<TagWithCount[], TagWithCount[]>, Record<never, never>, Record<never, never>>;
195
+ };
196
+ };
197
+ export type AppContract = typeof contract;
198
+ //# sourceMappingURL=contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAgBvB,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IAC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@
1
+ import { oc } from '@orpc/contract';
2
+ import { z } from 'zod';
3
+ import { assetNameSchema, semverSchema, listAssetsSchema, updateProfileSchema, uploadGenericSchema, uploadTypedSchema, uploadMaterialSchema, } from './schemas.js';
4
+ // ─── Contract ─────────────────────────────────────────────────────────────────
5
+ export const contract = {
6
+ asset: {
7
+ getByName: oc
8
+ .input(z.object({ name: assetNameSchema }))
9
+ .output(z.custom()),
10
+ list: oc
11
+ .input(listAssetsSchema)
12
+ .output(z.custom()),
13
+ getVersionTree: oc
14
+ .input(z.object({ name: z.string(), version: semverSchema }))
15
+ .output(z.custom()),
16
+ getRawFile: oc
17
+ .input(z.object({ name: z.string(), version: semverSchema, path: z.string() }))
18
+ .output(z.instanceof(Blob)),
19
+ },
20
+ upload: {
21
+ generic: oc
22
+ .input(uploadGenericSchema.extend({ file: z.instanceof(File) }))
23
+ .output(z.custom()),
24
+ model: oc
25
+ .input(uploadTypedSchema.extend({ file: z.instanceof(File) }))
26
+ .output(z.custom()),
27
+ hdri: oc
28
+ .input(uploadTypedSchema.extend({ file: z.instanceof(File) }))
29
+ .output(z.custom()),
30
+ music: oc
31
+ .input(uploadTypedSchema.extend({ file: z.instanceof(File) }))
32
+ .output(z.custom()),
33
+ material: oc
34
+ .input(uploadMaterialSchema)
35
+ .output(z.custom()),
36
+ },
37
+ admin: {
38
+ listUnapproved: oc
39
+ .output(z.custom()),
40
+ approve: oc
41
+ .input(z.object({ assetName: z.string(), version: z.string() }))
42
+ .output(z.object({ success: z.boolean() })),
43
+ backfillEmbeddings: oc
44
+ .output(z.object({ indexed: z.number() })),
45
+ },
46
+ user: {
47
+ getProfile: oc
48
+ .output(z.custom()),
49
+ updateProfile: oc
50
+ .input(updateProfileSchema)
51
+ .output(z.custom()),
52
+ getApiKey: oc
53
+ .output(z.custom()),
54
+ regenerateApiKey: oc
55
+ .output(z.object({ key: z.string(), prefix: z.string() })),
56
+ myAssets: oc
57
+ .output(z.custom()),
58
+ },
59
+ tag: {
60
+ list: oc
61
+ .output(z.custom()),
62
+ },
63
+ };
64
+ //# sourceMappingURL=contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAA;AACnC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EACL,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,cAAc,CAAA;AAkGrB,iFAAiF;AAEjF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,KAAK,EAAE;QACL,SAAS,EAAE,EAAE;aACV,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;aAC1C,MAAM,CAAC,CAAC,CAAC,MAAM,EAAmC,CAAC;QAEtD,IAAI,EAAE,EAAE;aACL,KAAK,CAAC,gBAAgB,CAAC;aACvB,MAAM,CAAC,CAAC,CAAC,MAAM,EAAgC,CAAC;QAEnD,cAAc,EAAE,EAAE;aACf,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;aAC5D,MAAM,CAAC,CAAC,CAAC,MAAM,EAAmB,CAAC;QAEtC,UAAU,EAAE,EAAE;aACX,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;aAC9E,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;KAC9B;IAED,MAAM,EAAE;QACN,OAAO,EAAE,EAAE;aACR,KAAK,CAAC,mBAAmB,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C,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;KAC7C;IAED,IAAI,EAAE;QACJ,UAAU,EAAE,EAAE;aACX,MAAM,CAAC,CAAC,CAAC,MAAM,EAAe,CAAC;QAElC,aAAa,EAAE,EAAE;aACd,KAAK,CAAC,mBAAmB,CAAC;aAC1B,MAAM,CAAC,CAAC,CAAC,MAAM,EAAQ,CAAC;QAE3B,SAAS,EAAE,EAAE;aACV,MAAM,CAAC,CAAC,CAAC,MAAM,EAA8C,CAAC;QAEjE,gBAAgB,EAAE,EAAE;aACjB,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAE5D,QAAQ,EAAE,EAAE;aACT,MAAM,CAAC,CAAC,CAAC,MAAM,EAAuB,CAAC;KAC3C;IAED,GAAG,EAAE;QACH,IAAI,EAAE,EAAE;aACL,MAAM,CAAC,CAAC,CAAC,MAAM,EAAkB,CAAC;KACtC;CACF,CAAA"}
@@ -0,0 +1,13 @@
1
+ export { createMarketClient, createInternalClient } from './client.js';
2
+ export type { MarketClient, InternalClient, MarketClientOptions } from './client.js';
3
+ export { contract } from './contract.js';
4
+ export type { AppContract } from './contract.js';
5
+ export { internalContract } from './internal-contract.js';
6
+ export type { InternalContract } from './internal-contract.js';
7
+ export type { Asset, AssetVersion, AssetWithVersionsAndTags, AssetWithVersions, AssetListItem, PaginatedList, User, UnapprovedItem, TagWithCount, FileTreeEntry, } from './contract.js';
8
+ export { resolve, ResolutionError } from './resolve.js';
9
+ export type { ResolvedAsset, ResolveResult } from './resolve.js';
10
+ export { ASSET_TYPES, assetTypeSchema, semverSchema, assetNameSchema, npmDependenciesSchema, assetDependenciesSchema, uploadGenericSchema, uploadTypedSchema, uploadMaterialSchema, updateProfileSchema, listAssetsSchema, } from './schemas.js';
11
+ export type { AssetType } from './schemas.js';
12
+ export { MAX_FILE_SIZE, ALLOWED_EXTENSIONS, ASSET_TYPE_LABELS } from './constants.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACtE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAGpF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAG9D,YAAY,EACV,KAAK,EACL,YAAY,EACZ,wBAAwB,EACxB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,IAAI,EACJ,cAAc,EACd,YAAY,EACZ,aAAa,GACd,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACvD,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAGhE,OAAO,EACL,WAAW,EACX,eAAe,EACf,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,cAAc,CAAA;AACrB,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAG7C,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ // Client
2
+ export { createMarketClient, createInternalClient } from './client.js';
3
+ // Contracts
4
+ export { contract } from './contract.js';
5
+ export { internalContract } from './internal-contract.js';
6
+ // Resolve
7
+ export { resolve, ResolutionError } from './resolve.js';
8
+ // Schemas
9
+ export { ASSET_TYPES, assetTypeSchema, semverSchema, assetNameSchema, npmDependenciesSchema, assetDependenciesSchema, uploadGenericSchema, uploadTypedSchema, uploadMaterialSchema, updateProfileSchema, listAssetsSchema, } from './schemas.js';
10
+ // Constants
11
+ export { MAX_FILE_SIZE, ALLOWED_EXTENSIONS, ASSET_TYPE_LABELS } from './constants.js';
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAGtE,YAAY;AACZ,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAiBzD,UAAU;AACV,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAGvD,UAAU;AACV,OAAO,EACL,WAAW,EACX,eAAe,EACf,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,cAAc,CAAA;AAGrB,YAAY;AACZ,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Install resolved assets into a local project.
3
+ *
4
+ * 1. Downloads asset files into ./src/{assetName}/ via the oRPC client.
5
+ * 2. Merges npm dependencies into package.json.
6
+ * 3. Runs the package manager to install npm deps.
7
+ *
8
+ * NOTE: This module uses Node.js APIs (fs, path, nypm) and is only
9
+ * used by the CLI binary — it is NOT exported from the package index.
10
+ */
11
+ import type { MarketClient } from './client.js';
12
+ import type { ResolveResult } from './resolve.js';
13
+ export interface InstallOptions {
14
+ /** Project root directory (default: cwd) */
15
+ cwd?: string;
16
+ /** Log progress */
17
+ onProgress?: (message: string) => void;
18
+ }
19
+ export declare function install(client: MarketClient, resolution: ResolveResult, opts?: InstallOptions): Promise<void>;
20
+ //# sourceMappingURL=install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEjD,MAAM,WAAW,cAAc;IAC7B,4CAA4C;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,mBAAmB;IACnB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACvC;AAED,wBAAsB,OAAO,CAC3B,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,aAAa,EACzB,IAAI,GAAE,cAAmB,GACxB,OAAO,CAAC,IAAI,CAAC,CASf"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Install resolved assets into a local project.
3
+ *
4
+ * 1. Downloads asset files into ./src/{assetName}/ via the oRPC client.
5
+ * 2. Merges npm dependencies into package.json.
6
+ * 3. Runs the package manager to install npm deps.
7
+ *
8
+ * NOTE: This module uses Node.js APIs (fs, path, nypm) and is only
9
+ * used by the CLI binary — it is NOT exported from the package index.
10
+ */
11
+ import * as fs from 'fs/promises';
12
+ import * as path from 'path';
13
+ import { detectPackageManager, installDependencies } from 'nypm';
14
+ export async function install(client, resolution, opts = {}) {
15
+ const cwd = opts.cwd ?? process.cwd();
16
+ const log = opts.onProgress ?? (() => { });
17
+ // Run asset file downloads and npm dep installation in parallel
18
+ await Promise.all([
19
+ downloadAssets(client, resolution, cwd, log),
20
+ installNpmDeps(resolution, cwd, log),
21
+ ]);
22
+ }
23
+ async function downloadAssets(client, resolution, cwd, log) {
24
+ for (const asset of resolution.assets) {
25
+ const destDir = path.join(cwd, 'src', asset.name);
26
+ await fs.mkdir(destDir, { recursive: true });
27
+ log(`Downloading ${asset.name}@${asset.version}...`);
28
+ const tree = await client.asset.getVersionTree({ name: asset.name, version: asset.version });
29
+ for (const file of tree) {
30
+ const filePath = path.join(destDir, file.path);
31
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
32
+ const blob = await client.asset.getRawFile({
33
+ name: asset.name,
34
+ version: asset.version,
35
+ path: file.path,
36
+ });
37
+ const content = Buffer.from(await blob.arrayBuffer());
38
+ await fs.writeFile(filePath, content);
39
+ }
40
+ log(` ${tree.length} files → src/${asset.name}/`);
41
+ }
42
+ }
43
+ async function installNpmDeps(resolution, cwd, log) {
44
+ const deps = resolution.npmDependencies;
45
+ if (Object.keys(deps).length === 0)
46
+ return;
47
+ // Read existing package.json
48
+ const pkgPath = path.join(cwd, 'package.json');
49
+ let pkg;
50
+ try {
51
+ pkg = JSON.parse(await fs.readFile(pkgPath, 'utf-8'));
52
+ }
53
+ catch {
54
+ pkg = { name: 'my-project', private: true, dependencies: {} };
55
+ }
56
+ // Merge dependencies
57
+ pkg.dependencies = { ...pkg.dependencies, ...deps };
58
+ await fs.writeFile(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
59
+ log(`Installing npm dependencies: ${Object.keys(deps).join(', ')}`);
60
+ // Detect package manager, fall back to npm
61
+ const pm = await detectPackageManager(cwd).catch(() => null);
62
+ const pmName = pm?.name ?? 'npm';
63
+ log(`Using ${pmName}...`);
64
+ await installDependencies({ cwd, packageManager: { name: pmName, command: pmName } });
65
+ log('npm dependencies installed.');
66
+ }
67
+ //# sourceMappingURL=install.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.js","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EA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CAAA;IAC/D,CAAC;IAED,qBAAqB;IACrB,GAAG,CAAC,YAAY,GAAG,EAAE,GAAG,GAAG,CAAC,YAAY,EAAE,GAAG,IAAI,EAAE,CAAA;IACnD,MAAM,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;IAEhE,GAAG,CAAC,gCAAgC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAEnE,2CAA2C;IAC3C,MAAM,EAAE,GAAG,MAAM,oBAAoB,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;IAC5D,MAAM,MAAM,GAAG,EAAE,EAAE,IAAI,IAAI,KAAK,CAAA;IAEhC,GAAG,CAAC,SAAS,MAAM,KAAK,CAAC,CAAA;IACzB,MAAM,mBAAmB,CAAC,EAAE,GAAG,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,CAAA;IACrF,GAAG,CAAC,6BAA6B,CAAC,CAAA;AACpC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ export declare const internalContract: {
3
+ buildUpload: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
4
+ key: z.ZodString;
5
+ content: z.ZodString;
6
+ contentType: z.ZodString;
7
+ }, z.core.$strip>, z.ZodObject<{
8
+ ok: z.ZodBoolean;
9
+ }, z.core.$strip>, Record<never, never>, Record<never, never>>;
10
+ buildComplete: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
11
+ assetName: z.ZodString;
12
+ version: z.ZodString;
13
+ buildOutputKey: z.ZodString;
14
+ }, z.core.$strip>, z.ZodObject<{
15
+ ok: z.ZodBoolean;
16
+ }, z.core.$strip>, Record<never, never>, Record<never, never>>;
17
+ };
18
+ export type InternalContract = typeof internalContract;
19
+ //# sourceMappingURL=internal-contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-contract.d.ts","sourceRoot":"","sources":["../src/internal-contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;CAoB5B,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAA"}
@@ -0,0 +1,19 @@
1
+ import { oc } from '@orpc/contract';
2
+ import { z } from 'zod';
3
+ export const internalContract = {
4
+ buildUpload: oc
5
+ .input(z.object({
6
+ key: z.string(),
7
+ content: z.string(), // base64-encoded
8
+ contentType: z.string(),
9
+ }))
10
+ .output(z.object({ ok: z.boolean() })),
11
+ buildComplete: oc
12
+ .input(z.object({
13
+ assetName: z.string(),
14
+ version: z.string(),
15
+ buildOutputKey: z.string(),
16
+ }))
17
+ .output(z.object({ ok: z.boolean() })),
18
+ };
19
+ //# sourceMappingURL=internal-contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-contract.js","sourceRoot":"","sources":["../src/internal-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAA;AACnC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,WAAW,EAAE,EAAE;SACZ,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;QACP,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;QACf,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,iBAAiB;QACtC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;KACxB,CAAC,CACH;SACA,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAExC,aAAa,EAAE,EAAE;SACd,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;QACP,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;KAC3B,CAAC,CACH;SACA,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;CACzC,CAAA"}