@elizaos/cli 1.2.11-beta.9 → 1.3.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-3LVXQ7VC.js → chunk-2ALAPQLV.js} +3 -7
- package/dist/{chunk-TVVBQLSH.js → chunk-2CUIHNPL.js} +34 -1
- package/dist/{chunk-NS5R6Z74.js → chunk-I77ZRNYO.js} +2 -2
- package/dist/commands/agent/actions/index.js +1 -1
- package/dist/commands/agent/index.js +1 -1
- package/dist/commands/create/actions/index.js +2 -2
- package/dist/commands/create/index.js +3 -3
- package/dist/index.js +39 -6
- package/dist/{registry-NSUZGLOY.js → registry-N626N4VG.js} +1 -1
- package/dist/templates/plugin-quick-starter/package.json +1 -1
- package/dist/templates/plugin-quick-starter/src/plugin.ts +1 -1
- package/dist/templates/plugin-starter/CLAUDE.md +465 -0
- package/dist/templates/plugin-starter/dist/assets/{index-DUtsQhKX.js → index-D1cHX53P.js} +1 -1
- package/dist/templates/plugin-starter/dist/index.html +1 -1
- package/dist/templates/plugin-starter/package.json +1 -1
- package/dist/templates/project-starter/CLAUDE.md +698 -0
- package/dist/templates/project-starter/package.json +4 -4
- package/dist/templates/project-tee-starter/package.json +3 -3
- package/dist/{utils-TV5USNZM.js → utils-H66532NB.js} +1 -1
- package/package.json +5 -5
- package/templates/plugin-quick-starter/package.json +2 -2
- package/templates/plugin-quick-starter/src/plugin.ts +1 -1
- package/templates/plugin-starter/CLAUDE.md +465 -0
- package/templates/plugin-starter/dist/.vite/manifest.json +1 -1
- package/templates/plugin-starter/dist/assets/{index-DUtsQhKX.js → index-D1cHX53P.js} +1 -1
- package/templates/plugin-starter/dist/index.html +1 -1
- package/templates/plugin-starter/package.json +2 -2
- package/templates/project-starter/CLAUDE.md +698 -0
- package/templates/project-starter/package.json +5 -5
- package/templates/project-tee-starter/package.json +4 -4
- package/dist/templates/plugin-quick-starter/dist/index.js +0 -195
- package/dist/templates/plugin-quick-starter/dist/index.js.map +0 -1
- package/templates/plugin-quick-starter/dist/index.d.ts +0 -13
- package/templates/plugin-quick-starter/dist/index.js +0 -195
- package/templates/plugin-quick-starter/dist/index.js.map +0 -1
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
# ElizaOS Plugin Development Guide for Claude
|
|
2
|
+
|
|
3
|
+
> **Optimized for Claude LLM** - Complete reference for building ElizaOS plugins
|
|
4
|
+
|
|
5
|
+
## 📋 Project Overview
|
|
6
|
+
|
|
7
|
+
| Property | Value |
|
|
8
|
+
| ------------------- | --------------------- |
|
|
9
|
+
| **Project Type** | ElizaOS Plugin |
|
|
10
|
+
| **Package Manager** | `bun` (REQUIRED) |
|
|
11
|
+
| **Language** | TypeScript (Required) |
|
|
12
|
+
| **Testing** | Bun test |
|
|
13
|
+
| **Runtime** | ElizaOS Agent Runtime |
|
|
14
|
+
|
|
15
|
+
## 🏗️ Plugin Architecture
|
|
16
|
+
|
|
17
|
+
ElizaOS plugins follow a **component-based architecture** with four main types:
|
|
18
|
+
|
|
19
|
+
### 🔄 **Services** (Required for External APIs)
|
|
20
|
+
|
|
21
|
+
**Purpose:** Handle stateful operations and external integrations
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
export class ExampleService extends Service {
|
|
25
|
+
static serviceType = 'example';
|
|
26
|
+
private apiClient: ExternalAPI;
|
|
27
|
+
|
|
28
|
+
constructor() {
|
|
29
|
+
super();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async initialize(runtime: IAgentRuntime): Promise<void> {
|
|
33
|
+
// Initialize SDK connections, databases, etc.
|
|
34
|
+
this.apiClient = new ExternalAPI(process.env.API_KEY);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async processData(data: any): Promise<any> {
|
|
38
|
+
// Your business logic here
|
|
39
|
+
return await this.apiClient.process(data);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Services are for:**
|
|
45
|
+
|
|
46
|
+
- ✅ API connections and SDK management
|
|
47
|
+
- ✅ Database operations
|
|
48
|
+
- ✅ State management
|
|
49
|
+
- ✅ Authentication handling
|
|
50
|
+
- ❌ NOT for simple data formatting (use Providers)
|
|
51
|
+
|
|
52
|
+
### ⚡ **Actions** (Required for User Interactions)
|
|
53
|
+
|
|
54
|
+
**Purpose:** Handle user commands and generate responses
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { Action, ActionResult } from '@elizaos/core';
|
|
58
|
+
|
|
59
|
+
export const exampleAction: Action = {
|
|
60
|
+
name: 'EXAMPLE_ACTION',
|
|
61
|
+
description: 'Processes user requests for example functionality',
|
|
62
|
+
|
|
63
|
+
validate: async (runtime: IAgentRuntime, message: Memory) => {
|
|
64
|
+
const text = message.content.text.toLowerCase();
|
|
65
|
+
return text.includes('example') || text.includes('demo');
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
handler: async (runtime, message, state, options, callback): Promise<ActionResult> => {
|
|
69
|
+
try {
|
|
70
|
+
const service = runtime.getService<ExampleService>('example');
|
|
71
|
+
const result = await service.processData(message.content);
|
|
72
|
+
|
|
73
|
+
await callback({
|
|
74
|
+
text: `Here's your result: ${result}`,
|
|
75
|
+
action: 'EXAMPLE_ACTION',
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
success: true,
|
|
80
|
+
text: `Successfully processed: ${result}`,
|
|
81
|
+
values: {
|
|
82
|
+
lastProcessed: result,
|
|
83
|
+
processedAt: Date.now(),
|
|
84
|
+
},
|
|
85
|
+
data: {
|
|
86
|
+
actionName: 'EXAMPLE_ACTION',
|
|
87
|
+
result,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
} catch (error) {
|
|
91
|
+
await callback({
|
|
92
|
+
text: 'I encountered an error processing your request.',
|
|
93
|
+
error: true,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
success: false,
|
|
98
|
+
text: 'Failed to process request',
|
|
99
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
100
|
+
data: {
|
|
101
|
+
actionName: 'EXAMPLE_ACTION',
|
|
102
|
+
errorMessage: error instanceof Error ? error.message : 'Unknown error',
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Actions handle:**
|
|
111
|
+
|
|
112
|
+
- ✅ User input validation
|
|
113
|
+
- ✅ Command parsing and routing
|
|
114
|
+
- ✅ Service coordination
|
|
115
|
+
- ✅ Response generation
|
|
116
|
+
- ❌ NOT direct API calls (use Services)
|
|
117
|
+
|
|
118
|
+
**Important: Callbacks vs ActionResult:**
|
|
119
|
+
|
|
120
|
+
- **`callback()`** → Sends messages to the user in chat
|
|
121
|
+
- **`ActionResult` return** → Passes data/state to next action in chain
|
|
122
|
+
- Both are used together: callback for user communication, return for action chaining
|
|
123
|
+
|
|
124
|
+
### 📊 **Providers** (Optional - Context Supply)
|
|
125
|
+
|
|
126
|
+
**Purpose:** Supply read-only contextual information
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
export const exampleProvider: Provider = {
|
|
130
|
+
get: async (runtime: IAgentRuntime, message: Memory) => {
|
|
131
|
+
const service = runtime.getService<ExampleService>('example');
|
|
132
|
+
const status = await service.getStatus();
|
|
133
|
+
|
|
134
|
+
return `Current system status: ${status.state}
|
|
135
|
+
Available features: ${status.features.join(', ')}
|
|
136
|
+
Last updated: ${status.timestamp}`;
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Providers supply:**
|
|
142
|
+
|
|
143
|
+
- ✅ Formatted contextual data
|
|
144
|
+
- ✅ Real-time information
|
|
145
|
+
- ✅ System state summaries
|
|
146
|
+
- ❌ NOT for state modification
|
|
147
|
+
|
|
148
|
+
### 🧠 **Evaluators** (Optional - Post-Processing)
|
|
149
|
+
|
|
150
|
+
**Purpose:** Learn from interactions and analyze outcomes
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
export const exampleEvaluator: Evaluator = {
|
|
154
|
+
name: 'EXAMPLE_EVALUATOR',
|
|
155
|
+
|
|
156
|
+
evaluate: async (runtime: IAgentRuntime, message: Memory, state?: any) => {
|
|
157
|
+
// Analyze the interaction outcome
|
|
158
|
+
const success = state?.lastActionSuccess || false;
|
|
159
|
+
|
|
160
|
+
if (success) {
|
|
161
|
+
// Store successful patterns
|
|
162
|
+
await runtime.addMemory({
|
|
163
|
+
content: { text: 'Successful example interaction pattern' },
|
|
164
|
+
type: 'learning',
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return { success, confidence: 0.8 };
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## 📁 Project Structure
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
src/
|
|
177
|
+
├── 📂 actions/ # User command handlers
|
|
178
|
+
│ ├── exampleAction.ts
|
|
179
|
+
│ └── index.ts
|
|
180
|
+
├── 📂 services/ # External integrations (REQUIRED)
|
|
181
|
+
│ ├── ExampleService.ts
|
|
182
|
+
│ └── index.ts
|
|
183
|
+
├── 📂 providers/ # Context suppliers (optional)
|
|
184
|
+
│ ├── exampleProvider.ts
|
|
185
|
+
│ └── index.ts
|
|
186
|
+
├── 📂 evaluators/ # Learning components (optional)
|
|
187
|
+
│ ├── exampleEvaluator.ts
|
|
188
|
+
│ └── index.ts
|
|
189
|
+
├── 📂 types/ # TypeScript definitions
|
|
190
|
+
│ └── index.ts
|
|
191
|
+
├── 📄 index.ts # Plugin export
|
|
192
|
+
└── 📄 package.json # Dependencies and metadata
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## 📦 Plugin Export Pattern
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
// src/index.ts
|
|
199
|
+
import { Plugin } from '@elizaos/core';
|
|
200
|
+
import { ExampleService } from './services';
|
|
201
|
+
import { exampleAction } from './actions';
|
|
202
|
+
import { exampleProvider } from './providers';
|
|
203
|
+
import { exampleEvaluator } from './evaluators';
|
|
204
|
+
|
|
205
|
+
export const plugin: Plugin = {
|
|
206
|
+
name: 'example-plugin',
|
|
207
|
+
description: 'Demonstrates ElizaOS plugin patterns',
|
|
208
|
+
|
|
209
|
+
// Core components
|
|
210
|
+
services: [ExampleService],
|
|
211
|
+
actions: [exampleAction],
|
|
212
|
+
|
|
213
|
+
// Optional components
|
|
214
|
+
providers: [exampleProvider],
|
|
215
|
+
evaluators: [exampleEvaluator],
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
export default plugin;
|
|
219
|
+
|
|
220
|
+
// Re-export components for external use
|
|
221
|
+
export { ExampleService } from './services';
|
|
222
|
+
export * from './types';
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## 🚀 Development Workflow
|
|
226
|
+
|
|
227
|
+
### Quick Start Commands
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
# Install dependencies
|
|
231
|
+
bun install
|
|
232
|
+
|
|
233
|
+
# Start development with hot reload
|
|
234
|
+
elizaos dev
|
|
235
|
+
|
|
236
|
+
# Run tests
|
|
237
|
+
bun test
|
|
238
|
+
|
|
239
|
+
# Build for production
|
|
240
|
+
bun run build
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### 🧪 Testing Your Plugin
|
|
244
|
+
|
|
245
|
+
#### **Method 1: Dev Mode (Recommended)**
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
elizaos dev
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
This automatically:
|
|
252
|
+
|
|
253
|
+
- Loads your plugin from current directory
|
|
254
|
+
- Creates a test character with your plugin
|
|
255
|
+
- Starts interactive chat interface
|
|
256
|
+
- Enables hot reloading
|
|
257
|
+
|
|
258
|
+
#### **Method 2: Unit Testing**
|
|
259
|
+
|
|
260
|
+
```typescript
|
|
261
|
+
// tests/actions.test.ts
|
|
262
|
+
import { describe, it, expect } from 'bun:test';
|
|
263
|
+
import { exampleAction } from '../src/actions';
|
|
264
|
+
|
|
265
|
+
describe('ExampleAction', () => {
|
|
266
|
+
it('validates trigger words correctly', async () => {
|
|
267
|
+
const mockMessage = {
|
|
268
|
+
content: { text: 'show me an example' },
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
const isValid = await exampleAction.validate(mockRuntime, mockMessage);
|
|
272
|
+
|
|
273
|
+
expect(isValid).toBe(true);
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## 🎯 Best Practices
|
|
279
|
+
|
|
280
|
+
### ✅ **DO**
|
|
281
|
+
|
|
282
|
+
- **Use Services for APIs**: All external calls go through services
|
|
283
|
+
- **Validate User Input**: Always validate in action handlers
|
|
284
|
+
- **Handle Errors Gracefully**: Provide meaningful error messages
|
|
285
|
+
- **Follow TypeScript**: Use strict typing throughout
|
|
286
|
+
- **Test Thoroughly**: Write tests for core functionality
|
|
287
|
+
|
|
288
|
+
### ❌ **DON'T**
|
|
289
|
+
|
|
290
|
+
- **API Calls in Actions**: Use services instead
|
|
291
|
+
- **State in Providers**: Keep providers read-only
|
|
292
|
+
- **Parse Input in Evaluators**: Use actions for input handling
|
|
293
|
+
- **Hardcode Credentials**: Use environment variables
|
|
294
|
+
- **Skip Error Handling**: Always handle potential failures
|
|
295
|
+
|
|
296
|
+
### 🔧 **Common Patterns**
|
|
297
|
+
|
|
298
|
+
#### Error Handling Pattern
|
|
299
|
+
|
|
300
|
+
```typescript
|
|
301
|
+
export const robustAction: Action = {
|
|
302
|
+
name: 'ROBUST_ACTION',
|
|
303
|
+
description: 'Demonstrates robust error handling',
|
|
304
|
+
|
|
305
|
+
validate: async (runtime: IAgentRuntime, message: Memory) => {
|
|
306
|
+
// Validate user input before processing
|
|
307
|
+
const text = message.content.text.toLowerCase();
|
|
308
|
+
return text.includes('process') || text.includes('execute');
|
|
309
|
+
},
|
|
310
|
+
|
|
311
|
+
handler: async (runtime, message, state, options, callback): Promise<ActionResult> => {
|
|
312
|
+
try {
|
|
313
|
+
const service = runtime.getService<YourService>('yourService');
|
|
314
|
+
if (!service) {
|
|
315
|
+
throw new Error('Service not available');
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
const result = await service.performOperation();
|
|
319
|
+
|
|
320
|
+
await callback({
|
|
321
|
+
text: `Operation completed: ${result}`,
|
|
322
|
+
action: 'ROBUST_ACTION',
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
return {
|
|
326
|
+
success: true,
|
|
327
|
+
text: `Successfully completed operation`,
|
|
328
|
+
values: {
|
|
329
|
+
operationResult: result,
|
|
330
|
+
processedAt: Date.now(),
|
|
331
|
+
},
|
|
332
|
+
data: {
|
|
333
|
+
actionName: 'ROBUST_ACTION',
|
|
334
|
+
result,
|
|
335
|
+
},
|
|
336
|
+
};
|
|
337
|
+
} catch (error) {
|
|
338
|
+
console.error(`Action failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
339
|
+
|
|
340
|
+
await callback({
|
|
341
|
+
text: "I'm sorry, I couldn't complete that request. Please try again.",
|
|
342
|
+
error: true,
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
return {
|
|
346
|
+
success: false,
|
|
347
|
+
text: 'Failed to complete operation',
|
|
348
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
349
|
+
data: {
|
|
350
|
+
actionName: 'ROBUST_ACTION',
|
|
351
|
+
errorMessage: error instanceof Error ? error.message : String(error),
|
|
352
|
+
},
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
};
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
#### Service Initialization Pattern
|
|
360
|
+
|
|
361
|
+
```typescript
|
|
362
|
+
export class RobustService extends Service {
|
|
363
|
+
private client: ExternalClient;
|
|
364
|
+
private isInitialized = false;
|
|
365
|
+
|
|
366
|
+
async initialize(runtime: IAgentRuntime): Promise<void> {
|
|
367
|
+
try {
|
|
368
|
+
this.client = new ExternalClient({
|
|
369
|
+
apiKey: process.env.EXTERNAL_API_KEY,
|
|
370
|
+
timeout: 30000,
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
await this.client.authenticate();
|
|
374
|
+
this.isInitialized = true;
|
|
375
|
+
|
|
376
|
+
console.log('Service initialized successfully');
|
|
377
|
+
} catch (error) {
|
|
378
|
+
console.error('Service initialization failed:', error);
|
|
379
|
+
throw error;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
private ensureInitialized(): void {
|
|
384
|
+
if (!this.isInitialized) {
|
|
385
|
+
throw new Error('Service not initialized');
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
async performOperation(): Promise<any> {
|
|
390
|
+
this.ensureInitialized();
|
|
391
|
+
return await this.client.operation();
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
## 🐛 Debugging Guide
|
|
397
|
+
|
|
398
|
+
### Environment Variables
|
|
399
|
+
|
|
400
|
+
```bash
|
|
401
|
+
# Enable detailed logging
|
|
402
|
+
LOG_LEVEL=debug elizaos dev
|
|
403
|
+
|
|
404
|
+
# Test specific components
|
|
405
|
+
elizaos test --filter "action-name"
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
### Common Issues & Solutions
|
|
409
|
+
|
|
410
|
+
| Issue | Cause | Solution |
|
|
411
|
+
| ----------------------- | ------------------------------ | ---------------------------- |
|
|
412
|
+
| "Service not found" | Service not registered | Add to plugin services array |
|
|
413
|
+
| "Action not triggering" | Validation function too strict | Check validate() logic |
|
|
414
|
+
| "Provider not updating" | Provider has state | Make provider stateless |
|
|
415
|
+
| "Memory errors" | Database connection issues | Check database adapter setup |
|
|
416
|
+
|
|
417
|
+
## 📋 Package.json Template
|
|
418
|
+
|
|
419
|
+
```json
|
|
420
|
+
{
|
|
421
|
+
"name": "@your-org/elizaos-plugin-example",
|
|
422
|
+
"version": "1.0.0",
|
|
423
|
+
"description": "ElizaOS plugin for example functionality",
|
|
424
|
+
"type": "module",
|
|
425
|
+
"main": "dist/index.js",
|
|
426
|
+
"types": "dist/index.d.ts",
|
|
427
|
+
"files": ["dist"],
|
|
428
|
+
|
|
429
|
+
"scripts": {
|
|
430
|
+
"build": "bun run build:types && bun run build:js",
|
|
431
|
+
"build:types": "tsc",
|
|
432
|
+
"build:js": "bun build src/index.ts --outdir dist",
|
|
433
|
+
"test": "bun test",
|
|
434
|
+
"dev": "elizaos dev"
|
|
435
|
+
},
|
|
436
|
+
|
|
437
|
+
"peerDependencies": {
|
|
438
|
+
"@elizaos/core": "*"
|
|
439
|
+
},
|
|
440
|
+
|
|
441
|
+
"devDependencies": {
|
|
442
|
+
"@types/bun": "latest",
|
|
443
|
+
"typescript": "^5.0.0"
|
|
444
|
+
},
|
|
445
|
+
|
|
446
|
+
"keywords": ["elizaos", "plugin", "ai-agent"]
|
|
447
|
+
}
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
## 🎯 Final Checklist
|
|
451
|
+
|
|
452
|
+
Before publishing your plugin:
|
|
453
|
+
|
|
454
|
+
- [ ] All services have proper initialization
|
|
455
|
+
- [ ] Actions validate user input correctly
|
|
456
|
+
- [ ] Error handling covers edge cases
|
|
457
|
+
- [ ] Tests pass for core functionality
|
|
458
|
+
- [ ] TypeScript compiles without errors
|
|
459
|
+
- [ ] Plugin exports are correct
|
|
460
|
+
- [ ] Documentation is complete
|
|
461
|
+
- [ ] Environment variables are documented
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
**🎉 Ready to build your ElizaOS plugin!** Start with the dev mode and iterate based on real testing.
|
|
@@ -6,7 +6,7 @@ var Dd=f=>{throw TypeError(f)};var cs=(f,i,o)=>i.has(f)||Dd("Cannot "+o);var v=(
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var zd;function xv(){if(zd)return gn;zd=1;var f=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function o(r,E,z){var H=null;if(z!==void 0&&(H=""+z),E.key!==void 0&&(H=""+E.key),"key"in E){z={};for(var C in E)C!=="key"&&(z[C]=E[C])}else z=E;return E=z.ref,{$$typeof:f,type:r,key:H,ref:E!==void 0?E:null,props:z}}return gn.Fragment=i,gn.jsx=o,gn.jsxs=o,gn}var Rd;function Bv(){return Rd||(Rd=1,fs.exports=xv()),fs.exports}var _t=Bv(),Dn=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(f){return this.listeners.add(f),this.onSubscribe(),()=>{this.listeners.delete(f),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Eu=typeof window>"u"||"Deno"in globalThis;function oe(){}function Yv(f,i){return typeof f=="function"?f(i):f}function vs(f){return typeof f=="number"&&f>=0&&f!==1/0}function ly(f,i){return Math.max(f+(i||0)-Date.now(),0)}function wl(f,i){return typeof f=="function"?f(i):f}function Ce(f,i){return typeof f=="function"?f(i):f}function _d(f,i){const{type:o="all",exact:r,fetchStatus:E,predicate:z,queryKey:H,stale:C}=f;if(H){if(r){if(i.queryHash!==Rs(H,i.options))return!1}else if(!En(i.queryKey,H))return!1}if(o!=="all"){const _=i.isActive();if(o==="active"&&!_||o==="inactive"&&_)return!1}return!(typeof C=="boolean"&&i.isStale()!==C||E&&E!==i.state.fetchStatus||z&&!z(i))}function Ud(f,i){const{exact:o,status:r,predicate:E,mutationKey:z}=f;if(z){if(!i.options.mutationKey)return!1;if(o){if(pn(i.options.mutationKey)!==pn(z))return!1}else if(!En(i.options.mutationKey,z))return!1}return!(r&&i.state.status!==r||E&&!E(i))}function Rs(f,i){return((i==null?void 0:i.queryKeyHashFn)||pn)(f)}function pn(f){return JSON.stringify(f,(i,o)=>gs(o)?Object.keys(o).sort().reduce((r,E)=>(r[E]=o[E],r),{}):o)}function En(f,i){return f===i?!0:typeof f!=typeof i?!1:f&&i&&typeof f=="object"&&typeof i=="object"?Object.keys(i).every(o=>En(f[o],i[o])):!1}function uy(f,i){if(f===i)return f;const o=Hd(f)&&Hd(i);if(o||gs(f)&&gs(i)){const r=o?f:Object.keys(f),E=r.length,z=o?i:Object.keys(i),H=z.length,C=o?[]:{},_=new Set(r);let T=0;for(let U=0;U<H;U++){const Q=o?U:z[U];(!o&&_.has(Q)||o)&&f[Q]===void 0&&i[Q]===void 0?(C[Q]=void 0,T++):(C[Q]=uy(f[Q],i[Q]),C[Q]===f[Q]&&f[Q]!==void 0&&T++)}return E===H&&T===E?f:C}return i}function ms(f,i){if(!i||Object.keys(f).length!==Object.keys(i).length)return!1;for(const o in f)if(f[o]!==i[o])return!1;return!0}function Hd(f){return Array.isArray(f)&&f.length===Object.keys(f).length}function gs(f){if(!Nd(f))return!1;const i=f.constructor;if(i===void 0)return!0;const o=i.prototype;return!(!Nd(o)||!o.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(f)!==Object.prototype)}function Nd(f){return Object.prototype.toString.call(f)==="[object Object]"}function jv(f){return new Promise(i=>{setTimeout(i,f)})}function Ss(f,i,o){return typeof o.structuralSharing=="function"?o.structuralSharing(f,i):o.structuralSharing!==!1?uy(f,i):i}function Gv(f,i,o=0){const r=[...f,i];return o&&r.length>o?r.slice(1):r}function Xv(f,i,o=0){const r=[i,...f];return o&&r.length>o?r.slice(0,-1):r}var _s=Symbol();function ay(f,i){return!f.queryFn&&(i!=null&&i.initialPromise)?()=>i.initialPromise:!f.queryFn||f.queryFn===_s?()=>Promise.reject(new Error(`Missing queryFn: '${f.queryHash}'`)):f.queryFn}function Zv(f,i){return typeof f=="function"?f(...i):!!f}var hu,Yl,ca,Jd,Lv=(Jd=class extends Dn{constructor(){super();W(this,hu);W(this,Yl);W(this,ca);Y(this,ca,i=>{if(!Eu&&window.addEventListener){const o=()=>i();return window.addEventListener("visibilitychange",o,!1),()=>{window.removeEventListener("visibilitychange",o)}}})}onSubscribe(){v(this,Yl)||this.setEventListener(v(this,ca))}onUnsubscribe(){var i;this.hasListeners()||((i=v(this,Yl))==null||i.call(this),Y(this,Yl,void 0))}setEventListener(i){var o;Y(this,ca,i),(o=v(this,Yl))==null||o.call(this),Y(this,Yl,i(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(i){v(this,hu)!==i&&(Y(this,hu,i),this.onFocus())}onFocus(){const i=this.isFocused();this.listeners.forEach(o=>{o(i)})}isFocused(){var i;return typeof v(this,hu)=="boolean"?v(this,hu):((i=globalThis.document)==null?void 0:i.visibilityState)!=="hidden"}},hu=new WeakMap,Yl=new WeakMap,ca=new WeakMap,Jd),Us=new Lv,fa,jl,sa,Fd,Vv=(Fd=class extends Dn{constructor(){super();W(this,fa,!0);W(this,jl);W(this,sa);Y(this,sa,i=>{if(!Eu&&window.addEventListener){const o=()=>i(!0),r=()=>i(!1);return window.addEventListener("online",o,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",o),window.removeEventListener("offline",r)}}})}onSubscribe(){v(this,jl)||this.setEventListener(v(this,sa))}onUnsubscribe(){var i;this.hasListeners()||((i=v(this,jl))==null||i.call(this),Y(this,jl,void 0))}setEventListener(i){var o;Y(this,sa,i),(o=v(this,jl))==null||o.call(this),Y(this,jl,i(this.setOnline.bind(this)))}setOnline(i){v(this,fa)!==i&&(Y(this,fa,i),this.listeners.forEach(r=>{r(i)}))}isOnline(){return v(this,fa)}},fa=new WeakMap,jl=new WeakMap,sa=new WeakMap,Fd),Vi=new Vv;function bs(){let f,i;const o=new Promise((E,z)=>{f=E,i=z});o.status="pending",o.catch(()=>{});function r(E){Object.assign(o,E),delete o.resolve,delete o.reject}return o.resolve=E=>{r({status:"fulfilled",value:E}),f(E)},o.reject=E=>{r({status:"rejected",reason:E}),i(E)},o}function Kv(f){return Math.min(1e3*2**f,3e4)}function ny(f){return(f??"online")==="online"?Vi.isOnline():!0}var iy=class extends Error{constructor(f){super("CancelledError"),this.revert=f==null?void 0:f.revert,this.silent=f==null?void 0:f.silent}};function ss(f){return f instanceof iy}function cy(f){let i=!1,o=0,r=!1,E;const z=bs(),H=L=>{var X;r||(x(new iy(L)),(X=f.abort)==null||X.call(f))},C=()=>{i=!0},_=()=>{i=!1},T=()=>Us.isFocused()&&(f.networkMode==="always"||Vi.isOnline())&&f.canRun(),U=()=>ny(f.networkMode)&&f.canRun(),Q=L=>{var X;r||(r=!0,(X=f.onSuccess)==null||X.call(f,L),E==null||E(),z.resolve(L))},x=L=>{var X;r||(r=!0,(X=f.onError)==null||X.call(f,L),E==null||E(),z.reject(L))},Z=()=>new Promise(L=>{var X;E=dt=>{(r||T())&&L(dt)},(X=f.onPause)==null||X.call(f)}).then(()=>{var L;E=void 0,r||(L=f.onContinue)==null||L.call(f)}),I=()=>{if(r)return;let L;const X=o===0?f.initialPromise:void 0;try{L=X??f.fn()}catch(dt){L=Promise.reject(dt)}Promise.resolve(L).then(Q).catch(dt=>{var Dt;if(r)return;const Mt=f.retry??(Eu?0:3),tt=f.retryDelay??Kv,yt=typeof tt=="function"?tt(o,dt):tt,$=Mt===!0||typeof Mt=="number"&&o<Mt||typeof Mt=="function"&&Mt(o,dt);if(i||!$){x(dt);return}o++,(Dt=f.onFail)==null||Dt.call(f,o,dt),jv(yt).then(()=>T()?void 0:Z()).then(()=>{i?x(dt):I()})})};return{promise:z,cancel:H,continue:()=>(E==null||E(),z),cancelRetry:C,continueRetry:_,canStart:U,start:()=>(U()?I():Z().then(I),z)}}var wv=f=>setTimeout(f,0);function Jv(){let f=[],i=0,o=C=>{C()},r=C=>{C()},E=wv;const z=C=>{i?f.push(C):E(()=>{o(C)})},H=()=>{const C=f;f=[],C.length&&E(()=>{r(()=>{C.forEach(_=>{o(_)})})})};return{batch:C=>{let _;i++;try{_=C()}finally{i--,i||H()}return _},batchCalls:C=>(..._)=>{z(()=>{C(..._)})},schedule:z,setNotifyFunction:C=>{o=C},setBatchNotifyFunction:C=>{r=C},setScheduler:C=>{E=C}}}var $t=Jv(),du,Wd,fy=(Wd=class{constructor(){W(this,du)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),vs(this.gcTime)&&Y(this,du,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(f){this.gcTime=Math.max(this.gcTime||0,f??(Eu?1/0:5*60*1e3))}clearGcTimeout(){v(this,du)&&(clearTimeout(v(this,du)),Y(this,du,void 0))}},du=new WeakMap,Wd),ra,yu,qe,vu,ee,Tn,mu,Ye,rl,$d,Fv=($d=class extends fy{constructor(i){super();W(this,Ye);W(this,ra);W(this,yu);W(this,qe);W(this,vu);W(this,ee);W(this,Tn);W(this,mu);Y(this,mu,!1),Y(this,Tn,i.defaultOptions),this.setOptions(i.options),this.observers=[],Y(this,vu,i.client),Y(this,qe,v(this,vu).getQueryCache()),this.queryKey=i.queryKey,this.queryHash=i.queryHash,Y(this,ra,Wv(this.options)),this.state=i.state??v(this,ra),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var i;return(i=v(this,ee))==null?void 0:i.promise}setOptions(i){this.options={...v(this,Tn),...i},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&v(this,qe).remove(this)}setData(i,o){const r=Ss(this.state.data,i,this.options);return nt(this,Ye,rl).call(this,{data:r,type:"success",dataUpdatedAt:o==null?void 0:o.updatedAt,manual:o==null?void 0:o.manual}),r}setState(i,o){nt(this,Ye,rl).call(this,{type:"setState",state:i,setStateOptions:o})}cancel(i){var r,E;const o=(r=v(this,ee))==null?void 0:r.promise;return(E=v(this,ee))==null||E.cancel(i),o?o.then(oe).catch(oe):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(v(this,ra))}isActive(){return this.observers.some(i=>Ce(i.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===_s||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(i=>wl(i.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(i=>i.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(i=0){return this.state.data===void 0?!0:i==="static"?!1:this.state.isInvalidated?!0:!ly(this.state.dataUpdatedAt,i)}onFocus(){var o;const i=this.observers.find(r=>r.shouldFetchOnWindowFocus());i==null||i.refetch({cancelRefetch:!1}),(o=v(this,ee))==null||o.continue()}onOnline(){var o;const i=this.observers.find(r=>r.shouldFetchOnReconnect());i==null||i.refetch({cancelRefetch:!1}),(o=v(this,ee))==null||o.continue()}addObserver(i){this.observers.includes(i)||(this.observers.push(i),this.clearGcTimeout(),v(this,qe).notify({type:"observerAdded",query:this,observer:i}))}removeObserver(i){this.observers.includes(i)&&(this.observers=this.observers.filter(o=>o!==i),this.observers.length||(v(this,ee)&&(v(this,mu)?v(this,ee).cancel({revert:!0}):v(this,ee).cancelRetry()),this.scheduleGc()),v(this,qe).notify({type:"observerRemoved",query:this,observer:i}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||nt(this,Ye,rl).call(this,{type:"invalidate"})}fetch(i,o){var T,U,Q;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(o!=null&&o.cancelRefetch))this.cancel({silent:!0});else if(v(this,ee))return v(this,ee).continueRetry(),v(this,ee).promise}if(i&&this.setOptions(i),!this.options.queryFn){const x=this.observers.find(Z=>Z.options.queryFn);x&&this.setOptions(x.options)}const r=new AbortController,E=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(Y(this,mu,!0),r.signal)})},z=()=>{const x=ay(this.options,o),I=(()=>{const L={client:v(this,vu),queryKey:this.queryKey,meta:this.meta};return E(L),L})();return Y(this,mu,!1),this.options.persister?this.options.persister(x,I,this):x(I)},C=(()=>{const x={fetchOptions:o,options:this.options,queryKey:this.queryKey,client:v(this,vu),state:this.state,fetchFn:z};return E(x),x})();(T=this.options.behavior)==null||T.onFetch(C,this),Y(this,yu,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((U=C.fetchOptions)==null?void 0:U.meta))&&nt(this,Ye,rl).call(this,{type:"fetch",meta:(Q=C.fetchOptions)==null?void 0:Q.meta});const _=x=>{var Z,I,L,X;ss(x)&&x.silent||nt(this,Ye,rl).call(this,{type:"error",error:x}),ss(x)||((I=(Z=v(this,qe).config).onError)==null||I.call(Z,x,this),(X=(L=v(this,qe).config).onSettled)==null||X.call(L,this.state.data,x,this)),this.scheduleGc()};return Y(this,ee,cy({initialPromise:o==null?void 0:o.initialPromise,fn:C.fetchFn,abort:r.abort.bind(r),onSuccess:x=>{var Z,I,L,X;if(x===void 0){_(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(x)}catch(dt){_(dt);return}(I=(Z=v(this,qe).config).onSuccess)==null||I.call(Z,x,this),(X=(L=v(this,qe).config).onSettled)==null||X.call(L,x,this.state.error,this),this.scheduleGc()},onError:_,onFail:(x,Z)=>{nt(this,Ye,rl).call(this,{type:"failed",failureCount:x,error:Z})},onPause:()=>{nt(this,Ye,rl).call(this,{type:"pause"})},onContinue:()=>{nt(this,Ye,rl).call(this,{type:"continue"})},retry:C.options.retry,retryDelay:C.options.retryDelay,networkMode:C.options.networkMode,canRun:()=>!0})),v(this,ee).start()}},ra=new WeakMap,yu=new WeakMap,qe=new WeakMap,vu=new WeakMap,ee=new WeakMap,Tn=new WeakMap,mu=new WeakMap,Ye=new WeakSet,rl=function(i){const o=r=>{switch(i.type){case"failed":return{...r,fetchFailureCount:i.failureCount,fetchFailureReason:i.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...sy(r.data,this.options),fetchMeta:i.meta??null};case"success":return Y(this,yu,void 0),{...r,data:i.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:i.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!i.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const E=i.error;return ss(E)&&E.revert&&v(this,yu)?{...v(this,yu),fetchStatus:"idle"}:{...r,error:E,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:E,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...i.state}}};this.state=o(this.state),$t.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),v(this,qe).notify({query:this,type:"updated",action:i})})},$d);function sy(f,i){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ny(i.networkMode)?"fetching":"paused",...f===void 0&&{error:null,status:"pending"}}}function Wv(f){const i=typeof f.initialData=="function"?f.initialData():f.initialData,o=i!==void 0,r=o?typeof f.initialDataUpdatedAt=="function"?f.initialDataUpdatedAt():f.initialDataUpdatedAt:0;return{data:i,dataUpdateCount:0,dataUpdatedAt:o?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:o?"success":"pending",fetchStatus:"idle"}}var we,kd,$v=(kd=class extends Dn{constructor(i={}){super();W(this,we);this.config=i,Y(this,we,new Map)}build(i,o,r){const E=o.queryKey,z=o.queryHash??Rs(E,o);let H=this.get(z);return H||(H=new Fv({client:i,queryKey:E,queryHash:z,options:i.defaultQueryOptions(o),state:r,defaultOptions:i.getQueryDefaults(E)}),this.add(H)),H}add(i){v(this,we).has(i.queryHash)||(v(this,we).set(i.queryHash,i),this.notify({type:"added",query:i}))}remove(i){const o=v(this,we).get(i.queryHash);o&&(i.destroy(),o===i&&v(this,we).delete(i.queryHash),this.notify({type:"removed",query:i}))}clear(){$t.batch(()=>{this.getAll().forEach(i=>{this.remove(i)})})}get(i){return v(this,we).get(i)}getAll(){return[...v(this,we).values()]}find(i){const o={exact:!0,...i};return this.getAll().find(r=>_d(o,r))}findAll(i={}){const o=this.getAll();return Object.keys(i).length>0?o.filter(r=>_d(i,r)):o}notify(i){$t.batch(()=>{this.listeners.forEach(o=>{o(i)})})}onFocus(){$t.batch(()=>{this.getAll().forEach(i=>{i.onFocus()})})}onOnline(){$t.batch(()=>{this.getAll().forEach(i=>{i.onOnline()})})}},we=new WeakMap,kd),Je,ue,gu,Fe,Bl,Pd,kv=(Pd=class extends fy{constructor(i){super();W(this,Fe);W(this,Je);W(this,ue);W(this,gu);this.mutationId=i.mutationId,Y(this,ue,i.mutationCache),Y(this,Je,[]),this.state=i.state||Pv(),this.setOptions(i.options),this.scheduleGc()}setOptions(i){this.options=i,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(i){v(this,Je).includes(i)||(v(this,Je).push(i),this.clearGcTimeout(),v(this,ue).notify({type:"observerAdded",mutation:this,observer:i}))}removeObserver(i){Y(this,Je,v(this,Je).filter(o=>o!==i)),this.scheduleGc(),v(this,ue).notify({type:"observerRemoved",mutation:this,observer:i})}optionalRemove(){v(this,Je).length||(this.state.status==="pending"?this.scheduleGc():v(this,ue).remove(this))}continue(){var i;return((i=v(this,gu))==null?void 0:i.continue())??this.execute(this.state.variables)}async execute(i){var z,H,C,_,T,U,Q,x,Z,I,L,X,dt,Mt,tt,yt,$,Dt,jt,vt;const o=()=>{nt(this,Fe,Bl).call(this,{type:"continue"})};Y(this,gu,cy({fn:()=>this.options.mutationFn?this.options.mutationFn(i):Promise.reject(new Error("No mutationFn found")),onFail:(ft,Et)=>{nt(this,Fe,Bl).call(this,{type:"failed",failureCount:ft,error:Et})},onPause:()=>{nt(this,Fe,Bl).call(this,{type:"pause"})},onContinue:o,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>v(this,ue).canRun(this)}));const r=this.state.status==="pending",E=!v(this,gu).canStart();try{if(r)o();else{nt(this,Fe,Bl).call(this,{type:"pending",variables:i,isPaused:E}),await((H=(z=v(this,ue).config).onMutate)==null?void 0:H.call(z,i,this));const Et=await((_=(C=this.options).onMutate)==null?void 0:_.call(C,i));Et!==this.state.context&&nt(this,Fe,Bl).call(this,{type:"pending",context:Et,variables:i,isPaused:E})}const ft=await v(this,gu).start();return await((U=(T=v(this,ue).config).onSuccess)==null?void 0:U.call(T,ft,i,this.state.context,this)),await((x=(Q=this.options).onSuccess)==null?void 0:x.call(Q,ft,i,this.state.context)),await((I=(Z=v(this,ue).config).onSettled)==null?void 0:I.call(Z,ft,null,this.state.variables,this.state.context,this)),await((X=(L=this.options).onSettled)==null?void 0:X.call(L,ft,null,i,this.state.context)),nt(this,Fe,Bl).call(this,{type:"success",data:ft}),ft}catch(ft){try{throw await((Mt=(dt=v(this,ue).config).onError)==null?void 0:Mt.call(dt,ft,i,this.state.context,this)),await((yt=(tt=this.options).onError)==null?void 0:yt.call(tt,ft,i,this.state.context)),await((Dt=($=v(this,ue).config).onSettled)==null?void 0:Dt.call($,void 0,ft,this.state.variables,this.state.context,this)),await((vt=(jt=this.options).onSettled)==null?void 0:vt.call(jt,void 0,ft,i,this.state.context)),ft}finally{nt(this,Fe,Bl).call(this,{type:"error",error:ft})}}finally{v(this,ue).runNext(this)}}},Je=new WeakMap,ue=new WeakMap,gu=new WeakMap,Fe=new WeakSet,Bl=function(i){const o=r=>{switch(i.type){case"failed":return{...r,failureCount:i.failureCount,failureReason:i.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:i.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:i.isPaused,status:"pending",variables:i.variables,submittedAt:Date.now()};case"success":return{...r,data:i.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:i.error,failureCount:r.failureCount+1,failureReason:i.error,isPaused:!1,status:"error"}}};this.state=o(this.state),$t.batch(()=>{v(this,Je).forEach(r=>{r.onMutationUpdate(i)}),v(this,ue).notify({mutation:this,type:"updated",action:i})})},Pd);function Pv(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ol,je,On,Id,Iv=(Id=class extends Dn{constructor(i={}){super();W(this,ol);W(this,je);W(this,On);this.config=i,Y(this,ol,new Set),Y(this,je,new Map),Y(this,On,0)}build(i,o,r){const E=new kv({mutationCache:this,mutationId:++Zi(this,On)._,options:i.defaultMutationOptions(o),state:r});return this.add(E),E}add(i){v(this,ol).add(i);const o=Li(i);if(typeof o=="string"){const r=v(this,je).get(o);r?r.push(i):v(this,je).set(o,[i])}this.notify({type:"added",mutation:i})}remove(i){if(v(this,ol).delete(i)){const o=Li(i);if(typeof o=="string"){const r=v(this,je).get(o);if(r)if(r.length>1){const E=r.indexOf(i);E!==-1&&r.splice(E,1)}else r[0]===i&&v(this,je).delete(o)}}this.notify({type:"removed",mutation:i})}canRun(i){const o=Li(i);if(typeof o=="string"){const r=v(this,je).get(o),E=r==null?void 0:r.find(z=>z.state.status==="pending");return!E||E===i}else return!0}runNext(i){var r;const o=Li(i);if(typeof o=="string"){const E=(r=v(this,je).get(o))==null?void 0:r.find(z=>z!==i&&z.state.isPaused);return(E==null?void 0:E.continue())??Promise.resolve()}else return Promise.resolve()}clear(){$t.batch(()=>{v(this,ol).forEach(i=>{this.notify({type:"removed",mutation:i})}),v(this,ol).clear(),v(this,je).clear()})}getAll(){return Array.from(v(this,ol))}find(i){const o={exact:!0,...i};return this.getAll().find(r=>Ud(o,r))}findAll(i={}){return this.getAll().filter(o=>Ud(i,o))}notify(i){$t.batch(()=>{this.listeners.forEach(o=>{o(i)})})}resumePausedMutations(){const i=this.getAll().filter(o=>o.state.isPaused);return $t.batch(()=>Promise.all(i.map(o=>o.continue().catch(oe))))}},ol=new WeakMap,je=new WeakMap,On=new WeakMap,Id);function Li(f){var i;return(i=f.options.scope)==null?void 0:i.id}function qd(f){return{onFetch:(i,o)=>{var U,Q,x,Z,I;const r=i.options,E=(x=(Q=(U=i.fetchOptions)==null?void 0:U.meta)==null?void 0:Q.fetchMore)==null?void 0:x.direction,z=((Z=i.state.data)==null?void 0:Z.pages)||[],H=((I=i.state.data)==null?void 0:I.pageParams)||[];let C={pages:[],pageParams:[]},_=0;const T=async()=>{let L=!1;const X=tt=>{Object.defineProperty(tt,"signal",{enumerable:!0,get:()=>(i.signal.aborted?L=!0:i.signal.addEventListener("abort",()=>{L=!0}),i.signal)})},dt=ay(i.options,i.fetchOptions),Mt=async(tt,yt,$)=>{if(L)return Promise.reject();if(yt==null&&tt.pages.length)return Promise.resolve(tt);const jt=(()=>{const wt={client:i.client,queryKey:i.queryKey,pageParam:yt,direction:$?"backward":"forward",meta:i.options.meta};return X(wt),wt})(),vt=await dt(jt),{maxPages:ft}=i.options,Et=$?Xv:Gv;return{pages:Et(tt.pages,vt,ft),pageParams:Et(tt.pageParams,yt,ft)}};if(E&&z.length){const tt=E==="backward",yt=tt?tm:Cd,$={pages:z,pageParams:H},Dt=yt(r,$);C=await Mt($,Dt,tt)}else{const tt=f??z.length;do{const yt=_===0?H[0]??r.initialPageParam:Cd(r,C);if(_>0&&yt==null)break;C=await Mt(C,yt),_++}while(_<tt)}return C};i.options.persister?i.fetchFn=()=>{var L,X;return(X=(L=i.options).persister)==null?void 0:X.call(L,T,{client:i.client,queryKey:i.queryKey,meta:i.options.meta,signal:i.signal},o)}:i.fetchFn=T}}}function Cd(f,{pages:i,pageParams:o}){const r=i.length-1;return i.length>0?f.getNextPageParam(i[r],i,o[r],o):void 0}function tm(f,{pages:i,pageParams:o}){var r;return i.length>0?(r=f.getPreviousPageParam)==null?void 0:r.call(f,i[0],i,o[0],o):void 0}var Ct,Gl,Xl,oa,ha,Zl,da,ya,ty,em=(ty=class{constructor(f={}){W(this,Ct);W(this,Gl);W(this,Xl);W(this,oa);W(this,ha);W(this,Zl);W(this,da);W(this,ya);Y(this,Ct,f.queryCache||new $v),Y(this,Gl,f.mutationCache||new Iv),Y(this,Xl,f.defaultOptions||{}),Y(this,oa,new Map),Y(this,ha,new Map),Y(this,Zl,0)}mount(){Zi(this,Zl)._++,v(this,Zl)===1&&(Y(this,da,Us.subscribe(async f=>{f&&(await this.resumePausedMutations(),v(this,Ct).onFocus())})),Y(this,ya,Vi.subscribe(async f=>{f&&(await this.resumePausedMutations(),v(this,Ct).onOnline())})))}unmount(){var f,i;Zi(this,Zl)._--,v(this,Zl)===0&&((f=v(this,da))==null||f.call(this),Y(this,da,void 0),(i=v(this,ya))==null||i.call(this),Y(this,ya,void 0))}isFetching(f){return v(this,Ct).findAll({...f,fetchStatus:"fetching"}).length}isMutating(f){return v(this,Gl).findAll({...f,status:"pending"}).length}getQueryData(f){var o;const i=this.defaultQueryOptions({queryKey:f});return(o=v(this,Ct).get(i.queryHash))==null?void 0:o.state.data}ensureQueryData(f){const i=this.defaultQueryOptions(f),o=v(this,Ct).build(this,i),r=o.state.data;return r===void 0?this.fetchQuery(f):(f.revalidateIfStale&&o.isStaleByTime(wl(i.staleTime,o))&&this.prefetchQuery(i),Promise.resolve(r))}getQueriesData(f){return v(this,Ct).findAll(f).map(({queryKey:i,state:o})=>{const r=o.data;return[i,r]})}setQueryData(f,i,o){const r=this.defaultQueryOptions({queryKey:f}),E=v(this,Ct).get(r.queryHash),z=E==null?void 0:E.state.data,H=Yv(i,z);if(H!==void 0)return v(this,Ct).build(this,r).setData(H,{...o,manual:!0})}setQueriesData(f,i,o){return $t.batch(()=>v(this,Ct).findAll(f).map(({queryKey:r})=>[r,this.setQueryData(r,i,o)]))}getQueryState(f){var o;const i=this.defaultQueryOptions({queryKey:f});return(o=v(this,Ct).get(i.queryHash))==null?void 0:o.state}removeQueries(f){const i=v(this,Ct);$t.batch(()=>{i.findAll(f).forEach(o=>{i.remove(o)})})}resetQueries(f,i){const o=v(this,Ct);return $t.batch(()=>(o.findAll(f).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...f},i)))}cancelQueries(f,i={}){const o={revert:!0,...i},r=$t.batch(()=>v(this,Ct).findAll(f).map(E=>E.cancel(o)));return Promise.all(r).then(oe).catch(oe)}invalidateQueries(f,i={}){return $t.batch(()=>(v(this,Ct).findAll(f).forEach(o=>{o.invalidate()}),(f==null?void 0:f.refetchType)==="none"?Promise.resolve():this.refetchQueries({...f,type:(f==null?void 0:f.refetchType)??(f==null?void 0:f.type)??"active"},i)))}refetchQueries(f,i={}){const o={...i,cancelRefetch:i.cancelRefetch??!0},r=$t.batch(()=>v(this,Ct).findAll(f).filter(E=>!E.isDisabled()&&!E.isStatic()).map(E=>{let z=E.fetch(void 0,o);return o.throwOnError||(z=z.catch(oe)),E.state.fetchStatus==="paused"?Promise.resolve():z}));return Promise.all(r).then(oe)}fetchQuery(f){const i=this.defaultQueryOptions(f);i.retry===void 0&&(i.retry=!1);const o=v(this,Ct).build(this,i);return o.isStaleByTime(wl(i.staleTime,o))?o.fetch(i):Promise.resolve(o.state.data)}prefetchQuery(f){return this.fetchQuery(f).then(oe).catch(oe)}fetchInfiniteQuery(f){return f.behavior=qd(f.pages),this.fetchQuery(f)}prefetchInfiniteQuery(f){return this.fetchInfiniteQuery(f).then(oe).catch(oe)}ensureInfiniteQueryData(f){return f.behavior=qd(f.pages),this.ensureQueryData(f)}resumePausedMutations(){return Vi.isOnline()?v(this,Gl).resumePausedMutations():Promise.resolve()}getQueryCache(){return v(this,Ct)}getMutationCache(){return v(this,Gl)}getDefaultOptions(){return v(this,Xl)}setDefaultOptions(f){Y(this,Xl,f)}setQueryDefaults(f,i){v(this,oa).set(pn(f),{queryKey:f,defaultOptions:i})}getQueryDefaults(f){const i=[...v(this,oa).values()],o={};return i.forEach(r=>{En(f,r.queryKey)&&Object.assign(o,r.defaultOptions)}),o}setMutationDefaults(f,i){v(this,ha).set(pn(f),{mutationKey:f,defaultOptions:i})}getMutationDefaults(f){const i=[...v(this,ha).values()],o={};return i.forEach(r=>{En(f,r.mutationKey)&&Object.assign(o,r.defaultOptions)}),o}defaultQueryOptions(f){if(f._defaulted)return f;const i={...v(this,Xl).queries,...this.getQueryDefaults(f.queryKey),...f,_defaulted:!0};return i.queryHash||(i.queryHash=Rs(i.queryKey,i)),i.refetchOnReconnect===void 0&&(i.refetchOnReconnect=i.networkMode!=="always"),i.throwOnError===void 0&&(i.throwOnError=!!i.suspense),!i.networkMode&&i.persister&&(i.networkMode="offlineFirst"),i.queryFn===_s&&(i.enabled=!1),i}defaultMutationOptions(f){return f!=null&&f._defaulted?f:{...v(this,Xl).mutations,...(f==null?void 0:f.mutationKey)&&this.getMutationDefaults(f.mutationKey),...f,_defaulted:!0}}clear(){v(this,Ct).clear(),v(this,Gl).clear()}},Ct=new WeakMap,Gl=new WeakMap,Xl=new WeakMap,oa=new WeakMap,ha=new WeakMap,Zl=new WeakMap,da=new WeakMap,ya=new WeakMap,ty),re,it,An,ae,Su,va,Ll,Vl,Mn,ma,ga,bu,pu,Kl,Sa,ht,bn,ps,Es,Ts,Os,As,Ms,Ds,ry,ey,lm=(ey=class extends Dn{constructor(i,o){super();W(this,ht);W(this,re);W(this,it);W(this,An);W(this,ae);W(this,Su);W(this,va);W(this,Ll);W(this,Vl);W(this,Mn);W(this,ma);W(this,ga);W(this,bu);W(this,pu);W(this,Kl);W(this,Sa,new Set);this.options=o,Y(this,re,i),Y(this,Vl,null),Y(this,Ll,bs()),this.options.experimental_prefetchInRender||v(this,Ll).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(o)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(v(this,it).addObserver(this),Qd(v(this,it),this.options)?nt(this,ht,bn).call(this):this.updateResult(),nt(this,ht,Os).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return zs(v(this,it),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return zs(v(this,it),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,nt(this,ht,As).call(this),nt(this,ht,Ms).call(this),v(this,it).removeObserver(this)}setOptions(i){const o=this.options,r=v(this,it);if(this.options=v(this,re).defaultQueryOptions(i),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ce(this.options.enabled,v(this,it))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");nt(this,ht,Ds).call(this),v(this,it).setOptions(this.options),o._defaulted&&!ms(this.options,o)&&v(this,re).getQueryCache().notify({type:"observerOptionsUpdated",query:v(this,it),observer:this});const E=this.hasListeners();E&&xd(v(this,it),r,this.options,o)&&nt(this,ht,bn).call(this),this.updateResult(),E&&(v(this,it)!==r||Ce(this.options.enabled,v(this,it))!==Ce(o.enabled,v(this,it))||wl(this.options.staleTime,v(this,it))!==wl(o.staleTime,v(this,it)))&&nt(this,ht,ps).call(this);const z=nt(this,ht,Es).call(this);E&&(v(this,it)!==r||Ce(this.options.enabled,v(this,it))!==Ce(o.enabled,v(this,it))||z!==v(this,Kl))&&nt(this,ht,Ts).call(this,z)}getOptimisticResult(i){const o=v(this,re).getQueryCache().build(v(this,re),i),r=this.createResult(o,i);return am(this,r)&&(Y(this,ae,r),Y(this,va,this.options),Y(this,Su,v(this,it).state)),r}getCurrentResult(){return v(this,ae)}trackResult(i,o){return new Proxy(i,{get:(r,E)=>(this.trackProp(E),o==null||o(E),Reflect.get(r,E))})}trackProp(i){v(this,Sa).add(i)}getCurrentQuery(){return v(this,it)}refetch({...i}={}){return this.fetch({...i})}fetchOptimistic(i){const o=v(this,re).defaultQueryOptions(i),r=v(this,re).getQueryCache().build(v(this,re),o);return r.fetch().then(()=>this.createResult(r,o))}fetch(i){return nt(this,ht,bn).call(this,{...i,cancelRefetch:i.cancelRefetch??!0}).then(()=>(this.updateResult(),v(this,ae)))}createResult(i,o){var ft;const r=v(this,it),E=this.options,z=v(this,ae),H=v(this,Su),C=v(this,va),T=i!==r?i.state:v(this,An),{state:U}=i;let Q={...U},x=!1,Z;if(o._optimisticResults){const Et=this.hasListeners(),wt=!Et&&Qd(i,o),Ut=Et&&xd(i,r,o,E);(wt||Ut)&&(Q={...Q,...sy(U.data,i.options)}),o._optimisticResults==="isRestoring"&&(Q.fetchStatus="idle")}let{error:I,errorUpdatedAt:L,status:X}=Q;Z=Q.data;let dt=!1;if(o.placeholderData!==void 0&&Z===void 0&&X==="pending"){let Et;z!=null&&z.isPlaceholderData&&o.placeholderData===(C==null?void 0:C.placeholderData)?(Et=z.data,dt=!0):Et=typeof o.placeholderData=="function"?o.placeholderData((ft=v(this,ga))==null?void 0:ft.state.data,v(this,ga)):o.placeholderData,Et!==void 0&&(X="success",Z=Ss(z==null?void 0:z.data,Et,o),x=!0)}if(o.select&&Z!==void 0&&!dt)if(z&&Z===(H==null?void 0:H.data)&&o.select===v(this,Mn))Z=v(this,ma);else try{Y(this,Mn,o.select),Z=o.select(Z),Z=Ss(z==null?void 0:z.data,Z,o),Y(this,ma,Z),Y(this,Vl,null)}catch(Et){Y(this,Vl,Et)}v(this,Vl)&&(I=v(this,Vl),Z=v(this,ma),L=Date.now(),X="error");const Mt=Q.fetchStatus==="fetching",tt=X==="pending",yt=X==="error",$=tt&&Mt,Dt=Z!==void 0,vt={status:X,fetchStatus:Q.fetchStatus,isPending:tt,isSuccess:X==="success",isError:yt,isInitialLoading:$,isLoading:$,data:Z,dataUpdatedAt:Q.dataUpdatedAt,error:I,errorUpdatedAt:L,failureCount:Q.fetchFailureCount,failureReason:Q.fetchFailureReason,errorUpdateCount:Q.errorUpdateCount,isFetched:Q.dataUpdateCount>0||Q.errorUpdateCount>0,isFetchedAfterMount:Q.dataUpdateCount>T.dataUpdateCount||Q.errorUpdateCount>T.errorUpdateCount,isFetching:Mt,isRefetching:Mt&&!tt,isLoadingError:yt&&!Dt,isPaused:Q.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:yt&&Dt,isStale:Hs(i,o),refetch:this.refetch,promise:v(this,Ll),isEnabled:Ce(o.enabled,i)!==!1};if(this.options.experimental_prefetchInRender){const Et=Oe=>{vt.status==="error"?Oe.reject(vt.error):vt.data!==void 0&&Oe.resolve(vt.data)},wt=()=>{const Oe=Y(this,Ll,vt.promise=bs());Et(Oe)},Ut=v(this,Ll);switch(Ut.status){case"pending":i.queryHash===r.queryHash&&Et(Ut);break;case"fulfilled":(vt.status==="error"||vt.data!==Ut.value)&&wt();break;case"rejected":(vt.status!=="error"||vt.error!==Ut.reason)&&wt();break}}return vt}updateResult(){const i=v(this,ae),o=this.createResult(v(this,it),this.options);if(Y(this,Su,v(this,it).state),Y(this,va,this.options),v(this,Su).data!==void 0&&Y(this,ga,v(this,it)),ms(o,i))return;Y(this,ae,o);const r=()=>{if(!i)return!0;const{notifyOnChangeProps:E}=this.options,z=typeof E=="function"?E():E;if(z==="all"||!z&&!v(this,Sa).size)return!0;const H=new Set(z??v(this,Sa));return this.options.throwOnError&&H.add("error"),Object.keys(v(this,ae)).some(C=>{const _=C;return v(this,ae)[_]!==i[_]&&H.has(_)})};nt(this,ht,ry).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&nt(this,ht,Os).call(this)}},re=new WeakMap,it=new WeakMap,An=new WeakMap,ae=new WeakMap,Su=new WeakMap,va=new WeakMap,Ll=new WeakMap,Vl=new WeakMap,Mn=new WeakMap,ma=new WeakMap,ga=new WeakMap,bu=new WeakMap,pu=new WeakMap,Kl=new WeakMap,Sa=new WeakMap,ht=new WeakSet,bn=function(i){nt(this,ht,Ds).call(this);let o=v(this,it).fetch(this.options,i);return i!=null&&i.throwOnError||(o=o.catch(oe)),o},ps=function(){nt(this,ht,As).call(this);const i=wl(this.options.staleTime,v(this,it));if(Eu||v(this,ae).isStale||!vs(i))return;const r=ly(v(this,ae).dataUpdatedAt,i)+1;Y(this,bu,setTimeout(()=>{v(this,ae).isStale||this.updateResult()},r))},Es=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(v(this,it)):this.options.refetchInterval)??!1},Ts=function(i){nt(this,ht,Ms).call(this),Y(this,Kl,i),!(Eu||Ce(this.options.enabled,v(this,it))===!1||!vs(v(this,Kl))||v(this,Kl)===0)&&Y(this,pu,setInterval(()=>{(this.options.refetchIntervalInBackground||Us.isFocused())&&nt(this,ht,bn).call(this)},v(this,Kl)))},Os=function(){nt(this,ht,ps).call(this),nt(this,ht,Ts).call(this,nt(this,ht,Es).call(this))},As=function(){v(this,bu)&&(clearTimeout(v(this,bu)),Y(this,bu,void 0))},Ms=function(){v(this,pu)&&(clearInterval(v(this,pu)),Y(this,pu,void 0))},Ds=function(){const i=v(this,re).getQueryCache().build(v(this,re),this.options);if(i===v(this,it))return;const o=v(this,it);Y(this,it,i),Y(this,An,i.state),this.hasListeners()&&(o==null||o.removeObserver(this),i.addObserver(this))},ry=function(i){$t.batch(()=>{i.listeners&&this.listeners.forEach(o=>{o(v(this,ae))}),v(this,re).getQueryCache().notify({query:v(this,it),type:"observerResultsUpdated"})})},ey);function um(f,i){return Ce(i.enabled,f)!==!1&&f.state.data===void 0&&!(f.state.status==="error"&&i.retryOnMount===!1)}function Qd(f,i){return um(f,i)||f.state.data!==void 0&&zs(f,i,i.refetchOnMount)}function zs(f,i,o){if(Ce(i.enabled,f)!==!1&&wl(i.staleTime,f)!=="static"){const r=typeof o=="function"?o(f):o;return r==="always"||r!==!1&&Hs(f,i)}return!1}function xd(f,i,o,r){return(f!==i||Ce(r.enabled,f)===!1)&&(!o.suspense||f.state.status!=="error")&&Hs(f,o)}function Hs(f,i){return Ce(i.enabled,f)!==!1&&f.isStaleByTime(wl(i.staleTime,f))}function am(f,i){return!ms(f.getCurrentResult(),i)}var rs={exports:{}},P={};/**
|
|
9
|
+
*/var zd;function xv(){if(zd)return gn;zd=1;var f=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function o(r,E,z){var H=null;if(z!==void 0&&(H=""+z),E.key!==void 0&&(H=""+E.key),"key"in E){z={};for(var C in E)C!=="key"&&(z[C]=E[C])}else z=E;return E=z.ref,{$$typeof:f,type:r,key:H,ref:E!==void 0?E:null,props:z}}return gn.Fragment=i,gn.jsx=o,gn.jsxs=o,gn}var Rd;function Bv(){return Rd||(Rd=1,fs.exports=xv()),fs.exports}var _t=Bv(),Dn=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(f){return this.listeners.add(f),this.onSubscribe(),()=>{this.listeners.delete(f),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Eu=typeof window>"u"||"Deno"in globalThis;function oe(){}function Yv(f,i){return typeof f=="function"?f(i):f}function vs(f){return typeof f=="number"&&f>=0&&f!==1/0}function ly(f,i){return Math.max(f+(i||0)-Date.now(),0)}function wl(f,i){return typeof f=="function"?f(i):f}function Ce(f,i){return typeof f=="function"?f(i):f}function _d(f,i){const{type:o="all",exact:r,fetchStatus:E,predicate:z,queryKey:H,stale:C}=f;if(H){if(r){if(i.queryHash!==Rs(H,i.options))return!1}else if(!En(i.queryKey,H))return!1}if(o!=="all"){const _=i.isActive();if(o==="active"&&!_||o==="inactive"&&_)return!1}return!(typeof C=="boolean"&&i.isStale()!==C||E&&E!==i.state.fetchStatus||z&&!z(i))}function Ud(f,i){const{exact:o,status:r,predicate:E,mutationKey:z}=f;if(z){if(!i.options.mutationKey)return!1;if(o){if(pn(i.options.mutationKey)!==pn(z))return!1}else if(!En(i.options.mutationKey,z))return!1}return!(r&&i.state.status!==r||E&&!E(i))}function Rs(f,i){return((i==null?void 0:i.queryKeyHashFn)||pn)(f)}function pn(f){return JSON.stringify(f,(i,o)=>gs(o)?Object.keys(o).sort().reduce((r,E)=>(r[E]=o[E],r),{}):o)}function En(f,i){return f===i?!0:typeof f!=typeof i?!1:f&&i&&typeof f=="object"&&typeof i=="object"?Object.keys(i).every(o=>En(f[o],i[o])):!1}function uy(f,i){if(f===i)return f;const o=Hd(f)&&Hd(i);if(o||gs(f)&&gs(i)){const r=o?f:Object.keys(f),E=r.length,z=o?i:Object.keys(i),H=z.length,C=o?[]:{},_=new Set(r);let T=0;for(let U=0;U<H;U++){const Q=o?U:z[U];(!o&&_.has(Q)||o)&&f[Q]===void 0&&i[Q]===void 0?(C[Q]=void 0,T++):(C[Q]=uy(f[Q],i[Q]),C[Q]===f[Q]&&f[Q]!==void 0&&T++)}return E===H&&T===E?f:C}return i}function ms(f,i){if(!i||Object.keys(f).length!==Object.keys(i).length)return!1;for(const o in f)if(f[o]!==i[o])return!1;return!0}function Hd(f){return Array.isArray(f)&&f.length===Object.keys(f).length}function gs(f){if(!Nd(f))return!1;const i=f.constructor;if(i===void 0)return!0;const o=i.prototype;return!(!Nd(o)||!o.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(f)!==Object.prototype)}function Nd(f){return Object.prototype.toString.call(f)==="[object Object]"}function jv(f){return new Promise(i=>{setTimeout(i,f)})}function Ss(f,i,o){return typeof o.structuralSharing=="function"?o.structuralSharing(f,i):o.structuralSharing!==!1?uy(f,i):i}function Gv(f,i,o=0){const r=[...f,i];return o&&r.length>o?r.slice(1):r}function Xv(f,i,o=0){const r=[i,...f];return o&&r.length>o?r.slice(0,-1):r}var _s=Symbol();function ay(f,i){return!f.queryFn&&(i!=null&&i.initialPromise)?()=>i.initialPromise:!f.queryFn||f.queryFn===_s?()=>Promise.reject(new Error(`Missing queryFn: '${f.queryHash}'`)):f.queryFn}function Zv(f,i){return typeof f=="function"?f(...i):!!f}var hu,Yl,ca,Jd,Lv=(Jd=class extends Dn{constructor(){super();W(this,hu);W(this,Yl);W(this,ca);Y(this,ca,i=>{if(!Eu&&window.addEventListener){const o=()=>i();return window.addEventListener("visibilitychange",o,!1),()=>{window.removeEventListener("visibilitychange",o)}}})}onSubscribe(){v(this,Yl)||this.setEventListener(v(this,ca))}onUnsubscribe(){var i;this.hasListeners()||((i=v(this,Yl))==null||i.call(this),Y(this,Yl,void 0))}setEventListener(i){var o;Y(this,ca,i),(o=v(this,Yl))==null||o.call(this),Y(this,Yl,i(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(i){v(this,hu)!==i&&(Y(this,hu,i),this.onFocus())}onFocus(){const i=this.isFocused();this.listeners.forEach(o=>{o(i)})}isFocused(){var i;return typeof v(this,hu)=="boolean"?v(this,hu):((i=globalThis.document)==null?void 0:i.visibilityState)!=="hidden"}},hu=new WeakMap,Yl=new WeakMap,ca=new WeakMap,Jd),Us=new Lv,fa,jl,sa,Fd,Vv=(Fd=class extends Dn{constructor(){super();W(this,fa,!0);W(this,jl);W(this,sa);Y(this,sa,i=>{if(!Eu&&window.addEventListener){const o=()=>i(!0),r=()=>i(!1);return window.addEventListener("online",o,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",o),window.removeEventListener("offline",r)}}})}onSubscribe(){v(this,jl)||this.setEventListener(v(this,sa))}onUnsubscribe(){var i;this.hasListeners()||((i=v(this,jl))==null||i.call(this),Y(this,jl,void 0))}setEventListener(i){var o;Y(this,sa,i),(o=v(this,jl))==null||o.call(this),Y(this,jl,i(this.setOnline.bind(this)))}setOnline(i){v(this,fa)!==i&&(Y(this,fa,i),this.listeners.forEach(r=>{r(i)}))}isOnline(){return v(this,fa)}},fa=new WeakMap,jl=new WeakMap,sa=new WeakMap,Fd),Vi=new Vv;function bs(){let f,i;const o=new Promise((E,z)=>{f=E,i=z});o.status="pending",o.catch(()=>{});function r(E){Object.assign(o,E),delete o.resolve,delete o.reject}return o.resolve=E=>{r({status:"fulfilled",value:E}),f(E)},o.reject=E=>{r({status:"rejected",reason:E}),i(E)},o}function Kv(f){return Math.min(1e3*2**f,3e4)}function ny(f){return(f??"online")==="online"?Vi.isOnline():!0}var iy=class extends Error{constructor(f){super("CancelledError"),this.revert=f==null?void 0:f.revert,this.silent=f==null?void 0:f.silent}};function ss(f){return f instanceof iy}function cy(f){let i=!1,o=0,r=!1,E;const z=bs(),H=L=>{var X;r||(x(new iy(L)),(X=f.abort)==null||X.call(f))},C=()=>{i=!0},_=()=>{i=!1},T=()=>Us.isFocused()&&(f.networkMode==="always"||Vi.isOnline())&&f.canRun(),U=()=>ny(f.networkMode)&&f.canRun(),Q=L=>{var X;r||(r=!0,(X=f.onSuccess)==null||X.call(f,L),E==null||E(),z.resolve(L))},x=L=>{var X;r||(r=!0,(X=f.onError)==null||X.call(f,L),E==null||E(),z.reject(L))},Z=()=>new Promise(L=>{var X;E=dt=>{(r||T())&&L(dt)},(X=f.onPause)==null||X.call(f)}).then(()=>{var L;E=void 0,r||(L=f.onContinue)==null||L.call(f)}),I=()=>{if(r)return;let L;const X=o===0?f.initialPromise:void 0;try{L=X??f.fn()}catch(dt){L=Promise.reject(dt)}Promise.resolve(L).then(Q).catch(dt=>{var Dt;if(r)return;const Mt=f.retry??(Eu?0:3),tt=f.retryDelay??Kv,yt=typeof tt=="function"?tt(o,dt):tt,$=Mt===!0||typeof Mt=="number"&&o<Mt||typeof Mt=="function"&&Mt(o,dt);if(i||!$){x(dt);return}o++,(Dt=f.onFail)==null||Dt.call(f,o,dt),jv(yt).then(()=>T()?void 0:Z()).then(()=>{i?x(dt):I()})})};return{promise:z,cancel:H,continue:()=>(E==null||E(),z),cancelRetry:C,continueRetry:_,canStart:U,start:()=>(U()?I():Z().then(I),z)}}var wv=f=>setTimeout(f,0);function Jv(){let f=[],i=0,o=C=>{C()},r=C=>{C()},E=wv;const z=C=>{i?f.push(C):E(()=>{o(C)})},H=()=>{const C=f;f=[],C.length&&E(()=>{r(()=>{C.forEach(_=>{o(_)})})})};return{batch:C=>{let _;i++;try{_=C()}finally{i--,i||H()}return _},batchCalls:C=>(..._)=>{z(()=>{C(..._)})},schedule:z,setNotifyFunction:C=>{o=C},setBatchNotifyFunction:C=>{r=C},setScheduler:C=>{E=C}}}var $t=Jv(),du,Wd,fy=(Wd=class{constructor(){W(this,du)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),vs(this.gcTime)&&Y(this,du,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(f){this.gcTime=Math.max(this.gcTime||0,f??(Eu?1/0:300*1e3))}clearGcTimeout(){v(this,du)&&(clearTimeout(v(this,du)),Y(this,du,void 0))}},du=new WeakMap,Wd),ra,yu,qe,vu,ee,Tn,mu,Ye,rl,$d,Fv=($d=class extends fy{constructor(i){super();W(this,Ye);W(this,ra);W(this,yu);W(this,qe);W(this,vu);W(this,ee);W(this,Tn);W(this,mu);Y(this,mu,!1),Y(this,Tn,i.defaultOptions),this.setOptions(i.options),this.observers=[],Y(this,vu,i.client),Y(this,qe,v(this,vu).getQueryCache()),this.queryKey=i.queryKey,this.queryHash=i.queryHash,Y(this,ra,Wv(this.options)),this.state=i.state??v(this,ra),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var i;return(i=v(this,ee))==null?void 0:i.promise}setOptions(i){this.options={...v(this,Tn),...i},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&v(this,qe).remove(this)}setData(i,o){const r=Ss(this.state.data,i,this.options);return nt(this,Ye,rl).call(this,{data:r,type:"success",dataUpdatedAt:o==null?void 0:o.updatedAt,manual:o==null?void 0:o.manual}),r}setState(i,o){nt(this,Ye,rl).call(this,{type:"setState",state:i,setStateOptions:o})}cancel(i){var r,E;const o=(r=v(this,ee))==null?void 0:r.promise;return(E=v(this,ee))==null||E.cancel(i),o?o.then(oe).catch(oe):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(v(this,ra))}isActive(){return this.observers.some(i=>Ce(i.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===_s||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(i=>wl(i.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(i=>i.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(i=0){return this.state.data===void 0?!0:i==="static"?!1:this.state.isInvalidated?!0:!ly(this.state.dataUpdatedAt,i)}onFocus(){var o;const i=this.observers.find(r=>r.shouldFetchOnWindowFocus());i==null||i.refetch({cancelRefetch:!1}),(o=v(this,ee))==null||o.continue()}onOnline(){var o;const i=this.observers.find(r=>r.shouldFetchOnReconnect());i==null||i.refetch({cancelRefetch:!1}),(o=v(this,ee))==null||o.continue()}addObserver(i){this.observers.includes(i)||(this.observers.push(i),this.clearGcTimeout(),v(this,qe).notify({type:"observerAdded",query:this,observer:i}))}removeObserver(i){this.observers.includes(i)&&(this.observers=this.observers.filter(o=>o!==i),this.observers.length||(v(this,ee)&&(v(this,mu)?v(this,ee).cancel({revert:!0}):v(this,ee).cancelRetry()),this.scheduleGc()),v(this,qe).notify({type:"observerRemoved",query:this,observer:i}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||nt(this,Ye,rl).call(this,{type:"invalidate"})}fetch(i,o){var T,U,Q;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(o!=null&&o.cancelRefetch))this.cancel({silent:!0});else if(v(this,ee))return v(this,ee).continueRetry(),v(this,ee).promise}if(i&&this.setOptions(i),!this.options.queryFn){const x=this.observers.find(Z=>Z.options.queryFn);x&&this.setOptions(x.options)}const r=new AbortController,E=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(Y(this,mu,!0),r.signal)})},z=()=>{const x=ay(this.options,o),I=(()=>{const L={client:v(this,vu),queryKey:this.queryKey,meta:this.meta};return E(L),L})();return Y(this,mu,!1),this.options.persister?this.options.persister(x,I,this):x(I)},C=(()=>{const x={fetchOptions:o,options:this.options,queryKey:this.queryKey,client:v(this,vu),state:this.state,fetchFn:z};return E(x),x})();(T=this.options.behavior)==null||T.onFetch(C,this),Y(this,yu,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((U=C.fetchOptions)==null?void 0:U.meta))&&nt(this,Ye,rl).call(this,{type:"fetch",meta:(Q=C.fetchOptions)==null?void 0:Q.meta});const _=x=>{var Z,I,L,X;ss(x)&&x.silent||nt(this,Ye,rl).call(this,{type:"error",error:x}),ss(x)||((I=(Z=v(this,qe).config).onError)==null||I.call(Z,x,this),(X=(L=v(this,qe).config).onSettled)==null||X.call(L,this.state.data,x,this)),this.scheduleGc()};return Y(this,ee,cy({initialPromise:o==null?void 0:o.initialPromise,fn:C.fetchFn,abort:r.abort.bind(r),onSuccess:x=>{var Z,I,L,X;if(x===void 0){_(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(x)}catch(dt){_(dt);return}(I=(Z=v(this,qe).config).onSuccess)==null||I.call(Z,x,this),(X=(L=v(this,qe).config).onSettled)==null||X.call(L,x,this.state.error,this),this.scheduleGc()},onError:_,onFail:(x,Z)=>{nt(this,Ye,rl).call(this,{type:"failed",failureCount:x,error:Z})},onPause:()=>{nt(this,Ye,rl).call(this,{type:"pause"})},onContinue:()=>{nt(this,Ye,rl).call(this,{type:"continue"})},retry:C.options.retry,retryDelay:C.options.retryDelay,networkMode:C.options.networkMode,canRun:()=>!0})),v(this,ee).start()}},ra=new WeakMap,yu=new WeakMap,qe=new WeakMap,vu=new WeakMap,ee=new WeakMap,Tn=new WeakMap,mu=new WeakMap,Ye=new WeakSet,rl=function(i){const o=r=>{switch(i.type){case"failed":return{...r,fetchFailureCount:i.failureCount,fetchFailureReason:i.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...sy(r.data,this.options),fetchMeta:i.meta??null};case"success":return Y(this,yu,void 0),{...r,data:i.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:i.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!i.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const E=i.error;return ss(E)&&E.revert&&v(this,yu)?{...v(this,yu),fetchStatus:"idle"}:{...r,error:E,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:E,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...i.state}}};this.state=o(this.state),$t.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),v(this,qe).notify({query:this,type:"updated",action:i})})},$d);function sy(f,i){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ny(i.networkMode)?"fetching":"paused",...f===void 0&&{error:null,status:"pending"}}}function Wv(f){const i=typeof f.initialData=="function"?f.initialData():f.initialData,o=i!==void 0,r=o?typeof f.initialDataUpdatedAt=="function"?f.initialDataUpdatedAt():f.initialDataUpdatedAt:0;return{data:i,dataUpdateCount:0,dataUpdatedAt:o?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:o?"success":"pending",fetchStatus:"idle"}}var we,kd,$v=(kd=class extends Dn{constructor(i={}){super();W(this,we);this.config=i,Y(this,we,new Map)}build(i,o,r){const E=o.queryKey,z=o.queryHash??Rs(E,o);let H=this.get(z);return H||(H=new Fv({client:i,queryKey:E,queryHash:z,options:i.defaultQueryOptions(o),state:r,defaultOptions:i.getQueryDefaults(E)}),this.add(H)),H}add(i){v(this,we).has(i.queryHash)||(v(this,we).set(i.queryHash,i),this.notify({type:"added",query:i}))}remove(i){const o=v(this,we).get(i.queryHash);o&&(i.destroy(),o===i&&v(this,we).delete(i.queryHash),this.notify({type:"removed",query:i}))}clear(){$t.batch(()=>{this.getAll().forEach(i=>{this.remove(i)})})}get(i){return v(this,we).get(i)}getAll(){return[...v(this,we).values()]}find(i){const o={exact:!0,...i};return this.getAll().find(r=>_d(o,r))}findAll(i={}){const o=this.getAll();return Object.keys(i).length>0?o.filter(r=>_d(i,r)):o}notify(i){$t.batch(()=>{this.listeners.forEach(o=>{o(i)})})}onFocus(){$t.batch(()=>{this.getAll().forEach(i=>{i.onFocus()})})}onOnline(){$t.batch(()=>{this.getAll().forEach(i=>{i.onOnline()})})}},we=new WeakMap,kd),Je,ue,gu,Fe,Bl,Pd,kv=(Pd=class extends fy{constructor(i){super();W(this,Fe);W(this,Je);W(this,ue);W(this,gu);this.mutationId=i.mutationId,Y(this,ue,i.mutationCache),Y(this,Je,[]),this.state=i.state||Pv(),this.setOptions(i.options),this.scheduleGc()}setOptions(i){this.options=i,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(i){v(this,Je).includes(i)||(v(this,Je).push(i),this.clearGcTimeout(),v(this,ue).notify({type:"observerAdded",mutation:this,observer:i}))}removeObserver(i){Y(this,Je,v(this,Je).filter(o=>o!==i)),this.scheduleGc(),v(this,ue).notify({type:"observerRemoved",mutation:this,observer:i})}optionalRemove(){v(this,Je).length||(this.state.status==="pending"?this.scheduleGc():v(this,ue).remove(this))}continue(){var i;return((i=v(this,gu))==null?void 0:i.continue())??this.execute(this.state.variables)}async execute(i){var z,H,C,_,T,U,Q,x,Z,I,L,X,dt,Mt,tt,yt,$,Dt,jt,vt;const o=()=>{nt(this,Fe,Bl).call(this,{type:"continue"})};Y(this,gu,cy({fn:()=>this.options.mutationFn?this.options.mutationFn(i):Promise.reject(new Error("No mutationFn found")),onFail:(ft,Et)=>{nt(this,Fe,Bl).call(this,{type:"failed",failureCount:ft,error:Et})},onPause:()=>{nt(this,Fe,Bl).call(this,{type:"pause"})},onContinue:o,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>v(this,ue).canRun(this)}));const r=this.state.status==="pending",E=!v(this,gu).canStart();try{if(r)o();else{nt(this,Fe,Bl).call(this,{type:"pending",variables:i,isPaused:E}),await((H=(z=v(this,ue).config).onMutate)==null?void 0:H.call(z,i,this));const Et=await((_=(C=this.options).onMutate)==null?void 0:_.call(C,i));Et!==this.state.context&&nt(this,Fe,Bl).call(this,{type:"pending",context:Et,variables:i,isPaused:E})}const ft=await v(this,gu).start();return await((U=(T=v(this,ue).config).onSuccess)==null?void 0:U.call(T,ft,i,this.state.context,this)),await((x=(Q=this.options).onSuccess)==null?void 0:x.call(Q,ft,i,this.state.context)),await((I=(Z=v(this,ue).config).onSettled)==null?void 0:I.call(Z,ft,null,this.state.variables,this.state.context,this)),await((X=(L=this.options).onSettled)==null?void 0:X.call(L,ft,null,i,this.state.context)),nt(this,Fe,Bl).call(this,{type:"success",data:ft}),ft}catch(ft){try{throw await((Mt=(dt=v(this,ue).config).onError)==null?void 0:Mt.call(dt,ft,i,this.state.context,this)),await((yt=(tt=this.options).onError)==null?void 0:yt.call(tt,ft,i,this.state.context)),await((Dt=($=v(this,ue).config).onSettled)==null?void 0:Dt.call($,void 0,ft,this.state.variables,this.state.context,this)),await((vt=(jt=this.options).onSettled)==null?void 0:vt.call(jt,void 0,ft,i,this.state.context)),ft}finally{nt(this,Fe,Bl).call(this,{type:"error",error:ft})}}finally{v(this,ue).runNext(this)}}},Je=new WeakMap,ue=new WeakMap,gu=new WeakMap,Fe=new WeakSet,Bl=function(i){const o=r=>{switch(i.type){case"failed":return{...r,failureCount:i.failureCount,failureReason:i.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:i.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:i.isPaused,status:"pending",variables:i.variables,submittedAt:Date.now()};case"success":return{...r,data:i.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:i.error,failureCount:r.failureCount+1,failureReason:i.error,isPaused:!1,status:"error"}}};this.state=o(this.state),$t.batch(()=>{v(this,Je).forEach(r=>{r.onMutationUpdate(i)}),v(this,ue).notify({mutation:this,type:"updated",action:i})})},Pd);function Pv(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ol,je,On,Id,Iv=(Id=class extends Dn{constructor(i={}){super();W(this,ol);W(this,je);W(this,On);this.config=i,Y(this,ol,new Set),Y(this,je,new Map),Y(this,On,0)}build(i,o,r){const E=new kv({mutationCache:this,mutationId:++Zi(this,On)._,options:i.defaultMutationOptions(o),state:r});return this.add(E),E}add(i){v(this,ol).add(i);const o=Li(i);if(typeof o=="string"){const r=v(this,je).get(o);r?r.push(i):v(this,je).set(o,[i])}this.notify({type:"added",mutation:i})}remove(i){if(v(this,ol).delete(i)){const o=Li(i);if(typeof o=="string"){const r=v(this,je).get(o);if(r)if(r.length>1){const E=r.indexOf(i);E!==-1&&r.splice(E,1)}else r[0]===i&&v(this,je).delete(o)}}this.notify({type:"removed",mutation:i})}canRun(i){const o=Li(i);if(typeof o=="string"){const r=v(this,je).get(o),E=r==null?void 0:r.find(z=>z.state.status==="pending");return!E||E===i}else return!0}runNext(i){var r;const o=Li(i);if(typeof o=="string"){const E=(r=v(this,je).get(o))==null?void 0:r.find(z=>z!==i&&z.state.isPaused);return(E==null?void 0:E.continue())??Promise.resolve()}else return Promise.resolve()}clear(){$t.batch(()=>{v(this,ol).forEach(i=>{this.notify({type:"removed",mutation:i})}),v(this,ol).clear(),v(this,je).clear()})}getAll(){return Array.from(v(this,ol))}find(i){const o={exact:!0,...i};return this.getAll().find(r=>Ud(o,r))}findAll(i={}){return this.getAll().filter(o=>Ud(i,o))}notify(i){$t.batch(()=>{this.listeners.forEach(o=>{o(i)})})}resumePausedMutations(){const i=this.getAll().filter(o=>o.state.isPaused);return $t.batch(()=>Promise.all(i.map(o=>o.continue().catch(oe))))}},ol=new WeakMap,je=new WeakMap,On=new WeakMap,Id);function Li(f){var i;return(i=f.options.scope)==null?void 0:i.id}function qd(f){return{onFetch:(i,o)=>{var U,Q,x,Z,I;const r=i.options,E=(x=(Q=(U=i.fetchOptions)==null?void 0:U.meta)==null?void 0:Q.fetchMore)==null?void 0:x.direction,z=((Z=i.state.data)==null?void 0:Z.pages)||[],H=((I=i.state.data)==null?void 0:I.pageParams)||[];let C={pages:[],pageParams:[]},_=0;const T=async()=>{let L=!1;const X=tt=>{Object.defineProperty(tt,"signal",{enumerable:!0,get:()=>(i.signal.aborted?L=!0:i.signal.addEventListener("abort",()=>{L=!0}),i.signal)})},dt=ay(i.options,i.fetchOptions),Mt=async(tt,yt,$)=>{if(L)return Promise.reject();if(yt==null&&tt.pages.length)return Promise.resolve(tt);const jt=(()=>{const wt={client:i.client,queryKey:i.queryKey,pageParam:yt,direction:$?"backward":"forward",meta:i.options.meta};return X(wt),wt})(),vt=await dt(jt),{maxPages:ft}=i.options,Et=$?Xv:Gv;return{pages:Et(tt.pages,vt,ft),pageParams:Et(tt.pageParams,yt,ft)}};if(E&&z.length){const tt=E==="backward",yt=tt?tm:Cd,$={pages:z,pageParams:H},Dt=yt(r,$);C=await Mt($,Dt,tt)}else{const tt=f??z.length;do{const yt=_===0?H[0]??r.initialPageParam:Cd(r,C);if(_>0&&yt==null)break;C=await Mt(C,yt),_++}while(_<tt)}return C};i.options.persister?i.fetchFn=()=>{var L,X;return(X=(L=i.options).persister)==null?void 0:X.call(L,T,{client:i.client,queryKey:i.queryKey,meta:i.options.meta,signal:i.signal},o)}:i.fetchFn=T}}}function Cd(f,{pages:i,pageParams:o}){const r=i.length-1;return i.length>0?f.getNextPageParam(i[r],i,o[r],o):void 0}function tm(f,{pages:i,pageParams:o}){var r;return i.length>0?(r=f.getPreviousPageParam)==null?void 0:r.call(f,i[0],i,o[0],o):void 0}var Ct,Gl,Xl,oa,ha,Zl,da,ya,ty,em=(ty=class{constructor(f={}){W(this,Ct);W(this,Gl);W(this,Xl);W(this,oa);W(this,ha);W(this,Zl);W(this,da);W(this,ya);Y(this,Ct,f.queryCache||new $v),Y(this,Gl,f.mutationCache||new Iv),Y(this,Xl,f.defaultOptions||{}),Y(this,oa,new Map),Y(this,ha,new Map),Y(this,Zl,0)}mount(){Zi(this,Zl)._++,v(this,Zl)===1&&(Y(this,da,Us.subscribe(async f=>{f&&(await this.resumePausedMutations(),v(this,Ct).onFocus())})),Y(this,ya,Vi.subscribe(async f=>{f&&(await this.resumePausedMutations(),v(this,Ct).onOnline())})))}unmount(){var f,i;Zi(this,Zl)._--,v(this,Zl)===0&&((f=v(this,da))==null||f.call(this),Y(this,da,void 0),(i=v(this,ya))==null||i.call(this),Y(this,ya,void 0))}isFetching(f){return v(this,Ct).findAll({...f,fetchStatus:"fetching"}).length}isMutating(f){return v(this,Gl).findAll({...f,status:"pending"}).length}getQueryData(f){var o;const i=this.defaultQueryOptions({queryKey:f});return(o=v(this,Ct).get(i.queryHash))==null?void 0:o.state.data}ensureQueryData(f){const i=this.defaultQueryOptions(f),o=v(this,Ct).build(this,i),r=o.state.data;return r===void 0?this.fetchQuery(f):(f.revalidateIfStale&&o.isStaleByTime(wl(i.staleTime,o))&&this.prefetchQuery(i),Promise.resolve(r))}getQueriesData(f){return v(this,Ct).findAll(f).map(({queryKey:i,state:o})=>{const r=o.data;return[i,r]})}setQueryData(f,i,o){const r=this.defaultQueryOptions({queryKey:f}),E=v(this,Ct).get(r.queryHash),z=E==null?void 0:E.state.data,H=Yv(i,z);if(H!==void 0)return v(this,Ct).build(this,r).setData(H,{...o,manual:!0})}setQueriesData(f,i,o){return $t.batch(()=>v(this,Ct).findAll(f).map(({queryKey:r})=>[r,this.setQueryData(r,i,o)]))}getQueryState(f){var o;const i=this.defaultQueryOptions({queryKey:f});return(o=v(this,Ct).get(i.queryHash))==null?void 0:o.state}removeQueries(f){const i=v(this,Ct);$t.batch(()=>{i.findAll(f).forEach(o=>{i.remove(o)})})}resetQueries(f,i){const o=v(this,Ct);return $t.batch(()=>(o.findAll(f).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...f},i)))}cancelQueries(f,i={}){const o={revert:!0,...i},r=$t.batch(()=>v(this,Ct).findAll(f).map(E=>E.cancel(o)));return Promise.all(r).then(oe).catch(oe)}invalidateQueries(f,i={}){return $t.batch(()=>(v(this,Ct).findAll(f).forEach(o=>{o.invalidate()}),(f==null?void 0:f.refetchType)==="none"?Promise.resolve():this.refetchQueries({...f,type:(f==null?void 0:f.refetchType)??(f==null?void 0:f.type)??"active"},i)))}refetchQueries(f,i={}){const o={...i,cancelRefetch:i.cancelRefetch??!0},r=$t.batch(()=>v(this,Ct).findAll(f).filter(E=>!E.isDisabled()&&!E.isStatic()).map(E=>{let z=E.fetch(void 0,o);return o.throwOnError||(z=z.catch(oe)),E.state.fetchStatus==="paused"?Promise.resolve():z}));return Promise.all(r).then(oe)}fetchQuery(f){const i=this.defaultQueryOptions(f);i.retry===void 0&&(i.retry=!1);const o=v(this,Ct).build(this,i);return o.isStaleByTime(wl(i.staleTime,o))?o.fetch(i):Promise.resolve(o.state.data)}prefetchQuery(f){return this.fetchQuery(f).then(oe).catch(oe)}fetchInfiniteQuery(f){return f.behavior=qd(f.pages),this.fetchQuery(f)}prefetchInfiniteQuery(f){return this.fetchInfiniteQuery(f).then(oe).catch(oe)}ensureInfiniteQueryData(f){return f.behavior=qd(f.pages),this.ensureQueryData(f)}resumePausedMutations(){return Vi.isOnline()?v(this,Gl).resumePausedMutations():Promise.resolve()}getQueryCache(){return v(this,Ct)}getMutationCache(){return v(this,Gl)}getDefaultOptions(){return v(this,Xl)}setDefaultOptions(f){Y(this,Xl,f)}setQueryDefaults(f,i){v(this,oa).set(pn(f),{queryKey:f,defaultOptions:i})}getQueryDefaults(f){const i=[...v(this,oa).values()],o={};return i.forEach(r=>{En(f,r.queryKey)&&Object.assign(o,r.defaultOptions)}),o}setMutationDefaults(f,i){v(this,ha).set(pn(f),{mutationKey:f,defaultOptions:i})}getMutationDefaults(f){const i=[...v(this,ha).values()],o={};return i.forEach(r=>{En(f,r.mutationKey)&&Object.assign(o,r.defaultOptions)}),o}defaultQueryOptions(f){if(f._defaulted)return f;const i={...v(this,Xl).queries,...this.getQueryDefaults(f.queryKey),...f,_defaulted:!0};return i.queryHash||(i.queryHash=Rs(i.queryKey,i)),i.refetchOnReconnect===void 0&&(i.refetchOnReconnect=i.networkMode!=="always"),i.throwOnError===void 0&&(i.throwOnError=!!i.suspense),!i.networkMode&&i.persister&&(i.networkMode="offlineFirst"),i.queryFn===_s&&(i.enabled=!1),i}defaultMutationOptions(f){return f!=null&&f._defaulted?f:{...v(this,Xl).mutations,...(f==null?void 0:f.mutationKey)&&this.getMutationDefaults(f.mutationKey),...f,_defaulted:!0}}clear(){v(this,Ct).clear(),v(this,Gl).clear()}},Ct=new WeakMap,Gl=new WeakMap,Xl=new WeakMap,oa=new WeakMap,ha=new WeakMap,Zl=new WeakMap,da=new WeakMap,ya=new WeakMap,ty),re,it,An,ae,Su,va,Ll,Vl,Mn,ma,ga,bu,pu,Kl,Sa,ht,bn,ps,Es,Ts,Os,As,Ms,Ds,ry,ey,lm=(ey=class extends Dn{constructor(i,o){super();W(this,ht);W(this,re);W(this,it);W(this,An);W(this,ae);W(this,Su);W(this,va);W(this,Ll);W(this,Vl);W(this,Mn);W(this,ma);W(this,ga);W(this,bu);W(this,pu);W(this,Kl);W(this,Sa,new Set);this.options=o,Y(this,re,i),Y(this,Vl,null),Y(this,Ll,bs()),this.options.experimental_prefetchInRender||v(this,Ll).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(o)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(v(this,it).addObserver(this),Qd(v(this,it),this.options)?nt(this,ht,bn).call(this):this.updateResult(),nt(this,ht,Os).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return zs(v(this,it),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return zs(v(this,it),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,nt(this,ht,As).call(this),nt(this,ht,Ms).call(this),v(this,it).removeObserver(this)}setOptions(i){const o=this.options,r=v(this,it);if(this.options=v(this,re).defaultQueryOptions(i),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ce(this.options.enabled,v(this,it))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");nt(this,ht,Ds).call(this),v(this,it).setOptions(this.options),o._defaulted&&!ms(this.options,o)&&v(this,re).getQueryCache().notify({type:"observerOptionsUpdated",query:v(this,it),observer:this});const E=this.hasListeners();E&&xd(v(this,it),r,this.options,o)&&nt(this,ht,bn).call(this),this.updateResult(),E&&(v(this,it)!==r||Ce(this.options.enabled,v(this,it))!==Ce(o.enabled,v(this,it))||wl(this.options.staleTime,v(this,it))!==wl(o.staleTime,v(this,it)))&&nt(this,ht,ps).call(this);const z=nt(this,ht,Es).call(this);E&&(v(this,it)!==r||Ce(this.options.enabled,v(this,it))!==Ce(o.enabled,v(this,it))||z!==v(this,Kl))&&nt(this,ht,Ts).call(this,z)}getOptimisticResult(i){const o=v(this,re).getQueryCache().build(v(this,re),i),r=this.createResult(o,i);return am(this,r)&&(Y(this,ae,r),Y(this,va,this.options),Y(this,Su,v(this,it).state)),r}getCurrentResult(){return v(this,ae)}trackResult(i,o){return new Proxy(i,{get:(r,E)=>(this.trackProp(E),o==null||o(E),Reflect.get(r,E))})}trackProp(i){v(this,Sa).add(i)}getCurrentQuery(){return v(this,it)}refetch({...i}={}){return this.fetch({...i})}fetchOptimistic(i){const o=v(this,re).defaultQueryOptions(i),r=v(this,re).getQueryCache().build(v(this,re),o);return r.fetch().then(()=>this.createResult(r,o))}fetch(i){return nt(this,ht,bn).call(this,{...i,cancelRefetch:i.cancelRefetch??!0}).then(()=>(this.updateResult(),v(this,ae)))}createResult(i,o){var ft;const r=v(this,it),E=this.options,z=v(this,ae),H=v(this,Su),C=v(this,va),T=i!==r?i.state:v(this,An),{state:U}=i;let Q={...U},x=!1,Z;if(o._optimisticResults){const Et=this.hasListeners(),wt=!Et&&Qd(i,o),Ut=Et&&xd(i,r,o,E);(wt||Ut)&&(Q={...Q,...sy(U.data,i.options)}),o._optimisticResults==="isRestoring"&&(Q.fetchStatus="idle")}let{error:I,errorUpdatedAt:L,status:X}=Q;Z=Q.data;let dt=!1;if(o.placeholderData!==void 0&&Z===void 0&&X==="pending"){let Et;z!=null&&z.isPlaceholderData&&o.placeholderData===(C==null?void 0:C.placeholderData)?(Et=z.data,dt=!0):Et=typeof o.placeholderData=="function"?o.placeholderData((ft=v(this,ga))==null?void 0:ft.state.data,v(this,ga)):o.placeholderData,Et!==void 0&&(X="success",Z=Ss(z==null?void 0:z.data,Et,o),x=!0)}if(o.select&&Z!==void 0&&!dt)if(z&&Z===(H==null?void 0:H.data)&&o.select===v(this,Mn))Z=v(this,ma);else try{Y(this,Mn,o.select),Z=o.select(Z),Z=Ss(z==null?void 0:z.data,Z,o),Y(this,ma,Z),Y(this,Vl,null)}catch(Et){Y(this,Vl,Et)}v(this,Vl)&&(I=v(this,Vl),Z=v(this,ma),L=Date.now(),X="error");const Mt=Q.fetchStatus==="fetching",tt=X==="pending",yt=X==="error",$=tt&&Mt,Dt=Z!==void 0,vt={status:X,fetchStatus:Q.fetchStatus,isPending:tt,isSuccess:X==="success",isError:yt,isInitialLoading:$,isLoading:$,data:Z,dataUpdatedAt:Q.dataUpdatedAt,error:I,errorUpdatedAt:L,failureCount:Q.fetchFailureCount,failureReason:Q.fetchFailureReason,errorUpdateCount:Q.errorUpdateCount,isFetched:Q.dataUpdateCount>0||Q.errorUpdateCount>0,isFetchedAfterMount:Q.dataUpdateCount>T.dataUpdateCount||Q.errorUpdateCount>T.errorUpdateCount,isFetching:Mt,isRefetching:Mt&&!tt,isLoadingError:yt&&!Dt,isPaused:Q.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:yt&&Dt,isStale:Hs(i,o),refetch:this.refetch,promise:v(this,Ll),isEnabled:Ce(o.enabled,i)!==!1};if(this.options.experimental_prefetchInRender){const Et=Oe=>{vt.status==="error"?Oe.reject(vt.error):vt.data!==void 0&&Oe.resolve(vt.data)},wt=()=>{const Oe=Y(this,Ll,vt.promise=bs());Et(Oe)},Ut=v(this,Ll);switch(Ut.status){case"pending":i.queryHash===r.queryHash&&Et(Ut);break;case"fulfilled":(vt.status==="error"||vt.data!==Ut.value)&&wt();break;case"rejected":(vt.status!=="error"||vt.error!==Ut.reason)&&wt();break}}return vt}updateResult(){const i=v(this,ae),o=this.createResult(v(this,it),this.options);if(Y(this,Su,v(this,it).state),Y(this,va,this.options),v(this,Su).data!==void 0&&Y(this,ga,v(this,it)),ms(o,i))return;Y(this,ae,o);const r=()=>{if(!i)return!0;const{notifyOnChangeProps:E}=this.options,z=typeof E=="function"?E():E;if(z==="all"||!z&&!v(this,Sa).size)return!0;const H=new Set(z??v(this,Sa));return this.options.throwOnError&&H.add("error"),Object.keys(v(this,ae)).some(C=>{const _=C;return v(this,ae)[_]!==i[_]&&H.has(_)})};nt(this,ht,ry).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&nt(this,ht,Os).call(this)}},re=new WeakMap,it=new WeakMap,An=new WeakMap,ae=new WeakMap,Su=new WeakMap,va=new WeakMap,Ll=new WeakMap,Vl=new WeakMap,Mn=new WeakMap,ma=new WeakMap,ga=new WeakMap,bu=new WeakMap,pu=new WeakMap,Kl=new WeakMap,Sa=new WeakMap,ht=new WeakSet,bn=function(i){nt(this,ht,Ds).call(this);let o=v(this,it).fetch(this.options,i);return i!=null&&i.throwOnError||(o=o.catch(oe)),o},ps=function(){nt(this,ht,As).call(this);const i=wl(this.options.staleTime,v(this,it));if(Eu||v(this,ae).isStale||!vs(i))return;const r=ly(v(this,ae).dataUpdatedAt,i)+1;Y(this,bu,setTimeout(()=>{v(this,ae).isStale||this.updateResult()},r))},Es=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(v(this,it)):this.options.refetchInterval)??!1},Ts=function(i){nt(this,ht,Ms).call(this),Y(this,Kl,i),!(Eu||Ce(this.options.enabled,v(this,it))===!1||!vs(v(this,Kl))||v(this,Kl)===0)&&Y(this,pu,setInterval(()=>{(this.options.refetchIntervalInBackground||Us.isFocused())&&nt(this,ht,bn).call(this)},v(this,Kl)))},Os=function(){nt(this,ht,ps).call(this),nt(this,ht,Ts).call(this,nt(this,ht,Es).call(this))},As=function(){v(this,bu)&&(clearTimeout(v(this,bu)),Y(this,bu,void 0))},Ms=function(){v(this,pu)&&(clearInterval(v(this,pu)),Y(this,pu,void 0))},Ds=function(){const i=v(this,re).getQueryCache().build(v(this,re),this.options);if(i===v(this,it))return;const o=v(this,it);Y(this,it,i),Y(this,An,i.state),this.hasListeners()&&(o==null||o.removeObserver(this),i.addObserver(this))},ry=function(i){$t.batch(()=>{i.listeners&&this.listeners.forEach(o=>{o(v(this,ae))}),v(this,re).getQueryCache().notify({query:v(this,it),type:"observerResultsUpdated"})})},ey);function um(f,i){return Ce(i.enabled,f)!==!1&&f.state.data===void 0&&!(f.state.status==="error"&&i.retryOnMount===!1)}function Qd(f,i){return um(f,i)||f.state.data!==void 0&&zs(f,i,i.refetchOnMount)}function zs(f,i,o){if(Ce(i.enabled,f)!==!1&&wl(i.staleTime,f)!=="static"){const r=typeof o=="function"?o(f):o;return r==="always"||r!==!1&&Hs(f,i)}return!1}function xd(f,i,o,r){return(f!==i||Ce(r.enabled,f)===!1)&&(!o.suspense||f.state.status!=="error")&&Hs(f,o)}function Hs(f,i){return Ce(i.enabled,f)!==!1&&f.isStaleByTime(wl(i.staleTime,f))}function am(f,i){return!ms(f.getCurrentResult(),i)}var rs={exports:{}},P={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react.production.js
|
|
12
12
|
*
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Agent Plugin View</title>
|
|
8
|
-
<script type="module" crossorigin src="./assets/index-
|
|
8
|
+
<script type="module" crossorigin src="./assets/index-D1cHX53P.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="./assets/index-CgkejLs_.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|