@dhzh/foundry 4.0.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/drizzle/{0001_numerous_scorpion.sql → 0000_lumpy_landau.sql} +15 -3
- package/dist/drizzle/meta/0000_snapshot.json +202 -1
- package/dist/drizzle/meta/_journal.json +2 -9
- package/dist/index.mjs +1 -1
- package/dist/skills/foundry/SKILL.md +8 -8
- package/dist/skills/foundry/references/captures.md +85 -103
- package/dist/skills/foundry/references/cli-conventions.md +3 -3
- package/dist/skills/foundry/references/data-transfer.md +2 -2
- package/dist/skills/foundry/references/settings.md +8 -11
- package/dist/web/assets/{BottomSheet-CDtaYemW.js → BottomSheet-CWUeIGJ0.js} +1 -1
- package/dist/web/assets/{ItemSwipeLayer-Cp1gCfRQ.js → ItemSwipeLayer-4ExriXa6.js} +1 -1
- package/dist/web/assets/{MenuBottomSheet-CMLetz-H.js → MenuBottomSheet-BzoE93x-.js} +1 -1
- package/dist/web/assets/index-CLqIiIT_.js +104 -0
- package/dist/web/assets/{index-D6Lneuo8.css → index-DPU18hWe.css} +16 -0
- package/dist/web/index.html +2 -2
- package/package.json +2 -1
- package/dist/drizzle/0000_fuzzy_spectrum.sql +0 -12
- package/dist/drizzle/meta/0001_snapshot.json +0 -302
- package/dist/web/assets/index-D8GEg9kQ.js +0 -179
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: foundry
|
|
3
|
-
description: Operate the local Foundry CLI for settings, model providers, saved
|
|
3
|
+
description: Operate the local Foundry CLI for settings, model providers, saved link captures and their fetch jobs, or encrypted backup export/import. Use when a task asks to inspect or change Foundry data, save a URL as an agent-facing bookmark, investigate capture jobs, or transfer Foundry data; start the Web UI only when the user explicitly needs it.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Foundry
|
|
@@ -20,18 +20,18 @@ Read only the references needed for the current request.
|
|
|
20
20
|
| Invocation, JSON conventions, IDs, stdin, the Web UI | [references/cli-conventions.md](references/cli-conventions.md) |
|
|
21
21
|
| Appearance, language, timezone, capture fetcher configuration | [references/settings.md](references/settings.md) |
|
|
22
22
|
| List, create, update, disable, or discover models for providers | [references/providers.md](references/providers.md) |
|
|
23
|
-
| Captures, capture detail, notes, recapture, or child
|
|
23
|
+
| Captures, capture detail, notes, recapture, or child fetch jobs | [references/captures.md](references/captures.md) |
|
|
24
24
|
| Encrypted export, preview, or destructive restore | [references/data-transfer.md](references/data-transfer.md) |
|
|
25
25
|
|
|
26
26
|
## Core Model
|
|
27
27
|
|
|
28
28
|
- A **provider** has a stable provider ID and model-discovery configuration.
|
|
29
|
-
- A **capture**
|
|
30
|
-
|
|
31
|
-
- A **
|
|
29
|
+
- A **capture** is an agent-facing bookmark: a URL plus a response from the
|
|
30
|
+
configured fetcher that explains what the URL is about.
|
|
31
|
+
- A **fetch job** is a child of exactly one capture. Its canonical command path
|
|
32
32
|
is `foundry captures jobs ...`; there is no global jobs command.
|
|
33
33
|
- A successful capture command returns `capture.id`, `job.id`,
|
|
34
|
-
`job.status`, and `
|
|
34
|
+
`job.status`, and the raw fetcher response in `rawResponse`.
|
|
35
35
|
- CLI timestamps are ISO-8601 strings. The CLI does not apply the user's display
|
|
36
36
|
time format or timezone; that formatting belongs to the Web UI.
|
|
37
37
|
- Capture and provider records intentionally expose stored API keys in JSON
|
|
@@ -92,13 +92,13 @@ foundry data-transfer import <path>
|
|
|
92
92
|
groups. Run `foundry <command> --help` when the installed version may differ
|
|
93
93
|
from these references.
|
|
94
94
|
|
|
95
|
-
## Workflow: Capture A
|
|
95
|
+
## Workflow: Capture A Link
|
|
96
96
|
|
|
97
97
|
1. Read `settings get`; if no capture fetcher is selected or its API key is
|
|
98
98
|
empty, update settings first.
|
|
99
99
|
2. Run `captures create <url> --note <text>`.
|
|
100
100
|
3. Inspect the returned `job.status`.
|
|
101
|
-
4. On success,
|
|
101
|
+
4. On success, inspect the returned `rawResponse` or fetch it again
|
|
102
102
|
later with `captures get <capture-id>`.
|
|
103
103
|
5. On failure, read the job reference and investigate through
|
|
104
104
|
`captures jobs get`.
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Captures
|
|
2
2
|
|
|
3
|
+
A capture is an agent-facing bookmark. It records what a saved URL is about so
|
|
4
|
+
an agent can decide whether the URL is relevant and then visit it or run a fresh
|
|
5
|
+
web search for details.
|
|
6
|
+
|
|
7
|
+
Foundry does not store a page copy as the primary capture result. It sends one
|
|
8
|
+
capture-discovery request through the configured fetcher and stores the raw
|
|
9
|
+
response. The response contains result titles, descriptions, metadata, and
|
|
10
|
+
summaries that help identify the product, library, or resource.
|
|
11
|
+
|
|
3
12
|
## Commands
|
|
4
13
|
|
|
5
14
|
```bash
|
|
@@ -24,15 +33,19 @@ nested job `get` supports `show`.
|
|
|
24
33
|
```json
|
|
25
34
|
{
|
|
26
35
|
"id": "<capture-id>",
|
|
27
|
-
"url": "https://
|
|
28
|
-
"title": "
|
|
29
|
-
"userNote": "
|
|
36
|
+
"url": "https://ui.shadcn.com/",
|
|
37
|
+
"title": "shadcn/ui - The Foundation for your Design System",
|
|
38
|
+
"userNote": "Components for the next project",
|
|
30
39
|
"latestSuccessfulJobId": "<job-id>",
|
|
31
40
|
"createdAt": "<iso>",
|
|
32
41
|
"updatedAt": "<iso>"
|
|
33
42
|
}
|
|
34
43
|
```
|
|
35
44
|
|
|
45
|
+
The title comes from the best matching fetcher result. Exact URL results are
|
|
46
|
+
preferred, then the same site's homepage, then the first result on the same
|
|
47
|
+
site.
|
|
48
|
+
|
|
36
49
|
## Capture Detail
|
|
37
50
|
|
|
38
51
|
`captures get` returns:
|
|
@@ -41,22 +54,60 @@ nested job `get` supports `show`.
|
|
|
41
54
|
{
|
|
42
55
|
"capture": {
|
|
43
56
|
"id": "<capture-id>",
|
|
44
|
-
"url": "https://
|
|
45
|
-
"title": "
|
|
46
|
-
"userNote": "
|
|
57
|
+
"url": "https://ui.shadcn.com/",
|
|
58
|
+
"title": "shadcn/ui - The Foundation for your Design System",
|
|
59
|
+
"userNote": "Components for the next project",
|
|
47
60
|
"latestSuccessfulJobId": "<job-id>",
|
|
48
61
|
"createdAt": "<iso>",
|
|
49
62
|
"updatedAt": "<iso>"
|
|
50
63
|
},
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
64
|
+
"rawResponse": {
|
|
65
|
+
"success": true,
|
|
66
|
+
"data": {
|
|
67
|
+
"web": [
|
|
68
|
+
{
|
|
69
|
+
"url": "https://ui.shadcn.com/",
|
|
70
|
+
"title": "shadcn/ui - The Foundation for your Design System",
|
|
71
|
+
"description": "Composable, accessible components...",
|
|
72
|
+
"summary": "The fetcher's longer page summary...",
|
|
73
|
+
"metadata": {
|
|
74
|
+
"sourceURL": "https://ui.shadcn.com/",
|
|
75
|
+
"statusCode": 200
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
"creditsUsed": 2
|
|
54
81
|
}
|
|
55
82
|
}
|
|
56
83
|
```
|
|
57
84
|
|
|
58
|
-
`
|
|
59
|
-
|
|
85
|
+
`rawResponse` is the unmodified response from the configured fetcher. It is
|
|
86
|
+
`null` until a job succeeds. The response shape depends on that fetcher; use
|
|
87
|
+
result metadata and descriptions as supporting evidence rather than treating
|
|
88
|
+
any generated summary as the canonical product description.
|
|
89
|
+
|
|
90
|
+
## Fetcher Behavior
|
|
91
|
+
|
|
92
|
+
The current fetcher implementation is Firecrawl Search. A fetch job sends one
|
|
93
|
+
request to `POST https://api.firecrawl.dev/v2/search` with a query derived from
|
|
94
|
+
the submitted URL:
|
|
95
|
+
|
|
96
|
+
- Root URL: `site:<hostname> <brand-token>`
|
|
97
|
+
- Path URL: `site:<hostname> <last-meaningful-path-segment>`
|
|
98
|
+
|
|
99
|
+
Examples:
|
|
100
|
+
|
|
101
|
+
| URL | Query |
|
|
102
|
+
| --- | --- |
|
|
103
|
+
| `https://ui.shadcn.com/` | `site:ui.shadcn.com shadcn` |
|
|
104
|
+
| `https://ui.shadcn.com/docs` | `site:ui.shadcn.com docs` |
|
|
105
|
+
| `https://models.dev/labs/apodex/` | `site:models.dev apodex` |
|
|
106
|
+
| `https://github.com/vercel/next.js` | `site:github.com next.js` |
|
|
107
|
+
|
|
108
|
+
The request uses five web results, `formats: ["summary"]`, main-content
|
|
109
|
+
filtering, cache reuse, ad blocking, automatic proxy selection, and a
|
|
110
|
+
two-day `maxAge`.
|
|
60
111
|
|
|
61
112
|
## Child Jobs
|
|
62
113
|
|
|
@@ -92,114 +143,51 @@ Job shape:
|
|
|
92
143
|
Statuses:
|
|
93
144
|
|
|
94
145
|
- `pending`: queued, not started.
|
|
95
|
-
- `running`:
|
|
96
|
-
- `succeeded`:
|
|
97
|
-
- `failed`:
|
|
146
|
+
- `running`: fetcher request in progress.
|
|
147
|
+
- `succeeded`: fetch completed and raw response persisted.
|
|
148
|
+
- `failed`: search exhausted its attempts or failed non-retryably.
|
|
98
149
|
|
|
99
|
-
The job response does not include
|
|
100
|
-
`foundry captures get <capture-id>` for the latest successful
|
|
150
|
+
The job response does not include the raw response. Use
|
|
151
|
+
`foundry captures get <capture-id>` for the latest successful response.
|
|
101
152
|
|
|
102
|
-
`jobs list` returns the capture's non-deleted jobs, newest first.
|
|
103
|
-
|
|
153
|
+
`jobs list` returns the capture's non-deleted jobs, newest first. An existing
|
|
154
|
+
capture with no jobs returns `[]`.
|
|
104
155
|
|
|
105
156
|
`jobs recapture` creates a new job with the current fetcher configuration, waits
|
|
106
157
|
for it to reach `succeeded` or `failed`, and returns the final job summary.
|
|
107
|
-
Preconditions are the same as capture recapture: the capture exists, no active
|
|
108
|
-
job already exists, and the current fetcher/API key are configured.
|
|
109
|
-
|
|
110
|
-
The Web UI Jobs page supports listing status, fetcher, created/updated time,
|
|
111
|
-
and error details; refresh by rerunning `jobs list`; and recapture. It does not
|
|
112
|
-
expose cancel, delete, retry-in-place, or a global job list. The CLI deliberately
|
|
113
|
-
matches those capabilities.
|
|
114
|
-
|
|
115
|
-
## List And Counts
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
foundry captures list
|
|
119
|
-
foundry captures list --filter no-successful
|
|
120
|
-
foundry captures counts
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
Filters:
|
|
124
|
-
|
|
125
|
-
- `all`: every non-deleted capture.
|
|
126
|
-
- `no-successful`: captures with no latest successful job.
|
|
127
|
-
|
|
128
|
-
Counts shape:
|
|
129
|
-
|
|
130
|
-
```json
|
|
131
|
-
{
|
|
132
|
-
"all": 6,
|
|
133
|
-
"noSuccessful": 1
|
|
134
|
-
}
|
|
135
|
-
```
|
|
136
158
|
|
|
137
159
|
## Create
|
|
138
160
|
|
|
139
161
|
```bash
|
|
140
|
-
foundry captures create https://
|
|
162
|
+
foundry captures create https://ui.shadcn.com/ --note "Component library"
|
|
141
163
|
```
|
|
142
164
|
|
|
143
165
|
Preconditions:
|
|
144
166
|
|
|
145
|
-
- `settings.features.library.captures.fetcher` must be `firecrawl` or `
|
|
146
|
-
- The
|
|
147
|
-
- URL must be HTTP or HTTPS after trimming whitespace.
|
|
167
|
+
- `settings.features.library.captures.fetcher` must be `firecrawl` or `null`.
|
|
168
|
+
- The configured fetcher API key must be non-empty.
|
|
169
|
+
- The URL must be HTTP or HTTPS after trimming whitespace.
|
|
148
170
|
- The same normalized URL cannot already have an active capture.
|
|
149
171
|
|
|
150
|
-
The command creates the capture, queues its first
|
|
151
|
-
job reaches `succeeded` or `failed`, and returns
|
|
152
|
-
|
|
153
|
-
```json
|
|
154
|
-
{
|
|
155
|
-
"capture": {
|
|
156
|
-
"id": "<capture-id>",
|
|
157
|
-
"url": "https://example.com/article",
|
|
158
|
-
"title": "Article title",
|
|
159
|
-
"userNote": "Read later",
|
|
160
|
-
"latestSuccessfulJobId": "<job-id>",
|
|
161
|
-
"createdAt": "<iso>",
|
|
162
|
-
"updatedAt": "<iso>"
|
|
163
|
-
},
|
|
164
|
-
"content": {
|
|
165
|
-
"jobId": "<job-id>",
|
|
166
|
-
"markdown": "# Article"
|
|
167
|
-
},
|
|
168
|
-
"job": {
|
|
169
|
-
"id": "<job-id>",
|
|
170
|
-
"captureId": "<capture-id>",
|
|
171
|
-
"status": "succeeded",
|
|
172
|
-
"fetcher": "firecrawl",
|
|
173
|
-
"errorCode": null,
|
|
174
|
-
"errorMessage": null,
|
|
175
|
-
"createdAt": "<iso>",
|
|
176
|
-
"updatedAt": "<iso>"
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
```
|
|
172
|
+
The command creates the capture, queues its first fetch job, waits until that
|
|
173
|
+
job reaches `succeeded` or `failed`, and returns `capture`, `rawResponse`, and
|
|
174
|
+
`job`.
|
|
180
175
|
|
|
181
|
-
|
|
182
|
-
`
|
|
183
|
-
`errorCode` and `errorMessage`.
|
|
176
|
+
A completed create command can return `job.status: "failed"` and
|
|
177
|
+
`rawResponse: null`. That is a discovery failure, not a capture-create failure.
|
|
178
|
+
Read `errorCode` and `errorMessage`.
|
|
184
179
|
|
|
185
180
|
## Recapture
|
|
186
181
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
This creates a new child job, waits for completion, and returns the same
|
|
192
|
-
`capture`, `content`, and `job` structure as `captures create`.
|
|
182
|
+
`foundry captures recapture <capture-id>` creates a new child job, waits for
|
|
183
|
+
completion, and returns the same `capture`, `rawResponse`, and `job` structure
|
|
184
|
+
as `captures create`.
|
|
193
185
|
|
|
194
186
|
Preconditions:
|
|
195
187
|
|
|
196
188
|
- The capture must exist.
|
|
197
189
|
- No pending or running job may already exist for it.
|
|
198
|
-
- The current
|
|
199
|
-
|
|
200
|
-
This is the capture-level equivalent of `captures jobs recapture`; it returns
|
|
201
|
-
the capture detail along with the final job, while the nested jobs command
|
|
202
|
-
returns only the final job.
|
|
190
|
+
- The current fetcher and its API key must be configured.
|
|
203
191
|
|
|
204
192
|
## Update Note
|
|
205
193
|
|
|
@@ -212,10 +200,6 @@ Notes are trimmed. An empty string stores `null` and clears the note.
|
|
|
212
200
|
|
|
213
201
|
## Delete
|
|
214
202
|
|
|
215
|
-
```bash
|
|
216
|
-
foundry captures delete <capture-id>
|
|
217
|
-
```
|
|
218
|
-
|
|
219
203
|
Deletion is soft deletion of the capture and its jobs. It is blocked while a
|
|
220
204
|
pending or running job exists. Response:
|
|
221
205
|
|
|
@@ -226,16 +210,14 @@ pending or running job exists. Response:
|
|
|
226
210
|
}
|
|
227
211
|
```
|
|
228
212
|
|
|
229
|
-
Deleting the capture also removes its job history from normal queries.
|
|
230
|
-
|
|
231
213
|
## Errors
|
|
232
214
|
|
|
233
215
|
- `INVALID_URL`: URL is not HTTP or HTTPS.
|
|
234
216
|
- `CAPTURE_ALREADY_EXISTS`: active capture with the same URL exists.
|
|
235
|
-
- `FETCHER_NOT_CONFIGURED`: no
|
|
217
|
+
- `FETCHER_NOT_CONFIGURED`: no fetcher or fetcher API key is configured.
|
|
236
218
|
- `ACTIVE_JOB_EXISTS`: capture already has pending/running work.
|
|
237
219
|
- `CAPTURE_NOT_FOUND`: unknown or deleted capture.
|
|
238
220
|
- `JOB_NOT_FOUND`: unknown job or a job owned by another capture.
|
|
239
221
|
|
|
240
222
|
Job failures are returned as a valid final job with `status: "failed"`; do not
|
|
241
|
-
assume a successful command means a successful
|
|
223
|
+
assume a successful command means a successful fetcher response.
|
|
@@ -32,8 +32,8 @@ Command aliases:
|
|
|
32
32
|
|
|
33
33
|
## JSON Contract
|
|
34
34
|
|
|
35
|
-
Successful feature commands write one JSON value to stdout. Do not
|
|
36
|
-
|
|
35
|
+
Successful feature commands write one JSON value to stdout. Do not parse
|
|
36
|
+
localized human prose. Help output is plain text and is only for command
|
|
37
37
|
discovery.
|
|
38
38
|
|
|
39
39
|
Expected domain failures write a JSON envelope to stderr:
|
|
@@ -47,7 +47,7 @@ Expected domain failures write a JSON envelope to stderr:
|
|
|
47
47
|
}
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
The process exit code is `1` for handled command errors. A failed
|
|
50
|
+
The process exit code is `1` for handled command errors. A failed fetch is
|
|
51
51
|
different: capture commands can return successful JSON with `job.status` set to
|
|
52
52
|
`"failed"`, so always inspect the job payload.
|
|
53
53
|
|
|
@@ -23,7 +23,7 @@ accepted but may expose the secret in shell history or process inspection.
|
|
|
23
23
|
}
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
`activeJobCount` counts pending/running
|
|
26
|
+
`activeJobCount` counts pending/running fetch jobs. Export, inspect, and import
|
|
27
27
|
are blocked when the current Foundry database has active jobs. Concurrent
|
|
28
28
|
transfers return `BUSY`.
|
|
29
29
|
|
|
@@ -104,7 +104,7 @@ Import performs inspection and commit in one process:
|
|
|
104
104
|
1. Validate current state has no active jobs.
|
|
105
105
|
2. Decrypt and validate the archive.
|
|
106
106
|
3. Stage the imported database and settings.
|
|
107
|
-
4. Replace current providers, captures,
|
|
107
|
+
4. Replace current providers, captures, fetch jobs, and settings in a
|
|
108
108
|
transaction where applicable.
|
|
109
109
|
|
|
110
110
|
This operation is destructive: the current Foundry database and settings are
|
|
@@ -32,9 +32,8 @@ folder and returns its path.
|
|
|
32
32
|
"captures": {
|
|
33
33
|
"fetcher": null,
|
|
34
34
|
"maxAttempts": 1,
|
|
35
|
-
"
|
|
36
|
-
"firecrawl": { "apiKey": "" }
|
|
37
|
-
"deepseek": { "apiKey": "" }
|
|
35
|
+
"fetchConcurrency": 2,
|
|
36
|
+
"firecrawl": { "apiKey": "" }
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
},
|
|
@@ -56,11 +55,10 @@ Allowed fields:
|
|
|
56
55
|
| `language` | `system`, `en-US`, `zh-CN`, `zh-TW`, `ja-JP` |
|
|
57
56
|
| `timeFormat` | `YYYY-MM-DD HH:mm:ss`, `YYYY-MM-DD`, `YYYY/MM/DD HH:mm:ss`, `DD/MM/YYYY HH:mm:ss`, `MM/DD/YYYY hh:mm:ss A`, `HH:mm:ss` |
|
|
58
57
|
| `timezone` | `America/Los_Angeles`, `America/New_York`, `Asia/Shanghai`, `Asia/Taipei`, `Asia/Tokyo`, `UTC` |
|
|
59
|
-
| `captures.fetcher` | `firecrawl
|
|
58
|
+
| `captures.fetcher` | `firecrawl` or `null` |
|
|
60
59
|
| `captures.maxAttempts` | integer `1..10` |
|
|
61
|
-
| `captures.
|
|
60
|
+
| `captures.fetchConcurrency` | integer `1..5` |
|
|
62
61
|
| `captures.firecrawlApiKey` | string, trimmed |
|
|
63
|
-
| `captures.deepseekApiKey` | string, trimmed |
|
|
64
62
|
|
|
65
63
|
The nested patch object is:
|
|
66
64
|
|
|
@@ -69,9 +67,8 @@ The nested patch object is:
|
|
|
69
67
|
"captures": {
|
|
70
68
|
"fetcher": "firecrawl",
|
|
71
69
|
"maxAttempts": 2,
|
|
72
|
-
"
|
|
73
|
-
"firecrawlApiKey": "<key>"
|
|
74
|
-
"deepseekApiKey": "<key>"
|
|
70
|
+
"fetchConcurrency": 2,
|
|
71
|
+
"firecrawlApiKey": "<key>"
|
|
75
72
|
}
|
|
76
73
|
}
|
|
77
74
|
```
|
|
@@ -90,7 +87,7 @@ may be ignored, so verify the returned settings after a mutation.
|
|
|
90
87
|
- The update response contains the complete resulting settings plus
|
|
91
88
|
`configFolder`.
|
|
92
89
|
- Appearance, language, and display-time settings affect the Web UI rendering.
|
|
93
|
-
- Capture fetcher, retry count, and concurrency affect newly scheduled
|
|
90
|
+
- Capture fetcher, retry count, and concurrency affect newly scheduled fetch
|
|
94
91
|
jobs.
|
|
95
92
|
|
|
96
93
|
## Examples
|
|
@@ -113,7 +110,7 @@ foundry settings update --input '{
|
|
|
113
110
|
"fetcher": "firecrawl",
|
|
114
111
|
"firecrawlApiKey": "<key>",
|
|
115
112
|
"maxAttempts": 2,
|
|
116
|
-
"
|
|
113
|
+
"fetchConcurrency": 2
|
|
117
114
|
}
|
|
118
115
|
}'
|
|
119
116
|
```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,u as Mt,a as Ne,b as It,j as K,L as jt,p as Je,c as Bt,d as At,e as Dt,g as Nt,h as qt,m as mt,k as Ht,o as Yt,l as _t,n as Ft,t as $t,s as Vt,q as Kt,v as Gt,w as Ut}from"./index-D8GEg9kQ.js";const Wt=48,Xt=.25,Jt=/^(\d+(?:\.\d+)?|\.\d+)(px|%)$/i;function St(e,o){if(typeof e=="number")return Number.isFinite(e)&&e>0&&e<=1?e*o:null;const s=Jt.exec(e.trim());if(s===null)return null;const c=Number.parseFloat(s[1]);return c>0?s[2].toLowerCase()==="%"?c/100*o:c:null}function Qt(e){return St(e,1)!==null}function Zt(e,o){const s=[];for(const c of e){const h=St(c,o);h!==null&&s.push(h)}return s}function en(e,o,s=Wt){const h=[0,...o.filter(f=>f>0&&f<e).map(f=>e-f)].sort((f,u)=>f-u),p=[];for(const f of h){const u=p[p.length-1];(u===void 0||f-u>=s)&&p.push(f)}return p}function tn(e,o){return o.reduce((s,c)=>Math.abs(c-e)<Math.abs(s-e)?c:s,o[0])}const nn=.3;function rn(e,o){if(e.length<2||o<=0)return null;const s=e[e.length-1];return o-s<=Xt*o?s:null}function Ye(e,o,s,c){const h=c!==null,p=h?o[o.length-2]:o[o.length-1],f=h?c:s,u=h?nn:0;return e<=p?1:e>=f?u:1-(1-u)*((e-p)/(f-p))}function on(e,o,s,c){let h=o;if(s>0){const p=o.filter(f=>f>=c);p.length>0&&(h=p)}else if(s<0){const p=o.filter(f=>f<=c);p.length>0&&(h=p)}return tn(e,h)}const _e="--_sheet-keyboard-inset",sn=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);function Ve(){return window.visualViewport?.height??window.innerHeight}function cn(){return Ve()>=window.innerHeight-.5}function an(){const e=window.navigator.userAgent;return/iPad|iPhone|iPod/.test(e)||e.includes("Macintosh")&&window.navigator.maxTouchPoints>1}function Ke(e){return e instanceof HTMLTextAreaElement?!e.disabled&&!e.readOnly:e instanceof HTMLInputElement?!e.disabled&&!e.readOnly&&!sn.has((e.getAttribute("type")??"text").toLowerCase()):e instanceof HTMLElement&&e.matches('[contenteditable]:not([contenteditable="false"])')}function gt(e,o){if(!(e instanceof Element))return null;const s=e.closest('input, textarea, [contenteditable]:not([contenteditable="false"])');if(o.contains(s)&&Ke(s))return s;const c=e.closest("label"),h=c instanceof HTMLLabelElement?c.control:null;return o.contains(h)&&Ke(h)?h:null}function ln({bodyRef:e,bottomClearance:o,isEnabled:s,isFullyExpanded:c,isPageScrollLocked:h,isSheetTraveling:p,isOpen:f,isPresented:u,sheetRef:j}){const E=n.useRef(!1),B=n.useRef(!1),A=n.useRef(c),M=n.useRef(f);A.current=c,M.current=f,n.useEffect(()=>{if(!s||!p)return;const i=j.current,b=document.activeElement;i&&b instanceof HTMLElement&&b!==i&&i.contains(b)&&(B.current=E.current,i.focus({preventScroll:!0}))},[s,p,j]),n.useEffect(()=>{if(!s||!u||f)return;const i=j.current,b=document.activeElement;i&&b instanceof HTMLElement&&b!==i&&i.contains(b)&&(B.current=E.current,b.blur())},[s,f,u,j]),n.useEffect(()=>{const i=e.current,b=j.current;if(!s||!u||!i)return;let P=null,D=null;const N=an(),ee=()=>{i.style.setProperty(_e,"0px"),P=null,D=null,E.current=!1,B.current=!1},F=(d,x)=>{if(typeof i.scrollBy!="function"){i.scrollTop+=d;return}const S=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;i.scrollBy({top:d,behavior:x&&!S?"smooth":"instant"})},Q=(d,x)=>{const S=i.getBoundingClientRect(),I=d.getBoundingClientRect(),q=Ve(),se=Math.max(0,S.bottom-q)>0?o:0,re=S.top,C=Math.min(S.bottom,q-se);C<=re||(I.bottom>C?F(I.bottom-C,x):I.top<re&&F(I.top-re,x))},R=d=>{const x=Ve();if(cn()){ee();return}if(Math.max(0,d.bodyBottom-x)===0){ee();return}const I=Math.max(0,d.bodyBottom-(x-o));i.style.setProperty(_e,`${I}px`)},w=d=>{if(!A.current)return;const x=gt(d.relatedTarget,i);if(x){x!==document.activeElement&&x.focus({preventScroll:!0});return}const S=gt(d.target,i);M.current&&S&&!d.relatedTarget&&b?.focus({preventScroll:!0})},te=()=>{const d=document.activeElement;if(!A.current||!(d instanceof HTMLElement)||!i.contains(d)||!Ke(d)){if(B.current&&P){R(P);return}ee();return}B.current=!1;const x=i.getBoundingClientRect(),S=Ve(),I=Math.max(0,x.bottom-S),q=I>0?o:0;P=I>0?{bodyBottom:x.bottom}:null,h&&I>0&&!E.current&&(D={x:window.scrollX,y:window.scrollY}),E.current=I>0;const me=I>0?Math.max(0,x.bottom-(S-q)):0;i.style.setProperty(_e,`${me}px`),Q(d,I>0)};let H=0;const k=()=>{cancelAnimationFrame(H),H=requestAnimationFrame(te)},X=()=>{const d=D;if(d==null||window.scrollX===d.x&&window.scrollY===d.y)return;window.scrollTo(d.x,d.y);const x=document.activeElement;x instanceof HTMLElement&&i.contains(x)&&Ke(x)&&Q(x,!1)},y=typeof ResizeObserver>"u"?null:new ResizeObserver(k),$=()=>{if(!y)return;y.disconnect();const d=new Set([i]);b&&d.add(b);for(const S of i.children)d.add(S);const x=document.activeElement;if(x instanceof HTMLElement&&i.contains(x))for(let S=x;S&&S!==i;S=S.parentElement)d.add(S);for(const S of d)y.observe(S)},G=typeof MutationObserver>"u"?null:new MutationObserver(d=>{d.every(x=>x.type==="attributes"&&x.target===i)||($(),k())}),U=()=>{$(),k()},Y=()=>{B.current=E.current,k()},_=d=>{d.target===b&&d.propertyName==="transform"&&k()},ne=window.visualViewport;return N&&document.addEventListener("blur",w,!0),i.addEventListener("focusin",U),i.addEventListener("focusout",Y),b?.addEventListener("transitionend",_),ne?.addEventListener("resize",k),ne?.addEventListener("scroll",k),window.addEventListener("scroll",X),window.addEventListener("resize",k),G?.observe(i,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),$(),k(),()=>{cancelAnimationFrame(H),N&&document.removeEventListener("blur",w,!0),i.removeEventListener("focusin",U),i.removeEventListener("focusout",Y),b?.removeEventListener("transitionend",_),ne?.removeEventListener("resize",k),ne?.removeEventListener("scroll",k),window.removeEventListener("scroll",X),window.removeEventListener("resize",k),y?.disconnect(),G?.disconnect(),i.style.removeProperty(_e),E.current=!1,B.current=!1}},[e,o,s,h,u,j])}const pt=.998,un=pt/(1-pt),fn=48,Qe=100,Fe=.4,yt=40;function Ze(e){return e.syntheticTouch===!0}const dn=.35,xn=4,et=8;function hn(){typeof navigator>"u"||typeof navigator.vibrate!="function"||Rt()||navigator.vibrate(8)}function mn(e,o){let s=o[0],c=Math.abs(e-s);for(const f of o){const u=Math.abs(e-f);u<c&&(c=u,s=f)}if(c>=yt)return e;const h=c/yt,p=1-h*h;return e+(s-e)*p}function tt(e,o,s){return Math.max(0,e-o-s)}function Tt(e){const o=Number.parseFloat(getComputedStyle(e).paddingBlockEnd);return Number.isFinite(o)?o:0}function bt(e){if(!e)return 0;const o=Tt(e);return Math.max(0,e.scrollHeight-e.clientHeight-o)-e.scrollTop}function gn(e){if(e.scrollHeight-e.clientHeight<=1)return!1;const{overflowY:o}=getComputedStyle(e);return o==="auto"||o==="scroll"}function kt(e,o){const s=[];for(let c=e instanceof Element?e:null;c!=null&&c!==o;c=c.parentElement)c instanceof HTMLElement&&gn(c)&&s.push(c);return s.push(o),s}function pn(e){return e.scrollTop<=0}function yn(e){return e.scrollTop+e.clientHeight>=e.scrollHeight-1}function $e(e){return e.every(pn)}function nt(e){return e.every(yn)}function Le(e,o,s){return Math.max(0,e-s-o)}function Rt(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function bn({isOpen:e,canDismiss:o=!0,offscreenBlockEndInset:s=0,onDismiss:c,snapHeights:h,onSnap:p,onScrimOpacity:f}){const[u,j]=n.useState(0),[E,B]=n.useState(0),[A,M]=n.useState(!1),[i,b]=n.useState(!1),[P,D]=n.useState(0),[N,ee]=n.useState(0),[F,Q]=n.useState(0),R=n.useRef(0),w=n.useRef(0),[te,H]=n.useState(null),[k,X]=n.useState(!1),y=n.useRef(0),$=n.useRef(null),G=n.useRef(null),U=n.useRef(s);U.current=Math.max(0,s);const Y=n.useCallback(t=>{const r=Math.max(0,t);R.current=r,Q(r)},[]),_=n.useCallback(t=>{const r=Math.max(0,t);Math.abs(r-y.current)>.5&&(y.current=r,ee(r))},[]),ne=n.useCallback(()=>{X(!0),$.current=null,H(null);const t=G.current;G.current=null,t!=null&&_(t)},[_]),d=n.useCallback((t,r,m,T,g,L,a)=>{const v=tt(t,m,L);if(a&&Math.abs(T-r)>.5&&!Rt()){G.current=v,$.current=g,H(g);return}G.current=null,$.current=null,H(null),X(Math.abs(g-m)>.5),_(v)},[_]),x=n.useRef(0);A||(x.current=E);const S=n.useRef(e);S.current=e;const I=n.useRef(h);I.current=h;const q=n.useRef(c),me=n.useRef(o),se=n.useRef(p),re=n.useRef(f);n.useEffect(()=>{q.current=c,me.current=o,se.current=p,re.current=f});const C=n.useRef(null),ge=n.useRef(0),pe=n.useRef(null),ye=n.useRef(null),be=n.useRef(null);n.useLayoutEffect(()=>{if(!k)return;pe.current?.offsetHeight;const t=requestAnimationFrame(()=>{X(!1)});return()=>cancelAnimationFrame(t)},[k]);const le=n.useCallback(t=>{t<=0||!S.current||x.current>0||(ge.current=t,D(r=>r===t?r:t))},[]),Ge=n.useCallback(t=>{if(be.current?.disconnect(),be.current=null,pe.current=t,!t||typeof ResizeObserver>"u"){t&&le(t.getBoundingClientRect().height);return}le(t.getBoundingClientRect().height);const r=new ResizeObserver(m=>{const T=m[0];if(T){const g=T.borderBoxSize?.[0]?.blockSize;le(g??T.target.getBoundingClientRect().height)}});r.observe(t),be.current=r},[le]);n.useEffect(()=>()=>be.current?.disconnect(),[]),n.useEffect(()=>{e&&(j(0),B(0),M(!1),b(!1),X(!1),Y(0),w.current=0,y.current=0,$.current=null,G.current=null,ee(0),H(null))},[e,Y]);const ue=n.useCallback(()=>ge.current>0?ge.current:pe.current?.getBoundingClientRect().height??0,[]),oe=n.useCallback(t=>{const r=Le(t,0,U.current),m=en(r,I.current?.()??[]);return{offsets:m,peekOffset:rn(m,r)}},[]),Re=n.useCallback(()=>{const t=pe.current;if(!t)return ge.current;const r=t.style.height;if(r==="")return t.getBoundingClientRect().height;t.style.height="";const m=t.getBoundingClientRect().height;return t.style.height=r,m},[]),ce=n.useCallback(()=>{if(!S.current||C.current!=null||$.current!=null)return;const t=Re();if(t<=0)return;const{offsets:r,peekOffset:m}=oe(t),T=Math.min(w.current,r.length-1),g=r[T],L=g===m?0:g,a=R.current;if(t===ge.current&&Math.abs(g-x.current)<=.5&&Math.abs(L-a)<=.5)return;ge.current=t,D(t),w.current=T,d(a,g,L,g,a,bt(ye.current),!1),Y(L),B(g),se.current?.(Le(t,g,U.current));const v=r[r.length-1],l=Le(t,v,U.current);re.current?.(Ye(g,r,v+l*Fe,m))},[Re,d,Y,oe]);n.useEffect(()=>{if(!(!e||typeof window>"u"))return window.addEventListener("resize",ce),window.addEventListener("orientationchange",ce),()=>{window.removeEventListener("resize",ce),window.removeEventListener("orientationchange",ce)}},[e,ce]);const Be=n.useRef(!1);n.useLayoutEffect(()=>{if(!Be.current){Be.current=!0;return}ce()},[ce,h]);const qe=n.useCallback((t,r)=>{const m=pe.current;if(m==null)return;const T=t-r;m.style.transform=T!==0?`translateY(${T}px)`:""},[]),J=n.useCallback(t=>{const r=C.current;if(r==null)return;C.current=null,t?.hasPointerCapture?.(r.pointerId)&&t.releasePointerCapture(r.pointerId),j(r.baseOffset),M(!1),b(!1),d(r.baseLayoutOffset,r.baseOffset,r.baseLayoutOffset,r.renderedOffset,r.layoutOffset,r.naturalEndGap,!0);const{offsets:m,peekOffset:T}=oe(r.height),g=m[m.length-1],L=Le(r.height,g,U.current),a=g+L*Fe;re.current?.(Ye(r.baseOffset,m,a,T))},[d,oe]);n.useEffect(()=>{const t=()=>J(),r=()=>{document.visibilityState==="hidden"&&J()};return window.addEventListener("blur",t),document.addEventListener("visibilitychange",r),()=>{window.removeEventListener("blur",t),document.removeEventListener("visibilitychange",r)}},[J]);const He=n.useCallback((t,r,m,T,g,L,a,v,l,z)=>{const{offsets:W,peekOffset:xe}=oe(m),Se=W[W.length-1],ae=Le(m,Se,U.current),Oe=Se+ae*Fe,De=g>fn?t+r*un:t,xt=Te=>{const ht=Te===xe?0:Te;d(a,Te,ht,v,l,z,!0),Y(ht),w.current=Math.max(0,W.indexOf(Te)),B(Te),se.current?.(Le(m,Te,U.current)),re.current?.(Ye(Te,W,Oe,xe)),Te!==L&&hn()};if(T>0&&De>Oe){me.current?(d(a,L,a,a,a,z,!1),q.current()):xt(Se);return}const zt=on(Math.min(Math.max(De,0),Se),W,T,L);xt(zt)},[d,Y,oe]),O=n.useCallback((t,r,m)=>{const T=t.currentTarget,g=Ze(t);g||T.setPointerCapture?.(t.pointerId);const L=m??t.clientY,a=bt(ye.current),v=R.current;C.current={syntheticTouch:g,pointerId:t.pointerId,startCoord:L,lastCoord:t.clientY,lastTime:t.timeStamp,samples:[{t:t.timeStamp,y:t.clientY}],velocity:0,height:r,baseOffset:E,baseLayoutOffset:v,renderedOffset:E,layoutOffset:v,naturalEndGap:a,hasTraveled:!1},_(tt(v,v,a)),j(E),M(!0)},[E,_]),ke=n.useCallback(t=>{t.button!==0||!t.isPrimary||(t.preventDefault(),O(t,ue()))},[O,ue]),Z=n.useCallback(t=>{C.current!=null&&(t.preventDefault(),J(t.currentTarget))},[J]),fe=n.useCallback(t=>{C.current?.syntheticTouch||C.current?.pointerId===t.pointerId&&J()},[J]),ve=n.useCallback(t=>{const r=C.current;if(!r||r.pointerId!==t.pointerId||r.syntheticTouch&&!Ze(t))return;const m=t.clientY-r.startCoord;if(t.timeStamp-r.lastTime>0){for(r.lastCoord=t.clientY,r.lastTime=t.timeStamp,r.samples.push({t:t.timeStamp,y:t.clientY});r.samples.length>2&&t.timeStamp-r.samples[0].t>Qe;)r.samples.shift();const Oe=r.samples[0],De=Math.min(t.timeStamp-Oe.t,Qe);r.velocity=De>0?(t.clientY-Oe.y)/De:0}const{offsets:g,peekOffset:L}=oe(r.height),a=r.baseOffset+m,v=g[g.length-1];let l;a<0?l=Math.max(-48,a*dn):a>v?l=a:l=mn(a,g);const z=l<r.baseOffset?0:r.baseLayoutOffset,W=z!==r.layoutOffset;r.renderedOffset=l,r.layoutOffset=z,x.current=l,qe(l,z),W&&j(l),!r.hasTraveled&&l!==r.baseOffset&&(r.hasTraveled=!0,b(!0)),_(tt(r.baseLayoutOffset,z,r.naturalEndGap));const xe=g[g.length-1],Se=Le(r.height,xe,U.current),ae=xe+Se*Fe;re.current?.(Ye(l,g,ae,L))},[oe,_,qe]),Ee=n.useCallback(t=>{const r=C.current;if(!r||r.pointerId!==t.pointerId||r.syntheticTouch&&!Ze(t))return;const m=t.currentTarget,T=t.clientY-r.startCoord,g=Math.max(0,r.baseOffset+T),L=T===0?0:T>0?1:-1,a=t.timeStamp-r.lastTime<Qe?r.velocity:0;C.current=null,r.syntheticTouch||m.releasePointerCapture?.(t.pointerId),M(!1),b(!1),He(g,a,r.height||1,L,Math.abs(T),r.baseOffset,r.baseLayoutOffset,r.renderedOffset,r.layoutOffset,r.naturalEndGap)},[He]),de=n.useRef(null),Ce=n.useCallback(t=>{if(t.button!==0||!t.isPrimary)return;const r=kt(t.target,t.currentTarget);if(!$e(r)){de.current=null;return}de.current={pointerId:t.pointerId,startCoord:t.clientY,scrollers:r}},[]),ze=n.useCallback(t=>{if(C.current){ve(t);return}const r=de.current;if(!r||r.pointerId!==t.pointerId)return;const m=t.clientY-r.startCoord;m>et&&$e(r.scrollers)?(de.current=null,O(t,ue(),r.startCoord),ve(t)):m<0&&(de.current=null)},[O,ve,ue]),Ae=n.useCallback(t=>{de.current=null,!C.current?.syntheticTouch&&C.current&&Ee(t)},[Ee]),we=n.useRef(null),Me=n.useRef(null),ie=n.useCallback(t=>{we.current=null,de.current=null,J(t)},[J]),V=n.useRef(O),Ie=n.useRef(J),je=n.useRef(ie),Pe=n.useRef(ve),st=n.useRef(Ee),Ue=n.useRef(ue);n.useEffect(()=>{V.current=O,Ie.current=J,je.current=ie,Pe.current=ve,st.current=Ee,Ue.current=ue});const ct=n.useCallback(t=>{const r=(a,v)=>({syntheticTouch:!0,pointerId:a.identifier,clientY:a.clientY,timeStamp:Date.now(),currentTarget:v,setPointerCapture:()=>{},releasePointerCapture:()=>{}}),m=a=>{const v=a.currentTarget;if(a.touches.length>1){je.current(v);return}const l=a.changedTouches[0];if(!l){we.current=null;return}const z=kt(a.target,v),W=$e(z),xe=nt(z)&&x.current>0;we.current={id:l.identifier,startY:l.clientY,scrollers:z,top:W,bottom:xe,contentEndY:null,promotedAtContentEnd:!1}},T=a=>{const v=a.currentTarget;if(a.touches.length>1){je.current(v);return}const l=we.current;if(C.current){const ae=[...a.changedTouches].find(Oe=>Oe.identifier===C.current?.pointerId);if(!ae)return;if(l?.promotedAtContentEnd&&l.contentEndY!=null){if(ae.clientY>=l.contentEndY){l.contentEndY=null,l.promotedAtContentEnd=!1,Ie.current(v);return}Pe.current(r(ae,v));return}a.preventDefault(),Pe.current(r(ae,v));return}if(!l)return;const z=[...a.changedTouches].find(ae=>ae.identifier===l.id);if(!z)return;const W=z.clientY-l.startY,xe=l.top&&W>et&&$e(l.scrollers),Se=l.bottom&&W<-et&&nt(l.scrollers);if(xe||Se){a.preventDefault(),we.current=null,V.current(r(z,v),Ue.current(),l.startY),Pe.current(r(z,v));return}(l.top&&W<0||l.bottom&&W>0)&&(l.top=!1,l.bottom=!1),x.current>0&&nt(l.scrollers)?l.contentEndY==null?l.contentEndY=z.clientY:l.contentEndY-z.clientY>=xn&&(l.promotedAtContentEnd=!0,V.current(r(z,v),Ue.current(),l.contentEndY),Pe.current(r(z,v))):l.contentEndY=null},g=a=>{we.current=null;const v=C.current?.pointerId;if(v==null)return;const l=[...a.changedTouches].find(W=>W.identifier===v),z=a.currentTarget;l?st.current(r(l,z)):a.touches.length===0&&Ie.current(z)},L=ye.current;if(L&&Me.current){const a=Me.current;L.removeEventListener("touchstart",a.start),L.removeEventListener("touchmove",a.move),L.removeEventListener("touchend",a.end),L.removeEventListener("touchcancel",a.end)}ye.current=t,t?(t.addEventListener("touchstart",m,{passive:!0}),t.addEventListener("touchmove",T,{passive:!1}),t.addEventListener("touchend",g,{passive:!0}),t.addEventListener("touchcancel",g,{passive:!0}),Me.current={start:m,move:T,end:g}):Me.current=null},[]),it=Mt("(prefers-reduced-motion: reduce)"),at=n.useCallback(t=>{if(y.current<=0)return;const r=Tt(t),m=Math.max(0,t.scrollHeight-t.clientHeight-r),T=Math.max(0,t.scrollTop-m);T<y.current-.5&&_(T)},[_]),lt=n.useCallback(t=>{C.current!=null||$.current!=null||at(t.currentTarget)},[at]),ut=n.useCallback(t=>{if(!t.isPrimary){ie(t.currentTarget);return}ke(t)},[ke,ie]),ft=n.useCallback(t=>{if(!t.isPrimary){ie(t.currentTarget);return}Ce(t)},[Ce,ie]),We=n.useCallback(t=>{t.touches.length>1&&ie(t.currentTarget)},[ie]),dt=n.useCallback(t=>{const r=C.current;r?.pointerId!==t.pointerId||r.syntheticTouch||J(t.currentTarget)},[J]),Xe=A?u:E,Pt=n.useMemo(()=>({style:{transform:Xe!==0?`translateY(${Xe}px)`:void 0,transition:e&&(A||k||it)?"none":void 0,touchAction:"pinch-zoom",overscrollBehavior:"contain"}}),[Xe,A,e,k,it]),Ot=n.useMemo(()=>({style:{touchAction:"pinch-zoom",cursor:"grab"},onContextMenu:Z,onLostPointerCapture:fe,onPointerDown:ut,onPointerMove:ve,onPointerUp:Ee,onPointerCancel:dt,onTouchStart:We,onTouchMove:We}),[Ee,Z,dt,ut,We,fe,ve]),Lt=n.useMemo(()=>({ref:ct,onContextMenu:Z,onLostPointerCapture:fe,onPointerDown:ft,onPointerMove:ze,onPointerUp:Ae,onPointerCancel:Ae,onScroll:lt}),[ct,Ae,ft,ze,lt,Z,fe]);return{sheetRef:Ge,contentProps:Pt,handleProps:Ot,bodyProps:Lt,bodyElementRef:ye,dragOffset:u,settledOffset:E,isDragging:A,isTraveling:i,activeOffsetRef:x,sheetHeight:P,scrollPreservationInset:N,settlingLayoutOffset:te,settledLayoutOffset:F,completeScrollAreaSettle:ne}}const vt={hug:"92dvh",capped:"62dvh",tall:"92dvh"},kn=48,vn=48,En=50;function wn(){return typeof window>"u"?0:window.innerHeight}function Sn(e){let o="";for(const s of e??[])o+=`${typeof s}:${s}|`;return o}const he={sheet:{kfzvcC:"x67bb7w",kB7OPa:"x9f619",kVAEAm:"x1n2onr6",k1xSpc:"x78zum5",kXwgrk:"xdt5ytf",kAzted:"x2lwn1j",kzqmXN:"xh8yej3",ks0D6T:"x11gisft",kWkggS:"x10xzikg",kEafiO:"x11xkdxz",kPef9Z:"x13fuv20",kLZC3w:"x1pc3f07",k2ei4v:"xgbv0en",kVhnKS:"x1t7ytsu",kGJrpR:"x1j92z86",ke9TFa:"xw8tdv1",k8ry5P:"x18b5jzi",kBCPoo:"x1gejf6u",krdFHd:"x81l70g",kfmiAY:"x7hs6f1",kGVxlE:"x1kcpxr7",kI3sdo:"x1a2a7pz",kVQacm:"xb3r6kr",kGO01o:"x1wkw6tp",k1K539:"x1if0o47",k3aq6I:"xnn1q72 xhbqy3z",kSiTet:"x1hc1fzr",k1ekBW:"xwcsmn1",kIyJzY:"x80gvsz",kAMwcw:"xlr8y92",k6sLGO:"x1q1rmc8",k6CgDc:"xzg1mie",$$css:!0},sheetClosing:{k3aq6I:"x1weeur4",kAMwcw:"xv2sgk5",$$css:!0},sheetFading:{kSiTet:"xg01cxk",$$css:!0},sheetInactive:{kfzvcC:"x47corl",$$css:!0},body:{kzQI83:"x1iyjqo2",kAzted:"x2lwn1j",kB7OPa:"x9f619",kFalU9:"xge0x1e",kInvED:"x1wfwxd8 x1nw7mhf",kWkggS:"x10xzikg",kGO01o:"x18d9i69",$$css:!0},content:{k1xSpc:"xufnvkl",kB7OPa:"x9f619",kZKoxP:"x5yr21d",kAzted:"x121v3j4",$$css:!0},tallKeyboardBody:{kFlMNQ:"xrw9175",k5JduY:"x1s928wv",kc3QkE:"xhkezso",k4zj60:"xu6fald",kloYau:"x2q1x1w",$$css:!0},budget:{kZKoxP:"x1tpcejd",$$css:!0},hugHeight:{kZKoxP:"xg7h5cd",kskxy:"x14bu9tk",$$css:!0}};function Tn(e){return e.kind==="open"?e.entering?"entering":null:e.kind==="retained"?e.motion==="covered"?null:e.motion:e.kind==="exiting"?"exiting":null}function Et(e,o,s){if(e==null)return s(),()=>{};let c=!1,h=null;const p=()=>{c||(c=!0,h!=null&&clearTimeout(h),e.removeEventListener("transitionend",f),e.removeEventListener("transitioncancel",f),s())},f=i=>{i.target===e&&i.propertyName===o&&p()};e.addEventListener("transitionend",f),e.addEventListener("transitioncancel",f);const u=getComputedStyle(e);if(e.style.transition.trim()==="none"||u.transition.trim()==="none")return p(),()=>{};const j=u.transitionProperty.split(",").map(i=>i.trim()),E=u.transitionDuration.split(",").map(wt),B=u.transitionDelay.split(",").map(wt);let A=!1;const M=j.reduce((i,b,P)=>{if(b!==o&&b!=="all")return i;const D=E[P%E.length],N=B[P%B.length];return D==null||N==null?(A=!0,i):Math.max(i,D+N)},0);return A?()=>{e.removeEventListener("transitionend",f),e.removeEventListener("transitioncancel",f)}:M<=0?(p(),()=>{}):(h=setTimeout(p,M+En),()=>{h!=null&&clearTimeout(h),e.removeEventListener("transitionend",f),e.removeEventListener("transitioncancel",f)})}function wt(e){const o=e.trim();if(!/^-?(?:\d+|\d*\.\d+)(?:ms|s)$/.test(o))return null;const s=Number.parseFloat(e);return o.endsWith("ms")?s:s*1e3}function rt({ref:e,state:o,height:s,label:c,children:h,padding:p,snapPoints:f,className:u,style:j,tabIndex:E,xstyle:B,isSwipeDismissAllowed:A=!0,isPageScrollLocked:M=!1,onDismiss:i,onScrimOpacity:b,onElementChange:P,onMotionStart:D,onMotionComplete:N,...ee}){const F=n.useRef(null),Q=n.useRef(o),R=n.useRef(!1),w=n.useRef(D),te=n.useRef(N),H=n.useRef(null),k=n.useRef(null),X=o.kind==="open"&&o.entering,y=Q.current,$=y.kind==="open"&&y.entering;X&&!$?R.current=y.kind==="retained":X||(R.current=!1),n.useLayoutEffect(()=>{Q.current=o,w.current=D,te.current=N},[N,D,o]);const G=o.kind==="open",U=o.kind!=="hidden",Y=o.kind==="retained",_=Y||o.kind==="exiting",ne=o.kind==="exiting",d=Y&&o.motion==="fading",x=Y?o.alignmentOffset:0,S=Sn(f),I=n.useRef(f);I.current=f;const{snapHeights:q,ignoredSnapPointsMessage:me}=n.useMemo(()=>{if(S==="")return{snapHeights:void 0,ignoredSnapPointsMessage:""};const V=(I.current??[]).filter(Ie=>!Qt(Ie));return{snapHeights:()=>Zt(I.current??[],wn()),ignoredSnapPointsMessage:V.length===0?"":`snapPoints ignored ${JSON.stringify(V)}. A snap point is a viewport fraction above 0 and up to 1 (0.5 is half the screen), a px length ('320px'), or a percentage ('50%').`}},[S]);Ne("BottomSheet",me,me!=="");const{contentProps:se,handleProps:re,bodyProps:C,bodyElementRef:ge,sheetRef:pe,dragOffset:ye,settledOffset:be,isDragging:le,isTraveling:Ge,sheetHeight:ue,scrollPreservationInset:oe,settlingLayoutOffset:Re,settledLayoutOffset:ce,completeScrollAreaSettle:Be}=bn({isOpen:G,canDismiss:A,offscreenBlockEndInset:kn,onDismiss:i,snapHeights:q,onScrimOpacity:b}),{getViewportProps:qe,getContentProps:J}=It({axis:"both",keyboardAccess:{owner:"contentOrViewport",label:c},overscroll:"contain",stickyContainment:"always"}),He=n.useCallback(V=>{pe(V),F.current=V,P?.(V)},[P,pe]);ln({bodyRef:ge,bottomClearance:vn,isEnabled:s==="tall",isFullyExpanded:be===0,isPageScrollLocked:M,isSheetTraveling:Ge,isOpen:G,isPresented:U,sheetRef:F}),n.useImperativeHandle(e,()=>F.current,[]);const O=Tn(o);n.useLayoutEffect(()=>{if(O!=null){if(H.current=null,k.current=null,O==="entering"&&R.current){k.current=O;return}return Et(F.current,O==="fading"?"opacity":"transform",()=>{H.current===O?te.current?.(O):k.current=O})}},[O]),n.useLayoutEffect(()=>{if(Re!=null)return Et(F.current,"transform",Be)},[Be,Re]),n.useEffect(()=>{if(O!=null)return w.current?.(O),H.current=O,k.current===O&&(k.current=null,te.current?.(O)),()=>{H.current===O&&(H.current=null),k.current===O&&(k.current=null)}},[O]);const ke=p==null,Z=p??4,fe=Vt[Z],Ee=typeof s=="string"&&s in vt?vt[s]:typeof s=="number"?`${s}px`:s,de=ue>0;let Ce=se.style.transform,ze;if(de){const V=le?ye<be?0:ce:Re??ce,je=(le?ye:be)-V,Pe=le||Re!=null;ze=V>0||Pe?`${Math.max(0,ue-Math.max(0,V))}px`:void 0,Ce=je!==0?`translateY(${je}px)`:void 0}const Ae=x>0?[Ce,`translateY(${x}px)`].filter(Boolean).join(" "):Ce,we=G?Ce:Y?Ae:void 0,Me=j?.transform;n.useLayoutEffect(()=>{if(le||Me!=null)return;const V=F.current;V!=null&&(V.style.transform=we??"")});const ie={transition:se.style.transition,touchAction:se.style.touchAction,overscrollBehavior:se.style.overscrollBehavior,height:ze};return K.jsxs("div",{...ee,ref:He,tabIndex:E??-1,...mt($t("bottom-sheet"),Je(Ft.reset,_t.reset,he.sheet,Yt.reset,s==="hug"?he.hugHeight:he.budget,ne&&he.sheetClosing,d&&he.sheetFading,_&&he.sheetInactive,B),u,{"--_sheet-budget":Ee,...G?ie:Y||ne?{height:ze}:{},...j}),children:[K.jsx("div",{className:"x10l6tqk x13vifvy x1o0tod xtijo5x x1vjfegm x78zum5 x6s0dn4 xl56j7k xvpftlf xafqdz2 x1j4r261 x1jm3nie x16khyan",...re,"aria-hidden":"true",children:K.jsx("div",{className:"x1m747yf x11c6zpc xjspbzw x1m4xfpy"})}),K.jsx("div",{...qe({...C,...mt(Je(Ht.focusVisible,he.body,s==="tall"&&he.tallKeyboardBody),oe>0?{style:{paddingBlockEnd:`${oe}px`}}:{})}),children:K.jsx("div",{...J(Je(he.content,...Bt(ke?{useThemeDefault:"bottom-sheet"}:{paddingInnerX:fe,paddingInnerY:fe,paddingOuterX:fe,paddingOuterY:fe}),!ke&&Z!==4&&At[Z],!ke&&Z!==4&&Dt[Z],!ke&&Z!==4&&Nt[Z],!ke&&Z!==4&&qt[Z])),children:K.jsx(jt,{children:h})})})]})}rt.displayName="BottomSheetPanel";function Rn(){return K.jsx("div",{className:"xixxii4 x17y0mx6 x1ey2m1c x1kpxq89 x10xzikg xhtitgo x47corl x1cb67k9 xt2iwb0","data-sheet-edge-tint":"","aria-hidden":"true"})}const ot=n.createContext(null);ot.displayName="BottomSheetSwitcherContext";function Cn(e,o){switch(e){case"active":return{kind:"open",entering:!1};case"entering":return{kind:"open",entering:!0};case"covered":case"aligning":case"fading":return{kind:"retained",motion:e,alignmentOffset:o};case"exiting":return{kind:"exiting"};case"hidden":return{kind:"hidden"}}}function Ct(e,o){const s=document.activeElement;if(s!=null&&e?.contains(s))return;const c=e?.querySelector("[data-autofocus]");c!=null?c.focus({preventScroll:!0}):o&&e?.focus({preventScroll:!0})}function Pn({ref:e,isOpen:o,onOpenChange:s,label:c,children:h,height:p="capped",snapPoints:f,hasScrim:u=!0,finalFocusRef:j,purpose:E="info",xstyle:B,...A}){const M=n.useRef(null),i=n.useRef(null),b=n.useRef(null),[P,D]=n.useState(o),N=o||P,ee=o?{kind:"open",entering:!1}:P?{kind:"exiting"}:{kind:"hidden"},F=n.useCallback(()=>{o&&E!=="required"&&s(!1)},[o,s,E]),Q=n.useCallback(()=>{E==="info"&&s(!1)},[s,E]),R=n.useCallback(y=>{i.current=y},[]),w=n.useCallback(y=>{M.current?.style.setProperty("--_sheet-scrim-opacity",String(y))},[]);n.useEffect(()=>{const y=M.current;if(y==null||!o)return;D(!0),y.style.setProperty("--_sheet-scrim-opacity","1"),y.open||(u?(b.current=document.activeElement,y.showModal()):y.show(),Ct(i.current,u))},[u,o]),n.useEffect(()=>{!o&&P&&u&&w(0)},[w,u,o,P]);const te=n.useCallback(y=>{if(y!=="exiting"||o)return;const $=M.current;$?.open&&$.close(),D(!1),(j?.current??b.current)?.focus(),b.current=null},[j,o]);Kt(N&&u),Ne("BottomSheet","requires a non-empty `label` for an accessible name; the open sheet has no built-in heading to derive one from.",o&&!c);const{shouldDismissOnCloseRequest:H}=Gt({isActive:N,escapeBehavior:o&&E!=="required"?"close":"block",onDismiss:F,getContainer:()=>M.current,isPresent:()=>M.current?.open??!1}),k=n.useCallback(y=>{y.preventDefault(),H()&&F()},[F,H]),X=n.useCallback(y=>{u&&y.target===y.currentTarget&&Q()},[Q,u]);return K.jsxs("dialog",{...{0:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz"},8:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq"},4:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x15h3t91 x142juwg x1viac0w"},12:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x15h3t91 x142juwg x1viac0w"},2:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz x1cz9k3x"},10:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq x1cz9k3x"},6:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x142juwg x1viac0w x1cz9k3x"},14:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x142juwg x1viac0w x1cz9k3x"},1:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz x47corl xfo81ep xh8yej3 x5yr21d"},9:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq x47corl xfo81ep xh8yej3 x5yr21d"},5:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x15h3t91 x142juwg x1viac0w x47corl xfo81ep xh8yej3 x5yr21d"},13:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x15h3t91 x142juwg x1viac0w x47corl xfo81ep xh8yej3 x5yr21d"},3:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz x1cz9k3x x47corl xfo81ep xh8yej3 x5yr21d"},11:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq x1cz9k3x x47corl xfo81ep xh8yej3 x5yr21d"},7:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x142juwg x1viac0w x1cz9k3x x47corl xfo81ep xh8yej3 x5yr21d"},15:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x142juwg x1viac0w x1cz9k3x x47corl xfo81ep xh8yej3 x5yr21d"}}[!!N<<3|!!u<<2|!!(u&&!o&&P)<<1|!u<<0],ref:M,"aria-label":c,"aria-hidden":!o&&P?"true":void 0,"aria-modal":u&&o?"true":void 0,role:E==="required"?"alertdialog":void 0,inert:!o&&P?!0:void 0,onCancel:k,onClick:X,children:[K.jsx("div",{className:"x10l6tqk x17y0mx6 x1ey2m1c x78zum5 xl56j7k x47corl",children:K.jsx(rt,{...A,ref:e,state:ee,height:p,label:c,snapPoints:f,isSwipeDismissAllowed:E==="info",isPageScrollLocked:N&&u,xstyle:B,onDismiss:Q,onScrimOpacity:w,onElementChange:R,onMotionComplete:te,children:K.jsx(Ut,{children:h})})}),K.jsx(Rn,{})]})}function On({switcher:e,ref:o,sheetId:s,label:c,children:h,height:p="capped",snapPoints:f,purpose:u="info",xstyle:j,...E}){const{activeSheet:B,hasScrim:A,onActiveSheetChange:M,getSheetPhase:i,getSheetAlignmentOffset:b,registerSheetElement:P,registerSheetLabel:D,registerSheetPurpose:N,onSheetEnterStart:ee,onSheetTransitionComplete:F,onSheetScrimOpacityChange:Q}=e,R=typeof s=="string"&&s.length>0,w=R?i(s):"hidden",te=R?b(s):0,H=Cn(w,te),k=w==="active"||w==="entering",X=w==="covered"||w==="aligning"||w==="fading"||w==="exiting",y=w!=="hidden",$=w==="active"||w==="entering",G=n.useRef(null),U=n.useRef(w),Y=U.current,_=n.useRef(!1);n.useLayoutEffect(()=>{U.current=w},[w]);const ne=n.useCallback(()=>{u==="info"&&R&&B===s&&M(null)},[B,R,M,u,s]),d=n.useCallback(q=>{G.current=q,R&&P(s,q)},[R,P,s]),x=n.useCallback(q=>{q==="entering"&&R&&ee(s)},[R,ee,s]),S=n.useCallback(q=>{R&&F({sheetId:s,phase:q})},[R,F,s]),I=n.useCallback(q=>{R&&Q(s,q)},[R,Q,s]);return n.useLayoutEffect(()=>{if(R)return D(s,c),()=>D(s,null)},[R,c,D,s]),n.useLayoutEffect(()=>{if(R)return N(s,u),()=>N(s,null)},[R,u,N,s]),n.useEffect(()=>{if(k){const q=Y==="active"||Y==="entering";(!_.current||!q)&&Ct(G.current,A),_.current=!0}else w==="hidden"&&(_.current=!1)},[A,k,w,Y]),Ne("BottomSheet","requires a non-empty `label` for an accessible name; the open sheet has no built-in heading to derive one from.",k&&!c),K.jsx("div",{...{0:{className:"x10l6tqk x17y0mx6 x1ey2m1c x78zum5 xl56j7k x47corl"},2:{className:"x10l6tqk x17y0mx6 x1ey2m1c xl56j7k x47corl x1s85apg"},1:{className:"x10l6tqk x17y0mx6 x1ey2m1c x78zum5 xl56j7k x47corl x1vjfegm"},3:{className:"x10l6tqk x17y0mx6 x1ey2m1c xl56j7k x47corl x1s85apg x1vjfegm"}}[!y<<1|!!$<<0],hidden:!y,"aria-hidden":X?"true":void 0,inert:X?!0:void 0,children:K.jsx(rt,{...E,ref:o,state:H,height:p,label:c,snapPoints:f,isSwipeDismissAllowed:u==="info",isPageScrollLocked:A,xstyle:j,onDismiss:ne,onScrimOpacity:I,onElementChange:d,onMotionStart:x,onMotionComplete:S,children:K.jsx(ot,{value:null,children:h})})})}function Ln(e){const o=n.use(ot),s=e.sheetId,c=typeof s=="string"&&s.length>0;return Ne("BottomSheet","requires a non-empty `sheetId` when nested in BottomSheetSwitcher; standalone `isOpen` / `onOpenChange` props are ignored there.",o!=null&&!c),Ne("BottomSheet","`sheetId` only works inside BottomSheetSwitcher. Use `isOpen` and `onOpenChange` for a standalone sheet.",o==null&&s!=null),o!=null?K.jsx(On,{...e,switcher:o}):K.jsx(Pn,{...e})}Ln.displayName="BottomSheet";export{Ln as BottomSheet};
|
|
1
|
+
import{r as n,u as Mt,a as Ne,b as It,j as K,L as jt,p as Je,c as Bt,d as At,e as Dt,g as Nt,h as qt,m as mt,k as Ht,o as Yt,l as _t,n as Ft,t as $t,s as Vt,q as Kt,v as Gt,w as Ut}from"./index-CLqIiIT_.js";const Wt=48,Xt=.25,Jt=/^(\d+(?:\.\d+)?|\.\d+)(px|%)$/i;function St(e,o){if(typeof e=="number")return Number.isFinite(e)&&e>0&&e<=1?e*o:null;const s=Jt.exec(e.trim());if(s===null)return null;const c=Number.parseFloat(s[1]);return c>0?s[2].toLowerCase()==="%"?c/100*o:c:null}function Qt(e){return St(e,1)!==null}function Zt(e,o){const s=[];for(const c of e){const h=St(c,o);h!==null&&s.push(h)}return s}function en(e,o,s=Wt){const h=[0,...o.filter(f=>f>0&&f<e).map(f=>e-f)].sort((f,u)=>f-u),p=[];for(const f of h){const u=p[p.length-1];(u===void 0||f-u>=s)&&p.push(f)}return p}function tn(e,o){return o.reduce((s,c)=>Math.abs(c-e)<Math.abs(s-e)?c:s,o[0])}const nn=.3;function rn(e,o){if(e.length<2||o<=0)return null;const s=e[e.length-1];return o-s<=Xt*o?s:null}function Ye(e,o,s,c){const h=c!==null,p=h?o[o.length-2]:o[o.length-1],f=h?c:s,u=h?nn:0;return e<=p?1:e>=f?u:1-(1-u)*((e-p)/(f-p))}function on(e,o,s,c){let h=o;if(s>0){const p=o.filter(f=>f>=c);p.length>0&&(h=p)}else if(s<0){const p=o.filter(f=>f<=c);p.length>0&&(h=p)}return tn(e,h)}const _e="--_sheet-keyboard-inset",sn=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);function Ve(){return window.visualViewport?.height??window.innerHeight}function cn(){return Ve()>=window.innerHeight-.5}function an(){const e=window.navigator.userAgent;return/iPad|iPhone|iPod/.test(e)||e.includes("Macintosh")&&window.navigator.maxTouchPoints>1}function Ke(e){return e instanceof HTMLTextAreaElement?!e.disabled&&!e.readOnly:e instanceof HTMLInputElement?!e.disabled&&!e.readOnly&&!sn.has((e.getAttribute("type")??"text").toLowerCase()):e instanceof HTMLElement&&e.matches('[contenteditable]:not([contenteditable="false"])')}function gt(e,o){if(!(e instanceof Element))return null;const s=e.closest('input, textarea, [contenteditable]:not([contenteditable="false"])');if(o.contains(s)&&Ke(s))return s;const c=e.closest("label"),h=c instanceof HTMLLabelElement?c.control:null;return o.contains(h)&&Ke(h)?h:null}function ln({bodyRef:e,bottomClearance:o,isEnabled:s,isFullyExpanded:c,isPageScrollLocked:h,isSheetTraveling:p,isOpen:f,isPresented:u,sheetRef:j}){const E=n.useRef(!1),B=n.useRef(!1),A=n.useRef(c),M=n.useRef(f);A.current=c,M.current=f,n.useEffect(()=>{if(!s||!p)return;const i=j.current,b=document.activeElement;i&&b instanceof HTMLElement&&b!==i&&i.contains(b)&&(B.current=E.current,i.focus({preventScroll:!0}))},[s,p,j]),n.useEffect(()=>{if(!s||!u||f)return;const i=j.current,b=document.activeElement;i&&b instanceof HTMLElement&&b!==i&&i.contains(b)&&(B.current=E.current,b.blur())},[s,f,u,j]),n.useEffect(()=>{const i=e.current,b=j.current;if(!s||!u||!i)return;let P=null,D=null;const N=an(),ee=()=>{i.style.setProperty(_e,"0px"),P=null,D=null,E.current=!1,B.current=!1},F=(d,x)=>{if(typeof i.scrollBy!="function"){i.scrollTop+=d;return}const S=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;i.scrollBy({top:d,behavior:x&&!S?"smooth":"instant"})},Q=(d,x)=>{const S=i.getBoundingClientRect(),I=d.getBoundingClientRect(),q=Ve(),se=Math.max(0,S.bottom-q)>0?o:0,re=S.top,C=Math.min(S.bottom,q-se);C<=re||(I.bottom>C?F(I.bottom-C,x):I.top<re&&F(I.top-re,x))},R=d=>{const x=Ve();if(cn()){ee();return}if(Math.max(0,d.bodyBottom-x)===0){ee();return}const I=Math.max(0,d.bodyBottom-(x-o));i.style.setProperty(_e,`${I}px`)},w=d=>{if(!A.current)return;const x=gt(d.relatedTarget,i);if(x){x!==document.activeElement&&x.focus({preventScroll:!0});return}const S=gt(d.target,i);M.current&&S&&!d.relatedTarget&&b?.focus({preventScroll:!0})},te=()=>{const d=document.activeElement;if(!A.current||!(d instanceof HTMLElement)||!i.contains(d)||!Ke(d)){if(B.current&&P){R(P);return}ee();return}B.current=!1;const x=i.getBoundingClientRect(),S=Ve(),I=Math.max(0,x.bottom-S),q=I>0?o:0;P=I>0?{bodyBottom:x.bottom}:null,h&&I>0&&!E.current&&(D={x:window.scrollX,y:window.scrollY}),E.current=I>0;const me=I>0?Math.max(0,x.bottom-(S-q)):0;i.style.setProperty(_e,`${me}px`),Q(d,I>0)};let H=0;const k=()=>{cancelAnimationFrame(H),H=requestAnimationFrame(te)},X=()=>{const d=D;if(d==null||window.scrollX===d.x&&window.scrollY===d.y)return;window.scrollTo(d.x,d.y);const x=document.activeElement;x instanceof HTMLElement&&i.contains(x)&&Ke(x)&&Q(x,!1)},y=typeof ResizeObserver>"u"?null:new ResizeObserver(k),$=()=>{if(!y)return;y.disconnect();const d=new Set([i]);b&&d.add(b);for(const S of i.children)d.add(S);const x=document.activeElement;if(x instanceof HTMLElement&&i.contains(x))for(let S=x;S&&S!==i;S=S.parentElement)d.add(S);for(const S of d)y.observe(S)},G=typeof MutationObserver>"u"?null:new MutationObserver(d=>{d.every(x=>x.type==="attributes"&&x.target===i)||($(),k())}),U=()=>{$(),k()},Y=()=>{B.current=E.current,k()},_=d=>{d.target===b&&d.propertyName==="transform"&&k()},ne=window.visualViewport;return N&&document.addEventListener("blur",w,!0),i.addEventListener("focusin",U),i.addEventListener("focusout",Y),b?.addEventListener("transitionend",_),ne?.addEventListener("resize",k),ne?.addEventListener("scroll",k),window.addEventListener("scroll",X),window.addEventListener("resize",k),G?.observe(i,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),$(),k(),()=>{cancelAnimationFrame(H),N&&document.removeEventListener("blur",w,!0),i.removeEventListener("focusin",U),i.removeEventListener("focusout",Y),b?.removeEventListener("transitionend",_),ne?.removeEventListener("resize",k),ne?.removeEventListener("scroll",k),window.removeEventListener("scroll",X),window.removeEventListener("resize",k),y?.disconnect(),G?.disconnect(),i.style.removeProperty(_e),E.current=!1,B.current=!1}},[e,o,s,h,u,j])}const pt=.998,un=pt/(1-pt),fn=48,Qe=100,Fe=.4,yt=40;function Ze(e){return e.syntheticTouch===!0}const dn=.35,xn=4,et=8;function hn(){typeof navigator>"u"||typeof navigator.vibrate!="function"||Rt()||navigator.vibrate(8)}function mn(e,o){let s=o[0],c=Math.abs(e-s);for(const f of o){const u=Math.abs(e-f);u<c&&(c=u,s=f)}if(c>=yt)return e;const h=c/yt,p=1-h*h;return e+(s-e)*p}function tt(e,o,s){return Math.max(0,e-o-s)}function Tt(e){const o=Number.parseFloat(getComputedStyle(e).paddingBlockEnd);return Number.isFinite(o)?o:0}function bt(e){if(!e)return 0;const o=Tt(e);return Math.max(0,e.scrollHeight-e.clientHeight-o)-e.scrollTop}function gn(e){if(e.scrollHeight-e.clientHeight<=1)return!1;const{overflowY:o}=getComputedStyle(e);return o==="auto"||o==="scroll"}function kt(e,o){const s=[];for(let c=e instanceof Element?e:null;c!=null&&c!==o;c=c.parentElement)c instanceof HTMLElement&&gn(c)&&s.push(c);return s.push(o),s}function pn(e){return e.scrollTop<=0}function yn(e){return e.scrollTop+e.clientHeight>=e.scrollHeight-1}function $e(e){return e.every(pn)}function nt(e){return e.every(yn)}function Le(e,o,s){return Math.max(0,e-s-o)}function Rt(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function bn({isOpen:e,canDismiss:o=!0,offscreenBlockEndInset:s=0,onDismiss:c,snapHeights:h,onSnap:p,onScrimOpacity:f}){const[u,j]=n.useState(0),[E,B]=n.useState(0),[A,M]=n.useState(!1),[i,b]=n.useState(!1),[P,D]=n.useState(0),[N,ee]=n.useState(0),[F,Q]=n.useState(0),R=n.useRef(0),w=n.useRef(0),[te,H]=n.useState(null),[k,X]=n.useState(!1),y=n.useRef(0),$=n.useRef(null),G=n.useRef(null),U=n.useRef(s);U.current=Math.max(0,s);const Y=n.useCallback(t=>{const r=Math.max(0,t);R.current=r,Q(r)},[]),_=n.useCallback(t=>{const r=Math.max(0,t);Math.abs(r-y.current)>.5&&(y.current=r,ee(r))},[]),ne=n.useCallback(()=>{X(!0),$.current=null,H(null);const t=G.current;G.current=null,t!=null&&_(t)},[_]),d=n.useCallback((t,r,m,T,g,L,a)=>{const v=tt(t,m,L);if(a&&Math.abs(T-r)>.5&&!Rt()){G.current=v,$.current=g,H(g);return}G.current=null,$.current=null,H(null),X(Math.abs(g-m)>.5),_(v)},[_]),x=n.useRef(0);A||(x.current=E);const S=n.useRef(e);S.current=e;const I=n.useRef(h);I.current=h;const q=n.useRef(c),me=n.useRef(o),se=n.useRef(p),re=n.useRef(f);n.useEffect(()=>{q.current=c,me.current=o,se.current=p,re.current=f});const C=n.useRef(null),ge=n.useRef(0),pe=n.useRef(null),ye=n.useRef(null),be=n.useRef(null);n.useLayoutEffect(()=>{if(!k)return;pe.current?.offsetHeight;const t=requestAnimationFrame(()=>{X(!1)});return()=>cancelAnimationFrame(t)},[k]);const le=n.useCallback(t=>{t<=0||!S.current||x.current>0||(ge.current=t,D(r=>r===t?r:t))},[]),Ge=n.useCallback(t=>{if(be.current?.disconnect(),be.current=null,pe.current=t,!t||typeof ResizeObserver>"u"){t&&le(t.getBoundingClientRect().height);return}le(t.getBoundingClientRect().height);const r=new ResizeObserver(m=>{const T=m[0];if(T){const g=T.borderBoxSize?.[0]?.blockSize;le(g??T.target.getBoundingClientRect().height)}});r.observe(t),be.current=r},[le]);n.useEffect(()=>()=>be.current?.disconnect(),[]),n.useEffect(()=>{e&&(j(0),B(0),M(!1),b(!1),X(!1),Y(0),w.current=0,y.current=0,$.current=null,G.current=null,ee(0),H(null))},[e,Y]);const ue=n.useCallback(()=>ge.current>0?ge.current:pe.current?.getBoundingClientRect().height??0,[]),oe=n.useCallback(t=>{const r=Le(t,0,U.current),m=en(r,I.current?.()??[]);return{offsets:m,peekOffset:rn(m,r)}},[]),Re=n.useCallback(()=>{const t=pe.current;if(!t)return ge.current;const r=t.style.height;if(r==="")return t.getBoundingClientRect().height;t.style.height="";const m=t.getBoundingClientRect().height;return t.style.height=r,m},[]),ce=n.useCallback(()=>{if(!S.current||C.current!=null||$.current!=null)return;const t=Re();if(t<=0)return;const{offsets:r,peekOffset:m}=oe(t),T=Math.min(w.current,r.length-1),g=r[T],L=g===m?0:g,a=R.current;if(t===ge.current&&Math.abs(g-x.current)<=.5&&Math.abs(L-a)<=.5)return;ge.current=t,D(t),w.current=T,d(a,g,L,g,a,bt(ye.current),!1),Y(L),B(g),se.current?.(Le(t,g,U.current));const v=r[r.length-1],l=Le(t,v,U.current);re.current?.(Ye(g,r,v+l*Fe,m))},[Re,d,Y,oe]);n.useEffect(()=>{if(!(!e||typeof window>"u"))return window.addEventListener("resize",ce),window.addEventListener("orientationchange",ce),()=>{window.removeEventListener("resize",ce),window.removeEventListener("orientationchange",ce)}},[e,ce]);const Be=n.useRef(!1);n.useLayoutEffect(()=>{if(!Be.current){Be.current=!0;return}ce()},[ce,h]);const qe=n.useCallback((t,r)=>{const m=pe.current;if(m==null)return;const T=t-r;m.style.transform=T!==0?`translateY(${T}px)`:""},[]),J=n.useCallback(t=>{const r=C.current;if(r==null)return;C.current=null,t?.hasPointerCapture?.(r.pointerId)&&t.releasePointerCapture(r.pointerId),j(r.baseOffset),M(!1),b(!1),d(r.baseLayoutOffset,r.baseOffset,r.baseLayoutOffset,r.renderedOffset,r.layoutOffset,r.naturalEndGap,!0);const{offsets:m,peekOffset:T}=oe(r.height),g=m[m.length-1],L=Le(r.height,g,U.current),a=g+L*Fe;re.current?.(Ye(r.baseOffset,m,a,T))},[d,oe]);n.useEffect(()=>{const t=()=>J(),r=()=>{document.visibilityState==="hidden"&&J()};return window.addEventListener("blur",t),document.addEventListener("visibilitychange",r),()=>{window.removeEventListener("blur",t),document.removeEventListener("visibilitychange",r)}},[J]);const He=n.useCallback((t,r,m,T,g,L,a,v,l,z)=>{const{offsets:W,peekOffset:xe}=oe(m),Se=W[W.length-1],ae=Le(m,Se,U.current),Oe=Se+ae*Fe,De=g>fn?t+r*un:t,xt=Te=>{const ht=Te===xe?0:Te;d(a,Te,ht,v,l,z,!0),Y(ht),w.current=Math.max(0,W.indexOf(Te)),B(Te),se.current?.(Le(m,Te,U.current)),re.current?.(Ye(Te,W,Oe,xe)),Te!==L&&hn()};if(T>0&&De>Oe){me.current?(d(a,L,a,a,a,z,!1),q.current()):xt(Se);return}const zt=on(Math.min(Math.max(De,0),Se),W,T,L);xt(zt)},[d,Y,oe]),O=n.useCallback((t,r,m)=>{const T=t.currentTarget,g=Ze(t);g||T.setPointerCapture?.(t.pointerId);const L=m??t.clientY,a=bt(ye.current),v=R.current;C.current={syntheticTouch:g,pointerId:t.pointerId,startCoord:L,lastCoord:t.clientY,lastTime:t.timeStamp,samples:[{t:t.timeStamp,y:t.clientY}],velocity:0,height:r,baseOffset:E,baseLayoutOffset:v,renderedOffset:E,layoutOffset:v,naturalEndGap:a,hasTraveled:!1},_(tt(v,v,a)),j(E),M(!0)},[E,_]),ke=n.useCallback(t=>{t.button!==0||!t.isPrimary||(t.preventDefault(),O(t,ue()))},[O,ue]),Z=n.useCallback(t=>{C.current!=null&&(t.preventDefault(),J(t.currentTarget))},[J]),fe=n.useCallback(t=>{C.current?.syntheticTouch||C.current?.pointerId===t.pointerId&&J()},[J]),ve=n.useCallback(t=>{const r=C.current;if(!r||r.pointerId!==t.pointerId||r.syntheticTouch&&!Ze(t))return;const m=t.clientY-r.startCoord;if(t.timeStamp-r.lastTime>0){for(r.lastCoord=t.clientY,r.lastTime=t.timeStamp,r.samples.push({t:t.timeStamp,y:t.clientY});r.samples.length>2&&t.timeStamp-r.samples[0].t>Qe;)r.samples.shift();const Oe=r.samples[0],De=Math.min(t.timeStamp-Oe.t,Qe);r.velocity=De>0?(t.clientY-Oe.y)/De:0}const{offsets:g,peekOffset:L}=oe(r.height),a=r.baseOffset+m,v=g[g.length-1];let l;a<0?l=Math.max(-48,a*dn):a>v?l=a:l=mn(a,g);const z=l<r.baseOffset?0:r.baseLayoutOffset,W=z!==r.layoutOffset;r.renderedOffset=l,r.layoutOffset=z,x.current=l,qe(l,z),W&&j(l),!r.hasTraveled&&l!==r.baseOffset&&(r.hasTraveled=!0,b(!0)),_(tt(r.baseLayoutOffset,z,r.naturalEndGap));const xe=g[g.length-1],Se=Le(r.height,xe,U.current),ae=xe+Se*Fe;re.current?.(Ye(l,g,ae,L))},[oe,_,qe]),Ee=n.useCallback(t=>{const r=C.current;if(!r||r.pointerId!==t.pointerId||r.syntheticTouch&&!Ze(t))return;const m=t.currentTarget,T=t.clientY-r.startCoord,g=Math.max(0,r.baseOffset+T),L=T===0?0:T>0?1:-1,a=t.timeStamp-r.lastTime<Qe?r.velocity:0;C.current=null,r.syntheticTouch||m.releasePointerCapture?.(t.pointerId),M(!1),b(!1),He(g,a,r.height||1,L,Math.abs(T),r.baseOffset,r.baseLayoutOffset,r.renderedOffset,r.layoutOffset,r.naturalEndGap)},[He]),de=n.useRef(null),Ce=n.useCallback(t=>{if(t.button!==0||!t.isPrimary)return;const r=kt(t.target,t.currentTarget);if(!$e(r)){de.current=null;return}de.current={pointerId:t.pointerId,startCoord:t.clientY,scrollers:r}},[]),ze=n.useCallback(t=>{if(C.current){ve(t);return}const r=de.current;if(!r||r.pointerId!==t.pointerId)return;const m=t.clientY-r.startCoord;m>et&&$e(r.scrollers)?(de.current=null,O(t,ue(),r.startCoord),ve(t)):m<0&&(de.current=null)},[O,ve,ue]),Ae=n.useCallback(t=>{de.current=null,!C.current?.syntheticTouch&&C.current&&Ee(t)},[Ee]),we=n.useRef(null),Me=n.useRef(null),ie=n.useCallback(t=>{we.current=null,de.current=null,J(t)},[J]),V=n.useRef(O),Ie=n.useRef(J),je=n.useRef(ie),Pe=n.useRef(ve),st=n.useRef(Ee),Ue=n.useRef(ue);n.useEffect(()=>{V.current=O,Ie.current=J,je.current=ie,Pe.current=ve,st.current=Ee,Ue.current=ue});const ct=n.useCallback(t=>{const r=(a,v)=>({syntheticTouch:!0,pointerId:a.identifier,clientY:a.clientY,timeStamp:Date.now(),currentTarget:v,setPointerCapture:()=>{},releasePointerCapture:()=>{}}),m=a=>{const v=a.currentTarget;if(a.touches.length>1){je.current(v);return}const l=a.changedTouches[0];if(!l){we.current=null;return}const z=kt(a.target,v),W=$e(z),xe=nt(z)&&x.current>0;we.current={id:l.identifier,startY:l.clientY,scrollers:z,top:W,bottom:xe,contentEndY:null,promotedAtContentEnd:!1}},T=a=>{const v=a.currentTarget;if(a.touches.length>1){je.current(v);return}const l=we.current;if(C.current){const ae=[...a.changedTouches].find(Oe=>Oe.identifier===C.current?.pointerId);if(!ae)return;if(l?.promotedAtContentEnd&&l.contentEndY!=null){if(ae.clientY>=l.contentEndY){l.contentEndY=null,l.promotedAtContentEnd=!1,Ie.current(v);return}Pe.current(r(ae,v));return}a.preventDefault(),Pe.current(r(ae,v));return}if(!l)return;const z=[...a.changedTouches].find(ae=>ae.identifier===l.id);if(!z)return;const W=z.clientY-l.startY,xe=l.top&&W>et&&$e(l.scrollers),Se=l.bottom&&W<-et&&nt(l.scrollers);if(xe||Se){a.preventDefault(),we.current=null,V.current(r(z,v),Ue.current(),l.startY),Pe.current(r(z,v));return}(l.top&&W<0||l.bottom&&W>0)&&(l.top=!1,l.bottom=!1),x.current>0&&nt(l.scrollers)?l.contentEndY==null?l.contentEndY=z.clientY:l.contentEndY-z.clientY>=xn&&(l.promotedAtContentEnd=!0,V.current(r(z,v),Ue.current(),l.contentEndY),Pe.current(r(z,v))):l.contentEndY=null},g=a=>{we.current=null;const v=C.current?.pointerId;if(v==null)return;const l=[...a.changedTouches].find(W=>W.identifier===v),z=a.currentTarget;l?st.current(r(l,z)):a.touches.length===0&&Ie.current(z)},L=ye.current;if(L&&Me.current){const a=Me.current;L.removeEventListener("touchstart",a.start),L.removeEventListener("touchmove",a.move),L.removeEventListener("touchend",a.end),L.removeEventListener("touchcancel",a.end)}ye.current=t,t?(t.addEventListener("touchstart",m,{passive:!0}),t.addEventListener("touchmove",T,{passive:!1}),t.addEventListener("touchend",g,{passive:!0}),t.addEventListener("touchcancel",g,{passive:!0}),Me.current={start:m,move:T,end:g}):Me.current=null},[]),it=Mt("(prefers-reduced-motion: reduce)"),at=n.useCallback(t=>{if(y.current<=0)return;const r=Tt(t),m=Math.max(0,t.scrollHeight-t.clientHeight-r),T=Math.max(0,t.scrollTop-m);T<y.current-.5&&_(T)},[_]),lt=n.useCallback(t=>{C.current!=null||$.current!=null||at(t.currentTarget)},[at]),ut=n.useCallback(t=>{if(!t.isPrimary){ie(t.currentTarget);return}ke(t)},[ke,ie]),ft=n.useCallback(t=>{if(!t.isPrimary){ie(t.currentTarget);return}Ce(t)},[Ce,ie]),We=n.useCallback(t=>{t.touches.length>1&&ie(t.currentTarget)},[ie]),dt=n.useCallback(t=>{const r=C.current;r?.pointerId!==t.pointerId||r.syntheticTouch||J(t.currentTarget)},[J]),Xe=A?u:E,Pt=n.useMemo(()=>({style:{transform:Xe!==0?`translateY(${Xe}px)`:void 0,transition:e&&(A||k||it)?"none":void 0,touchAction:"pinch-zoom",overscrollBehavior:"contain"}}),[Xe,A,e,k,it]),Ot=n.useMemo(()=>({style:{touchAction:"pinch-zoom",cursor:"grab"},onContextMenu:Z,onLostPointerCapture:fe,onPointerDown:ut,onPointerMove:ve,onPointerUp:Ee,onPointerCancel:dt,onTouchStart:We,onTouchMove:We}),[Ee,Z,dt,ut,We,fe,ve]),Lt=n.useMemo(()=>({ref:ct,onContextMenu:Z,onLostPointerCapture:fe,onPointerDown:ft,onPointerMove:ze,onPointerUp:Ae,onPointerCancel:Ae,onScroll:lt}),[ct,Ae,ft,ze,lt,Z,fe]);return{sheetRef:Ge,contentProps:Pt,handleProps:Ot,bodyProps:Lt,bodyElementRef:ye,dragOffset:u,settledOffset:E,isDragging:A,isTraveling:i,activeOffsetRef:x,sheetHeight:P,scrollPreservationInset:N,settlingLayoutOffset:te,settledLayoutOffset:F,completeScrollAreaSettle:ne}}const vt={hug:"92dvh",capped:"62dvh",tall:"92dvh"},kn=48,vn=48,En=50;function wn(){return typeof window>"u"?0:window.innerHeight}function Sn(e){let o="";for(const s of e??[])o+=`${typeof s}:${s}|`;return o}const he={sheet:{kfzvcC:"x67bb7w",kB7OPa:"x9f619",kVAEAm:"x1n2onr6",k1xSpc:"x78zum5",kXwgrk:"xdt5ytf",kAzted:"x2lwn1j",kzqmXN:"xh8yej3",ks0D6T:"x11gisft",kWkggS:"x10xzikg",kEafiO:"x11xkdxz",kPef9Z:"x13fuv20",kLZC3w:"x1pc3f07",k2ei4v:"xgbv0en",kVhnKS:"x1t7ytsu",kGJrpR:"x1j92z86",ke9TFa:"xw8tdv1",k8ry5P:"x18b5jzi",kBCPoo:"x1gejf6u",krdFHd:"x81l70g",kfmiAY:"x7hs6f1",kGVxlE:"x1kcpxr7",kI3sdo:"x1a2a7pz",kVQacm:"xb3r6kr",kGO01o:"x1wkw6tp",k1K539:"x1if0o47",k3aq6I:"xnn1q72 xhbqy3z",kSiTet:"x1hc1fzr",k1ekBW:"xwcsmn1",kIyJzY:"x80gvsz",kAMwcw:"xlr8y92",k6sLGO:"x1q1rmc8",k6CgDc:"xzg1mie",$$css:!0},sheetClosing:{k3aq6I:"x1weeur4",kAMwcw:"xv2sgk5",$$css:!0},sheetFading:{kSiTet:"xg01cxk",$$css:!0},sheetInactive:{kfzvcC:"x47corl",$$css:!0},body:{kzQI83:"x1iyjqo2",kAzted:"x2lwn1j",kB7OPa:"x9f619",kFalU9:"xge0x1e",kInvED:"x1wfwxd8 x1nw7mhf",kWkggS:"x10xzikg",kGO01o:"x18d9i69",$$css:!0},content:{k1xSpc:"xufnvkl",kB7OPa:"x9f619",kZKoxP:"x5yr21d",kAzted:"x121v3j4",$$css:!0},tallKeyboardBody:{kFlMNQ:"xrw9175",k5JduY:"x1s928wv",kc3QkE:"xhkezso",k4zj60:"xu6fald",kloYau:"x2q1x1w",$$css:!0},budget:{kZKoxP:"x1tpcejd",$$css:!0},hugHeight:{kZKoxP:"xg7h5cd",kskxy:"x14bu9tk",$$css:!0}};function Tn(e){return e.kind==="open"?e.entering?"entering":null:e.kind==="retained"?e.motion==="covered"?null:e.motion:e.kind==="exiting"?"exiting":null}function Et(e,o,s){if(e==null)return s(),()=>{};let c=!1,h=null;const p=()=>{c||(c=!0,h!=null&&clearTimeout(h),e.removeEventListener("transitionend",f),e.removeEventListener("transitioncancel",f),s())},f=i=>{i.target===e&&i.propertyName===o&&p()};e.addEventListener("transitionend",f),e.addEventListener("transitioncancel",f);const u=getComputedStyle(e);if(e.style.transition.trim()==="none"||u.transition.trim()==="none")return p(),()=>{};const j=u.transitionProperty.split(",").map(i=>i.trim()),E=u.transitionDuration.split(",").map(wt),B=u.transitionDelay.split(",").map(wt);let A=!1;const M=j.reduce((i,b,P)=>{if(b!==o&&b!=="all")return i;const D=E[P%E.length],N=B[P%B.length];return D==null||N==null?(A=!0,i):Math.max(i,D+N)},0);return A?()=>{e.removeEventListener("transitionend",f),e.removeEventListener("transitioncancel",f)}:M<=0?(p(),()=>{}):(h=setTimeout(p,M+En),()=>{h!=null&&clearTimeout(h),e.removeEventListener("transitionend",f),e.removeEventListener("transitioncancel",f)})}function wt(e){const o=e.trim();if(!/^-?(?:\d+|\d*\.\d+)(?:ms|s)$/.test(o))return null;const s=Number.parseFloat(e);return o.endsWith("ms")?s:s*1e3}function rt({ref:e,state:o,height:s,label:c,children:h,padding:p,snapPoints:f,className:u,style:j,tabIndex:E,xstyle:B,isSwipeDismissAllowed:A=!0,isPageScrollLocked:M=!1,onDismiss:i,onScrimOpacity:b,onElementChange:P,onMotionStart:D,onMotionComplete:N,...ee}){const F=n.useRef(null),Q=n.useRef(o),R=n.useRef(!1),w=n.useRef(D),te=n.useRef(N),H=n.useRef(null),k=n.useRef(null),X=o.kind==="open"&&o.entering,y=Q.current,$=y.kind==="open"&&y.entering;X&&!$?R.current=y.kind==="retained":X||(R.current=!1),n.useLayoutEffect(()=>{Q.current=o,w.current=D,te.current=N},[N,D,o]);const G=o.kind==="open",U=o.kind!=="hidden",Y=o.kind==="retained",_=Y||o.kind==="exiting",ne=o.kind==="exiting",d=Y&&o.motion==="fading",x=Y?o.alignmentOffset:0,S=Sn(f),I=n.useRef(f);I.current=f;const{snapHeights:q,ignoredSnapPointsMessage:me}=n.useMemo(()=>{if(S==="")return{snapHeights:void 0,ignoredSnapPointsMessage:""};const V=(I.current??[]).filter(Ie=>!Qt(Ie));return{snapHeights:()=>Zt(I.current??[],wn()),ignoredSnapPointsMessage:V.length===0?"":`snapPoints ignored ${JSON.stringify(V)}. A snap point is a viewport fraction above 0 and up to 1 (0.5 is half the screen), a px length ('320px'), or a percentage ('50%').`}},[S]);Ne("BottomSheet",me,me!=="");const{contentProps:se,handleProps:re,bodyProps:C,bodyElementRef:ge,sheetRef:pe,dragOffset:ye,settledOffset:be,isDragging:le,isTraveling:Ge,sheetHeight:ue,scrollPreservationInset:oe,settlingLayoutOffset:Re,settledLayoutOffset:ce,completeScrollAreaSettle:Be}=bn({isOpen:G,canDismiss:A,offscreenBlockEndInset:kn,onDismiss:i,snapHeights:q,onScrimOpacity:b}),{getViewportProps:qe,getContentProps:J}=It({axis:"both",keyboardAccess:{owner:"contentOrViewport",label:c},overscroll:"contain",stickyContainment:"always"}),He=n.useCallback(V=>{pe(V),F.current=V,P?.(V)},[P,pe]);ln({bodyRef:ge,bottomClearance:vn,isEnabled:s==="tall",isFullyExpanded:be===0,isPageScrollLocked:M,isSheetTraveling:Ge,isOpen:G,isPresented:U,sheetRef:F}),n.useImperativeHandle(e,()=>F.current,[]);const O=Tn(o);n.useLayoutEffect(()=>{if(O!=null){if(H.current=null,k.current=null,O==="entering"&&R.current){k.current=O;return}return Et(F.current,O==="fading"?"opacity":"transform",()=>{H.current===O?te.current?.(O):k.current=O})}},[O]),n.useLayoutEffect(()=>{if(Re!=null)return Et(F.current,"transform",Be)},[Be,Re]),n.useEffect(()=>{if(O!=null)return w.current?.(O),H.current=O,k.current===O&&(k.current=null,te.current?.(O)),()=>{H.current===O&&(H.current=null),k.current===O&&(k.current=null)}},[O]);const ke=p==null,Z=p??4,fe=Vt[Z],Ee=typeof s=="string"&&s in vt?vt[s]:typeof s=="number"?`${s}px`:s,de=ue>0;let Ce=se.style.transform,ze;if(de){const V=le?ye<be?0:ce:Re??ce,je=(le?ye:be)-V,Pe=le||Re!=null;ze=V>0||Pe?`${Math.max(0,ue-Math.max(0,V))}px`:void 0,Ce=je!==0?`translateY(${je}px)`:void 0}const Ae=x>0?[Ce,`translateY(${x}px)`].filter(Boolean).join(" "):Ce,we=G?Ce:Y?Ae:void 0,Me=j?.transform;n.useLayoutEffect(()=>{if(le||Me!=null)return;const V=F.current;V!=null&&(V.style.transform=we??"")});const ie={transition:se.style.transition,touchAction:se.style.touchAction,overscrollBehavior:se.style.overscrollBehavior,height:ze};return K.jsxs("div",{...ee,ref:He,tabIndex:E??-1,...mt($t("bottom-sheet"),Je(Ft.reset,_t.reset,he.sheet,Yt.reset,s==="hug"?he.hugHeight:he.budget,ne&&he.sheetClosing,d&&he.sheetFading,_&&he.sheetInactive,B),u,{"--_sheet-budget":Ee,...G?ie:Y||ne?{height:ze}:{},...j}),children:[K.jsx("div",{className:"x10l6tqk x13vifvy x1o0tod xtijo5x x1vjfegm x78zum5 x6s0dn4 xl56j7k xvpftlf xafqdz2 x1j4r261 x1jm3nie x16khyan",...re,"aria-hidden":"true",children:K.jsx("div",{className:"x1m747yf x11c6zpc xjspbzw x1m4xfpy"})}),K.jsx("div",{...qe({...C,...mt(Je(Ht.focusVisible,he.body,s==="tall"&&he.tallKeyboardBody),oe>0?{style:{paddingBlockEnd:`${oe}px`}}:{})}),children:K.jsx("div",{...J(Je(he.content,...Bt(ke?{useThemeDefault:"bottom-sheet"}:{paddingInnerX:fe,paddingInnerY:fe,paddingOuterX:fe,paddingOuterY:fe}),!ke&&Z!==4&&At[Z],!ke&&Z!==4&&Dt[Z],!ke&&Z!==4&&Nt[Z],!ke&&Z!==4&&qt[Z])),children:K.jsx(jt,{children:h})})})]})}rt.displayName="BottomSheetPanel";function Rn(){return K.jsx("div",{className:"xixxii4 x17y0mx6 x1ey2m1c x1kpxq89 x10xzikg xhtitgo x47corl x1cb67k9 xt2iwb0","data-sheet-edge-tint":"","aria-hidden":"true"})}const ot=n.createContext(null);ot.displayName="BottomSheetSwitcherContext";function Cn(e,o){switch(e){case"active":return{kind:"open",entering:!1};case"entering":return{kind:"open",entering:!0};case"covered":case"aligning":case"fading":return{kind:"retained",motion:e,alignmentOffset:o};case"exiting":return{kind:"exiting"};case"hidden":return{kind:"hidden"}}}function Ct(e,o){const s=document.activeElement;if(s!=null&&e?.contains(s))return;const c=e?.querySelector("[data-autofocus]");c!=null?c.focus({preventScroll:!0}):o&&e?.focus({preventScroll:!0})}function Pn({ref:e,isOpen:o,onOpenChange:s,label:c,children:h,height:p="capped",snapPoints:f,hasScrim:u=!0,finalFocusRef:j,purpose:E="info",xstyle:B,...A}){const M=n.useRef(null),i=n.useRef(null),b=n.useRef(null),[P,D]=n.useState(o),N=o||P,ee=o?{kind:"open",entering:!1}:P?{kind:"exiting"}:{kind:"hidden"},F=n.useCallback(()=>{o&&E!=="required"&&s(!1)},[o,s,E]),Q=n.useCallback(()=>{E==="info"&&s(!1)},[s,E]),R=n.useCallback(y=>{i.current=y},[]),w=n.useCallback(y=>{M.current?.style.setProperty("--_sheet-scrim-opacity",String(y))},[]);n.useEffect(()=>{const y=M.current;if(y==null||!o)return;D(!0),y.style.setProperty("--_sheet-scrim-opacity","1"),y.open||(u?(b.current=document.activeElement,y.showModal()):y.show(),Ct(i.current,u))},[u,o]),n.useEffect(()=>{!o&&P&&u&&w(0)},[w,u,o,P]);const te=n.useCallback(y=>{if(y!=="exiting"||o)return;const $=M.current;$?.open&&$.close(),D(!1),(j?.current??b.current)?.focus(),b.current=null},[j,o]);Kt(N&&u),Ne("BottomSheet","requires a non-empty `label` for an accessible name; the open sheet has no built-in heading to derive one from.",o&&!c);const{shouldDismissOnCloseRequest:H}=Gt({isActive:N,escapeBehavior:o&&E!=="required"?"close":"block",onDismiss:F,getContainer:()=>M.current,isPresent:()=>M.current?.open??!1}),k=n.useCallback(y=>{y.preventDefault(),H()&&F()},[F,H]),X=n.useCallback(y=>{u&&y.target===y.currentTarget&&Q()},[Q,u]);return K.jsxs("dialog",{...{0:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz"},8:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq"},4:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x15h3t91 x142juwg x1viac0w"},12:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x15h3t91 x142juwg x1viac0w"},2:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz x1cz9k3x"},10:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq x1cz9k3x"},6:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x142juwg x1viac0w x1cz9k3x"},14:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x142juwg x1viac0w x1cz9k3x"},1:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz x47corl xfo81ep xh8yej3 x5yr21d"},9:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq x47corl xfo81ep xh8yej3 x5yr21d"},5:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x15h3t91 x142juwg x1viac0w x47corl xfo81ep xh8yej3 x5yr21d"},13:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x15h3t91 x142juwg x1viac0w x47corl xfo81ep xh8yej3 x5yr21d"},3:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz x1cz9k3x x47corl xfo81ep xh8yej3 x5yr21d"},11:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq x1cz9k3x x47corl xfo81ep xh8yej3 x5yr21d"},7:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x142juwg x1viac0w x1cz9k3x x47corl xfo81ep xh8yej3 x5yr21d"},15:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x142juwg x1viac0w x1cz9k3x x47corl xfo81ep xh8yej3 x5yr21d"}}[!!N<<3|!!u<<2|!!(u&&!o&&P)<<1|!u<<0],ref:M,"aria-label":c,"aria-hidden":!o&&P?"true":void 0,"aria-modal":u&&o?"true":void 0,role:E==="required"?"alertdialog":void 0,inert:!o&&P?!0:void 0,onCancel:k,onClick:X,children:[K.jsx("div",{className:"x10l6tqk x17y0mx6 x1ey2m1c x78zum5 xl56j7k x47corl",children:K.jsx(rt,{...A,ref:e,state:ee,height:p,label:c,snapPoints:f,isSwipeDismissAllowed:E==="info",isPageScrollLocked:N&&u,xstyle:B,onDismiss:Q,onScrimOpacity:w,onElementChange:R,onMotionComplete:te,children:K.jsx(Ut,{children:h})})}),K.jsx(Rn,{})]})}function On({switcher:e,ref:o,sheetId:s,label:c,children:h,height:p="capped",snapPoints:f,purpose:u="info",xstyle:j,...E}){const{activeSheet:B,hasScrim:A,onActiveSheetChange:M,getSheetPhase:i,getSheetAlignmentOffset:b,registerSheetElement:P,registerSheetLabel:D,registerSheetPurpose:N,onSheetEnterStart:ee,onSheetTransitionComplete:F,onSheetScrimOpacityChange:Q}=e,R=typeof s=="string"&&s.length>0,w=R?i(s):"hidden",te=R?b(s):0,H=Cn(w,te),k=w==="active"||w==="entering",X=w==="covered"||w==="aligning"||w==="fading"||w==="exiting",y=w!=="hidden",$=w==="active"||w==="entering",G=n.useRef(null),U=n.useRef(w),Y=U.current,_=n.useRef(!1);n.useLayoutEffect(()=>{U.current=w},[w]);const ne=n.useCallback(()=>{u==="info"&&R&&B===s&&M(null)},[B,R,M,u,s]),d=n.useCallback(q=>{G.current=q,R&&P(s,q)},[R,P,s]),x=n.useCallback(q=>{q==="entering"&&R&&ee(s)},[R,ee,s]),S=n.useCallback(q=>{R&&F({sheetId:s,phase:q})},[R,F,s]),I=n.useCallback(q=>{R&&Q(s,q)},[R,Q,s]);return n.useLayoutEffect(()=>{if(R)return D(s,c),()=>D(s,null)},[R,c,D,s]),n.useLayoutEffect(()=>{if(R)return N(s,u),()=>N(s,null)},[R,u,N,s]),n.useEffect(()=>{if(k){const q=Y==="active"||Y==="entering";(!_.current||!q)&&Ct(G.current,A),_.current=!0}else w==="hidden"&&(_.current=!1)},[A,k,w,Y]),Ne("BottomSheet","requires a non-empty `label` for an accessible name; the open sheet has no built-in heading to derive one from.",k&&!c),K.jsx("div",{...{0:{className:"x10l6tqk x17y0mx6 x1ey2m1c x78zum5 xl56j7k x47corl"},2:{className:"x10l6tqk x17y0mx6 x1ey2m1c xl56j7k x47corl x1s85apg"},1:{className:"x10l6tqk x17y0mx6 x1ey2m1c x78zum5 xl56j7k x47corl x1vjfegm"},3:{className:"x10l6tqk x17y0mx6 x1ey2m1c xl56j7k x47corl x1s85apg x1vjfegm"}}[!y<<1|!!$<<0],hidden:!y,"aria-hidden":X?"true":void 0,inert:X?!0:void 0,children:K.jsx(rt,{...E,ref:o,state:H,height:p,label:c,snapPoints:f,isSwipeDismissAllowed:u==="info",isPageScrollLocked:A,xstyle:j,onDismiss:ne,onScrimOpacity:I,onElementChange:d,onMotionStart:x,onMotionComplete:S,children:K.jsx(ot,{value:null,children:h})})})}function Ln(e){const o=n.use(ot),s=e.sheetId,c=typeof s=="string"&&s.length>0;return Ne("BottomSheet","requires a non-empty `sheetId` when nested in BottomSheetSwitcher; standalone `isOpen` / `onOpenChange` props are ignored there.",o!=null&&!c),Ne("BottomSheet","`sheetId` only works inside BottomSheetSwitcher. Use `isOpen` and `onOpenChange` for a standalone sheet.",o==null&&s!=null),o!=null?K.jsx(On,{...e,switcher:o}):K.jsx(Pn,{...e})}Ln.displayName="BottomSheet";export{Ln as BottomSheet};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,i as de,u as pe,j as x,p as J,m as $,t as q,f as me}from"./index-
|
|
1
|
+
import{r as n,i as de,u as pe,j as x,p as J,m as $,t as q,f as me}from"./index-CLqIiIT_.js";const Q="--_item-swipe-travel",Z="--_item-swipe-dir",F="--_item-swipe-duration",fe=10,xe=48,ke=.5,ge=.5,he=.35,Pe=.6,we=44,ee=24,Ee=200,ye=400,te={isArmed:!1,phase:"idle",side:"leading"};function M(p){return p==="trailing"?-1:1}function L(){return typeof performance>"u"?Date.now():performance.now()}function ne(p){const P=p.querySelectorAll('button, a[href], input, [tabindex]:not([tabindex="-1"])');for(const m of P)if(m.closest("[data-swipe-panel]")==null){m.focus();return}document.activeElement instanceof HTMLElement&&document.activeElement.blur()}function Se({isEnabled:p,behavior:P,sides:m,measurePanel:T,fireOutermost:v,isReducedMotion:b=!1,rootRef:s}){const k=n.useRef(null),C=n.useRef(0),w=n.useRef(1),I=n.useRef(0),f=n.useRef(null),i=n.useRef(null),l=n.useRef(null),[E,g]=n.useState(te),h=n.useRef(E);h.current=E;const u=n.useRef(T),y=n.useRef(v),O=n.useRef(m),R=n.useRef(P),Y=n.useRef(b);n.useEffect(()=>{u.current=T,y.current=v,O.current=m,R.current=P,Y.current=b}),n.useEffect(()=>()=>{f.current!=null&&clearTimeout(f.current),i.current!=null&&cancelAnimationFrame(i.current)},[]);const A=n.useCallback(t=>{const e=s.current;e&&(C.current=t,e.style.setProperty(Q,`${t}px`))},[s]),_=n.useCallback(t=>{const e=s.current;e&&(t>0?e.style.setProperty(F,`${t}ms`):e.style.setProperty(F,"0s"))},[s]),G=n.useCallback(()=>{const t=s.current;t&&(t.style.removeProperty(Q),t.style.removeProperty(Z),t.style.removeProperty(F),C.current=0)},[s]),U=n.useCallback(()=>{i.current!=null&&cancelAnimationFrame(i.current),i.current=null,l.current=null},[]),H=n.useCallback(t=>{l.current=t,i.current==null&&(i.current=requestAnimationFrame(()=>{i.current=null;const e=l.current;l.current=null,e!=null&&A(e)}))},[A]),o=n.useCallback((t,e,r,c)=>{U();const a=Y.current?0:Ee;g({isArmed:!1,phase:"settling",side:t}),_(a),A(e),f.current!=null&&clearTimeout(f.current),f.current=setTimeout(()=>{f.current=null,_(0),c?.()!==!0&&(r==="idle"&&G(),g(r==="idle"?te:{isArmed:!1,phase:r,side:t}))},a)},[U,G,_,A]),K=n.useCallback((t,e)=>{const c=s.current?.clientWidth??0,a=M(t)*e*(c+ee);o(t,a,"held",()=>y.current(t)?!1:(o(t,0,"idle"),!0))},[s,o]),j=n.useCallback(()=>{const t=h.current;if(t.phase!=="resting")return;const e=s.current;e!=null&&e.contains(document.activeElement)&&ne(e),o(t.side,0,"idle")},[s,o]);n.useEffect(()=>{if(E.phase!=="resting")return;const t=e=>{const r=s.current;r!=null&&e.target instanceof Node&&!r.contains(e.target)&&j()};return document.addEventListener("pointerdown",t,!0),()=>{document.removeEventListener("pointerdown",t,!0)}},[j,s,E.phase]),n.useEffect(()=>{const t=s.current;if(t==null||!p)return;const e=r=>{k.current?.claimed===!0&&r.cancelable&&r.preventDefault()};return t.addEventListener("touchmove",e,{passive:!1}),()=>{t.removeEventListener("touchmove",e)}},[p,s]);const re=n.useCallback(t=>{const e=h.current;if(e.phase!=="resting")return;const r=s.current;if(r!=null&&r.contains(document.activeElement)&&ne(r),t()){const a=r?.clientWidth??0,d=M(e.side)*w.current*(a+ee);o(e.side,d,"held")}else o(e.side,0,"idle")},[s,o]),se=n.useCallback(t=>{const e=h.current;if(t.pointerType!=="touch"||k.current!=null||e.phase==="settling"||e.phase==="held")return;const r=s.current,c=de(r)?-1:1;w.current=c;const a=L();k.current={baseTravel:C.current*c,claimed:null,commitPx:0,inlineSign:c,lastTime:a,lastX:t.clientX,panelWidth:0,pointerId:t.pointerId,prevTime:a,prevX:t.clientX,side:e.phase==="resting"?e.side:"leading",startX:t.clientX,startY:t.clientY,travel:0}},[p,s]),ie=n.useCallback(t=>{const e=k.current;if(e==null||e.pointerId!==t.pointerId||e.claimed===!1)return;const r=(t.clientX-e.startX)*e.inlineSign,c=t.clientY-e.startY;if(e.claimed===null){if(Math.max(Math.abs(r),Math.abs(c))<fe)return;if(Math.abs(r)<=Math.abs(c)){e.claimed=!1;return}const N=h.current.phase==="resting"?e.side:r>0?"leading":"trailing";if(!O.current[N]){e.claimed=!1;return}e.claimed=!0,e.side=N,e.panelWidth=u.current(N);const oe=s.current?.clientWidth??0;e.commitPx=Math.max(e.panelWidth+xe,oe*ke),s.current!=null&&s.current.style.setProperty(Z,String(e.inlineSign)),_(0),g({isArmed:!1,phase:"dragging",side:N});try{s.current?.setPointerCapture(t.pointerId)}catch{}}const a=M(e.side),d=Math.max(0,r*a+e.baseTravel*a),W=d<=e.commitPx?d:e.commitPx+(d-e.commitPx)*he,z=d>=e.commitPx;z!==e.travel>=e.commitPx&&g({isArmed:z,phase:"dragging",side:e.side}),e.travel=d,e.prevX=e.lastX,e.prevTime=e.lastTime,e.lastX=t.clientX,e.lastTime=L(),H(a*e.inlineSign*W)},[H,s,_]),X=n.useCallback((t,e)=>{const r=k.current;if(r==null||r.pointerId!==t.pointerId||(k.current=null,r.claimed!==!0))return;I.current=L()+ye;try{s.current?.releasePointerCapture(t.pointerId)}catch{}const{side:c,inlineSign:a}=r,d=M(c)*a*r.panelWidth;if(e){o(c,0,"idle");return}const W=Math.max(1,r.lastTime-r.prevTime),B=M(c)*a*(r.lastX-r.prevX)/W>=Pe&&r.travel>=we;if(r.travel>=r.commitPx||B){K(c,a);return}if(R.current==="reveal"&&r.travel>=r.panelWidth*ge){o(c,d,"resting");return}o(c,0,"idle")},[s,o,K]),ce=n.useCallback(t=>X(t,!1),[X]),le=n.useCallback(t=>X(t,!0),[X]),D=n.useCallback(()=>L()<I.current,[]),ae=n.useCallback(t=>{!D()||t.target instanceof Element&&t.target.closest("[data-swipe-panel]")!=null||(I.current=0,t.preventDefault(),t.stopPropagation())},[D]),ue=n.useCallback(t=>{t.key==="Escape"&&h.current.phase==="resting"&&(t.stopPropagation(),j())},[j]);return{activateEntry:re,close:j,handlers:{onClickCapture:ae,onKeyDown:ue,onPointerCancel:le,onPointerDown:se,onPointerMove:ie,onPointerUp:ce},shouldSuppressClick:D,state:E}}const S={swipePanel:{kVAEAm:"x10l6tqk",k87sOh:"x13vifvy",krVfgx:"x1ey2m1c",kzqmXN:"xnalus7",k1xSpc:"x78zum5",kGNEyG:"x1qjc9v5",kB7OPa:"x9f619",kVQacm:"xb3r6kr",kaIpWk:"x1pjcqnp",k3aq6I:"x145au52",k1ekBW:"x13zkoj4",kIyJzY:"xxfakuu",kAMwcw:"xn34ekc",$$css:!0},swipePanelLeading:{kLqNvP:"x1o0tod",kjj79g:"x1nhvcw1",kzqmXN:"x96shys",$$css:!0},swipePanelTrailing:{kt4wiu:"xtijo5x",kjj79g:"x13a6bvl",kzqmXN:"x1qwjaml",$$css:!0},swipeEntry:{k1xSpc:"x78zum5",kXwgrk:"xdt5ytf",kGNEyG:"x6s0dn4",kjj79g:"xl56j7k",kOIVth:"xzye2dw",k7Eaqz:"x187xtus",kZKoxP:"x5yr21d",kg3NbH:"xrrkdod",kB7OPa:"x9f619",kogj98:"x1ghz6dp",kMzoRj:"xc342km",ksu8eU:"xng3xce",kysU6D:"xjyslct",kkrTdU:"x1ypdohk x16khyan",kMv6JI:"x9ynric",kGuDYH:"x141an7d",k63SB2:"x1e4wzip",kLWn49:"x1ltkj2j",khDVqt:"xuxw1ft",$$css:!0},swipeEntryDisabled:{kSiTet:"xbyyjgo",$$css:!0}},V={neutral:{kWkggS:"x17x4s8c",kMwMTN:"x1tgivj0",$$css:!0},accent:{kWkggS:"x1ewilqj",kMwMTN:"x17wrial",$$css:!0},destructive:{kWkggS:"x1pjz0fi",kMwMTN:"x1m024r3",$$css:!0}};function Te({rootRef:p,onBridge:P,leading:m,trailing:T,behavior:v}){const b=n.useRef(null),s=n.useRef(null),k=pe("(prefers-reduced-motion: reduce)"),C=i=>{const l=i==="leading"?m:T;return l[l.length-1]},w=Se({isEnabled:!0,behavior:v,sides:{leading:m.length>0,trailing:T.length>0},measurePanel:i=>(i==="leading"?b:s).current?.offsetWidth??0,fireOutermost:i=>{const l=C(i);return l==null||l.isDisabled===!0?!1:(l.onActivate(),l.hasRemoval===!0)},isReducedMotion:k,rootRef:p});n.useEffect(()=>(P({handlers:w.handlers,shouldSuppressClick:w.shouldSuppressClick}),()=>{P(null)}));const I=w.state.phase==="resting",f=(i,l)=>{if(l.length===0)return null;const E=l[l.length-1],g=v==="commit",h=I&&!g;return x.jsx("div",{"data-swipe-panel":i,inert:h?void 0:!0,"aria-hidden":g?!0:void 0,...$(q("item-swipe-panel",{side:i}),J(S.swipePanel,i==="leading"?S.swipePanelLeading:S.swipePanelTrailing,V[E.variant??"accent"])),children:x.jsx("div",{ref:i==="leading"?b:s,...{0:{className:"x78zum5 x2lah0s x5yr21d x10xzikg"},1:{className:"x78zum5 x2lah0s x5yr21d x10xzikg x15zctf7"}}[(i==="leading")<<0],children:l.map(u=>{const y=u.variant??"accent",O=x.jsxs(x.Fragment,{children:[u.icon,x.jsx("span",{children:u.label})]}),R=J(S.swipeEntry,V[y],u.isDisabled===!0&&S.swipeEntryDisabled);return g?x.jsx("span",{...$(q("item-swipe-action",{variant:y}),R),children:O},u.id??u.label):x.jsx("button",{type:"button",disabled:u.isDisabled===!0,onClick:()=>w.activateEntry(()=>(u.onActivate(),u.hasRemoval===!0)),...$(q("item-swipe-action",{variant:y}),me.focusVisible(S.swipeEntry,V[y],u.isDisabled===!0&&S.swipeEntryDisabled)),children:O},u.id??u.label)})})},i)};return x.jsxs(x.Fragment,{children:[f("leading",m),f("trailing",T)]})}Te.displayName="ItemSwipeLayer";export{Te as default};
|