axiodb 2.28.82 → 2.29.83

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.
@@ -0,0 +1,283 @@
1
+ # AxioDB Docker Image
2
+
3
+ [![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white)](https://docker.com/)
4
+ [![AxioDB](https://img.shields.io/badge/AxioDB-2.29.82-blue?style=for-the-badge)](https://www.npmjs.com/package/axiodb)
5
+
6
+ This Docker image provides a REST API server for AxioDB, allowing you to interact with the AxioDB database management system through HTTP requests. The container includes a web-based GUI dashboard for visual database management and comprehensive API endpoints for programmatic access.
7
+
8
+ ## =� What's Included
9
+
10
+ - **REST API Server**: Full HTTP API for database operations
11
+ - **Web GUI Dashboard**: Browser-based interface at `http://localhost:27018`
12
+ - **API Documentation**: Interactive API reference at `http://localhost:27018/api`
13
+ - **AxioDB Core**: Complete database management system
14
+ - **Auto-start Configuration**: Ready-to-use setup with minimal configuration
15
+
16
+ ## =� Quick Start
17
+
18
+ ### Running the Container
19
+
20
+ ```bash
21
+ # Pull and run the AxioDB Docker container
22
+ docker run -d \
23
+ --name axiodb-server \
24
+ -p 27018:27018 \
25
+ <your-docker-image-name>
26
+ ```
27
+
28
+ ### Custom Port Mapping
29
+
30
+ ```bash
31
+ # Run on a different host port (e.g., 8080)
32
+ docker run -d \
33
+ --name axiodb-server \
34
+ -p 8080:27018 \
35
+ <your-docker-image-name>
36
+
37
+ # Access via http://localhost:8080
38
+ ```
39
+
40
+ ### With Data Persistence
41
+
42
+ ```bash
43
+ # Mount a volume to persist data
44
+ docker run -d \
45
+ --name axiodb-server \
46
+ -p 27018:27018 \
47
+ -v axiodb-data:/app/AxioDB \
48
+ <your-docker-image-name>
49
+ ```
50
+
51
+ ## < Accessing the Services
52
+
53
+ Once the container is running:
54
+
55
+ ### Web GUI Dashboard
56
+ - **URL**: `http://localhost:27018`
57
+ - **Description**: Interactive web interface for managing databases, collections, and documents
58
+ - **Features**:
59
+ - Database creation and management
60
+ - Collection operations with schema validation
61
+ - Document CRUD operations
62
+ - Real-time statistics and monitoring
63
+
64
+ ### API Documentation
65
+ - **URL**: `http://localhost:27018/api`
66
+ - **Description**: Complete REST API reference with examples
67
+ - **Features**:
68
+ - Interactive API explorer
69
+ - Request/response examples
70
+ - Authentication details
71
+ - Endpoint documentation
72
+
73
+ ### REST API Endpoints
74
+ - **Base URL**: `http://localhost:27018/api`
75
+ - **Content-Type**: `application/json`
76
+ - **Available Operations**:
77
+ - Database management (`/api/database/*`)
78
+ - Collection operations (`/api/collection/*`)
79
+ - Document CRUD (`/api/operation/*`)
80
+ - Statistics and monitoring (`/api/stats/*`)
81
+
82
+ ## =� For Node.js Developers
83
+
84
+ ### Recommended: Use AxioDB NPM Package
85
+
86
+ If you're building a **Node.js application**, we highly recommend using the official **AxioDB NPM package** instead of the Docker REST API for better performance and direct integration:
87
+
88
+ ```bash
89
+ npm install axiodb@latest --save
90
+ ```
91
+
92
+ **Benefits of the NPM package over Docker API:**
93
+ - **Better Performance**: Direct in-process database operations
94
+ - **No Network Overhead**: Eliminate HTTP request latency
95
+ - **Type Safety**: Full TypeScript support with IntelliSense
96
+ - **Advanced Features**: Access to all AxioDB features including encryption, caching, and aggregation
97
+ - **Easier Development**: No need to manage Docker containers during development
98
+
99
+ #### NPM Package Usage Example
100
+
101
+ ```javascript
102
+ const { AxioDB, SchemaTypes } = require("axiodb");
103
+
104
+ // Create a single AxioDB instance
105
+ const db = new AxioDB();
106
+
107
+ const main = async () => {
108
+ // Create database and collection
109
+ const database = await db.createDB("myApp");
110
+ const collection = await database.createCollection("users", true, {
111
+ name: SchemaTypes.string().required(),
112
+ email: SchemaTypes.string().required().email(),
113
+ age: SchemaTypes.number().min(0).max(120)
114
+ });
115
+
116
+ // Insert document
117
+ const result = await collection.insert({
118
+ name: "John Doe",
119
+ email: "john@example.com",
120
+ age: 30
121
+ });
122
+
123
+ console.log(result);
124
+ };
125
+
126
+ main();
127
+ ```
128
+
129
+ ### When to Use Docker vs NPM Package
130
+
131
+ | Use Case | Docker API | NPM Package |
132
+ |----------|------------|-------------|
133
+ | **Node.js Applications** | L Not recommended |  **Recommended** |
134
+ | **Microservices Architecture** |  Good choice | � Consider service boundaries |
135
+ | **Non-Node.js Applications** |  **Recommended** | L Not available |
136
+ | **Development/Prototyping** |  Quick setup |  Better performance |
137
+ | **Production Deployment** | � Network overhead |  **Recommended** |
138
+
139
+ ## =' Configuration
140
+
141
+ ### Environment Variables
142
+
143
+ ```bash
144
+ docker run -d \
145
+ --name axiodb-server \
146
+ -p 27018:27018 \
147
+ -e AXIODB_PORT=27018 \
148
+ -e AXIODB_HOST=0.0.0.0 \
149
+ <your-docker-image-name>
150
+ ```
151
+
152
+ ### Docker Compose
153
+
154
+ ```yaml
155
+ version: '3.8'
156
+
157
+ services:
158
+ axiodb:
159
+ image: <your-docker-image-name>
160
+ container_name: axiodb-server
161
+ ports:
162
+ - "27018:27018"
163
+ volumes:
164
+ - axiodb-data:/app/AxioDB
165
+ restart: unless-stopped
166
+
167
+ volumes:
168
+ axiodb-data:
169
+ ```
170
+
171
+ ## =� API Examples
172
+
173
+ ### Create Database
174
+
175
+ ```bash
176
+ curl -X POST http://localhost:27018/api/database/create \
177
+ -H "Content-Type: application/json" \
178
+ -d '{"name": "myDatabase"}'
179
+ ```
180
+
181
+ ### Create Collection
182
+
183
+ ```bash
184
+ curl -X POST http://localhost:27018/api/collection/create \
185
+ -H "Content-Type: application/json" \
186
+ -d '{
187
+ "database": "myDatabase",
188
+ "name": "users",
189
+ "schema": {
190
+ "name": {"type": "string", "required": true},
191
+ "email": {"type": "string", "required": true}
192
+ }
193
+ }'
194
+ ```
195
+
196
+ ### Insert Document
197
+
198
+ ```bash
199
+ curl -X POST http://localhost:27018/api/operation/insert \
200
+ -H "Content-Type: application/json" \
201
+ -d '{
202
+ "database": "myDatabase",
203
+ "collection": "users",
204
+ "data": {
205
+ "name": "John Doe",
206
+ "email": "john@example.com"
207
+ }
208
+ }'
209
+ ```
210
+
211
+ ### Query Documents
212
+
213
+ ```bash
214
+ curl -X POST http://localhost:27018/api/operation/query \
215
+ -H "Content-Type: application/json" \
216
+ -d '{
217
+ "database": "myDatabase",
218
+ "collection": "users",
219
+ "query": {"name": "John Doe"},
220
+ "limit": 10
221
+ }'
222
+ ```
223
+
224
+ ## =3 Building from Source
225
+
226
+ If you want to build the Docker image yourself:
227
+
228
+ ```bash
229
+ # Clone the repository
230
+ git clone https://github.com/AnkanSaha/AxioDB.git
231
+ cd AxioDB/Docker
232
+
233
+ # Build the Docker image
234
+ docker build -t axiodb:latest .
235
+
236
+ # Run the container
237
+ docker run -d --name axiodb-server -p 27018:27018 axiodb:latest
238
+ ```
239
+
240
+ ## =
241
  Troubleshooting
242
+
243
+ ### Container Won't Start
244
+ ```bash
245
+ # Check container logs
246
+ docker logs axiodb-server
247
+
248
+ # Check if port is already in use
249
+ netstat -tulpn | grep :27018
250
+ ```
251
+
252
+ ### Port Already in Use
253
+ ```bash
254
+ # Use a different port
255
+ docker run -d --name axiodb-server -p 8080:27018 <your-docker-image-name>
256
+ ```
257
+
258
+ ### Data Persistence Issues
259
+ ```bash
260
+ # Ensure proper volume mounting
261
+ docker run -d \
262
+ --name axiodb-server \
263
+ -p 27018:27018 \
264
+ -v "$(pwd)/axiodb-data":/app/AxioDB \
265
+ <your-docker-image-name>
266
+ ```
267
+
268
+ ## =� Additional Resources
269
+
270
+ - **Official Documentation**: [https://axiodb.site/](https://axiodb.site/)
271
+ - **NPM Package**: [https://www.npmjs.com/package/axiodb](https://www.npmjs.com/package/axiodb)
272
+ - **GitHub Repository**: [https://github.com/AnkanSaha/AxioDB](https://github.com/AnkanSaha/AxioDB)
273
+ - **API Reference**: Access via `http://localhost:27018/api` when container is running
274
+
275
+ ## > Support
276
+
277
+ For support and questions:
278
+ - Open an issue on [GitHub](https://github.com/AnkanSaha/AxioDB/issues)
279
+ - Check the [documentation](https://axiodb.site/)
280
+ - Visit the API reference at `http://localhost:27018/api`
281
+
282
+ ---
283
+
284
+ **Note**: This Docker image is designed for development, testing, and small-scale production use. For high-performance Node.js applications, consider using the AxioDB NPM package directly for optimal performance.
@@ -135,15 +135,32 @@ exports.AvailableRoutes = [
135
135
  {
136
136
  method: "PUT",
137
137
  description: "Update an existing document in a collection",
138
- path: "/api/operation/update/?dbName&collectionName&documentId&transactiontoken",
138
+ path: "/api/operation/update/by-id/?dbName&collectionName&documentId&transactiontoken",
139
139
  payload: {
140
140
  document: "object",
141
141
  },
142
142
  },
143
+ {
144
+ method: "PUT",
145
+ description: "Update an existing document in a collection",
146
+ path: "/api/operation/update/by-query/?dbName&isMany&collectionName&transactiontoken",
147
+ payload: {
148
+ query: "object",
149
+ update: "object",
150
+ },
151
+ },
143
152
  {
144
153
  method: "DELETE",
145
154
  description: "Delete an existing document in a collection",
146
- path: "/api/operation/delete/?dbName&collectionName&documentId&transactiontoken",
155
+ path: "/api/operation/delete/by-id/?dbName&collectionName&documentId&transactiontoken",
156
+ },
157
+ {
158
+ method: "DELETE",
159
+ description: "Delete an existing document in a collection",
160
+ path: "/api/operation/delete/by-query/?dbName&collectionName&isMany&documentId&transactiontoken",
161
+ payload: {
162
+ query: "object",
163
+ },
147
164
  },
148
165
  {
149
166
  method: "POST",
@@ -1 +1 @@
1
- {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../source/server/config/keys.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAuD;AACvD,gDAAwB;AAExB,IAAY,UASX;AATD,WAAY,UAAU;IACpB,+CAAY,CAAA;IACZ,mCAAqB,CAAA;IACrB,wCAA0B,CAAA;IAC1B,kDAAoC,CAAA;IACpC,oDAAsC,CAAA;IACtC,uEAAyD,CAAA;IACzD,iDAAwB,IAAI,CAAC,GAAG,EAAE,2BAAA,CAAA;IAClC,uEAAsB,CAAA;AACxB,CAAC,EATW,UAAU,0BAAV,UAAU,QASrB;AAED,kBAAkB;AACL,QAAA,WAAW,GAAG;IAC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kD;gBAC/D,IAAI,EAAE,kEAAkE;gBACxE,OAAO,EAAE;oBACP,WAAW,EAAE,OAAO;iBACrB;aACF;SACF;KACF;CACF,CAAC"}
1
+ {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../source/server/config/keys.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAuD;AACvD,gDAAwB;AAExB,IAAY,UASX;AATD,WAAY,UAAU;IACpB,+CAAY,CAAA;IACZ,mCAAqB,CAAA;IACrB,wCAA0B,CAAA;IAC1B,kDAAoC,CAAA;IACpC,oDAAsC,CAAA;IACtC,uEAAyD,CAAA;IACzD,iDAAwB,IAAI,CAAC,GAAG,EAAE,2BAAA,CAAA;IAClC,uEAAsB,CAAA;AACxB,CAAC,EATW,UAAU,0BAAV,UAAU,QASrB;AAED,kBAAkB;AACL,QAAA,WAAW,GAAG;IACzB,MAAM,EAAE,GAAG;IACX,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC;IAC1D,eAAe,EAAE,CAAC,cAAc,EAAE,eAAe,CAAC;IAClD,eAAe,EAAE,CAAC,gBAAgB,EAAE,kBAAkB,CAAC;IACvD,OAAO,EAAE,KAAK,EAAE,sBAAsB;IACtC,iBAAiB,EAAE,IAAI;CACxB,CAAC;AAEW,QAAA,UAAU,GAAG,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC;AAc3E,SAAS;AACI,QAAA,eAAe,GAA0B;IACpD;QACE,SAAS,EAAE,aAAa;QACxB,WAAW,EAAE,uBAAuB;QACpC,KAAK,EAAE;YACL;gBACE,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,WAAW;gBACjB,WAAW,EAAE,2CAA2C;aACzD;YACD;gBACE,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,aAAa;gBACnB,WAAW,EAAE,+CAA+C;aAC7D;YACD;gBACE,MAAM,EAAE,KAAK;gBACb,IAAI,EA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AK,EAAE;YACL;gBACE,MAAM,EAAE,KAAK;gBACb,WAAW,EAAE,qCAAqC;gBAClD,IAAI,EAAE,iEAAiE;aACxE;YACD;gBACE,MAAM,EAAE,MAAM;gBACd,WAAW,EAAE,uCAAuC;gBACpD,IAAI,EAAE,+DAA+D;gBACrE,OAAO,EAAE;oBACP,QAAQ,EAAE,QAAQ;iBACnB;aACF;YACD;gBACE,MAAM,EAAE,KAAK;gBACb,WAAW,EAAE,6CAA6C;gBAC1D,IAAI,EAAE,gFAAgF;gBACtF,OAAO,EAAE;oBACP,QAAQ,EAAE,QAAQ;iBACnB;aACF;YACD;gBACE,MAAM,EAAE,KAAK;gBACb,WAAW,EAAE,6CAA6C;gBAC1D,IAAI,EAAE,+EAA+E;gBACrF,OAAO,EAAE;oBACP,KAAK,EAAE,QAAQ;oBACf,MAAM,EAAE,QAAQ;iBACjB;aACF;YACD;gBACE,MAAM,EAAE,QAAQ;gBAChB,WAAW,EAAE,6CAA6C;gBAC1D,IAAI,EAAE,gFAAgF;aACvF;YACD;gBACE,MAAM,EAAE,QAAQ;gBAChB,WAAW,EAAE,6CAA6C;gBAC1D,IAAI,EAAE,0FAA0F;gBAChG,OAAO,EAAE;oBACP,KAAK,EAAE,QAAQ;iBAChB;aACF;YACD;gBACE,MAAM,EAAE,MAAM;gBACd,WAAW,EAAE,kDAAkD;gBAC/D,IAAI,EAAE,kEAAkE;gBACxE,OAAO,EAAE;oBACP,WAAW,EAAE,OAAO;iBACrB;aACF;SACF;KACF;CACF,CAAC"}
@@ -12,6 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ /* eslint-disable @typescript-eslint/no-explicit-any */
15
16
  const outers_1 = require("outers");
16
17
  const responseBuilder_helper_1 = __importDefault(require("../../helper/responseBuilder.helper"));
17
18
  const filesCounterInFolder_helper_1 = __importDefault(require("../../helper/filesCounterInFolder.helper"));
@@ -56,7 +57,7 @@ class CollectionController {
56
57
  // Creating the collection
57
58
  try {
58
59
  yield databaseInstance.createCollection(collectionName, crypto, key);
59
- GlobalStorage_config_1.default.delete(`${dbName}${collectionName}`);
60
+ GlobalStorage_config_1.default.clear();
60
61
  return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.CREATED, "Collection created successfully", {
61
62
  dbName,
62
63
  collectionName,
@@ -156,7 +157,7 @@ class CollectionController {
156
157
  }
157
158
  try {
158
159
  yield databaseInstance.deleteCollection(collectionName);
159
- GlobalStorage_config_1.default.delete(`${dbName}${collectionName}`);
160
+ GlobalStorage_config_1.default.clear();
160
161
  return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.OK, "Collection deleted successfully");
161
162
  }
162
163
  catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"Collection.controller.js","sourceRoot":"","sources":["../../../../source/server/controller/Collections/Collection.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,mCAAqC;AAErC,iGAE6C;AAE7C,2GAA2E;AAC3E,6FAAoE;AAEpE;;;;;;GAMG;AACH,MAAqB,oBAAoB;IAGvC,YAAY,cAAsB;QAChC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED;;;;;;;;;OASG;IACU,gBAAgB,CAC3B,OAAuB;;YAEvB,8CAA8C;YAC9C,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAKvD,CAAC;YAEF,kCAAkC;YAClC,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;gBAC1C,OAAO,IAAA,gCAAa,EAAC,oBAAW,CAAC,WAAW,EAAE,uBAAuB,CAAC,CAAC;YACzE,CAAC;YACD,IAAI,CAAC,cAAc,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;gBAC1D,OAAO,IAAA,gCAAa,EAAC,oBAAW,CA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OAAO,IAAA,gCAAa,EAAC,oBAAW,CAAC,EAAE,EAAE,iCAAiC,CAAC,CAAC;YAC1E,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;gBACnD,OAAO,IAAA,gCAAa,EAClB,oBAAW,CAAC,qBAAqB,EACjC,6BAA6B,CAC9B,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF;AAxMD,uCAwMC"}
1
+ {"version":3,"file":"Collection.controller.js","sourceRoot":"","sources":["../../../../source/server/controller/Collections/Collection.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,uDAAuD;AACvD,mCAAqC;AAErC,iGAE6C;AAE7C,2GAA2E;AAC3E,6FAAoE;AAEpE;;;;;;GAMG;AACH,MAAqB,oBAAoB;IAGvC,YAAY,cAAsB;QAChC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED;;;;;;;;;OASG;IACU,gBAAgB,CAC3B,OAAuB;;YAEvB,8CAA8C;YAC9C,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAKvD,CAAC;YAEF,kCAAkC;YAClC,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;gBAC1C,OAAO,IAAA,gCAAa,EAAC,oBAAW,CAAC,WAAW,EAAE,uBAAuB,CAAC,CAAC;YACzE,CAAC;YACD,IAAI,CAAC,cAAc,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;gBAC1D,OAAO,IAAA,gCAAa,EAAC,oBAAW,CAAC,WAAW,EAAE,yBAAyB,CAAC,CAAC;YAC3E,CAAC;YAED,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAEpE,MAAM,kBAAkB,GACtB,MAAM,gBAAgB,CAAC,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AAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF;AAxMD,uCAwMC"}
@@ -65,9 +65,7 @@ class DatabaseController {
65
65
  */
66
66
  createDatabase(request) {
67
67
  return __awaiter(this, void 0, void 0, function* () {
68
- var _a;
69
68
  const { name } = request.body;
70
- const transactionToken = (_a = request.query) === null || _a === void 0 ? void 0 : _a.transactiontoken;
71
69
  try {
72
70
  // check if the database already exists
73
71
  const exists = yield this.AxioDBInstance.isDatabaseExists(name);
@@ -82,7 +80,7 @@ class DatabaseController {
82
80
  return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.BAD_REQUEST, "Invalid database name");
83
81
  }
84
82
  yield this.AxioDBInstance.createDB(name);
85
- GlobalStorage_config_1.default.delete(`database_${transactionToken}`);
83
+ GlobalStorage_config_1.default.clear();
86
84
  return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.CREATED, "Database Created", {
87
85
  Database_Name: name,
88
86
  });
@@ -110,9 +108,7 @@ class DatabaseController {
110
108
  */
111
109
  deleteDatabase(request) {
112
110
  return __awaiter(this, void 0, void 0, function* () {
113
- var _a;
114
111
  const { dbName } = request.query;
115
- const transactionToken = (_a = request.query) === null || _a === void 0 ? void 0 : _a.transactiontoken;
116
112
  try {
117
113
  // check if the database exists
118
114
  const exists = yield this.AxioDBInstance.isDatabaseExists(dbName);
@@ -121,7 +117,7 @@ class DatabaseController {
121
117
  }
122
118
  // delete the database
123
119
  yield this.AxioDBInstance.deleteDatabase(dbName);
124
- GlobalStorage_config_1.default.delete(`database_${transactionToken}`);
120
+ GlobalStorage_config_1.default.clear();
125
121
  return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.OK, "Database Deleted", {
126
122
  Database_Name: dbName,
127
123
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Databse.controller.js","sourceRoot":"","sources":["../../../../source/server/controller/Database/Databse.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,uDAAuD;AACvD,mCAAqC;AAErC,iGAE6C;AAE7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OAAO,IAAA,gCAAa,EAAC,oBAAW,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;gBACpE,CAAC;gBACD,sBAAsB;gBACtB,MAAM,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;gBACjD,8BAAmB,CAAC,MAAM,CAAC,YAAY,gBAAgB,EAAE,CAAC,CAAC;gBAC3D,OAAO,IAAA,gCAAa,EAAC,oBAAW,CAAC,EAAE,EAAE,kBAAkB,EAAE;oBACvD,aAAa,EAAE,MAAM;iBACtB,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;gBACjD,OAAO,IAAA,gCAAa,EAClB,oBAAW,CAAC,qBAAqB,EACjC,yBAAyB,CAC1B,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF;AAlID,qCAkIC"}
1
+ {"version":3,"file":"Databse.controller.js","sourceRoot":"","sources":["../../../../source/server/controller/Database/Databse.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,uDAAuD;AACvD,mCAAqC;AAErC,iGAE6C;AAE7C,6FAAoE;AAEpE;;;;;;GAMG;AACH,MAAqB,kBAAkB;IAGrC,YAAY,cAAsB;QAChC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED;;;;;;;;;OASG;IACU,YAAY,CACvB,gBAAwB;;YAExB,cAAc;YACd,IACE,gBAAgB;gBAChB,8BAAmB,CAAC,GAAG,CAAC,YAAY,gBAAgB,EAAE,CAAC,IAAI,SAAS,EACpE,CAAC;gBACD,OAAO,IAAA,gCAAa,EAClB,oBAAW,CAAC,EAAE,EACd,mBAAmB,EACnB,8BAAmB,CAAC,GAAG,CAAC,YAAY,gBAAgB,EAAE,CAAC,CACxD,CAAC;YACJ,CAAC;YAED,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,EAAE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O,EAAE,kBAAkB,EAAE;oBAC5D,aAAa,EAAE,IAAI;iBACpB,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;gBACjD,OAAO,IAAA,gCAAa,EAClB,oBAAW,CAAC,qBAAqB,EACjC,yBAAyB,CAC1B,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;OAcG;IACU,cAAc,CACzB,OAAuB;;YAEvB,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAA2B,CAAC;YACvD,IAAI,CAAC;gBACH,+BAA+B;gBAC/B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;gBAClE,IAAI,CAAC,MAAM,EAAE,CAAC;oBACZ,OAAO,IAAA,gCAAa,EAAC,oBAAW,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;gBACpE,CAAC;gBACD,sBAAsB;gBACtB,MAAM,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;gBACjD,8BAAmB,CAAC,KAAK,EAAE,CAAC;gBAC5B,OAAO,IAAA,gCAAa,EAAC,oBAAW,CAAC,EAAE,EAAE,kBAAkB,EAAE;oBACvD,aAAa,EAAE,MAAM;iBACtB,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;gBACjD,OAAO,IAAA,gCAAa,EAClB,oBAAW,CAAC,qBAAqB,EACjC,yBAAyB,CAC1B,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF;AAhID,qCAgIC"}
@@ -49,7 +49,20 @@ export default class CRUDController {
49
49
  * @param request.query.documentId - The ID of the document to update
50
50
  * @param request.body - The updated document data
51
51
  */
52
- updateDocument(request: FastifyRequest): Promise<import("../../helper/responseBuilder.helper").ResponseBuilder>;
52
+ updateDocumentById(request: FastifyRequest): Promise<import("../../helper/responseBuilder.helper").ResponseBuilder>;
53
+ /**
54
+ * Updates documents in a specified collection based on a query.
55
+ * @param request - The Fastify request object containing query parameters and body data
56
+ * @param request.query - Query parameters containing database, collection, and update options
57
+ * @param request.query.dbName - The name of the database
58
+ * @param request.query.collectionName - The name of the collection
59
+ * @param request.query.isMany - Flag indicating if multiple documents should be updated
60
+ * @param request.body - The update query and data
61
+ * @param request.body.query - The query to match documents
62
+ * @param request.body.update - The updated document data
63
+ * @returns A response object with the status of the update operation
64
+ */
65
+ updateDocumentByQuery(request: FastifyRequest): Promise<import("../../helper/responseBuilder.helper").ResponseBuilder>;
53
66
  /**
54
67
  * Deletes a document from a specified collection in a database.
55
68
  *
@@ -65,7 +78,24 @@ export default class CRUDController {
65
78
  *
66
79
  * @throws May throw exceptions during database operations
67
80
  */
68
- deleteDocument(request: FastifyRequest): Promise<import("../../helper/responseBuilder.helper").ResponseBuilder>;
81
+ deleteDocumentById(request: FastifyRequest): Promise<import("../../helper/responseBuilder.helper").ResponseBuilder>;
82
+ /**
83
+ * Deletes one or more documents from a collection based on a query
84
+ *
85
+ * @param request - The Fastify request object containing the query parameters
86
+ * @param request.query.dbName - The name of the database
87
+ * @param request.query.collectionName - The name of the collection
88
+ * @param request.query.query - The query object to match documents for deletion
89
+ * @param request.query.isMany - Boolean flag indicating whether to delete multiple documents (true) or a single document (false)
90
+ *
91
+ * @returns A response object with status code and message
92
+ * - 200 OK if the document(s) were successfully deleted
93
+ * - 400 BAD_REQUEST if any of the required parameters are invalid
94
+ * - 500 INTERNAL_SERVER_ERROR if the deletion operation failed
95
+ *
96
+ * @throws May throw exceptions from database operations
97
+ */
98
+ deleteDocumentByQuery(request: FastifyRequest): Promise<import("../../helper/responseBuilder.helper").ResponseBuilder>;
69
99
  /**
70
100
  * Executes an aggregation pipeline on a specified collection.
71
101
  *
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
16
16
  /* eslint-disable prefer-const */
17
17
  const outers_1 = require("outers");
18
18
  const responseBuilder_helper_1 = __importDefault(require("../../helper/responseBuilder.helper"));
19
+ const GlobalStorage_config_1 = __importDefault(require("../../config/GlobalStorage.config"));
19
20
  /**
20
21
  * CRUD Controller class for handling database operations
21
22
  */
@@ -107,6 +108,7 @@ class CRUDController {
107
108
  if (!insertResult || insertResult.statusCode !== outers_1.StatusCodes.OK) {
108
109
  return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.INTERNAL_SERVER_ERROR, "Failed to insert document");
109
110
  }
111
+ GlobalStorage_config_1.default.clear();
110
112
  return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.CREATED, "Document created successfully", insertResult.data);
111
113
  });
112
114
  }
@@ -119,7 +121,7 @@ class CRUDController {
119
121
  * @param request.query.documentId - The ID of the document to update
120
122
  * @param request.body - The updated document data
121
123
  */
122
- updateDocument(request) {
124
+ updateDocumentById(request) {
123
125
  return __awaiter(this, void 0, void 0, function* () {
124
126
  // Extracting parameters from the request body
125
127
  let { dbName, collectionName, documentId } = request.query;
@@ -146,9 +148,59 @@ class CRUDController {
146
148
  if (!updateResult || updateResult.statusCode !== outers_1.StatusCodes.OK) {
147
149
  return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.INTERNAL_SERVER_ERROR, "Failed to update document");
148
150
  }
151
+ GlobalStorage_config_1.default.clear();
149
152
  return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.OK, "Document updated successfully", updateResult.data);
150
153
  });
151
154
  }
155
+ /**
156
+ * Updates documents in a specified collection based on a query.
157
+ * @param request - The Fastify request object containing query parameters and body data
158
+ * @param request.query - Query parameters containing database, collection, and update options
159
+ * @param request.query.dbName - The name of the database
160
+ * @param request.query.collectionName - The name of the collection
161
+ * @param request.query.isMany - Flag indicating if multiple documents should be updated
162
+ * @param request.body - The update query and data
163
+ * @param request.body.query - The query to match documents
164
+ * @param request.body.update - The updated document data
165
+ * @returns A response object with the status of the update operation
166
+ */
167
+ updateDocumentByQuery(request) {
168
+ return __awaiter(this, void 0, void 0, function* () {
169
+ // Extracting parameters from the request body
170
+ let { dbName, collectionName, isMany } = request.query;
171
+ const { query, update: updatedData } = request.body;
172
+ // Validating extracted parameters
173
+ if (!dbName || typeof dbName !== "string") {
174
+ return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.BAD_REQUEST, "Invalid database name");
175
+ }
176
+ if (!collectionName || typeof collectionName !== "string") {
177
+ return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.BAD_REQUEST, "Invalid collection name");
178
+ }
179
+ if (!query || typeof query !== "object") {
180
+ return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.BAD_REQUEST, "Invalid query");
181
+ }
182
+ if (!updatedData || typeof updatedData !== "object") {
183
+ return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.BAD_REQUEST, "Invalid updated data");
184
+ }
185
+ const databaseInstance = yield this.AxioDBInstance.createDB(dbName);
186
+ const DB_Collection = yield databaseInstance.createCollection(collectionName);
187
+ if (isMany) {
188
+ const updateResult = yield DB_Collection.update(query).UpdateMany(updatedData);
189
+ if (!updateResult || updateResult.statusCode !== outers_1.StatusCodes.OK) {
190
+ return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.INTERNAL_SERVER_ERROR, "Failed to update document");
191
+ }
192
+ }
193
+ else {
194
+ // Update the single document
195
+ const updateResult = yield DB_Collection.update(query).UpdateOne(updatedData);
196
+ if (!updateResult || updateResult.statusCode !== outers_1.StatusCodes.OK) {
197
+ return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.INTERNAL_SERVER_ERROR, "Failed to update document");
198
+ }
199
+ }
200
+ GlobalStorage_config_1.default.clear();
201
+ return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.OK, "Document updated successfully");
202
+ });
203
+ }
152
204
  /**
153
205
  * Deletes a document from a specified collection in a database.
154
206
  *
@@ -164,7 +216,7 @@ class CRUDController {
164
216
  *
165
217
  * @throws May throw exceptions during database operations
166
218
  */
167
- deleteDocument(request) {
219
+ deleteDocumentById(request) {
168
220
  return __awaiter(this, void 0, void 0, function* () {
169
221
  // Extracting parameters from the request body
170
222
  let { dbName, collectionName, documentId } = request.query;
@@ -188,6 +240,59 @@ class CRUDController {
188
240
  if (!deleteResult || deleteResult.statusCode !== outers_1.StatusCodes.OK) {
189
241
  return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.INTERNAL_SERVER_ERROR, "Failed to delete document");
190
242
  }
243
+ GlobalStorage_config_1.default.clear();
244
+ return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.OK, "Document deleted successfully");
245
+ });
246
+ }
247
+ /**
248
+ * Deletes one or more documents from a collection based on a query
249
+ *
250
+ * @param request - The Fastify request object containing the query parameters
251
+ * @param request.query.dbName - The name of the database
252
+ * @param request.query.collectionName - The name of the collection
253
+ * @param request.query.query - The query object to match documents for deletion
254
+ * @param request.query.isMany - Boolean flag indicating whether to delete multiple documents (true) or a single document (false)
255
+ *
256
+ * @returns A response object with status code and message
257
+ * - 200 OK if the document(s) were successfully deleted
258
+ * - 400 BAD_REQUEST if any of the required parameters are invalid
259
+ * - 500 INTERNAL_SERVER_ERROR if the deletion operation failed
260
+ *
261
+ * @throws May throw exceptions from database operations
262
+ */
263
+ deleteDocumentByQuery(request) {
264
+ return __awaiter(this, void 0, void 0, function* () {
265
+ // Extracting parameters from the request body
266
+ let { dbName, collectionName, isMany } = request.query;
267
+ let { query } = request.body;
268
+ // Validating extracted parameters
269
+ if (!dbName || typeof dbName !== "string") {
270
+ return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.BAD_REQUEST, "Invalid database name");
271
+ }
272
+ if (!collectionName || typeof collectionName !== "string") {
273
+ return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.BAD_REQUEST, "Invalid collection name");
274
+ }
275
+ if (!query || typeof query !== "object") {
276
+ return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.BAD_REQUEST, "Invalid query");
277
+ }
278
+ const databaseInstance = yield this.AxioDBInstance.createDB(dbName);
279
+ const DB_Collection = yield databaseInstance.createCollection(collectionName);
280
+ // Delete the document
281
+ if (isMany) {
282
+ const deleteResult = yield DB_Collection.delete(query).deleteMany();
283
+ console.log(deleteResult);
284
+ if (!deleteResult || deleteResult.statusCode !== outers_1.StatusCodes.OK) {
285
+ return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.INTERNAL_SERVER_ERROR, "Failed to delete document");
286
+ }
287
+ else {
288
+ const deleteResult = yield DB_Collection.delete(query).deleteOne();
289
+ GlobalStorage_config_1.default.clear();
290
+ if (!deleteResult || deleteResult.statusCode !== outers_1.StatusCodes.OK) {
291
+ return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.INTERNAL_SERVER_ERROR, "Failed to delete document");
292
+ }
293
+ }
294
+ }
295
+ GlobalStorage_config_1.default.clear();
191
296
  return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.OK, "Document deleted successfully");
192
297
  });
193
298
  }
@@ -227,6 +332,7 @@ class CRUDController {
227
332
  if (!aggregationResult || aggregationResult.statusCode !== outers_1.StatusCodes.OK) {
228
333
  return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.INTERNAL_SERVER_ERROR, "Failed to run aggregation");
229
334
  }
335
+ GlobalStorage_config_1.default.clear();
230
336
  return (0, responseBuilder_helper_1.default)(outers_1.StatusCodes.OK, "Aggregation run successfully", aggregationResult.data);
231
337
  });
232
338
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CRUD.controller.js","sourceRoot":"","sources":["../../../../source/server/controller/Operation/CRUD.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,uDAAuD;AACvD,iCAAiC;AACjC,mCAAqC;AAErC,iGAAgE;AAGhE;;GAEG;AACH,MAAqB,cAAc;IAGjC,YAAY,cAAsB;QAChC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED;;;;;;;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,EACjC,2BAA2B,CAC5B,CAAC;YACJ,CAAC;YACD,OAAO,IAAA,gCAAa,EAClB,oBAAW,CAAC,EAAE,EACd,8BAA8B,EAC9B,iBAAiB,CAAC,IAAI,CACvB,CAAC;QACJ,CAAC;KAAA;CACF;AA/RD,iCA+RC"}
1
+ {"version":3,"file":"CRUD.controller.js","sourceRoot":"","sources":["../../../../source/server/controller/Operation/CRUD.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,uDAAuD;AACvD,iCAAiC;AACjC,mCAAqC;AAErC,iGAAgE;AAEhE,6FAAoE;AAEpE;;GAEG;AACH,MAAqB,cAAc;IAGjC,YAAY,cAAsB;QAChC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACU,eAAe,CAAC,OAAuB;;YAClD,8CAA8C;YAC9C,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAI9C,CAAC;YAEF,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;YAE9B,kCAAkC;YAClC,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;gBAC1C,OAAO,IAAA,gCAAa,EAAC,oBAAW,CAAC,WAAW,EAAE,uBAAuB,CAAC,CAAC;YACzE,CAAC;YACD,IAAI,CAAC,cAAc,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;gBAC1D,OAAO,IAAA,gCAAa,EAAC,oBAAW,CAAC,WAAW,EAAE,yBAAyB,CAAC,CAAC;YAC3E,CAAC;YAED,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;gBACzC,OAAO,IAAA,gCAAa,EAAC,oBAAW,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC;YACvE,CAAC;YAED,MAAM,IAAI,GAAG,CAAC,IAAI,GAAG,CAA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W,CAAC,WAAW,EACvB,8BAA8B,CAC/B,CAAC;YACJ,CAAC;YAED,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YACpE,MAAM,aAAa,GACjB,MAAM,gBAAgB,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;YAE1D,MAAM,iBAAiB,GAAG,MAAM,aAAa,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,CAAC;YAC5E,IAAI,CAAC,iBAAiB,IAAI,iBAAiB,CAAC,UAAU,KAAK,oBAAW,CAAC,EAAE,EAAE,CAAC;gBAC1E,OAAO,IAAA,gCAAa,EAClB,oBAAW,CAAC,qBAAqB,EACjC,2BAA2B,CAC5B,CAAC;YACJ,CAAC;YAED,8BAAmB,CAAC,KAAK,EAAE,CAAC;YAC5B,OAAO,IAAA,gCAAa,EAClB,oBAAW,CAAC,EAAE,EACd,8BAA8B,EAC9B,iBAAiB,CAAC,IAAI,CACvB,CAAC;QACJ,CAAC;KAAA;CACF;AAxaD,iCAwaC"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "index.html": {
3
- "file": "assets/index-BBHFnwjb.js",
3
+ "file": "assets/index-DfWfvQkO.js",
4
4
  "name": "index",
5
5
  "src": "index.html",
6
6
  "isEntry": true,
@@ -62,6 +62,6 @@ Please change the parent <Route path="${G}"> to <Route path="${G==="/"?"*":`${G}
62
62
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(s){return s instanceof this?s:new this(s)}static concat(s,...c){const r=new this(s);return c.forEach(f=>r.set(f)),r}static accessor(s){const r=(this[eh]=this[eh]={accessors:{}}).accessors,f=this.prototype;function d(g){const x=eu(g);r[x]||(yv(f,g),r[x]=!0)}return _.isArray(s)?s.forEach(d):d(s),this}};yt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);_.reduceDescriptors(yt.prototype,({value:n},s)=>{let c=s[0].toUpperCase()+s.slice(1);return{get:()=>n,set(r){this[c]=r}}});_.freezeMethods(yt);function pc(n,s){const c=this||fu,r=s||c,f=yt.from(r.headers);let d=r.data;return _.forEach(n,function(x){d=x.call(c,d,f.normalize(),s?s.status:void 0)}),f.normalize(),d}function kh(n){return!!(n&&n.__CANCEL__)}function Pa(n,s,c){ie.call(this,n==null?"canceled":n,ie.ERR_CANCELED,s,c),this.name="CanceledError"}_.inherits(Pa,ie,{__CANCEL__:!0});function Qh(n,s,c){const r=c.config.validateStatus;!c.status||!r||r(c.status)?n(c):s(new ie("Request failed with status code "+c.status,[ie.ERR_BAD_REQUEST,ie.ERR_BAD_RESPONSE][Math.floor(c.status/100)-4],c.config,c.request,c))}function pv(n){const s=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return s&&s[1]||""}function vv(n,s){n=n||10;const c=new Array(n),r=new Array(n);let f=0,d=0,g;return s=s!==void 0?s:1e3,function(p){const m=Date.now(),v=r[d];g||(g=m),c[f]=p,r[f]=m;let E=d,R=0;for(;E!==f;)R+=c[E++],E=E%n;if(f=(f+1)%n,f===d&&(d=(d+1)%n),m-g<s)return;const U=v&&m-v;return U?Math.round(R*1e3/U):void 0}}function xv(n,s){let c=0,r=1e3/s,f,d;const g=(m,v=Date.now())=>{c=v,f=null,d&&(clearTimeout(d),d=null),n(...m)};return[(...m)=>{const v=Date.now(),E=v-c;E>=r?g(m,v):(f=m,d||(d=setTimeout(()=>{d=null,g(f)},r-E)))},()=>f&&g(f)]}const Ui=(n,s,c=3)=>{let r=0;const f=vv(50,250);return xv(d=>{const g=d.loaded,x=d.lengthComputable?d.total:void 0,p=g-r,m=f(p),v=g<=x;r=g;const E={loaded:g,total:x,progress:x?g/x:void 0,bytes:p,rate:m||void 0,estimated:m&&x&&v?(x-g)/m:void 0,event:d,lengthComputable:x!=null,[s?"download":"upload"]:!0};n(E)},c)},th=(n,s)=>{const c=n!=null;return[r=>s[0]({lengthComputable:c,total:n,loaded:r}),s[1]]},lh=n=>(...s)=>_.asap(()=>n(...s)),bv=it.hasStandardBrowserEnv?((n,s)=>c=>(c=new URL(c,it.origin),n.protocol===c.protocol&&n.host===c.host&&(s||n.port===c.port)))(new URL(it.origin),it.navigator&&/(msie|trident)/i.test(it.navigator.userAgent)):()=>!0,Sv=it.hasStandardBrowserEnv?{write(n,s,c,r,f,d){const g=[n+"="+encodeURIComponent(s)];_.isNumber(c)&&g.push("expires="+new Date(c).toGMTString()),_.isString(r)&&g.push("path="+r),_.isString(f)&&g.push("domain="+f),d===!0&&g.push("secure"),document.cookie=g.join("; ")},read(n){const s=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return s?decodeURIComponent(s[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function wv(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function Nv(n,s){return s?n.replace(/\/?\/$/,"")+"/"+s.replace(/^\/+/,""):n}function Zh(n,s,c){let r=!wv(s);return n&&(r||c==!1)?Nv(n,s):s}const ah=n=>n instanceof yt?pe({},n):n;function ra(n,s){s=s||{};const c={};function r(m,v,E,R){return _.isPlainObject(m)&&_.isPlainObject(v)?_.merge.call({caseless:R},m,v):_.isPlainObject(v)?_.merge({},v):_.isArray(v)?v.slice():v}function f(m,v,E,R){if(_.isUndefined(v)){if(!_.isUndefined(m))return r(void 0,m,E,R)}else return r(m,v,E,R)}function d(m,v){if(!_.isUndefined(v))return r(void 0,v)}function g(m,v){if(_.isUndefined(v)){if(!_.isUndefined(m))return r(void 0,m)}else return r(void 0,v)}function x(m,v,E){if(E in s)return r(m,v);if(E in n)return r(void 0,m)}const p={url:d,method:d,data:d,baseURL:g,transformRequest:g,transformResponse:g,paramsSerializer:g,timeout:g,timeoutMessage:g,withCredentials:g,withXSRFToken:g,adapter:g,responseType:g,xsrfCookieName:g,xsrfHeaderName:g,onUploadProgress:g,onDownloadProgress:g,decompress:g,maxContentLength:g,maxBodyLength:g,beforeRedirect:g,transport:g,httpAgent:g,httpsAgent:g,cancelToken:g,socketPath:g,responseEncoding:g,validateStatus:x,headers:(m,v,E)=>f(ah(m),ah(v),E,!0)};return _.forEach(Object.keys(pe(pe({},n),s)),function(v){const E=p[v]||f,R=E(n[v],s[v],v);_.isUndefined(R)&&E!==x||(c[v]=R)}),c}const Kh=n=>{const s=ra({},n);let{data:c,withXSRFToken:r,xsrfHeaderName:f,xsrfCookieName:d,headers:g,auth:x}=s;s.headers=g=yt.from(g),s.url=Vh(Zh(s.baseURL,s.url,s.allowAbsoluteUrls),n.params,n.paramsSerializer),x&&g.set("Authorization","Basic "+btoa((x.username||"")+":"+(x.password?unescape(encodeURIComponent(x.password)):"")));let p;if(_.isFormData(c)){if(it.hasStandardBrowserEnv||it.hasStandardBrowserWebWorkerEnv)g.setContentType(void 0);else if((p=g.getContentType())!==!1){const[m,...v]=p?p.split(";").map(E=>E.trim()).filter(Boolean):[];g.setContentType([m||"multipart/form-data",...v].join("; "))}}if(it.hasStandardBrowserEnv&&(r&&_.isFunction(r)&&(r=r(s)),r||r!==!1&&bv(s.url))){const m=f&&d&&Sv.read(d);m&&g.set(f,m)}return s},Ev=typeof XMLHttpRequest!="undefined",jv=Ev&&function(n){return new Promise(function(c,r){const f=Kh(n);let d=f.data;const g=yt.from(f.headers).normalize();let{responseType:x,onUploadProgress:p,onDownloadProgress:m}=f,v,E,R,U,M;function z(){U&&U(),M&&M(),f.cancelToken&&f.cancelToken.unsubscribe(v),f.signal&&f.signal.removeEventListener("abort",v)}let D=new XMLHttpRequest;D.open(f.method.toUpperCase(),f.url,!0),D.timeout=f.timeout;function V(){if(!D)return;const k=yt.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),X={data:!x||x==="text"||x==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:k,config:n,request:D};Qh(function(ce){c(ce),z()},function(ce){r(ce),z()},X),D=null}"onloadend"in D?D.onloadend=V:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(V)},D.onabort=function(){D&&(r(new ie("Request aborted",ie.ECONNABORTED,n,D)),D=null)},D.onerror=function(){r(new ie("Network Error",ie.ERR_NETWORK,n,D)),D=null},D.ontimeout=function(){let I=f.timeout?"timeout of "+f.timeout+"ms exceeded":"timeout exceeded";const X=f.transitional||Gh;f.timeoutErrorMessage&&(I=f.timeoutErrorMessage),r(new ie(I,X.clarifyTimeoutError?ie.ETIMEDOUT:ie.ECONNABORTED,n,D)),D=null},d===void 0&&g.setContentType(null),"setRequestHeader"in D&&_.forEach(g.toJSON(),function(I,X){D.setRequestHeader(X,I)}),_.isUndefined(f.withCredentials)||(D.withCredentials=!!f.withCredentials),x&&x!=="json"&&(D.responseType=f.responseType),m&&([R,M]=Ui(m,!0),D.addEventListener("progress",R)),p&&D.upload&&([E,U]=Ui(p),D.upload.addEventListener("progress",E),D.upload.addEventListener("loadend",U)),(f.cancelToken||f.signal)&&(v=k=>{D&&(r(!k||k.type?new Pa(null,n,D):k),D.abort(),D=null)},f.cancelToken&&f.cancelToken.subscribe(v),f.signal&&(f.signal.aborted?v():f.signal.addEventListener("abort",v)));const G=pv(f.url);if(G&&it.protocols.indexOf(G)===-1){r(new ie("Unsupported protocol "+G+":",ie.ERR_BAD_REQUEST,n));return}D.send(d||null)})},Rv=(n,s)=>{const{length:c}=n=n?n.filter(Boolean):[];if(s||c){let r=new AbortController,f;const d=function(m){if(!f){f=!0,x();const v=m instanceof Error?m:this.reason;r.abort(v instanceof ie?v:new Pa(v instanceof Error?v.message:v))}};let g=s&&setTimeout(()=>{g=null,d(new ie(`timeout ${s} of ms exceeded`,ie.ETIMEDOUT))},s);const x=()=>{n&&(g&&clearTimeout(g),g=null,n.forEach(m=>{m.unsubscribe?m.unsubscribe(d):m.removeEventListener("abort",d)}),n=null)};n.forEach(m=>m.addEventListener("abort",d));const{signal:p}=r;return p.unsubscribe=()=>_.asap(x),p}},Tv=function*(n,s){let c=n.byteLength;if(c<s){yield n;return}let r=0,f;for(;r<c;)f=r+s,yield n.slice(r,f),r=f},Av=function(n,s){return ic(this,null,function*(){try{for(var c=_0(Dv(n)),r,f,d;r=!(f=yield new na(c.next())).done;r=!1){const g=f.value;yield*sc(Tv(g,s))}}catch(f){d=[f]}finally{try{r&&(f=c.return)&&(yield new na(f.call(c)))}finally{if(d)throw d[0]}}})},Dv=function(n){return ic(this,null,function*(){if(n[Symbol.asyncIterator]){yield*sc(n);return}const s=n.getReader();try{for(;;){const{done:c,value:r}=yield new na(s.read());if(c)break;yield r}}finally{yield new na(s.cancel())}})},nh=(n,s,c,r)=>{const f=Av(n,s);let d=0,g,x=m=>{g||(g=!0,r&&r(m))};return new ReadableStream({pull(m){return Oe(this,null,function*(){try{const{done:v,value:E}=yield f.next();if(v){x(),m.close();return}let R=E.byteLength;if(c){let U=d+=R;c(U)}m.enqueue(new Uint8Array(E))}catch(v){throw x(v),v}})},cancel(m){return x(m),f.return()}},{highWaterMark:2})},ki=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Jh=ki&&typeof ReadableStream=="function",Ov=ki&&(typeof TextEncoder=="function"?(n=>s=>n.encode(s))(new TextEncoder):n=>Oe(null,null,function*(){return new Uint8Array(yield new Response(n).arrayBuffer())})),$h=(n,...s)=>{try{return!!n(...s)}catch(c){return!1}},Cv=Jh&&$h(()=>{let n=!1;const s=new Request(it.origin,{body:new ReadableStream,method:"POST",get duplex(){return n=!0,"half"}}).headers.has("Content-Type");return n&&!s}),uh=64*1024,jc=Jh&&$h(()=>_.isReadableStream(new Response("").body)),Bi={stream:jc&&(n=>n.body)};ki&&(n=>{["text","arrayBuffer","blob","formData","stream"].forEach(s=>{!Bi[s]&&(Bi[s]=_.isFunction(n[s])?c=>c[s]():(c,r)=>{throw new ie(`Response type '${s}' is not supported`,ie.ERR_NOT_SUPPORT,r)})})})(new Response);const Mv=n=>Oe(null,null,function*(){if(n==null)return 0;if(_.isBlob(n))return n.size;if(_.isSpecCompliantForm(n))return(yield new Request(it.origin,{method:"POST",body:n}).arrayBuffer()).byteLength;if(_.isArrayBufferView(n)||_.isArrayBuffer(n))return n.byteLength;if(_.isURLSearchParams(n)&&(n=n+""),_.isString(n))return(yield Ov(n)).byteLength}),zv=(n,s)=>Oe(null,null,function*(){const c=_.toFiniteNumber(n.getContentLength());return c==null?Mv(s):c}),_v=ki&&(n=>Oe(null,null,function*(){let{url:s,method:c,data:r,signal:f,cancelToken:d,timeout:g,onDownloadProgress:x,onUploadProgress:p,responseType:m,headers:v,withCredentials:E="same-origin",fetchOptions:R}=Kh(n);m=m?(m+"").toLowerCase():"text";let U=Rv([f,d&&d.toAbortSignal()],g),M;const z=U&&U.unsubscribe&&(()=>{U.unsubscribe()});let D;try{if(p&&Cv&&c!=="get"&&c!=="head"&&(D=yield zv(v,r))!==0){let X=new Request(s,{method:"POST",body:r,duplex:"half"}),F;if(_.isFormData(r)&&(F=X.headers.get("content-type"))&&v.setContentType(F),X.body){const[ce,fe]=th(D,Ui(lh(p)));r=nh(X.body,uh,ce,fe)}}_.isString(E)||(E=E?"include":"omit");const V="credentials"in Request.prototype;M=new Request(s,nt(pe({},R),{signal:U,method:c.toUpperCase(),headers:v.normalize().toJSON(),body:r,duplex:"half",credentials:V?E:void 0}));let G=yield fetch(M,R);const k=jc&&(m==="stream"||m==="response");if(jc&&(x||k&&z)){const X={};["status","statusText","headers"].forEach(Ce=>{X[Ce]=G[Ce]});const F=_.toFiniteNumber(G.headers.get("content-length")),[ce,fe]=x&&th(F,Ui(lh(x),!0))||[];G=new Response(nh(G.body,uh,ce,()=>{fe&&fe(),z&&z()}),X)}m=m||"text";let I=yield Bi[_.findKey(Bi,m)||"text"](G,n);return!k&&z&&z(),yield new Promise((X,F)=>{Qh(X,F,{data:I,headers:yt.from(G.headers),status:G.status,statusText:G.statusText,config:n,request:M})})}catch(V){throw z&&z(),V&&V.name==="TypeError"&&/Load failed|fetch/i.test(V.message)?Object.assign(new ie("Network Error",ie.ERR_NETWORK,n,M),{cause:V.cause||V}):ie.from(V,V&&V.code,n,M)}})),Rc={http:$p,xhr:jv,fetch:_v};_.forEach(Rc,(n,s)=>{if(n){try{Object.defineProperty(n,"name",{value:s})}catch(c){}Object.defineProperty(n,"adapterName",{value:s})}});const ih=n=>`- ${n}`,Uv=n=>_.isFunction(n)||n===null||n===!1,Fh={getAdapter:n=>{n=_.isArray(n)?n:[n];const{length:s}=n;let c,r;const f={};for(let d=0;d<s;d++){c=n[d];let g;if(r=c,!Uv(c)&&(r=Rc[(g=String(c)).toLowerCase()],r===void 0))throw new ie(`Unknown adapter '${g}'`);if(r)break;f[g||"#"+d]=r}if(!r){const d=Object.entries(f).map(([x,p])=>`adapter ${x} `+(p===!1?"is not supported by the environment":"is not available in the build"));let g=s?d.length>1?`since :
63
63
  `+d.map(ih).join(`
64
64
  `):" "+ih(d[0]):"as no adapter specified";throw new ie("There is no suitable adapter to dispatch the request "+g,"ERR_NOT_SUPPORT")}return r},adapters:Rc};function vc(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new Pa(null,n)}function sh(n){return vc(n),n.headers=yt.from(n.headers),n.data=pc.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),Fh.getAdapter(n.adapter||fu.adapter)(n).then(function(r){return vc(n),r.data=pc.call(n,n.transformResponse,r),r.headers=yt.from(r.headers),r},function(r){return kh(r)||(vc(n),r&&r.response&&(r.response.data=pc.call(n,n.transformResponse,r.response),r.response.headers=yt.from(r.response.headers))),Promise.reject(r)})}const Wh="1.11.0",Qi={};["object","boolean","number","function","string","symbol"].forEach((n,s)=>{Qi[n]=function(r){return typeof r===n||"a"+(s<1?"n ":" ")+n}});const rh={};Qi.transitional=function(s,c,r){function f(d,g){return"[Axios v"+Wh+"] Transitional option '"+d+"'"+g+(r?". "+r:"")}return(d,g,x)=>{if(s===!1)throw new ie(f(g," has been removed"+(c?" in "+c:"")),ie.ERR_DEPRECATED);return c&&!rh[g]&&(rh[g]=!0,console.warn(f(g," has been deprecated since v"+c+" and will be removed in the near future"))),s?s(d,g,x):!0}};Qi.spelling=function(s){return(c,r)=>(console.warn(`${r} is likely a misspelling of ${s}`),!0)};function Bv(n,s,c){if(typeof n!="object")throw new ie("options must be an object",ie.ERR_BAD_OPTION_VALUE);const r=Object.keys(n);let f=r.length;for(;f-- >0;){const d=r[f],g=s[d];if(g){const x=n[d],p=x===void 0||g(x,d,n);if(p!==!0)throw new ie("option "+d+" must be "+p,ie.ERR_BAD_OPTION_VALUE);continue}if(c!==!0)throw new ie("Unknown option "+d,ie.ERR_BAD_OPTION)}}const zi={assertOptions:Bv,validators:Qi},Kt=zi.validators;let sa=class{constructor(s){this.defaults=s||{},this.interceptors={request:new I0,response:new I0}}request(s,c){return Oe(this,null,function*(){try{return yield this._request(s,c)}catch(r){if(r instanceof Error){let f={};Error.captureStackTrace?Error.captureStackTrace(f):f=new Error;const d=f.stack?f.stack.replace(/^.+\n/,""):"";try{r.stack?d&&!String(r.stack).endsWith(d.replace(/^.+\n.+\n/,""))&&(r.stack+=`
65
- `+d):r.stack=d}catch(g){}}throw r}})}_request(s,c){typeof s=="string"?(c=c||{},c.url=s):c=s||{},c=ra(this.defaults,c);const{transitional:r,paramsSerializer:f,headers:d}=c;r!==void 0&&zi.assertOptions(r,{silentJSONParsing:Kt.transitional(Kt.boolean),forcedJSONParsing:Kt.transitional(Kt.boolean),clarifyTimeoutError:Kt.transitional(Kt.boolean)},!1),f!=null&&(_.isFunction(f)?c.paramsSerializer={serialize:f}:zi.assertOptions(f,{encode:Kt.function,serialize:Kt.function},!0)),c.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?c.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:c.allowAbsoluteUrls=!0),zi.assertOptions(c,{baseUrl:Kt.spelling("baseURL"),withXsrfToken:Kt.spelling("withXSRFToken")},!0),c.method=(c.method||this.defaults.method||"get").toLowerCase();let g=d&&_.merge(d.common,d[c.method]);d&&_.forEach(["delete","get","head","post","put","patch","common"],M=>{delete d[M]}),c.headers=yt.concat(g,d);const x=[];let p=!0;this.interceptors.request.forEach(function(z){typeof z.runWhen=="function"&&z.runWhen(c)===!1||(p=p&&z.synchronous,x.unshift(z.fulfilled,z.rejected))});const m=[];this.interceptors.response.forEach(function(z){m.push(z.fulfilled,z.rejected)});let v,E=0,R;if(!p){const M=[sh.bind(this),void 0];for(M.unshift(...x),M.push(...m),R=M.length,v=Promise.resolve(c);E<R;)v=v.then(M[E++],M[E++]);return v}R=x.length;let U=c;for(E=0;E<R;){const M=x[E++],z=x[E++];try{U=M(U)}catch(D){z.call(this,D);break}}try{v=sh.call(this,U)}catch(M){return Promise.reject(M)}for(E=0,R=m.length;E<R;)v=v.then(m[E++],m[E++]);return v}getUri(s){s=ra(this.defaults,s);const c=Zh(s.baseURL,s.url,s.allowAbsoluteUrls);return Vh(c,s.params,s.paramsSerializer)}};_.forEach(["delete","get","head","options"],function(s){sa.prototype[s]=function(c,r){return this.request(ra(r||{},{method:s,url:c,data:(r||{}).data}))}});_.forEach(["post","put","patch"],function(s){function c(r){return function(d,g,x){return this.request(ra(x||{},{method:s,headers:r?{"Content-Type":"multipart/form-data"}:{},url:d,data:g}))}}sa.prototype[s]=c(),sa.prototype[s+"Form"]=c(!0)});let Hv=class Ph{constructor(s){if(typeof s!="function")throw new TypeError("executor must be a function.");let c;this.promise=new Promise(function(d){c=d});const r=this;this.promise.then(f=>{if(!r._listeners)return;let d=r._listeners.length;for(;d-- >0;)r._listeners[d](f);r._listeners=null}),this.promise.then=f=>{let d;const g=new Promise(x=>{r.subscribe(x),d=x}).then(f);return g.cancel=function(){r.unsubscribe(d)},g},s(function(d,g,x){r.reason||(r.reason=new Pa(d,g,x),c(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(s){if(this.reason){s(this.reason);return}this._listeners?this._listeners.push(s):this._listeners=[s]}unsubscribe(s){if(!this._listeners)return;const c=this._listeners.indexOf(s);c!==-1&&this._listeners.splice(c,1)}toAbortSignal(){const s=new AbortController,c=r=>{s.abort(r)};return this.subscribe(c),s.signal.unsubscribe=()=>this.unsubscribe(c),s.signal}static source(){let s;return{token:new Ph(function(f){s=f}),cancel:s}}};function Lv(n){return function(c){return n.apply(null,c)}}function qv(n){return _.isObject(n)&&n.isAxiosError===!0}const Tc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Tc).forEach(([n,s])=>{Tc[s]=n});function Ih(n){const s=new sa(n),c=Dh(sa.prototype.request,s);return _.extend(c,sa.prototype,s,{allOwnKeys:!0}),_.extend(c,s,null,{allOwnKeys:!0}),c.create=function(f){return Ih(ra(n,f))},c}const me=Ih(fu);me.Axios=sa;me.CanceledError=Pa;me.CancelToken=Hv;me.isCancel=kh;me.VERSION=Wh;me.toFormData=Xi;me.AxiosError=ie;me.Cancel=me.CanceledError;me.all=function(s){return Promise.all(s)};me.spread=Lv;me.isAxiosError=qv;me.mergeConfig=ra;me.AxiosHeaders=yt;me.formToJSON=n=>Xh(_.isHTMLForm(n)?new FormData(n):n);me.getAdapter=Fh.getAdapter;me.HttpStatusCode=Tc;me.default=me;const{Axios:D2,AxiosError:O2,CanceledError:C2,isCancel:M2,CancelToken:z2,VERSION:_2,all:U2,Cancel:B2,isAxiosError:H2,spread:L2,toFormData:q2,AxiosHeaders:Y2,HttpStatusCode:V2,formToJSON:G2,getAdapter:X2,mergeConfig:k2}=me,ch=n=>{let s;const c=new Set,r=(m,v)=>{const E=typeof m=="function"?m(s):m;if(!Object.is(E,s)){const R=s;s=(v!=null?v:typeof E!="object"||E===null)?E:Object.assign({},s,E),c.forEach(U=>U(s,R))}},f=()=>s,x={setState:r,getState:f,getInitialState:()=>p,subscribe:m=>(c.add(m),()=>c.delete(m))},p=s=n(r,f,x);return x},Yv=n=>n?ch(n):ch,Vv=n=>n;function Gv(n,s=Vv){const c=Ti.useSyncExternalStore(n.subscribe,Ti.useCallback(()=>s(n.getState()),[n,s]),Ti.useCallback(()=>s(n.getInitialState()),[n,s]));return Ti.useDebugValue(c),c}const oh=n=>{const s=Yv(n),c=r=>Gv(s,r);return Object.assign(c,s),c},em=n=>n?oh(n):oh,st=window.location.origin,Hi=em(n=>({Rootname:"",setRootname:s=>n({Rootname:s})})),ct=em(n=>({TransactionKey:"",setTransactionKey:s=>n({TransactionKey:s}),loadKey:()=>Oe(null,null,function*(){if(sessionStorage.getItem("transactionToken")){n({TransactionKey:sessionStorage.getItem("transactionToken")});return}yield me.get(`${st}/api/get-token`).then(s=>{var c,r,f,d;s.status===200&&(sessionStorage.setItem("transactionToken",(r=(c=s.data)==null?void 0:c.data)==null?void 0:r.originSessionKey),n({TransactionKey:(d=(f=s.data)==null?void 0:f.data)==null?void 0:d.originSessionKey}))}).catch(s=>{console.error("Error fetching transaction key:",s)})})})),Xv=()=>{const[n,s]=S.useState(!1),{Rootname:c}=Hi(d=>d),{setRootname:r}=Hi(d=>d),{TransactionKey:f}=ct(d=>d);return S.useEffect(()=>{me.get(`${st}/api/db/databases?transactiontoken=${f}`).then(d=>{var g;d.status===200&&r((g=d.data.data.RootName)!=null?g:"AxioDB")})},[]),o.jsx("header",{className:"bg-gradient-to-r from-blue-700 to-indigo-800 shadow-lg",children:o.jsx("nav",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:o.jsx("div",{className:"flex items-center justify-between h-16",children:o.jsxs("div",{className:"flex items-center",children:[o.jsx("div",{className:"flex-shrink-0",children:o.jsxs(tu,{to:"/",className:"flex items-center",children:[o.jsx("img",{src:"/AXioDB.png",alt:"AxioDB Logo",className:"h-9 w-9"}),o.jsxs("span",{className:"ml-2 text-white font-bold text-xl tracking-tight",children:[c," Admin Hub"]})]})}),o.jsx("div",{className:"hidden md:block ml-10",children:o.jsxs("div",{className:"flex space-x-4",children:[o.jsx(tu,{to:"/",className:"text-blue-100 hover:bg-blue-600 hover:text-white px-3 py-2 rounded-md text-sm font-medium transition-colors",children:"Dashboard"}),o.jsx(tu,{to:"/operations",className:"text-blue-100 hover:bg-blue-600 hover:text-white px-3 py-2 rounded-md text-sm font-medium transition-colors",children:"Operations"})]})})]})})})})};function kv(n,s){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},n),S.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"}))}const Qv=S.forwardRef(kv);function Zv(n,s){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},n),S.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"}))}const Kv=S.forwardRef(Zv);function Jv(n,s){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},n),S.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"}))}const tm=S.forwardRef(Jv);function $v(n,s){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},n),S.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"}))}const Fv=S.forwardRef($v);function Wv(n,s){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},n),S.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"}))}const Pv=S.forwardRef(Wv);function Iv(n,s){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},n),S.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"}))}const e2=S.forwardRef(Iv);function t2(n,s){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:s},n),S.createElement("path",{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"}))}const l2=S.forwardRef(t2);function a2(n,s){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:s},n),S.createElement("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"}))}const n2=S.forwardRef(a2),u2=({treeDB:n})=>{const[s,c]=S.useState(!0),[r,f]=S.useState({}),[d,g]=S.useState([]),x=m=>{f(v=>nt(pe({},v),{[m]:!v[m]}))};S.useEffect(()=>{const m=()=>{if(!n||!Array.isArray(n)){g([]),c(!1);return}const v=n.map((E,R)=>{const U=`db${R+1}`;return{id:U,name:E.name,type:"database",children:Array.isArray(E.collections)?E.collections.map((M,z)=>({id:`${U}_col${z+1}`,name:M.name||M,type:"collection",documentCount:M.documentCount||0,size:"0 MB"})):[]}});v.length>0&&f({[v[0].id]:!0}),g(v),c(!1)};setTimeout(()=>{m()},500)},[n]);const p=m=>{const v=r[m.id];return o.jsxs("div",{children:[o.jsxs("div",{className:`flex items-center py-2 px-3 ${m.type==="database"?"bg-blue-50 hover:bg-blue-100 border-b border-blue-100":"hover:bg-gray-50 pl-10"} cursor-pointer transition-colors`,onClick:()=>m.children&&x(m.id),children:[m.children?o.jsx("div",{className:"mr-1",children:v?o.jsx(l2,{className:"h-4 w-4 text-gray-500"}):o.jsx(n2,{className:"h-4 w-4 text-gray-500"})}):o.jsx("div",{className:"w-4 mr-1"}),m.type==="database"?o.jsx(tm,{className:"h-5 w-5 text-blue-600 mr-2"}):o.jsx(Pv,{className:"h-5 w-5 text-yellow-600 mr-2"}),o.jsx("div",{className:"flex-grow",children:o.jsx("span",{className:"font-medium",children:m.name})}),m.type==="collection"&&o.jsx("div",{className:"text-xs text-gray-500",children:o.jsxs("span",{className:"mr-2",children:[m.documentCount," docs"]})})]}),m.children&&v&&o.jsx("div",{className:"border-l border-gray-200 ml-5",children:m.children.map(p)})]},m.id)};return o.jsxs("div",{className:"bg-white rounded-lg shadow-md hover:shadow-lg transition-shadow",children:[o.jsxs("div",{className:"border-b border-gray-200 py-4 px-6",children:[o.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Database Structure"}),o.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Overview of databases and collections"})]}),o.jsx("div",{className:"overflow-y-auto",style:{maxHeight:"400px"},children:s?o.jsx("div",{className:"p-6 space-y-3",children:[1,2,3].map(m=>o.jsxs("div",{className:"animate-pulse",children:[o.jsx("div",{className:"h-6 bg-gray-200 rounded w-3/4 mb-2"}),o.jsxs("div",{className:"pl-6 space-y-2",children:[o.jsx("div",{className:"h-5 bg-gray-100 rounded w-2/3"}),o.jsx("div",{className:"h-5 bg-gray-100 rounded w-2/3"}),o.jsx("div",{className:"h-5 bg-gray-100 rounded w-2/3"})]})]},m))}):o.jsx("div",{children:d.map(p)})})]})},i2=({CacheStorageInfo:n})=>{const[s,c]=S.useState(!0);S.useEffect(()=>{(()=>{setTimeout(()=>{c(!1)},800)})()},[]);const r=n.Storage/n.Max*100;return o.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow",children:[o.jsxs("div",{className:"flex justify-between mb-3",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"In-Memory Cache"}),s?o.jsx("div",{className:"h-8 mt-2 bg-gray-200 rounded animate-pulse w-24"}):o.jsxs("p",{className:"text-3xl font-bold text-orange-600 mt-2",children:[n.Storage," ",o.jsx("span",{className:"text-lg",children:n.Unit})]}),o.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["of ",n.Max," ",n.Unit," allocated"]})]}),o.jsx("div",{className:"p-3 bg-orange-100 rounded-full",children:o.jsx(Qv,{className:"h-8 w-8 text-orange-600"})})]}),o.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2.5 mt-2",children:o.jsx("div",{className:"bg-orange-600 h-2.5 rounded-full",style:{width:`${s?0:r}%`}})})]})},s2=({storageInfo:n})=>{const[s,c]=S.useState(!0);S.useEffect(()=>{(()=>{setTimeout(()=>{c(!1)},800)})()},[]);const r=(n==null?void 0:n.total)/(n==null?void 0:n.machine)*100;return o.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow",children:[o.jsxs("div",{className:"flex justify-between mb-3",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Storage Used"}),s?o.jsx("div",{className:"h-8 mt-2 bg-gray-200 rounded animate-pulse w-24"}):o.jsxs("p",{className:"text-3xl font-bold text-green-600 mt-2",children:[n==null?void 0:n.total," ",o.jsx("span",{className:"text-lg",children:n==null?void 0:n.matrixUnit})]}),o.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["of ",n==null?void 0:n.machine," ",n==null?void 0:n.matrixUnit," available"]})]}),o.jsx("div",{className:"p-3 bg-green-100 rounded-full",children:o.jsx(e2,{className:"h-8 w-8 text-green-600"})})]}),o.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2.5 mt-2",children:o.jsx("div",{className:"bg-green-600 h-2.5 rounded-full",style:{width:`${s?0:r}%`}})})]})},r2=({totalCollections:n})=>{const[s,c]=S.useState(!0);return S.useEffect(()=>{(()=>{setTimeout(()=>{c(!1)},600)})()},[]),o.jsx("div",{className:"bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow",children:o.jsxs("div",{className:"flex justify-between",children:[o.jsx("div",{children:s?o.jsx("div",{className:"h-8 mt-2 bg-gray-200 rounded animate-pulse w-16"}):o.jsxs("p",{className:"text-2xl font-bold text-indigo-600 mt-2",children:[n," ",n<=1?"Collection":"Collections"]})}),o.jsx("div",{className:"p-3 bg-indigo-100 rounded-full",children:o.jsx(Kv,{className:"h-8 w-8 text-indigo-600"})})]})})},c2=({totalDatabases:n})=>{const[s,c]=S.useState(!0);return S.useEffect(()=>{setTimeout(()=>{c(!1)},1e3)},[]),o.jsx("div",{className:"bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow",children:o.jsxs("div",{className:"flex justify-between",children:[o.jsx("div",{children:s?o.jsx("div",{className:"h-8 mt-2 bg-gray-200 rounded animate-pulse w-16 text-center"}):o.jsx("p",{className:"text-2xl font-bold text-blue-600 mt-2 text-center",children:n<=1?`${n} Database`:`${n} Databases`})}),o.jsx("div",{className:"p-3 bg-blue-100 rounded-full",children:o.jsx(tm,{className:"h-8 w-8 text-blue-600"})})]})})},o2=({totalDocuments:n})=>{const[s,c]=S.useState(!0);return S.useEffect(()=>{(()=>{setTimeout(()=>{c(!1)},700)})()},[]),o.jsx("div",{className:"bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow",children:o.jsxs("div",{className:"flex justify-between",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Total Documents"}),s?o.jsx("div",{className:"h-8 mt-2 bg-gray-200 rounded animate-pulse w-20"}):o.jsx("p",{className:"text-3xl font-bold text-purple-600 mt-2",children:n}),o.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Across all collections"})]}),o.jsx("div",{className:"p-3 bg-purple-100 rounded-full",children:o.jsx(Fv,{className:"h-8 w-8 text-purple-600"})})]})})},f2=()=>{const[n,s]=S.useState(!0),[c,r]=S.useState(null),{TransactionKey:f}=ct(d=>d);return S.useEffect(()=>{me.get(`${st}/api/dashboard-stats?transactiontoken=${f}`).then(d=>{d.status===200&&(r(d.data.data),s(!1))})},[]),o.jsxs("div",{className:"container mx-auto px-4 py-6",children:[o.jsx("div",{className:"mb-6",children:o.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Dashboard"})}),n?o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-6 mb-8",children:[1,2,3,4,5].map(d=>o.jsx("div",{className:"h-32 bg-gray-200 rounded-lg animate-pulse"},d))}):o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-6 mb-8",children:[o.jsx(c2,{totalDatabases:(c==null?void 0:c.totalDatabases)||0}),o.jsx(r2,{totalCollections:(c==null?void 0:c.totalCollections)||0}),o.jsx(o2,{totalDocuments:(c==null?void 0:c.totalDocuments)||0}),o.jsx(s2,{storageInfo:(c==null?void 0:c.storageInfo)||{}}),o.jsx(i2,{CacheStorageInfo:(c==null?void 0:c.cacheStorage)||{}})]}),o.jsx("div",{className:"mb-8",children:o.jsx(u2,{treeDB:(c==null?void 0:c.nodeTree)||[]})})]})},d2=({isOpen:n,onClose:s,onDatabaseCreated:c})=>{const[r,f]=S.useState(""),[d,g]=S.useState(!1),[x,p]=S.useState(""),{TransactionKey:m}=ct(R=>R),v=()=>{f(""),p(""),g(!1),s()},E=R=>Oe(null,null,function*(){var U,M;if(R.preventDefault(),!r.trim()){p("Database name is required");return}if(!/^[a-zA-Z0-9_]+$/.test(r)){p("Database name can only contain letters, numbers, and underscores");return}g(!0),p("");try{const z=yield me.post(`${st}/api/db/create-database`,{name:r},{params:{transactiontoken:m}});if(z.data.statusCode===200||z.data.statusCode===201)c(r),g(!1),v();else throw g(!1),new Error("Failed to create database")}catch(z){console.error("Error creating database:",z),p(((M=(U=z.response)==null?void 0:U.data)==null?void 0:M.message)||"Failed to create database. Please try again."),g(!1)}});return n?o.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 animate-fadeIn",children:o.jsxs("div",{className:"bg-white rounded-lg max-w-md w-full p-6",children:[o.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-4",children:"Create New Database"}),o.jsxs("form",{onSubmit:E,children:[o.jsxs("div",{className:"mb-4",children:[o.jsx("label",{htmlFor:"databaseName",className:"block text-sm font-medium text-gray-700 mb-1",children:"Database Name"}),o.jsx("input",{type:"text",id:"databaseName",value:r,onChange:R=>f(R.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"Enter database name",disabled:d}),x&&o.jsx("p",{className:"mt-2 text-sm text-red-600",children:x})]}),o.jsxs("div",{className:"flex justify-end space-x-4 mt-6",children:[o.jsx("button",{type:"button",onClick:v,className:"px-4 py-2 text-gray-700 hover:text-gray-900 transition-colors",disabled:d,children:"Cancel"}),o.jsx("button",{type:"submit",className:`px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 transition-colors flex items-center ${d?"opacity-75 cursor-not-allowed":""}`,disabled:d,children:d?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Creating..."]}):"Create Database"})]})]})]})}):null},h2=({isOpen:n,dbName:s,onClose:c,onConfirmDelete:r})=>{const{TransactionKey:f}=ct(p=>p),[d,g]=S.useState(!1);if(!n)return null;const x=()=>Oe(null,null,function*(){var p,m;g(!0);try{const v=yield me.delete(`${st}/api/db/delete-database`,{params:{transactiontoken:f,dbName:s}});if(v.status===200)console.log("Database deleted successfully:",v.data),r();else throw new Error("Failed to delete database")}catch(v){console.error("Error deleting database:",v),alert(((m=(p=v.response)==null?void 0:p.data)==null?void 0:m.message)||"Failed to delete database. Please try again.")}finally{g(!1)}});return o.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:o.jsxs("div",{className:"bg-white rounded-lg max-w-md w-full p-6 animate-fadeIn",children:[o.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-4",children:"Confirm Deletion"}),o.jsxs("p",{className:"text-gray-700 mb-6",children:['Are you sure you want to delete the database "',s,'"? This action cannot be undone.']}),o.jsxs("div",{className:"flex justify-end space-x-4",children:[o.jsx("button",{onClick:c,disabled:d,className:"px-4 py-2 text-gray-700 hover:text-gray-900 transition-colors",children:"Cancel"}),o.jsx("button",{onClick:x,disabled:d,className:`px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 transition-colors flex items-center ${d?"opacity-75 cursor-not-allowed":""}`,children:d?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Deleting..."]}):"Delete"})]})]})})},m2=({databases:n,onDeleteClick:s,loading:c})=>{const r=iu(),[f,d]=S.useState({}),g=p=>{d(m=>nt(pe({},m),{[p]:!1}))},x=p=>{r(`/collections?database=${encodeURIComponent(p)}`)};return o.jsxs("div",{className:"bg-white rounded-lg shadow-md overflow-hidden",children:[o.jsxs("div",{className:"border-b border-gray-200 bg-gray-50 px-6 py-4",children:[o.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Your Databases"}),o.jsxs("p",{className:"text-sm text-gray-500",children:["Total: ",c?"Loading...":n==null?void 0:n.TotalDatabases]})]}),c?o.jsx("div",{className:"p-6",children:[1,2,3].map(p=>o.jsxs("div",{className:"animate-pulse flex items-center justify-between py-4 border-b border-gray-100",children:[o.jsxs("div",{children:[o.jsx("div",{className:"h-6 bg-gray-200 rounded w-48 mb-2"}),o.jsx("div",{className:"h-4 bg-gray-100 rounded w-32"})]}),o.jsx("div",{className:"h-8 bg-gray-200 rounded w-24"})]},p))}):o.jsx("ul",{className:"divide-y divide-gray-200",children:n!=null&&n.ListOfDatabases&&(n==null?void 0:n.ListOfDatabases.length)>0?n.ListOfDatabases.map((p,m)=>o.jsxs("li",{className:`px-6 py-4 flex items-center justify-between hover:bg-gray-50 transition-all duration-300 ${f[p]?"animate-slideIn":"animate-fadeIn"}`,onAnimationEnd:()=>g(p),children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-lg font-medium text-gray-900",children:p}),o.jsxs("p",{className:"text-sm text-gray-500",children:["Path: ",n.AllDatabasesPaths[m]]})]}),o.jsxs("div",{className:"flex space-x-2",children:[o.jsx("button",{onClick:()=>x(p),className:"text-blue-600 hover:text-blue-800 px-3 py-1 rounded border border-blue-200 hover:border-blue-400 transition-colors",children:"View Collections"}),o.jsx("button",{onClick:()=>s(p),className:"text-red-600 hover:text-red-800 px-3 py-1 rounded border border-red-200 hover:border-red-400 transition-colors",children:"Delete"})]})]},p)):o.jsx("li",{className:"px-6 py-8 text-center text-gray-500",children:'No databases found. Click "Create Database" to add one.'})})]})},g2=()=>{const[n,s]=S.useState(!0),[c,r]=S.useState([]),[f,d]=S.useState(!1),[g,x]=S.useState(!1),[p,m]=S.useState(""),{TransactionKey:v}=ct(z=>z),{Rootname:E}=Hi(z=>z);S.useEffect(()=>{v&&Oe(null,null,function*(){try{const D=yield me.get(`${st}/api/db/databases?transactiontoken=${v}`);D.status===200&&(r(D.data.data),s(!1))}catch(D){console.error("Error fetching databases:",D),s(!1),r([])}})},[v]);const R=z=>{m(z),d(!0)},U=()=>{r(z=>nt(pe({},z),{ListOfDatabases:z.ListOfDatabases.filter(D=>D!==p),TotalDatabases:`${z.ListOfDatabases.length-1} Databases`})),d(!1),m("")},M=z=>{r(D=>nt(pe({},D),{ListOfDatabases:[...D.ListOfDatabases,z],TotalDatabases:`${D.ListOfDatabases.length+1} Databases`,AllDatabasesPaths:[...D.AllDatabasesPaths,`${D.CurrentPath}/${z}`]}))};return o.jsxs("div",{className:"container mx-auto px-4 py-6",children:[o.jsxs("div",{className:"flex justify-between items-center mb-6",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Databases"}),o.jsxs("p",{className:"text-gray-600",children:["Manage your ",E," databases"]})]}),o.jsxs("button",{onClick:()=>x(!0),className:"bg-green-600 hover:bg-green-700 text-white py-2 px-4 rounded-lg flex items-center transition-colors",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"})}),"Create Database"]})]}),o.jsx(m2,{databases:c,onDeleteClick:R,loading:n}),o.jsx(d2,{isOpen:g,onClose:()=>x(!1),onDatabaseCreated:M}),o.jsx(h2,{isOpen:f,dbName:p,onClose:()=>d(!1),onConfirmDelete:U})]})},y2=({isOpen:n,onClose:s,onCollectionCreated:c,databaseName:r})=>{const[f,d]=S.useState(""),[g,x]=S.useState(!1),[p,m]=S.useState(""),[v,E]=S.useState(!1),[R,U]=S.useState(""),{TransactionKey:M}=ct(V=>V),z=()=>{d(""),x(!1),m(""),U(""),E(!1),s()},D=V=>Oe(null,null,function*(){var G,k;if(V.preventDefault(),!f.trim()){U("Collection name is required");return}if(!/^[a-zA-Z0-9_]+$/.test(f)){U("Collection name can only contain letters, numbers, and underscores");return}if(g&&!p.trim()){U("Encryption key is required when encryption is enabled");return}E(!0),U("");try{const I=yield me.post(`${st}/api/collection/create-collection`,{dbName:r,collectionName:f,crypto:g,key:g?p:""},{params:{transactiontoken:M}});if(I.data.statusCode===200||I.data.statusCode===201)c({name:f,documentCount:0,size:"N/A"}),z();else throw new Error("Failed to create collection")}catch(I){console.error("Error creating collection:",I),U(((k=(G=I.response)==null?void 0:G.data)==null?void 0:k.message)||"Failed to create collection. Please try again."),E(!1)}});return n?o.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 animate-fadeIn",children:o.jsxs("div",{className:"bg-white rounded-lg max-w-md w-full p-6",children:[o.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-4",children:"Create New Collection"}),o.jsxs("form",{onSubmit:D,children:[o.jsxs("div",{className:"mb-4",children:[o.jsx("label",{htmlFor:"databaseName",className:"block text-sm font-medium text-gray-700 mb-1",children:"Database Name"}),o.jsx("input",{type:"text",id:"databaseName",value:r,className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm bg-gray-100 cursor-not-allowed",disabled:!0})]}),o.jsxs("div",{className:"mb-4",children:[o.jsx("label",{htmlFor:"collectionName",className:"block text-sm font-medium text-gray-700 mb-1",children:"Collection Name"}),o.jsx("input",{type:"text",id:"collectionName",value:f,onChange:V=>d(V.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"Enter collection name",disabled:v})]}),o.jsx("div",{className:"mb-4",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("label",{htmlFor:"enableCrypto",className:"text-sm font-medium text-gray-700",children:"Enable Encryption"}),o.jsxs("div",{className:"relative inline-block w-10 mr-2 align-middle select-none",children:[o.jsx("input",{type:"checkbox",id:"enableCrypto",checked:g,onChange:()=>x(!g),className:"toggle-checkbox absolute block w-6 h-6 rounded-full bg-white border-4 appearance-none cursor-pointer",disabled:v}),o.jsx("label",{htmlFor:"enableCrypto",className:`toggle-label block overflow-hidden h-6 rounded-full cursor-pointer ${g?"bg-green-500":"bg-gray-300"}`})]})]})}),g&&o.jsxs("div",{className:"mb-4",children:[o.jsx("label",{htmlFor:"cryptoKey",className:"block text-sm font-medium text-gray-700 mb-1",children:"Encryption Key"}),o.jsx("input",{type:"password",id:"cryptoKey",value:p,onChange:V=>m(V.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"Enter encryption key",disabled:v})]}),R&&o.jsx("p",{className:"mt-2 text-sm text-red-600",children:R}),o.jsxs("div",{className:"flex justify-end space-x-4 mt-6",children:[o.jsx("button",{type:"button",onClick:z,className:"px-4 py-2 text-gray-700 hover:text-gray-900 transition-colors",disabled:v,children:"Cancel"}),o.jsx("button",{type:"submit",className:`px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 transition-colors flex items-center ${v?"opacity-75 cursor-not-allowed":""}`,disabled:v,children:v?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Creating..."]}):"Create Collection"})]})]})]})}):null},p2=({isOpen:n,onClose:s,onCollectionDeleted:c,databaseName:r,collectionName:f})=>{const[d,g]=S.useState(!1),[x,p]=S.useState(""),{TransactionKey:m}=ct(R=>R),v=()=>{p(""),g(!1),s()},E=()=>Oe(null,null,function*(){var R,U;g(!0),p("");try{if((yield me.delete(`${st}/api/collection/delete-collection/?dbName=${r}&collectionName=${f}&transactiontoken=${m}`)).data.statusCode===200)c(f),v();else throw new Error("Failed to delete collection")}catch(M){console.error("Error deleting collection:",M),p(((U=(R=M.response)==null?void 0:R.data)==null?void 0:U.message)||"Failed to delete collection. Please try again."),g(!1)}});return n?o.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 animate-fadeIn",children:o.jsxs("div",{className:"bg-white rounded-lg max-w-md w-full p-6",children:[o.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-4",children:"Delete Collection"}),o.jsxs("p",{className:"mb-6 text-gray-600",children:["Are you sure you want to delete the collection"," ",o.jsx("span",{className:"font-semibold",children:f})," from database"," ",o.jsx("span",{className:"font-semibold",children:r}),"? This action cannot be undone."]}),x&&o.jsx("p",{className:"mb-4 text-sm text-red-600",children:x}),o.jsxs("div",{className:"flex justify-end space-x-4 mt-6",children:[o.jsx("button",{type:"button",onClick:v,className:"px-4 py-2 text-gray-700 hover:text-gray-900 transition-colors",disabled:d,children:"Cancel"}),o.jsx("button",{type:"button",onClick:E,className:`px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 transition-colors flex items-center ${d?"opacity-75 cursor-not-allowed":""}`,disabled:d,children:d?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Deleting..."]}):"Delete Collection"})]})]})}):null},v2=()=>{const[n]=Ah(),s=iu(),[c,r]=S.useState(!0),[f,d]=S.useState([]),[g,x]=S.useState([]),[p,m]=S.useState(!1),[v,E]=S.useState(!1),[R,U]=S.useState(""),M=n.get("database"),{TransactionKey:z}=ct(F=>F),{Rootname:D}=Hi(F=>F),V=()=>Oe(null,null,function*(){try{const F=yield me.get(`${st}/api/collection/all/?databaseName=${M}&transactiontoken=${z}`);if(F.status===200){const ce=F.data.data||{};if(ce.ListOfCollections&&Array.isArray(ce.ListOfCollections)){const fe=ce.CollectionSizeMap||[],Ce=ce.collectionMetaStatus||[];x(Ce);const tt=ce.ListOfCollections.map(we=>{const xe=fe.find(Ke=>{const qe=Ke.folderPath.split("/");return qe[qe.length-1]===we}),ze=Ce.find(Ke=>Ke.name===we);return{name:we,documentCount:xe?xe.fileCount:0,isEncrypted:(ze==null?void 0:ze.isEncrypted)||!1,isSchemaNeeded:(ze==null?void 0:ze.isSchemaNeeded)||!1,schema:(ze==null?void 0:ze.schema)||{}}});d(tt)}else d([]);r(!1)}}catch(F){console.error("Error fetching collections:",F),r(!1),d([])}});S.useEffect(()=>{if(!M){s("/databases");return}z&&V()},[z,M,s]);const G=()=>{s("/databases")},k=()=>{V()},I=F=>{U(F),E(!0)},X=()=>{V()};return o.jsxs("div",{className:"container mx-auto px-4 py-6",children:[o.jsxs("div",{className:"flex justify-between items-center mb-6",children:[o.jsxs("div",{children:[o.jsx("div",{className:"flex items-center mb-2",children:o.jsx("button",{onClick:G,className:"text-blue-600 hover:text-blue-800 mr-3",children:"← Back to Databases"})}),o.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Collections"}),o.jsxs("p",{className:"text-gray-600",children:["Collections in database:"," ",o.jsx("span",{className:"font-medium",children:M})]})]}),o.jsxs("button",{onClick:()=>m(!0),className:"bg-green-600 hover:bg-green-700 text-white py-2 px-4 rounded-lg flex items-center transition-colors",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"})}),"Create Collection"]})]}),o.jsxs("div",{className:"bg-white rounded-lg shadow-md overflow-hidden",children:[o.jsxs("div",{className:"border-b border-gray-200 bg-gray-50 px-6 py-4",children:[o.jsxs("h3",{className:"text-lg font-medium text-gray-900",children:["Collections in ",M]}),o.jsxs("p",{className:"text-sm text-gray-500",children:["Total:"," ",c?"Loading...":f.length>0?`${f.length} Collections`:"0 Collections"]})]}),c?o.jsx("div",{className:"p-6",children:[1,2,3].map(F=>o.jsxs("div",{className:"animate-pulse flex items-center justify-between py-4 border-b border-gray-100",children:[o.jsxs("div",{children:[o.jsx("div",{className:"h-6 bg-gray-200 rounded w-48 mb-2"}),o.jsx("div",{className:"h-4 bg-gray-100 rounded w-32"})]}),o.jsx("div",{className:"h-8 bg-gray-200 rounded w-24"})]},F))}):o.jsx("ul",{className:"divide-y divide-gray-200",children:f.length>0?f.map(F=>o.jsxs("li",{className:"px-6 py-4 flex items-center justify-between hover:bg-gray-50 transition-colors",children:[o.jsxs("div",{children:[o.jsxs("h4",{className:"text-lg font-medium text-gray-900 flex items-center",children:[F.name,F.isEncrypted?o.jsx("span",{className:"ml-2 text-green-600",title:"Encrypted Collection",children:o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"})})}):o.jsx("span",{className:"ml-2 text-gray-400",title:"Unencrypted Collection",children:o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{d:"M10 2a5 5 0 00-5 5v2a2 2 0 00-2 2v5a2 2 0 002 2h10a2 2 0 002-2v-5a2 2 0 00-2-2H7V7a3 3 0 015.905-.75 1 1 0 001.937-.5A5.002 5.002 0 0010 2z"})})})]}),o.jsxs("p",{className:"text-sm text-gray-500",children:[F.documentCount," documents"]})]}),o.jsxs("div",{className:"flex space-x-2",children:[o.jsx("button",{onClick:()=>s(`/collections/documents?database=${M}&collection=${F.name}`),className:"text-blue-600 hover:text-blue-800 px-3 py-1 rounded border border-blue-200 hover:border-blue-400 transition-colors",children:"View Documents"}),o.jsx("button",{onClick:()=>I(F.name),className:"text-red-600 hover:text-red-800 px-3 py-1 rounded border border-red-200 hover:border-red-400 transition-colors",children:"Delete"})]})]},F.name)):o.jsx("li",{className:"px-6 py-8 text-center text-gray-500",children:'No collections found in this database. Click "Create Collection" to add one.'})})]}),p&&o.jsx(y2,{isOpen:p,onClose:()=>m(!1),onCollectionCreated:k,databaseName:M}),v&&o.jsx(p2,{isOpen:v,onClose:()=>E(!1),onCollectionDeleted:X,databaseName:M,collectionName:R})]})},x2=({isOpen:n,onClose:s,onDocumentInserted:c,databaseName:r,collectionName:f,onSuccess:d})=>{const[g,x]=S.useState(`{
65
+ `+d):r.stack=d}catch(g){}}throw r}})}_request(s,c){typeof s=="string"?(c=c||{},c.url=s):c=s||{},c=ra(this.defaults,c);const{transitional:r,paramsSerializer:f,headers:d}=c;r!==void 0&&zi.assertOptions(r,{silentJSONParsing:Kt.transitional(Kt.boolean),forcedJSONParsing:Kt.transitional(Kt.boolean),clarifyTimeoutError:Kt.transitional(Kt.boolean)},!1),f!=null&&(_.isFunction(f)?c.paramsSerializer={serialize:f}:zi.assertOptions(f,{encode:Kt.function,serialize:Kt.function},!0)),c.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?c.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:c.allowAbsoluteUrls=!0),zi.assertOptions(c,{baseUrl:Kt.spelling("baseURL"),withXsrfToken:Kt.spelling("withXSRFToken")},!0),c.method=(c.method||this.defaults.method||"get").toLowerCase();let g=d&&_.merge(d.common,d[c.method]);d&&_.forEach(["delete","get","head","post","put","patch","common"],M=>{delete d[M]}),c.headers=yt.concat(g,d);const x=[];let p=!0;this.interceptors.request.forEach(function(z){typeof z.runWhen=="function"&&z.runWhen(c)===!1||(p=p&&z.synchronous,x.unshift(z.fulfilled,z.rejected))});const m=[];this.interceptors.response.forEach(function(z){m.push(z.fulfilled,z.rejected)});let v,E=0,R;if(!p){const M=[sh.bind(this),void 0];for(M.unshift(...x),M.push(...m),R=M.length,v=Promise.resolve(c);E<R;)v=v.then(M[E++],M[E++]);return v}R=x.length;let U=c;for(E=0;E<R;){const M=x[E++],z=x[E++];try{U=M(U)}catch(D){z.call(this,D);break}}try{v=sh.call(this,U)}catch(M){return Promise.reject(M)}for(E=0,R=m.length;E<R;)v=v.then(m[E++],m[E++]);return v}getUri(s){s=ra(this.defaults,s);const c=Zh(s.baseURL,s.url,s.allowAbsoluteUrls);return Vh(c,s.params,s.paramsSerializer)}};_.forEach(["delete","get","head","options"],function(s){sa.prototype[s]=function(c,r){return this.request(ra(r||{},{method:s,url:c,data:(r||{}).data}))}});_.forEach(["post","put","patch"],function(s){function c(r){return function(d,g,x){return this.request(ra(x||{},{method:s,headers:r?{"Content-Type":"multipart/form-data"}:{},url:d,data:g}))}}sa.prototype[s]=c(),sa.prototype[s+"Form"]=c(!0)});let Hv=class Ph{constructor(s){if(typeof s!="function")throw new TypeError("executor must be a function.");let c;this.promise=new Promise(function(d){c=d});const r=this;this.promise.then(f=>{if(!r._listeners)return;let d=r._listeners.length;for(;d-- >0;)r._listeners[d](f);r._listeners=null}),this.promise.then=f=>{let d;const g=new Promise(x=>{r.subscribe(x),d=x}).then(f);return g.cancel=function(){r.unsubscribe(d)},g},s(function(d,g,x){r.reason||(r.reason=new Pa(d,g,x),c(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(s){if(this.reason){s(this.reason);return}this._listeners?this._listeners.push(s):this._listeners=[s]}unsubscribe(s){if(!this._listeners)return;const c=this._listeners.indexOf(s);c!==-1&&this._listeners.splice(c,1)}toAbortSignal(){const s=new AbortController,c=r=>{s.abort(r)};return this.subscribe(c),s.signal.unsubscribe=()=>this.unsubscribe(c),s.signal}static source(){let s;return{token:new Ph(function(f){s=f}),cancel:s}}};function Lv(n){return function(c){return n.apply(null,c)}}function qv(n){return _.isObject(n)&&n.isAxiosError===!0}const Tc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Tc).forEach(([n,s])=>{Tc[s]=n});function Ih(n){const s=new sa(n),c=Dh(sa.prototype.request,s);return _.extend(c,sa.prototype,s,{allOwnKeys:!0}),_.extend(c,s,null,{allOwnKeys:!0}),c.create=function(f){return Ih(ra(n,f))},c}const me=Ih(fu);me.Axios=sa;me.CanceledError=Pa;me.CancelToken=Hv;me.isCancel=kh;me.VERSION=Wh;me.toFormData=Xi;me.AxiosError=ie;me.Cancel=me.CanceledError;me.all=function(s){return Promise.all(s)};me.spread=Lv;me.isAxiosError=qv;me.mergeConfig=ra;me.AxiosHeaders=yt;me.formToJSON=n=>Xh(_.isHTMLForm(n)?new FormData(n):n);me.getAdapter=Fh.getAdapter;me.HttpStatusCode=Tc;me.default=me;const{Axios:D2,AxiosError:O2,CanceledError:C2,isCancel:M2,CancelToken:z2,VERSION:_2,all:U2,Cancel:B2,isAxiosError:H2,spread:L2,toFormData:q2,AxiosHeaders:Y2,HttpStatusCode:V2,formToJSON:G2,getAdapter:X2,mergeConfig:k2}=me,ch=n=>{let s;const c=new Set,r=(m,v)=>{const E=typeof m=="function"?m(s):m;if(!Object.is(E,s)){const R=s;s=(v!=null?v:typeof E!="object"||E===null)?E:Object.assign({},s,E),c.forEach(U=>U(s,R))}},f=()=>s,x={setState:r,getState:f,getInitialState:()=>p,subscribe:m=>(c.add(m),()=>c.delete(m))},p=s=n(r,f,x);return x},Yv=n=>n?ch(n):ch,Vv=n=>n;function Gv(n,s=Vv){const c=Ti.useSyncExternalStore(n.subscribe,Ti.useCallback(()=>s(n.getState()),[n,s]),Ti.useCallback(()=>s(n.getInitialState()),[n,s]));return Ti.useDebugValue(c),c}const oh=n=>{const s=Yv(n),c=r=>Gv(s,r);return Object.assign(c,s),c},em=n=>n?oh(n):oh,st=window.location.origin,Hi=em(n=>({Rootname:"",setRootname:s=>n({Rootname:s})})),ct=em(n=>({TransactionKey:"",setTransactionKey:s=>n({TransactionKey:s}),loadKey:()=>Oe(null,null,function*(){if(sessionStorage.getItem("transactionToken")){n({TransactionKey:sessionStorage.getItem("transactionToken")});return}yield me.get(`${st}/api/get-token`).then(s=>{var c,r,f,d;s.status===200&&(sessionStorage.setItem("transactionToken",(r=(c=s.data)==null?void 0:c.data)==null?void 0:r.originSessionKey),n({TransactionKey:(d=(f=s.data)==null?void 0:f.data)==null?void 0:d.originSessionKey}))}).catch(s=>{console.error("Error fetching transaction key:",s)})})})),Xv=()=>{const[n,s]=S.useState(!1),{Rootname:c}=Hi(d=>d),{setRootname:r}=Hi(d=>d),{TransactionKey:f}=ct(d=>d);return S.useEffect(()=>{me.get(`${st}/api/db/databases?transactiontoken=${f}`).then(d=>{var g;d.status===200&&r((g=d.data.data.RootName)!=null?g:"AxioDB")})},[]),o.jsx("header",{className:"bg-gradient-to-r from-blue-700 to-indigo-800 shadow-lg",children:o.jsx("nav",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:o.jsx("div",{className:"flex items-center justify-between h-16",children:o.jsxs("div",{className:"flex items-center",children:[o.jsx("div",{className:"flex-shrink-0",children:o.jsxs(tu,{to:"/",className:"flex items-center",children:[o.jsx("img",{src:"/AXioDB.png",alt:"AxioDB Logo",className:"h-9 w-9"}),o.jsxs("span",{className:"ml-2 text-white font-bold text-xl tracking-tight",children:[c," Admin Hub"]})]})}),o.jsx("div",{className:"hidden md:block ml-10",children:o.jsxs("div",{className:"flex space-x-4",children:[o.jsx(tu,{to:"/",className:"text-blue-100 hover:bg-blue-600 hover:text-white px-3 py-2 rounded-md text-sm font-medium transition-colors",children:"Dashboard"}),o.jsx(tu,{to:"/operations",className:"text-blue-100 hover:bg-blue-600 hover:text-white px-3 py-2 rounded-md text-sm font-medium transition-colors",children:"Operations"})]})})]})})})})};function kv(n,s){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},n),S.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"}))}const Qv=S.forwardRef(kv);function Zv(n,s){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},n),S.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"}))}const Kv=S.forwardRef(Zv);function Jv(n,s){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},n),S.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"}))}const tm=S.forwardRef(Jv);function $v(n,s){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},n),S.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"}))}const Fv=S.forwardRef($v);function Wv(n,s){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},n),S.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"}))}const Pv=S.forwardRef(Wv);function Iv(n,s){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:s},n),S.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"}))}const e2=S.forwardRef(Iv);function t2(n,s){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:s},n),S.createElement("path",{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"}))}const l2=S.forwardRef(t2);function a2(n,s){return S.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:s},n),S.createElement("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"}))}const n2=S.forwardRef(a2),u2=({treeDB:n})=>{const[s,c]=S.useState(!0),[r,f]=S.useState({}),[d,g]=S.useState([]),x=m=>{f(v=>nt(pe({},v),{[m]:!v[m]}))};S.useEffect(()=>{const m=()=>{if(!n||!Array.isArray(n)){g([]),c(!1);return}const v=n.map((E,R)=>{const U=`db${R+1}`;return{id:U,name:E.name,type:"database",children:Array.isArray(E.collections)?E.collections.map((M,z)=>({id:`${U}_col${z+1}`,name:M.name||M,type:"collection",documentCount:M.documentCount||0,size:"0 MB"})):[]}});v.length>0&&f({[v[0].id]:!0}),g(v),c(!1)};setTimeout(()=>{m()},500)},[n]);const p=m=>{const v=r[m.id];return o.jsxs("div",{children:[o.jsxs("div",{className:`flex items-center py-2 px-3 ${m.type==="database"?"bg-blue-50 hover:bg-blue-100 border-b border-blue-100":"hover:bg-gray-50 pl-10"} cursor-pointer transition-colors`,onClick:()=>m.children&&x(m.id),children:[m.children?o.jsx("div",{className:"mr-1",children:v?o.jsx(l2,{className:"h-4 w-4 text-gray-500"}):o.jsx(n2,{className:"h-4 w-4 text-gray-500"})}):o.jsx("div",{className:"w-4 mr-1"}),m.type==="database"?o.jsx(tm,{className:"h-5 w-5 text-blue-600 mr-2"}):o.jsx(Pv,{className:"h-5 w-5 text-yellow-600 mr-2"}),o.jsx("div",{className:"flex-grow",children:o.jsx("span",{className:"font-medium",children:m.name})}),m.type==="collection"&&o.jsx("div",{className:"text-xs text-gray-500",children:o.jsxs("span",{className:"mr-2",children:[m.documentCount," docs"]})})]}),m.children&&v&&o.jsx("div",{className:"border-l border-gray-200 ml-5",children:m.children.map(p)})]},m.id)};return o.jsxs("div",{className:"bg-white rounded-lg shadow-md hover:shadow-lg transition-shadow",children:[o.jsxs("div",{className:"border-b border-gray-200 py-4 px-6",children:[o.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Database Structure"}),o.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Overview of databases and collections"})]}),o.jsx("div",{className:"overflow-y-auto",style:{maxHeight:"400px"},children:s?o.jsx("div",{className:"p-6 space-y-3",children:[1,2,3].map(m=>o.jsxs("div",{className:"animate-pulse",children:[o.jsx("div",{className:"h-6 bg-gray-200 rounded w-3/4 mb-2"}),o.jsxs("div",{className:"pl-6 space-y-2",children:[o.jsx("div",{className:"h-5 bg-gray-100 rounded w-2/3"}),o.jsx("div",{className:"h-5 bg-gray-100 rounded w-2/3"}),o.jsx("div",{className:"h-5 bg-gray-100 rounded w-2/3"})]})]},m))}):o.jsx("div",{children:d.map(p)})})]})},i2=({CacheStorageInfo:n})=>{const[s,c]=S.useState(!0);S.useEffect(()=>{(()=>{setTimeout(()=>{c(!1)},800)})()},[]);const r=n.Storage/n.Max*100;return o.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow",children:[o.jsxs("div",{className:"flex justify-between mb-3",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"In-Memory Cache"}),s?o.jsx("div",{className:"h-8 mt-2 bg-gray-200 rounded animate-pulse w-24"}):o.jsxs("p",{className:"text-3xl font-bold text-orange-600 mt-2",children:[n.Storage," ",o.jsx("span",{className:"text-lg",children:n.Unit})]}),o.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["of ",n.Max," ",n.Unit," allocated"]})]}),o.jsx("div",{className:"p-3 bg-orange-100 rounded-full",children:o.jsx(Qv,{className:"h-8 w-8 text-orange-600"})})]}),o.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2.5 mt-2",children:o.jsx("div",{className:"bg-orange-600 h-2.5 rounded-full",style:{width:`${s?0:r}%`}})})]})},s2=({storageInfo:n})=>{const[s,c]=S.useState(!0);S.useEffect(()=>{(()=>{setTimeout(()=>{c(!1)},800)})()},[]);const r=(n==null?void 0:n.total)/(n==null?void 0:n.machine)*100;return o.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow",children:[o.jsxs("div",{className:"flex justify-between mb-3",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Storage Used"}),s?o.jsx("div",{className:"h-8 mt-2 bg-gray-200 rounded animate-pulse w-24"}):o.jsxs("p",{className:"text-3xl font-bold text-green-600 mt-2",children:[n==null?void 0:n.total," ",o.jsx("span",{className:"text-lg",children:n==null?void 0:n.matrixUnit})]}),o.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["of ",n==null?void 0:n.machine," ",n==null?void 0:n.matrixUnit," available"]})]}),o.jsx("div",{className:"p-3 bg-green-100 rounded-full",children:o.jsx(e2,{className:"h-8 w-8 text-green-600"})})]}),o.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2.5 mt-2",children:o.jsx("div",{className:"bg-green-600 h-2.5 rounded-full",style:{width:`${s?0:r}%`}})})]})},r2=({totalCollections:n})=>{const[s,c]=S.useState(!0);return S.useEffect(()=>{(()=>{setTimeout(()=>{c(!1)},600)})()},[]),o.jsx("div",{className:"bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow",children:o.jsxs("div",{className:"flex justify-between",children:[o.jsx("div",{children:s?o.jsx("div",{className:"h-8 mt-2 bg-gray-200 rounded animate-pulse w-16"}):o.jsxs("p",{className:"text-2xl font-bold text-indigo-600 mt-2",children:[n," ",n<=1?"Collection":"Collections"]})}),o.jsx("div",{className:"p-3 bg-indigo-100 rounded-full",children:o.jsx(Kv,{className:"h-8 w-8 text-indigo-600"})})]})})},c2=({totalDatabases:n})=>{const[s,c]=S.useState(!0);return S.useEffect(()=>{setTimeout(()=>{c(!1)},1e3)},[]),o.jsx("div",{className:"bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow",children:o.jsxs("div",{className:"flex justify-between",children:[o.jsx("div",{children:s?o.jsx("div",{className:"h-8 mt-2 bg-gray-200 rounded animate-pulse w-16 text-center"}):o.jsx("p",{className:"text-2xl font-bold text-blue-600 mt-2 text-center",children:n<=1?`${n} Database`:`${n} Databases`})}),o.jsx("div",{className:"p-3 bg-blue-100 rounded-full",children:o.jsx(tm,{className:"h-8 w-8 text-blue-600"})})]})})},o2=({totalDocuments:n})=>{const[s,c]=S.useState(!0);return S.useEffect(()=>{(()=>{setTimeout(()=>{c(!1)},700)})()},[]),o.jsx("div",{className:"bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow",children:o.jsxs("div",{className:"flex justify-between",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Total Documents"}),s?o.jsx("div",{className:"h-8 mt-2 bg-gray-200 rounded animate-pulse w-20"}):o.jsx("p",{className:"text-3xl font-bold text-purple-600 mt-2",children:n}),o.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Across all collections"})]}),o.jsx("div",{className:"p-3 bg-purple-100 rounded-full",children:o.jsx(Fv,{className:"h-8 w-8 text-purple-600"})})]})})},f2=()=>{const[n,s]=S.useState(!0),[c,r]=S.useState(null),{TransactionKey:f}=ct(d=>d);return S.useEffect(()=>{me.get(`${st}/api/dashboard-stats?transactiontoken=${f}`).then(d=>{d.status===200&&(r(d.data.data),s(!1))})},[]),o.jsxs("div",{className:"container mx-auto px-4 py-6",children:[o.jsx("div",{className:"mb-6",children:o.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Dashboard"})}),n?o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-6 mb-8",children:[1,2,3,4,5].map(d=>o.jsx("div",{className:"h-32 bg-gray-200 rounded-lg animate-pulse"},d))}):o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-6 mb-8",children:[o.jsx(c2,{totalDatabases:(c==null?void 0:c.totalDatabases)||0}),o.jsx(r2,{totalCollections:(c==null?void 0:c.totalCollections)||0}),o.jsx(o2,{totalDocuments:(c==null?void 0:c.totalDocuments)||0}),o.jsx(s2,{storageInfo:(c==null?void 0:c.storageInfo)||{}}),o.jsx(i2,{CacheStorageInfo:(c==null?void 0:c.cacheStorage)||{}})]}),o.jsx("div",{className:"mb-8",children:o.jsx(u2,{treeDB:(c==null?void 0:c.nodeTree)||[]})})]})},d2=({isOpen:n,onClose:s,onDatabaseCreated:c})=>{const[r,f]=S.useState(""),[d,g]=S.useState(!1),[x,p]=S.useState(""),{TransactionKey:m}=ct(R=>R),v=()=>{f(""),p(""),g(!1),s()},E=R=>Oe(null,null,function*(){var U,M;if(R.preventDefault(),!r.trim()){p("Database name is required");return}if(!/^[a-zA-Z0-9_]+$/.test(r)){p("Database name can only contain letters, numbers, and underscores");return}g(!0),p("");try{const z=yield me.post(`${st}/api/db/create-database`,{name:r},{params:{transactiontoken:m}});if(z.data.statusCode===200||z.data.statusCode===201)c(r),g(!1),v();else throw g(!1),new Error("Failed to create database")}catch(z){console.error("Error creating database:",z),p(((M=(U=z.response)==null?void 0:U.data)==null?void 0:M.message)||"Failed to create database. Please try again."),g(!1)}});return n?o.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 animate-fadeIn",children:o.jsxs("div",{className:"bg-white rounded-lg max-w-md w-full p-6",children:[o.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-4",children:"Create New Database"}),o.jsxs("form",{onSubmit:E,children:[o.jsxs("div",{className:"mb-4",children:[o.jsx("label",{htmlFor:"databaseName",className:"block text-sm font-medium text-gray-700 mb-1",children:"Database Name"}),o.jsx("input",{type:"text",id:"databaseName",value:r,onChange:R=>f(R.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"Enter database name",disabled:d}),x&&o.jsx("p",{className:"mt-2 text-sm text-red-600",children:x})]}),o.jsxs("div",{className:"flex justify-end space-x-4 mt-6",children:[o.jsx("button",{type:"button",onClick:v,className:"px-4 py-2 text-gray-700 hover:text-gray-900 transition-colors",disabled:d,children:"Cancel"}),o.jsx("button",{type:"submit",className:`px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 transition-colors flex items-center ${d?"opacity-75 cursor-not-allowed":""}`,disabled:d,children:d?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Creating..."]}):"Create Database"})]})]})]})}):null},h2=({isOpen:n,dbName:s,onClose:c,onConfirmDelete:r})=>{const{TransactionKey:f}=ct(p=>p),[d,g]=S.useState(!1);if(!n)return null;const x=()=>Oe(null,null,function*(){var p,m;g(!0);try{const v=yield me.delete(`${st}/api/db/delete-database`,{params:{transactiontoken:f,dbName:s}});if(v.status===200)console.log("Database deleted successfully:",v.data),r();else throw new Error("Failed to delete database")}catch(v){console.error("Error deleting database:",v),alert(((m=(p=v.response)==null?void 0:p.data)==null?void 0:m.message)||"Failed to delete database. Please try again.")}finally{g(!1)}});return o.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:o.jsxs("div",{className:"bg-white rounded-lg max-w-md w-full p-6 animate-fadeIn",children:[o.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-4",children:"Confirm Deletion"}),o.jsxs("p",{className:"text-gray-700 mb-6",children:['Are you sure you want to delete the database "',s,'"? This action cannot be undone.']}),o.jsxs("div",{className:"flex justify-end space-x-4",children:[o.jsx("button",{onClick:c,disabled:d,className:"px-4 py-2 text-gray-700 hover:text-gray-900 transition-colors",children:"Cancel"}),o.jsx("button",{onClick:x,disabled:d,className:`px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 transition-colors flex items-center ${d?"opacity-75 cursor-not-allowed":""}`,children:d?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Deleting..."]}):"Delete"})]})]})})},m2=({databases:n,onDeleteClick:s,loading:c})=>{const r=iu(),[f,d]=S.useState({}),g=p=>{d(m=>nt(pe({},m),{[p]:!1}))},x=p=>{r(`/collections?database=${encodeURIComponent(p)}`)};return o.jsxs("div",{className:"bg-white rounded-lg shadow-md overflow-hidden",children:[o.jsxs("div",{className:"border-b border-gray-200 bg-gray-50 px-6 py-4",children:[o.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Your Databases"}),o.jsxs("p",{className:"text-sm text-gray-500",children:["Total: ",c?"Loading...":n==null?void 0:n.TotalDatabases]})]}),c?o.jsx("div",{className:"p-6",children:[1,2,3].map(p=>o.jsxs("div",{className:"animate-pulse flex items-center justify-between py-4 border-b border-gray-100",children:[o.jsxs("div",{children:[o.jsx("div",{className:"h-6 bg-gray-200 rounded w-48 mb-2"}),o.jsx("div",{className:"h-4 bg-gray-100 rounded w-32"})]}),o.jsx("div",{className:"h-8 bg-gray-200 rounded w-24"})]},p))}):o.jsx("ul",{className:"divide-y divide-gray-200",children:n!=null&&n.ListOfDatabases&&(n==null?void 0:n.ListOfDatabases.length)>0?n.ListOfDatabases.map((p,m)=>o.jsxs("li",{className:`px-6 py-4 flex items-center justify-between hover:bg-gray-50 transition-all duration-300 ${f[p]?"animate-slideIn":"animate-fadeIn"}`,onAnimationEnd:()=>g(p),children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-lg font-medium text-gray-900",children:p}),o.jsxs("p",{className:"text-sm text-gray-500",children:["Path: ",n.AllDatabasesPaths[m]]})]}),o.jsxs("div",{className:"flex space-x-2",children:[o.jsx("button",{onClick:()=>x(p),className:"text-blue-600 hover:text-blue-800 px-3 py-1 rounded border border-blue-200 hover:border-blue-400 transition-colors",children:"View Collections"}),o.jsx("button",{onClick:()=>s(p),className:"text-red-600 hover:text-red-800 px-3 py-1 rounded border border-red-200 hover:border-red-400 transition-colors",children:"Delete"})]})]},p)):o.jsx("li",{className:"px-6 py-8 text-center text-gray-500",children:'No databases found. Click "Create Database" to add one.'})})]})},g2=()=>{const[n,s]=S.useState(!0),[c,r]=S.useState([]),[f,d]=S.useState(!1),[g,x]=S.useState(!1),[p,m]=S.useState(""),{TransactionKey:v}=ct(z=>z),{Rootname:E}=Hi(z=>z);S.useEffect(()=>{v&&Oe(null,null,function*(){try{const D=yield me.get(`${st}/api/db/databases?transactiontoken=${v}`);D.status===200&&(r(D.data.data),s(!1))}catch(D){console.error("Error fetching databases:",D),s(!1),r([])}})},[v]);const R=z=>{m(z),d(!0)},U=()=>{r(z=>nt(pe({},z),{ListOfDatabases:z.ListOfDatabases.filter(D=>D!==p),TotalDatabases:`${z.ListOfDatabases.length-1} Databases`})),d(!1),m("")},M=z=>{r(D=>nt(pe({},D),{ListOfDatabases:[...D.ListOfDatabases,z],TotalDatabases:`${D.ListOfDatabases.length+1} Databases`,AllDatabasesPaths:[...D.AllDatabasesPaths,`${D.CurrentPath}/${z}`]}))};return o.jsxs("div",{className:"container mx-auto px-4 py-6",children:[o.jsxs("div",{className:"flex justify-between items-center mb-6",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Databases"}),o.jsxs("p",{className:"text-gray-600",children:["Manage your ",E," databases"]})]}),o.jsxs("button",{onClick:()=>x(!0),className:"bg-green-600 hover:bg-green-700 text-white py-2 px-4 rounded-lg flex items-center transition-colors",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"})}),"Create Database"]})]}),o.jsx(m2,{databases:c,onDeleteClick:R,loading:n}),o.jsx(d2,{isOpen:g,onClose:()=>x(!1),onDatabaseCreated:M}),o.jsx(h2,{isOpen:f,dbName:p,onClose:()=>d(!1),onConfirmDelete:U})]})},y2=({isOpen:n,onClose:s,onCollectionCreated:c,databaseName:r})=>{const[f,d]=S.useState(""),[g,x]=S.useState(!1),[p,m]=S.useState(""),[v,E]=S.useState(!1),[R,U]=S.useState(""),{TransactionKey:M}=ct(V=>V),z=()=>{d(""),x(!1),m(""),U(""),E(!1),s()},D=V=>Oe(null,null,function*(){var G,k;if(V.preventDefault(),!f.trim()){U("Collection name is required");return}if(!/^[a-zA-Z0-9_]+$/.test(f)){U("Collection name can only contain letters, numbers, and underscores");return}if(g&&!p.trim()){U("Encryption key is required when encryption is enabled");return}E(!0),U("");try{const I=yield me.post(`${st}/api/collection/create-collection`,{dbName:r,collectionName:f,crypto:g,key:g?p:""},{params:{transactiontoken:M}});if(I.data.statusCode===200||I.data.statusCode===201)c({name:f,documentCount:0,size:"N/A"}),z();else throw new Error("Failed to create collection")}catch(I){console.error("Error creating collection:",I),U(((k=(G=I.response)==null?void 0:G.data)==null?void 0:k.message)||"Failed to create collection. Please try again."),E(!1)}});return n?o.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 animate-fadeIn",children:o.jsxs("div",{className:"bg-white rounded-lg max-w-md w-full p-6",children:[o.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-4",children:"Create New Collection"}),o.jsxs("form",{onSubmit:D,children:[o.jsxs("div",{className:"mb-4",children:[o.jsx("label",{htmlFor:"databaseName",className:"block text-sm font-medium text-gray-700 mb-1",children:"Database Name"}),o.jsx("input",{type:"text",id:"databaseName",value:r,className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm bg-gray-100 cursor-not-allowed",disabled:!0})]}),o.jsxs("div",{className:"mb-4",children:[o.jsx("label",{htmlFor:"collectionName",className:"block text-sm font-medium text-gray-700 mb-1",children:"Collection Name"}),o.jsx("input",{type:"text",id:"collectionName",value:f,onChange:V=>d(V.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"Enter collection name",disabled:v})]}),o.jsx("div",{className:"mb-4",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("label",{htmlFor:"enableCrypto",className:"text-sm font-medium text-gray-700",children:"Enable Encryption"}),o.jsxs("div",{className:"relative inline-block w-10 mr-2 align-middle select-none",children:[o.jsx("input",{type:"checkbox",id:"enableCrypto",checked:g,onChange:()=>x(!g),className:"toggle-checkbox absolute block w-6 h-6 rounded-full bg-white border-4 appearance-none cursor-pointer",disabled:v}),o.jsx("label",{htmlFor:"enableCrypto",className:`toggle-label block overflow-hidden h-6 rounded-full cursor-pointer ${g?"bg-green-500":"bg-gray-300"}`})]})]})}),g&&o.jsxs("div",{className:"mb-4",children:[o.jsx("label",{htmlFor:"cryptoKey",className:"block text-sm font-medium text-gray-700 mb-1",children:"Encryption Key"}),o.jsx("input",{type:"password",id:"cryptoKey",value:p,onChange:V=>m(V.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"Enter encryption key",disabled:v})]}),R&&o.jsx("p",{className:"mt-2 text-sm text-red-600",children:R}),o.jsxs("div",{className:"flex justify-end space-x-4 mt-6",children:[o.jsx("button",{type:"button",onClick:z,className:"px-4 py-2 text-gray-700 hover:text-gray-900 transition-colors",disabled:v,children:"Cancel"}),o.jsx("button",{type:"submit",className:`px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 transition-colors flex items-center ${v?"opacity-75 cursor-not-allowed":""}`,disabled:v,children:v?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Creating..."]}):"Create Collection"})]})]})]})}):null},p2=({isOpen:n,onClose:s,onCollectionDeleted:c,databaseName:r,collectionName:f})=>{const[d,g]=S.useState(!1),[x,p]=S.useState(""),{TransactionKey:m}=ct(R=>R),v=()=>{p(""),g(!1),s()},E=()=>Oe(null,null,function*(){var R,U;g(!0),p("");try{if((yield me.delete(`${st}/api/collection/delete-collection/?dbName=${r}&collectionName=${f}&transactiontoken=${m}`)).data.statusCode===200)c(f),v();else throw new Error("Failed to delete collection")}catch(M){console.error("Error deleting collection:",M),p(((U=(R=M.response)==null?void 0:R.data)==null?void 0:U.message)||"Failed to delete collection. Please try again."),g(!1)}});return n?o.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 animate-fadeIn",children:o.jsxs("div",{className:"bg-white rounded-lg max-w-md w-full p-6",children:[o.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-4",children:"Delete Collection"}),o.jsxs("p",{className:"mb-6 text-gray-600",children:["Are you sure you want to delete the collection"," ",o.jsx("span",{className:"font-semibold",children:f})," from database"," ",o.jsx("span",{className:"font-semibold",children:r}),"? This action cannot be undone."]}),x&&o.jsx("p",{className:"mb-4 text-sm text-red-600",children:x}),o.jsxs("div",{className:"flex justify-end space-x-4 mt-6",children:[o.jsx("button",{type:"button",onClick:v,className:"px-4 py-2 text-gray-700 hover:text-gray-900 transition-colors",disabled:d,children:"Cancel"}),o.jsx("button",{type:"button",onClick:E,className:`px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 transition-colors flex items-center ${d?"opacity-75 cursor-not-allowed":""}`,disabled:d,children:d?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Deleting..."]}):"Delete Collection"})]})]})}):null},v2=()=>{const[n]=Ah(),s=iu(),[c,r]=S.useState(!0),[f,d]=S.useState([]),[g,x]=S.useState([]),[p,m]=S.useState(!1),[v,E]=S.useState(!1),[R,U]=S.useState(""),M=n.get("database"),{TransactionKey:z}=ct(F=>F),{Rootname:D}=Hi(F=>F),V=()=>Oe(null,null,function*(){try{const F=yield me.get(`${st}/api/collection/all/?databaseName=${M}&transactiontoken=${z}`);if(F.status===200){const ce=F.data.data||{};if(ce.ListOfCollections&&Array.isArray(ce.ListOfCollections)){const fe=ce.CollectionSizeMap||[],Ce=ce.collectionMetaStatus||[];x(Ce);const tt=ce.ListOfCollections.map(we=>{const xe=fe.find(Ke=>{const qe=Ke.folderPath.split("/");return qe[qe.length-1]===we}),ze=Ce.find(Ke=>Ke.name===we);return{name:we,documentCount:xe?xe.fileCount:0,isEncrypted:(ze==null?void 0:ze.isEncrypted)||!1,isSchemaNeeded:(ze==null?void 0:ze.isSchemaNeeded)||!1,schema:(ze==null?void 0:ze.schema)||{}}});d(tt)}else d([]);r(!1)}}catch(F){console.error("Error fetching collections:",F),r(!1),d([])}});S.useEffect(()=>{if(!M){s("/databases");return}z&&V()},[z,M,s]);const G=()=>{s("/operations")},k=()=>{V()},I=F=>{U(F),E(!0)},X=()=>{V()};return o.jsxs("div",{className:"container mx-auto px-4 py-6",children:[o.jsxs("div",{className:"flex justify-between items-center mb-6",children:[o.jsxs("div",{children:[o.jsx("div",{className:"flex items-center mb-2",children:o.jsx("button",{onClick:G,className:"text-blue-600 hover:text-blue-800 mr-3",children:"← Back to Databases"})}),o.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Collections"}),o.jsxs("p",{className:"text-gray-600",children:["Collections in database:"," ",o.jsx("span",{className:"font-medium",children:M})]})]}),o.jsxs("button",{onClick:()=>m(!0),className:"bg-green-600 hover:bg-green-700 text-white py-2 px-4 rounded-lg flex items-center transition-colors",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"})}),"Create Collection"]})]}),o.jsxs("div",{className:"bg-white rounded-lg shadow-md overflow-hidden",children:[o.jsxs("div",{className:"border-b border-gray-200 bg-gray-50 px-6 py-4",children:[o.jsxs("h3",{className:"text-lg font-medium text-gray-900",children:["Collections in ",M]}),o.jsxs("p",{className:"text-sm text-gray-500",children:["Total:"," ",c?"Loading...":f.length>0?`${f.length} Collections`:"0 Collections"]})]}),c?o.jsx("div",{className:"p-6",children:[1,2,3].map(F=>o.jsxs("div",{className:"animate-pulse flex items-center justify-between py-4 border-b border-gray-100",children:[o.jsxs("div",{children:[o.jsx("div",{className:"h-6 bg-gray-200 rounded w-48 mb-2"}),o.jsx("div",{className:"h-4 bg-gray-100 rounded w-32"})]}),o.jsx("div",{className:"h-8 bg-gray-200 rounded w-24"})]},F))}):o.jsx("ul",{className:"divide-y divide-gray-200",children:f.length>0?f.map(F=>o.jsxs("li",{className:"px-6 py-4 flex items-center justify-between hover:bg-gray-50 transition-colors",children:[o.jsxs("div",{children:[o.jsxs("h4",{className:"text-lg font-medium text-gray-900 flex items-center",children:[F.name,F.isEncrypted?o.jsx("span",{className:"ml-2 text-green-600",title:"Encrypted Collection",children:o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"})})}):o.jsx("span",{className:"ml-2 text-gray-400",title:"Unencrypted Collection",children:o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{d:"M10 2a5 5 0 00-5 5v2a2 2 0 00-2 2v5a2 2 0 002 2h10a2 2 0 002-2v-5a2 2 0 00-2-2H7V7a3 3 0 015.905-.75 1 1 0 001.937-.5A5.002 5.002 0 0010 2z"})})})]}),o.jsxs("p",{className:"text-sm text-gray-500",children:[F.documentCount," documents"]})]}),o.jsxs("div",{className:"flex space-x-2",children:[o.jsx("button",{onClick:()=>s(`/collections/documents?database=${M}&collection=${F.name}`),className:"text-blue-600 hover:text-blue-800 px-3 py-1 rounded border border-blue-200 hover:border-blue-400 transition-colors",children:"View Documents"}),o.jsx("button",{onClick:()=>I(F.name),className:"text-red-600 hover:text-red-800 px-3 py-1 rounded border border-red-200 hover:border-red-400 transition-colors",children:"Delete"})]})]},F.name)):o.jsx("li",{className:"px-6 py-8 text-center text-gray-500",children:'No collections found in this database. Click "Create Collection" to add one.'})})]}),p&&o.jsx(y2,{isOpen:p,onClose:()=>m(!1),onCollectionCreated:k,databaseName:M}),v&&o.jsx(p2,{isOpen:v,onClose:()=>E(!1),onCollectionDeleted:X,databaseName:M,collectionName:R})]})},x2=({isOpen:n,onClose:s,onDocumentInserted:c,databaseName:r,collectionName:f,onSuccess:d})=>{const[g,x]=S.useState(`{
66
66
 
67
- }`),[p,m]=S.useState(""),[v,E]=S.useState(!1),{TransactionKey:R}=ct(M=>M),U=M=>Oe(null,null,function*(){var z;M.preventDefault(),m("");try{const D=JSON.parse(g);E(!0);const V=yield me.post(`${st}/api/operation/create/?dbName=${r}&collectionName=${f}&transactiontoken=${R}`,pe({},D));if(V.status===200||V.status===201){const G=(z=V.data.data)==null?void 0:z.documentId,k=nt(pe({},D),{documentId:G||`doc_${Date.now()}`,updatedAt:new Date().toISOString()});c(k),s(),typeof d=="function"&&d()}else throw new Error("Failed to insert document")}catch(D){D instanceof SyntaxError?m("Invalid JSON format. Please check your input."):m(`Error inserting document: ${D.message}`),E(!1)}});return n?o.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 overflow-y-auto h-full w-full z-50 flex justify-center items-center backdrop-blur-sm",children:o.jsxs("div",{className:"relative bg-white rounded-lg shadow-2xl max-w-2xl w-full mx-4 max-h-[90vh] flex flex-col",children:[o.jsxs("div",{className:"flex justify-between items-center p-5 border-b",children:[o.jsxs("h3",{className:"text-xl font-semibold text-gray-900 flex items-center",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 mr-2 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Insert New Document"]}),o.jsx("button",{onClick:s,className:"text-gray-400 hover:text-gray-500 transition-colors",children:o.jsx("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"p-6 overflow-y-auto flex-grow",children:[o.jsxs("div",{className:"mb-4 flex items-center space-x-2 bg-blue-50 p-3 rounded-md",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 text-blue-500",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})}),o.jsxs("p",{className:"text-sm text-blue-700",children:["Enter the document data in JSON format to insert into"," ",o.jsx("span",{className:"font-semibold",children:f})]})]}),p&&o.jsx("div",{className:"mb-4 bg-red-50 border-l-4 border-red-500 p-4 text-red-700",children:o.jsx("p",{children:p})}),o.jsxs("form",{onSubmit:U,children:[o.jsxs("div",{className:"mb-4",children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Document Data (JSON)"}),o.jsx("textarea",{value:g,onChange:M=>x(M.target.value),className:"w-full h-64 p-3 border border-gray-300 rounded-md font-mono text-sm focus:ring-blue-500 focus:border-blue-500 shadow-inner bg-gray-50",placeholder:"Enter JSON document data",required:!0}),o.jsx("p",{className:"mt-2 text-xs text-gray-500",children:"The documentId and updatedAt fields will be automatically generated."})]}),o.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[o.jsx("button",{type:"button",onClick:s,className:"px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors",children:"Cancel"}),o.jsx("button",{type:"submit",disabled:v,className:`px-4 py-2 rounded-md text-white flex items-center ${v?"bg-green-500":"bg-green-600 hover:bg-green-700"} transition-colors shadow-md`,children:v?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"animate-spin h-5 w-5 mr-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Inserting..."]}):"Insert Document"})]})]})]})]})}):null},b2=({isOpen:n,onClose:s,onDocumentUpdated:c,document:r,databaseName:f,collectionName:d})=>{const[g,x]=S.useState(""),[p,m]=S.useState(""),[v,E]=S.useState(!1),{TransactionKey:R}=ct(M=>M);S.useEffect(()=>{if(r){const M=r,{documentId:z,updatedAt:D}=M,V=aa(M,["documentId","updatedAt"]);x(JSON.stringify(V,null,2))}},[r]);const U=M=>Oe(null,null,function*(){var z;M.preventDefault(),m("");try{const D=JSON.parse(g);E(!0);const V=yield me.put(`${st}/api/operation/update/?dbName=${f}&collectionName=${d}&documentId=${r.documentId}&transactiontoken=${R}`,pe({},D));if(V.status===200){const G=((z=V.data.data)==null?void 0:z.document)||nt(pe({},D),{documentId:r.documentId,updatedAt:new Date().toISOString()});c(G),s()}else throw new Error("Failed to update document")}catch(D){D instanceof SyntaxError?m("Invalid JSON format. Please check your input."):m(`Error updating document: ${D.message}`),E(!1)}});return n?o.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 overflow-y-auto h-full w-full z-50 flex justify-center items-center backdrop-blur-sm",children:o.jsxs("div",{className:"relative bg-white rounded-lg shadow-2xl max-w-2xl w-full mx-4 max-h-[90vh] flex flex-col",children:[o.jsxs("div",{className:"flex justify-between items-center p-5 border-b",children:[o.jsxs("h3",{className:"text-xl font-semibold text-gray-900 flex items-center",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 mr-2 text-indigo-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})}),"Update Document"]}),o.jsx("button",{onClick:s,className:"text-gray-400 hover:text-gray-500 transition-colors",children:o.jsx("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"p-6 overflow-y-auto flex-grow",children:[o.jsxs("div",{className:"mb-4 flex items-center space-x-2 bg-indigo-50 p-3 rounded-md",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 text-indigo-500",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})}),o.jsx("p",{className:"text-sm text-indigo-700",children:"Edit the document data in JSON format"})]}),p&&o.jsx("div",{className:"mb-4 bg-red-50 border-l-4 border-red-500 p-4 text-red-700",children:o.jsx("p",{children:p})}),o.jsxs("form",{onSubmit:U,children:[o.jsxs("div",{className:"mb-4",children:[o.jsxs("div",{className:"flex justify-between items-center mb-2",children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Document Data (JSON)"}),o.jsxs("div",{className:"flex items-center",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-1 text-yellow-500",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"})}),o.jsxs("span",{className:"text-xs text-gray-500 font-mono",children:["ID: ",r.documentId]})]})]}),o.jsx("textarea",{value:g,onChange:M=>x(M.target.value),className:"w-full h-64 p-3 border border-gray-300 rounded-md font-mono text-sm focus:ring-indigo-500 focus:border-indigo-500 shadow-inner bg-gray-50",placeholder:"Enter JSON document data",required:!0}),o.jsx("p",{className:"mt-2 text-xs text-gray-500",children:"You cannot change the document's ID. The updatedAt field will be automatically updated."})]}),o.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[o.jsx("button",{type:"button",onClick:s,className:"px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors",children:"Cancel"}),o.jsx("button",{type:"submit",disabled:v,className:`px-4 py-2 rounded-md text-white flex items-center ${v?"bg-indigo-500":"bg-indigo-600 hover:bg-indigo-700"} transition-colors shadow-md`,children:v?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"animate-spin h-5 w-5 mr-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Updating..."]}):"Update Document"})]})]})]})]})}):null},S2=({isOpen:n,onClose:s,onDocumentDeleted:c,documentId:r,databaseName:f,collectionName:d})=>{const[g,x]=S.useState(!1),[p,m]=S.useState(""),{TransactionKey:v}=ct(R=>R),E=()=>Oe(null,null,function*(){try{if(x(!0),(yield me.delete(`${st}/api/operation/delete/?dbName=${f}&collectionName=${d}&documentId=${r}&transactiontoken=${v}`)).status===200)c(r),s();else throw new Error("Failed to delete document")}catch(R){m(`Error deleting document: ${R.message}`),x(!1)}});return n?o.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 overflow-y-auto h-full w-full z-50 flex justify-center items-center backdrop-blur-sm",children:o.jsxs("div",{className:"relative bg-white rounded-lg shadow-2xl max-w-md w-full mx-4",children:[o.jsxs("div",{className:"flex justify-between items-center p-5 border-b",children:[o.jsxs("h3",{className:"text-xl font-semibold text-gray-900 flex items-center",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 mr-2 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),"Delete Document"]}),o.jsx("button",{onClick:s,className:"text-gray-400 hover:text-gray-500 transition-colors",children:o.jsx("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"p-6",children:[o.jsx("div",{className:"bg-red-50 p-4 rounded-md mb-5",children:o.jsxs("div",{className:"flex",children:[o.jsx("div",{className:"flex-shrink-0",children:o.jsx("svg",{className:"h-5 w-5 text-red-400",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),o.jsxs("div",{className:"ml-3",children:[o.jsx("h3",{className:"text-sm font-medium text-red-800",children:"Are you sure you want to delete this document?"}),o.jsx("div",{className:"mt-2 text-sm text-red-700",children:o.jsx("p",{children:"This action cannot be undone."})})]})]})}),o.jsxs("div",{className:"mb-5",children:[o.jsx("p",{className:"text-gray-700 mb-2",children:o.jsx("span",{className:"font-medium",children:"Document ID:"})}),o.jsx("div",{className:"bg-gray-50 p-2 rounded border border-gray-200 font-mono text-sm break-all",children:r})]}),o.jsxs("div",{className:"mb-5",children:[o.jsxs("p",{className:"text-gray-700 mb-1",children:[o.jsx("span",{className:"font-medium",children:"Collection:"})," ",d]}),o.jsxs("p",{className:"text-gray-700",children:[o.jsx("span",{className:"font-medium",children:"Database:"})," ",f]})]}),p&&o.jsx("div",{className:"mb-4 bg-red-50 border-l-4 border-red-500 p-4 text-red-700",children:o.jsx("p",{children:p})}),o.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[o.jsx("button",{type:"button",onClick:s,className:"px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors",children:"Cancel"}),o.jsx("button",{onClick:E,disabled:g,className:`px-4 py-2 rounded-md text-white flex items-center ${g?"bg-red-500":"bg-red-600 hover:bg-red-700"} transition-colors shadow-md`,children:g?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"animate-spin h-5 w-5 mr-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Deleting..."]}):"Delete Document"})]})]})]})}):null},w2=({isOpen:n,onClose:s,databaseName:c,collectionName:r,onAggregationResults:f})=>{const[d,g]=S.useState('[{ "$match": {} }]'),[x,p]=S.useState(!1),[m,v]=S.useState(null),{TransactionKey:E}=ct(M=>M),R=()=>Oe(null,null,function*(){var M,z;try{p(!0),v(null);const D=JSON.parse(d),V=yield me.post(`${st}/api/operation/aggregate/?dbName=${c}&collectionName=${r}`,{aggregation:D},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${E}`}});if(V.data&&V.data.data){const G=V.data.data.documents||V.data.data;f(G,D),s()}}catch(D){console.error("Aggregation error:",D),v(((z=(M=D.response)==null?void 0:M.data)==null?void 0:z.message)||D.message||"Failed to run aggregation")}finally{p(!1)}}),U=()=>{v(null),s()};return n?o.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 z-50 flex items-center justify-center p-4",children:o.jsxs("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-3xl max-h-[90vh] flex flex-col",children:[o.jsxs("div",{className:"px-6 py-4 border-b border-gray-200 flex justify-between items-center bg-gradient-to-r from-indigo-50 to-blue-50",children:[o.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Run Aggregation Pipeline"}),o.jsx("button",{onClick:U,className:"text-gray-500 hover:text-gray-700 focus:outline-none",children:o.jsx("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"flex-1 overflow-auto p-6",children:[o.jsxs("div",{className:"mb-4",children:[o.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Enter your MongoDB aggregation pipeline as a JSON array. Example:"}),o.jsx("div",{className:"bg-gray-50 p-3 rounded-md text-xs font-mono mb-4 border border-gray-200",children:'[{ "$match": { "field": "value" } }, { "$sort": { "field": 1 } }]'}),o.jsxs("p",{className:"text-sm text-gray-600 mb-4",children:["Running on ",o.jsx("span",{className:"font-semibold",children:r})," ","in database ",o.jsx("span",{className:"font-semibold",children:c})]})]}),o.jsxs("div",{className:"mb-4",children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Aggregation Pipeline"}),o.jsx("textarea",{className:"w-full h-64 px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 font-mono text-sm",value:d,onChange:M=>g(M.target.value),placeholder:'[{ "$match": {} }]'})]}),m&&o.jsx("div",{className:"bg-red-50 border-l-4 border-red-500 p-4 mb-4",children:o.jsxs("div",{className:"flex",children:[o.jsx("div",{className:"flex-shrink-0",children:o.jsx("svg",{className:"h-5 w-5 text-red-500",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),o.jsx("div",{className:"ml-3",children:o.jsx("p",{className:"text-sm text-red-700",children:m})})]})})]}),o.jsxs("div",{className:"px-6 py-4 border-t border-gray-200 flex justify-end",children:[o.jsx("button",{onClick:U,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 hover:bg-gray-200 rounded-md mr-3",children:"Cancel"}),o.jsx("button",{onClick:R,disabled:x,className:`px-4 py-2 text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 rounded-md flex items-center ${x?"opacity-70 cursor-not-allowed":""}`,children:x?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Processing..."]}):o.jsxs(o.Fragment,{children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Run Aggregation"]})})]})]})}):null},fh=()=>{const[n]=Ah(),s=iu(),[c,r]=S.useState(!0),[f,d]=S.useState([]),[g,x]=S.useState(!0),[p,m]=S.useState(1),v=S.useRef(),E=n.get("database"),R=n.get("collection"),{TransactionKey:U}=ct(J=>J),[M,z]=S.useState(!1),[D,V]=S.useState(!1),[G,k]=S.useState(!1),[I,X]=S.useState(!1),[F,ce]=S.useState(null),[fe,Ce]=S.useState(!1),[tt,we]=S.useState([]),[xe,ze]=S.useState([]),Ke=S.useCallback((J=1,ue=!1)=>Oe(null,null,function*(){try{r(!0);const je=yield me.get(`${st}/api/operation/all/?dbName=${E}&collectionName=${R}&page=${J}&transactiontoken=${U}`);if(je.status===200){const hl=je.data.data.data.documents||[];d(ue?hl:Yt=>[...Yt,...hl]),x(hl.length===10)}r(!1)}catch(je){console.error("Error fetching documents:",je),r(!1)}}),[E,R,U]);S.useEffect(()=>{if(!E||!R){s("/collections");return}Ce(!1),we([]),m(1),d([]),Ke(1,!0)},[E,R,s,Ke]);const qe=S.useCallback(J=>{c||fe||(v.current&&v.current.disconnect(),v.current=new IntersectionObserver(ue=>{ue[0].isIntersecting&&g&&(m(je=>je+1),Ke(p+1))}),J&&v.current.observe(J))},[c,g,Ke,p,fe]),B=()=>{s(`/collections?database=${E}`)},Z=J=>{d(ue=>[J,...ue])},ee=J=>{ce(J),V(!0)},Se=J=>{ce(J),k(!0)},w=()=>Oe(null,null,function*(){try{r(!0);const J=yield me.post(`${st}/api/operation/aggregate/?dbName=${E}&collectionName=${R}`,{aggregation:tt},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${U}`}});J.data&&J.data.data&&ze(J.data.data.documents||J.data.data),r(!1)}catch(J){console.error("Error re-running aggregation:",J),r(!1)}}),Y=J=>{d(ue=>ue.map(je=>je.documentId===J.documentId?J:je)),fe&&w()},K=J=>{d(ue=>ue.filter(je=>je.documentId!==J)),fe&&w()},Q=(J,ue)=>{ze(J),we(ue),Ce(!0)},P=()=>{Ce(!1),we([]),ze([]),Ke(1,!0)},ge=J=>new Date(J).toLocaleString(),ne=J=>{try{return!Array.isArray(J)||J.length===0?"No conditions":J.map((je,hl)=>{const Yt=Object.keys(je)[0];return`${Yt.replace("$","")}: ${JSON.stringify(je[Yt]).substring(0,30)}${JSON.stringify(je[Yt]).length>30?"...":""}`}).join(", ")}catch(ue){return"Invalid pipeline"}};return o.jsxs("div",{className:"container mx-auto px-4 py-6 max-w-7xl",children:[o.jsxs("div",{className:"bg-white rounded-lg shadow-lg overflow-hidden mb-8",children:[o.jsxs("div",{className:"flex justify-between items-center p-6 bg-gradient-to-r from-blue-50 to-indigo-50 border-b border-gray-200",children:[o.jsxs("div",{children:[o.jsx("div",{className:"flex items-center mb-2",children:o.jsxs("button",{onClick:B,className:"text-blue-600 hover:text-blue-800 flex items-center transition-colors font-medium",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-1",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M9.707 16.707a1 1 0 01-1.414 0l-6-6a1 1 0 010-1.414l6-6a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})}),"Back to Collections"]})}),o.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Documents"}),o.jsxs("div",{className:"flex items-center mt-1 text-gray-600",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2 text-indigo-500",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{d:"M7 3a1 1 0 000 2h6a1 1 0 100-2H7zM4 7a1 1 0 011-1h10a1 1 0 110 2H5a1 1 0 01-1-1zM2 11a2 2 0 002-2h12a2 2 0 012 2v4a2 2 0 01-2 2H4a2 2 0 01-2-2v-4z"})}),o.jsx("span",{className:"font-medium",children:R}),o.jsx("span",{className:"mx-2",children:"in"}),o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2 text-indigo-500",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{d:"M5 3a2 2 0 00-2 2v2a2 2 0 002 2h2a2 2 0 002-2V5a2 2 0 00-2-2H5zM5 11a2 2 0 00-2 2v2a2 2 0 002 2h2a2 2 0 002-2v-2a2 2 0 00-2-2H5zM11 5a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V5zM11 13a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"})}),o.jsx("span",{className:"font-medium",children:E})]})]}),o.jsxs("div",{className:"flex space-x-3",children:[o.jsxs("button",{onClick:()=>X(!0),className:"bg-indigo-600 hover:bg-indigo-700 text-white py-2 px-5 rounded-lg flex items-center transition-colors shadow-md",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M3 3a1 1 0 000 2v8a2 2 0 002 2h2.586l-1.293 1.293a1 1 0 101.414 1.414L10 15.414l2.293 2.293a1 1 0 001.414-1.414L12.414 15H15a2 2 0 002-2V5a1 1 0 100-2H3zm11.707 4.707a1 1 0 00-1.414-1.414L10 9.586 8.707 8.293a1 1 0 00-1.414 0l-2 2a1 1 0 101.414 1.414L8 10.414l1.293 1.293a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),"Run Aggregate"]}),o.jsxs("button",{onClick:()=>z(!0),className:"bg-green-600 hover:bg-green-700 text-white py-2 px-5 rounded-lg flex items-center transition-colors shadow-md",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"})}),"Insert Document"]})]})]}),fe&&o.jsxs("div",{className:"bg-indigo-50 px-6 py-3 border-b border-indigo-100 flex justify-between items-center",children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 text-indigo-600 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),o.jsxs("div",{children:[o.jsx("span",{className:"text-sm font-medium text-indigo-800",children:"Aggregation Results"}),o.jsxs("p",{className:"text-xs text-indigo-600 mt-0.5",children:["Pipeline: ",ne(tt)]})]})]}),o.jsxs("button",{onClick:P,className:"text-indigo-700 hover:text-indigo-900 text-sm font-medium flex items-center",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Clear Aggregation"]})]}),o.jsxs("div",{className:"p-6",children:[c&&(!fe&&f.length===0)?o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[1,2,3,4,5,6].map(J=>o.jsxs("div",{className:"animate-pulse bg-white rounded-lg border border-gray-200 shadow-sm p-4",children:[o.jsx("div",{className:"h-4 bg-gray-200 rounded w-3/4 mb-3"}),o.jsx("div",{className:"h-3 bg-gray-100 rounded w-1/2 mb-2"}),o.jsx("div",{className:"h-20 bg-gray-100 rounded mb-3"}),o.jsxs("div",{className:"flex justify-end",children:[o.jsx("div",{className:"h-8 bg-gray-200 rounded w-16 mr-2"}),o.jsx("div",{className:"h-8 bg-gray-200 rounded w-16"})]})]},J))}):fe?xe.length>0?o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:xe.map((J,ue)=>o.jsx("div",{className:"bg-white rounded-lg border border-gray-200 shadow-sm hover:shadow-md transition-shadow overflow-hidden",children:o.jsxs("div",{className:"p-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 text-indigo-500 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M3 3a1 1 0 000 2v8a2 2 0 002 2h2.586l-1.293 1.293a1 1 0 101.414 1.414L10 15.414l2.293 2.293a1 1 0 001.414-1.414L12.414 15H15a2 2 0 002-2V5a1 1 0 100-2H3zm11.707 4.707a1 1 0 00-1.414-1.414L10 9.586 8.707 8.293a1 1 0 00-1.414 0l-2 2a1 1 0 101.414 1.414L8 10.414l1.293 1.293a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),o.jsx("div",{className:"font-mono text-indigo-700 font-semibold",children:o.jsx("span",{className:"text-sm",children:J.documentId?`ID: ${J.documentId}`:`Result #${ue+1}`})})]}),J.updatedAt&&o.jsx("span",{className:"text-xs text-gray-500",title:J.updatedAt,children:ge(J.updatedAt)})]}),o.jsx("div",{className:"bg-gray-50 rounded p-3 mb-3 h-48 overflow-y-auto",children:o.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap break-words text-gray-800",children:JSON.stringify(Object.fromEntries(Object.entries(J).filter(([je])=>!["documentId","updatedAt"].includes(je))),null,2)})}),J.documentId&&o.jsxs("div",{className:"flex justify-end space-x-2",children:[o.jsx("button",{onClick:()=>ee(J),className:"text-indigo-600 hover:text-indigo-900 bg-indigo-50 hover:bg-indigo-100 px-3 py-1 rounded-md text-sm transition-colors",children:"Update"}),o.jsx("button",{onClick:()=>Se(J),className:"text-red-600 hover:text-red-900 bg-red-50 hover:bg-red-100 px-3 py-1 rounded-md text-sm transition-colors",children:"Delete"})]})]})},ue))}):o.jsxs("div",{className:"text-center py-12",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-16 w-16 text-gray-300 mx-auto mb-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),o.jsx("p",{className:"text-gray-500 mb-2",children:"No documents match your aggregation pipeline"}),o.jsx("button",{onClick:P,className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500",children:"Clear Aggregation"})]}):f.length>0?o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:f.map((J,ue)=>o.jsx("div",{ref:!fe&&ue===f.length-1?qe:null,className:"bg-white rounded-lg border border-gray-200 shadow-sm hover:shadow-md transition-shadow overflow-hidden",children:o.jsxs("div",{className:"p-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 text-yellow-500 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"})}),o.jsx("div",{className:"font-mono text-indigo-700 font-semibold",title:J.documentId,children:o.jsxs("span",{className:"text-sm",children:["ID: ",J.documentId]})})]}),o.jsx("span",{className:"text-xs text-gray-500",title:J.updatedAt,children:ge(J.updatedAt)})]}),o.jsx("div",{className:"bg-gray-50 rounded p-3 mb-3 h-48 overflow-y-auto",children:o.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap break-words text-gray-800",children:JSON.stringify(Object.fromEntries(Object.entries(J).filter(([je])=>!["documentId","updatedAt"].includes(je))),null,2)})}),o.jsxs("div",{className:"flex justify-end space-x-2",children:[o.jsx("button",{onClick:()=>ee(J),className:"text-indigo-600 hover:text-indigo-900 bg-indigo-50 hover:bg-indigo-100 px-3 py-1 rounded-md text-sm transition-colors",children:"Update"}),o.jsx("button",{onClick:()=>Se(J),className:"text-red-600 hover:text-red-900 bg-red-50 hover:bg-red-100 px-3 py-1 rounded-md text-sm transition-colors",children:"Delete"})]})]})},J.documentId))}):o.jsxs("div",{className:"text-center py-12",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-16 w-16 text-gray-300 mx-auto mb-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),o.jsx("p",{className:"text-gray-500 mb-2",children:"No documents found in this collection"}),o.jsx("button",{onClick:()=>z(!0),className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500",children:"Insert Your First Document"})]}),c&&f.length>0&&!fe&&o.jsx("div",{className:"flex justify-center items-center py-4",children:o.jsxs("svg",{className:"animate-spin h-6 w-6 text-indigo-500",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}),!c&&!g&&f.length>0&&!fe&&o.jsx("div",{className:"text-center py-4 text-gray-500 text-sm border-t border-gray-100 mt-6",children:"You've reached the end of the results."}),fe&&xe.length>0&&o.jsxs("div",{className:"text-center py-4 text-gray-500 text-sm border-t border-gray-100 mt-6",children:["Showing all ",xe.length," aggregation results."]})]})]}),M&&o.jsx(x2,{isOpen:M,onClose:()=>z(!1),onDocumentInserted:Z,databaseName:E,collectionName:R,onSuccess:()=>Ke(1,!0)}),D&&F&&o.jsx(b2,{isOpen:D,onClose:()=>V(!1),onDocumentUpdated:Y,document:F,databaseName:E,collectionName:R}),G&&F&&o.jsx(S2,{isOpen:G,onClose:()=>k(!1),onDocumentDeleted:K,documentId:F.documentId,databaseName:E,collectionName:R}),I&&o.jsx(w2,{isOpen:I,onClose:()=>X(!1),databaseName:E,collectionName:R,onAggregationResults:Q})]})},N2=()=>{const[n,s]=S.useState([]),[c,r]=S.useState(!0),[f,d]=S.useState(null),[g,x]=S.useState({}),{TransactionKey:p}=ct(R=>R);S.useEffect(()=>{p&&Oe(null,null,function*(){try{r(!0);const U=yield me.get(`${st}/api/routes?transactiontoken=${p}`);if(U.data&&U.data.data&&Array.isArray(U.data.data)){s(U.data.data);const M={};U.data.data.forEach(z=>{M[z.groupName]=!0}),x(M)}else throw new Error("Invalid API response format");r(!1)}catch(U){console.error("Error fetching API routes:",U),d("Failed to load API reference. Please try again later."),r(!1)}})},[p]);const m=R=>{x(U=>nt(pe({},U),{[R]:!U[R]}))},v=R=>{switch(R){case"GET":return"bg-blue-600";case"POST":return"bg-green-600";case"PUT":return"bg-amber-600";case"DELETE":return"bg-red-600";default:return"bg-gray-600"}},E=R=>o.jsx("pre",{className:"mt-2 p-3 bg-gray-800 text-gray-200 rounded-md overflow-x-auto text-sm",children:JSON.stringify(R,null,2)});return c?o.jsxs("div",{className:"container mx-auto px-4 py-8",children:[o.jsx("h1",{className:"text-2xl font-bold mb-6",children:"API Reference"}),o.jsx("div",{className:"flex justify-center items-center py-12",children:o.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-blue-500"})})]}):f?o.jsxs("div",{className:"container mx-auto px-4 py-8",children:[o.jsx("h1",{className:"text-2xl font-bold mb-6",children:"API Reference"}),o.jsx("div",{className:"bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded",children:o.jsx("p",{children:f})})]}):o.jsxs("div",{className:"container mx-auto px-4 py-8",children:[o.jsx("h1",{className:"text-2xl font-bold mb-2",children:"API Reference"}),o.jsx("p",{className:"text-gray-600 mb-6",children:"Complete documentation for the AxioDB REST API"}),n.length===0&&!c&&!f?o.jsx("div",{className:"bg-yellow-100 border border-yellow-400 text-yellow-700 px-4 py-3 rounded",children:o.jsx("p",{children:"No API routes found. The server might not have returned any routes."})}):o.jsx("div",{className:"space-y-6",children:n.map(R=>o.jsxs("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:[o.jsxs("div",{className:"bg-gray-50 px-4 py-3 flex justify-between items-center cursor-pointer",onClick:()=>m(R.groupName),children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-medium text-gray-900",children:R.groupName}),o.jsx("p",{className:"text-sm text-gray-500",children:R.description})]}),o.jsx("div",{className:"text-gray-500",children:g[R.groupName]?o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M5 10a1 1 0 011-1h8a1 1 0 110 2H6a1 1 0 01-1-1z",clipRule:"evenodd"})}):o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z",clipRule:"evenodd"})})})]}),g[R.groupName]&&o.jsx("div",{className:"divide-y divide-gray-200",children:R.Paths.map((U,M)=>o.jsx("div",{className:"p-4 hover:bg-gray-50",children:o.jsxs("div",{className:"flex items-start",children:[o.jsx("span",{className:`${v(U.method)} text-white text-xs font-bold px-2 py-1 rounded mr-3 min-w-16 text-center`,children:U.method}),o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"font-mono text-sm bg-gray-100 p-2 rounded mb-2 overflow-x-auto",children:U.path}),o.jsx("p",{className:"text-gray-700 mb-2",children:U.description}),U.payload&&o.jsxs("div",{children:[o.jsx("h4",{className:"text-sm font-semibold text-gray-700 mt-2 mb-1",children:"Payload:"}),E(U.payload)]})]})]})},M))})]},R.groupName))})]})};function E2(){const{loadKey:n}=ct(r=>r),[s,c]=S.useState(!0);return S.useEffect(()=>{Oe(null,null,function*(){try{yield n()}finally{c(!1)}})},[n]),s?o.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"spinner-border text-primary mb-3",role:"status",children:o.jsx("span",{className:"sr-only",children:"Loading..."})}),o.jsx("p",{className:"text-gray-600",children:"Loading application..."})]})}):o.jsx(I1,{children:o.jsxs("div",{className:"min-h-screen bg-gray-50 flex flex-col",children:[o.jsx(Xv,{}),o.jsx("main",{className:"flex-grow",children:o.jsxs(D1,{children:[o.jsx(ua,{path:"/",element:o.jsx(f2,{})}),o.jsx(ua,{path:"/operations",element:o.jsx(g2,{})}),o.jsx(ua,{path:"/collections",element:o.jsx(v2,{})}),o.jsx(ua,{path:"/documents",element:o.jsx(fh,{})}),o.jsx(ua,{path:"/api",element:o.jsx(N2,{})}),o.jsx(ua,{path:"/collections/documents",element:o.jsx(fh,{})})]})}),o.jsx(cp,{})]})})}qy.createRoot(document.getElementById("root")).render(o.jsx(S.StrictMode,{children:o.jsx(E2,{})}))});export default j2();
67
+ }`),[p,m]=S.useState(""),[v,E]=S.useState(!1),{TransactionKey:R}=ct(M=>M),U=M=>Oe(null,null,function*(){var z;M.preventDefault(),m("");try{const D=JSON.parse(g);E(!0);const V=yield me.post(`${st}/api/operation/create/?dbName=${r}&collectionName=${f}&transactiontoken=${R}`,pe({},D));if(V.status===200||V.status===201){const G=(z=V.data.data)==null?void 0:z.documentId,k=nt(pe({},D),{documentId:G||`doc_${Date.now()}`,updatedAt:new Date().toISOString()});c(k),s(),typeof d=="function"&&d()}else throw new Error("Failed to insert document")}catch(D){D instanceof SyntaxError?m("Invalid JSON format. Please check your input."):m(`Error inserting document: ${D.message}`),E(!1)}});return n?o.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 overflow-y-auto h-full w-full z-50 flex justify-center items-center backdrop-blur-sm",children:o.jsxs("div",{className:"relative bg-white rounded-lg shadow-2xl max-w-2xl w-full mx-4 max-h-[90vh] flex flex-col",children:[o.jsxs("div",{className:"flex justify-between items-center p-5 border-b",children:[o.jsxs("h3",{className:"text-xl font-semibold text-gray-900 flex items-center",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 mr-2 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Insert New Document"]}),o.jsx("button",{onClick:s,className:"text-gray-400 hover:text-gray-500 transition-colors",children:o.jsx("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"p-6 overflow-y-auto flex-grow",children:[o.jsxs("div",{className:"mb-4 flex items-center space-x-2 bg-blue-50 p-3 rounded-md",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 text-blue-500",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})}),o.jsxs("p",{className:"text-sm text-blue-700",children:["Enter the document data in JSON format to insert into"," ",o.jsx("span",{className:"font-semibold",children:f})]})]}),p&&o.jsx("div",{className:"mb-4 bg-red-50 border-l-4 border-red-500 p-4 text-red-700",children:o.jsx("p",{children:p})}),o.jsxs("form",{onSubmit:U,children:[o.jsxs("div",{className:"mb-4",children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Document Data (JSON)"}),o.jsx("textarea",{value:g,onChange:M=>x(M.target.value),className:"w-full h-64 p-3 border border-gray-300 rounded-md font-mono text-sm focus:ring-blue-500 focus:border-blue-500 shadow-inner bg-gray-50",placeholder:"Enter JSON document data",required:!0}),o.jsx("p",{className:"mt-2 text-xs text-gray-500",children:"The documentId and updatedAt fields will be automatically generated."})]}),o.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[o.jsx("button",{type:"button",onClick:s,className:"px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors",children:"Cancel"}),o.jsx("button",{type:"submit",disabled:v,className:`px-4 py-2 rounded-md text-white flex items-center ${v?"bg-green-500":"bg-green-600 hover:bg-green-700"} transition-colors shadow-md`,children:v?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"animate-spin h-5 w-5 mr-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Inserting..."]}):"Insert Document"})]})]})]})]})}):null},b2=({isOpen:n,onClose:s,onDocumentUpdated:c,document:r,databaseName:f,collectionName:d})=>{const[g,x]=S.useState(""),[p,m]=S.useState(""),[v,E]=S.useState(!1),{TransactionKey:R}=ct(M=>M);S.useEffect(()=>{if(r){const M=r,{documentId:z,updatedAt:D}=M,V=aa(M,["documentId","updatedAt"]);x(JSON.stringify(V,null,2))}},[r]);const U=M=>Oe(null,null,function*(){var z;M.preventDefault(),m("");try{const D=JSON.parse(g);E(!0);const V=yield me.put(`${st}/api/operation/update/?dbName=${f}&collectionName=${d}&documentId=${r.documentId}&transactiontoken=${R}`,pe({},D));if(V.status===200){const G=((z=V.data.data)==null?void 0:z.document)||nt(pe({},D),{documentId:r.documentId,updatedAt:new Date().toISOString()});c(G),s()}else throw new Error("Failed to update document")}catch(D){D instanceof SyntaxError?m("Invalid JSON format. Please check your input."):m(`Error updating document: ${D.message}`),E(!1)}});return n?o.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 overflow-y-auto h-full w-full z-50 flex justify-center items-center backdrop-blur-sm",children:o.jsxs("div",{className:"relative bg-white rounded-lg shadow-2xl max-w-2xl w-full mx-4 max-h-[90vh] flex flex-col",children:[o.jsxs("div",{className:"flex justify-between items-center p-5 border-b",children:[o.jsxs("h3",{className:"text-xl font-semibold text-gray-900 flex items-center",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 mr-2 text-indigo-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})}),"Update Document"]}),o.jsx("button",{onClick:s,className:"text-gray-400 hover:text-gray-500 transition-colors",children:o.jsx("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"p-6 overflow-y-auto flex-grow",children:[o.jsxs("div",{className:"mb-4 flex items-center space-x-2 bg-indigo-50 p-3 rounded-md",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 text-indigo-500",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})}),o.jsx("p",{className:"text-sm text-indigo-700",children:"Edit the document data in JSON format"})]}),p&&o.jsx("div",{className:"mb-4 bg-red-50 border-l-4 border-red-500 p-4 text-red-700",children:o.jsx("p",{children:p})}),o.jsxs("form",{onSubmit:U,children:[o.jsxs("div",{className:"mb-4",children:[o.jsxs("div",{className:"flex justify-between items-center mb-2",children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Document Data (JSON)"}),o.jsxs("div",{className:"flex items-center",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-1 text-yellow-500",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"})}),o.jsxs("span",{className:"text-xs text-gray-500 font-mono",children:["ID: ",r.documentId]})]})]}),o.jsx("textarea",{value:g,onChange:M=>x(M.target.value),className:"w-full h-64 p-3 border border-gray-300 rounded-md font-mono text-sm focus:ring-indigo-500 focus:border-indigo-500 shadow-inner bg-gray-50",placeholder:"Enter JSON document data",required:!0}),o.jsx("p",{className:"mt-2 text-xs text-gray-500",children:"You cannot change the document's ID. The updatedAt field will be automatically updated."})]}),o.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[o.jsx("button",{type:"button",onClick:s,className:"px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors",children:"Cancel"}),o.jsx("button",{type:"submit",disabled:v,className:`px-4 py-2 rounded-md text-white flex items-center ${v?"bg-indigo-500":"bg-indigo-600 hover:bg-indigo-700"} transition-colors shadow-md`,children:v?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"animate-spin h-5 w-5 mr-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Updating..."]}):"Update Document"})]})]})]})]})}):null},S2=({isOpen:n,onClose:s,onDocumentDeleted:c,documentId:r,databaseName:f,collectionName:d})=>{const[g,x]=S.useState(!1),[p,m]=S.useState(""),{TransactionKey:v}=ct(R=>R),E=()=>Oe(null,null,function*(){try{if(x(!0),(yield me.delete(`${st}/api/operation/delete/by-id/?dbName=${f}&collectionName=${d}&documentId=${r}&transactiontoken=${v}`)).status===200)c(r),s();else throw new Error("Failed to delete document")}catch(R){m(`Error deleting document: ${R.message}`),x(!1)}});return n?o.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 overflow-y-auto h-full w-full z-50 flex justify-center items-center backdrop-blur-sm",children:o.jsxs("div",{className:"relative bg-white rounded-lg shadow-2xl max-w-md w-full mx-4",children:[o.jsxs("div",{className:"flex justify-between items-center p-5 border-b",children:[o.jsxs("h3",{className:"text-xl font-semibold text-gray-900 flex items-center",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 mr-2 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),"Delete Document"]}),o.jsx("button",{onClick:s,className:"text-gray-400 hover:text-gray-500 transition-colors",children:o.jsx("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"p-6",children:[o.jsx("div",{className:"bg-red-50 p-4 rounded-md mb-5",children:o.jsxs("div",{className:"flex",children:[o.jsx("div",{className:"flex-shrink-0",children:o.jsx("svg",{className:"h-5 w-5 text-red-400",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),o.jsxs("div",{className:"ml-3",children:[o.jsx("h3",{className:"text-sm font-medium text-red-800",children:"Are you sure you want to delete this document?"}),o.jsx("div",{className:"mt-2 text-sm text-red-700",children:o.jsx("p",{children:"This action cannot be undone."})})]})]})}),o.jsxs("div",{className:"mb-5",children:[o.jsx("p",{className:"text-gray-700 mb-2",children:o.jsx("span",{className:"font-medium",children:"Document ID:"})}),o.jsx("div",{className:"bg-gray-50 p-2 rounded border border-gray-200 font-mono text-sm break-all",children:r})]}),o.jsxs("div",{className:"mb-5",children:[o.jsxs("p",{className:"text-gray-700 mb-1",children:[o.jsx("span",{className:"font-medium",children:"Collection:"})," ",d]}),o.jsxs("p",{className:"text-gray-700",children:[o.jsx("span",{className:"font-medium",children:"Database:"})," ",f]})]}),p&&o.jsx("div",{className:"mb-4 bg-red-50 border-l-4 border-red-500 p-4 text-red-700",children:o.jsx("p",{children:p})}),o.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[o.jsx("button",{type:"button",onClick:s,className:"px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors",children:"Cancel"}),o.jsx("button",{onClick:E,disabled:g,className:`px-4 py-2 rounded-md text-white flex items-center ${g?"bg-red-500":"bg-red-600 hover:bg-red-700"} transition-colors shadow-md`,children:g?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"animate-spin h-5 w-5 mr-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Deleting..."]}):"Delete Document"})]})]})]})}):null},w2=({isOpen:n,onClose:s,databaseName:c,collectionName:r,onAggregationResults:f})=>{const[d,g]=S.useState('[{ "$match": {} }]'),[x,p]=S.useState(!1),[m,v]=S.useState(null),{TransactionKey:E}=ct(M=>M),R=()=>Oe(null,null,function*(){var M,z;try{p(!0),v(null);const D=JSON.parse(d),V=yield me.post(`${st}/api/operation/aggregate/?dbName=${c}&collectionName=${r}`,{aggregation:D},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${E}`}});if(V.data&&V.data.data){const G=V.data.data.documents||V.data.data;f(G,D),s()}}catch(D){console.error("Aggregation error:",D),v(((z=(M=D.response)==null?void 0:M.data)==null?void 0:z.message)||D.message||"Failed to run aggregation")}finally{p(!1)}}),U=()=>{v(null),s()};return n?o.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 z-50 flex items-center justify-center p-4",children:o.jsxs("div",{className:"bg-white rounded-lg shadow-xl w-full max-w-3xl max-h-[90vh] flex flex-col",children:[o.jsxs("div",{className:"px-6 py-4 border-b border-gray-200 flex justify-between items-center bg-gradient-to-r from-indigo-50 to-blue-50",children:[o.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Run Aggregation Pipeline"}),o.jsx("button",{onClick:U,className:"text-gray-500 hover:text-gray-700 focus:outline-none",children:o.jsx("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"flex-1 overflow-auto p-6",children:[o.jsxs("div",{className:"mb-4",children:[o.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Enter your MongoDB aggregation pipeline as a JSON array. Example:"}),o.jsx("div",{className:"bg-gray-50 p-3 rounded-md text-xs font-mono mb-4 border border-gray-200",children:'[{ "$match": { "field": "value" } }, { "$sort": { "field": 1 } }]'}),o.jsxs("p",{className:"text-sm text-gray-600 mb-4",children:["Running on ",o.jsx("span",{className:"font-semibold",children:r})," ","in database ",o.jsx("span",{className:"font-semibold",children:c})]})]}),o.jsxs("div",{className:"mb-4",children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Aggregation Pipeline"}),o.jsx("textarea",{className:"w-full h-64 px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 font-mono text-sm",value:d,onChange:M=>g(M.target.value),placeholder:'[{ "$match": {} }]'})]}),m&&o.jsx("div",{className:"bg-red-50 border-l-4 border-red-500 p-4 mb-4",children:o.jsxs("div",{className:"flex",children:[o.jsx("div",{className:"flex-shrink-0",children:o.jsx("svg",{className:"h-5 w-5 text-red-500",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),o.jsx("div",{className:"ml-3",children:o.jsx("p",{className:"text-sm text-red-700",children:m})})]})})]}),o.jsxs("div",{className:"px-6 py-4 border-t border-gray-200 flex justify-end",children:[o.jsx("button",{onClick:U,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 hover:bg-gray-200 rounded-md mr-3",children:"Cancel"}),o.jsx("button",{onClick:R,disabled:x,className:`px-4 py-2 text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 rounded-md flex items-center ${x?"opacity-70 cursor-not-allowed":""}`,children:x?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Processing..."]}):o.jsxs(o.Fragment,{children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Run Aggregation"]})})]})]})}):null},fh=()=>{const[n]=Ah(),s=iu(),[c,r]=S.useState(!0),[f,d]=S.useState([]),[g,x]=S.useState(!0),[p,m]=S.useState(1),v=S.useRef(),E=n.get("database"),R=n.get("collection"),{TransactionKey:U}=ct(J=>J),[M,z]=S.useState(!1),[D,V]=S.useState(!1),[G,k]=S.useState(!1),[I,X]=S.useState(!1),[F,ce]=S.useState(null),[fe,Ce]=S.useState(!1),[tt,we]=S.useState([]),[xe,ze]=S.useState([]),Ke=S.useCallback((J=1,ue=!1)=>Oe(null,null,function*(){try{r(!0);const je=yield me.get(`${st}/api/operation/all/?dbName=${E}&collectionName=${R}&page=${J}&transactiontoken=${U}`);if(je.status===200){const hl=je.data.data.data.documents||[];d(ue?hl:Yt=>[...Yt,...hl]),x(hl.length===10)}r(!1)}catch(je){console.error("Error fetching documents:",je),r(!1)}}),[E,R,U]);S.useEffect(()=>{if(!E||!R){s("/collections");return}Ce(!1),we([]),m(1),d([]),Ke(1,!0)},[E,R,s,Ke]);const qe=S.useCallback(J=>{c||fe||(v.current&&v.current.disconnect(),v.current=new IntersectionObserver(ue=>{ue[0].isIntersecting&&g&&(m(je=>je+1),Ke(p+1))}),J&&v.current.observe(J))},[c,g,Ke,p,fe]),B=()=>{s(`/collections?database=${E}`)},Z=J=>{d(ue=>[J,...ue])},ee=J=>{ce(J),V(!0)},Se=J=>{ce(J),k(!0)},w=()=>Oe(null,null,function*(){try{r(!0);const J=yield me.post(`${st}/api/operation/aggregate/?dbName=${E}&collectionName=${R}`,{aggregation:tt},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${U}`}});J.data&&J.data.data&&ze(J.data.data.documents||J.data.data),r(!1)}catch(J){console.error("Error re-running aggregation:",J),r(!1)}}),Y=J=>{d(ue=>ue.map(je=>je.documentId===J.documentId?J:je)),fe&&w()},K=J=>{d(ue=>ue.filter(je=>je.documentId!==J)),fe&&w()},Q=(J,ue)=>{ze(J),we(ue),Ce(!0)},P=()=>{Ce(!1),we([]),ze([]),Ke(1,!0)},ge=J=>new Date(J).toLocaleString(),ne=J=>{try{return!Array.isArray(J)||J.length===0?"No conditions":J.map((je,hl)=>{const Yt=Object.keys(je)[0];return`${Yt.replace("$","")}: ${JSON.stringify(je[Yt]).substring(0,30)}${JSON.stringify(je[Yt]).length>30?"...":""}`}).join(", ")}catch(ue){return"Invalid pipeline"}};return o.jsxs("div",{className:"container mx-auto px-4 py-6 max-w-7xl",children:[o.jsxs("div",{className:"bg-white rounded-lg shadow-lg overflow-hidden mb-8",children:[o.jsxs("div",{className:"flex justify-between items-center p-6 bg-gradient-to-r from-blue-50 to-indigo-50 border-b border-gray-200",children:[o.jsxs("div",{children:[o.jsx("div",{className:"flex items-center mb-2",children:o.jsxs("button",{onClick:B,className:"text-blue-600 hover:text-blue-800 flex items-center transition-colors font-medium",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-1",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M9.707 16.707a1 1 0 01-1.414 0l-6-6a1 1 0 010-1.414l6-6a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})}),"Back to Collections"]})}),o.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Documents"}),o.jsxs("div",{className:"flex items-center mt-1 text-gray-600",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2 text-indigo-500",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{d:"M7 3a1 1 0 000 2h6a1 1 0 100-2H7zM4 7a1 1 0 011-1h10a1 1 0 110 2H5a1 1 0 01-1-1zM2 11a2 2 0 002-2h12a2 2 0 012 2v4a2 2 0 01-2 2H4a2 2 0 01-2-2v-4z"})}),o.jsx("span",{className:"font-medium",children:R}),o.jsx("span",{className:"mx-2",children:"in"}),o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2 text-indigo-500",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{d:"M5 3a2 2 0 00-2 2v2a2 2 0 002 2h2a2 2 0 002-2V5a2 2 0 00-2-2H5zM5 11a2 2 0 00-2 2v2a2 2 0 002 2h2a2 2 0 002-2v-2a2 2 0 00-2-2H5zM11 5a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V5zM11 13a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"})}),o.jsx("span",{className:"font-medium",children:E})]})]}),o.jsxs("div",{className:"flex space-x-3",children:[o.jsxs("button",{onClick:()=>X(!0),className:"bg-indigo-600 hover:bg-indigo-700 text-white py-2 px-5 rounded-lg flex items-center transition-colors shadow-md",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M3 3a1 1 0 000 2v8a2 2 0 002 2h2.586l-1.293 1.293a1 1 0 101.414 1.414L10 15.414l2.293 2.293a1 1 0 001.414-1.414L12.414 15H15a2 2 0 002-2V5a1 1 0 100-2H3zm11.707 4.707a1 1 0 00-1.414-1.414L10 9.586 8.707 8.293a1 1 0 00-1.414 0l-2 2a1 1 0 101.414 1.414L8 10.414l1.293 1.293a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),"Run Aggregate"]}),o.jsxs("button",{onClick:()=>z(!0),className:"bg-green-600 hover:bg-green-700 text-white py-2 px-5 rounded-lg flex items-center transition-colors shadow-md",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"})}),"Insert Document"]})]})]}),fe&&o.jsxs("div",{className:"bg-indigo-50 px-6 py-3 border-b border-indigo-100 flex justify-between items-center",children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 text-indigo-600 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),o.jsxs("div",{children:[o.jsx("span",{className:"text-sm font-medium text-indigo-800",children:"Aggregation Results"}),o.jsxs("p",{className:"text-xs text-indigo-600 mt-0.5",children:["Pipeline: ",ne(tt)]})]})]}),o.jsxs("button",{onClick:P,className:"text-indigo-700 hover:text-indigo-900 text-sm font-medium flex items-center",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),"Clear Aggregation"]})]}),o.jsxs("div",{className:"p-6",children:[c&&(!fe&&f.length===0)?o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[1,2,3,4,5,6].map(J=>o.jsxs("div",{className:"animate-pulse bg-white rounded-lg border border-gray-200 shadow-sm p-4",children:[o.jsx("div",{className:"h-4 bg-gray-200 rounded w-3/4 mb-3"}),o.jsx("div",{className:"h-3 bg-gray-100 rounded w-1/2 mb-2"}),o.jsx("div",{className:"h-20 bg-gray-100 rounded mb-3"}),o.jsxs("div",{className:"flex justify-end",children:[o.jsx("div",{className:"h-8 bg-gray-200 rounded w-16 mr-2"}),o.jsx("div",{className:"h-8 bg-gray-200 rounded w-16"})]})]},J))}):fe?xe.length>0?o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:xe.map((J,ue)=>o.jsx("div",{className:"bg-white rounded-lg border border-gray-200 shadow-sm hover:shadow-md transition-shadow overflow-hidden",children:o.jsxs("div",{className:"p-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 text-indigo-500 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M3 3a1 1 0 000 2v8a2 2 0 002 2h2.586l-1.293 1.293a1 1 0 101.414 1.414L10 15.414l2.293 2.293a1 1 0 001.414-1.414L12.414 15H15a2 2 0 002-2V5a1 1 0 100-2H3zm11.707 4.707a1 1 0 00-1.414-1.414L10 9.586 8.707 8.293a1 1 0 00-1.414 0l-2 2a1 1 0 101.414 1.414L8 10.414l1.293 1.293a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),o.jsx("div",{className:"font-mono text-indigo-700 font-semibold",children:o.jsx("span",{className:"text-sm",children:J.documentId?`ID: ${J.documentId}`:`Result #${ue+1}`})})]}),J.updatedAt&&o.jsx("span",{className:"text-xs text-gray-500",title:J.updatedAt,children:ge(J.updatedAt)})]}),o.jsx("div",{className:"bg-gray-50 rounded p-3 mb-3 h-48 overflow-y-auto",children:o.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap break-words text-gray-800",children:JSON.stringify(Object.fromEntries(Object.entries(J).filter(([je])=>!["documentId","updatedAt"].includes(je))),null,2)})}),J.documentId&&o.jsxs("div",{className:"flex justify-end space-x-2",children:[o.jsx("button",{onClick:()=>ee(J),className:"text-indigo-600 hover:text-indigo-900 bg-indigo-50 hover:bg-indigo-100 px-3 py-1 rounded-md text-sm transition-colors",children:"Update"}),o.jsx("button",{onClick:()=>Se(J),className:"text-red-600 hover:text-red-900 bg-red-50 hover:bg-red-100 px-3 py-1 rounded-md text-sm transition-colors",children:"Delete"})]})]})},ue))}):o.jsxs("div",{className:"text-center py-12",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-16 w-16 text-gray-300 mx-auto mb-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),o.jsx("p",{className:"text-gray-500 mb-2",children:"No documents match your aggregation pipeline"}),o.jsx("button",{onClick:P,className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500",children:"Clear Aggregation"})]}):f.length>0?o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:f.map((J,ue)=>o.jsx("div",{ref:!fe&&ue===f.length-1?qe:null,className:"bg-white rounded-lg border border-gray-200 shadow-sm hover:shadow-md transition-shadow overflow-hidden",children:o.jsxs("div",{className:"p-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 text-yellow-500 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"})}),o.jsx("div",{className:"font-mono text-indigo-700 font-semibold",title:J.documentId,children:o.jsxs("span",{className:"text-sm",children:["ID: ",J.documentId]})})]}),o.jsx("span",{className:"text-xs text-gray-500",title:J.updatedAt,children:ge(J.updatedAt)})]}),o.jsx("div",{className:"bg-gray-50 rounded p-3 mb-3 h-48 overflow-y-auto",children:o.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap break-words text-gray-800",children:JSON.stringify(Object.fromEntries(Object.entries(J).filter(([je])=>!["documentId","updatedAt"].includes(je))),null,2)})}),o.jsxs("div",{className:"flex justify-end space-x-2",children:[o.jsx("button",{onClick:()=>ee(J),className:"text-indigo-600 hover:text-indigo-900 bg-indigo-50 hover:bg-indigo-100 px-3 py-1 rounded-md text-sm transition-colors",children:"Update"}),o.jsx("button",{onClick:()=>Se(J),className:"text-red-600 hover:text-red-900 bg-red-50 hover:bg-red-100 px-3 py-1 rounded-md text-sm transition-colors",children:"Delete"})]})]})},J.documentId))}):o.jsxs("div",{className:"text-center py-12",children:[o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-16 w-16 text-gray-300 mx-auto mb-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),o.jsx("p",{className:"text-gray-500 mb-2",children:"No documents found in this collection"}),o.jsx("button",{onClick:()=>z(!0),className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500",children:"Insert Your First Document"})]}),c&&f.length>0&&!fe&&o.jsx("div",{className:"flex justify-center items-center py-4",children:o.jsxs("svg",{className:"animate-spin h-6 w-6 text-indigo-500",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}),!c&&!g&&f.length>0&&!fe&&o.jsx("div",{className:"text-center py-4 text-gray-500 text-sm border-t border-gray-100 mt-6",children:"You've reached the end of the results."}),fe&&xe.length>0&&o.jsxs("div",{className:"text-center py-4 text-gray-500 text-sm border-t border-gray-100 mt-6",children:["Showing all ",xe.length," aggregation results."]})]})]}),M&&o.jsx(x2,{isOpen:M,onClose:()=>z(!1),onDocumentInserted:Z,databaseName:E,collectionName:R,onSuccess:()=>Ke(1,!0)}),D&&F&&o.jsx(b2,{isOpen:D,onClose:()=>V(!1),onDocumentUpdated:Y,document:F,databaseName:E,collectionName:R}),G&&F&&o.jsx(S2,{isOpen:G,onClose:()=>k(!1),onDocumentDeleted:K,documentId:F.documentId,databaseName:E,collectionName:R}),I&&o.jsx(w2,{isOpen:I,onClose:()=>X(!1),databaseName:E,collectionName:R,onAggregationResults:Q})]})},N2=()=>{const[n,s]=S.useState([]),[c,r]=S.useState(!0),[f,d]=S.useState(null),[g,x]=S.useState({}),{TransactionKey:p}=ct(R=>R);S.useEffect(()=>{p&&Oe(null,null,function*(){try{r(!0);const U=yield me.get(`${st}/api/routes?transactiontoken=${p}`);if(U.data&&U.data.data&&Array.isArray(U.data.data)){s(U.data.data);const M={};U.data.data.forEach(z=>{M[z.groupName]=!0}),x(M)}else throw new Error("Invalid API response format");r(!1)}catch(U){console.error("Error fetching API routes:",U),d("Failed to load API reference. Please try again later."),r(!1)}})},[p]);const m=R=>{x(U=>nt(pe({},U),{[R]:!U[R]}))},v=R=>{switch(R){case"GET":return"bg-blue-600";case"POST":return"bg-green-600";case"PUT":return"bg-amber-600";case"DELETE":return"bg-red-600";default:return"bg-gray-600"}},E=R=>o.jsx("pre",{className:"mt-2 p-3 bg-gray-800 text-gray-200 rounded-md overflow-x-auto text-sm",children:JSON.stringify(R,null,2)});return c?o.jsxs("div",{className:"container mx-auto px-4 py-8",children:[o.jsx("h1",{className:"text-2xl font-bold mb-6",children:"API Reference"}),o.jsx("div",{className:"flex justify-center items-center py-12",children:o.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-blue-500"})})]}):f?o.jsxs("div",{className:"container mx-auto px-4 py-8",children:[o.jsx("h1",{className:"text-2xl font-bold mb-6",children:"API Reference"}),o.jsx("div",{className:"bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded",children:o.jsx("p",{children:f})})]}):o.jsxs("div",{className:"container mx-auto px-4 py-8",children:[o.jsx("h1",{className:"text-2xl font-bold mb-2",children:"API Reference"}),o.jsx("p",{className:"text-gray-600 mb-6",children:"Complete documentation for the AxioDB REST API"}),n.length===0&&!c&&!f?o.jsx("div",{className:"bg-yellow-100 border border-yellow-400 text-yellow-700 px-4 py-3 rounded",children:o.jsx("p",{children:"No API routes found. The server might not have returned any routes."})}):o.jsx("div",{className:"space-y-6",children:n.map(R=>o.jsxs("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:[o.jsxs("div",{className:"bg-gray-50 px-4 py-3 flex justify-between items-center cursor-pointer",onClick:()=>m(R.groupName),children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-medium text-gray-900",children:R.groupName}),o.jsx("p",{className:"text-sm text-gray-500",children:R.description})]}),o.jsx("div",{className:"text-gray-500",children:g[R.groupName]?o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M5 10a1 1 0 011-1h8a1 1 0 110 2H6a1 1 0 01-1-1z",clipRule:"evenodd"})}):o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:o.jsx("path",{fillRule:"evenodd",d:"M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z",clipRule:"evenodd"})})})]}),g[R.groupName]&&o.jsx("div",{className:"divide-y divide-gray-200",children:R.Paths.map((U,M)=>o.jsx("div",{className:"p-4 hover:bg-gray-50",children:o.jsxs("div",{className:"flex items-start",children:[o.jsx("span",{className:`${v(U.method)} text-white text-xs font-bold px-2 py-1 rounded mr-3 min-w-16 text-center`,children:U.method}),o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"font-mono text-sm bg-gray-100 p-2 rounded mb-2 overflow-x-auto",children:U.path}),o.jsx("p",{className:"text-gray-700 mb-2",children:U.description}),U.payload&&o.jsxs("div",{children:[o.jsx("h4",{className:"text-sm font-semibold text-gray-700 mt-2 mb-1",children:"Payload:"}),E(U.payload)]})]})]})},M))})]},R.groupName))})]})};function E2(){const{loadKey:n}=ct(r=>r),[s,c]=S.useState(!0);return S.useEffect(()=>{Oe(null,null,function*(){try{yield n()}finally{c(!1)}})},[n]),s?o.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"spinner-border text-primary mb-3",role:"status",children:o.jsx("span",{className:"sr-only",children:"Loading..."})}),o.jsx("p",{className:"text-gray-600",children:"Loading application..."})]})}):o.jsx(I1,{children:o.jsxs("div",{className:"min-h-screen bg-gray-50 flex flex-col",children:[o.jsx(Xv,{}),o.jsx("main",{className:"flex-grow",children:o.jsxs(D1,{children:[o.jsx(ua,{path:"/",element:o.jsx(f2,{})}),o.jsx(ua,{path:"/operations",element:o.jsx(g2,{})}),o.jsx(ua,{path:"/collections",element:o.jsx(v2,{})}),o.jsx(ua,{path:"/documents",element:o.jsx(fh,{})}),o.jsx(ua,{path:"/api",element:o.jsx(N2,{})}),o.jsx(ua,{path:"/collections/documents",element:o.jsx(fh,{})})]})}),o.jsx(cp,{})]})})}qy.createRoot(document.getElementById("root")).render(o.jsx(S.StrictMode,{children:o.jsx(E2,{})}))});export default j2();
@@ -25,7 +25,7 @@
25
25
  <meta name="twitter:card" content="summary_large_image" />
26
26
  <link rel="canonical" href="https://axiodb.site" />
27
27
  <link rel="icon" type="image/svg+xml" href="AXioDB.png" />
28
- <script type="module" crossorigin src="/assets/index-BBHFnwjb.js"></script>
28
+ <script type="module" crossorigin src="/assets/index-DfWfvQkO.js"></script>
29
29
  <link rel="stylesheet" crossorigin href="/assets/index-D8BIlnCE.css">
30
30
  <link rel="manifest" href="/manifest.webmanifest"><script id="vite-plugin-pwa:register-sw" src="/registerSW.js"></script></head>
31
31
 
@@ -1 +1 @@
1
- if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()}).then(()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(n,r)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(s[t])return;let o={};const l=e=>i(e,t),c={module:{uri:t},exports:o,require:l};s[t]=Promise.all(n.map(e=>c[e]||l(e))).then(e=>(r(...e),o))}}define(["./workbox-5ffe50d4"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"assets/index-BBHFnwjb.js",revision:null},{url:"assets/index-D8BIlnCE.css",revision:null},{url:"index.html",revision:"2420368633ca6a32f5dfc3e15a517bc6"},{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"manifest.webmanifest",revision:"531c27931688c6a365595ec1badc959b"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))});
1
+ if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()}).then(()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(n,r)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(s[t])return;let o={};const d=e=>i(e,t),l={module:{uri:t},exports:o,require:d};s[t]=Promise.all(n.map(e=>l[e]||d(e))).then(e=>(r(...e),o))}}define(["./workbox-5ffe50d4"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"assets/index-D8BIlnCE.css",revision:null},{url:"assets/index-DfWfvQkO.js",revision:null},{url:"index.html",revision:"dab6394bb937ed91cdc5a2b3d63bdc93"},{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"manifest.webmanifest",revision:"531c27931688c6a365595ec1badc959b"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))});
@@ -22,10 +22,14 @@ function OperationRouter(fastify, options) {
22
22
  fastify.get("/all/", (request, reply) => __awaiter(this, void 0, void 0, function* () { return new CRUD_controller_1.default(AxioDBInstance).getAllDocuments(request); }));
23
23
  // Create New Document
24
24
  fastify.post("/create/", (request, reply) => __awaiter(this, void 0, void 0, function* () { return new CRUD_controller_1.default(AxioDBInstance).createNewDocument(request); }));
25
- // Update Document
26
- fastify.put("/update/", (request, reply) => __awaiter(this, void 0, void 0, function* () { return new CRUD_controller_1.default(AxioDBInstance).updateDocument(request); }));
27
- // Delete Document
28
- fastify.delete("/delete/", (request, reply) => __awaiter(this, void 0, void 0, function* () { return new CRUD_controller_1.default(AxioDBInstance).deleteDocument(request); }));
25
+ // Update Document by Id
26
+ fastify.put("/update/by-id/", (request, reply) => __awaiter(this, void 0, void 0, function* () { return new CRUD_controller_1.default(AxioDBInstance).updateDocumentById(request); }));
27
+ // Update Document by Query
28
+ fastify.put("/update/by-query/", (request, reply) => __awaiter(this, void 0, void 0, function* () { return new CRUD_controller_1.default(AxioDBInstance).updateDocumentByQuery(request); }));
29
+ // Delete Document by Id
30
+ fastify.delete("/delete/by-id/", (request, reply) => __awaiter(this, void 0, void 0, function* () { return new CRUD_controller_1.default(AxioDBInstance).deleteDocumentById(request); }));
31
+ // Delete Document by Query
32
+ fastify.delete("/delete/by-query/", (request, reply) => __awaiter(this, void 0, void 0, function* () { return new CRUD_controller_1.default(AxioDBInstance).deleteDocumentByQuery(request); }));
29
33
  fastify.post("/aggregate/", (request, reply) => __awaiter(this, void 0, void 0, function* () { return new CRUD_controller_1.default(AxioDBInstance).runAggregation(request); }));
30
34
  });
31
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Operation.routes.js","sourceRoot":"","sources":["../../../../source/server/router/Routers/Operation.routes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAaA,kCA6BC;AArCD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C,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAA,GAAA,CAClE,CAAC;QAEF,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,CAAO,OAAO,EAAE,KAAK,EAAE,EAAE,gDACnD,OAAA,IAAI,yBAAc,CAAC,cAAc,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA,GAAA,CAC3D,CAAC;IACJ,CAAC;CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axiodb",
3
- "version": "2.28.82",
3
+ "version": "2.29.83",
4
4
  "description": "A blazing-fast, lightweight, and scalable nodejs package based DBMS for modern application. Supports schemas, encryption, and advanced query capabilities.",
5
5
  "main": "./lib/config/DB.js",
6
6
  "types": "./lib/config/DB.d.ts",