@questionbase/deskfree 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 (52) hide show
  1. package/README.md +129 -0
  2. package/dist/channel.d.ts +3 -0
  3. package/dist/channel.d.ts.map +1 -0
  4. package/dist/channel.js +503 -0
  5. package/dist/channel.js.map +1 -0
  6. package/dist/client.d.ts +148 -0
  7. package/dist/client.d.ts.map +1 -0
  8. package/dist/client.js +255 -0
  9. package/dist/client.js.map +1 -0
  10. package/dist/deliver.d.ts +22 -0
  11. package/dist/deliver.d.ts.map +1 -0
  12. package/dist/deliver.js +350 -0
  13. package/dist/deliver.js.map +1 -0
  14. package/dist/gateway.d.ts +13 -0
  15. package/dist/gateway.d.ts.map +1 -0
  16. package/dist/gateway.js +687 -0
  17. package/dist/gateway.js.map +1 -0
  18. package/dist/index.d.ts +11 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +19 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/llm-definitions.d.ts +116 -0
  23. package/dist/llm-definitions.d.ts.map +1 -0
  24. package/dist/llm-definitions.js +148 -0
  25. package/dist/llm-definitions.js.map +1 -0
  26. package/dist/offline-queue.d.ts +45 -0
  27. package/dist/offline-queue.d.ts.map +1 -0
  28. package/dist/offline-queue.js +109 -0
  29. package/dist/offline-queue.js.map +1 -0
  30. package/dist/paths.d.ts +10 -0
  31. package/dist/paths.d.ts.map +1 -0
  32. package/dist/paths.js +29 -0
  33. package/dist/paths.js.map +1 -0
  34. package/dist/runtime.d.ts +17 -0
  35. package/dist/runtime.d.ts.map +1 -0
  36. package/dist/runtime.js +24 -0
  37. package/dist/runtime.js.map +1 -0
  38. package/dist/tools.d.ts +35 -0
  39. package/dist/tools.d.ts.map +1 -0
  40. package/dist/tools.js +527 -0
  41. package/dist/tools.js.map +1 -0
  42. package/dist/types.d.ts +389 -0
  43. package/dist/types.d.ts.map +1 -0
  44. package/dist/types.js +2 -0
  45. package/dist/types.js.map +1 -0
  46. package/dist/workspace.d.ts +18 -0
  47. package/dist/workspace.d.ts.map +1 -0
  48. package/dist/workspace.js +83 -0
  49. package/dist/workspace.js.map +1 -0
  50. package/openclaw.plugin.json +8 -0
  51. package/package.json +63 -0
  52. package/skills/deskfree/SKILL.md +271 -0
