@pg-boss/dashboard 1.0.1 → 1.1.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 +25 -173
- package/build/client/assets/MenuTrigger-CEHCnGow.js +1 -0
- package/build/client/assets/{_index-Bcg_-XSd.js → _index-9fLquIe1.js} +1 -1
- package/build/client/assets/{badge-Cd8v3tl3.js → badge-B5ZugmiV.js} +1 -1
- package/build/client/assets/{button-BaXUPm8v.js → button-Djse56Dx.js} +1 -1
- package/build/client/assets/{chevron-down-xu6Uceu-.js → chevron-down-B4tDL9Ah.js} +1 -1
- package/build/client/assets/chunk-LFPYN7LY-Cj1DJmJR.js +26 -0
- package/build/client/assets/{createLucideIcon-BXGwbdrh.js → createLucideIcon-B0YqJFaz.js} +1 -1
- package/build/client/assets/db-link-DmvfwdX4.js +1 -0
- package/build/client/assets/dialog-CQzw3QVH.js +1 -0
- package/build/client/assets/{entry.client-COnaNoy-.js → entry.client-Szv-xmaE.js} +4 -4
- package/build/client/assets/{error-card-DmoxS3Ao.js → error-card-CXoOCvsg.js} +1 -1
- package/build/client/assets/{filter-select-mMC79WOR.js → filter-select-DXyBBVm8.js} +1 -1
- package/build/client/assets/{index-DhMkYPMa.js → index-x2yWco1W.js} +1 -1
- package/build/client/assets/{jobs-DtmTCs8I.js → jobs-CM6xcK-O.js} +1 -1
- package/build/client/assets/manifest-acaa4b8e.js +1 -0
- package/build/client/assets/{pagination-NfhvsUbp.js → pagination-C4yyCmBA.js} +1 -1
- package/build/client/assets/{queues._index-Cw1B49mg.js → queues._index-Dn3ieC5d.js} +1 -1
- package/build/client/assets/{queues._name-D0cG_qDX.js → queues._name-GrviLLx2.js} +1 -1
- package/build/client/assets/{queues._name.jobs._jobId-uJ3dfM3J.js → queues._name.jobs._jobId-s_wYs79w.js} +1 -1
- package/build/client/assets/{queues.create-BGXDhJ3m.js → queues.create-Ch3Mqw52.js} +1 -1
- package/build/client/assets/root-Bpb4WtY4.css +1 -0
- package/build/client/assets/{root-NWrBrGvr.js → root-D0qqtdF7.js} +1 -1
- package/build/client/assets/{schedules-DzgBEayh.js → schedules-DwnuuhxF.js} +1 -1
- package/build/client/assets/{schedules._name._key-i42S9kw2.js → schedules._name._key-DJn-u3Cm.js} +1 -1
- package/build/client/assets/{schedules.new-Dt78KptL.js → schedules.new-CQuE2Uhz.js} +1 -1
- package/build/client/assets/{send-0eWgiWNl.js → send-DVfuC6NR.js} +1 -1
- package/build/client/assets/{table-CTo0I5HG.js → table-CtSLyG7m.js} +1 -1
- package/build/client/assets/useOpenInteractionType-Ss_6xZdw.js +12 -0
- package/build/client/assets/{warnings-BhQM6lFV.js → warnings-DqRQYomb.js} +1 -1
- package/build/server/assets/auth.server-DgTIakNo.js +17 -0
- package/build/server/assets/server-build.js +305 -39
- package/build/server/index.js +5 -0
- package/package.json +16 -15
- package/build/client/assets/MenuTrigger-SThQHnlb.js +0 -1
- package/build/client/assets/chunk-JZWAC4HX-DC8i-F7r.js +0 -26
- package/build/client/assets/db-link-CtPnIrIr.js +0 -1
- package/build/client/assets/dialog-Bl8T588f.js +0 -1
- package/build/client/assets/manifest-25954681.js +0 -1
- package/build/client/assets/root-DJRlbyb5.css +0 -1
- package/build/client/assets/useOpenInteractionType-C_L8nZ_l.js +0 -12
package/README.md
CHANGED
|
@@ -4,14 +4,13 @@ A web-based dashboard for monitoring and managing [pg-boss](https://github.com/t
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **Overview
|
|
8
|
-
- **Queue Management**:
|
|
9
|
-
- **Job
|
|
10
|
-
- **Job
|
|
7
|
+
- **Overview**: Aggregate statistics, problem queues, and recent warnings at a glance
|
|
8
|
+
- **Queue Management**: View all queues with cached statistics and create new queues
|
|
9
|
+
- **Job List**: View jobs with state and queue filtering
|
|
10
|
+
- **Job Details**: View full job payloads, output data, and metadata
|
|
11
11
|
- **Job Actions**: Create, cancel, retry, resume, or delete jobs directly from the UI
|
|
12
|
-
- **Warning History**:
|
|
13
|
-
- **Multi-
|
|
14
|
-
- **Pagination**: Efficiently browse large datasets with cached statistics
|
|
12
|
+
- **Warning History**: When `persistWarnings` is enabled, browse through previously emitted warning events.
|
|
13
|
+
- **Multi-Schema Support**: Monitor multiple pg-boss instances from a single dashboard
|
|
15
14
|
- **Mobile Responsive**: Full functionality on mobile devices with collapsible sidebar
|
|
16
15
|
- **Shareable URLs**: Database selection and filters are preserved in URLs for easy sharing
|
|
17
16
|
|
|
@@ -46,6 +45,21 @@ The dashboard is configured via environment variables:
|
|
|
46
45
|
| `DATABASE_URL` | PostgreSQL connection string(s) | `postgres://localhost/pgboss` |
|
|
47
46
|
| `PGBOSS_SCHEMA` | pg-boss schema name(s) | `pgboss` |
|
|
48
47
|
| `PORT` | Server port | `3000` |
|
|
48
|
+
| `PGBOSS_DASHBOARD_AUTH_USERNAME` | Basic auth username (optional) | - |
|
|
49
|
+
| `PGBOSS_DASHBOARD_AUTH_PASSWORD` | Basic auth password (optional) | - |
|
|
50
|
+
|
|
51
|
+
### Basic Authentication
|
|
52
|
+
|
|
53
|
+
To protect the dashboard with basic authentication, set `PGBOSS_DASHBOARD_AUTH_USERNAME` and `PGBOSS_DASHBOARD_AUTH_PASSWORD`:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
PGBOSS_DASHBOARD_AUTH_USERNAME=admin \
|
|
57
|
+
PGBOSS_DASHBOARD_AUTH_PASSWORD=secret \
|
|
58
|
+
DATABASE_URL="postgres://localhost/mydb" \
|
|
59
|
+
npx pg-boss-dashboard
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Both variables must be provided together. If only one is set, the dashboard will throw an error on startup.
|
|
49
63
|
|
|
50
64
|
### Multi-Database Configuration
|
|
51
65
|
|
|
@@ -139,87 +153,6 @@ server {
|
|
|
139
153
|
}
|
|
140
154
|
```
|
|
141
155
|
|
|
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
156
|
## Enabling Warning Persistence
|
|
224
157
|
|
|
225
158
|
To capture warnings in the dashboard, enable warning persistence in your pg-boss configuration:
|
|
@@ -233,7 +166,7 @@ const boss = new PgBoss({
|
|
|
233
166
|
});
|
|
234
167
|
```
|
|
235
168
|
|
|
236
|
-
|
|
169
|
+
Warnings correlate to `warning` events already emitted by pg-boss:
|
|
237
170
|
- `slow_query`: Queries taking longer than expected
|
|
238
171
|
- `queue_backlog`: Queues exceeding their warning threshold
|
|
239
172
|
- `clock_skew`: Database clock drift detection
|
|
@@ -280,97 +213,16 @@ The `dev:init-db` script creates the pg-boss schema and populates it with sample
|
|
|
280
213
|
|
|
281
214
|
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
215
|
|
|
283
|
-
###
|
|
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
|
|
216
|
+
### Testing
|
|
315
217
|
|
|
316
218
|
```bash
|
|
317
219
|
# All tests (frontend + server)
|
|
318
220
|
npm test
|
|
319
221
|
|
|
320
|
-
#
|
|
321
|
-
npm run
|
|
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
|
|
222
|
+
# Full CI test (used by GitHub Actions)
|
|
223
|
+
npm run ci
|
|
332
224
|
```
|
|
333
225
|
|
|
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
226
|
## Troubleshooting
|
|
375
227
|
|
|
376
228
|
### "Failed to load dashboard"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as g,p as ye}from"./chunk-LFPYN7LY-Cj1DJmJR.js";import{g as ft,m as Kt,h as In,i as dt,E as ot,j as lt,k as jt}from"./db-link-DmvfwdX4.js";import{i as An,u as kn,a as Q,b as Ln,A as Qt,s as be,c as gt,d as We,e as Ue,f as et,t as Zt,g as Eo,h as Ge,j as Co,k as ne,l as Dn,m as Yt,n as ae,o as Ve,p as ze,q as dn,r as Be,v as Ae,w as Fn,x as en,y as tt,z as ut,B as Oo,C as Nn,D as To,E as tn,F as nn,G as At,H as Hn,I as mt,J as Mo,P as Bn,K as pt,L as _n,M as Et,N as pe,O as Ct,Q as it,R as kt,S as Po,T as Ne,U as So,V as Io,W as Vn,X as Ao,Y as ko,Z as Gt,_ as Z,$ as Pe,a0 as Se,a1 as Lo,a2 as Do,a3 as gn,a4 as Rt,a5 as Ot,a6 as Fo,a7 as No,a8 as Ho,a9 as Bo,aa as _o,ab as Vo,ac as $o,ad as $n,ae as Wo,af as Uo,ag as zo,ah as Ko,ai as jo,aj as Yo,ak as Go,al as Xo,am as vt,an as qo,ao as Jo,ap as Wn,aq as Qo,ar as me,as as Zo,at as er,au as Un,av as tr,aw as nr,ax as or,ay as rr,az as sr,aA as ir,aB as cr,aC as ar,aD as lr,aE as zn,aF as ur,aG as Kn,aH as fr,aI as dr,aJ as gr,aK as mr,aL as pr,aM as hr,aN as yr,aO as mn,aP as pn,aQ as xr}from"./useOpenInteractionType-Ss_6xZdw.js";import{a as Tt}from"./index-x2yWco1W.js";const jn=g.createContext(void 0);function Yn(e){const t=g.useContext(jn);if(t===void 0&&!e)throw new Error(ft(33));return t}const Gn=g.createContext(void 0);function qe(e){const t=g.useContext(Gn);if(t===void 0&&!e)throw new Error(ft(36));return t}const br=g.createContext(void 0);function Lt(e=!0){const t=g.useContext(br);if(t===void 0&&!e)throw new Error(ft(25));return t}function Rr(e){const{closeOnClick:t,highlighted:n,id:o,nodeId:s,store:r,itemRef:c,itemMetadata:i}=e,{events:m}=r.useState("floatingTreeRoot"),l=Lt(!0),f=l!==void 0;return g.useMemo(()=>({id:o,role:"menuitem",tabIndex:n?0:-1,onMouseMove(a){s&&m.emit("itemhover",{nodeId:s,target:a.currentTarget})},onClick(a){t&&m.emit("close",{domEvent:a,reason:An})},onMouseUp(a){if(l){const b=l.initialCursorPointRef.current;if(l.initialCursorPointRef.current=null,f&&b&&Math.abs(a.clientX-b.x)<=1&&Math.abs(a.clientY-b.y)<=1)return}c.current&&r.context.allowMouseUpTriggerRef.current&&(!f||a.button===2)&&(!i||i.type==="regular-item")&&c.current.click()}}),[t,n,o,m,s,r,c,l,f,i])}const vr={type:"regular-item"};function wr(e){const{closeOnClick:t,disabled:n=!1,highlighted:o,id:s,store:r,nativeButton:c,itemMetadata:i,nodeId:m}=e,l=g.useRef(null),{getButtonProps:f,buttonRef:a}=kn({disabled:n,focusableWhenDisabled:!0,native:c}),b=Rr({closeOnClick:t,highlighted:o,id:s,nodeId:m,store:r,itemRef:l,itemMetadata:i}),p=g.useCallback(u=>Kt(b,{onMouseEnter(){i.type==="submenu-trigger"&&i.setActive()},onKeyUp(R){R.key===" "&&r.context.typingRef.current&&R.preventBaseUIHandler()}},u,f),[b,f,r,i]),h=In(l,a);return g.useMemo(()=>({getItemProps:p,itemRef:h}),[p,h])}const Xn=g.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Er(){return g.useContext(Xn)}let Cr=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function qn(e={}){const{label:t,metadata:n,textRef:o,indexGuessBehavior:s,index:r}=e,{register:c,unregister:i,subscribeMapChange:m,elementsRef:l,labelsRef:f,nextIndexRef:a}=Er(),b=g.useRef(-1),[p,h]=g.useState(r??(s===Cr.GuessFromOrder?()=>{if(b.current===-1){const d=a.current;a.current+=1,b.current=d}return b.current}:-1)),u=g.useRef(null),R=g.useCallback(d=>{if(u.current=d,p!==-1&&d!==null&&(l.current[p]=d,f)){const y=t!==void 0;f.current[p]=y?t:o?.current?.textContent??d.textContent}},[p,l,f,t,o]);return Q(()=>{if(r!=null)return;const d=u.current;if(d)return c(d,n),()=>{i(d)}},[r,c,i,n]),Q(()=>{if(r==null)return m(d=>{const y=u.current?d.get(u.current)?.index:null;y!=null&&h(y)})},[r,m,h]),g.useMemo(()=>({ref:R,index:p}),[p,R])}const Ri=g.forwardRef(function(t,n){const{render:o,className:s,id:r,label:c,nativeButton:i=!1,disabled:m=!1,closeOnClick:l=!0,...f}=t,a=qn({label:c}),b=Yn(!0),p=Ln(r),{store:h}=qe(),u=h.useState("isActive",a.index),R=h.useState("itemProps"),{getItemProps:d,itemRef:y}=wr({closeOnClick:l,disabled:m,highlighted:u,id:p,store:h,nativeButton:i,nodeId:b?.nodeId,itemMetadata:vr});return dt("div",t,{state:{disabled:m,highlighted:u},props:[R,f,d],ref:[y,n,a.ref]})}),Or=["top","right","bottom","left"],nt=Math.min,Te=Math.max,Mt=Math.round,Qe=Math.floor,Fe=e=>({x:e,y:e}),Tr={left:"right",right:"left",bottom:"top",top:"bottom"},Mr={start:"end",end:"start"};function Xt(e,t,n){return Te(e,nt(t,n))}function _e(e,t){return typeof e=="function"?e(t):e}function Me(e){return e.split("-")[0]}function Ke(e){return e.split("-")[1]}function on(e){return e==="x"?"y":"x"}function rn(e){return e==="y"?"height":"width"}const Pr=new Set(["top","bottom"]);function Ie(e){return Pr.has(Me(e))?"y":"x"}function sn(e){return on(Ie(e))}function Sr(e,t,n){n===void 0&&(n=!1);const o=Ke(e),s=sn(e),r=rn(s);let c=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(c=Pt(c)),[c,Pt(c)]}function Ir(e){const t=Pt(e);return[qt(e),t,qt(t)]}function qt(e){return e.replace(/start|end/g,t=>Mr[t])}const hn=["left","right"],yn=["right","left"],Ar=["top","bottom"],kr=["bottom","top"];function Lr(e,t,n){switch(e){case"top":case"bottom":return n?t?yn:hn:t?hn:yn;case"left":case"right":return t?Ar:kr;default:return[]}}function Dr(e,t,n,o){const s=Ke(e);let r=Lr(Me(e),n==="start",o);return s&&(r=r.map(c=>c+"-"+s),t&&(r=r.concat(r.map(qt)))),r}function Pt(e){return e.replace(/left|right|bottom|top/g,t=>Tr[t])}function Fr(e){return{top:0,right:0,bottom:0,left:0,...e}}function Jn(e){return typeof e!="number"?Fr(e):{top:e,right:e,bottom:e,left:e}}function St(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 yt(e,t,n){return Math.floor(e/t)!==n}function ct(e,t){return t<0||t>=e.current.length}function Bt(e,t){return he(e,{disabledIndices:t})}function xn(e,t){return he(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function he(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&&at(e,r,o));return r}function Nr(e,{event:t,orientation:n,loopFocus:o,rtl:s,cols:r,disabledIndices:c,minIndex:i,maxIndex:m,prevIndex:l,stopEvent:f=!1}){let a=l;const b=[],p={};let h=!1;{let d=null,y=-1;e.current.forEach((E,w)=>{if(E==null)return;const x=E.closest('[role="row"]');x&&(h=!0),(x!==d||y===-1)&&(d=x,y+=1,b[y]=[]),b[y].push(w),p[w]=y})}const u=h&&b.length>0&&b.some(d=>d.length!==r);function R(d){if(!u||l===-1)return;const y=p[l];if(y==null)return;const E=b[y].indexOf(l);let w=d==="up"?y-1:y+1;o&&(w<0?w=b.length-1:w>=b.length&&(w=0));const x=new Set;for(;w>=0&&w<b.length&&!x.has(w);){x.add(w);const v=b[w];if(v.length===0){w=d==="up"?w-1:w+1;continue}const C=Math.min(E,v.length-1);for(let S=C;S>=0;S-=1){const _=v[S];if(!at(e,_,c))return _}w=d==="up"?w-1:w+1,o&&(w<0?w=b.length-1:w>=b.length&&(w=0))}}if(t.key===Qt){const d=R("up");if(d!==void 0)f&&be(t),a=d;else{if(f&&be(t),l===-1)a=m;else if(a=he(e,{startingIndex:a,amount:r,decrement:!0,disabledIndices:c}),o&&(l-r<i||a<0)){const y=l%r,E=m%r,w=m-(E-y);E===y?a=m:a=E>y?w:w-r}ct(e,a)&&(a=l)}}if(t.key===gt){const d=R("down");d!==void 0?(f&&be(t),a=d):(f&&be(t),l===-1?a=i:(a=he(e,{startingIndex:l,amount:r,disabledIndices:c}),o&&l+r>m&&(a=he(e,{startingIndex:l%r-r,amount:r,disabledIndices:c}))),ct(e,a)&&(a=l))}if(n==="both"){const d=Qe(l/r);t.key===(s?We:Ue)&&(f&&be(t),l%r!==r-1?(a=he(e,{startingIndex:l,disabledIndices:c}),o&&yt(a,r,d)&&(a=he(e,{startingIndex:l-l%r-1,disabledIndices:c}))):o&&(a=he(e,{startingIndex:l-l%r-1,disabledIndices:c})),yt(a,r,d)&&(a=l)),t.key===(s?Ue:We)&&(f&&be(t),l%r!==0?(a=he(e,{startingIndex:l,decrement:!0,disabledIndices:c}),o&&yt(a,r,d)&&(a=he(e,{startingIndex:l+(r-l%r),decrement:!0,disabledIndices:c}))):o&&(a=he(e,{startingIndex:l+(r-l%r),decrement:!0,disabledIndices:c})),yt(a,r,d)&&(a=l));const y=Qe(m/r)===d;ct(e,a)&&(o&&y?a=t.key===(s?Ue:We)?m:he(e,{startingIndex:l-l%r-1,disabledIndices:c}):a=l)}return a}function Hr(e,t,n){const o=[];let s=0;return e.forEach(({width:r,height:c},i)=>{let m=!1;for(;!m;){const l=[];for(let f=0;f<r;f+=1)for(let a=0;a<c;a+=1)l.push(s+f+a*t);s%t+r<=t&&l.every(f=>o[f]==null)?(l.forEach(f=>{o[f]=i}),m=!0):s+=1}}),[...o]}function Br(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 _r(e,t){return t.flatMap((n,o)=>e.includes(n)?[o]:[])}function at(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&&!et(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 Vr(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:m=!0,touchOpenDelay:l=0,reason:f=Zt}=t,a=g.useRef(void 0),b=Eo(),p=Ge(),h=g.useMemo(()=>({onPointerDown(u){a.current=u.pointerType},onMouseDown(u){const R=a.current,d=u.nativeEvent,y=n.select("open");if(u.button!==0||r==="click"||et(R,!0)&&i)return;const E=o.current.openEvent,w=E?.type,x=n.select("domReferenceElement")!==u.currentTarget,v=y&&x||!(y&&c&&(!(E&&m)||w==="click"||w==="mousedown"));if(Dn(d.target)){const S=ne(f,d,d.target);v&&R==="touch"&&l>0?p.start(l,()=>{n.setOpen(!0,S)}):n.setOpen(v,S);return}const C=u.currentTarget;b.request(()=>{const S=ne(f,d,C);v&&R==="touch"&&l>0?p.start(l,()=>{n.setOpen(!0,S)}):n.setOpen(v,S)})},onClick(u){if(r==="mousedown-only")return;const R=a.current;if(r==="mousedown"&&R){a.current=void 0;return}if(et(R,!0)&&i)return;const d=n.select("open"),y=o.current.openEvent,E=n.select("domReferenceElement")!==u.currentTarget,w=d&&E||!(d&&c&&(!(y&&m)||Co(y))),x=ne(f,u.nativeEvent,u.currentTarget);w&&R==="touch"&&l>0?p.start(l,()=>{n.setOpen(!0,x)}):n.setOpen(w,x)},onKeyDown(){a.current=void 0}}),[o,r,i,n,m,c,b,p,l,f]);return g.useMemo(()=>s?{reference:h}:ot,[s,h])}function bn(e,t,n){let{reference:o,floating:s}=e;const r=Ie(t),c=sn(t),i=rn(c),m=Me(t),l=r==="y",f=o.x+o.width/2-s.width/2,a=o.y+o.height/2-s.height/2,b=o[i]/2-s[i]/2;let p;switch(m){case"top":p={x:f,y:o.y-s.height};break;case"bottom":p={x:f,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:a};break;case"left":p={x:o.x-s.width,y:a};break;default:p={x:o.x,y:o.y}}switch(Ke(t)){case"start":p[c]-=b*(n&&l?-1:1);break;case"end":p[c]+=b*(n&&l?-1:1);break}return p}async function $r(e,t){var n;t===void 0&&(t={});const{x:o,y:s,platform:r,rects:c,elements:i,strategy:m}=e,{boundary:l="clippingAncestors",rootBoundary:f="viewport",elementContext:a="floating",altBoundary:b=!1,padding:p=0}=_e(t,e),h=Jn(p),R=i[b?a==="floating"?"reference":"floating":a],d=St(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(R)))==null||n?R:R.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(i.floating)),boundary:l,rootBoundary:f,strategy:m})),y=a==="floating"?{x:o,y:s,width:c.floating.width,height:c.floating.height}:c.reference,E=await(r.getOffsetParent==null?void 0:r.getOffsetParent(i.floating)),w=await(r.isElement==null?void 0:r.isElement(E))?await(r.getScale==null?void 0:r.getScale(E))||{x:1,y:1}:{x:1,y:1},x=St(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:y,offsetParent:E,strategy:m}):y);return{top:(d.top-x.top+h.top)/w.y,bottom:(x.bottom-d.bottom+h.bottom)/w.y,left:(d.left-x.left+h.left)/w.x,right:(x.right-d.right+h.right)/w.x}}const Wr=async(e,t,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:r=[],platform:c}=n,i=r.filter(Boolean),m=await(c.isRTL==null?void 0:c.isRTL(t));let l=await c.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:a}=bn(l,o,m),b=o,p={},h=0;for(let R=0;R<i.length;R++){var u;const{name:d,fn:y}=i[R],{x:E,y:w,data:x,reset:v}=await y({x:f,y:a,initialPlacement:o,placement:b,strategy:s,middlewareData:p,rects:l,platform:{...c,detectOverflow:(u=c.detectOverflow)!=null?u:$r},elements:{reference:e,floating:t}});f=E??f,a=w??a,p={...p,[d]:{...p[d],...x}},v&&h<=50&&(h++,typeof v=="object"&&(v.placement&&(b=v.placement),v.rects&&(l=v.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:s}):v.rects),{x:f,y:a}=bn(l,b,m)),R=-1)}return{x:f,y:a,placement:b,strategy:s,middlewareData:p}},Ur=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:m,elements:l}=t,{mainAxis:f=!0,crossAxis:a=!0,fallbackPlacements:b,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:u=!0,...R}=_e(e,t);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const d=Me(s),y=Ie(i),E=Me(i)===i,w=await(m.isRTL==null?void 0:m.isRTL(l.floating)),x=b||(E||!u?[Pt(i)]:Ir(i)),v=h!=="none";!b&&v&&x.push(...Dr(i,u,h,w));const C=[i,...x],S=await m.detectOverflow(t,R),_=[];let P=((o=r.flip)==null?void 0:o.overflows)||[];if(f&&_.push(S[d]),a){const I=Sr(s,c,w);_.push(S[I[0]],S[I[1]])}if(P=[...P,{placement:s,overflows:_}],!_.every(I=>I<=0)){var F,k;const I=(((F=r.flip)==null?void 0:F.index)||0)+1,D=C[I];if(D&&(!(a==="alignment"?y!==Ie(D):!1)||P.every(T=>Ie(T.placement)===y?T.overflows[0]>0:!0)))return{data:{index:I,overflows:P},reset:{placement:D}};let N=(k=P.filter(M=>M.overflows[0]<=0).sort((M,T)=>M.overflows[1]-T.overflows[1])[0])==null?void 0:k.placement;if(!N)switch(p){case"bestFit":{var O;const M=(O=P.filter(T=>{if(v){const L=Ie(T.placement);return L===y||L==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(L=>L>0).reduce((L,B)=>L+B,0)]).sort((T,L)=>T[1]-L[1])[0])==null?void 0:O[0];M&&(N=M);break}case"initialPlacement":N=i;break}if(s!==N)return{reset:{placement:N}}}return{}}}};function Rn(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function vn(e){return Or.some(t=>e[t]>=0)}const zr=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:s="referenceHidden",...r}=_e(e,t);switch(s){case"referenceHidden":{const c=await o.detectOverflow(t,{...r,elementContext:"reference"}),i=Rn(c,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:vn(i)}}}case"escaped":{const c=await o.detectOverflow(t,{...r,altBoundary:!0}),i=Rn(c,n.floating);return{data:{escapedOffsets:i,escaped:vn(i)}}}default:return{}}}}},Qn=new Set(["left","top"]);async function Kr(e,t){const{placement:n,platform:o,elements:s}=e,r=await(o.isRTL==null?void 0:o.isRTL(s.floating)),c=Me(n),i=Ke(n),m=Ie(n)==="y",l=Qn.has(c)?-1:1,f=r&&m?-1:1,a=_e(t,e);let{mainAxis:b,crossAxis:p,alignmentAxis:h}=typeof a=="number"?{mainAxis:a,crossAxis:0,alignmentAxis:null}:{mainAxis:a.mainAxis||0,crossAxis:a.crossAxis||0,alignmentAxis:a.alignmentAxis};return i&&typeof h=="number"&&(p=i==="end"?h*-1:h),m?{x:p*f,y:b*l}:{x:b*l,y:p*f}}const jr=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,m=await Kr(t,e);return c===((n=i.offset)==null?void 0:n.placement)&&(o=i.arrow)!=null&&o.alignmentOffset?{}:{x:s+m.x,y:r+m.y,data:{...m,placement:c}}}}},Yr=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:m={fn:d=>{let{x:y,y:E}=d;return{x:y,y:E}}},...l}=_e(e,t),f={x:n,y:o},a=await r.detectOverflow(t,l),b=Ie(Me(s)),p=on(b);let h=f[p],u=f[b];if(c){const d=p==="y"?"top":"left",y=p==="y"?"bottom":"right",E=h+a[d],w=h-a[y];h=Xt(E,h,w)}if(i){const d=b==="y"?"top":"left",y=b==="y"?"bottom":"right",E=u+a[d],w=u-a[y];u=Xt(E,u,w)}const R=m.fn({...t,[p]:h,[b]:u});return{...R,data:{x:R.x-n,y:R.y-o,enabled:{[p]:c,[b]:i}}}}}},Gr=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:m=!0,crossAxis:l=!0}=_e(e,t),f={x:n,y:o},a=Ie(s),b=on(a);let p=f[b],h=f[a];const u=_e(i,t),R=typeof u=="number"?{mainAxis:u,crossAxis:0}:{mainAxis:0,crossAxis:0,...u};if(m){const E=b==="y"?"height":"width",w=r.reference[b]-r.floating[E]+R.mainAxis,x=r.reference[b]+r.reference[E]-R.mainAxis;p<w?p=w:p>x&&(p=x)}if(l){var d,y;const E=b==="y"?"width":"height",w=Qn.has(Me(s)),x=r.reference[a]-r.floating[E]+(w&&((d=c.offset)==null?void 0:d[a])||0)+(w?0:R.crossAxis),v=r.reference[a]+r.reference[E]+(w?0:((y=c.offset)==null?void 0:y[a])||0)-(w?R.crossAxis:0);h<x?h=x:h>v&&(h=v)}return{[b]:p,[a]:h}}}},Xr=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:m=()=>{},...l}=_e(e,t),f=await c.detectOverflow(t,l),a=Me(s),b=Ke(s),p=Ie(s)==="y",{width:h,height:u}=r.floating;let R,d;a==="top"||a==="bottom"?(R=a,d=b===(await(c.isRTL==null?void 0:c.isRTL(i.floating))?"start":"end")?"left":"right"):(d=a,R=b==="end"?"top":"bottom");const y=u-f.top-f.bottom,E=h-f.left-f.right,w=nt(u-f[R],y),x=nt(h-f[d],E),v=!t.middlewareData.shift;let C=w,S=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(S=E),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(C=y),v&&!b){const P=Te(f.left,0),F=Te(f.right,0),k=Te(f.top,0),O=Te(f.bottom,0);p?S=h-2*(P!==0||F!==0?P+F:Te(f.left,f.right)):C=u-2*(k!==0||O!==0?k+O:Te(f.top,f.bottom))}await m({...t,availableWidth:S,availableHeight:C});const _=await c.getDimensions(i.floating);return h!==_.width||u!==_.height?{reset:{rects:!0}}:{}}}};function Zn(e){const t=Be(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const s=Ae(e),r=s?e.offsetWidth:n,c=s?e.offsetHeight:o,i=Mt(n)!==r||Mt(o)!==c;return i&&(n=r,o=c),{width:n,height:o,$:i}}function cn(e){return ae(e)?e:e.contextElement}function Ze(e){const t=cn(e);if(!Ae(t))return Fe(1);const n=t.getBoundingClientRect(),{width:o,height:s,$:r}=Zn(t);let c=(r?Mt(n.width):n.width)/o,i=(r?Mt(n.height):n.height)/s;return(!c||!Number.isFinite(c))&&(c=1),(!i||!Number.isFinite(i))&&(i=1),{x:c,y:i}}const qr=Fe(0);function eo(e){const t=ze(e);return!Fn()||!t.visualViewport?qr:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Jr(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ze(e)?!1:t}function Xe(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),r=cn(e);let c=Fe(1);t&&(o?ae(o)&&(c=Ze(o)):c=Ze(e));const i=Jr(r,n,o)?eo(r):Fe(0);let m=(s.left+i.x)/c.x,l=(s.top+i.y)/c.y,f=s.width/c.x,a=s.height/c.y;if(r){const b=ze(r),p=o&&ae(o)?ze(o):o;let h=b,u=dn(h);for(;u&&o&&p!==h;){const R=Ze(u),d=u.getBoundingClientRect(),y=Be(u),E=d.left+(u.clientLeft+parseFloat(y.paddingLeft))*R.x,w=d.top+(u.clientTop+parseFloat(y.paddingTop))*R.y;m*=R.x,l*=R.y,f*=R.x,a*=R.y,m+=E,l+=w,h=ze(u),u=dn(h)}}return St({width:f,height:a,x:m,y:l})}function Dt(e,t){const n=At(e).scrollLeft;return t?t.left+n:Xe(Ve(e)).left+n}function to(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Dt(e,n),s=n.top+t.scrollTop;return{x:o,y:s}}function Qr(e){let{elements:t,rect:n,offsetParent:o,strategy:s}=e;const r=s==="fixed",c=Ve(o),i=t?en(t.floating):!1;if(o===c||i&&r)return n;let m={scrollLeft:0,scrollTop:0},l=Fe(1);const f=Fe(0),a=Ae(o);if((a||!a&&!r)&&((tn(o)!=="body"||nn(c))&&(m=At(o)),Ae(o))){const p=Xe(o);l=Ze(o),f.x=p.x+o.clientLeft,f.y=p.y+o.clientTop}const b=c&&!a&&!r?to(c,m):Fe(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-m.scrollLeft*l.x+f.x+b.x,y:n.y*l.y-m.scrollTop*l.y+f.y+b.y}}function Zr(e){return Array.from(e.getClientRects())}function es(e){const t=Ve(e),n=At(e),o=e.ownerDocument.body,s=Te(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),r=Te(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let c=-n.scrollLeft+Dt(e);const i=-n.scrollTop;return Be(o).direction==="rtl"&&(c+=Te(t.clientWidth,o.clientWidth)-s),{width:s,height:r,x:c,y:i}}const wn=25;function ts(e,t){const n=ze(e),o=Ve(e),s=n.visualViewport;let r=o.clientWidth,c=o.clientHeight,i=0,m=0;if(s){r=s.width,c=s.height;const f=Fn();(!f||f&&t==="fixed")&&(i=s.offsetLeft,m=s.offsetTop)}const l=Dt(o);if(l<=0){const f=o.ownerDocument,a=f.body,b=getComputedStyle(a),p=f.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,h=Math.abs(o.clientWidth-a.clientWidth-p);h<=wn&&(r-=h)}else l<=wn&&(r+=l);return{width:r,height:c,x:i,y:m}}const ns=new Set(["absolute","fixed"]);function os(e,t){const n=Xe(e,!0,t==="fixed"),o=n.top+e.clientTop,s=n.left+e.clientLeft,r=Ae(e)?Ze(e):Fe(1),c=e.clientWidth*r.x,i=e.clientHeight*r.y,m=s*r.x,l=o*r.y;return{width:c,height:i,x:m,y:l}}function En(e,t,n){let o;if(t==="viewport")o=ts(e,n);else if(t==="document")o=es(Ve(e));else if(ae(t))o=os(t,n);else{const s=eo(e);o={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return St(o)}function no(e,t){const n=tt(e);return n===t||!ae(n)||ut(n)?!1:Be(n).position==="fixed"||no(n,t)}function rs(e,t){const n=t.get(e);if(n)return n;let o=Yt(e,[],!1).filter(i=>ae(i)&&tn(i)!=="body"),s=null;const r=Be(e).position==="fixed";let c=r?tt(e):e;for(;ae(c)&&!ut(c);){const i=Be(c),m=Nn(c);!m&&i.position==="fixed"&&(s=null),(r?!m&&!s:!m&&i.position==="static"&&!!s&&ns.has(s.position)||nn(c)&&!m&&no(e,c))?o=o.filter(f=>f!==c):s=i,c=tt(c)}return t.set(e,o),o}function ss(e){let{element:t,boundary:n,rootBoundary:o,strategy:s}=e;const c=[...n==="clippingAncestors"?en(t)?[]:rs(t,this._c):[].concat(n),o],i=c[0],m=c.reduce((l,f)=>{const a=En(t,f,s);return l.top=Te(a.top,l.top),l.right=nt(a.right,l.right),l.bottom=nt(a.bottom,l.bottom),l.left=Te(a.left,l.left),l},En(t,i,s));return{width:m.right-m.left,height:m.bottom-m.top,x:m.left,y:m.top}}function is(e){const{width:t,height:n}=Zn(e);return{width:t,height:n}}function cs(e,t,n){const o=Ae(t),s=Ve(t),r=n==="fixed",c=Xe(e,!0,r,t);let i={scrollLeft:0,scrollTop:0};const m=Fe(0);function l(){m.x=Dt(s)}if(o||!o&&!r)if((tn(t)!=="body"||nn(s))&&(i=At(t)),o){const p=Xe(t,!0,r,t);m.x=p.x+t.clientLeft,m.y=p.y+t.clientTop}else s&&l();r&&!o&&s&&l();const f=s&&!o&&!r?to(s,i):Fe(0),a=c.left+i.scrollLeft-m.x-f.x,b=c.top+i.scrollTop-m.y-f.y;return{x:a,y:b,width:c.width,height:c.height}}function Vt(e){return Be(e).position==="static"}function Cn(e,t){if(!Ae(e)||Be(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ve(e)===n&&(n=n.ownerDocument.body),n}function oo(e,t){const n=ze(e);if(en(e))return n;if(!Ae(e)){let s=tt(e);for(;s&&!ut(s);){if(ae(s)&&!Vt(s))return s;s=tt(s)}return n}let o=Cn(e,t);for(;o&&Oo(o)&&Vt(o);)o=Cn(o,t);return o&&ut(o)&&Vt(o)&&!Nn(o)?n:o||To(e)||n}const as=async function(e){const t=this.getOffsetParent||oo,n=this.getDimensions,o=await n(e.floating);return{reference:cs(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function ls(e){return Be(e).direction==="rtl"}const us={convertOffsetParentRelativeRectToViewportRelativeRect:Qr,getDocumentElement:Ve,getClippingRect:ss,getOffsetParent:oo,getElementRects:as,getClientRects:Zr,getDimensions:is,getScale:Ze,isElement:ae,isRTL:ls};function ro(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function fs(e,t){let n=null,o;const s=Ve(e);function r(){var i;clearTimeout(o),(i=n)==null||i.disconnect(),n=null}function c(i,m){i===void 0&&(i=!1),m===void 0&&(m=1),r();const l=e.getBoundingClientRect(),{left:f,top:a,width:b,height:p}=l;if(i||t(),!b||!p)return;const h=Qe(a),u=Qe(s.clientWidth-(f+b)),R=Qe(s.clientHeight-(a+p)),d=Qe(f),E={rootMargin:-h+"px "+-u+"px "+-R+"px "+-d+"px",threshold:Te(0,nt(1,m))||1};let w=!0;function x(v){const C=v[0].intersectionRatio;if(C!==m){if(!w)return c();C?c(!1,C):o=setTimeout(()=>{c(!1,1e-7)},1e3)}C===1&&!ro(l,e.getBoundingClientRect())&&c(),w=!1}try{n=new IntersectionObserver(x,{...E,root:s.ownerDocument})}catch{n=new IntersectionObserver(x,E)}n.observe(e)}return c(!0),r}function On(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:m=!1}=o,l=cn(e),f=s||r?[...l?Yt(l):[],...Yt(t)]:[];f.forEach(d=>{s&&d.addEventListener("scroll",n,{passive:!0}),r&&d.addEventListener("resize",n)});const a=l&&i?fs(l,n):null;let b=-1,p=null;c&&(p=new ResizeObserver(d=>{let[y]=d;y&&y.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var E;(E=p)==null||E.observe(t)})),n()}),l&&!m&&p.observe(l),p.observe(t));let h,u=m?Xe(e):null;m&&R();function R(){const d=Xe(e);u&&!ro(u,d)&&n(),u=d,h=requestAnimationFrame(R)}return n(),()=>{var d;f.forEach(y=>{s&&y.removeEventListener("scroll",n),r&&y.removeEventListener("resize",n)}),a?.(),(d=p)==null||d.disconnect(),p=null,m&&cancelAnimationFrame(h)}}const ds=jr,gs=Yr,ms=Ur,ps=Xr,hs=zr,ys=Gr,xs=(e,t,n)=>{const o=new Map,s={platform:us,...n},r={...s.platform,_c:o};return Wr(e,t,{...s,platform:r})};var bs=typeof document<"u",Rs=function(){},wt=bs?g.useLayoutEffect:Rs;function It(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(!It(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)&&!It(e[r],t[r]))return!1}return!0}return e!==e&&t!==t}function so(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Tn(e,t){const n=so(e);return Math.round(t*n)/n}function $t(e){const t=g.useRef(e);return wt(()=>{t.current=e}),t}function vs(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:m,open:l}=e,[f,a]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[b,p]=g.useState(o);It(b,o)||p(o);const[h,u]=g.useState(null),[R,d]=g.useState(null),y=g.useCallback(T=>{T!==v.current&&(v.current=T,u(T))},[]),E=g.useCallback(T=>{T!==C.current&&(C.current=T,d(T))},[]),w=r||h,x=c||R,v=g.useRef(null),C=g.useRef(null),S=g.useRef(f),_=m!=null,P=$t(m),F=$t(s),k=$t(l),O=g.useCallback(()=>{if(!v.current||!C.current)return;const T={placement:t,strategy:n,middleware:b};F.current&&(T.platform=F.current),xs(v.current,C.current,T).then(L=>{const B={...L,isPositioned:k.current!==!1};I.current&&!It(S.current,B)&&(S.current=B,Tt.flushSync(()=>{a(B)}))})},[b,t,n,F,k]);wt(()=>{l===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,a(T=>({...T,isPositioned:!1})))},[l]);const I=g.useRef(!1);wt(()=>(I.current=!0,()=>{I.current=!1}),[]),wt(()=>{if(w&&(v.current=w),x&&(C.current=x),w&&x){if(P.current)return P.current(w,x,O);O()}},[w,x,O,P,_]);const D=g.useMemo(()=>({reference:v,floating:C,setReference:y,setFloating:E}),[y,E]),N=g.useMemo(()=>({reference:w,floating:x}),[w,x]),M=g.useMemo(()=>{const T={position:n,left:0,top:0};if(!N.floating)return T;const L=Tn(N.floating,f.x),B=Tn(N.floating,f.y);return i?{...T,transform:"translate("+L+"px, "+B+"px)",...so(N.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:B}},[n,i,N.floating,f.x,f.y]);return g.useMemo(()=>({...f,update:O,refs:D,elements:N,floatingStyles:M}),[f,O,D,N,M])}const ws=(e,t)=>({...ds(e),options:[e,t]}),Es=(e,t)=>({...gs(e),options:[e,t]}),Cs=(e,t)=>({...ys(e),options:[e,t]}),Os=(e,t)=>({...ms(e),options:[e,t]}),Ts=(e,t)=>({...ps(e),options:[e,t]}),Ms=(e,t)=>({...hs(e),options:[e,t]});function Ps(e){const{open:t=!1,onOpenChange:n,elements:o={}}=e,s=Hn(),r=mt()!=null,c=lt(()=>new Mo({open:t,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new Bn,floatingId:s,nested:r,noEmit:!1})).current;return Q(()=>{const i={open:t,floatingId:s};o.reference!==void 0&&(i.referenceElement=o.reference,i.domReferenceElement=ae(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=!1,c}function Ss(e={}){const{nodeId:t,externalTree:n}=e,o=Ps(e),s=e.rootContext||o,r={reference:s.useState("referenceElement"),floating:s.useState("floatingElement"),domReference:s.useState("domReferenceElement")},[c,i]=g.useState(null),m=g.useRef(null),l=pt(n);Q(()=>{r.domReference&&(m.current=r.domReference)},[r.domReference]);const f=vs({...e,elements:{...r,...c&&{reference:c}}}),a=g.useCallback(C=>{const S=ae(C)?{getBoundingClientRect:()=>C.getBoundingClientRect(),getClientRects:()=>C.getClientRects(),contextElement:C}:C;i(S),f.refs.setReference(S)},[f.refs]),[b,p]=g.useState(null),[h,u]=g.useState(null);s.useSyncedValue("referenceElement",b),s.useSyncedValue("domReferenceElement",ae(b)?b:null),s.useSyncedValue("floatingElement",h);const R=g.useCallback(C=>{(ae(C)||C===null)&&(m.current=C,p(C)),(ae(f.refs.reference.current)||f.refs.reference.current===null||C!==null&&!ae(C))&&f.refs.setReference(C)},[f.refs,p]),d=g.useCallback(C=>{u(C),f.refs.setFloating(C)},[f.refs]),y=g.useMemo(()=>({...f.refs,setReference:R,setFloating:d,setPositionReference:a,domReference:m}),[f.refs,R,d,a]),E=g.useMemo(()=>({...f.elements,domReference:r.domReference}),[f.elements,r.domReference]),w=s.useState("open"),x=s.useState("floatingId"),v=g.useMemo(()=>({...f,dataRef:s.context.dataRef,open:w,onOpenChange:s.setOpen,events:s.context.events,floatingId:x,refs:y,elements:E,nodeId:t,rootStore:s}),[f,y,E,t,s,w,x]);return Q(()=>{s.context.dataRef.current.floatingContext=v;const C=l?.nodesRef.current.find(S=>S.id===t);C&&(C.context=v)}),g.useMemo(()=>({...f,context:v,refs:y,elements:E,rootStore:s}),[f,y,E,v,s])}const Wt=So&&Io;function Is(e,t={}){const n="rootStore"in e?e.rootStore:e,{events:o,dataRef:s}=n.context,{enabled:r=!0,delay:c}=t,i=g.useRef(!1),m=g.useRef(null),l=Ge(),f=g.useRef(!0);g.useEffect(()=>{const b=n.select("domReferenceElement");if(!r)return;const p=ze(b);function h(){const d=n.select("domReferenceElement");!n.select("open")&&Ae(d)&&d===Et(Ne(d))&&(i.current=!0)}function u(){f.current=!0}function R(){f.current=!1}return p.addEventListener("blur",h),Wt&&(p.addEventListener("keydown",u,!0),p.addEventListener("pointerdown",R,!0)),()=>{p.removeEventListener("blur",h),Wt&&(p.removeEventListener("keydown",u,!0),p.removeEventListener("pointerdown",R,!0))}},[n,r]),g.useEffect(()=>{if(!r)return;function b(p){if(p.reason===Zt||p.reason===Vn){const h=n.select("domReferenceElement");ae(h)&&(m.current=h,i.current=!0)}}return o.on("openchange",b),()=>{o.off("openchange",b)}},[o,r,n]);const a=g.useMemo(()=>({onMouseLeave(){i.current=!1,m.current=null},onFocus(b){const p=b.currentTarget;if(i.current){if(m.current===p)return;i.current=!1,m.current=null}const h=kt(b.nativeEvent);if(ae(h)){if(Wt&&!b.relatedTarget){if(!f.current&&!Dn(h))return}else if(!Po(h))return}const u=Ct(b.relatedTarget,n.context.triggerElements),{nativeEvent:R,currentTarget:d}=b,y=typeof c=="function"?c():c;if(n.select("open")&&u||y===0||y===void 0){n.setOpen(!0,ne(it,R,d));return}l.start(y,()=>{i.current||n.setOpen(!0,ne(it,R,d))})},onBlur(b){i.current=!1,m.current=null;const p=b.relatedTarget,h=b.nativeEvent,u=ae(p)&&p.hasAttribute(_n("focus-guard"))&&p.getAttribute("data-type")==="outside";l.start(0,()=>{const R=n.select("domReferenceElement"),d=Et(R?R.ownerDocument:document);!p&&d===R||pe(s.current.floatingContext?.refs.floating.current,d)||pe(R,d)||u||Ct(p??d,n.context.triggerElements)||n.setOpen(!1,ne(it,h))})}}),[s,n,l,c]);return g.useMemo(()=>r?{reference:a,trigger:a}:{},[r,a])}const Jt=_n("safe-polygon"),As=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${ko}`;function ks(e){return e?!!e.closest(As):!1}class an{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.unbindMouseMove=()=>{},this.restTimeoutPending=!1,this.openChangeTimeout=new Gt,this.restTimeout=new Gt,this.handleCloseOptions=void 0}static create(){return new an}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}function io(e){const t=lt(an.create).current,n=e.context.dataRef.current;return n.hoverInteractionState||(n.hoverInteractionState=t),Ao(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}const Ls=new Set(["click","mousedown"]);function Ds(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:m=0}=t,l=io(n),f=pt(),a=mt(),b=Z(()=>l.interactedInside?!0:c.current.openEvent?Ls.has(c.current.openEvent.type):!1),p=Z(()=>{const E=c.current.openEvent?.type;return E?.includes("mouse")&&E!=="mousedown"}),h=Z(E=>Ct(E,n.context.triggerElements)),u=g.useCallback((E,w=!0)=>{const x=Fs(m,l.pointerType);x&&!l.handler?l.openChangeTimeout.start(x,()=>n.setOpen(!1,ne(Pe,E))):w&&(l.openChangeTimeout.clear(),n.setOpen(!1,ne(Pe,E)))},[m,n,l]),R=Z(()=>{l.unbindMouseMove(),l.handler=void 0}),d=Z(()=>{if(l.performedPointerEventsMutation){const E=Ne(s).body;E.style.pointerEvents="",E.removeAttribute(Jt),l.performedPointerEventsMutation=!1}}),y=Z(E=>{const w=kt(E);if(!ks(w)){l.interactedInside=!1;return}l.interactedInside=!0});Q(()=>{o||(l.pointerType=void 0,l.restTimeoutPending=!1,l.interactedInside=!1,R(),d())},[o,l,R,d]),g.useEffect(()=>()=>{R()},[R]),g.useEffect(()=>d,[d]),Q(()=>{if(i&&o&&l.handleCloseOptions?.blockPointerEvents&&p()&&ae(r)&&s){l.performedPointerEventsMutation=!0;const E=Ne(s).body;E.setAttribute(Jt,"");const w=r,x=s,v=f?.nodesRef.current.find(C=>C.id===a)?.context?.elements.floating;return v&&(v.style.pointerEvents=""),E.style.pointerEvents="none",w.style.pointerEvents="auto",x.style.pointerEvents="auto",()=>{E.style.pointerEvents="",w.style.pointerEvents="",x.style.pointerEvents=""}}},[i,o,r,s,l,p,f,a]),g.useEffect(()=>{if(!i)return;function E(C){b()||!c.current.floatingContext||!n.select("open")||h(C.relatedTarget)||(d(),R(),b()||u(C))}function w(C){l.openChangeTimeout.clear(),d(),l.handler?.(C),R()}function x(C){b()||u(C,!1)}const v=s;return v&&(v.addEventListener("mouseleave",E),v.addEventListener("mouseenter",w),v.addEventListener("mouseleave",x),v.addEventListener("pointerdown",y,!0)),()=>{v&&(v.removeEventListener("mouseleave",E),v.removeEventListener("mouseenter",w),v.removeEventListener("mouseleave",x),v.removeEventListener("pointerdown",y,!0))}},[i,s,n,c,b,h,u,d,R,y,l])}function Fs(e,t){return t&&!et(t)?0:typeof e=="function"?e():e}function Ut(e){return typeof e=="function"?e():e}const Ns={current:null};function Hs(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:m=!1,restMs:l=0,move:f=!0,triggerElementRef:a=Ns,externalTree:b,isActiveTrigger:p=!0}=t,h=pt(b),u=io(n),R=Se(i),d=Se(c),y=Se(l),E=Se(r);p&&(u.handleCloseOptions=R.current?.__options);const w=Z(()=>u.interactedInside?!0:o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1),x=Z(P=>Ct(P,n.context.triggerElements)),v=g.useCallback((P,F=!0)=>{const k=_t(d.current,"close",u.pointerType);k&&!u.handler?u.openChangeTimeout.start(k,()=>n.setOpen(!1,ne(Pe,P))):F&&(u.openChangeTimeout.clear(),n.setOpen(!1,ne(Pe,P)))},[d,n,u]),C=Z(()=>{u.unbindMouseMove(),u.handler=void 0}),S=Z(()=>{if(u.performedPointerEventsMutation){const P=Ne(n.select("domReferenceElement")).body;P.style.pointerEvents="",P.removeAttribute(Jt),u.performedPointerEventsMutation=!1}});g.useEffect(()=>{if(!r)return;function P(F){F.open||(u.openChangeTimeout.clear(),u.restTimeout.clear(),u.blockMouseMove=!0,u.restTimeoutPending=!1)}return s.on("openchange",P),()=>{s.off("openchange",P)}},[r,s,u]);const _=Z(P=>{if(w()||!o.current.floatingContext||x(P.relatedTarget))return;const F=a.current;R.current?.({...o.current.floatingContext,tree:h,x:P.clientX,y:P.clientY,onClose(){S(),C(),!w()&&F===n.select("domReferenceElement")&&v(P)}})(P)});return g.useEffect(()=>{if(!r)return;const P=a.current??(p?n.select("domReferenceElement"):null);if(!ae(P))return;function F(I){if(u.openChangeTimeout.clear(),u.blockMouseMove=!1,m&&!et(u.pointerType)||Ut(y.current)>0&&!_t(d.current,"open"))return;const D=_t(d.current,"open",u.pointerType),N=n.select("domReferenceElement"),M=n.context.triggerElements,T=(M.hasElement(I.target)||M.hasMatchingElement(X=>pe(X,I.target)))&&(!N||!pe(N,I.target)),L=I.currentTarget??null,B=n.select("open"),G=!B||T;T&&B?n.setOpen(!0,ne(Pe,I,L)):D?u.openChangeTimeout.start(D,()=>{G&&n.setOpen(!0,ne(Pe,I,L))}):G&&n.setOpen(!0,ne(Pe,I,L))}function k(I){if(w()){S();return}u.unbindMouseMove();const D=n.select("domReferenceElement"),N=Ne(D);if(u.restTimeout.clear(),u.restTimeoutPending=!1,x(I.relatedTarget))return;if(R.current&&o.current.floatingContext){n.select("open")||u.openChangeTimeout.clear();const T=a.current;u.handler=R.current({...o.current.floatingContext,tree:h,x:I.clientX,y:I.clientY,onClose(){S(),C(),E.current&&!w()&&T===n.select("domReferenceElement")&&v(I,!0)}});const L=u.handler;L(I),N.addEventListener("mousemove",L),u.unbindMouseMove=()=>{N.removeEventListener("mousemove",L)};return}(u.pointerType!=="touch"||!pe(n.select("floatingElement"),I.relatedTarget))&&v(I)}function O(I){_(I)}return n.select("open")&&P.addEventListener("mouseleave",O),f&&P.addEventListener("mousemove",F,{once:!0}),P.addEventListener("mouseenter",F),P.addEventListener("mouseleave",k),()=>{P.removeEventListener("mouseleave",O),f&&P.removeEventListener("mousemove",F),P.removeEventListener("mouseenter",F),P.removeEventListener("mouseleave",k)}},[C,S,o,d,v,n,r,R,_,u,p,w,x,m,f,y,a,h,E]),g.useMemo(()=>{if(!r)return;function P(F){u.pointerType=F.pointerType}return{onPointerDown:P,onPointerEnter:P,onMouseMove(F){const{nativeEvent:k}=F,O=F.currentTarget,I=n.select("domReferenceElement"),D=n.context.triggerElements,N=n.select("open"),M=(D.hasElement(F.target)||D.hasMatchingElement(L=>pe(L,F.target)))&&(!I||!pe(I,F.target));if(m&&!et(u.pointerType)||N&&!M||Ut(y.current)===0||!M&&u.restTimeoutPending&&F.movementX**2+F.movementY**2<2)return;u.restTimeout.clear();function T(){if(u.restTimeoutPending=!1,w())return;const L=n.select("open");!u.blockMouseMove&&(!L||M)&&n.setOpen(!0,ne(Pe,k,O))}u.pointerType==="touch"?Tt.flushSync(()=>{T()}):M&&N?T():(u.restTimeoutPending=!0,u.restTimeout.start(Ut(y.current),T))}}},[r,u,w,m,n,y])}const Bs="Escape";function Ft(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function xt(e,t){return Ft(t,e===Qt||e===gt,e===We||e===Ue)}function zt(e,t,n){return Ft(t,e===gt,n?e===We:e===Ue)||e==="Enter"||e===" "||e===""}function _s(e,t,n){return Ft(t,n?e===We:e===Ue,e===gt)}function Vs(e,t,n,o){const s=n?e===Ue:e===We,r=e===Qt;return t==="both"||t==="horizontal"&&o&&o>1?e===Bs:Ft(t,s,r)}function $s(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:m,onNavigate:l=()=>{},enabled:f=!0,selectedIndex:a=null,allowEscape:b=!1,loopFocus:p=!1,nested:h=!1,rtl:u=!1,virtual:R=!1,focusItemOnOpen:d="auto",focusItemOnHover:y=!0,openOnArrowKeyDown:E=!0,disabledIndices:w=void 0,orientation:x="vertical",parentOrientation:v,cols:C=1,id:S,resetOnPointerLeave:_=!0,externalTree:P}=t,F=Lo(s),k=Se(F),O=mt(),I=pt(P);Q(()=>{c.current.orientation=x},[c,x]);const D=Do(r),N=g.useRef(d),M=g.useRef(a??-1),T=g.useRef(null),L=g.useRef(!0),B=Z(A=>{l(M.current===-1?null:M.current,A)}),G=g.useRef(B),X=g.useRef(!!s),ie=g.useRef(o),V=g.useRef(!1),re=g.useRef(!1),U=Se(w),z=Se(o),se=Se(a),le=Se(_),q=Z(()=>{function A(oe){R?I?.events.emit("virtualfocus",oe):gn(oe,{sync:V.current,preventScroll:!0})}const $=i.current[M.current],H=re.current;$&&A($),(V.current?oe=>oe():requestAnimationFrame)(()=>{const oe=i.current[M.current]||$;if(!oe)return;$||A(oe),j&&(H||!L.current)&&oe.scrollIntoView?.({block:"nearest",inline:"nearest"})})});Q(()=>{f&&(o&&s?(M.current=a??-1,N.current&&a!=null&&(re.current=!0,B())):X.current&&(M.current=-1,G.current()))},[f,o,s,a,B]),Q(()=>{if(f){if(!o){V.current=!1;return}if(s)if(m==null){if(V.current=!1,se.current!=null)return;if(X.current&&(M.current=-1,q()),(!ie.current||!X.current)&&N.current&&(T.current!=null||N.current===!0&&T.current==null)){let A=0;const $=()=>{i.current[0]==null?(A<2&&(A?requestAnimationFrame:queueMicrotask)($),A+=1):(M.current=T.current==null||zt(T.current,x,u)||h?Bt(i):xn(i),T.current=null,B())};$()}}else ct(i,m)||(M.current=m,q(),re.current=!1)}},[f,o,s,m,se,h,i,x,u,B,q,U]),Q(()=>{if(!f||s||!I||R||!X.current)return;const A=I.nodesRef.current,$=A.find(oe=>oe.id===O)?.context?.elements.floating,H=Et(Ne(s)),J=A.some(oe=>oe.context&&pe(oe.context.elements.floating,H));$&&!J&&L.current&&$.focus({preventScroll:!0})},[f,s,I,O,R]),Q(()=>{G.current=B,ie.current=o,X.current=!!s}),Q(()=>{o||(T.current=null,N.current=d)},[o,d]);const ee=m!=null,j=g.useMemo(()=>{function A(H){if(!z.current)return;const J=i.current.indexOf(H.currentTarget);J!==-1&&M.current!==J&&(M.current=J,B(H))}return{onFocus(H){V.current=!0,A(H)},onClick:({currentTarget:H})=>H.focus({preventScroll:!0}),onMouseMove(H){V.current=!0,re.current=!1,y&&A(H)},onPointerLeave(H){if(!z.current||!L.current||H.pointerType==="touch")return;V.current=!0;const J=H.relatedTarget;!y||i.current.includes(J)||le.current&&(gn(null,{sync:!0}),M.current=-1,B(H),R||k.current?.focus({preventScroll:!0}))}}},[z,k,y,i,B,le,R]),xe=g.useCallback(()=>v??I?.nodesRef.current.find(A=>A.id===O)?.context?.dataRef?.current.orientation,[O,I,v]),Ee=Z(A=>{if(L.current=!1,V.current=!0,A.which===229||!z.current&&A.currentTarget===k.current)return;if(h&&Vs(A.key,x,u,C)){xt(A.key,xe())||be(A),n.setOpen(!1,ne(Rt,A.nativeEvent)),Ae(r)&&(R?I?.events.emit("virtualfocus",r):r.focus());return}const $=M.current,H=Bt(i,w),J=xn(i,w);if(D||(A.key==="Home"&&(be(A),M.current=H,B(A)),A.key==="End"&&(be(A),M.current=J,B(A))),C>1){const oe=Array.from({length:i.current.length},()=>({width:1,height:1})),ce=Hr(oe,C),ke=ce.findIndex(ve=>ve!=null&&!at(i,ve,w)),He=ce.reduce((ve,De,$e)=>De!=null&&!at(i,De,w)?$e:ve,-1),Le=ce[Nr({current:ce.map(ve=>ve!=null?i.current[ve]:null)},{event:A,orientation:x,loopFocus:p,rtl:u,cols:C,disabledIndices:_r([...(typeof w!="function"?w:null)||i.current.map((ve,De)=>at(i,De,w)?De:void 0),void 0],ce),minIndex:ke,maxIndex:He,prevIndex:Br(M.current>J?H:M.current,oe,ce,C,A.key===gt?"bl":A.key===(u?We:Ue)?"tr":"tl"),stopEvent:!0})];if(Le!=null&&(M.current=Le,B(A)),x==="both")return}if(xt(A.key,x)){if(be(A),o&&!R&&Et(A.currentTarget.ownerDocument)===A.currentTarget){M.current=zt(A.key,x,u)?H:J,B(A);return}zt(A.key,x,u)?p?$>=J?b&&$!==i.current.length?M.current=-1:(V.current=!1,M.current=H):M.current=he(i,{startingIndex:$,disabledIndices:w}):M.current=Math.min(J,he(i,{startingIndex:$,disabledIndices:w})):p?$<=H?b&&$!==-1?M.current=i.current.length:(V.current=!1,M.current=J):M.current=he(i,{startingIndex:$,decrement:!0,disabledIndices:w}):M.current=Math.max(H,he(i,{startingIndex:$,decrement:!0,disabledIndices:w})),ct(i,M.current)&&(M.current=-1),B(A)}}),Re=g.useMemo(()=>R&&o&&ee&&{"aria-activedescendant":`${S}-${m}`},[R,o,ee,S,m]),ue=g.useMemo(()=>({"aria-orientation":x==="both"?void 0:x,...D?{}:Re,onKeyDown(A){if(A.key==="Tab"&&A.shiftKey&&o&&!R){const $=kt(A.nativeEvent);if($&&!pe(k.current,$))return;be(A),n.setOpen(!1,ne(Ot,A.nativeEvent)),Ae(r)&&r.focus();return}Ee(A)},onPointerMove(){L.current=!0}}),[Re,Ee,k,x,D,n,o,R,r]),K=g.useMemo(()=>{function A(H){d==="auto"&&Fo(H.nativeEvent)&&(N.current=!R)}function $(H){N.current=d,d==="auto"&&No(H.nativeEvent)&&(N.current=!0)}return{onKeyDown(H){const J=n.select("open");L.current=!1;const oe=H.key.startsWith("Arrow"),ce=_s(H.key,xe(),u),ke=xt(H.key,x),He=(h?ce:ke)||H.key==="Enter"||H.key.trim()==="";if(R&&J)return Ee(H);if(!(!J&&!E&&oe)){if(He){const Le=xt(H.key,xe());T.current=h&&Le?null:H.key}if(h){ce&&(be(H),J?(M.current=Bt(i,U.current),B(H)):n.setOpen(!0,ne(Rt,H.nativeEvent,H.currentTarget)));return}ke&&(se.current!=null&&(M.current=se.current),be(H),!J&&E?n.setOpen(!0,ne(Rt,H.nativeEvent,H.currentTarget)):Ee(H),J&&B(H))}},onFocus(H){n.select("open")&&!R&&(M.current=-1,B(H))},onPointerDown:$,onPointerEnter:$,onMouseDown:A,onClick:A}},[Ee,U,d,i,h,B,n,E,x,xe,u,se,R]),fe=g.useMemo(()=>({...Re,...K}),[Re,K]);return g.useMemo(()=>f?{reference:fe,floating:ue,item:j,trigger:K}:{},[f,fe,ue,K,j])}function Ws(e,t){const n="rootStore"in e?e.rootStore:e,o=n.context.dataRef,s=n.useState("open"),{listRef:r,activeIndex:c,onMatch:i,onTypingChange:m,enabled:l=!0,resetMs:f=750,selectedIndex:a=null}=t,b=Ge(),p=g.useRef(""),h=g.useRef(a??c??-1),u=g.useRef(null);Q(()=>{!s&&a!==null||(b.clear(),u.current=null,p.current!==""&&(p.current=""))},[s,a,b]),Q(()=>{s&&p.current===""&&(h.current=a??c??-1)},[s,a,c]);const R=Z(x=>{x?o.current.typing||(o.current.typing=x,m?.(x)):o.current.typing&&(o.current.typing=x,m?.(x))}),d=Z(x=>{function v(k,O,I){const D=O.find(N=>N?.toLocaleLowerCase().indexOf(I.toLocaleLowerCase())===0);return D?k.indexOf(D):-1}const C=r.current;if(p.current.length>0&&p.current[0]!==" "&&(v(C,C,p.current)===-1?R(!1):x.key===" "&&be(x)),C==null||x.key.length!==1||x.ctrlKey||x.metaKey||x.altKey)return;s&&x.key!==" "&&(be(x),R(!0));const S=p.current==="";S&&(h.current=a??c??-1),C.every(k=>k?k[0]?.toLocaleLowerCase()!==k[1]?.toLocaleLowerCase():!0)&&p.current===x.key&&(p.current="",h.current=u.current),p.current+=x.key,b.start(f,()=>{p.current="",h.current=u.current,R(!1)});const P=S?a??c??-1:h.current,F=v(C,[...C.slice((P||0)+1),...C.slice(0,(P||0)+1)],p.current);F!==-1?(i?.(F),u.current=F):x.key!==" "&&(p.current="",R(!1))}),y=Z(x=>{const v=x.relatedTarget,C=n.select("domReferenceElement"),S=n.select("floatingElement"),_=pe(C,v),P=pe(S,v);_||P||(b.clear(),p.current="",h.current=u.current,R(!1))}),E=g.useMemo(()=>({onKeyDown:d,onBlur:y}),[d,y]),w=g.useMemo(()=>({onKeyDown:d,onKeyUp(x){x.key===" "&&R(!1)},onBlur:y}),[d,y,R]);return g.useMemo(()=>l?{reference:E,floating:w}:{},[l,E,w])}function Mn(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[m,l]=t[c]||[0,0],[f,a]=t[i]||[0,0];l>=o!=a>=o&&n<=(f-m)*(o-l)/(a-l)+m&&(s=!s)}return s}function Us(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function zs(e={}){const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:o=!0}=e,s=new Gt;let r=!1,c=null,i=null,m=typeof performance<"u"?performance.now():0;function l(a,b){const p=performance.now(),h=p-m;if(c===null||i===null||h===0)return c=a,i=b,m=p,null;const u=a-c,R=b-i,y=Math.sqrt(u*u+R*R)/h;return c=a,i=b,m=p,y}const f=({x:a,y:b,placement:p,elements:h,onClose:u,nodeId:R,tree:d})=>function(E){function w(){s.clear(),u()}if(s.clear(),!h.domReference||!h.floating||p==null||a==null||b==null)return;const{clientX:x,clientY:v}=E,C=[x,v],S=kt(E),_=E.type==="mouseleave",P=pe(h.floating,S),F=pe(h.domReference,S),k=h.domReference.getBoundingClientRect(),O=h.floating.getBoundingClientRect(),I=p.split("-")[0],D=a>O.right-O.width/2,N=b>O.bottom-O.height/2,M=Us(C,k),T=O.width>k.width,L=O.height>k.height,B=(T?k:O).left,G=(T?k:O).right,X=(L?k:O).top,ie=(L?k:O).bottom;if(P&&(r=!0,!_))return;if(F&&(r=!1),F&&!_){r=!0;return}if(_&&ae(E.relatedTarget)&&pe(h.floating,E.relatedTarget)||d&&Ho(d.nodesRef.current,R).some(({context:U})=>U?.open))return;if(I==="top"&&b>=k.bottom-1||I==="bottom"&&b<=k.top+1||I==="left"&&a>=k.right-1||I==="right"&&a<=k.left+1)return w();let V=[];switch(I){case"top":V=[[B,k.top+1],[B,O.bottom-1],[G,O.bottom-1],[G,k.top+1]];break;case"bottom":V=[[B,O.top+1],[B,k.bottom-1],[G,k.bottom-1],[G,O.top+1]];break;case"left":V=[[O.right-1,ie],[O.right-1,X],[k.left+1,X],[k.left+1,ie]];break;case"right":V=[[k.right-1,ie],[k.right-1,X],[O.left+1,X],[O.left+1,ie]];break}function re([U,z]){switch(I){case"top":{const se=[T?U+t/2:D?U+t*4:U-t*4,z+t+1],le=[T?U-t/2:D?U+t*4:U-t*4,z+t+1],q=[[O.left,D||T?O.bottom-t:O.top],[O.right,D?T?O.bottom-t:O.top:O.bottom-t]];return[se,le,...q]}case"bottom":{const se=[T?U+t/2:D?U+t*4:U-t*4,z-t],le=[T?U-t/2:D?U+t*4:U-t*4,z-t],q=[[O.left,D||T?O.top+t:O.bottom],[O.right,D?T?O.top+t:O.bottom:O.top+t]];return[se,le,...q]}case"left":{const se=[U+t+1,L?z+t/2:N?z+t*4:z-t*4],le=[U+t+1,L?z-t/2:N?z+t*4:z-t*4];return[...[[N||L?O.right-t:O.left,O.top],[N?L?O.right-t:O.left:O.right-t,O.bottom]],se,le]}case"right":{const se=[U-t,L?z+t/2:N?z+t*4:z-t*4],le=[U-t,L?z-t/2:N?z+t*4:z-t*4],q=[[N||L?O.left+t:O.right,O.top],[N?L?O.left+t:O.right:O.left+t,O.bottom]];return[se,le,...q]}default:return[]}}if(!Mn([x,v],V)){if(r&&!M)return w();if(!_&&o){const U=l(E.clientX,E.clientY);if(U!==null&&U<.1)return w()}Mn([x,v],re([a,b]))?!r&&o&&s.start(40,w):w()}};return f.__options={blockPointerEvents:n},f}const Ks=g.createContext(void 0);function js(e){return g.useContext(Ks)}function co(e){return e==="starting"?Bo:ot}const Ys={...$n,...Wo},vi=g.forwardRef(function(t,n){const{render:o,className:s,finalFocus:r,...c}=t,{store:i}=qe(),{side:m,align:l}=Yn(),f=js()!=null,a=i.useState("open"),b=i.useState("transitionStatus"),p=i.useState("popupProps"),h=i.useState("mounted"),u=i.useState("instantType"),R=i.useState("activeTriggerElement"),d=i.useState("parent"),y=i.useState("lastOpenChangeReason"),E=i.useState("rootId"),w=i.useState("floatingRootContext"),x=i.useState("floatingTreeRoot"),v=i.useState("closeDelay"),C=i.useState("activeTriggerElement"),S=d.type==="context-menu";_o({open:a,ref:i.context.popupRef,onComplete(){a&&i.context.onOpenChangeComplete?.(!0)}}),g.useEffect(()=>{function I(D){i.setOpen(!1,ne(D.reason,D.domEvent))}return x.events.on("close",I),()=>{x.events.off("close",I)}},[x.events,i]);const _=i.useState("hoverEnabled"),P=i.useState("disabled");Ds(w,{enabled:_&&!P&&!S&&d.type!=="menubar",closeDelay:v});const F={transitionStatus:b,side:m,align:l,open:a,nested:d.type==="menu",instant:u},k=dt("div",t,{state:F,ref:[n,i.context.popupRef],stateAttributesMapping:Ys,props:[p,{onKeyDown(I){f&&Uo.has(I.key)&&I.stopPropagation()}},co(b),c,{"data-rootownerid":E}]});let O=d.type===void 0||S;return(R||d.type==="menubar"&&y!==Vo)&&(O=!0),ye.jsx($o,{context:w,modal:S,disabled:!h,returnFocus:r===void 0?O:r,initialFocus:d.type!=="menu",restoreFocus:!0,externalTree:d.type!=="menubar"?x:void 0,previousFocusableElement:C,nextFocusableElement:d.type===void 0?i.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:d.type===void 0?i.context.beforeContentFocusGuardRef:void 0,children:k})}),ao=g.createContext(void 0);function Gs(){const e=g.useContext(ao);if(e===void 0)throw new Error(ft(32));return e}const wi=g.forwardRef(function(t,n){const{keepMounted:o=!1,...s}=t,{store:r}=qe();return r.useState("mounted")||o?ye.jsx(ao.Provider,{value:o,children:ye.jsx(zo,{ref:n,...s})}):null}),Xs=g.createContext(void 0);function lo(){return g.useContext(Xs)?.direction??"ltr"}const qs=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:s,rects:r,platform:c,elements:i,middlewareData:m}=t,{element:l,padding:f=0,offsetParent:a="real"}=_e(e,t)||{};if(l==null)return{};const b=Jn(f),p={x:n,y:o},h=sn(s),u=rn(h),R=await c.getDimensions(l),d=h==="y",y=d?"top":"left",E=d?"bottom":"right",w=d?"clientHeight":"clientWidth",x=r.reference[u]+r.reference[h]-p[h]-r.floating[u],v=p[h]-r.reference[h],C=a==="real"?await c.getOffsetParent?.(l):i.floating;let S=i.floating[w]||r.floating[u];(!S||!await c.isElement?.(C))&&(S=i.floating[w]||r.floating[u]);const _=x/2-v/2,P=S/2-R[u]/2-1,F=Math.min(b[y],P),k=Math.min(b[E],P),O=F,I=S-R[u]-k,D=S/2-R[u]/2+_,N=Xt(O,D,I),M=!m.arrow&&Ke(s)!=null&&D!==N&&r.reference[u]/2-(D<O?F:k)-R[u]/2<0,T=M?D<O?D-O:D-I:0;return{[h]:p[h]+T,data:{[h]:N,centerOffset:D-N-T,...M&&{alignmentOffset:T}},reset:M}}}),Js=(e,t)=>({...qs(e),options:[e,t]}),Qs={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 Ms().fn(e)).data?.referenceHidden||r}}}},Zs={sideX:"left",sideY:"top"};function uo(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 Pn(e,t,n){const{rects:o,placement:s}=e;return{side:uo(t,Me(s),n),align:Ke(s)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function ei(e){const{anchor:t,positionMethod:n="absolute",side:o="bottom",sideOffset:s=0,align:r="center",alignOffset:c=0,collisionBoundary:i,collisionPadding:m=5,sticky:l=!1,arrowPadding:f=5,disableAnchorTracking:a=!1,keepMounted:b=!1,floatingRootContext:p,mounted:h,collisionAvoidance:u,shiftCrossAxis:R=!1,nodeId:d,adaptiveOrigin:y,lazyFlip:E=!1,externalTree:w}=e,[x,v]=g.useState(null);!h&&x!==null&&v(null);const C=u.side||"flip",S=u.align||"flip",_=u.fallbackAxisSide||"end",P=typeof t=="function"?t:void 0,F=Z(P),k=P?F:t,O=Se(t),D=lo()==="rtl",N=x||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":D?"left":"right","inline-start":D?"right":"left"}[o],M=r==="center"?N:`${N}-${r}`;let T=m;const L=1,B=o==="bottom"?L:0,G=o==="top"?L:0,X=o==="right"?L:0,ie=o==="left"?L:0;typeof T=="number"?T={top:T+B,right:T+ie,bottom:T+G,left:T+X}:T&&(T={top:(T.top||0)+B,right:(T.right||0)+ie,bottom:(T.bottom||0)+G,left:(T.left||0)+X});const V={boundary:i==="clipping-ancestors"?"clippingAncestors":i,padding:T},re=g.useRef(null),U=Se(s),z=Se(c),q=[ws(te=>{const de=Pn(te,o,D),Ce=typeof U.current=="function"?U.current(de):U.current,we=typeof z.current=="function"?z.current(de):z.current;return{mainAxis:Ce,crossAxis:we,alignmentAxis:we}},[typeof s!="function"?s:0,typeof c!="function"?c:0,D,o])],ee=S==="none"&&C!=="shift",j=!ee&&(l||R||C==="shift"),xe=C==="none"?null:Os({...V,padding:{top:T.top+L,right:T.right+L,bottom:T.bottom+L,left:T.left+L},mainAxis:!R&&C==="flip",crossAxis:S==="flip"?"alignment":!1,fallbackAxisSideDirection:_}),Ee=ee?null:Es(te=>{const de=Ne(te.elements.floating).documentElement;return{...V,rootBoundary:R?{x:0,y:0,width:de.clientWidth,height:de.clientHeight}:void 0,mainAxis:S!=="none",crossAxis:j,limiter:l||R?void 0:Cs(Ce=>{if(!re.current)return{};const{width:we,height:Oe}=re.current.getBoundingClientRect(),Ye=Ie(Me(Ce.placement)),Je=Ye==="y"?we:Oe,Nt=Ye==="y"?T.left+T.right:T.top+T.bottom;return{offset:Je/2+Nt/2}})}},[V,l,R,T,S]);C==="shift"||S==="shift"||r==="center"?q.push(Ee,xe):q.push(xe,Ee),q.push(Ts({...V,apply({elements:{floating:te},rects:{reference:de},availableWidth:Ce,availableHeight:we}){const Oe=te.style;Oe.setProperty("--available-width",`${Ce}px`),Oe.setProperty("--available-height",`${we}px`),Oe.setProperty("--anchor-width",`${de.width}px`),Oe.setProperty("--anchor-height",`${de.height}px`)}}),Js(()=>({element:re.current||document.createElement("div"),padding:f,offsetParent:"floating"}),[f]),{name:"transformOrigin",fn(te){const{elements:de,middlewareData:Ce,placement:we,rects:Oe,y:Ye}=te,Je=Me(we),Nt=Ie(Je),un=re.current,mo=Ce.arrow?.x||0,po=Ce.arrow?.y||0,ho=un?.clientWidth||0,yo=un?.clientHeight||0,Ht=mo+ho/2,fn=po+yo/2,xo=Math.abs(Ce.shift?.y||0),bo=Oe.reference.height/2,st=typeof s=="function"?s(Pn(te,o,D)):s,Ro=xo>st,vo={top:`${Ht}px calc(100% + ${st}px)`,bottom:`${Ht}px ${-st}px`,left:`calc(100% + ${st}px) ${fn}px`,right:`${-st}px ${fn}px`}[Je],wo=`${Ht}px ${Oe.reference.y+bo-Ye}px`;return de.floating.style.setProperty("--transform-origin",j&&Nt==="y"&&Ro?wo:vo),{}}},Qs,y),Q(()=>{!h&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[h,p]);const Re=g.useMemo(()=>({elementResize:!a&&typeof ResizeObserver<"u",layoutShift:!a&&typeof IntersectionObserver<"u"}),[a]),{refs:ue,elements:K,x:fe,y:A,middlewareData:$,update:H,placement:J,context:oe,isPositioned:ce,floatingStyles:ke}=Ss({rootContext:p,placement:M,middleware:q,strategy:n,whileElementsMounted:b?void 0:(...te)=>On(...te,Re),nodeId:d,externalTree:w}),{sideX:He,sideY:Le}=$.adaptiveOrigin||Zs,ve=ce?n:"fixed",De=g.useMemo(()=>{const te=y?{position:ve,[He]:fe,[Le]:A}:{position:ve,...ke};return ce||(te.opacity=0),te},[y,ve,He,fe,Le,A,ke,ce]),$e=g.useRef(null);Q(()=>{if(!h)return;const te=O.current,de=typeof te=="function"?te():te,we=(Sn(de)?de.current:de)||null||null;we!==$e.current&&(ue.setPositionReference(we),$e.current=we)},[h,ue,k,O]),g.useEffect(()=>{if(!h)return;const te=O.current;typeof te!="function"&&Sn(te)&&te.current!==$e.current&&(ue.setPositionReference(te.current),$e.current=te.current)},[h,ue,k,O]),g.useEffect(()=>{if(b&&h&&K.domReference&&K.floating)return On(K.domReference,K.floating,H,Re)},[b,h,K,H,Re]);const je=Me(J),ht=uo(o,je,D),rt=Ke(J)||"center",W=!!$.hide?.referenceHidden;Q(()=>{E&&h&&ce&&v(je)},[E,h,ce,je]);const Y=g.useMemo(()=>({position:"absolute",top:$.arrow?.y,left:$.arrow?.x}),[$.arrow]),ge=$.arrow?.centerOffset!==0;return g.useMemo(()=>({positionerStyles:De,arrowStyles:Y,arrowRef:re,arrowUncentered:ge,side:ht,align:rt,physicalSide:je,anchorHidden:W,refs:ue,context:oe,isPositioned:ce,update:H}),[De,Y,re,ge,ht,rt,je,W,ue,oe,ce,H])}function Sn(e){return e!=null&&"current"in e}function ti(e){const{children:t,elementsRef:n,labelsRef:o,onMapChange:s}=e,r=Z(s),c=g.useRef(0),i=lt(oi).current,m=lt(ni).current,[l,f]=g.useState(0),a=g.useRef(l),b=Z((d,y)=>{m.set(d,y??null),a.current+=1,f(a.current)}),p=Z(d=>{m.delete(d),a.current+=1,f(a.current)}),h=g.useMemo(()=>{const d=new Map;return Array.from(m.keys()).filter(E=>E.isConnected).sort(ri).forEach((E,w)=>{const x=m.get(E)??{};d.set(E,{...x,index:w})}),d},[m,l]);Q(()=>{if(typeof MutationObserver!="function"||h.size===0)return;const d=new MutationObserver(y=>{const E=new Set,w=x=>E.has(x)?E.delete(x):E.add(x);y.forEach(x=>{x.removedNodes.forEach(w),x.addedNodes.forEach(w)}),E.size===0&&(a.current+=1,f(a.current))});return h.forEach((y,E)=>{E.parentElement&&d.observe(E.parentElement,{childList:!0})}),()=>{d.disconnect()}},[h]),Q(()=>{a.current===l&&(n.current.length!==h.size&&(n.current.length=h.size),o&&o.current.length!==h.size&&(o.current.length=h.size),c.current=h.size),r(h)},[r,h,n,o,l]),Q(()=>()=>{n.current=[]},[n]),Q(()=>()=>{o&&(o.current=[])},[o]);const u=Z(d=>(i.add(d),()=>{i.delete(d)}));Q(()=>{i.forEach(d=>d(h))},[i,h]);const R=g.useMemo(()=>({register:b,unregister:p,subscribeMapChange:u,elementsRef:n,labelsRef:o,nextIndexRef:c}),[b,p,u,n,o,c]);return ye.jsx(Xn.Provider,{value:R,children:t})}function ni(){return new Map}function oi(){return new Set}function ri(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 Ei=g.forwardRef(function(t,n){const{anchor:o,positionMethod:s="absolute",className:r,render:c,side:i,align:m,sideOffset:l=0,alignOffset:f=0,collisionBoundary:a="clipping-ancestors",collisionPadding:b=5,arrowPadding:p=5,sticky:h=!1,disableAnchorTracking:u=!1,collisionAvoidance:R=Ko,...d}=t,{store:y}=qe(),E=Gs(),w=Lt(!0),x=y.useState("parent"),v=y.useState("floatingRootContext"),C=y.useState("floatingTreeRoot"),S=y.useState("mounted"),_=y.useState("open"),P=y.useState("modal"),F=y.useState("activeTriggerElement"),k=y.useState("transitionStatus"),O=y.useState("lastOpenChangeReason"),I=y.useState("floatingNodeId"),D=y.useState("floatingParentNodeId");let N=o,M=l,T=f,L=m,B=R;x.type==="context-menu"&&(N=o??x.context?.anchor,L=L??"start",!i&&L!=="center"&&(T=t.alignOffset??2,M=t.sideOffset??-5));let G=i,X=L;x.type==="menu"?(G=G??"inline-end",X=X??"start",B=t.collisionAvoidance??jo):x.type==="menubar"&&(G=G??"bottom",X=X??"start");const ie=x.type==="context-menu",V=ei({anchor:N,floatingRootContext:v,positionMethod:w?"fixed":s,mounted:S,side:G,sideOffset:M,align:X,alignOffset:T,arrowPadding:ie?0:p,collisionBoundary:a,collisionPadding:b,sticky:h,nodeId:I,keepMounted:E,disableAnchorTracking:u,collisionAvoidance:B,shiftCrossAxis:ie&&!("side"in B&&B.side==="flip"),externalTree:C}),re=g.useMemo(()=>{const ee={};return _||(ee.pointerEvents="none"),{role:"presentation",hidden:!S,style:{...V.positionerStyles,...ee}}},[_,S,V.positionerStyles]);g.useEffect(()=>{function ee(j){j.open&&(j.parentNodeId===I&&y.set("hoverEnabled",!1),j.nodeId!==I&&j.parentNodeId===y.select("floatingParentNodeId")&&y.setOpen(!1,ne(vt)))}return C.events.on("menuopenchange",ee),()=>{C.events.off("menuopenchange",ee)}},[y,C.events,I]),g.useEffect(()=>{if(y.select("floatingParentNodeId")==null)return;function ee(j){if(j.open||j.nodeId!==y.select("floatingParentNodeId"))return;const xe=j.reason??vt;y.setOpen(!1,ne(xe))}return C.events.on("menuopenchange",ee),()=>{C.events.off("menuopenchange",ee)}},[C.events,y]),g.useEffect(()=>{function ee(j){!_||j.nodeId!==y.select("floatingParentNodeId")||j.target&&F&&F!==j.target&&y.setOpen(!1,ne(vt))}return C.events.on("itemhover",ee),()=>{C.events.off("itemhover",ee)}},[C.events,_,F,y]),g.useEffect(()=>{const ee={open:_,nodeId:I,parentNodeId:D,reason:y.select("lastOpenChangeReason")};C.events.emit("menuopenchange",ee)},[C.events,_,y,I,D]);const U={open:_,side:V.side,align:V.align,anchorHidden:V.anchorHidden,nested:x.type==="menu"},z=g.useMemo(()=>({side:V.side,align:V.align,arrowRef:V.arrowRef,arrowUncentered:V.arrowUncentered,arrowStyles:V.arrowStyles,nodeId:V.context.nodeId}),[V.side,V.align,V.arrowRef,V.arrowUncentered,V.arrowStyles,V.context.nodeId]),se=dt("div",t,{state:U,stateAttributesMapping:$n,ref:[n,y.useStateSetter("positionerElement")],props:[re,co(k),d]}),le=S&&x.type!=="menu"&&(x.type!=="menubar"&&P&&O!==Pe||x.type==="menubar"&&x.context.modal);let q=null;return x.type==="menubar"?q=x.context.contentElement:x.type===void 0&&(q=F),ye.jsxs(jn.Provider,{value:z,children:[le&&ye.jsx(Yo,{ref:x.type==="context-menu"||x.type==="nested-context-menu"?x.context.internalBackdropRef:null,inert:Go(!_),cutout:q}),ye.jsx(Xo,{id:I,children:ye.jsx(ti,{elementsRef:y.context.itemDomElements,labelsRef:y.context.itemLabels,children:se})})]})}),si=g.createContext(null);function fo(e){return g.useContext(si)}const ii={...Jo,disabled:me(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:me(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:me(e=>e.allowMouseEnter),stickIfOpen:me(e=>e.stickIfOpen),parent:me(e=>e.parent),rootId:me(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:me(e=>e.activeIndex),isActive:me((e,t)=>e.activeIndex===t),hoverEnabled:me(e=>e.hoverEnabled),instantType:me(e=>e.instantType),lastOpenChangeReason:me(e=>e.openChangeReason),floatingTreeRoot:me(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:me(e=>e.floatingNodeId),floatingParentNodeId:me(e=>e.floatingParentNodeId),itemProps:me(e=>e.itemProps),closeDelay:me(e=>e.closeDelay),keyboardEventRelay:me(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class ln extends qo{constructor(t){super({...ci(),...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 Bn},ii),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=lt(()=>new ln(n)).current;return t??o}unsubscribeParentListener=null}function ci(){return{...Qo(),disabled:!1,modal:!0,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Wn,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:ot,keyboardEventRelay:void 0,closeDelay:0}}const ai=g.createContext(void 0);function li(){return g.useContext(ai)}const Ci=Zo(function(t){const{children:n,open:o,onOpenChange:s,onOpenChangeComplete:r,defaultOpen:c=!1,disabled:i=!1,modal:m,loopFocus:l=!0,orientation:f="vertical",actionsRef:a,closeParentOnEsc:b=!1,handle:p,triggerId:h,defaultTriggerId:u=null,highlightItemOnHover:R=!0}=t,d=Lt(!0),y=qe(!0),E=fo(!0),w=li(),x=g.useMemo(()=>w&&y?{type:"menu",store:y.store}:E?{type:"menubar",context:E}:d&&!y?{type:"context-menu",context:d}:{type:void 0},[d,y,E,w]),v=ln.useStore(p?.store,{open:c,openProp:o,activeTriggerId:u,triggerIdProp:h,parent:x});er(()=>{o===void 0&&v.state.open===!1&&c===!0&&v.update({open:!0,activeTriggerId:u})}),v.useControlledProp("openProp",o),v.useControlledProp("triggerIdProp",h),v.useContextCallback("onOpenChangeComplete",r);const C=v.useState("floatingTreeRoot"),S=Un(C),_=mt();Q(()=>{d&&!y?v.update({parent:{type:"context-menu",context:d},floatingNodeId:S,floatingParentNodeId:_}):y&&v.update({floatingNodeId:S,floatingParentNodeId:_})},[d,y,S,_,v]);const P=v.useState("open"),F=v.useState("activeTriggerElement"),k=v.useState("positionerElement"),O=v.useState("hoverEnabled"),I=v.useState("modal"),D=v.useState("disabled"),N=v.useState("lastOpenChangeReason"),M=v.useState("parent"),T=v.useState("activeIndex"),L=v.useState("payload"),B=v.useState("floatingParentNodeId"),G=g.useRef(null),X=B!=null;let ie;v.useSyncedValues({disabled:i,modal:M.type===void 0?m:void 0,rootId:Hn()});const{openMethod:V,triggerProps:re,reset:U}=tr(P);nr(v);const{forceUnmount:z}=or(P,v,()=>{v.update({allowMouseEnter:!1,stickIfOpen:!0}),U()}),se=g.useRef(M.type!=="context-menu"),le=Ge();g.useEffect(()=>{if(P||(G.current=null),M.type==="context-menu"){if(!P){le.clear(),se.current=!1;return}le.start(500,()=>{se.current=!0})}},[le,P,M.type]),rr(P&&I&&N!==Pe&&V!=="touch",k),Q(()=>{!P&&!O&&v.set("hoverEnabled",!0)},[P,O,v]);const q=g.useRef(!0),ee=Ge(),j=Z((W,Y)=>{const ge=Y.reason;if(P===W&&Y.trigger===F&&N===ge||(Y.preventUnmountOnClose=()=>{v.set("preventUnmountingOnClose",!0)},!W&&Y.trigger==null&&(Y.trigger=F??void 0),s?.(W,Y),Y.isCanceled))return;const te={open:W,nativeEvent:Y.event,reason:Y.reason,nested:X};ie?.emit("openchange",te);const de=Y.event;if(W===!1&&de?.type==="click"&&de.pointerType==="touch"&&!q.current)return;if(!W&&T!==null){const Je=v.context.itemDomElements.current[T];queueMicrotask(()=>{Je?.setAttribute("tabindex","-1")})}W&&ge===it?(q.current=!1,ee.start(300,()=>{q.current=!0})):(q.current=!0,ee.clear());const Ce=(ge===Zt||ge===An)&&de.detail===0&&de?.isTrusted,we=!W&&(ge===Vn||ge==null),Oe={open:W,openChangeReason:ge};G.current=Y.event??null;const Ye=Y.trigger?.id??null;(Ye||W)&&(Oe.activeTriggerId=Ye,Oe.activeTriggerElement=Y.trigger??null),v.update(Oe),M.type==="menubar"&&(ge===it||ge===Ot||ge===Pe||ge===Rt||ge===vt)?v.set("instantType","group"):Ce||we?v.set("instantType",Ce?"click":"dismiss"):v.set("instantType",void 0)}),xe=g.useCallback(W=>{const Y=ne(W);return Y.preventUnmountOnClose=()=>{v.set("preventUnmountingOnClose",!0)},Y},[v]),Ee=g.useCallback(()=>{v.setOpen(!1,xe(sr))},[v,xe]);g.useImperativeHandle(a,()=>({unmount:z,close:Ee}),[z,Ee]);let Re;M.type==="context-menu"&&(Re=M.context),g.useImperativeHandle(Re?.positionerRef,()=>k,[k]),g.useImperativeHandle(Re?.actionsRef,()=>({setOpen:j}),[j]);const ue=ir({popupStore:v,onOpenChange:j});ie=ue.context.events,g.useEffect(()=>{const W=({open:Y,eventDetails:ge})=>j(Y,ge);return ie.on("setOpen",W),()=>{ie?.off("setOpen",W)}},[ie,j]);const K=cr(ue,{enabled:!D,bubbles:{escapeKey:b&&M.type==="menu"},outsidePress(){return M.type!=="context-menu"||G.current?.type==="contextmenu"?!0:se.current},externalTree:X?C:void 0}),fe=ar(ue,{role:"menu"}),A=lo(),$=g.useCallback(W=>{v.select("activeIndex")!==W&&v.set("activeIndex",W)},[v]),H=$s(ue,{enabled:!D,listRef:v.context.itemDomElements,activeIndex:T,nested:M.type!==void 0,loopFocus:l,orientation:f,parentOrientation:M.type==="menubar"?M.context.orientation:void 0,rtl:A==="rtl",disabledIndices:jt,onNavigate:$,openOnArrowKeyDown:M.type!=="context-menu",externalTree:X?C:void 0,focusItemOnHover:R}),J=g.useCallback(W=>{v.context.typingRef.current=W},[v]),oe=Ws(ue,{listRef:v.context.itemLabels,activeIndex:T,resetMs:lr,onMatch:W=>{P&&W!==T&&v.set("activeIndex",W)},onTypingChange:J}),{getReferenceProps:ce,getFloatingProps:ke,getItemProps:He,getTriggerProps:Le}=zn([K,fe,H,oe]),ve=g.useMemo(()=>{const W=Kt(ce(),{onMouseMove(){v.set("allowMouseEnter",!0)}},re);return delete W.role,W},[ce,v,re]),De=g.useMemo(()=>{const W=Le();if(!W)return W;const Y=Kt(W,re);return delete Y.role,delete Y["aria-controls"],Y},[Le,re]),$e=g.useMemo(()=>ke({onMouseMove(){v.set("allowMouseEnter",!0),M.type==="menu"&&v.set("hoverEnabled",!1)},onClick(){v.select("hoverEnabled")&&v.set("hoverEnabled",!1)},onKeyDown(W){const Y=v.select("keyboardEventRelay");Y&&!W.isPropagationStopped()&&Y(W)}}),[ke,M.type,v]),je=g.useMemo(()=>He(),[He]);v.useSyncedValues({floatingRootContext:ue,activeTriggerProps:ve,inactiveTriggerProps:De,popupProps:$e,itemProps:je});const ht=g.useMemo(()=>({store:v,parent:x}),[v,x]),rt=ye.jsx(Gn.Provider,{value:ht,children:typeof n=="function"?n({payload:L}):n});return M.type===void 0||M.type==="context-menu"?ye.jsx(ur,{externalTree:C,children:rt}):rt});function ui(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,m=parseFloat(o.height)||0,l=Math.max(t.width,r,i),f=Math.max(t.height,c,m),a=l-t.width,b=f-t.height;return{left:t.left-a/2,right:t.right+a/2,top:t.top-b/2,bottom:t.bottom+b/2}}function fi(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:o}=Kn(),{ref:s,index:r}=qn(e),c=n===r,i=g.useRef(null),m=In(s,i);return{compositeProps:g.useMemo(()=>({tabIndex:c?0:-1,onFocus(){o(r)},onMouseMove(){const f=i.current;if(!t||!f)return;const a=f.hasAttribute("disabled")||f.ariaDisabled==="true";!c&&!a&&f.focus()}}),[c,o,r,t]),compositeRef:m,index:r}}function di(e){const{render:t,className:n,state:o=ot,props:s=jt,refs:r=jt,metadata:c,stateAttributesMapping:i,tag:m="div",...l}=e,{compositeProps:f,compositeRef:a}=fi({metadata:c});return dt(m,e,{state:o,ref:[...r,a],props:[f,...s,l],stateAttributesMapping:i})}function go(e){if(Ae(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!ut(e))return go(tt(e))}function gi(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,Ne(r.currentTarget).addEventListener("click",()=>{s.current=!1},{once:!0}))},onClick:r=>{s.current&&(s.current=!1,r.preventBaseUIHandler())}}:ot,[t,n,o])}const bt=2,Oi=fr(function(t,n){const{render:o,className:s,disabled:r=!1,nativeButton:c=!0,id:i,openOnHover:m,delay:l=100,closeDelay:f=0,handle:a,payload:b,...p}=t,h=qe(!0),u=a?.store??h?.store;if(!u)throw new Error(ft(85));const R=Ln(i),d=u.useState("isTriggerActive",R),y=u.useState("floatingRootContext"),E=u.useState("isOpenedByTrigger",R),w=g.useRef(null),x=pi(),v=Kn(!0),C=pt(),S=g.useMemo(()=>C??new Wn,[C]),_=Un(S),P=mt(),{registerTrigger:F,isMountedByThisTrigger:k}=dr(R,w,u,{payload:b,closeDelay:f,parent:x,floatingTreeRoot:S,floatingNodeId:_,floatingParentNodeId:P,keyboardEventRelay:v?.relayKeyboardEvent}),O=x.type==="menubar",I=u.useState("disabled"),D=r||I||O&&x.context.disabled,{getButtonProps:N,buttonRef:M}=kn({disabled:D,native:c});g.useEffect(()=>{!E&&x.type===void 0&&(u.context.allowMouseUpTriggerRef.current=!1)},[u,E,x.type]);const T=g.useRef(null),L=Ge(),B=Z(K=>{if(!T.current)return;L.clear(),u.context.allowMouseUpTriggerRef.current=!1;const fe=K.target;if(pe(T.current,fe)||pe(u.select("positionerElement"),fe)||fe===T.current||fe!=null&&go(fe)===u.select("rootId"))return;const A=ui(T.current);K.clientX>=A.left-bt&&K.clientX<=A.right+bt&&K.clientY>=A.top-bt&&K.clientY<=A.bottom+bt||S.events.emit("close",{domEvent:K,reason:gr})});g.useEffect(()=>{E&&u.select("lastOpenChangeReason")===Pe&&Ne(T.current).addEventListener("mouseup",B,{once:!0})},[E,B,u]);const G=O&&x.context.hasSubmenuOpen,ie=Hs(y,{enabled:(m??G)&&!D&&x.type!=="context-menu"&&(!O||G&&!k),handleClose:zs({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:x.type===void 0?l:void 0,delay:{close:f},triggerElementRef:w,externalTree:S,isActiveTrigger:d}),V=mi(E,u.select("lastOpenChangeReason")),re=Vr(y,{enabled:!D&&x.type!=="context-menu",event:E&&O?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:x.type===void 0?V:!1}),U=Is(y,{enabled:!D&&G}),z=gi({open:E,enabled:O,mouseDownAction:"open"}),se=zn([re,U]),le={disabled:D,open:E},q=u.useState("triggerProps",k),ee=[T,n,M,F,w],j=[se.getReferenceProps(),ie??ot,q,{"aria-haspopup":"menu",id:R,onMouseDown:K=>{if(u.select("open"))return;L.start(200,()=>{u.context.allowMouseUpTriggerRef.current=!0}),Ne(K.currentTarget).addEventListener("mouseup",B,{once:!0})}},O?{role:"menuitem"}:{},z,p,N],xe=g.useRef(null),Ee=Z(K=>{Tt.flushSync(()=>{u.setOpen(!1,ne(Ot,K.nativeEvent,K.currentTarget))}),mr(xe.current)?.focus()}),Re=Z(K=>{const fe=u.select("positionerElement");if(fe&&pr(K,fe))u.context.beforeContentFocusGuardRef.current?.focus();else{Tt.flushSync(()=>{u.setOpen(!1,ne(Ot,K.nativeEvent,K.currentTarget))});let A=hr(u.context.triggerFocusTargetRef.current||w.current);for(;A!==null&&pe(fe,A);){const $=A;if(A=yr(A),A===$)break}A?.focus()}}),ue=dt("button",t,{enabled:!O,stateAttributesMapping:mn,state:le,ref:ee,props:j});return O?ye.jsx(di,{tag:"button",render:o,className:s,state:le,refs:ee,props:j,stateAttributesMapping:mn}):E?ye.jsxs(g.Fragment,{children:[ye.jsx(pn,{ref:xe,onFocus:Ee},`${R}-pre-focus-guard`),ye.jsx(g.Fragment,{children:ue},R),ye.jsx(pn,{ref:u.context.triggerFocusTargetRef,onFocus:Re},`${R}-post-focus-guard`)]}):ye.jsx(g.Fragment,{children:ue},R)});function mi(e,t){const n=Ge(),[o,s]=g.useState(!1);return Q(()=>{e&&t==="trigger-hover"?(s(!0),n.start(xr,()=>{s(!1)})):e||(n.clear(),s(!1))},[e,t,n]),o}function pi(){const e=Lt(!0),t=qe(!0),n=fo();return g.useMemo(()=>n?{type:"menubar",context:n}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,n])}export{Ci as M,Oi as a,wi as b,Ei as c,vi as d,Ri as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,A as u,B as b}from"./chunk-
|
|
1
|
+
import{p as e,A as u,B as b}from"./chunk-LFPYN7LY-Cj1DJmJR.js";import{c as t,D as i,W as p,b as k,f as N}from"./db-link-DmvfwdX4.js";import{B as v,C as x,a as m,b as h,c as g}from"./button-Djse56Dx.js";import{B as f}from"./badge-B5ZugmiV.js";import{T as C,a as w,b as j,c as d,d as L,e as l}from"./table-CtSLyG7m.js";import{E as T}from"./error-card-CXoOCvsg.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as a}from"./chunk-
|
|
1
|
+
import{p as a}from"./chunk-LFPYN7LY-Cj1DJmJR.js";import{c as e,a as s}from"./db-link-DmvfwdX4.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as o,a as n}from"./chunk-
|
|
1
|
+
import{p as o,a as n}from"./chunk-LFPYN7LY-Cj1DJmJR.js";import{c as t,u as g,m as y,a as m}from"./db-link-DmvfwdX4.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as o}from"./createLucideIcon-
|
|
1
|
+
import{c as o}from"./createLucideIcon-B0YqJFaz.js";const n=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],e=o("chevron-down",n);export{e as C};
|