django-admin-react 1.1.0__tar.gz → 1.3.0__tar.gz
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.
- {django_admin_react-1.1.0 → django_admin_react-1.3.0}/PKG-INFO +72 -29
- {django_admin_react-1.1.0 → django_admin_react-1.3.0}/README.md +71 -28
- {django_admin_react-1.1.0 → django_admin_react-1.3.0}/django_admin_react/conf.py +12 -0
- django_admin_react-1.3.0/django_admin_react/static/admin_react/.vite/manifest.json +33 -0
- django_admin_react-1.3.0/django_admin_react/static/admin_react/assets/ColumnLayoutModal-D4m6pUL5.js +5 -0
- django_admin_react-1.1.0/django_admin_react/static/admin_react/assets/JsonViewer-7Pvk14Q0.js → django_admin_react-1.3.0/django_admin_react/static/admin_react/assets/JsonViewer-CGUvMntK.js +1 -1
- django_admin_react-1.3.0/django_admin_react/static/admin_react/assets/index-Cb7PAxbs.js +8 -0
- django_admin_react-1.3.0/django_admin_react/static/admin_react/assets/index-CrqOF5FE.css +1 -0
- {django_admin_react-1.1.0 → django_admin_react-1.3.0}/django_admin_react/static/admin_react/index.html +2 -2
- django_admin_react-1.3.0/django_admin_react/templates/admin/base_site.html +37 -0
- django_admin_react-1.3.0/django_admin_react/templates/django_admin_react/_experience_toggle_strip.html +22 -0
- django_admin_react-1.3.0/django_admin_react/templatetags/__init__.py +0 -0
- django_admin_react-1.3.0/django_admin_react/templatetags/experience_toggle.py +82 -0
- {django_admin_react-1.1.0 → django_admin_react-1.3.0}/pyproject.toml +1 -1
- django_admin_react-1.1.0/django_admin_react/static/admin_react/.vite/manifest.json +0 -23
- django_admin_react-1.1.0/django_admin_react/static/admin_react/assets/index-BAk9ZaWt.js +0 -8
- django_admin_react-1.1.0/django_admin_react/static/admin_react/assets/index-CAPQqmPH.css +0 -1
- {django_admin_react-1.1.0 → django_admin_react-1.3.0}/LICENSE +0 -0
- {django_admin_react-1.1.0 → django_admin_react-1.3.0}/django_admin_react/README.md +0 -0
- {django_admin_react-1.1.0 → django_admin_react-1.3.0}/django_admin_react/__init__.py +0 -0
- {django_admin_react-1.1.0 → django_admin_react-1.3.0}/django_admin_react/apps.py +0 -0
- {django_admin_react-1.1.0 → django_admin_react-1.3.0}/django_admin_react/audit.py +0 -0
- {django_admin_react-1.1.0 → django_admin_react-1.3.0}/django_admin_react/pwa.py +0 -0
- {django_admin_react-1.1.0 → django_admin_react-1.3.0}/django_admin_react/templates/README.md +0 -0
- {django_admin_react-1.1.0 → django_admin_react-1.3.0}/django_admin_react/templates/admin_react/README.md +0 -0
- {django_admin_react-1.1.0 → django_admin_react-1.3.0}/django_admin_react/templates/admin_react/index.html +0 -0
- {django_admin_react-1.1.0 → django_admin_react-1.3.0}/django_admin_react/templates/admin_react/login.html +0 -0
- {django_admin_react-1.1.0 → django_admin_react-1.3.0}/django_admin_react/templates/admin_react/sw.js +0 -0
- {django_admin_react-1.1.0 → django_admin_react-1.3.0}/django_admin_react/urls.py +0 -0
- {django_admin_react-1.1.0 → django_admin_react-1.3.0}/django_admin_react/views.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: django-admin-react
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: A drop-in React single-page admin for Django, driven entirely by ModelAdmin.
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: django,admin,react,spa,tailwind
|
|
@@ -111,23 +111,38 @@ permissions at runtime from `GET /api/v1/registry/`. Add a new
|
|
|
111
111
|
|
|
112
112
|
Real captures of the **django-admin-react SPA** rendering the bundled
|
|
113
113
|
`examples/` apps — driven entirely by each app's `ModelAdmin`.
|
|
114
|
-
Captured **manually** against a local dev server (no Playwright / Cypress /
|
|
115
|
-
e2e tooling required).
|
|
116
114
|
|
|
117
|
-
|
|
118
|
-
| -------------------------------------------------- | ----------------------------------------------------- |
|
|
119
|
-
|  |  |
|
|
115
|
+
### Light + dark — your `ModelAdmin` decides the chrome, the theme is operator/user choice
|
|
120
116
|
|
|
121
|
-
| List view
|
|
122
|
-
|
|
|
123
|
-
|  |  |
|
|
124
120
|
|
|
125
|
-
|
|
|
126
|
-
|
|
|
127
|
-
|  |  |
|
|
128
124
|
|
|
129
|
-
|
|
130
|
-
|
|
125
|
+
| Detail view (dark) | Sign in (package login) |
|
|
126
|
+
| ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
127
|
+
|  |  |
|
|
128
|
+
|
|
129
|
+
### Phone-shaped (375 px) — `RecordCardList` fallback, full feature parity
|
|
130
|
+
|
|
131
|
+
| Mobile list (cards) | Mobile detail (stacked fieldsets) |
|
|
132
|
+
| ----------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
133
|
+
|  |  |
|
|
134
|
+
|
|
135
|
+
### One API, many surfaces
|
|
136
|
+
|
|
137
|
+
The SPA is one consumer of the wire format. The same JSON powers the
|
|
138
|
+
React app, the [MCP layer](https://pypi.org/project/django-admin-mcp-api/),
|
|
139
|
+
and any client you write:
|
|
140
|
+
|
|
141
|
+

|
|
142
|
+
|
|
143
|
+
Screenshots are captured deterministically against the
|
|
144
|
+
[`examples/`](./examples) apps' fixtures — no real names, emails,
|
|
145
|
+
account numbers, or PII.
|
|
131
146
|
|
|
132
147
|
---
|
|
133
148
|
|
|
@@ -298,30 +313,58 @@ urlpatterns = [
|
|
|
298
313
|
]
|
|
299
314
|
```
|
|
300
315
|
|
|
301
|
-
####
|
|
316
|
+
#### Experience-toggle strip (optional)
|
|
302
317
|
|
|
303
|
-
During the rollout, show
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
318
|
+
During the rollout, show a thin **persistent** strip at the top of
|
|
319
|
+
every page on **both** admins that links to the same page on the
|
|
320
|
+
other admin. Users can switch surfaces in one click, regardless of
|
|
321
|
+
which one they're on:
|
|
307
322
|
|
|
308
323
|
```python
|
|
309
324
|
# settings.py
|
|
310
325
|
DJANGO_ADMIN_REACT = {
|
|
311
|
-
"LEGACY_ADMIN_URL_PREFIX": "admin/",
|
|
326
|
+
"LEGACY_ADMIN_URL_PREFIX": "admin/", # the legacy admin's mount
|
|
327
|
+
"REACT_ADMIN_URL_PREFIX": "admin2/", # this package's mount
|
|
312
328
|
}
|
|
313
329
|
```
|
|
314
330
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
331
|
+
Both values must match the prefixes you used in `urls.py`. When set:
|
|
332
|
+
|
|
333
|
+
- The **React SPA** renders a strip linking the same path under the
|
|
334
|
+
legacy admin's mount (with `?query=string` preserved and a trailing
|
|
335
|
+
slash, since Django admin URLs require one).
|
|
336
|
+
- The **legacy Django admin** renders the mirror strip linking the
|
|
337
|
+
matching React URL.
|
|
338
|
+
|
|
339
|
+
Set `LEGACY_ADMIN_URL_PREFIX` alone if you only want the SPA → legacy
|
|
340
|
+
direction (reverse direction stays off).
|
|
341
|
+
|
|
342
|
+
##### `INSTALLED_APPS` ordering
|
|
343
|
+
|
|
344
|
+
For the legacy-side strip, list `django_admin_react` **before**
|
|
345
|
+
`django.contrib.admin`. Django's template loader resolves
|
|
346
|
+
`admin/base_site.html` left-to-right and the first match wins —
|
|
347
|
+
the package's override of that template injects the strip:
|
|
348
|
+
|
|
349
|
+
```python
|
|
350
|
+
INSTALLED_APPS = [
|
|
351
|
+
"django_admin_react", # ← BEFORE django.contrib.admin
|
|
352
|
+
"django.contrib.admin",
|
|
353
|
+
# ...
|
|
354
|
+
]
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
If you don't enable the legacy-side strip (`REACT_ADMIN_URL_PREFIX`
|
|
358
|
+
unset) the ordering doesn't matter — the override is a no-op for
|
|
359
|
+
consumers who haven't opted in.
|
|
360
|
+
|
|
361
|
+
##### UX contract
|
|
322
362
|
|
|
323
|
-
|
|
324
|
-
|
|
363
|
+
The strip is **subtle and persistent**: one line tall, neutral
|
|
364
|
+
chrome, no dismiss control. Operators turn it on/off via the
|
|
365
|
+
settings; end-users do not. When you remove the settings (or set
|
|
366
|
+
them to `None`), the strips disappear on the next page load —
|
|
367
|
+
completing the migration.
|
|
325
368
|
|
|
326
369
|
---
|
|
327
370
|
|
|
@@ -78,23 +78,38 @@ permissions at runtime from `GET /api/v1/registry/`. Add a new
|
|
|
78
78
|
|
|
79
79
|
Real captures of the **django-admin-react SPA** rendering the bundled
|
|
80
80
|
`examples/` apps — driven entirely by each app's `ModelAdmin`.
|
|
81
|
-
Captured **manually** against a local dev server (no Playwright / Cypress /
|
|
82
|
-
e2e tooling required).
|
|
83
81
|
|
|
84
|
-
|
|
85
|
-
| -------------------------------------------------- | ----------------------------------------------------- |
|
|
86
|
-
|  |  |
|
|
82
|
+
### Light + dark — your `ModelAdmin` decides the chrome, the theme is operator/user choice
|
|
87
83
|
|
|
88
|
-
| List view
|
|
89
|
-
|
|
|
90
|
-
|  |  |
|
|
91
87
|
|
|
92
|
-
|
|
|
93
|
-
|
|
|
94
|
-
|  |  |
|
|
95
91
|
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
| Detail view (dark) | Sign in (package login) |
|
|
93
|
+
| ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
94
|
+
|  |  |
|
|
95
|
+
|
|
96
|
+
### Phone-shaped (375 px) — `RecordCardList` fallback, full feature parity
|
|
97
|
+
|
|
98
|
+
| Mobile list (cards) | Mobile detail (stacked fieldsets) |
|
|
99
|
+
| ----------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
100
|
+
|  |  |
|
|
101
|
+
|
|
102
|
+
### One API, many surfaces
|
|
103
|
+
|
|
104
|
+
The SPA is one consumer of the wire format. The same JSON powers the
|
|
105
|
+
React app, the [MCP layer](https://pypi.org/project/django-admin-mcp-api/),
|
|
106
|
+
and any client you write:
|
|
107
|
+
|
|
108
|
+

|
|
109
|
+
|
|
110
|
+
Screenshots are captured deterministically against the
|
|
111
|
+
[`examples/`](./examples) apps' fixtures — no real names, emails,
|
|
112
|
+
account numbers, or PII.
|
|
98
113
|
|
|
99
114
|
---
|
|
100
115
|
|
|
@@ -265,30 +280,58 @@ urlpatterns = [
|
|
|
265
280
|
]
|
|
266
281
|
```
|
|
267
282
|
|
|
268
|
-
####
|
|
283
|
+
#### Experience-toggle strip (optional)
|
|
269
284
|
|
|
270
|
-
During the rollout, show
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
285
|
+
During the rollout, show a thin **persistent** strip at the top of
|
|
286
|
+
every page on **both** admins that links to the same page on the
|
|
287
|
+
other admin. Users can switch surfaces in one click, regardless of
|
|
288
|
+
which one they're on:
|
|
274
289
|
|
|
275
290
|
```python
|
|
276
291
|
# settings.py
|
|
277
292
|
DJANGO_ADMIN_REACT = {
|
|
278
|
-
"LEGACY_ADMIN_URL_PREFIX": "admin/",
|
|
293
|
+
"LEGACY_ADMIN_URL_PREFIX": "admin/", # the legacy admin's mount
|
|
294
|
+
"REACT_ADMIN_URL_PREFIX": "admin2/", # this package's mount
|
|
279
295
|
}
|
|
280
296
|
```
|
|
281
297
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
298
|
+
Both values must match the prefixes you used in `urls.py`. When set:
|
|
299
|
+
|
|
300
|
+
- The **React SPA** renders a strip linking the same path under the
|
|
301
|
+
legacy admin's mount (with `?query=string` preserved and a trailing
|
|
302
|
+
slash, since Django admin URLs require one).
|
|
303
|
+
- The **legacy Django admin** renders the mirror strip linking the
|
|
304
|
+
matching React URL.
|
|
305
|
+
|
|
306
|
+
Set `LEGACY_ADMIN_URL_PREFIX` alone if you only want the SPA → legacy
|
|
307
|
+
direction (reverse direction stays off).
|
|
308
|
+
|
|
309
|
+
##### `INSTALLED_APPS` ordering
|
|
310
|
+
|
|
311
|
+
For the legacy-side strip, list `django_admin_react` **before**
|
|
312
|
+
`django.contrib.admin`. Django's template loader resolves
|
|
313
|
+
`admin/base_site.html` left-to-right and the first match wins —
|
|
314
|
+
the package's override of that template injects the strip:
|
|
315
|
+
|
|
316
|
+
```python
|
|
317
|
+
INSTALLED_APPS = [
|
|
318
|
+
"django_admin_react", # ← BEFORE django.contrib.admin
|
|
319
|
+
"django.contrib.admin",
|
|
320
|
+
# ...
|
|
321
|
+
]
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
If you don't enable the legacy-side strip (`REACT_ADMIN_URL_PREFIX`
|
|
325
|
+
unset) the ordering doesn't matter — the override is a no-op for
|
|
326
|
+
consumers who haven't opted in.
|
|
327
|
+
|
|
328
|
+
##### UX contract
|
|
289
329
|
|
|
290
|
-
|
|
291
|
-
|
|
330
|
+
The strip is **subtle and persistent**: one line tall, neutral
|
|
331
|
+
chrome, no dismiss control. Operators turn it on/off via the
|
|
332
|
+
settings; end-users do not. When you remove the settings (or set
|
|
333
|
+
them to `None`), the strips disappear on the next page load —
|
|
334
|
+
completing the migration.
|
|
292
335
|
|
|
293
336
|
---
|
|
294
337
|
|
|
@@ -118,6 +118,17 @@ DEFAULTS: dict[str, Any] = {
|
|
|
118
118
|
# mapping). When the matching legacy route doesn't exist, the
|
|
119
119
|
# legacy admin 404s — same outcome as visiting that URL directly.
|
|
120
120
|
"LEGACY_ADMIN_URL_PREFIX": None,
|
|
121
|
+
# ``REACT_ADMIN_URL_PREFIX`` — sibling of ``LEGACY_ADMIN_URL_PREFIX``
|
|
122
|
+
# (#584). When **both** are set, the legacy Django admin renders a
|
|
123
|
+
# mirror strip at the top of every page linking the same path under
|
|
124
|
+
# the React admin's mount — so a user on either surface can swap
|
|
125
|
+
# to the other in one click. The value is the prefix the SPA was
|
|
126
|
+
# mounted at in ``urls.py`` — e.g. ``"admin2/"`` for
|
|
127
|
+
# ``urlpatterns = [path("admin2/", include("django_admin_react.urls")), ...]``.
|
|
128
|
+
# When only ``LEGACY_ADMIN_URL_PREFIX`` is set, only the SPA-side
|
|
129
|
+
# strip renders (reverse direction stays off — no implicit guess
|
|
130
|
+
# at the consumer's chosen mount).
|
|
131
|
+
"REACT_ADMIN_URL_PREFIX": None,
|
|
121
132
|
"PWA_NAME": None,
|
|
122
133
|
"PWA_SHORT_NAME": None,
|
|
123
134
|
"PWA_ICONS": None,
|
|
@@ -142,6 +153,7 @@ class _PackageSettings:
|
|
|
142
153
|
REACT_LOGIN: bool = DEFAULTS["REACT_LOGIN"]
|
|
143
154
|
API_URL_PREFIX: str | None = DEFAULTS["API_URL_PREFIX"]
|
|
144
155
|
LEGACY_ADMIN_URL_PREFIX: str | None = DEFAULTS["LEGACY_ADMIN_URL_PREFIX"]
|
|
156
|
+
REACT_ADMIN_URL_PREFIX: str | None = DEFAULTS["REACT_ADMIN_URL_PREFIX"]
|
|
145
157
|
PWA_NAME: str | None = DEFAULTS["PWA_NAME"]
|
|
146
158
|
PWA_SHORT_NAME: str | None = DEFAULTS["PWA_SHORT_NAME"]
|
|
147
159
|
PWA_ICONS: list[dict[str, str]] | None = DEFAULTS["PWA_ICONS"]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"../../packages/details/src/JsonViewer.tsx": {
|
|
3
|
+
"file": "assets/JsonViewer-CGUvMntK.js",
|
|
4
|
+
"name": "JsonViewer",
|
|
5
|
+
"src": "../../packages/details/src/JsonViewer.tsx",
|
|
6
|
+
"isDynamicEntry": true,
|
|
7
|
+
"imports": [
|
|
8
|
+
"index.html"
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
"index.html": {
|
|
12
|
+
"file": "assets/index-Cb7PAxbs.js",
|
|
13
|
+
"name": "index",
|
|
14
|
+
"src": "index.html",
|
|
15
|
+
"isEntry": true,
|
|
16
|
+
"dynamicImports": [
|
|
17
|
+
"../../packages/details/src/JsonViewer.tsx",
|
|
18
|
+
"src/ColumnLayoutModal.tsx"
|
|
19
|
+
],
|
|
20
|
+
"css": [
|
|
21
|
+
"assets/index-CrqOF5FE.css"
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
"src/ColumnLayoutModal.tsx": {
|
|
25
|
+
"file": "assets/ColumnLayoutModal-D4m6pUL5.js",
|
|
26
|
+
"name": "ColumnLayoutModal",
|
|
27
|
+
"src": "src/ColumnLayoutModal.tsx",
|
|
28
|
+
"isDynamicEntry": true,
|
|
29
|
+
"imports": [
|
|
30
|
+
"index.html"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
}
|
django_admin_react-1.3.0/django_admin_react/static/admin_react/assets/ColumnLayoutModal-D4m6pUL5.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{c as qt,b as c,R as P,r as Te,j as k,M as In,a as Gt}from"./index-Cb7PAxbs.js";const An=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Nn=qt("grip-vertical",An);const Tn=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],On=qt("lock",Tn);function kn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const tt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function we(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function bt(e){return"nodeType"in e}function B(e){var t,n;return e?we(e)?e:bt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function mt(e){const{Document:t}=B(e);return e instanceof t}function $e(e){return we(e)?!1:e instanceof B(e).HTMLElement}function _t(e){return e instanceof B(e).SVGElement}function xe(e){return e?we(e)?e.document:bt(e)?mt(e)?e:$e(e)||_t(e)?e.ownerDocument:document:document:document}const Z=tt?c.useLayoutEffect:c.useEffect;function yt(e){const t=c.useRef(e);return Z(()=>{t.current=e}),c.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Ln(){const e=c.useRef(null),t=c.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ze(e,t){t===void 0&&(t=[e]);const n=c.useRef(e);return Z(()=>{n.current!==e&&(n.current=e)},t),n}function Fe(e,t){const n=c.useRef();return c.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Je(e){const t=yt(e),n=c.useRef(null),r=c.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function ft(e){const t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}let ct={};function Xe(e,t){return c.useMemo(()=>{if(t)return t;const n=ct[e]==null?0:ct[e]+1;return ct[e]=n,e+"-"+n},[e,t])}function Jt(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,s)=>{const a=Object.entries(s);for(const[l,u]of a){const f=i[l];f!=null&&(i[l]=f+e*u)}return i},{...t})}}const ye=Jt(1),je=Jt(-1);function zn(e){return"clientX"in e&&"clientY"in e}function wt(e){if(!e)return!1;const{KeyboardEvent:t}=B(e.target);return t&&e instanceof t}function jn(e){if(!e)return!1;const{TouchEvent:t}=B(e.target);return t&&e instanceof t}function ht(e){if(jn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return zn(e)?{x:e.clientX,y:e.clientY}:null}const Pe=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Pe.Translate.toString(e),Pe.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Lt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Pn(e){return e.matches(Lt)?e:e.querySelector(Lt)}const Bn={display:"none"};function $n(e){let{id:t,value:n}=e;return P.createElement("div",{id:t,style:Bn},n)}function Fn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return P.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function Xn(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Qt=c.createContext(null);function Yn(e){const t=c.useContext(Qt);c.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Un(){const[e]=c.useState(()=>new Set),t=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const Wn={draggable:`
|
|
2
|
+
To pick up a draggable item, press the space bar.
|
|
3
|
+
While dragging, use the arrow keys to move the item.
|
|
4
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
5
|
+
`},Hn={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Vn(e){let{announcements:t=Hn,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Wn}=e;const{announce:i,announcement:s}=Xn(),a=Xe("DndLiveRegion"),[l,u]=c.useState(!1);if(c.useEffect(()=>{u(!0)},[]),Yn(c.useMemo(()=>({onDragStart(d){let{active:h}=d;i(t.onDragStart({active:h}))},onDragMove(d){let{active:h,over:g}=d;t.onDragMove&&i(t.onDragMove({active:h,over:g}))},onDragOver(d){let{active:h,over:g}=d;i(t.onDragOver({active:h,over:g}))},onDragEnd(d){let{active:h,over:g}=d;i(t.onDragEnd({active:h,over:g}))},onDragCancel(d){let{active:h,over:g}=d;i(t.onDragCancel({active:h,over:g}))}}),[i,t])),!l)return null;const f=P.createElement(P.Fragment,null,P.createElement($n,{id:r,value:o.draggable}),P.createElement(Fn,{id:a,announcement:s}));return n?Te.createPortal(f,n):f}var N;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(N||(N={}));function Qe(){}function zt(e,t){return c.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Kn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const q=Object.freeze({x:0,y:0});function Zt(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function en(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function qn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function jt(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function tn(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Pt(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Gn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Pt(t,t.left,t.top),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const u=Zt(Pt(l),o);i.push({id:a,data:{droppableContainer:s,value:u}})}}return i.sort(en)},_n=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=jt(t),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const u=jt(l),f=o.reduce((h,g,b)=>h+Zt(u[b],g),0),d=Number((f/4).toFixed(4));i.push({id:a,data:{droppableContainer:s,value:d}})}}return i.sort(en)};function Jn(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),s=o-r,a=i-n;if(r<o&&n<i){const l=t.width*t.height,u=e.width*e.height,f=s*a,d=f/(l+u-f);return Number(d.toFixed(4))}return 0}const Qn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:s}=i,a=n.get(s);if(a){const l=Jn(a,t);l>0&&o.push({id:s,data:{droppableContainer:i,value:l}})}}return o.sort(qn)};function Zn(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function nn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:q}function er(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((s,a)=>({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const tr=er(1);function nr(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function rr(e,t,n){const r=nr(t);if(!r)return e;const{scaleX:o,scaleY:i,x:s,y:a}=r,l=e.left-s-(1-o)*parseFloat(n),u=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),f=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:f,height:d,top:u,right:l+f,bottom:u+d,left:l}}const or={ignoreTransform:!1};function De(e,t){t===void 0&&(t=or);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:f}=B(e).getComputedStyle(e);u&&(n=rr(n,u,f))}const{top:r,left:o,width:i,height:s,bottom:a,right:l}=n;return{top:r,left:o,width:i,height:s,bottom:a,right:l}}function Bt(e){return De(e,{ignoreTransform:!0})}function ir(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function sr(e,t){return t===void 0&&(t=B(e).getComputedStyle(e)),t.position==="fixed"}function ar(e,t){t===void 0&&(t=B(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function nt(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(mt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!$e(o)||_t(o)||n.includes(o))return n;const i=B(e).getComputedStyle(o);return o!==e&&ar(o,i)&&n.push(o),sr(o,i)?n:r(o.parentNode)}return e?r(e):n}function rn(e){const[t]=nt(e,1);return t??null}function lt(e){return!tt||!e?null:we(e)?e:bt(e)?mt(e)||e===xe(e).scrollingElement?window:$e(e)?e:null:null}function on(e){return we(e)?e.scrollX:e.scrollLeft}function sn(e){return we(e)?e.scrollY:e.scrollTop}function gt(e){return{x:on(e),y:sn(e)}}var O;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(O||(O={}));function an(e){return!tt||!e?!1:e===document.scrollingElement}function cn(e){const t={x:0,y:0},n=an(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const cr={x:.2,y:.2};function lr(e,t,n,r,o){let{top:i,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=cr);const{isTop:u,isBottom:f,isLeft:d,isRight:h}=cn(e),g={x:0,y:0},b={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!u&&i<=t.top+v.height?(g.y=O.Backward,b.y=r*Math.abs((t.top+v.height-i)/v.height)):!f&&l>=t.bottom-v.height&&(g.y=O.Forward,b.y=r*Math.abs((t.bottom-v.height-l)/v.height)),!h&&a>=t.right-v.width?(g.x=O.Forward,b.x=r*Math.abs((t.right-v.width-a)/v.width)):!d&&s<=t.left+v.width&&(g.x=O.Backward,b.x=r*Math.abs((t.left+v.width-s)/v.width)),{direction:g,speed:b}}function ur(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:s}=window;return{top:0,left:0,right:i,bottom:s,width:i,height:s}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function ln(e){return e.reduce((t,n)=>ye(t,gt(n)),q)}function dr(e){return e.reduce((t,n)=>t+on(n),0)}function fr(e){return e.reduce((t,n)=>t+sn(n),0)}function hr(e,t){if(t===void 0&&(t=De),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);rn(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const gr=[["x",["left","right"],dr],["y",["top","bottom"],fr]];class xt{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=nt(n),o=ln(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,s,a]of gr)for(const l of s)Object.defineProperty(this,l,{get:()=>{const u=a(r),f=o[i]-u;return this.rect[l]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Oe{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function vr(e){const{EventTarget:t}=B(e);return e instanceof t?e:xe(e)}function ut(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var H;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(H||(H={}));function $t(e){e.preventDefault()}function pr(e){e.stopPropagation()}var y;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(y||(y={}));const un={start:[y.Space,y.Enter],cancel:[y.Esc],end:[y.Space,y.Enter,y.Tab]},br=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case y.Right:return{...n,x:n.x+25};case y.Left:return{...n,x:n.x-25};case y.Down:return{...n,y:n.y+25};case y.Up:return{...n,y:n.y-25}}};class Dt{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Oe(xe(n)),this.windowListeners=new Oe(B(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(H.Resize,this.handleCancel),this.windowListeners.add(H.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(H.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&hr(r),n(q)}handleKeyDown(t){if(wt(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=un,coordinateGetter:s=br,scrollBehavior:a="smooth"}=o,{code:l}=t;if(i.end.includes(l)){this.handleEnd(t);return}if(i.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,f=u?{x:u.left,y:u.top}:q;this.referenceCoordinates||(this.referenceCoordinates=f);const d=s(t,{active:n,context:r.current,currentCoordinates:f});if(d){const h=je(d,f),g={x:0,y:0},{scrollableAncestors:b}=r.current;for(const v of b){const p=t.code,{isTop:w,isRight:x,isLeft:m,isBottom:R,maxScroll:S,minScroll:E}=cn(v),D=ur(v),C={x:Math.min(p===y.Right?D.right-D.width/2:D.right,Math.max(p===y.Right?D.left:D.left+D.width/2,d.x)),y:Math.min(p===y.Down?D.bottom-D.height/2:D.bottom,Math.max(p===y.Down?D.top:D.top+D.height/2,d.y))},A=p===y.Right&&!x||p===y.Left&&!m,T=p===y.Down&&!R||p===y.Up&&!w;if(A&&C.x!==d.x){const I=v.scrollLeft+h.x,V=p===y.Right&&I<=S.x||p===y.Left&&I>=E.x;if(V&&!h.y){v.scrollTo({left:I,behavior:a});return}V?g.x=v.scrollLeft-I:g.x=p===y.Right?v.scrollLeft-S.x:v.scrollLeft-E.x,g.x&&v.scrollBy({left:-g.x,behavior:a});break}else if(T&&C.y!==d.y){const I=v.scrollTop+h.y,V=p===y.Down&&I<=S.y||p===y.Up&&I>=E.y;if(V&&!h.x){v.scrollTo({top:I,behavior:a});return}V?g.y=v.scrollTop-I:g.y=p===y.Down?v.scrollTop-S.y:v.scrollTop-E.y,g.y&&v.scrollBy({top:-g.y,behavior:a});break}}this.handleMove(t,ye(je(d,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Dt.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=un,onActivation:o}=t,{active:i}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function Ft(e){return!!(e&&"distance"in e)}function Xt(e){return!!(e&&"delay"in e)}class Ct{constructor(t,n,r){var o;r===void 0&&(r=vr(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:s}=i;this.props=t,this.events=n,this.document=xe(s),this.documentListeners=new Oe(this.document),this.listeners=new Oe(r),this.windowListeners=new Oe(B(s)),this.initialCoordinates=(o=ht(i))!=null?o:q,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(H.Resize,this.handleCancel),this.windowListeners.add(H.DragStart,$t),this.windowListeners.add(H.VisibilityChange,this.handleCancel),this.windowListeners.add(H.ContextMenu,$t),this.documentListeners.add(H.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Xt(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Ft(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(H.Click,pr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(H.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:s,options:{activationConstraint:a}}=i;if(!o)return;const l=(n=ht(t))!=null?n:q,u=je(o,l);if(!r&&a){if(Ft(a)){if(a.tolerance!=null&&ut(u,a.tolerance))return this.handleCancel();if(ut(u,a.distance))return this.handleStart()}if(Xt(a)&&ut(u,a.tolerance))return this.handleCancel();this.handlePending(a,u);return}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===y.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const mr={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Rt extends Ct{constructor(t){const{event:n}=t,r=xe(n.target);super(t,mr,r)}}Rt.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const yr={move:{name:"mousemove"},end:{name:"mouseup"}};var vt;(function(e){e[e.RightClick=2]="RightClick"})(vt||(vt={}));class wr extends Ct{constructor(t){super(t,yr,xe(t.event.target))}}wr.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===vt.RightClick?!1:(r?.({event:n}),!0)}}];const dt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class xr extends Ct{constructor(t){super(t,dt)}static setup(){return window.addEventListener(dt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(dt.move.name,t)};function t(){}}}xr.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var ke;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ke||(ke={}));var Ze;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ze||(Ze={}));function Dr(e){let{acceleration:t,activator:n=ke.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:s=5,order:a=Ze.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:f,delta:d,threshold:h}=e;const g=Rr({delta:d,disabled:!i}),[b,v]=Ln(),p=c.useRef({x:0,y:0}),w=c.useRef({x:0,y:0}),x=c.useMemo(()=>{switch(n){case ke.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case ke.DraggableRect:return o}},[n,o,l]),m=c.useRef(null),R=c.useCallback(()=>{const E=m.current;if(!E)return;const D=p.current.x*w.current.x,C=p.current.y*w.current.y;E.scrollBy(D,C)},[]),S=c.useMemo(()=>a===Ze.TreeOrder?[...u].reverse():u,[a,u]);c.useEffect(()=>{if(!i||!u.length||!x){v();return}for(const E of S){if(r?.(E)===!1)continue;const D=u.indexOf(E),C=f[D];if(!C)continue;const{direction:A,speed:T}=lr(E,C,x,t,h);for(const I of["x","y"])g[I][A[I]]||(T[I]=0,A[I]=0);if(T.x>0||T.y>0){v(),m.current=E,b(R,s),p.current=T,w.current=A;return}}p.current={x:0,y:0},w.current={x:0,y:0},v()},[t,R,r,v,i,s,JSON.stringify(x),JSON.stringify(g),b,u,S,f,JSON.stringify(h)])}const Cr={x:{[O.Backward]:!1,[O.Forward]:!1},y:{[O.Backward]:!1,[O.Forward]:!1}};function Rr(e){let{delta:t,disabled:n}=e;const r=ft(t);return Fe(o=>{if(n||!r||!o)return Cr;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[O.Backward]:o.x[O.Backward]||i.x===-1,[O.Forward]:o.x[O.Forward]||i.x===1},y:{[O.Backward]:o.y[O.Backward]||i.y===-1,[O.Forward]:o.y[O.Forward]||i.y===1}}},[n,t,r])}function Sr(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Fe(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function Er(e,t){return c.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...i]},[]),[e,t])}var Be;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Be||(Be={}));var pt;(function(e){e.Optimized="optimized"})(pt||(pt={}));const Yt=new Map;function Mr(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,s]=c.useState(null),{frequency:a,measure:l,strategy:u}=o,f=c.useRef(e),d=p(),h=ze(d),g=c.useCallback(function(w){w===void 0&&(w=[]),!h.current&&s(x=>x===null?w:x.concat(w.filter(m=>!x.includes(m))))},[h]),b=c.useRef(null),v=Fe(w=>{if(d&&!n)return Yt;if(!w||w===Yt||f.current!==e||i!=null){const x=new Map;for(let m of e){if(!m)continue;if(i&&i.length>0&&!i.includes(m.id)&&m.rect.current){x.set(m.id,m.rect.current);continue}const R=m.node.current,S=R?new xt(l(R),R):null;m.rect.current=S,S&&x.set(m.id,S)}return x}return w},[e,i,n,d,l]);return c.useEffect(()=>{f.current=e},[e]),c.useEffect(()=>{d||g()},[n,d]),c.useEffect(()=>{i&&i.length>0&&s(null)},[JSON.stringify(i)]),c.useEffect(()=>{d||typeof a!="number"||b.current!==null||(b.current=setTimeout(()=>{g(),b.current=null},a))},[a,d,g,...r]),{droppableRects:v,measureDroppableContainers:g,measuringScheduled:i!=null};function p(){switch(u){case Be.Always:return!1;case Be.BeforeDragging:return n;default:return!n}}}function dn(e,t){return Fe(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Ir(e,t){return dn(e,t)}function Ar(e){let{callback:t,disabled:n}=e;const r=yt(t),o=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return c.useEffect(()=>()=>o?.disconnect(),[o]),o}function rt(e){let{callback:t,disabled:n}=e;const r=yt(t),o=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return c.useEffect(()=>()=>o?.disconnect(),[o]),o}function Nr(e){return new xt(De(e),e)}function Ut(e,t,n){t===void 0&&(t=Nr);const[r,o]=c.useState(null);function i(){o(l=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const f=t(e);return JSON.stringify(l)===JSON.stringify(f)?l:f})}const s=Ar({callback(l){if(e)for(const u of l){const{type:f,target:d}=u;if(f==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),a=rt({callback:i});return Z(()=>{i(),e?(a?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[e]),r}function Tr(e){const t=dn(e);return nn(e,t)}const Wt=[];function Or(e){const t=c.useRef(e),n=Fe(r=>e?r&&r!==Wt&&e&&t.current&&e.parentNode===t.current.parentNode?r:nt(e):Wt,[e]);return c.useEffect(()=>{t.current=e},[e]),n}function kr(e){const[t,n]=c.useState(null),r=c.useRef(e),o=c.useCallback(i=>{const s=lt(i.target);s&&n(a=>a?(a.set(s,gt(s)),new Map(a)):null)},[]);return c.useEffect(()=>{const i=r.current;if(e!==i){s(i);const a=e.map(l=>{const u=lt(l);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,gt(u)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(i)};function s(a){a.forEach(l=>{const u=lt(l);u?.removeEventListener("scroll",o)})}},[o,e]),c.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,s)=>ye(i,s),q):ln(e):q,[e,t])}function Ht(e,t){t===void 0&&(t=[]);const n=c.useRef(null);return c.useEffect(()=>{n.current=null},t),c.useEffect(()=>{const r=e!==q;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?je(e,n.current):q}function Lr(e){c.useEffect(()=>{if(!tt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function zr(e,t){return c.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=s=>{i(s,t)},n},{}),[e,t])}function fn(e){return c.useMemo(()=>e?ir(e):null,[e])}const Vt=[];function jr(e,t){t===void 0&&(t=De);const[n]=e,r=fn(n?B(n):null),[o,i]=c.useState(Vt);function s(){i(()=>e.length?e.map(l=>an(l)?r:new xt(t(l),l)):Vt)}const a=rt({callback:s});return Z(()=>{a?.disconnect(),s(),e.forEach(l=>a?.observe(l))},[e]),o}function Pr(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return $e(t)?t:e}function Br(e){let{measure:t}=e;const[n,r]=c.useState(null),o=c.useCallback(u=>{for(const{target:f}of u)if($e(f)){r(d=>{const h=t(f);return d?{...d,width:h.width,height:h.height}:h});break}},[t]),i=rt({callback:o}),s=c.useCallback(u=>{const f=Pr(u);i?.disconnect(),f&&i?.observe(f),r(f?t(f):null)},[t,i]),[a,l]=Je(s);return c.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const $r=[{sensor:Rt,options:{}},{sensor:Dt,options:{}}],Fr={current:{}},_e={draggable:{measure:Bt},droppable:{measure:Bt,strategy:Be.WhileDragging,frequency:pt.Optimized},dragOverlay:{measure:De}};class Le extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Xr={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Le,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Qe},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:_e,measureDroppableContainers:Qe,windowRect:null,measuringScheduled:!1},Yr={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Qe,draggableNodes:new Map,over:null,measureDroppableContainers:Qe},ot=c.createContext(Yr),hn=c.createContext(Xr);function Ur(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Le}}}function Wr(e,t){switch(t.type){case N.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case N.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case N.DragEnd:case N.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case N.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Le(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case N.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new Le(e.droppable.containers);return s.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case N.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Le(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Hr(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=c.useContext(ot),i=ft(r),s=ft(n?.id);return c.useEffect(()=>{if(!t&&!r&&i&&s!=null){if(!wt(i)||document.activeElement===i.target)return;const a=o.get(s);if(!a)return;const{activatorNode:l,node:u}=a;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const f of[l.current,u.current]){if(!f)continue;const d=Pn(f);if(d){d.focus();break}}})}},[r,t,o,s,i]),null}function Vr(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function Kr(e){return c.useMemo(()=>({draggable:{..._e.draggable,...e?.draggable},droppable:{..._e.droppable,...e?.droppable},dragOverlay:{..._e.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function qr(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=c.useRef(!1),{x:s,y:a}=typeof o=="boolean"?{x:o,y:o}:o;Z(()=>{if(!s&&!a||!t){i.current=!1;return}if(i.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const f=n(u),d=nn(f,r);if(s||(d.x=0),a||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const h=rn(u);h&&h.scrollBy({top:d.y,left:d.x})}},[t,s,a,r,n])}const gn=c.createContext({...q,scaleX:1,scaleY:1});var de;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(de||(de={}));const Gr=c.memo(function(t){var n,r,o,i;let{id:s,accessibility:a,autoScroll:l=!0,children:u,sensors:f=$r,collisionDetection:d=Qn,measuring:h,modifiers:g,...b}=t;const v=c.useReducer(Wr,void 0,Ur),[p,w]=v,[x,m]=Un(),[R,S]=c.useState(de.Uninitialized),E=R===de.Initialized,{draggable:{active:D,nodes:C,translate:A},droppable:{containers:T}}=p,I=D!=null?C.get(D):null,V=c.useRef({initial:null,translated:null}),K=c.useMemo(()=>{var z;return D!=null?{id:D,data:(z=I?.data)!=null?z:Fr,rect:V}:null},[D,I]),G=c.useRef(null),[Ce,Ye]=c.useState(null),[$,Ue]=c.useState(null),ee=ze(b,Object.values(b)),Re=Xe("DndDescribedBy",s),We=c.useMemo(()=>T.getEnabled(),[T]),j=Kr(h),{droppableRects:te,measureDroppableContainers:fe,measuringScheduled:Se}=Mr(We,{dragging:E,dependencies:[A.x,A.y],config:j.droppable}),U=Sr(C,D),He=c.useMemo(()=>$?ht($):null,[$]),ie=Mn(),ne=Ir(U,j.draggable.measure);qr({activeNode:D!=null?C.get(D):null,config:ie.layoutShiftCompensation,initialRect:ne,measure:j.draggable.measure});const M=Ut(U,j.draggable.measure,ne),Ee=Ut(U?U.parentElement:null),_=c.useRef({activatorEvent:null,active:null,activeNode:U,collisionRect:null,collisions:null,droppableRects:te,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),he=T.getNodeFor((n=_.current.over)==null?void 0:n.id),re=Br({measure:j.dragOverlay.measure}),ge=(r=re.nodeRef.current)!=null?r:U,ve=E?(o=re.rect)!=null?o:M:null,Et=!!(re.nodeRef.current&&re.rect),Mt=Tr(Et?null:M),it=fn(ge?B(ge):null),se=Or(E?he??U:null),Ve=jr(se),Ke=Vr(g,{transform:{x:A.x-Mt.x,y:A.y-Mt.y,scaleX:1,scaleY:1},activatorEvent:$,active:K,activeNodeRect:M,containerNodeRect:Ee,draggingNodeRect:ve,over:_.current.over,overlayNodeRect:re.rect,scrollableAncestors:se,scrollableAncestorRects:Ve,windowRect:it}),It=He?ye(He,A):null,At=kr(se),wn=Ht(At),xn=Ht(At,[M]),pe=ye(Ke,wn),be=ve?tr(ve,Ke):null,Me=K&&be?d({active:K,collisionRect:be,droppableRects:te,droppableContainers:We,pointerCoordinates:It}):null,Nt=tn(Me,"id"),[ae,Tt]=c.useState(null),Dn=Et?Ke:ye(Ke,xn),Cn=Zn(Dn,(i=ae?.rect)!=null?i:null,M),st=c.useRef(null),Ot=c.useCallback((z,F)=>{let{sensor:X,options:ce}=F;if(G.current==null)return;const W=C.get(G.current);if(!W)return;const Y=z.nativeEvent,J=new X({active:G.current,activeNode:W,event:Y,options:ce,context:_,onAbort(L){if(!C.get(L))return;const{onDragAbort:Q}=ee.current,oe={id:L};Q?.(oe),x({type:"onDragAbort",event:oe})},onPending(L,le,Q,oe){if(!C.get(L))return;const{onDragPending:Ae}=ee.current,ue={id:L,constraint:le,initialCoordinates:Q,offset:oe};Ae?.(ue),x({type:"onDragPending",event:ue})},onStart(L){const le=G.current;if(le==null)return;const Q=C.get(le);if(!Q)return;const{onDragStart:oe}=ee.current,Ie={activatorEvent:Y,active:{id:le,data:Q.data,rect:V}};Te.unstable_batchedUpdates(()=>{oe?.(Ie),S(de.Initializing),w({type:N.DragStart,initialCoordinates:L,active:le}),x({type:"onDragStart",event:Ie}),Ye(st.current),Ue(Y)})},onMove(L){w({type:N.DragMove,coordinates:L})},onEnd:me(N.DragEnd),onCancel:me(N.DragCancel)});st.current=J;function me(L){return async function(){const{active:Q,collisions:oe,over:Ie,scrollAdjustedTranslate:Ae}=_.current;let ue=null;if(Q&&Ae){const{cancelDrop:Ne}=ee.current;ue={activatorEvent:Y,active:Q,collisions:oe,delta:Ae,over:Ie},L===N.DragEnd&&typeof Ne=="function"&&await Promise.resolve(Ne(ue))&&(L=N.DragCancel)}G.current=null,Te.unstable_batchedUpdates(()=>{w({type:L}),S(de.Uninitialized),Tt(null),Ye(null),Ue(null),st.current=null;const Ne=L===N.DragEnd?"onDragEnd":"onDragCancel";if(ue){const at=ee.current[Ne];at?.(ue),x({type:Ne,event:ue})}})}}},[C]),Rn=c.useCallback((z,F)=>(X,ce)=>{const W=X.nativeEvent,Y=C.get(ce);if(G.current!==null||!Y||W.dndKit||W.defaultPrevented)return;const J={active:Y};z(X,F.options,J)===!0&&(W.dndKit={capturedBy:F.sensor},G.current=ce,Ot(X,F))},[C,Ot]),kt=Er(f,Rn);Lr(f),Z(()=>{M&&R===de.Initializing&&S(de.Initialized)},[M,R]),c.useEffect(()=>{const{onDragMove:z}=ee.current,{active:F,activatorEvent:X,collisions:ce,over:W}=_.current;if(!F||!X)return;const Y={active:F,activatorEvent:X,collisions:ce,delta:{x:pe.x,y:pe.y},over:W};Te.unstable_batchedUpdates(()=>{z?.(Y),x({type:"onDragMove",event:Y})})},[pe.x,pe.y]),c.useEffect(()=>{const{active:z,activatorEvent:F,collisions:X,droppableContainers:ce,scrollAdjustedTranslate:W}=_.current;if(!z||G.current==null||!F||!W)return;const{onDragOver:Y}=ee.current,J=ce.get(Nt),me=J&&J.rect.current?{id:J.id,rect:J.rect.current,data:J.data,disabled:J.disabled}:null,L={active:z,activatorEvent:F,collisions:X,delta:{x:W.x,y:W.y},over:me};Te.unstable_batchedUpdates(()=>{Tt(me),Y?.(L),x({type:"onDragOver",event:L})})},[Nt]),Z(()=>{_.current={activatorEvent:$,active:K,activeNode:U,collisionRect:be,collisions:Me,droppableRects:te,draggableNodes:C,draggingNode:ge,draggingNodeRect:ve,droppableContainers:T,over:ae,scrollableAncestors:se,scrollAdjustedTranslate:pe},V.current={initial:ve,translated:be}},[K,U,Me,be,C,ge,ve,te,T,ae,se,pe]),Dr({...ie,delta:A,draggingRect:be,pointerCoordinates:It,scrollableAncestors:se,scrollableAncestorRects:Ve});const Sn=c.useMemo(()=>({active:K,activeNode:U,activeNodeRect:M,activatorEvent:$,collisions:Me,containerNodeRect:Ee,dragOverlay:re,draggableNodes:C,droppableContainers:T,droppableRects:te,over:ae,measureDroppableContainers:fe,scrollableAncestors:se,scrollableAncestorRects:Ve,measuringConfiguration:j,measuringScheduled:Se,windowRect:it}),[K,U,M,$,Me,Ee,re,C,T,te,ae,fe,se,Ve,j,Se,it]),En=c.useMemo(()=>({activatorEvent:$,activators:kt,active:K,activeNodeRect:M,ariaDescribedById:{draggable:Re},dispatch:w,draggableNodes:C,over:ae,measureDroppableContainers:fe}),[$,kt,K,M,w,Re,C,ae,fe]);return P.createElement(Qt.Provider,{value:m},P.createElement(ot.Provider,{value:En},P.createElement(hn.Provider,{value:Sn},P.createElement(gn.Provider,{value:Cn},u)),P.createElement(Hr,{disabled:a?.restoreFocus===!1})),P.createElement(Vn,{...a,hiddenTextDescribedById:Re}));function Mn(){const z=Ce?.autoScrollEnabled===!1,F=typeof l=="object"?l.enabled===!1:l===!1,X=E&&!z&&!F;return typeof l=="object"?{...l,enabled:X}:{enabled:X}}}),_r=c.createContext(null),Kt="button",Jr="Draggable";function Qr(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=Xe(Jr),{activators:s,activatorEvent:a,active:l,activeNodeRect:u,ariaDescribedById:f,draggableNodes:d,over:h}=c.useContext(ot),{role:g=Kt,roleDescription:b="draggable",tabIndex:v=0}=o??{},p=l?.id===t,w=c.useContext(p?gn:_r),[x,m]=Je(),[R,S]=Je(),E=zr(s,t),D=ze(n);Z(()=>(d.set(t,{id:t,key:i,node:x,activatorNode:R,data:D}),()=>{const A=d.get(t);A&&A.key===i&&d.delete(t)}),[d,t]);const C=c.useMemo(()=>({role:g,tabIndex:v,"aria-disabled":r,"aria-pressed":p&&g===Kt?!0:void 0,"aria-roledescription":b,"aria-describedby":f.draggable}),[r,g,v,p,b,f.draggable]);return{active:l,activatorEvent:a,activeNodeRect:u,attributes:C,isDragging:p,listeners:r?void 0:E,node:x,over:h,setNodeRef:m,setActivatorNodeRef:S,transform:w}}function Zr(){return c.useContext(hn)}const eo="Droppable",to={timeout:25};function no(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=Xe(eo),{active:s,dispatch:a,over:l,measureDroppableContainers:u}=c.useContext(ot),f=c.useRef({disabled:n}),d=c.useRef(!1),h=c.useRef(null),g=c.useRef(null),{disabled:b,updateMeasurementsFor:v,timeout:p}={...to,...o},w=ze(v??r),x=c.useCallback(()=>{if(!d.current){d.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{u(Array.isArray(w.current)?w.current:[w.current]),g.current=null},p)},[p]),m=rt({callback:x,disabled:b||!s}),R=c.useCallback((C,A)=>{m&&(A&&(m.unobserve(A),d.current=!1),C&&m.observe(C))},[m]),[S,E]=Je(R),D=ze(t);return c.useEffect(()=>{!m||!S.current||(m.disconnect(),d.current=!1,m.observe(S.current))},[S,m]),c.useEffect(()=>(a({type:N.RegisterDroppable,element:{id:r,key:i,disabled:n,node:S,rect:h,data:D}}),()=>a({type:N.UnregisterDroppable,key:i,id:r})),[r]),c.useEffect(()=>{n!==f.current.disabled&&(a({type:N.SetDroppableDisabled,id:r,key:i,disabled:n}),f.current.disabled=n)},[r,i,n,a]),{active:s,rect:h,isOver:l?.id===r,node:S,over:l,setNodeRef:E}}function St(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function ro(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function qe(e){return e!==null&&e>=0}function oo(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function io(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const vn=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=St(t,r,n),s=t[o],a=i[o];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},Ge={scaleX:1,scaleY:1},so=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:s}=e;const a=(t=i[n])!=null?t:r;if(!a)return null;if(o===n){const u=i[s];return u?{x:0,y:n<s?u.top+u.height-(a.top+a.height):u.top-a.top,...Ge}:null}const l=ao(i,o,n);return o>n&&o<=s?{x:0,y:-a.height-l,...Ge}:o<n&&o>=s?{x:0,y:a.height+l,...Ge}:{x:0,y:0,...Ge}};function ao(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const pn="Sortable",bn=P.createContext({activeIndex:-1,containerId:pn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:vn,disabled:{draggable:!1,droppable:!1}});function co(e){let{children:t,id:n,items:r,strategy:o=vn,disabled:i=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:u,measureDroppableContainers:f}=Zr(),d=Xe(pn,n),h=a.rect!==null,g=c.useMemo(()=>r.map(E=>typeof E=="object"&&"id"in E?E.id:E),[r]),b=s!=null,v=s?g.indexOf(s.id):-1,p=u?g.indexOf(u.id):-1,w=c.useRef(g),x=!oo(g,w.current),m=p!==-1&&v===-1||x,R=io(i);Z(()=>{x&&b&&f(g)},[x,g,b,f]),c.useEffect(()=>{w.current=g},[g]);const S=c.useMemo(()=>({activeIndex:v,containerId:d,disabled:R,disableTransforms:m,items:g,overIndex:p,useDragOverlay:h,sortedRects:ro(g,l),strategy:o}),[v,d,R.draggable,R.droppable,m,g,p,l,h,o]);return P.createElement(bn.Provider,{value:S},t)}const lo=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return St(n,r,o).indexOf(t)},uo=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:s,previousItems:a,previousContainerId:l,transition:u}=e;return!u||!r||a!==i&&o===s?!1:n?!0:s!==o&&t===l},fo={duration:200,easing:"ease"},mn="transform",ho=Pe.Transition.toString({property:mn,duration:0,easing:"linear"}),go={roleDescription:"sortable"};function vo(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,s]=c.useState(null),a=c.useRef(n);return Z(()=>{if(!t&&n!==a.current&&r.current){const l=o.current;if(l){const u=De(r.current,{ignoreTransform:!0}),f={x:l.left-u.left,y:l.top-u.top,scaleX:l.width/u.width,scaleY:l.height/u.height};(f.x||f.y)&&s(f)}}n!==a.current&&(a.current=n)},[t,n,r,o]),c.useEffect(()=>{i&&s(null)},[i]),i}function po(e){let{animateLayoutChanges:t=uo,attributes:n,disabled:r,data:o,getNewIndex:i=lo,id:s,strategy:a,resizeObserverConfig:l,transition:u=fo}=e;const{items:f,containerId:d,activeIndex:h,disabled:g,disableTransforms:b,sortedRects:v,overIndex:p,useDragOverlay:w,strategy:x}=c.useContext(bn),m=bo(r,g),R=f.indexOf(s),S=c.useMemo(()=>({sortable:{containerId:d,index:R,items:f},...o}),[d,o,R,f]),E=c.useMemo(()=>f.slice(f.indexOf(s)),[f,s]),{rect:D,node:C,isOver:A,setNodeRef:T}=no({id:s,data:S,disabled:m.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...l}}),{active:I,activatorEvent:V,activeNodeRect:K,attributes:G,setNodeRef:Ce,listeners:Ye,isDragging:$,over:Ue,setActivatorNodeRef:ee,transform:Re}=Qr({id:s,data:S,attributes:{...go,...n},disabled:m.draggable}),We=kn(T,Ce),j=!!I,te=j&&!b&&qe(h)&&qe(p),fe=!w&&$,Se=fe&&te?Re:null,He=te?Se??(a??x)({rects:v,activeNodeRect:K,activeIndex:h,overIndex:p,index:R}):null,ie=qe(h)&&qe(p)?i({id:s,items:f,activeIndex:h,overIndex:p}):R,ne=I?.id,M=c.useRef({activeId:ne,items:f,newIndex:ie,containerId:d}),Ee=f!==M.current.items,_=t({active:I,containerId:d,isDragging:$,isSorting:j,id:s,index:R,items:f,newIndex:M.current.newIndex,previousItems:M.current.items,previousContainerId:M.current.containerId,transition:u,wasDragging:M.current.activeId!=null}),he=vo({disabled:!_,index:R,node:C,rect:D});return c.useEffect(()=>{j&&M.current.newIndex!==ie&&(M.current.newIndex=ie),d!==M.current.containerId&&(M.current.containerId=d),f!==M.current.items&&(M.current.items=f)},[j,ie,d,f]),c.useEffect(()=>{if(ne===M.current.activeId)return;if(ne&&!M.current.activeId){M.current.activeId=ne;return}const ge=setTimeout(()=>{M.current.activeId=ne},50);return()=>clearTimeout(ge)},[ne]),{active:I,activeIndex:h,attributes:G,data:S,rect:D,index:R,newIndex:ie,items:f,isOver:A,isSorting:j,isDragging:$,listeners:Ye,node:C,overIndex:p,over:Ue,setNodeRef:We,setActivatorNodeRef:ee,setDroppableNodeRef:T,setDraggableNodeRef:Ce,transform:he??He,transition:re()};function re(){if(he||Ee&&M.current.newIndex===R)return ho;if(!(fe&&!wt(V)||!u)&&(j||_))return Pe.Transition.toString({...u,property:mn})}}function bo(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function et(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const mo=[y.Down,y.Right,y.Up,y.Left],yo=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:s,scrollableAncestors:a}}=t;if(mo.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const h=o.get(d.id);if(h)switch(e.code){case y.Down:r.top<h.top&&l.push(d);break;case y.Up:r.top>h.top&&l.push(d);break;case y.Left:r.left>h.left&&l.push(d);break;case y.Right:r.left<h.left&&l.push(d);break}});const u=_n({collisionRect:r,droppableRects:o,droppableContainers:l});let f=tn(u,"id");if(f===s?.id&&u.length>1&&(f=u[1].id),f!=null){const d=i.get(n.id),h=i.get(f),g=h?o.get(h.id):null,b=h?.node.current;if(b&&g&&d&&h){const p=nt(b).some((E,D)=>a[D]!==E),w=yn(d,h),x=wo(d,h),m=p||!w?{x:0,y:0}:{x:x?r.width-g.width:0,y:x?r.height-g.height:0},R={x:g.left,y:g.top};return m.x&&m.y?R:je(R,m)}}}};function yn(e,t){return!et(e)||!et(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function wo(e,t){return!et(e)||!et(t)||!yn(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Ro({onClose:e,orderedDescriptors:t,isPk:n,hiddenCols:r,visibleColumnCount:o,onToggle:i,onReorder:s}){const a=Kn(zt(Rt,{activationConstraint:{distance:4}}),zt(Dt,{coordinateGetter:yo})),l=t.find(h=>n(h.name)),u=t.filter(h=>!n(h.name)),f=u.map(h=>h.name);function d(h){const{active:g,over:b}=h;if(!b||g.id===b.id)return;const v=f.indexOf(String(g.id)),p=f.indexOf(String(b.id));v===-1||p===-1||s(St(f,v,p))}return k.jsxs(In,{title:"Layout",onClose:e,children:[k.jsx("p",{className:"mb-2 text-xs text-gray-500",children:"Toggle to show or hide. Drag the handle to reorder (keyboard: Tab to a handle, then Space + arrow keys + Space to drop)."}),k.jsxs("ul",{className:"space-y-1",children:[l?k.jsx(xo,{label:l.label,tooltip:"The primary-key column always shows first."}):null,k.jsx(Gr,{sensors:a,collisionDetection:Gn,onDragEnd:d,children:k.jsx(co,{items:f,strategy:so,children:u.map(h=>{const g=!r.has(h.name),b=g&&o<=1;return k.jsx(Do,{id:h.name,label:h.label,visible:g,disabled:b,onToggle:()=>i(h.name,o)},h.name)})})})]})]})}function xo({label:e,tooltip:t}){return k.jsxs("li",{className:"flex items-center gap-2 rounded border border-transparent bg-gray-50 px-1 py-1","aria-label":`${e} (locked first)`,children:[k.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center text-gray-400",title:t,children:k.jsx(On,{className:"h-3.5 w-3.5","aria-hidden":!0})}),k.jsxs("label",{className:"flex flex-1 items-center gap-2 text-sm text-gray-500",children:[k.jsx(Gt,{checked:!0,disabled:!0,onChange:()=>{}}),k.jsx("span",{title:t,children:e})]})]})}function Do({id:e,label:t,visible:n,disabled:r,onToggle:o}){const{attributes:i,listeners:s,setNodeRef:a,setActivatorNodeRef:l,transform:u,transition:f,isDragging:d}=po({id:e}),h={transform:Pe.Transform.toString(u),transition:f};return k.jsxs("li",{ref:a,style:h,className:["flex items-center gap-2 rounded border px-1 py-1",d?"z-10 border-blue-300 bg-white shadow-lg":"border-transparent hover:border-gray-200"].join(" "),children:[k.jsx("button",{ref:l,type:"button","aria-label":`Reorder ${t}`,title:`Drag to reorder ${t}`,className:"cursor-grab touch-none rounded p-0.5 text-gray-400 hover:bg-gray-100 hover:text-gray-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 active:cursor-grabbing",...i,...s,children:k.jsx(Nn,{className:"h-4 w-4 shrink-0","aria-hidden":!0})}),k.jsxs("label",{className:`flex flex-1 items-center gap-2 text-sm ${r?"text-gray-400":"text-gray-800"}`,children:[k.jsx(Gt,{checked:n,disabled:r,onChange:o}),t]})]})}export{Ro as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as x,
|
|
1
|
+
import{c as x,b as l,j as e,C as h}from"./index-Cb7PAxbs.js";const p=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],g=x("chevron-right",p);const y=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],j=x("copy",y);function N({raw:t,parsed:r}){const[s,c]=l.useState(!1);async function a(){try{await navigator.clipboard.writeText(t),c(!0),setTimeout(()=>c(!1),2e3)}catch{}}return e.jsxs("div",{className:"relative w-full overflow-x-auto rounded border border-gray-200 bg-gray-50 p-3 font-mono text-xs leading-relaxed text-gray-800 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200",children:[e.jsx("button",{type:"button",onClick:a,"aria-label":"Copy JSON",title:s?"Copied":"Copy",className:"absolute right-2 top-2 inline-flex h-6 w-6 items-center justify-center rounded border border-gray-300 bg-white text-gray-600 hover:bg-gray-100 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700",children:s?e.jsx(h,{className:"h-3.5 w-3.5 text-green-600","aria-hidden":!0}):e.jsx(j,{className:"h-3.5 w-3.5","aria-hidden":!0})}),e.jsx(o,{value:r,depth:0})]})}function o({value:t,depth:r}){return t===null?e.jsx("span",{className:"text-purple-600 dark:text-purple-400",children:"null"}):typeof t=="boolean"?e.jsx("span",{className:"text-purple-600 dark:text-purple-400",children:t?"true":"false"}):typeof t=="number"?e.jsx("span",{className:"text-blue-700",children:String(t)}):typeof t=="string"?e.jsxs("span",{className:"text-green-700 dark:text-green-400",children:['"',t,'"']}):Array.isArray(t)?e.jsx(u,{value:t,depth:r}):typeof t=="object"?e.jsx(m,{value:t,depth:r}):e.jsx("span",{className:"text-gray-500",children:String(t)})}function m({value:t,depth:r}){const s=Object.keys(t),[c,a]=l.useState(r<2);return s.length===0?e.jsx("span",{className:"text-gray-500",children:"{}"}):e.jsx(d,{open:c,onToggle:()=>a(n=>!n),collapsedLabel:`{…} ${s.length} ${s.length===1?"key":"keys"}`,openBracket:"{",closeBracket:"}",depth:r,children:s.map((n,i)=>e.jsxs("div",{className:"pl-4",children:[e.jsxs("span",{className:"text-rose-700 dark:text-rose-400",children:['"',n,'"']}),e.jsx("span",{className:"text-gray-500",children:": "}),e.jsx(o,{value:t[n],depth:r+1}),i<s.length-1?e.jsx("span",{className:"text-gray-500",children:","}):null]},n))})}function u({value:t,depth:r}){const[s,c]=l.useState(r<2);return t.length===0?e.jsx("span",{className:"text-gray-500",children:"[]"}):e.jsx(d,{open:s,onToggle:()=>c(a=>!a),collapsedLabel:`[…] ${t.length} ${t.length===1?"item":"items"}`,openBracket:"[",closeBracket:"]",depth:r,children:t.map((a,n)=>e.jsxs("div",{className:"pl-4",children:[e.jsx(o,{value:a,depth:r+1}),n<t.length-1?e.jsx("span",{className:"text-gray-500",children:","}):null]},n))})}function d({open:t,onToggle:r,collapsedLabel:s,openBracket:c,closeBracket:a,depth:n,children:i}){return e.jsxs("span",{children:[e.jsx("button",{type:"button",onClick:r,"aria-expanded":t,className:"inline-flex items-center align-baseline text-gray-500 hover:text-gray-800 dark:hover:text-gray-200",children:e.jsx(g,{className:`h-3 w-3 shrink-0 transition-transform ${t?"rotate-90":""}`,"aria-hidden":!0})}),e.jsx("span",{className:"text-gray-500",children:c}),t?e.jsxs(e.Fragment,{children:[i,e.jsx("div",{className:n===0?"":"pl-0",children:e.jsx("span",{className:"text-gray-500",children:a})})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"px-1 text-gray-500",children:s}),e.jsx("span",{className:"text-gray-500",children:a})]})]})}export{N as default};
|