@@ -0,0 +1,148 @@
1
+ import type { ChannelProbeResult, CreateTaskResponse, MessagesResponse, Task, TasksListResponse, WsTicketResponse } from './types';
2
+ /** Enhanced error class for DeskFree API errors with user-friendly messages */
3
+ export declare class DeskFreeError extends Error {
4
+ readonly type: 'network' | 'auth' | 'server' | 'client' | 'timeout' | 'invalid_response';
5
+ readonly statusCode?: number;
6
+ readonly userMessage: string;
7
+ readonly procedure: string;
8
+ constructor(type: DeskFreeError['type'], procedure: string, message: string, userMessage: string, statusCode?: number);
9
+ static fromResponse(response: Response, procedure: string, responseText: string): DeskFreeError;
10
+ static timeout(procedure: string, timeoutMs: number): DeskFreeError;
11
+ static invalidResponse(procedure: string): DeskFreeError;
12
+ static network(procedure: string, originalError: Error): DeskFreeError;
13
+ }
14
+ export declare class DeskFreeClient {
15
+ private botToken;
16
+ private apiUrl;
17
+ private requestTimeoutMs;
18
+ constructor(botToken: string, apiUrl: string, options?: {
19
+ requestTimeoutMs?: number;
20
+ });
21
+ private request;
22
+ /**
23
+ * Validates that a string parameter is non-empty.
24
+ * Catches invalid inputs before they hit the network.
25
+ */
26
+ private requireNonEmpty;
27
+ /**
28
+ * Send a typing indicator to the DeskFree conversation.
29
+ *
30
+ * @param input - Optional parameters including taskId to scope the indicator
31
+ */
32
+ typing(input?: {
33
+ taskId?: string;
34
+ }): Promise<void>;
35
+ /**
36
+ * Send a text message (with optional attachments) to a DeskFree conversation.
37
+ *
38
+ * @param input - Message content, optional userId, taskId, and attachments
39
+ */
40
+ sendMessage(input: {
41
+ userId?: string;
42
+ content: string;
43
+ taskId?: string;
44
+ attachments?: Array<{
45
+ s3Key: string;
46
+ name: string;
47
+ contentType: string;
48
+ size: number;
49
+ }>;
50
+ }): Promise<void>;
51
+ /** Fetch paginated message history for a conversation. */
52
+ listMessages(input: {
53
+ userId?: string;
54
+ cursor?: string | null;
55
+ limit?: number;
56
+ }): Promise<MessagesResponse>;
57
+ /** Obtain a one-time WebSocket authentication ticket for real-time notifications. */
58
+ getWsTicket(): Promise<WsTicketResponse>;
59
+ /** Create a new task, optionally with a recurring schedule. */
60
+ createTask(input: {
61
+ title: string;
62
+ instructions?: string;
63
+ isRecurring?: boolean;
64
+ recurringSchedule?: {
65
+ frequency: 'daily' | 'weekly' | 'biweekly' | 'monthly';
66
+ dayOfWeek?: number;
67
+ dayOfMonth?: number;
68
+ time: string;
69
+ timezone?: string;
70
+ };
71
+ }): Promise<CreateTaskResponse>;
72
+ /** Snooze a task until a given ISO-8601 datetime. */
73
+ snoozeTask(input: {
74
+ taskId: string;
75
+ snoozedUntil: string;
76
+ }): Promise<Task>;
77
+ /** Unsnooze a previously snoozed task, making it active again. */
78
+ unsnoozeTask(input: {
79
+ taskId: string;
80
+ }): Promise<Task>;
81
+ /** List tasks, optionally filtered by status. */
82
+ listTasks(input?: {
83
+ status?: string;
84
+ }): Promise<TasksListResponse>;
85
+ /** Claim a task so the bot can begin working on it. */
86
+ claimTask(input: {
87
+ taskId: string;
88
+ }): Promise<Task>;
89
+ /** Release a previously claimed task back to the queue. */
90
+ releaseTask(input: {
91
+ taskId: string;
92
+ }): Promise<Task>;
93
+ /** Submit a task for human review, optionally with a comment. */
94
+ requestReview(input: {
95
+ taskId: string;
96
+ comment?: string;
97
+ }): Promise<Task>;
98
+ /** Update the deliverable (markdown content) for a task. */
99
+ updateDeliverable(input: {
100
+ taskId: string;
101
+ deliverable: string;
102
+ }): Promise<void>;
103
+ /** Fetch a single task by ID. */
104
+ getTask(input: {
105
+ taskId: string;
106
+ }): Promise<Task>;
107
+ /** Send an agent status update to DeskFree. */
108
+ statusUpdate(input: {
109
+ status: 'idle' | 'working' | 'responding';
110
+ activeSubAgents: Array<{
111
+ label: string;
112
+ status: 'running' | 'completed' | 'failed';
113
+ startedAt: string;
114
+ completedAt?: string;
115
+ tokenUsage?: number;
116
+ task?: string;
117
+ }>;
118
+ model?: string;
119
+ lastActivity?: string;
120
+ pluginVersion?: string;
121
+ openclawVersion?: string;
122
+ }): Promise<{
123
+ success: boolean;
124
+ }>;
125
+ /** Get short-lived AWS credentials for S3 workspace access. */
126
+ workspaceCredentials(): Promise<{
127
+ accessKeyId: string;
128
+ secretAccessKey: string;
129
+ sessionToken: string;
130
+ expiration: Date;
131
+ }>;
132
+ /** Notify DeskFree that workspace files have changed locally. */
133
+ workspaceRead(input: {
134
+ path: string;
135
+ }): Promise<{
136
+ path: string;
137
+ content: string;
138
+ lastModified: string;
139
+ }>;
140
+ /**
141
+ * Lightweight health check that verifies connectivity and authentication.
142
+ *
143
+ * @param timeoutMs - Maximum time to wait for the probe response
144
+ * @returns Probe result indicating success or a descriptive error
145
+ */
146
+ probe(timeoutMs: number): Promise<ChannelProbeResult>;
147
+ }
148
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,IAAI,EACJ,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AASjB,+EAA+E;AAC/E,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAgB,IAAI,EAChB,SAAS,GACT,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,kBAAkB,CAAC;IACvB,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpC,SAAgB,WAAW,EAAE,MAAM,CAAC;IACpC,SAAgB,SAAS,EAAE,MAAM,CAAC;gBAGhC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,EAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,WAA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CAAC;KACd,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IAIpE;;;;;OAKG;IACG,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAmD5D"}
package/dist/client.js ADDED
@@ -0,0 +1,255 @@
1
+ /**
2
+ * HTTP client for the DeskFree bot API.
3
+ * All endpoints use tRPC via HTTP POST/GET.
4
+ */
5
+ /** Default timeout for API requests (30 seconds). */
6
+ const DEFAULT_REQUEST_TIMEOUT_MS = 30_000;
7
+ /** Enhanced error class for DeskFree API errors with user-friendly messages */
8
+ export class DeskFreeError extends Error {
9
+ type;
10
+ statusCode;
11
+ userMessage;
12
+ procedure;
13
+ constructor(type, procedure, message, userMessage, statusCode) {
14
+ super(message);
15
+ this.name = 'DeskFreeError';
16
+ this.type = type;
17
+ this.procedure = procedure;
18
+ this.userMessage = userMessage;
19
+ this.statusCode = statusCode;
20
+ }
21
+ static fromResponse(response, procedure, responseText) {
22
+ const status = response.status;
23
+ const statusText = response.statusText;
24
+ if (status === 401) {
25
+ return new DeskFreeError('auth', procedure, `Authentication failed: ${status} ${statusText} — ${responseText}`, 'Your bot token is invalid or has expired. Please check your authentication credentials.', status);
26
+ }
27
+ if (status === 403) {
28
+ return new DeskFreeError('auth', procedure, `Authorization failed: ${status} ${statusText} — ${responseText}`, 'Your bot does not have permission to perform this action. Contact your administrator.', status);
29
+ }
30
+ if (status >= 500) {
31
+ return new DeskFreeError('server', procedure, `Server error: ${status} ${statusText} — ${responseText}`, 'DeskFree service is temporarily unavailable. Please try again in a few minutes.', status);
32
+ }
33
+ if (status === 429) {
34
+ return new DeskFreeError('client', procedure, `Rate limit exceeded: ${status} ${statusText} — ${responseText}`, 'Too many requests. Please wait a moment before trying again.', status);
35
+ }
36
+ if (status === 400) {
37
+ return new DeskFreeError('client', procedure, `Bad request: ${status} ${statusText} — ${responseText}`, 'The request was invalid. Please check your input and try again.', status);
38
+ }
39
+ return new DeskFreeError('client', procedure, `HTTP error: ${status} ${statusText} — ${responseText}`, `Request failed with error ${status}. Please try again or contact support if the problem persists.`, status);
40
+ }
41
+ static timeout(procedure, timeoutMs) {
42
+ return new DeskFreeError('timeout', procedure, `Request to ${procedure} timed out after ${timeoutMs}ms`, 'The request took too long to complete. Please check your network connection and try again.');
43
+ }
44
+ static invalidResponse(procedure) {
45
+ return new DeskFreeError('invalid_response', procedure, `Invalid tRPC response structure for ${procedure}`, 'Received an unexpected response from the server. Please try again or contact support.');
46
+ }
47
+ static network(procedure, originalError) {
48
+ return new DeskFreeError('network', procedure, `Network error for ${procedure}: ${originalError.message}`, 'Unable to connect to DeskFree. Please check your internet connection and try again.');
49
+ }
50
+ }
51
+ export class DeskFreeClient {
52
+ botToken;
53
+ apiUrl;
54
+ requestTimeoutMs;
55
+ constructor(botToken, apiUrl, options) {
56
+ this.botToken = botToken;
57
+ this.apiUrl = apiUrl.replace(/\/$/, '');
58
+ this.requestTimeoutMs =
59
+ options?.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
60
+ }
61
+ async request(method, procedure, input) {
62
+ const url = method === 'GET' && input
63
+ ? `${this.apiUrl}/${procedure}?input=${encodeURIComponent(JSON.stringify(input))}`
64
+ : `${this.apiUrl}/${procedure}`;
65
+ const controller = new AbortController();
66
+ const timer = setTimeout(() => controller.abort(), this.requestTimeoutMs);
67
+ try {
68
+ const response = await fetch(url, {
69
+ method,
70
+ headers: {
71
+ Authorization: `Bot ${this.botToken}`,
72
+ 'Content-Type': 'application/json',
73
+ },
74
+ body: method === 'POST' ? JSON.stringify(input) : undefined,
75
+ signal: controller.signal,
76
+ });
77
+ if (!response.ok) {
78
+ const text = await response.text().catch((err) => {
79
+ const errMsg = err instanceof Error ? err.message : String(err);
80
+ return `(failed to read response body: ${errMsg})`;
81
+ });
82
+ throw DeskFreeError.fromResponse(response, procedure, text);
83
+ }
84
+ const json = (await response.json());
85
+ // Validate tRPC response structure
86
+ if (!json.result || json.result.data === undefined) {
87
+ throw DeskFreeError.invalidResponse(procedure);
88
+ }
89
+ return json.result.data;
90
+ }
91
+ catch (err) {
92
+ if (err instanceof DeskFreeError) {
93
+ throw err;
94
+ }
95
+ if (err instanceof Error && err.name === 'AbortError') {
96
+ throw DeskFreeError.timeout(procedure, this.requestTimeoutMs);
97
+ }
98
+ if (err instanceof Error) {
99
+ // Network or other fetch errors
100
+ throw DeskFreeError.network(procedure, err);
101
+ }
102
+ throw err;
103
+ }
104
+ finally {
105
+ clearTimeout(timer);
106
+ }
107
+ }
108
+ /**
109
+ * Validates that a string parameter is non-empty.
110
+ * Catches invalid inputs before they hit the network.
111
+ */
112
+ requireNonEmpty(value, name) {
113
+ if (!value || value.trim() === '') {
114
+ throw new DeskFreeError('client', name, `${name} is required and cannot be empty`, `Missing required parameter: ${name}. Please provide a valid value.`);
115
+ }
116
+ }
117
+ /**
118
+ * Send a typing indicator to the DeskFree conversation.
119
+ *
120
+ * @param input - Optional parameters including taskId to scope the indicator
121
+ */
122
+ async typing(input) {
123
+ return this.request('POST', 'messages.typing', input ?? {});
124
+ }
125
+ /**
126
+ * Send a text message (with optional attachments) to a DeskFree conversation.
127
+ *
128
+ * @param input - Message content, optional userId, taskId, and attachments
129
+ */
130
+ async sendMessage(input) {
131
+ this.requireNonEmpty(input.content, 'content');
132
+ return this.request('POST', 'messages.send', input);
133
+ }
134
+ /** Fetch paginated message history for a conversation. */
135
+ async listMessages(input) {
136
+ if (input.limit !== undefined && (input.limit < 1 || input.limit > 100)) {
137
+ throw new DeskFreeError('client', 'limit', 'limit must be between 1 and 100', 'The limit parameter must be between 1 and 100.');
138
+ }
139
+ return this.request('GET', 'messages.list', input);
140
+ }
141
+ /** Obtain a one-time WebSocket authentication ticket for real-time notifications. */
142
+ async getWsTicket() {
143
+ return this.request('POST', 'messages.wsTicket', {});
144
+ }
145
+ /** Create a new task, optionally with a recurring schedule. */
146
+ async createTask(input) {
147
+ this.requireNonEmpty(input.title, 'title');
148
+ return this.request('POST', 'tasks.create', input);
149
+ }
150
+ /** Snooze a task until a given ISO-8601 datetime. */
151
+ async snoozeTask(input) {
152
+ this.requireNonEmpty(input.taskId, 'taskId');
153
+ this.requireNonEmpty(input.snoozedUntil, 'snoozedUntil');
154
+ return this.request('POST', 'tasks.snooze', input);
155
+ }
156
+ /** Unsnooze a previously snoozed task, making it active again. */
157
+ async unsnoozeTask(input) {
158
+ this.requireNonEmpty(input.taskId, 'taskId');
159
+ return this.request('POST', 'tasks.unsnooze', input);
160
+ }
161
+ /** List tasks, optionally filtered by status. */
162
+ async listTasks(input) {
163
+ return this.request('GET', 'tasks.list', input ?? {});
164
+ }
165
+ /** Claim a task so the bot can begin working on it. */
166
+ async claimTask(input) {
167
+ this.requireNonEmpty(input.taskId, 'taskId');
168
+ return this.request('POST', 'tasks.claim', input);
169
+ }
170
+ /** Release a previously claimed task back to the queue. */
171
+ async releaseTask(input) {
172
+ this.requireNonEmpty(input.taskId, 'taskId');
173
+ return this.request('POST', 'tasks.release', input);
174
+ }
175
+ /** Submit a task for human review, optionally with a comment. */
176
+ async requestReview(input) {
177
+ this.requireNonEmpty(input.taskId, 'taskId');
178
+ return this.request('POST', 'tasks.requestReview', input);
179
+ }
180
+ /** Update the deliverable (markdown content) for a task. */
181
+ async updateDeliverable(input) {
182
+ this.requireNonEmpty(input.taskId, 'taskId');
183
+ this.requireNonEmpty(input.deliverable, 'deliverable');
184
+ return this.request('POST', 'tasks.updateDeliverable', input);
185
+ }
186
+ /** Fetch a single task by ID. */
187
+ async getTask(input) {
188
+ this.requireNonEmpty(input.taskId, 'taskId');
189
+ return this.request('GET', 'tasks.get', input);
190
+ }
191
+ /** Send an agent status update to DeskFree. */
192
+ async statusUpdate(input) {
193
+ return this.request('POST', 'agent.statusUpdate', input);
194
+ }
195
+ /** Get short-lived AWS credentials for S3 workspace access. */
196
+ async workspaceCredentials() {
197
+ return this.request('POST', 'workspace.credentials', {});
198
+ }
199
+ /** Notify DeskFree that workspace files have changed locally. */
200
+ async workspaceRead(input) {
201
+ return this.request('GET', 'workspace.read', input);
202
+ }
203
+ /**
204
+ * Lightweight health check that verifies connectivity and authentication.
205
+ *
206
+ * @param timeoutMs - Maximum time to wait for the probe response
207
+ * @returns Probe result indicating success or a descriptive error
208
+ */
209
+ async probe(timeoutMs) {
210
+ const controller = new AbortController();
211
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
212
+ try {
213
+ const response = await fetch(`${this.apiUrl}/tasks.list?input=${encodeURIComponent(JSON.stringify({ limit: 1 }))}`, {
214
+ method: 'GET',
215
+ headers: {
216
+ Authorization: `Bot ${this.botToken}`,
217
+ 'Content-Type': 'application/json',
218
+ },
219
+ signal: controller.signal,
220
+ });
221
+ if (!response.ok) {
222
+ // Provide more user-friendly probe error messages
223
+ if (response.status === 401 || response.status === 403) {
224
+ return {
225
+ ok: false,
226
+ error: 'Authentication failed - check bot token',
227
+ };
228
+ }
229
+ if (response.status >= 500) {
230
+ return { ok: false, error: 'DeskFree server unavailable' };
231
+ }
232
+ return {
233
+ ok: false,
234
+ error: `HTTP ${response.status} - ${response.statusText}`,
235
+ };
236
+ }
237
+ return { ok: true };
238
+ }
239
+ catch (err) {
240
+ if (err instanceof Error && err.name === 'AbortError') {
241
+ return { ok: false, error: `Connection timeout after ${timeoutMs}ms` };
242
+ }
243
+ const message = err instanceof Error ? err.message : String(err);
244
+ // Simplify network errors for probe results
245
+ if (message.includes('fetch')) {
246
+ return { ok: false, error: 'Network connection failed' };
247
+ }
248
+ return { ok: false, error: message };
249
+ }
250
+ finally {
251
+ clearTimeout(timer);
252
+ }
253
+ }
254
+ }
255
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,qDAAqD;AACrD,MAAM,0BAA0B,GAAG,MAAM,CAAC;A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AE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,2BAA2B,EAAE,CAAC;YAC3D,CAAC;YAED,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;QACvC,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,22 @@
1
+ import { DeskFreeClient } from './client';
2
+ import type { ChannelGatewayContext, ChatMessage } from './types';
3
+ /**
4
+ * Validates if a content type is safe to download.
5
+ */
6
+ export declare function isContentTypeAllowed(contentType: string): boolean;
7
+ /**
8
+ * Sanitizes a filename to prevent directory traversal and other security issues.
9
+ */
10
+ export declare function sanitizeFileName(fileName: string): string;
11
+ /**
12
+ * Validates a URL to ensure it's a proper HTTPS URL.
13
+ */
14
+ export declare function validateDownloadUrl(url: string): void;
15
+ /**
16
+ * Delivers a DeskFree chat message to the OpenClaw agent pipeline.
17
+ *
18
+ * Each message produces a single inbound message.
19
+ * If the message has a taskId, it's set as ThreadId for conversation threading.
20
+ */
21
+ export declare function deliverMessageToAgent(ctx: ChannelGatewayContext, message: ChatMessage, client: DeskFreeClient): Promise<void>;
22
+ //# sourceMappingURL=deliver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deliver.d.ts","sourceRoot":"","sources":["../src/deliver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAI1C,OAAO,KAAK,EACV,qBAAqB,EACrB,WAAW,EAGZ,MAAM,SAAS,CAAC;AAuCjB;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAKjE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMzD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CA4CrD;AAyKD;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,qBAAqB,EAC1B,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,IAAI,CAAC,CAoJf"}