@brickkit/cli 0.7.3 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +173 -1
  2. package/dashboard-dist/CollapsiblePanel-DM8J3g8m.js +2 -0
  3. package/dashboard-dist/Geist-Variable.woff2 +0 -0
  4. package/dashboard-dist/GeistMono-Variable.woff2 +0 -0
  5. package/dashboard-dist/PopoverPopup-B6eMOlOC.js +1 -0
  6. package/dashboard-dist/api-reference-wTdT1AVt.js +260 -0
  7. package/dashboard-dist/app.css +2 -0
  8. package/dashboard-dist/app.js +18 -0
  9. package/dashboard-dist/core-CHWYtApw.js +1 -0
  10. package/dashboard-dist/docs-DflzpIIh.js +4 -0
  11. package/dashboard-dist/docs.css +1 -0
  12. package/dashboard-dist/preload-helper-CVJ-D494.js +1 -0
  13. package/dashboard-dist/react-jsx-runtime.js +4 -0
  14. package/dashboard-dist/react.js +3 -0
  15. package/dashboard-dist/rolldown-runtime-XKyaHtl9.js +1 -0
  16. package/dist/bin.d.ts.map +1 -1
  17. package/dist/bin.js +17 -6
  18. package/dist/bin.js.map +1 -1
  19. package/dist/dev-reporter.d.ts +15 -0
  20. package/dist/dev-reporter.d.ts.map +1 -0
  21. package/dist/dev-reporter.js +28 -0
  22. package/dist/dev-reporter.js.map +1 -0
  23. package/dist/dev-telemetry-store.js +1897 -0
  24. package/dist/dev-telemetry-store.js.map +1 -0
  25. package/dist/dev-telemetry.js +199 -0
  26. package/dist/dev-telemetry.js.map +1 -0
  27. package/dist/dev-worker.js +54 -9
  28. package/dist/dev-worker.js.map +1 -1
  29. package/dist/index.d.ts +24 -0
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/runner.js +157 -8
  32. package/dist/runner.js.map +1 -1
  33. package/dist/vite.d.ts +11 -0
  34. package/dist/vite.d.ts.map +1 -1
  35. package/dist/vite.js +104 -6
  36. package/dist/vite.js.map +1 -1
  37. package/package.json +42 -4
  38. package/dist/port-utils.js +0 -13
  39. package/dist/port-utils.js.map +0 -1
package/README.md CHANGED
@@ -23,7 +23,7 @@ Every command except `dev` and `start` takes a required `<entry>`: a module
23
23
  whose default export is a `BrickApp` that does not call `.listen()`.
24
24
 
25
25
  ```sh
26
- brick dev [entry] [--port 4000]
26
+ brick dev [entry] [--port 4000] [--dashboard-port 9400] [--history-days 90] [--no-dashboard]
27
27
  brick start [entry] [--port 4000]
28
28
  brick build <entry> [--outdir dist/brick] [--port <number>] [--no-aot]
29
29
  brick gen openapi <entry> [--output openapi.json]
@@ -57,6 +57,167 @@ brick info src/app.ts
57
57
 
58
58
  Source: <https://github.com/Chandraprakash-Darji/brick>.
59
59
 
60
+ ## Local dashboard
61
+
62
+ `brick dev` with an entry also serves a dashboard at
63
+ `http://127.0.0.1:9400`. It lists requests as they run, shows a waterfall of
64
+ each request's action and remote-call spans, and collects failures and reloads,
65
+ including startup crashes. The live views survive restarts within the same session.
66
+
67
+ Requests appear only from apps that opt in with `telemetry: true`. `brick dev`
68
+ warns when the dashboard is on but the entry doesn't set it:
69
+
70
+ ```ts
71
+ const app = brick({ services: [pagesService], telemetry: true });
72
+ ```
73
+
74
+ ```sh
75
+ brick dev src/app.ts # dashboard on 9400
76
+ brick dev src/app.ts --dashboard-port 9500 # another port
77
+ brick dev src/app.ts --history-days 30 # keep a month of requests
78
+ brick dev src/app.ts --history-days 0 # live requests only, nothing on disk
79
+ brick dev src/app.ts --no-dashboard # API only
80
+ ```
81
+
82
+ The dashboard is a React app in `packages/cli/dashboard`, styled with Tailwind
83
+ and shadcn components. `bun run --filter @brickkit/cli build` bundles it into
84
+ `dashboard-dist`, which the package ships (about 2 MB, most of it the API
85
+ reference, which loads only when the APIs tab opens). See
86
+ `packages/cli/dashboard/README.md`.
87
+
88
+ The Overview tab draws the app as a graph of clients, services, and databases,
89
+ with each service's actions and tools and each database's name, engine, and
90
+ tables. Calls, durations, and health fill in from recent requests. Below it are
91
+ each HTTP route with its action and recent request and failure counts, and the
92
+ services with their databases and resources. SQL statements appear as child
93
+ spans under the action that ran them, with the statement text on hover. Spans
94
+ are colored by type: request, action, service call, and SQL.
95
+
96
+ The APIs tab renders the app's OpenAPI documents with Fumadocs OpenAPI, in the
97
+ dashboard's colors, so the app serves no reference page of its own. A sidebar
98
+ lists each document's operations by tag, with a filter; the open one shows its
99
+ parameters, responses, and example requests, which default to JavaScript
100
+ `fetch`. Try in Playground sends the call to the app through the dashboard (the
101
+ app is another origin), so the call also appears in the Requests tab, and the
102
+ response comes with the app's trace of it (when `telemetry` is on): the error, its stack trace when the
103
+ app threw one, and the spans. The dashboard forwards only to the app it shows.
104
+ The first document is the app's own, left out when
105
+ `docs` is `false`; `reference.documents` adds more, each a title and an OpenAPI
106
+ document or a function returning one (for example Better Auth's
107
+ `auth.api.generateOpenAPISchema()`). A document that throws is skipped with a
108
+ warning. `reference` serves a Scalar page only for `true` or with a `path`.
109
+
110
+ The Docs tab shows the app's developer documentation: a folder of `.md`/`.mdx`
111
+ pages in Fumadocs' layout (frontmatter, `meta.json`, folder groups), set with
112
+ `documentation` on `brick()`. It appears only for apps that set it.
113
+
114
+ ```ts
115
+ // src/app.ts, with the docs in docs/ at the project root
116
+ const app = brick({
117
+ services: [pagesService],
118
+ documentation: "../docs", // or { dir: "../docs", components: "../docs/components.tsx" }
119
+ });
120
+ ```
121
+
122
+ Relative paths start at the folder of the app entry, as they read in the file that
123
+ sets them. `fumadocs-core` builds the page tree and search, and `@mdx-js/mdx` compiles the
124
+ pages. Both are optional peers, loaded only when `documentation` is set; without
125
+ them the tab says what to install (`bun add -d fumadocs-core @mdx-js/mdx`).
126
+ Saving a file updates the tab. Pages can use Fumadocs' components without
127
+ importing them (Callout, Cards, Tabs, Steps, Accordions, Files, TypeTable,
128
+ InlineTOC, Banner), and `components` names a module of your own React components
129
+ to add, which the dashboard bundles. Links between pages and local images work as
130
+ they do on a docs site. See `packages/cli/dashboard/README.md`.
131
+
132
+ The Logs tab lists what actions, tools, and endpoints log with `ctx.logger`, and
133
+ what they print with `console.log`, `info`, `warn`, `error`, and `debug`, newest
134
+ first. Under `brick dev` a line written while a traced request runs is a span
135
+ event on that request, so it shows here and in the request's details, and is not
136
+ printed. `brick start` does the same only when the app sets the `dashboard`
137
+ option (see below); otherwise nothing is captured or changed and both print as
138
+ usual. Lines outside a request still print. It needs `telemetry` on. A line is
139
+ cut at 4,000 characters and a span keeps its first 100.
140
+
141
+ To find a line: words that must all appear, `"an exact phrase"`, `-word` to
142
+ leave lines out, and `level:`, `route:`, `action:`, `method:`, and `trace:` for
143
+ one part of a line (any can be negated with `-`). Matches are marked, the level
144
+ buttons count what matches, 5m / 15m / 1h limit how far back to look, and Pause
145
+ holds the list still. Point at a line to copy it, show only its request, or
146
+ open it.
147
+
148
+ The Requests tab is one log of every request the app has served. Choose Live
149
+ for this run, or a range from 1 hour to 90 days to look back, or Custom to name
150
+ a start and an end to the second (or Today, Yesterday, the last 15 minutes). Four
151
+ cards show
152
+ the request count, error rate, median duration, and slowest 5% of what the list
153
+ shows, so they follow the range and filters. A timeline below them shows volume
154
+ (drag across it to zoom), filters on the left show a count
155
+ beside each value (outcome, service, method, route, and speed, with several
156
+ values per filter allowed), and the search box matches routes, paths, actions,
157
+ and failure messages. Each row shows the time, method and status, route, how long
158
+ it took, and the action that handled it or why it failed. Open a row to see the
159
+ request beside the list: when it started, what it ran, how it ended, the error
160
+ and stack trace if it failed, and the waterfall of its spans. Export saves the
161
+ filtered requests as CSV.
162
+
163
+ Finished requests are kept on disk between runs for 90 days by default, in
164
+ `.brick/telemetry.sqlite` in the project folder. `.brick/` ignores itself, so it
165
+ is never committed. History uses `bun:sqlite` under Bun and `node:sqlite` under
166
+ Node (22.5 or later); without either, the dashboard runs with live data only and
167
+ says so. Requests cut off by a restart are not kept. It keeps at most 100,000
168
+ requests, dropping the oldest first. Stored requests include their spans, which
169
+ carry SQL statement text, error messages, and stack traces, so treat `.brick/` as
170
+ you would your logs. Use `--history-days 0` to keep nothing, or
171
+ delete `.brick/` to start over.
172
+
173
+ Requests that send a W3C `traceparent` header join the caller's trace, and the
174
+ dashboard shows them under that trace id.
175
+
176
+ ### Monitoring dashboard for production
177
+
178
+ `brick start` serves a read-only dashboard of the running app when the app,
179
+ default-exported from the entry, sets the `dashboard` option:
180
+
181
+ ```ts
182
+ export default brick({
183
+ services,
184
+ dashboard: {
185
+ port: 9400, // its own port, apart from the app's
186
+ host: "0.0.0.0", // 127.0.0.1 unless set
187
+ auth: { token: process.env.DASHBOARD_TOKEN, authorize },
188
+ historyDays: 0, // finished requests kept on disk, in .brick/
189
+ },
190
+ });
191
+ ```
192
+
193
+ It listens on a port of its own, so it can be kept private or mounted at another
194
+ address, and it answers while the app's routes do not. It shows Requests, Logs,
195
+ Errors, Overview, and Reloads; there is no restart, API proxy, APIs, or Docs, and
196
+ OpenAPI documents are not served. Setting it turns `telemetry` on, and from then
197
+ `ctx.logger` and `console` lines written during a request go to the dashboard
198
+ and not to the container's console.
199
+
200
+ Beyond loopback, access control is required, and `brick start` will not run the
201
+ dashboard without it. `auth.token` is a secret (or several, to rotate), at least
202
+ 16 characters: a browser asks for it in its sign-in prompt (any user name, the
203
+ secret as the password), and monitors send `Authorization: Bearer <secret>`.
204
+ `auth.authorize(request)` is your own check, for the auth the app already has
205
+ (Better Auth, Clerk, a header from a proxy): it gets a standard `Request` without
206
+ a body and returns `true`, `false`, or a `Response` such as a redirect to a login
207
+ page; a throw or five seconds without an answer refuses the request with 503. A
208
+ request passes with a valid token or when `authorize` allows it.
209
+
210
+ `GET /_health` on the dashboard's port needs no sign-in: 200 while the app answers
211
+ its own `/_health`, 503 when it does not, for uptime monitors. Responses are
212
+ `no-store`, with a strict Content-Security-Policy and `X-Frame-Options: DENY`;
213
+ serve it over HTTPS. Failed sign-ins are not rate limited, so use long random
214
+ tokens. The dashboard runs in the app's process: it survives errors in handlers,
215
+ not the process dying. `brick dev` has its own dashboard and ignores the option.
216
+
217
+ The dashboard binds to `127.0.0.1` and rejects requests whose `Host` header is
218
+ not local. It does not record request bodies or headers. Error messages, stack
219
+ traces, and SQL statement text are visible to anyone who can open the dashboard.
220
+
60
221
  ## Action routes
61
222
 
62
223
  Each action exposes exactly one route: `method` defaults to POST, and `path`
@@ -148,6 +309,17 @@ imports of this server module are rejected. Add
148
309
  `/// <reference types="@brickkit/cli/vite/client" />` to your Vite environment
149
310
  declarations. See `examples/pages` for a complete Start integration.
150
311
 
312
+ During `vite dev` the plugin also serves the local dashboard at
313
+ `http://127.0.0.1:9400`. Pass `dashboard: { port }` to move it or
314
+ `dashboard: false` to turn it off. `dashboard: { historyDays }` sets how many days
315
+ of requests are kept in `.brick/` (default 90; 0 for none). The app must still
316
+ pass `telemetry: true` to `brick()`. Dev servers such as TanStack Start with Nitro run the app in a
317
+ worker, so the plugin imports a reporter into `virtual:brick-app` that sends
318
+ the worker's spans to the dashboard over loopback HTTP. History stays in the
319
+ Vite process and survives worker restarts. If the port is taken, Vite starts
320
+ without the dashboard and logs a warning. The dashboard cannot restart the app
321
+ in this mode, so it hides that button.
322
+
151
323
  Generation evaluates the app entry, so the configuration it needs to construct
152
324
  the app must be available in development and at build time. Keep startup jobs
