@pg-boss/dashboard 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +393 -0
- package/bin/cli.js +21 -0
- package/build/client/assets/MenuTrigger-SThQHnlb.js +1 -0
- package/build/client/assets/_index-Bcg_-XSd.js +1 -0
- package/build/client/assets/badge-Cd8v3tl3.js +1 -0
- package/build/client/assets/button-BaXUPm8v.js +1 -0
- package/build/client/assets/chevron-down-xu6Uceu-.js +1 -0
- package/build/client/assets/chunk-JZWAC4HX-DC8i-F7r.js +26 -0
- package/build/client/assets/createLucideIcon-BXGwbdrh.js +1 -0
- package/build/client/assets/db-link-CtPnIrIr.js +1 -0
- package/build/client/assets/dialog-Bl8T588f.js +1 -0
- package/build/client/assets/entry.client-COnaNoy-.js +13 -0
- package/build/client/assets/error-card-DmoxS3Ao.js +1 -0
- package/build/client/assets/filter-select-mMC79WOR.js +1 -0
- package/build/client/assets/index-DhMkYPMa.js +1 -0
- package/build/client/assets/jobs-DtmTCs8I.js +1 -0
- package/build/client/assets/manifest-25954681.js +1 -0
- package/build/client/assets/pagination-NfhvsUbp.js +1 -0
- package/build/client/assets/queues._index-Cw1B49mg.js +1 -0
- package/build/client/assets/queues._name-D0cG_qDX.js +1 -0
- package/build/client/assets/queues._name.jobs._jobId-uJ3dfM3J.js +1 -0
- package/build/client/assets/queues.create-BGXDhJ3m.js +1 -0
- package/build/client/assets/root-DJRlbyb5.css +1 -0
- package/build/client/assets/root-NWrBrGvr.js +35 -0
- package/build/client/assets/schedules-DzgBEayh.js +1 -0
- package/build/client/assets/schedules._name._key-i42S9kw2.js +1 -0
- package/build/client/assets/schedules.new-Dt78KptL.js +1 -0
- package/build/client/assets/send-0eWgiWNl.js +1 -0
- package/build/client/assets/table-CTo0I5HG.js +1 -0
- package/build/client/assets/useOpenInteractionType-C_L8nZ_l.js +12 -0
- package/build/client/assets/warnings-BhQM6lFV.js +1 -0
- package/build/server/assets/config.server-CARiqCUE.js +54 -0
- package/build/server/assets/node-DzjK5u9i.js +176 -0
- package/build/server/assets/server-build.js +9684 -0
- package/build/server/index.js +26 -0
- package/package.json +85 -0
package/README.md
ADDED
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
# pg-boss Dashboard
|
|
2
|
+
|
|
3
|
+
A web-based dashboard for monitoring and managing [pg-boss](https://github.com/timgit/pg-boss) job queues.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Overview Dashboard**: Aggregate statistics, problem queues, and recent warnings at a glance
|
|
8
|
+
- **Queue Management**: Browse all queues with real-time stats (queued, active, deferred, total)
|
|
9
|
+
- **Job Browser**: View and manage individual jobs with smart filtering (defaults to pending jobs)
|
|
10
|
+
- **Job Detail Inspector**: View full job payloads, output data, and metadata
|
|
11
|
+
- **Job Actions**: Create, cancel, retry, resume, or delete jobs directly from the UI
|
|
12
|
+
- **Warning History**: Track slow queries, queue backlogs, and clock skew issues
|
|
13
|
+
- **Multi-Database Support**: Monitor multiple pg-boss instances from a single dashboard
|
|
14
|
+
- **Pagination**: Efficiently browse large datasets with cached statistics
|
|
15
|
+
- **Mobile Responsive**: Full functionality on mobile devices with collapsible sidebar
|
|
16
|
+
- **Shareable URLs**: Database selection and filters are preserved in URLs for easy sharing
|
|
17
|
+
|
|
18
|
+
## Requirements
|
|
19
|
+
|
|
20
|
+
- Node.js 22.12+
|
|
21
|
+
- PostgreSQL database with pg-boss schema
|
|
22
|
+
- pg-boss 12.10+
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install @pg-boss/dashboard
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
For a quick local test:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
DATABASE_URL="postgres://user:password@localhost:5432/mydb" npx pg-boss-dashboard
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Open http://localhost:3000 in your browser.
|
|
39
|
+
|
|
40
|
+
## Configuration
|
|
41
|
+
|
|
42
|
+
The dashboard is configured via environment variables:
|
|
43
|
+
|
|
44
|
+
| Variable | Description | Default |
|
|
45
|
+
|----------|-------------|---------|
|
|
46
|
+
| `DATABASE_URL` | PostgreSQL connection string(s) | `postgres://localhost/pgboss` |
|
|
47
|
+
| `PGBOSS_SCHEMA` | pg-boss schema name(s) | `pgboss` |
|
|
48
|
+
| `PORT` | Server port | `3000` |
|
|
49
|
+
|
|
50
|
+
### Multi-Database Configuration
|
|
51
|
+
|
|
52
|
+
To monitor multiple pg-boss instances, separate connection strings with a pipe (`|`):
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
DATABASE_URL="postgres://host1/db1|postgres://host2/db2" npx pg-boss-dashboard
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
You can optionally name each database for better identification in the UI:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
DATABASE_URL="Production=postgres://prod/db|Staging=postgres://stage/db" npx pg-boss-dashboard
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
If your databases use different schemas, specify them with matching pipe separation:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
DATABASE_URL="postgres://host1/db1|postgres://host2/db2" \
|
|
68
|
+
PGBOSS_SCHEMA="pgboss|jobs" \
|
|
69
|
+
npx pg-boss-dashboard
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
When multiple databases are configured, a database selector appears in the sidebar. The selected database is persisted in the URL via the `db` query parameter, making it easy to share links to specific database views.
|
|
73
|
+
|
|
74
|
+
## Production Deployment
|
|
75
|
+
|
|
76
|
+
### Option 1: Direct Node.js
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm install @pg-boss/dashboard
|
|
80
|
+
|
|
81
|
+
DATABASE_URL="postgres://user:pass@localhost:5432/db" \
|
|
82
|
+
node node_modules/@pg-boss/dashboard/build/server/index.js
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Option 2: Docker
|
|
86
|
+
|
|
87
|
+
```dockerfile
|
|
88
|
+
FROM node:24
|
|
89
|
+
WORKDIR /app
|
|
90
|
+
RUN npm install -g @pg-boss/dashboard
|
|
91
|
+
ENV PORT=3000
|
|
92
|
+
EXPOSE 3000
|
|
93
|
+
CMD ["pg-boss-dashboard"]
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
docker build -t pgboss-dashboard .
|
|
98
|
+
docker run -d \
|
|
99
|
+
-e DATABASE_URL="postgres://user:pass@host:5432/db" \
|
|
100
|
+
-p 3000:3000 \
|
|
101
|
+
pgboss-dashboard
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Option 3: Docker Compose
|
|
105
|
+
|
|
106
|
+
```yaml
|
|
107
|
+
services:
|
|
108
|
+
dashboard:
|
|
109
|
+
image: node:24
|
|
110
|
+
working_dir: /app
|
|
111
|
+
command: sh -c "npm install -g @pg-boss/dashboard && pg-boss-dashboard"
|
|
112
|
+
environment:
|
|
113
|
+
DATABASE_URL: postgres://user:pass@db:5432/mydb
|
|
114
|
+
PGBOSS_SCHEMA: pgboss
|
|
115
|
+
PORT: 3000
|
|
116
|
+
ports:
|
|
117
|
+
- "3000:3000"
|
|
118
|
+
depends_on:
|
|
119
|
+
- db
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Reverse Proxy
|
|
123
|
+
|
|
124
|
+
For production, place a reverse proxy in front of any of the above options. Example Nginx configuration:
|
|
125
|
+
|
|
126
|
+
```nginx
|
|
127
|
+
server {
|
|
128
|
+
listen 80;
|
|
129
|
+
server_name pgboss.example.com;
|
|
130
|
+
|
|
131
|
+
location / {
|
|
132
|
+
proxy_pass http://127.0.0.1:3000;
|
|
133
|
+
proxy_http_version 1.1;
|
|
134
|
+
proxy_set_header Host $host;
|
|
135
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
136
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
137
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Pages
|
|
143
|
+
|
|
144
|
+
### Dashboard (`/`)
|
|
145
|
+
|
|
146
|
+
The overview page displays:
|
|
147
|
+
|
|
148
|
+
- **Stats Cards**: Total queues, total jobs, active jobs, and failed jobs
|
|
149
|
+
- **Problem Queues**: Queues exceeding their `warningQueueSize` threshold
|
|
150
|
+
- **Recent Warnings**: Latest 5 warnings (requires `persistWarnings: true` in pg-boss config)
|
|
151
|
+
- **Queue Summary**: Table of first 10 queues with quick stats
|
|
152
|
+
|
|
153
|
+
### Queues List (`/queues`)
|
|
154
|
+
|
|
155
|
+
Paginated list of all queues showing:
|
|
156
|
+
|
|
157
|
+
- Queue name (links to detail page)
|
|
158
|
+
- Policy type (standard, short, singleton, stately)
|
|
159
|
+
- Job counts: Queued, Active, Deferred, Total
|
|
160
|
+
- Last monitored timestamp
|
|
161
|
+
- Status indicator (Backlogged, Processing, Idle)
|
|
162
|
+
|
|
163
|
+
### Queue Detail (`/queues/:name`)
|
|
164
|
+
|
|
165
|
+
Detailed view of a single queue:
|
|
166
|
+
|
|
167
|
+
- **Stats Cards**: Queued, Active, Deferred, Total counts
|
|
168
|
+
- **Queue Info**: Policy type badge and partition indicator
|
|
169
|
+
- **Jobs Table**: Paginated list of jobs (50 per page) with:
|
|
170
|
+
- Job ID (truncated UUID, click to copy full ID)
|
|
171
|
+
- State (created, retry, active, completed, cancelled, failed)
|
|
172
|
+
- Priority
|
|
173
|
+
- Retry count / limit
|
|
174
|
+
- Created timestamp
|
|
175
|
+
- Actions (View, Cancel, Retry, Resume, Delete - availability depends on job state)
|
|
176
|
+
|
|
177
|
+
**Job Detail Dialog**: Click "View" on any job to open a modal with complete job information:
|
|
178
|
+
|
|
179
|
+
- Full Job ID (with copy button)
|
|
180
|
+
- Priority, retry count/limit
|
|
181
|
+
- All timestamps (created, started, completed)
|
|
182
|
+
- Singleton key (if applicable)
|
|
183
|
+
- Group ID and tier (for grouped jobs)
|
|
184
|
+
- Dead letter queue (if configured)
|
|
185
|
+
- **Job Data**: Full JSON payload submitted with the job
|
|
186
|
+
- **Job Output**: Result data returned by the worker (if completed)
|
|
187
|
+
|
|
188
|
+
**Filtering**: Use the state dropdown to filter jobs by state. Available filters:
|
|
189
|
+
|
|
190
|
+
| Filter | Description |
|
|
191
|
+
|--------|-------------|
|
|
192
|
+
| **Pending** (default) | Shows only non-final state jobs: `created`, `retry`, and `active`. This is the default view to handle queues with large job history efficiently. |
|
|
193
|
+
| **All States** | Shows all jobs including completed, cancelled, and failed. Use with caution on queues with many historical jobs. |
|
|
194
|
+
| **Individual states** | Filter by specific state: Created, Retry, Active, Completed, Cancelled, or Failed |
|
|
195
|
+
|
|
196
|
+
> **Performance Note**: The "Pending" filter is the default because queues can accumulate large numbers of completed/failed jobs over time. Showing all jobs by default could cause performance issues and make it harder to find actionable jobs.
|
|
197
|
+
|
|
198
|
+
> **Pagination Note**: Job counts are displayed when available from cached statistics. For some filters (Created, Retry, Completed, Cancelled, Failed), exact counts require database queries and are not shown to maintain performance.
|
|
199
|
+
|
|
200
|
+
**Job Actions** (shown based on job state):
|
|
201
|
+
|
|
202
|
+
| Action | Available States | Description |
|
|
203
|
+
|--------|------------------|-------------|
|
|
204
|
+
| **View** | All states | Opens job detail dialog with full job information |
|
|
205
|
+
| **Cancel** | created, retry, active | Stops the job from being processed |
|
|
206
|
+
| **Retry** | failed | Re-queues the job for another attempt |
|
|
207
|
+
| **Resume** | cancelled | Restores a cancelled job back to `created` state |
|
|
208
|
+
| **Delete** | All except active | Permanently removes the job |
|
|
209
|
+
|
|
210
|
+
### Warnings (`/warnings`)
|
|
211
|
+
|
|
212
|
+
History of pg-boss warnings with:
|
|
213
|
+
|
|
214
|
+
- Warning type (Slow Query, Queue Backlog, Clock Skew)
|
|
215
|
+
- Message
|
|
216
|
+
- Additional details (elapsed time, queue name, etc.)
|
|
217
|
+
- Timestamp
|
|
218
|
+
|
|
219
|
+
**Filtering**: Use the type dropdown to filter by warning type.
|
|
220
|
+
|
|
221
|
+
> **Note**: Warnings are only recorded when pg-boss is configured with `persistWarnings: true`.
|
|
222
|
+
|
|
223
|
+
## Enabling Warning Persistence
|
|
224
|
+
|
|
225
|
+
To capture warnings in the dashboard, enable warning persistence in your pg-boss configuration:
|
|
226
|
+
|
|
227
|
+
```javascript
|
|
228
|
+
const PgBoss = require('pg-boss');
|
|
229
|
+
|
|
230
|
+
const boss = new PgBoss({
|
|
231
|
+
connectionString: 'postgres://localhost/mydb',
|
|
232
|
+
persistWarnings: true // Enable warning persistence
|
|
233
|
+
});
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
This creates a `warning` table in your pg-boss schema that stores:
|
|
237
|
+
- `slow_query`: Queries taking longer than expected
|
|
238
|
+
- `queue_backlog`: Queues exceeding their warning threshold
|
|
239
|
+
- `clock_skew`: Database clock drift detection
|
|
240
|
+
|
|
241
|
+
## Tech Stack
|
|
242
|
+
|
|
243
|
+
- **Framework**: [React Router 7](https://reactrouter.com/) (framework mode)
|
|
244
|
+
- **Server**: [Hono](https://hono.dev/) via [react-router-hono-server](https://github.com/rphlmr/react-router-hono-server)
|
|
245
|
+
- **Styling**: [Tailwind CSS v4](https://tailwindcss.com/)
|
|
246
|
+
- **Components**: [Base UI](https://base-ui.com/)
|
|
247
|
+
- **Database**: [pg](https://node-postgres.com/) (PostgreSQL client)
|
|
248
|
+
- **Testing**: [Vitest](https://vitest.dev/) + [Testing Library](https://testing-library.com/)
|
|
249
|
+
|
|
250
|
+
## Development (Contributing)
|
|
251
|
+
|
|
252
|
+
To work on the dashboard from source:
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
# Clone the pg-boss repository
|
|
256
|
+
git clone https://github.com/timgit/pg-boss.git
|
|
257
|
+
cd pg-boss/packages/dashboard
|
|
258
|
+
|
|
259
|
+
# Install dependencies
|
|
260
|
+
npm install
|
|
261
|
+
|
|
262
|
+
# Initialize local database with pg-boss schema and test queues
|
|
263
|
+
npm run dev:init-db
|
|
264
|
+
|
|
265
|
+
# Start development server with hot reloading
|
|
266
|
+
npm run dev
|
|
267
|
+
|
|
268
|
+
# (Optional) Start a worker to process jobs
|
|
269
|
+
# Run this in a separate terminal to see jobs being processed
|
|
270
|
+
npm run dev:worker
|
|
271
|
+
|
|
272
|
+
# Build for production
|
|
273
|
+
npm run build
|
|
274
|
+
|
|
275
|
+
# Run production build
|
|
276
|
+
npm start
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
The `dev:init-db` script creates the pg-boss schema and populates it with sample queues and jobs for testing. It connects to `postgres://postgres:postgres@127.0.0.1:5432/pgboss` by default.
|
|
280
|
+
|
|
281
|
+
The `dev:worker` script starts a worker that processes jobs from the same pg-boss instance as the dashboard. This is useful for testing the dashboard while jobs are being processed. The worker will stay running until you stop it with Ctrl+C.
|
|
282
|
+
|
|
283
|
+
### Project Structure
|
|
284
|
+
|
|
285
|
+
```
|
|
286
|
+
packages/dashboard/
|
|
287
|
+
├── app/
|
|
288
|
+
│ ├── components/
|
|
289
|
+
│ │ ├── layout/ # Sidebar, page layout
|
|
290
|
+
│ │ └── ui/ # Reusable UI components
|
|
291
|
+
│ ├── lib/
|
|
292
|
+
│ │ ├── db.server.ts # Database connection pool
|
|
293
|
+
│ │ ├── queries.server.ts # SQL queries
|
|
294
|
+
│ │ ├── types.ts # TypeScript types
|
|
295
|
+
│ │ └── utils.ts # Shared utilities
|
|
296
|
+
│ ├── routes/
|
|
297
|
+
│ │ ├── _index.tsx # Dashboard overview
|
|
298
|
+
│ │ ├── queues._index.tsx # Queues list
|
|
299
|
+
│ │ ├── queues.$name.tsx # Queue detail
|
|
300
|
+
│ │ └── warnings.tsx # Warnings history
|
|
301
|
+
│ ├── root.tsx # Root layout
|
|
302
|
+
│ ├── routes.ts # Route configuration
|
|
303
|
+
│ └── server.ts # Hono server setup
|
|
304
|
+
├── tests/
|
|
305
|
+
│ ├── frontend/ # React component tests
|
|
306
|
+
│ ├── server/ # Server-side tests (queries, utils)
|
|
307
|
+
│ └── setup.ts # Test setup (jsdom, mocks)
|
|
308
|
+
├── package.json
|
|
309
|
+
├── vite.config.ts
|
|
310
|
+
├── vitest.config.frontend.ts # Frontend test config
|
|
311
|
+
└── vitest.config.server.ts # Server test config
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Running Tests
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
# All tests (frontend + server)
|
|
318
|
+
npm test
|
|
319
|
+
|
|
320
|
+
# Frontend tests only (React components)
|
|
321
|
+
npm run test:frontend
|
|
322
|
+
|
|
323
|
+
# Server tests only (queries, utils - requires PostgreSQL)
|
|
324
|
+
npm run test:server
|
|
325
|
+
|
|
326
|
+
# All tests with coverage
|
|
327
|
+
npm run cover
|
|
328
|
+
|
|
329
|
+
# Individual coverage reports
|
|
330
|
+
npm run cover:frontend
|
|
331
|
+
npm run cover:server
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### Type Checking
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
npm run typecheck
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
## API Reference
|
|
341
|
+
|
|
342
|
+
The dashboard reads directly from pg-boss database tables:
|
|
343
|
+
|
|
344
|
+
- `{schema}.queue` - Queue metadata and cached job counts
|
|
345
|
+
- `{schema}.job` - Individual jobs
|
|
346
|
+
- `{schema}.warning` - Warning history (when `persistWarnings` is enabled)
|
|
347
|
+
|
|
348
|
+
### Queue Table Fields Used
|
|
349
|
+
|
|
350
|
+
| Field | Description |
|
|
351
|
+
|-------|-------------|
|
|
352
|
+
| `name` | Queue name |
|
|
353
|
+
| `policy` | Queue policy (standard, short, singleton, stately) |
|
|
354
|
+
| `queued_count` | Number of jobs waiting to be processed |
|
|
355
|
+
| `active_count` | Number of jobs currently being processed |
|
|
356
|
+
| `deferred_count` | Number of jobs scheduled for later |
|
|
357
|
+
| `total_count` | Total job count |
|
|
358
|
+
| `warning_queued` | Threshold for backlog warnings |
|
|
359
|
+
| `monitor_on` | Last monitoring timestamp |
|
|
360
|
+
|
|
361
|
+
### Job States
|
|
362
|
+
|
|
363
|
+
| State | Description | Category |
|
|
364
|
+
|-------|-------------|----------|
|
|
365
|
+
| `created` | Job is queued and waiting | Pending (non-final) |
|
|
366
|
+
| `retry` | Job failed and is scheduled for retry | Pending (non-final) |
|
|
367
|
+
| `active` | Job is currently being processed | Pending (non-final) |
|
|
368
|
+
| `completed` | Job finished successfully | Final |
|
|
369
|
+
| `cancelled` | Job was cancelled | Final |
|
|
370
|
+
| `failed` | Job failed after exhausting retries | Final |
|
|
371
|
+
|
|
372
|
+
**Pending vs Final States**: Jobs in pending states (`created`, `retry`, `active`) are still being processed or waiting to be processed. Jobs in final states (`completed`, `cancelled`, `failed`) have finished processing. The dashboard's default "Pending" filter shows only non-final state jobs.
|
|
373
|
+
|
|
374
|
+
## Troubleshooting
|
|
375
|
+
|
|
376
|
+
### "Failed to load dashboard"
|
|
377
|
+
|
|
378
|
+
- Verify `DATABASE_URL` is correct and the database is accessible
|
|
379
|
+
- Ensure the pg-boss schema exists (run pg-boss at least once to create it)
|
|
380
|
+
- Check PostgreSQL logs for connection errors
|
|
381
|
+
|
|
382
|
+
### No warnings showing
|
|
383
|
+
|
|
384
|
+
- Ensure `persistWarnings: true` is set in your pg-boss configuration
|
|
385
|
+
- Warnings are only recorded after enabling this option
|
|
386
|
+
|
|
387
|
+
### Queue stats seem stale
|
|
388
|
+
|
|
389
|
+
Queue statistics are cached in the `queue` table by pg-boss's monitoring system. They update based on your `monitorStateIntervalSeconds` configuration (default: 30 seconds).
|
|
390
|
+
|
|
391
|
+
## License
|
|
392
|
+
|
|
393
|
+
MIT
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { serve } from '@hono/node-server'
|
|
3
|
+
|
|
4
|
+
const port = process.env.PORT || 3000
|
|
5
|
+
const host = process.env.HOST || '0.0.0.0'
|
|
6
|
+
|
|
7
|
+
// Import the built server
|
|
8
|
+
const { default: server } = await import('../build/server/index.js')
|
|
9
|
+
|
|
10
|
+
// Start the server
|
|
11
|
+
serve(
|
|
12
|
+
{
|
|
13
|
+
fetch: server.fetch,
|
|
14
|
+
port: parseInt(String(port), 10),
|
|
15
|
+
hostname: host,
|
|
16
|
+
},
|
|
17
|
+
(info) => {
|
|
18
|
+
console.log(`pg-boss dashboard server running at http://${info.address}:${info.port}`)
|
|
19
|
+
console.log('Open your browser to view the dashboard')
|
|
20
|
+
}
|
|
21
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as g,p as he}from"./chunk-JZWAC4HX-DC8i-F7r.js";import{g as mt,m as Yt,h as Tn,i as pt,E as st,j as Ct,k as Ot}from"./db-link-CtPnIrIr.js";import{u as Sn,i as Pn,a as te,b as In,A as Qt,s as be,c as ht,d as Ke,e as je,f as tt,g as An,h as $e,j as bo,k as ne,t as at,l as kn,m as Gt,n as le,o as ze,p as Ye,q as un,r as We,v as Le,w as Ln,x as Zt,y as nt,z as dt,B as wo,C as Dn,D as vo,E as en,F as tn,G as Lt,H as Fn,I as yt,J as Eo,P as Nn,K as xt,L as Hn,M as Mt,N as ye,O as lt,Q as Dt,R as Co,S as ot,T as Oo,U as Mo,V as Bn,W as To,X as se,Y as Oe,Z as Ae,_ as So,$ as Po,a0 as Io,a1 as vt,a2 as Tt,a3 as Ao,a4 as ko,a5 as Lo,a6 as Do,a7 as Fo,a8 as No,a9 as Ho,aa as Bo,ab as _n,ac as _o,ad as Vo,ae as $o,af as St,ag as Wo,ah as Uo,ai as zo,aj as Ko,ak as jo,al as ct,am as Yo,an as Go,ao as ge,ap as Vn,aq as Xo,ar as $n,as as qo,at as Jo,au as Qo,av as Zo,aw as er,ax as tr,ay as nr,az as or,aA as Wn,aB as rr,aC as sr,aD as Un,aE as ir,aF as cr,aG as ar,aH as lr,aI as ur,aJ as fr,aK as fn,aL as dn,aM as dr}from"./useOpenInteractionType-C_L8nZ_l.js";import{a as gt}from"./index-DhMkYPMa.js";const zn=g.createContext(void 0);function Kn(e){const t=g.useContext(zn);if(t===void 0&&!e)throw new Error(mt(33));return t}const jn=g.createContext(void 0);function Qe(e){const t=g.useContext(jn);if(t===void 0&&!e)throw new Error(mt(36));return t}const gr=g.createContext(void 0);function Ft(e=!0){const t=g.useContext(gr);if(t===void 0&&!e)throw new Error(mt(25));return t}const mr={type:"regular-item"};function pr(e){const{closeOnClick:t,disabled:n=!1,highlighted:o,id:s,store:r,nativeButton:c,itemMetadata:i,nodeId:h}=e,f=g.useRef(null),u=Ft(!0),a=u!==void 0,{events:R}=r.useState("floatingTreeRoot"),{getButtonProps:x,buttonRef:y}=Sn({disabled:n,focusableWhenDisabled:!0,native:c}),p=g.useCallback(d=>Yt({id:s,role:"menuitem",tabIndex:o?0:-1,onMouseMove(m){h&&R.emit("itemhover",{nodeId:h,target:m.currentTarget})},onMouseEnter(){i.type==="submenu-trigger"&&i.setActive()},onKeyUp(m){m.key===" "&&r.context.typingRef.current&&m.preventBaseUIHandler()},onClick(m){t&&R.emit("close",{domEvent:m,reason:Pn})},onMouseUp(m){if(u){const v=u.initialCursorPointRef.current;if(u.initialCursorPointRef.current=null,a&&v&&Math.abs(m.clientX-v.x)<=1&&Math.abs(m.clientY-v.y)<=1)return}f.current&&r.context.allowMouseUpTriggerRef.current&&(!a||m.button===2)&&i.type==="regular-item"&&f.current.click()}},d,x),[s,o,x,t,R,r,a,u,i,h]),b=Tn(f,y);return g.useMemo(()=>({getItemProps:p,itemRef:b}),[p,b])}const Yn=g.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function hr(){return g.useContext(Yn)}let yr=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Gn(e={}){const{label:t,metadata:n,textRef:o,indexGuessBehavior:s,index:r}=e,{register:c,unregister:i,subscribeMapChange:h,elementsRef:f,labelsRef:u,nextIndexRef:a}=hr(),R=g.useRef(-1),[x,y]=g.useState(r??(s===yr.GuessFromOrder?()=>{if(R.current===-1){const d=a.current;a.current+=1,R.current=d}return R.current}:-1)),p=g.useRef(null),b=g.useCallback(d=>{if(p.current=d,x!==-1&&d!==null&&(f.current[x]=d,u)){const m=t!==void 0;u.current[x]=m?t:o?.current?.textContent??d.textContent}},[x,f,u,t,o]);return te(()=>{if(r!=null)return;const d=p.current;if(d)return c(d,n),()=>{i(d)}},[r,c,i,n]),te(()=>{if(r==null)return h(d=>{const m=p.current?d.get(p.current)?.index:null;m!=null&&y(m)})},[r,h,y]),g.useMemo(()=>({ref:b,index:x}),[x,b])}const mi=g.forwardRef(function(t,n){const{render:o,className:s,id:r,label:c,nativeButton:i=!1,disabled:h=!1,closeOnClick:f=!0,...u}=t,a=Gn({label:c}),R=Kn(!0),x=In(r),{store:y}=Qe(),p=y.useState("isActive",a.index),b=y.useState("itemProps"),{getItemProps:d,itemRef:m}=pr({closeOnClick:f,disabled:h,highlighted:p,id:x,store:y,nativeButton:i,nodeId:R?.nodeId,itemMetadata:mr}),v=g.useMemo(()=>({disabled:h,highlighted:p}),[h,p]);return pt("div",t,{state:v,props:[b,u,d],ref:[m,n,a.ref]})}),xr=["top","right","bottom","left"],rt=Math.min,Me=Math.max,Pt=Math.round,Ze=Math.floor,_e=e=>({x:e,y:e}),Rr={left:"right",right:"left",bottom:"top",top:"bottom"},br={start:"end",end:"start"};function Xt(e,t,n){return Me(e,rt(t,n))}function Ue(e,t){return typeof e=="function"?e(t):e}function Te(e){return e.split("-")[0]}function Ge(e){return e.split("-")[1]}function nn(e){return e==="x"?"y":"x"}function on(e){return e==="y"?"height":"width"}const wr=new Set(["top","bottom"]);function ke(e){return wr.has(Te(e))?"y":"x"}function rn(e){return nn(ke(e))}function vr(e,t,n){n===void 0&&(n=!1);const o=Ge(e),s=rn(e),r=on(s);let c=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(c=It(c)),[c,It(c)]}function Er(e){const t=It(e);return[qt(e),t,qt(t)]}function qt(e){return e.replace(/start|end/g,t=>br[t])}const gn=["left","right"],mn=["right","left"],Cr=["top","bottom"],Or=["bottom","top"];function Mr(e,t,n){switch(e){case"top":case"bottom":return n?t?mn:gn:t?gn:mn;case"left":case"right":return t?Cr:Or;default:return[]}}function Tr(e,t,n,o){const s=Ge(e);let r=Mr(Te(e),n==="start",o);return s&&(r=r.map(c=>c+"-"+s),t&&(r=r.concat(r.map(qt)))),r}function It(e){return e.replace(/left|right|bottom|top/g,t=>Rr[t])}function Sr(e){return{top:0,right:0,bottom:0,left:0,...e}}function Xn(e){return typeof e!="number"?Sr(e):{top:e,right:e,bottom:e,left:e}}function At(e){const{x:t,y:n,width:o,height:s}=e;return{width:o,height:s,top:n,left:t,right:t+o,bottom:n+s,x:t,y:n}}function Rt(e,t,n){return Math.floor(e/t)!==n}function ut(e,t){return t<0||t>=e.current.length}function Vt(e,t){return pe(e,{disabledIndices:t})}function pn(e,t){return pe(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function pe(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:o,amount:s=1}={}){let r=t;do r+=n?-s:s;while(r>=0&&r<=e.current.length-1&&ft(e,r,o));return r}function Pr(e,{event:t,orientation:n,loopFocus:o,rtl:s,cols:r,disabledIndices:c,minIndex:i,maxIndex:h,prevIndex:f,stopEvent:u=!1}){let a=f;const R=[],x={};let y=!1;{let d=null,m=-1;e.current.forEach((v,w)=>{if(v==null)return;const l=v.closest('[role="row"]');l&&(y=!0),(l!==d||m===-1)&&(d=l,m+=1,R[m]=[]),R[m].push(w),x[w]=m})}const p=y&&R.length>0&&R.some(d=>d.length!==r);function b(d){if(!p||f===-1)return;const m=x[f];if(m==null)return;const v=R[m].indexOf(f);let w=d==="up"?m-1:m+1;o&&(w<0?w=R.length-1:w>=R.length&&(w=0));const l=new Set;for(;w>=0&&w<R.length&&!l.has(w);){l.add(w);const M=R[w];if(M.length===0){w=d==="up"?w-1:w+1;continue}const O=Math.min(v,M.length-1);for(let T=O;T>=0;T-=1){const N=M[T];if(!ft(e,N,c))return N}w=d==="up"?w-1:w+1,o&&(w<0?w=R.length-1:w>=R.length&&(w=0))}}if(t.key===Qt){const d=b("up");if(d!==void 0)u&&be(t),a=d;else{if(u&&be(t),f===-1)a=h;else if(a=pe(e,{startingIndex:a,amount:r,decrement:!0,disabledIndices:c}),o&&(f-r<i||a<0)){const m=f%r,v=h%r,w=h-(v-m);v===m?a=h:a=v>m?w:w-r}ut(e,a)&&(a=f)}}if(t.key===ht){const d=b("down");d!==void 0?(u&&be(t),a=d):(u&&be(t),f===-1?a=i:(a=pe(e,{startingIndex:f,amount:r,disabledIndices:c}),o&&f+r>h&&(a=pe(e,{startingIndex:f%r-r,amount:r,disabledIndices:c}))),ut(e,a)&&(a=f))}if(n==="both"){const d=Ze(f/r);t.key===(s?Ke:je)&&(u&&be(t),f%r!==r-1?(a=pe(e,{startingIndex:f,disabledIndices:c}),o&&Rt(a,r,d)&&(a=pe(e,{startingIndex:f-f%r-1,disabledIndices:c}))):o&&(a=pe(e,{startingIndex:f-f%r-1,disabledIndices:c})),Rt(a,r,d)&&(a=f)),t.key===(s?je:Ke)&&(u&&be(t),f%r!==0?(a=pe(e,{startingIndex:f,decrement:!0,disabledIndices:c}),o&&Rt(a,r,d)&&(a=pe(e,{startingIndex:f+(r-f%r),decrement:!0,disabledIndices:c}))):o&&(a=pe(e,{startingIndex:f+(r-f%r),decrement:!0,disabledIndices:c})),Rt(a,r,d)&&(a=f));const m=Ze(h/r)===d;ut(e,a)&&(o&&m?a=t.key===(s?je:Ke)?h:pe(e,{startingIndex:f-f%r-1,disabledIndices:c}):a=f)}return a}function Ir(e,t,n){const o=[];let s=0;return e.forEach(({width:r,height:c},i)=>{let h=!1;for(n&&(s=0);!h;){const f=[];for(let u=0;u<r;u+=1)for(let a=0;a<c;a+=1)f.push(s+u+a*t);s%t+r<=t&&f.every(u=>o[u]==null)?(f.forEach(u=>{o[u]=i}),h=!0):s+=1}}),[...o]}function Ar(e,t,n,o,s){if(e===-1)return-1;const r=n.indexOf(e),c=t[e];switch(s){case"tl":return r;case"tr":return c?r+c.width-1:r;case"bl":return c?r+(c.height-1)*o:r;case"br":return n.lastIndexOf(e);default:return-1}}function kr(e,t){return t.flatMap((n,o)=>e.includes(n)?[o]:[])}function ft(e,t,n){if(typeof n=="function")return n(t);if(n)return n.includes(t);const o=e.current[t];return o?o.hasAttribute("disabled")||o.getAttribute("aria-disabled")==="true":!1}function $t(e,t,n){if(n&&!tt(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const o=e();return typeof o=="number"?o:o?.[t]}return e?.[t]}function Lr(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.context.dataRef,{enabled:s=!0,event:r="click",toggle:c=!0,ignoreMouse:i=!1,stickIfOpen:h=!0,touchOpenDelay:f=0}=t,u=g.useRef(void 0),a=An(),R=$e(),x=g.useMemo(()=>({onPointerDown(y){u.current=y.pointerType},onMouseDown(y){const p=u.current,b=y.nativeEvent,d=n.select("open");if(y.button!==0||r==="click"||tt(p,!0)&&i)return;const m=o.current.openEvent,v=m?.type,w=n.select("domReferenceElement")!==y.currentTarget,l=d&&w||!(d&&c&&(!(m&&h)||v==="click"||v==="mousedown"));if(kn(b.target)){const O=ne(at,b,b.target);l&&p==="touch"&&f>0?R.start(f,()=>{n.setOpen(!0,O)}):n.setOpen(l,O);return}const M=y.currentTarget;a.request(()=>{const O=ne(at,b,M);l&&p==="touch"&&f>0?R.start(f,()=>{n.setOpen(!0,O)}):n.setOpen(l,O)})},onClick(y){if(r==="mousedown-only")return;const p=u.current;if(r==="mousedown"&&p){u.current=void 0;return}if(tt(p,!0)&&i)return;const b=n.select("open"),d=o.current.openEvent,m=n.select("domReferenceElement")!==y.currentTarget,v=b&&m||!(b&&c&&(!(d&&h)||bo(d))),w=ne(at,y.nativeEvent,y.currentTarget);v&&p==="touch"&&f>0?R.start(f,()=>{n.setOpen(!0,w)}):n.setOpen(v,w)},onKeyDown(){u.current=void 0}}),[o,r,i,n,h,c,a,R,f]);return g.useMemo(()=>s?{reference:x}:st,[s,x])}function hn(e,t,n){let{reference:o,floating:s}=e;const r=ke(t),c=rn(t),i=on(c),h=Te(t),f=r==="y",u=o.x+o.width/2-s.width/2,a=o.y+o.height/2-s.height/2,R=o[i]/2-s[i]/2;let x;switch(h){case"top":x={x:u,y:o.y-s.height};break;case"bottom":x={x:u,y:o.y+o.height};break;case"right":x={x:o.x+o.width,y:a};break;case"left":x={x:o.x-s.width,y:a};break;default:x={x:o.x,y:o.y}}switch(Ge(t)){case"start":x[c]-=R*(n&&f?-1:1);break;case"end":x[c]+=R*(n&&f?-1:1);break}return x}async function Dr(e,t){var n;t===void 0&&(t={});const{x:o,y:s,platform:r,rects:c,elements:i,strategy:h}=e,{boundary:f="clippingAncestors",rootBoundary:u="viewport",elementContext:a="floating",altBoundary:R=!1,padding:x=0}=Ue(t,e),y=Xn(x),b=i[R?a==="floating"?"reference":"floating":a],d=At(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(b)))==null||n?b:b.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(i.floating)),boundary:f,rootBoundary:u,strategy:h})),m=a==="floating"?{x:o,y:s,width:c.floating.width,height:c.floating.height}:c.reference,v=await(r.getOffsetParent==null?void 0:r.getOffsetParent(i.floating)),w=await(r.isElement==null?void 0:r.isElement(v))?await(r.getScale==null?void 0:r.getScale(v))||{x:1,y:1}:{x:1,y:1},l=At(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:m,offsetParent:v,strategy:h}):m);return{top:(d.top-l.top+y.top)/w.y,bottom:(l.bottom-d.bottom+y.bottom)/w.y,left:(d.left-l.left+y.left)/w.x,right:(l.right-d.right+y.right)/w.x}}const Fr=async(e,t,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:r=[],platform:c}=n,i=r.filter(Boolean),h=await(c.isRTL==null?void 0:c.isRTL(t));let f=await c.getElementRects({reference:e,floating:t,strategy:s}),{x:u,y:a}=hn(f,o,h),R=o,x={},y=0;for(let b=0;b<i.length;b++){var p;const{name:d,fn:m}=i[b],{x:v,y:w,data:l,reset:M}=await m({x:u,y:a,initialPlacement:o,placement:R,strategy:s,middlewareData:x,rects:f,platform:{...c,detectOverflow:(p=c.detectOverflow)!=null?p:Dr},elements:{reference:e,floating:t}});u=v??u,a=w??a,x={...x,[d]:{...x[d],...l}},M&&y<=50&&(y++,typeof M=="object"&&(M.placement&&(R=M.placement),M.rects&&(f=M.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:s}):M.rects),{x:u,y:a}=hn(f,R,h)),b=-1)}return{x:u,y:a,placement:R,strategy:s,middlewareData:x}},Nr=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:s,middlewareData:r,rects:c,initialPlacement:i,platform:h,elements:f}=t,{mainAxis:u=!0,crossAxis:a=!0,fallbackPlacements:R,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:p=!0,...b}=Ue(e,t);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const d=Te(s),m=ke(i),v=Te(i)===i,w=await(h.isRTL==null?void 0:h.isRTL(f.floating)),l=R||(v||!p?[It(i)]:Er(i)),M=y!=="none";!R&&M&&l.push(...Tr(i,p,y,w));const O=[i,...l],T=await h.detectOverflow(t,b),N=[];let D=((o=r.flip)==null?void 0:o.overflows)||[];if(u&&N.push(T[d]),a){const B=vr(s,c,w);N.push(T[B[0]],T[B[1]])}if(D=[...D,{placement:s,overflows:N}],!N.every(B=>B<=0)){var V,S;const B=(((V=r.flip)==null?void 0:V.index)||0)+1,A=O[B];if(A&&(!(a==="alignment"?m!==ke(A):!1)||D.every(C=>ke(C.placement)===m?C.overflows[0]>0:!0)))return{data:{index:B,overflows:D},reset:{placement:A}};let k=(S=D.filter(I=>I.overflows[0]<=0).sort((I,C)=>I.overflows[1]-C.overflows[1])[0])==null?void 0:S.placement;if(!k)switch(x){case"bestFit":{var E;const I=(E=D.filter(C=>{if(M){const F=ke(C.placement);return F===m||F==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(F=>F>0).reduce((F,P)=>F+P,0)]).sort((C,F)=>C[1]-F[1])[0])==null?void 0:E[0];I&&(k=I);break}case"initialPlacement":k=i;break}if(s!==k)return{reset:{placement:k}}}return{}}}};function yn(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function xn(e){return xr.some(t=>e[t]>=0)}const Hr=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:s="referenceHidden",...r}=Ue(e,t);switch(s){case"referenceHidden":{const c=await o.detectOverflow(t,{...r,elementContext:"reference"}),i=yn(c,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:xn(i)}}}case"escaped":{const c=await o.detectOverflow(t,{...r,altBoundary:!0}),i=yn(c,n.floating);return{data:{escapedOffsets:i,escaped:xn(i)}}}default:return{}}}}},qn=new Set(["left","top"]);async function Br(e,t){const{placement:n,platform:o,elements:s}=e,r=await(o.isRTL==null?void 0:o.isRTL(s.floating)),c=Te(n),i=Ge(n),h=ke(n)==="y",f=qn.has(c)?-1:1,u=r&&h?-1:1,a=Ue(t,e);let{mainAxis:R,crossAxis:x,alignmentAxis:y}=typeof a=="number"?{mainAxis:a,crossAxis:0,alignmentAxis:null}:{mainAxis:a.mainAxis||0,crossAxis:a.crossAxis||0,alignmentAxis:a.alignmentAxis};return i&&typeof y=="number"&&(x=i==="end"?y*-1:y),h?{x:x*u,y:R*f}:{x:R*f,y:x*u}}const _r=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:s,y:r,placement:c,middlewareData:i}=t,h=await Br(t,e);return c===((n=i.offset)==null?void 0:n.placement)&&(o=i.arrow)!=null&&o.alignmentOffset?{}:{x:s+h.x,y:r+h.y,data:{...h,placement:c}}}}},Vr=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:s,platform:r}=t,{mainAxis:c=!0,crossAxis:i=!1,limiter:h={fn:d=>{let{x:m,y:v}=d;return{x:m,y:v}}},...f}=Ue(e,t),u={x:n,y:o},a=await r.detectOverflow(t,f),R=ke(Te(s)),x=nn(R);let y=u[x],p=u[R];if(c){const d=x==="y"?"top":"left",m=x==="y"?"bottom":"right",v=y+a[d],w=y-a[m];y=Xt(v,y,w)}if(i){const d=R==="y"?"top":"left",m=R==="y"?"bottom":"right",v=p+a[d],w=p-a[m];p=Xt(v,p,w)}const b=h.fn({...t,[x]:y,[R]:p});return{...b,data:{x:b.x-n,y:b.y-o,enabled:{[x]:c,[R]:i}}}}}},$r=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:s,rects:r,middlewareData:c}=t,{offset:i=0,mainAxis:h=!0,crossAxis:f=!0}=Ue(e,t),u={x:n,y:o},a=ke(s),R=nn(a);let x=u[R],y=u[a];const p=Ue(i,t),b=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(h){const v=R==="y"?"height":"width",w=r.reference[R]-r.floating[v]+b.mainAxis,l=r.reference[R]+r.reference[v]-b.mainAxis;x<w?x=w:x>l&&(x=l)}if(f){var d,m;const v=R==="y"?"width":"height",w=qn.has(Te(s)),l=r.reference[a]-r.floating[v]+(w&&((d=c.offset)==null?void 0:d[a])||0)+(w?0:b.crossAxis),M=r.reference[a]+r.reference[v]+(w?0:((m=c.offset)==null?void 0:m[a])||0)-(w?b.crossAxis:0);y<l?y=l:y>M&&(y=M)}return{[R]:x,[a]:y}}}},Wr=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:s,rects:r,platform:c,elements:i}=t,{apply:h=()=>{},...f}=Ue(e,t),u=await c.detectOverflow(t,f),a=Te(s),R=Ge(s),x=ke(s)==="y",{width:y,height:p}=r.floating;let b,d;a==="top"||a==="bottom"?(b=a,d=R===(await(c.isRTL==null?void 0:c.isRTL(i.floating))?"start":"end")?"left":"right"):(d=a,b=R==="end"?"top":"bottom");const m=p-u.top-u.bottom,v=y-u.left-u.right,w=rt(p-u[b],m),l=rt(y-u[d],v),M=!t.middlewareData.shift;let O=w,T=l;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=v),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(O=m),M&&!R){const D=Me(u.left,0),V=Me(u.right,0),S=Me(u.top,0),E=Me(u.bottom,0);x?T=y-2*(D!==0||V!==0?D+V:Me(u.left,u.right)):O=p-2*(S!==0||E!==0?S+E:Me(u.top,u.bottom))}await h({...t,availableWidth:T,availableHeight:O});const N=await c.getDimensions(i.floating);return y!==N.width||p!==N.height?{reset:{rects:!0}}:{}}}};function Jn(e){const t=We(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const s=Le(e),r=s?e.offsetWidth:n,c=s?e.offsetHeight:o,i=Pt(n)!==r||Pt(o)!==c;return i&&(n=r,o=c),{width:n,height:o,$:i}}function sn(e){return le(e)?e:e.contextElement}function et(e){const t=sn(e);if(!Le(t))return _e(1);const n=t.getBoundingClientRect(),{width:o,height:s,$:r}=Jn(t);let c=(r?Pt(n.width):n.width)/o,i=(r?Pt(n.height):n.height)/s;return(!c||!Number.isFinite(c))&&(c=1),(!i||!Number.isFinite(i))&&(i=1),{x:c,y:i}}const Ur=_e(0);function Qn(e){const t=Ye(e);return!Ln()||!t.visualViewport?Ur:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function zr(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ye(e)?!1:t}function Je(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),r=sn(e);let c=_e(1);t&&(o?le(o)&&(c=et(o)):c=et(e));const i=zr(r,n,o)?Qn(r):_e(0);let h=(s.left+i.x)/c.x,f=(s.top+i.y)/c.y,u=s.width/c.x,a=s.height/c.y;if(r){const R=Ye(r),x=o&&le(o)?Ye(o):o;let y=R,p=un(y);for(;p&&o&&x!==y;){const b=et(p),d=p.getBoundingClientRect(),m=We(p),v=d.left+(p.clientLeft+parseFloat(m.paddingLeft))*b.x,w=d.top+(p.clientTop+parseFloat(m.paddingTop))*b.y;h*=b.x,f*=b.y,u*=b.x,a*=b.y,h+=v,f+=w,y=Ye(p),p=un(y)}}return At({width:u,height:a,x:h,y:f})}function Nt(e,t){const n=Lt(e).scrollLeft;return t?t.left+n:Je(ze(e)).left+n}function Zn(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Nt(e,n),s=n.top+t.scrollTop;return{x:o,y:s}}function Kr(e){let{elements:t,rect:n,offsetParent:o,strategy:s}=e;const r=s==="fixed",c=ze(o),i=t?Zt(t.floating):!1;if(o===c||i&&r)return n;let h={scrollLeft:0,scrollTop:0},f=_e(1);const u=_e(0),a=Le(o);if((a||!a&&!r)&&((en(o)!=="body"||tn(c))&&(h=Lt(o)),Le(o))){const x=Je(o);f=et(o),u.x=x.x+o.clientLeft,u.y=x.y+o.clientTop}const R=c&&!a&&!r?Zn(c,h):_e(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-h.scrollLeft*f.x+u.x+R.x,y:n.y*f.y-h.scrollTop*f.y+u.y+R.y}}function jr(e){return Array.from(e.getClientRects())}function Yr(e){const t=ze(e),n=Lt(e),o=e.ownerDocument.body,s=Me(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),r=Me(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let c=-n.scrollLeft+Nt(e);const i=-n.scrollTop;return We(o).direction==="rtl"&&(c+=Me(t.clientWidth,o.clientWidth)-s),{width:s,height:r,x:c,y:i}}const Rn=25;function Gr(e,t){const n=Ye(e),o=ze(e),s=n.visualViewport;let r=o.clientWidth,c=o.clientHeight,i=0,h=0;if(s){r=s.width,c=s.height;const u=Ln();(!u||u&&t==="fixed")&&(i=s.offsetLeft,h=s.offsetTop)}const f=Nt(o);if(f<=0){const u=o.ownerDocument,a=u.body,R=getComputedStyle(a),x=u.compatMode==="CSS1Compat"&&parseFloat(R.marginLeft)+parseFloat(R.marginRight)||0,y=Math.abs(o.clientWidth-a.clientWidth-x);y<=Rn&&(r-=y)}else f<=Rn&&(r+=f);return{width:r,height:c,x:i,y:h}}const Xr=new Set(["absolute","fixed"]);function qr(e,t){const n=Je(e,!0,t==="fixed"),o=n.top+e.clientTop,s=n.left+e.clientLeft,r=Le(e)?et(e):_e(1),c=e.clientWidth*r.x,i=e.clientHeight*r.y,h=s*r.x,f=o*r.y;return{width:c,height:i,x:h,y:f}}function bn(e,t,n){let o;if(t==="viewport")o=Gr(e,n);else if(t==="document")o=Yr(ze(e));else if(le(t))o=qr(t,n);else{const s=Qn(e);o={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return At(o)}function eo(e,t){const n=nt(e);return n===t||!le(n)||dt(n)?!1:We(n).position==="fixed"||eo(n,t)}function Jr(e,t){const n=t.get(e);if(n)return n;let o=Gt(e,[],!1).filter(i=>le(i)&&en(i)!=="body"),s=null;const r=We(e).position==="fixed";let c=r?nt(e):e;for(;le(c)&&!dt(c);){const i=We(c),h=Dn(c);!h&&i.position==="fixed"&&(s=null),(r?!h&&!s:!h&&i.position==="static"&&!!s&&Xr.has(s.position)||tn(c)&&!h&&eo(e,c))?o=o.filter(u=>u!==c):s=i,c=nt(c)}return t.set(e,o),o}function Qr(e){let{element:t,boundary:n,rootBoundary:o,strategy:s}=e;const c=[...n==="clippingAncestors"?Zt(t)?[]:Jr(t,this._c):[].concat(n),o],i=c[0],h=c.reduce((f,u)=>{const a=bn(t,u,s);return f.top=Me(a.top,f.top),f.right=rt(a.right,f.right),f.bottom=rt(a.bottom,f.bottom),f.left=Me(a.left,f.left),f},bn(t,i,s));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function Zr(e){const{width:t,height:n}=Jn(e);return{width:t,height:n}}function es(e,t,n){const o=Le(t),s=ze(t),r=n==="fixed",c=Je(e,!0,r,t);let i={scrollLeft:0,scrollTop:0};const h=_e(0);function f(){h.x=Nt(s)}if(o||!o&&!r)if((en(t)!=="body"||tn(s))&&(i=Lt(t)),o){const x=Je(t,!0,r,t);h.x=x.x+t.clientLeft,h.y=x.y+t.clientTop}else s&&f();r&&!o&&s&&f();const u=s&&!o&&!r?Zn(s,i):_e(0),a=c.left+i.scrollLeft-h.x-u.x,R=c.top+i.scrollTop-h.y-u.y;return{x:a,y:R,width:c.width,height:c.height}}function Wt(e){return We(e).position==="static"}function wn(e,t){if(!Le(e)||We(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ze(e)===n&&(n=n.ownerDocument.body),n}function to(e,t){const n=Ye(e);if(Zt(e))return n;if(!Le(e)){let s=nt(e);for(;s&&!dt(s);){if(le(s)&&!Wt(s))return s;s=nt(s)}return n}let o=wn(e,t);for(;o&&wo(o)&&Wt(o);)o=wn(o,t);return o&&dt(o)&&Wt(o)&&!Dn(o)?n:o||vo(e)||n}const ts=async function(e){const t=this.getOffsetParent||to,n=this.getDimensions,o=await n(e.floating);return{reference:es(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function ns(e){return We(e).direction==="rtl"}const os={convertOffsetParentRelativeRectToViewportRelativeRect:Kr,getDocumentElement:ze,getClippingRect:Qr,getOffsetParent:to,getElementRects:ts,getClientRects:jr,getDimensions:Zr,getScale:et,isElement:le,isRTL:ns};function no(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function rs(e,t){let n=null,o;const s=ze(e);function r(){var i;clearTimeout(o),(i=n)==null||i.disconnect(),n=null}function c(i,h){i===void 0&&(i=!1),h===void 0&&(h=1),r();const f=e.getBoundingClientRect(),{left:u,top:a,width:R,height:x}=f;if(i||t(),!R||!x)return;const y=Ze(a),p=Ze(s.clientWidth-(u+R)),b=Ze(s.clientHeight-(a+x)),d=Ze(u),v={rootMargin:-y+"px "+-p+"px "+-b+"px "+-d+"px",threshold:Me(0,rt(1,h))||1};let w=!0;function l(M){const O=M[0].intersectionRatio;if(O!==h){if(!w)return c();O?c(!1,O):o=setTimeout(()=>{c(!1,1e-7)},1e3)}O===1&&!no(f,e.getBoundingClientRect())&&c(),w=!1}try{n=new IntersectionObserver(l,{...v,root:s.ownerDocument})}catch{n=new IntersectionObserver(l,v)}n.observe(e)}return c(!0),r}function vn(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:r=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:h=!1}=o,f=sn(e),u=s||r?[...f?Gt(f):[],...Gt(t)]:[];u.forEach(d=>{s&&d.addEventListener("scroll",n,{passive:!0}),r&&d.addEventListener("resize",n)});const a=f&&i?rs(f,n):null;let R=-1,x=null;c&&(x=new ResizeObserver(d=>{let[m]=d;m&&m.target===f&&x&&(x.unobserve(t),cancelAnimationFrame(R),R=requestAnimationFrame(()=>{var v;(v=x)==null||v.observe(t)})),n()}),f&&!h&&x.observe(f),x.observe(t));let y,p=h?Je(e):null;h&&b();function b(){const d=Je(e);p&&!no(p,d)&&n(),p=d,y=requestAnimationFrame(b)}return n(),()=>{var d;u.forEach(m=>{s&&m.removeEventListener("scroll",n),r&&m.removeEventListener("resize",n)}),a?.(),(d=x)==null||d.disconnect(),x=null,h&&cancelAnimationFrame(y)}}const ss=_r,is=Vr,cs=Nr,as=Wr,ls=Hr,us=$r,fs=(e,t,n)=>{const o=new Map,s={platform:os,...n},r={...s.platform,_c:o};return Fr(e,t,{...s,platform:r})};var ds=typeof document<"u",gs=function(){},Et=ds?g.useLayoutEffect:gs;function kt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!kt(e[o],t[o]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,s[o]))return!1;for(o=n;o--!==0;){const r=s[o];if(!(r==="_owner"&&e.$$typeof)&&!kt(e[r],t[r]))return!1}return!0}return e!==e&&t!==t}function oo(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function En(e,t){const n=oo(e);return Math.round(t*n)/n}function Ut(e){const t=g.useRef(e);return Et(()=>{t.current=e}),t}function ms(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:s,elements:{reference:r,floating:c}={},transform:i=!0,whileElementsMounted:h,open:f}=e,[u,a]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[R,x]=g.useState(o);kt(R,o)||x(o);const[y,p]=g.useState(null),[b,d]=g.useState(null),m=g.useCallback(C=>{C!==M.current&&(M.current=C,p(C))},[]),v=g.useCallback(C=>{C!==O.current&&(O.current=C,d(C))},[]),w=r||y,l=c||b,M=g.useRef(null),O=g.useRef(null),T=g.useRef(u),N=h!=null,D=Ut(h),V=Ut(s),S=Ut(f),E=g.useCallback(()=>{if(!M.current||!O.current)return;const C={placement:t,strategy:n,middleware:R};V.current&&(C.platform=V.current),fs(M.current,O.current,C).then(F=>{const P={...F,isPositioned:S.current!==!1};B.current&&!kt(T.current,P)&&(T.current=P,gt.flushSync(()=>{a(P)}))})},[R,t,n,V,S]);Et(()=>{f===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,a(C=>({...C,isPositioned:!1})))},[f]);const B=g.useRef(!1);Et(()=>(B.current=!0,()=>{B.current=!1}),[]),Et(()=>{if(w&&(M.current=w),l&&(O.current=l),w&&l){if(D.current)return D.current(w,l,E);E()}},[w,l,E,D,N]);const A=g.useMemo(()=>({reference:M,floating:O,setReference:m,setFloating:v}),[m,v]),k=g.useMemo(()=>({reference:w,floating:l}),[w,l]),I=g.useMemo(()=>{const C={position:n,left:0,top:0};if(!k.floating)return C;const F=En(k.floating,u.x),P=En(k.floating,u.y);return i?{...C,transform:"translate("+F+"px, "+P+"px)",...oo(k.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:P}},[n,i,k.floating,u.x,u.y]);return g.useMemo(()=>({...u,update:E,refs:A,elements:k,floatingStyles:I}),[u,E,A,k,I])}const ps=(e,t)=>({...ss(e),options:[e,t]}),hs=(e,t)=>({...is(e),options:[e,t]}),ys=(e,t)=>({...us(e),options:[e,t]}),xs=(e,t)=>({...cs(e),options:[e,t]}),Rs=(e,t)=>({...as(e),options:[e,t]}),bs=(e,t)=>({...ls(e),options:[e,t]});function ws(e){const{open:t=!1,onOpenChange:n,elements:o={}}=e,s=Fn(),r=yt()!=null,c=Ct(()=>new Eo({open:t,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:o.triggers??new Nn,floatingId:s,nested:r,noEmit:e.noEmit||!1})).current;return te(()=>{const i={open:t,floatingId:s};o.reference!==void 0&&(i.referenceElement=o.reference,i.domReferenceElement=le(o.reference)?o.reference:null),o.floating!==void 0&&(i.floatingElement=o.floating),c.update(i)},[t,s,o.reference,o.floating,c]),c.context.onOpenChange=n,c.context.nested=r,c.context.noEmit=e.noEmit||!1,c}function vs(e={}){const{nodeId:t,externalTree:n}=e,o=ws(e),s=e.rootContext||o,r={reference:s.useState("referenceElement"),floating:s.useState("floatingElement"),domReference:s.useState("domReferenceElement")},[c,i]=g.useState(null),h=g.useRef(null),f=xt(n);te(()=>{r.domReference&&(h.current=r.domReference)},[r.domReference]);const u=ms({...e,elements:{...r,...c&&{reference:c}}}),a=g.useCallback(O=>{const T=le(O)?{getBoundingClientRect:()=>O.getBoundingClientRect(),getClientRects:()=>O.getClientRects(),contextElement:O}:O;i(T),u.refs.setReference(T)},[u.refs]),[R,x]=g.useState(null),[y,p]=g.useState(null);s.useSyncedValue("referenceElement",R),s.useSyncedValue("domReferenceElement",le(R)?R:null),s.useSyncedValue("floatingElement",y);const b=g.useCallback(O=>{(le(O)||O===null)&&(h.current=O,x(O)),(le(u.refs.reference.current)||u.refs.reference.current===null||O!==null&&!le(O))&&u.refs.setReference(O)},[u.refs,x]),d=g.useCallback(O=>{p(O),u.refs.setFloating(O)},[u.refs]),m=g.useMemo(()=>({...u.refs,setReference:b,setFloating:d,setPositionReference:a,domReference:h}),[u.refs,b,d,a]),v=g.useMemo(()=>({...u.elements,domReference:r.domReference}),[u.elements,r.domReference]),w=s.useState("open"),l=s.useState("floatingId"),M=g.useMemo(()=>({...u,dataRef:s.context.dataRef,open:w,onOpenChange:s.setOpen,events:s.context.events,floatingId:l,refs:m,elements:v,nodeId:t,rootStore:s}),[u,m,v,t,s,w,l]);return te(()=>{s.context.dataRef.current.floatingContext=M;const O=f?.nodesRef.current.find(T=>T.id===t);O&&(O.context=M)}),g.useMemo(()=>({...u,context:M,refs:m,elements:v,rootStore:s}),[u,m,v,M,s])}const zt=Oo&&Mo;function Es(e,t={}){const n="rootStore"in e?e.rootStore:e,{events:o,dataRef:s}=n.context,{enabled:r=!0,visibleOnly:c=!0,delay:i}=t,h=g.useRef(!1),f=g.useRef(null),u=$e(),a=g.useRef(!0);g.useEffect(()=>{const x=n.select("domReferenceElement");if(!r)return;const y=Ye(x);function p(){const m=n.select("domReferenceElement");!n.select("open")&&Le(m)&&m===Mt(ot(m))&&(h.current=!0)}function b(){a.current=!0}function d(){a.current=!1}return y.addEventListener("blur",p),zt&&(y.addEventListener("keydown",b,!0),y.addEventListener("pointerdown",d,!0)),()=>{y.removeEventListener("blur",p),zt&&(y.removeEventListener("keydown",b,!0),y.removeEventListener("pointerdown",d,!0))}},[n,r]),g.useEffect(()=>{if(!r)return;function x(y){if(y.reason===at||y.reason===Bn){const p=n.select("domReferenceElement");le(p)&&(f.current=p,h.current=!0)}}return o.on("openchange",x),()=>{o.off("openchange",x)}},[o,r,n]);const R=g.useMemo(()=>({onMouseLeave(){h.current=!1,f.current=null},onFocus(x){const y=x.currentTarget;if(h.current){if(f.current===y)return;h.current=!1,f.current=null}const p=Dt(x.nativeEvent);if(c&&le(p)){if(zt&&!x.relatedTarget){if(!a.current&&!kn(p))return}else if(!Co(p))return}const b=x.relatedTarget&&n.context.triggerElements.hasElement(x.relatedTarget),{nativeEvent:d,currentTarget:m}=x,v=typeof i=="function"?i():i;if(n.select("open")&&b||v===0||v===void 0){n.setOpen(!0,ne(lt,d,m));return}u.start(v,()=>{h.current||n.setOpen(!0,ne(lt,d,m))})},onBlur(x){h.current=!1,f.current=null;const y=x.relatedTarget,p=x.nativeEvent,b=le(y)&&y.hasAttribute(Hn("focus-guard"))&&y.getAttribute("data-type")==="outside";u.start(0,()=>{const d=n.select("domReferenceElement"),m=Mt(d?d.ownerDocument:document);if(!y&&m===d||ye(s.current.floatingContext?.refs.floating.current,m)||ye(d,m)||b)return;const v=y??m;if(le(v)){const w=n.context.triggerElements;if(w.hasElement(v)||w.hasMatchingElement(l=>ye(l,v)))return}n.setOpen(!1,ne(lt,p))})}}),[s,n,c,u,i]);return g.useMemo(()=>r?{reference:R,trigger:R}:{},[r,R])}const Jt=Hn("safe-polygon"),Cs=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${To}`;function Os(e){return e?!!e.closest(Cs):!1}function ro(e){const t=g.useRef(void 0),n=g.useRef(!1),o=g.useRef(void 0),s=g.useRef(!0),r=g.useRef(!1),c=g.useRef(()=>{}),i=g.useRef(!1),h=$e(),f=$e(),u=g.useRef(void 0);return g.useMemo(()=>{const a=e.context.dataRef.current;return a.hoverInteractionState||(a.hoverInteractionState={pointerTypeRef:t,interactedInsideRef:n,handlerRef:o,blockMouseMoveRef:s,performedPointerEventsMutationRef:r,unbindMouseMoveRef:c,restTimeoutPendingRef:i,openChangeTimeout:h,restTimeout:f,handleCloseOptionsRef:u}),a.hoverInteractionState},[e,t,n,o,s,r,c,i,h,f,u])}const Ms=new Set(["click","mousedown"]);function Ts(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),s=n.useState("floatingElement"),r=n.useState("domReferenceElement"),{dataRef:c}=n.context,{enabled:i=!0,closeDelay:h=0,externalTree:f}=t,{pointerTypeRef:u,interactedInsideRef:a,handlerRef:R,performedPointerEventsMutationRef:x,unbindMouseMoveRef:y,restTimeoutPendingRef:p,openChangeTimeout:b,handleCloseOptionsRef:d}=ro(n),m=xt(f),v=yt(),w=se(()=>a.current?!0:c.current.openEvent?Ms.has(c.current.openEvent.type):!1),l=se(()=>{const D=c.current.openEvent?.type;return D?.includes("mouse")&&D!=="mousedown"}),M=g.useCallback((D,V=!0)=>{const S=Ss(h,u.current);S&&!R.current?b.start(S,()=>n.setOpen(!1,ne(Oe,D))):V&&(b.clear(),n.setOpen(!1,ne(Oe,D)))},[h,R,n,u,b]),O=se(()=>{y.current(),R.current=void 0}),T=se(()=>{if(x.current){const D=ot(s).body;D.style.pointerEvents="",D.removeAttribute(Jt),x.current=!1}}),N=se(D=>{const V=Dt(D);if(!Os(V)){a.current=!1;return}a.current=!0});te(()=>{o||(u.current=void 0,p.current=!1,a.current=!1,O(),T())},[o,u,p,a,O,T]),g.useEffect(()=>()=>{O()},[O]),g.useEffect(()=>T,[T]),te(()=>{if(i&&o&&d.current?.blockPointerEvents&&l()&&le(r)&&s){x.current=!0;const D=ot(s).body;D.setAttribute(Jt,"");const V=r,S=s,E=m?.nodesRef.current.find(B=>B.id===v)?.context?.elements.floating;return E&&(E.style.pointerEvents=""),D.style.pointerEvents="none",V.style.pointerEvents="auto",S.style.pointerEvents="auto",()=>{D.style.pointerEvents="",V.style.pointerEvents="",S.style.pointerEvents=""}}},[i,o,r,s,d,l,m,v,x]),g.useEffect(()=>{if(!i)return;function D(B){if(w()||!c.current.floatingContext||!n.select("open"))return;const A=n.context.triggerElements;B.relatedTarget&&A.hasElement(B.relatedTarget)||(T(),O(),w()||M(B))}function V(B){b.clear(),T(),R.current?.(B),O()}function S(B){w()||M(B,!1)}const E=s;return E&&(E.addEventListener("mouseleave",D),E.addEventListener("mouseenter",V),E.addEventListener("mouseleave",S),E.addEventListener("pointerdown",N,!0)),()=>{E&&(E.removeEventListener("mouseleave",D),E.removeEventListener("mouseenter",V),E.removeEventListener("mouseleave",S),E.removeEventListener("pointerdown",N,!0))}})}function Ss(e,t){return t&&!tt(t)?0:typeof e=="function"?e():e}function Kt(e){return typeof e=="function"?e():e}const Ps={current:null};function Is(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:o,events:s}=n.context,{enabled:r=!0,delay:c=0,handleClose:i=null,mouseOnly:h=!1,restMs:f=0,move:u=!0,triggerElementRef:a=Ps,externalTree:R,isActiveTrigger:x=!0}=t,y=xt(R),{pointerTypeRef:p,interactedInsideRef:b,handlerRef:d,blockMouseMoveRef:m,performedPointerEventsMutationRef:v,unbindMouseMoveRef:w,restTimeoutPendingRef:l,openChangeTimeout:M,restTimeout:O,handleCloseOptionsRef:T}=ro(n),N=Ae(i),D=Ae(c),V=Ae(f);x&&(T.current=N.current?.__options);const S=se(()=>b.current?!0:o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1),E=g.useCallback((I,C=!0)=>{const F=$t(D.current,"close",p.current);F&&!d.current?M.start(F,()=>n.setOpen(!1,ne(Oe,I))):C&&(M.clear(),n.setOpen(!1,ne(Oe,I)))},[D,d,n,p,M]),B=se(()=>{w.current(),d.current=void 0}),A=se(()=>{if(v.current){const I=ot(n.select("domReferenceElement")).body;I.style.pointerEvents="",I.removeAttribute(Jt),v.current=!1}});g.useEffect(()=>{if(!r)return;function I(C){C.open||(M.clear(),O.clear(),m.current=!0,l.current=!1)}return s.on("openchange",I),()=>{s.off("openchange",I)}},[r,s,M,O,m,l]);const k=se(I=>{if(S()||!o.current.floatingContext)return;const C=n.context.triggerElements;if(I.relatedTarget&&C.hasElement(I.relatedTarget))return;const F=a.current;N.current?.({...o.current.floatingContext,tree:y,x:I.clientX,y:I.clientY,onClose(){A(),B(),!S()&&F===n.select("domReferenceElement")&&E(I)}})(I)});return g.useEffect(()=>{if(!r)return;const I=a.current??(x?n.select("domReferenceElement"):null);if(!le(I))return;function C($){if(M.clear(),m.current=!1,h&&!tt(p.current)||Kt(V.current)>0&&!$t(D.current,"open"))return;const Y=$t(D.current,"open",p.current),L=n.select("domReferenceElement"),G=n.context.triggerElements,q=(G.hasElement($.target)||G.hasMatchingElement(ee=>ye(ee,$.target)))&&(!L||!ye(L,$.target)),U=$.currentTarget??null,W=n.select("open"),oe=!W||q;q&&W?n.setOpen(!0,ne(Oe,$,U)):Y?M.start(Y,()=>{oe&&n.setOpen(!0,ne(Oe,$,U))}):oe&&n.setOpen(!0,ne(Oe,$,U))}function F($){if(S()){A();return}w.current();const Y=n.select("domReferenceElement"),L=ot(Y);O.clear(),l.current=!1;const G=n.context.triggerElements;if($.relatedTarget&&G.hasElement($.relatedTarget))return;if(N.current&&o.current.floatingContext){n.select("open")||M.clear();const U=a.current;d.current=N.current({...o.current.floatingContext,tree:y,x:$.clientX,y:$.clientY,onClose(){A(),B(),!S()&&U===n.select("domReferenceElement")&&E($,!0)}});const W=d.current;W($),L.addEventListener("mousemove",W),w.current=()=>{L.removeEventListener("mousemove",W)};return}(p.current!=="touch"||!ye(n.select("floatingElement"),$.relatedTarget))&&E($)}function P($){k($)}return n.select("open")&&I.addEventListener("mouseleave",P),u&&I.addEventListener("mousemove",C,{once:!0}),I.addEventListener("mouseenter",C),I.addEventListener("mouseleave",F),()=>{I.removeEventListener("mouseleave",P),u&&I.removeEventListener("mousemove",C),I.removeEventListener("mouseenter",C),I.removeEventListener("mouseleave",F)}},[B,A,m,o,D,E,n,r,N,k,x,S,h,u,p,V,O,l,M,a,y,w,d]),g.useMemo(()=>{function I(C){p.current=C.pointerType}return{onPointerDown:I,onPointerEnter:I,onMouseMove(C){const{nativeEvent:F}=C,P=C.currentTarget,$=n.select("domReferenceElement"),Y=n.context.triggerElements,L=n.select("open"),G=(Y.hasElement(C.target)||Y.hasMatchingElement(U=>ye(U,C.target)))&&(!$||!ye($,C.target));if(h&&!tt(p.current)||L&&!G||Kt(V.current)===0||!G&&l.current&&C.movementX**2+C.movementY**2<2)return;O.clear();function q(){if(l.current=!1,S())return;const U=n.select("open");!m.current&&(!U||G)&&n.setOpen(!0,ne(Oe,F,P))}p.current==="touch"?gt.flushSync(()=>{q()}):G&&L?q():(l.current=!0,O.start(Kt(V.current),q))}}},[m,S,h,n,p,V,O,l])}const As="Escape";function Ht(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function bt(e,t){return Ht(t,e===Qt||e===ht,e===Ke||e===je)}function jt(e,t,n){return Ht(t,e===ht,n?e===Ke:e===je)||e==="Enter"||e===" "||e===""}function ks(e,t,n){return Ht(t,n?e===Ke:e===je,e===ht)}function Ls(e,t,n,o){const s=n?e===je:e===Ke,r=e===Qt;return t==="both"||t==="horizontal"&&o&&o>1?e===As:Ht(t,s,r)}function Ds(e,t){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),s=n.useState("floatingElement"),r=n.useState("domReferenceElement"),c=n.context.dataRef,{listRef:i,activeIndex:h,onNavigate:f=()=>{},enabled:u=!0,selectedIndex:a=null,allowEscape:R=!1,loopFocus:x=!1,nested:y=!1,rtl:p=!1,virtual:b=!1,focusItemOnOpen:d="auto",focusItemOnHover:m=!0,openOnArrowKeyDown:v=!0,disabledIndices:w=void 0,orientation:l="vertical",parentOrientation:M,cols:O=1,scrollItemIntoView:T=!0,itemSizes:N,dense:D=!1,id:V,resetOnPointerLeave:S=!0,externalTree:E}=t,B=So(s),A=Ae(B),k=yt(),I=xt(E);te(()=>{c.current.orientation=l},[c,l]);const C=Po(r),F=g.useRef(d),P=g.useRef(a??-1),$=g.useRef(null),Y=g.useRef(!0),L=se(H=>{f(P.current===-1?null:P.current,H)}),G=g.useRef(L),q=g.useRef(!!s),U=g.useRef(o),W=g.useRef(!1),oe=g.useRef(!1),ee=Ae(w),K=Ae(o),J=Ae(T),me=Ae(a),De=Ae(S),Se=se(()=>{function H(re){b?I?.events.emit("virtualfocus",re):Io(re,{sync:W.current,preventScroll:!0})}const j=i.current[P.current],_=oe.current;j&&H(j),(W.current?re=>re():requestAnimationFrame)(()=>{const re=i.current[P.current]||j;if(!re)return;j||H(re);const ue=J.current;ue&&Re&&(_||!Y.current)&&re.scrollIntoView?.(typeof ue=="boolean"?{block:"nearest",inline:"nearest"}:ue)})});te(()=>{u&&(o&&s?(P.current=a??-1,F.current&&a!=null&&(oe.current=!0,L())):q.current&&(P.current=-1,G.current()))},[u,o,s,a,L]),te(()=>{if(u){if(!o){W.current=!1;return}if(s)if(h==null){if(W.current=!1,me.current!=null)return;if(q.current&&(P.current=-1,Se()),(!U.current||!q.current)&&F.current&&($.current!=null||F.current===!0&&$.current==null)){let H=0;const j=()=>{i.current[0]==null?(H<2&&(H?requestAnimationFrame:queueMicrotask)(j),H+=1):(P.current=$.current==null||jt($.current,l,p)||y?Vt(i):pn(i),$.current=null,L())};j()}}else ut(i,h)||(P.current=h,Se(),oe.current=!1)}},[u,o,s,h,me,y,i,l,p,L,Se,ee]),te(()=>{if(!u||s||!I||b||!q.current)return;const H=I.nodesRef.current,j=H.find(re=>re.id===k)?.context?.elements.floating,_=Mt(ot(s)),Z=H.some(re=>re.context&&ye(re.context.elements.floating,_));j&&!Z&&Y.current&&j.focus({preventScroll:!0})},[u,s,I,k,b]),te(()=>{G.current=L,U.current=o,q.current=!!s}),te(()=>{o||($.current=null,F.current=d)},[o,d]);const xe=h!=null,Re=g.useMemo(()=>{function H(_){if(!K.current)return;const Z=i.current.indexOf(_.currentTarget);Z!==-1&&P.current!==Z&&(P.current=Z,L(_))}return{onFocus(_){W.current=!0,H(_)},onClick:({currentTarget:_})=>_.focus({preventScroll:!0}),onMouseMove(_){W.current=!0,oe.current=!1,m&&H(_)},onPointerLeave(_){if(!K.current||!Y.current||_.pointerType==="touch")return;W.current=!0;const Z=_.relatedTarget;!m||i.current.includes(Z)||De.current&&(P.current=-1,L(_),b||A.current?.focus({preventScroll:!0}))}}},[K,A,m,i,L,De,b]),X=g.useCallback(()=>M??I?.nodesRef.current.find(H=>H.id===k)?.context?.dataRef?.current.orientation,[k,I,M]),ie=se(H=>{if(Y.current=!1,W.current=!0,H.which===229||!K.current&&H.currentTarget===A.current)return;if(y&&Ls(H.key,l,p,O)){bt(H.key,X())||be(H),n.setOpen(!1,ne(vt,H.nativeEvent)),Le(r)&&(b?I?.events.emit("virtualfocus",r):r.focus());return}const j=P.current,_=Vt(i,w),Z=pn(i,w);if(C||(H.key==="Home"&&(be(H),P.current=_,L(H)),H.key==="End"&&(be(H),P.current=Z,L(H))),O>1){const re=N||Array.from({length:i.current.length},()=>({width:1,height:1})),ue=Ir(re,O,D),Ne=ue.findIndex(Ee=>Ee!=null&&!ft(i,Ee,w)),Be=ue.reduce((Ee,He,z)=>He!=null&&!ft(i,He,w)?z:Ee,-1),Pe=ue[Pr({current:ue.map(Ee=>Ee!=null?i.current[Ee]:null)},{event:H,orientation:l,loopFocus:x,rtl:p,cols:O,disabledIndices:kr([...(typeof w!="function"?w:null)||i.current.map((Ee,He)=>ft(i,He,w)?He:void 0),void 0],ue),minIndex:Ne,maxIndex:Be,prevIndex:Ar(P.current>Z?_:P.current,re,ue,O,H.key===ht?"bl":H.key===(p?Ke:je)?"tr":"tl"),stopEvent:!0})];if(Pe!=null&&(P.current=Pe,L(H)),l==="both")return}if(bt(H.key,l)){if(be(H),o&&!b&&Mt(H.currentTarget.ownerDocument)===H.currentTarget){P.current=jt(H.key,l,p)?_:Z,L(H);return}jt(H.key,l,p)?x?j>=Z?R&&j!==i.current.length?P.current=-1:(W.current=!1,P.current=_):P.current=pe(i,{startingIndex:j,disabledIndices:w}):P.current=Math.min(Z,pe(i,{startingIndex:j,disabledIndices:w})):x?j<=_?R&&j!==-1?P.current=i.current.length:(W.current=!1,P.current=Z):P.current=pe(i,{startingIndex:j,decrement:!0,disabledIndices:w}):P.current=Math.max(_,pe(i,{startingIndex:j,decrement:!0,disabledIndices:w})),ut(i,P.current)&&(P.current=-1),L(H)}}),ce=g.useMemo(()=>b&&o&&xe&&{"aria-activedescendant":`${V}-${h}`},[b,o,xe,V,h]),ve=g.useMemo(()=>({"aria-orientation":l==="both"?void 0:l,...C?{}:ce,onKeyDown(H){if(H.key==="Tab"&&H.shiftKey&&o&&!b){const j=Dt(H.nativeEvent);if(j&&!ye(A.current,j))return;be(H),n.setOpen(!1,ne(Tt,H.nativeEvent)),Le(r)&&r.focus();return}ie(H)},onPointerMove(){Y.current=!0}}),[ce,ie,A,l,C,n,o,b,r]),Fe=g.useMemo(()=>{function H(_){d==="auto"&&Ao(_.nativeEvent)&&(F.current=!b)}function j(_){F.current=d,d==="auto"&&ko(_.nativeEvent)&&(F.current=!0)}return{onKeyDown(_){const Z=n.select("open");Y.current=!1;const re=_.key.startsWith("Arrow"),ue=ks(_.key,X(),p),Ne=bt(_.key,l),Be=(y?ue:Ne)||_.key==="Enter"||_.key.trim()==="";if(b&&Z)return ie(_);if(!(!Z&&!v&&re)){if(Be){const Pe=bt(_.key,X());$.current=y&&Pe?null:_.key}if(y){ue&&(be(_),Z?(P.current=Vt(i,ee.current),L(_)):n.setOpen(!0,ne(vt,_.nativeEvent,_.currentTarget)));return}Ne&&(me.current!=null&&(P.current=me.current),be(_),!Z&&v?n.setOpen(!0,ne(vt,_.nativeEvent,_.currentTarget)):ie(_),Z&&L(_))}},onFocus(_){n.select("open")&&!b&&(P.current=-1,L(_))},onPointerDown:j,onPointerEnter:j,onMouseDown:H,onClick:H}},[ie,ee,d,i,y,L,n,v,l,X,p,me,b]),Xe=g.useMemo(()=>({...ce,...Fe}),[ce,Fe]);return g.useMemo(()=>u?{reference:Xe,floating:ve,item:Re,trigger:Fe}:{},[u,Xe,ve,Fe,Re])}function Fs(e,t){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),s=n.context.dataRef,{listRef:r,activeIndex:c,onMatch:i,onTypingChange:h,enabled:f=!0,findMatch:u=null,resetMs:a=750,ignoreKeys:R=Ot,selectedIndex:x=null}=t,y=$e(),p=g.useRef(""),b=g.useRef(x??c??-1),d=g.useRef(null);te(()=>{o&&(y.clear(),d.current=null,p.current="")},[o,y]),te(()=>{o&&p.current===""&&(b.current=x??c??-1)},[o,x,c]);const m=se(M=>{M?s.current.typing||(s.current.typing=M,h?.(M)):s.current.typing&&(s.current.typing=M,h?.(M))}),v=se(M=>{function O(S,E,B){const A=u?u(E,B):E.find(k=>k?.toLocaleLowerCase().indexOf(B.toLocaleLowerCase())===0);return A?S.indexOf(A):-1}const T=r.current;if(p.current.length>0&&p.current[0]!==" "&&(O(T,T,p.current)===-1?m(!1):M.key===" "&&be(M)),T==null||R.includes(M.key)||M.key.length!==1||M.ctrlKey||M.metaKey||M.altKey)return;o&&M.key!==" "&&(be(M),m(!0)),T.every(S=>S?S[0]?.toLocaleLowerCase()!==S[1]?.toLocaleLowerCase():!0)&&p.current===M.key&&(p.current="",b.current=d.current),p.current+=M.key,y.start(a,()=>{p.current="",b.current=d.current,m(!1)});const D=b.current,V=O(T,[...T.slice((D||0)+1),...T.slice(0,(D||0)+1)],p.current);V!==-1?(i?.(V),d.current=V):M.key!==" "&&(p.current="",m(!1))}),w=g.useMemo(()=>({onKeyDown:v}),[v]),l=g.useMemo(()=>({onKeyDown:v,onKeyUp(M){M.key===" "&&m(!1)}}),[v,m]);return g.useMemo(()=>f?{reference:w,floating:l}:{},[f,w,l])}function Cn(e,t){const[n,o]=e;let s=!1;const r=t.length;for(let c=0,i=r-1;c<r;i=c++){const[h,f]=t[c]||[0,0],[u,a]=t[i]||[0,0];f>=o!=a>=o&&n<=(u-h)*(o-f)/(a-f)+h&&(s=!s)}return s}function Ns(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function Hs(e={}){const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:o=!0}=e,s=new Lo;let r=!1,c=null,i=null,h=typeof performance<"u"?performance.now():0;function f(a,R){const x=performance.now(),y=x-h;if(c===null||i===null||y===0)return c=a,i=R,h=x,null;const p=a-c,b=R-i,m=Math.sqrt(p*p+b*b)/y;return c=a,i=R,h=x,m}const u=({x:a,y:R,placement:x,elements:y,onClose:p,nodeId:b,tree:d})=>function(v){function w(){s.clear(),p()}if(s.clear(),!y.domReference||!y.floating||x==null||a==null||R==null)return;const{clientX:l,clientY:M}=v,O=[l,M],T=Dt(v),N=v.type==="mouseleave",D=ye(y.floating,T),V=ye(y.domReference,T),S=y.domReference.getBoundingClientRect(),E=y.floating.getBoundingClientRect(),B=x.split("-")[0],A=a>E.right-E.width/2,k=R>E.bottom-E.height/2,I=Ns(O,S),C=E.width>S.width,F=E.height>S.height,P=(C?S:E).left,$=(C?S:E).right,Y=(F?S:E).top,L=(F?S:E).bottom;if(D&&(r=!0,!N))return;if(V&&(r=!1),V&&!N){r=!0;return}if(N&&le(v.relatedTarget)&&ye(y.floating,v.relatedTarget)||d&&Do(d.nodesRef.current,b).some(({context:U})=>U?.open))return;if(B==="top"&&R>=S.bottom-1||B==="bottom"&&R<=S.top+1||B==="left"&&a>=S.right-1||B==="right"&&a<=S.left+1)return w();let G=[];switch(B){case"top":G=[[P,S.top+1],[P,E.bottom-1],[$,E.bottom-1],[$,S.top+1]];break;case"bottom":G=[[P,E.top+1],[P,S.bottom-1],[$,S.bottom-1],[$,E.top+1]];break;case"left":G=[[E.right-1,L],[E.right-1,Y],[S.left+1,Y],[S.left+1,L]];break;case"right":G=[[S.right-1,L],[S.right-1,Y],[E.left+1,Y],[E.left+1,L]];break}function q([U,W]){switch(B){case"top":{const oe=[C?U+t/2:A?U+t*4:U-t*4,W+t+1],ee=[C?U-t/2:A?U+t*4:U-t*4,W+t+1],K=[[E.left,A||C?E.bottom-t:E.top],[E.right,A?C?E.bottom-t:E.top:E.bottom-t]];return[oe,ee,...K]}case"bottom":{const oe=[C?U+t/2:A?U+t*4:U-t*4,W-t],ee=[C?U-t/2:A?U+t*4:U-t*4,W-t],K=[[E.left,A||C?E.top+t:E.bottom],[E.right,A?C?E.top+t:E.bottom:E.top+t]];return[oe,ee,...K]}case"left":{const oe=[U+t+1,F?W+t/2:k?W+t*4:W-t*4],ee=[U+t+1,F?W-t/2:k?W+t*4:W-t*4];return[...[[k||F?E.right-t:E.left,E.top],[k?F?E.right-t:E.left:E.right-t,E.bottom]],oe,ee]}case"right":{const oe=[U-t,F?W+t/2:k?W+t*4:W-t*4],ee=[U-t,F?W-t/2:k?W+t*4:W-t*4],K=[[k||F?E.left+t:E.right,E.top],[k?F?E.left+t:E.right:E.left+t,E.bottom]];return[oe,ee,...K]}default:return[]}}if(!Cn([l,M],G)){if(r&&!I)return w();if(!N&&o){const U=f(v.clientX,v.clientY);if(U!==null&&U<.1)return w()}Cn([l,M],q([a,R]))?!r&&o&&s.start(40,w):w()}};return u.__options={blockPointerEvents:n},u}const Bs=g.createContext(void 0);function _s(e){return g.useContext(Bs)}function Vs(e){return e==="starting"?Fo:st}const $s={..._n,..._o},pi=g.forwardRef(function(t,n){const{render:o,className:s,finalFocus:r,...c}=t,{store:i}=Qe(),{side:h,align:f}=Kn(),u=_s()!=null,a=i.useState("open"),R=i.useState("transitionStatus"),x=i.useState("popupProps"),y=i.useState("mounted"),p=i.useState("instantType"),b=i.useState("activeTriggerElement"),d=i.useState("parent"),m=i.useState("lastOpenChangeReason"),v=i.useState("rootId"),w=i.useState("floatingRootContext"),l=i.useState("floatingTreeRoot"),M=i.useState("closeDelay"),O=i.useState("activeTriggerElement"),T=d.type==="context-menu";No({open:a,ref:i.context.popupRef,onComplete(){a&&i.context.onOpenChangeComplete?.(!0)}}),g.useEffect(()=>{function B(A){i.setOpen(!1,ne(A.reason,A.domEvent))}return l.events.on("close",B),()=>{l.events.off("close",B)}},[l.events,i]);const N=i.useState("hoverEnabled"),D=i.useState("disabled");Ts(w,{enabled:N&&!D&&!T&&d.type!=="menubar",closeDelay:M});const V=g.useMemo(()=>({transitionStatus:R,side:h,align:f,open:a,nested:d.type==="menu",instant:p}),[R,h,f,a,d.type,p]),S=pt("div",t,{state:V,ref:[n,i.context.popupRef],stateAttributesMapping:$s,props:[x,{onKeyDown(B){u&&Vo.has(B.key)&&B.stopPropagation()}},Vs(R),c,{"data-rootownerid":v}]});let E=d.type===void 0||T;return(b||d.type==="menubar"&&m!==Ho)&&(E=!0),he.jsx(Bo,{context:w,modal:T,disabled:!y,returnFocus:r===void 0?E:r,initialFocus:d.type!=="menu",restoreFocus:!0,externalTree:d.type!=="menubar"?l:void 0,previousFocusableElement:O,nextFocusableElement:d.type===void 0?i.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:d.type===void 0?i.context.beforeContentFocusGuardRef:void 0,children:S})}),so=g.createContext(void 0);function Ws(){const e=g.useContext(so);if(e===void 0)throw new Error(mt(32));return e}const hi=g.forwardRef(function(t,n){const{keepMounted:o=!1,...s}=t,{store:r}=Qe();return r.useState("mounted")||o?he.jsx(so.Provider,{value:o,children:he.jsx($o,{ref:n,...s})}):null}),Us=g.createContext(void 0);function io(){return g.useContext(Us)?.direction??"ltr"}const zs=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:s,rects:r,platform:c,elements:i,middlewareData:h}=t,{element:f,padding:u=0,offsetParent:a="real"}=Ue(e,t)||{};if(f==null)return{};const R=Xn(u),x={x:n,y:o},y=rn(s),p=on(y),b=await c.getDimensions(f),d=y==="y",m=d?"top":"left",v=d?"bottom":"right",w=d?"clientHeight":"clientWidth",l=r.reference[p]+r.reference[y]-x[y]-r.floating[p],M=x[y]-r.reference[y],O=a==="real"?await c.getOffsetParent?.(f):i.floating;let T=i.floating[w]||r.floating[p];(!T||!await c.isElement?.(O))&&(T=i.floating[w]||r.floating[p]);const N=l/2-M/2,D=T/2-b[p]/2-1,V=Math.min(R[m],D),S=Math.min(R[v],D),E=V,B=T-b[p]-S,A=T/2-b[p]/2+N,k=Xt(E,A,B),I=!h.arrow&&Ge(s)!=null&&A!==k&&r.reference[p]/2-(A<E?V:S)-b[p]/2<0,C=I?A<E?A-E:A-B:0;return{[y]:x[y]+C,data:{[y]:k,centerOffset:A-k-C,...I&&{alignmentOffset:C}},reset:I}}}),Ks=(e,t)=>({...zs(e),options:[e,t]}),js={name:"hide",async fn(e){const{width:t,height:n,x:o,y:s}=e.rects.reference,r=t===0&&n===0&&o===0&&s===0;return{data:{referenceHidden:(await bs().fn(e)).data?.referenceHidden||r}}}},Ys={sideX:"left",sideY:"top"};function co(e,t,n){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?n?"inline-start":"inline-end":"right",bottom:"bottom",left:o?n?"inline-end":"inline-start":"left"}[t]}function On(e,t,n){const{rects:o,placement:s}=e;return{side:co(t,Te(s),n),align:Ge(s)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function Gs(e){const{anchor:t,positionMethod:n="absolute",side:o="bottom",sideOffset:s=0,align:r="center",alignOffset:c=0,collisionBoundary:i,collisionPadding:h=5,sticky:f=!1,arrowPadding:u=5,disableAnchorTracking:a=!1,keepMounted:R=!1,floatingRootContext:x,mounted:y,collisionAvoidance:p,shiftCrossAxis:b=!1,nodeId:d,adaptiveOrigin:m,lazyFlip:v=!1,externalTree:w}=e,[l,M]=g.useState(null);!y&&l!==null&&M(null);const O=p.side||"flip",T=p.align||"flip",N=p.fallbackAxisSide||"end",D=typeof t=="function"?t:void 0,V=se(D),S=D?V:t,E=Ae(t),A=io()==="rtl",k=l||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":A?"left":"right","inline-start":A?"right":"left"}[o],I=r==="center"?k:`${k}-${r}`;let C=h;const F=1,P=o==="bottom"?F:0,$=o==="top"?F:0,Y=o==="right"?F:0,L=o==="left"?F:0;typeof C=="number"?C={top:C+P,right:C+L,bottom:C+$,left:C+Y}:C&&(C={top:(C.top||0)+P,right:(C.right||0)+L,bottom:(C.bottom||0)+$,left:(C.left||0)+Y});const G={boundary:i==="clipping-ancestors"?"clippingAncestors":i,padding:C},q=g.useRef(null),U=Ae(s),W=Ae(c),K=[ps(ae=>{const fe=On(ae,o,A),Ce=typeof U.current=="function"?U.current(fe):U.current,we=typeof W.current=="function"?W.current(fe):W.current;return{mainAxis:Ce,crossAxis:we,alignmentAxis:we}},[typeof s!="function"?s:0,typeof c!="function"?c:0,A,o])],J=T==="none"&&O!=="shift",me=!J&&(f||b||O==="shift"),De=O==="none"?null:xs({...G,padding:{top:C.top+F,right:C.right+F,bottom:C.bottom+F,left:C.left+F},mainAxis:!b&&O==="flip",crossAxis:T==="flip"?"alignment":!1,fallbackAxisSideDirection:N}),Se=J?null:hs(ae=>{const fe=St(ae.elements.floating).documentElement;return{...G,rootBoundary:b?{x:0,y:0,width:fe.clientWidth,height:fe.clientHeight}:void 0,mainAxis:T!=="none",crossAxis:me,limiter:f||b?void 0:ys(Ce=>{if(!q.current)return{};const{width:we,height:Ve}=q.current.getBoundingClientRect(),Ie=ke(Te(Ce.placement)),qe=Ie==="y"?we:Ve,Bt=Ie==="y"?C.left+C.right:C.top+C.bottom;return{offset:qe/2+Bt/2}})}},[G,f,b,C,T]);O==="shift"||T==="shift"||r==="center"?K.push(Se,De):K.push(De,Se),K.push(Rs({...G,apply({elements:{floating:ae},rects:{reference:fe},availableWidth:Ce,availableHeight:we}){Object.entries({"--available-width":`${Ce}px`,"--available-height":`${we}px`,"--anchor-width":`${fe.width}px`,"--anchor-height":`${fe.height}px`}).forEach(([Ve,Ie])=>{ae.style.setProperty(Ve,Ie)})}}),Ks(()=>({element:q.current||document.createElement("div"),padding:u,offsetParent:"floating"}),[u]),{name:"transformOrigin",fn(ae){const{elements:fe,middlewareData:Ce,placement:we,rects:Ve,y:Ie}=ae,qe=Te(we),Bt=ke(qe),an=q.current,uo=Ce.arrow?.x||0,fo=Ce.arrow?.y||0,go=an?.clientWidth||0,mo=an?.clientHeight||0,_t=uo+go/2,ln=fo+mo/2,po=Math.abs(Ce.shift?.y||0),ho=Ve.reference.height/2,it=typeof s=="function"?s(On(ae,o,A)):s,yo=po>it,xo={top:`${_t}px calc(100% + ${it}px)`,bottom:`${_t}px ${-it}px`,left:`calc(100% + ${it}px) ${ln}px`,right:`${-it}px ${ln}px`}[qe],Ro=`${_t}px ${Ve.reference.y+ho-Ie}px`;return fe.floating.style.setProperty("--transform-origin",me&&Bt==="y"&&yo?Ro:xo),{}}},js,m),te(()=>{!y&&x&&x.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[y,x]);const xe=g.useMemo(()=>({elementResize:!a&&typeof ResizeObserver<"u",layoutShift:!a&&typeof IntersectionObserver<"u"}),[a]),{refs:Re,elements:X,x:ie,y:ce,middlewareData:ve,update:Fe,placement:Xe,context:H,isPositioned:j,floatingStyles:_}=vs({rootContext:x,placement:I,middleware:K,strategy:n,whileElementsMounted:R?void 0:(...ae)=>vn(...ae,xe),nodeId:d,externalTree:w}),{sideX:Z,sideY:re}=ve.adaptiveOrigin||Ys,ue=j?n:"fixed",Ne=g.useMemo(()=>m?{position:ue,[Z]:ie,[re]:ce}:{position:ue,..._},[m,ue,Z,ie,re,ce,_]),Be=g.useRef(null);te(()=>{if(!y)return;const ae=E.current,fe=typeof ae=="function"?ae():ae,we=(Mn(fe)?fe.current:fe)||null||null;we!==Be.current&&(Re.setPositionReference(we),Be.current=we)},[y,Re,S,E]),g.useEffect(()=>{if(!y)return;const ae=E.current;typeof ae!="function"&&Mn(ae)&&ae.current!==Be.current&&(Re.setPositionReference(ae.current),Be.current=ae.current)},[y,Re,S,E]),g.useEffect(()=>{if(R&&y&&X.domReference&&X.floating)return vn(X.domReference,X.floating,Fe,xe)},[R,y,X,Fe,xe]);const Pe=Te(Xe),Ee=co(o,Pe,A),He=Ge(Xe)||"center",z=!!ve.hide?.referenceHidden;te(()=>{v&&y&&j&&M(Pe)},[v,y,j,Pe]);const Q=g.useMemo(()=>({position:"absolute",top:ve.arrow?.y,left:ve.arrow?.x}),[ve.arrow]),de=ve.arrow?.centerOffset!==0;return g.useMemo(()=>({positionerStyles:Ne,arrowStyles:Q,arrowRef:q,arrowUncentered:de,side:Ee,align:He,physicalSide:Pe,anchorHidden:z,refs:Re,context:H,isPositioned:j,update:Fe}),[Ne,Q,q,de,Ee,He,Pe,z,Re,H,j,Fe])}function Mn(e){return e!=null&&"current"in e}function Xs(e){const{children:t,elementsRef:n,labelsRef:o,onMapChange:s}=e,r=se(s),c=g.useRef(0),i=Ct(Js).current,h=Ct(qs).current,[f,u]=g.useState(0),a=g.useRef(f),R=se((d,m)=>{h.set(d,m??null),a.current+=1,u(a.current)}),x=se(d=>{h.delete(d),a.current+=1,u(a.current)}),y=g.useMemo(()=>{const d=new Map;return Array.from(h.keys()).filter(v=>v.isConnected).sort(Qs).forEach((v,w)=>{const l=h.get(v)??{};d.set(v,{...l,index:w})}),d},[h,f]);te(()=>{if(typeof MutationObserver!="function"||y.size===0)return;const d=new MutationObserver(m=>{const v=new Set,w=l=>v.has(l)?v.delete(l):v.add(l);m.forEach(l=>{l.removedNodes.forEach(w),l.addedNodes.forEach(w)}),v.size===0&&(a.current+=1,u(a.current))});return y.forEach((m,v)=>{v.parentElement&&d.observe(v.parentElement,{childList:!0})}),()=>{d.disconnect()}},[y]),te(()=>{a.current===f&&(n.current.length!==y.size&&(n.current.length=y.size),o&&o.current.length!==y.size&&(o.current.length=y.size),c.current=y.size),r(y)},[r,y,n,o,f]),te(()=>()=>{n.current=[]},[n]),te(()=>()=>{o&&(o.current=[])},[o]);const p=se(d=>(i.add(d),()=>{i.delete(d)}));te(()=>{i.forEach(d=>d(y))},[i,y]);const b=g.useMemo(()=>({register:R,unregister:x,subscribeMapChange:p,elementsRef:n,labelsRef:o,nextIndexRef:c}),[R,x,p,n,o,c]);return he.jsx(Yn.Provider,{value:b,children:t})}function qs(){return new Map}function Js(){return new Set}function Qs(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const yi=g.forwardRef(function(t,n){const{anchor:o,positionMethod:s="absolute",className:r,render:c,side:i,align:h,sideOffset:f=0,alignOffset:u=0,collisionBoundary:a="clipping-ancestors",collisionPadding:R=5,arrowPadding:x=5,sticky:y=!1,disableAnchorTracking:p=!1,collisionAvoidance:b=Wo,...d}=t,{store:m}=Qe(),v=Ws(),w=Ft(!0),l=m.useState("parent"),M=m.useState("floatingRootContext"),O=m.useState("floatingTreeRoot"),T=m.useState("mounted"),N=m.useState("open"),D=m.useState("modal"),V=m.useState("activeTriggerElement"),S=m.useState("lastOpenChangeReason"),E=m.useState("floatingNodeId"),B=m.useState("floatingParentNodeId");let A=o,k=f,I=u,C=h,F=b;l.type==="context-menu"&&(A=o??l.context?.anchor,C=C??"start",!i&&C!=="center"&&(I=t.alignOffset??2,k=t.sideOffset??-5));let P=i,$=C;l.type==="menu"?(P=P??"inline-end",$=$??"start",F=t.collisionAvoidance??Uo):l.type==="menubar"&&(P=P??"bottom",$=$??"start");const Y=l.type==="context-menu",L=Gs({anchor:A,floatingRootContext:M,positionMethod:w?"fixed":s,mounted:T,side:P,sideOffset:k,align:$,alignOffset:I,arrowPadding:Y?0:x,collisionBoundary:a,collisionPadding:R,sticky:y,nodeId:E,keepMounted:v,disableAnchorTracking:p,collisionAvoidance:F,shiftCrossAxis:Y,externalTree:O}),G=g.useMemo(()=>{const K={};return N||(K.pointerEvents="none"),{role:"presentation",hidden:!T,style:{...L.positionerStyles,...K}}},[N,T,L.positionerStyles]);g.useEffect(()=>{function K(J){J.open?(J.parentNodeId===E&&m.set("hoverEnabled",!1),J.nodeId!==E&&J.parentNodeId===m.select("floatingParentNodeId")&&m.setOpen(!1,ne(ct))):J.parentNodeId===E&&J.reason!==ct&&m.set("hoverEnabled",!0)}return O.events.on("menuopenchange",K),()=>{O.events.off("menuopenchange",K)}},[m,O.events,E]),g.useEffect(()=>{if(m.select("floatingParentNodeId")==null)return;function K(J){if(J.open||J.nodeId!==m.select("floatingParentNodeId"))return;const me=J.reason??ct;m.setOpen(!1,ne(me))}return O.events.on("menuopenchange",K),()=>{O.events.off("menuopenchange",K)}},[O.events,m]),g.useEffect(()=>{function K(J){!N||J.nodeId!==m.select("floatingParentNodeId")||J.target&&V&&V!==J.target&&m.setOpen(!1,ne(ct))}return O.events.on("itemhover",K),()=>{O.events.off("itemhover",K)}},[O.events,N,V,m]),g.useEffect(()=>{const K={open:N,nodeId:E,parentNodeId:B,reason:m.select("lastOpenChangeReason")};O.events.emit("menuopenchange",K)},[O.events,N,m,E,B]);const q=g.useMemo(()=>({open:N,side:L.side,align:L.align,anchorHidden:L.anchorHidden,nested:l.type==="menu"}),[N,L.side,L.align,L.anchorHidden,l.type]),U=g.useMemo(()=>({side:L.side,align:L.align,arrowRef:L.arrowRef,arrowUncentered:L.arrowUncentered,arrowStyles:L.arrowStyles,nodeId:L.context.nodeId}),[L.side,L.align,L.arrowRef,L.arrowUncentered,L.arrowStyles,L.context.nodeId]),W=pt("div",t,{state:q,stateAttributesMapping:_n,ref:[n,m.useStateSetter("positionerElement")],props:[G,d]}),oe=T&&l.type!=="menu"&&(l.type!=="menubar"&&D&&S!==Oe||l.type==="menubar"&&l.context.modal);let ee=null;return l.type==="menubar"?ee=l.context.contentElement:l.type===void 0&&(ee=V),he.jsxs(zn.Provider,{value:U,children:[oe&&he.jsx(zo,{ref:l.type==="context-menu"||l.type==="nested-context-menu"?l.context.internalBackdropRef:null,inert:Ko(!N),cutout:ee}),he.jsx(jo,{id:E,children:he.jsx(Xs,{elementsRef:m.context.itemDomElements,labelsRef:m.context.itemLabels,children:W})})]})}),Zs=g.createContext(null);function ao(e){return g.useContext(Zs)}const ei={...Go,disabled:ge(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:ge(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:ge(e=>e.parent.type==="menu"?e.parent.store.select("allowMouseEnter"):e.allowMouseEnter),stickIfOpen:ge(e=>e.stickIfOpen),parent:ge(e=>e.parent),rootId:ge(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:ge(e=>e.activeIndex),isActive:ge((e,t)=>e.activeIndex===t),hoverEnabled:ge(e=>e.hoverEnabled),instantType:ge(e=>e.instantType),lastOpenChangeReason:ge(e=>e.openChangeReason),floatingTreeRoot:ge(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:ge(e=>e.floatingNodeId),floatingParentNodeId:ge(e=>e.floatingParentNodeId),itemProps:ge(e=>e.itemProps),closeDelay:ge(e=>e.closeDelay),keyboardEventRelay:ge(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class cn extends Yo{constructor(t){super({...ti(),...t},{positionerRef:g.createRef(),popupRef:g.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:g.createRef(),beforeContentFocusGuardRef:g.createRef(),onOpenChangeComplete:void 0,triggerElements:new Nn},ei),this.observe(ge(n=>n.allowMouseEnter),(n,o)=>{this.state.parent.type==="menu"&&n!==o&&this.state.parent.store.set("allowMouseEnter",n)}),this.unsubscribeParentListener=this.observe("parent",n=>{if(this.unsubscribeParentListener?.(),n.type==="menu"){this.unsubscribeParentListener=n.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=n.store.context.allowMouseUpTriggerRef;return}n.type!==void 0&&(this.context.allowMouseUpTriggerRef=n.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:n})}static useStore(t,n){const o=Ct(()=>new cn(n)).current;return t??o}unsubscribeParentListener=null}function ti(){return{...Xo(),disabled:!1,modal:!0,allowMouseEnter:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Vn,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:st,keyboardEventRelay:void 0,closeDelay:0}}const ni=g.createContext(void 0);function oi(){return g.useContext(ni)}function xi(e){const{children:t,open:n,onOpenChange:o,onOpenChangeComplete:s,defaultOpen:r=!1,disabled:c=!1,modal:i,loopFocus:h=!0,orientation:f="vertical",actionsRef:u,closeParentOnEsc:a=!1,handle:R,triggerId:x,defaultTriggerId:y=null,highlightItemOnHover:p=!0}=e,b=Ft(!0),d=Qe(!0),m=ao(),v=oi(),w=g.useMemo(()=>v&&d?{type:"menu",store:d.store}:m?{type:"menubar",context:m}:b&&!d?{type:"context-menu",context:b}:{type:void 0},[b,d,m,v]),l=cn.useStore(R?.store,{parent:w}),M=l.useState("floatingTreeRoot"),O=$n(M),T=yt();te(()=>{b&&!d?l.update({parent:{type:"context-menu",context:b},floatingNodeId:O,floatingParentNodeId:T}):d&&l.update({floatingNodeId:O,floatingParentNodeId:T})},[b,d,O,T,l]),l.useControlledProp("open",n,r),l.useControlledProp("activeTriggerId",x,y),l.useContextCallback("onOpenChangeComplete",s);const N=l.useState("open"),D=l.useState("activeTriggerElement"),V=l.useState("positionerElement"),S=l.useState("hoverEnabled"),E=l.useState("modal"),B=l.useState("disabled"),A=l.useState("lastOpenChangeReason"),k=l.useState("parent"),I=l.useState("activeIndex"),C=l.useState("payload"),F=l.useState("floatingParentNodeId"),P=g.useRef(null),$=F!=null;let Y;l.useSyncedValues({disabled:c,modal:k.type===void 0?i:void 0,rootId:Fn()});const{openMethod:L,triggerProps:G,reset:q}=qo(N);Jo(l);const{forceUnmount:U}=Qo(N,l,()=>{l.update({allowMouseEnter:!1,stickIfOpen:!0}),q()}),W=g.useRef(k.type!=="context-menu"),oe=$e();g.useEffect(()=>{if(N||(P.current=null),k.type==="context-menu"){if(!N){oe.clear(),W.current=!1;return}oe.start(500,()=>{W.current=!0})}},[oe,N,k.type]),Zo(N&&E&&A!==Oe&&L!=="touch",V),te(()=>{!N&&!S&&l.set("hoverEnabled",!0)},[N,S,l]);const ee=g.useRef(!0),K=$e(),J=se((z,Q)=>{const de=Q.reason;if(N===z&&Q.trigger===D&&A===de||(Q.preventUnmountOnClose=()=>{l.set("preventUnmountingOnClose",!0)},!z&&Q.trigger==null&&(Q.trigger=D??void 0),o?.(z,Q),Q.isCanceled))return;const ae={open:z,nativeEvent:Q.event,reason:Q.reason,nested:$};Y?.emit("openchange",ae);const fe=Q.event;if(z===!1&&fe?.type==="click"&&fe.pointerType==="touch"&&!ee.current)return;if(!z&&I!==null){const Ie=l.context.itemDomElements.current[I];queueMicrotask(()=>{Ie?.setAttribute("tabindex","-1")})}z&&de===lt?(ee.current=!1,K.start(300,()=>{ee.current=!0})):(ee.current=!0,K.clear());const Ce=(de===at||de===Pn)&&fe.detail===0&&fe?.isTrusted,we=!z&&(de===Bn||de==null);function Ve(){const Ie={open:z,openChangeReason:de};P.current=Q.event??null;const qe=Q.trigger?.id??null;(qe||z)&&(Ie.activeTriggerId=qe,Ie.activeTriggerElement=Q.trigger??null),l.update(Ie)}de===Oe?gt.flushSync(Ve):Ve(),k.type==="menubar"&&(de===lt||de===Tt||de===Oe||de===vt||de===ct)?l.set("instantType","group"):Ce||we?l.set("instantType",Ce?"click":"dismiss"):l.set("instantType",void 0)}),me=g.useCallback(z=>{const Q=ne(z);return Q.preventUnmountOnClose=()=>{l.set("preventUnmountingOnClose",!0)},Q},[l]),De=g.useCallback(()=>{l.setOpen(!1,me(er))},[l,me]);g.useImperativeHandle(u,()=>({unmount:U,close:De}),[U,De]);let Se;k.type==="context-menu"&&(Se=k.context),g.useImperativeHandle(Se?.positionerRef,()=>V,[V]),g.useImperativeHandle(Se?.actionsRef,()=>({setOpen:J}),[J]);const xe=tr({popupStore:l,onOpenChange:J});Y=xe.context.events,g.useEffect(()=>{const z=({open:Q,eventDetails:de})=>J(Q,de);return Y.on("setOpen",z),()=>{Y?.off("setOpen",z)}},[Y,J]);const Re=nr(xe,{enabled:!B,bubbles:{escapeKey:a&&k.type==="menu"},outsidePress(){return k.type!=="context-menu"||P.current?.type==="contextmenu"?!0:W.current},externalTree:$?M:void 0}),X=or(xe,{role:"menu"}),ie=io(),ce=g.useCallback(z=>{l.select("activeIndex")!==z&&l.set("activeIndex",z)},[l]),ve=Ds(xe,{enabled:!B,listRef:l.context.itemDomElements,activeIndex:I,nested:k.type!==void 0,loopFocus:h,orientation:f,parentOrientation:k.type==="menubar"?k.context.orientation:void 0,rtl:ie==="rtl",disabledIndices:Ot,onNavigate:ce,openOnArrowKeyDown:k.type!=="context-menu",externalTree:$?M:void 0,focusItemOnHover:p}),Fe=g.useCallback(z=>{l.context.typingRef.current=z},[l]),Xe=Fs(xe,{listRef:l.context.itemLabels,activeIndex:I,resetMs:sr,onMatch:z=>{N&&z!==I&&l.set("activeIndex",z)},onTypingChange:Fe}),{getReferenceProps:H,getFloatingProps:j,getItemProps:_,getTriggerProps:Z}=Wn([Re,X,ve,Xe]),re=g.useMemo(()=>{const z=Yt(H(),{onMouseEnter(){l.set("hoverEnabled",!0)},onMouseMove(){l.set("allowMouseEnter",!0)}},G);return delete z.role,z},[H,l,G]),ue=g.useMemo(()=>{const z=Z();if(!z)return z;const Q=Yt(z,G);return delete Q.role,delete Q["aria-controls"],Q},[Z,G]),Ne=An(),Be=g.useMemo(()=>j({onMouseEnter(){k.type==="menu"&&Ne.request(()=>l.set("hoverEnabled",!1))},onMouseMove(){l.set("allowMouseEnter",!0)},onClick(){l.select("hoverEnabled")&&l.set("hoverEnabled",!1)},onKeyDown(z){const Q=l.select("keyboardEventRelay");Q&&!z.isPropagationStopped()&&Q(z)}}),[j,k.type,Ne,l]),Pe=g.useMemo(()=>_(),[_]);l.useSyncedValues({floatingRootContext:xe,activeTriggerProps:re,inactiveTriggerProps:ue,popupProps:Be,itemProps:Pe});const Ee=g.useMemo(()=>({store:l,parent:w}),[l,w]),He=he.jsx(jn.Provider,{value:Ee,children:typeof t=="function"?t({payload:C}):t});return k.type===void 0||k.type==="context-menu"?he.jsx(rr,{externalTree:M,children:He}):He}function ri(e){const t=e.getBoundingClientRect(),n=window.getComputedStyle(e,"::before"),o=window.getComputedStyle(e,"::after");if(!(n.content!=="none"||o.content!=="none"))return t;const r=parseFloat(n.width)||0,c=parseFloat(n.height)||0,i=parseFloat(o.width)||0,h=parseFloat(o.height)||0,f=Math.max(t.width,r,i),u=Math.max(t.height,c,h),a=f-t.width,R=u-t.height;return{left:t.left-a/2,right:t.right+a/2,top:t.top-R/2,bottom:t.bottom+R/2}}function si(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:o}=Un(),{ref:s,index:r}=Gn(e),c=n===r,i=g.useRef(null),h=Tn(s,i);return{compositeProps:g.useMemo(()=>({tabIndex:c?0:-1,onFocus(){o(r)},onMouseMove(){const u=i.current;if(!t||!u)return;const a=u.hasAttribute("disabled")||u.ariaDisabled==="true";!c&&!a&&u.focus()}}),[c,o,r,t]),compositeRef:h,index:r}}function ii(e){const{render:t,className:n,state:o=st,props:s=Ot,refs:r=Ot,metadata:c,stateAttributesMapping:i,tag:h="div",...f}=e,{compositeProps:u,compositeRef:a}=si({metadata:c});return pt(h,e,{state:o,ref:[...r,a],props:[u,...s,f],stateAttributesMapping:i})}function lo(e){if(Le(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!dt(e))return lo(nt(e))}function ci(e){const{enabled:t=!0,mouseDownAction:n,open:o}=e,s=g.useRef(!1);return g.useMemo(()=>t?{onMouseDown:r=>{(n==="open"&&!o||n==="close"&&o)&&(s.current=!0,St(r.currentTarget).addEventListener("click",()=>{s.current=!1},{once:!0}))},onClick:r=>{s.current&&(s.current=!1,r.preventBaseUIHandler())}}:st,[t,n,o])}const wt=2,Ri=g.forwardRef(function(t,n){const{render:o,className:s,disabled:r=!1,nativeButton:c=!0,id:i,openOnHover:h,delay:f=100,closeDelay:u=0,handle:a,payload:R,...x}=t,y=Qe(!0),p=a?.store??y?.store;if(!p)throw new Error(mt(85));const b=In(i),d=p.useState("isTriggerActive",b),m=p.useState("floatingRootContext"),v=p.useState("isOpenedByTrigger",b),w=g.useRef(null),l=li(),M=Un(!0),O=xt(),T=g.useMemo(()=>O??new Vn,[O]),N=$n(T),D=yt(),{registerTrigger:V,isMountedByThisTrigger:S}=ir(b,w,p,{payload:R,closeDelay:u,parent:l,floatingTreeRoot:T,floatingNodeId:N,floatingParentNodeId:D,keyboardEventRelay:M?.relayKeyboardEvent}),E=l.type==="menubar",B=p.useState("disabled"),A=r||B||E&&l.context.disabled,{getButtonProps:k,buttonRef:I}=Sn({disabled:A,native:c});g.useEffect(()=>{!v&&l.type===void 0&&(p.context.allowMouseUpTriggerRef.current=!1)},[p,v,l.type]);const C=g.useRef(null),F=$e(),P=se(X=>{if(!C.current)return;F.clear(),p.context.allowMouseUpTriggerRef.current=!1;const ie=X.target;if(ye(C.current,ie)||ye(p.select("positionerElement"),ie)||ie===C.current||ie!=null&&lo(ie)===p.select("rootId"))return;const ce=ri(C.current);X.clientX>=ce.left-wt&&X.clientX<=ce.right+wt&&X.clientY>=ce.top-wt&&X.clientY<=ce.bottom+wt||T.events.emit("close",{domEvent:X,reason:cr})});g.useEffect(()=>{v&&p.select("lastOpenChangeReason")===Oe&&St(C.current).addEventListener("mouseup",P,{once:!0})},[v,P,p]);const $=E&&l.context.hasSubmenuOpen,L=Is(m,{enabled:(h??$)&&!A&&l.type!=="context-menu"&&(!E||$&&!S),handleClose:Hs({blockPointerEvents:!E}),mouseOnly:!0,move:!1,restMs:l.type===void 0?f:void 0,delay:{close:u},triggerElementRef:w,externalTree:T,isActiveTrigger:d}),G=ai(v,p.select("lastOpenChangeReason")),q=Lr(m,{enabled:!A&&l.type!=="context-menu",event:v&&E?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:l.type===void 0?G:!1}),U=Es(m,{enabled:!A&&$}),W=ci({open:v,enabled:E,mouseDownAction:"open"}),oe=Wn([q,U]),ee=g.useMemo(()=>({disabled:A,open:v}),[A,v]),K=p.useState("triggerProps",S),J=[C,n,I,V,w],me=[oe.getReferenceProps(),L??st,K,{"aria-haspopup":"menu",id:b,onMouseDown:X=>{if(p.select("open"))return;F.start(200,()=>{p.context.allowMouseUpTriggerRef.current=!0}),St(X.currentTarget).addEventListener("mouseup",P,{once:!0})}},E?{role:"menuitem"}:{},W,x,k],De=g.useRef(null),Se=se(X=>{gt.flushSync(()=>{p.setOpen(!1,ne(Tt,X.nativeEvent,X.currentTarget))}),ar(De.current)?.focus()}),xe=se(X=>{const ie=p.select("positionerElement");if(ie&&lr(X,ie))p.context.beforeContentFocusGuardRef.current?.focus();else{gt.flushSync(()=>{p.setOpen(!1,ne(Tt,X.nativeEvent,X.currentTarget))});let ce=ur(p.context.triggerFocusTargetRef.current||w.current);for(;ce!==null&&ye(ie,ce);){const ve=ce;if(ce=fr(ce),ce===ve)break}ce?.focus()}}),Re=pt("button",t,{enabled:!E,stateAttributesMapping:fn,state:ee,ref:J,props:me});return E?he.jsx(ii,{tag:"button",render:o,className:s,state:ee,refs:J,props:me,stateAttributesMapping:fn}):v?he.jsxs(g.Fragment,{children:[he.jsx(dn,{ref:De,onFocus:Se},`${b}-pre-focus-guard`),he.jsx(g.Fragment,{children:Re},b),he.jsx(dn,{ref:p.context.triggerFocusTargetRef,onFocus:xe},`${b}-post-focus-guard`)]}):he.jsx(g.Fragment,{children:Re},b)});function ai(e,t){const n=$e(),[o,s]=g.useState(!1);return te(()=>{e&&t==="trigger-hover"?(s(!0),n.start(dr,()=>{s(!1)})):e||(n.clear(),s(!1))},[e,t,n]),o}function li(){const e=Ft(!0),t=Qe(!0),n=ao();return g.useMemo(()=>n?{type:"menubar",context:n}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,n])}export{xi as M,Ri as a,hi as b,yi as c,pi as d,mi as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e,A as u,B as b}from"./chunk-JZWAC4HX-DC8i-F7r.js";import{c as t,D as i,W as p,b as k,f as N}from"./db-link-CtPnIrIr.js";import{B as v,C as x,a as m,b as h,c as g}from"./button-BaXUPm8v.js";import{B as f}from"./badge-Cd8v3tl3.js";import{T as C,a as w,b as j,c as d,d as L,e as l}from"./table-CTo0I5HG.js";import{E as T}from"./error-card-DmoxS3Ao.js";const B=[{name:"Queued Jobs",key:"totalQueued",description:"Jobs waiting to be processed",color:"text-gray-600 dark:text-gray-400",bgColor:"bg-gray-50 dark:bg-gray-800"},{name:"Active Jobs",key:"totalActive",description:"Jobs currently processing",color:"text-gray-600 dark:text-gray-400",bgColor:"bg-gray-50 dark:bg-gray-800"},{name:"Deferred Jobs",key:"totalDeferred",description:"Jobs scheduled for later",color:"text-gray-600 dark:text-gray-400",bgColor:"bg-gray-50 dark:bg-gray-800"},{name:"Total Jobs",key:"totalJobs",description:"All jobs across queues",color:"text-gray-600 dark:text-gray-400",bgColor:"bg-gray-50 dark:bg-gray-800"}];function A({stats:r}){return e.jsx(e.Fragment,{children:B.map(a=>e.jsx("div",{className:t("overflow-hidden rounded-xl border shadow-sm","bg-white border-gray-200","dark:bg-gray-900 dark:border-gray-800"),children:e.jsx("div",{className:"p-5",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:t("flex-shrink-0 rounded-lg p-3",a.bgColor),children:e.jsx(S,{className:t("h-6 w-6",a.color)})}),e.jsxs("div",{className:"ml-4 flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 truncate",children:a.name}),e.jsx("p",{className:t("text-2xl font-semibold",a.color),children:r[a.key].toLocaleString()})]})]})})},a.key))})}function S({className:r}){return e.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 0 1 3 19.875v-6.75ZM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V8.625ZM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V4.125Z"})})}function M({totalQueues:r,problemQueues:a}){return e.jsx(i,{to:"/queues",className:t("block overflow-hidden rounded-xl border shadow-sm transition-all","bg-white border-gray-200 hover:shadow-md hover:border-gray-300","dark:bg-gray-900 dark:border-gray-800 dark:hover:border-gray-700"),children:e.jsx("div",{className:"p-5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"flex-shrink-0 rounded-lg p-3 bg-gray-50 dark:bg-gray-800",children:e.jsx(Q,{className:"h-6 w-6 text-gray-600 dark:text-gray-400"})}),e.jsxs("div",{className:"ml-4",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Queues"}),e.jsx("p",{className:"text-2xl font-semibold text-gray-600 dark:text-gray-400",children:r.toLocaleString()})]})]}),a>0&&e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"flex-shrink-0 rounded-lg p-3 bg-gray-50 dark:bg-gray-800",children:e.jsx(W,{className:"h-6 w-6 text-amber-600 dark:text-amber-400"})}),e.jsxs("div",{className:"ml-4 text-right",children:[e.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:"Needing Attention"}),e.jsx("p",{className:"text-2xl font-semibold text-amber-600 dark:text-amber-400",children:a.toLocaleString()})]})]})]})})})}function Q({className:r}){return e.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 12h16.5m-16.5 3.75h16.5M3.75 19.5h16.5M5.625 4.5h12.75a1.875 1.875 0 0 1 0 3.75H5.625a1.875 1.875 0 0 1 0-3.75Z"})})}function W({className:r}){return e.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})})}const _=b(function(){return e.jsx(T,{title:"Failed to load dashboard"})}),P=u(function({loaderData:a}){const{stats:y,warnings:n,topQueues:o,queueStats:c}=a;return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"Dashboard"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"Monitor your pg-boss job queues"})]}),e.jsx(i,{to:"/send",children:e.jsx(v,{variant:"primary",size:"md",children:"Send Job"})})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-4",children:"Overview"}),e.jsxs("div",{className:"space-y-5",children:[e.jsx("div",{className:"grid grid-cols-1 gap-5 sm:grid-cols-2",children:e.jsx(M,{totalQueues:c.totalQueues,problemQueues:c.problemQueues})}),e.jsx("div",{className:"grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-4",children:e.jsx(A,{stats:y})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(x,{children:[e.jsx(m,{children:e.jsx(h,{children:"Top Queues"})}),e.jsx(g,{className:"p-0",children:o.length===0?e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 p-6",children:"No queues found"}):e.jsxs(C,{children:[e.jsx(w,{children:e.jsxs(j,{children:[e.jsx(d,{children:"Name"}),e.jsx(d,{className:"text-right hidden md:table-cell",children:"Queued"}),e.jsx(d,{className:"text-right hidden md:table-cell",children:"Active"}),e.jsx(d,{className:"text-right",children:"Total"})]})}),e.jsx(L,{children:o.map(s=>e.jsxs(j,{children:[e.jsx(l,{children:e.jsx(i,{to:`/queues/${encodeURIComponent(s.name)}`,className:"font-medium text-primary-600 hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300",children:s.name})}),e.jsx(l,{className:"text-right text-gray-700 dark:text-gray-300 hidden md:table-cell",children:s.queuedCount.toLocaleString()}),e.jsx(l,{className:"text-right text-gray-700 dark:text-gray-300 hidden md:table-cell",children:s.activeCount.toLocaleString()}),e.jsx(l,{className:"text-right text-gray-700 dark:text-gray-300",children:s.totalCount.toLocaleString()})]},s.name))})]})})]}),e.jsxs(x,{children:[e.jsxs(m,{className:"flex flex-row items-center justify-between",children:[e.jsx(h,{children:"Recent Warnings"}),e.jsx(i,{to:"/warnings",className:"text-sm font-medium text-primary-600 hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300",children:"View all"})]}),e.jsx(g,{children:n.length===0?e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No warnings recorded"}):e.jsx("ul",{className:"space-y-3",children:n.map(s=>e.jsxs("li",{className:t("flex items-start gap-3 p-3 rounded-lg","bg-gray-50 dark:bg-gray-800"),children:[e.jsx(E,{className:"w-5 h-5 text-amber-500 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(f,{variant:k[s.type],size:"sm",children:p[s.type]}),e.jsx("span",{className:"text-xs text-gray-400",children:N(new Date(s.createdOn))})]}),e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 truncate",children:s.message})]})]},s.id))})})]})]})]})});function E({className:r}){return e.jsx("svg",{className:r,fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})})}export{_ as ErrorBoundary,P as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as a}from"./chunk-JZWAC4HX-DC8i-F7r.js";import{c as e,a as s}from"./db-link-CtPnIrIr.js";const d=s("inline-flex items-center gap-1.5 rounded-full font-medium ring-1 ring-inset",{variants:{variant:{gray:"bg-gray-100 text-gray-700 ring-gray-500/10 dark:bg-gray-800 dark:text-gray-300 dark:ring-gray-500/20",primary:"bg-primary-50 text-primary-700 ring-primary-600/10 dark:bg-primary-950 dark:text-primary-300 dark:ring-primary-400/20",success:"bg-green-50 text-green-700 ring-green-600/10 dark:bg-green-950 dark:text-green-300 dark:ring-green-400/20",warning:"bg-warning-50 text-amber-700 ring-warning-600/10 dark:bg-warning-950 dark:text-amber-300 dark:ring-warning-400/20",error:"bg-red-50 text-red-700 ring-red-600/10 dark:bg-red-950 dark:text-red-300 dark:ring-red-400/20"},size:{sm:"px-2 py-0.5 text-xs",md:"px-2.5 py-1 text-xs",lg:"px-3 py-1 text-sm"}},defaultVariants:{variant:"gray",size:"md"}}),m={gray:"bg-gray-500",primary:"bg-primary-500 dark:bg-primary-400",success:"bg-green-500",warning:"bg-warning-500",error:"bg-red-500"};function x({children:g,variant:r="gray",size:n,dot:i=!1,className:t}){return a.jsxs("span",{className:e(d({variant:r,size:n,className:t})),children:[i&&a.jsx("span",{className:e("h-1.5 w-1.5 rounded-full",m[r??"gray"])}),g]})}export{x as B};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as o,a as n}from"./chunk-JZWAC4HX-DC8i-F7r.js";import{c as t,u as g,m as y,a as m}from"./db-link-CtPnIrIr.js";function x({children:r,className:a,...e}){return o.jsx("div",{className:t("bg-white rounded-xl border border-gray-200 shadow-sm overflow-hidden","dark:bg-gray-900 dark:border-gray-800",a),...e,children:r})}function f({children:r,className:a,...e}){return o.jsx("div",{className:t("px-6 py-5 border-b border-gray-200 dark:border-gray-800",a),...e,children:r})}function l({children:r,className:a,...e}){return o.jsx("h3",{className:t("text-lg font-semibold text-gray-900 dark:text-gray-100",a),...e,children:r})}function h({children:r,className:a,...e}){return o.jsx("div",{className:t("px-6 py-5",a),...e,children:r})}const p=m("inline-flex items-center justify-center font-semibold rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed dark:focus:ring-offset-gray-900",{variants:{variant:{primary:"bg-primary-600 text-white hover:bg-primary-700 focus:ring-primary-600 shadow-sm",secondary:"bg-primary-50 text-primary-700 hover:bg-primary-100 focus:ring-primary-600 dark:bg-primary-950 dark:text-primary-300 dark:hover:bg-primary-900",outline:"bg-white text-gray-700 border border-gray-300 hover:bg-gray-50 focus:ring-primary-600 shadow-sm dark:bg-gray-900 dark:text-gray-300 dark:border-gray-700 dark:hover:bg-gray-800",ghost:"text-gray-700 hover:bg-gray-100 focus:ring-primary-600 dark:text-gray-300 dark:hover:bg-gray-800",danger:"bg-red-600 text-white hover:bg-red-700 focus:ring-red-600 shadow-sm"},size:{sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-sm",lg:"px-5 py-2.5 text-base"}},defaultVariants:{variant:"primary",size:"md"}}),b=n.forwardRef(({className:r,variant:a,size:e,render:s,...d},i)=>g({defaultTagName:"button",render:s,props:y({className:t(p({variant:a,size:e,className:r}))},d),ref:i}));b.displayName="Button";export{b as B,x as C,f as a,l as b,h as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as o}from"./createLucideIcon-BXGwbdrh.js";const n=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],e=o("chevron-down",n);export{e as C};
|