@opengeni/contracts 0.31.0 → 0.32.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/dist/chunk-7JZMI22I.js +126 -0
- package/dist/chunk-7JZMI22I.js.map +1 -0
- package/dist/{chunk-H4NRLOOX.js → chunk-GMOYIHF3.js} +650 -280
- package/dist/chunk-GMOYIHF3.js.map +1 -0
- package/dist/google-drive.d.ts +21 -0
- package/dist/google-drive.js +36 -3
- package/dist/google-drive.js.map +1 -1
- package/dist/index.d.ts +647 -2
- package/dist/index.js +97 -5
- package/dist/slack-bot-scopes.d.ts +58 -1
- package/dist/slack-bot-scopes.js +15 -3
- package/dist/workspace-instruction-policies.d.ts +160 -0
- package/package.json +1 -1
- package/src/google-drive.ts +53 -0
- package/src/index.ts +513 -100
- package/src/slack-bot-scopes.ts +93 -1
- package/src/workspace-instruction-policies.ts +75 -3
- package/dist/chunk-H4NRLOOX.js.map +0 -1
- package/dist/chunk-KGL5BVGF.js +0 -45
- package/dist/chunk-KGL5BVGF.js.map +0 -1
package/dist/google-drive.d.ts
CHANGED
|
@@ -1,9 +1,30 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const GOOGLE_DRIVE_PROVIDER_DOMAIN: "googleapis.com";
|
|
3
|
+
export declare const GOOGLE_DRIVE_FULL_SCOPE: "https://www.googleapis.com/auth/drive";
|
|
4
|
+
export declare const GOOGLE_DRIVE_FILE_SCOPE: "https://www.googleapis.com/auth/drive.file";
|
|
3
5
|
export declare const GOOGLE_DRIVE_METADATA_READONLY_SCOPE: "https://www.googleapis.com/auth/drive.metadata.readonly";
|
|
4
6
|
export declare const GOOGLE_DRIVE_READONLY_SCOPE: "https://www.googleapis.com/auth/drive.readonly";
|
|
5
7
|
export declare const GOOGLE_DRIVE_CREDENTIAL_ROLE: "google_drive_metadata";
|
|
6
8
|
export declare const GOOGLE_DRIVE_CREDENTIAL_LABEL: "Google Drive metadata browser";
|
|
9
|
+
export declare const GoogleDriveOAuthCapability: z.ZodEnum<{
|
|
10
|
+
picker_file_read: "picker_file_read";
|
|
11
|
+
recursive_source_sync: "recursive_source_sync";
|
|
12
|
+
source_content_read: "source_content_read";
|
|
13
|
+
source_metadata_discovery: "source_metadata_discovery";
|
|
14
|
+
}>;
|
|
15
|
+
export type GoogleDriveOAuthCapability = z.infer<typeof GoogleDriveOAuthCapability>;
|
|
16
|
+
export type GoogleDriveOAuthScopeDecision = {
|
|
17
|
+
accessMode: "metadata_readonly" | "readonly" | null;
|
|
18
|
+
capabilities: GoogleDriveOAuthCapability[];
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Converts exact Google OAuth grants into the Drive capabilities OpenGeni may
|
|
22
|
+
* rely on. Unknown or malformed grants add no authority. In particular,
|
|
23
|
+
* drive.file covers only files explicitly opened or shared with the app and
|
|
24
|
+
* never authorizes arbitrary recursive descendant discovery.
|
|
25
|
+
*/
|
|
26
|
+
export declare function googleDriveOAuthScopeDecision(grantedScopes: readonly string[]): GoogleDriveOAuthScopeDecision;
|
|
27
|
+
export declare function googleDriveScopesAllowCapability(grantedScopes: readonly string[], capability: GoogleDriveOAuthCapability): boolean;
|
|
7
28
|
export declare const GoogleDriveTargetScope: z.ZodEnum<{
|
|
8
29
|
organization: "organization";
|
|
9
30
|
user: "user";
|
package/dist/google-drive.js
CHANGED
|
@@ -1,15 +1,43 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConnectionMetadata
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-GMOYIHF3.js";
|
|
4
|
+
import "./chunk-7JZMI22I.js";
|
|
5
5
|
|
|
6
6
|
// src/google-drive.ts
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
var GOOGLE_DRIVE_PROVIDER_DOMAIN = "googleapis.com";
|
|
9
|
+
var GOOGLE_DRIVE_FULL_SCOPE = "https://www.googleapis.com/auth/drive";
|
|
10
|
+
var GOOGLE_DRIVE_FILE_SCOPE = "https://www.googleapis.com/auth/drive.file";
|
|
9
11
|
var GOOGLE_DRIVE_METADATA_READONLY_SCOPE = "https://www.googleapis.com/auth/drive.metadata.readonly";
|
|
10
12
|
var GOOGLE_DRIVE_READONLY_SCOPE = "https://www.googleapis.com/auth/drive.readonly";
|
|
11
13
|
var GOOGLE_DRIVE_CREDENTIAL_ROLE = "google_drive_metadata";
|
|
12
14
|
var GOOGLE_DRIVE_CREDENTIAL_LABEL = "Google Drive metadata browser";
|
|
15
|
+
var GoogleDriveOAuthCapability = z.enum([
|
|
16
|
+
"picker_file_read",
|
|
17
|
+
"source_metadata_discovery",
|
|
18
|
+
"source_content_read",
|
|
19
|
+
"recursive_source_sync"
|
|
20
|
+
]);
|
|
21
|
+
function googleDriveOAuthScopeDecision(grantedScopes) {
|
|
22
|
+
const granted = new Set(grantedScopes);
|
|
23
|
+
const hasFullDrive = granted.has(GOOGLE_DRIVE_FULL_SCOPE);
|
|
24
|
+
const hasSourceContentRead = hasFullDrive || granted.has(GOOGLE_DRIVE_READONLY_SCOPE);
|
|
25
|
+
const hasSourceMetadataDiscovery = hasSourceContentRead || granted.has(GOOGLE_DRIVE_METADATA_READONLY_SCOPE);
|
|
26
|
+
const hasPickerFileRead = hasSourceContentRead || granted.has(GOOGLE_DRIVE_FILE_SCOPE);
|
|
27
|
+
const capabilities = [];
|
|
28
|
+
if (hasPickerFileRead) capabilities.push("picker_file_read");
|
|
29
|
+
if (hasSourceMetadataDiscovery) capabilities.push("source_metadata_discovery");
|
|
30
|
+
if (hasSourceContentRead) {
|
|
31
|
+
capabilities.push("source_content_read", "recursive_source_sync");
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
accessMode: hasSourceContentRead ? "readonly" : hasSourceMetadataDiscovery ? "metadata_readonly" : null,
|
|
35
|
+
capabilities
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function googleDriveScopesAllowCapability(grantedScopes, capability) {
|
|
39
|
+
return googleDriveOAuthScopeDecision(grantedScopes).capabilities.includes(capability);
|
|
40
|
+
}
|
|
13
41
|
var GoogleDriveTargetScope = z.enum(["user", "workspace", "organization"]);
|
|
14
42
|
var GoogleDriveSyncCadence = z.enum(["manual", "hourly", "daily"]);
|
|
15
43
|
var GoogleDriveReadPolicy = z.enum(["allow", "ask", "block"]);
|
|
@@ -78,18 +106,23 @@ var SaveGoogleDriveSourceRequest = z.object({
|
|
|
78
106
|
export {
|
|
79
107
|
GOOGLE_DRIVE_CREDENTIAL_LABEL,
|
|
80
108
|
GOOGLE_DRIVE_CREDENTIAL_ROLE,
|
|
109
|
+
GOOGLE_DRIVE_FILE_SCOPE,
|
|
110
|
+
GOOGLE_DRIVE_FULL_SCOPE,
|
|
81
111
|
GOOGLE_DRIVE_METADATA_READONLY_SCOPE,
|
|
82
112
|
GOOGLE_DRIVE_PROVIDER_DOMAIN,
|
|
83
113
|
GOOGLE_DRIVE_READONLY_SCOPE,
|
|
84
114
|
GoogleDriveBrowseItem,
|
|
85
115
|
GoogleDriveBrowseResponse,
|
|
86
116
|
GoogleDriveConnectionMetadata,
|
|
117
|
+
GoogleDriveOAuthCapability,
|
|
87
118
|
GoogleDriveOAuthStartRequest,
|
|
88
119
|
GoogleDriveOAuthStartResponse,
|
|
89
120
|
GoogleDriveReadPolicy,
|
|
90
121
|
GoogleDriveSelectedSource,
|
|
91
122
|
GoogleDriveSyncCadence,
|
|
92
123
|
GoogleDriveTargetScope,
|
|
93
|
-
SaveGoogleDriveSourceRequest
|
|
124
|
+
SaveGoogleDriveSourceRequest,
|
|
125
|
+
googleDriveOAuthScopeDecision,
|
|
126
|
+
googleDriveScopesAllowCapability
|
|
94
127
|
};
|
|
95
128
|
//# sourceMappingURL=google-drive.js.map
|
package/dist/google-drive.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/google-drive.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { ConnectionMetadata } from \"./index\";\n\nexport const GOOGLE_DRIVE_PROVIDER_DOMAIN = \"googleapis.com\" as const;\nexport const GOOGLE_DRIVE_METADATA_READONLY_SCOPE =\n \"https://www.googleapis.com/auth/drive.metadata.readonly\" as const;\nexport const GOOGLE_DRIVE_READONLY_SCOPE =\n \"https://www.googleapis.com/auth/drive.readonly\" as const;\nexport const GOOGLE_DRIVE_CREDENTIAL_ROLE = \"google_drive_metadata\" as const;\nexport const GOOGLE_DRIVE_CREDENTIAL_LABEL = \"Google Drive metadata browser\" as const;\n\nexport const GoogleDriveTargetScope = z.enum([\"user\", \"workspace\", \"organization\"]);\nexport type GoogleDriveTargetScope = z.infer<typeof GoogleDriveTargetScope>;\n\nexport const GoogleDriveSyncCadence = z.enum([\"manual\", \"hourly\", \"daily\"]);\nexport type GoogleDriveSyncCadence = z.infer<typeof GoogleDriveSyncCadence>;\n\nexport const GoogleDriveReadPolicy = z.enum([\"allow\", \"ask\", \"block\"]);\nexport type GoogleDriveReadPolicy = z.infer<typeof GoogleDriveReadPolicy>;\n\nexport const GoogleDriveSelectedSource = z.object({\n id: z.string().min(1).max(256),\n name: z.string().min(1).max(1024),\n mimeType: z.string().min(1).max(256),\n driveId: z.string().min(1).max(256).nullable().default(null),\n targetScope: GoogleDriveTargetScope,\n syncCadence: GoogleDriveSyncCadence.default(\"hourly\"),\n readPolicy: GoogleDriveReadPolicy.default(\"allow\"),\n selectedAt: z.string().datetime({ offset: true }),\n});\nexport type GoogleDriveSelectedSource = z.infer<typeof GoogleDriveSelectedSource>;\n\nexport const GoogleDriveConnectionMetadata = z\n .object({\n credentialRole: z.literal(GOOGLE_DRIVE_CREDENTIAL_ROLE),\n credentialLabel: z.literal(GOOGLE_DRIVE_CREDENTIAL_LABEL),\n googlePermissionId: z.string().min(1).max(256),\n googleEmail: z.string().email().max(320),\n googleDisplayName: z.string().min(1).max(512).nullable(),\n verifiedAt: z.string().datetime({ offset: true }),\n accessMode: z.enum([\"metadata_readonly\", \"readonly\"]),\n selectedSources: z.array(GoogleDriveSelectedSource).max(100).optional(),\n /** @deprecated Read `selectedSources`; retained while existing connections migrate. */\n selectedSource: GoogleDriveSelectedSource.nullable().optional(),\n })\n .passthrough();\nexport type GoogleDriveConnectionMetadata = z.infer<typeof GoogleDriveConnectionMetadata>;\n\nexport const GoogleDriveOAuthStartRequest = z.object({\n connectionId: z.string().uuid().optional(),\n});\nexport type GoogleDriveOAuthStartRequest = z.infer<typeof GoogleDriveOAuthStartRequest>;\n\nexport const GoogleDriveOAuthStartResponse = z.object({\n authorizationUrl: z.string().url(),\n expiresAt: z.string().datetime({ offset: true }),\n});\nexport type GoogleDriveOAuthStartResponse = z.infer<typeof GoogleDriveOAuthStartResponse>;\n\nexport const GoogleDriveBrowseItem = z.object({\n id: z.string().min(1).max(256),\n name: z.string().min(1).max(1024),\n mimeType: z.string().min(1).max(256),\n kind: z.enum([\"folder\", \"file\"]),\n driveId: z.string().min(1).max(256).nullable(),\n modifiedTime: z.string().datetime({ offset: true }).nullable(),\n size: z.string().regex(/^\\d+$/).nullable(),\n webViewLink: z.string().url().nullable(),\n});\nexport type GoogleDriveBrowseItem = z.infer<typeof GoogleDriveBrowseItem>;\n\nexport const GoogleDriveBrowseResponse = z.object({\n connection: z.lazy(() => ConnectionMetadata),\n parentId: z.string().min(1).max(256),\n current: GoogleDriveBrowseItem.nullable(),\n items: z.array(GoogleDriveBrowseItem),\n nextPageToken: z.string().min(1).max(4096).nullable(),\n incompleteSearch: z.boolean(),\n});\nexport type GoogleDriveBrowseResponse = z.infer<typeof GoogleDriveBrowseResponse>;\n\nexport const SaveGoogleDriveSourceRequest = z.object({\n sources: z\n .array(\n GoogleDriveBrowseItem.pick({\n id: true,\n name: true,\n mimeType: true,\n driveId: true,\n }),\n )\n .max(100)\n .refine((sources) => new Set(sources.map((source) => source.id)).size === sources.length, {\n message: \"Google Drive sources must be unique\",\n }),\n targetScope: GoogleDriveTargetScope,\n syncCadence: GoogleDriveSyncCadence.default(\"hourly\"),\n readPolicy: GoogleD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I,CAAC,EAAE,IAAI,GAAG;AAAA,EACnC,SAAS,sBAAsB,SAAS;AAAA,EACxC,OAAO,EAAE,MAAM,qBAAqB;AAAA,EACpC,eAAe,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,IAAI,EAAE,SAAS;AAAA,EACpD,kBAAkB,EAAE,QAAQ;AAC9B,CAAC;AAGM,IAAM,+BAA+B,EAAE,OAAO;AAAA,EACnD,SAAS,EACN;AAAA,IACC,sBAAsB,KAAK;AAAA,MACzB,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,IACX,CAAC;AAAA,EACH,EACC,IAAI,GAAG,EACP,OAAO,CAAC,YAAY,IAAI,IAAI,QAAQ,IAAI,CAAC,WAAW,OAAO,EAAE,CAAC,EAAE,SAAS,QAAQ,QAAQ;AAAA,IACxF,SAAS;AAAA,EACX,CAAC;AAAA,EACH,aAAa;AAAA,EACb,aAAa,uBAAuB,QAAQ,QAAQ;AAAA,EACpD,YAAY,sBAAsB,QAAQ,OAAO;AACnD,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/google-drive.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { ConnectionMetadata } from \"./index\";\n\nexport const GOOGLE_DRIVE_PROVIDER_DOMAIN = \"googleapis.com\" as const;\nexport const GOOGLE_DRIVE_FULL_SCOPE = \"https://www.googleapis.com/auth/drive\" as const;\nexport const GOOGLE_DRIVE_FILE_SCOPE = \"https://www.googleapis.com/auth/drive.file\" as const;\nexport const GOOGLE_DRIVE_METADATA_READONLY_SCOPE =\n \"https://www.googleapis.com/auth/drive.metadata.readonly\" as const;\nexport const GOOGLE_DRIVE_READONLY_SCOPE =\n \"https://www.googleapis.com/auth/drive.readonly\" as const;\nexport const GOOGLE_DRIVE_CREDENTIAL_ROLE = \"google_drive_metadata\" as const;\nexport const GOOGLE_DRIVE_CREDENTIAL_LABEL = \"Google Drive metadata browser\" as const;\n\nexport const GoogleDriveOAuthCapability = z.enum([\n \"picker_file_read\",\n \"source_metadata_discovery\",\n \"source_content_read\",\n \"recursive_source_sync\",\n]);\nexport type GoogleDriveOAuthCapability = z.infer<typeof GoogleDriveOAuthCapability>;\n\nexport type GoogleDriveOAuthScopeDecision = {\n accessMode: \"metadata_readonly\" | \"readonly\" | null;\n capabilities: GoogleDriveOAuthCapability[];\n};\n\n/**\n * Converts exact Google OAuth grants into the Drive capabilities OpenGeni may\n * rely on. Unknown or malformed grants add no authority. In particular,\n * drive.file covers only files explicitly opened or shared with the app and\n * never authorizes arbitrary recursive descendant discovery.\n */\nexport function googleDriveOAuthScopeDecision(\n grantedScopes: readonly string[],\n): GoogleDriveOAuthScopeDecision {\n const granted = new Set(grantedScopes);\n const hasFullDrive = granted.has(GOOGLE_DRIVE_FULL_SCOPE);\n const hasSourceContentRead = hasFullDrive || granted.has(GOOGLE_DRIVE_READONLY_SCOPE);\n const hasSourceMetadataDiscovery =\n hasSourceContentRead || granted.has(GOOGLE_DRIVE_METADATA_READONLY_SCOPE);\n const hasPickerFileRead = hasSourceContentRead || granted.has(GOOGLE_DRIVE_FILE_SCOPE);\n const capabilities: GoogleDriveOAuthCapability[] = [];\n if (hasPickerFileRead) capabilities.push(\"picker_file_read\");\n if (hasSourceMetadataDiscovery) capabilities.push(\"source_metadata_discovery\");\n if (hasSourceContentRead) {\n capabilities.push(\"source_content_read\", \"recursive_source_sync\");\n }\n return {\n accessMode: hasSourceContentRead\n ? \"readonly\"\n : hasSourceMetadataDiscovery\n ? \"metadata_readonly\"\n : null,\n capabilities,\n };\n}\n\nexport function googleDriveScopesAllowCapability(\n grantedScopes: readonly string[],\n capability: GoogleDriveOAuthCapability,\n): boolean {\n return googleDriveOAuthScopeDecision(grantedScopes).capabilities.includes(capability);\n}\n\nexport const GoogleDriveTargetScope = z.enum([\"user\", \"workspace\", \"organization\"]);\nexport type GoogleDriveTargetScope = z.infer<typeof GoogleDriveTargetScope>;\n\nexport const GoogleDriveSyncCadence = z.enum([\"manual\", \"hourly\", \"daily\"]);\nexport type GoogleDriveSyncCadence = z.infer<typeof GoogleDriveSyncCadence>;\n\nexport const GoogleDriveReadPolicy = z.enum([\"allow\", \"ask\", \"block\"]);\nexport type GoogleDriveReadPolicy = z.infer<typeof GoogleDriveReadPolicy>;\n\nexport const GoogleDriveSelectedSource = z.object({\n id: z.string().min(1).max(256),\n name: z.string().min(1).max(1024),\n mimeType: z.string().min(1).max(256),\n driveId: z.string().min(1).max(256).nullable().default(null),\n targetScope: GoogleDriveTargetScope,\n syncCadence: GoogleDriveSyncCadence.default(\"hourly\"),\n readPolicy: GoogleDriveReadPolicy.default(\"allow\"),\n selectedAt: z.string().datetime({ offset: true }),\n});\nexport type GoogleDriveSelectedSource = z.infer<typeof GoogleDriveSelectedSource>;\n\nexport const GoogleDriveConnectionMetadata = z\n .object({\n credentialRole: z.literal(GOOGLE_DRIVE_CREDENTIAL_ROLE),\n credentialLabel: z.literal(GOOGLE_DRIVE_CREDENTIAL_LABEL),\n googlePermissionId: z.string().min(1).max(256),\n googleEmail: z.string().email().max(320),\n googleDisplayName: z.string().min(1).max(512).nullable(),\n verifiedAt: z.string().datetime({ offset: true }),\n accessMode: z.enum([\"metadata_readonly\", \"readonly\"]),\n selectedSources: z.array(GoogleDriveSelectedSource).max(100).optional(),\n /** @deprecated Read `selectedSources`; retained while existing connections migrate. */\n selectedSource: GoogleDriveSelectedSource.nullable().optional(),\n })\n .passthrough();\nexport type GoogleDriveConnectionMetadata = z.infer<typeof GoogleDriveConnectionMetadata>;\n\nexport const GoogleDriveOAuthStartRequest = z.object({\n connectionId: z.string().uuid().optional(),\n});\nexport type GoogleDriveOAuthStartRequest = z.infer<typeof GoogleDriveOAuthStartRequest>;\n\nexport const GoogleDriveOAuthStartResponse = z.object({\n authorizationUrl: z.string().url(),\n expiresAt: z.string().datetime({ offset: true }),\n});\nexport type GoogleDriveOAuthStartResponse = z.infer<typeof GoogleDriveOAuthStartResponse>;\n\nexport const GoogleDriveBrowseItem = z.object({\n id: z.string().min(1).max(256),\n name: z.string().min(1).max(1024),\n mimeType: z.string().min(1).max(256),\n kind: z.enum([\"folder\", \"file\"]),\n driveId: z.string().min(1).max(256).nullable(),\n modifiedTime: z.string().datetime({ offset: true }).nullable(),\n size: z.string().regex(/^\\d+$/).nullable(),\n webViewLink: z.string().url().nullable(),\n});\nexport type GoogleDriveBrowseItem = z.infer<typeof GoogleDriveBrowseItem>;\n\nexport const GoogleDriveBrowseResponse = z.object({\n connection: z.lazy(() => ConnectionMetadata),\n parentId: z.string().min(1).max(256),\n current: GoogleDriveBrowseItem.nullable(),\n items: z.array(GoogleDriveBrowseItem),\n nextPageToken: z.string().min(1).max(4096).nullable(),\n incompleteSearch: z.boolean(),\n});\nexport type GoogleDriveBrowseResponse = z.infer<typeof GoogleDriveBrowseResponse>;\n\nexport const SaveGoogleDriveSourceRequest = z.object({\n sources: z\n .array(\n GoogleDriveBrowseItem.pick({\n id: true,\n name: true,\n mimeType: true,\n driveId: true,\n }),\n )\n .max(100)\n .refine((sources) => new Set(sources.map((source) => source.id)).size === sources.length, {\n message: \"Google Drive sources must be unique\",\n }),\n targetScope: GoogleDriveTargetScope,\n syncCadence: GoogleDriveSyncCadence.default(\"hourly\"),\n readPolicy: GoogleDriveReadPolicy.default(\"allow\"),\n});\nexport type SaveGoogleDriveSourceRequest = z.infer<typeof SaveGoogleDriveSourceRequest>;\n"],"mappings":";;;;;;AAAA,SAAS,SAAS;AAIX,IAAM,+BAA+B;AACrC,IAAM,0BAA0B;AAChC,IAAM,0BAA0B;AAChC,IAAM,uCACX;AACK,IAAM,8BACX;AACK,IAAM,+BAA+B;AACrC,IAAM,gCAAgC;AAEtC,IAAM,6BAA6B,EAAE,KAAK;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAcM,SAAS,8BACd,eAC+B;AAC/B,QAAM,UAAU,IAAI,IAAI,aAAa;AACrC,QAAM,eAAe,QAAQ,IAAI,uBAAuB;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