153
325
  and connection-opening initialization in request handlers or your server
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{At as t,Bt as n,Dt as r,K as i,M as a,N as o,Ot as s,P as c,Qt as l,St as u,Tt as d,W as f,X as p,_n as m,_t as h,at as g,bt as _,c as v,dt as y,en as b,et as x,gn as S,ht as C,it as w,j as T,jt as E,k as D,kt as O,l as k,mn as A,n as j,nn as M,o as N,on as P,pn as F,pt as I,q as ee,r as L,s as R,tn as te,un as z,vt as B}from"./preload-helper-CVJ-D494.js";var V={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};V.node;var H=A(V),U={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};U.node;var W=A(U),ne={name:`circle-x`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-circle`]};ne.node;var G=A(ne),re={name:`clipboard`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]};re.node;var ie=A(re),ae={name:`copy-check`,size:24,node:[[`path`,{d:`m12 15 2 2 4-4`,key:`2c609p`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};ae.node;var oe=A(ae),se={name:`file`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]};se.node;var ce=A(se),le={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};le.node;var ue=A(le),de={name:`lightbulb`,size:24,node:[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]};de.node;var fe=A(de),pe={name:`link`,size:24,node:[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]};pe.node;var me=A(pe),he=48,K=(e,t=0)=>{let n=new Int32Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r)-he-t;return n},ge=e=>{let t=new Int32Array(e.length+1);for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t},_e=e=>{let t=new Int32Array(e.length),n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r)-he;n+=i>>>1^-(i&1),t[r]=n}return t},ve=384,ye=[],be=ge(K(`E0500002005282000000002000150000020021820000011200000003022202000300004200120000200420001200021200301200010400162000010000220021010:2192001200220012000220012000200200200400010200040000000000400200108200110100000022010313000162002000020020012020080213000228200000000082000000000120002000120020020040101020300130001001010`)),xe=ge(K(`:11111111211111119311546544411119731869:671397415686432441111111111161114151214313433415:78311132233313187211117221449443411141111151152226611131111112212518142224214215421421542142424242516171151615616347111111111197911327451111111111111111111113134714133513411111311111111111111111111112444411111342312715245411117:3`)),Se=`@containerabcdefghinlmoprstunderlineviawzccentlignnimatespectuto-colsrowsaglorightnessckdrop-sisbcontrastfiltergrayscalehue-rotateinvertopacityslurrightnessaturateepia-coniclinearpositionradialsizeockurrderttom-belrstxyespacing-xyaretoursorlnt-umnsendspantartainentrasteividerop-shadowurationcorationlay-xyasendillexontromlter-featuresstretchapr-xyayscaleidow-colsrowsue-rotatedentlinesetvert-beringsxyeshadoweiadingftnest-clamp-imageabein-lrstxyskx--b-coniclpositionrsizet-x-y-fromto-fromto-inearfromto-fromto-adialfromto-fromtofromtofromtofromtoblockhinlinew-screenesblockhinlinewbjectpacityrutlinederigin-offsetbelrstxyesrspective-originaceholderioghtng-offsettateundedw-xyz-belrstlreseslr-endspantartaturatecepiahizekewpace-taleroll-xyz-barmpbelrstxyesbelrstxyes-thumbrackadowrink-xyxyartrokeabextora-shadowpckingnsformitionlate-xyz-offsetill-changeoom`,Ce=(()=>{let e=be.length-1,t=new Int32Array(e);for(let n=e-1;n>=0;n--){let e=1,r=n+1;for(let i=be[n];i<be[n+1];i++)e+=t[r],r+=t[r];t[n]=e}let n=new Int32Array(be[e]),r=0;for(let i=0;i<e;i++){let e=i+1;for(let a=be[i];a<be[i+1];a++)n[r++]=e,e+=t[e]}return n})(),we=K(`02000000000000900<=0?000B000F00F00ŏI0J0LNPRTVX0000]_a00000000000000000000000rst0000000zŏ00000000000…ŏ000ˆ0000ŏ0000000000—0000000000000000000000000000000000000000000000000000Ë000000000000000000000Þ000000000000000000ð0000000ø0ùúûüýþÿĀāĂ㥹Ć000000000000000000000000000000000000000000ħ0ĨĪ00000000000000000000ļĽ00000Ŭ000000`,1),Te=ge(K(`123333359346463635126536711576`)),Ee=K(`93203242332583253248325D>E?F@03263243255B:032523853:0325B:8GA032542H<C=12727B:0328432553;D>E?3257D>032585:0325B:;0328B:032`),De=K(`012113445661666666789111:5;;;;;;;;444;;;:62999<1161=62>>?61:21@ABCD4446996:64E:::;:?::64:F114GHHIHHHHIHH1HH1HH1HHHHHH::EEJ4444::EE4444441691;644444114244444:;K6666555555555555555999666664444444444444444444444226?6:66644L9M?D:111::::6DE199`),Oe=_e(`020200202020020020020020020020200200200200200200200002020202001003040106000200200200200200200200200200200200200200200200200200200200200200200200200200200200020020020020020020002020200202002002002002002002002002002020002002020020200220200200200200200200200200200200020020020000200020002000200200200020020020002000200200200020020202002020202000200200020022000200200020020002002000200220002002000200W0Z00020020002002020002002000200g0j0002002000200200020020002002000200200020020002000200002000002002002002002000200020000200002002002002002002002020020020200200200200200200200200202020020020020020020020020002002002020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020002002002002002002000200200200200200200200200200020202020002000200020002002002002000020200200`),ke=(()=>{let e=new Int32Array(319).fill(-1),t=_e(`02422242:222222242224222242442222222422222244442242226224222426222422442462222422622222222626222462242622422622422424242422222222422222222242422222222222222222622442224222222222222224424442262222222222222222222226224222424242422224422422422222`),n=_e(`02222222222222222222202222222222222222222222221422222222222222222222222222222222222Y\\222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221422222222222222222222222222222222222222Ŀł222222222222222222`);for(let r=0;r<t.length;r++)e[t[r]]=n[r];return e})(),Ae=`container |break-after- all auto avoid avoid-page column left page right|break-before- all auto avoid avoid-page column left page right|break-inside-a uto void void-column void-page|box-decoration- clone slice|box- border content| contents flow-root hidden table table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group| not-sr-only sr-only|float- end left none right start|clear- both end left none right start|isolat e ion-auto|overflow- auto clip hidden scroll visible|overflow-x- auto clip hidden scroll visible|overflow-y- auto clip hidden scroll visible|overscroll- auto contain none|overscroll-x- auto contain none|overscroll-y- auto contain none| absolute fixed relative static sticky| collapse invisible visible|justify- around baseline between center center-safe end end-safe evenly normal start stretch|justify-items- center center-safe end end-safe normal start stretch|justify-self- auto center center-safe end end-safe start stretch|items- baseline baseline-last center center-safe end end-safe start stretch|self- auto baseline baseline-last center center-safe end end-safe start stretch|place-content- around baseline between center center-safe end end-safe evenly start stretch|place-items- baseline center center-safe end end-safe start stretch|place-self- auto center center-safe end end-safe start stretch| antialiased subpixel-antialiased| italic not-italic|normal-nums |ordinal |slashed-zero | lining-nums oldstyle-nums| proportional-nums tabular-nums| diagonal-fractions stacked-fractions| no-underline overline| capitalize lowercase normal-case uppercase|truncate |whitespace- break-spaces normal nowrap pre pre-line pre-wrap|break- all keep normal words|wrap- anywhere break-word normal|hyphens- auto manual none|mix-blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay plus-darker plus-lighter saturation screen soft-light|table- auto fixed|caption- bottom top|backface- hidden visible|appearance- auto none|scheme- dark light light-dark normal only-dark only-light|field-sizing- content fixed|pointer-events- auto none|resize -none -x -y|snap- align-none center end start|snap- always normal|snap- both none x y|snap- mandatory proximity|touch- auto manipulation none|touch-pan- left right x|touch-pan- down up y|touch-pinch-zoom |select- all auto none text|forced-color-adjust- auto none| normal size| baseline bottom middle sub super text-bottom text-top top| bounce none ping pulse spin| auto square video| auto fr max min px|none | auto full px| fixed local scroll|clip- border content padding text|origin- border content padding| bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| no-repeat repeat repeat-round repeat-space repeat-x repeat-y| auto contain cover| gradient-to-b gradient-to-bl gradient-to-br gradient-to-l gradient-to-r gradient-to-t gradient-to-tl gradient-to-tr none|blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay saturation screen soft-light|to- b bl br l r t tl tr| auto dvh fit full lh lvh max min px screen svh| dashed dotted double hidden none solid| collapse separate|px |auto |full | content none strict| inline-size size|layout |paint |style | around baseline between center center-safe end end-safe evenly normal start stretch| alias all-scroll auto cell col-resize context-menu copy crosshair default e-resize ew-resize grab grabbing help move n-resize ne-resize nesw-resize no-drop none not-allowed ns-resize nw-resize nwse-resize pointer progress row-resize s-resize se-resize sw-resize text vertical-text w-resize wait zoom-in zoom-out| dashed dotted double solid wavy| auto from-font|reverse |initial | in in-out initial linear out| col col-reverse row row-reverse| nowrap wrap wrap-reverse| auto initial none| black bold extrabold extralight light medium normal semibold thin| condensed expanded extra-condensed extra-expanded normal semi-condensed semi-expanded ultra-condensed ultra-expanded|flow- col col-dense dense row row-dense| none subgrid| auto dvh dvw fit full lh lvh lvw max min px screen svh svw| block flex grid table| auto dvw fit full lvw max min px screen svw| loose none normal px relaxed snug tight|through |item | inside outside| decimal disc none| auto px| clip-border clip-content clip-fill clip-padding clip-stroke clip-view no-clip| add exclude intersect subtract| alpha luminance match|origin- border content fill padding stroke view|type- alpha luminance| circle ellipse| closest-corner closest-side farthest-corner farthest-side|at- bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| dvh fit full lh lvh max min none px screen svh| auto dvh dvw fit full lh lvh lvw max min none px screen svh svw| dvw fit full lvw max min none px screen svw| auto dvh dvw fit full lvh lvw max min none prose px svh svw| auto dvh dvw fit full lvh lvw max min none px screen svh svw| contain cover fill none scale-down| first last none| distant dramatic midrange near none normal|inset | full none|3d | auto smooth|gutter- auto both stable| auto none thin| inner none| auto dvh dvw fit full lvh lvw max min px svh svw|base | center end justify left right start| clip ellipsis| balance nowrap pretty wrap| normal tight tighter wide wider widest| cpu gpu none| 3d flat| all colors none opacity shadow transform| discrete normal| full px| auto dvh dvw fit full lvh lvw max min px screen svh svw| auto contents scroll transform`.split(`|`).map(e=>{let t=e.split(` `),n=t.shift();for(let e=0;e<t.length;e++)t[e]=n+t[e];return t}),je=_e(`0000000000000000000000000000000000000000000000000000000000000262242:6@200000006:240B428:4422400002046044222426220026642642462026224222824220022400000000\\00N222422242222222224062242222222422226264222422222222222222442804222422222222222222222222220<4<0204260002444020204224422`),Me=_e(`ɠ222222222222222222222222222222222222222222222222222222222222˕4222226>ʶ22ʷʺʷ2ʸʷ42ʴ2ʓ22>621422ɶ222ɹɼɷɺɷɺ22ɱ42222ɨ2ɧ26622ɘɓ244ƸƵ222]d24242ǖǓƚÄȫ2263ȨȥȨ2222222ǣ222222222222222222ǂƽ2ƾƵ2222222422222ƜƑ22222222222222222222144Ŧţ22Ţş222222222222222222222ĸ2ı68ĦģĦɡŰ4Ġ«®ĝ822ĔđĔ2ē2222622`),Ne=_e(`02222222222222222222222222222222222222222222222222222222222222222202022222222222EH2200IL021042222Y\\222IL0cf2e10j2222U00X202[^2y0000120|{~‚22…ˆ‡:22|22222222222G000q†OVI00000}š2›>40000ŒB00000I¨©000¬00000000000000021M®­00°“000000000000000000000–222›HGHa1º222¿2À2222ÉÌ000­°2±`),Pe=new Int32Array(995),Fe=new Int32Array(995),Ie=new Int32Array(995),Le=``,Re=new Int32Array(1038);{let e=new Map,t=0,n=0;for(let r=0;r<je.length;r++)for(let i of Ae[Ne[r]]){let a=e.get(i);a===void 0&&(a=t++,e.set(i,a),Re[a*2]=Le.length,Re[a*2+1]=i.length,Le+=i),Pe[n]=je[r],Fe[n]=Me[r],Ie[n]=a,n++}}var q=_e(`0b2N:222@R>F@286¦2@H2D266226FB22B2>BD\\6N22222Z222D222p`),ze=ge(K(`1::24444432:442:44:44>222222:44:4421322511111311111114`)),Be=_e(`2Š4A;33N=C@H4A;33N=C@<27;83:;8393NQ:3NQʰ222ˉºŴŽ2R2=18cƴÅҜ=cĞÛC1ƈǝȈ:ħ25=11D3A@4=<1;1DEr25;11B3?<6;:371BCn9@7=<8192>2E121@9@EHE@9>2T25511<398454131<=V25511<398454131<=„ƧNž2Đå242L222290000f22500ɛ000ǘ222`),Ve=K(`ij`),He=K(`—`),Ue=K(`1`),We={GROUP_COUNT:ve,customValidatorNames:ye,edgeStart:be,labelStart:xe,labelText:Se,edgeTarget:Ce,nodeGroup:we,nodeVlist:ke,vlistPat:Te,vlistOps:Ee,vlistRef:De,vlistGroup:Oe,litAnchor:Pe,litGroup:Fe,litPool:Ie,poolOffsets:Re,poolText:Le,adjGid:q,adjStart:ze,adjTgt:Be,patGid:Ve,patTgt:He,postfixLookupGroups:Ue,orderSensitiveModifiers:`* ** after backdrop before details-content file first-letter first-line marker placeholder selection`},Ge=`line`in Error(),Ke=-1,qe=-1,Je=(e,t,n)=>{let r=2166136261;for(let i=t;i<n;i++)r=Math.imul(r^e.charCodeAt(i),16777619);return r},Ye=(e,t,n)=>{let r=n-t,i=Math.imul(r,2654435761)^e.charCodeAt(t);if(r>3){let a=r>>2,o=r>>1;i=Math.imul(i^e.charCodeAt(t+1)<<8^e.charCodeAt(t+2)<<16^e.charCodeAt(t+a),2246822507),i=Math.imul(i^e.charCodeAt(t+o)<<8^e.charCodeAt(t+o+a)<<16^e.charCodeAt(n-3),3266489909),i^=e.charCodeAt(n-2)<<8^e.charCodeAt(n-1)<<16;for(let r=t+3,a=n-4;r<t+8&&r<a;r++,a--)i=Math.imul(i^e.charCodeAt(r)^e.charCodeAt(a)<<8,16777619)}return i^i>>>15},Xe=(e,t,n={})=>{let{GROUP_COUNT:r,edgeStart:i,labelStart:a,labelText:o,edgeTarget:s,nodeGroup:c,nodeVlist:l,vlistPat:u,vlistOps:d,vlistRef:f,vlistGroup:p,litAnchor:m,litGroup:h,litPool:g,poolOffsets:_,poolText:v,adjGid:y,adjStart:b,adjTgt:x,patGid:S,patTgt:C,postfixLookupGroups:w,customValidatorNames:T,orderSensitiveModifiers:E}=e,D=new Int32Array(r).fill(-1);for(let e=0;e<y.length;e++)D[y[e]]=e;let O=0;for(let e=0;e+1<b.length;e++){let t=b[e+1]-b[e];t>O&&(O=t)}let k=32;for(;k<2*(1+O+S.length);)k<<=1;let A=new Int32Array(f.length+1);for(let e=0;e<f.length;e++)A[e+1]=A[e]+u[f[e]+1]-u[f[e]];let j=new Uint8Array(r);for(let e=0;e<w.length;e++)j[w[e]]=1;let M=i.length-1,N=new Uint8Array(M),P=0,F=!0;for(let e=0;e<m.length;e++){N[m[e]]=1;let t=_[g[e]*2+1];t>P&&(P=t);let n=v.charCodeAt(_[g[e]*2]);(n===91||n===40)&&(F=!1)}let I=1;for(;I<m.length*2;)I<<=1;let ee=new Int32Array(I).fill(-1);for(let e=0;e<m.length;e++){let t=_[g[e]*2],n=(Je(v,t,t+_[g[e]*2+1])^Math.imul(m[e],2654435761)|0)&I-1;for(;ee[n]!==-1;)n=n+1&I-1;ee[n]=e}let L=(e,t,n,r)=>{let i=(Je(t,n,r)^Math.imul(e,2654435761)|0)&I-1,a=r-n;for(;;){let r=ee[i];if(r===-1)return-1;if(m[r]===e&&_[g[r]*2+1]===a){let e=_[g[r]*2],i=!0;for(let r=0;r<a;r++)if(v.charCodeAt(e+r)!==t.charCodeAt(n+r)){i=!1;break}if(i)return h[r]}i=i+1&I-1}},R=n.cacheSize??8192,te=n.prefix??e.prefix??``,z=te===``?``:te+`:`,B=z.length,V=(T??[]).map(e=>{let n=t&&t[e];if(!n)throw Error(`cn: missing validator `+e);return n}),H=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,U=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,W=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ne=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,G=0,re=-1,ie=-1,ae=-1,oe=-1,se=e=>e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===95,ce=e=>/\s/.test(String.fromCharCode(e)),le=(e,t,n)=>{if(G=0,re=-1,n-t<3)return;let r=e.charCodeAt(t),i=e.charCodeAt(n-1);if(r===91&&i===93)G=1;else if(r===40&&i===41)G=2;else return;ae=t+1,oe=n-1;let a=t+1;if(se(e.charCodeAt(a))){for(a++;a<n-1;){let t=e.charCodeAt(a);if(!se(t)&&t!==45)break;a++}a<n-2&&e.charCodeAt(a)===58&&(re=t+1,ie=a,ae=a+1)}},ue=(e,t,n,r)=>{if(n-t!==r.length)return!1;for(let n=0;n<r.length;n++)if(e.charCodeAt(t+n)!==r.charCodeAt(n))return!1;return!0},de=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,fe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,pe=e=>!!e&&!Number.isNaN(Number(e)),me=(e,t,n)=>{if(n-t<11||!ue(e,t,t+10,`@container`))return!1;if(e.charCodeAt(t+10)===47)return n-t>=12;let r=e.charCodeAt(t+11);return r===115&&n-t>=17&&ue(e,t+10,t+16,`-size/`)||r===110&&n-t>=19&&ue(e,t+10,t+18,`-normal/`)},he=[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2],K=`length|number|number weight|family-name|position percentage|length size bg-size|image url|shadow|length|family-name|position percentage|length size bg-size|image url|shadow|number weight`.split(`|`).map(e=>e.split(` `)),ge=[2,3,1,0,0,0,4,5,0,0,0,0,0,1,1],_e=(e,t,n,r)=>{if(e>=10){if(e>=25)return V[e-25](t.slice(n,r));let i=e-10;if(G!==he[i])return!1;if(re>=0){for(let e of K[i])if(ue(t,re,ie,e))return!0;return!1}switch(ge[i]){case 0:return!1;case 1:return!0;case 2:{let e=t.slice(ae,oe);return H.test(e)&&!U.test(e)}case 3:return pe(t.slice(ae,oe));case 4:return ne.test(t.slice(ae,oe));default:return W.test(t.slice(ae,oe))}}switch(e){case 0:return!0;case 1:return G===0;case 2:return G===1;case 3:return G===2;case 4:return de.test(t.slice(n,r));case 5:return pe(t.slice(n,r));case 6:{let e=t.slice(n,r);return!!e&&Number.isInteger(Number(e))}case 7:return r>n&&t.charCodeAt(r-1)===37&&pe(t.slice(n,r-1));case 8:return fe.test(t.slice(n,r));default:return me(t,n,r)}},ve=new Set(typeof E==`string`?E.split(` `):E),ye=(e,t,n,r,i,a)=>{let o=Je(t,n,r)^(i?2654435769:0),s=e.get(o);if(s!==void 0)outer:for(let e=0;e<s.length;e++){let a=s[e];if(a.imp===i&&a.k.length===r-n){for(let e=0;e<a.k.length;e++)if(a.k.charCodeAt(e)!==t.charCodeAt(n+e))continue outer;return a.id}}else e.set(o,s=[]);let c=t.slice(n,r),l=a(c);return s.push({k:c,imp:i,id:l}),l},be=new Map,xe=new Map,Se=2,Ce=4096,we=(e,t)=>{let n=[],r=0,i=0,a=0;for(let t=0;t<e.length;t++){let o=e.charCodeAt(t);r===0&&i===0&&o===58?(n.push(e.slice(a,t)),a=t+1):o===91?r++:o===93?r--:o===40?i++:o===41&&i--}n.push(e.slice(a));let o=n[0];if(n.length>1){let e=[],t=[];for(let r of n)r.charCodeAt(0)===91||ve.has(r)?(t.length&&(e.push(...t.sort()),t=[]),e.push(r)):t.push(r);t.length&&e.push(...t.sort()),o=e.join(`:`)}let s=t?o+` !`:o,c=xe.get(s);return c===void 0&&xe.set(s,c=Se++),c},Te=new Map,Ee=r,De=r+4096,Oe=()=>Ee++,ke=2097152,Ae=8192,je=new Int32Array(Ae),Me=Array(Ae).fill(null),Ne=new Int32Array(Ae),Pe=new Int32Array(Ae),Fe=new Uint8Array(Ae),Ie=0,Le=(e,t,n,r,i,a,o,s)=>{let c=e;if(Me[e]!==null){if(Me[e|1]===null)c=e|1;else if(!(Ie++&3))c=e|Ie>>2&1;else return}Me[c]=t.slice(n,r),je[c]=i,Ne[c]=a,Pe[c]=o,Fe[c]=s},Re=()=>Me.fill(null),q=256,ze=[new Int32Array(q),new Int32Array(q),new Int32Array(q),new Int32Array(q)],[Be,Ve,He,Ue]=ze,We=new Uint8Array(q),Xe=new Uint8Array(q),Ze=()=>{q*=2,ze=ze.map(e=>{let t=new Int32Array(q);return t.set(e),t}),[Be,Ve,He,Ue]=ze;let e=new Uint8Array(q);e.set(We),We=e,Xe=new Uint8Array(q)},Qe=64,et=new Int32Array(Qe),tt=new Int32Array(Qe),nt=new Int32Array(r),J=2048,rt=21,it=new Float64Array(J),Y=new Int32Array(J),X=0,Z=(e,t)=>{if(e===0&&t<r)return nt[t]===X?1:(nt[t]=X,0);let n=e*2097152+t+1,i=Math.imul(n,2654435761)>>>rt;for(;Y[i]===X;){if(it[i]===n)return 1;i=i+1&J-1}return it[i]=n,Y[i]=X,0},at=(e,t,n,r,i)=>{if(n-t>=2&&e.charCodeAt(t)===91&&e.charCodeAt(n-1)===93){let r=-1;for(let i=t+1;i<n-1;i++)if(e.charCodeAt(i)===58){r=i;break}return r===-1||r===t+1?Ke:ye(Te,e,t+1,r,0,Oe)}if(r>=0&&c[r]>=0)return c[r];for(let t=i-1;t>=0;t--){let r=tt[t];if(r>n)continue;let i=et[t],a=n-r;if(N[i]===1&&a>0&&a<=P){let t=e.charCodeAt(r);if(F===!1||t!==91&&t!==40){let t=L(i,e,r,n);if(t>=0)return t}}let o=l[i];if(o<0)continue;let s=f[o],c=u[s],m=u[s+1];if(c===m)continue;le(e,r,n);let h=A[o]-c;for(let t=c;t<m;t++)if(_e(d[t],e,r,n))return p[h+t]}return Ke},ot=e=>{let t=e.length,n=0,c=0,u=!1;(Se>Ce||be.size>Ce)&&(be=new Map,xe=new Map,Se=2,Re()),Ee>De&&(Te=new Map,Ee=r,Re());let d=0;for(;d<t;){let f=e.charCodeAt(d);if(f===32||f>=9&&f<=13||f>=160&&ce(f)){f!==32&&(u=!0),d++;continue}let p=d,m=0;for(;d<t;){if(f=e.charCodeAt(d),f<=32){if(f===32)break;if(f>=9&&f<=13){u=!0;break}}else if(f>=160&&ce(f)){u=!0;break}m=Math.imul(m^f,16777619),d++}let h=d,g=h-p;n===q&&Ze();let _=n++;Be[_]=p,Ve[_]=h,c+=g,m^=Math.imul(g,2654435761);let v=m^m>>>15,y=v&8190;{let t=-1;if(je[y]===v&&Me[y]!==null&&Me[y].length===g?t=y:je[y|1]===v&&Me[y|1]!==null&&Me[y|1].length===g&&(t=y|1),t>=0){let n=Me[t],r=!0;for(let t=0;t<g;t++)if(n.charCodeAt(t)!==e.charCodeAt(p+t)){r=!1;break}if(r){He[_]=Ne[t],Ue[_]=Pe[t],We[_]=Fe[t];continue}}}let b=p;if(B!==0){if(h-p<=B||!e.startsWith(z,p)){He[_]=Ke,Le(y,e,p,h,v,Ke,0,0);continue}b=p+B}let x=0,S=0,C=-1,w=-1;for(let t=b;t<h;t++){let n=e.charCodeAt(t);if(x===0&&S===0){if(n===58){C=t;continue}if(n===47){w=t;continue}}n===91?x++:n===93?x--:n===40?S++:n===41&&S--}let T=C>=b?C+1:b,E=T,D=h,O=!1,k=0;D>E&&e.charCodeAt(D-1)===33?(O=!0,D--):D>E&&e.charCodeAt(E)===33&&(O=!0,E++,k=1);let A=-1;w>T&&(A=w+k,A>=D&&(A=-1));let M=E;D-E>1&&e.charCodeAt(E)===45&&(M=E+1);let P=0,F=0,I=0,ee=-1,L=0;(l[0]>=0||N[0]===1)&&(et[0]=0,tt[0]=M,L=1);let R=qe,te=0;for(let t=M;t<D;t++)if(t===A&&(R=F<I?qe:P,te=L),P!==qe){let n=e.charCodeAt(t),r=-1;if(F<I)o.charCodeAt(F)===n?(F++,F===I&&(r=P=ee)):P=qe;else{let e=i[P],t=i[P+1],c=qe;for(let i=e;i<t;i++){let e=a[i];if(o.charCodeAt(e)===n){a[i+1]-e===1?r=c=s[i]:(F=e+1,I=a[i+1],ee=s[i],c=P);break}}P=c}if(r>=0&&(l[r]>=0||N[r]===1)&&t+1<D&&e.charCodeAt(t+1)===45){if(L===Qe){Qe*=2;let e=new Int32Array(Qe);e.set(et),et=e;let t=new Int32Array(Qe);t.set(tt),tt=t}et[L]=r,tt[L]=t+2,L++}}A===D&&(R=F<I?qe:P,te=L);let V=F<I?qe:P,H,U=!1;if(A>=0){if(U=!0,H=at(e,E,A,R,te),H!==Ke&&H<r&&j[H]){let t=at(e,E,D,V,L);t!==Ke&&t!==H&&(H=t,U=!1)}else H===Ke&&(H=at(e,E,D,V,L),U=!1)}else H=at(e,E,D,V,L);let W=0,ne=0;H===Ke?He[_]=Ke:(ne=+!!U,W=b>=C?+!!O:ye(be,e,b,C,+!!O,e=>we(e,O)),He[_]=H,We[_]=ne,Ue[_]=W),Le(y,e,p,h,v,H,W,ne)}if(n===0)return``;if(n===1)return Be[0]===0&&Ve[0]===t?e:e.slice(Be[0],Ve[0]);if(n*k>J){for(;n*k>J;)J<<=1,rt--;it=new Float64Array(J),Y=new Int32Array(J)}if(Se>=ke||Ee>=ke)throw Error(`cn: too many distinct classes in one merge`);X=X+1|0,X===0&&(nt.fill(0),Y.fill(0),X=1);let f=!1;for(let e=n-1;e>=0;e--){let t=He[e];if(t===Ke){Xe[e]=1;continue}let n=Ue[e];if(Z(n,t)===1)Xe[e]=0,f=!0;else if(Xe[e]=1,t<r){let r=D[t];if(r>=0)for(let e=b[r];e<b[r+1];e++)Z(n,x[e]);if(We[e]&1)for(let e=0;e<S.length;e++)S[e]===t&&Z(n,C[e])}}if(!f&&!u&&t===c+n-1)return e;let p=``,m=0;for(;m<n;){if(!Xe[m]){m++;continue}let t=Be[m],r=Ve[m],i=m+1;for(;i<n&&Xe[i]&&Be[i]===r+1&&e.charCodeAt(r)===32;)r=Ve[i],i++;p.length>0&&(p+=` `),p+=e.slice(t,r),m=i}return p},st=16384,Q=new Int32Array(st*2),ct=0,$=1,lt=Object.create(null),ut=Object.create(null),dt=new Map,ft=new Map,pt=0,mt=0,ht=()=>{ct^=st,$=$+1|0,mt=0},gt=e=>{let t=lt[e];if(t!==void 0)return t;let n=Ye(e,0,e.length),r=(n&16383)+ct,i=Q[r]===(n^$)||Q[r^st]===(n^$-1);return i&&(t=ut[e],t!==void 0)?(lt[e]=t,t):(t=ot(e),i?(lt[e]=t,++pt>R&&(pt=0,ut=lt,lt=Object.create(null),ht())):(Q[r]=n^$,++mt>st&&ht()),t)},_t=e=>{let t=dt.get(e);if(t!==void 0)return t;let n=Ye(e,0,e.length),r=(n&16383)+ct,i=Q[r]===(n^$)||Q[r^st]===(n^$-1);return i&&(t=ft.get(e),t!==void 0)?(dt.set(e,t),t):(t=ot(e),i?(dt.set(e,t),++pt>R&&(pt=0,ft=dt,dt=new Map,ht())):(Q[r]=n^$,++mt>st&&ht()),t)},vt=e=>{let t=Ye(e,0,e.length),n=(t&16383)+ct;return Q[n]===(t^$)||Q[n^st]===(t^$-1)||(Q[n]=t^$,++mt>st&&ht(),!1)},yt=R===0?ot:Ge?e=>{let t=dt.get(e);return t===void 0?_t(e):t}:gt;return{merge:function(){return arguments.length===1&&typeof arguments[0]==`string`?yt(arguments[0]):yt($e.apply(null,arguments))},mergeString:yt,seenBefore:R===0?()=>!1:vt,mergeUncached:ot}},Ze=(e,t)=>{if(!e)return``;if(typeof e==`string`)return e;let n=``;if(typeof e.length==`number`&&(!t||Array.isArray(e))){let r=e;for(let e=0;e<r.length;e++){let i=r[e];if(!i)continue;let a=typeof i==`string`?i:Ze(i,t);a&&(n&&(n+=` `),n+=a)}return n}if(t){if(typeof e==`number`)return``+e;if(typeof e==`object`)for(let t in e)e[t]&&(n&&(n+=` `),n+=t)}return n},Qe=(e,t)=>{let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(!i)continue;let a=typeof i==`string`?i:Ze(i,t);a&&(n&&(n+=` `),n+=a)}return n},$e=function(){return Qe(arguments,!1)},et=256,tt=16,nt=1024,J=4096,rt=(e,t)=>{let n=t===void 0?()=>!0:t.seenBefore,r=t===void 0?e:t.mergeUncached,i=new Map,a=new Map,o=0,s=null,c=null,l=[],u=[],d=0,f=(t,n,r)=>{c===null&&(c=Array(J).fill(``),l=Array(J).fill(``),u=Array(J).fill(``));let i=Ye(t,0,t.length)&4094;if(c[i]===t&&l[i]===n)return u[i];if(c[i|1]===t&&l[i|1]===n)return u[i|1];let a=e(r?n+` `+t:t),o=c[i]===``?i:i|(c[i|1]===``?1:d++&1);return c[o]=t,l[o]=n,u[o]=a,a},p=(e,t,n,r)=>{let i=0;if(t){if(t!==e.a0)return!1;i=1}if(n){if(n!==(i===0?e.a0:e.a1))return!1;i++}if(r){if(r!==(i===0?e.a0:i===1?e.a1:e.a2))return!1;i++}return i===e.t},m=(e,t)=>{let n=e.a,r=0;for(let e=0;e<t.length;e++){let i=t[e];if(i){if(i!==n[r])return!1;r++}}return r===e.t},h=(t,c)=>{let l=t.length,u=s===null?null:s.n;if(!c){if(u!==null&&m(u,t))return s=u,u.r;if(s!==null&&s!==u&&m(s,t))return s.r}let d=``,p=-1,h=0,g=!1;for(let e=0;e<l;e++){let n=t[e];if(n){if(typeof n!=`string`){if(n=t[e]=Ze(n,!0),!n)continue;g=!0}p<0&&(d=n,p=e),h++}}if(h===0)return``;if(h===1)return e(d);if(g){if(u!==null&&m(u,t))return s=u,u.r;if(s!==null&&s!==u&&m(s,t))return s.r}let _=i.get(d);_===void 0&&(_=a.get(d),_!==void 0&&i.set(d,_));let v=null;if(_!==void 0){if(_.skip>0){_.skip--,s=null;let e=d;for(let n=p+1;n<l;n++){let r=t[n];r&&(e+=` `+r)}return f(e,``,!1)}let e=_.e;outer:for(let n=0;n<e.length;n++){let r=e[n];if(r.t!==h)continue;let i=r.a,a=1;for(let e=p+1;e<l;e++){let n=t[e];if(n&&n!==i[a++])continue outer}v=r;break}v!==null&&(_.miss=0)}if(v===null){let s=d,c=[d];for(let e=p+1;e<l;e++){let n=t[e];n&&(s+=` `+n,c.push(n))}if(!n(s))return r(s);v={r:e(s),t:c.length,a0:c[0],a1:c[1],a2:c[2]??``,a:c,n:null},_===void 0?i.set(d,_={e:[],miss:0,skip:0,at:0}):++_.miss>tt&&(_.miss=tt,_.skip=nt,_.e.length=0,_.at=0);let u=_.e;u.length<et?u.push(v):(u[_.at]=v,_.at=_.at+1&255),++o>1e3&&(o=0,a=i,i=new Map)}return s!==null&&s!==v&&(s.n=v),s=v,v.r},g=t=>Array.isArray(t)?h(t.slice(),!1):e(Ze(t,!0));return function(t,n,r){let a=arguments.length;if((a|1)==3){let e=s;if(e!==null){let i=e.n;if(i!==null&&p(i,t,n,r))return s=i,i.r;if(e!==i&&p(e,t,n,r))return e.r}if(a===2&&typeof n==`string`&&n!==``){let e=i.get(t);if(e!==void 0&&e.skip>0)return e.skip--,s=null,f(n,t,!0)}return h([t,n,r],!0)}if(a===1)return typeof t==`string`?e(t):g(t);let o=s;if(o!==null){let e=o.n;if(e!==null){let t=e.a,n=0,r=!0;for(let e=0;e<a;e++){let i=arguments[e];if(i){if(i!==t[n]){r=!1;break}n++}}if(r&&n===e.t)return s=e,e.r}if(o!==e){let e=o.a,t=0,n=!0;for(let r=0;r<a;r++){let i=arguments[r];if(i){if(i!==e[t]){n=!1;break}t++}}if(n&&t===o.t)return o.r}}let c=[];for(let e=0;e<a;e++)c.push(arguments[e]);return h(c,!0)}},it=Xe(We),Y=rt(it.mergeString,it);it.merge;var X=e(m(),1),Z=e(S(),1),at=`size-5 -me-0.5 fill-(--callout-color) text-fd-card`;function ot({children:e,title:t,...n}){return(0,Z.jsxs)(Q,{...n,children:[t&&(0,Z.jsx)(ct,{children:t}),(0,Z.jsx)($,{children:e})]})}function st(e){return e===`warn`?`warning`:e===`tip`?`info`:e}function Q({type:e=`info`,icon:t,children:n,className:r,style:i,...a}){let o=st(e);return(0,Z.jsxs)(`div`,{className:Y(`flex gap-2 my-4 rounded-xl border bg-fd-card p-3 ps-1 text-sm text-fd-card-foreground`,r),style:{"--callout-color":`var(--color-fd-${o}, var(--color-fd-muted))`,...i},...a,children:[(0,Z.jsx)(`div`,{role:`none`,className:`w-0.5 bg-(--callout-color)/50 rounded-sm`}),t??{info:(0,Z.jsx)(ue,{className:at}),warning:(0,Z.jsx)(z,{className:at}),error:(0,Z.jsx)(G,{className:at}),success:(0,Z.jsx)(W,{className:at}),idea:(0,Z.jsx)(fe,{className:`size-5 -me-0.5 fill-(--callout-color) text-(--callout-color)`})}[o],(0,Z.jsx)(`div`,{className:`flex flex-col gap-2 min-w-0 flex-1`,children:n})]})}function ct({children:e,className:t,...n}){return(0,Z.jsx)(`p`,{className:Y(`font-medium my-0!`,t),...n,children:e})}function $({children:e,className:t,...n}){return(0,Z.jsx)(`div`,{className:Y(`text-fd-muted-foreground prose-no-margin empty:hidden`,t),...n,children:e})}var lt=()=>{throw Error("You need to wrap your application inside `FrameworkProvider`.")},ut=(0,X.createContext)({useParams:lt,useRouter:lt,usePathname:lt});function dt(e){let{Image:t}=(0,X.use)(ut);if(!t){let{src:t,alt:n,priority:r,...i}=e;return(0,Z.jsx)(`img`,{alt:n,src:t,fetchPriority:r?`high`:`auto`,...i})}return(0,Z.jsx)(t,{...e})}function ft(e){let{Link:t}=(0,X.use)(ut);if(!t){let{href:t,prefetch:n,...r}=e;return(0,Z.jsx)(`a`,{href:t,...r})}return(0,Z.jsx)(t,{...e})}function pt({ref:e,href:t=`#`,external:n=!!(t.match(/^\w+:/)||t.startsWith(`//`)),prefetch:r,children:i,...a}){return n?(0,Z.jsx)(`a`,{ref:e,href:t,rel:`noreferrer noopener`,target:`_blank`,...a,children:i}):(0,Z.jsx)(ft,{ref:e,href:t,prefetch:r,...a,children:i})}function mt(e){return(0,Z.jsx)(`div`,{...e,className:Y(`grid grid-cols-2 gap-3 @container`,e.className),children:e.children})}function ht({icon:e,title:t,description:n,...r}){let i=r.href?pt:`div`;return(0,Z.jsxs)(i,{...r,"data-card":!0,className:Y(`block rounded-xl border bg-fd-card p-4 text-fd-card-foreground transition-colors @max-lg:col-span-full`,r.href&&`hover:bg-fd-accent/80`,r.className),children:[e?(0,Z.jsx)(`div`,{className:`not-prose mb-2 w-fit shadow-md rounded-lg border bg-fd-muted p-1.5 text-fd-muted-foreground [&_svg]:size-4`,children:e}):null,(0,Z.jsx)(`h3`,{className:`not-prose mb-1 text-sm font-medium`,children:t}),n?(0,Z.jsx)(`p`,{className:`my-0! text-sm text-fd-muted-foreground`,children:n}):null,(0,Z.jsx)(`div`,{className:`text-sm text-fd-muted-foreground prose-no-margin empty:hidden`,children:r.children})]})}var gt=`bg-fd-primary text-fd-primary-foreground hover:bg-fd-primary/80`,_t={default:gt,primary:gt,outline:`border hover:bg-fd-accent hover:text-fd-accent-foreground`,ghost:`hover:bg-fd-accent hover:text-fd-accent-foreground`,secondary:`border bg-fd-secondary text-fd-secondary-foreground hover:bg-fd-accent hover:text-fd-accent-foreground`},vt=l(`inline-flex items-center justify-center rounded-md p-2 text-sm font-medium transition-colors duration-100 disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fd-ring`,{variants:{variant:_t,color:_t,size:{sm:`gap-1 px-2 py-1.5 text-xs`,icon:`p-1.5 [&_svg]:size-5`,"icon-sm":`p-1.5 [&_svg]:size-4.5`,"icon-xs":`p-1 [&_svg]:size-4`}}});function yt(e){let[t,n]=(0,X.useState)(!1),r=(0,X.useRef)(e),i=(0,X.useRef)(null);r.current=e;let a=(0,X.useCallback)(()=>{i.current&&window.clearTimeout(i.current),Promise.resolve(r.current()).then(()=>{n(!0),i.current=window.setTimeout(()=>{n(!1)},1500)})},[]);return(0,X.useEffect)(()=>()=>{i.current&&window.clearTimeout(i.current)},[]),[t,a]}var bt=(0,X.createContext)({}),xt=/\\?\{([^}]+)\}/g;function St({note:e}={}){let t=(0,X.use)(bt);return(0,X.useMemo)(()=>Ct(t,{note:e}),[t,e])}function Ct(e,{note:t}={}){let n=(n,r={})=>{let{note:i,variables:a}=r,o=[];t&&o.push(t),i&&o.push(i);let s=e[wt(n,o)]??n;return a&&(s=s.replaceAll(xt,(e,t)=>e[0]===`\\`?e.slice(1):t in a?a[t]:e)),s};return n.jsx=(n,r={})=>{let{note:i,variables:a,tags:o}=r,s=[];t&&s.push(t),i&&s.push(i);let c=e[wt(n,s)]??n;return o?Dt(c,a,o):a?Tt(c,a):c},n.translations=e,n}function wt(e,t){return e+t.map(e=>`(${e})`).join(``)}function Tt(e,t){let n=0,r=[];for(let i of e.matchAll(xt)){let[a,o]=i;n<i.index&&r.push(e.slice(n,i.index)),n=i.index+a.length,a[0]===`\\`?r.push(a.slice(1)):o in t?r.push(kt(t[o],n)):r.push(a)}return r.push(e.slice(n)),r}var Et=/\\?<([^>]+)>/g;function Dt(e,t,n){let r=[{children:[]}],i=0,a=()=>{let e=r.pop();r[r.length-1].children.push(kt(e.tag&&n[e.tag]?Ot(n[e.tag],e.children):e.children,i))};for(let o of e.matchAll(Et)){let s=r[r.length-1],[c,l]=o;if(i<o.index){let n=e.slice(i,o.index);s.children.push(t?Tt(n,t):n)}if(i=o.index+c.length,c[0]===`\\`){let e=c.slice(1);s.children.push(t?Tt(e,t):e)}else if(l[0]===`/`){let e=l.slice(1);s.tag===e?a():s.children.push(t?Tt(c,t):c)}else if(l.at(-1)===`/`){let e=l.slice(0,-1);n[e]&&s.children.push(kt(Ot(n[e]),i))}else r.push({children:[],tag:l})}if(i<e.length){let n=e.slice(i);r[r.length-1].children.push(t?Tt(n,t):n)}for(;r.length>1;)a();return r[0].children}function Ot(e,t){return(0,X.isValidElement)(e)?t===void 0?e:(0,X.cloneElement)(e,void 0,t):e(t)}function kt(e,t){return(0,X.isValidElement)(e)?(0,X.cloneElement)(e,{key:t}):e}function At({as:e,...t}){let n=e??`h1`,r=St({note:`heading anchor`}),[i,a]=yt(()=>{if(!t.id)return;let e=new URL(window.location.href);return e.hash=t.id,navigator.clipboard.writeText(e.href)});return t.id?(0,Z.jsxs)(n,{...t,className:Y(`group/heading flex scroll-m-28 flex-row items-center gap-1`,t.className),children:[(0,Z.jsx)(`a`,{"data-card":``,href:`#${t.id}`,children:t.children}),(0,Z.jsxs)(`button`,{"aria-live":`polite`,className:Y(vt({variant:`ghost`,size:`icon-xs`}),`not-prose shrink-0 text-fd-muted-foreground opacity-0 transition-opacity group-hover/heading:opacity-100`),onClick:a,children:[i?(0,Z.jsx)(oe,{}):(0,Z.jsx)(me,{}),(0,Z.jsx)(`span`,{className:`sr-only`,children:r(i?`Copied Anchor Link`:`Copy Anchor Link`,{note:`aria-label`})})]})]}):(0,Z.jsx)(n,{...t})}function jt(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})}}var Mt=X.createContext(void 0);function Nt(){let e=X.useContext(Mt);if(e===void 0)throw Error(O(64));return e}var Pt=`data-activation-direction`,Ft={tabActivationDirection:e=>({[Pt]:e})},It=X.forwardRef(function(e,n){let{className:r,defaultValue:i=0,onValueChange:a,orientation:o=`horizontal`,render:s,value:c,style:l,...u}=e,d=e.defaultValue!==void 0,f=X.useRef([]),[m,h]=X.useState(()=>new Map),[g,_]=k({controlled:c,default:i,name:`Tabs`,state:`value`}),v=c!==void 0,[y,S]=X.useState(()=>new Map),C=X.useRef(void 0),T=X.useCallback(e=>Lt(y,e),[y]),[D,O]=X.useState(()=>({previousValue:g,tabActivationDirection:`none`})),{previousValue:A,tabActivationDirection:j}=D,M=j,P=!1;A!==g&&(M=Rt(A,g,o,y),P=A!=null&&g!=null&&T(g)==null);let F=P?A:g,ee=A!==F||j!==M;t(()=>{ee&&O({previousValue:F,tabActivationDirection:M})},[F,ee,M]);let L=E((e,t)=>{t.activationDirection=Rt(g,e,o,y),a?.(e,t),!t.isCanceled&&_(()=>e)}),R=E((e,t)=>{a?.(e,I(t,void 0,void 0,{activationDirection:`none`}))}),te=E((e,t)=>(h(n=>{let r=new Map(n);return r.set(e,t),r}),()=>{h(n=>{if(n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})})),z=X.useCallback(e=>m.get(e),[m]),B=X.useCallback(e=>{for(let t of y.values())if(e===t.value)return t.id},[y]),V=X.useMemo(()=>({getTabElementBySelectedValue:T,getTabIdByPanelValue:B,getTabPanelIdByValue:z,onValueChange:L,orientation:o,registerMountedTabPanel:te,setTabMap:S,tabActivationDirection:M,value:g}),[T,B,z,L,o,te,S,M,g]),H=X.useMemo(()=>{for(let e of y.values())if(e.value===g)return e},[y,g]),U=X.useMemo(()=>{for(let e of y.values())if(!e.disabled)return e.value},[y]),W=X.useRef(!d),ne=X.useRef(i),G=X.useRef(d),re=X.useRef(!1);t(()=>{if(v)return;function e(e,t){_(()=>e),O({previousValue:e,tabActivationDirection:`none`}),R(e,t),W.current=!1}if(y.size===0){re.current&&g!==null&&!C.current?.isConnected&&e(null,w);return}re.current=!0,C.current=y.keys().next().value;let t=H?.disabled,n=H==null&&g!==null;if(!t&&g===ne.current&&(G.current=!1),G.current&&t&&g===ne.current)return;let r=W.current;if(t||n){let n=U??null;if(g===n){W.current=!1;return}let i=w;r?i=x:t&&(i=p),e(n,i)}else r&&H!=null&&(R(g,x),W.current=!1)},[U,v,R,H,_,y,g]);let ie=b(`div`,e,{state:{orientation:o,tabActivationDirection:M},ref:n,props:u,stateAttributesMapping:Ft});return(0,Z.jsx)(Mt.Provider,{value:V,children:(0,Z.jsx)(N,{elementsRef:f,children:ie})})});function Lt(e,t){for(let[n,r]of e.entries())if(t===r.value)return n;return null}function Rt(e,t,n,r){if(e==null||t==null)return`none`;let[i,a,o]=n===`horizontal`?[`left`,`left`,`right`]:[`top`,`up`,`down`],s=Lt(r,e),c=Lt(r,t);if(s==null||c==null)return s!==c&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?t>e?o:a:`none`;let l=s.getBoundingClientRect()[i],u=c.getBoundingClientRect()[i];return u<l?a:u>l?o:`none`}var zt=X.createContext(void 0);function Bt(){let e=X.useContext(zt);if(e===void 0)throw Error(O(65));return e}var Vt=X.forwardRef(function(e,n){let{className:i,disabled:a=!1,render:o,value:c,id:l,nativeButton:u=!0,style:f,...p}=e,{value:m,getTabPanelIdByValue:h,onValueChange:v,orientation:y,tabActivationDirection:x}=Nt(),{activateOnFocus:S,registerTabResizeObserverElement:C,tabsListElement:w}=Bt(),{highlightedIndex:D,onHighlightedIndexChange:O}=s(),k=T(l),A=X.useMemo(()=>({disabled:a,id:k,value:c}),[a,k,c]),{compositeProps:j,compositeRef:M,index:N}=R({metadata:A}),P=c===m,F=X.useRef(!1),ee=X.useRef(null),te=E(e=>{ee.current?.(),ee.current=e?C(e):null});t(()=>{if(F.current){F.current=!1;return}if(!(P&&N>-1&&D!==N))return;let e=w;if(e!=null){let t=B(r(e));if(t&&_(e,t))return}a||O(N)},[P,N,D,O,a,w]);let{getButtonProps:z,buttonRef:V}=d({disabled:a,native:u,focusableWhenDisabled:!0}),H=h(c),U=X.useRef(!1),W=X.useRef(!1);function ne(e){v(c,I(g,e.nativeEvent,void 0,{activationDirection:`none`}))}function G(e){P||a||ne(e)}function re(e){P||a||S&&(!U.current||W.current)&&ne(e)}function ie(e){if(P||a)return;U.current=!0,W.current=e.button===0;let t=r(e.currentTarget);function n(){U.current=!1,W.current=!1,t.removeEventListener(`pointerup`,n),t.removeEventListener(`pointercancel`,n)}t.addEventListener(`pointerup`,n),t.addEventListener(`pointercancel`,n)}return b(`button`,e,{state:{disabled:a,active:P,orientation:y,tabActivationDirection:x},ref:[n,V,M,te],props:[j,{role:`tab`,"aria-controls":H,"aria-selected":P,id:k,onClick:G,onFocus:re,onPointerDown:ie,[L]:P?``:void 0,onKeyDownCapture(){F.current=!0}},p,z],stateAttributesMapping:Ft})}),Ht=`data-index`,Ut={...Ft,...C},Wt=X.forwardRef(function(e,n){let{className:r,value:i,render:o,keepMounted:s=!1,style:l,...u}=e,{value:d,getTabIdByPanelValue:f,orientation:p,tabActivationDirection:m,registerMountedTabPanel:h}=Nt(),g=T(),{ref:_,index:y}=v(),x=i===d,{mounted:S,transitionStatus:C,setMounted:w}=c(x),E=!S,O=f(i),k={hidden:E,orientation:p,tabActivationDirection:m,transitionStatus:C},A=X.useRef(null),j=b(`div`,e,{state:k,ref:[n,_,A],props:[{"aria-labelledby":O,hidden:E,id:g,role:`tabpanel`,tabIndex:x?0:-1,inert:D(!x),[Ht]:y},u],stateAttributesMapping:Ut});return a({open:x,ref:A,onComplete(){x||w(!1)}}),t(()=>{if(!(g==null||E&&!s))return h(i,g)},[E,s,i,g,h]),s||S?j:null}),Gt=X.forwardRef(function(e,n){let{activateOnFocus:r=!1,className:i,loopFocus:a=!0,render:o,style:s,...c}=e,{orientation:l,setTabMap:u,tabActivationDirection:d}=Nt(),[f,p]=X.useState(0),[m,h]=X.useState(null),g=X.useRef(new Set),_=X.useRef(new Set),v=X.useRef(null);t(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{g.current.forEach(e=>{e()})});return v.current=e,m&&e.observe(m),_.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),v.current=null}},[m]);let y=E(e=>(g.current.add(e),()=>{g.current.delete(e)})),b=E(e=>(_.current.add(e),v.current?.observe(e),()=>{_.current.delete(e),v.current?.unobserve(e)})),x={orientation:l,tabActivationDirection:d},S={"aria-orientation":l===`vertical`?`vertical`:void 0,role:`tablist`},C=X.useMemo(()=>({activateOnFocus:r,registerIndicatorUpdateListener:y,registerTabResizeObserverElement:b,tabsListElement:m}),[r,y,b,m]);return(0,Z.jsx)(zt.Provider,{value:C,children:(0,Z.jsx)(j,{render:o,className:i,style:s,state:x,refs:[n,h],props:[S,c],stateAttributesMapping:Ft,highlightedIndex:f,enableHomeAndEndKeys:!0,loopFocus:a,orientation:l,onHighlightedIndexChange:p,onMapChange:u,disabledIndices:M})})}),Kt=new Map,qt=(0,X.createContext)(null);function Jt(){let e=(0,X.use)(qt);if(!e)throw Error(`You must wrap your component in <Tabs>`);return e}var Yt=Gt;function Xt({value:e,ref:t,...n}){let{triggers:r}=Jt();return(0,Z.jsx)(Vt,{ref:jt(t,t=>{t?r.add(e):r.delete(e)}),value:e,...n})}function Zt({ref:e,groupId:t,persist:n=!1,updateAnchor:r=!1,defaultValue:i,value:a,onValueChange:o,...s}){let c=(0,X.useRef)(null),l=(0,X.useMemo)(()=>new Map,[]),u=(0,X.useMemo)(()=>new Map,[]),d=(0,X.useMemo)(()=>new Set,[]),[f,p]=a===void 0?(0,X.useState)(i):[a,e=>o?.(e)],m=(0,X.useEffectEvent)(e=>{d.has(e)&&p(e)}),h=(0,X.useEffectEvent)(()=>{let e=window.location.hash.slice(1);if(!e)return;for(let[t,n]of l.entries())if(n===e){p(t),c.current?.scrollIntoView();return}let t=document.getElementById(e);if(t){for(let[e,n]of u.entries())if(n.contains(t)){p(e),requestAnimationFrame(()=>t.scrollIntoView());return}}});return(0,X.useLayoutEffect)(()=>{if(!t)return;let e=sessionStorage.getItem(t);n&&(e??=localStorage.getItem(t)),e&&m(e);let r=Kt.get(t)??new Set;return r.add(m),Kt.set(t,r),()=>{r.delete(m)}},[t,n]),(0,X.useLayoutEffect)(()=>(h(),window.addEventListener(`hashchange`,h),()=>window.removeEventListener(`hashchange`,h)),[]),(0,Z.jsx)(It,{ref:jt(e,c),value:f,onValueChange:e=>{if(r){let t=l.get(e);t&&window.history.replaceState(null,``,`#${t}`)}if(t){let r=Kt.get(t);if(r)for(let t of r)t(e);sessionStorage.setItem(t,e),n&&localStorage.setItem(t,e)}else p(e)},...s,children:(0,Z.jsx)(qt,{value:(0,X.useMemo)(()=>({valueToIdMap:l,panels:u,triggers:d}),[l,u,d]),children:s.children})})}function Qt({value:e,ref:t,...n}){let{valueToIdMap:r,panels:i}=Jt();return n.id&&r.set(e,n.id),(0,Z.jsx)(Wt,{ref:jt(t,t=>{t?i.set(e,t):i.delete(e)}),value:e,...n,children:n.children})}var $t=(0,X.createContext)(null);function en(e){return(0,Z.jsx)(`pre`,{...e,className:Y(`min-w-full w-max *:flex *:flex-col`,e.className),children:e.children})}function tn({ref:e,title:t,allowCopy:n=!0,keepBackground:r=!1,icon:i,viewportProps:a={},children:o,Actions:s=e=>(0,Z.jsx)(`div`,{...e,className:Y(`empty:hidden`,e.className)}),...c}){let l=(0,X.use)($t)!==null,u=(0,X.useRef)(null);return n===`true`?n=!0:n===`false`&&(n=!1),(0,Z.jsxs)(`figure`,{ref:e,dir:`ltr`,...c,tabIndex:-1,className:Y(l?`bg-fd-secondary -mx-px -mb-px last:rounded-b-xl`:`my-4 bg-fd-card rounded-xl`,r&&`bg-(--shiki-light-bg) dark:bg-(--shiki-dark-bg)`,`shiki relative border not-prose overflow-hidden text-sm`,c.className),children:[t?(0,Z.jsxs)(`div`,{className:`flex text-fd-muted-foreground items-center gap-2 h-9.5 border-b px-4`,children:[typeof i==`string`?(0,Z.jsx)(`div`,{className:`[&_svg]:size-3.5`,dangerouslySetInnerHTML:{__html:i}}):i,(0,Z.jsx)(`figcaption`,{className:`flex-1 truncate`,children:t}),s({className:`-me-2`,children:n&&(0,Z.jsx)(nn,{containerRef:u})})]}):s({className:`absolute top-2 right-2 z-2 backdrop-blur-lg rounded-lg text-fd-muted-foreground`,children:n&&(0,Z.jsx)(nn,{containerRef:u})}),(0,Z.jsx)(`div`,{ref:u,...a,role:`region`,tabIndex:0,className:Y(`text-[0.8125rem] py-3.5 overflow-auto max-h-[600px] fd-scroll-container focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-fd-ring`,a.className),style:{"--padding-right":t?void 0:`calc(var(--spacing) * 8)`,counterSet:c[`data-line-numbers`]?`line ${Number(c[`data-line-numbers-start`]??1)-1}`:void 0,...a.style},children:o})]})}function nn({className:e,containerRef:t,...n}){let r=St({note:`code block`}),[i,a]=yt(()=>{let e=t.current?.getElementsByTagName(`pre`).item(0);if(!e)return;let n=e.cloneNode(!0);return n.querySelectorAll(`.nd-copy-ignore`).forEach(e=>{e.replaceWith(`
2
+ `)}),navigator.clipboard.writeText(n.textContent??``)});return(0,Z.jsxs)(`button`,{type:`button`,"data-checked":i||void 0,className:Y(vt({className:`hover:text-fd-accent-foreground data-checked:text-fd-accent-foreground`,size:`icon-xs`}),e),"aria-live":`polite`,onClick:a,...n,children:[i?(0,Z.jsx)(F,{}):(0,Z.jsx)(ie,{}),(0,Z.jsx)(`span`,{className:`sr-only`,children:r(i?`Copied Text`:`Copy Text`,{note:`aria-label`})})]})}function rn({ref:e,className:t,...n}){let r=(0,X.useRef)(null),i=(0,X.use)($t)!==null;return(0,Z.jsx)(Zt,{ref:jt(r,e),...n,className:e=>Y(`bg-fd-card rounded-xl border`,!i&&`my-4`,typeof t==`function`?t(e):t),children:(0,Z.jsx)($t,{value:(0,X.useMemo)(()=>({containerRef:r,nested:i}),[i]),children:n.children})})}function an({className:e,...t}){return(0,Z.jsx)(Yt,{...t,className:t=>Y(`flex flex-row px-2 overflow-x-auto text-fd-muted-foreground`,typeof e==`function`?e(t):e),children:t.children})}function on({children:e,className:t,...n}){return(0,Z.jsxs)(Xt,{...n,className:e=>Y(`relative group inline-flex text-sm font-medium text-nowrap items-center transition-colors gap-2 px-2 py-1.5 [&_svg]:size-3.5`,e.active?`text-fd-primary`:`hover:text-fd-accent-foreground`,typeof t==`function`?t(e):t),children:[(0,Z.jsx)(`div`,{className:`absolute inset-x-2 bottom-0 h-px group-data-active:bg-fd-primary`}),e]})}function sn(e){return(0,Z.jsx)(Qt,{...e})}function cn(e){return(0,Z.jsx)(dt,{sizes:`(max-width: 768px) 100vw, (max-width: 1200px) 70vw, 900px`,...e,className:Y(`rounded-lg`,e.className)})}function ln(e){return(0,Z.jsx)(`div`,{className:`relative overflow-auto prose-no-margin my-6`,children:(0,Z.jsx)(`table`,{...e})})}var un={CodeBlockTab:sn,CodeBlockTabs:rn,CodeBlockTabsList:an,CodeBlockTabsTrigger:on,pre:e=>(0,Z.jsx)(tn,{...e,children:(0,Z.jsx)(en,{children:e.children})}),Card:ht,Cards:mt,a:pt,img:cn,h1:e=>(0,Z.jsx)(At,{as:`h1`,...e}),h2:e=>(0,Z.jsx)(At,{as:`h2`,...e}),h3:e=>(0,Z.jsx)(At,{as:`h3`,...e}),h4:e=>(0,Z.jsx)(At,{as:`h4`,...e}),h5:e=>(0,Z.jsx)(At,{as:`h5`,...e}),h6:e=>(0,Z.jsx)(At,{as:`h6`,...e}),table:ln,Callout:ot,CalloutContainer:Q,CalloutTitle:ct,CalloutDescription:$};function dn(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:i}=e,[a,o]=k({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:s,setMounted:l,transitionStatus:u}=c(a,!0,!0),d=T(),[f,p]=X.useState(),m=f===null?void 0:f??d,h=E(e=>{let t=!a,n=I(y,e.nativeEvent);r(t,n),!n.isCanceled&&o(t)});return X.useMemo(()=>({defaultPanelId:d,disabled:i,handleTrigger:h,mounted:s,open:a,panelId:m,setMounted:l,setOpen:o,setPanelIdState:p,transitionStatus:u}),[d,i,h,s,a,m,l,o,p,u])}var fn=X.createContext(void 0);function pn(){let e=X.useContext(fn);if(e===void 0)throw Error(O(15));return e}var mn=`data-open`,hn=`data-closed`,gn=h,_n=`data-panel-open`,vn={[mn]:``},yn={[hn]:``},bn={open(e){return e?{[_n]:``}:null}},xn={open(e){return e?vn:yn}},Sn={...xn,...C},Cn=X.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=E(o),d=dn({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=X.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=X.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=b(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:Sn});return(0,Z.jsx)(fn.Provider,{value:p,children:m})}),wn={...bn,...C},Tn=X.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=pn(),{className:s,disabled:c=o,render:l,nativeButton:u=!0,style:f,...p}=e,{getButtonProps:m,buttonRef:h}=d({disabled:c,native:u});return b(`button`,e,{state:a,ref:[t,h],props:[{"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i},p,m],stateAttributesMapping:wn})}),En={height:void 0,width:void 0};function Dn(e){let{externalRef:n,hiddenUntilFound:r,id:s,keepMounted:c,mounted:l,onOpenChange:d,open:p,setMounted:m,setOpen:h,transitionStatus:_}=e,v=X.useRef(null),y=X.useRef(null),[b,x]=X.useState(En),S=X.useRef(En),C=X.useRef(!1),w=X.useRef(p),T=X.useRef(!1),[D,O]=X.useState(!1),k=X.useRef(null),A=P(n,v),j=i(p),M=o(v),N=!p&&!l,F=D?`idle`:_,L=p&&(w.current||T.current),R=!p&&l&&y.current===`css-animation`&&b.height===void 0&&b.width===void 0?S.current:b,te=r&&N&&y.current!==`css-animation`,z=E((e,t=!0)=>{t&&(S.current=e),x(e)}),B=E(()=>{k.current?.(),k.current=null}),V=E(e=>{B(),k.current=()=>{k.current=null,e()}}),H=E(()=>{p&&l&&y.current===`css-animation`&&(T.current=!0)});t(()=>{D&&_!==`starting`&&O(!1)},[D,_]),X.useEffect(()=>()=>{H(),B()},[H,B]),t(()=>{p||(w.current=!1,T.current=!1);let e=v.current;if(!e)return;!p&&k.current&&B();let t=kn(e,L);if(y.current=t,p&&_===`idle`&&w.current&&t===`css-animation`){S.current=On(e);return}if(p&&_===`starting`){let n=C.current;if(C.current=!1,t===`none`){z(On(e)),O(!0);return}if(t===`css-transition`){let t=Mn(e);if(z(On(e)),!n)return t;let r=jn(e,`transition-duration`,`0s`);return V(r),O(!0),t}z(On(e));let r=jn(e,`animation-name`,`none`);if(!n){r();return}let i=jn(e,`animation-duration`,`0s`);r(),V(i),O(!0);return}if(!p&&l&&(_===`idle`||_===`starting`)){if(t===`none`){z(En,!1),m(!1);return}z(On(e));return}if(_!==`ending`)return;if(t===`none`){m(!1);return}let n=On(e);n.height>0||n.width>0?(z(n),t===`css-animation`&&jn(e,`animation-name`,`none`)()):m(!1)},[l,p,B,z,m,V,L,_]),a({enabled:p&&l&&F===`idle`,open:!0,ref:v,onComplete(){p&&z(En,!1)}}),X.useEffect(()=>{if(p||!l||F!==`ending`)return;if(!v.current){m(!1),z(En,!1);return}let e=new AbortController,t=-1;function n(){j.current||(m(!1),z(En,!1))}return t=f.request(()=>{M(n,e.signal)}),()=>{f.cancel(t),e.abort()}},[j,l,p,F,M,z,m]),t(()=>{let e=v.current;e&&r&&N&&e.setAttribute(`hidden`,`until-found`)},[N,r]),X.useEffect(function(){let e=v.current;if(!e)return;let t=u.create(),n=-1,r=(r,i)=>{t.start(0,()=>{j.current||(n=f.request(()=>{j.current||(r&&(C.current=!1),i&&e.setAttribute(gn,``),e.setAttribute(`hidden`,`until-found`))}))})},i=ee(e,`beforematch`,t=>{let n=I(g,t);if(d(!0,n),n.isCanceled){r(!1,!1);return}C.current=!0;let i=e.hasAttribute(gn);e.removeAttribute(gn),h(!0),r(!0,i)});return()=>{t.clear(),f.cancel(n),i()}},[j,d,h]);let U=c||r||l||p;return{height:R.height,props:{...te?{[gn]:``}:void 0,hidden:N,id:s},ref:A,shouldPreventOpenAnimation:L,shouldRender:U,transitionStatus:F,width:R.width}}function On(e){return{height:e.scrollHeight,width:e.scrollWidth}}function kn(e,t){let r=n(e).getComputedStyle(e),i=(r.animationName.split(`,`).map(e=>e.trim()).some(e=>e!==``&&e!==`none`)||t)&&An(r.animationDuration),a=An(r.transitionDuration);return i&&a||a?`css-transition`:i?`css-animation`:`none`}function An(e){return e.split(`,`).map(e=>e.trim()).some(e=>e!==``&&Number.parseFloat(e)>0)}function jn(e,t,n){let r=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{r===``?e.style.removeProperty(t):e.style.setProperty(t,r,i)}}function Mn(e){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)});function n(){Object.entries(t).forEach(([t,n])=>{n===``?e.style.removeProperty(t):e.style.setProperty(t,n)})}let r=f.request(n);return()=>{f.cancel(r),n()}}var Nn=`--collapsible-panel-height`,Pn=`--collapsible-panel-width`,Fn=X.forwardRef(function(e,n){let{className:r,hiddenUntilFound:i,keepMounted:a,render:o,id:s,style:c,...l}=e,{defaultPanelId:u,mounted:d,onOpenChange:f,open:p,setMounted:m,setPanelIdState:h,setOpen:g,state:_,transitionStatus:v}=pn(),y=i??!1,x=a??!1,S=s||void 0,C=S??u;t(()=>(h(e=>S??(e===null?void 0:e)),()=>{h(e=>e===S?null:e)}),[S,h]);let{height:w,props:T,ref:E,shouldPreventOpenAnimation:D,shouldRender:O,transitionStatus:k,width:A}=Dn({externalRef:n,hiddenUntilFound:y,id:C,keepMounted:x,mounted:d,onOpenChange:f,open:p,setMounted:m,setOpen:g,transitionStatus:v}),j={..._,transitionStatus:k},M=te(c,j),N=b(`div`,{...e,style:void 0},{state:j,ref:E,props:[T,{style:{[Nn]:w===void 0?`auto`:`${w}px`,[Pn]:A===void 0?`auto`:`${A}px`}},l,M?{style:M}:void 0,D?{style:{animationName:`none`}}:void 0],stateAttributesMapping:Sn});return O?N:null});export{pt as A,Nt as C,St as D,Ct as E,ue as F,ce as I,H as L,ot as M,Y as N,yt as O,me as P,Ft as S,At as T,Gt as _,xn as a,Bt as b,pn as c,tn as d,en as f,Xt as g,Yt as h,Cn as i,dt as j,vt as k,dn as l,Qt as m,Dn as n,bn as o,Zt as p,Tn as r,fn as s,Fn as t,un as u,Wt as v,jt as w,It as x,Vt as y};
@@ -0,0 +1 @@
1
+ import{r as e,t}from"./rolldown-runtime-XKyaHtl9.js";import{$ as n,A as r,At as i,Bt as a,Ct as o,Dt as s,F as c,Ft as l,G as u,Gt as d,Ht as f,I as p,It as m,Jt as h,K as g,Kt as _,L as v,Lt as y,M as b,Mt as x,N as S,Nt as C,P as w,Pt as T,Q as E,Qt as D,Rt as O,St as k,Tt as A,Ut as j,V as M,Vt as N,W as ee,Wt as te,Xt as ne,Yt as P,Z as re,Zt as F,_n as I,_t as L,an as ie,at as R,bt as z,cn as ae,d as oe,dt as B,en as V,gn as se,gt as ce,hn as le,ht as ue,i as de,in as fe,j as pe,jt as H,k as U,kt as W,lt as G,mn as me,nn as he,on as ge,ot as _e,pt as K,q,qt as ve,rn as ye,s as be,sn as xe,ut as J,vt as Y,wt as Se,xt as X,yt as Ce,zt as we}from"./preload-helper-CVJ-D494.js";var Te={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};Te.node;var Ee=me(Te),De={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]};De.node;var Oe=me(De),ke={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};ke.node;var Ae=me(ke),je={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};je.node;var Me=me(je);function Ne(e){return V(e.defaultTagName??`div`,e,e)}var Z=e(I(),1),Q=e(se(),1),Pe=e(le(),1),Fe=D(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function Ie({className:e,variant:t=`default`,render:n,...r}){return Ne({defaultTagName:`span`,props:ae({className:F(Fe({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}var Le=[],Re=void 0;function ze(){return Re}function Be(e){Le.push(e)}function Ve(e){let t=(t,n)=>{let r=xe(Ue).current,i;try{Re=r;for(let e of Le)e.before(r);i=e(t,n);for(let e of Le)e.after(r);r.didInitialize=!0}finally{Re=void 0}return i};return t.displayName=e.displayName||e.name,t}function He(e){return Z.forwardRef(Ve(e))}function Ue(){return{didInitialize:!1}}function We(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:Ge,platform:Ke,maxTouchPoints:qe}=We(),Je=Ge.toLowerCase(),Ye=Ke.toLowerCase(),Xe=/^i(os$|p)/.test(Ye)||Ye===`macintel`&&qe>1,Ze=`android`,Qe=Ye===Ze||Je.includes(Ze),$e=!Xe&&Ye.startsWith(`mac`);Ye.startsWith(`win`),!Qe&&/^(linux|chrome os)/.test(Ye);var et=$e||Xe,tt=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!tt&&Je.includes(`firefox`),!tt&&Je.includes(`chrom`);var nt=et,rt=/jsdom|happydom/.test(Je);function it(e){e.preventDefault(),e.stopPropagation()}function at(e){return`nativeEvent`in e}function ot(e){return e.pointerType===``&&e.isTrusted?!0:Qe&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function st(e){return rt?!1:!Qe&&e.width===0&&e.height===0||e.type===`pointerdown`&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`&&(Qe||e.buttons===0)||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function ct(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function lt(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var ut=`data-base-ui-focusable`,dt=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,ft=`ArrowLeft`,pt=`ArrowRight`,mt=`ArrowUp`,ht=`ArrowDown`,gt=`data-open`,_t=`data-closed`,vt=L,yt=ce,bt=`data-anchor-hidden`,xt=`data-popup-open`,St=`data-pressed`,Ct={[xt]:``},wt={[xt]:``,[St]:``},Tt={[gt]:``},Et={[_t]:``},Dt={[bt]:``},Ot={open(e){return e?Ct:null}},kt={open(e){return e?wt:null}},At={open(e){return e?Tt:Et},anchorHidden(e){return e?Dt:null}},jt={...At,...ue},Mt=`data-trigger-disabled`;function Nt(e,t){if(!f(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(Mt);for(let[,e]of t.entries())if(z(e,n))return!e.hasAttribute(Mt);return!1}function Pt(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function Ft(e){return e.matches(`html,body`)}function It(e){return j(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function Lt(e){return Ce(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${dt}`)!=null}function Rt(e){return e?e.getAttribute(`role`)===`combobox`&&It(e):!1}function zt(e){if(!e||rt)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function Bt(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function Vt(e,t){return t!=null&&!ct(t)?0:typeof e==`function`?e():e}function Ht(e,t,n){let r=Vt(e,n);return typeof r==`number`?r:r?.[t]}function Ut(e){return typeof e==`function`?e():e}function Wt(e,t){return t||e===`click`||e===`mousedown`}function Gt(e){return e?.includes(`mouse`)&&e!==`mousedown`}function Kt(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}var qt={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},Jt={...qt,position:`fixed`,margin:0,top:0,left:0},Yt={...qt,position:`absolute`},Xt=Z.forwardRef(function(e,t){let[n,r]=Z.useState();i(()=>{nt&&tt&&r(`button`)},[]);let a={tabIndex:0,role:n};return(0,Q.jsx)(`span`,{...e,ref:t,style:Jt,"aria-hidden":!n||void 0,...a,"data-base-ui-focus-guard":``})}),Zt=Math.min,Qt=Math.max,$t=Math.round,en=Math.floor,tn=e=>({x:e,y:e}),nn={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function rn(e,t,n){return Qt(e,Zt(t,n))}function an(e,t){return typeof e==`function`?e(t):e}function on(e){return e.split(`-`)[0]}function sn(e){return e.split(`-`)[1]}function cn(e){return e===`x`?`y`:`x`}function ln(e){return e===`y`?`height`:`width`}function un(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function dn(e){return cn(un(e))}function fn(e,t,n){n===void 0&&(n=!1);let r=sn(e),i=dn(e),a=ln(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=xn(o)),[o,xn(o)]}function pn(e){let t=xn(e);return[mn(e),t,mn(t)]}function mn(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var hn=[`left`,`right`],gn=[`right`,`left`],_n=[`top`,`bottom`],vn=[`bottom`,`top`];function yn(e,t,n){switch(e){case`top`:case`bottom`:return n?t?gn:hn:t?hn:gn;case`left`:case`right`:return t?_n:vn;default:return[]}}function bn(e,t,n,r){let i=sn(e),a=yn(on(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(mn)))),a}function xn(e){let t=on(e);return nn[t]+e.slice(t.length)}function Sn(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Cn(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Sn(e)}function wn(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}var Tn=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function En(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return ve(n)?n.host:null}function Dn(e){for(let t of Array.from(e.children))if(m(t)===`summary`)return t;return null}function On(e,t){let n=Dn(t);return!!n&&(e===n||z(n,e))}function kn(e){let t=e?m(e):``;return e!=null&&e.matches(Tn)&&(t!==`summary`||e.parentElement!=null&&m(e.parentElement)===`details`&&Dn(e.parentElement)===e)&&(t!==`details`||Dn(e)==null)&&(t!==`input`||e.type!==`hidden`)}function An(e){if(!kn(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=En(t)){let n=t!==e,r=m(t)===`slot`;if(t.hasAttribute(`inert`)||n&&m(t)===`details`&&!t.open&&!On(e,t)||t.hasAttribute(`hidden`)||!r&&!jn(t,n))return!1}return!0}function jn(e,t){let n=x(e);return t?n.display!==`none`:M(e,n)}function Mn(e){let t=e.tabIndex;if(t<0){let t=m(e);if(t===`details`||t===`audio`||t===`video`||j(e)&&e.isContentEditable)return 0}return t}function Nn(e){if(m(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Pn(e,t){let n=Nn(e);if(!n)return!0;let r=t.find(e=>{let t=Nn(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=Nn(e);return t?.name===n.name&&t.form===n.form})===n}function Fn(e){if(j(e)&&m(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return j(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function In(e,t){Fn(e).forEach(e=>{kn(e)&&t.push(e),In(e,t)})}function Ln(e,t,n){Fn(e).forEach(e=>{j(e)&&e.matches(t)&&n.push(e),Ln(e,t,n)})}function Rn(e){return An(e)&&Mn(e)>=0}function zn(e){let t=[];return In(e,t),t.filter(An)}function Bn(e){let t=zn(e);return t.filter(e=>Mn(e)>=0&&Pn(e,t))}function Vn(e,t){let n=Bn(e),r=n.length;if(r===0)return;let i=Y(s(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function Hn(e){return Vn(s(e).body,1)||e}function Un(e){return Vn(s(e).body,-1)||e}function Wn(e,t,n){if(!e)return null;let r=[];In(s(e).body,r);let i=r.indexOf(e);if(i===-1)return null;let a=r.filter(An);for(let e=1;e<r.length;e+=1){let o=r[(i+t*e+r.length)%r.length];if(!z(n,o)&&Rn(o)&&Pn(o,a))return o}return r[i]}function Gn(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!z(n,r)}function Kn(e){Bn(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function qn(e){let t=[];Ln(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function Jn(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...Jn(e,t.id,n)])}function Yn(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function Xn(e){return`data-base-ui-${e}`}var Zn=0;function Qn(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(Zn);function a(){(!i||i())&&e?.focus({preventScroll:n})}if(r)return a(),fe;let o=requestAnimationFrame(a);return Zn=o,()=>{Zn===o&&(cancelAnimationFrame(o),Zn=0)}}var $n=`data-base-ui-inert`,er=new WeakMap,tr=new WeakSet,nr=new WeakMap,rr=0;function ir(e){return e?ve(e)?e.host:ir(e.parentNode):null}var ar=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=ir(t);return e.contains(n)?n:null}).filter(e=>e!=null),or=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},sr=(e,t,n)=>{let r=[],i=e=>{e&&!n.has(e)&&Array.from(e.children).forEach(e=>{m(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function cr(e,t,n,{mark:r=!0}){let i=ar(t,e),a=r?sr(t,or(i),new Set(i)):[],o=[],s=[];if(n){let e=ar(t,Array.from(t.querySelectorAll(`[aria-live]`))),n=i.concat(e);sr(t,or(n),new Set(n)).forEach(e=>{let t=e.getAttribute(`aria-hidden`),n=t!==null&&t!==`false`,r=(er.get(e)||0)+1;er.set(e,r),o.push(e),r===1&&n&&tr.add(e),n||e.setAttribute(`aria-hidden`,`true`)})}return r&&a.forEach(e=>{let t=(nr.get(e)||0)+1;nr.set(e,t),s.push(e),t===1&&e.setAttribute($n,``)}),rr+=1,()=>{o.forEach(e=>{let t=(er.get(e)||0)-1;er.set(e,t),t||(tr.has(e)||e.removeAttribute(`aria-hidden`),tr.delete(e))}),r&&s.forEach(e=>{let t=(nr.get(e)||0)-1;nr.set(e,t),t||e.removeAttribute($n)}),--rr,rr||(er=new WeakMap,tr=new WeakSet,nr=new WeakMap)}}function lr(e,t={}){let{ariaHidden:n=!1,mark:r=!0}=t,i=s(e[0]).body;return cr(e,i,n,{mark:r})}var ur={style:{transition:`none`}},dr=`data-base-ui-click-trigger`,fr={fallbackAxisSide:`none`},pr={fallbackAxisSide:`end`},mr={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},hr=Z.createContext(null),gr=()=>Z.useContext(hr),_r=Xn(`portal`);function vr(e={}){let{ref:t,container:n,componentProps:r=ye,elementProps:a}=e,o=p(),s=gr()?.portalNode,[c,l]=Z.useState(null),[u,f]=Z.useState(null),m=H(e=>{e!==null&&f(e)}),h=Z.useRef(null);i(()=>{if(n===null){h.current&&(h.current=null,f(null),l(null));return}let e=(n&&(d(n)?n:n.current))??s??document.body;e==null?h.current&&(h.current=null,f(null),l(null)):h.current!==e&&(h.current=e,f(null),l(e))},[n,s]);let g=V(`div`,r,{ref:[t,m],props:[{id:o,[_r]:``},a]}),_=c&&g?Pe.createPortal(g,c):null;return{node:u,nodeId:Z.isValidElement(g)?g.props.id:void 0,subtree:_}}var yr=Z.forwardRef(function(e,t){let{render:n,className:r,style:a,children:o,container:s,portalOwnerRole:c,...l}=e,{node:u,nodeId:d,subtree:f}=vr({container:s,ref:t,componentProps:e,elementProps:l}),p=Z.useRef(null),m=Z.useRef(null),h=Z.useRef(null),g=Z.useRef(null),[_,v]=Z.useState(null),y=Z.useRef(!1),b=_?.modal,x=_?.open,S=!!_&&!_.modal&&_.open&&!!u;Z.useEffect(()=>{if(!u||b)return;function e(e){u&&e.relatedTarget&&Gn(e)&&(e.type===`focusin`?y.current&&=(qn(u),!1):(Kn(u),y.current=!0))}return Kt(q(u,`focusin`,e,!0),q(u,`focusout`,e,!0))},[u,b]),i(()=>{u&&x===!0&&y.current&&(qn(u),y.current=!1)},[x,u]);let C=Z.useMemo(()=>({beforeOutsideRef:p,afterOutsideRef:m,beforeInsideRef:h,afterInsideRef:g,portalNode:u,setFocusManagerState:v}),[u]);return(0,Q.jsxs)(Z.Fragment,{children:[f,(0,Q.jsxs)(hr.Provider,{value:C,children:[S&&u&&(0,Q.jsx)(Xt,{"data-type":`outside`,ref:p,onFocus:e=>{Gn(e,u)?h.current?.focus():Un(_?_.domReference:null)?.focus()}}),S&&u&&(0,Q.jsx)(`span`,{role:c,"aria-owns":d,style:mr}),u&&Pe.createPortal(o,u),S&&u&&(0,Q.jsx)(Xt,{"data-type":`outside`,ref:m,onFocus:e=>{Gn(e,u)?g.current?.focus():(Hn(_?_.domReference:null)?.focus(),_?.closeOnFocusOut&&_?.onOpenChange(!1,K(`focus-out`,e.nativeEvent)))}})]})]})});function br(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var xr=class{nodesRef={current:[]};events=br();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},Sr=Z.createContext(null),Cr=Z.createContext(null),wr=()=>Z.useContext(Sr)?.id||null,Tr=e=>{let t=Z.useContext(Cr);return e??t};function Er(e){let t=p(),n=Tr(e),r=wr();return i(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function Dr(e){let{children:t,id:n}=e,r=wr();return(0,Q.jsx)(Sr.Provider,{value:Z.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Or(e){let{children:t,externalTree:n}=e,r=xe(()=>n??new xr).current;return(0,Q.jsx)(Cr.Provider,{value:r,children:t})}function kr(e,t){let n=a(X(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||(ot(e)?`keyboard`:t||`mouse`):`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var Ar=20,jr=[];function Mr(){jr=jr.filter(e=>e.deref()?.isConnected)}function Nr(e){Mr(),e&&m(e)!==`body`&&(jr.push(new WeakRef(e)),jr.length>Ar&&(jr=jr.slice(-20)))}function Pr(){return Mr(),jr[jr.length-1]?.deref()}function Fr(e){return e?Rn(e)?e:Bn(e)[0]||e:null}function Ir(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=zn(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Rn(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function Lr(e){let{context:t,children:n,disabled:r=!1,initialFocus:a=!0,returnFocus:l=!0,explicitReturnFocus:d,restoreFocus:f=!1,modal:p=!0,closeOnFocusOut:h=!0,openInteractionType:_=``,nextFocusableElement:v,previousFocusableElement:y,beforeContentFocusGuardRef:b,externalTree:x,getInsideElements:S}=e,C=t.useState(`open`),w=t.useState(`domReferenceElement`),T=t.useState(`floatingElement`),{events:D,dataRef:O}=t.context,k=H(()=>O.current.floatingContext?.nodeId),A=a===!1,N=Rt(w)&&A,ee=g(a),te=g(l),ne=g(d),P=g(_),re=g(C),F=Tr(x),I=gr(),L=Z.useRef(!1),ie=Z.useRef(!1),R=Z.useRef(!1),ae=Z.useRef(null),oe=Z.useRef(``),B=Z.useRef(``),V=Z.useRef(null),se=Z.useRef(null),ce=ge(V,b,I?.beforeInsideRef),le=ge(se,I?.afterInsideRef),ue=o(),de=o(),fe=u(),pe=I!=null,U=Bt(T),W=H((e=U)=>e?Bn(e):[]),G=H(()=>S?.().filter(e=>e!=null)??[]);Z.useEffect(()=>{if(r||!p)return;function e(e){e.key===`Tab`&&z(U,Y(s(U)))&&W().length===0&&!N&&it(e)}let t=s(U);return q(t,`keydown`,e)},[r,U,p,N,W]),Z.useEffect(()=>{if(r||!C)return;let e=s(U);function t(){R.current=!1}function n(e){let t=X(e),n=G(),r=z(T,t)||z(w,t)||z(I?.portalNode,t)||n.some(e=>e===t||z(e,t));R.current=!r,B.current=e.pointerType||`keyboard`,Ce(t,`[data-base-ui-click-trigger]`)&&(ie.current=!0,de.start(0,()=>{ie.current=!1}))}function i(){B.current=`keyboard`}return Kt(q(e,`pointerdown`,n,!0),q(e,`pointerup`,t,!0),q(e,`pointercancel`,t,!0),q(e,`keydown`,i,!0),t)},[r,T,w,U,C,I,de,G]),Z.useEffect(()=>{if(r||!h)return;let e=s(U);function n(){ie.current=!0,de.start(0,()=>{ie.current=!1})}function i(e){let t=X(e);Rn(t)&&(ae.current=t)}function a(n){let r=n.relatedTarget,i=n.currentTarget,a=X(n);p&&r==null&&a!=null&&z(T,a)&&Nr(a),queueMicrotask(()=>{let o=k(),s=t.context.triggerElements,l=G(),u=r?.hasAttribute(Xn(`focus-guard`))&&[V.current,se.current,I?.beforeInsideRef.current,I?.afterInsideRef.current,I?.beforeOutsideRef.current,I?.afterOutsideRef.current,c(y),c(v)].includes(r),d=!(z(w,r)||z(T,r)||z(r,T)||z(I?.portalNode,r)||l.some(e=>e===r||z(e,r))||s.hasMatchingElement(e=>z(e,r))||u||F&&(Jn(F.nodesRef.current,o).find(e=>z(e.context?.elements.floating,r)||z(e.context?.elements.domReference,r))||Yn(F.nodesRef.current,o).find(e=>[e.context?.elements.floating,Bt(e.context?.elements.floating)].includes(r)||e.context?.elements.domReference===r)));if(i===w&&U&&Ir(U),f&&i!==w&&!M(a)&&Y(e)===e.body){if(j(U)&&(U.focus(),f===`popup`)){fe.request(()=>{U.focus()});return}let e=W(),t=ae.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||U;j(n)&&n.focus()}O.current.insideReactTree?O.current.insideReactTree=!1:(N||!p)&&r&&d&&!ie.current&&(N||r!==Pr())&&(L.current=!0,t.setOpen(!1,K(E,n)))})}function o(){R.current||(O.current.insideReactTree=!0,ue.start(0,()=>{O.current.insideReactTree=!1}))}let l=j(w)?w:null;if(T||l)return Kt(l&&q(l,`focusout`,a),l&&q(l,`pointerdown`,n),T&&q(T,`focusin`,i),T&&q(T,`focusout`,a),T&&I&&q(T,`focusout`,o,!0))},[r,w,T,U,p,F,I,t,h,f,W,N,k,O,ue,de,fe,v,y,G]),Z.useEffect(()=>{if(r||!T||!C)return;let e=Array.from(I?.portalNode?.querySelectorAll(`[${Xn(`portal`)}]`)||[]),t=(F?Yn(F.nodesRef.current,k()):[]).find(e=>Rt(e.context?.elements.domReference||null))?.context?.elements.domReference,n=lr([T,...e,V.current,se.current,I?.beforeOutsideRef.current,I?.afterOutsideRef.current,...G(),t,c(y),c(v),N?w:null].filter(e=>e!=null),{ariaHidden:p||N,mark:!1}),i=lr([T,...e].filter(e=>e!=null));return()=>{i(),n()}},[C,r,w,T,p,I,N,F,k,v,y,G]),i(()=>{if(!C||r||!j(U))return;oe.current=``,B.current=``;let e=s(U),t=Y(e);queueMicrotask(()=>{let n=ee.current,r=typeof n==`function`?n(P.current||``):n;if(r===void 0||r===!1||z(U,t))return;let i=null,a=()=>(i??=W(U),i[0]||U),o;o=r===!0||r===null?a():c(r),o||=a();let s=z(U,Y(e)),l=O.current.openEvent,u=l?.type===`mousedown`&&ot(l);Qn(o,{sync:u,preventScroll:o===U,shouldFocus(){if(!re.current)return!1;if(s)return!0;let t=Y(e);return!(t!==o&&z(U,t))}})})},[r,C,U,W,ee,P,re,O]);let me=Z.useRef(null);i(()=>{if(r||!U){me.current=null;return}me.current&&=(me.current.cancelled=!0,null);let e=s(U),t=Y(e),n=P.current==null;Nr(t);function i(e){if(e.open||(oe.current=kr(e.nativeEvent,B.current)),(e.reason===`focus-out`&&e.triggerElement?.hasAttribute(Xn(`focus-guard`))||e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`)&&(L.current=!0),e.reason===`outside-press`){if(e.nested)L.current=!1;else if(ot(e.nativeEvent)||st(e.nativeEvent))L.current=!1;else{let e=!1;s(U).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?L.current=!1:L.current=!0}}}D.on(`openchange`,i);function a(e){let r=te.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=w?.isConnected?w:null,o=t?.isConnected&&m(t)!==`body`?t:null,s=n?o||a:a||o;return s||=Pr()||null,typeof i==`boolean`?s:c(i)||s||null}return()=>{D.off(`openchange`,i);let t=Y(e),n=G(),r=z(T,t)||n.some(e=>e===t||z(e,t))||F&&Jn(F.nodesRef.current,k(),!1).some(e=>z(e.context?.elements.floating,t)),o=te.current,s=oe.current,c=a(s),l={cancelled:!1};me.current=l,queueMicrotask(()=>{me.current===l&&(me.current=null);let n=Fr(c),i=ne.current??typeof o!=`boolean`;if(!l.cancelled&&o&&!L.current&&j(n)&&(i||n===t||t===e.body||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}L.current=!1})}},[r,T,U,te,ne,P,D,F,w,k,G]),i(()=>{if(!tt||C||!T)return;let e=Y(s(T));j(e)&&It(e)&&z(T,e)&&e.blur()},[C,T]),i(()=>{if(!r&&I)return I.setFocusManagerState({modal:p,closeOnFocusOut:h,open:C,onOpenChange:t.setOpen,domReference:w}),()=>{I.setFocusManagerState(null)}},[r,I,p,C,t,h,w]),i(()=>{if(!r&&U)return Ir(U),()=>{queueMicrotask(Mr)}},[r,U]);let he=!r&&(!p||!N)&&(pe||p);return(0,Q.jsxs)(Z.Fragment,{children:[he&&(0,Q.jsx)(Xt,{"data-type":`inside`,ref:ce,onFocus:e=>{if(p){let e=W();Qn(e[e.length-1])}else I?.portalNode&&(L.current=!1,Gn(e,I.portalNode)?Hn(w)?.focus():c(y??I.beforeOutsideRef)?.focus())}}),n,he&&(0,Q.jsx)(Xt,{"data-type":`inside`,ref:le,onFocus:e=>{p?Qn(W()[0]):I?.portalNode&&(h&&(L.current=!0),Gn(e,I.portalNode)?Un(w)?.focus():c(v??I.afterOutsideRef)?.focus())}})]})}function Rr(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:s=!0,touchOpenDelay:c=0,reason:l=B}=t,d=e.context.dataRef,f=Z.useRef(void 0),p=u(),m=o(),h=Z.useMemo(()=>{function t(t,n,r,i){let a=K(l,n,r);t&&i===`touch`&&c>0?m.start(c,()=>{e.setOpen(!0,a)}):e.setOpen(t,a)}function n(t,n,r){let a=d.current.openEvent,o=e.select(`domReferenceElement`)!==n;return t&&o||!t||!i?!0:a&&(typeof s==`function`?s():s)?!r(a.type):!1}return{onPointerDown(e){f.current=ct(e.pointerType,!0)&&st(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(i){let o=f.current,s=i.nativeEvent,c=e.select(`open`);if(i.button!==0||r===`click`||ct(o,!0)&&a)return;let l=n(c,i.currentTarget,e=>e===`click`||e===`mousedown`),u=X(s),d=It(u);if(d||o===`virtual`){t(l,s,d?u:i.currentTarget,o);return}let m=i.currentTarget;p.request(()=>{t(l,s,m,o)})},onClick(i){if(r===`mousedown-only`)return;let o=f.current;r===`mousedown`&&o?f.current=void 0:ct(o,!0)&&a||t(n(e.select(`open`),i.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),i.nativeEvent,i.currentTarget,o)},onKeyDown(){f.current=void 0}}},[d,r,a,l,e,s,i,p,m,c]);return Z.useMemo(()=>n?{reference:h}:ye,[n,h])}function zr(){return!1}function Br(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function Vr(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:c=zr,bubbles:l,externalTree:u}=t,d=e.useState(`open`),p=e.useState(`floatingElement`),{dataRef:m,events:h}=e.context,g=Tr(u),_=H(typeof i==`function`?i:()=>!1),v=typeof i==`function`?_:i,y=v!==!1,b=H(()=>a),{escapeKey:S,outsidePress:C}=Br(l),w=Z.useRef(!1),T=Z.useRef(!1),E=Z.useRef(!1),D=Z.useRef(!1),O=Z.useRef(!1),A=Z.useRef(``),M=Z.useRef(null),N=o(),ee=o(),ne=o(),P=H(()=>{ee.clear(),m.current.insideReactTree=!1}),F=H(e=>{let t=m.current.floatingContext?.nodeId;return(g?Jn(g.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),I=H(t=>Pt(t,e.select(`floatingElement`))||Pt(t,e.select(`domReferenceElement`))),L=H(t=>{c()&&e.setOpen(!1,K(B,t.nativeEvent))}),ie=H(t=>{if(!d||!n||!r||t.key!==`Escape`)return;let i=at(t)?t.nativeEvent:t;if(O.current||i.isComposing||!S&&F(`__escapeKeyBubbles`))return;let a=K(re,i);e.setOpen(!1,a),a.isCanceled||t.preventDefault(),!S&&!a.isPropagationAllowed&&t.stopPropagation()}),R=H(()=>{m.current.insideReactTree=!0,ee.start(0,P)}),ae=H(t=>{if(!d||!n||t.button!==0)return;let r=X(t.nativeEvent);z(e.select(`floatingElement`),r)&&(w.current||(w.current=!0,T.current=!1))}),oe=H(e=>{d&&n&&(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&w.current&&(T.current=!0)});Z.useEffect(()=>{function e(e){e.open||(D.current=!1)}return h.on(`openchange`,e),()=>{h.off(`openchange`,e)}},[h]),Z.useEffect(()=>P,[P]),Z.useEffect(()=>{if(!d||!n)return d||(D.current=!1,O.current=!1,A.current=``,M.current=null),P;m.current.__escapeKeyBubbles=S,m.current.__outsidePressBubbles=C;let t=new k,i=s(p);function a(){ne.clear(),O.current=!0}function o(){O.current=!0,ne.start(tt?5:0,()=>{O.current=!1})}function c(){E.current=!0,t.start(0,()=>{E.current=!1})}function l(){w.current=!1,T.current=!1}function u(){let e=A.current,t=e===`pen`||!e?`mouse`:e,n=b(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function h(e){let t=u();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function _(e){let t=m.current.floatingContext?.nodeId,n=g&&Jn(g.nodesRef.current,t).some(t=>Pt(e,t.context?.elements.floating));return I(e)||n}function ee(n){if(h(n)){n.type!==`click`&&!I(n)&&(t.clear(),E.current=!1),P();return}if(m.current.insideReactTree){P();return}let r=X(n),i=`[${Xn(`inert`)}]`,a=f(r)?r.getRootNode():null,o=Array.from((ve(a)?a:s(e.select(`floatingElement`))).querySelectorAll(i)),c=e.context.triggerElements;if(r&&(c.hasElement(r)||c.hasMatchingElement(e=>z(e,r))))return;let l=f(r)?r:null;for(;l&&!te(l);){let e=we(l);if(te(e)||!f(e))break;l=e}if(!(o.length&&f(r)&&!Ft(r)&&!z(r,e.select(`floatingElement`))&&o.every(e=>!z(l,e)))){if(j(r)&&!(`touches`in n)){let e=te(r),t=x(r),i=/auto|scroll/,a=e||i.test(t.overflowX),o=e||i.test(t.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=t.direction===`rtl`,u=c&&(l?n.offsetX<=r.offsetWidth-r.clientWidth:n.offsetX>r.clientWidth),d=s&&n.offsetY>r.clientHeight;if(u||d)return}if(!_(n)){if(u()===`intentional`){if(n.detail!==0&&!ot(n)&&!D.current)return;if(E.current){t.clear(),E.current=!1;return}}(typeof v!=`function`||v(n))&&(F(`__outsidePressBubbles`)||(e.setOpen(!1,K(_e,n)),P()))}}}function re(t){u()===`sloppy`&&t.pointerType!==`touch`&&e.select(`open`)&&n&&!I(t)&&ee(t)}function L(t){if(u()!==`sloppy`||!e.select(`open`)||!n||I(t))return;let r=t.touches[0];r&&(M.current={startTime:Date.now(),startX:r.clientX,startY:r.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},N.start(1e3,()=>{M.current&&(M.current.dismissOnTouchEnd=!1,M.current.dismissOnMouseDown=!1)}))}function R(e,t){let n=X(e);if(!n)return;let r=q(n,e.type,()=>{t(e),r()})}function ae(e){A.current=`touch`,R(e,L)}function oe(e){N.clear(),e.type===`pointerdown`&&(e.button===0&&(D.current=!0),A.current=e.pointerType),(e.type!==`mousedown`||!M.current||M.current.dismissOnMouseDown)&&R(e,e=>{e.type===`pointerdown`?re(e):ee(e)})}function B(e){if(e.type===`pointercancel`&&(D.current=!1),!w.current)return;let n=T.current;l(),u()===`intentional`&&(e.type===`pointercancel`?n&&c():_(e)||(n?c():(typeof v!=`function`||v(e))&&(t.clear(),E.current=!0,P())))}function V(e){if(u()!==`sloppy`||!M.current||I(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-M.current.startX),r=Math.abs(t.clientY-M.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(M.current.dismissOnTouchEnd=!0),i>10&&(ee(e),N.clear(),M.current=null)}function se(e){R(e,V)}function ce(e){u()===`sloppy`&&M.current&&!I(e)&&(M.current.dismissOnTouchEnd&&ee(e),N.clear(),M.current=null)}function le(e){R(e,ce)}let ue=Kt(r&&Kt(q(i,`keydown`,ie),q(i,`compositionstart`,a),q(i,`compositionend`,o)),y&&Kt(q(i,`click`,oe,!0),q(i,`pointerdown`,oe,!0),q(i,`pointerup`,B,!0),q(i,`pointercancel`,B,!0),q(i,`mousedown`,oe,!0),q(i,`mouseup`,B,!0),q(i,`touchstart`,ae,{capture:!0,passive:!0}),q(i,`touchmove`,se,{capture:!0,passive:!0}),q(i,`touchend`,le,{capture:!0,passive:!0})));return()=>{ue(),t.clear(),l(),E.current=!1}},[m,p,r,y,v,d,n,S,C,ie,P,b,F,I,g,e,N,ne]);let V=Z.useMemo(()=>({onKeyDown:ie,onPointerDown:L,onClick:L}),[ie,L]),se=Z.useMemo(()=>({onKeyDown:ie,onPointerDown:oe,onMouseDown:oe,onClickCapture:R,onMouseDownCapture(e){R(),ae(e)},onPointerDownCapture(e){R(),ae(e)},onMouseUpCapture:R,onTouchEndCapture:R,onTouchMoveCapture:R}),[ie,R,ae,oe]);return Z.useMemo(()=>n?{reference:V,floating:se,trigger:V}:{},[n,V,se])}function Hr(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:a,nested:o,onOpenChange:s}=e,c=t.useState(`open`),l=t.useState(`activeTriggerElement`),u=t.useState(n?`popupElement`:`positionerElement`),d=s;return t.useSyncedValue(`floatingId`,a),i(()=>{let e={open:c,floatingId:a,referenceElement:l,floatingElement:u};f(l)&&(e.domReferenceElement=l),r.state.positionReference===r.state.referenceElement&&(e.positionReference=l),r.update(e)},[c,a,l,u,r]),r.context.onOpenChange=d,r.context.nested=o,r}function Ur(e){let{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:a,onUnmount:o,animateInitialOpen:s}=e,c=H(a),{mounted:l,setMounted:u,transitionStatus:d}=w(t,!1,!1,s),f=!t&&r;i(()=>{t&&c(!1)},[t,c]);let p=Z.useRef(l),m=Z.useRef(!1),h=v(),g=()=>{p.current=!1,u(!1),o()};i(()=>{p.current=l,m.current&&(m.current=!1,!t&&l&&g())});let _=H(()=>{p.current&&(t?(m.current=!0,h()):g())});return b({enabled:l&&!t&&!f,open:t,ref:n,onComplete(){t||_()}}),{mounted:l,transitionStatus:d,preventUnmountingOnClose:f,forceUnmount:_}}var Wr={tabIndex:-1,[ut]:``};function Gr(e){return t=>t!==`touch`||e.current}function Kr(e,t=!1){let n=p(),r=wr()!=null,i=xe(()=>e(n,r)).current;return Hr({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function qr({handle:e,store:t}){return i(()=>e.attachStore(t),[e,t]),null}function Jr(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function Yr(e,t){let n=Z.useRef(null);return H(r=>{let i=n.current;if(i!==null){if(i.element===r&&i.store===t&&i.id===e)return;n.current=null;let a=i.store;a.context.triggerElements.getById(i.id)===i.element&&(a.context.triggerElements.delete(i.id),Jr(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),Jr(t))})}function Xr(e,t,n,r=!1){let i=e.preventUnmountingOnClose;t?i=!1:r&&(i=!0);let a=n?.id??null,o=e.activeTriggerId,s=e.activeTriggerElement;return(a||t)&&(o=a,s=n??null),{open:t,preventUnmountingOnClose:i,activeTriggerId:o,activeTriggerElement:s,openedWithoutTrigger:t?n==null:e.openedWithoutTrigger}}function Zr(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Qr(e,t,n,r={}){let i=n.reason,a=i===J,o=t&&i===`trigger-focus`,s=!t&&(i===`trigger-press`||i===`escape-key`),c=Zr(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);let l=()=>{let i=Xr(e.state,t,n.trigger,c()),l={...r.extraState,...i};o?l.instantType=`focus`:s?l.instantType=`dismiss`:a&&(l.instantType=void 0),e.update(l)};a?Pe.flushSync(l):l()}function $r(e,t,n,r){let a=n.useState(`isMountedByTrigger`,e),o=Yr(e,n),s=H(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){let e={activeTriggerElement:t,...i?r:null};n.update(e)}else if(a==null&&i&&!n.state.openedWithoutTrigger){let i={activeTriggerId:e??null,activeTriggerElement:t,...r};n.update(i)}}),c=H(e=>{o(e),e&&s(e)});return i(()=>(c(t.current),()=>c(null)),[c,t,n,e]),i(()=>{if(a){let e={activeTriggerElement:t.current,...r};n.update(e)}},[a,n,t,...Object.values(r)]),{registerTrigger:c,isMountedByThisTrigger:a}}function ei(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=Z.useRef(null),a=e.useState(`open`),o=e.useState(`triggerCount`),s=e.useState(`activeTriggerId`),c=e.useState(`activeTriggerElement`);i(()=>{if(!a){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0),e.state.openedWithoutTrigger&&e.set(`openedWithoutTrigger`,!1);return}let t=e.context.triggerElements.size,i={};e.state.triggerCount!==t&&(i.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(i.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){i.activeTriggerId=t,i.activeTriggerElement=n,r.current=t;break}i.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&!e.state.openedWithoutTrigger&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;i.activeTriggerId=e,i.activeTriggerElement=n,r.current=e}}(i.triggerCount!==void 0||i.activeTriggerId!==void 0||i.activeTriggerElement!==void 0)&&e.update(i),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=K(R);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[a,e,o,s,c,n])}function ti(e,t,n,r){let{mounted:i,transitionStatus:a,forceUnmount:o}=Ur({open:e,ref:t.context.popupRef,preventUnmountOnClose:t.useState(`preventUnmountingOnClose`),setPreventUnmountOnClose:e=>t.set(`preventUnmountingOnClose`,e),animateInitialOpen:r,onUnmount(){t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}});return xe(()=>(t.set(`mounted`,i),null)),t.useSyncedValues({mounted:i,transitionStatus:a}),{forceUnmount:o,transitionStatus:a}}function ni(e,t){e.useSyncedValues(t),i(()=>()=>{e.update({activeTriggerProps:ye,inactiveTriggerProps:ye,popupProps:ye})},[e])}function ri(e,t){i(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),i(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var ii=class{idMap=new Map;add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}},ai=t((e=>{var t=I();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),oi=t(((e,t)=>{t.exports=ai()})),si=t((e=>{var t=I(),n=oi();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),ci=t(((e,t)=>{t.exports=si()})),li=oi(),ui=ci(),di=ie(19)?mi:hi;function fi(e,t,n,r,i){return di(e,t,n,r,i)}function pi(e,t,n,r,i){let a=Z.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,li.useSyncExternalStore)(e.subscribe,a,a)}Be({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,li.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function mi(e,t,n,r,i){let a=ze();if(!a)return pi(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function hi(e,t,n,r,i){return(0,ui.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var gi=class{static create(e){return new this(e)}constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return fi(this,e,t,n,r)}},_i=class extends gi{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){Z.useDebugValue(e);let n=this;i(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;i(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this,n=Object.values(e);i(()=>{t.update(e)},[t,...n])}useControlledProp(e,t){Z.useDebugValue(e);let n=this,r=t!==void 0;i(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return Z.useDebugValue(e),fi(this,this.selectors[e],t,n,r)}useContextCallback(e,t){Z.useDebugValue(e);let n=H(t??fe);this.context[e]=n}useStateSetter(e){let t=Z.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},vi={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},yi=class extends _i{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:br(),nested:n,triggerElements:i},vi),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&lt(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{this.syncOnly||this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function bi(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new yi({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,openedWithoutTrigger:!1,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:ye,inactiveTriggerProps:ye,popupProps:ye}}var xi=e=>e.triggerIdProp??e.activeTriggerId,Si=e=>e.openProp??e.open,Ci=e=>(e.popupElement?.id??e.floatingId)||void 0;function wi(e,t){return t!==void 0&&Si(e)&&xi(e)===t}function Ti(e,t){return wi(e,t)?!0:t!==void 0&&Si(e)&&xi(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}var Ei={open:Si,mounted:e=>e.mounted,transitionStatus:e=>Si(e)&&!e.mounted?`starting`:e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:xi,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Ci,isTriggerActive:(e,t)=>t!==void 0&&xi(e)===t,isOpenedByTrigger:(e,t)=>wi(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&xi(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>Ti(e,t)?Ci(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function Di(e){let t=Z.useCallback(t=>e===void 0?fe:e.subscribeStore(t),[e]),n=Z.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,li.useSyncExternalStore)(t,n,()=>e?.serverStore)}var Oi=$e&&tt;function ki(e,t={}){let{enabled:n=!0,delay:r}=t,{events:i,dataRef:c}=e.context,l=Z.useRef(!1),u=Z.useRef(null),d=Z.useRef(!0),p=o();Z.useEffect(()=>{let t=e.select(`domReferenceElement`);if(!n)return;let r=a(t);function i(){let t=e.select(`domReferenceElement`);!e.select(`open`)&&j(t)&&t===Y(s(t))&&(l.current=!0,u.current=t)}function o(){d.current=!0}function c(){d.current=!1}return Kt(q(r,`blur`,i),Oi&&q(r,`keydown`,o,!0),Oi&&q(r,`pointerdown`,c,!0))},[e,n]),Z.useEffect(()=>{if(!n)return;function t(t){if(t.reason===`trigger-press`||t.reason===`escape-key`){let t=e.select(`domReferenceElement`);f(t)&&(u.current=t,l.current=!0)}}return i.on(`openchange`,t),()=>{i.off(`openchange`,t)}},[i,n,e]);let m=Z.useMemo(()=>{function t(){l.current=!1,u.current=null}return{onMouseLeave(){t()},onFocus(n){let i=n.currentTarget;if(l.current){if(u.current===i)return;t()}let a=X(n.nativeEvent);if(f(a)){if(Oi&&!n.relatedTarget){if(!d.current&&!It(a))return}else if(!zt(a))return}let o=Nt(n.relatedTarget,e.context.triggerElements),{nativeEvent:s,currentTarget:c}=n;e.select(`open`)&&o||!r?e.setOpen(!0,K(G,s,c)):p.start(r,()=>{l.current||e.setOpen(!0,K(G,s,c))})},onBlur(n){t();let r=n.relatedTarget,i=n.nativeEvent,a=f(r)&&r.hasAttribute(Xn(`focus-guard`))&&r.getAttribute(`data-type`)===`outside`;p.start(0,()=>{let t=e.select(`domReferenceElement`),n=Y(s(t));(r||n!==t)&&(z(c.current.floatingContext?.refs.floating.current,n)||z(t,n)||a||Nt(r??n,e.context.triggerElements)||e.setOpen(!1,K(G,i)))})}}},[c,r,e,p]);return Z.useMemo(()=>n?{reference:m,trigger:m}:{},[n,m])}var Ai=class e{pointerType=void 0;interactedInside=!1;handler=void 0;blockMouseMove=!0;performedPointerEventsMutation=!1;pointerEventsScopeElement=null;pointerEventsReferenceElement=null;pointerEventsFloatingElement=null;restTimeoutPending=!1;openChangeTimeout=new k;restTimeout=new k;handleCloseOptions=void 0;static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},ji=new WeakMap;function Mi(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&ji.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),ji.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Ni(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=ji.get(n);a&&a!==e&&Mi(a),Mi(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,ji.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function Pi(e){let t=e.context.dataRef.current,n=xe(()=>t.hoverInteractionState??Ai.create()).current;return t.hoverInteractionState||=n,Se(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function Fi(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:a}=t,c=e.useState(`open`),l=e.useState(`floatingElement`),u=e.useState(`domReferenceElement`),{dataRef:d}=e.context,p=Tr(),m=wr(),h=Pi(e),g=o(),_=H(()=>Wt(d.current.openEvent?.type,h.interactedInside)),v=H(()=>Gt(d.current.openEvent?.type)),y=H(()=>{Mi(h)});i(()=>{c||(h.pointerType=void 0,h.restTimeoutPending=!1,h.interactedInside=!1,y())},[c,h,y]),Z.useEffect(()=>y,[y]),i(()=>{if(n&&c&&h.handleCloseOptions?.blockPointerEvents&&v()&&f(u)&&l){let e=u,t=l,n=s(l),r=p?.nodesRef.current.find(e=>e.id===m)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=h.pointerEventsScopeElement===t?null:h.pointerEventsScopeElement,a=r===t?null:r,o=h.handleCloseOptions?.getScope?.()??i??a??Ce(e,`[data-rootownerid]`)??n.body;return Ni(h,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{y()}}},[n,c,u,l,h,v,p,m,y]),Z.useEffect(()=>{if(!n)return;function t(){return!!(p&&m&&Jn(p.nodesRef.current,m).length>0)}function i(t){let n=Ht(r,`close`,h.pointerType),i=()=>{e.setOpen(!1,K(J,t)),p?.events.emit(`floating.closed`,t)};n?h.openChangeTimeout.start(n,i):(h.openChangeTimeout.clear(),i())}function o(e){let t=X(e);Lt(t)?h.interactedInside=Ce(t,`[aria-haspopup]`)!=null:h.interactedInside=!1}function s(){h.openChangeTimeout.clear(),g.clear(),p?.events.off(`floating.closed`,u),y()}function c(n){if(t()&&p){p.events.on(`floating.closed`,u);return}if(Nt(n.relatedTarget,e.context.triggerElements))return;let r=d.current.floatingContext?.nodeId??a,o=n.relatedTarget;p&&r&&f(o)&&Jn(p.nodesRef.current,r,!1).some(e=>z(e.context?.elements.floating,o))||(h.handler?h.handler(n):(y(),v()&&!_()&&i(n)))}function u(n){p&&m&&!t()&&g.start(0,()=>{p.events.off(`floating.closed`,u),e.setOpen(!1,K(J,n)),p.events.emit(`floating.closed`,n)})}let b=l;return Kt(b&&q(b,`mouseenter`,s),b&&q(b,`mouseleave`,c),b&&q(b,`pointerdown`,o,!0),()=>{p?.events.off(`floating.closed`,u)})},[n,l,e,d,r,a,v,_,y,h,p,m,g])}var Ii={current:null};function Li(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:c=!0,triggerElementRef:l=Ii,externalTree:u,isActiveTrigger:d=!0,getHandleCloseContext:p,isClosing:m,shouldOpen:h,guardStaleOpen:_=!1}=t,{dataRef:v,events:y}=e.context,b=Tr(u),x=Pi(e),S=Z.useRef(!1),C=g(i),w=g(r),T=g(o),E=g(n),D=g(h),O=g(m),k=H(()=>Wt(v.current.openEvent?.type,x.interactedInside)),A=H(()=>D.current?.()!==!1),j=H((t,n,r)=>{let i=e.context.triggerElements;if(i.hasElement(n))return!t||!z(t,n);if(!f(r))return!1;let a=r;return i.hasMatchingElement(e=>z(e,a))&&(!t||!z(t,a))}),M=H(()=>{x.handler&&=(s(e.select(`domReferenceElement`)).removeEventListener(`mousemove`,x.handler),void 0)}),N=H(()=>{Mi(x)});return d&&(x.handleCloseOptions=i?.__options),Z.useEffect(()=>M,[M]),Z.useEffect(()=>{if(!n)return;function e(e){e.open?S.current=!1:(S.current=e.reason===J,M(),x.openChangeTimeout.clear(),x.restTimeout.clear(),x.blockMouseMove=!0,x.restTimeoutPending=!1)}return y.on(`openchange`,e),()=>{y.off(`openchange`,e)}},[n,y,x,M]),Z.useEffect(()=>{if(!n)return;function t(t,n=!0){let r=Ht(w.current,`close`,x.pointerType);r?x.openChangeTimeout.start(r,()=>{e.setOpen(!1,K(J,t)),b?.events.emit(`floating.closed`,t)}):n&&(x.openChangeTimeout.clear(),e.setOpen(!1,K(J,t)),b?.events.emit(`floating.closed`,t))}let r=l.current??(d?e.select(`domReferenceElement`):null);if(!f(r))return;function i(t){if(x.openChangeTimeout.clear(),x.blockMouseMove=!1,a&&!ct(x.pointerType))return;let n=Ut(T.current),r=Ht(w.current,`open`,x.pointerType),i=X(t),o=t.currentTarget??null,s=e.select(`domReferenceElement`),c=o;if(f(i)&&!e.context.triggerElements.hasElement(i)){for(let t of e.context.triggerElements.elements())if(z(t,i)){c=t;break}}f(o)&&f(s)&&!e.context.triggerElements.hasElement(o)&&z(o,s)&&(c=s);let l=c!=null&&j(s,c,i),u=e.select(`open`),d=O.current?.()??e.select(`transitionStatus`)===`ending`,p=!u&&d&&S.current,m=!l&&f(c)&&f(s)&&z(s,c)&&p,h=n>0&&!r,g=l&&(u||p)||m,_=!u||l;g?A()&&e.setOpen(!0,K(J,t,c)):h||(r?x.openChangeTimeout.start(r,()=>{_&&A()&&e.setOpen(!0,K(J,t,c))}):_&&A()&&e.setOpen(!0,K(J,t,c)))}function o(n){if(k()){N();return}M();let r=e.select(`domReferenceElement`),i=s(r);x.restTimeout.clear(),x.restTimeoutPending=!1;let a=v.current.floatingContext??p?.();if(!Nt(n.relatedTarget,e.context.triggerElements)){if(C.current&&a){e.select(`open`)||x.openChangeTimeout.clear();let r=l.current;x.handler=C.current({...a,tree:b,x:n.clientX,y:n.clientY,onClose(){N(),M(),E.current&&!k()&&r===e.select(`domReferenceElement`)&&t(n,!0)}}),i.addEventListener(`mousemove`,x.handler),x.handler(n)}else(x.pointerType!==`touch`||!z(e.select(`floatingElement`),n.relatedTarget))&&t(n)}}function u(e){z(r,e.relatedTarget)||(x.openChangeTimeout.clear(),x.restTimeout.clear(),x.restTimeoutPending=!1)}let m=_?q(r,`mouseout`,u):void 0;return c?Kt(q(r,`mousemove`,i,{once:!0}),q(r,`mouseenter`,i),q(r,`mouseleave`,o),m):Kt(q(r,`mouseenter`,i),q(r,`mouseleave`,o),m)},[M,N,v,w,e,n,C,x,d,j,k,a,c,T,l,b,E,p,O,A,_]),Z.useMemo(()=>{if(!n)return;function t(e){x.pointerType=e.pointerType}return{onPointerDown:t,onPointerEnter:t,onMouseMove(t){let{nativeEvent:n}=t,r=t.currentTarget,i=e.select(`domReferenceElement`),o=e.select(`open`),s=j(i,r,t.target);if(a&&!ct(x.pointerType))return;if(o&&s&&x.handleCloseOptions?.blockPointerEvents){let t=e.select(`floatingElement`);if(t){let e=x.handleCloseOptions?.getScope?.()??r.ownerDocument.body;Ni(x,{scopeElement:e,referenceElement:r,floatingElement:t})}}let c=Ut(T.current);if(o&&!s||c===0||!s&&x.restTimeoutPending&&t.movementX**2+t.movementY**2<2)return;x.restTimeout.clear();function l(){if(x.restTimeoutPending=!1,k())return;let t=e.select(`open`);!x.blockMouseMove&&(!t||s)&&A()&&e.setOpen(!0,K(J,n,r))}x.pointerType===`touch`?Pe.flushSync(()=>{l()}):s&&o?l():(x.restTimeoutPending=!0,x.restTimeout.start(c,l))}}},[n,x,k,j,a,e,T,A])}var Ri=.1,zi=Ri*Ri,$=.5;function Bi(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Vi(e,t,n,r,i,a,o,s,c,l){let u=!1;return Bi(e,t,n,r,i,a)&&(u=!u),Bi(e,t,i,a,o,s)&&(u=!u),Bi(e,t,o,s,c,l)&&(u=!u),Bi(e,t,c,l,n,r)&&(u=!u),u}function Hi(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Ui(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Wi(e={}){let{blockPointerEvents:t=!1}=e,n=new k,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,p=typeof performance<`u`?performance.now():0;function m(e,t){let n=performance.now(),r=n-p;if(u===null||d===null||r===0)return u=e,d=t,p=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*zi;return u=e,d=t,p=n,o<s}function h(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:p}=r,g=X(r),_=r.type===`mouseleave`,v=z(u,g),y=z(a,g);if(v&&(l=!0,!_))return;if(y&&(l=!1,!_)){l=!0;return}if(_&&f(r.relatedTarget)&&z(u,r.relatedTarget))return;function b(){return!!(s&&Jn(s.nodesRef.current,o).length>0)}function x(){b()||h()}if(b())return;let S=a.getBoundingClientRect(),C=u.getBoundingClientRect(),w=e>C.right-C.width/2,T=t>C.bottom-C.height/2,E=C.width>S.width,D=C.height>S.height,O=(E?S:C).left,k=(E?S:C).right,A=(D?S:C).top,j=(D?S:C).bottom;if(c===`top`&&t>=S.bottom-1||c===`bottom`&&t<=S.top+1||c===`left`&&e>=S.right-1||c===`right`&&e<=S.left+1){x();return}let M=!1;switch(c){case`top`:M=Ui(d,p,O,S.top+1,k,C.bottom-1);break;case`bottom`:M=Ui(d,p,O,C.top+1,k,S.bottom-1);break;case`left`:M=Ui(d,p,C.right-1,j,S.left+1,A);break;case`right`:M=Ui(d,p,S.right-1,j,C.left+1,A)}if(M)return;if(l&&!Hi(d,p,S)||!_&&m(d,p)){x();return}let N=!1;switch(c){case`top`:{let n=E?$/2:$*4,r=E||w?e+n:e-n,i=E?e-n:w?e+n:e-n,a=t+$+1,o=w||E?C.bottom-$:C.top,s=w?E?C.bottom-$:C.top:C.bottom-$;N=Vi(d,p,r,a,i,a,C.left,o,C.right,s);break}case`bottom`:{let n=E?$/2:$*4,r=E||w?e+n:e-n,i=E?e-n:w?e+n:e-n,a=t-$,o=w||E?C.top+$:C.bottom,s=w?E?C.top+$:C.bottom:C.top+$;N=Vi(d,p,r,a,i,a,C.left,o,C.right,s);break}case`left`:{let n=D?$/2:$*4,r=D||T?t+n:t-n,i=D?t-n:T?t+n:t-n,a=e+$+1,o=T||D?C.right-$:C.left,s=T?D?C.right-$:C.left:C.right-$;N=Vi(d,p,o,C.top,s,C.bottom,a,r,a,i);break}case`right`:{let n=D?$/2:$*4,r=D||T?t+n:t-n,i=D?t-n:T?t+n:t-n,a=e-$,o=T||D?C.left+$:C.right,s=T?D?C.left+$:C.right:C.left+$;N=Vi(d,p,a,r,a,i,o,C.top,s,C.bottom);break}}N?l||n.start(40,x):x()}};return r.__options={...e,blockPointerEvents:t},r}function Gi(e,t,n){let{reference:r,floating:i}=e,a=un(t),o=dn(t),s=ln(o),c=on(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=sn(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Ki(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=an(t,e),p=Cn(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=wn(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=wn(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var qi=50,Ji=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Ki},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Gi(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<qi&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Gi(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Yi=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=an(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=on(r),_=un(o),v=on(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[xn(o)]:pn(o)),x=p!==`none`;!d&&x&&b.push(...bn(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=fn(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===un(t)||T.every(e=>un(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=un(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},Xi=new Set([`left`,`top`]);async function Zi(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=on(n),s=sn(n),c=un(n)===`y`,l=Xi.has(o)?-1:1,u=a&&c?-1:1,d=an(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Qi=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Zi(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},$i=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=an(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=un(i),p=cn(f),m=u[p],h=u[f],g=(e,t)=>rn(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},ea=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=an(e,t),u={x:n,y:r},d=un(i),f=cn(d),p=u[f],m=u[d],h=an(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Xi.has(on(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},ta=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=an(e,t),c=await i.detectOverflow(t,s),l=on(n),u=sn(n),d=un(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Zt(p-c[m],g),y=Zt(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Qt(c.left,c.right):S=p-2*Qt(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function na(e){let t=x(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=j(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=$t(n)!==a||$t(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function ra(e){return f(e)?e:e.contextElement}function ia(e){let t=ra(e);if(!j(t))return tn(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=na(t),o=(a?$t(n.width):n.width)/r,s=(a?$t(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var aa=tn(0);function oa(e){let t=a(e);return!ne()||!t.visualViewport?aa:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function sa(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===a(e)}function ca(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),o=ra(e),s=tn(1);t&&(r?f(r)&&(s=ia(r)):s=ia(e));let c=sa(o,n,r)?oa(o):tn(0),u=(i.left+c.x)/s.x,d=(i.top+c.y)/s.y,p=i.width/s.x,m=i.height/s.y;if(o&&r){let e=a(o),t=f(r)?a(r):r,n=e,i=l(n);for(;i&&t!==n;){let e=ia(i),t=i.getBoundingClientRect(),r=x(i),o=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;u*=e.x,d*=e.y,p*=e.x,m*=e.y,u+=o,d+=s,n=a(i),i=l(n)}}return wn({width:p,height:m,x:u,y:d})}function la(e,t){let n=y(e).scrollLeft;return t?t.left+n:ca(T(e)).left+n}function ua(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-la(e,n),y:n.top+t.scrollTop}}function da(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=T(r),s=t?P(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=tn(1),u=tn(0),d=j(r);if((d||!a)&&((m(r)!==`body`||_(o))&&(c=y(r)),d)){let e=ca(r);l=ia(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?ua(o,c):tn(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function fa(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function pa(e){let t=y(e),n=e.ownerDocument.body,r=Qt(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Qt(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+la(e),o=-t.scrollTop;return x(n).direction===`rtl`&&(a+=Qt(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var ma=25;function ha(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=a(e),o=T(e),s=i.visualViewport,c=o.clientWidth,l=o.clientHeight,u=0,d=0;if(s){let e=!ne()||t===`fixed`;r?e||(u=-s.offsetLeft,d=-s.offsetTop):(c=s.width,l=s.height,e&&(u=s.offsetLeft,d=s.offsetTop))}if(la(o)<=0){let e=o.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(o.clientWidth-t.clientWidth-r),a=getComputedStyle(o).scrollbarGutter===`stable both-edges`?i/2:i;a<=ma&&(c-=a)}return{width:c,height:l,x:u,y:d}}function ga(e,t){let n=ca(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=ia(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function _a(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=ha(e,n,t);else if(t===`document`)r=pa(T(e));else if(f(t))r=ga(t,n);else{let n=oa(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return wn(r)}function va(e,t){let n=t.get(e);if(n)return n;let r=O(e,[],!1).filter(e=>f(e)&&m(e)!==`body`),i=null,a=x(e).position===`fixed`,o=a?we(e):e;for(;f(o)&&!te(o);){let e=x(o),t=N(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=we(o)}return t.set(e,r),r}function ya(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?P(t)?[]:va(t,this._c):[].concat(n),r],o=_a(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=_a(t,a[e],i);s=Qt(n.top,s),c=Zt(n.right,c),l=Zt(n.bottom,l),u=Qt(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function ba(e){let{width:t,height:n}=na(e);return{width:t,height:n}}function xa(e,t,n){let r=j(t),i=T(t),a=n===`fixed`,o=ca(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=tn(0);if((r||!a)&&((m(t)!==`body`||_(i))&&(s=y(t)),r)){let e=ca(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=la(i));let l=i&&!r&&!a?ua(i,s):tn(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function Sa(e){return x(e).position===`static`}function Ca(e,t){if(!j(e)||x(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return T(e)===n&&(n=n.ownerDocument.body),n}function wa(e,t){let n=a(e);if(P(e))return n;if(!j(e)){let t=we(e);for(;t&&!te(t);){if(f(t)&&!Sa(t))return t;t=we(t)}return n}let r=Ca(e,t);for(;r&&h(r)&&Sa(r);)r=Ca(r,t);return r&&te(r)&&Sa(r)&&!N(r)?n:r||C(e)||n}var Ta=async function(e){let t=this.getOffsetParent||wa,n=this.getDimensions,r=await n(e.floating);return{reference:xa(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ea(e){return x(e).direction===`rtl`}var Da={convertOffsetParentRelativeRectToViewportRelativeRect:da,getDocumentElement:T,getClippingRect:ya,getOffsetParent:wa,getElementRects:Ta,getClientRects:fa,getDimensions:ba,getScale:ia,isElement:f,isRTL:Ea};function Oa(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ka(e,t,n){let r=null,i,o=T(e);function s(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function c(n,a){n===void 0&&(n=!1),a===void 0&&(a=1),s();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=en(d),h=en(o.clientWidth-(u+f)),g=en(o.clientHeight-(d+p)),_=en(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Qt(0,Zt(1,a))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Oa(l,e.getBoundingClientRect()))return c();if(n!==a){if(!y)return c();n?c(!1,n):i=setTimeout(()=>{c(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:o.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let l=a(e),u=()=>c(n);return l.addEventListener(`resize`,u),c(!0),()=>{l.removeEventListener(`resize`,u),s()}}function Aa(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=ra(e),u=i||a?[...l?O(l):[],...t?O(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?ka(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?ca(e):null;c&&g();function g(){let t=ca(e);h&&!Oa(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var ja=Qi,Ma=$i,Na=Yi,Pa=ta,Fa=ea,Ia=(e,t,n)=>{let r=new Map,i=n??{},a={...Da,...i.platform,_c:r};return Ji(e,t,{...i,platform:a})},La=typeof document<`u`?Z.useLayoutEffect:function(){};function Ra(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,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ra(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Ra(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function za(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ba(e,t){let n=za(e);return Math.round(t*n)/n}function Va(e){let t=Z.useRef(e);return La(()=>{t.current=e}),t}function Ha(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=Z.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=Z.useState(r);Ra(f,r)||p(r);let[m,h]=Z.useState(null),[g,_]=Z.useState(null),v=Z.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=Z.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=Z.useRef(null),C=Z.useRef(null),w=Z.useRef(u),T=c!=null,E=Va(c),D=Va(i),O=Va(l),k=Z.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Ia(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Ra(w.current,t)&&(w.current=t,Pe.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);La(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Z.useRef(!1);La(()=>(A.current=!0,()=>{A.current=!1}),[]),La(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=Z.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=Z.useMemo(()=>({reference:b,floating:x}),[b,x]),N=Z.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Ba(M.floating,u.x),r=Ba(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...za(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return Z.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var Ua=(e,t)=>{let n=ja(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wa=(e,t)=>{let n=Ma(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ga=(e,t)=>({fn:Fa(e).fn,options:[e,t]}),Ka=(e,t)=>{let n=Na(e);return{name:n.name,fn:n.fn,options:[e,t]}},qa=(e,t)=>{let n=Pa(e);return{name:n.name,fn:n.fn,options:[e,t]}};function Ja(e){let{nodeId:t,externalTree:n,rootContext:r}=e,a=r.useState(`referenceElement`),o=r.useState(`floatingElement`),s=r.useState(`domReferenceElement`),c=r.useState(`open`),l=r.useState(`floatingId`),[u,d]=Z.useState(null),p=Z.useRef(null),m=Tr(n),h=Z.useMemo(()=>({reference:a,floating:o,domReference:s}),[a,o,s]),g=Ha({...e,elements:{...h,...u&&{reference:u}}}),_=Z.useCallback(e=>{let t=f(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;d(t),g.refs.setReference(t)},[g.refs]),v=Z.useMemo(()=>({...g.refs,setPositionReference:_,domReference:p}),[g.refs,_]),y=Z.useMemo(()=>({...g.elements,domReference:s}),[g.elements,s]),b=Z.useMemo(()=>({...g,dataRef:r.context.dataRef,open:c,onOpenChange:r.setOpen,events:r.context.events,floatingId:l,refs:v,elements:y,nodeId:t,rootStore:r}),[g,v,y,t,r,c,l]);return i(()=>{s&&(p.current=s)},[s]),i(()=>{r.context.dataRef.current.floatingContext=b;let e=m?.nodesRef.current.find(e=>e.id===t);e&&(e.context=b)}),Z.useMemo(()=>({...g,context:b,refs:v,elements:y,rootStore:r}),[g,v,y,b,r])}var Ya=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=an(e,t)||{};if(l==null)return{};let d=Cn(u),f={x:n,y:r},p=dn(i),m=ln(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=s.floating[y]||a.floating[m],C=b/2-x/2,w=S/2-h[m]/2-1,T=Math.min(d[_],w),E=Math.min(d[v],w),D=T,O=S-h[m]-E,k=S/2-h[m]/2+C,A=rn(D,k,O),j=!c.arrow&&sn(i)!=null&&k!==A&&a.reference[m]/2-(k<D?T:E)-h[m]/2<0,M=j?k<D?k-D:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),Xa=(e,t)=>{let{name:n,fn:r}=Ya(e);return{name:n,fn:r,options:[e,t]}},Za={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},Qa={sideX:`left`,sideY:`top`},$a=`--available-width`,eo=`--available-height`,to=`--anchor-width`,no=`--anchor-height`,ro=`--transform-origin`,io=$a,ao=eo;function oo(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function so(e,t,n){let{rects:r,placement:i}=e;return{side:oo(t,on(i),n),align:sn(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function co(e){return lo(e,Ja)}function lo(e,t){let{anchor:n,positionMethod:o=`absolute`,side:c=`bottom`,sideOffset:l=0,align:u=`center`,alignOffset:d=0,collisionBoundary:f,collisionPadding:p=5,sticky:m=!1,arrowPadding:h=5,disableAnchorTracking:_=!1,inline:v,keepMounted:y=!1,floatingRootContext:b,mounted:x,collisionAvoidance:S,shift:C,nodeId:w,adaptiveOrigin:T,lazyFlip:E=!1,externalTree:D}=e,O=S.side||`flip`,k=S.align||`flip`,A=S.fallbackAxisSide||`end`,j=C?.crossAxis??!1,M=C?.rootBoundary,N=typeof n==`function`?n:void 0,ee=H(N),te=N?ee:n,ne=g(n),P=g(x),re=r()===`rtl`,[F,I]=Z.useState(null);!x&&F!==null&&I(null);let L=E===`placement`,ie=F?on(F):null,R=F&&L?sn(F)||`center`:null,z=ie||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":re?`left`:`right`,"inline-start":re?`right`:`left`}[c],ae=R||u,oe=ae===`center`?z:`${z}-${ae}`,B=p;typeof B==`number`?B={top:B,right:B,bottom:B,left:B}:B&&={top:B.top||0,right:B.right||0,bottom:B.bottom||0,left:B.left||0};let V=+(c===`bottom`),se=+(c===`top`),ce=+(c===`right`),le=+(c===`left`),ue={boundary:f===`clipping-ancestors`?`clippingAncestors`:f,padding:B},de=Z.useRef(null),fe=g(l),pe=g(d),U=typeof l==`function`?0:l,W=typeof d==`function`?0:d,G=[];v&&G.push(v),G.push(Ua(e=>{let t=so(e,c,re),n=typeof fe.current==`function`?fe.current(t):fe.current,r=typeof pe.current==`function`?pe.current(t):pe.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[U,W,re,c]));let me=k===`none`&&O!==`shift`,he=!me&&(m||j||O===`shift`),ge=O===`none`?null:Ka({...ue,padding:{top:B.top+1+V,right:B.right+1+le,bottom:B.bottom+1+se,left:B.left+1+ce},mainAxis:!j&&O===`flip`,crossAxis:k===`flip`&&`alignment`,fallbackAxisSideDirection:A}),_e=me?null:Wa({...ue,rootBoundary:M,mainAxis:k!==`none`,crossAxis:he,limiter:m||j?void 0:Ga(e=>{if(!de.current)return{};let{width:t,height:n}=de.current.getBoundingClientRect(),r=un(on(e.placement)),i=r===`y`?t:n,a=r===`y`?B.left+B.right:B.top+B.bottom;return{offset:i/2+a/2}})},[ue,m,j,M,B,k]);O===`shift`||k===`shift`||ae===`center`?G.push(_e,ge):G.push(ge,_e),G.push(qa({...ue,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!P.current)return;let i=e.style;i.setProperty(io,`${t}px`),i.setProperty(ao,`${n}px`);let o=a(e).devicePixelRatio||1,{x:s,y:c,width:l,height:u}=r.reference,d=(Math.round((s+l)*o)-Math.round(s*o))/o,f=(Math.round((c+u)*o)-Math.round(c*o))/o;i.setProperty(to,`${d}px`),i.setProperty(no,`${f}px`)}}),Xa(e=>({element:de.current||s(e.elements.floating).createElement(`div`),padding:de.current?h:0}),[h]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:i,rects:a,y:o}=e,s=on(r),u=sn(r),d=un(s)===`y`,f=de.current,p=typeof l==`function`?l(so(e,c,re)):l,m;m=!f&&u&&Math.abs(d?n.shift?.x||0:n.shift?.y||0)<=1?u===`start`===(d&&i.isRTL?.(t)===!0)?`100%`:`0%`:`${(d?n.arrow?.x||0:n.arrow?.y||0)+(d?f?.clientWidth||0:f?.clientHeight||0)/2}px`;let h=s===`top`||s===`left`?`calc(100% + ${p}px)`:`${-p}px`;return he&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${a.reference.y+a.reference.height/2-o}px`),t.style.setProperty(ro,d?`${m} ${h}`:`${h} ${m}`),{}}},Za,T),i(()=>{!x&&b&&b.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[x,b]);let K=Z.useMemo(()=>({ancestorScroll:!_,elementResize:!_&&typeof ResizeObserver<`u`,layoutShift:!_&&typeof IntersectionObserver<`u`}),[_]),{refs:q,elements:ve,x:ye,y:be,middlewareData:xe,update:J,placement:Y,context:Se,isPositioned:X,floatingStyles:Ce}=t({rootContext:b,open:y?x:void 0,placement:oe,middleware:G,strategy:o,whileElementsMounted:y?void 0:(...e)=>Aa(...e,K),nodeId:w,externalTree:D}),{sideX:we,sideY:Te}=xe.adaptiveOrigin||Qa,Ee=X?o:`fixed`,De=Z.useMemo(()=>{let e;return e=X?T?{position:Ee,[we]:ye,[Te]:be}:{...Ce,position:Ee}:{position:Ee,top:0,left:0},e[io]=`100vw`,e[ao]=`100vh`,X||(e.opacity=0),e},[T,Ee,we,ye,Te,be,Ce,X]),Oe=Z.useRef(null);i(()=>{if(!x)return;let e=ne.current,t=typeof e==`function`?e():e,n=(uo(t)?t.current:t)||null;n!==Oe.current&&(q.setPositionReference(n),Oe.current=n)},[x,q,te,ne]),Z.useEffect(()=>{if(!x)return;let e=ne.current;typeof e!=`function`&&uo(e)&&e.current!==Oe.current&&(q.setPositionReference(e.current),Oe.current=e.current)},[x,q,te,ne]),Z.useEffect(()=>{if(y&&x&&ve.reference&&ve.floating)return Aa(ve.reference,ve.floating,J,K)},[y,x,ve,J,K]);let ke=on(Y),Ae=oo(c,ke,re),je=sn(Y)||`center`,Me=!!xe.hide?.referenceHidden;i(()=>{E&&x&&X&&(ke!==z||L&&je!==ae)&&I(Y)},[E,L,x,X,Y,ke,je,z,ae]);let Ne=Z.useMemo(()=>({position:`absolute`,top:xe.arrow?.y,left:xe.arrow?.x}),[xe.arrow]),Q=xe.arrow?.centerOffset!==0;return Z.useMemo(()=>({positionerStyles:De,arrowStyles:Ne,arrowRef:de,arrowUncentered:Q,side:Ae,align:je,physicalSide:ke,anchorHidden:Me,refs:q,context:Se,isPositioned:X,update:J}),[De,Ne,de,Q,Ae,je,ke,Me,q,Se,X,J])}function uo(e){return e!=null&&`current`in e}function fo(e){return e===`starting`?ur:ye}function po(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),V(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},fo(r),i],stateAttributesMapping:At})}function mo(e,t,n,r=!0,a,o){let[s,c]=Z.useState(),l=pe(a?`${a}-label`:void 0),u=!!o?.trim(),d=e??(u?void 0:t)??s;return i(()=>{let i=e||t||u||!r?void 0:ho(n.current,l);s!==i&&c(i)}),d}function ho(e,t){let n=go(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function go(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function _o(e){let{render:t,className:n,style:r,state:i=ye,props:a=he,refs:o=he,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=be({metadata:s});return V(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}var vo=Z.createContext(void 0);function yo(e){let t=Z.useContext(vo);if(t===void 0&&!e)throw Error(W(69));return t}function bo(e){return e.status===`error`||(e.httpStatus??0)>=400}function xo(e){return e===void 0?`running`:e<1?`${e.toFixed(2)} ms`:e<100?`${e.toFixed(1).replace(/\.0$/,``)} ms`:e<1e3?`${Math.round(e)} ms`:`${(e/1e3).toFixed(2)} s`}function So(e,t){let n=new Date(e),r=String(n.getMilliseconds()).padStart(3,`0`).slice(0,2),i=`${n.toLocaleTimeString([],{hour12:!1})}.${r}`;return t?`${n.toLocaleDateString([],{month:`short`,day:`numeric`})} ${i}`:i}function Co(e){return new Date(e).toLocaleTimeString([],{hour12:!1})}function wo(e){return new Date(e).toLocaleString([],{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1})}function To(e,t){return t<=1296e5?new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hour12:!1}):new Date(e).toLocaleDateString([],{month:`short`,day:`numeric`})}function Eo(e){return`${(e*100).toFixed(1).replace(/\.0$/,``)}%`}function Do(e){return e>=1e4?`${(e/1e3).toFixed(1)}K`:e.toLocaleString()}function Oo(e,t){if(e.length===0)return 0;let n=(e.length-1)*t,r=Math.floor(n),i=Math.ceil(n);return e[r]+(e[i]-e[r])*(n-r)}function ko(e){return e.attributes[`db.statement`]===void 0?e.name.startsWith(`action `)?`action`:e.name.startsWith(`rpc `)?`rpc`:e.attributes[`http.route`]===void 0?`other`:`http`:`sql`}function Ao(e){let t=new Map(e.map(e=>[e.spanId,e.parentSpanId])),n=new Map,r=e=>{let i=n.get(e);if(i!==void 0)return i;let a=t.get(e),o=a!==void 0&&t.has(a)?r(a)+1:0;return n.set(e,o),o};for(let t of e)r(t.spanId);return n}var jo=e=>e.endMs===void 0?0:e.endMs-e.startMs,Mo=(e,t)=>{let n=e?.[t];return typeof n==`string`?n:void 0};function No(e){let t=e.spans.filter(e=>ko(e)===`sql`),n=t.map(jo),r;for(let t of e.spans){let e=t.events.find(e=>e.name===`exception`),n=Mo(t.attributes,`brick.error.code`);if(e||n){r={message:Mo(e?.attributes,`exception.message`)??t.statusMessage,stack:Mo(e?.attributes,`exception.stacktrace`),code:n,span:t.name};break}}return{action:e.spans.find(e=>ko(e)===`action`),calls:e.spans.filter(e=>ko(e)===`rpc`),queries:{count:t.length,totalMs:n.reduce((e,t)=>e+t,0),slowestMs:Math.max(0,...n)},exception:r}}function Po(e,t){if(!t)return e;let n=(Array.isArray(e.servers)?e.servers:[]).filter(e=>typeof e?.url==`string`).map(e=>{let n=e.url;return n.includes(`{`)?e:{...e,url:new URL(n,`${t}/`).href.replace(/\/$/,``)}});return{...e,servers:n.length>0?n:[{url:t,description:`Dev server`}]}}var Fo={http:`bg-span-request`,action:`bg-span-action`,rpc:`bg-span-rpc`,sql:`bg-span-sql`,other:`bg-span-other`},Io={http:`Request`,action:`Action`,rpc:`Service call`,sql:`SQL`,other:`Other`},Lo=`bg-[image:repeating-linear-gradient(135deg,transparent_0_4px,color-mix(in_oklab,var(--background)_45%,transparent)_4px_8px)]`;function Ro(e){return e.status===`error`}function zo({span:e}){let t=Object.entries(e.attributes).filter(([,e])=>e!==void 0),n=e.events.filter(e=>e.name===`exception`);return(0,Q.jsxs)(`div`,{className:`mb-2 flex flex-col gap-2`,children:[(0,Q.jsx)(`dl`,{className:`m-0 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-4 gap-y-0.5 border bg-muted/50 p-3 font-mono text-xs leading-[18px]`,children:t.map(([e,t])=>(0,Q.jsxs)(`div`,{className:`contents`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,Q.jsx)(`dd`,{className:`m-0 [overflow-wrap:anywhere]`,children:String(t)})]},e))}),n.map((e,t)=>(0,Q.jsxs)(`pre`,{className:`m-0 overflow-auto border bg-muted/50 p-3 font-mono text-xs leading-[18px] [overflow-wrap:anywhere] whitespace-pre-wrap`,children:[String(e.attributes[`exception.message`]??``),e.attributes[`exception.stacktrace`]?`\n\n${String(e.attributes[`exception.stacktrace`])}`:``]},t))]})}function Bo({trace:e,now:t}){let[n,r]=(0,Z.useState)(),i=Ao(e.spans),a=Math.max(e.endMs??t,...e.spans.map(e=>e.endMs??t)),o=Math.max(a-e.startMs,.001),s=[...new Set(e.spans.map(ko))];return(0,Q.jsxs)(`div`,{className:`flex flex-col px-4 pt-2 pb-4`,children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[s.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(`i`,{className:F(`size-2 rounded-[1px]`,Fo[e])}),Io[e]]},e)),e.spans.some(Ro)&&(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(`i`,{className:`size-2 rounded-[1px] bg-destructive`}),`Failed`]})]}),e.spans.map(a=>{let s=a.endMs??t,c=ko(a),l=Math.min(Math.max((a.startMs-e.startMs)/o*100,0),99.5),u=Math.min(Math.max((s-a.startMs)/o*100,.5),100-l),d=n===a.spanId;return(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":d,onClick:()=>r(d?void 0:a.spanId),className:`group grid min-h-7 w-full grid-cols-[minmax(120px,38%)_minmax(0,1fr)_64px] items-center gap-3 text-left`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center truncate text-[13px] text-muted-foreground group-hover:text-foreground`,style:{paddingLeft:(i.get(a.spanId)??0)*14},title:String(a.attributes[`db.statement`]??a.name),children:[(0,Q.jsx)(`i`,{className:F(`mr-2 size-2 shrink-0 rounded-[1px]`,Ro(a)?`bg-destructive`:Fo[c])}),(0,Q.jsx)(`span`,{className:`truncate`,children:a.name})]}),(0,Q.jsx)(`span`,{className:`relative h-3 overflow-hidden bg-border/70`,children:(0,Q.jsx)(`span`,{className:F(`absolute inset-y-0 min-w-0.5 rounded-[1.5px]`,Ro(a)?`bg-destructive`:Fo[c],a.status===`running`&&Lo),style:{left:`${l}%`,width:`${u}%`}})}),(0,Q.jsx)(`span`,{className:`text-right text-xs text-muted-foreground tabular-nums`,children:xo(a.endMs===void 0?void 0:a.endMs-a.startMs)})]}),d&&(0,Q.jsx)(zo,{span:a})]},a.spanId)}),e.truncated&&(0,Q.jsx)(Ie,{variant:`outline`,className:`mt-2 self-start`,children:`Some spans were dropped`})]})}var Vo=Z.createContext(void 0);function Ho(e){let t=Z.useContext(Vo);if(t===void 0&&!e)throw Error(W(47));return t}var Uo={...Ei,disabled:e=>e.disabled,instantType:e=>e.instantType===`trigger-change`&&!Ei.open(e)?void 0:e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,isPressOpenedByTrigger:(e,t)=>e.openChangeReason===`trigger-press`&&Ei.isOpenedByTrigger(e,t),isTouchPressOpen:(e,t)=>t&&e.openMethod===`touch`&&e.openChangeReason===`trigger-press`,hasTriggerFocusGuards:(e,t)=>Ei.isOpenedByTrigger(e,t)&&!e.focusManagerModal,modal:e=>e.modal,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},Wo=class extends _i{constructor(e,t,n){let r=new ii;super(Go(e,r,t,n),Ko(r),Uo)}setOpen=(e,t)=>{let n=t.reason===J,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=Zr(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n=Xr(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.context.stickIfOpen=!0,this.context.stickIfOpenTimeout.start(500,()=>{this.context.stickIfOpen=!1}),Pe.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function Go(e,t,n,r=!1){let i={...bi(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function Ko(e){return{popupRef:Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Z.createRef(),beforeTriggerFocusGuardRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),stickIfOpenTimeout:new k,stickIfOpen:!0,triggerElements:e}}var qo=Ve(function({props:e}){let{children:t,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,modal:s=!1,handle:c,triggerId:l,defaultTriggerId:u=null}=e,d=Yo(c,{modal:s,open:i,openProp:r,activeTriggerId:u,triggerIdProp:l});d.useControlledProp(`openProp`,r),d.useControlledProp(`triggerIdProp`,l);let f=d.useState(`open`),p=d.useState(`mounted`),m=d.useState(`payload`);d.useContextCallback(`onOpenChange`,a),d.useContextCallback(`onOpenChangeComplete`,o),ri(d,f),ei(d);let{forceUnmount:h}=ti(f,d,()=>{d.context.stickIfOpen=!0,d.set(`openChangeReason`,null)});d.useSyncedValues({modal:s}),Z.useEffect(()=>{f||d.context.stickIfOpenTimeout.clear()},[d,f]),Z.useImperativeHandle(e.actionsRef,()=>({unmount:h,close:()=>d.setOpen(!1,K(n))}),[h,d]);let g=f||p||c!=null;return(0,Q.jsxs)(Vo.Provider,{value:d,children:[c&&(0,Q.jsx)(qr,{handle:c,store:d}),g&&(0,Q.jsx)(Xo,{store:d,modal:s}),typeof t==`function`?t({payload:m}):t]})});function Jo(e){return Ho(!0)?(0,Q.jsx)(qo,{props:e}):(0,Q.jsx)(Or,{children:(0,Q.jsx)(qo,{props:e})})}function Yo(e,t){let n=Kr((e,n)=>new Wo(t,e,n));return Z.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function Xo({store:e,modal:t}){let n=Vr(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return ni(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}function Zo(e,t){function n(n,r,i){let a=n.currentTarget;Pe.flushSync(()=>{e.setOpen(!1,K(E,n.nativeEvent,a))}),Wn(a.isConnected?a:t.current,r,i)?.focus()}function r(t){n(t,-1,e.select(`positionerElement`))}function i(t){let r=e.select(`positionerElement`);r&&Gn(t,r)?e.context.beforeContentFocusGuardRef.current?.focus():n(t,1,r)}return{handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function Qo(e){let t=Z.useRef(``),n=Z.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Z.useCallback(n=>{n.detail===0?e(n,`keyboard`):(`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``)},[e]),onPointerDown:n}}function $o(e,t){let{onClick:n,onPointerDown:r}=Qo(H((n,r)=>{(typeof e==`function`?e():e)||t(r||(Xe?`touch`:``))}));return Z.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function es(e){let[t,n]=Z.useState(null),r=$o(e,n);return oe(e,t=>{t&&!e&&n(null)}),Z.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var ts=He(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=Ho(!0),h=Di(s)??m;if(!h)throw Error(W(74));let g=pe(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=Z.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=$r(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`isPressOpenedByTrigger`,g),T=h.useState(`isTouchPressOpen`,l),E=h.useState(`hasTriggerFocusGuards`,g),D=Li(v,{enabled:!a&&l&&!T,mouseOnly:!0,move:!1,handleClose:Wi(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),O=Rr(v,{stickIfOpen:H(()=>h.context.stickIfOpen)}),k=$o(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),j=h.useState(`triggerProps`,C),{getButtonProps:M,buttonRef:N}=A({disabled:a,native:o}),ee={open(e){return w?kt.open(e):Ot.open(e)}},{handlePreFocusGuardFocus:te,handleFocusTargetFocus:ne}=Zo(h,x),P=V(`button`,e,{state:{disabled:a,open:y},ref:[N,t,S,x],props:[O.reference,D,j,k,{[dr]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,M],stateAttributesMapping:ee}),re=(0,Q.jsx)(Z.Fragment,{children:P},g);return E?(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(Xt,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:te}),re,(0,Q.jsx)(Xt,{ref:h.context.triggerFocusTargetRef,onFocus:ne})]}):re}),ns=Z.createContext(void 0);function rs(){let e=Z.useContext(ns);if(e===void 0)throw Error(W(45));return e}var is=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return Ho().useState(`mounted`)||n?(0,Q.jsx)(ns.Provider,{value:n,children:(0,Q.jsx)(yr,{ref:t,...r})}):null}),as=Z.createContext(void 0);function os(){let e=Z.useContext(as);if(!e)throw Error(W(46));return e}var ss=Z.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,Q.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})});function cs(e){let{store:t,domReference:n,positionerElement:r,open:a}=e,o=Z.useRef(null),s=Z.useRef(null),c=S(r);i(()=>{a||(s.current?.abort(),s.current=null,t.state.instantType===`trigger-change`&&t.set(`instantType`,void 0))},[a,t]),i(()=>{let e=n,r=o.current;if(e&&(o.current=e),!r||!e||e===r||!t.select(`open`))return;t.set(`instantType`,void 0);let i=new AbortController;return s.current=i,c(()=>{t.select(`open`)&&t.set(`instantType`,`trigger-change`)},i.signal),()=>{i.abort()}},[n,c,t])}var ls={},us={},ds=``;function fs(e,t){return _(e)?e:t}function ps(e,t,n){return/hidden|clip/.test(e.getComputedStyle(fs(t,n)).overflowY)}function ms(e){if(typeof document>`u`)return!1;let t=s(e);return a(t).innerWidth-t.documentElement.clientWidth>0}function hs(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=s(e),n=t.documentElement,r=t.body,i=fs(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let c=i.offsetWidth;i.style.overflowY=`hidden`;let l=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,c===l}function gs(e){let t=s(e),n=t.documentElement,r=t.body,i=fs(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function _s(e){let t=s(e),n=t.documentElement,r=t.body,i=a(n),o=0,c=0,l=!1,u=ee.create();if(tt&&(i.visualViewport?.scale??1)!==1)return()=>{};function d(){let t=i.getComputedStyle(n),a=i.getComputedStyle(r),s=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;o=n.scrollTop,c=n.scrollLeft,ls={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},ds=n.style.scrollBehavior,us={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||a.overflowY===`scroll`,p=t.overflowX===`scroll`||a.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(a.marginTop)+parseFloat(a.marginBottom),_=parseFloat(a.marginLeft)+parseFloat(a.marginRight),v=fs(n,r);l=hs(e),l?(n.style.scrollbarGutter=s,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`):(Object.assign(n.style,{scrollbarGutter:s,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=o,r.scrollLeft=c,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`)}function f(){Object.assign(n.style,ls),Object.assign(r.style,us),l||(n.scrollTop=o,n.scrollLeft=c,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=ds)}function p(){f(),u.request(d)}d();let m=q(i,`resize`,p);return()=>{u.cancel(),f(),typeof i.removeEventListener==`function`&&m()}}var vs=new class{lockCount=0;restore=null;timeoutLock=k.create();timeoutUnlock=k.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=s(e),n=t.documentElement,r=t.body,i=a(n);if(ps(i,n,r)){let t=new i.MutationObserver(()=>{ps(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let o=Xe||!ms(e);this.restore=o?gs(e):_s(e)}};function ys(e=!0,t=null){i(()=>{if(e)return vs.acquire(t)},[e,t])}var bs=20;function xs(e,t,n,r){let[a,o]=Z.useState(!1);i(()=>{if(!e||!t||n==null){o(!1);return}let r=s(n).documentElement.clientWidth,i=n.offsetWidth;o(r>0&&i>0&&i>=r-bs)},[e,t,n]),ys(e&&(!t||a),r)}var Ss=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=pr,..._}=e,v=Ho(),y=rs(),b=Er(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=co({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:v.useState(`adaptiveOrigin`)});cs({store:v,domReference:x.useState(`domReferenceElement`),positionerElement:O,open:C});let M=E===!0&&w!==`trigger-hover`;xs(C&&M,D===`touch`,O,T);let N=v.useStateSetter(`positionerElement`),ee=po(e,{open:C,side:j.side,align:j.align,anchorHidden:j.anchorHidden,instant:k},{styles:j.positionerStyles,transitionStatus:A,props:_,refs:[t,N],hidden:!S,inert:!C});return(0,Q.jsxs)(as.Provider,{value:j,children:[S&&M&&(0,Q.jsx)(ss,{inert:U(!C),cutout:T}),(0,Q.jsx)(Dr,{id:b,children:ee})]})}),Cs=Z.createContext(void 0);function ws(){let[e,t]=Z.useState(0),n=H(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Z.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var Ts=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=Ho(),l=os(),u=yo(!0)!=null,{context:d,hasClosePart:f}=ws(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),x=c.useState(`modal`),S=c.useState(`mounted`),C=c.useState(`openChangeReason`),w=c.useState(`activeTriggerElement`),T=c.useState(`floatingRootContext`),E=T.useState(`floatingId`),D=c.useState(`disabled`),O=c.useState(`openOnHover`),k=c.useState(`closeDelay`);b({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),Fi(T,{enabled:O&&!D,closeDelay:k});let A=a===void 0?Gr(c.context.popupRef):a,M=x!==!1&&f;c.useSyncedValue(`focusManagerModal`,M);let N=c.useStateSetter(`popupElement`),ee={open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},te=V(`div`,e,{state:ee,ref:[t,c.context.popupRef,N],props:[_,{id:E,role:`dialog`,...Wr,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&de.has(e.key)&&e.stopPropagation()}},fo(g),s],stateAttributesMapping:jt});return(0,Q.jsx)(Lr,{context:T,openInteractionType:m,modal:M,disabled:!S||C===`trigger-hover`,initialFocus:A,returnFocus:o,restoreFocus:`popup`,getInsideElements:()=>[c.context.beforeTriggerFocusGuardRef.current],previousFocusableElement:j(w)?w:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,Q.jsx)(Cs.Provider,{value:d,children:te})})});export{ti as $,He as $t,po as A,Mt as At,bi as B,vt as Bt,Oo as C,Xt as Ct,yo as D,Bt as Dt,Po as E,Ht as Et,Li as F,xt as Ft,ii as G,ct as Gt,yi as H,ft as Ht,Fi as I,St as It,Qr as J,it as Jt,Wr as K,ot as Kt,Pi as L,_t as Lt,co as M,jt as Mt,Da as N,kt as Nt,_o as O,Rt as Ot,Wi as P,Ot as Pt,ei as Q,Ve as Qt,ki as R,yt as Rt,bo as S,$t as St,ko as T,Yt as Tt,_i as U,pt as Ut,Ei as V,ht as Vt,oi as W,mt as Wt,Gr as X,tt as Xt,Zr as Y,rt as Yt,Xr as Z,$e as Zt,Do as _,dr as _t,cs as a,Hr as at,Eo as b,Qn as bt,ts as c,Lr as ct,Zo as d,Er as dt,Ie as en,ni as et,Jo as f,wr as ft,Co as g,vr as gt,To as h,yr as ht,ys as i,Ee as in,Ur as it,fo as j,At as jt,mo as k,It as kt,es as l,Dr as lt,No as m,xr as mt,Ss as n,Ae as nn,ri as nt,ss as o,Vr as ot,Bo as p,Tr as pt,qr as q,st as qt,xs as r,Oe as rn,$r as rt,is as s,Rr as st,Ts as t,Me as tn,Kr as tt,$o as u,Or as ut,wo as v,fr as vt,Ao as w,Jt as wt,So as x,wn as xt,xo as y,pr as yt,Di as z,gt as zt};