diff --git a/README.md b/README.md index 6242ac8..a10f42b 100644 --- a/README.md +++ b/README.md @@ -255,6 +255,38 @@ sweeps its existing projects into a `default` org that all existing accounts join, so nothing breaks. Public share links stay outside the wall on purpose. +Inside an org, each project carries its own **permissions** — four ordered +levels, edited under Project settings → People: + +| Level | Can | +|---|---| +| `none` | nothing: the project is hidden — absent from the project list, every route denied | +| `read` | browse, view, download, history, read heat — and **pull**, so a device stays current | +| `write` | + upload, sync push, and minting/revoking share links | +| `admin` | + rename, delete, and edit this project's permissions | + +The default is `write` for every org member, which is exactly the old +behavior — an upgraded hub changes nothing until someone edits +permissions. Setting the **default** to `No access` makes a project +invite-only: only explicit grants get in. Whoever creates a project becomes +its first admin, and **org owners are implicitly admin on every project in +their org**, so nobody can lock them out. Grants are org members only, and +a project always keeps at least one admin. + +Two things follow on the **device** side, because a refusal is not the same +as being offline (see `bdrive status`): + +- **read-only** — pushes are refused, so the daemon goes **pull-only**. Your + local edits stay journaled on the device, never pushed and never lost; + they go out if you're granted `write` again. +- **no access** — pulls are refused too, so sync **pauses**. Nothing is + pulled, pushed, or written: revoking access never deletes or reverts a + file on someone's disk. Re-granting resumes on the next tick. + +Public `/s/` share links are **unaffected** by any of this: they are +anonymous by design and keep serving until revoked, so cutting someone's +access does not kill links they already minted. + ```sh # On the server device (knows the storage) bdrive web -c config.json @@ -289,7 +321,8 @@ blob uploads go direct to the object store via the same short-lived presigned URLs browser uploads use (falling back to relaying when the backend can't presign). Client pushes and project creation require the server to run with `--upload`; against a read-only hub, clients still pull -and their pushes wait (offline semantics) until allowed. +and `bdrive status` reports `access: read-only (pull only)` rather than +pretending to be offline. ### Sharing files by URL diff --git a/architecture/cli-sync.md b/architecture/cli-sync.md index 57f4f52..2803780 100644 --- a/architecture/cli-sync.md +++ b/architecture/cli-sync.md @@ -28,7 +28,9 @@ classDiagram +LocalOps +PulledOps +Conflicts +Materialized +Pushed +Offline +OfflineErr + +ReadOnly +NoAccess +AccessErr } + note for Result "Offline / ReadOnly / NoAccess are three different answers: unreachable (retry all), push refused (pull-only), pull refused (pause, touch nothing)" class Filter { +Skip(rel) bool @@ -59,8 +61,9 @@ classDiagram class Backend { <> +Put +Get +List +Exists +Close + +ErrForbidden sentinel } - note for Backend "internal/remote — client devices use the https:// hub backend (token from BDRIVE_TOKEN / settings.json)" + note for Backend "internal/remote — client devices use the https:// hub backend (token from BDRIVE_TOKEN / settings.json); a hub 403 wraps ErrForbidden, which is what Result turns into ReadOnly/NoAccess instead of Offline" class daemon { +Run(folder, scan, remote) diff --git a/architecture/webapp-server.md b/architecture/webapp-server.md index 59302d6..b0e74e8 100644 --- a/architecture/webapp-server.md +++ b/architecture/webapp-server.md @@ -121,11 +121,26 @@ classDiagram -repo ProjectRepo -byID +Get +Create +Update +Rename +List + +SetCreator +SetDefault + +SetPerm +ClearPerm } class Project { +ID +Name +Org +Created +Description +Icon + +Creator string + +Default string + +Perms map email→level } + note for Project "Default == \"\" means write — the historical behavior, so an upgraded hub needs no migration. SetPerm/ClearPerm refuse to drop the last explicit admin." + + class projectPerm { + <> + org owner → admin + explicit grant → that level + org member → project Default + otherwise → none + } + note for projectPerm "perms.go — the single authorization ladder. proj(level, h) in server.go is the one choke point: every per-project route declares its level at registration." class ShareDB { -repo ShareRepo @@ -198,6 +213,9 @@ classDiagram BuiltinAuth ..> OrgDB : InviteValid wiring ProjectDB ..> Project + Server *-- projectPerm : gates every per-project route + projectPerm ..> Project : Perms + Default + projectPerm ..> Directory : org role ShareDB ..> Share DeviceRegistry ..> DeviceInfo ReadLedger ..> ReadStat @@ -257,7 +275,9 @@ classDiagram class sqlMetaStore { one database/sql impl sqlite (modernc) or postgres (pgx) + +addColumns() idempotent ALTER } + note for sqlMetaStore "ProjectRepo.Put is transactional over projects + project_perms (same shape as orgs + org_members); addColumns probes the live column set so a running hub gains projects.creator / default_level on restart." MetaStore <|.. fileMetaStore MetaStore <|.. sqlMetaStore diff --git a/cmd/bdrive/cmds.go b/cmd/bdrive/cmds.go index 90716c6..40d7161 100644 --- a/cmd/bdrive/cmds.go +++ b/cmd/bdrive/cmds.go @@ -9,6 +9,7 @@ import ( "github.com/runbear-io/beardrive/internal/config" "github.com/runbear-io/beardrive/internal/daemon" "github.com/runbear-io/beardrive/internal/journal" + "github.com/runbear-io/beardrive/internal/store" "github.com/runbear-io/beardrive/internal/syncer" ) @@ -167,6 +168,12 @@ func statusCmd() *cobra.Command { pending = 0 } fmt.Printf(" pending: %d local change(s) not yet pushed\n", pending) + switch st.Access { + case store.AccessReadOnly: + fmt.Printf(" access: read-only (pull only) — %d local change(s) stay on this device\n", pending) + case store.AccessNone: + fmt.Printf(" access: no access to this project — sync paused\n") + } } } return nil diff --git a/cmd/bdrive/helpers.go b/cmd/bdrive/helpers.go index 704fbb2..59bd85b 100644 --- a/cmd/bdrive/helpers.go +++ b/cmd/bdrive/helpers.go @@ -124,6 +124,10 @@ func printCycle(res *syncer.Result) { } fmt.Printf(" files updated: %d\n", res.Materialized) switch { + case res.NoAccess: + fmt.Printf(" remote: no access — sync paused (ask a project admin for access)\n") + case res.ReadOnly: + fmt.Printf(" remote: read-only (pull only) — local changes stay on this device\n") case res.Offline: fmt.Printf(" remote: offline (%v)\n", res.OfflineErr) case res.Pushed: diff --git a/internal/daemon/daemon.go b/internal/daemon/daemon.go index e09397d..9956e83 100644 --- a/internal/daemon/daemon.go +++ b/internal/daemon/daemon.go @@ -145,6 +145,9 @@ func Run(folder string, scanInterval, remoteInterval time.Duration) error { }() var lastRemote time.Time var lastToken string + // Which access state we last logged, so a degraded daemon says it once + // instead of on every tick. + lastAccess := store.AccessOK for { // Re-read the project config each tick: picks up `bdrive remote set` @@ -216,6 +219,21 @@ func Run(folder string, scanInterval, remoteInterval time.Duration) error { return nil case err != nil: log.Printf("cycle error: %v", err) + case res.NoAccess: + // The connection is fine, the answer isn't: keep the backend and + // keep ticking cheaply so a re-grant self-heals. Log the + // transition only — a paused daemon must stay quiet. + if lastAccess != store.AccessNone { + log.Printf("access revoked for this project; sync paused (%v)", res.AccessErr) + lastAccess = store.AccessNone + } + lastRemote = time.Now() + case res.ReadOnly: + if lastAccess != store.AccessReadOnly { + log.Printf("read-only on this project, pulling only; local changes stay on this device") + lastAccess = store.AccessReadOnly + } + lastRemote = time.Now() case res.Offline: log.Printf("offline, will retry: %v", res.OfflineErr) if be != nil { @@ -224,6 +242,10 @@ func Run(folder string, scanInterval, remoteInterval time.Duration) error { } lastRemote = time.Now() default: + if lastAccess != store.AccessOK { + log.Printf("access restored; syncing normally") + lastAccess = store.AccessOK + } if res.Activity() { log.Printf("local+%d pulled+%d conflicts=%d files~%d pushed=%v", res.LocalOps, res.PulledOps, res.Conflicts, res.Materialized, res.Pushed) diff --git a/internal/remote/http.go b/internal/remote/http.go index 9504598..666db06 100644 --- a/internal/remote/http.go +++ b/internal/remote/http.go @@ -89,10 +89,16 @@ func (b *httpBackend) endpoint(name string, q url.Values) string { } // httpError turns a non-2xx response into an error carrying the server's -// message. +// message. A 403 additionally wraps ErrForbidden: only the hub's own +// endpoints go through here, so that status is always an authorization +// answer, never a storage hiccup. func httpError(resp *http.Response) error { msg, _ := io.ReadAll(io.LimitReader(resp.Body, 512)) - return fmt.Errorf("server: %s: %s", resp.Status, strings.TrimSpace(string(msg))) + err := fmt.Errorf("server: %s: %s", resp.Status, strings.TrimSpace(string(msg))) + if resp.StatusCode == http.StatusForbidden { + return fmt.Errorf("%w: %w", ErrForbidden, err) + } + return err } func (b *httpBackend) List(ctx context.Context, prefix string) ([]Object, error) { @@ -225,7 +231,12 @@ func (b *httpBackend) putDirect(ctx context.Context, plan putPlan, r io.Reader, } defer resp.Body.Close() if resp.StatusCode < 200 || resp.StatusCode >= 300 { - return fmt.Errorf("direct upload: %w", httpError(resp)) + // Deliberately not httpError: this response comes from the object + // store, not the hub, and its 403 means an expired presigned URL — + // mapping it to ErrForbidden would park the device in permanent + // read-only over a transient signing problem. + msg, _ := io.ReadAll(io.LimitReader(resp.Body, 512)) + return fmt.Errorf("direct upload: %s: %s", resp.Status, strings.TrimSpace(string(msg))) } return nil } diff --git a/internal/remote/http_test.go b/internal/remote/http_test.go new file mode 100644 index 0000000..ed8140e --- /dev/null +++ b/internal/remote/http_test.go @@ -0,0 +1,86 @@ +package remote + +import ( + "bytes" + "context" + "errors" + "net/http" + "net/http/httptest" + "strings" + "testing" +) + +// Every hub endpoint must turn a 403 into ErrForbidden: that sentinel is what +// tells the syncer "you were refused" rather than "the network is down", and a +// miss on any one call would put that path back into a silent forever-retry. +func TestHubForbiddenIsSentinel(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + http.Error(w, "you have read-only access to this project", http.StatusForbidden) + })) + defer ts.Close() + + be, err := Open(context.Background(), ts.URL+"/p/p-0123abcd") + if err != nil { + t.Fatal(err) + } + defer be.Close() + ctx := context.Background() + + calls := map[string]func() error{ + "List": func() error { _, err := be.List(ctx, "journal/"); return err }, + "Get": func() error { _, err := be.Get(ctx, "journal/d.jsonl"); return err }, + "Exists": func() error { _, err := be.Exists(ctx, "journal/d.jsonl"); return err }, + "Put": func() error { return be.Put(ctx, "blobs/abc", strings.NewReader("hi"), 2) }, + } + for name, call := range calls { + err := call() + if err == nil { + t.Errorf("%s: no error on 403", name) + continue + } + if !errors.Is(err, ErrForbidden) { + t.Errorf("%s: %v does not wrap ErrForbidden", name, err) + } + if !strings.Contains(err.Error(), "read-only") { + t.Errorf("%s: the server's message is lost: %v", name, err) + } + } + if rr, ok := be.(ReadReporter); ok { + if err := rr.ReportReads(ctx, []ReadEvent{{Path: "a.md"}}); !errors.Is(err, ErrForbidden) { + t.Errorf("ReportReads: %v does not wrap ErrForbidden", err) + } + } +} + +// A 403 relayed from the object store is an expired presigned URL, not an +// authorization answer. Mapping it would park a healthy device in permanent +// read-only over a transient signing problem. +func TestPresignedForbiddenIsNotAuthz(t *testing.T) { + storage := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + http.Error(w, "AccessDenied", http.StatusForbidden) + })) + defer storage.Close() + + hub := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if !strings.HasSuffix(r.URL.Path, "/store/sign") { + http.Error(w, "unexpected", http.StatusNotFound) + return + } + w.Header().Set("Content-Type", "application/json") + w.Write([]byte(`{"mode":"direct","exists":false,"url":"` + storage.URL + `/blob","method":"PUT"}`)) + })) + defer hub.Close() + + be, err := Open(context.Background(), hub.URL+"/p/p-0123abcd") + if err != nil { + t.Fatal(err) + } + defer be.Close() + err = be.Put(context.Background(), "blobs/abc", bytes.NewReader([]byte("hi")), 2) + if err == nil { + t.Fatal("direct upload to a 403 target should fail") + } + if errors.Is(err, ErrForbidden) { + t.Fatalf("a presigned-target 403 must not be ErrForbidden: %v", err) + } +} diff --git a/internal/remote/remote.go b/internal/remote/remote.go index 59d44d2..36ccc5e 100644 --- a/internal/remote/remote.go +++ b/internal/remote/remote.go @@ -15,6 +15,7 @@ package remote import ( "context" + "errors" "fmt" "io" "net/url" @@ -22,6 +23,12 @@ import ( "time" ) +// ErrForbidden marks a refusal by the hub's authorization — the device asked +// correctly and was told no, which is a different thing from being offline. +// The syncer keys its degraded states off it: a refused push means read-only +// (keep pulling), a refused pull means access is gone (pause, touch nothing). +var ErrForbidden = errors.New("forbidden") + type Object struct { Key string Size int64 diff --git a/internal/store/store.go b/internal/store/store.go index 6d87951..9baf018 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -181,9 +181,20 @@ func (s *Store) SaveCache(mountID string, c map[string]CachedFile) error { // ---- sync state (sync.json) ---- +// Access records how the hub answered this device on the last cycle that +// reached it. It is persisted so `bdrive status` — which never runs a cycle — +// can report a degraded state, and so the daemon can log a transition once +// instead of on every tick. +const ( + AccessOK = "" // normal read+write sync + AccessReadOnly = "read-only" // pushes refused: pull-only + AccessNone = "no-access" // pulls refused too: sync paused +) + type SyncState struct { - Lamport int64 `json:"lamport"` - PushedOps int64 `json:"pushed_ops"` // how many of our own ops the remote has + Lamport int64 `json:"lamport"` + PushedOps int64 `json:"pushed_ops"` // how many of our own ops the remote has + Access string `json:"access,omitempty"` // "", "read-only", or "no-access" } func (s *Store) LoadSync() (SyncState, error) { diff --git a/internal/syncer/http_remote_test.go b/internal/syncer/http_remote_test.go index 8980088..2041d31 100644 --- a/internal/syncer/http_remote_test.go +++ b/internal/syncer/http_remote_test.go @@ -80,7 +80,9 @@ func TestSyncThroughWebServer(t *testing.T) { } // With uploads disabled on the server, a client can still pull (read-only -// follower) — its pushes degrade to offline instead of failing the cycle. +// follower) — its pushes report ReadOnly instead of failing the cycle. Not +// Offline: the server answered, it just said no, and retrying forever as if +// the network were down would hide that from the user. func TestReadOnlyServerClientStillPulls(t *testing.T) { storage := sharedRemote(t) ts, p := newHub(t, storage, false) // read-only hub @@ -101,8 +103,8 @@ func TestReadOnlyServerClientStillPulls(t *testing.T) { if err != nil { t.Fatal(err) } - if !res.Offline { - t.Fatalf("push against read-only server should degrade to offline: %+v", res) + if !res.ReadOnly || res.Offline { + t.Fatalf("push against a read-only server should report ReadOnly, not Offline: %+v", res) } if read(t, a.Folder, "shared.md") != "server-side truth" { t.Fatal("client should still pull from a read-only server") diff --git a/internal/syncer/org_authz_test.go b/internal/syncer/org_authz_test.go index 39a5396..8da68c4 100644 --- a/internal/syncer/org_authz_test.go +++ b/internal/syncer/org_authz_test.go @@ -115,7 +115,7 @@ func signupDeviceToken(t *testing.T, ts *httptest.Server, email, name string) st } // A device signed in to the wrong org can neither push into nor pull from a -// project: sync degrades to offline (never partial access) and no data +// project: sync pauses with NoAccess (never partial access) and no data // crosses the wall in either direction. func TestOrgWallsDeviceSync(t *testing.T) { storage := sharedRemote(t) @@ -147,8 +147,8 @@ func TestOrgWallsDeviceSync(t *testing.T) { if err != nil { t.Fatal(err) } - if !res.Offline { - t.Fatal("cross-org sync must degrade to offline, not succeed") + if !res.NoAccess || res.Offline { + t.Fatalf("cross-org sync must pause with NoAccess, not succeed or look offline: %+v", res) } if _, err := os.Stat(filepath.Join(b.Folder, "secret.md")); err == nil { t.Fatal("org A's file leaked to a device in org B") diff --git a/internal/syncer/syncer.go b/internal/syncer/syncer.go index 869a588..43f49b2 100644 --- a/internal/syncer/syncer.go +++ b/internal/syncer/syncer.go @@ -14,6 +14,7 @@ import ( "context" "crypto/sha256" "encoding/hex" + "errors" "fmt" "io" "io/fs" @@ -79,6 +80,13 @@ func (s *Session) mountID() string { } // Result summarizes one sync cycle. +// +// Offline, ReadOnly, and NoAccess are three different answers and must not be +// conflated: offline means the hub could not be reached and everything should +// be retried; ReadOnly means it refused our push (we keep pulling, local ops +// stay journaled and unpushed); NoAccess means it refused our pull too, so the +// cycle does nothing at all and leaves the working folder alone. Regaining +// access self-heals on a later cycle with no manual step. type Result struct { LocalOps int // local changes committed to the journal PulledOps int // ops received from other devices @@ -87,6 +95,9 @@ type Result struct { Pushed bool // own journal/blobs uploaded Offline bool // remote configured but unreachable this cycle OfflineErr error + ReadOnly bool // the hub refused our push: pull-only from here + NoAccess bool // the hub refused our pull: sync paused, nothing touched + AccessErr error } func (r *Result) Activity() bool { @@ -150,7 +161,17 @@ func (s *Session) Cycle(ctx context.Context) (*Result, error) { var pulled []journal.Op if s.Backend != nil { pulled, err = s.pull(ctx) - if err != nil { + switch { + case err == nil: + case errors.Is(err, remote.ErrForbidden): + // Access to this project was revoked. Stop here: materializing a + // replay we can no longer refresh would look like the hub + // reverting the user's files. Nothing is pushed, nothing is + // deleted, and the next cycle re-checks. + res.NoAccess, res.AccessErr = true, err + st.Access = store.AccessNone + return res, s.finish(cache, st) + default: res.Offline = true res.OfflineErr = err } @@ -191,11 +212,19 @@ func (s *Session) Cycle(ctx context.Context) (*Result, error) { // 5. Push our blobs and journal. if s.Backend != nil && !res.Offline && int64(len(myOps)) > st.PushedOps { - if err := s.push(ctx, myOps, &st); err != nil { + switch err := s.push(ctx, myOps, &st); { + case err == nil: + res.Pushed = true + case errors.Is(err, remote.ErrForbidden): + // Read-only on this project: pull and materialize already ran, so + // pull-only is the steady state. Our own ops stay in the local + // journal — never pushed, never dropped. The push is still + // attempted once per remote interval (no hot loop, and a re-grant + // self-heals). + res.ReadOnly, res.AccessErr = true, err + default: res.Offline = true res.OfflineErr = err - } else { - res.Pushed = true } } @@ -214,15 +243,26 @@ func (s *Session) Cycle(ctx context.Context) (*Result, error) { } } - if err := s.Store.SaveCache(s.mountID(), cache); err != nil { - return nil, err + st.Access = store.AccessOK + if res.ReadOnly { + st.Access = store.AccessReadOnly } - if err := s.Store.SaveSync(st); err != nil { + if err := s.finish(cache, st); err != nil { return nil, err } return res, nil } +// finish persists the two pieces of state a cycle mutates. Saving the cache +// matters even on a cut-short cycle: the scan already journaled local edits, +// and dropping the cache would make the next scan journal them all again. +func (s *Session) finish(cache map[string]store.CachedFile, st store.SyncState) error { + if err := s.Store.SaveCache(s.mountID(), cache); err != nil { + return err + } + return s.Store.SaveSync(st) +} + // scan diffs the working folder against the state cache and returns ops for // every local change, storing new content in the blob store. Filtered paths // are neither journaled nor deleted: a path that becomes ignored is dropped diff --git a/internal/syncer/syncer_test.go b/internal/syncer/syncer_test.go index 7ec62da..84ba5ba 100644 --- a/internal/syncer/syncer_test.go +++ b/internal/syncer/syncer_test.go @@ -3,10 +3,14 @@ package syncer import ( "context" "fmt" + "io" + "io/fs" + "maps" "os" "path/filepath" "strings" "sync" + "sync/atomic" "testing" "time" @@ -382,3 +386,193 @@ func TestNestedMountExcluded(t *testing.T) { t.Fatalf("b readme.md = %q, want root v2", got) } } + +// gated wraps a backend and refuses the operations the hub would refuse for a +// given permission level, with the same sentinel the http backend produces. +// The flags are read on every call so a test can revoke (or restore) access +// mid-run, which is exactly the case that used to look like a network fault. +type gated struct { + remote.Backend + read *atomic.Bool // pulls allowed (List/Get) + write *atomic.Bool // pushes allowed (Put) +} + +func newGated(be remote.Backend) *gated { + g := &gated{Backend: be, read: &atomic.Bool{}, write: &atomic.Bool{}} + g.read.Store(true) + g.write.Store(true) + return g +} + +func (g *gated) List(ctx context.Context, prefix string) ([]remote.Object, error) { + if !g.read.Load() { + return nil, fmt.Errorf("%w: server: 403 Forbidden", remote.ErrForbidden) + } + return g.Backend.List(ctx, prefix) +} + +func (g *gated) Get(ctx context.Context, key string) (io.ReadCloser, error) { + if !g.read.Load() { + return nil, fmt.Errorf("%w: server: 403 Forbidden", remote.ErrForbidden) + } + return g.Backend.Get(ctx, key) +} + +func (g *gated) Put(ctx context.Context, key string, r io.Reader, size int64) error { + if !g.write.Load() { + return fmt.Errorf("%w: server: 403 Forbidden", remote.ErrForbidden) + } + return g.Backend.Put(ctx, key, r, size) +} + +// A read-only device keeps pulling its teammates' changes and journals its own +// edits locally, but nothing of its own ever reaches the remote — and the +// cycle says ReadOnly, never Offline, so the user is told rather than left +// watching a silent retry loop. +func TestReadOnlyDevicePullsOnly(t *testing.T) { + be := sharedRemote(t) + a := newDevice(t, "deva", be) + gate := newGated(be) + b := newDevice(t, "devb", gate) + + write(t, a.Folder, "shared.md", "from A") + cycle(t, a) + + gate.write.Store(false) // B is downgraded to read + write(t, b.Folder, "mine.md", "local only") + res, err := b.Cycle(context.Background()) + if err != nil { + t.Fatal(err) + } + if !res.ReadOnly || res.Offline { + t.Fatalf("read-only push: %+v, want ReadOnly and not Offline", res) + } + if got := read(t, b.Folder, "shared.md"); got != "from A" { + t.Fatalf("b shared.md = %q — a read-only device must still pull", got) + } + // B's own edit is journaled locally... + ops, err := b.Store.DeviceOps(b.Device.ID) + if err != nil { + t.Fatal(err) + } + if len(ops) != 1 || ops[0].Path != "mine.md" { + t.Fatalf("b's local journal = %+v, want one op for mine.md", ops) + } + // ...and never lands in the shared remote, however many cycles run. + for i := 0; i < 3; i++ { + if _, err := b.Cycle(context.Background()); err != nil { + t.Fatal(err) + } + } + c := newDevice(t, "devc", be) + cycle(t, c) + if _, err := os.Stat(filepath.Join(c.Folder, "mine.md")); !os.IsNotExist(err) { + t.Fatal("a read-only device's edit reached the remote") + } + // The state is persisted so `bdrive status` can report it without a cycle. + if st, err := b.Store.LoadSync(); err != nil || st.Access != store.AccessReadOnly { + t.Fatalf("persisted access = %q (%v), want read-only", st.Access, err) + } + + // Restoring write self-heals: the held-back op finally goes out. + gate.write.Store(true) + if res := cycle(t, b); !res.Pushed { + t.Fatalf("re-granted device did not push: %+v", res) + } + cycle(t, c) + if got := read(t, c.Folder, "mine.md"); got != "local only" { + t.Fatalf("c mine.md = %q after the re-grant", got) + } + if st, _ := b.Store.LoadSync(); st.Access != store.AccessOK { + t.Fatalf("persisted access = %q after re-grant, want cleared", st.Access) + } +} + +// A device whose access is revoked entirely pauses: the cycle reports +// NoAccess (not Offline), the working folder is left byte-for-byte alone — +// revoking access must never look like the hub deleting someone's files — and +// re-granting resumes normal sync with no manual step. +func TestNoAccessPausesSync(t *testing.T) { + be := sharedRemote(t) + a := newDevice(t, "deva", be) + gate := newGated(be) + c := newDevice(t, "devc", gate) + + write(t, a.Folder, "doc.md", "v1") + cycle(t, a) + cycle(t, c) + if got := read(t, c.Folder, "doc.md"); got != "v1" { + t.Fatalf("c doc.md = %q, want v1", got) + } + + // A moves on while C's access is cut. + write(t, a.Folder, "doc.md", "v2") + write(t, a.Folder, "new.md", "after the cut") + cycle(t, a) + + gate.read.Store(false) + gate.write.Store(false) + before := snapshotDir(t, c.Folder) + write(t, c.Folder, "cs-own.md", "written while cut off") + before["cs-own.md"] = "written while cut off" + + for i := 0; i < 3; i++ { + res, err := c.Cycle(context.Background()) + if err != nil { + t.Fatal(err) + } + if !res.NoAccess || res.Offline { + t.Fatalf("cycle %d: %+v, want NoAccess and not Offline", i, res) + } + if res.Materialized != 0 || res.Pushed { + t.Fatalf("cycle %d touched the folder or pushed: %+v", i, res) + } + } + if got := snapshotDir(t, c.Folder); !maps.Equal(got, before) { + t.Fatalf("working folder changed while access was revoked:\n got %v\nwant %v", got, before) + } + if st, _ := c.Store.LoadSync(); st.Access != store.AccessNone { + t.Fatalf("persisted access = %q, want no-access", st.Access) + } + + // Re-granting needs no intervention: the next cycle converges both ways. + gate.read.Store(true) + gate.write.Store(true) + cycle(t, c) + if got := read(t, c.Folder, "doc.md"); got != "v2" { + t.Fatalf("c doc.md = %q after the re-grant, want v2", got) + } + if got := read(t, c.Folder, "new.md"); got != "after the cut" { + t.Fatalf("c new.md = %q after the re-grant", got) + } + cycle(t, a) + if got := read(t, a.Folder, "cs-own.md"); got != "written while cut off" { + t.Fatalf("a cs-own.md = %q — C's held-back edit should arrive", got) + } +} + +// snapshotDir reads every file under folder (excluding .bdrive) as path→content. +func snapshotDir(t *testing.T, folder string) map[string]string { + t.Helper() + out := map[string]string{} + err := filepath.WalkDir(folder, func(p string, d fs.DirEntry, err error) error { + if err != nil || d.IsDir() { + return err + } + rel, _ := filepath.Rel(folder, p) + rel = filepath.ToSlash(rel) + if strings.HasPrefix(rel, config.ProjectDir+"/") { + return nil + } + b, err := os.ReadFile(p) + if err != nil { + return err + } + out[rel] = string(b) + return nil + }) + if err != nil { + t.Fatal(err) + } + return out +} diff --git a/internal/webapp/admin.go b/internal/webapp/admin.go index 5f3e025..9aef68c 100644 --- a/internal/webapp/admin.go +++ b/internal/webapp/admin.go @@ -12,34 +12,14 @@ import ( // operable — an admin can offboard, clean up, and audit — without editing // JSON files on the server by hand. -// projectOwner returns true when the request's account owns the project's org. -func (s *Server) projectOwner(r *http.Request, projectID string) bool { - if s.Dir == nil || s.Auth == nil { - return true - } - org := s.orgOf(projectID) - if org == "" { - return true - } - return s.Dir.Role(org, s.requestUser(r).Email) == RoleOwner -} - -// handleProjectUpdate edits a project's name, description and icon. Owner of -// its org only. It's a partial update: every field is a pointer, so only the -// keys actually present in the body change — {"description":""} clears the -// description, omitting the key leaves it alone. +// handleProjectUpdate edits a project's name, description and icon. Project +// admins (and, implicitly, the owners of its org) only. It's a partial update: +// every field is a pointer, so only the keys actually present in the body +// change — {"description":""} clears the description, omitting the key leaves +// it alone. func (s *Server) handleProjectUpdate(w http.ResponseWriter, r *http.Request) { id := r.PathValue("project") - if s.Projects == nil { - http.Error(w, "this server does not host projects", http.StatusNotFound) - return - } - if _, ok := s.Projects.Get(id); !ok || !s.projectAllowed(r, id) { - http.Error(w, "no such project", http.StatusNotFound) - return - } - if !s.projectOwner(r, id) { - http.Error(w, "only an organization owner can rename a project", http.StatusForbidden) + if _, ok := s.project(w, r, id, PermAdmin); !ok { return } var req struct { @@ -58,20 +38,11 @@ func (s *Server) handleProjectUpdate(w http.ResponseWriter, r *http.Request) { writeJSON(w, map[string]any{"ok": true}) } -// handleProjectDelete removes a project from the registry. Owner only. -// Storage (blobs, journals) is intentionally left in place. +// handleProjectDelete removes a project from the registry. Project admins +// only. Storage (blobs, journals) is intentionally left in place. func (s *Server) handleProjectDelete(w http.ResponseWriter, r *http.Request) { id := r.PathValue("project") - if s.Projects == nil { - http.Error(w, "this server does not host projects", http.StatusNotFound) - return - } - if _, ok := s.Projects.Get(id); !ok || !s.projectAllowed(r, id) { - http.Error(w, "no such project", http.StatusNotFound) - return - } - if !s.projectOwner(r, id) { - http.Error(w, "only an organization owner can delete a project", http.StatusForbidden) + if _, ok := s.project(w, r, id, PermAdmin); !ok { return } if err := s.Projects.Delete(id); err != nil { diff --git a/internal/webapp/db_conformance_test.go b/internal/webapp/db_conformance_test.go index 684fbcc..89e073e 100644 --- a/internal/webapp/db_conformance_test.go +++ b/internal/webapp/db_conformance_test.go @@ -134,9 +134,26 @@ func TestMetaStoreConformance(t *testing.T) { t.Fatal(err) } p2, _, _ := projects.GetOrCreate("scratch", "o-1") + if err := projects.SetPerm(p2.ID, "doomed@x.io", PermAdmin); err != nil { + t.Fatal(err) + } if err := projects.Delete(p2.ID); err != nil { t.Fatal(err) } + // per-project permissions ride along with the project record + if err := projects.SetCreator(p1.ID, "Boss@X.io"); err != nil { + t.Fatal(err) + } + if err := projects.SetDefault(p1.ID, PermNone); err != nil { + t.Fatal(err) + } + for email, level := range map[string]string{ + "boss@x.io": PermAdmin, "reader@x.io": PermRead, "cutoff@x.io": PermNone, + } { + if err := projects.SetPerm(p1.ID, email, level); err != nil { + t.Fatal(err) + } + } orgs, err := NewOrgDB(st.Orgs()) if err != nil { @@ -225,12 +242,23 @@ func TestMetaStoreConformance(t *testing.T) { if !ok || hb.Name != "handbook" { t.Fatalf("rename lost across reload: %+v", hb) } - // Description/icon are the columns migrate() has to ADD to an - // already-created projects table; the reopen above already ran - // migrate() a second time, so surviving here proves it's a no-op. + // Description/icon and creator/default_level are all columns + // migrate() has to ADD to an already-created projects table; the + // reopen above already ran migrate() a second time, so surviving + // here proves it's a no-op. if hb.Description != "everything support needs" || hb.Icon != "book-open" { t.Fatalf("description/icon lost across reload: %+v", hb) } + if hb.Creator != "boss@x.io" || hb.Default != PermNone { + t.Fatalf("creator/default lost across reload: %+v", hb) + } + if hb.Perms["boss@x.io"] != PermAdmin || hb.Perms["reader@x.io"] != PermRead || + hb.Perms["cutoff@x.io"] != PermNone || len(hb.Perms) != 3 { + t.Fatalf("grants lost across reload: %+v", hb.Perms) + } + if _, ok := projects2.Get(p2.ID); ok { + t.Fatal("deleted project (and its grants) came back after reload") + } orgs2, _ := NewOrgDB(st2.Orgs()) ro, ok := orgs2.Get(org.ID) @@ -275,3 +303,53 @@ func TestMetaStoreConformance(t *testing.T) { }) } } + +// migrate() only ever created tables, so the columns permissions added need a +// real ALTER on a hub that is already running. Prove both halves: an old +// projects table gains them (with its rows intact), and migrating again is a +// no-op rather than an error. +func TestSQLMigrateAddsPermissionColumns(t *testing.T) { + path := filepath.Join(t.TempDir(), "old.db") + old, err := sql.Open("sqlite", path) + if err != nil { + t.Fatal(err) + } + // the pre-permissions schema, verbatim + if _, err := old.Exec(`CREATE TABLE projects ( + id TEXT PRIMARY KEY, name TEXT NOT NULL, org TEXT NOT NULL DEFAULT '', + created TEXT NOT NULL DEFAULT '')`); err != nil { + t.Fatal(err) + } + if _, err := old.Exec(`INSERT INTO projects (id,name,org,created) VALUES ('p-0000abcd','wiki','o-1','')`); err != nil { + t.Fatal(err) + } + old.Close() + + for i := 0; i < 2; i++ { // opening twice re-runs migrate() + st, err := OpenSQLStore("sqlite", path) + if err != nil { + t.Fatalf("open %d: %v", i, err) + } + projects, err := NewProjectDB(st.Projects()) + if err != nil { + t.Fatalf("load %d: %v", i, err) + } + p, ok := projects.Get("p-0000abcd") + if !ok || p.Name != "wiki" { + t.Fatalf("pre-existing row lost on upgrade: %+v", p) + } + // An upgraded row has no creator and an empty default, which reads as + // write — the whole "no behavior change on upgrade" promise. + if p.Creator != "" || p.Default != "" || p.level() != PermWrite { + t.Fatalf("upgraded row = %+v, want empty creator/default reading as write", p) + } + if i == 0 { + if err := projects.SetPerm(p.ID, "a@x.io", PermRead); err != nil { + t.Fatal(err) + } + } else if p.Perms["a@x.io"] != PermRead { + t.Fatalf("grant lost across reopen: %+v", p.Perms) + } + st.Close() + } +} diff --git a/internal/webapp/db_sql.go b/internal/webapp/db_sql.go index 1fa0103..011f792 100644 --- a/internal/webapp/db_sql.go +++ b/internal/webapp/db_sql.go @@ -161,6 +161,9 @@ func (s *sqlMetaStore) migrate() error { kind TEXT NOT NULL, actor TEXT NOT NULL, count INTEGER NOT NULL DEFAULT 0, last TEXT NOT NULL DEFAULT '', PRIMARY KEY (project, path, day, kind, actor))`, + `CREATE TABLE IF NOT EXISTS project_perms ( + project TEXT NOT NULL, email TEXT NOT NULL, level TEXT NOT NULL, + PRIMARY KEY (project, email))`, } for _, st := range stmts { if _, err := s.db.Exec(st); err != nil { @@ -170,8 +173,10 @@ func (s *sqlMetaStore) migrate() error { // Columns added after the tables shipped. CREATE TABLE IF NOT EXISTS does // nothing for an existing table, so these need a real (idempotent) ALTER. return s.addColumns("projects", map[string]string{ - "description": `TEXT NOT NULL DEFAULT ''`, - "icon": `TEXT NOT NULL DEFAULT ''`, + "description": `TEXT NOT NULL DEFAULT ''`, + "icon": `TEXT NOT NULL DEFAULT ''`, + "creator": `TEXT NOT NULL DEFAULT ''`, + "default_level": `TEXT NOT NULL DEFAULT ''`, }) } @@ -293,33 +298,101 @@ func (r *sqlAccountRepo) PutPolicy(p authPolicy) error { type sqlProjectRepo struct{ s *sqlMetaStore } func (r *sqlProjectRepo) Load() ([]Project, error) { - rows, err := r.s.db.Query(`SELECT id, name, org, created, description, icon FROM projects`) + rows, err := r.s.db.Query( + `SELECT id, name, org, created, description, icon, creator, default_level FROM projects`) if err != nil { return nil, err } - defer rows.Close() - var out []Project + byID := map[string]*Project{} + var order []string for rows.Next() { var p Project var created string - if err := rows.Scan(&p.ID, &p.Name, &p.Org, &created, &p.Description, &p.Icon); err != nil { + if err := rows.Scan(&p.ID, &p.Name, &p.Org, &created, + &p.Description, &p.Icon, &p.Creator, &p.Default); err != nil { + rows.Close() return nil, err } p.Created = tdec(created) - out = append(out, p) + byID[p.ID] = &p + order = append(order, p.ID) } - return out, rows.Err() + rows.Close() + if err := rows.Err(); err != nil { + return nil, err + } + + rows, err = r.s.db.Query(`SELECT project, email, level FROM project_perms`) + if err != nil { + return nil, err + } + for rows.Next() { + var project, email, level string + if err := rows.Scan(&project, &email, &level); err != nil { + rows.Close() + return nil, err + } + if p := byID[project]; p != nil { + if p.Perms == nil { + p.Perms = map[string]string{} + } + p.Perms[email] = level + } + } + rows.Close() + if err := rows.Err(); err != nil { + return nil, err + } + + out := make([]Project, 0, len(order)) + for _, id := range order { + out = append(out, *byID[id]) + } + return out, nil } +// Put writes the project and replaces its grants in one transaction — same +// shape as PutOrg over orgs/org_members. func (r *sqlProjectRepo) Put(p Project) error { - return r.s.exec(`INSERT INTO projects (id,name,org,created,description,icon) VALUES (?,?,?,?,?,?) + tx, err := r.s.db.Begin() + if err != nil { + return err + } + defer tx.Rollback() + if _, err := tx.Exec(r.s.q( + `INSERT INTO projects (id,name,org,created,description,icon,creator,default_level) + VALUES (?,?,?,?,?,?,?,?) ON CONFLICT(id) DO UPDATE SET name=excluded.name, org=excluded.org, created=excluded.created, - description=excluded.description, icon=excluded.icon`, - p.ID, p.Name, p.Org, tenc(p.Created), p.Description, p.Icon) + description=excluded.description, icon=excluded.icon, + creator=excluded.creator, default_level=excluded.default_level`), + p.ID, p.Name, p.Org, tenc(p.Created), p.Description, p.Icon, p.Creator, p.Default); err != nil { + return err + } + if _, err := tx.Exec(r.s.q(`DELETE FROM project_perms WHERE project = ?`), p.ID); err != nil { + return err + } + for email, level := range p.Perms { + if _, err := tx.Exec(r.s.q(`INSERT INTO project_perms (project,email,level) VALUES (?,?,?)`), + p.ID, email, level); err != nil { + return err + } + } + return tx.Commit() } func (r *sqlProjectRepo) Delete(id string) error { - return r.s.exec(`DELETE FROM projects WHERE id = ?`, id) + tx, err := r.s.db.Begin() + if err != nil { + return err + } + defer tx.Rollback() + if _, err := tx.Exec(r.s.q(`DELETE FROM project_perms WHERE project = ?`), id); err != nil { + return err + } + if _, err := tx.Exec(r.s.q(`DELETE FROM projects WHERE id = ?`), id); err != nil { + return err + } + return tx.Commit() } // ---- orgs (+ members, + invites) ---- diff --git a/internal/webapp/e2e_serve_test.go b/internal/webapp/e2e_serve_test.go index e9b4187..6e0fd2c 100644 --- a/internal/webapp/e2e_serve_test.go +++ b/internal/webapp/e2e_serve_test.go @@ -29,6 +29,7 @@ const ( e2eAdmin = "e2e@example.com" e2eMember = "member@example.com" e2eSolo = "solo@example.com" + e2eReader = "reader@example.com" // org member with a read-only grant on "wiki" e2ePassword = "e2e-pass-1" ) @@ -85,6 +86,9 @@ func TestE2EServe(t *testing.T) { if _, err := auth.signup(e2eSolo, "E2E Solo", e2ePassword); err != nil { t.Fatal(err) } + if _, err := auth.signup(e2eReader, "E2E Reader", e2ePassword); err != nil { + t.Fatal(err) + } auth.Admins = map[string]bool{e2eAdmin: true} srv.Auth = auth @@ -96,12 +100,19 @@ func TestE2EServe(t *testing.T) { if err != nil { t.Fatal(err) } - if err := orgs.AddMember(org.ID, e2eMember, RoleMember); err != nil { - t.Fatal(err) + for _, m := range []string{e2eMember, e2eReader} { + if err := orgs.AddMember(org.ID, m, RoleMember); err != nil { + t.Fatal(err) + } } if err := db.SetOrg(p.ID, org.ID); err != nil { t.Fatal(err) } + // One member cut back to read: the suite checks that write affordances + // are absent for them, not merely that the server would 403. + if err := db.SetPerm(p.ID, e2eReader, PermRead); err != nil { + t.Fatal(err) + } srv.Dir = LocalDirectory{OrgDB: orgs} auth.InviteValid = orgs.ValidInvite diff --git a/internal/webapp/frontend/e2e/helpers.ts b/internal/webapp/frontend/e2e/helpers.ts index 8f268ef..c67c5a1 100644 --- a/internal/webapp/frontend/e2e/helpers.ts +++ b/internal/webapp/frontend/e2e/helpers.ts @@ -2,6 +2,8 @@ import { Page } from "@playwright/test"; export const ADMIN = "e2e@example.com"; export const MEMBER = "member@example.com"; +// Org member cut back to read-only on "wiki" by the seeded harness. +export const READER = "reader@example.com"; export const PASSWORD = "e2e-pass-1"; // One real form login per identity per run, then the session cookie is diff --git a/internal/webapp/frontend/e2e/home.spec.ts b/internal/webapp/frontend/e2e/home.spec.ts index 1754bbe..9f7ef05 100644 --- a/internal/webapp/frontend/e2e/home.spec.ts +++ b/internal/webapp/frontend/e2e/home.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { login, wikiId, MEMBER, expectToast } from "./helpers"; +import { login, wikiId, MEMBER, READER, expectToast } from "./helpers"; // Phase 3: project home (connect guide + embedded insights), the dedicated // insights route, and the history views. Ports the original parity checks @@ -294,3 +294,40 @@ test("project settings: delete needs the exact name typed, then navigates away", await expect(page).not.toHaveURL(new RegExp(pid)); await expect(page.locator("#projects .row .label", { hasText: "condemned" })).toHaveCount(0); }); + +test("project settings: People shows the default level and the grants", async ({ page }) => { + await login(page); + const pid = await wikiId(page); + await page.goto(`/${pid}/settings`); + const people = page.locator(".ps-people"); + await expect(people).toBeVisible(); + // An admin gets live controls... + await expect(people.locator('select[aria-label="Default access for workspace members"]')).toBeEnabled(); + await expect(people.locator("button", { hasText: "+ Add" })).toBeVisible(); + // ...the seeded read-only member is listed as an exception... + await expect(people.locator(`select[aria-label="Access for ${READER}"]`)).toHaveValue("read"); + // ...and the workspace owner is shown as permanently admin, not editable. + await expect(people.locator(".admin-item", { hasText: "Workspace owner" })).toBeVisible(); +}); + +test("a read-only member: no Share, no danger zone, People is read-only", async ({ page }) => { + await login(page, READER); + const pid = await wikiId(page); + + // The project is fully visible and browsable. + await page.goto(`/${pid}/index.md`); + await expect(page.locator("#content h1")).toHaveText("Wiki"); + // ...but nothing that writes is offered. + await expect(page.locator("#share-btn")).toHaveCount(0); + + await page.goto(`/${pid}/settings`); + await expect(page.locator(".project-settings h2")).toContainText("wiki"); + await expect(page.locator(".ps-chip")).toHaveText("Read-only"); + await expect(page.locator(".ps-danger")).toHaveCount(0); + // The People table is shown, disabled — same layout, no controls. + await expect(page.locator(".ps-people")).toBeVisible(); + await expect( + page.locator('.ps-people select[aria-label="Default access for workspace members"]'), + ).toBeDisabled(); + await expect(page.locator(".ps-people button", { hasText: "+ Add" })).toHaveCount(0); +}); diff --git a/internal/webapp/frontend/src/api/types.ts b/internal/webapp/frontend/src/api/types.ts index fe297ac..1607097 100644 --- a/internal/webapp/frontend/src/api/types.ts +++ b/internal/webapp/frontend/src/api/types.ts @@ -19,7 +19,17 @@ export interface ServerConfig { me?: { email: string; name: string }; } -// GET /api/projects (handleProjectList → Project, projects.go) +// Per-project permission levels (perms.go). Ordered: each includes the ones +// before it. +export type PermLevel = "none" | "read" | "write" | "admin"; +const PERM_RANK: Record = { read: 1, write: 2, admin: 3 }; +// Mirrors atLeast() on the server. The UI uses it to hide affordances; the +// server still enforces every one of them. +export function atLeast(have: string | undefined, want: PermLevel): boolean { + return (PERM_RANK[have || ""] || 0) >= (PERM_RANK[want] || 0); +} + +// GET /api/projects (handleProjectList, server.go) export interface Project { id: string; name: string; @@ -28,6 +38,19 @@ export interface Project { description?: string; /** lucide icon name (kebab-case); unknown or absent → the folder placeholder */ icon?: string; + creator?: string; + // The signed-in account's effective level on this project, resolved + // server-side. A project you cannot read never appears in the list at all, + // so this is always read or better here. + perm?: PermLevel; +} + +// GET /api/p/{id}/permissions (handleProjectPerms, perms.go) +export interface ProjectPerms { + default: PermLevel; // what org members get without a grant + me: PermLevel; // the caller's own effective level + creator?: string; + grants: Array<{ email: string; level: PermLevel }>; } export interface ProjectList { diff --git a/internal/webapp/frontend/src/apps/Browser.tsx b/internal/webapp/frontend/src/apps/Browser.tsx index 2b19933..c61c294 100644 --- a/internal/webapp/frontend/src/apps/Browser.tsx +++ b/internal/webapp/frontend/src/apps/Browser.tsx @@ -7,6 +7,7 @@ import { } from "react"; import { useQueryClient } from "@tanstack/react-query"; import { Button } from "@/components/ui/button"; +import { atLeast } from "../api/types"; import type { Project, ServerConfig } from "../api/types"; import { useHeat, useTree } from "../hooks/useBrowse"; import { urlForPath, urlForView, type Route } from "../router"; @@ -149,7 +150,9 @@ export default function Browser(props: { const downloadRef = useRef(null); const panel = props.panel ?? null; - const canShare = !panel && hub && !!project && isFile; + // Minting a public link is a write. A read-only member sees no Share + // button rather than a button that 403s. + const canShare = !panel && hub && !!project && isFile && atLeast(project.perm, "write"); const canHistory = !panel && hub && !!project; // Browser upload is deliberately absent (for now): content enters through // local sync only; the web app is a read/share/history surface. diff --git a/internal/webapp/frontend/src/components/ProjectSettings.tsx b/internal/webapp/frontend/src/components/ProjectSettings.tsx index d155270..458863d 100644 --- a/internal/webapp/frontend/src/components/ProjectSettings.tsx +++ b/internal/webapp/frontend/src/components/ProjectSettings.tsx @@ -2,10 +2,11 @@ import { useEffect } from "react"; import { useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; import { z } from "zod"; +import { useQueryClient } from "@tanstack/react-query"; import { api } from "../api/http"; -import { modalPrompt } from "../modal"; +import { modalConfirm, modalPrompt } from "../modal"; import { toast } from "../toast"; -import { useHubRefresh } from "../hooks/useHub"; +import { useHubRefresh, usePermissions } from "../hooks/useHub"; import { PROJECT_ICONS, ProjectIcon } from "./shell"; import { projColor } from "./ProjectNav"; import { Button } from "@/components/ui/button"; @@ -20,11 +21,13 @@ import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Separator } from "@/components/ui/separator"; import { Textarea } from "@/components/ui/textarea"; -import type { Org, Project } from "../api/types"; +import { atLeast } from "../api/types"; +import type { Org, PermLevel, Project, ProjectPerms } from "../api/types"; // Settings for the open project (sidebar menu): General edits the name, -// description and icon; About holds the identity facts; the danger zone -// deletes. Install/connect lives on the Installation page. +// description and icon; About holds the identity facts; People says who can +// do what; the danger zone deletes. Install/connect lives on the Installation +// page. const MAX_DESC = 280; @@ -50,9 +53,9 @@ export function ProjectSettings({ onDeleted: () => Promise; }) { const refresh = useHubRefresh(); - // Owner-only, and only as UX: handleProjectUpdate enforces it too. Swap for - // the project-level permission once BEA-2 lands. - const mayEdit = org?.role === "owner"; + // Project admins, and only as UX: handleProjectUpdate enforces it too. + // (Workspace owners resolve to admin server-side, so they still pass.) + const mayEdit = atLeast(project.perm, "admin"); const form = useForm({ resolver: zodResolver(schema), @@ -97,7 +100,10 @@ export function ProjectSettings({ return (
-

{project.name}

+

+ {project.name} + {!atLeast(project.perm, "write") && Read-only} +

@@ -239,8 +245,10 @@ export function ProjectSettings({ - {/* Owner-only, and only as UX: handleProjectDelete enforces it too. */} - {org?.role === "owner" && ( + + + {/* Admin-only, and only as UX: handleProjectDelete enforces it too. */} + {mayEdit && ( Danger zone @@ -279,3 +287,171 @@ export function ProjectSettings({
); } + +const LEVELS: Array<{ value: PermLevel; label: string }> = [ + { value: "admin", label: "Admin" }, + { value: "write", label: "Write" }, + { value: "read", label: "Read" }, + { value: "none", label: "No access" }, +]; +const LABEL: Record = Object.fromEntries(LEVELS.map((l) => [l.value, l.label])); + +// People: the level everyone in the workspace gets, plus per-person +// exceptions. Visible to every member with access; editable only for admins, +// who see the same table with live controls. +function People({ project, org }: { project: Project; org: Org | null }) { + const qc = useQueryClient(); + const { data, error } = usePermissions(project.id); + const isAdmin = atLeast(project.perm, "admin"); + const reload = () => { + qc.invalidateQueries({ queryKey: ["permissions", project.id] }); + qc.invalidateQueries({ queryKey: ["projects"] }); + }; + const run = async (fn: () => Promise, ok: string) => { + try { + await fn(); + toast(ok); + } catch (e) { + toast((e as Error).message, true); + } + reload(); + }; + + if (error) return null; // permissions are unavailable in single-volume mode + if (!data) return null; + const perms: ProjectPerms = data; + const base = `/api/p/${project.id}/permissions`; + // Workspace owners are always project admins, whatever the grant list says. + const owners = new Set( + (org?.members || []).filter((m) => m.role === "owner").map((m) => m.email.toLowerCase()), + ); + const rows = [ + ...perms.grants.filter((g) => !owners.has(g.email.toLowerCase())), + ...[...owners].sort().map((email) => ({ email, level: "admin" as PermLevel, owner: true })), + ]; + + const addPerson = async () => { + const email = await modalPrompt( + "Add an exception", + "Email of a workspace member. They get Read access; change it in the table.", + "", + "Add", + ); + if (email === null || !email.trim()) return; + await run(() => api("PUT", `${base}/${encodeURIComponent(email.trim())}`, { level: "read" }), "Added."); + }; + + return ( + + + People + Who can see and change this project. + + + +

+ Everyone in {org?.name || "this workspace"} can + +

+ {perms.default === "none" && ( +

+ This project is invite-only: only the people below and workspace owners can see it. +

+ )} + +
+

Exceptions

+ {isAdmin && ( + + )} +
+ {rows.length === 0 ? ( +

No exceptions — everyone gets the access above.

+ ) : ( +
+ {rows.map((g) => { + const isOwner = "owner" in g; + return ( +
+ + {g.email} + {perms.creator && g.email.toLowerCase() === perms.creator.toLowerCase() && ( + (creator) + )} + + {isOwner ? ( + Workspace owner — always admin + ) : ( + + + {isAdmin && ( + + )} + + )} +
+ ); + })} +
+ )} +
+
+ ); +} diff --git a/internal/webapp/frontend/src/hooks/useHub.ts b/internal/webapp/frontend/src/hooks/useHub.ts index 29f9c40..25c129b 100644 --- a/internal/webapp/frontend/src/hooks/useHub.ts +++ b/internal/webapp/frontend/src/hooks/useHub.ts @@ -1,6 +1,6 @@ import { useQuery, useQueryClient } from "@tanstack/react-query"; import { getJSON } from "../api/http"; -import type { OrgList, PendingList, ProjectList } from "../api/types"; +import type { OrgList, PendingList, ProjectList, ProjectPerms } from "../api/types"; // Hub-wide server state: the project list (polled — new projects appear // without a reload, matching the classic app's 30s refresh) and the orgs @@ -25,6 +25,16 @@ export function useOrgs(enabled: boolean) { }); } +// One project's permission settings (default level + explicit grants). Any +// member with read may fetch it; only an admin may change it. +export function usePermissions(projectId: string | undefined) { + return useQuery({ + queryKey: ["permissions", projectId], + queryFn: () => getJSON(`/api/p/${projectId}/permissions`), + enabled: !!projectId, + }); +} + // Pending signups; only fetched for hub admins (the admin bar shows the // count). export function usePending(enabled: boolean) { diff --git a/internal/webapp/frontend/src/style.css b/internal/webapp/frontend/src/style.css index d46c2d8..e97ee51 100644 --- a/internal/webapp/frontend/src/style.css +++ b/internal/webapp/frontend/src/style.css @@ -373,7 +373,7 @@ button, input, a.btn { font-family: inherit; } [data-slot="dropdown-menu-content"] { border-color: var(--border); } /* ---- project settings ---- */ -/* Sectioned cards: General (editable), About (facts), Danger zone. */ +/* Sectioned cards: General (editable), About (facts), People, Danger zone. */ .project-settings { display: flex; flex-direction: column; gap: 14px; } .project-settings > h2 { font-size: 21px; font-weight: 640; letter-spacing: -.02em; margin: 0 0 4px; color: #f4f6f9; } .ps-form { display: flex; flex-direction: column; gap: 18px; } @@ -395,6 +395,17 @@ button, input, a.btn { font-family: inherit; } .ps-icon-cell.active { border-color: var(--accent); color: var(--accent-bright); } /* Irreversible actions keep their own, clearly-marked card. */ .ps-danger [data-slot="card-title"] { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: #d2695e; font-weight: 600; } +/* Who can do what — one more card in the same stack. The read-only view is + the same markup with its controls disabled, so nothing shifts when the + caller's level changes. Native selects here rather than the shadcn Select: + the org admin's role picker already uses them, and this table matches it. */ +.ps-chip { margin-left: 10px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-faint); font-size: 11px; font-weight: 600; letter-spacing: .02em; vertical-align: middle; } +.ps-people h4 { font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin: 0; } +.ps-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-dim); margin: 0 0 10px; } +.ps-people select { height: 28px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px; } +.ps-people select:disabled { opacity: .6; cursor: default; } +.ps-note { color: var(--text-faint); font-size: 12.5px; margin: 0 0 12px; max-width: 56ch; line-height: 1.55; } +.ps-people-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 8px; } .ps-danger p { color: var(--text-dim); font-size: 13px; margin: 0 0 14px; max-width: 52ch; line-height: 1.55; } .ps-facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 20px; margin: 0; font-size: 13px; } .ps-facts dt { color: var(--text-faint); } diff --git a/internal/webapp/orgs.go b/internal/webapp/orgs.go index 20603d1..afa5917 100644 --- a/internal/webapp/orgs.go +++ b/internal/webapp/orgs.go @@ -372,20 +372,6 @@ func (s *Server) orgOf(projectID string) string { return p.Org } -// projectAllowed says whether the request's account may touch the project. -// Without an org registry (single-volume mode, tests, pre-org hubs) every -// authenticated request passes, preserving the old behavior. -func (s *Server) projectAllowed(r *http.Request, projectID string) bool { - if s.Dir == nil || s.Auth == nil { - return true - } - org := s.orgOf(projectID) - if org == "" { - return true // org-less project (migration happens at startup) - } - return s.Dir.Role(org, s.requestUser(r).Email) != "" -} - // handleOrgList returns the caller's orgs with members (visible to any // member) and the caller's role. func (s *Server) handleOrgList(w http.ResponseWriter, r *http.Request) { diff --git a/internal/webapp/perms.go b/internal/webapp/perms.go new file mode 100644 index 0000000..72df341 --- /dev/null +++ b/internal/webapp/perms.go @@ -0,0 +1,235 @@ +package webapp + +import ( + "encoding/json" + "io" + "net/http" + "sort" +) + +// Per-project permissions. Orgs wall projects off from outsiders; these four +// ordered levels say what an insider may do with one project. The default +// level for a project is "write" — today's behavior — expressed as the empty +// string on Project.Default, so an existing hub upgrades with no migration and +// no change in behavior until someone edits permissions. +// +// One resolver (projectPerm) and one choke point (the proj() wrapper in +// server.go): every per-project route declares the level it needs at +// registration, so no handler grows its own check and a missed handler cannot +// become a silent authorization hole. + +const ( + PermNone = "none" // the project is hidden: absent from the list, 403 everywhere + PermRead = "read" // browse, view, download, history, heat + PermWrite = "write" // + upload, sync push, share links + PermAdmin = "admin" // + rename, delete, edit this project's permissions +) + +// permRank orders the levels. An unknown level ranks as none: fail closed. +func permRank(level string) int { + switch level { + case PermRead: + return 1 + case PermWrite: + return 2 + case PermAdmin: + return 3 + default: + return 0 + } +} + +// atLeast reports whether have satisfies want. +func atLeast(have, want string) bool { return permRank(have) >= permRank(want) } + +// validLevel says whether a level is one an API caller may name. +func validLevel(l string) bool { + return l == PermNone || l == PermRead || l == PermWrite || l == PermAdmin +} + +// projectPerm resolves the request account's effective level on a project: +// +// org owner of the project's org → admin (always; never lockable-out) +// explicit grant → that level ("none" = denied) +// member of the project's org → the project default (write unless changed) +// otherwise → none +// +// The two escape hatches are load-bearing and inherited verbatim from the +// projectAllowed this replaces: without a directory or auth (single-volume +// mode, tests) and for an org-less project (a pre-org hub mid-migration), +// everyone resolves to admin. +func (s *Server) projectPerm(r *http.Request, projectID string) string { + if s.Dir == nil || s.Auth == nil { + return PermAdmin + } + p, ok := s.Projects.Get(projectID) + if !ok || p.Org == "" { + return PermAdmin // org-less project (migration happens at startup) + } + email := normEmail(s.requestUser(r).Email) + role := s.Dir.Role(p.Org, email) + if role == RoleOwner { + return PermAdmin + } + if l, ok := p.Perms[email]; ok { + return l + } + if role == "" { + return PermNone // not a member of the project's org + } + return p.level() +} + +// requirePerm answers the request itself when the caller is short of level. +func (s *Server) requirePerm(w http.ResponseWriter, r *http.Request, projectID, level string) bool { + if atLeast(s.projectPerm(r, projectID), level) { + return true + } + http.Error(w, permDenied(level), http.StatusForbidden) + return false +} + +// permDenied is the operator-voice 403 body. Deliberately one shape for every +// level so the frontend's errorFor keeps mapping it. +func permDenied(level string) string { + switch level { + case PermAdmin: + return "you need admin permission on this project" + case PermWrite: + return "you have read-only access to this project" + default: + return "you do not have access to this project" + } +} + +// ---- HTTP ---- + +// handleProjectPerms returns the project's permission settings: the default +// level, the caller's own effective level, and the explicit grants. Any member +// with read may look; the grants are org-internal, not secrets. +func (s *Server) handleProjectPerms(w http.ResponseWriter, r *http.Request) { + id := r.PathValue("project") + p, ok := s.project(w, r, id, PermRead) + if !ok { + return + } + grants := make([]map[string]string, 0, len(p.Perms)) + for email, level := range p.Perms { + grants = append(grants, map[string]string{"email": email, "level": level}) + } + sort.Slice(grants, func(i, j int) bool { return grants[i]["email"] < grants[j]["email"] }) + writeJSON(w, map[string]any{ + "default": p.level(), + "me": s.projectPerm(r, id), + "creator": p.Creator, + "grants": grants, + }) +} + +// handleProjectPermDefault sets the level every org member gets without an +// explicit grant. Admin only. "admin" is not a legal default: it would make +// the last-admin rule meaningless. +func (s *Server) handleProjectPermDefault(w http.ResponseWriter, r *http.Request) { + id := r.PathValue("project") + if _, ok := s.project(w, r, id, PermAdmin); !ok { + return + } + var req struct { + Default string `json:"default"` + } + if err := json.NewDecoder(io.LimitReader(r.Body, 1<<16)).Decode(&req); err != nil { + http.Error(w, "bad request: "+err.Error(), http.StatusBadRequest) + return + } + if !validLevel(req.Default) || req.Default == PermAdmin { + http.Error(w, "default must be none, read, or write", http.StatusBadRequest) + return + } + if err := s.Projects.SetDefault(id, req.Default); err != nil { + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + writeJSON(w, map[string]any{"ok": true}) +} + +// handleProjectPermSet grants one account an explicit level. Admin only. +func (s *Server) handleProjectPermSet(w http.ResponseWriter, r *http.Request) { + id := r.PathValue("project") + p, ok := s.project(w, r, id, PermAdmin) + if !ok { + return + } + var req struct { + Level string `json:"level"` + } + if err := json.NewDecoder(io.LimitReader(r.Body, 1<<16)).Decode(&req); err != nil { + http.Error(w, "bad request: "+err.Error(), http.StatusBadRequest) + return + } + if !validLevel(req.Level) { + http.Error(w, "level must be none, read, write, or admin", http.StatusBadRequest) + return + } + email := normEmail(r.PathValue("email")) + if !s.grantable(w, p, email) { + return + } + if err := s.Projects.SetPerm(id, email, req.Level); err != nil { + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + writeJSON(w, map[string]any{"ok": true}) +} + +// handleProjectPermClear drops an explicit grant, reverting that account to +// the project default. Admin only. +func (s *Server) handleProjectPermClear(w http.ResponseWriter, r *http.Request) { + id := r.PathValue("project") + if _, ok := s.project(w, r, id, PermAdmin); !ok { + return + } + if err := s.Projects.ClearPerm(id, normEmail(r.PathValue("email"))); err != nil { + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + writeJSON(w, map[string]any{"ok": true}) +} + +// grantable checks the target of a grant: org members only, and never an org +// owner (they are implicitly admin everywhere, so a grant on one would be +// silently ignored — and a write that quietly does nothing is worse than a +// refusal). +func (s *Server) grantable(w http.ResponseWriter, p Project, email string) bool { + if s.Dir == nil || p.Org == "" { + return true + } + switch s.Dir.Role(p.Org, email) { + case "": + http.Error(w, "that account is not a member of this project's organization", http.StatusBadRequest) + return false + case RoleOwner: + http.Error(w, "organization owners are always project admins", http.StatusBadRequest) + return false + } + return true +} + +// project resolves a project id and the caller's level in one step, answering +// the request itself when either fails. A missing project is 404; an existing +// one the caller may not touch is 403 — the same answer a non-member gets, so +// the two are indistinguishable from outside. +func (s *Server) project(w http.ResponseWriter, r *http.Request, id, level string) (Project, bool) { + if s.Projects == nil { + http.Error(w, "this server does not host projects", http.StatusNotFound) + return Project{}, false + } + p, ok := s.Projects.Get(id) + if !ok { + http.Error(w, "no such project", http.StatusNotFound) + return Project{}, false + } + if !s.requirePerm(w, r, id, level) { + return Project{}, false + } + return p, true +} diff --git a/internal/webapp/perms_test.go b/internal/webapp/perms_test.go new file mode 100644 index 0000000..c35fb1f --- /dev/null +++ b/internal/webapp/perms_test.go @@ -0,0 +1,359 @@ +package webapp + +import ( + "encoding/json" + "net/http" + "path/filepath" + "strings" + "testing" +) + +func TestPermRankAndAtLeast(t *testing.T) { + // An unknown level must fail closed — it is the answer for a corrupt + // grant, and reading it as anything but "none" would open a hole. + for _, l := range []string{"", "none", "bogus", "Admin"} { + if permRank(l) != 0 { + t.Errorf("permRank(%q) = %d, want 0", l, permRank(l)) + } + } + if !(permRank(PermRead) < permRank(PermWrite) && permRank(PermWrite) < permRank(PermAdmin)) { + t.Fatal("levels are not ordered read < write < admin") + } + if !atLeast(PermAdmin, PermWrite) || !atLeast(PermWrite, PermWrite) || atLeast(PermRead, PermWrite) { + t.Fatal("atLeast is wrong") + } +} + +// permHub builds an org hub where alice owns the org, bob and carol are plain +// members, and dave is in another org entirely. The project is alice's. +func permHub(t *testing.T) (h http.Handler, srv *Server, cookies map[string]*http.Cookie, p Project) { + t.Helper() + srv, _, _ = newHub(t, true, nil) + auth, err := OpenBuiltinAuth(filepath.Join(t.TempDir(), "auth.json"), true, nil) + if err != nil { + t.Fatal(err) + } + srv.Auth = auth + orgs, err := OpenOrgDB(filepath.Join(t.TempDir(), "orgs.json")) + if err != nil { + t.Fatal(err) + } + srv.Dir = LocalDirectory{OrgDB: orgs} + shares, err := OpenShareDB(filepath.Join(t.TempDir(), "shares.json")) + if err != nil { + t.Fatal(err) + } + srv.Shares = shares + h = srv.Handler() + + cookies = map[string]*http.Cookie{} + for _, who := range []string{"alice", "bob", "carol", "dave"} { + cookies[who] = signupAndSession(t, h, who+"@x.io", strings.ToUpper(who[:1])+who[1:], "password1") + } + + rec := doAs(t, h, "POST", "/api/projects", map[string]string{"name": "wiki"}, cookies["alice"]) + if rec.Code != 200 { + t.Fatalf("create project: %d %s", rec.Code, rec.Body) + } + var out struct { + Project Project `json:"project"` + } + json.Unmarshal(rec.Body.Bytes(), &out) + p = out.Project + for _, who := range []string{"bob", "carol"} { + if err := orgs.AddMember(p.Org, who+"@x.io", RoleMember); err != nil { + t.Fatal(err) + } + } + return h, srv, cookies, p +} + +// Nothing changes for an existing hub: with no permission edits, every org +// member still has full read+write on every project. +func TestDefaultIsWriteForEveryMember(t *testing.T) { + h, _, c, p := permHub(t) + if rec := doAs(t, h, "GET", "/api/p/"+p.ID+"/tree", nil, c["bob"]); rec.Code != 200 { + t.Fatalf("member read: %d %s", rec.Code, rec.Body) + } + if rec := doAs(t, h, "PUT", "/api/p/"+p.ID+"/store/object?key=journal/d.jsonl", []byte("{}"), c["bob"]); rec.Code == http.StatusForbidden { + t.Fatalf("member write refused by default: %s", rec.Body) + } + // and an outsider is still walled out + if rec := doAs(t, h, "GET", "/api/p/"+p.ID+"/tree", nil, c["dave"]); rec.Code != http.StatusForbidden { + t.Fatalf("outsider read: %d, want 403", rec.Code) + } +} + +// The creator of a project becomes its first admin — unless they are an org +// owner, who is implicitly admin and needs no grant. +func TestCreatorBecomesAdmin(t *testing.T) { + h, srv, c, p := permHub(t) + // alice created it as an org owner: implicit admin, no explicit grant. + if got, _ := srv.Projects.Get(p.ID); got.Creator != "alice@x.io" { + t.Fatalf("creator = %q, want alice@x.io", got.Creator) + } + // bob, a plain member, creates one: he gets the explicit admin grant. + rec := doAs(t, h, "POST", "/api/projects", map[string]any{"name": "bobs", "org": p.Org}, c["bob"]) + if rec.Code != 200 { + t.Fatalf("bob create: %d %s", rec.Code, rec.Body) + } + var out struct { + Project map[string]any `json:"project"` + } + json.Unmarshal(rec.Body.Bytes(), &out) + if out.Project["perm"] != PermAdmin { + t.Fatalf("creator's own level = %v, want admin", out.Project["perm"]) + } + bp, _ := srv.Projects.Get(out.Project["id"].(string)) + if bp.Perms["bob@x.io"] != PermAdmin { + t.Fatalf("creator grant = %+v", bp.Perms) + } + // and a plain member who is a project admin can rename and delete it — + // this used to be org-owner-only. + id := out.Project["id"].(string) + if rec := doAs(t, h, "PATCH", "/api/projects/"+id, map[string]string{"name": "bobs2"}, c["bob"]); rec.Code != 200 { + t.Fatalf("project admin rename: %d %s", rec.Code, rec.Body) + } + if rec := doAs(t, h, "DELETE", "/api/projects/"+id, nil, c["bob"]); rec.Code != 200 { + t.Fatalf("project admin delete: %d %s", rec.Code, rec.Body) + } +} + +// A read grant admits every read route and refuses every write route. +func TestReadOnlyMemberRoutes(t *testing.T) { + h, srv, c, p := permHub(t) + if err := srv.Projects.SetPerm(p.ID, "bob@x.io", PermRead); err != nil { + t.Fatal(err) + } + base := "/api/p/" + p.ID + "/" + writes := []struct { + method, url string + body any + }{ + {"POST", base + "upload/init", map[string]any{"path": "x.md", "sha256": strings.Repeat("a", 64), "size": 1}}, + {"PUT", base + "upload/content?path=x.md", []byte("hi")}, + {"POST", base + "upload/commit", map[string]any{"path": "x.md", "sha256": strings.Repeat("a", 64), "size": 1}}, + {"PUT", base + "store/object?key=journal/d.jsonl", []byte("{}")}, + {"POST", base + "store/sign", map[string]any{"key": "blobs/" + strings.Repeat("a", 64), "size": 1}}, + {"POST", base + "shares", map[string]string{"path": "x.md"}}, + {"PATCH", "/api/projects/" + p.ID, map[string]string{"name": "nope"}}, + {"DELETE", "/api/projects/" + p.ID, nil}, + {"PUT", base + "permissions", map[string]string{"default": "read"}}, + {"PUT", base + "permissions/carol@x.io", map[string]string{"level": "read"}}, + {"DELETE", base + "permissions/carol@x.io", nil}, + } + for _, rt := range writes { + if rec := doAs(t, h, rt.method, rt.url, rt.body, c["bob"]); rec.Code != http.StatusForbidden { + t.Errorf("%s %s as read-only: %d, want 403", rt.method, rt.url, rec.Code) + } + } + reads := []struct{ method, url string }{ + {"GET", base + "tree"}, + {"GET", base + "file?path=x.md"}, + {"GET", base + "download?path=x.md"}, + {"GET", base + "render?path=x.md"}, + {"GET", base + "history"}, + {"GET", base + "blob?sha=" + strings.Repeat("a", 64)}, + {"GET", base + "heat"}, + {"GET", base + "shares"}, + {"GET", base + "store/list?prefix=journal/"}, + {"GET", base + "store/object?key=journal/d.jsonl"}, + {"GET", base + "store/exists?key=journal/d.jsonl"}, + {"GET", base + "permissions"}, + } + for _, rt := range reads { + if rec := doAs(t, h, rt.method, rt.url, nil, c["bob"]); rec.Code == http.StatusForbidden { + t.Errorf("%s %s as read-only: 403, want access (%s)", rt.method, rt.url, rec.Body) + } + } + if rec := doAs(t, h, "POST", base+"reads", map[string]any{"reads": []any{}}, c["bob"]); rec.Code == http.StatusForbidden { + t.Errorf("read report as read-only: 403, want access") + } + // a read member still sees the project and can open it + if rec := doAs(t, h, "GET", "/api/projects", nil, c["bob"]); !strings.Contains(rec.Body.String(), p.ID) { + t.Error("read-only member does not see the project in the list") + } +} + +// A none grant is treated exactly like a non-member: hidden from the list, +// 403 everywhere. +func TestNoAccessMemberIsInvisible(t *testing.T) { + h, srv, c, p := permHub(t) + if err := srv.Projects.SetPerm(p.ID, "bob@x.io", PermNone); err != nil { + t.Fatal(err) + } + base := "/api/p/" + p.ID + "/" + for _, url := range []string{"tree", "history", "heat", "shares", "permissions", "store/list?prefix=journal/"} { + if rec := doAs(t, h, "GET", base+url, nil, c["bob"]); rec.Code != http.StatusForbidden { + t.Errorf("GET %s as none: %d, want 403", url, rec.Code) + } + } + if rec := doAs(t, h, "GET", "/api/projects", nil, c["bob"]); strings.Contains(rec.Body.String(), p.ID) { + t.Error("a none member sees the project in the list") + } + // create-or-join by name must not hand the id back either + if rec := doAs(t, h, "POST", "/api/projects", map[string]any{"name": p.Name, "org": p.Org}, c["bob"]); rec.Code != http.StatusForbidden { + t.Errorf("join-by-name as none: %d, want 403", rec.Code) + } + // carol, with no explicit grant, is unaffected + if rec := doAs(t, h, "GET", base+"tree", nil, c["carol"]); rec.Code != 200 { + t.Errorf("carol: %d %s", rec.Code, rec.Body) + } +} + +// Default none makes a project invite-only: only explicit grants and org +// owners get in. +func TestInviteOnlyDefault(t *testing.T) { + h, srv, c, p := permHub(t) + if rec := doAs(t, h, "PUT", "/api/p/"+p.ID+"/permissions", map[string]string{"default": "none"}, c["alice"]); rec.Code != 200 { + t.Fatalf("set default: %d %s", rec.Code, rec.Body) + } + if err := srv.Projects.SetPerm(p.ID, "bob@x.io", PermRead); err != nil { + t.Fatal(err) + } + base := "/api/p/" + p.ID + "/tree" + if rec := doAs(t, h, "GET", base, nil, c["carol"]); rec.Code != http.StatusForbidden { + t.Errorf("carol with default none: %d, want 403", rec.Code) + } + if rec := doAs(t, h, "GET", base, nil, c["bob"]); rec.Code != 200 { + t.Errorf("bob with an explicit read grant: %d %s", rec.Code, rec.Body) + } + if rec := doAs(t, h, "GET", base, nil, c["alice"]); rec.Code != 200 { + t.Errorf("org owner locked out by default none: %d", rec.Code) + } + // admin is not a legal default + if rec := doAs(t, h, "PUT", "/api/p/"+p.ID+"/permissions", map[string]string{"default": "admin"}, c["alice"]); rec.Code != http.StatusBadRequest { + t.Errorf("default admin: %d, want 400", rec.Code) + } +} + +// An org owner always resolves to admin, whatever the grant list says, and a +// grant naming one is refused rather than silently ignored. +func TestOrgOwnerAlwaysAdmin(t *testing.T) { + h, srv, c, p := permHub(t) + if err := srv.Projects.SetPerm(p.ID, "bob@x.io", PermAdmin); err != nil { + t.Fatal(err) + } + // bob (a project admin) tries to cut alice, the org owner, out + rec := doAs(t, h, "PUT", "/api/p/"+p.ID+"/permissions/alice@x.io", map[string]string{"level": "none"}, c["bob"]) + if rec.Code != http.StatusBadRequest { + t.Fatalf("grant on an org owner: %d, want 400", rec.Code) + } + if rec := doAs(t, h, "GET", "/api/p/"+p.ID+"/tree", nil, c["alice"]); rec.Code != 200 { + t.Fatalf("org owner locked out: %d", rec.Code) + } + // even a hand-written grant in storage cannot outrank her + if err := srv.Projects.SetPerm(p.ID, "alice@x.io", PermNone); err != nil { + t.Fatal(err) + } + if rec := doAs(t, h, "DELETE", "/api/projects/"+p.ID, nil, c["alice"]); rec.Code != 200 { + t.Fatalf("org owner delete after a none grant: %d %s", rec.Code, rec.Body) + } +} + +// The last explicit admin cannot be removed or demoted — including by +// themselves. +func TestLastProjectAdminHeld(t *testing.T) { + h, srv, c, p := permHub(t) + if err := srv.Projects.SetPerm(p.ID, "bob@x.io", PermAdmin); err != nil { + t.Fatal(err) + } + for _, tc := range []struct { + method, url string + body any + }{ + {"PUT", "/api/p/" + p.ID + "/permissions/bob@x.io", map[string]string{"level": "none"}}, + {"PUT", "/api/p/" + p.ID + "/permissions/bob@x.io", map[string]string{"level": "read"}}, + {"DELETE", "/api/p/" + p.ID + "/permissions/bob@x.io", nil}, + } { + if rec := doAs(t, h, tc.method, tc.url, tc.body, c["bob"]); rec.Code != http.StatusBadRequest { + t.Errorf("%s %s: %d, want 400", tc.method, tc.url, rec.Code) + } + if got, _ := srv.Projects.Get(p.ID); got.Perms["bob@x.io"] != PermAdmin { + t.Fatalf("last admin changed anyway: %+v", got.Perms) + } + } + // with a second admin, the first can step down + if rec := doAs(t, h, "PUT", "/api/p/"+p.ID+"/permissions/carol@x.io", map[string]string{"level": "admin"}, c["bob"]); rec.Code != 200 { + t.Fatalf("grant second admin: %d %s", rec.Code, rec.Body) + } + if rec := doAs(t, h, "DELETE", "/api/p/"+p.ID+"/permissions/bob@x.io", nil, c["bob"]); rec.Code != 200 { + t.Fatalf("step down with another admin present: %d %s", rec.Code, rec.Body) + } +} + +// Grants are org members only. +func TestGrantsAreOrgMembersOnly(t *testing.T) { + h, _, c, p := permHub(t) + rec := doAs(t, h, "PUT", "/api/p/"+p.ID+"/permissions/dave@x.io", map[string]string{"level": "read"}, c["alice"]) + if rec.Code != http.StatusBadRequest { + t.Fatalf("grant to a non-member: %d, want 400", rec.Code) + } + rec = doAs(t, h, "PUT", "/api/p/"+p.ID+"/permissions/bob@x.io", map[string]string{"level": "bogus"}, c["alice"]) + if rec.Code != http.StatusBadRequest { + t.Fatalf("unknown level: %d, want 400", rec.Code) + } +} + +// GET /permissions reports the default, the caller's own level, and grants. +func TestPermissionsGET(t *testing.T) { + h, srv, c, p := permHub(t) + if err := srv.Projects.SetPerm(p.ID, "bob@x.io", PermRead); err != nil { + t.Fatal(err) + } + rec := doAs(t, h, "GET", "/api/p/"+p.ID+"/permissions", nil, c["bob"]) + if rec.Code != 200 { + t.Fatalf("GET permissions as a read member: %d %s", rec.Code, rec.Body) + } + var out struct { + Default string `json:"default"` + Me string `json:"me"` + Grants []map[string]string `json:"grants"` + } + json.Unmarshal(rec.Body.Bytes(), &out) + if out.Default != PermWrite || out.Me != PermRead { + t.Fatalf("default=%q me=%q, want write/read", out.Default, out.Me) + } + if len(out.Grants) != 1 || out.Grants[0]["email"] != "bob@x.io" { + t.Fatalf("grants = %+v", out.Grants) + } +} + +// The project list carries the caller's level *alongside* every ordinary +// Project field. Regression guard: an earlier version hand-listed the fields +// it returned, which silently dropped description and icon the moment those +// were added — the client saw a project with no metadata and no error. +func TestProjectListCarriesWholeProject(t *testing.T) { + h, srv, c, p := permHub(t) + desc, icon := "everything support needs", "book-open" + if err := srv.Projects.Update(p.ID, nil, &desc, &icon); err != nil { + t.Fatal(err) + } + rec := doAs(t, h, "GET", "/api/projects", nil, c["alice"]) + var out struct { + Projects []map[string]any `json:"projects"` + } + if err := json.Unmarshal(rec.Body.Bytes(), &out); err != nil { + t.Fatal(err) + } + var row map[string]any + for _, r := range out.Projects { + if r["id"] == p.ID { + row = r + } + } + if row == nil { + t.Fatalf("project missing from the list: %s", rec.Body) + } + for key, want := range map[string]any{ + "name": p.Name, "description": desc, "icon": icon, "perm": PermAdmin, + } { + if row[key] != want { + t.Errorf("list row %q = %v, want %v", key, row[key], want) + } + } + // The grant list is not list-response material — /permissions owns it. + if _, leaked := row["perms"]; leaked { + t.Errorf("grant list leaked into the project list: %v", row["perms"]) + } +} diff --git a/internal/webapp/projects.go b/internal/webapp/projects.go index 4fe5e2c..fea9a68 100644 --- a/internal/webapp/projects.go +++ b/internal/webapp/projects.go @@ -22,6 +22,23 @@ type Project struct { Created time.Time `json:"created"` Description string `json:"description,omitempty"` // optional one-line subtitle Icon string `json:"icon,omitempty"` // optional lucide icon name + // Creator is the account that first created the project; it gets an + // explicit admin grant at creation. Empty on projects that predate + // per-project permissions — those are governed by org owners. + Creator string `json:"creator,omitempty"` + // Default is the level every org member gets without an explicit grant. + // Empty means write: the historical behavior, so no row needs migrating. + Default string `json:"default,omitempty"` + // Perms are the explicit grants, lowercase email → level. + Perms map[string]string `json:"perms,omitempty"` +} + +// level is the project's effective default level for org members. +func (p Project) level() string { + if p.Default == "" { + return PermWrite + } + return p.Default } var projectIDRe = regexp.MustCompile(`^p-[0-9a-f]{8}$`) @@ -188,6 +205,103 @@ func (db *ProjectDB) Delete(id string) error { return db.repo.Delete(id) } +// SetCreator records who created a project (and is its first admin). +func (db *ProjectDB) SetCreator(id, email string) error { + db.mu.Lock() + defer db.mu.Unlock() + p, ok := db.byID[id] + if !ok { + return fmt.Errorf("no such project %q", id) + } + p.Creator = normEmail(email) + db.byID[id] = p + return db.repo.Put(p) +} + +// SetDefault sets the level org members get without an explicit grant. +func (db *ProjectDB) SetDefault(id, level string) error { + if !validLevel(level) || level == PermAdmin { + return fmt.Errorf("invalid default level %q", level) + } + db.mu.Lock() + defer db.mu.Unlock() + p, ok := db.byID[id] + if !ok { + return fmt.Errorf("no such project %q", id) + } + p.Default = level + db.byID[id] = p + return db.repo.Put(p) +} + +// SetPerm grants one account an explicit level on the project. Demoting the +// last explicit admin is refused, the same shape as OrgDB's last-owner rule: +// a project must keep someone who can administer it (org owners aside, who +// are implicitly admin and never appear in this list). +func (db *ProjectDB) SetPerm(id, email, level string) error { + if !validLevel(level) { + return fmt.Errorf("invalid level %q", level) + } + e := normEmail(email) + if e == "" { + return fmt.Errorf("email must not be empty") + } + db.mu.Lock() + defer db.mu.Unlock() + p, ok := db.byID[id] + if !ok { + return fmt.Errorf("no such project %q", id) + } + if level != PermAdmin && p.Perms[e] == PermAdmin && adminCount(p) <= 1 { + return fmt.Errorf("cannot demote the last project admin") + } + perms := make(map[string]string, len(p.Perms)+1) + for k, v := range p.Perms { + perms[k] = v + } + perms[e] = level + p.Perms = perms + db.byID[id] = p + return db.repo.Put(p) +} + +// ClearPerm drops an explicit grant, reverting the account to the default. +func (db *ProjectDB) ClearPerm(id, email string) error { + e := normEmail(email) + db.mu.Lock() + defer db.mu.Unlock() + p, ok := db.byID[id] + if !ok { + return fmt.Errorf("no such project %q", id) + } + if _, has := p.Perms[e]; !has { + return fmt.Errorf("%s has no permission set on this project", email) + } + if p.Perms[e] == PermAdmin && adminCount(p) <= 1 { + return fmt.Errorf("cannot remove the last project admin") + } + perms := make(map[string]string, len(p.Perms)) + for k, v := range p.Perms { + if k != e { + perms[k] = v + } + } + p.Perms = perms + db.byID[id] = p + return db.repo.Put(p) +} + +// adminCount counts explicit admin grants on a project. +func adminCount(p Project) int { + n := 0 + for _, l := range p.Perms { + if l == PermAdmin { + n++ + } + } + return n +} + // SetOrg moves a project into an org (used by the startup migration). func (db *ProjectDB) SetOrg(id, org string) error { db.mu.Lock() diff --git a/internal/webapp/server.go b/internal/webapp/server.go index a453aa8..b954453 100644 --- a/internal/webapp/server.go +++ b/internal/webapp/server.go @@ -19,9 +19,9 @@ package webapp import ( "context" - "errors" "embed" "encoding/json" + "errors" "fmt" "io" "io/fs" @@ -292,7 +292,9 @@ func (s *Server) Handler() http.Handler { // Volume resolution per route family: fixed single volume, or by // project id in hub mode. One handler implementation serves both. - single := func(h func(*volume, http.ResponseWriter, *http.Request)) http.HandlerFunc { + // Single-volume mode has no per-project permissions, so it ignores the + // declared level; hub mode enforces it. + single := func(_ string, h func(*volume, http.ResponseWriter, *http.Request)) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { if s.Source == nil { http.Error(w, "this server hosts projects; use /api/p//...", http.StatusNotFound) @@ -301,7 +303,7 @@ func (s *Server) Handler() http.Handler { h(s.single(), w, r) } } - proj := func(h func(*volume, http.ResponseWriter, *http.Request)) http.HandlerFunc { + proj := func(level string, h func(*volume, http.ResponseWriter, *http.Request)) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { id := r.PathValue("project") v, err := s.projectVolume(id) @@ -309,12 +311,11 @@ func (s *Server) Handler() http.Handler { http.Error(w, err.Error(), http.StatusNotFound) return } - if !s.projectAllowed(r, id) { - http.Error(w, "you are not a member of this project's organization", http.StatusForbidden) + if !s.requirePerm(w, r, id, level) { return } // Read recording (and anything else downstream) finds the project - // id in the context; membership has already passed at this point. + // id in the context; permission has already passed at this point. h(v, w, withProjectID(r, id)) } } @@ -324,17 +325,17 @@ func (s *Server) Handler() http.Handler { mux.HandleFunc("POST /api/projects", s.handleProjectCreate) mux.HandleFunc("GET /api/projects/{project}", s.handleProjectGet) - for prefix, resolve := range map[string]func(func(*volume, http.ResponseWriter, *http.Request)) http.HandlerFunc{ + for prefix, resolve := range map[string]func(string, func(*volume, http.ResponseWriter, *http.Request)) http.HandlerFunc{ "/api/": single, "/api/p/{project}/": proj, } { - mux.HandleFunc("GET "+prefix+"tree", resolve(s.handleTree)) - mux.HandleFunc("GET "+prefix+"file", resolve(s.handleFile)) - mux.HandleFunc("GET "+prefix+"download", resolve(s.handleDownload)) - mux.HandleFunc("GET "+prefix+"render", resolve(s.handleRender)) - mux.HandleFunc("POST "+prefix+"upload/init", resolve(s.handleUploadInit)) - mux.HandleFunc("PUT "+prefix+"upload/content", resolve(s.handleUploadContent)) - mux.HandleFunc("POST "+prefix+"upload/commit", resolve(s.handleUploadCommit)) + mux.HandleFunc("GET "+prefix+"tree", resolve(PermRead, s.handleTree)) + mux.HandleFunc("GET "+prefix+"file", resolve(PermRead, s.handleFile)) + mux.HandleFunc("GET "+prefix+"download", resolve(PermRead, s.handleDownload)) + mux.HandleFunc("GET "+prefix+"render", resolve(PermRead, s.handleRender)) + mux.HandleFunc("POST "+prefix+"upload/init", resolve(PermWrite, s.handleUploadInit)) + mux.HandleFunc("PUT "+prefix+"upload/content", resolve(PermWrite, s.handleUploadContent)) + mux.HandleFunc("POST "+prefix+"upload/commit", resolve(PermWrite, s.handleUploadCommit)) } mux.HandleFunc("GET /api/orgs", s.handleOrgList) @@ -356,22 +357,28 @@ func (s *Server) Handler() http.Handler { mux.HandleFunc("POST /api/admin/pending/{id}/approve", s.handleAdminApprove) mux.HandleFunc("POST /api/admin/pending/{id}/deny", s.handleAdminDeny) - mux.HandleFunc("GET /api/p/{project}/history", proj(s.handleHistory)) - mux.HandleFunc("GET /api/p/{project}/blob", proj(s.handleBlob)) - mux.HandleFunc("GET /api/p/{project}/heat", proj(s.handleHeat)) - mux.HandleFunc("POST /api/p/{project}/reads", proj(s.handleReadReport)) - mux.HandleFunc("POST /api/p/{project}/shares", proj(s.handleShareCreate)) - mux.HandleFunc("GET /api/p/{project}/shares", proj(s.handleShareList)) + mux.HandleFunc("GET /api/p/{project}/history", proj(PermRead, s.handleHistory)) + mux.HandleFunc("GET /api/p/{project}/blob", proj(PermRead, s.handleBlob)) + mux.HandleFunc("GET /api/p/{project}/heat", proj(PermRead, s.handleHeat)) + mux.HandleFunc("POST /api/p/{project}/reads", proj(PermRead, s.handleReadReport)) + mux.HandleFunc("POST /api/p/{project}/shares", proj(PermWrite, s.handleShareCreate)) + mux.HandleFunc("GET /api/p/{project}/shares", proj(PermRead, s.handleShareList)) mux.HandleFunc("DELETE /api/shares/{token}", s.handleShareRevoke) mux.HandleFunc("GET /s/{token}", s.handleShared) + mux.HandleFunc("GET /api/p/{project}/permissions", s.handleProjectPerms) + mux.HandleFunc("PUT /api/p/{project}/permissions", s.handleProjectPermDefault) + mux.HandleFunc("PUT /api/p/{project}/permissions/{email}", s.handleProjectPermSet) + mux.HandleFunc("DELETE /api/p/{project}/permissions/{email}", s.handleProjectPermClear) + // The sync (store) API only exists per project: hub mode is what - // storage-blind devices sync through. - mux.HandleFunc("GET /api/p/{project}/store/list", proj(s.handleStoreList)) - mux.HandleFunc("GET /api/p/{project}/store/object", proj(s.handleStoreGet)) - mux.HandleFunc("GET /api/p/{project}/store/exists", proj(s.handleStoreExists)) - mux.HandleFunc("POST /api/p/{project}/store/sign", proj(s.handleStoreSign)) - mux.HandleFunc("PUT /api/p/{project}/store/object", proj(s.handleStorePut)) + // storage-blind devices sync through. Reading the store is how a + // pull-only (read) device stays current; writing needs write. + mux.HandleFunc("GET /api/p/{project}/store/list", proj(PermRead, s.handleStoreList)) + mux.HandleFunc("GET /api/p/{project}/store/object", proj(PermRead, s.handleStoreGet)) + mux.HandleFunc("GET /api/p/{project}/store/exists", proj(PermRead, s.handleStoreExists)) + mux.HandleFunc("POST /api/p/{project}/store/sign", proj(PermWrite, s.handleStoreSign)) + mux.HandleFunc("PUT /api/p/{project}/store/object", proj(PermWrite, s.handleStorePut)) mux.Handle("GET /", s.frontend(static)) if s.Auth != nil { @@ -479,27 +486,48 @@ func (s *Server) handleProjectList(w http.ResponseWriter, r *http.Request) { http.Error(w, "this server does not host projects", http.StatusNotFound) return } - list := s.Projects.List() - visible := make([]Project, 0, len(list)) - for _, p := range list { - if s.projectAllowed(r, p.ID) { - visible = append(visible, p) + // Each row carries the caller's own level, so the frontend can hide write + // affordances without a second fetch per project on every render. + visible := []projectView{} + for _, p := range s.Projects.List() { + perm := s.projectPerm(r, p.ID) + if !atLeast(perm, PermRead) { + continue } + visible = append(visible, projectJSON(p, perm)) } writeJSON(w, map[string]any{"projects": visible}) } +// projectJSON renders a project for the API with the caller's effective level. +// projectView is a Project plus the caller's own effective level on it. +// It embeds rather than re-listing fields on purpose: hand-listing them means +// every new Project field silently fails to reach the client until someone +// remembers to add it here. +type projectView struct { + Project + Perm string `json:"perm"` +} + +func projectJSON(p Project, perm string) projectView { + // The grant list and the default belong to /api/p/{id}/permissions, which + // has its own gate; they'd be noise on every row of every project list. + p.Perms, p.Default = nil, "" + return projectView{p, perm} +} + func (s *Server) handleProjectGet(w http.ResponseWriter, r *http.Request) { if s.Projects == nil { http.Error(w, "this server does not host projects", http.StatusNotFound) return } p, ok := s.Projects.Get(r.PathValue("project")) - if !ok || !s.projectAllowed(r, p.ID) { + perm := s.projectPerm(r, p.ID) + if !ok || !atLeast(perm, PermRead) { http.Error(w, "no such project", http.StatusNotFound) return } - writeJSON(w, p) + writeJSON(w, projectJSON(p, perm)) } // handleProjectCreate creates a project by name, or returns the existing one @@ -539,7 +567,33 @@ func (s *Server) handleProjectCreate(w http.ResponseWriter, r *http.Request) { http.Error(w, err.Error(), http.StatusBadRequest) return } - writeJSON(w, map[string]any{"project": p, "created": created}) + if created { + // The creator is the project's first admin. Both writes are + // best-effort in the sense that a failure leaves a usable project + // governed by org owners — but report it rather than lie. + me := normEmail(s.requestUser(r).Email) + if me != "" { + if err := s.Projects.SetCreator(p.ID, me); err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + // An org owner is already implicitly admin; an explicit grant on + // one is refused elsewhere, so don't write one here either. + if s.Dir == nil || org == "" || s.Dir.Role(org, me) != RoleOwner { + if err := s.Projects.SetPerm(p.ID, me, PermAdmin); err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + } + p, _ = s.Projects.Get(p.ID) + } + } else if !atLeast(s.projectPerm(r, p.ID), PermRead) { + // GetOrCreate is create-or-join by name: without this, POSTing the + // name of a project you've been cut off from would hand back its id. + http.Error(w, permDenied(PermRead), http.StatusForbidden) + return + } + writeJSON(w, map[string]any{"project": projectJSON(p, s.projectPerm(r, p.ID)), "created": created}) } // orgForCreate resolves which org a new project lands in: the explicitly diff --git a/internal/webapp/shares.go b/internal/webapp/shares.go index 4e78e25..0b6df2d 100644 --- a/internal/webapp/shares.go +++ b/internal/webapp/shares.go @@ -190,9 +190,11 @@ func (s *Server) handleShareRevoke(w http.ResponseWriter, r *http.Request) { http.Error(w, "sharing is not enabled on this server", http.StatusNotFound) return } + // This route is /api/shares/{token} — outside the proj() wrapper — so the + // level check lives here: minting and killing public links are the same + // authority. sh, ok := s.Shares.Get(r.PathValue("token")) - if ok && !s.projectAllowed(r, sh.Project) { - http.Error(w, "you are not a member of this project's organization", http.StatusForbidden) + if ok && !s.requirePerm(w, r, sh.Project, PermWrite) { return } if s.Shares.Revoke(r.PathValue("token")) { diff --git a/internal/webapp/static/assets/index-FkLsvBWJ.css b/internal/webapp/static/assets/index-C9MMaLMG.css similarity index 66% rename from internal/webapp/static/assets/index-FkLsvBWJ.css rename to internal/webapp/static/assets/index-C9MMaLMG.css index 3a0ab94..9ca55ff 100644 --- a/internal/webapp/static/assets/index-FkLsvBWJ.css +++ b/internal/webapp/static/assets/index-C9MMaLMG.css @@ -1 +1 @@ -@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-duration:initial;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0}}}@layer theme{:root,:host{--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-lg:32rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--font-weight-medium:500;--font-weight-semibold:600;--tracking-widest:.1em;--radius-xs:.125rem;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--color-background:#0a0b0d;--color-foreground:#eef0f3;--color-card:#15171b;--color-card-foreground:#eef0f3;--color-popover:#15171b;--color-popover-foreground:#eef0f3;--color-primary:#f5a623;--color-primary-foreground:#1a1204;--color-secondary:#ffffff08;--color-secondary-foreground:#eef0f3;--color-muted:#ffffff0f;--color-muted-foreground:#9aa0a9;--color-accent:#ffffff0f;--color-accent-foreground:#eef0f3;--color-destructive:#f26d6d;--color-border:#ffffff12;--color-input:#ffffff1c;--color-ring:#f5a623;--radius-ctl:7px}}@layer base,components;@layer utilities{.\@container\/card-header{container:card-header/inline-size}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:0}.top-4{top:calc(var(--spacing) * 4)}.top-20{top:calc(var(--spacing) * 20)}.top-\[50\%\]{top:50%}.right-2{right:calc(var(--spacing) * 2)}.right-4{right:calc(var(--spacing) * 4)}.left-2{left:calc(var(--spacing) * 2)}.left-\[50\%\]{left:50%}.z-50{z-index:50}.col-start-2{grid-column-start:2}.row-span-2{grid-row:span 2/span 2}.row-start-1{grid-row-start:1}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-1{margin-inline:calc(var(--spacing) * -1)}.my-1{margin-block:var(--spacing)}.mt-4{margin-top:calc(var(--spacing) * 4)}.ml-auto{margin-left:auto}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.table{display:table}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-row{display:table-row}.field-sizing-content{field-sizing:content}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-2\.5{width:calc(var(--spacing) * 2.5);height:calc(var(--spacing) * 2.5)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-9{width:calc(var(--spacing) * 9);height:calc(var(--spacing) * 9)}.size-10{width:calc(var(--spacing) * 10);height:calc(var(--spacing) * 10)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-full{height:100%}.h-px{height:1px}.max-h-\(--radix-dropdown-menu-content-available-height\){max-height:var(--radix-dropdown-menu-content-available-height)}.max-h-\(--radix-select-content-available-height\){max-height:var(--radix-select-content-available-height)}.max-h-\[300px\]{max-height:300px}.min-h-16{min-height:calc(var(--spacing) * 16)}.w-fit{width:fit-content}.w-full{width:100%}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.min-w-0{min-width:0}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.shrink-0{flex-shrink:0}.caption-bottom{caption-side:bottom}.origin-\(--radix-dropdown-menu-content-transform-origin\){transform-origin:var(--radix-dropdown-menu-content-transform-origin)}.origin-\(--radix-select-content-transform-origin\){transform-origin:var(--radix-select-content-transform-origin)}.origin-\(--radix-tooltip-content-transform-origin\){transform-origin:var(--radix-tooltip-content-transform-origin)}.translate-x-\[-50\%\]{--tw-translate-x:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[-50\%\]{--tw-translate-y:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[calc\(-50\%_-_2px\)\]{--tw-translate-y: calc(-50% - 2px) ;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-45{rotate:45deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-in{animation:enter var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.resize{resize:both}.scroll-my-1{scroll-margin-block:var(--spacing)}.scroll-py-1{scroll-padding-block:var(--spacing)}.auto-rows-min{grid-auto-rows:min-content}.grid-rows-\[auto_auto\]{grid-template-rows:auto auto}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.self-start{align-self:flex-start}.justify-self-end{justify-self:flex-end}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded-\[2px\]{border-radius:2px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-xs{border-radius:var(--radius-xs)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-input{border-color:var(--color-input)}.bg-background{background-color:var(--color-background)}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-border{background-color:var(--color-border)}.bg-card{background-color:var(--color-card)}.bg-destructive{background-color:var(--color-destructive)}.bg-foreground{background-color:var(--color-foreground)}.bg-muted\/50{background-color:#ffffff08}@supports (color:color-mix(in lab,red,red)){.bg-muted\/50{background-color:color-mix(in oklab,var(--color-muted) 50%,transparent)}}.bg-popover{background-color:var(--color-popover)}.bg-primary{background-color:var(--color-primary)}.bg-secondary{background-color:var(--color-secondary)}.bg-transparent{background-color:#0000}.fill-current{fill:currentColor}.fill-foreground{fill:var(--color-foreground)}.p-0{padding:0}.p-1{padding:var(--spacing)}.p-2{padding:calc(var(--spacing) * 2)}.p-6{padding:calc(var(--spacing) * 6)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-6{padding-block:calc(var(--spacing) * 6)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-8{padding-left:calc(var(--spacing) * 8)}.text-center{text-align:center}.text-left{text-align:left}.align-middle{vertical-align:middle}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-none{--tw-leading:1;line-height:1}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.text-balance{text-wrap:balance}.whitespace-nowrap{white-space:nowrap}.text-background{color:var(--color-background)}.text-card-foreground{color:var(--color-card-foreground)}.text-destructive{color:var(--color-destructive)}.text-foreground{color:var(--color-foreground)}.text-muted-foreground{color:var(--color-muted-foreground)}.text-popover-foreground{color:var(--color-popover-foreground)}.text-primary{color:var(--color-primary)}.text-primary-foreground{color:var(--color-primary-foreground)}.text-secondary-foreground{color:var(--color-secondary-foreground)}.text-white{color:var(--color-white)}.capitalize{text-transform:capitalize}.underline-offset-4{text-underline-offset:4px}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-offset-background{--tw-ring-offset-color:var(--color-background)}.outline-hidden{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.outline-hidden{outline-offset:2px;outline:2px solid #0000}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[background-color\,border-color\,color\]{transition-property:background-color,border-color,color;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[color\,box-shadow\]{transition-property:color,box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.fade-in-0{--tw-enter-opacity:0}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.zoom-in-95{--tw-enter-scale:.95}.running{animation-play-state:running}.group-data-\[disabled\=true\]\:pointer-events-none:is(:where(.group)[data-disabled=true] *){pointer-events:none}.group-data-\[disabled\=true\]\:opacity-50:is(:where(.group)[data-disabled=true] *){opacity:.5}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-50:is(:where(.peer):disabled~*){opacity:.5}.selection\:bg-primary ::selection{background-color:var(--color-primary)}.selection\:bg-primary::selection{background-color:var(--color-primary)}.selection\:text-primary-foreground ::selection{color:var(--color-primary-foreground)}.selection\:text-primary-foreground::selection{color:var(--color-primary-foreground)}.file\:inline-flex::file-selector-button{display:inline-flex}.file\:h-7::file-selector-button{height:calc(var(--spacing) * 7)}.file\:border-0::file-selector-button{border-style:var(--tw-border-style);border-width:0}.file\:bg-transparent::file-selector-button{background-color:#0000}.file\:text-sm::file-selector-button{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.file\:font-medium::file-selector-button{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.file\:text-foreground::file-selector-button{color:var(--color-foreground)}.placeholder\:text-muted-foreground::placeholder{color:var(--color-muted-foreground)}@media(hover:hover){.hover\:bg-accent:hover{background-color:var(--color-accent)}.hover\:bg-destructive\/90:hover{background-color:#f26d6de6}@supports (color:color-mix(in lab,red,red)){.hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab,var(--color-destructive) 90%,transparent)}}.hover\:bg-muted\/50:hover{background-color:#ffffff08}@supports (color:color-mix(in lab,red,red)){.hover\:bg-muted\/50:hover{background-color:color-mix(in oklab,var(--color-muted) 50%,transparent)}}.hover\:bg-primary\/90:hover{background-color:#f5a623e6}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,var(--color-primary) 90%,transparent)}}.hover\:bg-secondary\/80:hover{background-color:#ffffff06}@supports (color:color-mix(in lab,red,red)){.hover\:bg-secondary\/80:hover{background-color:color-mix(in oklab,var(--color-secondary) 80%,transparent)}}.hover\:text-accent-foreground:hover{color:var(--color-accent-foreground)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}}.focus\:bg-accent:focus{background-color:var(--color-accent)}.focus\:text-accent-foreground:focus{color:var(--color-accent-foreground)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-ring:focus{--tw-ring-color:var(--color-ring)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus\:outline-hidden:focus{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.focus\:outline-hidden:focus{outline-offset:2px;outline:2px solid #0000}}.focus-visible\:border-ring:focus-visible{border-color:var(--color-ring)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-destructive\/20:focus-visible{--tw-ring-color:#f26d6d33}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-destructive\/20:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-destructive) 20%, transparent)}}.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:#f5a62380}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-ring) 50%, transparent)}}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.has-aria-expanded\:bg-muted\/50:has([aria-expanded=true]){background-color:#ffffff08}@supports (color:color-mix(in lab,red,red)){.has-aria-expanded\:bg-muted\/50:has([aria-expanded=true]){background-color:color-mix(in oklab,var(--color-muted) 50%,transparent)}}.has-data-\[slot\=card-action\]\:grid-cols-\[1fr_auto\]:has([data-slot=card-action]){grid-template-columns:1fr auto}.has-\[\>svg\]\:px-1\.5:has(>svg){padding-inline:calc(var(--spacing) * 1.5)}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-inline:calc(var(--spacing) * 2.5)}.has-\[\>svg\]\:px-3:has(>svg){padding-inline:calc(var(--spacing) * 3)}.has-\[\>svg\]\:px-4:has(>svg){padding-inline:calc(var(--spacing) * 4)}.aria-invalid\:border-destructive[aria-invalid=true]{border-color:var(--color-destructive)}.aria-invalid\:ring-destructive\/20[aria-invalid=true]{--tw-ring-color:#f26d6d33}@supports (color:color-mix(in lab,red,red)){.aria-invalid\:ring-destructive\/20[aria-invalid=true]{--tw-ring-color:color-mix(in oklab, var(--color-destructive) 20%, transparent)}}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true]{pointer-events:none}.data-\[disabled\=true\]\:opacity-50[data-disabled=true]{opacity:.5}.data-\[error\=true\]\:text-destructive[data-error=true]{color:var(--color-destructive)}.data-\[inset\]\:pl-8[data-inset]{padding-left:calc(var(--spacing) * 8)}.data-\[orientation\=horizontal\]\:h-px[data-orientation=horizontal]{height:1px}.data-\[orientation\=horizontal\]\:w-full[data-orientation=horizontal]{width:100%}.data-\[orientation\=vertical\]\:h-full[data-orientation=vertical]{height:100%}.data-\[orientation\=vertical\]\:w-px[data-orientation=vertical]{width:1px}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:var(--color-muted-foreground)}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:var(--color-accent)}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:var(--color-accent-foreground)}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:var(--spacing);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:calc(2*var(--spacing)*-1)}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:calc(2*var(--spacing))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x:var(--spacing);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:calc(2*var(--spacing)*-1)}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:calc(2*var(--spacing))}.data-\[size\=default\]\:h-9[data-size=default]{height:calc(var(--spacing) * 9)}.data-\[size\=sm\]\:h-8[data-size=sm]{height:calc(var(--spacing) * 8)}:is(.\*\*\:data-\[slot\=command-input-wrapper\]\:h-12 *)[data-slot=command-input-wrapper]{height:calc(var(--spacing) * 12)}:is(.\*\:data-\[slot\=select-value\]\:line-clamp-1>*)[data-slot=select-value]{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}:is(.\*\:data-\[slot\=select-value\]\:flex>*)[data-slot=select-value]{display:flex}:is(.\*\:data-\[slot\=select-value\]\:items-center>*)[data-slot=select-value]{align-items:center}:is(.\*\:data-\[slot\=select-value\]\:gap-2>*)[data-slot=select-value]{gap:calc(var(--spacing) * 2)}.data-\[state\=closed\]\:animate-out[data-state=closed]{animation:exit var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\[state\=open\]\:animate-in[data-state=open]{animation:enter var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:var(--color-accent)}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:var(--color-accent-foreground)}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:var(--color-muted-foreground)}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:var(--color-muted)}.data-\[variant\=destructive\]\:text-destructive[data-variant=destructive]{color:var(--color-destructive)}.data-\[variant\=destructive\]\:focus\:bg-destructive\/10[data-variant=destructive]:focus{background-color:#f26d6d1a}@supports (color:color-mix(in lab,red,red)){.data-\[variant\=destructive\]\:focus\:bg-destructive\/10[data-variant=destructive]:focus{background-color:color-mix(in oklab,var(--color-destructive) 10%,transparent)}}.data-\[variant\=destructive\]\:focus\:text-destructive[data-variant=destructive]:focus{color:var(--color-destructive)}@media(min-width:40rem){.sm\:max-w-lg{max-width:var(--container-lg)}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:text-left{text-align:left}}@media(min-width:48rem){.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media(prefers-color-scheme:dark){.dark\:border-input{border-color:var(--color-input)}.dark\:bg-destructive\/60{background-color:#f26d6d99}@supports (color:color-mix(in lab,red,red)){.dark\:bg-destructive\/60{background-color:color-mix(in oklab,var(--color-destructive) 60%,transparent)}}.dark\:bg-input\/30{background-color:#ffffff08}@supports (color:color-mix(in lab,red,red)){.dark\:bg-input\/30{background-color:color-mix(in oklab,var(--color-input) 30%,transparent)}}@media(hover:hover){.dark\:hover\:bg-accent\/50:hover{background-color:#ffffff08}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-accent\/50:hover{background-color:color-mix(in oklab,var(--color-accent) 50%,transparent)}}.dark\:hover\:bg-input\/50:hover{background-color:#ffffff0e}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-input\/50:hover{background-color:color-mix(in oklab,var(--color-input) 50%,transparent)}}}.dark\:focus-visible\:ring-destructive\/40:focus-visible{--tw-ring-color:#f26d6d66}@supports (color:color-mix(in lab,red,red)){.dark\:focus-visible\:ring-destructive\/40:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-destructive) 40%, transparent)}}.dark\:aria-invalid\:ring-destructive\/40[aria-invalid=true]{--tw-ring-color:#f26d6d66}@supports (color:color-mix(in lab,red,red)){.dark\:aria-invalid\:ring-destructive\/40[aria-invalid=true]{--tw-ring-color:color-mix(in oklab, var(--color-destructive) 40%, transparent)}}.dark\:data-\[variant\=destructive\]\:focus\:bg-destructive\/20[data-variant=destructive]:focus{background-color:#f26d6d33}@supports (color:color-mix(in lab,red,red)){.dark\:data-\[variant\=destructive\]\:focus\:bg-destructive\/20[data-variant=destructive]:focus{background-color:color-mix(in oklab,var(--color-destructive) 20%,transparent)}}}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-inline:calc(var(--spacing) * 2)}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-block:calc(var(--spacing) * 1.5)}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:var(--color-muted-foreground)}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-inline:calc(var(--spacing) * 2)}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:calc(var(--spacing) * 5)}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:calc(var(--spacing) * 5)}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:calc(var(--spacing) * 12)}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-inline:calc(var(--spacing) * 2)}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-block:calc(var(--spacing) * 3)}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:calc(var(--spacing) * 5)}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:calc(var(--spacing) * 5)}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-3 svg:not([class*=size-]){width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&_svg\:not\(\[class\*\=\'text-\'\]\)\]\:text-muted-foreground svg:not([class*=text-]){color:var(--color-muted-foreground)}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\.border-b\]\:pb-6.border-b{padding-bottom:calc(var(--spacing) * 6)}.\[\.border-t\]\:pt-6.border-t{padding-top:calc(var(--spacing) * 6)}:is(.\*\:\[span\]\:last\:flex>*):is(span):last-child{display:flex}:is(.\*\:\[span\]\:last\:items-center>*):is(span):last-child{align-items:center}:is(.\*\:\[span\]\:last\:gap-2>*):is(span):last-child{gap:calc(var(--spacing) * 2)}:is(.data-\[variant\=destructive\]\:\*\:\[svg\]\:text-destructive\![data-variant=destructive]>*):is(svg){color:var(--color-destructive)!important}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y:2px;translate:var(--tw-translate-x) var(--tw-translate-y)}.\[\&\>tr\]\:last\:border-b-0>tr:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}}@property --tw-animation-delay{syntax:"*";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:"*";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:"*";inherits:false}@property --tw-animation-fill-mode{syntax:"*";inherits:false;initial-value:none}@property --tw-animation-iteration-count{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0)scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1))rotate(var(--tw-enter-rotate,0));filter:blur(var(--tw-enter-blur,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0)scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1))rotate(var(--tw-exit-rotate,0));filter:blur(var(--tw-exit-blur,0))}}:root{--bg: #0a0b0d;--bg-side: #0c0e10;--bg-raise: #15171b;--surface: rgba(255,255,255,.03);--hover: rgba(255,255,255,.06);--border: rgba(255,255,255,.07);--border-2: rgba(255,255,255,.11);--code-bg: #0d0f12;--text: #eef0f3;--text-dim: #9aa0a9;--text-faint: #868b93;--text-ghost: #666b74;--accent: #f5a623;--accent-bright: #ffcf85;--accent-dim: #d3861a;--accent-press: #e0951a;--glow: rgba(245,166,35,.13);--add: #4cc38a;--del: #f26d6d;--mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;--ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;--r-ctl: 7px;--r-card: 10px;--r-over: 14px;--page-read: 768px;--page-app: 768px;--page-wide: 1200px;--hero-top: clamp(32px, 8vh, 88px)}@font-face{font-family:"Jersey 10";font-style:normal;font-weight:400;font-display:swap;src:url(/assets/jersey-10-COnnvJff.woff2) format("woff2")}@font-face{font-family:Logo Fallback;src:local("Helvetica Neue"),local("Arial"),local("Segoe UI"),local("Roboto");size-adjust:73%}*{box-sizing:border-box}[hidden]{display:none!important}html,body{height:100%;margin:0}#root{display:contents}body{display:flex;background:var(--bg);color:var(--text);font:13px/1.5 var(--ui);letter-spacing:-.006em;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}::selection{background:var(--glow);color:var(--accent-bright)}:focus-visible{outline:2px solid var(--accent);outline-offset:1px;border-radius:5px}:focus-visible{outline-color:var(--accent)}.admin input:focus-visible{outline:2px solid var(--accent);outline-offset:1px}input[type=checkbox]{accent-color:var(--accent);width:20px;height:20px;color-scheme:dark}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.sprite{position:absolute}.ico{width:16px;height:16px;flex:none;stroke:currentColor;stroke-width:1.6;fill:none;stroke-linecap:round;stroke-linejoin:round}button,input,a.btn{font-family:inherit}#sidebar{width:264px;min-width:210px;background:var(--bg-side);border-right:1px solid var(--border);display:flex;flex-direction:column;overflow:hidden}#vault{display:flex;align-items:center;gap:9px;height:52px;padding:0 12px 0 14px;border-bottom:1px solid var(--border);position:relative;z-index:45}#vault-badge{flex:none;display:grid;place-items:center;color:var(--accent)}#vault-name{font-family:"Jersey 10","Logo Fallback",var(--ui);font-size:18px;font-weight:400;font-synthesis:none;letter-spacing:.01em;line-height:1;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vault-actions{display:flex;align-items:center;gap:4px}#vault #signout,.icon-btn2{width:28px;height:28px;border-radius:6px;display:inline-flex;align-items:center;justify-content:center;color:var(--text-ghost);background:transparent;border:none;cursor:pointer;text-decoration:none}#vault #signout:hover,.icon-btn2:hover{color:var(--text);background:var(--hover)}#vault #signout .ico,.icon-btn2 .ico{width:16px;height:16px}#projects{flex:none;max-height:32%;overflow-y:auto;padding:10px 8px 8px;border-bottom:1px solid var(--border)}.nav-head{display:flex;align-items:center;justify-content:space-between;padding:6px 8px;font-size:10.5px;font-weight:600;text-transform:uppercase;letter-spacing:.07em;color:var(--text-faint)}.nav-add{display:grid;place-items:center;width:18px;height:18px;border:none;background:transparent;color:var(--text-ghost);cursor:pointer;border-radius:5px}.nav-add .ico{width:14px;height:14px}.nav-add:hover{color:var(--text);background:var(--hover)}#projects ul{list-style:none;margin:0;padding:0}#projects .row{display:flex;align-items:center;gap:9px;height:31px;padding:0 8px;border-radius:7px;color:var(--text-dim);cursor:pointer;position:relative;white-space:nowrap;overflow:hidden}.proj-mark{width:17px;height:17px;border-radius:5px;flex:none;display:grid;place-items:center;font-size:10px;font-weight:700;color:#0a0b0d;letter-spacing:-.02em;text-transform:uppercase}.proj-mark svg{width:11px;height:11px}.proj-menu [data-slot=select-item]{display:flex;align-items:center;gap:8px}#projects .row .label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}#projects .row:hover{background:var(--hover);color:var(--text)}#projects .row.active{background:var(--glow);color:var(--accent-bright)}#projects .row.active:before{content:"";position:absolute;left:0;top:6px;bottom:6px;width:2px;border-radius:2px;background:var(--accent)}#tree{flex:1;overflow-y:auto;padding:8px 8px 24px}.tguide{position:absolute;top:0;bottom:0;width:1px;background:var(--border);pointer-events:none}#tree .row{display:flex;align-items:center;gap:6px;height:28px;padding:0 8px;border-radius:7px;color:var(--text-dim);cursor:pointer;position:relative;white-space:nowrap;overflow:hidden}#tree .row:hover{background:var(--hover);color:var(--text)}#tree .row.active{background:var(--glow);color:var(--accent-bright)}#tree .row.active:before{content:"";position:absolute;left:0;top:5px;bottom:5px;width:2px;border-radius:2px;background:var(--accent)}#tree .chev{width:14px;height:14px;flex:none;color:var(--text-ghost);transition:transform .12s;display:flex;align-items:center;justify-content:center}#tree .chev .ico{width:13px;height:13px}#tree .ticon{flex:none;display:flex;color:var(--text-ghost)}#tree .ticon .ico{width:15px;height:15px}#tree .row:hover .ticon,#tree .row:hover .chev{color:var(--text-faint)}#tree .row.active .ticon,#tree .row.active .chev{color:var(--accent)}#tree .label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}#tree .file .label{font-size:12.5px}#tree .file .chev{visibility:hidden}#tree .row.collapsed .chev{transform:rotate(-90deg)}.field-err{color:var(--del);font-size:12px;margin:6px 2px 0}.modal,#palette{translate:none}.admin-card-table{padding:0}.admin-table{width:100%;border-collapse:collapse;table-layout:fixed}.admin-table td .ai-main,.admin-table td a.ai-main,.admin-table td .ai-copy,.admin-table td .ai-tag{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.admin-table th:last-child,.admin-table td:last-child{width:186px;text-align:right}.admin-table tr:last-child td{border-bottom:none}.admin-table th{text-align:left;font-size:11px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;color:var(--text-faint);padding:0;border-bottom:1px solid var(--border);-webkit-user-select:none;user-select:none}.admin-table td{padding:0;border-bottom:1px solid var(--border);overflow:hidden;text-overflow:ellipsis}.admin-table tr.admin-item{display:table-row}.admin-table tr.admin-item td{padding:8px 10px}.nav-menu{list-style:none;margin:6px 0 0;padding:0}.nav-menu .row .ico{width:15px;height:15px;flex:none;color:var(--text-ghost)}.nav-menu .row.active .ico{color:var(--accent-bright)}.proj-row{display:flex;align-items:center;gap:4px;padding:0 10px 4px 12px}#project-select{flex:1;min-width:0;height:30px;padding:0 9px;display:inline-flex;align-items:center;gap:8px;border:1px solid var(--border);border-radius:var(--r-ctl);background:var(--surface);color:var(--text);font:inherit;font-size:12.5px;font-weight:500;cursor:pointer;white-space:nowrap;outline:none}#project-select>span:last-of-type{overflow:hidden;text-overflow:ellipsis}#project-select:hover{background:var(--hover);border-color:var(--border-2)}#project-select svg{color:var(--text-ghost)}.proj-menu{z-index:80;min-width:var(--radix-select-trigger-width, 200px);border:1px solid var(--border-2);border-radius:9px;padding:4px;background:var(--bg-raise);box-shadow:0 10px 32px #00000059}.proj-menu [role=option]{font-size:12.5px;color:var(--text-dim);border-radius:6px;outline:none}.proj-menu [role=option][data-highlighted]{background:var(--hover);color:var(--text)}#accountbar{position:relative;border-top:1px solid var(--border);padding:7px 10px}#account-btn{width:100%;display:flex;align-items:center;gap:9px;text-align:left;padding:6px 8px;border:none;border-radius:7px;background:transparent;color:var(--text-dim);cursor:pointer;font:inherit}#account-btn:hover{background:var(--hover);color:var(--text)}#account-btn .avatar{width:26px;height:26px;flex:none;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;color:#fff;font-size:12px;font-weight:700}#account-btn .acct{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}#account-btn .acct b{font-size:12.5px;font-weight:600;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#account-btn .acct small{font-size:11px;color:var(--text-faint);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#account-btn>.ico{width:14px;height:14px;color:var(--text-ghost)}#account-menu{min-width:var(--radix-dropdown-menu-trigger-width, 220px);padding:5px;border:1px solid var(--border-2);border-radius:9px;background:var(--bg-raise);box-shadow:0 10px 32px #00000059;display:flex;flex-direction:column;z-index:80;outline:none}#account-menu [role=menuitem]{outline:none}#account-menu [role=menuitem][data-highlighted]{background:var(--hover);color:var(--text)}#account-menu .menu-sec{padding:7px 9px 3px;font-size:10.5px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--text-faint)}#account-menu [role=menuitem]{display:flex;align-items:center;gap:8px;padding:7px 9px;border:none;border-radius:6px;background:transparent;text-align:left;color:var(--text-dim);font:inherit;font-size:12.5px;cursor:pointer;text-decoration:none}#account-menu [role=menuitem]:hover{background:var(--hover);color:var(--text)}#account-menu [role=menuitem] b{font-weight:600}#account-menu [role=menuitem] .ico{width:15px;height:15px}#account-menu #signout{color:var(--del)}#account-menu #signout:hover{color:var(--del);background:var(--hover)}#main{flex:1;display:flex;flex-direction:column;min-width:0}#topbar{position:relative;display:flex;align-items:center;gap:9px;height:52px;padding:0 16px;border-bottom:1px solid var(--border)}.icon-btn{display:none;width:34px;height:34px;border:none;background:transparent;color:var(--text-dim);cursor:pointer;border-radius:7px;align-items:center;justify-content:center}.icon-btn:hover{color:var(--text);background:var(--hover)}#crumb{font-size:12.5px;color:var(--text);font-weight:500;letter-spacing:-.01em;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#crumb .crumb-seg{color:var(--text-dim);cursor:pointer}#crumb .crumb-seg:hover{color:var(--accent-bright)}#crumb .crumb-sep{color:var(--text-ghost);margin:0 5px}#meta{flex:1;min-width:0;font-size:12px;color:var(--text-faint);text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.btn{display:inline-flex;align-items:center;gap:6px;flex:none;height:30px;padding:0 11px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--text-dim);font-size:12.5px;font-weight:500;cursor:pointer;text-decoration:none}.btn:hover{background:var(--hover);color:var(--text);border-color:var(--border-2)}.btn .ico{width:15px;height:15px}.btn.ghost{color:var(--text-dim)}.tipcard{display:flex;align-items:center;gap:7px;white-space:nowrap;padding:6px 9px;border-radius:8px;border:1px solid var(--border-2);background:var(--surface-solid, var(--bg-raise));color:var(--text);font-size:12.5px;font-weight:500;box-shadow:0 8px 24px #00000059;z-index:80}.tipcard kbd{font:11px var(--ui);color:var(--text-faint);background:var(--hover);border:1px solid var(--border-2);border-radius:5px;padding:1px 5px}#more-menu{position:absolute;right:12px;top:calc(100% - 4px);z-index:80;background:var(--bg-raise);border:1px solid var(--border-2);border-radius:var(--r-card);box-shadow:0 18px 44px -14px #000000bf;padding:6px;min-width:168px}.more-item{display:block;width:100%;text-align:left;min-height:40px;padding:0 12px;background:transparent;border:none;cursor:pointer;color:var(--text);font:inherit;font-size:13.5px;border-radius:var(--r-ctl)}.more-item:hover{background:var(--hover)}#content{flex:1;overflow-y:auto;padding:44px 40px 110px;scroll-behavior:smooth}.page{width:100%;max-width:var(--page-app);margin-inline:auto;min-width:0}.page.read{max-width:var(--page-read)}.page.wide{max-width:var(--page-wide)}.empty{color:var(--text-faint);text-align:center;margin-top:var(--hero-top)}.empty-hint{display:block;margin-top:6px;font-size:12px;color:var(--text-faint)}.onboard{max-width:560px;margin:var(--hero-top) auto 0}.onboard h1{font-size:25px;font-weight:640;letter-spacing:-.02em;margin:0 0 8px;color:#f4f6f9}.onboard>p{color:var(--text-dim);margin:0 0 28px;font-size:14px}.ob-card{background:var(--bg-side);border:1px solid var(--border);border-radius:var(--r-card);padding:20px 22px;margin-bottom:14px}.ob-card h3{margin:0 0 6px;font-size:14.5px;font-weight:600}.ob-card p{margin:0 0 14px;font-size:13px;color:var(--text-dim)}.ob-row{display:flex;gap:9px}.ob-row input{flex:1;height:34px;padding:0 12px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--text);font:inherit;font-size:13px;outline:none}.ob-row input:focus{border-color:var(--accent);background:var(--hover)}.pbtn{display:inline-flex;align-items:center;gap:6px;flex:none;height:32px;padding:0 14px;border-radius:var(--r-ctl);border:none;background:var(--accent);color:#241704;font-size:13px;font-weight:600;cursor:pointer;white-space:nowrap}.pbtn:hover{background:var(--accent-bright)}.pbtn .ico{width:15px;height:15px}.danger-btn{display:inline-flex;align-items:center;height:32px;padding:0 14px;border-radius:var(--r-ctl);border:none;background:#b3382e;color:#fff;font-size:13px;font-weight:600;cursor:pointer}.danger-btn:hover{background:#c94336}[data-slot=input],[data-slot=textarea]{font:inherit;color:var(--text)}[data-slot=input][aria-invalid=true]:focus-visible,[data-slot=textarea][aria-invalid=true]:focus-visible{border-color:var(--del)}[data-slot=card],[data-slot=dropdown-menu-content]{border-color:var(--border)}.project-settings{display:flex;flex-direction:column;gap:14px}.project-settings>h2{font-size:21px;font-weight:640;letter-spacing:-.02em;margin:0 0 4px;color:#f4f6f9}.ps-form{display:flex;flex-direction:column;gap:18px}.ps-field{display:flex;flex-direction:column;gap:7px}.ps-field label{font-size:12.5px;color:var(--text-dim)}.ps-opt{color:var(--text-ghost);font-weight:400}.ps-icon-row{display:flex;align-items:center;gap:10px}.ps-icon-row .proj-mark{width:26px;height:26px;border-radius:7px}.ps-icon-row .proj-mark svg{width:15px;height:15px}.ps-meta{display:flex;align-items:baseline;justify-content:space-between;gap:12px}.ps-meta .field-err{flex:0 1 auto;margin:0}.ps-count{font-size:11.5px;color:var(--text-faint);font-variant-numeric:tabular-nums}.ps-actions{display:flex;justify-content:flex-end}.ps-icon-grid{display:grid;grid-template-columns:repeat(6,30px);gap:4px;padding:8px}.ps-icon-cell{display:grid;place-items:center;width:30px;height:30px;border-radius:7px;border:1px solid transparent;background:none;color:var(--text-dim);cursor:pointer}.ps-icon-cell svg{width:16px;height:16px}.ps-icon-cell:hover{background:var(--hover);color:var(--text)}.ps-icon-cell.active{border-color:var(--accent);color:var(--accent-bright)}.ps-danger [data-slot=card-title]{font-size:10.5px;text-transform:uppercase;letter-spacing:.07em;color:#d2695e;font-weight:600}.ps-danger p{color:var(--text-dim);font-size:13px;margin:0 0 14px;max-width:52ch;line-height:1.55}.ps-facts{display:grid;grid-template-columns:auto 1fr;gap:8px 20px;margin:0;font-size:13px}.ps-facts dt{color:var(--text-faint)}.ps-facts dd{margin:0;color:var(--text-dim)}.admin h1{font-size:21px;font-weight:640;letter-spacing:-.02em;margin:0 0 6px;color:#f4f6f9}.admin h3{font-size:10.5px;text-transform:uppercase;letter-spacing:.07em;color:var(--text-faint);font-weight:600;margin:30px 0 10px}.admin-lbl{flex:1 1 100%;margin:0 0 6px;font-size:12.5px;font-weight:600;color:var(--text-dim)}.admin-sub{color:var(--text-dim);font-size:13.5px;margin:-2px 0 16px;line-height:1.55}.admin-h{display:flex;align-items:center;justify-content:space-between;margin:30px 0 10px}.admin-h h3{margin:0}.admin-row{display:flex;gap:9px;margin-bottom:8px}.admin-row input{flex:1;height:34px;padding:0 12px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--text);font:inherit;font-size:13px;outline:none}.admin-row input:focus{border-color:var(--accent);background:var(--hover)}.admin-list{border:1px solid var(--border);border-radius:var(--r-card);overflow:hidden;background:var(--bg-side)}.admin-list.admin-card-table{overflow-x:auto;overflow-y:hidden}.admin-item{display:flex;align-items:center;gap:11px;padding:11px 14px;border-bottom:1px solid var(--border);font-size:13.5px}.modal-actions .ai-btn{height:32px}.empty a{color:var(--accent);text-decoration:none;display:inline-block;padding:6px 10px}.empty a:hover{text-decoration:underline}.empty h3{margin:0 0 8px;font-size:16px;color:var(--text)}.ai-copy{text-align:left;background:none;border:0;padding:6px 0;cursor:pointer}.ai-copy:hover{color:var(--text)}a.ai-main{color:var(--text-dim);text-decoration:none;padding:6px 0}a.ai-main:hover{color:var(--accent)}.th-sort{display:block;width:100%;text-align:left;background:none;border:0;padding:6px 10px;font:inherit;color:inherit;letter-spacing:inherit;text-transform:inherit;cursor:pointer}.th-sort:hover{color:var(--text-dim)}.proj-trigger>[data-slot=select-value]{display:block;flex:1 1 auto;min-width:0;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.role-cell{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:center;justify-items:start}.admin-table td .role-static{text-align:left}.role-chip-row{margin:-6px 0 12px}.role-chip{margin-left:0;padding:2px 8px;border:1px solid var(--border-2);border-radius:99px;vertical-align:middle}.ext{margin-left:4px;color:var(--text-faint);font-size:11px}.admin-item:last-child{border-bottom:none}.admin-item:hover{background:var(--hover)}.field-err{flex:1 1 100%;margin:6px 0 0}.admin-row{flex-wrap:wrap}.admin-row input[aria-invalid=true]{border-color:var(--del)}.ai-main{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text)}.admin-item>.ai-main{flex:1 1 55%;min-width:22ch}.admin-item>.ai-tag{flex:0 0 auto;min-width:0;max-width:45%}@media(max-width:1000px){.admin-item{flex-wrap:wrap}.admin-item>.ai-tag{flex:1 1 100%;max-width:100%}}.admin-table td .ai-main{min-width:0}.ai-main.mono{font:12px var(--mono);color:var(--text-dim);cursor:pointer}.ai-tag{font-size:11.5px;color:var(--text-faint);flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.admin-item select{height:28px;background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:0 8px;font:inherit;font-size:12.5px;cursor:pointer}.admin-item select:hover{border-color:var(--border-2)}.ai-btn,.ai-del{flex:none;height:27px;padding:0 11px;border-radius:6px;border:1px solid var(--border);background:var(--surface);color:var(--text-dim);font:inherit;font-size:12px;font-weight:500;cursor:pointer}.ai-del{color:var(--del);border-color:#f26d6d47}.ai-del:hover{background:#f26d6d1f;border-color:var(--del);color:#ff8b8b}.ai-btn:hover{background:var(--hover);color:var(--text);border-color:var(--border-2)}.admin-empty{padding:14px;color:var(--text-faint);font-size:13px}.admin-item.toggle{cursor:pointer;align-items:flex-start}.admin-item.toggle .ai-main{white-space:normal}.tg-label{font-size:13.5px;font-weight:550;color:var(--text)}.tg-desc{font-size:12px;color:var(--text-faint);margin-top:3px;line-height:1.5}.admin-item.toggle input{margin-top:2px;flex:none}.dl-title{display:flex;align-items:center;gap:10px;font-size:21px;font-weight:640;letter-spacing:-.02em;margin:0 0 4px;color:#f4f6f9}.dl-title-icon{display:flex;color:var(--accent)}.dl-title-icon .ico{width:20px;height:20px}.dl-sub{color:var(--text-faint);font-size:12.5px;margin:0 0 18px}.dl-items{border:1px solid var(--border);border-radius:var(--r-card);overflow:hidden;background:var(--bg-side)}.dl-row{display:flex;align-items:center;gap:11px;padding:10px 14px;border-bottom:1px solid var(--border);cursor:pointer}.dl-row:last-child{border-bottom:none}.dl-row:hover{background:var(--hover)}.dl-row .ticon{flex:none;display:flex;color:var(--text-ghost)}.dl-row .ticon .ico{width:16px;height:16px}.dl-row:hover .ticon{color:var(--text-faint)}.dl-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13.5px;color:var(--text)}.dl-meta{flex:none;font-size:12px;color:var(--text-faint);font-variant-numeric:tabular-nums}.heatdot{flex:none;width:7px;height:7px;border-radius:50%;background:var(--accent)}.heatdot.lvl1{opacity:.3}.heatdot.lvl2{opacity:.55}.heatdot.lvl3{opacity:.8}.heatdot.lvl4{opacity:1;box-shadow:0 0 6px #f5a6238c}.dl-empty{padding:24px 14px;color:var(--text-faint);font-size:13px;border:1px dashed var(--border);border-radius:var(--r-card);text-align:center}.dl-h3{margin:28px 0 8px;font-size:10.5px;text-transform:uppercase;letter-spacing:.07em;color:var(--text-faint);font-weight:600}.dl-hlist{border:1px solid var(--border);border-radius:var(--r-card);background:var(--bg-side);overflow:hidden;max-width:none}.dl-hlist .hentry:last-child{border-bottom:none}.hentry.clickable{cursor:pointer}.hentry.clickable:hover{background:var(--hover)}.dl-more{margin-top:10px}#vault-name.vault-link{cursor:pointer}#vault-name.vault-link:hover{color:var(--accent-bright)}.gd-tabs{display:flex;gap:2px;margin:20px 0 16px;border-bottom:1px solid var(--border);overflow-x:auto}.gd-tab{font:inherit;font-size:13px;font-weight:600;padding:7px 12px 9px;background:none;border:none;border-bottom:2px solid transparent;margin-bottom:-1px;color:var(--text-faint);cursor:pointer;white-space:nowrap}.gd-tab:hover{color:var(--text)}#account-btn.active{background:var(--glow)}#account-btn.active .acct b{color:var(--accent-bright)}.gd-tab.active{color:var(--accent-bright);border-bottom-color:var(--accent)}.gd-step{margin:0 0 18px}.gd-step-head{display:flex;align-items:center;gap:10px;margin-bottom:3px}.gd-num{flex:none;width:22px;height:22px;border-radius:50%;background:var(--glow);color:var(--accent-bright);font-size:12px;font-weight:700;display:flex;align-items:center;justify-content:center}.gd-step-title{font-weight:600;font-size:14px;color:var(--text)}.gd-desc{margin:2px 0 8px 32px;color:var(--text-faint);font-size:13px;line-height:1.5}.gd-extra{font-size:12.5px;margin-top:6px}.gd-code{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:10px;margin:6px 0 6px 32px;padding:10px 12px;background:var(--bg-raise);border:1px solid var(--border);border-radius:var(--r-card);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12.5px;line-height:1.6;color:var(--text)}.gd-code>code{display:block;min-width:0;overflow-x:auto;white-space:pre}.gd-copy{align-self:start;font:inherit;font-family:inherit;font-size:11px;font-weight:600;padding:3px 9px;border-radius:6px;border:1px solid var(--border-2);background:var(--bg-raise);color:var(--text-faint);cursor:pointer}.gd-copy:hover{color:var(--accent-bright);border-color:var(--accent-dim)}.gd-solo .gd-desc,.gd-solo .gd-code{margin-left:0}.gd-manual{margin:10px 0 0}.gd-manual>summary{display:inline-block;font-size:12.5px;font-weight:600;color:var(--text-faint);cursor:pointer;padding:4px 0}.gd-manual>summary:hover{color:var(--text)}.gd-manual .gd-desc,.gd-manual .gd-code{margin-left:0}.gd-done{margin:22px 0 8px;padding:12px 14px;border:1px solid var(--border);border-radius:var(--r-card);background:var(--bg-side);color:var(--text-faint);font-size:13px;line-height:1.5}.home-insights{margin-top:30px;padding-top:22px;border-top:1px solid var(--border)}.in-title{font-size:21px;font-weight:640;letter-spacing:-.02em;margin:0 0 4px;color:#f4f6f9}.in-title .in-scope{color:var(--text-ghost);font-weight:500;font-size:15px}.gd-head{display:flex;align-items:center;gap:9px}.gd-head .proj-mark{width:22px;height:22px;border-radius:6px}.gd-head .proj-mark svg{width:13px;height:13px}.in-desc{color:var(--text-dim);font-size:13.5px;line-height:1.55;margin:0 0 10px;max-width:62ch}.in-lens{display:flex;gap:6px;margin:0 0 14px}.in-lens-btn{font:inherit;font-size:12px;padding:5px 12px;border-radius:999px;border:1px solid var(--border);background:none;color:var(--text-faint);cursor:pointer}.in-lens-btn:hover{color:var(--text)}.in-lens-btn.active{color:var(--accent);border-color:var(--accent)}.in-chart{width:100%;max-width:760px;height:auto;border:1px solid var(--border);border-radius:var(--r-card);background:var(--bg-side);margin-bottom:6px}.in-axis{stroke:var(--border);stroke-width:1}.in-threshold{stroke:var(--border);stroke-width:1;stroke-dasharray:4 4}.in-danger-zone{fill:#f26d6d0d}.in-label{fill:var(--text-ghost);font-size:11px}.in-quad{fill:var(--text-ghost);font-size:10.5px;text-transform:uppercase;letter-spacing:.06em}.in-quad-danger{fill:#e07070}.in-pt{fill:var(--accent);opacity:.5;cursor:pointer}.in-pt:hover{opacity:1}.in-pt.cold{fill:var(--text-ghost);opacity:.25}.in-pt.danger{fill:#e05d5d;opacity:.6}.in-treemap{background:#0c0d10}.in-tm-group{fill:none;stroke:var(--border);stroke-width:1;cursor:pointer;pointer-events:all}.in-tm-glabel{fill:var(--text-faint);font-size:10px;text-transform:uppercase;letter-spacing:.05em;cursor:pointer}.in-tm-cell{cursor:pointer}.in-tm-cell:hover{stroke:#fff;stroke-width:1}.in-tm-label{fill:#0c0d10;font-size:10.5px;font-weight:620;cursor:pointer;pointer-events:none}.in-hotpath{border:1px solid var(--border);border-radius:var(--r-card);background:var(--bg-side);overflow:hidden}.in-hp-row{display:flex;align-items:center;gap:10px;padding:6px 12px;border-bottom:1px solid var(--border);cursor:pointer}.in-hp-row:last-child{border-bottom:none}.in-hp-row:hover{background:var(--hover)}.in-hp-name{flex:0 0 300px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;color:var(--text)}.in-hp-name.danger{color:var(--accent)}.in-hp-bar{flex:1;display:flex;height:10px;border-radius:3px;overflow:hidden}.in-hp-agent{background:var(--accent)}.in-hp-human{background:#5b8def}.in-hp-count{flex:none;width:40px;text-align:right;font-size:11.5px;color:var(--text-faint);font-variant-numeric:tabular-nums}.in-legend{margin:8px 2px 0;font-size:11.5px;color:var(--text-faint)}.in-sw{display:inline-block;width:10px;height:10px;border-radius:2px;vertical-align:-1px}.in-sw.agent{background:var(--accent)}.in-sw.human{background:#5b8def}.in-matrix rect{transition:opacity .1s}.in-matrix rect:hover{opacity:.85}.hentry{padding:11px 12px;border-bottom:1px solid var(--border)}.hentry:hover{background:#ffffff04}.hline{display:flex;gap:10px;align-items:center}.hkind{display:inline-flex;color:var(--add)}.hkind .ico{width:13px;height:13px}.hentry.edit .hkind{color:var(--accent)}.hentry.delete .hkind{color:var(--del)}.htag{flex:none;font-size:10px;text-transform:uppercase;letter-spacing:.06em;font-weight:600;padding:1px 6px;border-radius:4px}.hentry.add .htag{color:var(--add);background:#4cc38a1f}.hentry.edit .htag{color:var(--accent-bright);background:var(--glow)}.hentry.delete .htag{color:#ff8b8b;background:#f26d6d1f}.hpath{font-weight:500;cursor:pointer;color:var(--text);font-size:13px}.hpath:hover{color:var(--accent-bright)}.htime{margin-left:auto;color:var(--text-faint);font-size:12px;font-variant-numeric:tabular-nums}.hmeta{display:flex;align-items:center;gap:14px;margin-top:4px;padding-left:23px;font-size:12px;color:var(--text-dim)}.hdev,.hsize{color:var(--text-faint)}.hsize{font-variant-numeric:tabular-nums;white-space:nowrap;flex:none}.hnote{margin-top:4px;padding-left:23px;font-size:12px;color:var(--text-faint);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer}.hnote:hover{color:var(--text)}.hnote.open{white-space:normal;overflow-wrap:anywhere}.hnote:before{content:"› ";color:var(--text-ghost)}.hnote a{color:var(--accent-bright);text-decoration:none}.hnote a:hover{text-decoration:underline}#palette{position:fixed;top:12vh;left:50%;transform:translate(-50%);z-index:151;display:block;width:min(560px,92vw);background:var(--bg-raise);border:1px solid var(--border-2);border-radius:var(--r-over);box-shadow:0 24px 70px -18px #000c;overflow:hidden;outline:none;padding:0}#palette-inputwrap{display:flex;align-items:center;gap:11px;padding:14px 16px;border-bottom:1px solid var(--border)}#palette-inputwrap [data-slot=command-input-wrapper]{flex:1;display:flex;border-bottom:0;padding:0;height:auto}#palette-inputwrap [data-slot=command-input-wrapper]>svg:not(.ico){display:none}#palette input,#palette input:focus{border:none;background:transparent;box-shadow:none;outline:none;padding:0}#palette-inputwrap .ico{width:17px;height:17px;color:var(--text-faint)}#palette-input{flex:1;width:100%;border:none;background:transparent;color:var(--text);font:inherit;font-size:15px;letter-spacing:-.01em;outline:none;padding:0}#palette-input::placeholder{color:var(--text-ghost)}#palette-results{list-style:none;margin:0;padding:8px;max-height:46vh;overflow-y:auto}#palette-results [cmdk-item]{display:flex;align-items:center;gap:11px;height:38px;padding:0 10px;border-radius:9px;cursor:pointer;color:var(--text-dim);font-size:13.5px}#palette-results [cmdk-item][data-selected=true]{background:var(--glow)}#palette-results [cmdk-item][data-selected=true] .picon{color:var(--accent)}#palette-results [cmdk-item][data-selected=true] .plabel,#palette-results [cmdk-item][data-selected=true] .plabel b{color:var(--accent-bright)}#palette-results li{display:flex;align-items:center;gap:11px;height:38px;padding:0 10px;border-radius:9px;cursor:pointer;color:var(--text-dim);font-size:13.5px}#palette-results li.selected{background:var(--glow)}#palette-results li.selected .picon{color:var(--accent)}#palette-results li.selected .plabel,#palette-results li.selected .plabel b{color:var(--accent-bright)}#palette-results li .picon{width:18px;flex:none;display:flex;justify-content:center;color:var(--text-faint)}#palette-results li .picon .ico{width:15px;height:15px}#palette-results li .plabel{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--text)}#palette-results li .plabel b{color:var(--accent-bright);font-weight:600}#palette-results li .pkind{flex:none;font-size:10.5px;text-transform:uppercase;letter-spacing:.05em;color:var(--text-ghost)}#palette-results .pempty{color:var(--text-faint);cursor:default;justify-content:center;height:auto;padding:14px}#palette-hint{padding:9px 16px;border-top:1px solid var(--border);font-size:11px;color:var(--text-ghost)}[data-slot=dialog-overlay]{position:fixed;inset:0;background:#06070999;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);z-index:150}.modal{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:151;display:block;background:var(--bg-raise);border:1px solid var(--border-2);border-radius:var(--r-over);padding:22px 24px;width:min(460px,calc(100vw - 40px));box-shadow:0 24px 70px -18px #000c;outline:none}.modal h3{margin:0 0 10px;font-size:16px;font-weight:620;letter-spacing:-.01em}.modal p{margin:0 0 16px;font-size:13.5px;color:var(--text-dim);line-height:1.55}.modal p b{color:var(--text)}.modal-url{font:12px var(--mono);background:var(--surface);border:1px solid var(--border);border-radius:var(--r-ctl);padding:9px 11px;color:var(--text-dim);word-break:break-all;margin-bottom:16px}.modal-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}.modal-label{display:block;font-size:12.5px;color:var(--text-dim);margin:0 0 6px}.modal-msg{margin:0 0 16px;font-size:13.5px;color:var(--text-dim);line-height:1.55}.modal-input{width:100%;height:36px;padding:0 12px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--text);font:inherit;font-size:14px;margin-bottom:16px;outline:none}.modal-input:focus{border-color:var(--accent);background:var(--hover)}[data-sonner-toast]{background:var(--bg-raise)!important;color:var(--text)!important;border:1px solid var(--border-2)!important;border-radius:10px!important;font-size:13.5px!important;box-shadow:0 18px 44px -12px #000000b3!important}[data-sonner-toast][data-type=error]{border-color:#f26d6d80!important;color:#ffb0aa!important}#sb-backdrop{display:none}@media(max-width:900px){#sidebar{position:fixed;z-index:60;top:0;left:0;height:100%;transform:translate(-100%);transition:transform .2s ease;box-shadow:0 0 40px #0009}body.sb-open #sidebar{transform:translate(0)}body.sb-open #sb-backdrop{display:block;position:fixed;inset:0;background:#0000008c;z-index:50}.icon-btn,#search-btn{display:inline-flex;width:44px;height:44px}#content{padding:24px 18px 70px}#topbar{padding:0 8px;gap:4px}.btn .lbl{display:none}#topbar .btn{min-width:44px;min-height:44px;padding:0;justify-content:center;gap:0}#topbar .btn .ico{width:18px;height:18px}#more-btn:not([hidden]){display:inline-flex}#history-btn,#upload-btn,#download{display:none!important}#meta{display:none}#crumb{flex:1}#vault{padding:0 8px 0 12px}.icon-btn2,#signout,#tree .row,#projects .row{height:44px}#account-btn,#project-select{min-height:44px}.nav-add{min-width:44px;min-height:44px}.markdown table,pre.plain{display:block;overflow-x:auto;max-width:100%}.ob-row{flex-direction:column}.ob-row input{flex:none;min-height:44px}.admin-item{flex-wrap:wrap;row-gap:8px;padding:12px 14px}.admin-item select{height:44px}.ai-btn,.ai-del{height:auto;min-height:44px;padding:0 12px}.admin-table thead{display:none}.admin-table,.admin-table tbody,.admin-table td{display:block;width:auto}.admin-table tr.admin-item{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.admin-table tr.admin-item td{padding:0;border-bottom:none}.admin-table tr.admin-item td:first-child{flex:1 1 100%;width:auto}.admin-table tr.admin-item td:last-child{width:auto;text-align:left}[data-slot=dropdown-menu-item]{min-height:44px}#projects{flex:0 1 auto;max-height:none}.admin-row{flex-wrap:wrap}.admin-row input{flex:1 1 100%;min-height:44px}.admin-row button{flex:0 0 auto;align-self:flex-start;min-height:44px}.admin-item .ai-main{flex:1 1 100%;white-space:normal;overflow-wrap:anywhere}.admin-table td{white-space:normal}.admin-table td .ai-main,.admin-table td a.ai-main,.admin-table td .ai-copy,.admin-table td .ai-tag{white-space:normal;overflow-wrap:anywhere}.admin-item .ai-tag{flex:1 1 100%;max-width:100%;white-space:normal;overflow-wrap:anywhere}.ai-copy{min-height:44px;display:block;padding:12px 0;white-space:normal;overflow-wrap:anywhere;text-overflow:clip}a.ai-main{min-height:44px;display:flex;align-items:center}.gd-code{min-height:62px;padding-top:12px;padding-bottom:12px}.gd-copy{min-height:44px;padding:0 14px}.gd-tab{min-height:44px}.in-lens-btn{min-height:44px;padding:0 14px}.modal-input{height:44px}.modal-actions button,.pbtn,#palette-results li{height:auto;min-height:44px}.more-item{min-height:44px}}.modal-actions .ai-del{margin-right:auto}@media(max-width:430px){.dl-meta{display:none}.ai-tag{font-size:11px}.htime{white-space:nowrap;font-size:12px}.hline{flex-wrap:wrap}.modal-actions .ai-del{flex:0 0 100%;justify-content:center;text-align:center}}.markdown h1,.markdown h2,.markdown h3,.markdown h4{color:#f4f6f9;line-height:1.25;letter-spacing:-.018em;margin:1.5em 0 .5em;text-wrap:balance}.markdown h1:first-child{margin-top:0}.markdown h1{font-size:1.85em;font-weight:660;letter-spacing:-.024em}.markdown h2{font-size:1.32em;font-weight:620;margin-top:1.7em}.markdown h3{font-size:1.08em;font-weight:620}.markdown p,.markdown li{color:#c6cbd3;font-size:14.5px;line-height:1.72}.markdown p{margin:0 0 1em}.markdown strong{color:var(--text);font-weight:620}.markdown a{color:var(--accent-bright);text-decoration:none;border-bottom:1px solid rgba(245,166,35,.28)}.markdown a:hover{border-bottom-color:var(--accent)}.markdown ul,.markdown ol{margin:0 0 1em;padding-left:1.4em}.markdown li{margin-bottom:.4em}.markdown li::marker{color:var(--text-ghost)}.markdown code{background:var(--hover);border:1px solid var(--border);padding:.1em .4em;border-radius:5px;font:12.5px/1.5 var(--mono);color:#e4d9c4}.markdown pre{background:var(--code-bg);border:1px solid var(--border);border-radius:var(--r-card);padding:14px 16px;overflow-x:auto;margin:1.3em 0}.markdown pre code{background:none;border:none;padding:0;color:#c6cbd3}.markdown blockquote{margin:1.3em 0;padding:.3em 1em;border-left:2px solid var(--accent);background:linear-gradient(90deg,var(--glow),transparent);border-radius:0 8px 8px 0;color:#d8cdb6}.markdown blockquote p{margin:.3em 0;color:#d8cdb6}.markdown table{border-collapse:collapse;margin:1.3em 0;font-size:13.5px}.markdown th,.markdown td{border-bottom:1px solid var(--border);padding:9px 13px;text-align:left}.markdown th{color:var(--text-faint);font-size:11px;text-transform:uppercase;letter-spacing:.05em;font-weight:600;border-bottom-color:var(--border-2)}.markdown tr:hover td{background:#ffffff05}.markdown img{max-width:100%;border-radius:8px;border:1px solid var(--border)}.markdown hr{border:none;border-top:1px solid var(--border);margin:2.2em 0}.markdown table.frontmatter{margin:0 0 1.8em;font-size:12px;background:var(--surface);border:1px solid var(--border);border-radius:8px;border-collapse:separate;border-spacing:0}.markdown table.frontmatter th{text-transform:none;letter-spacing:0;font-size:11.5px;color:var(--text-faint);font-weight:600;text-align:left;white-space:nowrap;vertical-align:top;padding:6px 14px 6px 12px;border-bottom:1px solid var(--border)}.markdown table.frontmatter td{color:var(--text-dim);padding:6px 12px 6px 0;border-bottom:1px solid var(--border)}.markdown table.frontmatter tr:last-child th,.markdown table.frontmatter tr:last-child td{border-bottom:none}.markdown table.frontmatter code{white-space:pre-wrap;font-size:11px}.markdown .admin input:focus-visible{outline:2px solid var(--accent);outline-offset:1px}.admin input[aria-invalid=true]:focus-visible{outline-color:var(--del)}[role=dialog] input[aria-invalid=true]{border-color:var(--del)}[role=dialog] input[aria-invalid=true]:focus-visible{outline-color:var(--del)}button:disabled,.btn:disabled{cursor:default}input[type=checkbox]{accent-color:var(--accent)}.htmlview{display:block;width:100%;height:calc(100vh - 150px);border:1px solid var(--border);border-radius:var(--r-card);background:#fff}.notfound{margin-top:var(--hero-top);text-align:center;color:var(--text-dim)}.notfound h1{color:var(--text);font-size:1.4em;margin-bottom:.5em}.notfound code{background:var(--hover);border:1px solid var(--border);padding:.15em .5em;border-radius:6px}.notfound .nf-sub{max-width:440px;margin:12px auto 20px;font-size:13px;color:var(--text-faint);line-height:1.6}pre.plain{background:var(--code-bg);border:1px solid var(--border);border-radius:var(--r-card);padding:14px 16px;overflow-x:auto;font:12.5px/1.6 var(--mono);color:#c6cbd3;white-space:pre-wrap;overflow-wrap:anywhere}.filecard{margin-top:var(--hero-top);text-align:center;color:var(--text-dim)}.filecard .name{font-size:1.2em;color:var(--text);margin-bottom:.3em}.filecard .btn{margin-top:14px} +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-duration:initial;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0}}}@layer theme{:root,:host{--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-lg:32rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--font-weight-medium:500;--font-weight-semibold:600;--tracking-widest:.1em;--radius-xs:.125rem;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--color-background:#0a0b0d;--color-foreground:#eef0f3;--color-card:#15171b;--color-card-foreground:#eef0f3;--color-popover:#15171b;--color-popover-foreground:#eef0f3;--color-primary:#f5a623;--color-primary-foreground:#1a1204;--color-secondary:#ffffff08;--color-secondary-foreground:#eef0f3;--color-muted:#ffffff0f;--color-muted-foreground:#9aa0a9;--color-accent:#ffffff0f;--color-accent-foreground:#eef0f3;--color-destructive:#f26d6d;--color-border:#ffffff12;--color-input:#ffffff1c;--color-ring:#f5a623;--radius-ctl:7px}}@layer base,components;@layer utilities{.\@container\/card-header{container:card-header/inline-size}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:0}.top-4{top:calc(var(--spacing) * 4)}.top-20{top:calc(var(--spacing) * 20)}.top-\[50\%\]{top:50%}.right-2{right:calc(var(--spacing) * 2)}.right-4{right:calc(var(--spacing) * 4)}.left-2{left:calc(var(--spacing) * 2)}.left-\[50\%\]{left:50%}.z-50{z-index:50}.col-start-2{grid-column-start:2}.row-span-2{grid-row:span 2/span 2}.row-start-1{grid-row-start:1}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-1{margin-inline:calc(var(--spacing) * -1)}.my-1{margin-block:var(--spacing)}.mt-4{margin-top:calc(var(--spacing) * 4)}.ml-auto{margin-left:auto}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.table{display:table}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-row{display:table-row}.field-sizing-content{field-sizing:content}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-2\.5{width:calc(var(--spacing) * 2.5);height:calc(var(--spacing) * 2.5)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-9{width:calc(var(--spacing) * 9);height:calc(var(--spacing) * 9)}.size-10{width:calc(var(--spacing) * 10);height:calc(var(--spacing) * 10)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-full{height:100%}.h-px{height:1px}.max-h-\(--radix-dropdown-menu-content-available-height\){max-height:var(--radix-dropdown-menu-content-available-height)}.max-h-\(--radix-select-content-available-height\){max-height:var(--radix-select-content-available-height)}.max-h-\[300px\]{max-height:300px}.min-h-16{min-height:calc(var(--spacing) * 16)}.w-fit{width:fit-content}.w-full{width:100%}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.min-w-0{min-width:0}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.shrink-0{flex-shrink:0}.caption-bottom{caption-side:bottom}.origin-\(--radix-dropdown-menu-content-transform-origin\){transform-origin:var(--radix-dropdown-menu-content-transform-origin)}.origin-\(--radix-select-content-transform-origin\){transform-origin:var(--radix-select-content-transform-origin)}.origin-\(--radix-tooltip-content-transform-origin\){transform-origin:var(--radix-tooltip-content-transform-origin)}.translate-x-\[-50\%\]{--tw-translate-x:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[-50\%\]{--tw-translate-y:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[calc\(-50\%_-_2px\)\]{--tw-translate-y: calc(-50% - 2px) ;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-45{rotate:45deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-in{animation:enter var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.resize{resize:both}.scroll-my-1{scroll-margin-block:var(--spacing)}.scroll-py-1{scroll-padding-block:var(--spacing)}.auto-rows-min{grid-auto-rows:min-content}.grid-rows-\[auto_auto\]{grid-template-rows:auto auto}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.self-start{align-self:flex-start}.justify-self-end{justify-self:flex-end}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded-\[2px\]{border-radius:2px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-xs{border-radius:var(--radius-xs)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-input{border-color:var(--color-input)}.bg-background{background-color:var(--color-background)}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-border{background-color:var(--color-border)}.bg-card{background-color:var(--color-card)}.bg-destructive{background-color:var(--color-destructive)}.bg-foreground{background-color:var(--color-foreground)}.bg-muted\/50{background-color:#ffffff08}@supports (color:color-mix(in lab,red,red)){.bg-muted\/50{background-color:color-mix(in oklab,var(--color-muted) 50%,transparent)}}.bg-popover{background-color:var(--color-popover)}.bg-primary{background-color:var(--color-primary)}.bg-secondary{background-color:var(--color-secondary)}.bg-transparent{background-color:#0000}.fill-current{fill:currentColor}.fill-foreground{fill:var(--color-foreground)}.p-0{padding:0}.p-1{padding:var(--spacing)}.p-2{padding:calc(var(--spacing) * 2)}.p-6{padding:calc(var(--spacing) * 6)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-6{padding-block:calc(var(--spacing) * 6)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-8{padding-left:calc(var(--spacing) * 8)}.text-center{text-align:center}.text-left{text-align:left}.align-middle{vertical-align:middle}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-none{--tw-leading:1;line-height:1}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.text-balance{text-wrap:balance}.whitespace-nowrap{white-space:nowrap}.text-background{color:var(--color-background)}.text-card-foreground{color:var(--color-card-foreground)}.text-destructive{color:var(--color-destructive)}.text-foreground{color:var(--color-foreground)}.text-muted-foreground{color:var(--color-muted-foreground)}.text-popover-foreground{color:var(--color-popover-foreground)}.text-primary{color:var(--color-primary)}.text-primary-foreground{color:var(--color-primary-foreground)}.text-secondary-foreground{color:var(--color-secondary-foreground)}.text-white{color:var(--color-white)}.capitalize{text-transform:capitalize}.underline-offset-4{text-underline-offset:4px}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-offset-background{--tw-ring-offset-color:var(--color-background)}.outline-hidden{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.outline-hidden{outline-offset:2px;outline:2px solid #0000}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[background-color\,border-color\,color\]{transition-property:background-color,border-color,color;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[color\,box-shadow\]{transition-property:color,box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.fade-in-0{--tw-enter-opacity:0}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.zoom-in-95{--tw-enter-scale:.95}.running{animation-play-state:running}.group-data-\[disabled\=true\]\:pointer-events-none:is(:where(.group)[data-disabled=true] *){pointer-events:none}.group-data-\[disabled\=true\]\:opacity-50:is(:where(.group)[data-disabled=true] *){opacity:.5}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-50:is(:where(.peer):disabled~*){opacity:.5}.selection\:bg-primary ::selection{background-color:var(--color-primary)}.selection\:bg-primary::selection{background-color:var(--color-primary)}.selection\:text-primary-foreground ::selection{color:var(--color-primary-foreground)}.selection\:text-primary-foreground::selection{color:var(--color-primary-foreground)}.file\:inline-flex::file-selector-button{display:inline-flex}.file\:h-7::file-selector-button{height:calc(var(--spacing) * 7)}.file\:border-0::file-selector-button{border-style:var(--tw-border-style);border-width:0}.file\:bg-transparent::file-selector-button{background-color:#0000}.file\:text-sm::file-selector-button{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.file\:font-medium::file-selector-button{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.file\:text-foreground::file-selector-button{color:var(--color-foreground)}.placeholder\:text-muted-foreground::placeholder{color:var(--color-muted-foreground)}@media(hover:hover){.hover\:bg-accent:hover{background-color:var(--color-accent)}.hover\:bg-destructive\/90:hover{background-color:#f26d6de6}@supports (color:color-mix(in lab,red,red)){.hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab,var(--color-destructive) 90%,transparent)}}.hover\:bg-muted\/50:hover{background-color:#ffffff08}@supports (color:color-mix(in lab,red,red)){.hover\:bg-muted\/50:hover{background-color:color-mix(in oklab,var(--color-muted) 50%,transparent)}}.hover\:bg-primary\/90:hover{background-color:#f5a623e6}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,var(--color-primary) 90%,transparent)}}.hover\:bg-secondary\/80:hover{background-color:#ffffff06}@supports (color:color-mix(in lab,red,red)){.hover\:bg-secondary\/80:hover{background-color:color-mix(in oklab,var(--color-secondary) 80%,transparent)}}.hover\:text-accent-foreground:hover{color:var(--color-accent-foreground)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}}.focus\:bg-accent:focus{background-color:var(--color-accent)}.focus\:text-accent-foreground:focus{color:var(--color-accent-foreground)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-ring:focus{--tw-ring-color:var(--color-ring)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus\:outline-hidden:focus{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.focus\:outline-hidden:focus{outline-offset:2px;outline:2px solid #0000}}.focus-visible\:border-ring:focus-visible{border-color:var(--color-ring)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-destructive\/20:focus-visible{--tw-ring-color:#f26d6d33}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-destructive\/20:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-destructive) 20%, transparent)}}.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:#f5a62380}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-ring) 50%, transparent)}}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.has-aria-expanded\:bg-muted\/50:has([aria-expanded=true]){background-color:#ffffff08}@supports (color:color-mix(in lab,red,red)){.has-aria-expanded\:bg-muted\/50:has([aria-expanded=true]){background-color:color-mix(in oklab,var(--color-muted) 50%,transparent)}}.has-data-\[slot\=card-action\]\:grid-cols-\[1fr_auto\]:has([data-slot=card-action]){grid-template-columns:1fr auto}.has-\[\>svg\]\:px-1\.5:has(>svg){padding-inline:calc(var(--spacing) * 1.5)}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-inline:calc(var(--spacing) * 2.5)}.has-\[\>svg\]\:px-3:has(>svg){padding-inline:calc(var(--spacing) * 3)}.has-\[\>svg\]\:px-4:has(>svg){padding-inline:calc(var(--spacing) * 4)}.aria-invalid\:border-destructive[aria-invalid=true]{border-color:var(--color-destructive)}.aria-invalid\:ring-destructive\/20[aria-invalid=true]{--tw-ring-color:#f26d6d33}@supports (color:color-mix(in lab,red,red)){.aria-invalid\:ring-destructive\/20[aria-invalid=true]{--tw-ring-color:color-mix(in oklab, var(--color-destructive) 20%, transparent)}}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true]{pointer-events:none}.data-\[disabled\=true\]\:opacity-50[data-disabled=true]{opacity:.5}.data-\[error\=true\]\:text-destructive[data-error=true]{color:var(--color-destructive)}.data-\[inset\]\:pl-8[data-inset]{padding-left:calc(var(--spacing) * 8)}.data-\[orientation\=horizontal\]\:h-px[data-orientation=horizontal]{height:1px}.data-\[orientation\=horizontal\]\:w-full[data-orientation=horizontal]{width:100%}.data-\[orientation\=vertical\]\:h-full[data-orientation=vertical]{height:100%}.data-\[orientation\=vertical\]\:w-px[data-orientation=vertical]{width:1px}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:var(--color-muted-foreground)}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:var(--color-accent)}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:var(--color-accent-foreground)}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:var(--spacing);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:calc(2*var(--spacing)*-1)}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:calc(2*var(--spacing))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x:var(--spacing);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:calc(2*var(--spacing)*-1)}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y:calc(var(--spacing) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:calc(2*var(--spacing))}.data-\[size\=default\]\:h-9[data-size=default]{height:calc(var(--spacing) * 9)}.data-\[size\=sm\]\:h-8[data-size=sm]{height:calc(var(--spacing) * 8)}:is(.\*\*\:data-\[slot\=command-input-wrapper\]\:h-12 *)[data-slot=command-input-wrapper]{height:calc(var(--spacing) * 12)}:is(.\*\:data-\[slot\=select-value\]\:line-clamp-1>*)[data-slot=select-value]{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}:is(.\*\:data-\[slot\=select-value\]\:flex>*)[data-slot=select-value]{display:flex}:is(.\*\:data-\[slot\=select-value\]\:items-center>*)[data-slot=select-value]{align-items:center}:is(.\*\:data-\[slot\=select-value\]\:gap-2>*)[data-slot=select-value]{gap:calc(var(--spacing) * 2)}.data-\[state\=closed\]\:animate-out[data-state=closed]{animation:exit var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\[state\=open\]\:animate-in[data-state=open]{animation:enter var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:var(--color-accent)}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:var(--color-accent-foreground)}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:var(--color-muted-foreground)}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:var(--color-muted)}.data-\[variant\=destructive\]\:text-destructive[data-variant=destructive]{color:var(--color-destructive)}.data-\[variant\=destructive\]\:focus\:bg-destructive\/10[data-variant=destructive]:focus{background-color:#f26d6d1a}@supports (color:color-mix(in lab,red,red)){.data-\[variant\=destructive\]\:focus\:bg-destructive\/10[data-variant=destructive]:focus{background-color:color-mix(in oklab,var(--color-destructive) 10%,transparent)}}.data-\[variant\=destructive\]\:focus\:text-destructive[data-variant=destructive]:focus{color:var(--color-destructive)}@media(min-width:40rem){.sm\:max-w-lg{max-width:var(--container-lg)}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:text-left{text-align:left}}@media(min-width:48rem){.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media(prefers-color-scheme:dark){.dark\:border-input{border-color:var(--color-input)}.dark\:bg-destructive\/60{background-color:#f26d6d99}@supports (color:color-mix(in lab,red,red)){.dark\:bg-destructive\/60{background-color:color-mix(in oklab,var(--color-destructive) 60%,transparent)}}.dark\:bg-input\/30{background-color:#ffffff08}@supports (color:color-mix(in lab,red,red)){.dark\:bg-input\/30{background-color:color-mix(in oklab,var(--color-input) 30%,transparent)}}@media(hover:hover){.dark\:hover\:bg-accent\/50:hover{background-color:#ffffff08}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-accent\/50:hover{background-color:color-mix(in oklab,var(--color-accent) 50%,transparent)}}.dark\:hover\:bg-input\/50:hover{background-color:#ffffff0e}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-input\/50:hover{background-color:color-mix(in oklab,var(--color-input) 50%,transparent)}}}.dark\:focus-visible\:ring-destructive\/40:focus-visible{--tw-ring-color:#f26d6d66}@supports (color:color-mix(in lab,red,red)){.dark\:focus-visible\:ring-destructive\/40:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-destructive) 40%, transparent)}}.dark\:aria-invalid\:ring-destructive\/40[aria-invalid=true]{--tw-ring-color:#f26d6d66}@supports (color:color-mix(in lab,red,red)){.dark\:aria-invalid\:ring-destructive\/40[aria-invalid=true]{--tw-ring-color:color-mix(in oklab, var(--color-destructive) 40%, transparent)}}.dark\:data-\[variant\=destructive\]\:focus\:bg-destructive\/20[data-variant=destructive]:focus{background-color:#f26d6d33}@supports (color:color-mix(in lab,red,red)){.dark\:data-\[variant\=destructive\]\:focus\:bg-destructive\/20[data-variant=destructive]:focus{background-color:color-mix(in oklab,var(--color-destructive) 20%,transparent)}}}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-inline:calc(var(--spacing) * 2)}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-block:calc(var(--spacing) * 1.5)}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:var(--color-muted-foreground)}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-inline:calc(var(--spacing) * 2)}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:calc(var(--spacing) * 5)}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:calc(var(--spacing) * 5)}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:calc(var(--spacing) * 12)}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-inline:calc(var(--spacing) * 2)}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-block:calc(var(--spacing) * 3)}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:calc(var(--spacing) * 5)}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:calc(var(--spacing) * 5)}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-3 svg:not([class*=size-]){width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&_svg\:not\(\[class\*\=\'text-\'\]\)\]\:text-muted-foreground svg:not([class*=text-]){color:var(--color-muted-foreground)}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\.border-b\]\:pb-6.border-b{padding-bottom:calc(var(--spacing) * 6)}.\[\.border-t\]\:pt-6.border-t{padding-top:calc(var(--spacing) * 6)}:is(.\*\:\[span\]\:last\:flex>*):is(span):last-child{display:flex}:is(.\*\:\[span\]\:last\:items-center>*):is(span):last-child{align-items:center}:is(.\*\:\[span\]\:last\:gap-2>*):is(span):last-child{gap:calc(var(--spacing) * 2)}:is(.data-\[variant\=destructive\]\:\*\:\[svg\]\:text-destructive\![data-variant=destructive]>*):is(svg){color:var(--color-destructive)!important}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y:2px;translate:var(--tw-translate-x) var(--tw-translate-y)}.\[\&\>tr\]\:last\:border-b-0>tr:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}}@property --tw-animation-delay{syntax:"*";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:"*";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:"*";inherits:false}@property --tw-animation-fill-mode{syntax:"*";inherits:false;initial-value:none}@property --tw-animation-iteration-count{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0)scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1))rotate(var(--tw-enter-rotate,0));filter:blur(var(--tw-enter-blur,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0)scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1))rotate(var(--tw-exit-rotate,0));filter:blur(var(--tw-exit-blur,0))}}:root{--bg: #0a0b0d;--bg-side: #0c0e10;--bg-raise: #15171b;--surface: rgba(255,255,255,.03);--hover: rgba(255,255,255,.06);--border: rgba(255,255,255,.07);--border-2: rgba(255,255,255,.11);--code-bg: #0d0f12;--text: #eef0f3;--text-dim: #9aa0a9;--text-faint: #868b93;--text-ghost: #666b74;--accent: #f5a623;--accent-bright: #ffcf85;--accent-dim: #d3861a;--accent-press: #e0951a;--glow: rgba(245,166,35,.13);--add: #4cc38a;--del: #f26d6d;--mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;--ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;--r-ctl: 7px;--r-card: 10px;--r-over: 14px;--page-read: 768px;--page-app: 768px;--page-wide: 1200px;--hero-top: clamp(32px, 8vh, 88px)}@font-face{font-family:"Jersey 10";font-style:normal;font-weight:400;font-display:swap;src:url(/assets/jersey-10-COnnvJff.woff2) format("woff2")}@font-face{font-family:Logo Fallback;src:local("Helvetica Neue"),local("Arial"),local("Segoe UI"),local("Roboto");size-adjust:73%}*{box-sizing:border-box}[hidden]{display:none!important}html,body{height:100%;margin:0}#root{display:contents}body{display:flex;background:var(--bg);color:var(--text);font:13px/1.5 var(--ui);letter-spacing:-.006em;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}::selection{background:var(--glow);color:var(--accent-bright)}:focus-visible{outline:2px solid var(--accent);outline-offset:1px;border-radius:5px}:focus-visible{outline-color:var(--accent)}.admin input:focus-visible{outline:2px solid var(--accent);outline-offset:1px}input[type=checkbox]{accent-color:var(--accent);width:20px;height:20px;color-scheme:dark}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.sprite{position:absolute}.ico{width:16px;height:16px;flex:none;stroke:currentColor;stroke-width:1.6;fill:none;stroke-linecap:round;stroke-linejoin:round}button,input,a.btn{font-family:inherit}#sidebar{width:264px;min-width:210px;background:var(--bg-side);border-right:1px solid var(--border);display:flex;flex-direction:column;overflow:hidden}#vault{display:flex;align-items:center;gap:9px;height:52px;padding:0 12px 0 14px;border-bottom:1px solid var(--border);position:relative;z-index:45}#vault-badge{flex:none;display:grid;place-items:center;color:var(--accent)}#vault-name{font-family:"Jersey 10","Logo Fallback",var(--ui);font-size:18px;font-weight:400;font-synthesis:none;letter-spacing:.01em;line-height:1;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vault-actions{display:flex;align-items:center;gap:4px}#vault #signout,.icon-btn2{width:28px;height:28px;border-radius:6px;display:inline-flex;align-items:center;justify-content:center;color:var(--text-ghost);background:transparent;border:none;cursor:pointer;text-decoration:none}#vault #signout:hover,.icon-btn2:hover{color:var(--text);background:var(--hover)}#vault #signout .ico,.icon-btn2 .ico{width:16px;height:16px}#projects{flex:none;max-height:32%;overflow-y:auto;padding:10px 8px 8px;border-bottom:1px solid var(--border)}.nav-head{display:flex;align-items:center;justify-content:space-between;padding:6px 8px;font-size:10.5px;font-weight:600;text-transform:uppercase;letter-spacing:.07em;color:var(--text-faint)}.nav-add{display:grid;place-items:center;width:18px;height:18px;border:none;background:transparent;color:var(--text-ghost);cursor:pointer;border-radius:5px}.nav-add .ico{width:14px;height:14px}.nav-add:hover{color:var(--text);background:var(--hover)}#projects ul{list-style:none;margin:0;padding:0}#projects .row{display:flex;align-items:center;gap:9px;height:31px;padding:0 8px;border-radius:7px;color:var(--text-dim);cursor:pointer;position:relative;white-space:nowrap;overflow:hidden}.proj-mark{width:17px;height:17px;border-radius:5px;flex:none;display:grid;place-items:center;font-size:10px;font-weight:700;color:#0a0b0d;letter-spacing:-.02em;text-transform:uppercase}.proj-mark svg{width:11px;height:11px}.proj-menu [data-slot=select-item]{display:flex;align-items:center;gap:8px}#projects .row .label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}#projects .row:hover{background:var(--hover);color:var(--text)}#projects .row.active{background:var(--glow);color:var(--accent-bright)}#projects .row.active:before{content:"";position:absolute;left:0;top:6px;bottom:6px;width:2px;border-radius:2px;background:var(--accent)}#tree{flex:1;overflow-y:auto;padding:8px 8px 24px}.tguide{position:absolute;top:0;bottom:0;width:1px;background:var(--border);pointer-events:none}#tree .row{display:flex;align-items:center;gap:6px;height:28px;padding:0 8px;border-radius:7px;color:var(--text-dim);cursor:pointer;position:relative;white-space:nowrap;overflow:hidden}#tree .row:hover{background:var(--hover);color:var(--text)}#tree .row.active{background:var(--glow);color:var(--accent-bright)}#tree .row.active:before{content:"";position:absolute;left:0;top:5px;bottom:5px;width:2px;border-radius:2px;background:var(--accent)}#tree .chev{width:14px;height:14px;flex:none;color:var(--text-ghost);transition:transform .12s;display:flex;align-items:center;justify-content:center}#tree .chev .ico{width:13px;height:13px}#tree .ticon{flex:none;display:flex;color:var(--text-ghost)}#tree .ticon .ico{width:15px;height:15px}#tree .row:hover .ticon,#tree .row:hover .chev{color:var(--text-faint)}#tree .row.active .ticon,#tree .row.active .chev{color:var(--accent)}#tree .label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}#tree .file .label{font-size:12.5px}#tree .file .chev{visibility:hidden}#tree .row.collapsed .chev{transform:rotate(-90deg)}.field-err{color:var(--del);font-size:12px;margin:6px 2px 0}.modal,#palette{translate:none}.admin-card-table{padding:0}.admin-table{width:100%;border-collapse:collapse;table-layout:fixed}.admin-table td .ai-main,.admin-table td a.ai-main,.admin-table td .ai-copy,.admin-table td .ai-tag{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.admin-table th:last-child,.admin-table td:last-child{width:186px;text-align:right}.admin-table tr:last-child td{border-bottom:none}.admin-table th{text-align:left;font-size:11px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;color:var(--text-faint);padding:0;border-bottom:1px solid var(--border);-webkit-user-select:none;user-select:none}.admin-table td{padding:0;border-bottom:1px solid var(--border);overflow:hidden;text-overflow:ellipsis}.admin-table tr.admin-item{display:table-row}.admin-table tr.admin-item td{padding:8px 10px}.nav-menu{list-style:none;margin:6px 0 0;padding:0}.nav-menu .row .ico{width:15px;height:15px;flex:none;color:var(--text-ghost)}.nav-menu .row.active .ico{color:var(--accent-bright)}.proj-row{display:flex;align-items:center;gap:4px;padding:0 10px 4px 12px}#project-select{flex:1;min-width:0;height:30px;padding:0 9px;display:inline-flex;align-items:center;gap:8px;border:1px solid var(--border);border-radius:var(--r-ctl);background:var(--surface);color:var(--text);font:inherit;font-size:12.5px;font-weight:500;cursor:pointer;white-space:nowrap;outline:none}#project-select>span:last-of-type{overflow:hidden;text-overflow:ellipsis}#project-select:hover{background:var(--hover);border-color:var(--border-2)}#project-select svg{color:var(--text-ghost)}.proj-menu{z-index:80;min-width:var(--radix-select-trigger-width, 200px);border:1px solid var(--border-2);border-radius:9px;padding:4px;background:var(--bg-raise);box-shadow:0 10px 32px #00000059}.proj-menu [role=option]{font-size:12.5px;color:var(--text-dim);border-radius:6px;outline:none}.proj-menu [role=option][data-highlighted]{background:var(--hover);color:var(--text)}#accountbar{position:relative;border-top:1px solid var(--border);padding:7px 10px}#account-btn{width:100%;display:flex;align-items:center;gap:9px;text-align:left;padding:6px 8px;border:none;border-radius:7px;background:transparent;color:var(--text-dim);cursor:pointer;font:inherit}#account-btn:hover{background:var(--hover);color:var(--text)}#account-btn .avatar{width:26px;height:26px;flex:none;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;color:#fff;font-size:12px;font-weight:700}#account-btn .acct{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}#account-btn .acct b{font-size:12.5px;font-weight:600;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#account-btn .acct small{font-size:11px;color:var(--text-faint);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#account-btn>.ico{width:14px;height:14px;color:var(--text-ghost)}#account-menu{min-width:var(--radix-dropdown-menu-trigger-width, 220px);padding:5px;border:1px solid var(--border-2);border-radius:9px;background:var(--bg-raise);box-shadow:0 10px 32px #00000059;display:flex;flex-direction:column;z-index:80;outline:none}#account-menu [role=menuitem]{outline:none}#account-menu [role=menuitem][data-highlighted]{background:var(--hover);color:var(--text)}#account-menu .menu-sec{padding:7px 9px 3px;font-size:10.5px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--text-faint)}#account-menu [role=menuitem]{display:flex;align-items:center;gap:8px;padding:7px 9px;border:none;border-radius:6px;background:transparent;text-align:left;color:var(--text-dim);font:inherit;font-size:12.5px;cursor:pointer;text-decoration:none}#account-menu [role=menuitem]:hover{background:var(--hover);color:var(--text)}#account-menu [role=menuitem] b{font-weight:600}#account-menu [role=menuitem] .ico{width:15px;height:15px}#account-menu #signout{color:var(--del)}#account-menu #signout:hover{color:var(--del);background:var(--hover)}#main{flex:1;display:flex;flex-direction:column;min-width:0}#topbar{position:relative;display:flex;align-items:center;gap:9px;height:52px;padding:0 16px;border-bottom:1px solid var(--border)}.icon-btn{display:none;width:34px;height:34px;border:none;background:transparent;color:var(--text-dim);cursor:pointer;border-radius:7px;align-items:center;justify-content:center}.icon-btn:hover{color:var(--text);background:var(--hover)}#crumb{font-size:12.5px;color:var(--text);font-weight:500;letter-spacing:-.01em;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#crumb .crumb-seg{color:var(--text-dim);cursor:pointer}#crumb .crumb-seg:hover{color:var(--accent-bright)}#crumb .crumb-sep{color:var(--text-ghost);margin:0 5px}#meta{flex:1;min-width:0;font-size:12px;color:var(--text-faint);text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.btn{display:inline-flex;align-items:center;gap:6px;flex:none;height:30px;padding:0 11px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--text-dim);font-size:12.5px;font-weight:500;cursor:pointer;text-decoration:none}.btn:hover{background:var(--hover);color:var(--text);border-color:var(--border-2)}.btn .ico{width:15px;height:15px}.btn.ghost{color:var(--text-dim)}.tipcard{display:flex;align-items:center;gap:7px;white-space:nowrap;padding:6px 9px;border-radius:8px;border:1px solid var(--border-2);background:var(--surface-solid, var(--bg-raise));color:var(--text);font-size:12.5px;font-weight:500;box-shadow:0 8px 24px #00000059;z-index:80}.tipcard kbd{font:11px var(--ui);color:var(--text-faint);background:var(--hover);border:1px solid var(--border-2);border-radius:5px;padding:1px 5px}#more-menu{position:absolute;right:12px;top:calc(100% - 4px);z-index:80;background:var(--bg-raise);border:1px solid var(--border-2);border-radius:var(--r-card);box-shadow:0 18px 44px -14px #000000bf;padding:6px;min-width:168px}.more-item{display:block;width:100%;text-align:left;min-height:40px;padding:0 12px;background:transparent;border:none;cursor:pointer;color:var(--text);font:inherit;font-size:13.5px;border-radius:var(--r-ctl)}.more-item:hover{background:var(--hover)}#content{flex:1;overflow-y:auto;padding:44px 40px 110px;scroll-behavior:smooth}.page{width:100%;max-width:var(--page-app);margin-inline:auto;min-width:0}.page.read{max-width:var(--page-read)}.page.wide{max-width:var(--page-wide)}.empty{color:var(--text-faint);text-align:center;margin-top:var(--hero-top)}.empty-hint{display:block;margin-top:6px;font-size:12px;color:var(--text-faint)}.onboard{max-width:560px;margin:var(--hero-top) auto 0}.onboard h1{font-size:25px;font-weight:640;letter-spacing:-.02em;margin:0 0 8px;color:#f4f6f9}.onboard>p{color:var(--text-dim);margin:0 0 28px;font-size:14px}.ob-card{background:var(--bg-side);border:1px solid var(--border);border-radius:var(--r-card);padding:20px 22px;margin-bottom:14px}.ob-card h3{margin:0 0 6px;font-size:14.5px;font-weight:600}.ob-card p{margin:0 0 14px;font-size:13px;color:var(--text-dim)}.ob-row{display:flex;gap:9px}.ob-row input{flex:1;height:34px;padding:0 12px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--text);font:inherit;font-size:13px;outline:none}.ob-row input:focus{border-color:var(--accent);background:var(--hover)}.pbtn{display:inline-flex;align-items:center;gap:6px;flex:none;height:32px;padding:0 14px;border-radius:var(--r-ctl);border:none;background:var(--accent);color:#241704;font-size:13px;font-weight:600;cursor:pointer;white-space:nowrap}.pbtn:hover{background:var(--accent-bright)}.pbtn .ico{width:15px;height:15px}.danger-btn{display:inline-flex;align-items:center;height:32px;padding:0 14px;border-radius:var(--r-ctl);border:none;background:#b3382e;color:#fff;font-size:13px;font-weight:600;cursor:pointer}.danger-btn:hover{background:#c94336}[data-slot=input],[data-slot=textarea]{font:inherit;color:var(--text)}[data-slot=input][aria-invalid=true]:focus-visible,[data-slot=textarea][aria-invalid=true]:focus-visible{border-color:var(--del)}[data-slot=card],[data-slot=dropdown-menu-content]{border-color:var(--border)}.project-settings{display:flex;flex-direction:column;gap:14px}.project-settings>h2{font-size:21px;font-weight:640;letter-spacing:-.02em;margin:0 0 4px;color:#f4f6f9}.ps-form{display:flex;flex-direction:column;gap:18px}.ps-field{display:flex;flex-direction:column;gap:7px}.ps-field label{font-size:12.5px;color:var(--text-dim)}.ps-opt{color:var(--text-ghost);font-weight:400}.ps-icon-row{display:flex;align-items:center;gap:10px}.ps-icon-row .proj-mark{width:26px;height:26px;border-radius:7px}.ps-icon-row .proj-mark svg{width:15px;height:15px}.ps-meta{display:flex;align-items:baseline;justify-content:space-between;gap:12px}.ps-meta .field-err{flex:0 1 auto;margin:0}.ps-count{font-size:11.5px;color:var(--text-faint);font-variant-numeric:tabular-nums}.ps-actions{display:flex;justify-content:flex-end}.ps-icon-grid{display:grid;grid-template-columns:repeat(6,30px);gap:4px;padding:8px}.ps-icon-cell{display:grid;place-items:center;width:30px;height:30px;border-radius:7px;border:1px solid transparent;background:none;color:var(--text-dim);cursor:pointer}.ps-icon-cell svg{width:16px;height:16px}.ps-icon-cell:hover{background:var(--hover);color:var(--text)}.ps-icon-cell.active{border-color:var(--accent);color:var(--accent-bright)}.ps-danger [data-slot=card-title]{font-size:10.5px;text-transform:uppercase;letter-spacing:.07em;color:#d2695e;font-weight:600}.ps-chip{margin-left:10px;padding:2px 8px;border-radius:999px;border:1px solid var(--border);background:var(--surface);color:var(--text-faint);font-size:11px;font-weight:600;letter-spacing:.02em;vertical-align:middle}.ps-people h4{font-size:12.5px;font-weight:600;color:var(--text-dim);margin:0}.ps-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;font-size:13px;color:var(--text-dim);margin:0 0 10px}.ps-people select{height:28px;padding:0 8px;border-radius:6px;border:1px solid var(--border);background:var(--surface);color:var(--text);font:inherit;font-size:12.5px}.ps-people select:disabled{opacity:.6;cursor:default}.ps-note{color:var(--text-faint);font-size:12.5px;margin:0 0 12px;max-width:56ch;line-height:1.55}.ps-people-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:20px 0 8px}.ps-danger p{color:var(--text-dim);font-size:13px;margin:0 0 14px;max-width:52ch;line-height:1.55}.ps-facts{display:grid;grid-template-columns:auto 1fr;gap:8px 20px;margin:0;font-size:13px}.ps-facts dt{color:var(--text-faint)}.ps-facts dd{margin:0;color:var(--text-dim)}.admin h1{font-size:21px;font-weight:640;letter-spacing:-.02em;margin:0 0 6px;color:#f4f6f9}.admin h3{font-size:10.5px;text-transform:uppercase;letter-spacing:.07em;color:var(--text-faint);font-weight:600;margin:30px 0 10px}.admin-lbl{flex:1 1 100%;margin:0 0 6px;font-size:12.5px;font-weight:600;color:var(--text-dim)}.admin-sub{color:var(--text-dim);font-size:13.5px;margin:-2px 0 16px;line-height:1.55}.admin-h{display:flex;align-items:center;justify-content:space-between;margin:30px 0 10px}.admin-h h3{margin:0}.admin-row{display:flex;gap:9px;margin-bottom:8px}.admin-row input{flex:1;height:34px;padding:0 12px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--text);font:inherit;font-size:13px;outline:none}.admin-row input:focus{border-color:var(--accent);background:var(--hover)}.admin-list{border:1px solid var(--border);border-radius:var(--r-card);overflow:hidden;background:var(--bg-side)}.admin-list.admin-card-table{overflow-x:auto;overflow-y:hidden}.admin-item{display:flex;align-items:center;gap:11px;padding:11px 14px;border-bottom:1px solid var(--border);font-size:13.5px}.modal-actions .ai-btn{height:32px}.empty a{color:var(--accent);text-decoration:none;display:inline-block;padding:6px 10px}.empty a:hover{text-decoration:underline}.empty h3{margin:0 0 8px;font-size:16px;color:var(--text)}.ai-copy{text-align:left;background:none;border:0;padding:6px 0;cursor:pointer}.ai-copy:hover{color:var(--text)}a.ai-main{color:var(--text-dim);text-decoration:none;padding:6px 0}a.ai-main:hover{color:var(--accent)}.th-sort{display:block;width:100%;text-align:left;background:none;border:0;padding:6px 10px;font:inherit;color:inherit;letter-spacing:inherit;text-transform:inherit;cursor:pointer}.th-sort:hover{color:var(--text-dim)}.proj-trigger>[data-slot=select-value]{display:block;flex:1 1 auto;min-width:0;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.role-cell{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:center;justify-items:start}.admin-table td .role-static{text-align:left}.role-chip-row{margin:-6px 0 12px}.role-chip{margin-left:0;padding:2px 8px;border:1px solid var(--border-2);border-radius:99px;vertical-align:middle}.ext{margin-left:4px;color:var(--text-faint);font-size:11px}.admin-item:last-child{border-bottom:none}.admin-item:hover{background:var(--hover)}.field-err{flex:1 1 100%;margin:6px 0 0}.admin-row{flex-wrap:wrap}.admin-row input[aria-invalid=true]{border-color:var(--del)}.ai-main{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text)}.admin-item>.ai-main{flex:1 1 55%;min-width:22ch}.admin-item>.ai-tag{flex:0 0 auto;min-width:0;max-width:45%}@media(max-width:1000px){.admin-item{flex-wrap:wrap}.admin-item>.ai-tag{flex:1 1 100%;max-width:100%}}.admin-table td .ai-main{min-width:0}.ai-main.mono{font:12px var(--mono);color:var(--text-dim);cursor:pointer}.ai-tag{font-size:11.5px;color:var(--text-faint);flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.admin-item select{height:28px;background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:0 8px;font:inherit;font-size:12.5px;cursor:pointer}.admin-item select:hover{border-color:var(--border-2)}.ai-btn,.ai-del{flex:none;height:27px;padding:0 11px;border-radius:6px;border:1px solid var(--border);background:var(--surface);color:var(--text-dim);font:inherit;font-size:12px;font-weight:500;cursor:pointer}.ai-del{color:var(--del);border-color:#f26d6d47}.ai-del:hover{background:#f26d6d1f;border-color:var(--del);color:#ff8b8b}.ai-btn:hover{background:var(--hover);color:var(--text);border-color:var(--border-2)}.admin-empty{padding:14px;color:var(--text-faint);font-size:13px}.admin-item.toggle{cursor:pointer;align-items:flex-start}.admin-item.toggle .ai-main{white-space:normal}.tg-label{font-size:13.5px;font-weight:550;color:var(--text)}.tg-desc{font-size:12px;color:var(--text-faint);margin-top:3px;line-height:1.5}.admin-item.toggle input{margin-top:2px;flex:none}.dl-title{display:flex;align-items:center;gap:10px;font-size:21px;font-weight:640;letter-spacing:-.02em;margin:0 0 4px;color:#f4f6f9}.dl-title-icon{display:flex;color:var(--accent)}.dl-title-icon .ico{width:20px;height:20px}.dl-sub{color:var(--text-faint);font-size:12.5px;margin:0 0 18px}.dl-items{border:1px solid var(--border);border-radius:var(--r-card);overflow:hidden;background:var(--bg-side)}.dl-row{display:flex;align-items:center;gap:11px;padding:10px 14px;border-bottom:1px solid var(--border);cursor:pointer}.dl-row:last-child{border-bottom:none}.dl-row:hover{background:var(--hover)}.dl-row .ticon{flex:none;display:flex;color:var(--text-ghost)}.dl-row .ticon .ico{width:16px;height:16px}.dl-row:hover .ticon{color:var(--text-faint)}.dl-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13.5px;color:var(--text)}.dl-meta{flex:none;font-size:12px;color:var(--text-faint);font-variant-numeric:tabular-nums}.heatdot{flex:none;width:7px;height:7px;border-radius:50%;background:var(--accent)}.heatdot.lvl1{opacity:.3}.heatdot.lvl2{opacity:.55}.heatdot.lvl3{opacity:.8}.heatdot.lvl4{opacity:1;box-shadow:0 0 6px #f5a6238c}.dl-empty{padding:24px 14px;color:var(--text-faint);font-size:13px;border:1px dashed var(--border);border-radius:var(--r-card);text-align:center}.dl-h3{margin:28px 0 8px;font-size:10.5px;text-transform:uppercase;letter-spacing:.07em;color:var(--text-faint);font-weight:600}.dl-hlist{border:1px solid var(--border);border-radius:var(--r-card);background:var(--bg-side);overflow:hidden;max-width:none}.dl-hlist .hentry:last-child{border-bottom:none}.hentry.clickable{cursor:pointer}.hentry.clickable:hover{background:var(--hover)}.dl-more{margin-top:10px}#vault-name.vault-link{cursor:pointer}#vault-name.vault-link:hover{color:var(--accent-bright)}.gd-tabs{display:flex;gap:2px;margin:20px 0 16px;border-bottom:1px solid var(--border);overflow-x:auto}.gd-tab{font:inherit;font-size:13px;font-weight:600;padding:7px 12px 9px;background:none;border:none;border-bottom:2px solid transparent;margin-bottom:-1px;color:var(--text-faint);cursor:pointer;white-space:nowrap}.gd-tab:hover{color:var(--text)}#account-btn.active{background:var(--glow)}#account-btn.active .acct b{color:var(--accent-bright)}.gd-tab.active{color:var(--accent-bright);border-bottom-color:var(--accent)}.gd-step{margin:0 0 18px}.gd-step-head{display:flex;align-items:center;gap:10px;margin-bottom:3px}.gd-num{flex:none;width:22px;height:22px;border-radius:50%;background:var(--glow);color:var(--accent-bright);font-size:12px;font-weight:700;display:flex;align-items:center;justify-content:center}.gd-step-title{font-weight:600;font-size:14px;color:var(--text)}.gd-desc{margin:2px 0 8px 32px;color:var(--text-faint);font-size:13px;line-height:1.5}.gd-extra{font-size:12.5px;margin-top:6px}.gd-code{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:10px;margin:6px 0 6px 32px;padding:10px 12px;background:var(--bg-raise);border:1px solid var(--border);border-radius:var(--r-card);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12.5px;line-height:1.6;color:var(--text)}.gd-code>code{display:block;min-width:0;overflow-x:auto;white-space:pre}.gd-copy{align-self:start;font:inherit;font-family:inherit;font-size:11px;font-weight:600;padding:3px 9px;border-radius:6px;border:1px solid var(--border-2);background:var(--bg-raise);color:var(--text-faint);cursor:pointer}.gd-copy:hover{color:var(--accent-bright);border-color:var(--accent-dim)}.gd-solo .gd-desc,.gd-solo .gd-code{margin-left:0}.gd-manual{margin:10px 0 0}.gd-manual>summary{display:inline-block;font-size:12.5px;font-weight:600;color:var(--text-faint);cursor:pointer;padding:4px 0}.gd-manual>summary:hover{color:var(--text)}.gd-manual .gd-desc,.gd-manual .gd-code{margin-left:0}.gd-done{margin:22px 0 8px;padding:12px 14px;border:1px solid var(--border);border-radius:var(--r-card);background:var(--bg-side);color:var(--text-faint);font-size:13px;line-height:1.5}.home-insights{margin-top:30px;padding-top:22px;border-top:1px solid var(--border)}.in-title{font-size:21px;font-weight:640;letter-spacing:-.02em;margin:0 0 4px;color:#f4f6f9}.in-title .in-scope{color:var(--text-ghost);font-weight:500;font-size:15px}.gd-head{display:flex;align-items:center;gap:9px}.gd-head .proj-mark{width:22px;height:22px;border-radius:6px}.gd-head .proj-mark svg{width:13px;height:13px}.in-desc{color:var(--text-dim);font-size:13.5px;line-height:1.55;margin:0 0 10px;max-width:62ch}.in-lens{display:flex;gap:6px;margin:0 0 14px}.in-lens-btn{font:inherit;font-size:12px;padding:5px 12px;border-radius:999px;border:1px solid var(--border);background:none;color:var(--text-faint);cursor:pointer}.in-lens-btn:hover{color:var(--text)}.in-lens-btn.active{color:var(--accent);border-color:var(--accent)}.in-chart{width:100%;max-width:760px;height:auto;border:1px solid var(--border);border-radius:var(--r-card);background:var(--bg-side);margin-bottom:6px}.in-axis{stroke:var(--border);stroke-width:1}.in-threshold{stroke:var(--border);stroke-width:1;stroke-dasharray:4 4}.in-danger-zone{fill:#f26d6d0d}.in-label{fill:var(--text-ghost);font-size:11px}.in-quad{fill:var(--text-ghost);font-size:10.5px;text-transform:uppercase;letter-spacing:.06em}.in-quad-danger{fill:#e07070}.in-pt{fill:var(--accent);opacity:.5;cursor:pointer}.in-pt:hover{opacity:1}.in-pt.cold{fill:var(--text-ghost);opacity:.25}.in-pt.danger{fill:#e05d5d;opacity:.6}.in-treemap{background:#0c0d10}.in-tm-group{fill:none;stroke:var(--border);stroke-width:1;cursor:pointer;pointer-events:all}.in-tm-glabel{fill:var(--text-faint);font-size:10px;text-transform:uppercase;letter-spacing:.05em;cursor:pointer}.in-tm-cell{cursor:pointer}.in-tm-cell:hover{stroke:#fff;stroke-width:1}.in-tm-label{fill:#0c0d10;font-size:10.5px;font-weight:620;cursor:pointer;pointer-events:none}.in-hotpath{border:1px solid var(--border);border-radius:var(--r-card);background:var(--bg-side);overflow:hidden}.in-hp-row{display:flex;align-items:center;gap:10px;padding:6px 12px;border-bottom:1px solid var(--border);cursor:pointer}.in-hp-row:last-child{border-bottom:none}.in-hp-row:hover{background:var(--hover)}.in-hp-name{flex:0 0 300px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;color:var(--text)}.in-hp-name.danger{color:var(--accent)}.in-hp-bar{flex:1;display:flex;height:10px;border-radius:3px;overflow:hidden}.in-hp-agent{background:var(--accent)}.in-hp-human{background:#5b8def}.in-hp-count{flex:none;width:40px;text-align:right;font-size:11.5px;color:var(--text-faint);font-variant-numeric:tabular-nums}.in-legend{margin:8px 2px 0;font-size:11.5px;color:var(--text-faint)}.in-sw{display:inline-block;width:10px;height:10px;border-radius:2px;vertical-align:-1px}.in-sw.agent{background:var(--accent)}.in-sw.human{background:#5b8def}.in-matrix rect{transition:opacity .1s}.in-matrix rect:hover{opacity:.85}.hentry{padding:11px 12px;border-bottom:1px solid var(--border)}.hentry:hover{background:#ffffff04}.hline{display:flex;gap:10px;align-items:center}.hkind{display:inline-flex;color:var(--add)}.hkind .ico{width:13px;height:13px}.hentry.edit .hkind{color:var(--accent)}.hentry.delete .hkind{color:var(--del)}.htag{flex:none;font-size:10px;text-transform:uppercase;letter-spacing:.06em;font-weight:600;padding:1px 6px;border-radius:4px}.hentry.add .htag{color:var(--add);background:#4cc38a1f}.hentry.edit .htag{color:var(--accent-bright);background:var(--glow)}.hentry.delete .htag{color:#ff8b8b;background:#f26d6d1f}.hpath{font-weight:500;cursor:pointer;color:var(--text);font-size:13px}.hpath:hover{color:var(--accent-bright)}.htime{margin-left:auto;color:var(--text-faint);font-size:12px;font-variant-numeric:tabular-nums}.hmeta{display:flex;align-items:center;gap:14px;margin-top:4px;padding-left:23px;font-size:12px;color:var(--text-dim)}.hdev,.hsize{color:var(--text-faint)}.hsize{font-variant-numeric:tabular-nums;white-space:nowrap;flex:none}.hnote{margin-top:4px;padding-left:23px;font-size:12px;color:var(--text-faint);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer}.hnote:hover{color:var(--text)}.hnote.open{white-space:normal;overflow-wrap:anywhere}.hnote:before{content:"› ";color:var(--text-ghost)}.hnote a{color:var(--accent-bright);text-decoration:none}.hnote a:hover{text-decoration:underline}#palette{position:fixed;top:12vh;left:50%;transform:translate(-50%);z-index:151;display:block;width:min(560px,92vw);background:var(--bg-raise);border:1px solid var(--border-2);border-radius:var(--r-over);box-shadow:0 24px 70px -18px #000c;overflow:hidden;outline:none;padding:0}#palette-inputwrap{display:flex;align-items:center;gap:11px;padding:14px 16px;border-bottom:1px solid var(--border)}#palette-inputwrap [data-slot=command-input-wrapper]{flex:1;display:flex;border-bottom:0;padding:0;height:auto}#palette-inputwrap [data-slot=command-input-wrapper]>svg:not(.ico){display:none}#palette input,#palette input:focus{border:none;background:transparent;box-shadow:none;outline:none;padding:0}#palette-inputwrap .ico{width:17px;height:17px;color:var(--text-faint)}#palette-input{flex:1;width:100%;border:none;background:transparent;color:var(--text);font:inherit;font-size:15px;letter-spacing:-.01em;outline:none;padding:0}#palette-input::placeholder{color:var(--text-ghost)}#palette-results{list-style:none;margin:0;padding:8px;max-height:46vh;overflow-y:auto}#palette-results [cmdk-item]{display:flex;align-items:center;gap:11px;height:38px;padding:0 10px;border-radius:9px;cursor:pointer;color:var(--text-dim);font-size:13.5px}#palette-results [cmdk-item][data-selected=true]{background:var(--glow)}#palette-results [cmdk-item][data-selected=true] .picon{color:var(--accent)}#palette-results [cmdk-item][data-selected=true] .plabel,#palette-results [cmdk-item][data-selected=true] .plabel b{color:var(--accent-bright)}#palette-results li{display:flex;align-items:center;gap:11px;height:38px;padding:0 10px;border-radius:9px;cursor:pointer;color:var(--text-dim);font-size:13.5px}#palette-results li.selected{background:var(--glow)}#palette-results li.selected .picon{color:var(--accent)}#palette-results li.selected .plabel,#palette-results li.selected .plabel b{color:var(--accent-bright)}#palette-results li .picon{width:18px;flex:none;display:flex;justify-content:center;color:var(--text-faint)}#palette-results li .picon .ico{width:15px;height:15px}#palette-results li .plabel{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--text)}#palette-results li .plabel b{color:var(--accent-bright);font-weight:600}#palette-results li .pkind{flex:none;font-size:10.5px;text-transform:uppercase;letter-spacing:.05em;color:var(--text-ghost)}#palette-results .pempty{color:var(--text-faint);cursor:default;justify-content:center;height:auto;padding:14px}#palette-hint{padding:9px 16px;border-top:1px solid var(--border);font-size:11px;color:var(--text-ghost)}[data-slot=dialog-overlay]{position:fixed;inset:0;background:#06070999;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);z-index:150}.modal{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:151;display:block;background:var(--bg-raise);border:1px solid var(--border-2);border-radius:var(--r-over);padding:22px 24px;width:min(460px,calc(100vw - 40px));box-shadow:0 24px 70px -18px #000c;outline:none}.modal h3{margin:0 0 10px;font-size:16px;font-weight:620;letter-spacing:-.01em}.modal p{margin:0 0 16px;font-size:13.5px;color:var(--text-dim);line-height:1.55}.modal p b{color:var(--text)}.modal-url{font:12px var(--mono);background:var(--surface);border:1px solid var(--border);border-radius:var(--r-ctl);padding:9px 11px;color:var(--text-dim);word-break:break-all;margin-bottom:16px}.modal-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}.modal-label{display:block;font-size:12.5px;color:var(--text-dim);margin:0 0 6px}.modal-msg{margin:0 0 16px;font-size:13.5px;color:var(--text-dim);line-height:1.55}.modal-input{width:100%;height:36px;padding:0 12px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--text);font:inherit;font-size:14px;margin-bottom:16px;outline:none}.modal-input:focus{border-color:var(--accent);background:var(--hover)}[data-sonner-toast]{background:var(--bg-raise)!important;color:var(--text)!important;border:1px solid var(--border-2)!important;border-radius:10px!important;font-size:13.5px!important;box-shadow:0 18px 44px -12px #000000b3!important}[data-sonner-toast][data-type=error]{border-color:#f26d6d80!important;color:#ffb0aa!important}#sb-backdrop{display:none}@media(max-width:900px){#sidebar{position:fixed;z-index:60;top:0;left:0;height:100%;transform:translate(-100%);transition:transform .2s ease;box-shadow:0 0 40px #0009}body.sb-open #sidebar{transform:translate(0)}body.sb-open #sb-backdrop{display:block;position:fixed;inset:0;background:#0000008c;z-index:50}.icon-btn,#search-btn{display:inline-flex;width:44px;height:44px}#content{padding:24px 18px 70px}#topbar{padding:0 8px;gap:4px}.btn .lbl{display:none}#topbar .btn{min-width:44px;min-height:44px;padding:0;justify-content:center;gap:0}#topbar .btn .ico{width:18px;height:18px}#more-btn:not([hidden]){display:inline-flex}#history-btn,#upload-btn,#download{display:none!important}#meta{display:none}#crumb{flex:1}#vault{padding:0 8px 0 12px}.icon-btn2,#signout,#tree .row,#projects .row{height:44px}#account-btn,#project-select{min-height:44px}.nav-add{min-width:44px;min-height:44px}.markdown table,pre.plain{display:block;overflow-x:auto;max-width:100%}.ob-row{flex-direction:column}.ob-row input{flex:none;min-height:44px}.admin-item{flex-wrap:wrap;row-gap:8px;padding:12px 14px}.admin-item select{height:44px}.ai-btn,.ai-del{height:auto;min-height:44px;padding:0 12px}.admin-table thead{display:none}.admin-table,.admin-table tbody,.admin-table td{display:block;width:auto}.admin-table tr.admin-item{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.admin-table tr.admin-item td{padding:0;border-bottom:none}.admin-table tr.admin-item td:first-child{flex:1 1 100%;width:auto}.admin-table tr.admin-item td:last-child{width:auto;text-align:left}[data-slot=dropdown-menu-item]{min-height:44px}#projects{flex:0 1 auto;max-height:none}.admin-row{flex-wrap:wrap}.admin-row input{flex:1 1 100%;min-height:44px}.admin-row button{flex:0 0 auto;align-self:flex-start;min-height:44px}.admin-item .ai-main{flex:1 1 100%;white-space:normal;overflow-wrap:anywhere}.admin-table td{white-space:normal}.admin-table td .ai-main,.admin-table td a.ai-main,.admin-table td .ai-copy,.admin-table td .ai-tag{white-space:normal;overflow-wrap:anywhere}.admin-item .ai-tag{flex:1 1 100%;max-width:100%;white-space:normal;overflow-wrap:anywhere}.ai-copy{min-height:44px;display:block;padding:12px 0;white-space:normal;overflow-wrap:anywhere;text-overflow:clip}a.ai-main{min-height:44px;display:flex;align-items:center}.gd-code{min-height:62px;padding-top:12px;padding-bottom:12px}.gd-copy{min-height:44px;padding:0 14px}.gd-tab{min-height:44px}.in-lens-btn{min-height:44px;padding:0 14px}.modal-input{height:44px}.modal-actions button,.pbtn,#palette-results li{height:auto;min-height:44px}.more-item{min-height:44px}}.modal-actions .ai-del{margin-right:auto}@media(max-width:430px){.dl-meta{display:none}.ai-tag{font-size:11px}.htime{white-space:nowrap;font-size:12px}.hline{flex-wrap:wrap}.modal-actions .ai-del{flex:0 0 100%;justify-content:center;text-align:center}}.markdown h1,.markdown h2,.markdown h3,.markdown h4{color:#f4f6f9;line-height:1.25;letter-spacing:-.018em;margin:1.5em 0 .5em;text-wrap:balance}.markdown h1:first-child{margin-top:0}.markdown h1{font-size:1.85em;font-weight:660;letter-spacing:-.024em}.markdown h2{font-size:1.32em;font-weight:620;margin-top:1.7em}.markdown h3{font-size:1.08em;font-weight:620}.markdown p,.markdown li{color:#c6cbd3;font-size:14.5px;line-height:1.72}.markdown p{margin:0 0 1em}.markdown strong{color:var(--text);font-weight:620}.markdown a{color:var(--accent-bright);text-decoration:none;border-bottom:1px solid rgba(245,166,35,.28)}.markdown a:hover{border-bottom-color:var(--accent)}.markdown ul,.markdown ol{margin:0 0 1em;padding-left:1.4em}.markdown li{margin-bottom:.4em}.markdown li::marker{color:var(--text-ghost)}.markdown code{background:var(--hover);border:1px solid var(--border);padding:.1em .4em;border-radius:5px;font:12.5px/1.5 var(--mono);color:#e4d9c4}.markdown pre{background:var(--code-bg);border:1px solid var(--border);border-radius:var(--r-card);padding:14px 16px;overflow-x:auto;margin:1.3em 0}.markdown pre code{background:none;border:none;padding:0;color:#c6cbd3}.markdown blockquote{margin:1.3em 0;padding:.3em 1em;border-left:2px solid var(--accent);background:linear-gradient(90deg,var(--glow),transparent);border-radius:0 8px 8px 0;color:#d8cdb6}.markdown blockquote p{margin:.3em 0;color:#d8cdb6}.markdown table{border-collapse:collapse;margin:1.3em 0;font-size:13.5px}.markdown th,.markdown td{border-bottom:1px solid var(--border);padding:9px 13px;text-align:left}.markdown th{color:var(--text-faint);font-size:11px;text-transform:uppercase;letter-spacing:.05em;font-weight:600;border-bottom-color:var(--border-2)}.markdown tr:hover td{background:#ffffff05}.markdown img{max-width:100%;border-radius:8px;border:1px solid var(--border)}.markdown hr{border:none;border-top:1px solid var(--border);margin:2.2em 0}.markdown table.frontmatter{margin:0 0 1.8em;font-size:12px;background:var(--surface);border:1px solid var(--border);border-radius:8px;border-collapse:separate;border-spacing:0}.markdown table.frontmatter th{text-transform:none;letter-spacing:0;font-size:11.5px;color:var(--text-faint);font-weight:600;text-align:left;white-space:nowrap;vertical-align:top;padding:6px 14px 6px 12px;border-bottom:1px solid var(--border)}.markdown table.frontmatter td{color:var(--text-dim);padding:6px 12px 6px 0;border-bottom:1px solid var(--border)}.markdown table.frontmatter tr:last-child th,.markdown table.frontmatter tr:last-child td{border-bottom:none}.markdown table.frontmatter code{white-space:pre-wrap;font-size:11px}.markdown .admin input:focus-visible{outline:2px solid var(--accent);outline-offset:1px}.admin input[aria-invalid=true]:focus-visible{outline-color:var(--del)}[role=dialog] input[aria-invalid=true]{border-color:var(--del)}[role=dialog] input[aria-invalid=true]:focus-visible{outline-color:var(--del)}button:disabled,.btn:disabled{cursor:default}input[type=checkbox]{accent-color:var(--accent)}.htmlview{display:block;width:100%;height:calc(100vh - 150px);border:1px solid var(--border);border-radius:var(--r-card);background:#fff}.notfound{margin-top:var(--hero-top);text-align:center;color:var(--text-dim)}.notfound h1{color:var(--text);font-size:1.4em;margin-bottom:.5em}.notfound code{background:var(--hover);border:1px solid var(--border);padding:.15em .5em;border-radius:6px}.notfound .nf-sub{max-width:440px;margin:12px auto 20px;font-size:13px;color:var(--text-faint);line-height:1.6}pre.plain{background:var(--code-bg);border:1px solid var(--border);border-radius:var(--r-card);padding:14px 16px;overflow-x:auto;font:12.5px/1.6 var(--mono);color:#c6cbd3;white-space:pre-wrap;overflow-wrap:anywhere}.filecard{margin-top:var(--hero-top);text-align:center;color:var(--text-dim)}.filecard .name{font-size:1.2em;color:var(--text);margin-bottom:.3em}.filecard .btn{margin-top:14px} diff --git a/internal/webapp/static/assets/index-DNEdP71j.js b/internal/webapp/static/assets/index-DNEdP71j.js new file mode 100644 index 0000000..b58a245 --- /dev/null +++ b/internal/webapp/static/assets/index-DNEdP71j.js @@ -0,0 +1,121 @@ +function IR(e,n){for(var r=0;ri[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function r(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(s){if(s.ep)return;s.ep=!0;const l=r(s);fetch(s.href,l)}})();function eS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Sh={exports:{}},As={};var K0;function VR(){if(K0)return As;K0=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(i,s,l){var u=null;if(l!==void 0&&(u=""+l),s.key!==void 0&&(u=""+s.key),"key"in s){l={};for(var d in s)d!=="key"&&(l[d]=s[d])}else l=s;return s=l.ref,{$$typeof:e,type:i,key:u,ref:s!==void 0?s:null,props:l}}return As.Fragment=n,As.jsx=r,As.jsxs=r,As}var Y0;function FR(){return Y0||(Y0=1,Sh.exports=VR()),Sh.exports}var g=FR(),wh={exports:{}},Pe={};var Q0;function PR(){if(Q0)return Pe;Q0=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),b=Symbol.iterator;function x(N){return N===null||typeof N!="object"?null:(N=b&&N[b]||N["@@iterator"],typeof N=="function"?N:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,E={};function T(N,j,U){this.props=N,this.context=j,this.refs=E,this.updater=U||C}T.prototype.isReactComponent={},T.prototype.setState=function(N,j){if(typeof N!="object"&&typeof N!="function"&&N!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,N,j,"setState")},T.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function O(){}O.prototype=T.prototype;function A(N,j,U){this.props=N,this.context=j,this.refs=E,this.updater=U||C}var k=A.prototype=new O;k.constructor=A,_(k,T.prototype),k.isPureReactComponent=!0;var L=Array.isArray;function q(){}var H={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function he(N,j,U){var Q=U.ref;return{$$typeof:e,type:N,key:j,ref:Q!==void 0?Q:null,props:U}}function ve(N,j){return he(N.type,j,N.props)}function de(N){return typeof N=="object"&&N!==null&&N.$$typeof===e}function le(N){var j={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(U){return j[U]})}var ae=/\/+/g;function me(N,j){return typeof N=="object"&&N!==null&&N.key!=null?le(""+N.key):j.toString(36)}function ye(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(q,q):(N.status="pending",N.then(function(j){N.status==="pending"&&(N.status="fulfilled",N.value=j)},function(j){N.status==="pending"&&(N.status="rejected",N.reason=j)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function D(N,j,U,Q,Z){var re=typeof N;(re==="undefined"||re==="boolean")&&(N=null);var ee=!1;if(N===null)ee=!0;else switch(re){case"bigint":case"string":case"number":ee=!0;break;case"object":switch(N.$$typeof){case e:case n:ee=!0;break;case y:return ee=N._init,D(ee(N._payload),j,U,Q,Z)}}if(ee)return Z=Z(N),ee=Q===""?"."+me(N,0):Q,L(Z)?(U="",ee!=null&&(U=ee.replace(ae,"$&/")+"/"),D(Z,j,U,"",function(De){return De})):Z!=null&&(de(Z)&&(Z=ve(Z,U+(Z.key==null||N&&N.key===Z.key?"":(""+Z.key).replace(ae,"$&/")+"/")+ee)),j.push(Z)),1;ee=0;var ge=Q===""?".":Q+":";if(L(N))for(var be=0;be>>1,W=D[J];if(0>>1;Js(U,ne))Qs(Z,U)?(D[J]=Z,D[Q]=ne,J=Q):(D[J]=U,D[j]=ne,J=j);else if(Qs(Z,ne))D[J]=Z,D[Q]=ne,J=Q;else break e}}return Y}function s(D,Y){var ne=D.sortIndex-Y.sortIndex;return ne!==0?ne:D.id-Y.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var h=[],m=[],y=1,v=null,b=3,x=!1,C=!1,_=!1,E=!1,T=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function k(D){for(var Y=r(m);Y!==null;){if(Y.callback===null)i(m);else if(Y.startTime<=D)i(m),Y.sortIndex=Y.expirationTime,n(h,Y);else break;Y=r(m)}}function L(D){if(_=!1,k(D),!C)if(r(h)!==null)C=!0,q||(q=!0,le());else{var Y=r(m);Y!==null&&ye(L,Y.startTime-D)}}var q=!1,H=-1,I=5,he=-1;function ve(){return E?!0:!(e.unstable_now()-heD&&ve());){var J=v.callback;if(typeof J=="function"){v.callback=null,b=v.priorityLevel;var W=J(v.expirationTime<=D);if(D=e.unstable_now(),typeof W=="function"){v.callback=W,k(D),Y=!0;break t}v===r(h)&&i(h),k(D)}else i(h);v=r(h)}if(v!==null)Y=!0;else{var N=r(m);N!==null&&ye(L,N.startTime-D),Y=!1}}break e}finally{v=null,b=ne,x=!1}Y=void 0}}finally{Y?le():q=!1}}}var le;if(typeof A=="function")le=function(){A(de)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,me=ae.port2;ae.port1.onmessage=de,le=function(){me.postMessage(null)}}else le=function(){T(de,0)};function ye(D,Y){H=T(function(){D(e.unstable_now())},Y)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(D){D.callback=null},e.unstable_forceFrameRate=function(D){0>D||125J?(D.sortIndex=ne,n(m,D),r(h)===null&&D===r(m)&&(_?(O(H),H=-1):_=!0,ye(L,ne-J))):(D.sortIndex=W,n(h,D),C||x||(C=!0,q||(q=!0,le()))),D},e.unstable_shouldYield=ve,e.unstable_wrapCallback=function(D){var Y=b;return function(){var ne=b;b=Y;try{return D.apply(this,arguments)}finally{b=ne}}}})(Eh)),Eh}var W0;function HR(){return W0||(W0=1,Ch.exports=UR()),Ch.exports}var Rh={exports:{}},un={};var eb;function BR(){if(eb)return un;eb=1;var e=qm();function n(h){var m="https://react.dev/errors/"+h;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Rh.exports=BR(),Rh.exports}var nb;function qR(){if(nb)return Ms;nb=1;var e=HR(),n=qm(),r=tS();function i(t){var o="https://react.dev/errors/"+t;if(1W||(t.current=J[W],J[W]=null,W--)}function U(t,o){W++,J[W]=t.current,t.current=o}var Q=N(null),Z=N(null),re=N(null),ee=N(null);function ge(t,o){switch(U(re,o),U(Z,t),U(Q,null),o.nodeType){case 9:case 11:t=(t=o.documentElement)&&(t=t.namespaceURI)?v0(t):0;break;default:if(t=o.tagName,o=o.namespaceURI)o=v0(o),t=y0(o,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}j(Q),U(Q,t)}function be(){j(Q),j(Z),j(re)}function De(t){t.memoizedState!==null&&U(ee,t);var o=Q.current,a=y0(o,t.type);o!==a&&(U(Z,t),U(Q,a))}function Ve(t){Z.current===t&&(j(Q),j(Z)),ee.current===t&&(j(ee),Es._currentValue=ne)}var Ue,lt;function Je(t){if(Ue===void 0)try{throw Error()}catch(a){var o=a.stack.trim().match(/\n( *(at )?)/);Ue=o&&o[1]||"",lt=-1)":-1f||z[c]!==G[f]){var te=` +`+z[c].replace(" at new "," at ");return t.displayName&&te.includes("")&&(te=te.replace("",t.displayName)),te}while(1<=c&&0<=f);break}}}finally{Xt=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?Je(a):""}function qt(t,o){switch(t.tag){case 26:case 27:case 5:return Je(t.type);case 16:return Je("Lazy");case 13:return t.child!==o&&o!==null?Je("Suspense Fallback"):Je("Suspense");case 19:return Je("SuspenseList");case 0:case 15:return mn(t.type,!1);case 11:return mn(t.type.render,!1);case 1:return mn(t.type,!0);case 31:return Je("Activity");default:return""}}function Pt(t){try{var o="",a=null;do o+=qt(t,a),a=t,t=t.return;while(t);return o}catch(c){return` +Error generating stack: `+c.message+` +`+c.stack}}var Ut=Object.prototype.hasOwnProperty,or=e.unstable_scheduleCallback,Fe=e.unstable_cancelCallback,ze=e.unstable_shouldYield,We=e.unstable_requestPaint,zt=e.unstable_now,to=e.unstable_getCurrentPriorityLevel,ir=e.unstable_ImmediatePriority,Ri=e.unstable_UserBlockingPriority,no=e.unstable_NormalPriority,Ti=e.unstable_LowPriority,Un=e.unstable_IdlePriority,M=e.log,V=e.unstable_setDisableYieldValue,F=null,se=null;function ue(t){if(typeof M=="function"&&V(t),se&&typeof se.setStrictMode=="function")try{se.setStrictMode(F,t)}catch{}}var pe=Math.clz32?Math.clz32:Te,xe=Math.log,Se=Math.LN2;function Te(t){return t>>>=0,t===0?32:31-(xe(t)/Se|0)|0}var rt=256,wt=262144,Jt=4194304;function Dt(t){var o=t&42;if(o!==0)return o;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function je(t,o,a){var c=t.pendingLanes;if(c===0)return 0;var f=0,p=t.suspendedLanes,w=t.pingedLanes;t=t.warmLanes;var R=c&134217727;return R!==0?(c=R&~p,c!==0?f=Dt(c):(w&=R,w!==0?f=Dt(w):a||(a=R&~t,a!==0&&(f=Dt(a))))):(R=c&~p,R!==0?f=Dt(R):w!==0?f=Dt(w):a||(a=c&~t,a!==0&&(f=Dt(a)))),f===0?0:o!==0&&o!==f&&(o&p)===0&&(p=f&-f,a=o&-o,p>=a||p===32&&(a&4194048)!==0)?o:f}function pt(t,o){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&o)===0}function bt(t,o){switch(t){case 1:case 2:case 4:case 8:case 64:return o+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Gt(){var t=Jt;return Jt<<=1,(Jt&62914560)===0&&(Jt=4194304),t}function ar(t){for(var o=[],a=0;31>a;a++)o.push(t);return o}function _t(t,o){t.pendingLanes|=o,o!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function bn(t,o,a,c,f,p){var w=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var R=t.entanglements,z=t.expirationTimes,G=t.hiddenUpdates;for(a=w&~a;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var NC=/[\n"\\]/g;function Bn(t){return t.replace(NC,function(o){return"\\"+o.charCodeAt(0).toString(16)+" "})}function md(t,o,a,c,f,p,w,R){t.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?t.type=w:t.removeAttribute("type"),o!=null?w==="number"?(o===0&&t.value===""||t.value!=o)&&(t.value=""+Hn(o)):t.value!==""+Hn(o)&&(t.value=""+Hn(o)):w!=="submit"&&w!=="reset"||t.removeAttribute("value"),o!=null?pd(t,w,Hn(o)):a!=null?pd(t,w,Hn(a)):c!=null&&t.removeAttribute("value"),f==null&&p!=null&&(t.defaultChecked=!!p),f!=null&&(t.checked=f&&typeof f!="function"&&typeof f!="symbol"),R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?t.name=""+Hn(R):t.removeAttribute("name")}function dg(t,o,a,c,f,p,w,R){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(t.type=p),o!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||o!=null)){hd(t);return}a=a!=null?""+Hn(a):"",o=o!=null?""+Hn(o):a,R||o===t.value||(t.value=o),t.defaultValue=o}c=c??f,c=typeof c!="function"&&typeof c!="symbol"&&!!c,t.checked=R?t.checked:!!c,t.defaultChecked=!!c,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(t.name=w),hd(t)}function pd(t,o,a){o==="number"&&wl(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function Di(t,o,a,c){if(t=t.options,o){o={};for(var f=0;f"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),xd=!1;if(zr)try{var Ha={};Object.defineProperty(Ha,"passive",{get:function(){xd=!0}}),window.addEventListener("test",Ha,Ha),window.removeEventListener("test",Ha,Ha)}catch{xd=!1}var oo=null,Sd=null,Cl=null;function yg(){if(Cl)return Cl;var t,o=Sd,a=o.length,c,f="value"in oo?oo.value:oo.textContent,p=f.length;for(t=0;t=Ga),Cg=" ",Eg=!1;function Rg(t,o){switch(t){case"keyup":return aE.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Tg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ii=!1;function lE(t,o){switch(t){case"compositionend":return Tg(o);case"keypress":return o.which!==32?null:(Eg=!0,Cg);case"textInput":return t=o.data,t===Cg&&Eg?null:t;default:return null}}function cE(t,o){if(Ii)return t==="compositionend"||!Rd&&Rg(t,o)?(t=yg(),Cl=Sd=oo=null,Ii=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1=o)return{node:a,offset:o-t};t=c}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=kg(a)}}function $g(t,o){return t&&o?t===o?!0:t&&t.nodeType===3?!1:o&&o.nodeType===3?$g(t,o.parentNode):"contains"in t?t.contains(o):t.compareDocumentPosition?!!(t.compareDocumentPosition(o)&16):!1:!1}function Ig(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var o=wl(t.document);o instanceof t.HTMLIFrameElement;){try{var a=typeof o.contentWindow.location.href=="string"}catch{a=!1}if(a)t=o.contentWindow;else break;o=wl(t.document)}return o}function Ad(t){var o=t&&t.nodeName&&t.nodeName.toLowerCase();return o&&(o==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||o==="textarea"||t.contentEditable==="true")}var vE=zr&&"documentMode"in document&&11>=document.documentMode,Vi=null,Md=null,Qa=null,jd=!1;function Vg(t,o,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;jd||Vi==null||Vi!==wl(c)||(c=Vi,"selectionStart"in c&&Ad(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Qa&&Ya(Qa,c)||(Qa=c,c=vc(Md,"onSelect"),0>=w,f-=w,yr=1<<32-pe(o)+f|a<Be?(Ye=Oe,Oe=null):Ye=Oe.sibling;var nt=K(P,Oe,B[Be],oe);if(nt===null){Oe===null&&(Oe=Ye);break}t&&Oe&&nt.alternate===null&&o(P,Oe),$=p(nt,$,Be),tt===null?Ae=nt:tt.sibling=nt,tt=nt,Oe=Ye}if(Be===B.length)return a(P,Oe),Qe&&kr(P,Be),Ae;if(Oe===null){for(;BeBe?(Ye=Oe,Oe=null):Ye=Oe.sibling;var To=K(P,Oe,nt.value,oe);if(To===null){Oe===null&&(Oe=Ye);break}t&&Oe&&To.alternate===null&&o(P,Oe),$=p(To,$,Be),tt===null?Ae=To:tt.sibling=To,tt=To,Oe=Ye}if(nt.done)return a(P,Oe),Qe&&kr(P,Be),Ae;if(Oe===null){for(;!nt.done;Be++,nt=B.next())nt=ie(P,nt.value,oe),nt!==null&&($=p(nt,$,Be),tt===null?Ae=nt:tt.sibling=nt,tt=nt);return Qe&&kr(P,Be),Ae}for(Oe=c(Oe);!nt.done;Be++,nt=B.next())nt=X(Oe,P,Be,nt.value,oe),nt!==null&&(t&&nt.alternate!==null&&Oe.delete(nt.key===null?Be:nt.key),$=p(nt,$,Be),tt===null?Ae=nt:tt.sibling=nt,tt=nt);return t&&Oe.forEach(function($R){return o(P,$R)}),Qe&&kr(P,Be),Ae}function dt(P,$,B,oe){if(typeof B=="object"&&B!==null&&B.type===_&&B.key===null&&(B=B.props.children),typeof B=="object"&&B!==null){switch(B.$$typeof){case x:e:{for(var Ae=B.key;$!==null;){if($.key===Ae){if(Ae=B.type,Ae===_){if($.tag===7){a(P,$.sibling),oe=f($,B.props.children),oe.return=P,P=oe;break e}}else if($.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===I&&ni(Ae)===$.type){a(P,$.sibling),oe=f($,B.props),ns(oe,B),oe.return=P,P=oe;break e}a(P,$);break}else o(P,$);$=$.sibling}B.type===_?(oe=Xo(B.props.children,P.mode,oe,B.key),oe.return=P,P=oe):(oe=Dl(B.type,B.key,B.props,null,P.mode,oe),ns(oe,B),oe.return=P,P=oe)}return w(P);case C:e:{for(Ae=B.key;$!==null;){if($.key===Ae)if($.tag===4&&$.stateNode.containerInfo===B.containerInfo&&$.stateNode.implementation===B.implementation){a(P,$.sibling),oe=f($,B.children||[]),oe.return=P,P=oe;break e}else{a(P,$);break}else o(P,$);$=$.sibling}oe=Id(B,P.mode,oe),oe.return=P,P=oe}return w(P);case I:return B=ni(B),dt(P,$,B,oe)}if(ye(B))return Ee(P,$,B,oe);if(le(B)){if(Ae=le(B),typeof Ae!="function")throw Error(i(150));return B=Ae.call(B),Ne(P,$,B,oe)}if(typeof B.then=="function")return dt(P,$,Pl(B),oe);if(B.$$typeof===A)return dt(P,$,$l(P,B),oe);Ul(P,B)}return typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint"?(B=""+B,$!==null&&$.tag===6?(a(P,$.sibling),oe=f($,B),oe.return=P,P=oe):(a(P,$),oe=$d(B,P.mode,oe),oe.return=P,P=oe),w(P)):a(P,$)}return function(P,$,B,oe){try{ts=0;var Ae=dt(P,$,B,oe);return Qi=null,Ae}catch(Oe){if(Oe===Yi||Oe===Vl)throw Oe;var tt=Dn(29,Oe,null,P.mode);return tt.lanes=oe,tt.return=P,tt}}}var oi=lv(!0),cv=lv(!1),co=!1;function Qd(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Xd(t,o){t=t.updateQueue,o.updateQueue===t&&(o.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function uo(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function fo(t,o,a){var c=t.updateQueue;if(c===null)return null;if(c=c.shared,(ot&2)!==0){var f=c.pending;return f===null?o.next=o:(o.next=f.next,f.next=o),c.pending=o,o=zl(t),Gg(t,null,a),o}return Nl(t,c,o,a),zl(t)}function rs(t,o,a){if(o=o.updateQueue,o!==null&&(o=o.shared,(a&4194048)!==0)){var c=o.lanes;c&=t.pendingLanes,a|=c,o.lanes=a,xn(t,a)}}function Jd(t,o){var a=t.updateQueue,c=t.alternate;if(c!==null&&(c=c.updateQueue,a===c)){var f=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var w={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?f=p=w:p=p.next=w,a=a.next}while(a!==null);p===null?f=p=o:p=p.next=o}else f=p=o;a={baseState:c.baseState,firstBaseUpdate:f,lastBaseUpdate:p,shared:c.shared,callbacks:c.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=o:t.next=o,a.lastBaseUpdate=o}var Wd=!1;function os(){if(Wd){var t=Ki;if(t!==null)throw t}}function is(t,o,a,c){Wd=!1;var f=t.updateQueue;co=!1;var p=f.firstBaseUpdate,w=f.lastBaseUpdate,R=f.shared.pending;if(R!==null){f.shared.pending=null;var z=R,G=z.next;z.next=null,w===null?p=G:w.next=G,w=z;var te=t.alternate;te!==null&&(te=te.updateQueue,R=te.lastBaseUpdate,R!==w&&(R===null?te.firstBaseUpdate=G:R.next=G,te.lastBaseUpdate=z))}if(p!==null){var ie=f.baseState;w=0,te=G=z=null,R=p;do{var K=R.lane&-536870913,X=K!==R.lane;if(X?(Ke&K)===K:(c&K)===K){K!==0&&K===Zi&&(Wd=!0),te!==null&&(te=te.next={lane:0,tag:R.tag,payload:R.payload,callback:null,next:null});e:{var Ee=t,Ne=R;K=o;var dt=a;switch(Ne.tag){case 1:if(Ee=Ne.payload,typeof Ee=="function"){ie=Ee.call(dt,ie,K);break e}ie=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=Ne.payload,K=typeof Ee=="function"?Ee.call(dt,ie,K):Ee,K==null)break e;ie=v({},ie,K);break e;case 2:co=!0}}K=R.callback,K!==null&&(t.flags|=64,X&&(t.flags|=8192),X=f.callbacks,X===null?f.callbacks=[K]:X.push(K))}else X={lane:K,tag:R.tag,payload:R.payload,callback:R.callback,next:null},te===null?(G=te=X,z=ie):te=te.next=X,w|=K;if(R=R.next,R===null){if(R=f.shared.pending,R===null)break;X=R,R=X.next,X.next=null,f.lastBaseUpdate=X,f.shared.pending=null}}while(!0);te===null&&(z=ie),f.baseState=z,f.firstBaseUpdate=G,f.lastBaseUpdate=te,p===null&&(f.shared.lanes=0),vo|=w,t.lanes=w,t.memoizedState=ie}}function uv(t,o){if(typeof t!="function")throw Error(i(191,t));t.call(o)}function dv(t,o){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;tp?p:8;var w=D.T,R={};D.T=R,bf(t,!1,o,a);try{var z=f(),G=D.S;if(G!==null&&G(R,z),z!==null&&typeof z=="object"&&typeof z.then=="function"){var te=RE(z,c);ls(t,o,te,Vn(t))}else ls(t,o,c,Vn(t))}catch(ie){ls(t,o,{then:function(){},status:"rejected",reason:ie},Vn())}finally{Y.p=p,w!==null&&R.types!==null&&(w.types=R.types),D.T=w}}function NE(){}function vf(t,o,a,c){if(t.tag!==5)throw Error(i(476));var f=Hv(t).queue;Uv(t,f,o,ne,a===null?NE:function(){return Bv(t),a(c)})}function Hv(t){var o=t.memoizedState;if(o!==null)return o;o={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vr,lastRenderedState:ne},next:null};var a={};return o.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vr,lastRenderedState:a},next:null},t.memoizedState=o,t=t.alternate,t!==null&&(t.memoizedState=o),o}function Bv(t){var o=Hv(t);o.next===null&&(o=t.alternate.memoizedState),ls(t,o.next.queue,{},Vn())}function yf(){return tn(Es)}function qv(){return At().memoizedState}function Gv(){return At().memoizedState}function zE(t){for(var o=t.return;o!==null;){switch(o.tag){case 24:case 3:var a=Vn();t=uo(a);var c=fo(o,t,a);c!==null&&(On(c,o,a),rs(c,o,a)),o={cache:Gd()},t.payload=o;return}o=o.return}}function DE(t,o,a){var c=Vn();a={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Jl(t)?Kv(o,a):(a=kd(t,o,a,c),a!==null&&(On(a,t,c),Yv(a,o,c)))}function Zv(t,o,a){var c=Vn();ls(t,o,a,c)}function ls(t,o,a,c){var f={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Jl(t))Kv(o,f);else{var p=t.alternate;if(t.lanes===0&&(p===null||p.lanes===0)&&(p=o.lastRenderedReducer,p!==null))try{var w=o.lastRenderedState,R=p(w,a);if(f.hasEagerState=!0,f.eagerState=R,zn(R,w))return Nl(t,o,f,0),mt===null&&jl(),!1}catch{}if(a=kd(t,o,f,c),a!==null)return On(a,t,c),Yv(a,o,c),!0}return!1}function bf(t,o,a,c){if(c={lane:2,revertLane:Xf(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Jl(t)){if(o)throw Error(i(479))}else o=kd(t,a,c,2),o!==null&&On(o,t,2)}function Jl(t){var o=t.alternate;return t===He||o!==null&&o===He}function Kv(t,o){Ji=ql=!0;var a=t.pending;a===null?o.next=o:(o.next=a.next,a.next=o),t.pending=o}function Yv(t,o,a){if((a&4194048)!==0){var c=o.lanes;c&=t.pendingLanes,a|=c,o.lanes=a,xn(t,a)}}var cs={readContext:tn,use:Kl,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useLayoutEffect:Et,useInsertionEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useSyncExternalStore:Et,useId:Et,useHostTransitionStatus:Et,useFormState:Et,useActionState:Et,useOptimistic:Et,useMemoCache:Et,useCacheRefresh:Et};cs.useEffectEvent=Et;var Qv={readContext:tn,use:Kl,useCallback:function(t,o){return pn().memoizedState=[t,o===void 0?null:o],t},useContext:tn,useEffect:zv,useImperativeHandle:function(t,o,a){a=a!=null?a.concat([t]):null,Ql(4194308,4,$v.bind(null,o,t),a)},useLayoutEffect:function(t,o){return Ql(4194308,4,t,o)},useInsertionEffect:function(t,o){Ql(4,2,t,o)},useMemo:function(t,o){var a=pn();o=o===void 0?null:o;var c=t();if(ii){ue(!0);try{t()}finally{ue(!1)}}return a.memoizedState=[c,o],c},useReducer:function(t,o,a){var c=pn();if(a!==void 0){var f=a(o);if(ii){ue(!0);try{a(o)}finally{ue(!1)}}}else f=o;return c.memoizedState=c.baseState=f,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:f},c.queue=t,t=t.dispatch=DE.bind(null,He,t),[c.memoizedState,t]},useRef:function(t){var o=pn();return t={current:t},o.memoizedState=t},useState:function(t){t=ff(t);var o=t.queue,a=Zv.bind(null,He,o);return o.dispatch=a,[t.memoizedState,a]},useDebugValue:pf,useDeferredValue:function(t,o){var a=pn();return gf(a,t,o)},useTransition:function(){var t=ff(!1);return t=Uv.bind(null,He,t.queue,!0,!1),pn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,o,a){var c=He,f=pn();if(Qe){if(a===void 0)throw Error(i(407));a=a()}else{if(a=o(),mt===null)throw Error(i(349));(Ke&127)!==0||vv(c,o,a)}f.memoizedState=a;var p={value:a,getSnapshot:o};return f.queue=p,zv(bv.bind(null,c,p,t),[t]),c.flags|=2048,ea(9,{destroy:void 0},yv.bind(null,c,p,a,o),null),a},useId:function(){var t=pn(),o=mt.identifierPrefix;if(Qe){var a=br,c=yr;a=(c&~(1<<32-pe(c)-1)).toString(32)+a,o="_"+o+"R_"+a,a=Gl++,0<\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof c.is=="string"?w.createElement("select",{is:c.is}):w.createElement("select"),c.multiple?p.multiple=!0:c.size&&(p.size=c.size);break;default:p=typeof c.is=="string"?w.createElement(f,{is:c.is}):w.createElement(f)}}p[Wt]=o,p[wn]=c;e:for(w=o.child;w!==null;){if(w.tag===5||w.tag===6)p.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===o)break e;for(;w.sibling===null;){if(w.return===null||w.return===o)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}o.stateNode=p;e:switch(rn(p,f,c),f){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Pr(o)}}return vt(o),zf(o,o.type,t===null?null:t.memoizedProps,o.pendingProps,a),null;case 6:if(t&&o.stateNode!=null)t.memoizedProps!==c&&Pr(o);else{if(typeof c!="string"&&o.stateNode===null)throw Error(i(166));if(t=re.current,qi(o)){if(t=o.stateNode,a=o.memoizedProps,c=null,f=en,f!==null)switch(f.tag){case 27:case 5:c=f.memoizedProps}t[Wt]=o,t=!!(t.nodeValue===a||c!==null&&c.suppressHydrationWarning===!0||p0(t.nodeValue,a)),t||so(o,!0)}else t=yc(t).createTextNode(c),t[Wt]=o,o.stateNode=t}return vt(o),null;case 31:if(a=o.memoizedState,t===null||t.memoizedState!==null){if(c=qi(o),a!==null){if(t===null){if(!c)throw Error(i(318));if(t=o.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(557));t[Wt]=o}else Jo(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;vt(o),t=!1}else a=Ud(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return o.flags&256?(Ln(o),o):(Ln(o),null);if((o.flags&128)!==0)throw Error(i(558))}return vt(o),null;case 13:if(c=o.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(f=qi(o),c!==null&&c.dehydrated!==null){if(t===null){if(!f)throw Error(i(318));if(f=o.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(i(317));f[Wt]=o}else Jo(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;vt(o),f=!1}else f=Ud(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=f),f=!0;if(!f)return o.flags&256?(Ln(o),o):(Ln(o),null)}return Ln(o),(o.flags&128)!==0?(o.lanes=a,o):(a=c!==null,t=t!==null&&t.memoizedState!==null,a&&(c=o.child,f=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(f=c.alternate.memoizedState.cachePool.pool),p=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(p=c.memoizedState.cachePool.pool),p!==f&&(c.flags|=2048)),a!==t&&a&&(o.child.flags|=8192),rc(o,o.updateQueue),vt(o),null);case 4:return be(),t===null&&th(o.stateNode.containerInfo),vt(o),null;case 10:return $r(o.type),vt(o),null;case 19:if(j(Ot),c=o.memoizedState,c===null)return vt(o),null;if(f=(o.flags&128)!==0,p=c.rendering,p===null)if(f)ds(c,!1);else{if(Rt!==0||t!==null&&(t.flags&128)!==0)for(t=o.child;t!==null;){if(p=Bl(t),p!==null){for(o.flags|=128,ds(c,!1),t=p.updateQueue,o.updateQueue=t,rc(o,t),o.subtreeFlags=0,t=a,a=o.child;a!==null;)Zg(a,t),a=a.sibling;return U(Ot,Ot.current&1|2),Qe&&kr(o,c.treeForkCount),o.child}t=t.sibling}c.tail!==null&&zt()>lc&&(o.flags|=128,f=!0,ds(c,!1),o.lanes=4194304)}else{if(!f)if(t=Bl(p),t!==null){if(o.flags|=128,f=!0,t=t.updateQueue,o.updateQueue=t,rc(o,t),ds(c,!0),c.tail===null&&c.tailMode==="hidden"&&!p.alternate&&!Qe)return vt(o),null}else 2*zt()-c.renderingStartTime>lc&&a!==536870912&&(o.flags|=128,f=!0,ds(c,!1),o.lanes=4194304);c.isBackwards?(p.sibling=o.child,o.child=p):(t=c.last,t!==null?t.sibling=p:o.child=p,c.last=p)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=zt(),t.sibling=null,a=Ot.current,U(Ot,f?a&1|2:a&1),Qe&&kr(o,c.treeForkCount),t):(vt(o),null);case 22:case 23:return Ln(o),tf(),c=o.memoizedState!==null,t!==null?t.memoizedState!==null!==c&&(o.flags|=8192):c&&(o.flags|=8192),c?(a&536870912)!==0&&(o.flags&128)===0&&(vt(o),o.subtreeFlags&6&&(o.flags|=8192)):vt(o),a=o.updateQueue,a!==null&&rc(o,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),c=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(c=o.memoizedState.cachePool.pool),c!==a&&(o.flags|=2048),t!==null&&j(ti),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),o.memoizedState.cache!==a&&(o.flags|=2048),$r(kt),vt(o),null;case 25:return null;case 30:return null}throw Error(i(156,o.tag))}function VE(t,o){switch(Fd(o),o.tag){case 1:return t=o.flags,t&65536?(o.flags=t&-65537|128,o):null;case 3:return $r(kt),be(),t=o.flags,(t&65536)!==0&&(t&128)===0?(o.flags=t&-65537|128,o):null;case 26:case 27:case 5:return Ve(o),null;case 31:if(o.memoizedState!==null){if(Ln(o),o.alternate===null)throw Error(i(340));Jo()}return t=o.flags,t&65536?(o.flags=t&-65537|128,o):null;case 13:if(Ln(o),t=o.memoizedState,t!==null&&t.dehydrated!==null){if(o.alternate===null)throw Error(i(340));Jo()}return t=o.flags,t&65536?(o.flags=t&-65537|128,o):null;case 19:return j(Ot),null;case 4:return be(),null;case 10:return $r(o.type),null;case 22:case 23:return Ln(o),tf(),t!==null&&j(ti),t=o.flags,t&65536?(o.flags=t&-65537|128,o):null;case 24:return $r(kt),null;case 25:return null;default:return null}}function xy(t,o){switch(Fd(o),o.tag){case 3:$r(kt),be();break;case 26:case 27:case 5:Ve(o);break;case 4:be();break;case 31:o.memoizedState!==null&&Ln(o);break;case 13:Ln(o);break;case 19:j(Ot);break;case 10:$r(o.type);break;case 22:case 23:Ln(o),tf(),t!==null&&j(ti);break;case 24:$r(kt)}}function fs(t,o){try{var a=o.updateQueue,c=a!==null?a.lastEffect:null;if(c!==null){var f=c.next;a=f;do{if((a.tag&t)===t){c=void 0;var p=a.create,w=a.inst;c=p(),w.destroy=c}a=a.next}while(a!==f)}}catch(R){st(o,o.return,R)}}function po(t,o,a){try{var c=o.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var p=f.next;c=p;do{if((c.tag&t)===t){var w=c.inst,R=w.destroy;if(R!==void 0){w.destroy=void 0,f=o;var z=a,G=R;try{G()}catch(te){st(f,z,te)}}}c=c.next}while(c!==p)}}catch(te){st(o,o.return,te)}}function Sy(t){var o=t.updateQueue;if(o!==null){var a=t.stateNode;try{dv(o,a)}catch(c){st(t,t.return,c)}}}function wy(t,o,a){a.props=ai(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(c){st(t,o,c)}}function hs(t,o){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var c=t.stateNode;break;case 30:c=t.stateNode;break;default:c=t.stateNode}typeof a=="function"?t.refCleanup=a(c):a.current=c}}catch(f){st(t,o,f)}}function xr(t,o){var a=t.ref,c=t.refCleanup;if(a!==null)if(typeof c=="function")try{c()}catch(f){st(t,o,f)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){st(t,o,f)}else a.current=null}function _y(t){var o=t.type,a=t.memoizedProps,c=t.stateNode;try{e:switch(o){case"button":case"input":case"select":case"textarea":a.autoFocus&&c.focus();break e;case"img":a.src?c.src=a.src:a.srcSet&&(c.srcset=a.srcSet)}}catch(f){st(t,t.return,f)}}function Df(t,o,a){try{var c=t.stateNode;sR(c,t.type,a,o),c[wn]=o}catch(f){st(t,t.return,f)}}function Cy(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&wo(t.type)||t.tag===4}function kf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Cy(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&wo(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Lf(t,o,a){var c=t.tag;if(c===5||c===6)t=t.stateNode,o?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,o):(o=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,o.appendChild(t),a=a._reactRootContainer,a!=null||o.onclick!==null||(o.onclick=Nr));else if(c!==4&&(c===27&&wo(t.type)&&(a=t.stateNode,o=null),t=t.child,t!==null))for(Lf(t,o,a),t=t.sibling;t!==null;)Lf(t,o,a),t=t.sibling}function oc(t,o,a){var c=t.tag;if(c===5||c===6)t=t.stateNode,o?a.insertBefore(t,o):a.appendChild(t);else if(c!==4&&(c===27&&wo(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(oc(t,o,a),t=t.sibling;t!==null;)oc(t,o,a),t=t.sibling}function Ey(t){var o=t.stateNode,a=t.memoizedProps;try{for(var c=t.type,f=o.attributes;f.length;)o.removeAttributeNode(f[0]);rn(o,c,a),o[Wt]=t,o[wn]=a}catch(p){st(t,t.return,p)}}var Ur=!1,It=!1,$f=!1,Ry=typeof WeakSet=="function"?WeakSet:Set,Kt=null;function FE(t,o){if(t=t.containerInfo,oh=Ec,t=Ig(t),Ad(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var c=a.getSelection&&a.getSelection();if(c&&c.rangeCount!==0){a=c.anchorNode;var f=c.anchorOffset,p=c.focusNode;c=c.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var w=0,R=-1,z=-1,G=0,te=0,ie=t,K=null;t:for(;;){for(var X;ie!==a||f!==0&&ie.nodeType!==3||(R=w+f),ie!==p||c!==0&&ie.nodeType!==3||(z=w+c),ie.nodeType===3&&(w+=ie.nodeValue.length),(X=ie.firstChild)!==null;)K=ie,ie=X;for(;;){if(ie===t)break t;if(K===a&&++G===f&&(R=w),K===p&&++te===c&&(z=w),(X=ie.nextSibling)!==null)break;ie=K,K=ie.parentNode}ie=X}a=R===-1||z===-1?null:{start:R,end:z}}else a=null}a=a||{start:0,end:0}}else a=null;for(ih={focusedElem:t,selectionRange:a},Ec=!1,Kt=o;Kt!==null;)if(o=Kt,t=o.child,(o.subtreeFlags&1028)!==0&&t!==null)t.return=o,Kt=t;else for(;Kt!==null;){switch(o=Kt,p=o.alternate,t=o.flags,o.tag){case 0:if((t&4)!==0&&(t=o.updateQueue,t=t!==null?t.events:null,t!==null))for(a=0;a title"))),rn(p,c,a),p[Wt]=t,Zt(p),c=p;break e;case"link":var w=N0("link","href",f).get(c+(a.href||""));if(w){for(var R=0;Rdt&&(w=dt,dt=Ne,Ne=w);var P=Lg(R,Ne),$=Lg(R,dt);if(P&&$&&(X.rangeCount!==1||X.anchorNode!==P.node||X.anchorOffset!==P.offset||X.focusNode!==$.node||X.focusOffset!==$.offset)){var B=ie.createRange();B.setStart(P.node,P.offset),X.removeAllRanges(),Ne>dt?(X.addRange(B),X.extend($.node,$.offset)):(B.setEnd($.node,$.offset),X.addRange(B))}}}}for(ie=[],X=R;X=X.parentNode;)X.nodeType===1&&ie.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof R.focus=="function"&&R.focus(),R=0;Ra?32:a,D.T=null,a=Bf,Bf=null;var p=bo,w=Zr;if(Ht=0,ia=bo=null,Zr=0,(ot&6)!==0)throw Error(i(331));var R=ot;if(ot|=4,$y(p.current),Dy(p,p.current,w,a),ot=R,bs(0,!1),se&&typeof se.onPostCommitFiberRoot=="function")try{se.onPostCommitFiberRoot(F,p)}catch{}return!0}finally{Y.p=f,D.T=c,t0(t,o)}}function r0(t,o,a){o=Gn(a,o),o=_f(t.stateNode,o,2),t=fo(t,o,2),t!==null&&(_t(t,2),Sr(t))}function st(t,o,a){if(t.tag===3)r0(t,t,a);else for(;o!==null;){if(o.tag===3){r0(o,t,a);break}else if(o.tag===1){var c=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(yo===null||!yo.has(c))){t=Gn(a,t),a=oy(2),c=fo(o,a,2),c!==null&&(iy(a,c,o,t),_t(c,2),Sr(c));break}}o=o.return}}function Kf(t,o,a){var c=t.pingCache;if(c===null){c=t.pingCache=new HE;var f=new Set;c.set(o,f)}else f=c.get(o),f===void 0&&(f=new Set,c.set(o,f));f.has(a)||(Ff=!0,f.add(a),t=KE.bind(null,t,o,a),o.then(t,t))}function KE(t,o,a){var c=t.pingCache;c!==null&&c.delete(o),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,mt===t&&(Ke&a)===a&&(Rt===4||Rt===3&&(Ke&62914560)===Ke&&300>zt()-sc?(ot&2)===0&&aa(t,0):Pf|=a,oa===Ke&&(oa=0)),Sr(t)}function o0(t,o){o===0&&(o=Gt()),t=Qo(t,o),t!==null&&(_t(t,o),Sr(t))}function YE(t){var o=t.memoizedState,a=0;o!==null&&(a=o.retryLane),o0(t,a)}function QE(t,o){var a=0;switch(t.tag){case 31:case 13:var c=t.stateNode,f=t.memoizedState;f!==null&&(a=f.retryLane);break;case 19:c=t.stateNode;break;case 22:c=t.stateNode._retryCache;break;default:throw Error(i(314))}c!==null&&c.delete(o),o0(t,a)}function XE(t,o){return or(t,o)}var mc=null,la=null,Yf=!1,pc=!1,Qf=!1,So=0;function Sr(t){t!==la&&t.next===null&&(la===null?mc=la=t:la=la.next=t),pc=!0,Yf||(Yf=!0,WE())}function bs(t,o){if(!Qf&&pc){Qf=!0;do for(var a=!1,c=mc;c!==null;){if(t!==0){var f=c.pendingLanes;if(f===0)var p=0;else{var w=c.suspendedLanes,R=c.pingedLanes;p=(1<<31-pe(42|t)+1)-1,p&=f&~(w&~R),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,l0(c,p))}else p=Ke,p=je(c,c===mt?p:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(p&3)===0||pt(c,p)||(a=!0,l0(c,p));c=c.next}while(a);Qf=!1}}function JE(){i0()}function i0(){pc=Yf=!1;var t=0;So!==0&&cR()&&(t=So);for(var o=zt(),a=null,c=mc;c!==null;){var f=c.next,p=a0(c,o);p===0?(c.next=null,a===null?mc=f:a.next=f,f===null&&(la=a)):(a=c,(t!==0||(p&3)!==0)&&(pc=!0)),c=f}Ht!==0&&Ht!==5||bs(t),So!==0&&(So=0)}function a0(t,o){for(var a=t.suspendedLanes,c=t.pingedLanes,f=t.expirationTimes,p=t.pendingLanes&-62914561;0R)break;var te=z.transferSize,ie=z.initiatorType;te&&g0(ie)&&(z=z.responseEnd,w+=te*(z"u"?null:document;function O0(t,o,a){var c=ca;if(c&&typeof o=="string"&&o){var f=Bn(o);f='link[rel="'+t+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),T0.has(f)||(T0.add(f),t={rel:t,crossOrigin:a,href:o},c.querySelector(f)===null&&(o=c.createElement("link"),rn(o,"link",t),Zt(o),c.head.appendChild(o)))}}function yR(t){Kr.D(t),O0("dns-prefetch",t,null)}function bR(t,o){Kr.C(t,o),O0("preconnect",t,o)}function xR(t,o,a){Kr.L(t,o,a);var c=ca;if(c&&t&&o){var f='link[rel="preload"][as="'+Bn(o)+'"]';o==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Bn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Bn(a.imageSizes)+'"]')):f+='[href="'+Bn(t)+'"]';var p=f;switch(o){case"style":p=ua(t);break;case"script":p=da(t)}Jn.has(p)||(t=v({rel:"preload",href:o==="image"&&a&&a.imageSrcSet?void 0:t,as:o},a),Jn.set(p,t),c.querySelector(f)!==null||o==="style"&&c.querySelector(_s(p))||o==="script"&&c.querySelector(Cs(p))||(o=c.createElement("link"),rn(o,"link",t),Zt(o),c.head.appendChild(o)))}}function SR(t,o){Kr.m(t,o);var a=ca;if(a&&t){var c=o&&typeof o.as=="string"?o.as:"script",f='link[rel="modulepreload"][as="'+Bn(c)+'"][href="'+Bn(t)+'"]',p=f;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=da(t)}if(!Jn.has(p)&&(t=v({rel:"modulepreload",href:t},o),Jn.set(p,t),a.querySelector(f)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Cs(p)))return}c=a.createElement("link"),rn(c,"link",t),Zt(c),a.head.appendChild(c)}}}function wR(t,o,a){Kr.S(t,o,a);var c=ca;if(c&&t){var f=Ni(c).hoistableStyles,p=ua(t);o=o||"default";var w=f.get(p);if(!w){var R={loading:0,preload:null};if(w=c.querySelector(_s(p)))R.loading=5;else{t=v({rel:"stylesheet",href:t,"data-precedence":o},a),(a=Jn.get(p))&&fh(t,a);var z=w=c.createElement("link");Zt(z),rn(z,"link",t),z._p=new Promise(function(G,te){z.onload=G,z.onerror=te}),z.addEventListener("load",function(){R.loading|=1}),z.addEventListener("error",function(){R.loading|=2}),R.loading|=4,xc(w,o,c)}w={type:"stylesheet",instance:w,count:1,state:R},f.set(p,w)}}}function _R(t,o){Kr.X(t,o);var a=ca;if(a&&t){var c=Ni(a).hoistableScripts,f=da(t),p=c.get(f);p||(p=a.querySelector(Cs(f)),p||(t=v({src:t,async:!0},o),(o=Jn.get(f))&&hh(t,o),p=a.createElement("script"),Zt(p),rn(p,"link",t),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},c.set(f,p))}}function CR(t,o){Kr.M(t,o);var a=ca;if(a&&t){var c=Ni(a).hoistableScripts,f=da(t),p=c.get(f);p||(p=a.querySelector(Cs(f)),p||(t=v({src:t,async:!0,type:"module"},o),(o=Jn.get(f))&&hh(t,o),p=a.createElement("script"),Zt(p),rn(p,"link",t),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},c.set(f,p))}}function A0(t,o,a,c){var f=(f=re.current)?bc(f):null;if(!f)throw Error(i(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(o=ua(a.href),a=Ni(f).hoistableStyles,c=a.get(o),c||(c={type:"style",instance:null,count:0,state:null},a.set(o,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=ua(a.href);var p=Ni(f).hoistableStyles,w=p.get(t);if(w||(f=f.ownerDocument||f,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(t,w),(p=f.querySelector(_s(t)))&&!p._p&&(w.instance=p,w.state.loading=5),Jn.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Jn.set(t,a),p||ER(f,t,a,w.state))),o&&c===null)throw Error(i(528,""));return w}if(o&&c!==null)throw Error(i(529,""));return null;case"script":return o=a.async,a=a.src,typeof a=="string"&&o&&typeof o!="function"&&typeof o!="symbol"?(o=da(a),a=Ni(f).hoistableScripts,c=a.get(o),c||(c={type:"script",instance:null,count:0,state:null},a.set(o,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,t))}}function ua(t){return'href="'+Bn(t)+'"'}function _s(t){return'link[rel="stylesheet"]['+t+"]"}function M0(t){return v({},t,{"data-precedence":t.precedence,precedence:null})}function ER(t,o,a,c){t.querySelector('link[rel="preload"][as="style"]['+o+"]")?c.loading=1:(o=t.createElement("link"),c.preload=o,o.addEventListener("load",function(){return c.loading|=1}),o.addEventListener("error",function(){return c.loading|=2}),rn(o,"link",a),Zt(o),t.head.appendChild(o))}function da(t){return'[src="'+Bn(t)+'"]'}function Cs(t){return"script[async]"+t}function j0(t,o,a){if(o.count++,o.instance===null)switch(o.type){case"style":var c=t.querySelector('style[data-href~="'+Bn(a.href)+'"]');if(c)return o.instance=c,Zt(c),c;var f=v({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return c=(t.ownerDocument||t).createElement("style"),Zt(c),rn(c,"style",f),xc(c,a.precedence,t),o.instance=c;case"stylesheet":f=ua(a.href);var p=t.querySelector(_s(f));if(p)return o.state.loading|=4,o.instance=p,Zt(p),p;c=M0(a),(f=Jn.get(f))&&fh(c,f),p=(t.ownerDocument||t).createElement("link"),Zt(p);var w=p;return w._p=new Promise(function(R,z){w.onload=R,w.onerror=z}),rn(p,"link",c),o.state.loading|=4,xc(p,a.precedence,t),o.instance=p;case"script":return p=da(a.src),(f=t.querySelector(Cs(p)))?(o.instance=f,Zt(f),f):(c=a,(f=Jn.get(p))&&(c=v({},a),hh(c,f)),t=t.ownerDocument||t,f=t.createElement("script"),Zt(f),rn(f,"link",c),t.head.appendChild(f),o.instance=f);case"void":return null;default:throw Error(i(443,o.type))}else o.type==="stylesheet"&&(o.state.loading&4)===0&&(c=o.instance,o.state.loading|=4,xc(c,a.precedence,t));return o.instance}function xc(t,o,a){for(var c=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=c.length?c[c.length-1]:null,p=f,w=0;w title"):null)}function RR(t,o,a){if(a===1||o.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof o.precedence!="string"||typeof o.href!="string"||o.href==="")break;return!0;case"link":if(typeof o.rel!="string"||typeof o.href!="string"||o.href===""||o.onLoad||o.onError)break;return o.rel==="stylesheet"?(t=o.disabled,typeof o.precedence=="string"&&t==null):!0;case"script":if(o.async&&typeof o.async!="function"&&typeof o.async!="symbol"&&!o.onLoad&&!o.onError&&o.src&&typeof o.src=="string")return!0}return!1}function D0(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function TR(t,o,a,c){if(a.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var f=ua(c.href),p=o.querySelector(_s(f));if(p){o=p._p,o!==null&&typeof o=="object"&&typeof o.then=="function"&&(t.count++,t=wc.bind(t),o.then(t,t)),a.state.loading|=4,a.instance=p,Zt(p);return}p=o.ownerDocument||o,c=M0(c),(f=Jn.get(f))&&fh(c,f),p=p.createElement("link"),Zt(p);var w=p;w._p=new Promise(function(R,z){w.onload=R,w.onerror=z}),rn(p,"link",c),a.instance=p}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,o),(o=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=wc.bind(t),o.addEventListener("load",a),o.addEventListener("error",a))}}var mh=0;function OR(t,o){return t.stylesheets&&t.count===0&&Cc(t,t.stylesheets),0mh?50:800)+o);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(c),clearTimeout(f)}}:null}function wc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Cc(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var _c=null;function Cc(t,o){t.stylesheets=null,t.unsuspend!==null&&(t.count++,_c=new Map,o.forEach(AR,t),_c=null,wc.call(t))}function AR(t,o){if(!(o.state.loading&4)){var a=_c.get(t);if(a)var c=a.get(null);else{a=new Map,_c.set(t,a);for(var f=t.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),_h.exports=qR(),_h.exports}var ZR=GR(),ll=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},KR=class extends ll{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},Gm=new KR,YR={setTimeout:(e,n)=>setTimeout(e,n),clearTimeout:e=>clearTimeout(e),setInterval:(e,n)=>setInterval(e,n),clearInterval:e=>clearInterval(e)},QR=class{#e=YR;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,n){return this.#e.setTimeout(e,n)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,n){return this.#e.setInterval(e,n)}clearInterval(e){this.#e.clearInterval(e)}},fi=new QR;function XR(e){setTimeout(e,0)}var JR=typeof window>"u"||"Deno"in globalThis;function Mn(){}function WR(e,n){return typeof e=="function"?e(n):e}function im(e){return typeof e=="number"&&e>=0&&e!==1/0}function nS(e,n){return Math.max(e+(n||0)-Date.now(),0)}function No(e,n){return typeof e=="function"?e(n):e}function Fn(e,n){return typeof e=="function"?e(n):e}function ob(e,n){const{type:r="all",exact:i,fetchStatus:s,predicate:l,queryKey:u,stale:d}=e;if(u){if(i){if(n.queryHash!==Zm(u,n.options))return!1}else if(!Gs(n.queryKey,u))return!1}if(r!=="all"){const h=n.isActive();if(r==="active"&&!h||r==="inactive"&&h)return!1}return!(typeof d=="boolean"&&n.isStale()!==d||s&&s!==n.state.fetchStatus||l&&!l(n))}function ib(e,n){const{exact:r,status:i,predicate:s,mutationKey:l}=e;if(l){if(!n.options.mutationKey)return!1;if(r){if(qs(n.options.mutationKey)!==qs(l))return!1}else if(!Gs(n.options.mutationKey,l))return!1}return!(i&&n.state.status!==i||s&&!s(n))}function Zm(e,n){return(n?.queryKeyHashFn||qs)(e)}function qs(e){return JSON.stringify(e,(n,r)=>sm(r)?Object.keys(r).sort().reduce((i,s)=>(i[s]=r[s],i),{}):r)}function Gs(e,n){return e===n?!0:typeof e!=typeof n?!1:e&&n&&typeof e=="object"&&typeof n=="object"?Object.keys(n).every(r=>Gs(e[r],n[r])):!1}var e2=Object.prototype.hasOwnProperty;function rS(e,n,r=0){if(e===n)return e;if(r>500)return n;const i=ab(e)&&ab(n);if(!i&&!(sm(e)&&sm(n)))return n;const l=(i?e:Object.keys(e)).length,u=i?n:Object.keys(n),d=u.length,h=i?new Array(d):{};let m=0;for(let y=0;y{fi.setTimeout(n,e)})}function lm(e,n,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,n):r.structuralSharing!==!1?rS(e,n):n}function n2(e,n,r=0){const i=[...e,n];return r&&i.length>r?i.slice(1):i}function r2(e,n,r=0){const i=[n,...e];return r&&i.length>r?i.slice(0,-1):i}var Km=Symbol();function oS(e,n){return!e.queryFn&&n?.initialPromise?()=>n.initialPromise:!e.queryFn||e.queryFn===Km?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function iS(e,n){return typeof e=="function"?e(...n):!!e}function o2(e,n,r){let i=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??=n(),i||(i=!0,s.aborted?r():s.addEventListener("abort",r,{once:!0})),s)}),e}var Zs=(()=>{let e=()=>JR;return{isServer(){return e()},setIsServer(n){e=n}}})();function cm(){let e,n;const r=new Promise((s,l)=>{e=s,n=l});r.status="pending",r.catch(()=>{});function i(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{i({status:"fulfilled",value:s}),e(s)},r.reject=s=>{i({status:"rejected",reason:s}),n(s)},r}var i2=XR;function a2(){let e=[],n=0,r=d=>{d()},i=d=>{d()},s=i2;const l=d=>{n?e.push(d):s(()=>{r(d)})},u=()=>{const d=e;e=[],d.length&&s(()=>{i(()=>{d.forEach(h=>{r(h)})})})};return{batch:d=>{let h;n++;try{h=d()}finally{n--,n||u()}return h},batchCalls:d=>(...h)=>{l(()=>{d(...h)})},schedule:l,setNotifyFunction:d=>{r=d},setBatchNotifyFunction:d=>{i=d},setScheduler:d=>{s=d}}}var sn=a2(),s2=class extends ll{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(r=>{r(e)}))}isOnline(){return this.#e}},su=new s2;function l2(e){return Math.min(1e3*2**e,3e4)}function aS(e){return(e??"online")==="online"?su.isOnline():!0}var um=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function sS(e){let n=!1,r=0,i;const s=cm(),l=()=>s.status!=="pending",u=_=>{if(!l()){const E=new um(_);b(E),e.onCancel?.(E)}},d=()=>{n=!0},h=()=>{n=!1},m=()=>Gm.isFocused()&&(e.networkMode==="always"||su.isOnline())&&e.canRun(),y=()=>aS(e.networkMode)&&e.canRun(),v=_=>{l()||(i?.(),s.resolve(_))},b=_=>{l()||(i?.(),s.reject(_))},x=()=>new Promise(_=>{i=E=>{(l()||m())&&_(E)},e.onPause?.()}).then(()=>{i=void 0,l()||e.onContinue?.()}),C=()=>{if(l())return;let _;const E=r===0?e.initialPromise:void 0;try{_=E??e.fn()}catch(T){_=Promise.reject(T)}Promise.resolve(_).then(v).catch(T=>{if(l())return;const O=e.retry??(Zs.isServer()?0:3),A=e.retryDelay??l2,k=typeof A=="function"?A(r,T):A,L=O===!0||typeof O=="number"&&rm()?void 0:x()).then(()=>{n?b(T):C()})})};return{promise:s,status:()=>s.status,cancel:u,continue:()=>(i?.(),s),cancelRetry:d,continueRetry:h,canStart:y,start:()=>(y()?C():x().then(C),s)}}var lS=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),im(this.gcTime)&&(this.#e=fi.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Zs.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(fi.clearTimeout(this.#e),this.#e=void 0)}};function c2(e){return{onFetch:(n,r)=>{const i=n.options,s=n.fetchOptions?.meta?.fetchMore?.direction,l=n.state.data?.pages||[],u=n.state.data?.pageParams||[];let d={pages:[],pageParams:[]},h=0;const m=async()=>{let y=!1;const v=C=>{o2(C,()=>n.signal,()=>y=!0)},b=oS(n.options,n.fetchOptions),x=async(C,_,E)=>{if(y)return Promise.reject(n.signal.reason);if(_==null&&C.pages.length)return Promise.resolve(C);const O=(()=>{const q={client:n.client,queryKey:n.queryKey,pageParam:_,direction:E?"backward":"forward",meta:n.options.meta};return v(q),q})(),A=await b(O),{maxPages:k}=n.options,L=E?r2:n2;return{pages:L(C.pages,A,k),pageParams:L(C.pageParams,_,k)}};if(s&&l.length){const C=s==="backward",_=C?u2:lb,E={pages:l,pageParams:u},T=_(i,E);d=await x(E,T,C)}else{const C=e??l.length;do{const _=h===0?u[0]??i.initialPageParam:lb(i,d);if(h>0&&_==null)break;d=await x(d,_),h++}while(hn.options.persister?.(m,{client:n.client,queryKey:n.queryKey,meta:n.options.meta,signal:n.signal},r):n.fetchFn=m}}}function lb(e,{pages:n,pageParams:r}){const i=n.length-1;return n.length>0?e.getNextPageParam(n[i],n,r[i],r):void 0}function u2(e,{pages:n,pageParams:r}){return n.length>0?e.getPreviousPageParam?.(n[0],n,r[0],r):void 0}var d2=class extends lS{#e;#t;#n;#r;#i;#o;#s;#a;constructor(e){super(),this.#a=!1,this.#s=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=ub(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#o?.promise}setOptions(e){if(this.options={...this.#s,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=ub(this.options);n.data!==void 0&&(this.setState(cb(n.data,n.dataUpdatedAt)),this.#t=n)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,n){const r=lm(this.state.data,e,this.options);return this.#l({data:r,type:"success",dataUpdatedAt:n?.updatedAt,manual:n?.manual}),r}setState(e){this.#l({type:"setState",state:e})}cancel(e){const n=this.#o?.promise;return this.#o?.cancel(e),n?n.then(Mn).catch(Mn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Fn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Km||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>No(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!nS(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(n=>n.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#o?.continue()}onOnline(){this.observers.find(n=>n.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#o?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(this.#o&&(this.#a||this.#u()?this.#o.cancel({revert:!0}):this.#o.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#u(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#l({type:"invalidate"})}async fetch(e,n){if(this.state.fetchStatus!=="idle"&&this.#o?.status()!=="rejected"){if(this.state.data!==void 0&&n?.cancelRefetch)this.cancel({silent:!0});else if(this.#o)return this.#o.continueRetry(),this.#o.promise}if(e&&this.setOptions(e),!this.options.queryFn){const h=this.observers.find(m=>m.options.queryFn);h&&this.setOptions(h.options)}const r=new AbortController,i=h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:()=>(this.#a=!0,r.signal)})},s=()=>{const h=oS(this.options,n),y=(()=>{const v={client:this.#i,queryKey:this.queryKey,meta:this.meta};return i(v),v})();return this.#a=!1,this.options.persister?this.options.persister(h,y,this):h(y)},u=(()=>{const h={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:s};return i(h),h})();(this.#e==="infinite"?c2(this.options.pages):this.options.behavior)?.onFetch(u,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==u.fetchOptions?.meta)&&this.#l({type:"fetch",meta:u.fetchOptions?.meta}),this.#o=sS({initialPromise:n?.initialPromise,fn:u.fetchFn,onCancel:h=>{h instanceof um&&h.revert&&this.setState({...this.#n,fetchStatus:"idle"}),r.abort()},onFail:(h,m)=>{this.#l({type:"failed",failureCount:h,error:m})},onPause:()=>{this.#l({type:"pause"})},onContinue:()=>{this.#l({type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0});try{const h=await this.#o.start();if(h===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(h),this.#r.config.onSuccess?.(h,this),this.#r.config.onSettled?.(h,this.state.error,this),h}catch(h){if(h instanceof um){if(h.silent)return this.#o.promise;if(h.revert){if(this.state.data===void 0)throw h;return this.state.data}}throw this.#l({type:"error",error:h}),this.#r.config.onError?.(h,this),this.#r.config.onSettled?.(this.state.data,h,this),h}finally{this.scheduleGc()}}#l(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...cS(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...cb(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?i:void 0,i;case"error":const s=e.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),sn.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function cS(e,n){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:aS(n.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function cb(e,n){return{data:e,dataUpdatedAt:n??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ub(e){const n=typeof e.initialData=="function"?e.initialData():e.initialData,r=n!==void 0,i=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:n,dataUpdateCount:0,dataUpdatedAt:r?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var f2=class extends ll{constructor(e,n){super(),this.options=n,this.#e=e,this.#a=null,this.#s=cm(),this.bindMethods(),this.setOptions(n)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#o;#s;#a;#u;#l;#m;#d;#f;#c;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),db(this.#t,this.options)?this.#h():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return dm(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return dm(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#S(),this.#t.removeObserver(this)}setOptions(e){const n=this.options,r=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Fn(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#w(),this.#t.setOptions(this.options),n._defaulted&&!am(this.options,n)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const i=this.hasListeners();i&&fb(this.#t,r,this.options,n)&&this.#h(),this.updateResult(),i&&(this.#t!==r||Fn(this.options.enabled,this.#t)!==Fn(n.enabled,this.#t)||No(this.options.staleTime,this.#t)!==No(n.staleTime,this.#t))&&this.#g();const s=this.#v();i&&(this.#t!==r||Fn(this.options.enabled,this.#t)!==Fn(n.enabled,this.#t)||s!==this.#c)&&this.#y(s)}getOptimisticResult(e){const n=this.#e.getQueryCache().build(this.#e,e),r=this.createResult(n,e);return m2(this,r)&&(this.#r=r,this.#o=this.options,this.#i=this.#t.state),r}getCurrentResult(){return this.#r}trackResult(e,n){return new Proxy(e,{get:(r,i)=>(this.trackProp(i),n?.(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#s.status==="pending"&&this.#s.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=this.#e.defaultQueryOptions(e),r=this.#e.getQueryCache().build(this.#e,n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#w();let n=this.#t.fetch(this.options,e);return e?.throwOnError||(n=n.catch(Mn)),n}#g(){this.#x();const e=No(this.options.staleTime,this.#t);if(Zs.isServer()||this.#r.isStale||!im(e))return;const r=nS(this.#r.dataUpdatedAt,e)+1;this.#d=fi.setTimeout(()=>{this.#r.isStale||this.updateResult()},r)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(e){this.#S(),this.#c=e,!(Zs.isServer()||Fn(this.options.enabled,this.#t)===!1||!im(this.#c)||this.#c===0)&&(this.#f=fi.setInterval(()=>{(this.options.refetchIntervalInBackground||Gm.isFocused())&&this.#h()},this.#c))}#b(){this.#g(),this.#y(this.#v())}#x(){this.#d!==void 0&&(fi.clearTimeout(this.#d),this.#d=void 0)}#S(){this.#f!==void 0&&(fi.clearInterval(this.#f),this.#f=void 0)}createResult(e,n){const r=this.#t,i=this.options,s=this.#r,l=this.#i,u=this.#o,h=e!==r?e.state:this.#n,{state:m}=e;let y={...m},v=!1,b;if(n._optimisticResults){const I=this.hasListeners(),he=!I&&db(e,n),ve=I&&fb(e,r,n,i);(he||ve)&&(y={...y,...cS(m.data,e.options)}),n._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:x,errorUpdatedAt:C,status:_}=y;b=y.data;let E=!1;if(n.placeholderData!==void 0&&b===void 0&&_==="pending"){let I;s?.isPlaceholderData&&n.placeholderData===u?.placeholderData?(I=s.data,E=!0):I=typeof n.placeholderData=="function"?n.placeholderData(this.#m?.state.data,this.#m):n.placeholderData,I!==void 0&&(_="success",b=lm(s?.data,I,n),v=!0)}if(n.select&&b!==void 0&&!E)if(s&&b===l?.data&&n.select===this.#u)b=this.#l;else try{this.#u=n.select,b=n.select(b),b=lm(s?.data,b,n),this.#l=b,this.#a=null}catch(I){this.#a=I}this.#a&&(x=this.#a,b=this.#l,C=Date.now(),_="error");const T=y.fetchStatus==="fetching",O=_==="pending",A=_==="error",k=O&&T,L=b!==void 0,H={status:_,fetchStatus:y.fetchStatus,isPending:O,isSuccess:_==="success",isError:A,isInitialLoading:k,isLoading:k,data:b,dataUpdatedAt:y.dataUpdatedAt,error:x,errorUpdatedAt:C,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:y.dataUpdateCount>h.dataUpdateCount||y.errorUpdateCount>h.errorUpdateCount,isFetching:T,isRefetching:T&&!O,isLoadingError:A&&!L,isPaused:y.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:A&&L,isStale:Ym(e,n),refetch:this.refetch,promise:this.#s,isEnabled:Fn(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const I=H.data!==void 0,he=H.status==="error"&&!I,ve=ae=>{he?ae.reject(H.error):I&&ae.resolve(H.data)},de=()=>{const ae=this.#s=H.promise=cm();ve(ae)},le=this.#s;switch(le.status){case"pending":e.queryHash===r.queryHash&&ve(le);break;case"fulfilled":(he||H.data!==le.value)&&de();break;case"rejected":(!he||H.error!==le.reason)&&de();break}}return H}updateResult(){const e=this.#r,n=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#o=this.options,this.#i.data!==void 0&&(this.#m=this.#t),am(n,e))return;this.#r=n;const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!this.#p.size)return!0;const l=new Set(s??this.#p);return this.options.throwOnError&&l.add("error"),Object.keys(this.#r).some(u=>{const d=u;return this.#r[d]!==e[d]&&l.has(d)})};this.#_({listeners:r()})}#w(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const n=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(n?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#_(e){sn.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function h2(e,n){return Fn(n.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Fn(n.retryOnMount,e)===!1)}function db(e,n){return h2(e,n)||e.state.data!==void 0&&dm(e,n,n.refetchOnMount)}function dm(e,n,r){if(Fn(n.enabled,e)!==!1&&No(n.staleTime,e)!=="static"){const i=typeof r=="function"?r(e):r;return i==="always"||i!==!1&&Ym(e,n)}return!1}function fb(e,n,r,i){return(e!==n||Fn(i.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Ym(e,r)}function Ym(e,n){return Fn(n.enabled,e)!==!1&&e.isStaleByTime(No(n.staleTime,e))}function m2(e,n){return!am(e.getCurrentResult(),n)}var p2=class extends lS{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||g2(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(n=>n!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){const n=()=>{this.#i({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=sS({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(l,u)=>{this.#i({type:"failed",failureCount:l,error:u})},onPause:()=>{this.#i({type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const i=this.state.status==="pending",s=!this.#r.canStart();try{if(i)n();else{this.#i({type:"pending",variables:e,isPaused:s}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,r);const u=await this.options.onMutate?.(e,r);u!==this.state.context&&this.#i({type:"pending",context:u,variables:e,isPaused:s})}const l=await this.#r.start();return await this.#n.config.onSuccess?.(l,e,this.state.context,this,r),await this.options.onSuccess?.(l,e,this.state.context,r),await this.#n.config.onSettled?.(l,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(l,null,e,this.state.context,r),this.#i({type:"success",data:l}),l}catch(l){try{await this.#n.config.onError?.(l,e,this.state.context,this,r)}catch(u){Promise.reject(u)}try{await this.options.onError?.(l,e,this.state.context,r)}catch(u){Promise.reject(u)}try{await this.#n.config.onSettled?.(void 0,l,this.state.variables,this.state.context,this,r)}catch(u){Promise.reject(u)}try{await this.options.onSettled?.(void 0,l,e,this.state.context,r)}catch(u){Promise.reject(u)}throw this.#i({type:"error",error:l}),l}finally{this.#n.runNext(this)}}#i(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),sn.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function g2(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var v2=class extends ll{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,n,r){const i=new p2({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){this.#e.add(e);const n=Nc(e);if(typeof n=="string"){const r=this.#t.get(n);r?r.push(e):this.#t.set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const n=Nc(e);if(typeof n=="string"){const r=this.#t.get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&this.#t.delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=Nc(e);if(typeof n=="string"){const i=this.#t.get(n)?.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){const n=Nc(e);return typeof n=="string"?this.#t.get(n)?.find(i=>i!==e&&i.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){sn.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const n={exact:!0,...e};return this.getAll().find(r=>ib(n,r))}findAll(e={}){return this.getAll().filter(n=>ib(e,n))}notify(e){sn.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return sn.batch(()=>Promise.all(e.map(n=>n.continue().catch(Mn))))}};function Nc(e){return e.options.scope?.id}var y2=class extends ll{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,n,r){const i=n.queryKey,s=n.queryHash??Zm(i,n);let l=this.get(s);return l||(l=new d2({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(l)),l}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=this.#e.get(e.queryHash);n&&(e.destroy(),n===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){sn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>ob(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>ob(e,r)):n}notify(e){sn.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){sn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){sn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},b2=class{#e;#t;#n;#r;#i;#o;#s;#a;constructor(e={}){this.#e=e.queryCache||new y2,this.#t=e.mutationCache||new v2,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#o=0}mount(){this.#o++,this.#o===1&&(this.#s=Gm.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=su.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#o--,this.#o===0&&(this.#s?.(),this.#s=void 0,this.#a?.(),this.#a=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const n=this.defaultQueryOptions({queryKey:e});return this.#e.get(n.queryHash)?.state.data}ensureQueryData(e){const n=this.defaultQueryOptions(e),r=this.#e.build(this,n),i=r.state.data;return i===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(No(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(i))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:n,state:r})=>{const i=r.data;return[n,i]})}setQueryData(e,n,r){const i=this.defaultQueryOptions({queryKey:e}),l=this.#e.get(i.queryHash)?.state.data,u=WR(n,l);if(u!==void 0)return this.#e.build(this,i).setData(u,{...r,manual:!0})}setQueriesData(e,n,r){return sn.batch(()=>this.#e.findAll(e).map(({queryKey:i})=>[i,this.setQueryData(i,n,r)]))}getQueryState(e){const n=this.defaultQueryOptions({queryKey:e});return this.#e.get(n.queryHash)?.state}removeQueries(e){const n=this.#e;sn.batch(()=>{n.findAll(e).forEach(r=>{n.remove(r)})})}resetQueries(e,n){const r=this.#e;return sn.batch(()=>(r.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...e},n)))}cancelQueries(e,n={}){const r={revert:!0,...n},i=sn.batch(()=>this.#e.findAll(e).map(s=>s.cancel(r)));return Promise.all(i).then(Mn).catch(Mn)}invalidateQueries(e,n={}){return sn.batch(()=>(this.#e.findAll(e).forEach(r=>{r.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},n)))}refetchQueries(e,n={}){const r={...n,cancelRefetch:n.cancelRefetch??!0},i=sn.batch(()=>this.#e.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let l=s.fetch(void 0,r);return r.throwOnError||(l=l.catch(Mn)),s.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(i).then(Mn)}fetchQuery(e){const n=this.defaultQueryOptions(e);n.retry===void 0&&(n.retry=!1);const r=this.#e.build(this,n);return r.isStaleByTime(No(n.staleTime,r))?r.fetch(n):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Mn).catch(Mn)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Mn).catch(Mn)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return su.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,n){this.#r.set(qs(e),{queryKey:e,defaultOptions:n})}getQueryDefaults(e){const n=[...this.#r.values()],r={};return n.forEach(i=>{Gs(e,i.queryKey)&&Object.assign(r,i.defaultOptions)}),r}setMutationDefaults(e,n){this.#i.set(qs(e),{mutationKey:e,defaultOptions:n})}getMutationDefaults(e){const n=[...this.#i.values()],r={};return n.forEach(i=>{Gs(e,i.mutationKey)&&Object.assign(r,i.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const n={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return n.queryHash||(n.queryHash=Zm(n.queryKey,n)),n.refetchOnReconnect===void 0&&(n.refetchOnReconnect=n.networkMode!=="always"),n.throwOnError===void 0&&(n.throwOnError=!!n.suspense),!n.networkMode&&n.persister&&(n.networkMode="offlineFirst"),n.queryFn===Km&&(n.enabled=!1),n}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},uS=S.createContext(void 0),ka=e=>{const n=S.useContext(uS);if(!n)throw new Error("No QueryClient set, use QueryClientProvider to set one");return n},x2=({client:e,children:n})=>(S.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),g.jsx(uS.Provider,{value:e,children:n})),dS=S.createContext(!1),S2=()=>S.useContext(dS);dS.Provider;function w2(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var _2=S.createContext(w2()),C2=()=>S.useContext(_2),E2=(e,n,r)=>{const i=r?.state.error&&typeof e.throwOnError=="function"?iS(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||i)&&(n.isReset()||(e.retryOnMount=!1))},R2=e=>{S.useEffect(()=>{e.clearReset()},[e])},T2=({result:e,errorResetBoundary:n,throwOnError:r,query:i,suspense:s})=>e.isError&&!n.isReset()&&!e.isFetching&&i&&(s&&e.data===void 0||iS(r,[e.error,i])),O2=e=>{if(e.suspense){const r=s=>s==="static"?s:Math.max(s??1e3,1e3),i=e.staleTime;e.staleTime=typeof i=="function"?(...s)=>r(i(...s)):r(i),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},A2=(e,n)=>e.isLoading&&e.isFetching&&!n,M2=(e,n)=>e?.suspense&&n.isPending,hb=(e,n,r)=>n.fetchOptimistic(e).catch(()=>{r.clearReset()});function j2(e,n,r){const i=S2(),s=C2(),l=ka(),u=l.defaultQueryOptions(e);l.getDefaultOptions().queries?._experimental_beforeQuery?.(u);const d=l.getQueryCache().get(u.queryHash),h=e.subscribed!==!1;u._optimisticResults=i?"isRestoring":h?"optimistic":void 0,O2(u),E2(u,s,d),R2(s);const m=!l.getQueryCache().get(u.queryHash),[y]=S.useState(()=>new n(l,u)),v=y.getOptimisticResult(u),b=!i&&h;if(S.useSyncExternalStore(S.useCallback(x=>{const C=b?y.subscribe(sn.batchCalls(x)):Mn;return y.updateResult(),C},[y,b]),()=>y.getCurrentResult(),()=>y.getCurrentResult()),S.useEffect(()=>{y.setOptions(u)},[u,y]),M2(u,v))throw hb(u,y,s);if(T2({result:v,errorResetBoundary:s,throwOnError:u.throwOnError,query:d,suspense:u.suspense}))throw v.error;return l.getDefaultOptions().queries?._experimental_afterQuery?.(u,v),u.experimental_prefetchInRender&&!Zs.isServer()&&A2(v,i)&&(m?hb(u,y,s):d?.promise)?.catch(Mn).finally(()=>{y.updateResult()}),u.notifyOnChangeProps?v:y.trackResult(v)}function vn(e,n){return j2(e,f2)}function fS(){throw location.href="/auth/login?next="+encodeURIComponent(location.pathname+location.search),new Error("signing in…")}function N2(e,n){const r=n.trim();switch(e){case 403:return r.includes("seat")?"This plan is out of seats. Upgrade to add more people.":r.includes("owner")?"Only owners can do that.":"You don't have access to that.";case 409:return r?r[0].toUpperCase()+r.slice(1):"That is managed outside this hub.";case 404:return"That is gone — it may have been removed already.";case 429:return"Too many requests. Give it a moment.";default:return e>=500?"The server had a problem. Try again.":r?r[0].toUpperCase()+r.slice(1):"Something went wrong."}}async function Qm(e){throw new Error(N2(e.status,await e.text()))}async function Nn(e){const n=await fetch(e);return n.status===401&&fS(),n.ok||await Qm(n),n.json()}async function er(e,n,r){const i={method:e};r!==void 0&&(i.headers={"Content-Type":"application/json"},i.body=JSON.stringify(r));const s=await fetch(n,i);return s.ok||await Qm(s),s.status===204?{}:s.json()}async function Ma(e,n){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n||{})});return r.status===401&&fS(),r.ok||await Qm(r),r.json()}function z2(){return vn({queryKey:["config"],queryFn:async()=>{const e=await Nn("/api/config");return e.auth.enabled&&!e.me&&(location.href="/auth/login?next="+encodeURIComponent(location.pathname+location.search),await new Promise(()=>{})),e},staleTime:1/0})}var xi=tS();const D2=eS(xi);function mb(e,n){if(typeof e=="function")return e(n);e!=null&&(e.current=n)}function ja(...e){return n=>{let r=!1;const i=e.map(s=>{const l=mb(s,n);return!r&&typeof l=="function"&&(r=!0),l});if(r)return()=>{for(let s=0;s{let{children:s,...l}=r,u=null,d=!1;const h=[];pb(s)&&typeof zc=="function"&&(s=zc(s._payload)),S.Children.forEach(s,b=>{if(F2(b)){d=!0;const x=b;let C="child"in x.props?x.props.child:x.props.children;pb(C)&&typeof zc=="function"&&(C=zc(C._payload)),u=$2(x,C),h.push(u?.props?.children)}else h.push(b)}),u?u=S.cloneElement(u,void 0,h):!d&&S.Children.count(s)===1&&S.isValidElement(s)&&(u=s);const m=u?V2(u):void 0,y=it(i,m);if(!u){if(s||s===0)throw new Error(d?B2(e):H2(e));return s}const v=I2(l,u.props??{});return u.type!==S.Fragment&&(v.ref=i?y:m),S.cloneElement(u,v)});return n.displayName=`${e}.Slot`,n}var k2=hi("Slot"),hS=Symbol.for("radix.slottable");function L2(e){const n=r=>"child"in r?r.children(r.child):r.children;return n.displayName=`${e}.Slottable`,n.__radixId=hS,n}var $2=(e,n)=>{if("child"in e.props){const r=e.props.child;return S.isValidElement(r)?S.cloneElement(r,void 0,e.props.children(r.props.children)):null}return S.isValidElement(n)?n:null};function I2(e,n){const r={...n};for(const i in n){const s=e[i],l=n[i];/^on[A-Z]/.test(i)?s&&l?r[i]=(...d)=>{const h=l(...d);return s(...d),h}:s&&(r[i]=s):i==="style"?r[i]={...s,...l}:i==="className"&&(r[i]=[s,l].filter(Boolean).join(" "))}return{...e,...r}}function V2(e){let n=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?e.ref:(n=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function F2(e){return S.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hS}var P2=Symbol.for("react.lazy");function pb(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===P2&&"_payload"in e&&U2(e._payload)}function U2(e){return typeof e=="object"&&e!==null&&"then"in e}var H2=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,B2=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,zc=Ou[" use ".trim().toString()],q2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ie=q2.reduce((e,n)=>{const r=hi(`Primitive.${n}`),i=S.forwardRef((s,l)=>{const{asChild:u,...d}=s,h=u?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(h,{...d,ref:l})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{});function mS(e,n){e&&xi.flushSync(()=>e.dispatchEvent(n))}var pS=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),G2="VisuallyHidden",gS=S.forwardRef((e,n)=>g.jsx(Ie.span,{...e,ref:n,style:{...pS,...e.style}}));gS.displayName=G2;var Z2=gS;function Io(e,n=[]){let r=[];function i(l,u){const d=S.createContext(u);d.displayName=l+"Context";const h=r.length;r=[...r,u];const m=v=>{const{scope:b,children:x,...C}=v,_=b?.[e]?.[h]||d,E=S.useMemo(()=>C,Object.values(C));return g.jsx(_.Provider,{value:E,children:x})};m.displayName=l+"Provider";function y(v,b,x={}){const{optional:C=!1}=x,_=b?.[e]?.[h]||d,E=S.useContext(_);if(E)return E;if(u!==void 0)return u;if(!C)throw new Error(`\`${v}\` must be used within \`${l}\``)}return[m,y]}const s=()=>{const l=r.map(u=>S.createContext(u));return function(d){const h=d?.[e]||l;return S.useMemo(()=>({[`__scope${e}`]:{...d,[e]:h}}),[d,h])}};return s.scopeName=e,[i,K2(s,...n)]}function K2(...e){const n=e[0];if(e.length===1)return n;const r=()=>{const i=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(l){const u=i.reduce((d,{useScope:h,scopeName:m})=>{const v=h(l)[`__scope${m}`];return{...d,...v}},{});return S.useMemo(()=>({[`__scope${n.scopeName}`]:u}),[u])}};return r.scopeName=n.scopeName,r}function Xm(e){const n=e+"CollectionProvider",[r,i]=Io(n),[s,l]=r(n,{collectionRef:{current:null},itemMap:new Map}),u=_=>{const{scope:E,children:T}=_,O=S.useRef(null),A=S.useRef(new Map).current;return g.jsx(s,{scope:E,itemMap:A,collectionRef:O,children:T})};u.displayName=n;const d=e+"CollectionSlot",h=hi(d),m=S.forwardRef((_,E)=>{const{scope:T,children:O}=_,A=l(d,T),k=it(E,A.collectionRef);return g.jsx(h,{ref:k,children:O})});m.displayName=d;const y=e+"CollectionItemSlot",v="data-radix-collection-item",b=hi(y),x=S.forwardRef((_,E)=>{const{scope:T,children:O,...A}=_,k=S.useRef(null),L=it(E,k),q=l(y,T);return S.useEffect(()=>(q.itemMap.set(k,{ref:k,...A}),()=>{q.itemMap.delete(k)})),g.jsx(b,{[v]:"",ref:L,children:O})});x.displayName=y;function C(_){const E=l(e+"CollectionConsumer",_);return S.useCallback(()=>{const O=E.collectionRef.current;if(!O)return[];const A=Array.from(O.querySelectorAll(`[${v}]`));return Array.from(E.itemMap.values()).sort((q,H)=>A.indexOf(q.ref.current)-A.indexOf(H.ref.current))},[E.collectionRef,E.itemMap])}return[{Provider:u,Slot:m,ItemSlot:x},C,i]}function Re(e,n,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e?.(s),r===!1||!s||!s.defaultPrevented)return n?.(s)}}var Qt=globalThis?.document?S.useLayoutEffect:()=>{},Y2=Ou[" useInsertionEffect ".trim().toString()]||Qt;function Na({prop:e,defaultProp:n,onChange:r=()=>{},caller:i}){const[s,l,u]=Q2({defaultProp:n,onChange:r}),d=e!==void 0,h=d?e:s;{const y=S.useRef(e!==void 0);S.useEffect(()=>{const v=y.current;v!==d&&console.warn(`${i} is changing from ${v?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),y.current=d},[d,i])}const m=S.useCallback(y=>{if(d){const v=X2(y)?y(e):y;v!==e&&u.current?.(v)}else l(y)},[d,e,l,u]);return[h,m]}function Q2({defaultProp:e,onChange:n}){const[r,i]=S.useState(e),s=S.useRef(r),l=S.useRef(n);return Y2(()=>{l.current=n},[n]),S.useEffect(()=>{s.current!==r&&(l.current?.(r),s.current=r)},[r,s]),[r,i,l]}function X2(e){return typeof e=="function"}function J2(e,n){return S.useReducer((r,i)=>n[r][i]??r,e)}var gr=e=>{const{present:n,children:r}=e,i=W2(n),s=typeof r=="function"?r({present:i.isPresent}):S.Children.only(r),l=eT(i.ref,tT(s));return typeof r=="function"||i.isPresent?S.cloneElement(s,{ref:l}):null};gr.displayName="Presence";function W2(e){const[n,r]=S.useState(),i=S.useRef(null),s=S.useRef(e),l=S.useRef("none"),u=S.useRef(void 0),d=e?"mounted":"unmounted",[h,m]=J2(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return S.useEffect(()=>{h==="mounted"?(l.current=u.current??js(i.current),u.current=void 0):l.current="none"},[h]),Qt(()=>{const y=i.current,v=s.current;if(v!==e){const x=l.current,C=js(y);e?(u.current=C,m("MOUNT")):C==="none"||y?.display==="none"?m("UNMOUNT"):m(v&&x!==C?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,m]),Qt(()=>{if(n){let y;const v=n.ownerDocument.defaultView??window,b=C=>{const E=js(i.current).includes(CSS.escape(C.animationName));if(C.target===n&&E&&(m("ANIMATION_END"),!s.current)){const T=n.style.animationFillMode;n.style.animationFillMode="forwards",y=v.setTimeout(()=>{n.style.animationFillMode==="forwards"&&(n.style.animationFillMode=T)})}},x=C=>{C.target===n&&(l.current=js(i.current))};return n.addEventListener("animationstart",x),n.addEventListener("animationcancel",b),n.addEventListener("animationend",b),()=>{v.clearTimeout(y),n.removeEventListener("animationstart",x),n.removeEventListener("animationcancel",b),n.removeEventListener("animationend",b)}}else m("ANIMATION_END")},[n,m]),{isPresent:["mounted","unmountSuspended"].includes(h),ref:S.useCallback(y=>{if(y){const v=getComputedStyle(y);i.current=v,u.current=js(v)}else i.current=null;r(y)},[])}}function gb(e,n){if(typeof e=="function")return e(n);e!=null&&(e.current=n)}function eT(...e){const n=S.useRef(e);return n.current=e,S.useCallback(r=>{const i=n.current;let s=!1;const l=i.map(u=>{const d=gb(u,r);return!s&&typeof d=="function"&&(s=!0),d});if(s)return()=>{for(let u=0;u{}),rT=0;function hn(e){const[n,r]=S.useState(nT());return Qt(()=>{r(i=>i??String(rT++))},[e]),n?`radix-${n}`:""}var oT=S.createContext(void 0);function Jm(e){const n=S.useContext(oT);return e||n||"ltr"}function nr(e){const n=S.useRef(e);return S.useEffect(()=>{n.current=e}),S.useMemo(()=>((...r)=>n.current?.(...r)),[])}var iT="DismissableLayer",fm="dismissableLayer.update",aT="dismissableLayer.pointerDownOutside",sT="dismissableLayer.focusOutside",vb,Wm=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),cl=S.forwardRef((e,n)=>{const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,onDismiss:h,...m}=e,y=S.useContext(Wm),[v,b]=S.useState(null),x=v?.ownerDocument??globalThis?.document,[,C]=S.useState({}),_=it(n,b),E=Array.from(y.layers),[T]=[...y.layersWithOutsidePointerEventsDisabled].slice(-1),O=T?E.indexOf(T):-1,A=v?E.indexOf(v):-1,k=y.layersWithOutsidePointerEventsDisabled.size>0,L=A>=O,q=S.useRef(!1),H=fT(de=>{l?.(de),d?.(de),de.defaultPrevented||h?.()},{ownerDocument:x,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:q,dismissableSurfaces:y.dismissableSurfaces,shouldHandlePointerDownOutside:S.useCallback(de=>{if(!(de instanceof Node))return!1;const le=[...y.branches].some(ae=>ae.contains(de));return L&&!le},[y.branches,L])}),I=hT(de=>{if(i&&q.current)return;const le=de.target;[...y.branches].some(me=>me.contains(le))||(u?.(de),d?.(de),de.defaultPrevented||h?.())},x),he=v?A===E.length-1:!1,ve=nr(de=>{de.key==="Escape"&&(s?.(de),!de.defaultPrevented&&h&&(de.preventDefault(),h()))});return S.useEffect(()=>{if(he)return x.addEventListener("keydown",ve,{capture:!0}),()=>x.removeEventListener("keydown",ve,{capture:!0})},[x,he,ve]),S.useEffect(()=>{if(v)return r&&(y.layersWithOutsidePointerEventsDisabled.size===0&&(vb=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),y.layersWithOutsidePointerEventsDisabled.add(v)),y.layers.add(v),yb(),()=>{r&&(y.layersWithOutsidePointerEventsDisabled.delete(v),y.layersWithOutsidePointerEventsDisabled.size===0&&(x.body.style.pointerEvents=vb))}},[v,x,r,y]),S.useEffect(()=>()=>{v&&(y.layers.delete(v),y.layersWithOutsidePointerEventsDisabled.delete(v),yb())},[v,y]),S.useEffect(()=>{const de=()=>C({});return document.addEventListener(fm,de),()=>document.removeEventListener(fm,de)},[]),g.jsx(Ie.div,{...m,ref:_,style:{pointerEvents:k?L?"auto":"none":void 0,...e.style},onFocusCapture:Re(e.onFocusCapture,I.onFocusCapture),onBlurCapture:Re(e.onBlurCapture,I.onBlurCapture),onPointerDownCapture:Re(e.onPointerDownCapture,H.onPointerDownCapture)})});cl.displayName=iT;var lT="DismissableLayerBranch",cT=S.forwardRef((e,n)=>{const r=S.useContext(Wm),i=S.useRef(null),s=it(n,i);return S.useEffect(()=>{const l=i.current;if(l)return r.branches.add(l),()=>{r.branches.delete(l)}},[r.branches]),g.jsx(Ie.div,{...e,ref:s})});cT.displayName=lT;function uT(){const e=S.useContext(Wm),[n,r]=S.useState(null);return S.useEffect(()=>{if(n)return e.dismissableSurfaces.add(n),()=>{e.dismissableSurfaces.delete(n)}},[n,e.dismissableSurfaces]),r}var dT=()=>!0;function fT(e,n){const{ownerDocument:r=globalThis?.document,deferPointerDownOutside:i=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:l,shouldHandlePointerDownOutside:u=dT}=n,d=nr(e),h=S.useRef(!1),m=S.useRef(!1),y=S.useRef(new Map),v=S.useRef(()=>{});return S.useEffect(()=>{function b(){m.current=!1,s.current=!1,y.current.clear()}function x(){return Array.from(y.current.values()).some(Boolean)}function C(A){if(!m.current)return;const k=A.target;k instanceof Node&&[...l].some(q=>q.contains(k))||y.current.set(A.type,!0),A.type==="click"&&window.setTimeout(()=>{m.current&&v.current()},0)}function _(A){m.current&&y.current.set(A.type,!1)}const E=A=>{if(A.target&&!h.current){let k=function(){r.removeEventListener("click",v.current);const q=x();b(),q||vS(aT,d,L,{discrete:!0})};if(!u(A.target)){r.removeEventListener("click",v.current),b(),h.current=!1;return}const L={originalEvent:A};m.current=!0,s.current=i&&A.button===0,y.current.clear(),!i||A.button!==0?k():(r.removeEventListener("click",v.current),v.current=k,r.addEventListener("click",v.current,{once:!0}))}else r.removeEventListener("click",v.current),b();h.current=!1},T=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const A of T)r.addEventListener(A,C,!0),r.addEventListener(A,_);const O=window.setTimeout(()=>{r.addEventListener("pointerdown",E)},0);return()=>{window.clearTimeout(O),r.removeEventListener("pointerdown",E),r.removeEventListener("click",v.current);for(const A of T)r.removeEventListener(A,C,!0),r.removeEventListener(A,_)}},[r,d,i,s,l,u]),{onPointerDownCapture:()=>h.current=!0}}function hT(e,n=globalThis?.document){const r=nr(e),i=S.useRef(!1);return S.useEffect(()=>{const s=l=>{l.target&&!i.current&&vS(sT,r,{originalEvent:l},{discrete:!1})};return n.addEventListener("focusin",s),()=>n.removeEventListener("focusin",s)},[n,r]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function yb(){const e=new CustomEvent(fm);document.dispatchEvent(e)}function vS(e,n,r,{discrete:i}){const s=r.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});n&&s.addEventListener(e,n,{once:!0}),i?mS(s,l):s.dispatchEvent(l)}var Th="focusScope.autoFocusOnMount",Oh="focusScope.autoFocusOnUnmount",bb={bubbles:!1,cancelable:!0},mT="FocusScope",Au=S.forwardRef((e,n)=>{const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:l,...u}=e,[d,h]=S.useState(null),m=nr(s),y=nr(l),v=S.useRef(null),b=it(n,h),x=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(i){let _=function(A){if(x.paused||!d)return;const k=A.target;d.contains(k)?v.current=k:Ao(v.current,{select:!0})},E=function(A){if(x.paused||!d)return;const k=A.relatedTarget;k!==null&&(d.contains(k)||Ao(v.current,{select:!0}))},T=function(A){if(document.activeElement===document.body)for(const L of A)L.removedNodes.length>0&&Ao(d)};document.addEventListener("focusin",_),document.addEventListener("focusout",E);const O=new MutationObserver(T);return d&&O.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",E),O.disconnect()}}},[i,d,x.paused]),S.useEffect(()=>{if(d){Sb.add(x);const _=document.activeElement;if(!d.contains(_)){const T=new CustomEvent(Th,bb);d.addEventListener(Th,m),d.dispatchEvent(T),T.defaultPrevented||(pT(xT(yS(d)),{select:!0}),document.activeElement===_&&Ao(d))}return()=>{d.removeEventListener(Th,m),setTimeout(()=>{const T=new CustomEvent(Oh,bb);d.addEventListener(Oh,y),d.dispatchEvent(T),T.defaultPrevented||Ao(_??document.body,{select:!0}),d.removeEventListener(Oh,y),Sb.remove(x)},0)}}},[d,m,y,x]);const C=S.useCallback(_=>{if(!r&&!i||x.paused)return;const E=_.key==="Tab"&&!_.altKey&&!_.ctrlKey&&!_.metaKey,T=document.activeElement;if(E&&T){const O=_.currentTarget,[A,k]=gT(O);A&&k?!_.shiftKey&&T===k?(_.preventDefault(),r&&Ao(A,{select:!0})):_.shiftKey&&T===A&&(_.preventDefault(),r&&Ao(k,{select:!0})):T===O&&_.preventDefault()}},[r,i,x.paused]);return g.jsx(Ie.div,{tabIndex:-1,...u,ref:b,onKeyDown:C})});Au.displayName=mT;function pT(e,{select:n=!1}={}){const r=document.activeElement;for(const i of e)if(Ao(i,{select:n}),document.activeElement!==r)return}function gT(e){const n=yS(e),r=xb(n,e),i=xb(n.reverse(),e);return[r,i]}function yS(e){const n=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const s=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||s?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)n.push(r.currentNode);return n}function xb(e,n){const r=typeof n.checkVisibility=="function"&&n.checkVisibility({checkVisibilityCSS:!0});for(const i of e)if(!(r?!i.checkVisibility({checkVisibilityCSS:!0}):vT(i,{upTo:n})))return i}function vT(e,{upTo:n}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(n!==void 0&&e===n)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function yT(e){return e instanceof HTMLInputElement&&"select"in e}function Ao(e,{select:n=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&yT(e)&&n&&e.select()}}var Sb=bT();function bT(){let e=[];return{add(n){const r=e[0];n!==r&&r?.pause(),e=wb(e,n),e.unshift(n)},remove(n){e=wb(e,n),e[0]?.resume()}}}function wb(e,n){const r=[...e],i=r.indexOf(n);return i!==-1&&r.splice(i,1),r}function xT(e){return e.filter(n=>n.tagName!=="A")}var ST="Portal",ul=S.forwardRef((e,n)=>{const{container:r,...i}=e,[s,l]=S.useState(!1);Qt(()=>l(!0),[]);const u=r||s&&globalThis?.document?.body;return u?xi.createPortal(g.jsx(Ie.div,{...i,ref:n}),u):null});ul.displayName=ST;var Dc=0,ha=null;function ep(){S.useEffect(()=>{ha||(ha={start:_b(),end:_b()});const{start:e,end:n}=ha;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==n&&document.body.insertAdjacentElement("beforeend",n),Dc++,()=>{Dc===1&&(ha?.start.remove(),ha?.end.remove(),ha=null),Dc=Math.max(0,Dc-1)}},[])}function _b(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Rr=function(){return Rr=Object.assign||function(n){for(var r,i=1,s=arguments.length;i"u")return IT;var n=VT(e),r=document.documentElement.clientWidth,i=window.innerWidth;return{left:n[0],top:n[1],right:n[2],gap:Math.max(0,i-r+n[2]-n[0])}},PT=wS(),Ea="data-scroll-locked",UT=function(e,n,r,i){var s=e.left,l=e.top,u=e.right,d=e.gap;return r===void 0&&(r="margin"),` + .`.concat(_T,` { + overflow: hidden `).concat(i,`; + padding-right: `).concat(d,"px ").concat(i,`; + } + body[`).concat(Ea,`] { + overflow: hidden `).concat(i,`; + overscroll-behavior: contain; + `).concat([n&&"position: relative ".concat(i,";"),r==="margin"&&` + padding-left: `.concat(s,`px; + padding-top: `).concat(l,`px; + padding-right: `).concat(u,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(d,"px ").concat(i,`; + `),r==="padding"&&"padding-right: ".concat(d,"px ").concat(i,";")].filter(Boolean).join(""),` + } + + .`).concat(Qc,` { + right: `).concat(d,"px ").concat(i,`; + } + + .`).concat(Xc,` { + margin-right: `).concat(d,"px ").concat(i,`; + } + + .`).concat(Qc," .").concat(Qc,` { + right: 0 `).concat(i,`; + } + + .`).concat(Xc," .").concat(Xc,` { + margin-right: 0 `).concat(i,`; + } + + body[`).concat(Ea,`] { + `).concat(CT,": ").concat(d,`px; + } +`)},Eb=function(){var e=parseInt(document.body.getAttribute(Ea)||"0",10);return isFinite(e)?e:0},HT=function(){S.useEffect(function(){return document.body.setAttribute(Ea,(Eb()+1).toString()),function(){var e=Eb()-1;e<=0?document.body.removeAttribute(Ea):document.body.setAttribute(Ea,e.toString())}},[])},BT=function(e){var n=e.noRelative,r=e.noImportant,i=e.gapMode,s=i===void 0?"margin":i;HT();var l=S.useMemo(function(){return FT(s)},[s]);return S.createElement(PT,{styles:UT(l,!n,s,r?"":"!important")})},hm=!1;if(typeof window<"u")try{var kc=Object.defineProperty({},"passive",{get:function(){return hm=!0,!0}});window.addEventListener("test",kc,kc),window.removeEventListener("test",kc,kc)}catch{hm=!1}var ma=hm?{passive:!1}:!1,qT=function(e){return e.tagName==="TEXTAREA"},_S=function(e,n){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[n]!=="hidden"&&!(r.overflowY===r.overflowX&&!qT(e)&&r[n]==="visible")},GT=function(e){return _S(e,"overflowY")},ZT=function(e){return _S(e,"overflowX")},Rb=function(e,n){var r=n.ownerDocument,i=n;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var s=CS(e,i);if(s){var l=ES(e,i),u=l[1],d=l[2];if(u>d)return!0}i=i.parentNode}while(i&&i!==r.body);return!1},KT=function(e){var n=e.scrollTop,r=e.scrollHeight,i=e.clientHeight;return[n,r,i]},YT=function(e){var n=e.scrollLeft,r=e.scrollWidth,i=e.clientWidth;return[n,r,i]},CS=function(e,n){return e==="v"?GT(n):ZT(n)},ES=function(e,n){return e==="v"?KT(n):YT(n)},QT=function(e,n){return e==="h"&&n==="rtl"?-1:1},XT=function(e,n,r,i,s){var l=QT(e,window.getComputedStyle(n).direction),u=l*i,d=r.target,h=n.contains(d),m=!1,y=u>0,v=0,b=0;do{if(!d)break;var x=ES(e,d),C=x[0],_=x[1],E=x[2],T=_-E-l*C;(C||T)&&CS(e,d)&&(v+=T,b+=C);var O=d.parentNode;d=O&&O.nodeType===Node.DOCUMENT_FRAGMENT_NODE?O.host:O}while(!h&&d!==document.body||h&&(n.contains(d)||n===d));return(y&&Math.abs(v)<1||!y&&Math.abs(b)<1)&&(m=!0),m},Lc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Tb=function(e){return[e.deltaX,e.deltaY]},Ob=function(e){return e&&"current"in e?e.current:e},JT=function(e,n){return e[0]===n[0]&&e[1]===n[1]},WT=function(e){return` + .block-interactivity-`.concat(e,` {pointer-events: none;} + .allow-interactivity-`).concat(e,` {pointer-events: all;} +`)},eO=0,pa=[];function tO(e){var n=S.useRef([]),r=S.useRef([0,0]),i=S.useRef(),s=S.useState(eO++)[0],l=S.useState(wS)[0],u=S.useRef(e);S.useEffect(function(){u.current=e},[e]),S.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var _=wT([e.lockRef.current],(e.shards||[]).map(Ob),!0).filter(Boolean);return _.forEach(function(E){return E.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),_.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var d=S.useCallback(function(_,E){if("touches"in _&&_.touches.length===2||_.type==="wheel"&&_.ctrlKey)return!u.current.allowPinchZoom;var T=Lc(_),O=r.current,A="deltaX"in _?_.deltaX:O[0]-T[0],k="deltaY"in _?_.deltaY:O[1]-T[1],L,q=_.target,H=Math.abs(A)>Math.abs(k)?"h":"v";if("touches"in _&&H==="h"&&q.type==="range")return!1;var I=window.getSelection(),he=I&&I.anchorNode,ve=he?he===q||he.contains(q):!1;if(ve)return!1;var de=Rb(H,q);if(!de)return!0;if(de?L=H:(L=H==="v"?"h":"v",de=Rb(H,q)),!de)return!1;if(!i.current&&"changedTouches"in _&&(A||k)&&(i.current=L),!L)return!0;var le=i.current||L;return XT(le,E,_,le==="h"?A:k)},[]),h=S.useCallback(function(_){var E=_;if(!(!pa.length||pa[pa.length-1]!==l)){var T="deltaY"in E?Tb(E):Lc(E),O=n.current.filter(function(L){return L.name===E.type&&(L.target===E.target||E.target===L.shadowParent)&&JT(L.delta,T)})[0];if(O&&O.should){E.cancelable&&E.preventDefault();return}if(!O){var A=(u.current.shards||[]).map(Ob).filter(Boolean).filter(function(L){return L.contains(E.target)}),k=A.length>0?d(E,A[0]):!u.current.noIsolation;k&&E.cancelable&&E.preventDefault()}}},[]),m=S.useCallback(function(_,E,T,O){var A={name:_,delta:E,target:T,should:O,shadowParent:nO(T)};n.current.push(A),setTimeout(function(){n.current=n.current.filter(function(k){return k!==A})},1)},[]),y=S.useCallback(function(_){r.current=Lc(_),i.current=void 0},[]),v=S.useCallback(function(_){m(_.type,Tb(_),_.target,d(_,e.lockRef.current))},[]),b=S.useCallback(function(_){m(_.type,Lc(_),_.target,d(_,e.lockRef.current))},[]);S.useEffect(function(){return pa.push(l),e.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:b}),document.addEventListener("wheel",h,ma),document.addEventListener("touchmove",h,ma),document.addEventListener("touchstart",y,ma),function(){pa=pa.filter(function(_){return _!==l}),document.removeEventListener("wheel",h,ma),document.removeEventListener("touchmove",h,ma),document.removeEventListener("touchstart",y,ma)}},[]);var x=e.removeScrollBar,C=e.inert;return S.createElement(S.Fragment,null,C?S.createElement(l,{styles:WT(s)}):null,x?S.createElement(BT,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function nO(e){for(var n=null;e!==null;)e instanceof ShadowRoot&&(n=e.host,e=e.host),e=e.parentNode;return n}const rO=jT(SS,tO);var ju=S.forwardRef(function(e,n){return S.createElement(Mu,Rr({},e,{ref:n,sideCar:rO}))});ju.classNames=Mu.classNames;var oO=function(e){if(typeof document>"u")return null;var n=Array.isArray(e)?e[0]:e;return n.ownerDocument.body},ga=new WeakMap,$c=new WeakMap,Ic={},Nh=0,RS=function(e){return e&&(e.host||RS(e.parentNode))},iO=function(e,n){return n.map(function(r){if(e.contains(r))return r;var i=RS(r);return i&&e.contains(i)?i:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},aO=function(e,n,r,i){var s=iO(n,Array.isArray(e)?e:[e]);Ic[r]||(Ic[r]=new WeakMap);var l=Ic[r],u=[],d=new Set,h=new Set(s),m=function(v){!v||d.has(v)||(d.add(v),m(v.parentNode))};s.forEach(m);var y=function(v){!v||h.has(v)||Array.prototype.forEach.call(v.children,function(b){if(d.has(b))y(b);else try{var x=b.getAttribute(i),C=x!==null&&x!=="false",_=(ga.get(b)||0)+1,E=(l.get(b)||0)+1;ga.set(b,_),l.set(b,E),u.push(b),_===1&&C&&$c.set(b,!0),E===1&&b.setAttribute(r,"true"),C||b.setAttribute(i,"true")}catch(T){console.error("aria-hidden: cannot operate on ",b,T)}})};return y(n),d.clear(),Nh++,function(){u.forEach(function(v){var b=ga.get(v)-1,x=l.get(v)-1;ga.set(v,b),l.set(v,x),b||($c.has(v)||v.removeAttribute(i),$c.delete(v)),x||v.removeAttribute(r)}),Nh--,Nh||(ga=new WeakMap,ga=new WeakMap,$c=new WeakMap,Ic={})}},tp=function(e,n,r){r===void 0&&(r="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),s=oO(e);return s?(i.push.apply(i,Array.from(s.querySelectorAll("[aria-live], script"))),aO(i,s,r,"aria-hidden")):function(){return null}},Nu="Dialog",[TS]=Io(Nu),[sO,vr]=TS(Nu),np=e=>{const{__scopeDialog:n,children:r,open:i,defaultOpen:s,onOpenChange:l,modal:u=!0}=e,d=S.useRef(null),h=S.useRef(null),[m,y]=Na({prop:i,defaultProp:s??!1,onChange:l,caller:Nu});return g.jsx(sO,{scope:n,triggerRef:d,contentRef:h,contentId:hn(),titleId:hn(),descriptionId:hn(),open:m,onOpenChange:y,onOpenToggle:S.useCallback(()=>y(v=>!v),[y]),modal:u,children:r})};np.displayName=Nu;var OS="DialogTrigger",lO=S.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=vr(OS,r),l=it(n,s.triggerRef);return g.jsx(Ie.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":sp(s.open),...i,ref:l,onClick:Re(e.onClick,s.onOpenToggle)})});lO.displayName=OS;var rp="DialogPortal",[cO,AS]=TS(rp,{forceMount:void 0}),op=e=>{const{__scopeDialog:n,forceMount:r,children:i,container:s}=e,l=vr(rp,n);return g.jsx(cO,{scope:n,forceMount:r,children:S.Children.map(i,u=>g.jsx(gr,{present:r||l.open,children:g.jsx(ul,{asChild:!0,container:s,children:u})}))})};op.displayName=rp;var lu="DialogOverlay",ip=S.forwardRef((e,n)=>{const r=AS(lu,e.__scopeDialog),{forceMount:i=r.forceMount,...s}=e,l=vr(lu,e.__scopeDialog);return l.modal?g.jsx(gr,{present:i||l.open,children:g.jsx(dO,{...s,ref:n})}):null});ip.displayName=lu;var uO=hi("DialogOverlay.RemoveScroll"),dO=S.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=vr(lu,r),l=uT(),u=it(n,l);return g.jsx(ju,{as:uO,allowPinchZoom:!0,shards:[s.contentRef],children:g.jsx(Ie.div,{"data-state":sp(s.open),...i,ref:u,style:{pointerEvents:"auto",...i.style}})})}),za="DialogContent",ap=S.forwardRef((e,n)=>{const r=AS(za,e.__scopeDialog),{forceMount:i=r.forceMount,...s}=e,l=vr(za,e.__scopeDialog);return g.jsx(gr,{present:i||l.open,children:l.modal?g.jsx(fO,{...s,ref:n}):g.jsx(hO,{...s,ref:n})})});ap.displayName=za;var fO=S.forwardRef((e,n)=>{const r=vr(za,e.__scopeDialog),i=S.useRef(null),s=it(n,r.contentRef,i);return S.useEffect(()=>{const l=i.current;if(l)return tp(l)},[]),g.jsx(MS,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Re(e.onCloseAutoFocus,l=>{l.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Re(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0;(u.button===2||d)&&l.preventDefault()}),onFocusOutside:Re(e.onFocusOutside,l=>l.preventDefault())})}),hO=S.forwardRef((e,n)=>{const r=vr(za,e.__scopeDialog),i=S.useRef(!1),s=S.useRef(!1);return g.jsx(MS,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{e.onCloseAutoFocus?.(l),l.defaultPrevented||(i.current||r.triggerRef.current?.focus(),l.preventDefault()),i.current=!1,s.current=!1},onInteractOutside:l=>{e.onInteractOutside?.(l),l.defaultPrevented||(i.current=!0,l.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const u=l.target;r.triggerRef.current?.contains(u)&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&s.current&&l.preventDefault()}})}),MS=S.forwardRef((e,n)=>{const{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:l,...u}=e,d=vr(za,r);return ep(),g.jsx(g.Fragment,{children:g.jsx(Au,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:s,onUnmountAutoFocus:l,children:g.jsx(cl,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":sp(d.open),...u,ref:n,deferPointerDownOutside:!0,onDismiss:()=>d.onOpenChange(!1)})})})}),jS="DialogTitle",NS=S.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=vr(jS,r);return g.jsx(Ie.h2,{id:s.titleId,...i,ref:n})});NS.displayName=jS;var zS="DialogDescription",mO=S.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=vr(zS,r);return g.jsx(Ie.p,{id:s.descriptionId,...i,ref:n})});mO.displayName=zS;var DS="DialogClose",kS=S.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=vr(DS,r);return g.jsx(Ie.button,{type:"button",...i,ref:n,onClick:Re(e.onClick,()=>s.onOpenChange(!1))})});kS.displayName=DS;function sp(e){return e?"open":"closed"}function pO(e){const n=S.useRef({value:e,previous:e});return S.useMemo(()=>(n.current.value!==e&&(n.current.previous=n.current.value,n.current.value=e),n.current.previous),[e])}function gO(e){const[n,r]=S.useState(void 0);return Qt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const l=s[0];let u,d;if("borderBoxSize"in l){const h=l.borderBoxSize,m=Array.isArray(h)?h[0]:h;u=m.inlineSize,d=m.blockSize}else u=e.offsetWidth,d=e.offsetHeight;r({width:u,height:d})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else r(void 0)},[e]),n}const vO=["top","right","bottom","left"],zo=Math.min,Xr=Math.max,cu=Math.round,Vc=Math.floor,Jr=e=>({x:e,y:e}),yO={left:"right",right:"left",bottom:"top",top:"bottom"};function LS(e,n,r){return Xr(e,zo(n,r))}function Wr(e,n){return typeof e=="function"?e(n):e}function Do(e){return e.split("-")[0]}function La(e){return e.split("-")[1]}function lp(e){return e==="x"?"y":"x"}function cp(e){return e==="y"?"height":"width"}function Tr(e){const n=e[0];return n==="t"||n==="b"?"y":"x"}function up(e){return lp(Tr(e))}function bO(e,n,r){r===void 0&&(r=!1);const i=La(e),s=up(e),l=cp(s);let u=s==="x"?i===(r?"end":"start")?"right":"left":i==="start"?"bottom":"top";return n.reference[l]>n.floating[l]&&(u=uu(u)),[u,uu(u)]}function xO(e){const n=uu(e);return[mm(e),n,mm(n)]}function mm(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ab=["left","right"],Mb=["right","left"],SO=["top","bottom"],wO=["bottom","top"];function _O(e,n,r){switch(e){case"top":case"bottom":return r?n?Mb:Ab:n?Ab:Mb;case"left":case"right":return n?SO:wO;default:return[]}}function CO(e,n,r,i){const s=La(e);let l=_O(Do(e),r==="start",i);return s&&(l=l.map(u=>u+"-"+s),n&&(l=l.concat(l.map(mm)))),l}function uu(e){const n=Do(e);return yO[n]+e.slice(n.length)}function EO(e){var n,r,i,s;return{top:(n=e.top)!=null?n:0,right:(r=e.right)!=null?r:0,bottom:(i=e.bottom)!=null?i:0,left:(s=e.left)!=null?s:0}}function $S(e){return typeof e!="number"?EO(e):{top:e,right:e,bottom:e,left:e}}function du(e){const{x:n,y:r,width:i,height:s}=e;return{width:i,height:s,top:r,left:n,right:n+i,bottom:r+s,x:n,y:r}}function jb(e,n,r){let{reference:i,floating:s}=e;const l=Tr(n),u=up(n),d=cp(u),h=Do(n),m=l==="y",y=i.x+i.width/2-s.width/2,v=i.y+i.height/2-s.height/2,b=i[d]/2-s[d]/2;let x;switch(h){case"top":x={x:y,y:i.y-s.height};break;case"bottom":x={x:y,y:i.y+i.height};break;case"right":x={x:i.x+i.width,y:v};break;case"left":x={x:i.x-s.width,y:v};break;default:x={x:i.x,y:i.y}}const C=La(n);return C&&(x[u]+=b*(C==="end"?1:-1)*(r&&m?-1:1)),x}async function RO(e,n){var r;n===void 0&&(n={});const{x:i,y:s,platform:l,rects:u,elements:d,strategy:h}=e,{boundary:m="clippingAncestors",rootBoundary:y="viewport",elementContext:v="floating",altBoundary:b=!1,padding:x=0}=Wr(n,e),C=$S(x),E=d[b?v==="floating"?"reference":"floating":v],T=du(await l.getClippingRect({element:(r=await(l.isElement==null?void 0:l.isElement(E)))==null||r?E:E.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(d.floating)),boundary:m,rootBoundary:y,strategy:h})),O=v==="floating"?{x:i,y:s,width:u.floating.width,height:u.floating.height}:u.reference,A=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d.floating)),k=await(l.isElement==null?void 0:l.isElement(A))&&await(l.getScale==null?void 0:l.getScale(A))||{x:1,y:1},L=du(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:O,offsetParent:A,strategy:h}):O);return{top:(T.top-L.top+C.top)/k.y,bottom:(L.bottom-T.bottom+C.bottom)/k.y,left:(T.left-L.left+C.left)/k.x,right:(L.right-T.right+C.right)/k.x}}const TO=50,OO=async(e,n,r)=>{const{placement:i="bottom",strategy:s="absolute",middleware:l=[],platform:u}=r,d=u.detectOverflow?u:{...u,detectOverflow:RO},h=await(u.isRTL==null?void 0:u.isRTL(n));let m=await u.getElementRects({reference:e,floating:n,strategy:s}),{x:y,y:v}=jb(m,i,h),b=i,x=0;const C={};for(let _=0;_({name:"arrow",options:e,async fn(n){const{x:r,y:i,placement:s,rects:l,platform:u,elements:d,middlewareData:h}=n,{element:m,padding:y=0}=Wr(e,n)||{};if(m==null)return{};const v=$S(y),b={x:r,y:i},x=up(s),C=cp(x),_=await u.getDimensions(m),E=x==="y",T=E?"top":"left",O=E?"bottom":"right",A=E?"clientHeight":"clientWidth",k=l.reference[C]+l.reference[x]-b[x]-l.floating[C],L=b[x]-l.reference[x],q=await(u.getOffsetParent==null?void 0:u.getOffsetParent(m));let H=q?q[A]:0;(!H||!await(u.isElement==null?void 0:u.isElement(q)))&&(H=d.floating[A]||l.floating[C]);const I=k/2-L/2,he=H/2-_[C]/2-1,ve=zo(v[T],he),de=zo(v[O],he),le=H-_[C]-de,ae=H/2-_[C]/2+I,me=LS(ve,ae,le),ye=!h.arrow&&La(s)!=null&&ae!==me&&l.reference[C]/2-(aeme<=0)){var de,le;const me=(((de=l.flip)==null?void 0:de.index)||0)+1,ye=H[me];if(ye&&(!(v==="alignment"?O!==Tr(ye):!1)||ve.every(ne=>Tr(ne.placement)===O?ne.overflows[0]>0:!0)))return{data:{index:me,overflows:ve},reset:{placement:ye}};let D=(le=ve.filter(Y=>Y.overflows[0]<=0).sort((Y,ne)=>Y.overflows[1]-ne.overflows[1])[0])==null?void 0:le.placement;if(!D)switch(x){case"bestFit":{var ae;const Y=(ae=ve.filter(ne=>{if(q){const J=Tr(ne.placement);return J===O||J==="y"}return!0}).map(ne=>[ne.placement,ne.overflows.filter(J=>J>0).reduce((J,W)=>J+W,0)]).sort((ne,J)=>ne[1]-J[1])[0])==null?void 0:ae[0];Y&&(D=Y);break}case"initialPlacement":D=d;break}if(s!==D)return{reset:{placement:D}}}return{}}}};function Nb(e,n){return{top:e.top-n.height,right:e.right-n.width,bottom:e.bottom-n.height,left:e.left-n.width}}function zb(e){return vO.some(n=>e[n]>=0)}const jO=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(n){const{rects:r,platform:i}=n,{strategy:s="referenceHidden",...l}=Wr(e,n);switch(s){case"referenceHidden":{const u=await i.detectOverflow(n,{...l,elementContext:"reference"}),d=Nb(u,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:zb(d)}}}case"escaped":{const u=await i.detectOverflow(n,{...l,altBoundary:!0}),d=Nb(u,r.floating);return{data:{escapedOffsets:d,escaped:zb(d)}}}default:return{}}}}},IS=new Set(["left","top"]);async function NO(e,n){const{placement:r,platform:i,elements:s}=e,l=await(i.isRTL==null?void 0:i.isRTL(s.floating)),u=Do(r),d=La(r),h=Tr(r)==="y",m=IS.has(u)?-1:1,y=l&&h?-1:1,v=Wr(n,e);let{mainAxis:b,crossAxis:x,alignmentAxis:C}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return d&&typeof C=="number"&&(x=d==="end"?C*-1:C),h?{x:x*y,y:b*m}:{x:b*m,y:x*y}}const zO=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(n){var r,i;const{x:s,y:l,placement:u,middlewareData:d}=n,h=await NO(n,e);return u===((r=d.offset)==null?void 0:r.placement)&&(i=d.arrow)!=null&&i.alignmentOffset?{}:{x:s+h.x,y:l+h.y,data:{...h,placement:u}}}}},DO=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(n){const{x:r,y:i,placement:s,platform:l}=n,{mainAxis:u=!0,crossAxis:d=!1,limiter:h={fn:O=>{let{x:A,y:k}=O;return{x:A,y:k}}},...m}=Wr(e,n),y={x:r,y:i},v=await l.detectOverflow(n,m),b=Tr(s),x=lp(b);let C=y[x],_=y[b];const E=(O,A)=>LS(A+v[O==="y"?"top":"left"],A,A-v[O==="y"?"bottom":"right"]);u&&(C=E(x,C)),d&&(_=E(b,_));const T=h.fn({...n,[x]:C,[b]:_});return{...T,data:{x:T.x-r,y:T.y-i,enabled:{[x]:u,[b]:d}}}}}},kO=function(e){return e===void 0&&(e={}),{options:e,fn(n){var r,i;const{x:s,y:l,placement:u,rects:d,middlewareData:h}=n,{offset:m=0,mainAxis:y=!0,crossAxis:v=!0}=Wr(e,n),b={x:s,y:l},x=Tr(u),C=lp(x);let _=b[C],E=b[x];const T=Wr(m,n),O=typeof T=="number"?{mainAxis:T,crossAxis:0}:{mainAxis:(r=T.mainAxis)!=null?r:0,crossAxis:(i=T.crossAxis)!=null?i:0};if(y){const L=C==="y"?"height":"width",q=d.reference[C]-d.floating[L]+O.mainAxis,H=d.reference[C]+d.reference[L]-O.mainAxis;_H&&(_=H)}if(v){var A,k;const L=C==="y"?"width":"height",q=IS.has(Do(u)),H=d.reference[x]-d.floating[L]+(q&&((A=h.offset)==null?void 0:A[x])||0)+(q?0:O.crossAxis),I=d.reference[x]+d.reference[L]+(q?0:((k=h.offset)==null?void 0:k[x])||0)-(q?O.crossAxis:0);EI&&(E=I)}return{[C]:_,[x]:E}}}},LO=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(n){const{placement:r,rects:i,platform:s,elements:l}=n,{apply:u=()=>{},...d}=Wr(e,n),h=await s.detectOverflow(n,d),m=Do(r),y=La(r),v=Tr(r)==="y",{width:b,height:x}=i.floating;let C,_;m==="top"||m==="bottom"?(C=m,_=y===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(_=m,C=y==="end"?"top":"bottom");const E=x-h.top-h.bottom,T=b-h.left-h.right,O=zo(x-h[C],E),A=zo(b-h[_],T),k=n.middlewareData.shift,L=!k;let q=O,H=A;k!=null&&k.enabled.x&&(H=T),k!=null&&k.enabled.y&&(q=E),L&&!y&&(v?H=b-2*Xr(h.left,h.right):q=x-2*Xr(h.top,h.bottom)),await u({...n,availableWidth:H,availableHeight:q});const I=await s.getDimensions(l.floating);return b!==I.width||x!==I.height?{reset:{rects:!0}}:{}}}};function zu(){return typeof window<"u"}function $a(e){return VS(e)?(e.nodeName||"").toLowerCase():"#document"}function jn(e){var n;return(e==null||(n=e.ownerDocument)==null?void 0:n.defaultView)||window}function eo(e){var n;return(n=(VS(e)?e.ownerDocument:e.document)||window.document)==null?void 0:n.documentElement}function VS(e){return zu()?e instanceof Node||e instanceof jn(e).Node:!1}function Or(e){return zu()?e instanceof Element||e instanceof jn(e).Element:!1}function Vo(e){return zu()?e instanceof HTMLElement||e instanceof jn(e).HTMLElement:!1}function Db(e){return!zu()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof jn(e).ShadowRoot}function Du(e){const{overflow:n,overflowX:r,overflowY:i,display:s}=Ar(e);return/auto|scroll|overlay|hidden|clip/.test(n+i+r)&&s!=="inline"&&s!=="contents"}function $O(e){return/^(table|td|th)$/.test($a(e))}function ku(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const IO=/transform|translate|scale|rotate|perspective|filter/,VO=/paint|layout|strict|content/,ci=e=>!!e&&e!=="none";let zh;function dp(e){const n=Or(e)?Ar(e):e;return ci(n.transform)||ci(n.translate)||ci(n.scale)||ci(n.rotate)||ci(n.perspective)||!fp()&&(ci(n.backdropFilter)||ci(n.filter))||IO.test(n.willChange||"")||VO.test(n.contain||"")}function FO(e){let n=mi(e);for(;Vo(n)&&!Ks(n);){if(dp(n))return n;if(ku(n))return null;n=mi(n)}return null}function fp(){return zh==null&&(zh=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),zh}function Ks(e){return/^(html|body|#document)$/.test($a(e))}function Ar(e){return jn(e).getComputedStyle(e)}function Lu(e){return Or(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function mi(e){if($a(e)==="html")return e;const n=e.assignedSlot||e.parentNode||Db(e)&&e.host||eo(e);return Db(n)?n.host:n}function FS(e){const n=mi(e);return Ks(n)?(e.ownerDocument||e).body:Vo(n)&&Du(n)?n:FS(n)}function Ys(e,n,r){var i;n===void 0&&(n=[]),r===void 0&&(r=!0);const s=FS(e),l=s===((i=e.ownerDocument)==null?void 0:i.body),u=jn(s);if(l){const d=pm(u);return n.concat(u,u.visualViewport||[],Du(s)?s:[],d&&r?Ys(d):[])}else return n.concat(s,Ys(s,[],r))}function pm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function PS(e){const n=Ar(e);let r=parseFloat(n.width)||0,i=parseFloat(n.height)||0;const s=Vo(e),l=s?e.offsetWidth:r,u=s?e.offsetHeight:i,d=cu(r)!==l||cu(i)!==u;return d&&(r=l,i=u),{width:r,height:i,$:d}}function hp(e){return Or(e)?e:e.contextElement}function Ra(e){const n=hp(e);if(!Vo(n))return Jr(1);const r=n.getBoundingClientRect(),{width:i,height:s,$:l}=PS(n);let u=(l?cu(r.width):r.width)/i,d=(l?cu(r.height):r.height)/s;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const PO=Jr(0);function US(e){const n=jn(e);return!fp()||!n.visualViewport?PO:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function UO(e,n,r){return n===void 0&&(n=!1),!!r&&n&&r===jn(e)}function pi(e,n,r,i){n===void 0&&(n=!1),r===void 0&&(r=!1);const s=e.getBoundingClientRect(),l=hp(e);let u=Jr(1);n&&(i?Or(i)&&(u=Ra(i)):u=Ra(e));const d=UO(l,r,i)?US(l):Jr(0);let h=(s.left+d.x)/u.x,m=(s.top+d.y)/u.y,y=s.width/u.x,v=s.height/u.y;if(l&&i){const b=jn(l),x=Or(i)?jn(i):i;let C=b,_=pm(C);for(;_&&x!==C;){const E=Ra(_),T=_.getBoundingClientRect(),O=Ar(_),A=T.left+(_.clientLeft+parseFloat(O.paddingLeft))*E.x,k=T.top+(_.clientTop+parseFloat(O.paddingTop))*E.y;h*=E.x,m*=E.y,y*=E.x,v*=E.y,h+=A,m+=k,C=jn(_),_=pm(C)}}return du({width:y,height:v,x:h,y:m})}function $u(e,n){const r=Lu(e).scrollLeft;return n?n.left+r:pi(eo(e)).left+r}function HS(e,n){const r=e.getBoundingClientRect(),i=r.left+n.scrollLeft-$u(e,r),s=r.top+n.scrollTop;return{x:i,y:s}}function HO(e){let{elements:n,rect:r,offsetParent:i,strategy:s}=e;const l=s==="fixed",u=eo(i),d=n?ku(n.floating):!1;if(i===u||d&&l)return r;let h={scrollLeft:0,scrollTop:0},m=Jr(1);const y=Jr(0),v=Vo(i);if((v||!l)&&(($a(i)!=="body"||Du(u))&&(h=Lu(i)),v)){const x=pi(i);m=Ra(i),y.x=x.x+i.clientLeft,y.y=x.y+i.clientTop}const b=u&&!v&&!l?HS(u,h):Jr(0);return{width:r.width*m.x,height:r.height*m.y,x:r.x*m.x-h.scrollLeft*m.x+y.x+b.x,y:r.y*m.y-h.scrollTop*m.y+y.y+b.y}}function BO(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function qO(e){const n=Lu(e),r=e.ownerDocument.body,i=Xr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Xr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+$u(e);const u=-n.scrollTop;return Ar(r).direction==="rtl"&&(l+=Xr(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:l,y:u}}const GO=25;function ZO(e,n,r){r===void 0&&(r="viewport");const i=r==="layoutViewport",s=jn(e),l=eo(e),u=s.visualViewport;let d=l.clientWidth,h=l.clientHeight,m=0,y=0;if(u){const b=!fp()||n==="fixed";i?b||(m=-u.offsetLeft,y=-u.offsetTop):(d=u.width,h=u.height,b&&(m=u.offsetLeft,y=u.offsetTop))}if($u(l)<=0){const b=l.ownerDocument,x=b.body,C=getComputedStyle(x),_=b.compatMode==="CSS1Compat"&&parseFloat(C.marginLeft)+parseFloat(C.marginRight)||0,E=Math.abs(l.clientWidth-x.clientWidth-_),T=getComputedStyle(l).scrollbarGutter==="stable both-edges"?E/2:E;T<=GO&&(d-=T)}return{width:d,height:h,x:m,y}}function KO(e,n){const r=pi(e,!0,n==="fixed"),i=r.top+e.clientTop,s=r.left+e.clientLeft,l=Ra(e),u=e.clientWidth*l.x,d=e.clientHeight*l.y,h=s*l.x,m=i*l.y;return{width:u,height:d,x:h,y:m}}function kb(e,n,r){let i;if(n==="viewport"||n==="layoutViewport")i=ZO(e,r,n);else if(n==="document")i=qO(eo(e));else if(Or(n))i=KO(n,r);else{const s=US(e);i={x:n.x-s.x,y:n.y-s.y,width:n.width,height:n.height}}return du(i)}function YO(e,n){const r=n.get(e);if(r)return r;let i=Ys(e,[],!1).filter(d=>Or(d)&&$a(d)!=="body"),s=null;const l=Ar(e).position==="fixed";let u=l?mi(e):e;for(;Or(u)&&!Ks(u);){const d=Ar(u),h=dp(u),m=s?s.position:l?"fixed":"";!h&&(m==="fixed"||m==="absolute"&&d.position==="static")?i=i.filter(v=>v!==u):s=d,u=mi(u)}return n.set(e,i),i}function QO(e){let{element:n,boundary:r,rootBoundary:i,strategy:s}=e;const u=[...r==="clippingAncestors"?ku(n)?[]:YO(n,this._c):[].concat(r),i],d=kb(n,u[0],s);let h=d.top,m=d.right,y=d.bottom,v=d.left;for(let b=1;b{d(!1,1e-7)},1e3)}H=!1}try{i=new IntersectionObserver(I,{...q,root:l.ownerDocument})}catch{i=new IntersectionObserver(I,q)}i.observe(e)}const h=jn(e),m=()=>d(r);return h.addEventListener("resize",m),d(!0),()=>{h.removeEventListener("resize",m),u()}}function rA(e,n,r,i){i===void 0&&(i={});const{ancestorScroll:s=!0,ancestorResize:l=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:h=!1}=i,m=hp(e),y=s||l?[...m?Ys(m):[],...n?Ys(n):[]]:[];y.forEach(T=>{s&&T.addEventListener("scroll",r),l&&T.addEventListener("resize",r)});const v=m&&d?nA(m,r,l):null;let b=-1,x=null;u&&(x=new ResizeObserver(T=>{let[O]=T;O&&O.target===m&&x&&n&&(x.unobserve(n),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var A;(A=x)==null||A.observe(n)})),r()}),m&&!h&&x.observe(m),n&&x.observe(n));let C,_=h?pi(e):null;h&&E();function E(){const T=pi(e);_&&!qS(_,T)&&r(),_=T,C=requestAnimationFrame(E)}return r(),()=>{var T;y.forEach(O=>{s&&O.removeEventListener("scroll",r),l&&O.removeEventListener("resize",r)}),v?.(),(T=x)==null||T.disconnect(),x=null,h&&cancelAnimationFrame(C)}}const oA=zO,iA=DO,aA=MO,sA=LO,lA=jO,$b=AO,cA=kO,uA=(e,n,r)=>{const i=new Map,s=r??{},l={...tA,...s.platform,_c:i};return OO(e,n,{...s,platform:l})};var dA=typeof document<"u",fA=function(){},Jc=dA?S.useLayoutEffect:fA;function fu(e,n){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(typeof e=="function"&&e.toString()===n.toString())return!0;let r,i,s;if(e&&n&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==n.length)return!1;for(i=r;i--!==0;)if(!fu(e[i],n[i]))return!1;return!0}if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!{}.hasOwnProperty.call(n,s[i]))return!1;for(i=r;i--!==0;){const l=s[i];if(!(l==="_owner"&&e.$$typeof)&&!fu(e[l],n[l]))return!1}return!0}return e!==e&&n!==n}function GS(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ib(e,n){const r=GS(e);return Math.round(n*r)/r}function kh(e){const n=S.useRef(e);return Jc(()=>{n.current=e}),n}function hA(e){e===void 0&&(e={});const{placement:n="bottom",strategy:r="absolute",middleware:i=[],platform:s,elements:{reference:l,floating:u}={},transform:d=!0,whileElementsMounted:h,open:m}=e,[y,v]=S.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[b,x]=S.useState(i);fu(b,i)||x(i);const[C,_]=S.useState(null),[E,T]=S.useState(null),O=S.useCallback(ne=>{ne!==q.current&&(q.current=ne,_(ne))},[]),A=S.useCallback(ne=>{ne!==H.current&&(H.current=ne,T(ne))},[]),k=l||C,L=u||E,q=S.useRef(null),H=S.useRef(null),I=S.useRef(y),he=h!=null,ve=kh(h),de=kh(s),le=kh(m),ae=S.useCallback(()=>{if(!q.current||!H.current)return;const ne={placement:n,strategy:r,middleware:b};de.current&&(ne.platform=de.current),uA(q.current,H.current,ne).then(J=>{const W={...J,isPositioned:le.current!==!1};me.current&&!fu(I.current,W)&&(I.current=W,xi.flushSync(()=>{v(W)}))})},[b,n,r,de,le]);Jc(()=>{m===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,v(ne=>({...ne,isPositioned:!1})))},[m]);const me=S.useRef(!1);Jc(()=>(me.current=!0,()=>{me.current=!1}),[]),Jc(()=>{if(k&&(q.current=k),L&&(H.current=L),k&&L){if(ve.current)return ve.current(k,L,ae);ae()}},[k,L,ae,ve,he]);const ye=S.useMemo(()=>({reference:q,floating:H,setReference:O,setFloating:A}),[O,A]),D=S.useMemo(()=>({reference:k,floating:L}),[k,L]),Y=S.useMemo(()=>{const ne={position:r,left:0,top:0};if(!D.floating)return ne;const J=Ib(D.floating,y.x),W=Ib(D.floating,y.y);return d?{...ne,transform:"translate("+J+"px, "+W+"px)",...GS(D.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:J,top:W}},[r,d,D.floating,y.x,y.y]);return S.useMemo(()=>({...y,update:ae,refs:ye,elements:D,floatingStyles:Y}),[y,ae,ye,D,Y])}const mA=e=>{function n(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:i,padding:s}=typeof e=="function"?e(r):e;return i&&n(i)?i.current!=null?$b({element:i.current,padding:s}).fn(r):{}:i?$b({element:i,padding:s}).fn(r):{}}}},pA=(e,n)=>{const r=oA(e);return{name:r.name,fn:r.fn,options:[e,n]}},gA=(e,n)=>{const r=iA(e);return{name:r.name,fn:r.fn,options:[e,n]}},vA=(e,n)=>({fn:cA(e).fn,options:[e,n]}),yA=(e,n)=>{const r=aA(e);return{name:r.name,fn:r.fn,options:[e,n]}},bA=(e,n)=>{const r=sA(e);return{name:r.name,fn:r.fn,options:[e,n]}},xA=(e,n)=>{const r=lA(e);return{name:r.name,fn:r.fn,options:[e,n]}},SA=(e,n)=>{const r=mA(e);return{name:r.name,fn:r.fn,options:[e,n]}};var wA="Arrow",ZS=S.forwardRef((e,n)=>{const{children:r,width:i=10,height:s=5,...l}=e;return g.jsx(Ie.svg,{...l,ref:n,width:i,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});ZS.displayName=wA;var _A=ZS,mp="Popper",[KS,Ia]=Io(mp),[CA,YS]=KS(mp),QS=e=>{const{__scopePopper:n,children:r}=e,[i,s]=S.useState(null),[l,u]=S.useState(void 0);return g.jsx(CA,{scope:n,anchor:i,onAnchorChange:s,placementState:l,setPlacementState:u,children:r})};QS.displayName=mp;var XS="PopperAnchor",JS=S.forwardRef((e,n)=>{const{__scopePopper:r,virtualRef:i,...s}=e,l=YS(XS,r),u=S.useRef(null),d=l.onAnchorChange,h=S.useCallback(C=>{u.current=C,C&&d(C)},[d]),m=it(n,h),y=S.useRef(null);S.useEffect(()=>{if(!i)return;const C=y.current;y.current=i.current,C!==y.current&&d(y.current)});const v=l.placementState&&gp(l.placementState),b=v?.[0],x=v?.[1];return i?null:g.jsx(Ie.div,{"data-radix-popper-side":b,"data-radix-popper-align":x,...s,ref:m})});JS.displayName=XS;var pp="PopperContent",[EA,RA]=KS(pp),WS=S.forwardRef((e,n)=>{const{__scopePopper:r,side:i="bottom",sideOffset:s=0,align:l="center",alignOffset:u=0,arrowPadding:d=0,avoidCollisions:h=!0,collisionBoundary:m=[],collisionPadding:y=0,sticky:v="partial",hideWhenDetached:b=!1,updatePositionStrategy:x="optimized",onPlaced:C,..._}=e,E=YS(pp,r),[T,O]=S.useState(null),A=it(n,O),[k,L]=S.useState(null),q=gO(k),H=q?.width??0,I=q?.height??0,he=i+(l!=="center"?"-"+l:""),ve=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},de=Array.isArray(m)?m:[m],le=de.length>0,ae={padding:ve,boundary:de.filter(OA),altBoundary:le},{refs:me,floatingStyles:ye,placement:D,isPositioned:Y,middlewareData:ne}=hA({strategy:"fixed",placement:he,whileElementsMounted:(...ge)=>rA(...ge,{animationFrame:x==="always"}),elements:{reference:E.anchor},middleware:[pA({mainAxis:s+I,alignmentAxis:u}),h&&gA({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?vA():void 0,...ae}),h&&yA({...ae}),bA({...ae,apply:({elements:ge,rects:be,availableWidth:De,availableHeight:Ve})=>{const{width:Ue,height:lt}=be.reference,Je=ge.floating.style;Je.setProperty("--radix-popper-available-width",`${De}px`),Je.setProperty("--radix-popper-available-height",`${Ve}px`),Je.setProperty("--radix-popper-anchor-width",`${Ue}px`),Je.setProperty("--radix-popper-anchor-height",`${lt}px`)}}),k&&SA({element:k,padding:d}),AA({arrowWidth:H,arrowHeight:I}),b&&xA({strategy:"referenceHidden",...ae,boundary:le?ae.boundary:void 0})]}),J=E.setPlacementState;Qt(()=>(J(D),()=>{J(void 0)}),[D,J]);const[W,N]=gp(D),j=nr(C);Qt(()=>{Y&&j?.()},[Y,j]);const U=ne.arrow?.x,Q=ne.arrow?.y,Z=ne.arrow?.centerOffset!==0,[re,ee]=S.useState();return Qt(()=>{T&&ee(window.getComputedStyle(T).zIndex)},[T]),g.jsx("div",{ref:me.setFloating,"data-radix-popper-content-wrapper":"",style:{...ye,transform:Y?ye.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:re,"--radix-popper-transform-origin":[ne.transformOrigin?.x,ne.transformOrigin?.y].join(" "),...ne.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:g.jsx(EA,{scope:r,placedSide:W,placedAlign:N,onArrowChange:L,arrowX:U,arrowY:Q,shouldHideArrow:Z,children:g.jsx(Ie.div,{"data-side":W,"data-align":N,..._,ref:A,style:{..._.style,animation:Y?void 0:"none"}})})})});WS.displayName=pp;var ew="PopperArrow",TA={top:"bottom",right:"left",bottom:"top",left:"right"},tw=S.forwardRef(function(n,r){const{__scopePopper:i,...s}=n,l=RA(ew,i),u=TA[l.placedSide];return g.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:g.jsx(_A,{...s,ref:r,style:{...s.style,display:"block"}})})});tw.displayName=ew;function OA(e){return e!==null}var AA=e=>({name:"transformOrigin",options:e,fn(n){const{placement:r,rects:i,middlewareData:s}=n,u=s.arrow?.centerOffset!==0,d=u?0:e.arrowWidth,h=u?0:e.arrowHeight,[m,y]=gp(r),v={start:"0%",center:"50%",end:"100%"}[y],b=(s.arrow?.x??0)+d/2,x=(s.arrow?.y??0)+h/2;let C="",_="";return m==="bottom"?(C=u?v:`${b}px`,_=`${-h}px`):m==="top"?(C=u?v:`${b}px`,_=`${i.floating.height+h}px`):m==="right"?(C=`${-h}px`,_=u?v:`${x}px`):m==="left"&&(C=`${i.floating.width+h}px`,_=u?v:`${x}px`),{data:{x:C,y:_}}}});function gp(e){const[n,r="center"]=e.split("-");return[n,r]}var vp=QS,yp=JS,bp=WS,xp=tw,Lh=!1;function MA(){const[e,n]=S.useState(Lh);return S.useEffect(()=>{Lh||(Lh=!0,n(!0))},[]),e}var nw=Ou[" useSyncExternalStore ".trim().toString()];function jA(){return()=>{}}function NA(){return nw(jA,()=>!0,()=>!1)}var zA=typeof nw=="function"?NA:MA,$h="rovingFocusGroup.onEntryFocus",DA={bubbles:!1,cancelable:!0},dl="RovingFocusGroup",[gm,rw,kA]=Xm(dl),[LA,ow]=Io(dl,[kA]),[$A,IA]=LA(dl),iw=S.forwardRef((e,n)=>g.jsx(gm.Provider,{scope:e.__scopeRovingFocusGroup,children:g.jsx(gm.Slot,{scope:e.__scopeRovingFocusGroup,children:g.jsx(VA,{...e,ref:n})})}));iw.displayName=dl;var VA=S.forwardRef((e,n)=>{const{__scopeRovingFocusGroup:r,orientation:i,loop:s=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:h,onEntryFocus:m,preventScrollOnEntryFocus:y=!1,...v}=e,b=S.useRef(null),x=it(n,b),C=Jm(l),[_,E]=Na({prop:u,defaultProp:d??null,onChange:h,caller:dl}),[T,O]=S.useState(!1),A=nr(m),k=rw(r),L=S.useRef(!1),[q,H]=S.useState(0);return S.useEffect(()=>{const I=b.current;if(I)return I.addEventListener($h,A),()=>I.removeEventListener($h,A)},[A]),g.jsx($A,{scope:r,orientation:i,dir:C,loop:s,currentTabStopId:_,onItemFocus:S.useCallback(I=>E(I),[E]),onItemShiftTab:S.useCallback(()=>O(!0),[]),onFocusableItemAdd:S.useCallback(()=>H(I=>I+1),[]),onFocusableItemRemove:S.useCallback(()=>H(I=>I-1),[]),children:g.jsx(Ie.div,{tabIndex:T||q===0?-1:0,"data-orientation":i,...v,ref:x,style:{outline:"none",...e.style},onMouseDown:Re(e.onMouseDown,()=>{L.current=!0}),onFocus:Re(e.onFocus,I=>{const he=!L.current;if(I.target===I.currentTarget&&he&&!T){const ve=new CustomEvent($h,DA);if(I.currentTarget.dispatchEvent(ve),!ve.defaultPrevented){const de=k().filter(D=>D.focusable),le=de.find(D=>D.active),ae=de.find(D=>D.id===_),ye=[le,ae,...de].filter(Boolean).map(D=>D.ref.current);lw(ye,y)}}L.current=!1}),onBlur:Re(e.onBlur,()=>O(!1))})})}),aw="RovingFocusGroupItem",sw=S.forwardRef((e,n)=>{const{__scopeRovingFocusGroup:r,focusable:i=!0,active:s=!1,tabStopId:l,children:u,...d}=e,h=hn(),m=l||h,y=IA(aw,r),v=y.currentTabStopId===m,b=rw(r),{onFocusableItemAdd:x,onFocusableItemRemove:C,currentTabStopId:_}=y,E=zA();return Qt(()=>{if(!(!E||!i))return x(),()=>C()},[E,i,x,C]),S.useEffect(()=>{if(!(E||!i))return x(),()=>C()},[E,i,x,C]),g.jsx(gm.ItemSlot,{scope:r,id:m,focusable:i,active:s,children:g.jsx(Ie.span,{tabIndex:v?0:-1,"data-orientation":y.orientation,...d,ref:n,onMouseDown:Re(e.onMouseDown,T=>{i?y.onItemFocus(m):T.preventDefault()}),onFocus:Re(e.onFocus,()=>y.onItemFocus(m)),onKeyDown:Re(e.onKeyDown,T=>{if(T.key==="Tab"&&T.shiftKey){y.onItemShiftTab();return}if(T.target!==T.currentTarget)return;const O=UA(T,y.orientation,y.dir);if(O!==void 0){if(T.metaKey||T.ctrlKey||T.altKey||T.shiftKey)return;T.preventDefault();let k=b().filter(L=>L.focusable).map(L=>L.ref.current);if(O==="last")k.reverse();else if(O==="prev"||O==="next"){O==="prev"&&k.reverse();const L=k.indexOf(T.currentTarget);k=y.loop?HA(k,L+1):k.slice(L+1)}setTimeout(()=>lw(k))}}),children:typeof u=="function"?u({isCurrentTabStop:v,hasTabStop:_!=null}):u})})});sw.displayName=aw;var FA={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function PA(e,n){return n!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function UA(e,n,r){const i=PA(e.key,r);if(!(n==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(n==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return FA[i]}function lw(e,n=!1){const r=document.activeElement;for(const i of e)if(i===r||(i.focus({preventScroll:n}),document.activeElement!==r))return}function HA(e,n){return e.map((r,i)=>e[(n+i)%e.length])}var BA=iw,qA=sw,vm=["Enter"," "],GA=["ArrowDown","PageUp","Home"],cw=["ArrowUp","PageDown","End"],ZA=[...GA,...cw],KA={ltr:[...vm,"ArrowRight"],rtl:[...vm,"ArrowLeft"]},YA={ltr:["ArrowLeft"],rtl:["ArrowRight"]},fl="Menu",[Qs,QA,XA]=Xm(fl),[Si,uw]=Io(fl,[XA,Ia,ow]),Iu=Ia(),dw=ow(),[JA,wi]=Si(fl),[WA,hl]=Si(fl),fw=e=>{const{__scopeMenu:n,open:r=!1,children:i,dir:s,onOpenChange:l,modal:u=!0}=e,d=Iu(n),[h,m]=S.useState(null),y=S.useRef(!1),v=nr(l),b=Jm(s);return S.useEffect(()=>{const x=()=>{y.current=!0,document.addEventListener("pointerdown",C,{capture:!0,once:!0}),document.addEventListener("pointermove",C,{capture:!0,once:!0})},C=()=>y.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",C,{capture:!0}),document.removeEventListener("pointermove",C,{capture:!0})}},[]),S.useEffect(()=>{if(!r)return;const x=()=>v(!1);return window.addEventListener("blur",x),()=>window.removeEventListener("blur",x)},[r,v]),g.jsx(vp,{...d,children:g.jsx(JA,{scope:n,open:r,onOpenChange:v,content:h,onContentChange:m,children:g.jsx(WA,{scope:n,onClose:S.useCallback(()=>v(!1),[v]),isUsingKeyboardRef:y,dir:b,modal:u,children:i})})})};fw.displayName=fl;var eM="MenuAnchor",Sp=S.forwardRef((e,n)=>{const{__scopeMenu:r,...i}=e,s=Iu(r);return g.jsx(yp,{...s,...i,ref:n})});Sp.displayName=eM;var wp="MenuPortal",[tM,hw]=Si(wp,{forceMount:void 0}),mw=e=>{const{__scopeMenu:n,forceMount:r,children:i,container:s}=e,l=wi(wp,n);return g.jsx(tM,{scope:n,forceMount:r,children:g.jsx(gr,{present:r||l.open,children:g.jsx(ul,{asChild:!0,container:s,children:i})})})};mw.displayName=wp;var tr="MenuContent",[nM,_p]=Si(tr),pw=S.forwardRef((e,n)=>{const r=hw(tr,e.__scopeMenu),{forceMount:i=r.forceMount,...s}=e,l=wi(tr,e.__scopeMenu),u=hl(tr,e.__scopeMenu);return g.jsx(Qs.Provider,{scope:e.__scopeMenu,children:g.jsx(gr,{present:i||l.open,children:g.jsx(Qs.Slot,{scope:e.__scopeMenu,children:u.modal?g.jsx(rM,{...s,ref:n}):g.jsx(oM,{...s,ref:n})})})})}),rM=S.forwardRef((e,n)=>{const r=wi(tr,e.__scopeMenu),i=S.useRef(null),s=it(n,i);return S.useEffect(()=>{const l=i.current;if(l)return tp(l)},[]),g.jsx(Cp,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Re(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),oM=S.forwardRef((e,n)=>{const r=wi(tr,e.__scopeMenu);return g.jsx(Cp,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),iM=hi("MenuContent.ScrollLock"),Cp=S.forwardRef((e,n)=>{const{__scopeMenu:r,loop:i=!1,trapFocus:s,onOpenAutoFocus:l,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:h,onEscapeKeyDown:m,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:b,onDismiss:x,disableOutsideScroll:C,..._}=e,E=wi(tr,r),T=hl(tr,r),O=Iu(r),A=dw(r),k=QA(r),[L,q]=S.useState(null),H=S.useRef(null),I=it(n,H,E.onContentChange),he=S.useRef(0),ve=S.useRef(""),de=S.useRef(0),le=S.useRef(null),ae=S.useRef("right"),me=S.useRef(0),ye=C?ju:S.Fragment,D=C?{as:iM,allowPinchZoom:!0}:void 0,Y=J=>{const W=ve.current+J,N=k().filter(ee=>!ee.disabled),j=document.activeElement,U=N.find(ee=>ee.ref.current===j)?.textValue,Q=N.map(ee=>ee.textValue),Z=vM(Q,W,U),re=N.find(ee=>ee.textValue===Z)?.ref.current;(function ee(ge){ve.current=ge,window.clearTimeout(he.current),ge!==""&&(he.current=window.setTimeout(()=>ee(""),1e3))})(W),re&&setTimeout(()=>re.focus())};S.useEffect(()=>()=>window.clearTimeout(he.current),[]),ep();const ne=S.useCallback(J=>ae.current===le.current?.side&&bM(J,le.current?.area),[]);return g.jsx(nM,{scope:r,searchRef:ve,onItemEnter:S.useCallback(J=>{ne(J)&&J.preventDefault()},[ne]),onItemLeave:S.useCallback(J=>{ne(J)||(H.current?.focus(),q(null))},[ne]),onTriggerLeave:S.useCallback(J=>{ne(J)&&J.preventDefault()},[ne]),pointerGraceTimerRef:de,onPointerGraceIntentChange:S.useCallback(J=>{le.current=J},[]),children:g.jsx(ye,{...D,children:g.jsx(Au,{asChild:!0,trapped:s,onMountAutoFocus:Re(l,J=>{J.preventDefault(),H.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:g.jsx(cl,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:m,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:b,onDismiss:x,children:g.jsx(BA,{asChild:!0,...A,dir:T.dir,orientation:"vertical",loop:i,currentTabStopId:L,onCurrentTabStopIdChange:q,onEntryFocus:Re(h,J=>{T.isUsingKeyboardRef.current||J.preventDefault()}),preventScrollOnEntryFocus:!0,children:g.jsx(bp,{role:"menu","aria-orientation":"vertical","data-state":jw(E.open),"data-radix-menu-content":"",dir:T.dir,...O,..._,ref:I,style:{outline:"none",..._.style},onKeyDown:Re(_.onKeyDown,J=>{const N=J.target.closest("[data-radix-menu-content]")===J.currentTarget,j=J.ctrlKey||J.altKey||J.metaKey,U=J.key.length===1;N&&(J.key==="Tab"&&J.preventDefault(),!j&&U&&Y(J.key));const Q=H.current;if(J.target!==Q||!ZA.includes(J.key))return;J.preventDefault();const re=k().filter(ee=>!ee.disabled).map(ee=>ee.ref.current);cw.includes(J.key)&&re.reverse(),pM(re)}),onBlur:Re(e.onBlur,J=>{J.currentTarget.contains(J.target)||(window.clearTimeout(he.current),ve.current="")}),onPointerMove:Re(e.onPointerMove,Xs(J=>{const W=J.target,N=me.current!==J.clientX;if(J.currentTarget.contains(W)&&N){const j=J.clientX>me.current?"right":"left";ae.current=j,me.current=J.clientX}}))})})})})})})});pw.displayName=tr;var aM="MenuGroup",Ep=S.forwardRef((e,n)=>{const{__scopeMenu:r,...i}=e;return g.jsx(Ie.div,{role:"group",...i,ref:n})});Ep.displayName=aM;var sM="MenuLabel",gw=S.forwardRef((e,n)=>{const{__scopeMenu:r,...i}=e;return g.jsx(Ie.div,{...i,ref:n})});gw.displayName=sM;var hu="MenuItem",Vb="menu.itemSelect",Vu=S.forwardRef((e,n)=>{const{disabled:r=!1,onSelect:i,...s}=e,l=S.useRef(null),u=hl(hu,e.__scopeMenu),d=_p(hu,e.__scopeMenu),h=it(n,l),m=S.useRef(!1),y=()=>{const v=l.current;if(!r&&v){const b=new CustomEvent(Vb,{bubbles:!0,cancelable:!0});v.addEventListener(Vb,x=>i?.(x),{once:!0}),mS(v,b),b.defaultPrevented?m.current=!1:u.onClose()}};return g.jsx(vw,{...s,ref:h,disabled:r,onClick:Re(e.onClick,y),onPointerDown:v=>{e.onPointerDown?.(v),m.current=!0},onPointerUp:Re(e.onPointerUp,v=>{m.current||v.currentTarget?.click()}),onKeyDown:Re(e.onKeyDown,v=>{r||v.target!==v.currentTarget||d.searchRef.current!==""&&v.key===" "||vm.includes(v.key)&&(v.currentTarget.click(),v.preventDefault())})})});Vu.displayName=hu;var vw=S.forwardRef((e,n)=>{const{__scopeMenu:r,disabled:i=!1,textValue:s,...l}=e,u=_p(hu,r),d=dw(r),h=S.useRef(null),m=it(n,h),[y,v]=S.useState(!1),[b,x]=S.useState("");return S.useEffect(()=>{const C=h.current;C&&x((C.textContent??"").trim())},[l.children]),g.jsx(Qs.ItemSlot,{scope:r,disabled:i,textValue:s??b,children:g.jsx(qA,{asChild:!0,...d,focusable:!i,children:g.jsx(Ie.div,{role:"menuitem","data-highlighted":y?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...l,ref:m,onPointerMove:Re(e.onPointerMove,Xs(C=>{i?u.onItemLeave(C):(u.onItemEnter(C),C.defaultPrevented||C.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Re(e.onPointerLeave,Xs(C=>u.onItemLeave(C))),onFocus:Re(e.onFocus,()=>v(!0)),onBlur:Re(e.onBlur,()=>v(!1))})})})}),lM="MenuCheckboxItem",yw=S.forwardRef((e,n)=>{const{checked:r=!1,onCheckedChange:i,...s}=e;return g.jsx(_w,{scope:e.__scopeMenu,checked:r,children:g.jsx(Vu,{role:"menuitemcheckbox","aria-checked":mu(r)?"mixed":r,...s,ref:n,"data-state":Tp(r),onSelect:Re(s.onSelect,()=>i?.(mu(r)?!0:!r),{checkForDefaultPrevented:!1})})})});yw.displayName=lM;var bw="MenuRadioGroup",[cM,uM]=Si(bw,{value:void 0,onValueChange:()=>{}}),xw=S.forwardRef((e,n)=>{const{value:r,onValueChange:i,...s}=e,l=nr(i);return g.jsx(cM,{scope:e.__scopeMenu,value:r,onValueChange:l,children:g.jsx(Ep,{...s,ref:n})})});xw.displayName=bw;var Sw="MenuRadioItem",ww=S.forwardRef((e,n)=>{const{value:r,...i}=e,s=uM(Sw,e.__scopeMenu),l=r===s.value;return g.jsx(_w,{scope:e.__scopeMenu,checked:l,children:g.jsx(Vu,{role:"menuitemradio","aria-checked":l,...i,ref:n,"data-state":Tp(l),onSelect:Re(i.onSelect,()=>s.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});ww.displayName=Sw;var Rp="MenuItemIndicator",[_w,dM]=Si(Rp,{checked:!1}),Cw=S.forwardRef((e,n)=>{const{__scopeMenu:r,forceMount:i,...s}=e,l=dM(Rp,r);return g.jsx(gr,{present:i||mu(l.checked)||l.checked===!0,children:g.jsx(Ie.span,{...s,ref:n,"data-state":Tp(l.checked)})})});Cw.displayName=Rp;var fM="MenuSeparator",Ew=S.forwardRef((e,n)=>{const{__scopeMenu:r,...i}=e;return g.jsx(Ie.div,{role:"separator","aria-orientation":"horizontal",...i,ref:n})});Ew.displayName=fM;var hM="MenuArrow",Rw=S.forwardRef((e,n)=>{const{__scopeMenu:r,...i}=e,s=Iu(r);return g.jsx(xp,{...s,...i,ref:n})});Rw.displayName=hM;var mM="MenuSub",[kI,Tw]=Si(mM),$s="MenuSubTrigger",Ow=S.forwardRef((e,n)=>{const r=wi($s,e.__scopeMenu),i=hl($s,e.__scopeMenu),s=Tw($s,e.__scopeMenu),l=_p($s,e.__scopeMenu),u=S.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:h}=l,m={__scopeMenu:e.__scopeMenu},y=S.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);S.useEffect(()=>y,[y]),S.useEffect(()=>{const b=d.current;return()=>{window.clearTimeout(b),h(null)}},[d,h]);const v=it(n,s.onTriggerChange);return g.jsx(Sp,{asChild:!0,...m,children:g.jsx(vw,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?s.contentId:void 0,"data-state":jw(r.open),...e,ref:v,onClick:b=>{e.onClick?.(b),!(e.disabled||b.defaultPrevented)&&(b.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Re(e.onPointerMove,Xs(b=>{l.onItemEnter(b),!b.defaultPrevented&&!e.disabled&&!r.open&&!u.current&&(l.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{r.onOpenChange(!0),y()},100))})),onPointerLeave:Re(e.onPointerLeave,Xs(b=>{y();const x=r.content?.getBoundingClientRect();if(x){const C=r.content?.dataset.side,_=C==="right",E=_?-5:5,T=x[_?"left":"right"],O=x[_?"right":"left"];l.onPointerGraceIntentChange({area:[{x:b.clientX+E,y:b.clientY},{x:T,y:x.top},{x:O,y:x.top},{x:O,y:x.bottom},{x:T,y:x.bottom}],side:C}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(b),b.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:Re(e.onKeyDown,b=>{e.disabled||b.target!==b.currentTarget||l.searchRef.current!==""&&b.key===" "||KA[i.dir].includes(b.key)&&(r.onOpenChange(!0),r.content?.focus(),b.preventDefault())})})})});Ow.displayName=$s;var Aw="MenuSubContent",Mw=S.forwardRef((e,n)=>{const r=hw(tr,e.__scopeMenu),{forceMount:i=r.forceMount,align:s="start",...l}=e,u=wi(tr,e.__scopeMenu),d=hl(tr,e.__scopeMenu),h=Tw(Aw,e.__scopeMenu),m=S.useRef(null),y=it(n,m);return g.jsx(Qs.Provider,{scope:e.__scopeMenu,children:g.jsx(gr,{present:i||u.open,children:g.jsx(Qs.Slot,{scope:e.__scopeMenu,children:g.jsx(Cp,{id:h.contentId,"aria-labelledby":h.triggerId,...l,ref:y,align:s,side:d.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:v=>{d.isUsingKeyboardRef.current&&m.current?.focus(),v.preventDefault()},onCloseAutoFocus:v=>v.preventDefault(),onFocusOutside:Re(e.onFocusOutside,v=>{v.target!==h.trigger&&u.onOpenChange(!1)}),onEscapeKeyDown:Re(e.onEscapeKeyDown,v=>{d.onClose(),v.preventDefault()}),onKeyDown:Re(e.onKeyDown,v=>{const b=v.currentTarget.contains(v.target),x=YA[d.dir].includes(v.key);b&&x&&(u.onOpenChange(!1),h.trigger?.focus(),v.preventDefault())})})})})})});Mw.displayName=Aw;function jw(e){return e?"open":"closed"}function mu(e){return e==="indeterminate"}function Tp(e){return mu(e)?"indeterminate":e?"checked":"unchecked"}function pM(e){const n=document.activeElement;for(const r of e)if(r===n||(r.focus(),document.activeElement!==n))return}function gM(e,n){return e.map((r,i)=>e[(n+i)%e.length])}function vM(e,n,r){const s=n.length>1&&Array.from(n).every(m=>m===n[0])?n[0]:n,l=r?e.indexOf(r):-1;let u=gM(e,Math.max(l,0));s.length===1&&(u=u.filter(m=>m!==r));const h=u.find(m=>m.toLowerCase().startsWith(s.toLowerCase()));return h!==r?h:void 0}function yM(e,n){const{x:r,y:i}=e;let s=!1;for(let l=0,u=n.length-1;li!=b>i&&r<(v-m)*(i-y)/(b-y)+m&&(s=!s)}return s}function bM(e,n){if(!n)return!1;const r={x:e.clientX,y:e.clientY};return yM(r,n)}function Xs(e){return n=>n.pointerType==="mouse"?e(n):void 0}var xM=fw,SM=Sp,wM=mw,_M=pw,CM=Ep,EM=gw,RM=Vu,TM=yw,OM=xw,AM=ww,MM=Cw,jM=Ew,NM=Rw,zM=Ow,DM=Mw,Fu="DropdownMenu",[kM]=Io(Fu,[uw]),yn=uw(),[LM,Nw]=kM(Fu),zw=e=>{const{__scopeDropdownMenu:n,children:r,dir:i,open:s,defaultOpen:l,onOpenChange:u,modal:d=!0}=e,h=yn(n),m=S.useRef(null),[y,v]=Na({prop:s,defaultProp:l??!1,onChange:u,caller:Fu});return g.jsx(LM,{scope:n,triggerId:hn(),triggerRef:m,contentId:hn(),open:y,onOpenChange:v,onOpenToggle:S.useCallback(()=>v(b=>!b),[v]),modal:d,children:g.jsx(xM,{...h,open:y,onOpenChange:v,dir:i,modal:d,children:r})})};zw.displayName=Fu;var Dw="DropdownMenuTrigger",kw=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,disabled:i=!1,...s}=e,l=Nw(Dw,r),u=yn(r),d=it(n,l.triggerRef);return g.jsx(SM,{asChild:!0,...u,children:g.jsx(Ie.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":i?"":void 0,disabled:i,...s,ref:d,onPointerDown:Re(e.onPointerDown,h=>{!i&&h.button===0&&h.ctrlKey===!1&&(l.onOpenToggle(),l.open||h.preventDefault())}),onKeyDown:Re(e.onKeyDown,h=>{i||(["Enter"," "].includes(h.key)&&l.onOpenToggle(),h.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(h.key)&&h.preventDefault())})})})});kw.displayName=Dw;var $M="DropdownMenuPortal",Lw=e=>{const{__scopeDropdownMenu:n,...r}=e,i=yn(n);return g.jsx(wM,{...i,...r})};Lw.displayName=$M;var $w="DropdownMenuContent",Iw=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=Nw($w,r),l=yn(r),u=S.useRef(!1);return g.jsx(_M,{id:s.contentId,"aria-labelledby":s.triggerId,...l,...i,ref:n,onCloseAutoFocus:Re(e.onCloseAutoFocus,d=>{u.current||s.triggerRef.current?.focus(),u.current=!1,d.preventDefault()}),onInteractOutside:Re(e.onInteractOutside,d=>{const h=d.detail.originalEvent,m=h.button===0&&h.ctrlKey===!0,y=h.button===2||m;(!s.modal||y)&&(u.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Iw.displayName=$w;var IM="DropdownMenuGroup",VM=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=yn(r);return g.jsx(CM,{...s,...i,ref:n})});VM.displayName=IM;var FM="DropdownMenuLabel",Vw=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=yn(r);return g.jsx(EM,{...s,...i,ref:n})});Vw.displayName=FM;var PM="DropdownMenuItem",Fw=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=yn(r);return g.jsx(RM,{...s,...i,ref:n})});Fw.displayName=PM;var UM="DropdownMenuCheckboxItem",HM=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=yn(r);return g.jsx(TM,{...s,...i,ref:n})});HM.displayName=UM;var BM="DropdownMenuRadioGroup",qM=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=yn(r);return g.jsx(OM,{...s,...i,ref:n})});qM.displayName=BM;var GM="DropdownMenuRadioItem",ZM=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=yn(r);return g.jsx(AM,{...s,...i,ref:n})});ZM.displayName=GM;var KM="DropdownMenuItemIndicator",YM=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=yn(r);return g.jsx(MM,{...s,...i,ref:n})});YM.displayName=KM;var QM="DropdownMenuSeparator",XM=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=yn(r);return g.jsx(jM,{...s,...i,ref:n})});XM.displayName=QM;var JM="DropdownMenuArrow",WM=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=yn(r);return g.jsx(NM,{...s,...i,ref:n})});WM.displayName=JM;var ej="DropdownMenuSubTrigger",tj=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=yn(r);return g.jsx(zM,{...s,...i,ref:n})});tj.displayName=ej;var nj="DropdownMenuSubContent",rj=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=yn(r);return g.jsx(DM,{...s,...i,ref:n,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});rj.displayName=nj;var oj=zw,ij=kw,aj=Lw,sj=Iw,lj=Vw,cj=Fw,uj="Label",Pw=S.forwardRef((e,n)=>g.jsx(Ie.label,{...e,ref:n,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Pw.displayName=uj;var dj=Pw;function Fb(e,[n,r]){return Math.min(r,Math.max(n,e))}var fj=[" ","Enter","ArrowUp","ArrowDown"],hj=[" ","Enter"],gi="Select",[Pu,Uu,mj]=Xm(gi),[_i]=Io(gi,[mj,Ia]),Hu=Ia(),[pj,Fo]=_i(gi),[gj,vj]=_i(gi),yj="SelectProvider";function Uw(e){const{__scopeSelect:n,children:r,open:i,defaultOpen:s,onOpenChange:l,value:u,defaultValue:d,onValueChange:h,dir:m,name:y,autoComplete:v,disabled:b,required:x,form:C,internal_do_not_use_render:_}=e,E=Hu(n),[T,O]=S.useState(null),[A,k]=S.useState(null),[L,q]=S.useState(!1),H=Jm(m),[I,he]=Na({prop:i,defaultProp:s??!1,onChange:l,caller:gi}),[ve,de]=Na({prop:u,defaultProp:d,onChange:h,caller:gi}),le=S.useRef(null),ae=S.useRef(ve);S.useEffect(()=>{const j=C?T?.ownerDocument.getElementById(C):T?.form;if(j instanceof HTMLFormElement){const U=()=>de(ae.current);return j.addEventListener("reset",U),()=>j.removeEventListener("reset",U)}},[C,T,de]);const me=T?!!C||!!T.closest("form"):!0,[ye,D]=S.useState(new Set),Y=hn(),ne=Array.from(ye).map(j=>j.props.value).join(";"),J=S.useCallback(j=>{D(U=>new Set(U).add(j))},[]),W=S.useCallback(j=>{D(U=>{const Q=new Set(U);return Q.delete(j),Q})},[]),N={required:x,trigger:T,onTriggerChange:O,valueNode:A,onValueNodeChange:k,valueNodeHasChildren:L,onValueNodeHasChildrenChange:q,contentId:Y,value:ve,onValueChange:de,open:I,onOpenChange:he,dir:H,triggerPointerDownPosRef:le,disabled:b,name:y,autoComplete:v,form:C,nativeOptions:ye,nativeSelectKey:ne,isFormControl:me};return g.jsx(vp,{...E,children:g.jsx(pj,{scope:n,...N,children:g.jsx(Pu.Provider,{scope:n,children:g.jsx(gj,{scope:n,onNativeOptionAdd:J,onNativeOptionRemove:W,children:kj(_)?_(N):r})})})})}Uw.displayName=yj;var Hw=e=>{const{__scopeSelect:n,children:r,...i}=e;return g.jsx(Uw,{__scopeSelect:n,...i,internal_do_not_use_render:({isFormControl:s})=>g.jsxs(g.Fragment,{children:[r,s?g.jsx(p1,{__scopeSelect:n}):null]})})};Hw.displayName=gi;var Bw="SelectTrigger",qw=S.forwardRef((e,n)=>{const{__scopeSelect:r,disabled:i=!1,...s}=e,l=Hu(r),u=Fo(Bw,r),d=u.disabled||i,h=it(n,u.onTriggerChange),m=Uu(r),y=S.useRef("touch"),[v,b,x]=g1(_=>{const E=m().filter(A=>!A.disabled),T=E.find(A=>A.value===u.value),O=v1(E,_,T);O!==void 0&&u.onValueChange(O.value)}),C=_=>{d||(u.onOpenChange(!0),x()),_&&(u.triggerPointerDownPosRef.current={x:Math.round(_.pageX),y:Math.round(_.pageY)})};return g.jsx(yp,{asChild:!0,...l,children:g.jsx(Ie.button,{type:"button",role:"combobox","aria-controls":u.open?u.contentId:void 0,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":Bu(u.value)?"":void 0,...s,ref:h,onClick:Re(s.onClick,_=>{_.currentTarget.focus(),y.current!=="mouse"&&C(_)}),onPointerDown:Re(s.onPointerDown,_=>{y.current=_.pointerType;const E=_.target;E.hasPointerCapture(_.pointerId)&&E.releasePointerCapture(_.pointerId),_.button===0&&_.ctrlKey===!1&&_.pointerType==="mouse"&&(C(_),_.preventDefault())}),onKeyDown:Re(s.onKeyDown,_=>{const E=v.current!=="";!(_.ctrlKey||_.altKey||_.metaKey)&&_.key.length===1&&b(_.key),!(E&&_.key===" ")&&fj.includes(_.key)&&(C(),_.preventDefault())})})})});qw.displayName=Bw;var Gw="SelectValue",Zw=S.forwardRef((e,n)=>{const{__scopeSelect:r,className:i,style:s,children:l,placeholder:u="",...d}=e,h=Fo(Gw,r),{onValueNodeHasChildrenChange:m}=h,y=l!==void 0,v=it(n,h.onValueNodeChange);Qt(()=>{m(y)},[m,y]);const b=Bu(h.value);return g.jsx(Ie.span,{...d,asChild:b?!1:d.asChild,ref:v,style:{pointerEvents:"none"},children:g.jsx(S.Fragment,{children:b?u:l},b?"placeholder":"value")})});Zw.displayName=Gw;var bj="SelectIcon",Kw=S.forwardRef((e,n)=>{const{__scopeSelect:r,children:i,...s}=e;return g.jsx(Ie.span,{"aria-hidden":!0,...s,ref:n,children:i||"▼"})});Kw.displayName=bj;var Yw="SelectPortal",[xj,Sj]=_i(Yw,{forceMount:void 0}),Qw=e=>{const{__scopeSelect:n,forceMount:r,...i}=e;return g.jsx(xj,{scope:e.__scopeSelect,forceMount:r,children:g.jsx(ul,{asChild:!0,...i})})};Qw.displayName=Yw;var ko="SelectContent",Xw=S.forwardRef((e,n)=>{const r=Sj(ko,e.__scopeSelect),{forceMount:i=r.forceMount,...s}=e,l=Fo(ko,e.__scopeSelect),[u,d]=S.useState();return Qt(()=>{d(new DocumentFragment)},[]),g.jsx(gr,{present:i||l.open,children:({present:h})=>h?g.jsx(e1,{...s,ref:n}):g.jsx(Jw,{...s,fragment:u})})});Xw.displayName=ko;var Jw=S.forwardRef((e,n)=>{const{__scopeSelect:r,children:i,fragment:s}=e;return s?xi.createPortal(g.jsx(Ww,{scope:r,children:g.jsx(Pu.Slot,{scope:r,children:g.jsx("div",{ref:n,children:i})})}),s):null});Jw.displayName="SelectContentFragment";var dr=10,[Ww,Po]=_i(ko),wj="SelectContentImpl",_j=hi("SelectContent.RemoveScroll"),e1=S.forwardRef((e,n)=>{const{__scopeSelect:r}=e,{position:i="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:l,onPointerDownOutside:u,side:d,sideOffset:h,align:m,alignOffset:y,arrowPadding:v,collisionBoundary:b,collisionPadding:x,sticky:C,hideWhenDetached:_,avoidCollisions:E,...T}=e,O=Fo(ko,r),[A,k]=S.useState(null),[L,q]=S.useState(null),H=it(n,k),[I,he]=S.useState(null),[ve,de]=S.useState(null),le=Uu(r),[ae,me]=S.useState(!1),ye=S.useRef(!1);S.useEffect(()=>{if(A)return tp(A)},[A]),ep();const D=S.useCallback(ee=>{const[ge,...be]=le().map(Ue=>Ue.ref.current),[De]=be.slice(-1),Ve=document.activeElement;for(const Ue of ee)if(Ue===Ve||(Ue?.scrollIntoView({block:"nearest"}),Ue===ge&&L&&(L.scrollTop=0),Ue===De&&L&&(L.scrollTop=L.scrollHeight),Ue?.focus(),document.activeElement!==Ve))return},[le,L]),Y=S.useCallback(()=>D([I,A]),[D,I,A]);S.useEffect(()=>{ae&&Y()},[ae,Y]);const{onOpenChange:ne,triggerPointerDownPosRef:J}=O;S.useEffect(()=>{if(A){let ee={x:0,y:0};const ge=De=>{ee={x:Math.abs(Math.round(De.pageX)-(J.current?.x??0)),y:Math.abs(Math.round(De.pageY)-(J.current?.y??0))}},be=De=>{ee.x<=10&&ee.y<=10?De.preventDefault():De.composedPath().includes(A)||ne(!1),document.removeEventListener("pointermove",ge),J.current=null};return J.current!==null&&(document.addEventListener("pointermove",ge),document.addEventListener("pointerup",be,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ge),document.removeEventListener("pointerup",be,{capture:!0})}}},[A,ne,J]),S.useEffect(()=>{const ee=()=>ne(!1);return window.addEventListener("blur",ee),window.addEventListener("resize",ee),()=>{window.removeEventListener("blur",ee),window.removeEventListener("resize",ee)}},[ne]);const[W,N]=g1(ee=>{const ge=le().filter(Ve=>!Ve.disabled),be=ge.find(Ve=>Ve.ref.current===document.activeElement),De=v1(ge,ee,be);De&&setTimeout(()=>De.ref.current?.focus())}),j=S.useCallback((ee,ge,be)=>{const De=!ye.current&&!be;(O.value!==void 0&&O.value===ge||De)&&(he(ee),De&&(ye.current=!0))},[O.value]),U=S.useCallback(()=>A?.focus(),[A]),Q=S.useCallback((ee,ge,be)=>{const De=!ye.current&&!be;(O.value!==void 0&&O.value===ge||De)&&de(ee)},[O.value]),Z=i==="popper"?ym:t1,re=Z===ym?{side:d,sideOffset:h,align:m,alignOffset:y,arrowPadding:v,collisionBoundary:b,collisionPadding:x,sticky:C,hideWhenDetached:_,avoidCollisions:E}:{};return g.jsx(Ww,{scope:r,content:A,viewport:L,onViewportChange:q,itemRefCallback:j,selectedItem:I,onItemLeave:U,itemTextRefCallback:Q,focusSelectedItem:Y,selectedItemText:ve,position:i,isPositioned:ae,searchRef:W,children:g.jsx(ju,{as:_j,allowPinchZoom:!0,children:g.jsx(Au,{asChild:!0,trapped:O.open,onMountAutoFocus:ee=>{ee.preventDefault()},onUnmountAutoFocus:Re(s,ee=>{O.trigger?.focus({preventScroll:!0}),ee.preventDefault()}),children:g.jsx(cl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:ee=>ee.preventDefault(),onDismiss:()=>O.onOpenChange(!1),children:g.jsx(Z,{role:"listbox",id:O.contentId,"data-state":O.open?"open":"closed",dir:O.dir,onContextMenu:ee=>ee.preventDefault(),...T,...re,onPlaced:()=>me(!0),ref:H,style:{display:"flex",flexDirection:"column",outline:"none",...T.style},onKeyDown:Re(T.onKeyDown,ee=>{const ge=ee.ctrlKey||ee.altKey||ee.metaKey;if(ee.key==="Tab"&&ee.preventDefault(),!ge&&ee.key.length===1&&N(ee.key),["ArrowUp","ArrowDown","Home","End"].includes(ee.key)){let De=le().filter(Ve=>!Ve.disabled).map(Ve=>Ve.ref.current);if(["ArrowUp","End"].includes(ee.key)&&(De=De.slice().reverse()),["ArrowUp","ArrowDown"].includes(ee.key)){const Ve=ee.target,Ue=De.indexOf(Ve);De=De.slice(Ue+1)}setTimeout(()=>D(De)),ee.preventDefault()}})})})})})})});e1.displayName=wj;var Cj="SelectItemAlignedPosition",t1=S.forwardRef((e,n)=>{const{__scopeSelect:r,onPlaced:i,...s}=e,l=Fo(ko,r),u=Po(ko,r),[d,h]=S.useState(null),[m,y]=S.useState(null),v=it(n,y),b=Uu(r),x=S.useRef(!1),C=S.useRef(!0),{viewport:_,selectedItem:E,selectedItemText:T,focusSelectedItem:O}=u,A=S.useCallback(()=>{if(l.trigger&&l.valueNode&&d&&m&&_&&E&&T){const H=l.trigger.getBoundingClientRect(),I=m.getBoundingClientRect(),he=l.valueNode.getBoundingClientRect(),ve=T.getBoundingClientRect();if(l.dir!=="rtl"){const Ve=ve.left-I.left,Ue=he.left-Ve,lt=H.left-Ue,Je=H.width+lt,Xt=Math.max(Je,I.width),mn=window.innerWidth-dr,qt=Fb(Ue,[dr,Math.max(dr,mn-Xt)]);d.style.minWidth=Je+"px",d.style.left=qt+"px"}else{const Ve=I.right-ve.right,Ue=window.innerWidth-he.right-Ve,lt=window.innerWidth-H.right-Ue,Je=H.width+lt,Xt=Math.max(Je,I.width),mn=window.innerWidth-dr,qt=Fb(Ue,[dr,Math.max(dr,mn-Xt)]);d.style.minWidth=Je+"px",d.style.right=qt+"px"}const de=b(),le=window.innerHeight-dr*2,ae=_.scrollHeight,me=window.getComputedStyle(m),ye=parseInt(me.borderTopWidth,10),D=parseInt(me.paddingTop,10),Y=parseInt(me.borderBottomWidth,10),ne=parseInt(me.paddingBottom,10),J=ye+D+ae+ne+Y,W=Math.min(E.offsetHeight*5,J),N=window.getComputedStyle(_),j=parseInt(N.paddingTop,10),U=parseInt(N.paddingBottom,10),Q=H.top+H.height/2-dr,Z=le-Q,re=E.offsetHeight/2,ee=E.offsetTop+re,ge=ye+D+ee,be=J-ge;if(ge<=Q){const Ve=de.length>0&&E===de[de.length-1].ref.current;d.style.bottom="0px";const Ue=m.clientHeight-_.offsetTop-_.offsetHeight,lt=Math.max(Z,re+(Ve?U:0)+Ue+Y),Je=ge+lt;d.style.height=Je+"px"}else{const Ve=de.length>0&&E===de[0].ref.current;d.style.top="0px";const lt=Math.max(Q,ye+_.offsetTop+(Ve?j:0)+re)+be;d.style.height=lt+"px",_.scrollTop=ge-Q+_.offsetTop}d.style.margin=`${dr}px 0`,d.style.minHeight=W+"px",d.style.maxHeight=le+"px",i?.(),requestAnimationFrame(()=>x.current=!0)}},[b,l.trigger,l.valueNode,d,m,_,E,T,l.dir,i]);Qt(()=>A(),[A]);const[k,L]=S.useState();Qt(()=>{m&&L(window.getComputedStyle(m).zIndex)},[m]);const q=S.useCallback(H=>{H&&C.current===!0&&(A(),O?.(),C.current=!1)},[A,O]);return g.jsx(Rj,{scope:r,contentWrapper:d,shouldExpandOnScrollRef:x,onScrollButtonChange:q,children:g.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:g.jsx(Ie.div,{...s,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});t1.displayName=Cj;var Ej="SelectPopperPosition",ym=S.forwardRef((e,n)=>{const{__scopeSelect:r,align:i="start",collisionPadding:s=dr,...l}=e,u=Hu(r);return g.jsx(bp,{...u,...l,ref:n,align:i,collisionPadding:s,style:{boxSizing:"border-box",...l.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});ym.displayName=Ej;var[Rj,Op]=_i(ko,{}),bm="SelectViewport",n1=S.forwardRef((e,n)=>{const{__scopeSelect:r,nonce:i,...s}=e,l=Po(bm,r),u=Op(bm,r),d=it(n,l.onViewportChange),h=S.useRef(0);return g.jsxs(g.Fragment,{children:[g.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),g.jsx(Pu.Slot,{scope:r,children:g.jsx(Ie.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Re(s.onScroll,m=>{const y=m.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:b}=u;if(b?.current&&v){const x=Math.abs(h.current-y.scrollTop);if(x>0){const C=window.innerHeight-dr*2,_=parseFloat(v.style.minHeight),E=parseFloat(v.style.height),T=Math.max(_,E);if(T0?k:0,v.style.justifyContent="flex-end")}}}h.current=y.scrollTop})})})]})});n1.displayName=bm;var r1="SelectGroup",[Tj,Oj]=_i(r1),Aj=S.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e,s=hn();return g.jsx(Tj,{scope:r,id:s,children:g.jsx(Ie.div,{role:"group","aria-labelledby":s,...i,ref:n})})});Aj.displayName=r1;var o1="SelectLabel",Mj=S.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e,s=Oj(o1,r);return g.jsx(Ie.div,{id:s.id,...i,ref:n})});Mj.displayName=o1;var pu="SelectItem",[jj,i1]=_i(pu),a1=S.forwardRef((e,n)=>{const{__scopeSelect:r,value:i,disabled:s=!1,textValue:l,...u}=e,d=Fo(pu,r),h=Po(pu,r),m=d.value===i,[y,v]=S.useState(l??""),[b,x]=S.useState(!1),C=nr(A=>h.itemRefCallback?.(A,i,s)),_=it(n,C),E=hn(),T=S.useRef("touch"),O=()=>{s||(d.onValueChange(i),d.onOpenChange(!1))};return g.jsx(jj,{scope:r,value:i,disabled:s,textId:E,isSelected:m,onItemTextChange:S.useCallback(A=>{v(k=>k||(A?.textContent??"").trim())},[]),children:g.jsx(Pu.ItemSlot,{scope:r,value:i,disabled:s,textValue:y,children:g.jsx(Ie.div,{role:"option","aria-labelledby":E,"data-highlighted":b?"":void 0,"aria-selected":m&&b,"data-state":m?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...u,ref:_,onFocus:Re(u.onFocus,()=>x(!0)),onBlur:Re(u.onBlur,()=>x(!1)),onClick:Re(u.onClick,()=>{T.current!=="mouse"&&O()}),onPointerUp:Re(u.onPointerUp,()=>{T.current==="mouse"&&O()}),onPointerDown:Re(u.onPointerDown,A=>{T.current=A.pointerType}),onPointerMove:Re(u.onPointerMove,A=>{T.current=A.pointerType,s?h.onItemLeave?.():T.current==="mouse"&&A.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Re(u.onPointerLeave,A=>{A.currentTarget===document.activeElement&&h.onItemLeave?.()}),onKeyDown:Re(u.onKeyDown,A=>{s||A.target!==A.currentTarget||h.searchRef?.current!==""&&A.key===" "||(hj.includes(A.key)&&O(),A.key===" "&&A.preventDefault())})})})})});a1.displayName=pu;var Is="SelectItemText",s1=S.forwardRef((e,n)=>{const{__scopeSelect:r,className:i,style:s,...l}=e,u=Fo(Is,r),d=Po(Is,r),h=i1(Is,r),m=vj(Is,r),[y,v]=S.useState(null),b=nr(O=>d.itemTextRefCallback?.(O,h.value,h.disabled)),x=it(n,v,h.onItemTextChange,b),C=y?.textContent,_=S.useMemo(()=>g.jsx("option",{value:h.value,disabled:h.disabled,children:C},h.value),[h.disabled,h.value,C]),{onNativeOptionAdd:E,onNativeOptionRemove:T}=m;return Qt(()=>(E(_),()=>T(_)),[E,T,_]),g.jsxs(g.Fragment,{children:[g.jsx(Ie.span,{id:h.textId,...l,ref:x}),h.isSelected&&u.valueNode&&!u.valueNodeHasChildren&&!Bu(u.value)?xi.createPortal(l.children,u.valueNode):null]})});s1.displayName=Is;var l1="SelectItemIndicator",c1=S.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e;return i1(l1,r).isSelected?g.jsx(Ie.span,{"aria-hidden":!0,...i,ref:n}):null});c1.displayName=l1;var xm="SelectScrollUpButton",u1=S.forwardRef((e,n)=>{const r=Po(xm,e.__scopeSelect),i=Op(xm,e.__scopeSelect),[s,l]=S.useState(!1),u=it(n,i.onScrollButtonChange);return Qt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const m=h.scrollTop>0;l(m)};const h=r.viewport;return d(),h.addEventListener("scroll",d),()=>h.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),s?g.jsx(f1,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=r;d&&h&&(d.scrollTop=d.scrollTop-h.offsetHeight)}}):null});u1.displayName=xm;var Sm="SelectScrollDownButton",d1=S.forwardRef((e,n)=>{const r=Po(Sm,e.__scopeSelect),i=Op(Sm,e.__scopeSelect),[s,l]=S.useState(!1),u=it(n,i.onScrollButtonChange);return Qt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const m=h.scrollHeight-h.clientHeight,y=Math.ceil(h.scrollTop)h.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),s?g.jsx(f1,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=r;d&&h&&(d.scrollTop=d.scrollTop+h.offsetHeight)}}):null});d1.displayName=Sm;var f1=S.forwardRef((e,n)=>{const{__scopeSelect:r,onAutoScroll:i,...s}=e,l=Po("SelectScrollButton",r),u=S.useRef(null),d=Uu(r),h=S.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return S.useEffect(()=>()=>h(),[h]),Qt(()=>{d().find(y=>y.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[d]),g.jsx(Ie.div,{"aria-hidden":!0,...s,ref:n,style:{flexShrink:0,...s.style},onPointerDown:Re(s.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(i,50))}),onPointerMove:Re(s.onPointerMove,()=>{l.onItemLeave?.(),u.current===null&&(u.current=window.setInterval(i,50))}),onPointerLeave:Re(s.onPointerLeave,()=>{h()})})}),Nj="SelectSeparator",zj=S.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e;return g.jsx(Ie.div,{"aria-hidden":!0,...i,ref:n})});zj.displayName=Nj;var h1="SelectArrow",Dj=S.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e,s=Hu(r);return Po(h1,r).position==="popper"?g.jsx(xp,{...s,...i,ref:n}):null});Dj.displayName=h1;var m1="SelectBubbleInput",p1=S.forwardRef(({__scopeSelect:e,...n},r)=>{const i=Fo(m1,e),{value:s,onValueChange:l,required:u,disabled:d,name:h,autoComplete:m,form:y}=i,{nativeOptions:v,nativeSelectKey:b}=i,x=S.useRef(null),C=it(r,x),_=s??"",E=pO(_),T=Array.from(v).some(O=>(O.props.value??"")==="");return S.useEffect(()=>{const O=x.current;if(!O)return;const A=window.HTMLSelectElement.prototype,L=Object.getOwnPropertyDescriptor(A,"value").set;if(E!==_&&L){const q=new Event("change",{bubbles:!0});L.call(O,_),O.dispatchEvent(q)}},[E,_]),g.jsxs(Ie.select,{"aria-hidden":!0,required:u,tabIndex:-1,name:h,autoComplete:m,disabled:d,form:y,onChange:O=>l(O.target.value),...n,style:{...pS,...n.style},ref:C,defaultValue:_,children:[Bu(s)&&!T?g.jsx("option",{value:""}):null,Array.from(v)]},b)});p1.displayName=m1;function kj(e){return typeof e=="function"}function Bu(e){return e===""||e===void 0}function g1(e){const n=nr(e),r=S.useRef(""),i=S.useRef(0),s=S.useCallback(u=>{const d=r.current+u;n(d),(function h(m){r.current=m,window.clearTimeout(i.current),m!==""&&(i.current=window.setTimeout(()=>h(""),1e3))})(d)},[n]),l=S.useCallback(()=>{r.current="",window.clearTimeout(i.current)},[]);return S.useEffect(()=>()=>window.clearTimeout(i.current),[]),[r,s,l]}function v1(e,n,r){const s=n.length>1&&Array.from(n).every(m=>m===n[0])?n[0]:n,l=r?e.indexOf(r):-1;let u=Lj(e,Math.max(l,0));s.length===1&&(u=u.filter(m=>m!==r));const h=u.find(m=>m.textValue.toLowerCase().startsWith(s.toLowerCase()));return h!==r?h:void 0}function Lj(e,n){return e.map((r,i)=>e[(n+i)%e.length])}var $j="Separator",Pb="horizontal",Ij=["horizontal","vertical"],y1=S.forwardRef((e,n)=>{const{decorative:r,orientation:i=Pb,...s}=e,l=Vj(i)?i:Pb,d=r?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return g.jsx(Ie.div,{"data-orientation":l,...d,...s,ref:n})});y1.displayName=$j;function Vj(e){return Ij.includes(e)}var Fj=y1,[qu]=Io("Tooltip",[Ia]),Gu=Ia(),b1="TooltipProvider",Pj=700,wm="tooltip.open",[Uj,Ap]=qu(b1),x1=e=>{const{__scopeTooltip:n,delayDuration:r=Pj,skipDelayDuration:i=300,disableHoverableContent:s=!1,children:l}=e,u=S.useRef(!0),d=S.useRef(!1),h=S.useRef(0);return S.useEffect(()=>{const m=h.current;return()=>window.clearTimeout(m)},[]),g.jsx(Uj,{scope:n,isOpenDelayedRef:u,delayDuration:r,onOpen:S.useCallback(()=>{i<=0||(window.clearTimeout(h.current),u.current=!1)},[i]),onClose:S.useCallback(()=>{i<=0||(window.clearTimeout(h.current),h.current=window.setTimeout(()=>u.current=!0,i))},[i]),isPointerInTransitRef:d,onPointerInTransitChange:S.useCallback(m=>{d.current=m},[]),disableHoverableContent:s,children:l})};x1.displayName=b1;var Js="Tooltip",[Hj,ml]=qu(Js),S1=e=>{const{__scopeTooltip:n,children:r,open:i,defaultOpen:s,onOpenChange:l,disableHoverableContent:u,delayDuration:d}=e,h=Ap(Js,e.__scopeTooltip),m=Gu(n),[y,v]=S.useState(null),b=hn(),x=S.useRef(0),C=u??h.disableHoverableContent,_=d??h.delayDuration,E=S.useRef(!1),[T,O]=Na({prop:i,defaultProp:s??!1,onChange:H=>{H?(h.onOpen(),document.dispatchEvent(new CustomEvent(wm))):h.onClose(),l?.(H)},caller:Js}),A=S.useMemo(()=>T?E.current?"delayed-open":"instant-open":"closed",[T]),k=S.useCallback(()=>{window.clearTimeout(x.current),x.current=0,E.current=!1,O(!0)},[O]),L=S.useCallback(()=>{window.clearTimeout(x.current),x.current=0,O(!1)},[O]),q=S.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{E.current=!0,O(!0),x.current=0},_)},[_,O]);return S.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),g.jsx(vp,{...m,children:g.jsx(Hj,{scope:n,contentId:b,open:T,stateAttribute:A,trigger:y,onTriggerChange:v,onTriggerEnter:S.useCallback(()=>{h.isOpenDelayedRef.current?q():k()},[h.isOpenDelayedRef,q,k]),onTriggerLeave:S.useCallback(()=>{C?L():(window.clearTimeout(x.current),x.current=0)},[L,C]),onOpen:k,onClose:L,disableHoverableContent:C,children:r})})};S1.displayName=Js;var _m="TooltipTrigger",w1=S.forwardRef((e,n)=>{const{__scopeTooltip:r,...i}=e,s=ml(_m,r),l=Ap(_m,r),u=Gu(r),d=S.useRef(null),h=it(n,d,s.onTriggerChange),m=S.useRef(!1),y=S.useRef(!1),v=S.useCallback(()=>m.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),g.jsx(yp,{asChild:!0,...u,children:g.jsx(Ie.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...i,ref:h,onPointerMove:Re(e.onPointerMove,b=>{b.pointerType!=="touch"&&!y.current&&!l.isPointerInTransitRef.current&&(s.onTriggerEnter(),y.current=!0)}),onPointerLeave:Re(e.onPointerLeave,()=>{s.onTriggerLeave(),y.current=!1}),onPointerDown:Re(e.onPointerDown,()=>{s.open&&s.onClose(),m.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:Re(e.onFocus,()=>{m.current||s.onOpen()}),onBlur:Re(e.onBlur,s.onClose),onClick:Re(e.onClick,s.onClose)})})});w1.displayName=_m;var Mp="TooltipPortal",[Bj,qj]=qu(Mp,{forceMount:void 0}),_1=e=>{const{__scopeTooltip:n,forceMount:r,children:i,container:s}=e,l=ml(Mp,n);return g.jsx(Bj,{scope:n,forceMount:r,children:g.jsx(gr,{present:r||l.open,children:g.jsx(ul,{asChild:!0,container:s,children:i})})})};_1.displayName=Mp;var Da="TooltipContent",C1=S.forwardRef((e,n)=>{const r=qj(Da,e.__scopeTooltip),{forceMount:i=r.forceMount,side:s="top",...l}=e,u=ml(Da,e.__scopeTooltip);return g.jsx(gr,{present:i||u.open,children:u.disableHoverableContent?g.jsx(E1,{side:s,...l,ref:n}):g.jsx(Gj,{side:s,...l,ref:n})})}),Gj=S.forwardRef((e,n)=>{const r=ml(Da,e.__scopeTooltip),i=Ap(Da,e.__scopeTooltip),s=S.useRef(null),l=it(n,s),[u,d]=S.useState(null),{trigger:h,onClose:m}=r,y=s.current,{onPointerInTransitChange:v}=i,b=S.useCallback(()=>{d(null),v(!1)},[v]),x=S.useCallback((C,_)=>{const E=C.currentTarget,T={x:C.clientX,y:C.clientY},O=Qj(T,E.getBoundingClientRect()),A=Xj(T,O),k=Jj(_.getBoundingClientRect()),L=eN([...A,...k]);d(L),v(!0)},[v]);return S.useEffect(()=>()=>b(),[b]),S.useEffect(()=>{if(h&&y){const C=E=>x(E,y),_=E=>x(E,h);return h.addEventListener("pointerleave",C),y.addEventListener("pointerleave",_),()=>{h.removeEventListener("pointerleave",C),y.removeEventListener("pointerleave",_)}}},[h,y,x,b]),S.useEffect(()=>{if(u){const C=_=>{const E=_.target,T={x:_.clientX,y:_.clientY},O=h?.contains(E)||y?.contains(E),A=!Wj(T,u);O?b():A&&(b(),m())};return document.addEventListener("pointermove",C),()=>document.removeEventListener("pointermove",C)}},[h,y,u,m,b]),g.jsx(E1,{...e,ref:l})}),[Zj,Kj]=qu(Js,{isInside:!1}),Yj=L2("TooltipContent"),E1=S.forwardRef((e,n)=>{const{__scopeTooltip:r,children:i,"aria-label":s,onEscapeKeyDown:l,onPointerDownOutside:u,...d}=e,h=ml(Da,r),m=Gu(r),{onClose:y}=h;return S.useEffect(()=>(document.addEventListener(wm,y),()=>document.removeEventListener(wm,y)),[y]),S.useEffect(()=>{if(h.trigger){const v=b=>{b.target instanceof Node&&b.target.contains(h.trigger)&&y()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[h.trigger,y]),g.jsx(cl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:v=>v.preventDefault(),onDismiss:y,children:g.jsxs(bp,{"data-state":h.stateAttribute,...m,...d,ref:n,style:{...d.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[g.jsx(Yj,{children:i}),g.jsx(Zj,{scope:r,isInside:!0,children:g.jsx(Z2,{id:h.contentId,role:"tooltip",children:s||i})})]})})});C1.displayName=Da;var R1="TooltipArrow",T1=S.forwardRef((e,n)=>{const{__scopeTooltip:r,...i}=e,s=Gu(r);return Kj(R1,r).isInside?null:g.jsx(xp,{...s,...i,ref:n})});T1.displayName=R1;function Qj(e,n){const r=Math.abs(n.top-e.y),i=Math.abs(n.bottom-e.y),s=Math.abs(n.right-e.x),l=Math.abs(n.left-e.x);switch(Math.min(r,i,s,l)){case l:return"left";case s:return"right";case r:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function Xj(e,n,r=5){const i=[];switch(n){case"top":i.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":i.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":i.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":i.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return i}function Jj(e){const{top:n,right:r,bottom:i,left:s}=e;return[{x:s,y:n},{x:r,y:n},{x:r,y:i},{x:s,y:i}]}function Wj(e,n){const{x:r,y:i}=e;let s=!1;for(let l=0,u=n.length-1;li!=b>i&&r<(v-m)*(i-y)/(b-y)+m&&(s=!s)}return s}function eN(e){const n=e.slice();return n.sort((r,i)=>r.xi.x?1:r.yi.y?1:0),tN(n)}function tN(e){if(e.length<=1)return e.slice();const n=[];for(let i=0;i=2;){const l=n[n.length-1],u=n[n.length-2];if((l.x-u.x)*(s.y-u.y)>=(l.y-u.y)*(s.x-u.x))n.pop();else break}n.push(s)}n.pop();const r=[];for(let i=e.length-1;i>=0;i--){const s=e[i];for(;r.length>=2;){const l=r[r.length-1],u=r[r.length-2];if((l.x-u.x)*(s.y-u.y)>=(l.y-u.y)*(s.x-u.x))r.pop();else break}r.push(s)}return r.pop(),n.length===1&&r.length===1&&n[0].x===r[0].x&&n[0].y===r[0].y?n:n.concat(r)}var nN=x1,rN=S1,oN=w1,iN=_1,aN=C1,sN=T1;function O1(e){var n,r,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(n=0;n{const r=new Array(e.length+n.length);for(let i=0;i({classGroupId:e,validator:n}),M1=(e=new Map,n=null,r)=>({nextPart:e,validators:n,classGroupId:r}),gu="-",Ub=[],uN="arbitrary..",dN=e=>{const n=hN(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return fN(u);const d=u.split(gu),h=d[0]===""&&d.length>1?1:0;return j1(d,h,n)},getConflictingClassGroupIds:(u,d)=>{if(d){const h=i[u],m=r[u];return h?m?lN(m,h):h:m||Ub}return r[u]||Ub}}},j1=(e,n,r)=>{if(e.length-n===0)return r.classGroupId;const s=e[n],l=r.nextPart.get(s);if(l){const m=j1(e,n+1,l);if(m)return m}const u=r.validators;if(u===null)return;const d=n===0?e.join(gu):e.slice(n).join(gu),h=u.length;for(let m=0;me.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const n=e.slice(1,-1),r=n.indexOf(":"),i=n.slice(0,r);return i?uN+i:void 0})(),hN=e=>{const{theme:n,classGroups:r}=e;return mN(r,n)},mN=(e,n)=>{const r=M1();for(const i in e){const s=e[i];jp(s,r,i,n)}return r},jp=(e,n,r,i)=>{const s=e.length;for(let l=0;l{if(typeof e=="string"){gN(e,n,r);return}if(typeof e=="function"){vN(e,n,r,i);return}yN(e,n,r,i)},gN=(e,n,r)=>{const i=e===""?n:N1(n,e);i.classGroupId=r},vN=(e,n,r,i)=>{if(bN(e)){jp(e(i),n,r,i);return}n.validators===null&&(n.validators=[]),n.validators.push(cN(r,e))},yN=(e,n,r,i)=>{const s=Object.entries(e),l=s.length;for(let u=0;u{let r=e;const i=n.split(gu),s=i.length;for(let l=0;l"isThemeGetter"in e&&e.isThemeGetter===!0,xN=e=>{if(e<1)return{get:()=>{},set:()=>{}};let n=0,r=Object.create(null),i=Object.create(null);const s=(l,u)=>{r[l]=u,n++,n>e&&(n=0,i=r,r=Object.create(null))};return{get(l){let u=r[l];if(u!==void 0)return u;if((u=i[l])!==void 0)return s(l,u),u},set(l,u){l in r?r[l]=u:s(l,u)}}},Cm="!",Hb=":",SN=[],Bb=(e,n,r,i,s)=>({modifiers:e,hasImportantModifier:n,baseClassName:r,maybePostfixModifierPosition:i,isExternal:s}),wN=e=>{const{prefix:n,experimentalParseClassName:r}=e;let i=s=>{const l=[];let u=0,d=0,h=0,m;const y=s.length;for(let _=0;_h?m-h:void 0;return Bb(l,x,b,C)};if(n){const s=n+Hb,l=i;i=u=>u.startsWith(s)?l(u.slice(s.length)):Bb(SN,!1,u,void 0,!0)}if(r){const s=i;i=l=>r({className:l,parseClassName:s})}return i},_N=e=>{const n=new Map;return e.orderSensitiveModifiers.forEach((r,i)=>{n.set(r,1e6+i)}),r=>{const i=[];let s=[];for(let l=0;l0&&(s.sort(),i.push(...s),s=[]),i.push(u)):s.push(u)}return s.length>0&&(s.sort(),i.push(...s)),i}},CN=e=>({cache:xN(e.cacheSize),parseClassName:wN(e),sortModifiers:_N(e),postfixLookupClassGroupIds:EN(e),...dN(e)}),EN=e=>{const n=Object.create(null),r=e.postfixLookupClassGroups;if(r)for(let i=0;i{const{parseClassName:r,getClassGroupId:i,getConflictingClassGroupIds:s,sortModifiers:l,postfixLookupClassGroupIds:u}=n,d=[],h=e.trim().split(RN);let m="";for(let y=h.length-1;y>=0;y-=1){const v=h[y],{isExternal:b,modifiers:x,hasImportantModifier:C,baseClassName:_,maybePostfixModifierPosition:E}=r(v);if(b){m=v+(m.length>0?" "+m:m);continue}let T=!!E,O;if(T){const H=_.substring(0,E);O=i(H);const I=O&&u[O]?i(_):void 0;I&&I!==O&&(O=I,T=!1)}else O=i(_);if(!O){if(!T){m=v+(m.length>0?" "+m:m);continue}if(O=i(_),!O){m=v+(m.length>0?" "+m:m);continue}T=!1}const A=x.length===0?"":x.length===1?x[0]:l(x).join(":"),k=C?A+Cm:A,L=k+O;if(d.indexOf(L)>-1)continue;d.push(L);const q=s(O,T);for(let H=0;H0?" "+m:m)}return m},ON=(...e)=>{let n=0,r,i,s="";for(;n{if(typeof e=="string")return e;let n,r="";for(let i=0;i{let r,i,s,l;const u=h=>{const m=n.reduce((y,v)=>v(y),e());return r=CN(m),i=r.cache.get,s=r.cache.set,l=d,d(h)},d=h=>{const m=i(h);if(m)return m;const y=TN(h,r);return s(h,y),y};return l=u,(...h)=>l(ON(...h))},MN=[],Bt=e=>{const n=r=>r[e]||MN;return n.isThemeGetter=!0,n},D1=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,k1=/^\((?:(\w[\w-]*):)?(.+)\)$/i,jN=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,NN=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zN=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,DN=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,kN=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,LN=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Oo=e=>jN.test(e),qe=e=>!!e&&!Number.isNaN(Number(e)),wr=e=>!!e&&Number.isInteger(Number(e)),Ih=e=>e.endsWith("%")&&qe(e.slice(0,-1)),Yr=e=>NN.test(e),L1=()=>!0,$N=e=>zN.test(e)&&!DN.test(e),Np=()=>!1,IN=e=>kN.test(e),VN=e=>LN.test(e),FN=e=>!_e(e)&&!Ce(e),PN=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),UN=e=>Uo(e,V1,Np),_e=e=>D1.test(e),ui=e=>Uo(e,F1,$N),qb=e=>Uo(e,QN,qe),HN=e=>Uo(e,U1,L1),BN=e=>Uo(e,P1,Np),Gb=e=>Uo(e,$1,Np),qN=e=>Uo(e,I1,VN),Fc=e=>Uo(e,H1,IN),Ce=e=>k1.test(e),Ns=e=>Ci(e,F1),GN=e=>Ci(e,P1),Zb=e=>Ci(e,$1),ZN=e=>Ci(e,V1),KN=e=>Ci(e,I1),Pc=e=>Ci(e,H1,!0),YN=e=>Ci(e,U1,!0),Uo=(e,n,r)=>{const i=D1.exec(e);return i?i[1]?n(i[1]):r(i[2]):!1},Ci=(e,n,r=!1)=>{const i=k1.exec(e);return i?i[1]?n(i[1]):r:!1},$1=e=>e==="position"||e==="percentage",I1=e=>e==="image"||e==="url",V1=e=>e==="length"||e==="size"||e==="bg-size",F1=e=>e==="length",QN=e=>e==="number",P1=e=>e==="family-name",U1=e=>e==="number"||e==="weight",H1=e=>e==="shadow",XN=()=>{const e=Bt("color"),n=Bt("font"),r=Bt("text"),i=Bt("font-weight"),s=Bt("tracking"),l=Bt("leading"),u=Bt("breakpoint"),d=Bt("container"),h=Bt("spacing"),m=Bt("radius"),y=Bt("shadow"),v=Bt("inset-shadow"),b=Bt("text-shadow"),x=Bt("drop-shadow"),C=Bt("blur"),_=Bt("perspective"),E=Bt("aspect"),T=Bt("ease"),O=Bt("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...k(),Ce,_e],q=()=>["auto","hidden","clip","visible","scroll"],H=()=>["auto","contain","none"],I=()=>[Ce,_e,h],he=()=>[Oo,"full","auto",...I()],ve=()=>[wr,"none","subgrid",Ce,_e],de=()=>["auto",{span:["full",wr,Ce,_e]},wr,Ce,_e],le=()=>[wr,"auto",Ce,_e],ae=()=>["auto","min","max","fr",Ce,_e],me=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ye=()=>["start","end","center","stretch","center-safe","end-safe"],D=()=>["auto",...I()],Y=()=>[Oo,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],ne=()=>[Oo,"screen","full","dvw","lvw","svw","min","max","fit",...I()],J=()=>[Oo,"screen","full","lh","dvh","lvh","svh","min","max","fit",...I()],W=()=>[e,Ce,_e],N=()=>[...k(),Zb,Gb,{position:[Ce,_e]}],j=()=>["no-repeat",{repeat:["","x","y","space","round"]}],U=()=>["auto","cover","contain",ZN,UN,{size:[Ce,_e]}],Q=()=>[Ih,Ns,ui],Z=()=>["","none","full",m,Ce,_e],re=()=>["",qe,Ns,ui],ee=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],be=()=>[qe,Ih,Zb,Gb],De=()=>["","none",C,Ce,_e],Ve=()=>["none",qe,Ce,_e],Ue=()=>["none",qe,Ce,_e],lt=()=>[qe,Ce,_e],Je=()=>[Oo,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Yr],breakpoint:[Yr],color:[L1],container:[Yr],"drop-shadow":[Yr],ease:["in","out","in-out"],font:[FN],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Yr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Yr],shadow:[Yr],spacing:["px",qe],text:[Yr],"text-shadow":[Yr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Oo,_e,Ce,E]}],container:["container"],"container-type":[{"@container":["","normal","size",Ce,_e]}],"container-named":[PN],columns:[{columns:[qe,_e,Ce,d]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:q()}],"overflow-x":[{"overflow-x":q()}],"overflow-y":[{"overflow-y":q()}],overscroll:[{overscroll:H()}],"overscroll-x":[{"overscroll-x":H()}],"overscroll-y":[{"overscroll-y":H()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:he()}],"inset-x":[{"inset-x":he()}],"inset-y":[{"inset-y":he()}],start:[{"inset-s":he(),start:he()}],end:[{"inset-e":he(),end:he()}],"inset-bs":[{"inset-bs":he()}],"inset-be":[{"inset-be":he()}],top:[{top:he()}],right:[{right:he()}],bottom:[{bottom:he()}],left:[{left:he()}],visibility:["visible","invisible","collapse"],z:[{z:[wr,"auto",Ce,_e]}],basis:[{basis:[Oo,"full","auto",d,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[qe,Oo,"auto","initial","none",_e]}],grow:[{grow:["",qe,Ce,_e]}],shrink:[{shrink:["",qe,Ce,_e]}],order:[{order:[wr,"first","last","none",Ce,_e]}],"grid-cols":[{"grid-cols":ve()}],"col-start-end":[{col:de()}],"col-start":[{"col-start":le()}],"col-end":[{"col-end":le()}],"grid-rows":[{"grid-rows":ve()}],"row-start-end":[{row:de()}],"row-start":[{"row-start":le()}],"row-end":[{"row-end":le()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ae()}],"auto-rows":[{"auto-rows":ae()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...me(),"normal"]}],"justify-items":[{"justify-items":[...ye(),"normal"]}],"justify-self":[{"justify-self":["auto",...ye()]}],"align-content":[{content:["normal",...me()]}],"align-items":[{items:[...ye(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ye(),{baseline:["","last"]}]}],"place-content":[{"place-content":me()}],"place-items":[{"place-items":[...ye(),"baseline"]}],"place-self":[{"place-self":["auto",...ye()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pbs:[{pbs:I()}],pbe:[{pbe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:D()}],mx:[{mx:D()}],my:[{my:D()}],ms:[{ms:D()}],me:[{me:D()}],mbs:[{mbs:D()}],mbe:[{mbe:D()}],mt:[{mt:D()}],mr:[{mr:D()}],mb:[{mb:D()}],ml:[{ml:D()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],"inline-size":[{inline:["auto",...ne()]}],"min-inline-size":[{"min-inline":["auto",...ne()]}],"max-inline-size":[{"max-inline":["none",...ne()]}],"block-size":[{block:["auto",...J()]}],"min-block-size":[{"min-block":["auto",...J()]}],"max-block-size":[{"max-block":["none",...J()]}],w:[{w:[d,"screen",...Y()]}],"min-w":[{"min-w":[d,"screen","none",...Y()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[u]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",r,Ns,ui]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,YN,HN]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ih,_e]}],"font-family":[{font:[GN,BN,n]}],"font-features":[{"font-features":[_e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Ce,_e]}],"line-clamp":[{"line-clamp":[qe,"none",Ce,qb]}],leading:[{leading:[l,...I()]}],"list-image":[{"list-image":["none",Ce,_e]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ce,_e]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[qe,"from-font","auto",Ce,ui]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[qe,"auto",Ce,_e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"tab-size":[{tab:[wr,Ce,_e]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ce,_e]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ce,_e]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:N()}],"bg-repeat":[{bg:j()}],"bg-size":[{bg:U()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},wr,Ce,_e],radial:["",Ce,_e],conic:[wr,Ce,_e]},KN,qN]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:Z()}],"rounded-s":[{"rounded-s":Z()}],"rounded-e":[{"rounded-e":Z()}],"rounded-t":[{"rounded-t":Z()}],"rounded-r":[{"rounded-r":Z()}],"rounded-b":[{"rounded-b":Z()}],"rounded-l":[{"rounded-l":Z()}],"rounded-ss":[{"rounded-ss":Z()}],"rounded-se":[{"rounded-se":Z()}],"rounded-ee":[{"rounded-ee":Z()}],"rounded-es":[{"rounded-es":Z()}],"rounded-tl":[{"rounded-tl":Z()}],"rounded-tr":[{"rounded-tr":Z()}],"rounded-br":[{"rounded-br":Z()}],"rounded-bl":[{"rounded-bl":Z()}],"border-w":[{border:re()}],"border-w-x":[{"border-x":re()}],"border-w-y":[{"border-y":re()}],"border-w-s":[{"border-s":re()}],"border-w-e":[{"border-e":re()}],"border-w-bs":[{"border-bs":re()}],"border-w-be":[{"border-be":re()}],"border-w-t":[{"border-t":re()}],"border-w-r":[{"border-r":re()}],"border-w-b":[{"border-b":re()}],"border-w-l":[{"border-l":re()}],"divide-x":[{"divide-x":re()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":re()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-bs":[{"border-bs":W()}],"border-color-be":[{"border-be":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[qe,Ce,_e]}],"outline-w":[{outline:["",qe,Ns,ui]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",y,Pc,Fc]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",v,Pc,Fc]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[qe,ui]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":re()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",b,Pc,Fc]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[qe,Ce,_e]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[qe]}],"mask-image-linear-from-pos":[{"mask-linear-from":be()}],"mask-image-linear-to-pos":[{"mask-linear-to":be()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":be()}],"mask-image-t-to-pos":[{"mask-t-to":be()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":be()}],"mask-image-r-to-pos":[{"mask-r-to":be()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":be()}],"mask-image-b-to-pos":[{"mask-b-to":be()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":be()}],"mask-image-l-to-pos":[{"mask-l-to":be()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":be()}],"mask-image-x-to-pos":[{"mask-x-to":be()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":be()}],"mask-image-y-to-pos":[{"mask-y-to":be()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[Ce,_e]}],"mask-image-radial-from-pos":[{"mask-radial-from":be()}],"mask-image-radial-to-pos":[{"mask-radial-to":be()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[qe]}],"mask-image-conic-from-pos":[{"mask-conic-from":be()}],"mask-image-conic-to-pos":[{"mask-conic-to":be()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:N()}],"mask-repeat":[{mask:j()}],"mask-size":[{mask:U()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ce,_e]}],filter:[{filter:["","none",Ce,_e]}],blur:[{blur:De()}],brightness:[{brightness:[qe,Ce,_e]}],contrast:[{contrast:[qe,Ce,_e]}],"drop-shadow":[{"drop-shadow":["","none",x,Pc,Fc]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",qe,Ce,_e]}],"hue-rotate":[{"hue-rotate":[qe,Ce,_e]}],invert:[{invert:["",qe,Ce,_e]}],saturate:[{saturate:[qe,Ce,_e]}],sepia:[{sepia:["",qe,Ce,_e]}],"backdrop-filter":[{"backdrop-filter":["","none",Ce,_e]}],"backdrop-blur":[{"backdrop-blur":De()}],"backdrop-brightness":[{"backdrop-brightness":[qe,Ce,_e]}],"backdrop-contrast":[{"backdrop-contrast":[qe,Ce,_e]}],"backdrop-grayscale":[{"backdrop-grayscale":["",qe,Ce,_e]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[qe,Ce,_e]}],"backdrop-invert":[{"backdrop-invert":["",qe,Ce,_e]}],"backdrop-opacity":[{"backdrop-opacity":[qe,Ce,_e]}],"backdrop-saturate":[{"backdrop-saturate":[qe,Ce,_e]}],"backdrop-sepia":[{"backdrop-sepia":["",qe,Ce,_e]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ce,_e]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[qe,"initial",Ce,_e]}],ease:[{ease:["linear","initial",T,Ce,_e]}],delay:[{delay:[qe,Ce,_e]}],animate:[{animate:["none",O,Ce,_e]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[_,Ce,_e]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Ve()}],"rotate-x":[{"rotate-x":Ve()}],"rotate-y":[{"rotate-y":Ve()}],"rotate-z":[{"rotate-z":Ve()}],scale:[{scale:Ue()}],"scale-x":[{"scale-x":Ue()}],"scale-y":[{"scale-y":Ue()}],"scale-z":[{"scale-z":Ue()}],"scale-3d":["scale-3d"],skew:[{skew:lt()}],"skew-x":[{"skew-x":lt()}],"skew-y":[{"skew-y":lt()}],transform:[{transform:[Ce,_e,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Je()}],"translate-x":[{"translate-x":Je()}],"translate-y":[{"translate-y":Je()}],"translate-z":[{"translate-z":Je()}],"translate-none":["translate-none"],zoom:[{zoom:[wr,Ce,_e]}],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ce,_e]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":W()}],"scrollbar-track-color":[{"scrollbar-track":W()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mbs":[{"scroll-mbs":I()}],"scroll-mbe":[{"scroll-mbe":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pbs":[{"scroll-pbs":I()}],"scroll-pbe":[{"scroll-pbe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ce,_e]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[qe,Ns,ui,qb]}],stroke:[{stroke:["none",...W()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},JN=AN(XN);function et(...e){return JN(A1(e))}function WN({delayDuration:e=0,...n}){return g.jsx(nN,{"data-slot":"tooltip-provider",delayDuration:e,...n})}function ez({...e}){return g.jsx(rN,{"data-slot":"tooltip",...e})}function tz({...e}){return g.jsx(oN,{"data-slot":"tooltip-trigger",...e})}function nz({className:e,sideOffset:n=0,children:r,...i}){return g.jsx(iN,{children:g.jsxs(aN,{"data-slot":"tooltip-content",sideOffset:n,className:et("z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",e),...i,children:[r,g.jsx(sN,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}const Em=new Set;function rz(e){return Em.add(e),()=>Em.delete(e)}function oz(){for(const e of Em)e()}const B1=(...e)=>e.filter((n,r,i)=>!!n&&n.trim()!==""&&i.indexOf(n)===r).join(" ").trim();const iz=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const az=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,r,i)=>i?i.toUpperCase():r.toLowerCase());const Kb=e=>{const n=az(e);return n.charAt(0).toUpperCase()+n.slice(1)};var Vh={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const sz=e=>{for(const n in e)if(n.startsWith("aria-")||n==="role"||n==="title")return!0;return!1},lz=S.createContext({}),cz=()=>S.useContext(lz),uz=S.forwardRef(({color:e,size:n,strokeWidth:r,absoluteStrokeWidth:i,className:s="",children:l,iconNode:u,...d},h)=>{const{size:m=24,strokeWidth:y=2,absoluteStrokeWidth:v=!1,color:b="currentColor",className:x=""}=cz()??{},C=i??v?Number(r??y)*24/Number(n??m):r??y;return S.createElement("svg",{ref:h,...Vh,width:n??m??Vh.width,height:n??m??Vh.height,stroke:e??b,strokeWidth:C,className:B1("lucide",x,s),...!l&&!sz(d)&&{"aria-hidden":"true"},...d},[...u.map(([_,E])=>S.createElement(_,E)),...Array.isArray(l)?l:[l]])});const Me=(e,n)=>{const r=S.forwardRef(({className:i,...s},l)=>S.createElement(uz,{ref:l,iconNode:n,className:B1(`lucide-${iz(Kb(e))}`,`lucide-${e}`,i),...s}));return r.displayName=Kb(e),r};const dz=[["path",{d:"M4.5 3h15",key:"c7n0jr"}],["path",{d:"M6 3v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V3",key:"m1uhx7"}],["path",{d:"M6 14h12",key:"4cwo0f"}]],fz=Me("beaker",dz);const hz=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],mz=Me("book-open",hz);const pz=[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]],gz=Me("briefcase",pz);const vz=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],yz=Me("bug",vz);const bz=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],xz=Me("calendar",bz);const Sz=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],q1=Me("check",Sz);const wz=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],zp=Me("chevron-down",wz);const _z=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Cz=Me("chevron-right",_z);const Ez=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Rz=Me("chevron-up",Ez);const Tz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Oz=Me("circle-check",Tz);const Az=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],G1=Me("clock",Az);const Mz=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],jz=Me("code",Mz);const Nz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}]],zz=Me("compass",Nz);const Dz=[["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"}]],kz=Me("copy",Dz);const Lz=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],$z=Me("database",Lz);const Iz=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Vz=Me("download",Iz);const Fz=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Pz=Me("ellipsis",Fz);const Uz=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Z1=Me("file-text",Uz);const Hz=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],Bz=Me("flag",Hz);const qz=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Dp=Me("folder",qz);const Gz=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Zz=Me("gauge",Gz);const Kz=[["path",{d:"m14 13-8.381 8.38a1 1 0 0 1-3.001-3l8.384-8.381",key:"pgg06f"}],["path",{d:"m16 16 6-6",key:"vzrcl6"}],["path",{d:"m21.5 10.5-8-8",key:"a17d9x"}],["path",{d:"m8 8 6-6",key:"18bi4p"}],["path",{d:"m8.5 7.5 8 8",key:"1oyaui"}]],Yz=Me("gavel",Kz);const Qz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],K1=Me("globe",Qz);const Xz=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],Jz=Me("graduation-cap",Xz);const Wz=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],eD=Me("heart",Wz);const tD=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],nD=Me("history",tD);const rD=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],oD=Me("image",rD);const iD=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],aD=Me("info",iD);const sD=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],lD=Me("layout-dashboard",sD);const cD=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],uD=Me("lightbulb",cD);const dD=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],fD=Me("link",dD);const hD=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],mD=Me("loader-circle",hD);const pD=[["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"}]],Y1=Me("lock",pD);const gD=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],vD=Me("log-out",gD);const yD=[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]],bD=Me("megaphone",yD);const xD=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],SD=Me("menu",xD);const wD=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],_D=Me("music",wD);const CD=[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],ED=Me("octagon-x",CD);const RD=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],TD=Me("package",RD);const OD=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],AD=Me("pen-line",OD);const MD=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],jD=Me("plus",MD);const ND=[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]],zD=Me("rocket",ND);const DD=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Q1=Me("search",DD);const kD=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],LD=Me("settings",kD);const $D=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],ID=Me("share-2",$D);const VD=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],X1=Me("shield",VD);const FD=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],J1=Me("square-terminal",FD);const PD=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],UD=Me("star",PD);const HD=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],BD=Me("trash-2",HD);const qD=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],W1=Me("triangle-alert",qD);const GD=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],ZD=Me("upload",GD);const KD=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],e_=Me("users",KD);const YD=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],QD=Me("wrench",YD);const XD=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],t_=Me("x",XD);function JD(){const e=!document.body.classList.contains("sb-open");document.body.classList.toggle("sb-open"),Zu(),e?document.getElementById("sidebar")?.querySelector(WD)?.focus():document.getElementById("menu-btn")?.focus()}const WD='a[href], button:not(:disabled), select, input, [tabindex]:not([tabindex="-1"])';function hr(){const e=document.body.classList.contains("sb-open");document.body.classList.remove("sb-open"),Zu(),e&&window.innerWidth<=Wc&&document.getElementById("menu-btn")?.focus()}const Wc=900;function Zu(){const e=document.getElementById("sidebar");if(!e)return;const n=document.body.classList.contains("sb-open");window.innerWidth<=Wc&&!n?e.setAttribute("inert",""):e.removeAttribute("inert");const i=document.getElementById("main");i&&(n&&window.innerWidth<=Wc?i.setAttribute("inert",""):i.removeAttribute("inert")),e.setAttribute("aria-modal",String(n&&window.innerWidth<=Wc)),document.getElementById("menu-btn")?.setAttribute("aria-expanded",String(n))}typeof window<"u"&&(window.addEventListener("resize",Zu),window.addEventListener("keydown",e=>{e.key==="Escape"&&document.body.classList.contains("sb-open")&&hr()}));const ek={alert:W1,check:q1,chev:Cz,chevd:zp,clock:G1,copy:kz,doc:Z1,dots:Pz,download:Vz,folder:Dp,dashboard:lD,gear:LD,globe:K1,hist:nD,link:fD,lock:Y1,menu:SD,plus:jD,power:vD,search:Q1,share:ID,shield:X1,terminal:J1,trash:BD,upload:ZD,users:e_,x:t_};function Yt({name:e}){const n=ek[e];return n?g.jsx(n,{className:"ico","aria-hidden":"true"}):null}const n_={folder:Dp,"book-open":mz,"file-text":Z1,"pen-line":AD,users:e_,briefcase:gz,megaphone:bD,rocket:zD,lightbulb:uD,flag:Bz,star:UD,heart:eD,code:jz,"square-terminal":J1,bug:yz,wrench:QD,database:$z,package:TD,beaker:fz,gauge:Zz,shield:X1,lock:Y1,gavel:Yz,globe:K1,compass:zz,calendar:xz,clock:G1,"graduation-cap":Jz,image:oD,music:_D};function Ta({name:e,className:n}){const r=n_[e??""]??Dp;return g.jsx(r,{className:n,"aria-hidden":"true"})}function tk({size:e=22}){return g.jsxs("svg",{width:e,height:e,viewBox:"0 0 32 32",fill:"currentColor",role:"img","aria-label":"BearDrive",children:[g.jsx("rect",{x:"4",y:"4",width:"5.6",height:"24"}),g.jsx("rect",{x:"11.2",y:"4",width:"14.4",height:"11.2"}),g.jsx("rect",{x:"11.2",y:"16.8",width:"16.8",height:"11.2"})]})}function vu(e){const n=["page",e.width??"app",e.className].filter(Boolean).join(" ");return g.jsx("div",{className:n,children:e.children})}function nk(e){e&&Zu()}function Ws(e){return g.jsxs(g.Fragment,{children:[g.jsx("div",{id:"sb-backdrop",onClick:hr}),g.jsxs("aside",{id:"sidebar",ref:nk,children:[e.vault,e.projectsNav,e.tree??g.jsx("nav",{id:"tree","aria-label":"Files"}),e.orgBar]}),g.jsxs("main",{id:"main",children:[e.topbar,g.jsx("article",{id:"content",ref:e.contentRef,onScroll:e.onContentScroll,children:e.children})]})]})}function Ku(e){const{name:n,onHome:r,showSignout:i,search:s}=e;return g.jsxs("header",{id:"vault",children:[g.jsx("span",{id:"vault-badge",children:g.jsx(tk,{size:22})}),g.jsx("span",{id:"vault-name",className:r?"vault-link":void 0,onClick:r,role:r?"button":void 0,tabIndex:r?0:void 0,onKeyDown:l=>{r&&(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),r())},children:n}),g.jsxs("div",{className:"vault-actions",children:[s&&g.jsxs(ez,{delayDuration:150,children:[g.jsx(tz,{asChild:!0,children:g.jsx("button",{id:"search-btn",className:"icon-btn2","aria-label":"Search",onClick:()=>{oz(),hr()},children:g.jsx(Yt,{name:"search"})})}),g.jsxs(nz,{className:"tipcard",sideOffset:6,children:["Search ",g.jsx("kbd",{children:"⌘K"})]})]}),i&&g.jsx("a",{id:"signout",href:"/auth/logout",title:"Sign out","aria-label":"Sign out",children:g.jsx(Yt,{name:"power"})})]})]})}function el(e){return g.jsxs("header",{id:"topbar",children:[g.jsx("button",{id:"menu-btn",className:"icon-btn",title:"Menu","aria-label":"Menu","aria-controls":"sidebar","aria-expanded":"false",onClick:JD,children:g.jsx(Yt,{name:"menu"})}),g.jsx("span",{id:"crumb",children:e.crumb}),g.jsx("span",{id:"meta",children:e.meta}),e.actions]})}function rk(e){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const ok=e=>{switch(e){case"success":return sk;case"info":return ck;case"warning":return lk;case"error":return uk;default:return null}},ik=Array(12).fill(0),ak=({visible:e,className:n})=>fe.createElement("div",{className:["sonner-loading-wrapper",n].filter(Boolean).join(" "),"data-visible":e},fe.createElement("div",{className:"sonner-spinner"},ik.map((r,i)=>fe.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${i}`})))),sk=fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},fe.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),lk=fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},fe.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),ck=fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},fe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),uk=fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},fe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),dk=fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},fe.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),fe.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),fk=()=>{const[e,n]=fe.useState(document.hidden);return fe.useEffect(()=>{const r=()=>{n(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let Rm=1;class hk{constructor(){this.subscribe=n=>(this.subscribers.push(n),()=>{const r=this.subscribers.indexOf(n);this.subscribers.splice(r,1)}),this.publish=n=>{this.subscribers.forEach(r=>r(n))},this.addToast=n=>{this.publish(n),this.toasts=[...this.toasts,n]},this.create=n=>{var r;const{message:i,...s}=n,l=typeof n?.id=="number"||((r=n.id)==null?void 0:r.length)>0?n.id:Rm++,u=this.toasts.find(h=>h.id===l),d=n.dismissible===void 0?!0:n.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),u?this.toasts=this.toasts.map(h=>h.id===l?(this.publish({...h,...n,id:l,title:i}),{...h,...n,id:l,dismissible:d,title:i}):h):this.addToast({title:i,...s,dismissible:d,id:l}),l},this.dismiss=n=>(n?(this.dismissedToasts.add(n),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:n,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(i=>i({id:r.id,dismiss:!0}))}),n),this.message=(n,r)=>this.create({...r,message:n}),this.error=(n,r)=>this.create({...r,message:n,type:"error"}),this.success=(n,r)=>this.create({...r,type:"success",message:n}),this.info=(n,r)=>this.create({...r,type:"info",message:n}),this.warning=(n,r)=>this.create({...r,type:"warning",message:n}),this.loading=(n,r)=>this.create({...r,type:"loading",message:n}),this.promise=(n,r)=>{if(!r)return;let i;r.loading!==void 0&&(i=this.create({...r,promise:n,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const s=Promise.resolve(n instanceof Function?n():n);let l=i!==void 0,u;const d=s.then(async m=>{if(u=["resolve",m],fe.isValidElement(m))l=!1,this.create({id:i,type:"default",message:m});else if(pk(m)&&!m.ok){l=!1;const v=typeof r.error=="function"?await r.error(`HTTP error! status: ${m.status}`):r.error,b=typeof r.description=="function"?await r.description(`HTTP error! status: ${m.status}`):r.description,C=typeof v=="object"&&!fe.isValidElement(v)?v:{message:v};this.create({id:i,type:"error",description:b,...C})}else if(m instanceof Error){l=!1;const v=typeof r.error=="function"?await r.error(m):r.error,b=typeof r.description=="function"?await r.description(m):r.description,C=typeof v=="object"&&!fe.isValidElement(v)?v:{message:v};this.create({id:i,type:"error",description:b,...C})}else if(r.success!==void 0){l=!1;const v=typeof r.success=="function"?await r.success(m):r.success,b=typeof r.description=="function"?await r.description(m):r.description,C=typeof v=="object"&&!fe.isValidElement(v)?v:{message:v};this.create({id:i,type:"success",description:b,...C})}}).catch(async m=>{if(u=["reject",m],r.error!==void 0){l=!1;const y=typeof r.error=="function"?await r.error(m):r.error,v=typeof r.description=="function"?await r.description(m):r.description,x=typeof y=="object"&&!fe.isValidElement(y)?y:{message:y};this.create({id:i,type:"error",description:v,...x})}}).finally(()=>{l&&(this.dismiss(i),i=void 0),r.finally==null||r.finally.call(r)}),h=()=>new Promise((m,y)=>d.then(()=>u[0]==="reject"?y(u[1]):m(u[1])).catch(y));return typeof i!="string"&&typeof i!="number"?{unwrap:h}:Object.assign(i,{unwrap:h})},this.custom=(n,r)=>{const i=r?.id||Rm++;return this.create({jsx:n(i),id:i,...r}),i},this.getActiveToasts=()=>this.toasts.filter(n=>!this.dismissedToasts.has(n.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const An=new hk,mk=(e,n)=>{const r=n?.id||Rm++;return An.addToast({title:e,...n,id:r}),r},pk=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",gk=mk,vk=()=>An.toasts,yk=()=>An.getActiveToasts(),Yb=Object.assign(gk,{success:An.success,info:An.info,warning:An.warning,error:An.error,custom:An.custom,message:An.message,promise:An.promise,dismiss:An.dismiss,loading:An.loading},{getHistory:vk,getToasts:yk});rk("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Uc(e){return e.label!==void 0}const bk=3,xk="24px",Sk="16px",Qb=4e3,wk=356,_k=14,Ck=45,Ek=200;function _r(...e){return e.filter(Boolean).join(" ")}function Rk(e){const[n,r]=e.split("-"),i=[];return n&&i.push(n),r&&i.push(r),i}const Tk=e=>{var n,r,i,s,l,u,d,h,m;const{invert:y,toast:v,unstyled:b,interacting:x,setHeights:C,visibleToasts:_,heights:E,index:T,toasts:O,expanded:A,removeToast:k,defaultRichColors:L,closeButton:q,style:H,cancelButtonStyle:I,actionButtonStyle:he,className:ve="",descriptionClassName:de="",duration:le,position:ae,gap:me,expandByDefault:ye,classNames:D,icons:Y,closeButtonAriaLabel:ne="Close toast"}=e,[J,W]=fe.useState(null),[N,j]=fe.useState(null),[U,Q]=fe.useState(!1),[Z,re]=fe.useState(!1),[ee,ge]=fe.useState(!1),[be,De]=fe.useState(!1),[Ve,Ue]=fe.useState(!1),[lt,Je]=fe.useState(0),[Xt,mn]=fe.useState(0),qt=fe.useRef(v.duration||le||Qb),Pt=fe.useRef(null),Ut=fe.useRef(null),or=T===0,Fe=T+1<=_,ze=v.type,We=v.dismissible!==!1,zt=v.className||"",to=v.descriptionClassName||"",ir=fe.useMemo(()=>E.findIndex(je=>je.toastId===v.id)||0,[E,v.id]),Ri=fe.useMemo(()=>{var je;return(je=v.closeButton)!=null?je:q},[v.closeButton,q]),no=fe.useMemo(()=>v.duration||le||Qb,[v.duration,le]),Ti=fe.useRef(0),Un=fe.useRef(0),M=fe.useRef(0),V=fe.useRef(null),[F,se]=ae.split("-"),ue=fe.useMemo(()=>E.reduce((je,pt,bt)=>bt>=ir?je:je+pt.height,0),[E,ir]),pe=fk(),xe=v.invert||y,Se=ze==="loading";Un.current=fe.useMemo(()=>ir*me+ue,[ir,ue]),fe.useEffect(()=>{qt.current=no},[no]),fe.useEffect(()=>{Q(!0)},[]),fe.useEffect(()=>{const je=Ut.current;if(je){const pt=je.getBoundingClientRect().height;return mn(pt),C(bt=>[{toastId:v.id,height:pt,position:v.position},...bt]),()=>C(bt=>bt.filter(Gt=>Gt.toastId!==v.id))}},[C,v.id]),fe.useLayoutEffect(()=>{if(!U)return;const je=Ut.current,pt=je.style.height;je.style.height="auto";const bt=je.getBoundingClientRect().height;je.style.height=pt,mn(bt),C(Gt=>Gt.find(_t=>_t.toastId===v.id)?Gt.map(_t=>_t.toastId===v.id?{..._t,height:bt}:_t):[{toastId:v.id,height:bt,position:v.position},...Gt])},[U,v.title,v.description,C,v.id,v.jsx,v.action,v.cancel]);const Te=fe.useCallback(()=>{re(!0),Je(Un.current),C(je=>je.filter(pt=>pt.toastId!==v.id)),setTimeout(()=>{k(v)},Ek)},[v,k,C,Un]);fe.useEffect(()=>{if(v.promise&&ze==="loading"||v.duration===1/0||v.type==="loading")return;let je;return A||x||pe?(()=>{if(M.current{v.onAutoClose==null||v.onAutoClose.call(v,v),Te()},qt.current)),()=>clearTimeout(je)},[A,x,v,ze,pe,Te]),fe.useEffect(()=>{v.delete&&(Te(),v.onDismiss==null||v.onDismiss.call(v,v))},[Te,v.delete]);function rt(){var je;if(Y?.loading){var pt;return fe.createElement("div",{className:_r(D?.loader,v==null||(pt=v.classNames)==null?void 0:pt.loader,"sonner-loader"),"data-visible":ze==="loading"},Y.loading)}return fe.createElement(ak,{className:_r(D?.loader,v==null||(je=v.classNames)==null?void 0:je.loader),visible:ze==="loading"})}const wt=v.icon||Y?.[ze]||ok(ze);var Jt,Dt;return fe.createElement("li",{tabIndex:0,ref:Ut,className:_r(ve,zt,D?.toast,v==null||(n=v.classNames)==null?void 0:n.toast,D?.default,D?.[ze],v==null||(r=v.classNames)==null?void 0:r[ze]),"data-sonner-toast":"","data-rich-colors":(Jt=v.richColors)!=null?Jt:L,"data-styled":!(v.jsx||v.unstyled||b),"data-mounted":U,"data-promise":!!v.promise,"data-swiped":Ve,"data-removed":Z,"data-visible":Fe,"data-y-position":F,"data-x-position":se,"data-index":T,"data-front":or,"data-swiping":ee,"data-dismissible":We,"data-type":ze,"data-invert":xe,"data-swipe-out":be,"data-swipe-direction":N,"data-expanded":!!(A||ye&&U),"data-testid":v.testId,style:{"--index":T,"--toasts-before":T,"--z-index":O.length-T,"--offset":`${Z?lt:Un.current}px`,"--initial-height":ye?"auto":`${Xt}px`,...H,...v.style},onDragEnd:()=>{ge(!1),W(null),V.current=null},onPointerDown:je=>{je.button!==2&&(Se||!We||(Pt.current=new Date,Je(Un.current),je.target.setPointerCapture(je.pointerId),je.target.tagName!=="BUTTON"&&(ge(!0),V.current={x:je.clientX,y:je.clientY})))},onPointerUp:()=>{var je,pt,bt;if(be||!We)return;V.current=null;const Gt=Number(((je=Ut.current)==null?void 0:je.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ar=Number(((pt=Ut.current)==null?void 0:pt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),_t=new Date().getTime()-((bt=Pt.current)==null?void 0:bt.getTime()),bn=J==="x"?Gt:ar,qo=Math.abs(bn)/_t;if(Math.abs(bn)>=Ck||qo>.11){Je(Un.current),v.onDismiss==null||v.onDismiss.call(v,v),j(J==="x"?Gt>0?"right":"left":ar>0?"down":"up"),Te(),De(!0);return}else{var xn,Sn;(xn=Ut.current)==null||xn.style.setProperty("--swipe-amount-x","0px"),(Sn=Ut.current)==null||Sn.style.setProperty("--swipe-amount-y","0px")}Ue(!1),ge(!1),W(null)},onPointerMove:je=>{var pt,bt,Gt;if(!V.current||!We||((pt=window.getSelection())==null?void 0:pt.toString().length)>0)return;const _t=je.clientY-V.current.y,bn=je.clientX-V.current.x;var qo;const xn=(qo=e.swipeDirections)!=null?qo:Rk(ae);!J&&(Math.abs(bn)>1||Math.abs(_t)>1)&&W(Math.abs(bn)>Math.abs(_t)?"x":"y");let Sn={x:0,y:0};const Oi=sr=>1/(1.5+Math.abs(sr)/20);if(J==="y"){if(xn.includes("top")||xn.includes("bottom"))if(xn.includes("top")&&_t<0||xn.includes("bottom")&&_t>0)Sn.y=_t;else{const sr=_t*Oi(_t);Sn.y=Math.abs(sr)0)Sn.x=bn;else{const sr=bn*Oi(bn);Sn.x=Math.abs(sr)0||Math.abs(Sn.y)>0)&&Ue(!0),(bt=Ut.current)==null||bt.style.setProperty("--swipe-amount-x",`${Sn.x}px`),(Gt=Ut.current)==null||Gt.style.setProperty("--swipe-amount-y",`${Sn.y}px`)}},Ri&&!v.jsx&&ze!=="loading"?fe.createElement("button",{"aria-label":ne,"data-disabled":Se,"data-close-button":!0,onClick:Se||!We?()=>{}:()=>{Te(),v.onDismiss==null||v.onDismiss.call(v,v)},className:_r(D?.closeButton,v==null||(i=v.classNames)==null?void 0:i.closeButton)},(Dt=Y?.close)!=null?Dt:dk):null,(ze||v.icon||v.promise)&&v.icon!==null&&(Y?.[ze]!==null||v.icon)?fe.createElement("div",{"data-icon":"",className:_r(D?.icon,v==null||(s=v.classNames)==null?void 0:s.icon)},v.promise||v.type==="loading"&&!v.icon?v.icon||rt():null,v.type!=="loading"?wt:null):null,fe.createElement("div",{"data-content":"",className:_r(D?.content,v==null||(l=v.classNames)==null?void 0:l.content)},fe.createElement("div",{"data-title":"",className:_r(D?.title,v==null||(u=v.classNames)==null?void 0:u.title)},v.jsx?v.jsx:typeof v.title=="function"?v.title():v.title),v.description?fe.createElement("div",{"data-description":"",className:_r(de,to,D?.description,v==null||(d=v.classNames)==null?void 0:d.description)},typeof v.description=="function"?v.description():v.description):null),fe.isValidElement(v.cancel)?v.cancel:v.cancel&&Uc(v.cancel)?fe.createElement("button",{"data-button":!0,"data-cancel":!0,style:v.cancelButtonStyle||I,onClick:je=>{Uc(v.cancel)&&We&&(v.cancel.onClick==null||v.cancel.onClick.call(v.cancel,je),Te())},className:_r(D?.cancelButton,v==null||(h=v.classNames)==null?void 0:h.cancelButton)},v.cancel.label):null,fe.isValidElement(v.action)?v.action:v.action&&Uc(v.action)?fe.createElement("button",{"data-button":!0,"data-action":!0,style:v.actionButtonStyle||he,onClick:je=>{Uc(v.action)&&(v.action.onClick==null||v.action.onClick.call(v.action,je),!je.defaultPrevented&&Te())},className:_r(D?.actionButton,v==null||(m=v.classNames)==null?void 0:m.actionButton)},v.action.label):null)};function Xb(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function Ok(e,n){const r={};return[e,n].forEach((i,s)=>{const l=s===1,u=l?"--mobile-offset":"--offset",d=l?Sk:xk;function h(m){["top","right","bottom","left"].forEach(y=>{r[`${u}-${y}`]=typeof m=="number"?`${m}px`:m})}typeof i=="number"||typeof i=="string"?h(i):typeof i=="object"?["top","right","bottom","left"].forEach(m=>{i[m]===void 0?r[`${u}-${m}`]=d:r[`${u}-${m}`]=typeof i[m]=="number"?`${i[m]}px`:i[m]}):h(d)}),r}const Ak=fe.forwardRef(function(n,r){const{id:i,invert:s,position:l="bottom-right",hotkey:u=["altKey","KeyT"],expand:d,closeButton:h,className:m,offset:y,mobileOffset:v,theme:b="light",richColors:x,duration:C,style:_,visibleToasts:E=bk,toastOptions:T,dir:O=Xb(),gap:A=_k,icons:k,containerAriaLabel:L="Notifications"}=n,[q,H]=fe.useState([]),I=fe.useMemo(()=>i?q.filter(U=>U.toasterId===i):q.filter(U=>!U.toasterId),[q,i]),he=fe.useMemo(()=>Array.from(new Set([l].concat(I.filter(U=>U.position).map(U=>U.position)))),[I,l]),[ve,de]=fe.useState([]),[le,ae]=fe.useState(!1),[me,ye]=fe.useState(!1),[D,Y]=fe.useState(b!=="system"?b:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),ne=fe.useRef(null),J=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),W=fe.useRef(null),N=fe.useRef(!1),j=fe.useCallback(U=>{H(Q=>{var Z;return(Z=Q.find(re=>re.id===U.id))!=null&&Z.delete||An.dismiss(U.id),Q.filter(({id:re})=>re!==U.id)})},[]);return fe.useEffect(()=>An.subscribe(U=>{if(U.dismiss){requestAnimationFrame(()=>{H(Q=>Q.map(Z=>Z.id===U.id?{...Z,delete:!0}:Z))});return}setTimeout(()=>{D2.flushSync(()=>{H(Q=>{const Z=Q.findIndex(re=>re.id===U.id);return Z!==-1?[...Q.slice(0,Z),{...Q[Z],...U},...Q.slice(Z+1)]:[U,...Q]})})})}),[q]),fe.useEffect(()=>{if(b!=="system"){Y(b);return}if(b==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Y("dark"):Y("light")),typeof window>"u")return;const U=window.matchMedia("(prefers-color-scheme: dark)");try{U.addEventListener("change",({matches:Q})=>{Y(Q?"dark":"light")})}catch{U.addListener(({matches:Z})=>{try{Y(Z?"dark":"light")}catch(re){console.error(re)}})}},[b]),fe.useEffect(()=>{q.length<=1&&ae(!1)},[q]),fe.useEffect(()=>{const U=Q=>{var Z;if(u.every(ge=>Q[ge]||Q.code===ge)){var ee;ae(!0),(ee=ne.current)==null||ee.focus()}Q.code==="Escape"&&(document.activeElement===ne.current||(Z=ne.current)!=null&&Z.contains(document.activeElement))&&ae(!1)};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[u]),fe.useEffect(()=>{if(ne.current)return()=>{W.current&&(W.current.focus({preventScroll:!0}),W.current=null,N.current=!1)}},[ne.current]),fe.createElement("section",{ref:r,"aria-label":`${L} ${J}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},he.map((U,Q)=>{var Z;const[re,ee]=U.split("-");return I.length?fe.createElement("ol",{key:U,dir:O==="auto"?Xb():O,tabIndex:-1,ref:ne,className:m,"data-sonner-toaster":!0,"data-sonner-theme":D,"data-y-position":re,"data-x-position":ee,style:{"--front-toast-height":`${((Z=ve[0])==null?void 0:Z.height)||0}px`,"--width":`${wk}px`,"--gap":`${A}px`,..._,...Ok(y,v)},onBlur:ge=>{N.current&&!ge.currentTarget.contains(ge.relatedTarget)&&(N.current=!1,W.current&&(W.current.focus({preventScroll:!0}),W.current=null))},onFocus:ge=>{ge.target instanceof HTMLElement&&ge.target.dataset.dismissible==="false"||N.current||(N.current=!0,W.current=ge.relatedTarget)},onMouseEnter:()=>ae(!0),onMouseMove:()=>ae(!0),onMouseLeave:()=>{me||ae(!1)},onDragEnd:()=>ae(!1),onPointerDown:ge=>{ge.target instanceof HTMLElement&&ge.target.dataset.dismissible==="false"||ye(!0)},onPointerUp:()=>ye(!1)},I.filter(ge=>!ge.position&&Q===0||ge.position===U).map((ge,be)=>{var De,Ve;return fe.createElement(Tk,{key:ge.id,icons:k,index:be,toast:ge,defaultRichColors:x,duration:(De=T?.duration)!=null?De:C,className:T?.className,descriptionClassName:T?.descriptionClassName,invert:s,visibleToasts:E,closeButton:(Ve=T?.closeButton)!=null?Ve:h,interacting:me,position:U,style:T?.style,unstyled:T?.unstyled,classNames:T?.classNames,cancelButtonStyle:T?.cancelButtonStyle,actionButtonStyle:T?.actionButtonStyle,closeButtonAriaLabel:T?.closeButtonAriaLabel,removeToast:j,toasts:I.filter(Ue=>Ue.position==ge.position),heights:ve.filter(Ue=>Ue.position==ge.position),setHeights:de,expandByDefault:d,gap:A,expanded:le,swipeDirections:n.swipeDirections})})):null}))}),Mk=({...e})=>g.jsx(Ak,{theme:"dark",className:"toaster group",icons:{success:g.jsx(Oz,{className:"size-4"}),info:g.jsx(aD,{className:"size-4"}),warning:g.jsx(W1,{className:"size-4"}),error:g.jsx(ED,{className:"size-4"}),loading:g.jsx(mD,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius-ctl)"},...e});function Xe(e,n=!1){n?Yb.error(e,{duration:1/0,closeButton:!0}):Yb(e)}function jk(){return g.jsx(Mk,{position:"bottom-center"})}const Jb=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Wb=A1,Nk=(e,n)=>r=>{var i;if(n?.variants==null)return Wb(e,r?.class,r?.className);const{variants:s,defaultVariants:l}=n,u=Object.keys(s).map(m=>{const y=r?.[m],v=l?.[m];if(y===null)return null;const b=Jb(y)||Jb(v);return s[m][b]}),d=r&&Object.entries(r).reduce((m,y)=>{let[v,b]=y;return b===void 0||(m[v]=b),m},{}),h=n==null||(i=n.compoundVariants)===null||i===void 0?void 0:i.reduce((m,y)=>{let{class:v,className:b,...x}=y;return Object.entries(x).every(C=>{let[_,E]=C;return Array.isArray(E)?E.includes({...l,...d}[_]):{...l,...d}[_]===E})?[...m,v,b]:m},[]);return Wb(e,u,h,r?.class,r?.className)},zk=Nk("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[background-color,border-color,color] disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",primary:"pbtn",danger:"danger-btn",subtle:"ai-btn",toolbar:"btn",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function Nt({className:e,variant:n="default",size:r="default",asChild:i=!1,...s}){const l=i?k2:"button";return g.jsx(l,{"data-slot":"button","data-variant":n,"data-size":r,className:et(zk({variant:n,size:r,className:e})),...s})}function kp({...e}){return g.jsx(np,{"data-slot":"dialog",...e})}function Dk({...e}){return g.jsx(op,{"data-slot":"dialog-portal",...e})}function kk({className:e,...n}){return g.jsx(ip,{"data-slot":"dialog-overlay",className:et("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",e),...n})}function Lp({className:e,children:n,showCloseButton:r=!0,...i}){return g.jsxs(Dk,{"data-slot":"dialog-portal",children:[g.jsx(kk,{}),g.jsxs(ap,{"data-slot":"dialog-content",className:et("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",e),...i,children:[n,r&&g.jsxs(kS,{"data-slot":"dialog-close",className:"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[g.jsx(t_,{}),g.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Yu({className:e,...n}){return g.jsx(NS,{"data-slot":"dialog-title",className:et("text-lg leading-none font-semibold",e),...n})}let r_=null,eu=[];function pl(e){r_=e,eu.forEach(n=>n())}function $p(e,n,r="",i="OK",s={}){return new Promise(l=>pl({kind:"prompt",title:e,label:n,value:r,okLabel:i,...s,resolve:l}))}function Qu(e,n,r="Confirm",i=!1){return new Promise(s=>pl({kind:"confirm",title:e,message:n,confirmLabel:r,danger:i,resolve:s}))}function Lk(){const e=S.useSyncExternalStore(r=>(eu.push(r),()=>{eu=eu.filter(i=>i!==r)}),()=>r_);if(!e)return null;const n=()=>{pl(null),e.kind==="prompt"?e.resolve(null):e.resolve(!1)};return g.jsx(kp,{open:!0,onOpenChange:r=>!r&&n(),children:g.jsx(Lp,{className:"modal",showCloseButton:!1,children:e.kind==="prompt"?g.jsx($k,{m:e}):g.jsx(Ik,{m:e})})})}function $k({m:e}){const n=S.useRef(null),r=m=>{pl(null),e.resolve(m)},[i,s]=S.useState(""),[l,u]=S.useState(e.value),d=e.match===void 0||l.trim()===e.match,h=()=>{const m=l;if(d){if(!m.trim()){s("Give it a name."),n.current.focus();return}r(m)}};return g.jsxs(g.Fragment,{children:[g.jsx(Yu,{asChild:!0,children:g.jsx("h3",{children:e.title})}),g.jsx("label",{className:"modal-label",htmlFor:"modal-input",children:e.label}),g.jsx("input",{className:"modal-input",type:"text",autoComplete:"off",value:l,ref:n,id:"modal-input",autoFocus:!0,onFocus:m=>m.currentTarget.select(),"aria-invalid":!!i,"aria-describedby":i?"modal-input-err":void 0,onChange:m=>{u(m.currentTarget.value),i&&s("")},onKeyDown:m=>m.key==="Enter"&&h()}),i&&g.jsx("span",{id:"modal-input-err",role:"alert",className:"field-err",children:i}),g.jsxs("div",{className:"modal-actions",children:[g.jsx(Nt,{variant:"subtle",onClick:()=>r(null),children:"Cancel"}),g.jsx(Nt,{variant:e.danger?"danger":"primary",onClick:h,disabled:!d,children:e.okLabel})]})]})}function Ik({m:e}){const n=r=>{pl(null),e.resolve(r)};return g.jsxs(g.Fragment,{children:[g.jsx(Yu,{asChild:!0,children:g.jsx("h3",{children:e.title})}),g.jsx("p",{className:"modal-msg",children:e.message}),g.jsxs("div",{className:"modal-actions",children:[g.jsx(Nt,{variant:"subtle",onClick:()=>n(!1),autoFocus:e.danger,children:"Cancel"}),g.jsx(Nt,{variant:e.danger?"danger":"primary",onClick:()=>n(!0),autoFocus:!e.danger,children:e.confirmLabel})]})]})}function Vk(e){return vn({queryKey:["projects"],queryFn:()=>Nn("/api/projects"),enabled:e,refetchInterval:3e4,select:n=>n.projects||[]})}function Fk(e){return vn({queryKey:["orgs"],queryFn:()=>Nn("/api/orgs"),enabled:e,select:n=>n.orgs||[]})}function Pk(e){return vn({queryKey:["permissions",e],queryFn:()=>Nn(`/api/p/${e}/permissions`),enabled:!!e})}function o_(e){return vn({queryKey:["admin","pending"],queryFn:()=>Nn("/api/admin/pending"),enabled:e,select:n=>n.pending||[]})}function Ip(){const e=ka();return()=>Promise.all([e.invalidateQueries({queryKey:["projects"]}),e.invalidateQueries({queryKey:["orgs"]})]).then(()=>{})}function i_(e){return e.split("/").map(encodeURIComponent).join("/")}function ex(e){return e.split("/").map(decodeURIComponent).join("/")}const Uk=new Set(["insights","history","install","settings"]);function a_(e,n){const r=e.replace(/^\/+/,"");if(n!=="hub")return{path:r?ex(r):""};if(r==="orgs"||r.startsWith("orgs/"))return{org:r.slice(5).replace(/\/+$/,""),path:""};const i=r.indexOf("/");if(i===-1)return{project:r,path:""};const s={project:r.slice(0,i),path:ex(r.slice(i+1))},l=s.path.indexOf("/"),u=l===-1?s.path:s.path.slice(0,l);return Uk.has(u)&&(s.view=u,s.viewTarget=l===-1?"":s.path.slice(l+1).replace(/\/+$/,""),s.path=""),s}function Hk(e,n){const r=i_(e);return n?"/"+n+(r?"/"+r:""):"/"+r}function _a(e,n,r){let i=(n?"/"+n:"")+"/"+e;return r&&(i+="/"+i_(r.replace(/\/+$/,""))),i}let Vp="POP";const Tm=new Set;function s_(){for(const e of Tm)e()}window.addEventListener("popstate",()=>{Vp="POP",s_()});function fn(e,n){const r=location.pathname+location.search;!n?.replace&&r===e||(history[n?.replace?"replaceState":"pushState"](null,"",e),Vp=n?.replace?"REPLACE":"PUSH",s_())}function Fp(){return S.useSyncExternalStore(e=>(Tm.add(e),()=>{Tm.delete(e)}),()=>location.pathname)}function Bk(){return Vp}function l_(e){return e.startsWith("/")&&!e.startsWith("//")?{href:e,onClick:r=>{r.defaultPrevented||r.metaKey||r.ctrlKey||r.shiftKey||r.altKey||r.button!==0||(r.preventDefault(),fn(e),document.body.classList.remove("sb-open"))}}:{href:e,target:"_blank",rel:"noopener noreferrer"}}function qk({to:e}){return S.useEffect(()=>{fn(e,{replace:!0})},[e]),null}function c_(){return{accessor:(e,n)=>typeof e=="function"?{...n,accessorFn:e}:{...n,accessorKey:e},display:e=>e,group:e=>e}}function Mo(e,n){return typeof e=="function"?e(n):e}function Pn(e,n){return r=>{n.setState(i=>({...i,[e]:Mo(r,i[e])}))}}function Xu(e){return e instanceof Function}function Gk(e){return Array.isArray(e)&&e.every(n=>typeof n=="number")}function Zk(e,n){const r=[],i=s=>{s.forEach(l=>{r.push(l);const u=n(l);u!=null&&u.length&&i(u)})};return i(e),r}function ke(e,n,r){let i=[],s;return l=>{let u;r.key&&r.debug&&(u=Date.now());const d=e(l);if(!(d.length!==i.length||d.some((y,v)=>i[v]!==y)))return s;i=d;let m;if(r.key&&r.debug&&(m=Date.now()),s=n(...d),r==null||r.onChange==null||r.onChange(s),r.key&&r.debug&&r!=null&&r.debug()){const y=Math.round((Date.now()-u)*100)/100,v=Math.round((Date.now()-m)*100)/100,b=v/16,x=(C,_)=>{for(C=String(C);C.length<_;)C=" "+C;return C};console.info(`%c⏱ ${x(v,5)} /${x(y,5)} ms`,` + font-size: .6rem; + font-weight: bold; + color: hsl(${Math.max(0,Math.min(120-120*b,120))}deg 100% 31%);`,r?.key)}return s}}function Le(e,n,r,i){return{debug:()=>{var s;return(s=e?.debugAll)!=null?s:e[n]},key:!1,onChange:i}}function Kk(e,n,r,i){const s=()=>{var u;return(u=l.getValue())!=null?u:e.options.renderFallbackValue},l={id:`${n.id}_${r.id}`,row:n,column:r,getValue:()=>n.getValue(i),renderValue:s,getContext:ke(()=>[e,r,n,l],(u,d,h,m)=>({table:u,column:d,row:h,cell:m,getValue:m.getValue,renderValue:m.renderValue}),Le(e.options,"debugCells"))};return e._features.forEach(u=>{u.createCell==null||u.createCell(l,r,n,e)},{}),l}function Yk(e,n,r,i){var s,l;const d={...e._getDefaultColumnDef(),...n},h=d.accessorKey;let m=(s=(l=d.id)!=null?l:h?typeof String.prototype.replaceAll=="function"?h.replaceAll(".","_"):h.replace(/\./g,"_"):void 0)!=null?s:typeof d.header=="string"?d.header:void 0,y;if(d.accessorFn?y=d.accessorFn:h&&(h.includes(".")?y=b=>{let x=b;for(const _ of h.split(".")){var C;x=(C=x)==null?void 0:C[_]}return x}:y=b=>b[d.accessorKey]),!m)throw new Error;let v={id:`${String(m)}`,accessorFn:y,parent:i,depth:r,columnDef:d,columns:[],getFlatColumns:ke(()=>[!0],()=>{var b;return[v,...(b=v.columns)==null?void 0:b.flatMap(x=>x.getFlatColumns())]},Le(e.options,"debugColumns")),getLeafColumns:ke(()=>[e._getOrderColumnsFn()],b=>{var x;if((x=v.columns)!=null&&x.length){let C=v.columns.flatMap(_=>_.getLeafColumns());return b(C)}return[v]},Le(e.options,"debugColumns"))};for(const b of e._features)b.createColumn==null||b.createColumn(v,e);return v}const dn="debugHeaders";function tx(e,n,r){var i;let l={id:(i=r.id)!=null?i:n.id,column:n,index:r.index,isPlaceholder:!!r.isPlaceholder,placeholderId:r.placeholderId,depth:r.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const u=[],d=h=>{h.subHeaders&&h.subHeaders.length&&h.subHeaders.map(d),u.push(h)};return d(l),u},getContext:()=>({table:e,header:l,column:n})};return e._features.forEach(u=>{u.createHeader==null||u.createHeader(l,e)}),l}const Qk={createTable:e=>{e.getHeaderGroups=ke(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,r,i,s)=>{var l,u;const d=(l=i?.map(v=>r.find(b=>b.id===v)).filter(Boolean))!=null?l:[],h=(u=s?.map(v=>r.find(b=>b.id===v)).filter(Boolean))!=null?u:[],m=r.filter(v=>!(i!=null&&i.includes(v.id))&&!(s!=null&&s.includes(v.id)));return Hc(n,[...d,...m,...h],e)},Le(e.options,dn)),e.getCenterHeaderGroups=ke(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,r,i,s)=>(r=r.filter(l=>!(i!=null&&i.includes(l.id))&&!(s!=null&&s.includes(l.id))),Hc(n,r,e,"center")),Le(e.options,dn)),e.getLeftHeaderGroups=ke(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(n,r,i)=>{var s;const l=(s=i?.map(u=>r.find(d=>d.id===u)).filter(Boolean))!=null?s:[];return Hc(n,l,e,"left")},Le(e.options,dn)),e.getRightHeaderGroups=ke(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(n,r,i)=>{var s;const l=(s=i?.map(u=>r.find(d=>d.id===u)).filter(Boolean))!=null?s:[];return Hc(n,l,e,"right")},Le(e.options,dn)),e.getFooterGroups=ke(()=>[e.getHeaderGroups()],n=>[...n].reverse(),Le(e.options,dn)),e.getLeftFooterGroups=ke(()=>[e.getLeftHeaderGroups()],n=>[...n].reverse(),Le(e.options,dn)),e.getCenterFooterGroups=ke(()=>[e.getCenterHeaderGroups()],n=>[...n].reverse(),Le(e.options,dn)),e.getRightFooterGroups=ke(()=>[e.getRightHeaderGroups()],n=>[...n].reverse(),Le(e.options,dn)),e.getFlatHeaders=ke(()=>[e.getHeaderGroups()],n=>n.map(r=>r.headers).flat(),Le(e.options,dn)),e.getLeftFlatHeaders=ke(()=>[e.getLeftHeaderGroups()],n=>n.map(r=>r.headers).flat(),Le(e.options,dn)),e.getCenterFlatHeaders=ke(()=>[e.getCenterHeaderGroups()],n=>n.map(r=>r.headers).flat(),Le(e.options,dn)),e.getRightFlatHeaders=ke(()=>[e.getRightHeaderGroups()],n=>n.map(r=>r.headers).flat(),Le(e.options,dn)),e.getCenterLeafHeaders=ke(()=>[e.getCenterFlatHeaders()],n=>n.filter(r=>{var i;return!((i=r.subHeaders)!=null&&i.length)}),Le(e.options,dn)),e.getLeftLeafHeaders=ke(()=>[e.getLeftFlatHeaders()],n=>n.filter(r=>{var i;return!((i=r.subHeaders)!=null&&i.length)}),Le(e.options,dn)),e.getRightLeafHeaders=ke(()=>[e.getRightFlatHeaders()],n=>n.filter(r=>{var i;return!((i=r.subHeaders)!=null&&i.length)}),Le(e.options,dn)),e.getLeafHeaders=ke(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(n,r,i)=>{var s,l,u,d,h,m;return[...(s=(l=n[0])==null?void 0:l.headers)!=null?s:[],...(u=(d=r[0])==null?void 0:d.headers)!=null?u:[],...(h=(m=i[0])==null?void 0:m.headers)!=null?h:[]].map(y=>y.getLeafHeaders()).flat()},Le(e.options,dn))}};function Hc(e,n,r,i){var s,l;let u=0;const d=function(b,x){x===void 0&&(x=1),u=Math.max(u,x),b.filter(C=>C.getIsVisible()).forEach(C=>{var _;(_=C.columns)!=null&&_.length&&d(C.columns,x+1)},0)};d(e);let h=[];const m=(b,x)=>{const C={depth:x,id:[i,`${x}`].filter(Boolean).join("_"),headers:[]},_=[];b.forEach(E=>{const T=[..._].reverse()[0],O=E.column.depth===C.depth;let A,k=!1;if(O&&E.column.parent?A=E.column.parent:(A=E.column,k=!0),T&&T?.column===A)T.subHeaders.push(E);else{const L=tx(r,A,{id:[i,x,A.id,E?.id].filter(Boolean).join("_"),isPlaceholder:k,placeholderId:k?`${_.filter(q=>q.column===A).length}`:void 0,depth:x,index:_.length});L.subHeaders.push(E),_.push(L)}C.headers.push(E),E.headerGroup=C}),h.push(C),x>0&&m(_,x-1)},y=n.map((b,x)=>tx(r,b,{depth:u,index:x}));m(y,u-1),h.reverse();const v=b=>b.filter(C=>C.column.getIsVisible()).map(C=>{let _=0,E=0,T=[0];C.subHeaders&&C.subHeaders.length?(T=[],v(C.subHeaders).forEach(A=>{let{colSpan:k,rowSpan:L}=A;_+=k,T.push(L)})):_=1;const O=Math.min(...T);return E=E+O,C.colSpan=_,C.rowSpan=E,{colSpan:_,rowSpan:E}});return v((s=(l=h[0])==null?void 0:l.headers)!=null?s:[]),h}const Xk=(e,n,r,i,s,l,u)=>{let d={id:n,index:i,original:r,depth:s,parentId:u,_valuesCache:{},_uniqueValuesCache:{},getValue:h=>{if(d._valuesCache.hasOwnProperty(h))return d._valuesCache[h];const m=e.getColumn(h);if(m!=null&&m.accessorFn)return d._valuesCache[h]=m.accessorFn(d.original,i),d._valuesCache[h]},getUniqueValues:h=>{if(d._uniqueValuesCache.hasOwnProperty(h))return d._uniqueValuesCache[h];const m=e.getColumn(h);if(m!=null&&m.accessorFn)return m.columnDef.getUniqueValues?(d._uniqueValuesCache[h]=m.columnDef.getUniqueValues(d.original,i),d._uniqueValuesCache[h]):(d._uniqueValuesCache[h]=[d.getValue(h)],d._uniqueValuesCache[h])},renderValue:h=>{var m;return(m=d.getValue(h))!=null?m:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>Zk(d.subRows,h=>h.subRows),getParentRow:()=>d.parentId?e.getRow(d.parentId,!0):void 0,getParentRows:()=>{let h=[],m=d;for(;;){const y=m.getParentRow();if(!y)break;h.push(y),m=y}return h.reverse()},getAllCells:ke(()=>[e.getAllLeafColumns()],h=>h.map(m=>Kk(e,d,m,m.id)),Le(e.options,"debugRows")),_getAllCellsByColumnId:ke(()=>[d.getAllCells()],h=>h.reduce((m,y)=>(m[y.column.id]=y,m),{}),Le(e.options,"debugRows"))};for(let h=0;h{e._getFacetedRowModel=n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():n.getPreFilteredRowModel(),e._getFacetedUniqueValues=n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},u_=(e,n,r)=>{var i,s;const l=r==null||(i=r.toString())==null?void 0:i.toLowerCase();return!!(!((s=e.getValue(n))==null||(s=s.toString())==null||(s=s.toLowerCase())==null)&&s.includes(l))};u_.autoRemove=e=>pr(e);const d_=(e,n,r)=>{var i;return!!(!((i=e.getValue(n))==null||(i=i.toString())==null)&&i.includes(r))};d_.autoRemove=e=>pr(e);const f_=(e,n,r)=>{var i;return((i=e.getValue(n))==null||(i=i.toString())==null?void 0:i.toLowerCase())===r?.toLowerCase()};f_.autoRemove=e=>pr(e);const h_=(e,n,r)=>{var i;return(i=e.getValue(n))==null?void 0:i.includes(r)};h_.autoRemove=e=>pr(e);const m_=(e,n,r)=>!r.some(i=>{var s;return!((s=e.getValue(n))!=null&&s.includes(i))});m_.autoRemove=e=>pr(e)||!(e!=null&&e.length);const p_=(e,n,r)=>r.some(i=>{var s;return(s=e.getValue(n))==null?void 0:s.includes(i)});p_.autoRemove=e=>pr(e)||!(e!=null&&e.length);const g_=(e,n,r)=>e.getValue(n)===r;g_.autoRemove=e=>pr(e);const v_=(e,n,r)=>e.getValue(n)==r;v_.autoRemove=e=>pr(e);const Pp=(e,n,r)=>{let[i,s]=r;const l=e.getValue(n);return l>=i&&l<=s};Pp.resolveFilterValue=e=>{let[n,r]=e,i=typeof n!="number"?parseFloat(n):n,s=typeof r!="number"?parseFloat(r):r,l=n===null||Number.isNaN(i)?-1/0:i,u=r===null||Number.isNaN(s)?1/0:s;if(l>u){const d=l;l=u,u=d}return[l,u]};Pp.autoRemove=e=>pr(e)||pr(e[0])&&pr(e[1]);const Qr={includesString:u_,includesStringSensitive:d_,equalsString:f_,arrIncludes:h_,arrIncludesAll:m_,arrIncludesSome:p_,equals:g_,weakEquals:v_,inNumberRange:Pp};function pr(e){return e==null||e===""}const Wk={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Pn("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,n)=>{e.getAutoFilterFn=()=>{const r=n.getCoreRowModel().flatRows[0],i=r?.getValue(e.id);return typeof i=="string"?Qr.includesString:typeof i=="number"?Qr.inNumberRange:typeof i=="boolean"||i!==null&&typeof i=="object"?Qr.equals:Array.isArray(i)?Qr.arrIncludes:Qr.weakEquals},e.getFilterFn=()=>{var r,i;return Xu(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(r=(i=n.options.filterFns)==null?void 0:i[e.columnDef.filterFn])!=null?r:Qr[e.columnDef.filterFn]},e.getCanFilter=()=>{var r,i,s;return((r=e.columnDef.enableColumnFilter)!=null?r:!0)&&((i=n.options.enableColumnFilters)!=null?i:!0)&&((s=n.options.enableFilters)!=null?s:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var r;return(r=n.getState().columnFilters)==null||(r=r.find(i=>i.id===e.id))==null?void 0:r.value},e.getFilterIndex=()=>{var r,i;return(r=(i=n.getState().columnFilters)==null?void 0:i.findIndex(s=>s.id===e.id))!=null?r:-1},e.setFilterValue=r=>{n.setColumnFilters(i=>{const s=e.getFilterFn(),l=i?.find(y=>y.id===e.id),u=Mo(r,l?l.value:void 0);if(nx(s,u,e)){var d;return(d=i?.filter(y=>y.id!==e.id))!=null?d:[]}const h={id:e.id,value:u};if(l){var m;return(m=i?.map(y=>y.id===e.id?h:y))!=null?m:[]}return i!=null&&i.length?[...i,h]:[h]})}},createRow:(e,n)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=n=>{const r=e.getAllLeafColumns(),i=s=>{var l;return(l=Mo(n,s))==null?void 0:l.filter(u=>{const d=r.find(h=>h.id===u.id);if(d){const h=d.getFilterFn();if(nx(h,u.value,d))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(i)},e.resetColumnFilters=n=>{var r,i;e.setColumnFilters(n?[]:(r=(i=e.initialState)==null?void 0:i.columnFilters)!=null?r:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function nx(e,n,r){return(e&&e.autoRemove?e.autoRemove(n,r):!1)||typeof n>"u"||typeof n=="string"&&!n}const e3=(e,n,r)=>r.reduce((i,s)=>{const l=s.getValue(e);return i+(typeof l=="number"?l:0)},0),t3=(e,n,r)=>{let i;return r.forEach(s=>{const l=s.getValue(e);l!=null&&(i>l||i===void 0&&l>=l)&&(i=l)}),i},n3=(e,n,r)=>{let i;return r.forEach(s=>{const l=s.getValue(e);l!=null&&(i=l)&&(i=l)}),i},r3=(e,n,r)=>{let i,s;return r.forEach(l=>{const u=l.getValue(e);u!=null&&(i===void 0?u>=u&&(i=s=u):(i>u&&(i=u),s{let r=0,i=0;if(n.forEach(s=>{let l=s.getValue(e);l!=null&&(l=+l)>=l&&(++r,i+=l)}),r)return i/r},i3=(e,n)=>{if(!n.length)return;const r=n.map(l=>l.getValue(e));if(!Gk(r))return;if(r.length===1)return r[0];const i=Math.floor(r.length/2),s=r.sort((l,u)=>l-u);return r.length%2!==0?s[i]:(s[i-1]+s[i])/2},a3=(e,n)=>Array.from(new Set(n.map(r=>r.getValue(e))).values()),s3=(e,n)=>new Set(n.map(r=>r.getValue(e))).size,l3=(e,n)=>n.length,Fh={sum:e3,min:t3,max:n3,extent:r3,mean:o3,median:i3,unique:a3,uniqueCount:s3,count:l3},c3={getDefaultColumnDef:()=>({aggregatedCell:e=>{var n,r;return(n=(r=e.getValue())==null||r.toString==null?void 0:r.toString())!=null?n:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Pn("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,n)=>{e.toggleGrouping=()=>{n.setGrouping(r=>r!=null&&r.includes(e.id)?r.filter(i=>i!==e.id):[...r??[],e.id])},e.getCanGroup=()=>{var r,i;return((r=e.columnDef.enableGrouping)!=null?r:!0)&&((i=n.options.enableGrouping)!=null?i:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var r;return(r=n.getState().grouping)==null?void 0:r.includes(e.id)},e.getGroupedIndex=()=>{var r;return(r=n.getState().grouping)==null?void 0:r.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const r=e.getCanGroup();return()=>{r&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const r=n.getCoreRowModel().flatRows[0],i=r?.getValue(e.id);if(typeof i=="number")return Fh.sum;if(Object.prototype.toString.call(i)==="[object Date]")return Fh.extent},e.getAggregationFn=()=>{var r,i;if(!e)throw new Error;return Xu(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(r=(i=n.options.aggregationFns)==null?void 0:i[e.columnDef.aggregationFn])!=null?r:Fh[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=n=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(n),e.resetGrouping=n=>{var r,i;e.setGrouping(n?[]:(r=(i=e.initialState)==null?void 0:i.grouping)!=null?r:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,n)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=r=>{if(e._groupingValuesCache.hasOwnProperty(r))return e._groupingValuesCache[r];const i=n.getColumn(r);return i!=null&&i.columnDef.getGroupingValue?(e._groupingValuesCache[r]=i.columnDef.getGroupingValue(e.original),e._groupingValuesCache[r]):e.getValue(r)},e._groupingValuesCache={}},createCell:(e,n,r,i)=>{e.getIsGrouped=()=>n.getIsGrouped()&&n.id===r.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&n.getIsGrouped(),e.getIsAggregated=()=>{var s;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((s=r.subRows)!=null&&s.length)}}};function u3(e,n,r){if(!(n!=null&&n.length)||!r)return e;const i=e.filter(l=>!n.includes(l.id));return r==="remove"?i:[...n.map(l=>e.find(u=>u.id===l)).filter(Boolean),...i]}const d3={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Pn("columnOrder",e)}),createColumn:(e,n)=>{e.getIndex=ke(r=>[Us(n,r)],r=>r.findIndex(i=>i.id===e.id),Le(n.options,"debugColumns")),e.getIsFirstColumn=r=>{var i;return((i=Us(n,r)[0])==null?void 0:i.id)===e.id},e.getIsLastColumn=r=>{var i;const s=Us(n,r);return((i=s[s.length-1])==null?void 0:i.id)===e.id}},createTable:e=>{e.setColumnOrder=n=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(n),e.resetColumnOrder=n=>{var r;e.setColumnOrder(n?[]:(r=e.initialState.columnOrder)!=null?r:[])},e._getOrderColumnsFn=ke(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(n,r,i)=>s=>{let l=[];if(!(n!=null&&n.length))l=s;else{const u=[...n],d=[...s];for(;d.length&&u.length;){const h=u.shift(),m=d.findIndex(y=>y.id===h);m>-1&&l.push(d.splice(m,1)[0])}l=[...l,...d]}return u3(l,r,i)},Le(e.options,"debugTable"))}},Ph=()=>({left:[],right:[]}),f3={getInitialState:e=>({columnPinning:Ph(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Pn("columnPinning",e)}),createColumn:(e,n)=>{e.pin=r=>{const i=e.getLeafColumns().map(s=>s.id).filter(Boolean);n.setColumnPinning(s=>{var l,u;if(r==="right"){var d,h;return{left:((d=s?.left)!=null?d:[]).filter(v=>!(i!=null&&i.includes(v))),right:[...((h=s?.right)!=null?h:[]).filter(v=>!(i!=null&&i.includes(v))),...i]}}if(r==="left"){var m,y;return{left:[...((m=s?.left)!=null?m:[]).filter(v=>!(i!=null&&i.includes(v))),...i],right:((y=s?.right)!=null?y:[]).filter(v=>!(i!=null&&i.includes(v)))}}return{left:((l=s?.left)!=null?l:[]).filter(v=>!(i!=null&&i.includes(v))),right:((u=s?.right)!=null?u:[]).filter(v=>!(i!=null&&i.includes(v)))}})},e.getCanPin=()=>e.getLeafColumns().some(i=>{var s,l,u;return((s=i.columnDef.enablePinning)!=null?s:!0)&&((l=(u=n.options.enableColumnPinning)!=null?u:n.options.enablePinning)!=null?l:!0)}),e.getIsPinned=()=>{const r=e.getLeafColumns().map(d=>d.id),{left:i,right:s}=n.getState().columnPinning,l=r.some(d=>i?.includes(d)),u=r.some(d=>s?.includes(d));return l?"left":u?"right":!1},e.getPinnedIndex=()=>{var r,i;const s=e.getIsPinned();return s?(r=(i=n.getState().columnPinning)==null||(i=i[s])==null?void 0:i.indexOf(e.id))!=null?r:-1:0}},createRow:(e,n)=>{e.getCenterVisibleCells=ke(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left,n.getState().columnPinning.right],(r,i,s)=>{const l=[...i??[],...s??[]];return r.filter(u=>!l.includes(u.column.id))},Le(n.options,"debugRows")),e.getLeftVisibleCells=ke(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left],(r,i)=>(i??[]).map(l=>r.find(u=>u.column.id===l)).filter(Boolean).map(l=>({...l,position:"left"})),Le(n.options,"debugRows")),e.getRightVisibleCells=ke(()=>[e._getAllVisibleCells(),n.getState().columnPinning.right],(r,i)=>(i??[]).map(l=>r.find(u=>u.column.id===l)).filter(Boolean).map(l=>({...l,position:"right"})),Le(n.options,"debugRows"))},createTable:e=>{e.setColumnPinning=n=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(n),e.resetColumnPinning=n=>{var r,i;return e.setColumnPinning(n?Ph():(r=(i=e.initialState)==null?void 0:i.columnPinning)!=null?r:Ph())},e.getIsSomeColumnsPinned=n=>{var r;const i=e.getState().columnPinning;if(!n){var s,l;return!!((s=i.left)!=null&&s.length||(l=i.right)!=null&&l.length)}return!!((r=i[n])!=null&&r.length)},e.getLeftLeafColumns=ke(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(n,r)=>(r??[]).map(i=>n.find(s=>s.id===i)).filter(Boolean),Le(e.options,"debugColumns")),e.getRightLeafColumns=ke(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(n,r)=>(r??[]).map(i=>n.find(s=>s.id===i)).filter(Boolean),Le(e.options,"debugColumns")),e.getCenterLeafColumns=ke(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,r,i)=>{const s=[...r??[],...i??[]];return n.filter(l=>!s.includes(l.id))},Le(e.options,"debugColumns"))}};function h3(e){return e||(typeof document<"u"?document:null)}const Bc={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Uh=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),m3={getDefaultColumnDef:()=>Bc,getInitialState:e=>({columnSizing:{},columnSizingInfo:Uh(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Pn("columnSizing",e),onColumnSizingInfoChange:Pn("columnSizingInfo",e)}),createColumn:(e,n)=>{e.getSize=()=>{var r,i,s;const l=n.getState().columnSizing[e.id];return Math.min(Math.max((r=e.columnDef.minSize)!=null?r:Bc.minSize,(i=l??e.columnDef.size)!=null?i:Bc.size),(s=e.columnDef.maxSize)!=null?s:Bc.maxSize)},e.getStart=ke(r=>[r,Us(n,r),n.getState().columnSizing],(r,i)=>i.slice(0,e.getIndex(r)).reduce((s,l)=>s+l.getSize(),0),Le(n.options,"debugColumns")),e.getAfter=ke(r=>[r,Us(n,r),n.getState().columnSizing],(r,i)=>i.slice(e.getIndex(r)+1).reduce((s,l)=>s+l.getSize(),0),Le(n.options,"debugColumns")),e.resetSize=()=>{n.setColumnSizing(r=>{let{[e.id]:i,...s}=r;return s})},e.getCanResize=()=>{var r,i;return((r=e.columnDef.enableResizing)!=null?r:!0)&&((i=n.options.enableColumnResizing)!=null?i:!0)},e.getIsResizing=()=>n.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,n)=>{e.getSize=()=>{let r=0;const i=s=>{if(s.subHeaders.length)s.subHeaders.forEach(i);else{var l;r+=(l=s.column.getSize())!=null?l:0}};return i(e),r},e.getStart=()=>{if(e.index>0){const r=e.headerGroup.headers[e.index-1];return r.getStart()+r.getSize()}return 0},e.getResizeHandler=r=>{const i=n.getColumn(e.column.id),s=i?.getCanResize();return l=>{if(!i||!s||(l.persist==null||l.persist(),Hh(l)&&l.touches&&l.touches.length>1))return;const u=e.getSize(),d=e?e.getLeafHeaders().map(T=>[T.column.id,T.column.getSize()]):[[i.id,i.getSize()]],h=Hh(l)?Math.round(l.touches[0].clientX):l.clientX,m={},y=(T,O)=>{typeof O=="number"&&(n.setColumnSizingInfo(A=>{var k,L;const q=n.options.columnResizeDirection==="rtl"?-1:1,H=(O-((k=A?.startOffset)!=null?k:0))*q,I=Math.max(H/((L=A?.startSize)!=null?L:0),-.999999);return A.columnSizingStart.forEach(he=>{let[ve,de]=he;m[ve]=Math.round(Math.max(de+de*I,0)*100)/100}),{...A,deltaOffset:H,deltaPercentage:I}}),(n.options.columnResizeMode==="onChange"||T==="end")&&n.setColumnSizing(A=>({...A,...m})))},v=T=>y("move",T),b=T=>{y("end",T),n.setColumnSizingInfo(O=>({...O,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},x=h3(r),C={moveHandler:T=>v(T.clientX),upHandler:T=>{x?.removeEventListener("mousemove",C.moveHandler),x?.removeEventListener("mouseup",C.upHandler),b(T.clientX)}},_={moveHandler:T=>(T.cancelable&&(T.preventDefault(),T.stopPropagation()),v(T.touches[0].clientX),!1),upHandler:T=>{var O;x?.removeEventListener("touchmove",_.moveHandler),x?.removeEventListener("touchend",_.upHandler),T.cancelable&&(T.preventDefault(),T.stopPropagation()),b((O=T.touches[0])==null?void 0:O.clientX)}},E=p3()?{passive:!1}:!1;Hh(l)?(x?.addEventListener("touchmove",_.moveHandler,E),x?.addEventListener("touchend",_.upHandler,E)):(x?.addEventListener("mousemove",C.moveHandler,E),x?.addEventListener("mouseup",C.upHandler,E)),n.setColumnSizingInfo(T=>({...T,startOffset:h,startSize:u,deltaOffset:0,deltaPercentage:0,columnSizingStart:d,isResizingColumn:i.id}))}}},createTable:e=>{e.setColumnSizing=n=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(n),e.setColumnSizingInfo=n=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(n),e.resetColumnSizing=n=>{var r;e.setColumnSizing(n?{}:(r=e.initialState.columnSizing)!=null?r:{})},e.resetHeaderSizeInfo=n=>{var r;e.setColumnSizingInfo(n?Uh():(r=e.initialState.columnSizingInfo)!=null?r:Uh())},e.getTotalSize=()=>{var n,r;return(n=(r=e.getHeaderGroups()[0])==null?void 0:r.headers.reduce((i,s)=>i+s.getSize(),0))!=null?n:0},e.getLeftTotalSize=()=>{var n,r;return(n=(r=e.getLeftHeaderGroups()[0])==null?void 0:r.headers.reduce((i,s)=>i+s.getSize(),0))!=null?n:0},e.getCenterTotalSize=()=>{var n,r;return(n=(r=e.getCenterHeaderGroups()[0])==null?void 0:r.headers.reduce((i,s)=>i+s.getSize(),0))!=null?n:0},e.getRightTotalSize=()=>{var n,r;return(n=(r=e.getRightHeaderGroups()[0])==null?void 0:r.headers.reduce((i,s)=>i+s.getSize(),0))!=null?n:0}}};let qc=null;function p3(){if(typeof qc=="boolean")return qc;let e=!1;try{const n={get passive(){return e=!0,!1}},r=()=>{};window.addEventListener("test",r,n),window.removeEventListener("test",r)}catch{e=!1}return qc=e,qc}function Hh(e){return e.type==="touchstart"}const g3={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Pn("columnVisibility",e)}),createColumn:(e,n)=>{e.toggleVisibility=r=>{e.getCanHide()&&n.setColumnVisibility(i=>({...i,[e.id]:r??!e.getIsVisible()}))},e.getIsVisible=()=>{var r,i;const s=e.columns;return(r=s.length?s.some(l=>l.getIsVisible()):(i=n.getState().columnVisibility)==null?void 0:i[e.id])!=null?r:!0},e.getCanHide=()=>{var r,i;return((r=e.columnDef.enableHiding)!=null?r:!0)&&((i=n.options.enableHiding)!=null?i:!0)},e.getToggleVisibilityHandler=()=>r=>{e.toggleVisibility==null||e.toggleVisibility(r.target.checked)}},createRow:(e,n)=>{e._getAllVisibleCells=ke(()=>[e.getAllCells(),n.getState().columnVisibility],r=>r.filter(i=>i.column.getIsVisible()),Le(n.options,"debugRows")),e.getVisibleCells=ke(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(r,i,s)=>[...r,...i,...s],Le(n.options,"debugRows"))},createTable:e=>{const n=(r,i)=>ke(()=>[i(),i().filter(s=>s.getIsVisible()).map(s=>s.id).join("_")],s=>s.filter(l=>l.getIsVisible==null?void 0:l.getIsVisible()),Le(e.options,"debugColumns"));e.getVisibleFlatColumns=n("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=n("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=n("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=n("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=n("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=r=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(r),e.resetColumnVisibility=r=>{var i;e.setColumnVisibility(r?{}:(i=e.initialState.columnVisibility)!=null?i:{})},e.toggleAllColumnsVisible=r=>{var i;r=(i=r)!=null?i:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((s,l)=>({...s,[l.id]:r||!(l.getCanHide!=null&&l.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(r=>!(r.getIsVisible!=null&&r.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(r=>r.getIsVisible==null?void 0:r.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>r=>{var i;e.toggleAllColumnsVisible((i=r.target)==null?void 0:i.checked)}}};function Us(e,n){return n?n==="center"?e.getCenterVisibleLeafColumns():n==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const v3={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},y3={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Pn("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:n=>{var r;const i=(r=e.getCoreRowModel().flatRows[0])==null||(r=r._getAllCellsByColumnId()[n.id])==null?void 0:r.getValue();return typeof i=="string"||typeof i=="number"}}),createColumn:(e,n)=>{e.getCanGlobalFilter=()=>{var r,i,s,l;return((r=e.columnDef.enableGlobalFilter)!=null?r:!0)&&((i=n.options.enableGlobalFilter)!=null?i:!0)&&((s=n.options.enableFilters)!=null?s:!0)&&((l=n.options.getColumnCanGlobalFilter==null?void 0:n.options.getColumnCanGlobalFilter(e))!=null?l:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>Qr.includesString,e.getGlobalFilterFn=()=>{var n,r;const{globalFilterFn:i}=e.options;return Xu(i)?i:i==="auto"?e.getGlobalAutoFilterFn():(n=(r=e.options.filterFns)==null?void 0:r[i])!=null?n:Qr[i]},e.setGlobalFilter=n=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(n)},e.resetGlobalFilter=n=>{e.setGlobalFilter(n?void 0:e.initialState.globalFilter)}}},b3={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Pn("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let n=!1,r=!1;e._autoResetExpanded=()=>{var i,s;if(!n){e._queue(()=>{n=!0});return}if((i=(s=e.options.autoResetAll)!=null?s:e.options.autoResetExpanded)!=null?i:!e.options.manualExpanding){if(r)return;r=!0,e._queue(()=>{e.resetExpanded(),r=!1})}},e.setExpanded=i=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(i),e.toggleAllRowsExpanded=i=>{i??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=i=>{var s,l;e.setExpanded(i?{}:(s=(l=e.initialState)==null?void 0:l.expanded)!=null?s:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(i=>i.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>i=>{i.persist==null||i.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const i=e.getState().expanded;return i===!0||Object.values(i).some(Boolean)},e.getIsAllRowsExpanded=()=>{const i=e.getState().expanded;return typeof i=="boolean"?i===!0:!(!Object.keys(i).length||e.getRowModel().flatRows.some(s=>!s.getIsExpanded()))},e.getExpandedDepth=()=>{let i=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(l=>{const u=l.split(".");i=Math.max(i,u.length)}),i},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,n)=>{e.toggleExpanded=r=>{n.setExpanded(i=>{var s;const l=i===!0?!0:!!(i!=null&&i[e.id]);let u={};if(i===!0?Object.keys(n.getRowModel().rowsById).forEach(d=>{u[d]=!0}):u=i,r=(s=r)!=null?s:!l,!l&&r)return{...u,[e.id]:!0};if(l&&!r){const{[e.id]:d,...h}=u;return h}return i})},e.getIsExpanded=()=>{var r;const i=n.getState().expanded;return!!((r=n.options.getIsRowExpanded==null?void 0:n.options.getIsRowExpanded(e))!=null?r:i===!0||i?.[e.id])},e.getCanExpand=()=>{var r,i,s;return(r=n.options.getRowCanExpand==null?void 0:n.options.getRowCanExpand(e))!=null?r:((i=n.options.enableExpanding)!=null?i:!0)&&!!((s=e.subRows)!=null&&s.length)},e.getIsAllParentsExpanded=()=>{let r=!0,i=e;for(;r&&i.parentId;)i=n.getRow(i.parentId,!0),r=i.getIsExpanded();return r},e.getToggleExpandedHandler=()=>{const r=e.getCanExpand();return()=>{r&&e.toggleExpanded()}}}},Om=0,Am=10,Bh=()=>({pageIndex:Om,pageSize:Am}),x3={getInitialState:e=>({...e,pagination:{...Bh(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:Pn("pagination",e)}),createTable:e=>{let n=!1,r=!1;e._autoResetPageIndex=()=>{var i,s;if(!n){e._queue(()=>{n=!0});return}if((i=(s=e.options.autoResetAll)!=null?s:e.options.autoResetPageIndex)!=null?i:!e.options.manualPagination){if(r)return;r=!0,e._queue(()=>{e.resetPageIndex(),r=!1})}},e.setPagination=i=>{const s=l=>Mo(i,l);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(s)},e.resetPagination=i=>{var s;e.setPagination(i?Bh():(s=e.initialState.pagination)!=null?s:Bh())},e.setPageIndex=i=>{e.setPagination(s=>{let l=Mo(i,s.pageIndex);const u=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return l=Math.max(0,Math.min(l,u)),{...s,pageIndex:l}})},e.resetPageIndex=i=>{var s,l;e.setPageIndex(i?Om:(s=(l=e.initialState)==null||(l=l.pagination)==null?void 0:l.pageIndex)!=null?s:Om)},e.resetPageSize=i=>{var s,l;e.setPageSize(i?Am:(s=(l=e.initialState)==null||(l=l.pagination)==null?void 0:l.pageSize)!=null?s:Am)},e.setPageSize=i=>{e.setPagination(s=>{const l=Math.max(1,Mo(i,s.pageSize)),u=s.pageSize*s.pageIndex,d=Math.floor(u/l);return{...s,pageIndex:d,pageSize:l}})},e.setPageCount=i=>e.setPagination(s=>{var l;let u=Mo(i,(l=e.options.pageCount)!=null?l:-1);return typeof u=="number"&&(u=Math.max(-1,u)),{...s,pageCount:u}}),e.getPageOptions=ke(()=>[e.getPageCount()],i=>{let s=[];return i&&i>0&&(s=[...new Array(i)].fill(null).map((l,u)=>u)),s},Le(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:i}=e.getState().pagination,s=e.getPageCount();return s===-1?!0:s===0?!1:ie.setPageIndex(i=>i-1),e.nextPage=()=>e.setPageIndex(i=>i+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var i;return(i=e.options.pageCount)!=null?i:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var i;return(i=e.options.rowCount)!=null?i:e.getPrePaginationRowModel().rows.length}}},qh=()=>({top:[],bottom:[]}),S3={getInitialState:e=>({rowPinning:qh(),...e}),getDefaultOptions:e=>({onRowPinningChange:Pn("rowPinning",e)}),createRow:(e,n)=>{e.pin=(r,i,s)=>{const l=i?e.getLeafRows().map(h=>{let{id:m}=h;return m}):[],u=s?e.getParentRows().map(h=>{let{id:m}=h;return m}):[],d=new Set([...u,e.id,...l]);n.setRowPinning(h=>{var m,y;if(r==="bottom"){var v,b;return{top:((v=h?.top)!=null?v:[]).filter(_=>!(d!=null&&d.has(_))),bottom:[...((b=h?.bottom)!=null?b:[]).filter(_=>!(d!=null&&d.has(_))),...Array.from(d)]}}if(r==="top"){var x,C;return{top:[...((x=h?.top)!=null?x:[]).filter(_=>!(d!=null&&d.has(_))),...Array.from(d)],bottom:((C=h?.bottom)!=null?C:[]).filter(_=>!(d!=null&&d.has(_)))}}return{top:((m=h?.top)!=null?m:[]).filter(_=>!(d!=null&&d.has(_))),bottom:((y=h?.bottom)!=null?y:[]).filter(_=>!(d!=null&&d.has(_)))}})},e.getCanPin=()=>{var r;const{enableRowPinning:i,enablePinning:s}=n.options;return typeof i=="function"?i(e):(r=i??s)!=null?r:!0},e.getIsPinned=()=>{const r=[e.id],{top:i,bottom:s}=n.getState().rowPinning,l=r.some(d=>i?.includes(d)),u=r.some(d=>s?.includes(d));return l?"top":u?"bottom":!1},e.getPinnedIndex=()=>{var r,i;const s=e.getIsPinned();if(!s)return-1;const l=(r=s==="top"?n.getTopRows():n.getBottomRows())==null?void 0:r.map(u=>{let{id:d}=u;return d});return(i=l?.indexOf(e.id))!=null?i:-1}},createTable:e=>{e.setRowPinning=n=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(n),e.resetRowPinning=n=>{var r,i;return e.setRowPinning(n?qh():(r=(i=e.initialState)==null?void 0:i.rowPinning)!=null?r:qh())},e.getIsSomeRowsPinned=n=>{var r;const i=e.getState().rowPinning;if(!n){var s,l;return!!((s=i.top)!=null&&s.length||(l=i.bottom)!=null&&l.length)}return!!((r=i[n])!=null&&r.length)},e._getPinnedRows=(n,r,i)=>{var s;return((s=e.options.keepPinnedRows)==null||s?(r??[]).map(u=>{const d=e.getRow(u,!0);return d.getIsAllParentsExpanded()?d:null}):(r??[]).map(u=>n.find(d=>d.id===u))).filter(Boolean).map(u=>({...u,position:i}))},e.getTopRows=ke(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(n,r)=>e._getPinnedRows(n,r,"top"),Le(e.options,"debugRows")),e.getBottomRows=ke(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(n,r)=>e._getPinnedRows(n,r,"bottom"),Le(e.options,"debugRows")),e.getCenterRows=ke(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(n,r,i)=>{const s=new Set([...r??[],...i??[]]);return n.filter(l=>!s.has(l.id))},Le(e.options,"debugRows"))}},w3={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Pn("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=n=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(n),e.resetRowSelection=n=>{var r;return e.setRowSelection(n?{}:(r=e.initialState.rowSelection)!=null?r:{})},e.toggleAllRowsSelected=n=>{e.setRowSelection(r=>{n=typeof n<"u"?n:!e.getIsAllRowsSelected();const i={...r},s=e.getPreGroupedRowModel().flatRows;return n?s.forEach(l=>{l.getCanSelect()&&(i[l.id]=!0)}):s.forEach(l=>{delete i[l.id]}),i})},e.toggleAllPageRowsSelected=n=>e.setRowSelection(r=>{const i=typeof n<"u"?n:!e.getIsAllPageRowsSelected(),s={...r};return e.getRowModel().rows.forEach(l=>{Mm(s,l.id,i,!0,e)}),s}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=ke(()=>[e.getState().rowSelection,e.getCoreRowModel()],(n,r)=>Object.keys(n).length?Gh(e,r):{rows:[],flatRows:[],rowsById:{}},Le(e.options,"debugTable")),e.getFilteredSelectedRowModel=ke(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(n,r)=>Object.keys(n).length?Gh(e,r):{rows:[],flatRows:[],rowsById:{}},Le(e.options,"debugTable")),e.getGroupedSelectedRowModel=ke(()=>[e.getState().rowSelection,e.getSortedRowModel()],(n,r)=>Object.keys(n).length?Gh(e,r):{rows:[],flatRows:[],rowsById:{}},Le(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const n=e.getFilteredRowModel().flatRows,{rowSelection:r}=e.getState();let i=!!(n.length&&Object.keys(r).length);return i&&n.some(s=>s.getCanSelect()&&!r[s.id])&&(i=!1),i},e.getIsAllPageRowsSelected=()=>{const n=e.getPaginationRowModel().flatRows.filter(s=>s.getCanSelect()),{rowSelection:r}=e.getState();let i=!!n.length;return i&&n.some(s=>!r[s.id])&&(i=!1),i},e.getIsSomeRowsSelected=()=>{var n;const r=Object.keys((n=e.getState().rowSelection)!=null?n:{}).length;return r>0&&r{const n=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:n.filter(r=>r.getCanSelect()).some(r=>r.getIsSelected()||r.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>n=>{e.toggleAllRowsSelected(n.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>n=>{e.toggleAllPageRowsSelected(n.target.checked)}},createRow:(e,n)=>{e.toggleSelected=(r,i)=>{const s=e.getIsSelected();n.setRowSelection(l=>{var u;if(r=typeof r<"u"?r:!s,e.getCanSelect()&&s===r)return l;const d={...l};return Mm(d,e.id,r,(u=i?.selectChildren)!=null?u:!0,n),d})},e.getIsSelected=()=>{const{rowSelection:r}=n.getState();return Up(e,r)},e.getIsSomeSelected=()=>{const{rowSelection:r}=n.getState();return jm(e,r)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:r}=n.getState();return jm(e,r)==="all"},e.getCanSelect=()=>{var r;return typeof n.options.enableRowSelection=="function"?n.options.enableRowSelection(e):(r=n.options.enableRowSelection)!=null?r:!0},e.getCanSelectSubRows=()=>{var r;return typeof n.options.enableSubRowSelection=="function"?n.options.enableSubRowSelection(e):(r=n.options.enableSubRowSelection)!=null?r:!0},e.getCanMultiSelect=()=>{var r;return typeof n.options.enableMultiRowSelection=="function"?n.options.enableMultiRowSelection(e):(r=n.options.enableMultiRowSelection)!=null?r:!0},e.getToggleSelectedHandler=()=>{const r=e.getCanSelect();return i=>{var s;r&&e.toggleSelected((s=i.target)==null?void 0:s.checked)}}}},Mm=(e,n,r,i,s)=>{var l;const u=s.getRow(n,!0);r?(u.getCanMultiSelect()||Object.keys(e).forEach(d=>delete e[d]),u.getCanSelect()&&(e[n]=!0)):delete e[n],i&&(l=u.subRows)!=null&&l.length&&u.getCanSelectSubRows()&&u.subRows.forEach(d=>Mm(e,d.id,r,i,s))};function Gh(e,n){const r=e.getState().rowSelection,i=[],s={},l=function(u,d){return u.map(h=>{var m;const y=Up(h,r);if(y&&(i.push(h),s[h.id]=h),(m=h.subRows)!=null&&m.length&&(h={...h,subRows:l(h.subRows)}),y)return h}).filter(Boolean)};return{rows:l(n.rows),flatRows:i,rowsById:s}}function Up(e,n){var r;return(r=n[e.id])!=null?r:!1}function jm(e,n,r){var i;if(!((i=e.subRows)!=null&&i.length))return!1;let s=!0,l=!1;return e.subRows.forEach(u=>{if(!(l&&!s)&&(u.getCanSelect()&&(Up(u,n)?l=!0:s=!1),u.subRows&&u.subRows.length)){const d=jm(u,n);d==="all"?l=!0:(d==="some"&&(l=!0),s=!1)}}),s?"all":l?"some":!1}const Nm=/([0-9]+)/gm,_3=(e,n,r)=>y_(Lo(e.getValue(r)).toLowerCase(),Lo(n.getValue(r)).toLowerCase()),C3=(e,n,r)=>y_(Lo(e.getValue(r)),Lo(n.getValue(r))),E3=(e,n,r)=>Hp(Lo(e.getValue(r)).toLowerCase(),Lo(n.getValue(r)).toLowerCase()),R3=(e,n,r)=>Hp(Lo(e.getValue(r)),Lo(n.getValue(r))),T3=(e,n,r)=>{const i=e.getValue(r),s=n.getValue(r);return i>s?1:iHp(e.getValue(r),n.getValue(r));function Hp(e,n){return e===n?0:e>n?1:-1}function Lo(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function y_(e,n){const r=e.split(Nm).filter(Boolean),i=n.split(Nm).filter(Boolean);for(;r.length&&i.length;){const s=r.shift(),l=i.shift(),u=parseInt(s,10),d=parseInt(l,10),h=[u,d].sort();if(isNaN(h[0])){if(s>l)return 1;if(l>s)return-1;continue}if(isNaN(h[1]))return isNaN(u)?-1:1;if(u>d)return 1;if(d>u)return-1}return r.length-i.length}const zs={alphanumeric:_3,alphanumericCaseSensitive:C3,text:E3,textCaseSensitive:R3,datetime:T3,basic:O3},A3={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Pn("sorting",e),isMultiSortEvent:n=>n.shiftKey}),createColumn:(e,n)=>{e.getAutoSortingFn=()=>{const r=n.getFilteredRowModel().flatRows.slice(10);let i=!1;for(const s of r){const l=s?.getValue(e.id);if(Object.prototype.toString.call(l)==="[object Date]")return zs.datetime;if(typeof l=="string"&&(i=!0,l.split(Nm).length>1))return zs.alphanumeric}return i?zs.text:zs.basic},e.getAutoSortDir=()=>{const r=n.getFilteredRowModel().flatRows[0];return typeof r?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var r,i;if(!e)throw new Error;return Xu(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(r=(i=n.options.sortingFns)==null?void 0:i[e.columnDef.sortingFn])!=null?r:zs[e.columnDef.sortingFn]},e.toggleSorting=(r,i)=>{const s=e.getNextSortingOrder(),l=typeof r<"u"&&r!==null;n.setSorting(u=>{const d=u?.find(x=>x.id===e.id),h=u?.findIndex(x=>x.id===e.id);let m=[],y,v=l?r:s==="desc";if(u!=null&&u.length&&e.getCanMultiSort()&&i?d?y="toggle":y="add":u!=null&&u.length&&h!==u.length-1?y="replace":d?y="toggle":y="replace",y==="toggle"&&(l||s||(y="remove")),y==="add"){var b;m=[...u,{id:e.id,desc:v}],m.splice(0,m.length-((b=n.options.maxMultiSortColCount)!=null?b:Number.MAX_SAFE_INTEGER))}else y==="toggle"?m=u.map(x=>x.id===e.id?{...x,desc:v}:x):y==="remove"?m=u.filter(x=>x.id!==e.id):m=[{id:e.id,desc:v}];return m})},e.getFirstSortDir=()=>{var r,i;return((r=(i=e.columnDef.sortDescFirst)!=null?i:n.options.sortDescFirst)!=null?r:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=r=>{var i,s;const l=e.getFirstSortDir(),u=e.getIsSorted();return u?u!==l&&((i=n.options.enableSortingRemoval)==null||i)&&(!(r&&(s=n.options.enableMultiRemove)!=null)||s)?!1:u==="desc"?"asc":"desc":l},e.getCanSort=()=>{var r,i;return((r=e.columnDef.enableSorting)!=null?r:!0)&&((i=n.options.enableSorting)!=null?i:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var r,i;return(r=(i=e.columnDef.enableMultiSort)!=null?i:n.options.enableMultiSort)!=null?r:!!e.accessorFn},e.getIsSorted=()=>{var r;const i=(r=n.getState().sorting)==null?void 0:r.find(s=>s.id===e.id);return i?i.desc?"desc":"asc":!1},e.getSortIndex=()=>{var r,i;return(r=(i=n.getState().sorting)==null?void 0:i.findIndex(s=>s.id===e.id))!=null?r:-1},e.clearSorting=()=>{n.setSorting(r=>r!=null&&r.length?r.filter(i=>i.id!==e.id):[])},e.getToggleSortingHandler=()=>{const r=e.getCanSort();return i=>{r&&(i.persist==null||i.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?n.options.isMultiSortEvent==null?void 0:n.options.isMultiSortEvent(i):!1))}}},createTable:e=>{e.setSorting=n=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(n),e.resetSorting=n=>{var r,i;e.setSorting(n?[]:(r=(i=e.initialState)==null?void 0:i.sorting)!=null?r:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},M3=[Qk,g3,d3,f3,Jk,Wk,v3,y3,A3,c3,b3,x3,S3,w3,m3];function j3(e){var n,r;const i=[...M3,...(n=e._features)!=null?n:[]];let s={_features:i};const l=s._features.reduce((b,x)=>Object.assign(b,x.getDefaultOptions==null?void 0:x.getDefaultOptions(s)),{}),u=b=>s.options.mergeOptions?s.options.mergeOptions(l,b):{...l,...b};let h={...{},...(r=e.initialState)!=null?r:{}};s._features.forEach(b=>{var x;h=(x=b.getInitialState==null?void 0:b.getInitialState(h))!=null?x:h});const m=[];let y=!1;const v={_features:i,options:{...l,...e},initialState:h,_queue:b=>{m.push(b),y||(y=!0,Promise.resolve().then(()=>{for(;m.length;)m.shift()();y=!1}).catch(x=>setTimeout(()=>{throw x})))},reset:()=>{s.setState(s.initialState)},setOptions:b=>{const x=Mo(b,s.options);s.options=u(x)},getState:()=>s.options.state,setState:b=>{s.options.onStateChange==null||s.options.onStateChange(b)},_getRowId:(b,x,C)=>{var _;return(_=s.options.getRowId==null?void 0:s.options.getRowId(b,x,C))!=null?_:`${C?[C.id,x].join("."):x}`},getCoreRowModel:()=>(s._getCoreRowModel||(s._getCoreRowModel=s.options.getCoreRowModel(s)),s._getCoreRowModel()),getRowModel:()=>s.getPaginationRowModel(),getRow:(b,x)=>{let C=(x?s.getPrePaginationRowModel():s.getRowModel()).rowsById[b];if(!C&&(C=s.getCoreRowModel().rowsById[b],!C))throw new Error;return C},_getDefaultColumnDef:ke(()=>[s.options.defaultColumn],b=>{var x;return b=(x=b)!=null?x:{},{header:C=>{const _=C.header.column.columnDef;return _.accessorKey?_.accessorKey:_.accessorFn?_.id:null},cell:C=>{var _,E;return(_=(E=C.renderValue())==null||E.toString==null?void 0:E.toString())!=null?_:null},...s._features.reduce((C,_)=>Object.assign(C,_.getDefaultColumnDef==null?void 0:_.getDefaultColumnDef()),{}),...b}},Le(e,"debugColumns")),_getColumnDefs:()=>s.options.columns,getAllColumns:ke(()=>[s._getColumnDefs()],b=>{const x=function(C,_,E){return E===void 0&&(E=0),C.map(T=>{const O=Yk(s,T,E,_),A=T;return O.columns=A.columns?x(A.columns,O,E+1):[],O})};return x(b)},Le(e,"debugColumns")),getAllFlatColumns:ke(()=>[s.getAllColumns()],b=>b.flatMap(x=>x.getFlatColumns()),Le(e,"debugColumns")),_getAllFlatColumnsById:ke(()=>[s.getAllFlatColumns()],b=>b.reduce((x,C)=>(x[C.id]=C,x),{}),Le(e,"debugColumns")),getAllLeafColumns:ke(()=>[s.getAllColumns(),s._getOrderColumnsFn()],(b,x)=>{let C=b.flatMap(_=>_.getLeafColumns());return x(C)},Le(e,"debugColumns")),getColumn:b=>s._getAllFlatColumnsById()[b]};Object.assign(s,v);for(let b=0;bke(()=>[e.options.data],n=>{const r={rows:[],flatRows:[],rowsById:{}},i=function(s,l,u){l===void 0&&(l=0);const d=[];for(let m=0;me._autoResetPageIndex()))}function x_(){return e=>ke(()=>[e.getState().sorting,e.getPreSortedRowModel()],(n,r)=>{if(!r.rows.length||!(n!=null&&n.length))return r;const i=e.getState().sorting,s=[],l=i.filter(h=>{var m;return(m=e.getColumn(h.id))==null?void 0:m.getCanSort()}),u={};l.forEach(h=>{const m=e.getColumn(h.id);m&&(u[h.id]={sortUndefined:m.columnDef.sortUndefined,invertSorting:m.columnDef.invertSorting,sortingFn:m.getSortingFn()})});const d=h=>{const m=h.map(y=>({...y}));return m.sort((y,v)=>{for(let x=0;x{var v;s.push(y),(v=y.subRows)!=null&&v.length&&(y.subRows=d(y.subRows))}),m};return{rows:d(r.rows),flatRows:s,rowsById:r.rowsById}},Le(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function yu(e,n){return e?N3(e)?S.createElement(e,n):e:null}function N3(e){return z3(e)||typeof e=="function"||D3(e)}function z3(e){return typeof e=="function"&&(()=>{const n=Object.getPrototypeOf(e);return n.prototype&&n.prototype.isReactComponent})()}function D3(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function S_(e){const n={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[r]=S.useState(()=>({current:j3(n)})),[i,s]=S.useState(()=>r.current.initialState);return r.current.setOptions(l=>({...l,...e,state:{...i,...e.state},onStateChange:u=>{s(u),e.onStateChange==null||e.onStateChange(u)}})),r.current}var gl=e=>e.type==="checkbox",jo=e=>e instanceof Date,an=e=>e==null;const Bp=e=>typeof e=="object";var Tt=e=>!an(e)&&!Array.isArray(e)&&Bp(e)&&!jo(e),k3=e=>Tt(e)&&e.target?gl(e.target)?e.target.checked:e.target.value:e,L3=(e,n)=>n.split(".").some((r,i,s)=>!isNaN(Number(r))&&e.has(s.slice(0,i).join("."))),w_=e=>{const n=e.constructor&&e.constructor.prototype;return Tt(n)&&n.hasOwnProperty("isPrototypeOf")},Ju=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Mt(e){if(e instanceof Date)return new Date(e);const n=typeof FileList<"u"&&e instanceof FileList;if(Ju&&(e instanceof Blob||n))return e;const r=Array.isArray(e);if(!r&&!(Tt(e)&&w_(e)))return e;const i=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(i[s]=Mt(e[s]));return i}const va={BLUR:"blur",FOCUS_OUT:"focusout",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},mr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},fr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},__="root",qp=["__proto__","constructor","prototype"],$3=/^\w*$/;var vl=e=>$3.test(e),yt=e=>e===void 0;const I3=/[.[\]'"]/;var Wu=e=>e.split(I3).filter(Boolean),we=(e,n,r)=>{if(!n||!Tt(e))return r;const i=vl(n)?[n]:Wu(n);if(i.some(l=>qp.includes(l)))return r;const s=i.reduce((l,u)=>an(l)?void 0:l[u],e);return yt(s)||s===e?yt(e[n])?r:e[n]:s},Cr=e=>typeof e=="boolean",Wn=e=>typeof e=="function",ft=(e,n,r)=>{let i=-1;const s=vl(n)?[n]:Wu(n),l=s.length,u=l-1;for(;++i{const s={};for(const l in e)Object.defineProperty(s,l,{get:()=>{const u=l;return n._proxyFormState[u]!==mr.all&&(n._proxyFormState[u]=!i||mr.all),e[u]}});return s};const P3=Ju?fe.useLayoutEffect:fe.useEffect;var ln=e=>typeof e=="string",U3=(e,n,r,i,s)=>ln(e)?(i&&n.watch.add(e),we(r,e,s)):Array.isArray(e)?e.map(l=>(i&&n.watch.add(l),we(r,l))):(i&&(n.watchAll=!0),r),zm=e=>an(e)||!Bp(e);const rx=(e,n)=>n.length===0&&!Array.isArray(e)&&!w_(e);function Er(e,n,r=new WeakMap){if(e===n)return!0;if(zm(e)||zm(n))return Object.is(e,n);if(jo(e)&&jo(n))return Object.is(e.getTime(),n.getTime());const i=Object.keys(e),s=Object.keys(n);if(i.length!==s.length)return!1;if(rx(e,i)||rx(n,s))return Object.is(e,n);if(!i.length&&Array.isArray(e)!==Array.isArray(n))return!1;const l=r.get(e);if(l&&l.has(n))return!0;if(l)l.add(n);else{const u=new WeakSet;u.add(n),r.set(e,u)}for(const u of i){const d=e[u];if(!(u in n))return!1;if(u!=="ref"){const h=n[u];if(jo(d)&&jo(h)||(Tt(d)||Array.isArray(d))&&(Tt(h)||Array.isArray(h))?!Er(d,h,r):!Object.is(d,h))return!1}}return!0}var Gc=e=>({isOnSubmit:!e||e===mr.onSubmit,isOnBlur:e===mr.onBlur,isOnChange:e===mr.onChange,isOnAll:e===mr.all,isOnTouch:e===mr.onTouched}),Zh=(e,n,r)=>{if(r)return!1;if(n.watchAll||n.watch.has(e))return!0;for(const i of n.watch)if(e.startsWith(i)&&e.charAt(i.length)===".")return!0;return!1};const Hs=(e,n,r,i)=>{for(const s of r||Object.keys(e)){const l=we(e,s);if(l){const{_f:u,...d}=l;if(u){if(u.refs&&u.refs[0]&&n(u.refs[0],s)&&!i)return!0;if(u.ref&&n(u.ref,u.name)&&!i)return!0;if(Hs(d,n))break}else if(Tt(d)&&Hs(d,n))break}}};var ox=(e,n,r)=>{const i=we(e,r),s=Array.isArray(i)?i:[];return ft(s,__,n[r]),ft(e,r,s),e},on=e=>Tt(e)&&!Object.keys(e).length,Gp=e=>e.type==="file",bu=e=>{if(!Ju)return!1;const n=e?e.ownerDocument:0;return e instanceof(n&&n.defaultView?n.defaultView.HTMLElement:HTMLElement)},Zp=e=>e.type==="radio",xu=e=>e instanceof RegExp,Kp=(e,n,r,i,s)=>n?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[i]:s||!0}}:{};const ix={value:!1,isValid:!1},ax={value:!0,isValid:!0};var C_=e=>{if(Array.isArray(e)){if(e.length>1){const n=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:n,isValid:!!n.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!yt(e[0].attributes.value)?yt(e[0].value)||e[0].value===""?ax:{value:e[0].value,isValid:!0}:ax:ix}return ix};const sx={isValid:!1,value:null};var E_=e=>Array.isArray(e)?e.reduce((n,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:n,sx):sx;function lx(e,n,r="validate"){if(ln(e)||Array.isArray(e)&&e.every(ln)||Cr(e)&&!e)return{type:r,message:ln(e)?e:"",ref:n}}var ya=e=>Tt(e)&&!xu(e)?e:{value:e,message:""},cx=async(e,n,r,i,s,l)=>{const{ref:u,refs:d,required:h,maxLength:m,minLength:y,min:v,max:b,pattern:x,validate:C,name:_,valueAsNumber:E,mount:T}=e._f,O=we(r,_);if(!T||n.has(_))return{};const A=d?d[0]:u,k=le=>{if(s&&A.reportValidity){const ae=Cr(le)?"":le||"";d?d.forEach(me=>me.setCustomValidity(ae)):A.setCustomValidity(ae),A.reportValidity()}},L={},q=Zp(u),H=gl(u),I=q||H,he=(E||Gp(u))&&yt(u.value)&&yt(O)||bu(u)&&u.value===""||O===""||Array.isArray(O)&&!O.length,ve=Kp.bind(null,_,i,L),de=(le,ae,me,ye=fr.maxLength,D=fr.minLength)=>{const Y=le?ae:me;L[_]={type:le?ye:D,message:Y,ref:u,...ve(le?ye:D,Y)}};if(l?!Array.isArray(O)||!O.length:h&&(!I&&(he||an(O))||Cr(O)&&!O||H&&!C_(d).isValid||q&&!E_(d).isValid)){const{value:le,message:ae}=ln(h)?{value:!!h,message:h}:ya(h);if(le&&(L[_]={type:fr.required,message:ae,ref:A,...ve(fr.required,ae)},!i))return k(ae),L}if(!he&&(!an(v)||!an(b))){let le,ae;const me=ya(b),ye=ya(v);if(!an(O)&&!isNaN(O)){const D=u.valueAsNumber||O&&+O;an(me.value)||(le=D>me.value),an(ye.value)||(ae=Dnew Date(new Date().toDateString()+" "+W),ne=u.type=="time",J=u.type=="week";ln(me.value)&&O&&(le=ne?Y(O)>Y(me.value):J?O>me.value:D>new Date(me.value)),ln(ye.value)&&O&&(ae=ne?Y(O)+le.value,ye=!an(ae.value)&&O.length<+ae.value;if((me||ye)&&(de(me,le.message,ae.message),!i))return k(L[_].message),L}if(x&&!he&&ln(O)){const{value:le,message:ae}=ya(x);if(xu(le)&&!O.match(le)&&(L[_]={type:fr.pattern,message:ae,ref:u,...ve(fr.pattern,ae)},!i))return k(ae),L}if(C){if(Wn(C)){const le=await C(O,r),ae=lx(le,A);if(ae&&(L[_]={...ae,...ve(fr.validate,ae.message)},!i))return k(ae.message),L}else if(Tt(C)){let le={};for(const ae in C){if(!on(le)&&!i)break;const me=lx(await C[ae](O,r),A,ae);me&&(le={...me,...ve(ae,me.message)},k(me.message),i&&(L[_]=le))}if(!on(le)&&(L[_]={ref:A,...le},!i))return L}}return k(!0),L},tu=e=>Array.isArray(e)?e:[e],R_=e=>Array.isArray(e)?e.filter(Boolean):[];function H3(e,n){const r=n.slice(0,-1).length;let i=0;for(;iqp.includes(String(u))))return e;const i=r.length===1?e:H3(e,r),s=r.length-1,l=r[s];return i&&delete i[l],s!==0&&(Tt(i)&&on(i)||Array.isArray(i)&&B3(i))&&jt(e,r.slice(0,-1)),e}const T_=e=>{const n={};for(const r of Object.keys(e))if(Bp(e[r])&&e[r]!==null&&!jo(e[r])){const i=T_(e[r]);for(const s of Object.keys(i))n[`${r}.${s}`]=i[s]}else n[r]=e[r];return n},q3=fe.createContext(null);q3.displayName="HookFormContext";var ux=()=>{let e=[];return{get observers(){return e},next:s=>{for(const l of e)l.next&&l.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(l=>l!==s)}}),unsubscribe:()=>{e=[]}}};function O_(e,n){const r={};for(const i in e)if(e.hasOwnProperty(i)){const s=e[i],l=n[i];if(s&&Tt(s)&&l){const u=O_(s,l);Tt(u)&&(r[i]=u)}else e[i]&&(r[i]=l)}return r}var A_=e=>e.type==="select-multiple",G3=e=>Zp(e)||gl(e),Kh=e=>bu(e)&&e.isConnected,Z3=e=>{for(const n in e)if(Wn(e[n]))return!0;return!1};function M_(e){return Array.isArray(e)||Tt(e)&&!Z3(e)}function j_(e){return!!(e&&"_f"in e)}function N_(e){return Array.isArray(e)?!e.some(n=>!yt(n)):!Object.keys(e).length}function Dm(e,n){Array.isArray(e)?e[n]=void 0:delete e[n]}function km(e,n={},r){for(const i in e){const s=e[i],l=r&&r[i];M_(s)&&(!Array.isArray(s)||!j_(l))?(n[i]=Array.isArray(s)?[]:{},km(s,n[i],l),N_(n[i])&&Dm(n,i)):yt(s)||(n[i]=!0)}return n}function di(e,n,r,i){r||(r=km(n,{},i));for(const s in e){const l=e[s],u=i&&i[s];M_(l)&&(!Array.isArray(l)||!j_(u))?(yt(n)||zm(r[s])?r[s]=km(l,Array.isArray(l)?[]:{},u):di(l,an(n)?{}:n[s],r[s],u),N_(r[s])&&Dm(r,s)):Er(l,n[s])?Dm(r,s):r[s]=!0}return r}var z_=(e,{valueAsNumber:n,valueAsDate:r,setValueAs:i})=>yt(e)?e:n?e===""?NaN:e&&+e:r&&ln(e)?new Date(e):i?i(e):e;function dx(e){const n=e.ref;return Gp(n)?n.files:Zp(n)?E_(e.refs).value:A_(n)?[...n.selectedOptions].map(({value:r})=>r):gl(n)?C_(e.refs).value:z_(yt(n.value)?e.ref.value:n.value,e)}var K3=(e,n,r,i)=>{const s={};for(const l of e){const u=we(n,l);u&&ft(s,l,u._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:i}},Ds=e=>yt(e)?e:xu(e)?e.source:Tt(e)?xu(e.value)?e.value.source:e.value:e;const fx="AsyncFunction";var Y3=e=>{if(!e||!e.validate)return!1;if(Wn(e.validate))return e.validate.constructor.name===fx;if(Tt(e.validate)){for(const n in e.validate)if(e.validate[n].constructor.name===fx)return!0}return!1},Q3=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function hx(e,n,r){const i=we(e,r);if(i||vl(r))return{error:i,name:r};const s=r.split(".");for(;s.length;){const l=s.join("."),u=we(n,l),d=we(e,l);if(u&&!Array.isArray(u)&&r!==l)return{name:r};if(d&&d.type)return{name:l,error:d};if(d&&d.root&&d.root.type)return{name:`${l}.root`,error:d.root};s.pop()}return{name:r}}var X3=(e,n,r,i)=>{r(e);const{name:s,...l}=e,u=Object.keys(l);return!u.length||i&&u.length>=Object.keys(n).length||u.find(d=>n[d]===(!i||mr.all))},J3=(e,n,r)=>!e||!n||e===n||tu(e).some(i=>i&&(r?i===n||i.startsWith(n+"."):i.startsWith(n)||n.startsWith(i))),W3=(e,n,r,i,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(n||e):(r?i.isOnBlur:s.isOnBlur)?!e:(r?i.isOnChange:s.isOnChange)?e:!0,e4=(e,n)=>!R_(we(e,n)).length&&jt(e,n);const t4={mode:mr.onSubmit,reValidateMode:mr.onChange,shouldFocusError:!0},Yh="form",D_={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function n4(e={}){let n={...t4,...e},r={...Mt(D_),isLoading:Wn(n.defaultValues),errors:n.errors||{},disabled:n.disabled||!1},i={},s=Tt(n.defaultValues)||Tt(n.values)?Mt(n.defaultValues||n.values)||{}:{},l=n.shouldUnregister?{}:Mt(s),u={action:!1,mount:!1,watch:!1,keepIsValid:!1},d={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set};const h={},m={};let y=0,v=Gc(n.mode),b=Gc(n.reValidateMode);const x={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},C={...x};let _={...C};const E={array:ux(),state:ux()};let T=0;const O=n.criteriaMode===mr.all,A=(M,V)=>F=>{clearTimeout(m[M]),m[M]=setTimeout(V,F)},k=async M=>{if(!u.keepIsValid&&!n.disabled&&(C.isValid||_.isValid||M)){const V=++T;let F;n.resolver?(F=on((await me()).errors),V===T&&L()):F=await Y({fields:i,onlyCheckValid:!0,eventType:va.VALID}),V===T&&F!==r.isValid&&E.state.next({isValid:F})}},L=(M,V)=>{!n.disabled&&(C.isValidating||C.validatingFields||_.isValidating||_.validatingFields)&&((M||Array.from(d.mount)).forEach(F=>{F&&(V?ft(r.validatingFields,F,V):jt(r.validatingFields,F))}),E.state.next({validatingFields:r.validatingFields,isValidating:!on(r.validatingFields)}))},q=()=>{r.dirtyFields=di(s,l,void 0,i)},H=(M,V=[],F,se,ue=!0,pe=!0)=>{if(se&&F&&!n.disabled){if(u.action=!0,pe&&Array.isArray(we(i,M))){const xe=F(we(i,M),se.argA,se.argB);ue&&ft(i,M,xe)}if(pe&&Array.isArray(we(r.errors,M))){const xe=F(we(r.errors,M),se.argA,se.argB);ue&&ft(r.errors,M,xe),e4(r.errors,M)}if((C.touchedFields||_.touchedFields)&&pe&&Array.isArray(we(r.touchedFields,M))){const xe=F(we(r.touchedFields,M),se.argA,se.argB);ue&&ft(r.touchedFields,M,xe)}(C.dirtyFields||_.dirtyFields)&&q(),E.state.next({name:M,isDirty:J(M,V),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ft(l,M,V)},I=(M,V)=>{ft(r.errors,M,V),r.errors={...r.errors},E.state.next({errors:r.errors})},he=M=>{r.errors=M,E.state.next({errors:r.errors,isValid:!1})},ve=M=>{const V=vl(M)?[M]:Wu(M);let F=l,se=s;for(let ue=0;ue{const ue=we(i,M);if(ue){if(ve(M))return;const pe=yt(we(l,M)),xe=we(l,M,yt(F)?we(s,M):F);yt(xe)||se&&se.defaultChecked||V?ft(l,M,V?xe:dx(ue._f)):j(M,xe),u.mount&&!u.action&&(k(),pe&&r.isDirty&&(C.isDirty||_.isDirty)&&(J()||(r.isDirty=!1,E.state.next({...r}))),e.shouldUnregister&&pe&&!yt(we(l,M))&&Zh(M,d)&&(u.watch=!0))}},le=(M,V,F,se,ue)=>{let pe=!1,xe=!1;const Se={name:M};if(!n.disabled||se===!0){if(!F||se){const Te=Er(we(s,M),V);(C.isDirty||_.isDirty)&&(xe=r.isDirty,r.isDirty=Se.isDirty=!Te||J(),pe=xe!==Se.isDirty),xe=!!we(r.dirtyFields,M),Te!==r.isDirty?r.dirtyFields=di(s,l,void 0,i):Te?jt(r.dirtyFields,M):ft(r.dirtyFields,M,!0),Se.dirtyFields=r.dirtyFields,pe=pe||(C.dirtyFields||_.dirtyFields)&&xe!==!Te}if(F){const Te=we(r.touchedFields,M);Te||(ft(r.touchedFields,M,F),Se.touchedFields=r.touchedFields,pe=pe||(C.touchedFields||_.touchedFields)&&Te!==F)}pe&&ue&&E.state.next(Se)}return pe?Se:{}},ae=(M,V,F,se)=>{const ue=we(r.errors,M),pe=(C.isValid||_.isValid)&&Cr(V)&&r.isValid!==V;if(n.delayError&&F?(h[M]=A(M,()=>I(M,F)),h[M](n.delayError)):(clearTimeout(m[M]),delete h[M],F?ft(r.errors,M,F):jt(r.errors,M),r.errors={...r.errors}),(F?!Er(ue,F):ue)||!on(se)||pe){const xe={...se,...pe&&Cr(V)?{isValid:V}:{},errors:r.errors,name:M};r={...r,...xe},E.state.next(xe)}},me=async M=>(L(M,!0),await n.resolver(l,n.context,K3(M||d.mount,i,n.criteriaMode,n.shouldUseNativeValidation))),ye=async M=>{const{errors:V}=await me(M);if(L(M),M){for(const F of M){const se=we(V,F);se?d.array.has(F)&&Tt(se)&&!Object.keys(se).some(ue=>!Number.isNaN(Number(ue)))?ox(r.errors,{[F]:se},F):ft(r.errors,F,se):jt(r.errors,F)}r.errors={...r.errors}}else r.errors=V;return V},D=async({name:M,eventType:V})=>{if(e.validate){const F=await e.validate({formValues:l,formState:r,name:M,eventType:V});if(Tt(F))for(const se in F){const ue=F[se];ue&<(`${Yh}.${se}`,{message:ln(ue.message)?ue.message:"",type:ue.type||fr.validate})}else ln(F)||!F?lt(Yh,{message:F||"",type:fr.validate}):Ue(Yh);return F}return!0},Y=async({fields:M,onlyCheckValid:V,name:F,eventType:se,context:ue={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(ue.runRootValidation=!0,!await D({name:F,eventType:se})&&(ue.valid=!1,V)))return ue.valid;for(const pe in M){const xe=M[pe];if(xe){const{_f:Se,...Te}=xe;if(Se){const rt=d.array.has(Se.name),wt=xe._f&&Y3(xe._f),Jt=C.validatingFields||C.isValidating||_.validatingFields||_.isValidating;wt&&Jt&&L([Se.name],!0);const Dt=await cx(xe,d.disabled,l,O,n.shouldUseNativeValidation&&!V,rt);if(wt&&Jt&&L([Se.name]),Dt[Se.name]&&(ue.valid=!1,V)||(!V&&(we(Dt,Se.name)?rt?ox(r.errors,Dt,Se.name):ft(r.errors,Se.name,Dt[Se.name]):jt(r.errors,Se.name)),e.shouldUseNativeValidation&&Dt[Se.name]))break}!on(Te)&&await Y({context:ue,onlyCheckValid:V,fields:Te,name:pe,eventType:se})}}return ue.valid},ne=()=>{for(const M of d.unMount){const V=we(i,M);V&&(V._f.refs?V._f.refs.every(F=>!Kh(F)):!Kh(V._f.ref))&&qt(M)}d.unMount=new Set},J=(M,V)=>(M&&V&&ft(l,M,V),!Er(u.mount?l:s,s)),W=(M,V,F)=>U3(M,d,{...u.mount?l:yt(V)?s:ln(M)?{[M]:V}:V},F,V),N=M=>R_(we(u.mount?l:s,M,n.shouldUnregister?we(s,M,[]):[])),j=(M,V,F={},se=!1,ue=!1)=>{const pe=we(i,M);let xe=V;if(pe){const Se=pe._f;Se&&(!Se.disabled&&ft(l,M,z_(V,Se)),xe=bu(Se.ref)&&an(V)?"":V,A_(Se.ref)?[...Se.ref.options].forEach(Te=>Te.selected=xe.includes(Te.value)):Se.refs?gl(Se.ref)?Se.refs.forEach(Te=>{(!Te.defaultChecked||!Te.disabled)&&(Array.isArray(xe)?Te.checked=!!xe.find(rt=>rt===Te.value):Te.checked=xe===Te.value||!!xe)}):Se.refs.forEach(Te=>Te.checked=Te.value===xe):Gp(Se.ref)?Se.ref.value="":(Se.ref.value=xe,!Se.ref.type&&!ue&&E.state.next({name:M,values:se?l:Mt(l)})))}(F.shouldDirty||F.shouldTouch)&&le(M,xe,F.shouldTouch,F.shouldDirty,!ue),F.shouldValidate&&be(M,{delayError:F.delayError})},U=(M,V,F,se=!1,ue=!1)=>{for(const pe in V){if(!V.hasOwnProperty(pe))return;const xe=V[pe],Se=M+"."+pe,Te=we(i,Se);(d.array.has(M)||Tt(xe)||Te&&!Te._f)&&!jo(xe)?U(Se,xe,F,se,ue):j(Se,xe,F,se,ue)}},Q=(M,V,F,se,ue=!1)=>{const pe=we(i,M),xe=d.array.has(M),Se=se?V:Mt(V),Te=we(l,M),rt=Er(Te,Se);if(rt||ft(l,M,Se),xe)E.array.next({name:M,values:se?l:Mt(l)}),(C.isDirty||C.dirtyFields||_.isDirty||_.dirtyFields)&&F.shouldDirty&&(q(),ue||E.state.next({name:M,dirtyFields:r.dirtyFields,isDirty:J(M,Se)}));else{const wt=Array.isArray(Se)&&!Se.length||on(Se);!pe||pe._f||an(Se)||wt?j(M,Se,F,se,ue):U(M,Se,F,se,ue)}if(!rt&&!ue){const wt=Zh(M,d),Jt=se?l:Mt(l);E.state.next({...wt&&r,name:u.mount||wt?M:void 0,values:Jt})}},Z=(M,V,F={})=>Q(M,V,F,!1),re=(M,V={})=>{const F=Wn(M)?M(l):M;if(!Er(l,F)){l={...l,...F};const se=T_(F);for(const ue of d.mount)ue in se&&Q(ue,se[ue],V,!0,!0);E.state.next({...r,name:void 0,type:void 0,...y?{values:l}:{}}),V.shouldValidate&&k()}},ee=async M=>{u.mount=!0;const V=M.target;let F=V.name,se=!0;const ue=we(i,F),pe=xe=>{se=Number.isNaN(xe)||jo(xe)&&isNaN(xe.getTime())||Er(xe,we(l,F,xe))};if(ue){let xe,Se;const Te=V.type?dx(ue._f):k3(M),rt=M.type===va.BLUR||M.type===va.FOCUS_OUT,wt=!Q3(ue._f)&&!e.validate&&!n.resolver&&!we(r.errors,F)&&!ue._f.deps,Jt=wt||W3(rt,we(r.touchedFields,F),r.isSubmitted,b,v),Dt=Zh(F,d,rt);if(ft(l,F,Te),rt){if(!V||!V.readOnly){ue._f.onBlur&&ue._f.onBlur(M);const bt=h[F];bt&&bt(0)}}else ue._f.onChange&&ue._f.onChange(M);const je=le(F,Te,rt),pt=!on(je)||Dt;if(!rt&&E.state.next({name:F,type:M.type,...y?{values:Mt(l)}:{}}),Jt)return(!wt||!r.isValid)&&(C.isValid||_.isValid)&&(n.mode==="onBlur"?rt&&k():rt||k()),pt&&E.state.next({name:F,...Dt?{}:je});if(!n.resolver&&e.validate&&await D({name:F,eventType:M.type}),!rt&&Dt&&E.state.next({...r}),n.resolver){const{errors:bt}=await me([F]);if(L([F]),pe(Te),!se){!on(je)&&E.state.next(je);return}const Gt=hx(r.errors,i,F),ar=hx(bt,i,Gt.name||F);xe=ar.error,F=ar.name,Se=on(bt)}else L([F],!0),xe=(await cx(ue,d.disabled,l,O,n.shouldUseNativeValidation))[F],L([F]),pe(Te),se&&(xe?Se=!1:(C.isValid||_.isValid)&&(Se=await Y({fields:i,onlyCheckValid:!0,name:F,eventType:M.type})));se&&(ue._f.deps&&(!Array.isArray(ue._f.deps)||ue._f.deps.length>0)&&be(ue._f.deps),ae(F,Se,xe,je))}},ge=(M,V)=>{if(we(r.errors,V)&&M.focus)return M.focus(),1},be=async(M,V={})=>{let F,se;const ue=tu(M);if(n.resolver){const pe=await ye(yt(M)?M:ue);F=on(pe),se=M?!ue.some(xe=>we(pe,xe)):F}else M?(se=(await Promise.all(ue.map(async pe=>{const xe=we(i,pe);return await Y({fields:xe&&xe._f?{[pe]:xe}:xe,eventType:va.TRIGGER})}))).every(Boolean),!(!se&&!r.isValid)&&k()):se=F=await Y({fields:i,name:M,eventType:va.TRIGGER});if(V.delayError&&n.delayError&&ln(M)){const pe=we(r.errors,M);pe?(jt(r.errors,M),h[M]=A(M,()=>I(M,pe)),h[M](n.delayError)):(clearTimeout(m[M]),delete h[M])}return E.state.next({...!ln(M)||(C.isValid||_.isValid)&&F!==r.isValid?{}:{name:M},...n.resolver||!M?{isValid:F}:{},errors:r.errors}),V.shouldFocus&&!se&&Hs(i,ge,M?ue:d.mount),se},De=(M,V)=>{let F={...u.mount?l:s};return V&&(F=O_(V.dirtyFields?r.dirtyFields:r.touchedFields,F)),yt(M)?F:ln(M)?we(F,M):M.map(se=>we(F,se))},Ve=(M,V)=>({invalid:!!we((V||r).errors,M),isDirty:!!we((V||r).dirtyFields,M),error:we((V||r).errors,M),isValidating:!!we(r.validatingFields,M),isTouched:!!we((V||r).touchedFields,M)}),Ue=M=>{const V=M?tu(M):void 0;V?.forEach(F=>jt(r.errors,F)),V?V.forEach(F=>{E.state.next({name:F,errors:r.errors})}):E.state.next({errors:{}})},lt=(M,V,F)=>{const se=(we(i,M,{_f:{}})._f||{}).ref,ue=we(r.errors,M)||{},{ref:pe,message:xe,type:Se,...Te}=ue;ft(r.errors,M,{...Te,...V,ref:se}),E.state.next({name:M,errors:r.errors,isValid:!1}),F&&F.shouldFocus&&se&&se.focus&&se.focus()},Je=(M,V)=>{if(Wn(M)){y++;const{unsubscribe:F}=E.state.subscribe({next:ue=>"values"in ue&&M(ue.values||W(void 0,V),ue)});let se=!1;return{unsubscribe:()=>{se||(se=!0,y--,F())}}}return W(M,V,!0)},Xt=M=>{var V;const F=!!(!((V=M.formState)===null||V===void 0)&&V.values);F&&y++;const{unsubscribe:se}=E.state.subscribe({next:pe=>{if(J3(M.name,pe.name,M.exact)&&X3(pe,M.formState||C,Ri,M.reRenderRoot)){const xe={...l};M.callback({values:xe,...r,...pe,defaultValues:s})}}});if(!F)return se;let ue=!1;return()=>{ue||(ue=!0,y--,se())}},mn=M=>(u.mount=!0,_={..._,...M.formState},Xt({...M,formState:{...x,...M.formState}})),qt=(M,V={})=>{for(const F of M?tu(M):d.mount)d.mount.delete(F),d.array.delete(F),V.keepValue||(jt(i,F),jt(l,F)),!V.keepError&&jt(r.errors,F),!V.keepDirty&&jt(r.dirtyFields,F),!V.keepTouched&&jt(r.touchedFields,F),!V.keepIsValidating&&jt(r.validatingFields,F),!n.shouldUnregister&&!V.keepDefaultValue&&jt(s,F);E.state.next({values:Mt(l)}),E.state.next({...r,...V.keepDirty?{isDirty:J()}:{}}),!V.keepIsValid&&k()},Pt=({disabled:M,name:V})=>{if(Cr(M)&&u.mount||M||d.disabled.has(V)){const ue=d.disabled.has(V)!==!!M;M?d.disabled.add(V):d.disabled.delete(V),ue&&u.mount&&!u.action&&k()}},Ut=(M,V={})=>{let F=we(i,M);const se=Cr(V.disabled)||Cr(n.disabled),ue=!d.registerName.has(M)&&F&&F._f&&!F._f.mount;return ft(i,M,{...F||{},_f:{...F&&F._f?F._f:{ref:{name:M}},name:M,mount:!0,...V}}),d.mount.add(M),F&&!ue?Pt({disabled:Cr(V.disabled)?V.disabled:n.disabled,name:M}):de(M,!0,V.value),{...se?{disabled:V.disabled||n.disabled}:{},...n.progressive?{required:!!V.required,min:Ds(V.min),max:Ds(V.max),minLength:Ds(V.minLength),maxLength:Ds(V.maxLength),pattern:Ds(V.pattern)}:{},name:M,onChange:ee,onBlur:ee,ref:pe=>{if(pe){d.registerName.add(M),Ut(M,V),d.registerName.delete(M),F=we(i,M);const xe=yt(pe.value)&&pe.querySelectorAll&&pe.querySelectorAll("input,select,textarea")[0]||pe,Se=G3(xe),Te=F._f.refs||[];if(Se?Te.find(rt=>rt===xe):xe===F._f.ref)return;ft(i,M,{_f:{...F._f,...Se?{refs:[...Te.filter(Kh),xe,...Array.isArray(we(s,M))?[{}]:[]],ref:{type:xe.type,name:M}}:{ref:xe}}}),de(M,!1,void 0,xe)}else F=we(i,M,{}),F._f&&(F._f.mount=!1),(n.shouldUnregister||V.shouldUnregister)&&!(L3(d.array,M)&&u.action)&&d.unMount.add(M)}}},or=()=>n.shouldFocusError&&!n.shouldUseNativeValidation&&Hs(i,ge,d.mount),Fe=M=>{Cr(M)&&(E.state.next({disabled:M}),Hs(i,(V,F)=>{const se=we(i,F);se&&(V.disabled=se._f.disabled||M,Array.isArray(se._f.refs)&&se._f.refs.forEach(ue=>{ue.disabled=se._f.disabled||M}))},0,!1))},ze=(M,V)=>async F=>{let se;F&&(F.preventDefault&&F.preventDefault(),F.persist&&F.persist());let ue=Mt(l);if(E.state.next({isSubmitting:!0}),n.resolver){const{errors:pe,values:xe}=await me();L(),r.errors=pe,ue=Mt(xe)}else await Y({fields:i,eventType:va.SUBMIT});if(d.disabled.size)for(const pe of d.disabled)jt(ue,pe);if(jt(r.errors,__),on(r.errors)){E.state.next({errors:{}});try{await M(ue,F)}catch(pe){se=pe}}else V&&await V({...r.errors},F),or(),setTimeout(or);if(E.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:on(r.errors)&&!se,submitCount:r.submitCount+1,errors:r.errors}),se)throw se},We=(M,V={})=>{we(i,M)&&(yt(V.defaultValue)?Z(M,Mt(we(s,M))):(Z(M,V.defaultValue),ft(s,M,Mt(V.defaultValue))),V.keepTouched||jt(r.touchedFields,M),V.keepDirty||(jt(r.dirtyFields,M),r.isDirty=V.defaultValue?J(M,Mt(we(s,M))):J()),V.keepError||(jt(r.errors,M),C.isValid&&k()),E.state.next({...r}))},zt=(M,V={})=>{const F=M?Mt(M):s,se=Mt(F),ue=on(M),pe=se,xe=i;if(V.keepDefaultValues||(s=F),!V.keepValues){if(V.keepDirtyValues){const Se=new Set([...d.mount,...Object.keys(di(s,l,void 0,xe))]);for(const Te of Array.from(Se)){const rt=we(r.dirtyFields,Te),wt=we(l,Te),Jt=we(pe,Te);rt&&!yt(wt)?ft(pe,Te,wt):!rt&&!yt(Jt)&&Z(Te,Jt)}}else{if(Ju&&yt(M))for(const Se of d.mount){const Te=we(i,Se);if(Te&&Te._f){const rt=Array.isArray(Te._f.refs)?Te._f.refs[0]:Te._f.ref;if(bu(rt)){const wt=rt.closest("form");if(wt){wt.reset();break}}}}if(V.keepFieldsRef)for(const Se of d.mount)Z(Se,we(pe,Se));else i={}}if(n.shouldUnregister){if(l=V.keepDefaultValues?Mt(s):{},V.keepFieldsRef)for(const Se of d.mount)ft(l,Se,we(pe,Se))}else l=Mt(pe);E.array.next({values:{...pe}}),E.state.next({name:void 0,type:void 0,values:{...pe}})}d={mount:V.keepDirtyValues?d.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},u.mount=!C.isValid||!!V.keepIsValid||!!V.keepDirtyValues||!n.shouldUnregister&&!on(pe),u.watch=!!n.shouldUnregister,u.keepIsValid=!!V.keepIsValid,u.action=!1,V.keepErrors||(r.errors={}),E.state.next({submitCount:V.keepSubmitCount?r.submitCount:0,isDirty:ue?!1:V.keepDirty?r.isDirty:V.keepValues?J():!!(V.keepDefaultValues&&!Er(M,s)),isSubmitted:V.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:ue?{}:V.keepDirtyValues?V.keepDefaultValues&&l?di(s,l,void 0,xe):r.dirtyFields:V.keepDefaultValues&&M?di(s,M,void 0,xe):V.keepDirty?r.dirtyFields:{},touchedFields:V.keepTouched?r.touchedFields:{},errors:V.keepErrors?r.errors:{},isSubmitSuccessful:V.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},to=(M,V)=>zt(Wn(M)?M(l):M,{...n.resetOptions,...V}),ir=(M,V={})=>{const F=we(i,M),se=F&&F._f;if(se){const ue=se.refs?se.refs[0]:se.ref;ue.focus&&setTimeout(()=>{ue.focus(),V.shouldSelect&&Wn(ue.select)&&ue.select()})}},Ri=M=>{const{name:V,type:F,values:se,...ue}=M;r={...r,...ue}},Un={control:{register:Ut,unregister:qt,getFieldState:Ve,handleSubmit:ze,setError:lt,_subscribe:Xt,_runSchema:me,_updateIsValidating:L,_focusError:or,_getWatch:W,_getDirty:J,_setValid:k,_setFieldArray:H,_setDisabledField:Pt,_setErrors:he,_getFieldArray:N,_reset:zt,_resetDefaultValues:()=>Wn(n.defaultValues)&&n.defaultValues().then(M=>{to(M,n.resetOptions),E.state.next({isLoading:!1})}),_removeUnmounted:ne,_disableForm:Fe,_subjects:E,_proxyFormState:C,get _fields(){return i},get _formValues(){return l},get _state(){return u},set _state(M){u=M},get _defaultValues(){return s},get _names(){return d},set _names(M){d=M},get _formState(){return r},get _options(){return n},set _options(M){n={...n,...M},v=Gc(n.mode),b=Gc(n.reValidateMode)}},subscribe:mn,trigger:be,register:Ut,handleSubmit:ze,watch:Je,setValue:Z,setValues:re,getValues:De,reset:to,resetField:We,resetDefaultValues:(M,V={})=>{if(s=Mt(M),!V.keepDirty){const F=di(s,l,void 0,i);r.dirtyFields=F,r.isDirty=!on(F)}V.keepIsValid||k(),E.state.next({...r,defaultValues:s})},clearErrors:Ue,unregister:qt,setError:lt,setFocus:ir,getFieldState:Ve};return{...Un,formControl:Un}}function tl(e={}){const n=fe.useRef(void 0),r=fe.useRef(void 0),i=fe.useRef(e.formControl),[s,l]=fe.useState(()=>({...Mt(D_),isLoading:Wn(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Wn(e.defaultValues)?void 0:e.defaultValues}));if(!n.current||e.formControl&&i.current!==e.formControl)if(i.current=e.formControl,e.formControl)n.current={...e.formControl,formState:s},e.defaultValues&&!Wn(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:d,...h}=n4(e);n.current={...h,formState:s}}const u=n.current.control;return u._options=e,P3(()=>{const d=u._subscribe({formState:u._proxyFormState,callback:()=>l({...u._formState,defaultValues:u._defaultValues}),reRenderRoot:!0});return l(h=>({...h,isReady:!0})),u._formState.isReady=!0,d},[u]),fe.useEffect(()=>u._disableForm(e.disabled),[u,e.disabled]),fe.useEffect(()=>{e.mode&&(u._options.mode=e.mode),e.reValidateMode&&(u._options.reValidateMode=e.reValidateMode)},[u,e.mode,e.reValidateMode]),fe.useEffect(()=>{e.errors&&(u._setErrors(e.errors),u._focusError())},[u,e.errors]),fe.useEffect(()=>{e.shouldUnregister&&u._subjects.state.next({values:u._getWatch()})},[u,e.shouldUnregister]),fe.useEffect(()=>{if(u._proxyFormState.isDirty){const d=u._getDirty();d!==s.isDirty&&u._subjects.state.next({isDirty:d})}},[u,s.isDirty]),fe.useEffect(()=>{var d;e.values&&!Er(e.values,r.current)?(u._reset(e.values,{keepFieldsRef:!0,...u._options.resetOptions}),!((d=u._options.resetOptions)===null||d===void 0)&&d.keepIsValid||u._setValid(),r.current=e.values,l(h=>({...h}))):u._resetDefaultValues()},[u,e.values]),fe.useEffect(()=>{u._state.mount||(u._setValid(),u._state.mount=!0),u._state.watch&&(u._state.watch=!1,u._subjects.state.next({...u._formState})),u._removeUnmounted()}),n.current.formState=fe.useMemo(()=>F3(s,u),[u,s]),n.current}const mx=(e,n,r)=>{if(e&&"reportValidity"in e){const i=we(r,n);e.setCustomValidity(i&&i.message||""),e.reportValidity()}},Lm=(e,n)=>{for(const r in n.fields){const i=n.fields[r];i&&i.ref&&"reportValidity"in i.ref?mx(i.ref,r,e):i&&i.refs&&i.refs.forEach(s=>mx(s,r,e))}},px=(e,n)=>{n.shouldUseNativeValidation&&Lm(e,n);const r={};for(const i in e){const s=we(n.fields,i),l=Object.assign(e[i]||{},{ref:s&&s.ref});if(r4(n.names||Object.keys(e),i)){const u=Object.assign({},we(r,i));ft(u,"root",l),ft(r,i,u)}else ft(r,i,l)}return r},r4=(e,n)=>{const r=gx(n).replace(/[.*+?^${}()|\\]/g,"\\$&");return e.some(i=>gx(i).match(`^${r}\\.\\d+`))};function gx(e){return e.replace(/[\[\]]/g,"")}var vx;function ce(e,n,r){function i(d,h){if(d._zod||Object.defineProperty(d,"_zod",{value:{def:h,constr:u,traits:new Set},enumerable:!1}),d._zod.traits.has(e))return;d._zod.traits.add(e),n(d,h);const m=u.prototype,y=Object.keys(m);for(let v=0;vr?.Parent&&d instanceof r.Parent?!0:d?._zod?.traits?.has(e)}),Object.defineProperty(u,"name",{value:e}),u}class Oa extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class k_ extends Error{constructor(n){super(`Encountered unidirectional transform during encode: ${n}`),this.name="ZodEncodeError"}}(vx=globalThis).__zod_globalConfig??(vx.__zod_globalConfig={});const Yp=globalThis.__zod_globalConfig;function vi(e){return Yp}function L_(e){const n=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,s])=>n.indexOf(+i)===-1).map(([i,s])=>s)}function $m(e,n){return typeof n=="bigint"?n.toString():n}function Qp(e){return{get value(){{const n=e();return Object.defineProperty(this,"value",{value:n}),n}}}}function Xp(e){return e==null}function Jp(e){const n=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(n,r)}const yx=Symbol("evaluating");function ht(e,n,r){let i;Object.defineProperty(e,n,{get(){if(i!==yx)return i===void 0&&(i=yx,i=r()),i},set(s){Object.defineProperty(e,n,{value:s})},configurable:!0})}function Ei(e,n,r){Object.defineProperty(e,n,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ho(...e){const n={};for(const r of e){const i=Object.getOwnPropertyDescriptors(r);Object.assign(n,i)}return Object.defineProperties({},n)}function bx(e){return JSON.stringify(e)}function o4(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const $_="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Su(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const i4=Qp(()=>{if(Yp.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function nl(e){if(Su(e)===!1)return!1;const n=e.constructor;if(n===void 0||typeof n!="function")return!0;const r=n.prototype;return!(Su(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function I_(e){return nl(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const a4=new Set(["string","number","symbol"]);function ed(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Bo(e,n,r){const i=new e._zod.constr(n??e._zod.def);return(!n||r?.parent)&&(i._zod.parent=e),i}function $e(e){const n=e;if(!n)return{};if(typeof n=="string")return{error:()=>n};if(n?.message!==void 0){if(n?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");n.error=n.message}return delete n.message,typeof n.error=="string"?{...n,error:()=>n.error}:n}function s4(e){return Object.keys(e).filter(n=>e[n]._zod.optin==="optional"&&e[n]._zod.optout==="optional")}function l4(e,n){const r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const l=Ho(e._zod.def,{get shape(){const u={};for(const d in n){if(!(d in r.shape))throw new Error(`Unrecognized key: "${d}"`);n[d]&&(u[d]=r.shape[d])}return Ei(this,"shape",u),u},checks:[]});return Bo(e,l)}function c4(e,n){const r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const l=Ho(e._zod.def,{get shape(){const u={...e._zod.def.shape};for(const d in n){if(!(d in r.shape))throw new Error(`Unrecognized key: "${d}"`);n[d]&&delete u[d]}return Ei(this,"shape",u),u},checks:[]});return Bo(e,l)}function u4(e,n){if(!nl(n))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const l=e._zod.def.shape;for(const u in n)if(Object.getOwnPropertyDescriptor(l,u)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=Ho(e._zod.def,{get shape(){const l={...e._zod.def.shape,...n};return Ei(this,"shape",l),l}});return Bo(e,s)}function d4(e,n){if(!nl(n))throw new Error("Invalid input to safeExtend: expected a plain object");const r=Ho(e._zod.def,{get shape(){const i={...e._zod.def.shape,...n};return Ei(this,"shape",i),i}});return Bo(e,r)}function f4(e,n){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const r=Ho(e._zod.def,{get shape(){const i={...e._zod.def.shape,...n._zod.def.shape};return Ei(this,"shape",i),i},get catchall(){return n._zod.def.catchall},checks:n._zod.def.checks??[]});return Bo(e,r)}function h4(e,n,r){const s=n._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const u=Ho(n._zod.def,{get shape(){const d=n._zod.def.shape,h={...d};if(r)for(const m in r){if(!(m in d))throw new Error(`Unrecognized key: "${m}"`);r[m]&&(h[m]=e?new e({type:"optional",innerType:d[m]}):d[m])}else for(const m in d)h[m]=e?new e({type:"optional",innerType:d[m]}):d[m];return Ei(this,"shape",h),h},checks:[]});return Bo(n,u)}function m4(e,n,r){const i=Ho(n._zod.def,{get shape(){const s=n._zod.def.shape,l={...s};if(r)for(const u in r){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(l[u]=new e({type:"nonoptional",innerType:s[u]}))}else for(const u in s)l[u]=new e({type:"nonoptional",innerType:s[u]});return Ei(this,"shape",l),l}});return Bo(n,i)}function Ca(e,n=0){if(e.aborted===!0)return!0;for(let r=n;r{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function Zc(e){return typeof e=="string"?e:e?.message}function yi(e,n,r){const i=e.message?e.message:Zc(e.inst?._zod.def?.error?.(e))??Zc(n?.error?.(e))??Zc(r.customError?.(e))??Zc(r.localeError?.(e))??"Invalid input",{inst:s,continue:l,input:u,...d}=e;return d.path??(d.path=[]),d.message=i,n?.reportInput&&(d.input=u),d}function Wp(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function rl(...e){const[n,r,i]=e;return typeof n=="string"?{message:n,code:"custom",input:r,inst:i}:{...n}}const F_=(e,n)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:n,enumerable:!1}),e.message=JSON.stringify(n,$m,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},eg=ce("$ZodError",F_),td=ce("$ZodError",F_,{Parent:Error});function g4(e,n=r=>r.message){const r={},i=[];for(const s of e.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(n(s))):i.push(n(s));return{formErrors:i,fieldErrors:r}}function v4(e,n=r=>r.message){const r={_errors:[]},i=(s,l=[])=>{for(const u of s.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>i({issues:d},[...l,...u.path]));else if(u.code==="invalid_key")i({issues:u.issues},[...l,...u.path]);else if(u.code==="invalid_element")i({issues:u.issues},[...l,...u.path]);else{const d=[...l,...u.path];if(d.length===0)r._errors.push(n(u));else{let h=r,m=0;for(;m(n,r,i,s)=>{const l=i?{...i,async:!1}:{async:!1},u=n._zod.run({value:r,issues:[]},l);if(u instanceof Promise)throw new Oa;if(u.issues.length){const d=new(s?.Err??e)(u.issues.map(h=>yi(h,l,vi())));throw $_(d,s?.callee),d}return u.value},y4=nd(td),rd=e=>async(n,r,i,s)=>{const l=i?{...i,async:!0}:{async:!0};let u=n._zod.run({value:r,issues:[]},l);if(u instanceof Promise&&(u=await u),u.issues.length){const d=new(s?.Err??e)(u.issues.map(h=>yi(h,l,vi())));throw $_(d,s?.callee),d}return u.value},b4=rd(td),od=e=>(n,r,i)=>{const s=i?{...i,async:!1}:{async:!1},l=n._zod.run({value:r,issues:[]},s);if(l instanceof Promise)throw new Oa;return l.issues.length?{success:!1,error:new(e??eg)(l.issues.map(u=>yi(u,s,vi())))}:{success:!0,data:l.value}},x4=od(td),id=e=>async(n,r,i)=>{const s=i?{...i,async:!0}:{async:!0};let l=n._zod.run({value:r,issues:[]},s);return l instanceof Promise&&(l=await l),l.issues.length?{success:!1,error:new e(l.issues.map(u=>yi(u,s,vi())))}:{success:!0,data:l.value}},S4=id(td),w4=e=>(n,r,i)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return nd(e)(n,r,s)},_4=e=>(n,r,i)=>nd(e)(n,r,i),C4=e=>async(n,r,i)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return rd(e)(n,r,s)},E4=e=>async(n,r,i)=>rd(e)(n,r,i),R4=e=>(n,r,i)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return od(e)(n,r,s)},T4=e=>(n,r,i)=>od(e)(n,r,i),O4=e=>async(n,r,i)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return id(e)(n,r,s)},A4=e=>async(n,r,i)=>id(e)(n,r,i),M4=/^[cC][0-9a-z]{6,}$/,j4=/^[0-9a-z]+$/,N4=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,z4=/^[0-9a-vA-V]{20}$/,D4=/^[A-Za-z0-9]{27}$/,k4=/^[a-zA-Z0-9_-]{21}$/,L4=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,$4=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,xx=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,I4=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,V4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function F4(){return new RegExp(V4,"u")}const P4=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,U4=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,H4=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,B4=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,q4=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,P_=/^[A-Za-z0-9_-]*$/,G4=/^https?$/,Z4=/^\+[1-9]\d{6,14}$/,U_="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",K4=new RegExp(`^${U_}$`);function H_(e){const n="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${n}`:e.precision===0?`${n}:[0-5]\\d`:`${n}:[0-5]\\d\\.\\d{${e.precision}}`:`${n}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Y4(e){return new RegExp(`^${H_(e)}$`)}function Q4(e){const n=H_({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${n}(?:${r.join("|")})`;return new RegExp(`^${U_}T(?:${i})$`)}const X4=e=>{const n=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${n}$`)},J4=/^(?:true|false)$/i,W4=/^[^A-Z]*$/,e5=/^[^a-z]*$/,Mr=ce("$ZodCheck",(e,n)=>{var r;e._zod??(e._zod={}),e._zod.def=n,(r=e._zod).onattach??(r.onattach=[])}),t5=ce("$ZodCheckMaxLength",(e,n)=>{var r;Mr.init(e,n),(r=e._zod.def).when??(r.when=i=>{const s=i.value;return!Xp(s)&&s.length!==void 0}),e._zod.onattach.push(i=>{const s=i._zod.bag.maximum??Number.POSITIVE_INFINITY;n.maximum{const s=i.value;if(s.length<=n.maximum)return;const u=Wp(s);i.issues.push({origin:u,code:"too_big",maximum:n.maximum,inclusive:!0,input:s,inst:e,continue:!n.abort})}}),n5=ce("$ZodCheckMinLength",(e,n)=>{var r;Mr.init(e,n),(r=e._zod.def).when??(r.when=i=>{const s=i.value;return!Xp(s)&&s.length!==void 0}),e._zod.onattach.push(i=>{const s=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;n.minimum>s&&(i._zod.bag.minimum=n.minimum)}),e._zod.check=i=>{const s=i.value;if(s.length>=n.minimum)return;const u=Wp(s);i.issues.push({origin:u,code:"too_small",minimum:n.minimum,inclusive:!0,input:s,inst:e,continue:!n.abort})}}),r5=ce("$ZodCheckLengthEquals",(e,n)=>{var r;Mr.init(e,n),(r=e._zod.def).when??(r.when=i=>{const s=i.value;return!Xp(s)&&s.length!==void 0}),e._zod.onattach.push(i=>{const s=i._zod.bag;s.minimum=n.length,s.maximum=n.length,s.length=n.length}),e._zod.check=i=>{const s=i.value,l=s.length;if(l===n.length)return;const u=Wp(s),d=l>n.length;i.issues.push({origin:u,...d?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!n.abort})}}),ad=ce("$ZodCheckStringFormat",(e,n)=>{var r,i;Mr.init(e,n),e._zod.onattach.push(s=>{const l=s._zod.bag;l.format=n.format,n.pattern&&(l.patterns??(l.patterns=new Set),l.patterns.add(n.pattern))}),n.pattern?(r=e._zod).check??(r.check=s=>{n.pattern.lastIndex=0,!n.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:n.format,input:s.value,...n.pattern?{pattern:n.pattern.toString()}:{},inst:e,continue:!n.abort})}):(i=e._zod).check??(i.check=()=>{})}),o5=ce("$ZodCheckRegex",(e,n)=>{ad.init(e,n),e._zod.check=r=>{n.pattern.lastIndex=0,!n.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:n.pattern.toString(),inst:e,continue:!n.abort})}}),i5=ce("$ZodCheckLowerCase",(e,n)=>{n.pattern??(n.pattern=W4),ad.init(e,n)}),a5=ce("$ZodCheckUpperCase",(e,n)=>{n.pattern??(n.pattern=e5),ad.init(e,n)}),s5=ce("$ZodCheckIncludes",(e,n)=>{Mr.init(e,n);const r=ed(n.includes),i=new RegExp(typeof n.position=="number"?`^.{${n.position}}${r}`:r);n.pattern=i,e._zod.onattach.push(s=>{const l=s._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(i)}),e._zod.check=s=>{s.value.includes(n.includes,n.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:n.includes,input:s.value,inst:e,continue:!n.abort})}}),l5=ce("$ZodCheckStartsWith",(e,n)=>{Mr.init(e,n);const r=new RegExp(`^${ed(n.prefix)}.*`);n.pattern??(n.pattern=r),e._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=i=>{i.value.startsWith(n.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:n.prefix,input:i.value,inst:e,continue:!n.abort})}}),c5=ce("$ZodCheckEndsWith",(e,n)=>{Mr.init(e,n);const r=new RegExp(`.*${ed(n.suffix)}$`);n.pattern??(n.pattern=r),e._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=i=>{i.value.endsWith(n.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:n.suffix,input:i.value,inst:e,continue:!n.abort})}}),u5=ce("$ZodCheckOverwrite",(e,n)=>{Mr.init(e,n),e._zod.check=r=>{r.value=n.tx(r.value)}});class d5{constructor(n=[]){this.content=[],this.indent=0,this&&(this.args=n)}indented(n){this.indent+=1,n(this),this.indent-=1}write(n){if(typeof n=="function"){n(this,{execution:"sync"}),n(this,{execution:"async"});return}const i=n.split(` +`).filter(u=>u),s=Math.min(...i.map(u=>u.length-u.trimStart().length)),l=i.map(u=>u.slice(s)).map(u=>" ".repeat(this.indent*2)+u);for(const u of l)this.content.push(u)}compile(){const n=Function,r=this?.args,s=[...(this?.content??[""]).map(l=>` ${l}`)];return new n(...r,s.join(` +`))}}const f5={major:4,minor:4,patch:3},Vt=ce("$ZodType",(e,n)=>{var r;e??(e={}),e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=f5;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const s of i)for(const l of s._zod.onattach)l(e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(u,d,h)=>{let m=Ca(u),y;for(const v of d){if(v._zod.def.when){if(p4(u)||!v._zod.def.when(u))continue}else if(m)continue;const b=u.issues.length,x=v._zod.check(u);if(x instanceof Promise&&h?.async===!1)throw new Oa;if(y||x instanceof Promise)y=(y??Promise.resolve()).then(async()=>{await x,u.issues.length!==b&&(m||(m=Ca(u,b)))});else{if(u.issues.length===b)continue;m||(m=Ca(u,b))}}return y?y.then(()=>u):u},l=(u,d,h)=>{if(Ca(u))return u.aborted=!0,u;const m=s(d,i,h);if(m instanceof Promise){if(h.async===!1)throw new Oa;return m.then(y=>e._zod.parse(y,h))}return e._zod.parse(m,h)};e._zod.run=(u,d)=>{if(d.skipChecks)return e._zod.parse(u,d);if(d.direction==="backward"){const m=e._zod.parse({value:u.value,issues:[]},{...d,skipChecks:!0});return m instanceof Promise?m.then(y=>l(y,u,d)):l(m,u,d)}const h=e._zod.parse(u,d);if(h instanceof Promise){if(d.async===!1)throw new Oa;return h.then(m=>s(m,i,d))}return s(h,i,d)}}ht(e,"~standard",()=>({validate:s=>{try{const l=x4(e,s);return l.success?{value:l.data}:{issues:l.error?.issues}}catch{return S4(e,s).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},vendor:"zod",version:1}))}),tg=ce("$ZodString",(e,n)=>{Vt.init(e,n),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??X4(e._zod.bag),e._zod.parse=(r,i)=>{if(n.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),St=ce("$ZodStringFormat",(e,n)=>{ad.init(e,n),tg.init(e,n)}),h5=ce("$ZodGUID",(e,n)=>{n.pattern??(n.pattern=$4),St.init(e,n)}),m5=ce("$ZodUUID",(e,n)=>{if(n.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[n.version];if(i===void 0)throw new Error(`Invalid UUID version: "${n.version}"`);n.pattern??(n.pattern=xx(i))}else n.pattern??(n.pattern=xx());St.init(e,n)}),p5=ce("$ZodEmail",(e,n)=>{n.pattern??(n.pattern=I4),St.init(e,n)}),g5=ce("$ZodURL",(e,n)=>{St.init(e,n),e._zod.check=r=>{try{const i=r.value.trim();if(!n.normalize&&n.protocol?.source===G4.source&&!/^https?:\/\//i.test(i)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!n.abort});return}const s=new URL(i);n.hostname&&(n.hostname.lastIndex=0,n.hostname.test(s.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:n.hostname.source,input:r.value,inst:e,continue:!n.abort})),n.protocol&&(n.protocol.lastIndex=0,n.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:n.protocol.source,input:r.value,inst:e,continue:!n.abort})),n.normalize?r.value=s.href:r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!n.abort})}}}),v5=ce("$ZodEmoji",(e,n)=>{n.pattern??(n.pattern=F4()),St.init(e,n)}),y5=ce("$ZodNanoID",(e,n)=>{n.pattern??(n.pattern=k4),St.init(e,n)}),b5=ce("$ZodCUID",(e,n)=>{n.pattern??(n.pattern=M4),St.init(e,n)}),x5=ce("$ZodCUID2",(e,n)=>{n.pattern??(n.pattern=j4),St.init(e,n)}),S5=ce("$ZodULID",(e,n)=>{n.pattern??(n.pattern=N4),St.init(e,n)}),w5=ce("$ZodXID",(e,n)=>{n.pattern??(n.pattern=z4),St.init(e,n)}),_5=ce("$ZodKSUID",(e,n)=>{n.pattern??(n.pattern=D4),St.init(e,n)}),C5=ce("$ZodISODateTime",(e,n)=>{n.pattern??(n.pattern=Q4(n)),St.init(e,n)}),E5=ce("$ZodISODate",(e,n)=>{n.pattern??(n.pattern=K4),St.init(e,n)}),R5=ce("$ZodISOTime",(e,n)=>{n.pattern??(n.pattern=Y4(n)),St.init(e,n)}),T5=ce("$ZodISODuration",(e,n)=>{n.pattern??(n.pattern=L4),St.init(e,n)}),O5=ce("$ZodIPv4",(e,n)=>{n.pattern??(n.pattern=P4),St.init(e,n),e._zod.bag.format="ipv4"}),A5=ce("$ZodIPv6",(e,n)=>{n.pattern??(n.pattern=U4),St.init(e,n),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!n.abort})}}}),M5=ce("$ZodCIDRv4",(e,n)=>{n.pattern??(n.pattern=H4),St.init(e,n)}),j5=ce("$ZodCIDRv6",(e,n)=>{n.pattern??(n.pattern=B4),St.init(e,n),e._zod.check=r=>{const i=r.value.split("/");try{if(i.length!==2)throw new Error;const[s,l]=i;if(!l)throw new Error;const u=Number(l);if(`${u}`!==l)throw new Error;if(u<0||u>128)throw new Error;new URL(`http://[${s}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!n.abort})}}});function B_(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const N5=ce("$ZodBase64",(e,n)=>{n.pattern??(n.pattern=q4),St.init(e,n),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{B_(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!n.abort})}});function z5(e){if(!P_.test(e))return!1;const n=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=n.padEnd(Math.ceil(n.length/4)*4,"=");return B_(r)}const D5=ce("$ZodBase64URL",(e,n)=>{n.pattern??(n.pattern=P_),St.init(e,n),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{z5(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!n.abort})}}),k5=ce("$ZodE164",(e,n)=>{n.pattern??(n.pattern=Z4),St.init(e,n)});function L5(e,n=null){try{const r=e.split(".");if(r.length!==3)return!1;const[i]=r;if(!i)return!1;const s=JSON.parse(atob(i));return!("typ"in s&&s?.typ!=="JWT"||!s.alg||n&&(!("alg"in s)||s.alg!==n))}catch{return!1}}const $5=ce("$ZodJWT",(e,n)=>{St.init(e,n),e._zod.check=r=>{L5(r.value,n.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!n.abort})}}),I5=ce("$ZodBoolean",(e,n)=>{Vt.init(e,n),e._zod.pattern=J4,e._zod.parse=(r,i)=>{if(n.coerce)try{r.value=!!r.value}catch{}const s=r.value;return typeof s=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),r}}),V5=ce("$ZodUnknown",(e,n)=>{Vt.init(e,n),e._zod.parse=r=>r}),F5=ce("$ZodNever",(e,n)=>{Vt.init(e,n),e._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Sx(e,n,r){e.issues.length&&n.issues.push(...V_(r,e.issues)),n.value[r]=e.value}const P5=ce("$ZodArray",(e,n)=>{Vt.init(e,n),e._zod.parse=(r,i)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=Array(s.length);const l=[];for(let u=0;uSx(m,r,u))):Sx(h,r,u)}return l.length?Promise.all(l).then(()=>r):r}});function wu(e,n,r,i,s,l){const u=r in i;if(e.issues.length){if(s&&l&&!u)return;n.issues.push(...V_(r,e.issues))}if(!u&&!s){e.issues.length||n.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?u&&(n.value[r]=void 0):n.value[r]=e.value}function q_(e){const n=Object.keys(e.shape);for(const i of n)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);const r=s4(e.shape);return{...e,keys:n,keySet:new Set(n),numKeys:n.length,optionalKeys:new Set(r)}}function G_(e,n,r,i,s,l){const u=[],d=s.keySet,h=s.catchall._zod,m=h.def.type,y=h.optin==="optional",v=h.optout==="optional";for(const b in n){if(b==="__proto__"||d.has(b))continue;if(m==="never"){u.push(b);continue}const x=h.run({value:n[b],issues:[]},i);x instanceof Promise?e.push(x.then(C=>wu(C,r,b,n,y,v))):wu(x,r,b,n,y,v)}return u.length&&r.issues.push({code:"unrecognized_keys",keys:u,input:n,inst:l}),e.length?Promise.all(e).then(()=>r):r}const U5=ce("$ZodObject",(e,n)=>{if(Vt.init(e,n),!Object.getOwnPropertyDescriptor(n,"shape")?.get){const d=n.shape;Object.defineProperty(n,"shape",{get:()=>{const h={...d};return Object.defineProperty(n,"shape",{value:h}),h}})}const i=Qp(()=>q_(n));ht(e._zod,"propValues",()=>{const d=n.shape,h={};for(const m in d){const y=d[m]._zod;if(y.values){h[m]??(h[m]=new Set);for(const v of y.values)h[m].add(v)}}return h});const s=Su,l=n.catchall;let u;e._zod.parse=(d,h)=>{u??(u=i.value);const m=d.value;if(!s(m))return d.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),d;d.value={};const y=[],v=u.shape;for(const b of u.keys){const x=v[b],C=x._zod.optin==="optional",_=x._zod.optout==="optional",E=x._zod.run({value:m[b],issues:[]},h);E instanceof Promise?y.push(E.then(T=>wu(T,d,b,m,C,_))):wu(E,d,b,m,C,_)}return l?G_(y,m,d,h,i.value,e):y.length?Promise.all(y).then(()=>d):d}}),H5=ce("$ZodObjectJIT",(e,n)=>{U5.init(e,n);const r=e._zod.parse,i=Qp(()=>q_(n)),s=b=>{const x=new d5(["shape","payload","ctx"]),C=i.value,_=A=>{const k=bx(A);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};x.write("const input = payload.value;");const E=Object.create(null);let T=0;for(const A of C.keys)E[A]=`key_${T++}`;x.write("const newResult = {};");for(const A of C.keys){const k=E[A],L=bx(A),q=b[A],H=q?._zod?.optin==="optional",I=q?._zod?.optout==="optional";x.write(`const ${k} = ${_(A)};`),H&&I?x.write(` + if (${k}.issues.length) { + if (${L} in input) { + payload.issues = payload.issues.concat(${k}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${L}, ...iss.path] : [${L}] + }))); + } + } + + if (${k}.value === undefined) { + if (${L} in input) { + newResult[${L}] = undefined; + } + } else { + newResult[${L}] = ${k}.value; + } + + `):H?x.write(` + if (${k}.issues.length) { + payload.issues = payload.issues.concat(${k}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${L}, ...iss.path] : [${L}] + }))); + } + + if (${k}.value === undefined) { + if (${L} in input) { + newResult[${L}] = undefined; + } + } else { + newResult[${L}] = ${k}.value; + } + + `):x.write(` + const ${k}_present = ${L} in input; + if (${k}.issues.length) { + payload.issues = payload.issues.concat(${k}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${L}, ...iss.path] : [${L}] + }))); + } + if (!${k}_present && !${k}.issues.length) { + payload.issues.push({ + code: "invalid_type", + expected: "nonoptional", + input: undefined, + path: [${L}] + }); + } + + if (${k}_present) { + if (${k}.value === undefined) { + newResult[${L}] = undefined; + } else { + newResult[${L}] = ${k}.value; + } + } + + `)}x.write("payload.value = newResult;"),x.write("return payload;");const O=x.compile();return(A,k)=>O(b,A,k)};let l;const u=Su,d=!Yp.jitless,m=d&&i4.value,y=n.catchall;let v;e._zod.parse=(b,x)=>{v??(v=i.value);const C=b.value;return u(C)?d&&m&&x?.async===!1&&x.jitless!==!0?(l||(l=s(n.shape)),b=l(b,x),y?G_([],C,b,x,v,e):b):r(b,x):(b.issues.push({expected:"object",code:"invalid_type",input:C,inst:e}),b)}});function wx(e,n,r,i){for(const l of e)if(l.issues.length===0)return n.value=l.value,n;const s=e.filter(l=>!Ca(l));return s.length===1?(n.value=s[0].value,s[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:r,errors:e.map(l=>l.issues.map(u=>yi(u,i,vi())))}),n)}const B5=ce("$ZodUnion",(e,n)=>{Vt.init(e,n),ht(e._zod,"optin",()=>n.options.some(i=>i._zod.optin==="optional")?"optional":void 0),ht(e._zod,"optout",()=>n.options.some(i=>i._zod.optout==="optional")?"optional":void 0),ht(e._zod,"values",()=>{if(n.options.every(i=>i._zod.values))return new Set(n.options.flatMap(i=>Array.from(i._zod.values)))}),ht(e._zod,"pattern",()=>{if(n.options.every(i=>i._zod.pattern)){const i=n.options.map(s=>s._zod.pattern);return new RegExp(`^(${i.map(s=>Jp(s.source)).join("|")})$`)}});const r=n.options.length===1?n.options[0]._zod.run:null;e._zod.parse=(i,s)=>{if(r)return r(i,s);let l=!1;const u=[];for(const d of n.options){const h=d._zod.run({value:i.value,issues:[]},s);if(h instanceof Promise)u.push(h),l=!0;else{if(h.issues.length===0)return h;u.push(h)}}return l?Promise.all(u).then(d=>wx(d,i,e,s)):wx(u,i,e,s)}}),q5=ce("$ZodIntersection",(e,n)=>{Vt.init(e,n),e._zod.parse=(r,i)=>{const s=r.value,l=n.left._zod.run({value:s,issues:[]},i),u=n.right._zod.run({value:s,issues:[]},i);return l instanceof Promise||u instanceof Promise?Promise.all([l,u]).then(([h,m])=>_x(r,h,m)):_x(r,l,u)}});function Im(e,n){if(e===n)return{valid:!0,data:e};if(e instanceof Date&&n instanceof Date&&+e==+n)return{valid:!0,data:e};if(nl(e)&&nl(n)){const r=Object.keys(n),i=Object.keys(e).filter(l=>r.indexOf(l)!==-1),s={...e,...n};for(const l of i){const u=Im(e[l],n[l]);if(!u.valid)return{valid:!1,mergeErrorPath:[l,...u.mergeErrorPath]};s[l]=u.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let i=0;id.l&&d.r).map(([d])=>d);if(l.length&&s&&e.issues.push({...s,keys:l}),Ca(e))return e;const u=Im(n.value,r.value);if(!u.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`);return e.value=u.data,e}const G5=ce("$ZodEnum",(e,n)=>{Vt.init(e,n);const r=L_(n.entries),i=new Set(r);e._zod.values=i,e._zod.pattern=new RegExp(`^(${r.filter(s=>a4.has(typeof s)).map(s=>typeof s=="string"?ed(s):s.toString()).join("|")})$`),e._zod.parse=(s,l)=>{const u=s.value;return i.has(u)||s.issues.push({code:"invalid_value",values:r,input:u,inst:e}),s}}),Z5=ce("$ZodTransform",(e,n)=>{Vt.init(e,n),e._zod.optin="optional",e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new k_(e.constructor.name);const s=n.transform(r.value,r);if(i.async)return(s instanceof Promise?s:Promise.resolve(s)).then(u=>(r.value=u,r.fallback=!0,r));if(s instanceof Promise)throw new Oa;return r.value=s,r.fallback=!0,r}});function Cx(e,n){return n===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Z_=ce("$ZodOptional",(e,n)=>{Vt.init(e,n),e._zod.optin="optional",e._zod.optout="optional",ht(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0),ht(e._zod,"pattern",()=>{const r=n.innerType._zod.pattern;return r?new RegExp(`^(${Jp(r.source)})?$`):void 0}),e._zod.parse=(r,i)=>{if(n.innerType._zod.optin==="optional"){const s=r.value,l=n.innerType._zod.run(r,i);return l instanceof Promise?l.then(u=>Cx(u,s)):Cx(l,s)}return r.value===void 0?r:n.innerType._zod.run(r,i)}}),K5=ce("$ZodExactOptional",(e,n)=>{Z_.init(e,n),ht(e._zod,"values",()=>n.innerType._zod.values),ht(e._zod,"pattern",()=>n.innerType._zod.pattern),e._zod.parse=(r,i)=>n.innerType._zod.run(r,i)}),Y5=ce("$ZodNullable",(e,n)=>{Vt.init(e,n),ht(e._zod,"optin",()=>n.innerType._zod.optin),ht(e._zod,"optout",()=>n.innerType._zod.optout),ht(e._zod,"pattern",()=>{const r=n.innerType._zod.pattern;return r?new RegExp(`^(${Jp(r.source)}|null)$`):void 0}),ht(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,null]):void 0),e._zod.parse=(r,i)=>r.value===null?r:n.innerType._zod.run(r,i)}),Q5=ce("$ZodDefault",(e,n)=>{Vt.init(e,n),e._zod.optin="optional",ht(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(r,i)=>{if(i.direction==="backward")return n.innerType._zod.run(r,i);if(r.value===void 0)return r.value=n.defaultValue,r;const s=n.innerType._zod.run(r,i);return s instanceof Promise?s.then(l=>Ex(l,n)):Ex(s,n)}});function Ex(e,n){return e.value===void 0&&(e.value=n.defaultValue),e}const X5=ce("$ZodPrefault",(e,n)=>{Vt.init(e,n),e._zod.optin="optional",ht(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(r,i)=>(i.direction==="backward"||r.value===void 0&&(r.value=n.defaultValue),n.innerType._zod.run(r,i))}),J5=ce("$ZodNonOptional",(e,n)=>{Vt.init(e,n),ht(e._zod,"values",()=>{const r=n.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),e._zod.parse=(r,i)=>{const s=n.innerType._zod.run(r,i);return s instanceof Promise?s.then(l=>Rx(l,e)):Rx(s,e)}});function Rx(e,n){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:n}),e}const W5=ce("$ZodCatch",(e,n)=>{Vt.init(e,n),e._zod.optin="optional",ht(e._zod,"optout",()=>n.innerType._zod.optout),ht(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(r,i)=>{if(i.direction==="backward")return n.innerType._zod.run(r,i);const s=n.innerType._zod.run(r,i);return s instanceof Promise?s.then(l=>(r.value=l.value,l.issues.length&&(r.value=n.catchValue({...r,error:{issues:l.issues.map(u=>yi(u,i,vi()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=s.value,s.issues.length&&(r.value=n.catchValue({...r,error:{issues:s.issues.map(l=>yi(l,i,vi()))},input:r.value}),r.issues=[],r.fallback=!0),r)}}),e6=ce("$ZodPipe",(e,n)=>{Vt.init(e,n),ht(e._zod,"values",()=>n.in._zod.values),ht(e._zod,"optin",()=>n.in._zod.optin),ht(e._zod,"optout",()=>n.out._zod.optout),ht(e._zod,"propValues",()=>n.in._zod.propValues),e._zod.parse=(r,i)=>{if(i.direction==="backward"){const l=n.out._zod.run(r,i);return l instanceof Promise?l.then(u=>Kc(u,n.in,i)):Kc(l,n.in,i)}const s=n.in._zod.run(r,i);return s instanceof Promise?s.then(l=>Kc(l,n.out,i)):Kc(s,n.out,i)}});function Kc(e,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}const t6=ce("$ZodReadonly",(e,n)=>{Vt.init(e,n),ht(e._zod,"propValues",()=>n.innerType._zod.propValues),ht(e._zod,"values",()=>n.innerType._zod.values),ht(e._zod,"optin",()=>n.innerType?._zod?.optin),ht(e._zod,"optout",()=>n.innerType?._zod?.optout),e._zod.parse=(r,i)=>{if(i.direction==="backward")return n.innerType._zod.run(r,i);const s=n.innerType._zod.run(r,i);return s instanceof Promise?s.then(Tx):Tx(s)}});function Tx(e){return e.value=Object.freeze(e.value),e}const n6=ce("$ZodCustom",(e,n)=>{Mr.init(e,n),Vt.init(e,n),e._zod.parse=(r,i)=>r,e._zod.check=r=>{const i=r.value,s=n.fn(i);if(s instanceof Promise)return s.then(l=>Ox(l,r,i,e));Ox(s,r,i,e)}});function Ox(e,n,r,i){if(!e){const s={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(s.params=i._zod.def.params),n.issues.push(rl(s))}}var Ax;class r6{constructor(){this._map=new WeakMap,this._idmap=new Map}add(n,...r){const i=r[0];return this._map.set(n,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,n),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(n){const r=this._map.get(n);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(n),this}get(n){const r=n._zod.parent;if(r){const i={...this.get(r)??{}};delete i.id;const s={...i,...this._map.get(n)};return Object.keys(s).length?s:void 0}return this._map.get(n)}has(n){return this._map.has(n)}}function o6(){return new r6}(Ax=globalThis).__zod_globalRegistry??(Ax.__zod_globalRegistry=o6());const Vs=globalThis.__zod_globalRegistry;function i6(e,n){return new e({type:"string",...$e(n)})}function a6(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...$e(n)})}function Mx(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...$e(n)})}function s6(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...$e(n)})}function l6(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...$e(n)})}function c6(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...$e(n)})}function u6(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...$e(n)})}function d6(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...$e(n)})}function f6(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...$e(n)})}function h6(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...$e(n)})}function m6(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...$e(n)})}function p6(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...$e(n)})}function g6(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...$e(n)})}function v6(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...$e(n)})}function y6(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...$e(n)})}function b6(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...$e(n)})}function x6(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...$e(n)})}function S6(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...$e(n)})}function w6(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...$e(n)})}function _6(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...$e(n)})}function C6(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...$e(n)})}function E6(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...$e(n)})}function R6(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...$e(n)})}function T6(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...$e(n)})}function O6(e,n){return new e({type:"string",format:"date",check:"string_format",...$e(n)})}function A6(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,...$e(n)})}function M6(e,n){return new e({type:"string",format:"duration",check:"string_format",...$e(n)})}function j6(e,n){return new e({type:"boolean",...$e(n)})}function N6(e){return new e({type:"unknown"})}function z6(e,n){return new e({type:"never",...$e(n)})}function K_(e,n){return new t5({check:"max_length",...$e(n),maximum:e})}function _u(e,n){return new n5({check:"min_length",...$e(n),minimum:e})}function Y_(e,n){return new r5({check:"length_equals",...$e(n),length:e})}function D6(e,n){return new o5({check:"string_format",format:"regex",...$e(n),pattern:e})}function k6(e){return new i5({check:"string_format",format:"lowercase",...$e(e)})}function L6(e){return new a5({check:"string_format",format:"uppercase",...$e(e)})}function $6(e,n){return new s5({check:"string_format",format:"includes",...$e(n),includes:e})}function I6(e,n){return new l5({check:"string_format",format:"starts_with",...$e(n),prefix:e})}function V6(e,n){return new c5({check:"string_format",format:"ends_with",...$e(n),suffix:e})}function Va(e){return new u5({check:"overwrite",tx:e})}function F6(e){return Va(n=>n.normalize(e))}function P6(){return Va(e=>e.trim())}function U6(){return Va(e=>e.toLowerCase())}function H6(){return Va(e=>e.toUpperCase())}function B6(){return Va(e=>o4(e))}function q6(e,n,r){return new e({type:"array",element:n,...$e(r)})}function G6(e,n,r){return new e({type:"custom",check:"custom",fn:n,...$e(r)})}function Z6(e,n){const r=K6(i=>(i.addIssue=s=>{if(typeof s=="string")i.issues.push(rl(s,i.value,r._zod.def));else{const l=s;l.fatal&&(l.continue=!1),l.code??(l.code="custom"),l.input??(l.input=i.value),l.inst??(l.inst=r),l.continue??(l.continue=!r._zod.def.abort),i.issues.push(rl(l))}},e(i.value,i)),n);return r}function K6(e,n){const r=new Mr({check:"custom",...$e(n)});return r._zod.check=e,r}function Q_(e){let n=e?.target??"draft-2020-12";return n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Vs,target:n,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function cn(e,n,r={path:[],schemaPath:[]}){var i;const s=e._zod.def,l=n.seen.get(e);if(l)return l.count++,r.schemaPath.includes(e)&&(l.cycle=r.path),l.schema;const u={schema:{},count:1,cycle:void 0,path:r.path};n.seen.set(e,u);const d=e._zod.toJSONSchema?.();if(d)u.schema=d;else{const y={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(n,u.schema,y);else{const b=u.schema,x=n.processors[s.type];if(!x)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);x(e,n,b,y)}const v=e._zod.parent;v&&(u.ref||(u.ref=v),cn(v,n,y),n.seen.get(v).isParent=!0)}const h=n.metadataRegistry.get(e);return h&&Object.assign(u.schema,h),n.io==="input"&&gn(e)&&(delete u.schema.examples,delete u.schema.default),n.io==="input"&&"_prefault"in u.schema&&((i=u.schema).default??(i.default=u.schema._prefault)),delete u.schema._prefault,n.seen.get(e).schema}function X_(e,n){const r=e.seen.get(n);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=new Map;for(const u of e.seen.entries()){const d=e.metadataRegistry.get(u[0])?.id;if(d){const h=i.get(d);if(h&&h!==u[0])throw new Error(`Duplicate schema id "${d}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(d,u[0])}}const s=u=>{const d=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const v=e.external.registry.get(u[0])?.id,b=e.external.uri??(C=>C);if(v)return{ref:b(v)};const x=u[1].defId??u[1].schema.id??`schema${e.counter++}`;return u[1].defId=x,{defId:x,ref:`${b("__shared")}#/${d}/${x}`}}if(u[1]===r)return{ref:"#"};const m=`#/${d}/`,y=u[1].schema.id??`__schema${e.counter++}`;return{defId:y,ref:m+y}},l=u=>{if(u[1].schema.$ref)return;const d=u[1],{ref:h,defId:m}=s(u);d.def={...d.schema},m&&(d.defId=m);const y=d.schema;for(const v in y)delete y[v];y.$ref=h};if(e.cycles==="throw")for(const u of e.seen.entries()){const d=u[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/ + +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of e.seen.entries()){const d=u[1];if(n===u[0]){l(u);continue}if(e.external){const m=e.external.registry.get(u[0])?.id;if(n!==u[0]&&m){l(u);continue}}if(e.metadataRegistry.get(u[0])?.id){l(u);continue}if(d.cycle){l(u);continue}if(d.count>1&&e.reused==="ref"){l(u);continue}}}function J_(e,n){const r=e.seen.get(n);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=d=>{const h=e.seen.get(d);if(h.ref===null)return;const m=h.def??h.schema,y={...m},v=h.ref;if(h.ref=null,v){i(v);const x=e.seen.get(v),C=x.schema;if(C.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(m.allOf=m.allOf??[],m.allOf.push(C)):Object.assign(m,C),Object.assign(m,y),d._zod.parent===v)for(const E in m)E==="$ref"||E==="allOf"||E in y||delete m[E];if(C.$ref&&x.def)for(const E in m)E==="$ref"||E==="allOf"||E in x.def&&JSON.stringify(m[E])===JSON.stringify(x.def[E])&&delete m[E]}const b=d._zod.parent;if(b&&b!==v){i(b);const x=e.seen.get(b);if(x?.schema.$ref&&(m.$ref=x.schema.$ref,x.def))for(const C in m)C==="$ref"||C==="allOf"||C in x.def&&JSON.stringify(m[C])===JSON.stringify(x.def[C])&&delete m[C]}e.override({zodSchema:d,jsonSchema:m,path:h.path??[]})};for(const d of[...e.seen.entries()].reverse())i(d[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const d=e.external.registry.get(n)?.id;if(!d)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(d)}Object.assign(s,r.def??r.schema);const l=e.metadataRegistry.get(n)?.id;l!==void 0&&s.id===l&&delete s.id;const u=e.external?.defs??{};for(const d of e.seen.entries()){const h=d[1];h.def&&h.defId&&(h.def.id===h.defId&&delete h.def.id,u[h.defId]=h.def)}e.external||Object.keys(u).length>0&&(e.target==="draft-2020-12"?s.$defs=u:s.definitions=u);try{const d=JSON.parse(JSON.stringify(s));return Object.defineProperty(d,"~standard",{value:{...n["~standard"],jsonSchema:{input:Cu(n,"input",e.processors),output:Cu(n,"output",e.processors)}},enumerable:!1,writable:!1}),d}catch{throw new Error("Error converting schema to JSON.")}}function gn(e,n){const r=n??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return gn(i.element,r);if(i.type==="set")return gn(i.valueType,r);if(i.type==="lazy")return gn(i.getter(),r);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return gn(i.innerType,r);if(i.type==="intersection")return gn(i.left,r)||gn(i.right,r);if(i.type==="record"||i.type==="map")return gn(i.keyType,r)||gn(i.valueType,r);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:gn(i.in,r)||gn(i.out,r);if(i.type==="object"){for(const s in i.shape)if(gn(i.shape[s],r))return!0;return!1}if(i.type==="union"){for(const s of i.options)if(gn(s,r))return!0;return!1}if(i.type==="tuple"){for(const s of i.items)if(gn(s,r))return!0;return!!(i.rest&&gn(i.rest,r))}return!1}const Y6=(e,n={})=>r=>{const i=Q_({...r,processors:n});return cn(e,i),X_(i,e),J_(i,e)},Cu=(e,n,r={})=>i=>{const{libraryOptions:s,target:l}=i??{},u=Q_({...s??{},target:l,io:n,processors:r});return cn(e,u),X_(u,e),J_(u,e)},Q6={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},X6=(e,n,r,i)=>{const s=r;s.type="string";const{minimum:l,maximum:u,format:d,patterns:h,contentEncoding:m}=e._zod.bag;if(typeof l=="number"&&(s.minLength=l),typeof u=="number"&&(s.maxLength=u),d&&(s.format=Q6[d]??d,s.format===""&&delete s.format,d==="time"&&delete s.format),m&&(s.contentEncoding=m),h&&h.size>0){const y=[...h];y.length===1?s.pattern=y[0].source:y.length>1&&(s.allOf=[...y.map(v=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:v.source}))])}},J6=(e,n,r,i)=>{r.type="boolean"},W6=(e,n,r,i)=>{r.not={}},eL=(e,n,r,i)=>{},tL=(e,n,r,i)=>{const s=e._zod.def,l=L_(s.entries);l.every(u=>typeof u=="number")&&(r.type="number"),l.every(u=>typeof u=="string")&&(r.type="string"),r.enum=l},nL=(e,n,r,i)=>{if(n.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},rL=(e,n,r,i)=>{if(n.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},oL=(e,n,r,i)=>{const s=r,l=e._zod.def,{minimum:u,maximum:d}=e._zod.bag;typeof u=="number"&&(s.minItems=u),typeof d=="number"&&(s.maxItems=d),s.type="array",s.items=cn(l.element,n,{...i,path:[...i.path,"items"]})},iL=(e,n,r,i)=>{const s=r,l=e._zod.def;s.type="object",s.properties={};const u=l.shape;for(const m in u)s.properties[m]=cn(u[m],n,{...i,path:[...i.path,"properties",m]});const d=new Set(Object.keys(u)),h=new Set([...d].filter(m=>{const y=l.shape[m]._zod;return n.io==="input"?y.optin===void 0:y.optout===void 0}));h.size>0&&(s.required=Array.from(h)),l.catchall?._zod.def.type==="never"?s.additionalProperties=!1:l.catchall?l.catchall&&(s.additionalProperties=cn(l.catchall,n,{...i,path:[...i.path,"additionalProperties"]})):n.io==="output"&&(s.additionalProperties=!1)},aL=(e,n,r,i)=>{const s=e._zod.def,l=s.inclusive===!1,u=s.options.map((d,h)=>cn(d,n,{...i,path:[...i.path,l?"oneOf":"anyOf",h]}));l?r.oneOf=u:r.anyOf=u},sL=(e,n,r,i)=>{const s=e._zod.def,l=cn(s.left,n,{...i,path:[...i.path,"allOf",0]}),u=cn(s.right,n,{...i,path:[...i.path,"allOf",1]}),d=m=>"allOf"in m&&Object.keys(m).length===1,h=[...d(l)?l.allOf:[l],...d(u)?u.allOf:[u]];r.allOf=h},lL=(e,n,r,i)=>{const s=e._zod.def,l=cn(s.innerType,n,i),u=n.seen.get(e);n.target==="openapi-3.0"?(u.ref=s.innerType,r.nullable=!0):r.anyOf=[l,{type:"null"}]},cL=(e,n,r,i)=>{const s=e._zod.def;cn(s.innerType,n,i);const l=n.seen.get(e);l.ref=s.innerType},uL=(e,n,r,i)=>{const s=e._zod.def;cn(s.innerType,n,i);const l=n.seen.get(e);l.ref=s.innerType,r.default=JSON.parse(JSON.stringify(s.defaultValue))},dL=(e,n,r,i)=>{const s=e._zod.def;cn(s.innerType,n,i);const l=n.seen.get(e);l.ref=s.innerType,n.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},fL=(e,n,r,i)=>{const s=e._zod.def;cn(s.innerType,n,i);const l=n.seen.get(e);l.ref=s.innerType;let u;try{u=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=u},hL=(e,n,r,i)=>{const s=e._zod.def,l=s.in._zod.traits.has("$ZodTransform"),u=n.io==="input"?l?s.out:s.in:s.out;cn(u,n,i);const d=n.seen.get(e);d.ref=u},mL=(e,n,r,i)=>{const s=e._zod.def;cn(s.innerType,n,i);const l=n.seen.get(e);l.ref=s.innerType,r.readOnly=!0},W_=(e,n,r,i)=>{const s=e._zod.def;cn(s.innerType,n,i);const l=n.seen.get(e);l.ref=s.innerType};function Vm(){return Vm=Object.assign?Object.assign.bind():function(e){for(var n=1;n0){var h=s.errors[0][0];r[d]={message:h.message,type:h.code}}else r[d]={message:u,type:l};if(s.code==="invalid_union"&&s.errors.forEach(function(v){return v.forEach(function(b){return e.push(Vm({},b,{path:[].concat(s.path,b.path)}))})}),n){var m=r[d].types,y=m&&m[s.code];r[d]=Kp(d,n,r,l,y?[].concat(y,s.message):s.message)}e.shift()};e.length;)i();return r}function ol(e,n,r){if(r===void 0&&(r={}),(function(i){return"_def"in i&&typeof i._def=="object"&&"typeName"in i._def})(e))return function(i,s,l){try{return Promise.resolve(jx(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](i,n)).then(function(u){return l.shouldUseNativeValidation&&Lm({},l),{errors:{},values:r.raw?Object.assign({},i):u}})},function(u){if((function(d){return Array.isArray(d?.issues)})(u))return{values:{},errors:px(pL(u.errors,!l.shouldUseNativeValidation&&l.criteriaMode==="all"),l)};throw u}))}catch(u){return Promise.reject(u)}};if((function(i){return"_zod"in i&&typeof i._zod=="object"})(e))return function(i,s,l){try{return Promise.resolve(jx(function(){return Promise.resolve((r.mode==="sync"?y4:b4)(e,i,n)).then(function(u){return l.shouldUseNativeValidation&&Lm({},l),{errors:{},values:r.raw?Object.assign({},i):u}})},function(u){if((function(d){return d instanceof eg})(u))return{values:{},errors:px(gL(u.issues,!l.shouldUseNativeValidation&&l.criteriaMode==="all"),l)};throw u}))}catch(u){return Promise.reject(u)}};throw new Error("Invalid input: not a Zod schema")}const vL=ce("ZodISODateTime",(e,n)=>{C5.init(e,n),Ct.init(e,n)});function yL(e){return T6(vL,e)}const bL=ce("ZodISODate",(e,n)=>{E5.init(e,n),Ct.init(e,n)});function xL(e){return O6(bL,e)}const SL=ce("ZodISOTime",(e,n)=>{R5.init(e,n),Ct.init(e,n)});function wL(e){return A6(SL,e)}const _L=ce("ZodISODuration",(e,n)=>{T5.init(e,n),Ct.init(e,n)});function CL(e){return M6(_L,e)}const EL=(e,n)=>{eg.init(e,n),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>v4(e,r)},flatten:{value:r=>g4(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,$m,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,$m,2)}},isEmpty:{get(){return e.issues.length===0}}})},rr=ce("ZodError",EL,{Parent:Error}),RL=nd(rr),TL=rd(rr),OL=od(rr),AL=id(rr),ML=w4(rr),jL=_4(rr),NL=C4(rr),zL=E4(rr),DL=R4(rr),kL=T4(rr),LL=O4(rr),$L=A4(rr),Nx=new WeakMap;function sd(e,n,r){const i=Object.getPrototypeOf(e);let s=Nx.get(i);if(s||(s=new Set,Nx.set(i,s)),!s.has(n)){s.add(n);for(const l in r){const u=r[l];Object.defineProperty(i,l,{configurable:!0,enumerable:!1,get(){const d=u.bind(this);return Object.defineProperty(this,l,{configurable:!0,writable:!0,enumerable:!0,value:d}),d},set(d){Object.defineProperty(this,l,{configurable:!0,writable:!0,enumerable:!0,value:d})}})}}}const Ft=ce("ZodType",(e,n)=>(Vt.init(e,n),Object.assign(e["~standard"],{jsonSchema:{input:Cu(e,"input"),output:Cu(e,"output")}}),e.toJSONSchema=Y6(e,{}),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.parse=(r,i)=>RL(e,r,i,{callee:e.parse}),e.safeParse=(r,i)=>OL(e,r,i),e.parseAsync=async(r,i)=>TL(e,r,i,{callee:e.parseAsync}),e.safeParseAsync=async(r,i)=>AL(e,r,i),e.spa=e.safeParseAsync,e.encode=(r,i)=>ML(e,r,i),e.decode=(r,i)=>jL(e,r,i),e.encodeAsync=async(r,i)=>NL(e,r,i),e.decodeAsync=async(r,i)=>zL(e,r,i),e.safeEncode=(r,i)=>DL(e,r,i),e.safeDecode=(r,i)=>kL(e,r,i),e.safeEncodeAsync=async(r,i)=>LL(e,r,i),e.safeDecodeAsync=async(r,i)=>$L(e,r,i),sd(e,"ZodType",{check(...r){const i=this.def;return this.clone(Ho(i,{checks:[...i.checks??[],...r.map(s=>typeof s=="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,i){return Bo(this,r,i)},brand(){return this},register(r,i){return r.add(this,i),this},refine(r,i){return this.check(M8(r,i))},superRefine(r,i){return this.check(j8(r,i))},overwrite(r){return this.check(Va(r))},optional(){return Lx(this)},exactOptional(){return v8(this)},nullable(){return $x(this)},nullish(){return Lx($x(this))},nonoptional(r){return _8(this,r)},array(){return s8(this)},or(r){return u8([this,r])},and(r){return f8(this,r)},transform(r){return Ix(this,p8(r))},default(r){return x8(this,r)},prefault(r){return w8(this,r)},catch(r){return E8(this,r)},pipe(r){return Ix(this,r)},readonly(){return O8(this)},describe(r){const i=this.clone();return Vs.add(i,{description:r}),i},meta(...r){if(r.length===0)return Vs.get(this);const i=this.clone();return Vs.add(i,r[0]),i},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return Vs.get(e)?.description},configurable:!0}),e)),eC=ce("_ZodString",(e,n)=>{tg.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(i,s,l)=>X6(e,i,s);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,sd(e,"_ZodString",{regex(...i){return this.check(D6(...i))},includes(...i){return this.check($6(...i))},startsWith(...i){return this.check(I6(...i))},endsWith(...i){return this.check(V6(...i))},min(...i){return this.check(_u(...i))},max(...i){return this.check(K_(...i))},length(...i){return this.check(Y_(...i))},nonempty(...i){return this.check(_u(1,...i))},lowercase(i){return this.check(k6(i))},uppercase(i){return this.check(L6(i))},trim(){return this.check(P6())},normalize(...i){return this.check(F6(...i))},toLowerCase(){return this.check(U6())},toUpperCase(){return this.check(H6())},slugify(){return this.check(B6())}})}),IL=ce("ZodString",(e,n)=>{tg.init(e,n),eC.init(e,n),e.email=r=>e.check(a6(VL,r)),e.url=r=>e.check(d6(FL,r)),e.jwt=r=>e.check(R6(t8,r)),e.emoji=r=>e.check(f6(PL,r)),e.guid=r=>e.check(Mx(zx,r)),e.uuid=r=>e.check(s6(Yc,r)),e.uuidv4=r=>e.check(l6(Yc,r)),e.uuidv6=r=>e.check(c6(Yc,r)),e.uuidv7=r=>e.check(u6(Yc,r)),e.nanoid=r=>e.check(h6(UL,r)),e.guid=r=>e.check(Mx(zx,r)),e.cuid=r=>e.check(m6(HL,r)),e.cuid2=r=>e.check(p6(BL,r)),e.ulid=r=>e.check(g6(qL,r)),e.base64=r=>e.check(_6(JL,r)),e.base64url=r=>e.check(C6(WL,r)),e.xid=r=>e.check(v6(GL,r)),e.ksuid=r=>e.check(y6(ZL,r)),e.ipv4=r=>e.check(b6(KL,r)),e.ipv6=r=>e.check(x6(YL,r)),e.cidrv4=r=>e.check(S6(QL,r)),e.cidrv6=r=>e.check(w6(XL,r)),e.e164=r=>e.check(E6(e8,r)),e.datetime=r=>e.check(yL(r)),e.date=r=>e.check(xL(r)),e.time=r=>e.check(wL(r)),e.duration=r=>e.check(CL(r))});function Aa(e){return i6(IL,e)}const Ct=ce("ZodStringFormat",(e,n)=>{St.init(e,n),eC.init(e,n)}),VL=ce("ZodEmail",(e,n)=>{p5.init(e,n),Ct.init(e,n)}),zx=ce("ZodGUID",(e,n)=>{h5.init(e,n),Ct.init(e,n)}),Yc=ce("ZodUUID",(e,n)=>{m5.init(e,n),Ct.init(e,n)}),FL=ce("ZodURL",(e,n)=>{g5.init(e,n),Ct.init(e,n)}),PL=ce("ZodEmoji",(e,n)=>{v5.init(e,n),Ct.init(e,n)}),UL=ce("ZodNanoID",(e,n)=>{y5.init(e,n),Ct.init(e,n)}),HL=ce("ZodCUID",(e,n)=>{b5.init(e,n),Ct.init(e,n)}),BL=ce("ZodCUID2",(e,n)=>{x5.init(e,n),Ct.init(e,n)}),qL=ce("ZodULID",(e,n)=>{S5.init(e,n),Ct.init(e,n)}),GL=ce("ZodXID",(e,n)=>{w5.init(e,n),Ct.init(e,n)}),ZL=ce("ZodKSUID",(e,n)=>{_5.init(e,n),Ct.init(e,n)}),KL=ce("ZodIPv4",(e,n)=>{O5.init(e,n),Ct.init(e,n)}),YL=ce("ZodIPv6",(e,n)=>{A5.init(e,n),Ct.init(e,n)}),QL=ce("ZodCIDRv4",(e,n)=>{M5.init(e,n),Ct.init(e,n)}),XL=ce("ZodCIDRv6",(e,n)=>{j5.init(e,n),Ct.init(e,n)}),JL=ce("ZodBase64",(e,n)=>{N5.init(e,n),Ct.init(e,n)}),WL=ce("ZodBase64URL",(e,n)=>{D5.init(e,n),Ct.init(e,n)}),e8=ce("ZodE164",(e,n)=>{k5.init(e,n),Ct.init(e,n)}),t8=ce("ZodJWT",(e,n)=>{$5.init(e,n),Ct.init(e,n)}),n8=ce("ZodBoolean",(e,n)=>{I5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>J6(e,r,i)});function Dx(e){return j6(n8,e)}const r8=ce("ZodUnknown",(e,n)=>{V5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>eL()});function kx(){return N6(r8)}const o8=ce("ZodNever",(e,n)=>{F5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>W6(e,r,i)});function i8(e){return z6(o8,e)}const a8=ce("ZodArray",(e,n)=>{P5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>oL(e,r,i,s),e.element=n.element,sd(e,"ZodArray",{min(r,i){return this.check(_u(r,i))},nonempty(r){return this.check(_u(1,r))},max(r,i){return this.check(K_(r,i))},length(r,i){return this.check(Y_(r,i))},unwrap(){return this.element}})});function s8(e,n){return q6(a8,e,n)}const l8=ce("ZodObject",(e,n)=>{H5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>iL(e,r,i,s),ht(e,"shape",()=>n.shape),sd(e,"ZodObject",{keyof(){return h8(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:kx()})},loose(){return this.clone({...this._zod.def,catchall:kx()})},strict(){return this.clone({...this._zod.def,catchall:i8()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return u4(this,r)},safeExtend(r){return d4(this,r)},merge(r){return f4(this,r)},pick(r){return l4(this,r)},omit(r){return c4(this,r)},partial(...r){return h4(tC,this,r[0])},required(...r){return m4(nC,this,r[0])}})});function yl(e,n){const r={type:"object",shape:e??{},...$e(n)};return new l8(r)}const c8=ce("ZodUnion",(e,n)=>{B5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>aL(e,r,i,s),e.options=n.options});function u8(e,n){return new c8({type:"union",options:e,...$e(n)})}const d8=ce("ZodIntersection",(e,n)=>{q5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>sL(e,r,i,s)});function f8(e,n){return new d8({type:"intersection",left:e,right:n})}const Fm=ce("ZodEnum",(e,n)=>{G5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(i,s,l)=>tL(e,i,s),e.enum=n.entries,e.options=Object.values(n.entries);const r=new Set(Object.keys(n.entries));e.extract=(i,s)=>{const l={};for(const u of i)if(r.has(u))l[u]=n.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Fm({...n,checks:[],...$e(s),entries:l})},e.exclude=(i,s)=>{const l={...n.entries};for(const u of i)if(r.has(u))delete l[u];else throw new Error(`Key ${u} not found in enum`);return new Fm({...n,checks:[],...$e(s),entries:l})}});function h8(e,n){const r=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new Fm({type:"enum",entries:r,...$e(n)})}const m8=ce("ZodTransform",(e,n)=>{Z5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>rL(e,r),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new k_(e.constructor.name);r.addIssue=l=>{if(typeof l=="string")r.issues.push(rl(l,r.value,n));else{const u=l;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=r.value),u.inst??(u.inst=e),r.issues.push(rl(u))}};const s=n.transform(r.value,r);return s instanceof Promise?s.then(l=>(r.value=l,r.fallback=!0,r)):(r.value=s,r.fallback=!0,r)}});function p8(e){return new m8({type:"transform",transform:e})}const tC=ce("ZodOptional",(e,n)=>{Z_.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>W_(e,r,i,s),e.unwrap=()=>e._zod.def.innerType});function Lx(e){return new tC({type:"optional",innerType:e})}const g8=ce("ZodExactOptional",(e,n)=>{K5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>W_(e,r,i,s),e.unwrap=()=>e._zod.def.innerType});function v8(e){return new g8({type:"optional",innerType:e})}const y8=ce("ZodNullable",(e,n)=>{Y5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>lL(e,r,i,s),e.unwrap=()=>e._zod.def.innerType});function $x(e){return new y8({type:"nullable",innerType:e})}const b8=ce("ZodDefault",(e,n)=>{Q5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>uL(e,r,i,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function x8(e,n){return new b8({type:"default",innerType:e,get defaultValue(){return typeof n=="function"?n():I_(n)}})}const S8=ce("ZodPrefault",(e,n)=>{X5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>dL(e,r,i,s),e.unwrap=()=>e._zod.def.innerType});function w8(e,n){return new S8({type:"prefault",innerType:e,get defaultValue(){return typeof n=="function"?n():I_(n)}})}const nC=ce("ZodNonOptional",(e,n)=>{J5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>cL(e,r,i,s),e.unwrap=()=>e._zod.def.innerType});function _8(e,n){return new nC({type:"nonoptional",innerType:e,...$e(n)})}const C8=ce("ZodCatch",(e,n)=>{W5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>fL(e,r,i,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function E8(e,n){return new C8({type:"catch",innerType:e,catchValue:typeof n=="function"?n:()=>n})}const R8=ce("ZodPipe",(e,n)=>{e6.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>hL(e,r,i,s),e.in=n.in,e.out=n.out});function Ix(e,n){return new R8({type:"pipe",in:e,out:n})}const T8=ce("ZodReadonly",(e,n)=>{t6.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>mL(e,r,i,s),e.unwrap=()=>e._zod.def.innerType});function O8(e){return new T8({type:"readonly",innerType:e})}const A8=ce("ZodCustom",(e,n)=>{n6.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>nL(e,r)});function M8(e,n={}){return G6(A8,e,n)}function j8(e,n){return Z6(e,n)}const N8=/\.(md|markdown)$/i,z8=/\.(png|jpe?g|gif|svg|webp|ico|bmp|avif)$/i,rC=/\.html?$/i,D8=/\.(txt|log|json|ya?ml|toml|csv|go|py|js|ts|jsx|tsx|sh|bash|zsh|rb|rs|c|h|cpp|java|kt|swift|sql|css|xml|ini|conf|env|mod|sum|jsonl)$/i;function oC(e){if(e<1024)return e+" B";const n=["KB","MB","GB","TB"];let r=-1;do e/=1024,r++;while(e>=1024&&r[role=checkbox]]:translate-y-[2px]",e),...n})}function cC({className:e,...n}){return g.jsx("td",{"data-slot":"table-cell",className:et("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...n})}const k8=yl({name:Aa().trim().min(1,"Give the organization a name.").max(60,"Keep it under 60 characters.")});function uC({header:e}){const n=e.column.getIsSorted();return e.column.getCanSort()?g.jsx(Vx,{"data-sort":n||void 0,"aria-sort":n==="asc"?"ascending":n==="desc"?"descending":"none",children:g.jsxs("button",{type:"button",className:"th-sort",onClick:e.column.getToggleSortingHandler(),children:[yu(e.column.columnDef.header,e.getContext()),n==="asc"?" ↑":n==="desc"?" ↓":""]})}):g.jsx(Vx,{children:yu(e.column.columnDef.header,e.getContext())})}function L8({org:e,projects:n,myEmail:r}){const i=ka(),s=e.role==="owner",l=()=>i.invalidateQueries({queryKey:["orgs"]}),u=()=>i.invalidateQueries({queryKey:["invites",e.id]}),d=()=>i.invalidateQueries({queryKey:["orgShares",e.id]}),h=tl({resolver:ol(k8),values:{name:e.name}}),{data:m}=vn({queryKey:["invites",e.id],queryFn:()=>Nn(`/api/orgs/${e.id}/invites`),enabled:s,select:b=>b.invites||[]}),{data:y}=vn({queryKey:["orgShares",e.id],queryFn:()=>Nn(`/api/orgs/${e.id}/shares`),enabled:s,select:b=>b.shares||[]}),v=n.filter(b=>b.org===e.id);return g.jsxs("div",{className:"admin",children:[g.jsx("h1",{id:"org-title",children:e.name}),!s&&g.jsx("p",{className:"role-chip-row",children:g.jsx("span",{className:"ai-tag role-chip",children:"Member"})}),!s&&g.jsx("p",{className:"admin-sub",children:"Only owners can rename this organization, manage members, or issue invite links."}),s&&g.jsxs("form",{className:"admin-row",onSubmit:h.handleSubmit(async({name:b})=>{try{await er("PATCH","/api/orgs/"+e.id,{name:b}),Xe("Renamed."),l()}catch(x){Xe(x.message,!0)}}),children:[g.jsx("label",{className:"admin-lbl",htmlFor:"org-rename",children:"Organization name"}),g.jsx("input",{id:"org-rename",type:"text","aria-invalid":!!h.formState.errors.name,"aria-describedby":h.formState.errors.name?"org-rename-err":void 0,...h.register("name")}),g.jsx(Nt,{variant:"subtle",id:"org-rename-btn",type:"submit",disabled:!h.formState.isDirty,children:"Rename org"}),h.formState.errors.name&&g.jsx("span",{id:"org-rename-err",role:"alert",className:"field-err",children:h.formState.errors.name.message})]}),g.jsx("h3",{children:"Members"}),g.jsx($8,{org:e,owner:s,myEmail:r,onChanged:l}),g.jsx("h3",{children:"Projects"}),g.jsxs("div",{className:"admin-list",children:[v.length===0&&g.jsx("div",{className:"admin-empty",children:"No projects yet."}),v.map(b=>g.jsx("div",{className:"admin-item",children:g.jsx("span",{className:"ai-main",title:b.name,children:b.name})},b.id))]}),s&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"admin-h",children:[g.jsx("h3",{children:"Invite links"}),g.jsx(Nt,{variant:"primary",onClick:async()=>{try{const b=await Ma(`/api/orgs/${e.id}/invites`),x=await il(b.url);Xe(x?"Invite link copied to clipboard.":"Invite created — copy it from the list below."),u()}catch(b){Xe(b.message,!0)}},children:"New invite"})]}),g.jsxs("div",{className:"admin-list",children:[m&&m.length===0&&g.jsx("div",{className:"admin-empty",children:"No active invite links."}),(m||[]).map(b=>g.jsxs("div",{className:"admin-item",children:[g.jsx("button",{type:"button",className:"ai-main mono ai-copy","aria-label":`Copy invite link ${b.url}`,title:b.url,onClick:()=>il(b.url).then(x=>Xe(x?"Copied.":"Select and copy the link.")),children:b.url}),g.jsx("span",{className:"ai-tag",children:(b.creator?"by "+b.creator+" · ":"")+(b.uses?b.uses+" joined · ":"unused · ")+"expires "+new Date(b.expires).toLocaleDateString()}),g.jsx("button",{className:"ai-del","aria-label":`Revoke invite ${b.token.slice(0,8)}`,onClick:async()=>{if(await Qu("Revoke invite",`Revoke the link starting ${b.token.slice(0,8)}…? Anyone still holding it won't be able to join.`,"Revoke",!0))try{await er("DELETE",`/api/orgs/${e.id}/invites/${b.token}`),Xe("Revoked."),u()}catch(x){Xe(x.message,!0)}},children:"Revoke"})]},b.token))]}),g.jsx("h3",{children:"Public share links"}),g.jsx(I8,{shares:y||[],onChanged:d})]})]})}function $8({org:e,owner:n,myEmail:r,onChanged:i}){const[s,l]=S.useState([{id:"email",desc:!1}]),u=S.useMemo(()=>c_(),[]),d=S.useMemo(()=>[u.accessor("email",{id:"email",header:"Member",cell:m=>{const y=!!r&&m.getValue().toLowerCase()===r.toLowerCase();return g.jsx("span",{className:"ai-main",title:m.getValue(),children:m.getValue()+(y?" (you)":"")})}}),u.accessor("role",{id:"role",header:"Role",cell:m=>{const y=m.row.original,v=!!r&&y.email.toLowerCase()===r.toLowerCase();return!n||v?g.jsx("span",{className:"ai-tag role-static",children:y.role}):g.jsxs("span",{className:"role-cell",children:[g.jsxs("select",{"aria-label":`Role for ${y.email}`,value:y.role,onChange:async b=>{try{await er("PATCH",`/api/orgs/${e.id}/members/${encodeURIComponent(y.email)}`,{role:b.target.value}),Xe("Role updated.")}catch(x){Xe(x.message,!0)}i()},children:[g.jsx("option",{value:"owner",children:"owner"}),g.jsx("option",{value:"member",children:"member"})]}),g.jsx("button",{className:"ai-del","aria-label":`Remove ${y.email}`,onClick:async()=>{if(await Qu("Remove member",`Remove ${y.email} from ${e.name}?`,"Remove",!0))try{await er("DELETE",`/api/orgs/${e.id}/members/${encodeURIComponent(y.email)}`),Xe("Removed."),i()}catch(b){Xe(b.message,!0)}},children:"Remove"})]})}})],[u,e.id,e.name,n,r]),h=S_({data:e.members,columns:d,state:{sorting:s},onSortingChange:l,getCoreRowModel:b_(),getSortedRowModel:x_()});return g.jsx("div",{className:"admin-list admin-card-table",children:g.jsxs(aC,{className:"admin-table",children:[g.jsx(sC,{children:h.getHeaderGroups().map(m=>g.jsx(Eu,{children:m.headers.map(y=>g.jsx(uC,{header:y},y.id))},m.id))}),g.jsx(lC,{children:h.getRowModel().rows.map(m=>g.jsx(Eu,{className:"admin-item",children:m.getVisibleCells().map(y=>g.jsx(cC,{children:yu(y.column.columnDef.cell,y.getContext())},y.id))},m.id))})]})})}function I8({shares:e,onChanged:n}){const[r,i]=S.useState([]),s=S.useMemo(()=>c_(),[]),l=S.useMemo(()=>[s.accessor("path",{header:"Path",cell:d=>g.jsx("a",{className:"ai-main mono",href:d.row.original.url,target:"_blank",rel:"noopener noreferrer",title:d.getValue(),children:d.getValue()})}),s.accessor(d=>d.project_name||"",{id:"project",header:"Project",cell:d=>g.jsx("span",{className:"ai-tag",children:(d.getValue()||"")+(d.row.original.creator?" · by "+d.row.original.creator:"")+(d.row.original.created?" · "+new Date(d.row.original.created).toLocaleDateString():"")})}),s.display({id:"actions",header:"",cell:d=>g.jsx("button",{className:"ai-del","aria-label":`Revoke the share of ${d.row.original.path}`,onClick:async()=>{const h=d.row.original;if(await Qu("Revoke share link",`Revoke the public link to “${h.path}”? Anyone with the URL will lose access.`,"Revoke",!0))try{await er("DELETE","/api/shares/"+h.token),Xe("Share revoked."),n()}catch(m){Xe(m.message,!0)}},children:"Revoke"})})],[s,n]),u=S_({data:e,columns:l,state:{sorting:r},onSortingChange:i,getCoreRowModel:b_(),getSortedRowModel:x_()});return e.length===0?g.jsx("div",{className:"admin-list",children:g.jsx("div",{className:"admin-empty",children:"No public shares."})}):g.jsx("div",{className:"admin-list admin-card-table",children:g.jsxs(aC,{className:"admin-table",children:[g.jsx(sC,{children:u.getHeaderGroups().map(d=>g.jsx(Eu,{children:d.headers.map(h=>g.jsx(uC,{header:h},h.id))},d.id))}),g.jsx(lC,{children:u.getRowModel().rows.map(d=>g.jsx(Eu,{className:"admin-item",children:d.getVisibleCells().map(h=>g.jsx(cC,{children:yu(h.column.columnDef.cell,h.getContext())},h.id))},d.id))})]})})}const V8=yl({require_verification:Dx(),require_approval:Dx()});function F8(){const e=ka(),{data:n,error:r}=vn({queryKey:["admin","policy"],queryFn:()=>Nn("/api/admin/policy")}),{data:i}=o_(!0),s=tl({resolver:ol(V8),values:n?{require_verification:n.require_verification&&n.mailer,require_approval:n.require_approval}:{require_verification:!1,require_approval:!1}});if(S.useEffect(()=>{r&&Xe(r.message,!0)},[r]),!n)return null;const l=async(u,d,h)=>{try{await Ma(`/api/admin/pending/${u}/${d}`),Xe((d==="approve"?"Approved ":"Denied ")+h),e.invalidateQueries({queryKey:["admin","pending"]})}catch(m){Xe(m.message,!0)}};return g.jsxs("div",{className:"admin",children:[g.jsx("h1",{children:"Signup & access"}),g.jsx("p",{className:"admin-sub",children:"Who can create an account on this hub, and how new accounts are vetted."}),g.jsx("h3",{children:"New-account vetting"}),g.jsxs("form",{onSubmit:s.handleSubmit(async u=>{try{await Ma("/api/admin/policy",u),Xe("Signup policy saved."),e.invalidateQueries({queryKey:["admin","policy"]})}catch(d){Xe(d.message,!0)}}),children:[g.jsxs("div",{className:"admin-list",children:[g.jsx(Fx,{label:"Require email verification",desc:n.mailer?"New accounts must click an emailed link before they can sign in — proves they control the address.":"Configure SMTP on the server (auth.smtp) to enable email verification.",disabled:!n.mailer,inputProps:s.register("require_verification")}),g.jsx(Fx,{label:"Require admin approval",desc:"New accounts wait for a hub admin to approve them before they gain access.",inputProps:s.register("require_approval")})]}),g.jsx(Nt,{variant:"primary",type:"submit",style:{marginTop:14},disabled:!s.formState.isDirty,children:"Save policy"})]}),g.jsx("h3",{children:"Who can sign up"}),g.jsxs("div",{className:"admin-list",children:[g.jsxs("div",{className:"admin-item",children:[g.jsx("span",{className:"ai-main",children:"Allowed email domains"}),g.jsx("span",{className:"ai-tag",children:n.allowed_domains&&n.allowed_domains.length?n.allowed_domains.map(u=>"@"+u).join(", "):"any"})]}),g.jsxs("div",{className:"admin-item",children:[g.jsx("span",{className:"ai-main",children:"Self-signup"}),g.jsx("span",{className:"ai-tag",children:n.allow_signup?"open":"invite-only"})]}),g.jsxs("div",{className:"admin-item",children:[g.jsx("span",{className:"ai-main",children:"Hub admins"}),g.jsx("span",{className:"ai-tag",children:n.admins&&n.admins.length?n.admins.join(", "):"none"})]})]}),g.jsx("p",{className:"admin-sub",children:"Domains and admins are set in the server config file (they can't be widened from the browser)."}),g.jsx("h3",{children:"Pending signups"}),g.jsxs("div",{className:"admin-list",children:[(!i||i.length===0)&&g.jsx("div",{className:"admin-empty",children:"No one is waiting for approval."}),(i||[]).map(u=>g.jsxs("div",{className:"admin-item",children:[g.jsx("span",{className:"ai-main",children:(u.name?u.name+" · ":"")+u.email}),g.jsx(Nt,{variant:"primary",onClick:()=>l(u.id,"approve",u.email),children:"Approve"}),g.jsx("button",{className:"ai-del",onClick:()=>l(u.id,"deny",u.email),children:"Deny"})]},u.id))]})]})}function Fx({label:e,desc:n,disabled:r,inputProps:i}){return g.jsxs("label",{className:"admin-item toggle",style:r?{opacity:.55}:void 0,children:[g.jsxs("span",{className:"ai-main",children:[g.jsx("div",{className:"tg-label",children:e}),g.jsx("div",{className:"tg-desc",children:n})]}),g.jsx("input",{type:"checkbox",disabled:r,...i})]})}function P8({...e}){return g.jsx(Hw,{"data-slot":"select",...e})}function U8({...e}){return g.jsx(Zw,{"data-slot":"select-value",...e})}function H8({className:e,size:n="default",children:r,...i}){return g.jsxs(qw,{"data-slot":"select-trigger","data-size":n,className:et("flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",e),...i,children:[r,g.jsx(Kw,{asChild:!0,children:g.jsx(zp,{className:"size-4 opacity-50"})})]})}function B8({className:e,children:n,position:r="item-aligned",align:i="center",...s}){return g.jsx(Qw,{children:g.jsxs(Xw,{"data-slot":"select-content",className:et("relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,align:i,...s,children:[g.jsx(G8,{}),g.jsx(n1,{className:et("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:n}),g.jsx(Z8,{})]})})}function q8({className:e,children:n,...r}){return g.jsxs(a1,{"data-slot":"select-item",className:et("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...r,children:[g.jsx("span",{"data-slot":"select-item-indicator",className:"absolute right-2 flex size-3.5 items-center justify-center",children:g.jsx(c1,{children:g.jsx(q1,{className:"size-4"})})}),g.jsx(s1,{children:n})]})}function G8({className:e,...n}){return g.jsx(u1,{"data-slot":"select-scroll-up-button",className:et("flex cursor-default items-center justify-center py-1",e),...n,children:g.jsx(Rz,{className:"size-4"})})}function Z8({className:e,...n}){return g.jsx(d1,{"data-slot":"select-scroll-down-button",className:et("flex cursor-default items-center justify-center py-1",e),...n,children:g.jsx(zp,{className:"size-4"})})}const Px=["#5b8def","#f5a623","#4cc38a","#e0679b","#8b7bf0","#3ec8c8","#e6934a"];function al(e){let n=0;for(const r of e)n=n*31+r.charCodeAt(0)>>>0;return Px[n%Px.length]}function Ux({projects:e,currentId:n,menu:r}){const i=Ip(),s=e.find(u=>u.id===n),l=async()=>{const u=await $p("New project","Project name","","Create");if(u!==null)try{const d=await Ma("/api/projects",{name:u});await i(),fn("/"+d.project.id),Xe(`Created “${d.project.name}”.`)}catch(d){Xe("Could not create the project: "+d.message,!0)}};return g.jsxs("nav",{id:"projects","aria-label":"Projects",children:[g.jsxs("div",{className:"nav-head",children:[g.jsx("span",{children:"Projects"}),g.jsx("button",{className:"nav-add",title:"New project","aria-label":"New project",onClick:l,children:"+"})]}),g.jsx("div",{className:"proj-row",children:g.jsxs(P8,{value:n||"",onValueChange:u=>{u&&u!==n&&(fn("/"+u),hr())},children:[g.jsxs(H8,{id:"project-select","aria-label":`Switch project — current: ${s?.name??"none"}`,title:s?.name,className:"proj-trigger",children:[s&&g.jsx("span",{className:"proj-mark","aria-hidden":"true",style:{background:al(s.name)},children:g.jsx(Ta,{name:s.icon})}),s?g.jsx("span",{"data-slot":"select-value",children:s.name}):g.jsx(U8,{placeholder:"Select a project"})]}),g.jsx(B8,{className:"proj-menu",position:"popper",sideOffset:4,children:e.map(u=>g.jsxs(q8,{value:u.id,children:[g.jsx("span",{className:"proj-mark","aria-hidden":"true",style:{background:al(u.name)},children:g.jsx(Ta,{name:u.icon})}),u.name]},u.id))})]})}),r&&g.jsx("ul",{className:"nav-menu","aria-label":"Project pages",children:[["dashboard","Dashboard","dashboard",r.onDashboard],["install","Installation","terminal",r.onInstall],["history","History","hist",r.onHistory],["settings","Settings","gear",r.onSettings]].map(([u,d,h,m])=>g.jsx("li",{children:g.jsxs("div",{id:"nav-"+u,className:"row"+(r.active===u?" active":""),role:"button",tabIndex:0,onClick:m,onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),m())},children:[g.jsx(Yt,{name:h}),g.jsx("span",{className:"label",children:d})]})},u))})]})}function dC({...e}){return g.jsx(oj,{"data-slot":"dropdown-menu",...e})}function fC({...e}){return g.jsx(ij,{"data-slot":"dropdown-menu-trigger",...e})}function hC({className:e,sideOffset:n=4,...r}){return g.jsx(aj,{children:g.jsx(sj,{"data-slot":"dropdown-menu-content",sideOffset:n,className:et("z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",e),...r})})}function Bs({className:e,inset:n,variant:r="default",...i}){return g.jsx(cj,{"data-slot":"dropdown-menu-item","data-inset":n,"data-variant":r,className:et("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!",e),...i})}function Qh({className:e,inset:n,...r}){return g.jsx(lj,{"data-slot":"dropdown-menu-label","data-inset":n,className:et("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r})}function K8({me:e,org:n,admin:r,orgActive:i}){const s=e.name||e.email,[l,u]=S.useState(!1),d=n?l_(n.manage_url):null;return g.jsx("footer",{id:"accountbar",children:g.jsxs(dC,{modal:!1,open:l,onOpenChange:u,children:[g.jsx(fC,{asChild:!0,children:g.jsxs("button",{id:"account-btn",className:i?"active":void 0,"aria-label":"Account menu",children:[g.jsx("span",{className:"avatar",style:{background:al(e.email)},"aria-hidden":"true",children:(s.trim()[0]||"?").toUpperCase()}),g.jsxs("span",{className:"acct",children:[g.jsx("b",{children:s}),e.name&&g.jsx("small",{children:e.email})]}),g.jsx(Yt,{name:"chev"})]})}),g.jsxs(hC,{id:"account-menu",side:"top",align:"start",sideOffset:6,className:"acct-menu",children:[n&&g.jsxs(g.Fragment,{children:[g.jsx(Qh,{className:"menu-sec",children:"Organization"}),g.jsx(Bs,{asChild:!0,children:g.jsxs("a",{id:"menu-org-settings","aria-current":i?"page":void 0,...d,onClick:h=>{d?.onClick?.(h),u(!1)},children:[g.jsx(Yt,{name:"gear"}),g.jsxs("span",{children:[g.jsx("b",{children:n.name})," Settings"]}),!n.manage_url.startsWith("/")&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"ext","aria-hidden":"true",children:"↗"}),g.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]})]})})]}),r&&g.jsxs(g.Fragment,{children:[g.jsx(Qh,{className:"menu-sec",children:"Hub"}),g.jsxs(Bs,{id:"menu-hub-admin",onSelect:r.onClick,children:[g.jsx(Yt,{name:"shield"}),g.jsxs("span",{children:["Signup & access",r.pending?` · ${r.pending}`:""]})]})]}),g.jsx(Qh,{className:"menu-sec",children:"Account"}),g.jsx(Bs,{asChild:!0,children:g.jsxs("a",{id:"signout",href:"/auth/logout",children:[g.jsx(Yt,{name:"power"}),g.jsx("span",{children:"Log out"})]})})]})]})})}function nu({className:e,...n}){return g.jsx("div",{"data-slot":"card",className:et("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...n})}function ru({className:e,...n}){return g.jsx("div",{"data-slot":"card-header",className:et("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...n})}function ou({className:e,...n}){return g.jsx("div",{"data-slot":"card-title",className:et("leading-none font-semibold",e),...n})}function mC({className:e,...n}){return g.jsx("div",{"data-slot":"card-description",className:et("text-muted-foreground text-sm",e),...n})}function iu({className:e,...n}){return g.jsx("div",{"data-slot":"card-content",className:et("px-6",e),...n})}function Y8({className:e,type:n,...r}){return g.jsx("input",{type:n,"data-slot":"input",className:et("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",e),...r})}function Xh({className:e,...n}){return g.jsx(dj,{"data-slot":"label",className:et("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...n})}function Fs({className:e,orientation:n="horizontal",decorative:r=!0,...i}){return g.jsx(Fj,{"data-slot":"separator",decorative:r,orientation:n,className:et("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...i})}function Q8({className:e,...n}){return g.jsx("textarea",{"data-slot":"textarea",className:et("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...n})}const Hx={read:1,write:2,admin:3};function Ru(e,n){return(Hx[e||""]||0)>=(Hx[n]||0)}const Pm=280,X8=yl({name:Aa().trim().min(1,"Give the project a name.").max(120,"Keep the name under 120 characters."),description:Aa().max(Pm,`Keep the description under ${Pm} characters.`),icon:Aa()});function J8({project:e,org:n,onDeleted:r}){const i=Ip(),s=Ru(e.perm,"admin"),l=tl({resolver:ol(X8),defaultValues:{name:e.name,description:e.description??"",icon:e.icon??""}});S.useEffect(()=>{l.reset({name:e.name,description:e.description??"",icon:e.icon??""})},[e.id,e.name,e.description,e.icon]);const u=l.watch("icon"),d=l.watch("description"),h=l.handleSubmit(async m=>{const y=l.formState.dirtyFields,v={};if(y.name&&(v.name=m.name.trim()),y.description&&(v.description=m.description),y.icon&&(v.icon=m.icon),Object.keys(v).length!==0)try{await er("PATCH","/api/projects/"+e.id,v),Xe("Saved."),l.reset({...m,name:m.name.trim()}),await i()}catch(b){Xe(b.message,!0)}});return g.jsxs("div",{className:"project-settings",children:[g.jsxs("h2",{children:[e.name,!Ru(e.perm,"write")&&g.jsx("span",{className:"ps-chip",children:"Read-only"})]}),g.jsxs(nu,{children:[g.jsxs(ru,{children:[g.jsx(ou,{children:"General"}),g.jsx(mC,{children:"Name, description and icon for this project."})]}),g.jsx(Fs,{}),g.jsx(iu,{children:g.jsxs("form",{className:"ps-form",onSubmit:h,children:[g.jsxs("div",{className:"ps-field",children:[g.jsx(Xh,{htmlFor:"ps-icon-btn",children:"Icon"}),g.jsxs("div",{className:"ps-icon-row",children:[g.jsx("span",{className:"proj-mark","aria-hidden":"true",style:{background:al(e.name)},children:g.jsx(Ta,{name:u})}),g.jsxs(dC,{children:[g.jsx(fC,{asChild:!0,children:g.jsx(Nt,{id:"ps-icon-btn",type:"button",variant:"subtle",disabled:!s,children:"Change"})}),g.jsxs(hC,{align:"start",className:"ps-icon-grid",children:[g.jsx(Bs,{className:"ps-icon-cell"+(u===""?" active":""),title:"Default","aria-label":"Default icon",onSelect:()=>l.setValue("icon","",{shouldDirty:!0}),children:g.jsx(Ta,{})}),Object.keys(n_).map(m=>g.jsx(Bs,{className:"ps-icon-cell"+(u===m?" active":""),title:m,"aria-label":m,onSelect:()=>l.setValue("icon",m,{shouldDirty:!0}),children:g.jsx(Ta,{name:m})},m))]})]})]})]}),g.jsxs("div",{className:"ps-field",children:[g.jsx(Xh,{htmlFor:"ps-name",children:"Name"}),g.jsx(Y8,{id:"ps-name",disabled:!s,"aria-invalid":!!l.formState.errors.name,"aria-describedby":l.formState.errors.name?"ps-name-err":void 0,...l.register("name")}),l.formState.errors.name&&g.jsx("span",{id:"ps-name-err",role:"alert",className:"field-err",children:l.formState.errors.name.message})]}),g.jsxs("div",{className:"ps-field",children:[g.jsxs(Xh,{htmlFor:"ps-desc",children:["Description ",g.jsx("span",{className:"ps-opt",children:"(optional)"})]}),g.jsx(Q8,{id:"ps-desc",rows:2,disabled:!s,placeholder:"What this project is for.","aria-invalid":!!l.formState.errors.description,"aria-describedby":l.formState.errors.description?"ps-desc-err":void 0,...l.register("description")}),g.jsxs("div",{className:"ps-meta",children:[l.formState.errors.description?g.jsx("span",{id:"ps-desc-err",role:"alert",className:"field-err",children:l.formState.errors.description.message}):g.jsx("span",{}),g.jsxs("span",{className:"ps-count",children:[d.length," / ",Pm]})]})]}),s&&g.jsxs(g.Fragment,{children:[g.jsx(Fs,{}),g.jsx("div",{className:"ps-actions",children:g.jsx(Nt,{id:"ps-save",type:"submit",variant:"primary",disabled:!l.formState.isDirty||l.formState.isSubmitting,children:"Save changes"})})]})]})})]}),g.jsxs(nu,{children:[g.jsx(ru,{children:g.jsx(ou,{children:"About"})}),g.jsx(Fs,{}),g.jsx(iu,{children:g.jsxs("dl",{className:"ps-facts",children:[g.jsx("dt",{children:"Project id"}),g.jsx("dd",{children:g.jsx("code",{children:e.id})}),n&&g.jsxs(g.Fragment,{children:[g.jsx("dt",{children:"Workspace"}),g.jsx("dd",{children:n.name})]}),e.created&&g.jsxs(g.Fragment,{children:[g.jsx("dt",{children:"Created"}),g.jsx("dd",{children:new Date(e.created).toLocaleDateString()})]})]})})]}),g.jsx(e$,{project:e,org:n}),s&&g.jsxs(nu,{className:"ps-danger",children:[g.jsx(ru,{children:g.jsx(ou,{children:"Danger zone"})}),g.jsx(Fs,{}),g.jsxs(iu,{children:[g.jsx("p",{children:"Deleting removes the project from this hub. Its files stay in storage. This can't be undone."}),g.jsx(Nt,{variant:"danger",onClick:async()=>{if(await $p(`Delete “${e.name}”?`,"This can't be undone. Type the project name to confirm:","","Delete project",{match:e.name,danger:!0})!==null)try{await er("DELETE","/api/projects/"+e.id),Xe(`Deleted “${e.name}”.`),await r()}catch(y){Xe(y.message,!0)}},children:"Delete project"})]})]})]})}const Um=[{value:"admin",label:"Admin"},{value:"write",label:"Write"},{value:"read",label:"Read"},{value:"none",label:"No access"}],W8=Object.fromEntries(Um.map(e=>[e.value,e.label]));function e$({project:e,org:n}){const r=ka(),{data:i,error:s}=Pk(e.id),l=Ru(e.perm,"admin"),u=()=>{r.invalidateQueries({queryKey:["permissions",e.id]}),r.invalidateQueries({queryKey:["projects"]})},d=async(x,C)=>{try{await x(),Xe(C)}catch(_){Xe(_.message,!0)}u()};if(s||!i)return null;const h=i,m=`/api/p/${e.id}/permissions`,y=new Set((n?.members||[]).filter(x=>x.role==="owner").map(x=>x.email.toLowerCase())),v=[...h.grants.filter(x=>!y.has(x.email.toLowerCase())),...[...y].sort().map(x=>({email:x,level:"admin",owner:!0}))],b=async()=>{const x=await $p("Add an exception","Email of a workspace member. They get Read access; change it in the table.","","Add");x===null||!x.trim()||await d(()=>er("PUT",`${m}/${encodeURIComponent(x.trim())}`,{level:"read"}),"Added.")};return g.jsxs(nu,{className:"ps-people",children:[g.jsxs(ru,{children:[g.jsx(ou,{children:"People"}),g.jsx(mC,{children:"Who can see and change this project."})]}),g.jsx(Fs,{}),g.jsxs(iu,{children:[g.jsxs("p",{className:"ps-row",children:[g.jsxs("span",{children:["Everyone in ",n?.name||"this workspace"," can"]}),g.jsx("select",{"aria-label":"Default access for workspace members",disabled:!l,value:h.default,onChange:async x=>{const C=x.target.value;if(C==="none"&&!await Qu("Make this project invite-only?","Only people listed below (and workspace owners) will see this project.","Make invite-only")){u();return}await d(()=>er("PUT",m,{default:C}),"Default access updated.")},children:Um.filter(x=>x.value!=="admin").map(x=>g.jsx("option",{value:x.value,children:x.label},x.value))})]}),h.default==="none"&&g.jsx("p",{className:"ps-note",children:"This project is invite-only: only the people below and workspace owners can see it."}),g.jsxs("div",{className:"ps-people-head",children:[g.jsx("h4",{children:"Exceptions"}),l&&g.jsx(Nt,{type:"button",variant:"subtle",onClick:b,children:"+ Add"})]}),v.length===0?g.jsx("p",{className:"ps-note",children:"No exceptions — everyone gets the access above."}):g.jsx("div",{className:"admin-list",children:v.map(x=>{const C="owner"in x;return g.jsxs("div",{className:"admin-item",children:[g.jsxs("span",{className:"ai-main",title:x.email,children:[x.email,h.creator&&x.email.toLowerCase()===h.creator.toLowerCase()&&g.jsx("span",{className:"ai-tag",children:" (creator)"})]}),C?g.jsx("span",{className:"ai-tag",children:"Workspace owner — always admin"}):g.jsxs("span",{className:"role-cell",children:[g.jsx("select",{"aria-label":`Access for ${x.email}`,disabled:!l,value:x.level,onChange:_=>d(()=>er("PUT",`${m}/${encodeURIComponent(x.email)}`,{level:_.target.value}),`${x.email} is now ${W8[_.target.value]||_.target.value}.`),children:Um.map(_=>g.jsx("option",{value:_.value,children:_.label},_.value))}),l&&g.jsx("button",{className:"ai-del","aria-label":`Remove exception for ${x.email}`,onClick:()=>d(()=>er("DELETE",`${m}/${encodeURIComponent(x.email)}`),"Reverted to the default access."),children:"Remove"})]})]},x.email)})})]})]})}const Jh=[{key:"claude",label:"Claude Code & Cowork"},{key:"hermes",label:"Hermes",agent:"hermes",skillDir:"~/.hermes/skills/beardrive/"},{key:"codex",label:"Codex",agent:"codex",skillDir:"~/.codex/skills/beardrive/",extra:"Codex asks once to trust the project's .codex hooks layer — answer yes (or run /hooks) and from then on every turn pulls, edits push automatically, and reads are reported to Insights."}];function t$(e,n){const r=window.location.origin,i=n.id;return e.key==="claude"?[{title:"Add the BearDrive plugin",desc:"One time, in any Claude Code session. The plugin ships the beardrive skill, the /beardrive commands, and turn-boundary sync hooks — and Claude Cowork shares the same plugins, so installing it once covers both.",code:`/plugin marketplace add runbear-io/beardrive +/plugin install beardrive@beardrive`},{title:"Set up this project conversationally",desc:"In a Claude Code or Cowork session in the folder where you want the files, run:",code:"/beardrive:install connect to "+r+", project "+i,extra:"Claude installs the CLI, signs this machine in, mounts the project, and registers the sync hooks — pull the latest before every turn, push after edits (stamped with the session that made them), and report file reads to Insights. It asks before anything it changes."}]:[{title:"Paste this into "+e.label,desc:"Start "+e.label+" in the folder where you want the files (an existing folder works too — contents merge), then paste:",code:n$(e,n),extra:"Approve the shell commands when it asks. It installs the CLI, signs this machine in (it hands you a code and a URL — the folder itself never holds credentials), mounts the project, and registers the sync hooks: pull before every turn, push after edits stamped with the session that made them, file reads into Insights. It also keeps the beardrive skill in "+e.skillDir+", so from here on you can just ask."+(e.extra?" "+e.extra:"")}]}function n$(e,n){return["Set up BearDrive in this folder.","1. If `bdrive` is missing, install it: brew install runbear-io/tap/beardrive"," (no Homebrew? grab the release binary for this OS/arch from"," https://github.com/runbear-io/beardrive/releases)","2. bdrive skill install --agent "+e.agent+" # so you know the CLI next time","3. bdrive login --device "+window.location.origin+" # show me the code and the URL","4. bdrive init --project "+n.id,"5. bdrive hooks install # don't skip this - it's what syncs every turn","Then tell me what got set up."].join(` +`)}function r$(e,n){return`brew install runbear-io/tap/beardrive +bdrive skill install --agent `+e.agent+` +bdrive login `+window.location.origin+` +bdrive init --project `+n.id+` +bdrive hooks install --agent `+e.agent}function o$(){try{return localStorage.getItem("bdrive-guide-agent")||"claude"}catch{return"claude"}}function pC({project:e}){const[n,r]=S.useState(o$),i=Jh.find(l=>l.key===n)||Jh[0],s=t$(i,e);return g.jsxs("div",{className:"guide",children:[g.jsxs("h1",{className:"in-title gd-head",children:[g.jsx("span",{className:"proj-mark","aria-hidden":"true",style:{background:al(e.name)},children:g.jsx(Ta,{name:e.icon})}),e.name]}),e.description&&g.jsx("p",{className:"in-desc",children:e.description}),g.jsx("p",{className:"dl-sub",children:"Mount this project as a folder on any machine and connect your coding agent: files sync both ways in the background, every change is journaled with who made it, and agent reads feed Insights."}),g.jsx("div",{className:"gd-tabs",children:Jh.map(l=>g.jsx("button",{className:"gd-tab"+(l.key===i.key?" active":""),"data-key":l.key,onClick:()=>{r(l.key);try{localStorage.setItem("bdrive-guide-agent",l.key)}catch{}},children:l.label},l.key))}),g.jsxs("div",{className:"gd-body",children:[s.map((l,u)=>g.jsxs("div",{className:"gd-step"+(s.length>1?"":" gd-solo"),children:[g.jsxs("div",{className:"gd-step-head",children:[s.length>1&&g.jsx("span",{className:"gd-num",children:u+1}),g.jsx("span",{className:"gd-step-title",children:l.title})]}),l.desc&&g.jsx("p",{className:"gd-desc",children:l.desc}),l.code&&g.jsx(Bx,{code:l.code}),l.extra&&g.jsx("p",{className:"gd-desc gd-extra",children:l.extra})]},u)),i.agent&&g.jsxs("details",{className:"gd-manual",children:[g.jsx("summary",{children:"Or run it yourself"}),g.jsx("p",{className:"gd-desc",children:"Same result, in the folder you want the files. Don't skip the last line — the hooks are what keep every turn starting from the latest state."}),g.jsx(Bx,{code:r$(i,e)})]}),g.jsx("p",{className:"gd-done",children:"That's it — the folder now syncs on its own. Every agent turn starts from the latest state, edits appear here (and on every teammate's mount) within seconds, and what your agents read shows up in Insights."})]})]})}function Bx({code:e}){const[n,r]=S.useState("Copy");return g.jsxs("pre",{className:"gd-code",children:[g.jsx("code",{children:e}),g.jsx("button",{className:"gd-copy",onClick:async()=>{r(await il(e)?"Copied":"Copy failed"),setTimeout(()=>r("Copy"),1400)},children:n})]})}const i$=yl({invite:Aa().trim().refine(e=>/join\/([0-9a-f]+)/.test(e)||/^[0-9a-f]{8,}$/.test(e),{message:"That doesn't look like an invite link."})}),a$=yl({name:Aa().trim().min(1,"Give the project a name.").max(60,"Keep it under 60 characters.")});function s$({authEnabled:e,onCreate:n}){const r=tl({resolver:ol(i$),defaultValues:{invite:""}}),i=tl({resolver:ol(a$),defaultValues:{name:""}});return g.jsxs("div",{className:"onboard",children:[g.jsx("h1",{children:"Welcome to BearDrive"}),g.jsx("p",{children:"You're signed in, but you're not part of any project yet."}),e&&g.jsxs("div",{className:"ob-card",children:[g.jsx("h3",{children:"Have an invite link?"}),g.jsx("p",{children:"A teammate can send you a join link. Paste it here:"}),g.jsxs("form",{className:"ob-row",onSubmit:r.handleSubmit(({invite:s})=>{const l=s.match(/join\/([0-9a-f]+)/)||s.match(/^([0-9a-f]{8,})$/);location.href="/join/"+l[1]}),children:[g.jsx("input",{id:"ob-invite",type:"text",placeholder:"https://…/join/…",autoComplete:"off",...r.register("invite")}),g.jsx(Nt,{id:"ob-join",variant:"primary",type:"submit",children:"Join"})]}),r.formState.errors.invite&&g.jsx("p",{className:"field-err",children:r.formState.errors.invite.message})]}),g.jsxs("div",{className:"ob-card",children:[g.jsx("h3",{children:"Or start a new project"}),g.jsx("p",{children:"Create a shared space for your team's files."}),g.jsxs("form",{className:"ob-row",onSubmit:i.handleSubmit(({name:s})=>n(s)),children:[g.jsx("input",{id:"ob-name",type:"text",placeholder:"Project name, e.g. wiki",autoComplete:"off",...i.register("name")}),g.jsx(Nt,{id:"ob-create",variant:"primary",type:"submit",children:"Create"})]}),i.formState.errors.name&&g.jsx("p",{className:"field-err",children:i.formState.errors.name.message})]})]})}function l$(e,n=!0){const r=vn({queryKey:["tree",e],queryFn:()=>Nn(e+"tree"),enabled:n,refetchInterval:15e3}),i=S.useMemo(()=>{const s=[],l=new Map,u=d=>{for(const h of d.children||[])h.dir?(l.set(h.path,h),u(h)):s.push(h)};return r.data&&u(r.data),{flatFiles:s,dirIndex:l}},[r.data]);return{tree:r.data,...i,loaded:!!r.data}}function c$(e,n){return vn({queryKey:["heat",e],queryFn:()=>Nn(e+"heat?days=30"),enabled:n,staleTime:6e4,refetchInterval:6e4}).data?.entries??null}function u$(e,n,r){return vn({queryKey:["history",e,"prefix",n,20],queryFn:()=>Nn(e+"history?prefix="+encodeURIComponent(n)+"&n=20"),enabled:r,staleTime:15e3}).data?.entries??null}function qx(e,n,r){if(!e)return null;if(!r)return e[n]||null;const i={human:0,agent:0,share:0};for(const[s,l]of Object.entries(e))s.startsWith(n+"/")&&(i.human+=l.human||0,i.agent+=l.agent||0,i.share+=l.share||0);return i.human||i.agent||i.share?i:null}function sl(e){return(e.human||0)+(e.agent||0)+(e.share||0)}function au(e){const n=sl(e);if(!n)return"";let r=n+(n===1?" read":" reads");return e.agent&&(r+=" ("+e.agent+" agent)"),r}function d$(e){const n=sl(e);return n?n<3?1:n<10?2:n<30?3:4:0}function f$(e,n,r){const i=new Array(e);return new Proxy(i,{get(s,l,u){if(typeof l=="string"){const d=l.charCodeAt(0);if(d>=48&&d<=57){const h=+l;if(Number.isInteger(h)&&h>=0&&hi[y]!==m))&&(i=d,s=n(...d),r?.onChange&&!(l&&r.skipInitialOnChange)&&r.onChange(s),l=!1),s}return u.updateDeps=d=>{i=d},u}function Gx(e,n){if(e===void 0)throw new Error("Unexpected undefined");return e}const h$=(e,n)=>Math.abs(e-n)<1.01,m$=(e,n,r)=>{let i;return function(...s){e.clearTimeout(i),i=e.setTimeout(()=>n.apply(this,s),r)}};let ks;const Wh=()=>{if(ks!==void 0)return ks;if(typeof navigator>"u")return ks=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return ks=!0;const e=navigator.maxTouchPoints;return ks=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Zx=e=>{const{offsetWidth:n,offsetHeight:r}=e;return{width:n,height:r}},p$=e=>e,g$=e=>{const n=Math.max(e.startIndex-e.overscan,0),i=Math.min(e.endIndex+e.overscan,e.count-1)-n+1,s=new Array(i);for(let l=0;l{const r=e.scrollElement;if(!r)return;const i=e.targetWindow;if(!i)return;const s=u=>{const{width:d,height:h}=u;n({width:Math.round(d),height:Math.round(h)})};if(s(Zx(r)),!i.ResizeObserver)return()=>{};const l=new i.ResizeObserver(u=>{const d=()=>{const h=u[0];if(h?.borderBoxSize){const m=h.borderBoxSize[0];if(m){s({width:m.inlineSize,height:m.blockSize});return}}s(Zx(r))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return l.observe(r,{box:"border-box"}),()=>{l.unobserve(r)}},Tu={passive:!0},y$=typeof window>"u"?!0:"onscrollend"in window,b$=(e,n,r)=>{const i=e.scrollElement;if(!i)return;const s=e.targetWindow;if(!s)return;const l=e.options.useScrollendEvent&&y$;let u=0;const d=l?null:m$(s,()=>n(u,!1),e.options.isScrollingResetDelay),h=v=>()=>{u=r(i),d?.(),n(u,v)},m=h(!0),y=h(!1);return i.addEventListener("scroll",m,Tu),l&&i.addEventListener("scrollend",y,Tu),()=>{i.removeEventListener("scroll",m),l&&i.removeEventListener("scrollend",y)}},x$=(e,n)=>b$(e,n,r=>{const{horizontal:i,isRtl:s}=e.options;return i?r.scrollLeft*(s&&-1||1):r.scrollTop}),S$=(e,n,r)=>{if(r.options.useCachedMeasurements){const i=r.indexFromElement(e),s=r.options.getItemKey(i);return r.itemSizeCache.get(s)??r.options.estimateSize(i)}if(n?.borderBoxSize){const i=n.borderBoxSize[0];if(i)return Math.round(i[r.options.horizontal?"inlineSize":"blockSize"])}if(!n){const i=r.indexFromElement(e),s=r.options.getItemKey(i),l=r.itemSizeCache.get(s);if(l!==void 0)return l}return e[r.options.horizontal?"offsetWidth":"offsetHeight"]},w$=(e,{adjustments:n=0,behavior:r},i)=>{var s,l;(l=(s=i.scrollElement)==null?void 0:s.scrollTo)==null||l.call(s,{[i.options.horizontal?"left":"top"]:e+n,behavior:r})},_$=w$;class C${constructor(n){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var r,i,s;return((s=(i=(r=this.targetWindow)==null?void 0:r.performance)==null?void 0:i.now)==null?void 0:s.call(i))??Date.now()},this.observer=(()=>{let r=null;const i=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(s=>{s.forEach(l=>{const u=()=>{const d=l.target,h=this.indexFromElement(d);if(!d.isConnected){this.observer.unobserve(d);for(const[m,y]of this.elementsCache)if(y===d){this.elementsCache.delete(m);break}return}this.shouldMeasureDuringScroll(h)&&this.resizeItem(h,this.options.measureElement(d,l,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(u):u()})}));return{disconnect:()=>{var s;(s=i())==null||s.disconnect(),r=null},observe:s=>{var l;return(l=i())==null?void 0:l.observe(s,{box:"border-box"})},unobserve:s=>{var l;return(l=i())==null?void 0:l.unobserve(s)}}})(),this.range=null,this.setOptions=r=>{var i,s;const l={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:p$,rangeExtractor:g$,onChange:()=>{},measureElement:S$,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const b in r){const x=r[b];x!==void 0&&(l[b]=x)}const u=this.options;let d=null,h=null,m=!1;if(u!==void 0&&u.enabled&&l.enabled&&l.anchorTo==="end"&&this.scrollElement!==null){const b=u.count,x=l.count,C=this.getMeasurements(),_=b>0?((i=C[0])==null?void 0:i.key)??u.getItemKey(0):null,E=b>0?((s=C[b-1])==null?void 0:s.key)??u.getItemKey(b-1):null;if(x!==b||b>0&&x>0&&(l.getItemKey(0)!==_||l.getItemKey(x-1)!==E)){m=!0;const A=b>0?this.getVirtualItemForOffset(this.getScrollOffset())??C[0]:null;A&&(d=[A.key,this.getScrollOffset()-A.start]);const k=l.followOnAppend===!0?"auto":l.followOnAppend||null;k&&x>b&&this.isAtEnd(u.scrollEndThreshold)&&(b===0||l.getItemKey(x-1)!==E)&&(h=k)}}this.options=l,m&&(this.pendingMin=0,this.itemSizeCacheVersion++);let y=!1,v=0;if(d&&this.scrollOffset!==null){const[b,x]=d,C=this.getMeasurements(),{count:_,getItemKey:E}=this.options;let T=0;for(;T<_&&E(T)!==b;)T++;if(T<_){const O=C[T];if(O){const A=O.start+x;A!==this.scrollOffset&&(v=A-this.scrollOffset,this.scrollOffset=A,y=!0)}}}(y||h)&&(this.pendingScrollAnchor=[y?d[0]:null,y?d[1]:0,h,v])},this.notify=r=>{var i,s;(s=(i=this.options).onChange)==null||s.call(i,this,r)},this.maybeNotify=ba(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}if(this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(l=>{this.observer.observe(l)}),this.unsubs.push(this.options.observeElementRect(this,l=>{this.scrollRect=l,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(l,u)=>{if(u&&this._intendedScrollOffset===null&&l===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(l-this._intendedScrollOffset)<1.5&&(l=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;const d=this.getScrollOffset();this.scrollDirection=u?d===l?this.scrollDirection:d{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},d=()=>{this._iosTouching=!1,!(!Wh()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};l.addEventListener("touchstart",u,Tu),l.addEventListener("touchend",d,Tu),this.unsubs.push(()=>{l.removeEventListener("touchstart",u),l.removeEventListener("touchend",d),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const s=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,s&&this.scrollElement&&this.options.enabled){const[l,u,d,h]=s;l!==null&&!d&&(Wh()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?h!==0&&(this._iosDeferredAdjustment+=h):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),d&&this.scrollToEnd({behavior:d})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const r=this.getScrollOffset(),i=this.getMaxScrollOffset();if(r<0||r>i)return;const s=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(r,{adjustments:this.scrollAdjustments+=s,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=ba(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(r,i,s,l,u,d,h,m)=>(this.prevLanes!==void 0&&this.prevLanes!==d&&(this.lanesChangedFlag=!0),this.prevLanes=d,this.pendingMin=null,{count:r,paddingStart:i,scrollMargin:s,getItemKey:l,enabled:u,lanes:d,laneAssignmentMode:h,gap:m}),{key:!1}),this.getMeasurements=ba(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:r,paddingStart:i,scrollMargin:s,getItemKey:l,enabled:u,lanes:d,laneAssignmentMode:h,gap:m},y)=>{const v=this.itemSizeCache;if(!u)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const T of this.laneAssignments.keys())T>=r&&this.laneAssignments.delete(T);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(T=>{this.itemSizeCache.set(T.key,T.size)}));const b=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1),d===1){const T=r*2;let O=this._flatMeasurements;if(!O||O.length0&&L.set(O.subarray(0,b*2)),O=L,this._flatMeasurements=O}let A;if(b===0)A=i+s;else{const L=b-1;A=O[L*2]+O[L*2+1]+m}for(let L=b;L1){k=A;const ve=C[k],de=ve!==void 0?x[ve]:void 0;L=de?de.end+m:i+s}else if(E===d){let ve=0,de=_[0],le=C[0];for(let ae=1;aethis.options.debug}),this.calculateRange=ba(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,i,s,l)=>r.length===0||i===0?(this.range=null,null):(this.range=R$(r,i,s,l,l===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=ba(()=>{let r=null,i=null;const s=this.calculateRange();return s&&(r=s.startIndex,i=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,i]},(r,i,s,l,u)=>l===null||u===null?[]:r({startIndex:l,endIndex:u,overscan:i,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=r=>{const i=this.options.indexAttribute,s=r.getAttribute(i);return s?parseInt(s,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=r=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const s=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(s!==void 0&&this.range){const l=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),u=Math.max(0,s-l),d=Math.min(this.options.count-1,s+l);return r>=u&&r<=d}return!0},this.measureElement=r=>{if(!r){this.elementsCache.forEach((u,d)=>{u.isConnected||(this.observer.unobserve(u),this.elementsCache.delete(d))});return}const i=this.indexFromElement(r),s=this.options.getItemKey(i),l=this.elementsCache.get(s);l!==r&&(l&&this.observer.unobserve(l),this.observer.observe(r),this.elementsCache.set(s,r)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(r,void 0,this))},this.resizeItem=(r,i)=>{var s,l;if(r<0||r>=this.options.count)return;let u,d,h;const m=this._flatMeasurements;if(this.options.lanes===1&&m!==null)h=this.options.getItemKey(r),d=m[r*2],u=m[r*2+1];else{const b=this.measurementsCache[r];if(!b)return;h=b.key,d=b.start,u=b.size}const y=this.itemSizeCache.get(h)??u,v=i-y;if(v!==0){const b=this.options.anchorTo==="end"&&((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,x=b?this.getTotalSize():0,C=((l=this.scrollState)==null?void 0:l.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[r]??{index:r,key:h,start:d,size:u,end:d+u,lane:0},v,this):d[this.getVirtualIndexes(),this.getMeasurements()],(r,i)=>{const s=[];for(let l=0,u=r.length;lthis.options.debug}),this.getVirtualItemForOffset=r=>{const i=this.getMeasurements();if(i.length===0)return;const s=this._flatMeasurements,l=this.options.lanes===1&&s!=null,u=gC(0,i.length-1,l?d=>s[d*2]:d=>Gx(i[d]).start,r);return Gx(i[u])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const r=this.scrollElement.document.documentElement;return this.options.horizontal?r.scrollWidth-this.scrollElement.innerWidth:r.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(r=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=r,this.getOffsetForAlignment=(r,i,s=0)=>{if(!this.scrollElement)return 0;const l=this.getSize(),u=this.getScrollOffset();i==="auto"&&(i=r>=u+l?"end":"start"),i==="center"?r+=(s-l)/2:i==="end"&&(r-=l);const d=this.getMaxScrollOffset();return Math.max(Math.min(d,r),0)},this.getOffsetForIndex=(r,i="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const s=this.getSize(),l=this.getScrollOffset(),u=this.measurementsCache[r];if(!u)return;if(i==="auto")if(u.end>=l+s-this.options.scrollPaddingEnd)i="end";else if(u.start<=l+this.options.scrollPaddingStart)i="start";else return[l,i];if(i==="end"&&r===this.options.count-1)return[this.getMaxScrollOffset(),i];const d=i==="end"?u.end+this.options.scrollPaddingEnd:u.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(d,i,u.size),i]},this.scrollToOffset=(r,{align:i="start",behavior:s="auto"}={})=>{const l=this.getOffsetForAlignment(r,i),u=this.now();this.scrollState={index:null,align:i,behavior:s,startedAt:u,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToIndex=(r,{align:i="auto",behavior:s="auto"}={})=>{r=Math.max(0,Math.min(r,this.options.count-1));const l=this.getOffsetForIndex(r,i);if(!l)return;const[u,d]=l,h=this.now();this.scrollState={index:r,align:d,behavior:s,startedAt:h,lastTargetOffset:u,stableFrames:0},this._scrollToOffset(u,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollBy=(r,{behavior:i="auto"}={})=>{const s=this.getScrollOffset()+r,l=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:l,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:r="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:r});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:r})},this.getTotalSize=()=>{var r;const i=this.getMeasurements();let s;if(i.length===0)s=this.options.paddingStart;else if(this.options.lanes===1){const l=i.length-1,u=this._flatMeasurements;u!=null?s=u[l*2]+u[l*2+1]:s=((r=i[l])==null?void 0:r.end)??0}else{const l=Array(this.options.lanes).fill(null);let u=i.length-1;for(;u>=0&&l.some(d=>d===null);){const d=i[u];l[d.lane]===null&&(l[d.lane]=d.end),u--}s=Math.max(...l.filter(d=>d!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const r=[];if(this.itemSizeCache.size===0)return r;const i=this.getMeasurements();for(const s of i)s&&this.itemSizeCache.has(s.key)&&r.push({index:s.index,key:s.key,start:s.start,size:s.size,end:s.end,lane:s.lane});return r},this._scrollToOffset=(r,{adjustments:i,behavior:s})=>{this._intendedScrollOffset=r+(i??0),this.options.scrollToFn(r,{behavior:s,adjustments:i},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(n)}applyScrollAdjustment(n,r){n!==0&&(Wh()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=n:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=n,behavior:r}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,s=i?i[0]:this.scrollState.lastTargetOffset,l=1,u=s!==this.scrollState.lastTargetOffset;if(!u&&h$(s,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=l){this.getScrollOffset()!==s&&this._scrollToOffset(s,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,u){const d=this.getSize()||600,h=Math.abs(s-this.getScrollOffset()),m=this.scrollState.behavior==="smooth"&&h>d;this.scrollState.lastTargetOffset=s,m||(this.scrollState.behavior="auto"),this._scrollToOffset(s,{adjustments:void 0,behavior:m?"smooth":"auto"})}this.scheduleScrollReconcile()}}const gC=(e,n,r,i)=>{for(;e<=n;){const s=(e+n)/2|0,l=r(s);if(li)n=s-1;else return s}return e>0?e-1:0};function E$(e,n,r){let i=0;for(;i<=n;){const s=(i+n)/2|0,l=e[s*2];if(lr)n=s-1;else return s}return i>0?i-1:0}function R$(e,n,r,i,s){const l=e.length-1;if(e.length<=i)return{startIndex:0,endIndex:l};if(i===1&&s!==null){const m=E$(s,l,r);let y=m;const v=r+n;for(;ye[m].start,r),h=d;if(i===1)for(;h1){const m=Array(i).fill(0);for(;hv=0&&y.some(v=>v>=r);){const v=e[d];y[v.lane]=v.start,d--}d=Math.max(0,d-d%i),h=Math.min(l,h+(i-1-h%i))}return{startIndex:d,endIndex:h}}const em=typeof document<"u"?S.useLayoutEffect:S.useEffect;function T$({useFlushSync:e=!0,directDomUpdates:n=!1,directDomUpdatesMode:r="transform",...i}){const s=S.useReducer(m=>m+1,0)[1],l=S.useRef({enabled:n,mode:r,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});l.current.enabled=n,l.current.mode=r;const u=m=>{const y=l.current;if(!y.enabled||!y.container)return;const v=m.getTotalSize();if(v!==y.lastSize){y.lastSize=v;const T=m.options.horizontal?"width":"height";y.container.style[T]=`${v}px`}const b=!!m.options.horizontal,x=y.mode==="transform",C=b?"left":"top",_=m.options.scrollMargin,E=m.getVirtualItems();for(const T of E){const O=T.start-_,A=m.elementsCache.get(T.key);A&&y.lastPositions.get(A)!==O&&(y.lastPositions.set(A,O),x?A.style.transform=b?`translate3d(${O}px, 0, 0)`:`translate3d(0, ${O}px, 0)`:A.style[C]=`${O}px`)}},d={...i,onChange:(m,y)=>{var v;const b=l.current;let x=!0;if(b.enabled){u(m);const C=m.range,_=b.prevRange;x=!_||_.isScrolling!==m.isScrolling||_.startIndex!==C?.startIndex||_.endIndex!==C?.endIndex,x&&(b.prevRange=C?{startIndex:C.startIndex,endIndex:C.endIndex,isScrolling:m.isScrolling}:null)}x&&(e&&y?xi.flushSync(s):s()),(v=i.onChange)==null||v.call(i,m,y)}},[h]=S.useState(()=>{const m=new C$(d);return Object.assign(m,{containerRef:y=>{const v=l.current;if(v.container=y,v.lastSize=null,y&&v.enabled){const b=m.getTotalSize();v.lastSize=b;const x=m.options.horizontal?"width":"height";y.style[x]=`${b}px`}}})});return h.setOptions(d),em(()=>h._didMount(),[]),em(()=>h._willUpdate()),em(()=>{u(h)}),h}function O$(e){return T$({observeElementRect:v$,observeElementOffset:x$,scrollToFn:_$,...e})}function A$(e,n){const r=[],i=(s,l)=>{for(const u of s)r.push({node:u,depth:l}),u.dir&&n.has(u.path)&&i(u.children||[],l+1)};return i(e?.children||[],0),r}function M$(e){const{root:n,expanded:r,onToggle:i,currentPath:s,listingShowing:l,onOpen:u}=e,d=S.useRef(null),h=S.useMemo(()=>A$(n,r),[n,r]),m=O$({count:h.length,getScrollElement:()=>d.current,estimateSize:()=>window.matchMedia("(max-width: 768px)").matches?44:28,overscan:12,getItemKey:y=>h[y].node.path});return S.useEffect(()=>{if(!s)return;const y=h.findIndex(v=>v.node.path===s);y>=0&&m.scrollToIndex(y,{align:"auto"})},[s,h]),g.jsx("nav",{id:"tree","aria-label":"Files",ref:d,children:g.jsx("div",{style:{height:m.getTotalSize(),position:"relative"},children:m.getVirtualItems().map(y=>{const{node:v,depth:b}=h[y.index],x=v.dir?r.has(v.path):!1,C=()=>{if(v.dir&&s===v.path&&l){i(v.path);return}u(v.path),v.dir||hr()};return g.jsxs("div",{className:"row "+(v.dir?"dir":"file")+(s===v.path?" active":"")+(v.dir&&!x?" collapsed":""),"data-path":v.path,tabIndex:0,role:"button",title:v.name,"aria-expanded":v.dir?x:void 0,style:{position:"absolute",top:0,left:0,right:0,transform:`translateY(${y.start}px)`,paddingLeft:8+b*13},onClick:C,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),C())},children:[Array.from({length:b},(_,E)=>g.jsx("span",{className:"tguide",style:{left:8+E*13+5},"aria-hidden":"true"},E)),g.jsx("span",{className:"chev",onClick:_=>{v.dir&&(_.stopPropagation(),i(v.path))},children:g.jsx(Yt,{name:"chevd"})}),g.jsx("span",{className:"ticon",children:g.jsx(Yt,{name:v.dir?"folder":"doc"})}),g.jsx("span",{className:"label",children:v.name})]},y.key)})})})}function j$(e){const n=e.split("/"),r=[];let i="";for(let s=0;s{i=i?i+"/"+s:s;const u=i,d=l===r.length-1;return g.jsxs("span",{children:[l>0&&g.jsx("span",{className:"crumb-sep",children:"/"}),d?g.jsx("span",{children:s}):g.jsx("span",{className:"crumb-seg",title:u,onClick:()=>n(u),children:s})]},u)})})}const z$={add:"plus",edit:"edit",delete:"x"},D$={add:"added",edit:"edited",delete:"deleted"};function vC({entry:e,onOpen:n}){const[r,i]=S.useState(!1),s=e.kind==="put"?"edit":e.kind,l=e.user_name?`${e.user_name} <${e.user}>`:e.user||e.author||"unknown",u=[e.device.name||e.device.id,e.device.os,e.device.ip].filter(Boolean).join(" · "),d=s!=="delete",h=m=>{m.target.tagName!=="A"&&d&&n(e.path)};return g.jsxs("div",{className:"hentry "+s+(d?" clickable":""),tabIndex:d?0:void 0,role:d?"button":void 0,onClick:h,onKeyDown:m=>{d&&(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),n(e.path))},children:[g.jsxs("div",{className:"hline",children:[g.jsx("span",{className:"hkind",children:g.jsx(Yt,{name:z$[s]||"dot"})}),g.jsx("span",{className:"hpath",children:e.path}),g.jsx("span",{className:"htag",children:D$[s]||s}),g.jsx("span",{className:"htime",children:new Date(e.time).toLocaleString()})]}),g.jsxs("div",{className:"hmeta",children:[g.jsx("span",{className:"hwho",children:l}),g.jsx("span",{className:"hdev",children:u}),g.jsx("span",{className:"hsize",children:e.size?oC(e.size):""})]}),e.note&&g.jsx("div",{className:"hnote"+(r?" open":""),tabIndex:0,role:"button",title:r?"Collapse note":"Show full note","aria-expanded":r,onClick:m=>{m.stopPropagation(),m.target.tagName!=="A"&&i(!r)},onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),m.stopPropagation(),i(!r))},children:e.note.split(/(https?:\/\/\S+)/).map((m,y)=>/^https?:\/\//.test(m)?g.jsx("a",{href:m,target:"_blank",rel:"noopener",children:m},y):m)})]})}function k$(e){const{node:n,heatMap:r,onOpen:i}=e,s=(n.children||[]).slice().sort((m,y)=>Number(y.dir||!1)-Number(m.dir||!1)||m.name.localeCompare(y.name)),l=s.filter(m=>m.dir).length,u=s.length-l,d=[];l&&d.push(l+(l===1?" folder":" folders")),u&&d.push(u+(u===1?" file":" files"));const h=qx(r,n.path,!0);return h&&d.push(au(h)+" in 30 days"),g.jsxs("div",{className:"dirlist",children:[g.jsxs("h1",{className:"dl-title",children:[g.jsx("span",{className:"dl-title-icon",children:g.jsx(Yt,{name:"folder"})}),g.jsx("span",{children:n.name})]}),g.jsx("p",{className:"dl-sub",children:d.join(" · ")||"Empty folder"}),s.length===0?g.jsx("div",{className:"dl-empty",children:"Nothing in this folder yet."}):g.jsx("div",{className:"dl-items",children:s.map(m=>{let y="";if(m.dir){const b=(m.children||[]).length;y=b+(b===1?" item":" items")}else y=[m.size?oC(m.size):"",m.time?new Date(m.time).toLocaleDateString():""].filter(Boolean).join(" · ");const v=qx(r,m.path,!!m.dir);return v&&(y=au(v)+(y?" · "+y:"")),g.jsxs("div",{className:"dl-row",tabIndex:0,role:"button",title:m.path,onClick:()=>i(m.path),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),i(m.path))},children:[g.jsx("span",{className:"ticon",children:g.jsx(Yt,{name:m.dir?"folder":"doc"})}),g.jsx("span",{className:"dl-name",children:m.name}),v&&g.jsx("span",{className:"heatdot lvl"+d$(v),title:au(v)+" in 30 days"}),g.jsx("span",{className:"dl-meta",children:y})]},m.path)})}),e.hub&&g.jsx(L$,{apiBase:e.apiBase,prefix:n.path+"/",onOpen:i,onFullHistory:()=>e.onFullHistory(n.path+"/"),onRendered:e.onRendered})]})}function L$(e){const n=u$(e.apiBase,e.prefix,!0),{onRendered:r}=e;return S.useEffect(()=>{n&&n.length&&r&&r()},[n,r]),!n||n.length===0?null:g.jsxs("div",{className:"dl-history",children:[g.jsx("h3",{className:"dl-h3",children:"Recent changes"}),g.jsx("div",{className:"history dl-hlist",children:n.map((i,s)=>g.jsx(vC,{entry:i,onOpen:e.onOpen},s))}),g.jsx("button",{className:"ai-btn dl-more",onClick:e.onFullHistory,children:"Full history"})]})}function $$(e){const{apiBase:n,path:r,onMeta:i}=e,s=n+"file?path="+encodeURIComponent(r);return S.useEffect(()=>()=>i(""),[r,i]),N8.test(r)?g.jsx(I$,{...e}):rC.test(r)?g.jsx("iframe",{className:"htmlview",sandbox:"allow-scripts",src:s,title:r,onLoad:e.onRendered}):z8.test(r)?g.jsx(P$,{src:s,alt:r,onRendered:e.onRendered}):D8.test(r)?g.jsx(U$,{...e,fileURL:s}):g.jsxs("div",{className:"filecard",children:[g.jsx("div",{className:"name",children:r.split("/").pop()}),g.jsx("p",{children:"No preview for this file type."}),g.jsx("a",{className:"btn",download:!0,href:n+"download?path="+encodeURIComponent(r),children:"Download"})]})}function I$(e){const{apiBase:n,path:r,heatMap:i,flatFiles:s,onOpenFile:l,onMeta:u,onRendered:d}=e,{data:h,error:m}=vn({queryKey:["render",n,r],queryFn:()=>Nn(n+"render?path="+encodeURIComponent(r))}),y=S.useMemo(()=>h?F$(h.html,r,n):"",[h,r,n]);return S.useEffect(()=>{if(!h)return;const v=[];h.author&&v.push(h.author+(h.device?" on "+h.device:"")),h.time&&v.push(new Date(h.time).toLocaleString());const b=i&&i[h.path];b&&sl(b)&&v.push(au(b)+" / 30d"),u(v.join(" · ")),d?.()},[h,i,u,d]),m?g.jsxs("div",{className:"empty",children:["Could not load file: ",m.message]}):h?g.jsx("div",{dangerouslySetInnerHTML:{__html:y},onClick:v=>V$(v,r,s,l)}):null}function V$(e,n,r,i){const s=e.target.closest("a");if(!s||!e.currentTarget.contains(s))return;const l=s.getAttribute("href")||"",u=n.includes("/")?n.slice(0,n.lastIndexOf("/")):"";l.startsWith("wiki:")?(e.preventDefault(),H$(decodeURIComponent(l.slice(5)),r,i)):/^([a-z]+:|\/|#)/i.test(l)||(e.preventDefault(),i(iC(u,decodeURIComponent(l))))}function F$(e,n,r){const i=n.includes("/")?n.slice(0,n.lastIndexOf("/")):"",s=u=>r+"file?path="+encodeURIComponent(u),l=new DOMParser().parseFromString(e,"text/html");for(const u of l.querySelectorAll("img")){const d=u.getAttribute("src")||"";/^([a-z]+:|\/)/i.test(d)||u.setAttribute("src",s(iC(i,d)))}for(const u of l.querySelectorAll("a")){const d=u.getAttribute("href")||"";/^https?:/i.test(d)&&(u.setAttribute("target","_blank"),u.setAttribute("rel","noopener"))}return l.body.innerHTML}function P$({src:e,alt:n,onRendered:r}){return g.jsx("img",{src:e,alt:n,onLoad:r})}function U$(e){const{path:n,fileURL:r,onRendered:i}=e,{data:s,error:l}=vn({queryKey:["text",r],queryFn:async()=>{const u=await fetch(r);if(!u.ok)throw new Error(await u.text());return u.text()}});return S.useEffect(()=>{s!=null&&i?.()},[s,i]),l?g.jsxs("div",{className:"empty",children:["Could not load file: ",l.message]}):s==null?null:g.jsx("pre",{className:"plain",children:s},n)}function H$(e,n,r){const i=e.toLowerCase(),s=n.find(l=>l.path.toLowerCase()===i||l.path.toLowerCase()===i+".md")||n.find(l=>{const u=l.name.toLowerCase();return u===i||u===i+".md"});s&&r(s.path)}function B$({url:e,copied:n,onClose:r}){const i=e.split("/s/")[1];return g.jsx(kp,{open:!0,onOpenChange:s=>!s&&r(),children:g.jsxs(Lp,{className:"modal",showCloseButton:!1,children:[g.jsx(Yu,{asChild:!0,children:g.jsx("h3",{children:"Public link created"})}),g.jsxs("p",{children:[g.jsx("b",{children:"Anyone with this link can view this file"})," — no account needed. It always shows the latest version until you revoke it."]}),g.jsx("div",{className:"modal-url",children:e}),g.jsxs("div",{className:"modal-actions",children:[g.jsx(Nt,{variant:"primary",onClick:()=>il(e).then(s=>Xe(s?"Copied.":"Select and copy the link above.")),children:n?"Copied ✓":"Copy link"}),g.jsx(Nt,{variant:"subtle",onClick:()=>window.open(e,"_blank"),children:"Open"}),g.jsx(Nt,{variant:"subtle",className:"ai-del",onClick:async()=>{try{await er("DELETE","/api/shares/"+i),Xe("Link revoked — it no longer works."),r()}catch(s){Xe(s.message,!0)}},children:"Revoke"}),g.jsx(Nt,{variant:"subtle",onClick:r,children:"Done"})]})]})})}var Kx=1,q$=.9,G$=.8,Z$=.17,tm=.1,nm=.999,K$=.9999,Y$=.99,Q$=/[\\\/_+.#"@\[\(\{&]/,X$=/[\\\/_+.#"@\[\(\{&]/g,J$=/[\s-]/,yC=/[\s-]/g;function Hm(e,n,r,i,s,l,u){if(l===n.length)return s===e.length?Kx:Y$;var d=`${s},${l}`;if(u[d]!==void 0)return u[d];for(var h=i.charAt(l),m=r.indexOf(h,s),y=0,v,b,x,C;m>=0;)v=Hm(e,n,r,i,m+1,l+1,u),v>y&&(m===s?v*=Kx:Q$.test(e.charAt(m-1))?(v*=G$,x=e.slice(s,m-1).match(X$),x&&s>0&&(v*=Math.pow(nm,x.length))):J$.test(e.charAt(m-1))?(v*=q$,C=e.slice(s,m-1).match(yC),C&&s>0&&(v*=Math.pow(nm,C.length))):(v*=Z$,s>0&&(v*=Math.pow(nm,m-s))),e.charAt(m)!==n.charAt(l)&&(v*=K$)),(vv&&(v=b*tm)),v>y&&(y=v),m=r.indexOf(h,m+1);return u[d]=y,y}function Yx(e){return e.toLowerCase().replace(yC," ")}function W$(e,n,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,Hm(e,n,Yx(e),Yx(n),0,0,{})}var Ls='[cmdk-group=""]',rm='[cmdk-group-items=""]',eI='[cmdk-group-heading=""]',bC='[cmdk-item=""]',Qx=`${bC}:not([aria-disabled="true"])`,Bm="cmdk-item-select",xa="data-value",tI=(e,n,r)=>W$(e,n,r),xC=S.createContext(void 0),bl=()=>S.useContext(xC),SC=S.createContext(void 0),ng=()=>S.useContext(SC),wC=S.createContext(void 0),_C=S.forwardRef((e,n)=>{let r=Sa(()=>{var j,U;return{search:"",value:(U=(j=e.value)!=null?j:e.defaultValue)!=null?U:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),i=Sa(()=>new Set),s=Sa(()=>new Map),l=Sa(()=>new Map),u=Sa(()=>new Set),d=CC(e),{label:h,children:m,value:y,onValueChange:v,filter:b,shouldFilter:x,loop:C,disablePointerSelection:_=!1,vimBindings:E=!0,...T}=e,O=hn(),A=hn(),k=hn(),L=S.useRef(null),q=fI();bi(()=>{if(y!==void 0){let j=y.trim();r.current.value=j,H.emit()}},[y]),bi(()=>{q(6,ae)},[]);let H=S.useMemo(()=>({subscribe:j=>(u.current.add(j),()=>u.current.delete(j)),snapshot:()=>r.current,setState:(j,U,Q)=>{var Z,re,ee,ge;if(!Object.is(r.current[j],U)){if(r.current[j]=U,j==="search")le(),ve(),q(1,de);else if(j==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let be=document.getElementById(k);be?be.focus():(Z=document.getElementById(O))==null||Z.focus()}if(q(7,()=>{var be;r.current.selectedItemId=(be=me())==null?void 0:be.id,H.emit()}),Q||q(5,ae),((re=d.current)==null?void 0:re.value)!==void 0){let be=U??"";(ge=(ee=d.current).onValueChange)==null||ge.call(ee,be);return}}H.emit()}},emit:()=>{u.current.forEach(j=>j())}}),[]),I=S.useMemo(()=>({value:(j,U,Q)=>{var Z;U!==((Z=l.current.get(j))==null?void 0:Z.value)&&(l.current.set(j,{value:U,keywords:Q}),r.current.filtered.items.set(j,he(U,Q)),q(2,()=>{ve(),H.emit()}))},item:(j,U)=>(i.current.add(j),U&&(s.current.has(U)?s.current.get(U).add(j):s.current.set(U,new Set([j]))),q(3,()=>{le(),ve(),r.current.value||de(),H.emit()}),()=>{l.current.delete(j),i.current.delete(j),r.current.filtered.items.delete(j);let Q=me();q(4,()=>{le(),Q?.getAttribute("id")===j&&de(),H.emit()})}),group:j=>(s.current.has(j)||s.current.set(j,new Set),()=>{l.current.delete(j),s.current.delete(j)}),filter:()=>d.current.shouldFilter,label:h||e["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:O,inputId:k,labelId:A,listInnerRef:L}),[]);function he(j,U){var Q,Z;let re=(Z=(Q=d.current)==null?void 0:Q.filter)!=null?Z:tI;return j?re(j,r.current.search,U):0}function ve(){if(!r.current.search||d.current.shouldFilter===!1)return;let j=r.current.filtered.items,U=[];r.current.filtered.groups.forEach(Z=>{let re=s.current.get(Z),ee=0;re.forEach(ge=>{let be=j.get(ge);ee=Math.max(be,ee)}),U.push([Z,ee])});let Q=L.current;ye().sort((Z,re)=>{var ee,ge;let be=Z.getAttribute("id"),De=re.getAttribute("id");return((ee=j.get(De))!=null?ee:0)-((ge=j.get(be))!=null?ge:0)}).forEach(Z=>{let re=Z.closest(rm);re?re.appendChild(Z.parentElement===re?Z:Z.closest(`${rm} > *`)):Q.appendChild(Z.parentElement===Q?Z:Z.closest(`${rm} > *`))}),U.sort((Z,re)=>re[1]-Z[1]).forEach(Z=>{var re;let ee=(re=L.current)==null?void 0:re.querySelector(`${Ls}[${xa}="${encodeURIComponent(Z[0])}"]`);ee?.parentElement.appendChild(ee)})}function de(){let j=ye().find(Q=>Q.getAttribute("aria-disabled")!=="true"),U=j?.getAttribute(xa);H.setState("value",U||void 0)}function le(){var j,U,Q,Z;if(!r.current.search||d.current.shouldFilter===!1){r.current.filtered.count=i.current.size;return}r.current.filtered.groups=new Set;let re=0;for(let ee of i.current){let ge=(U=(j=l.current.get(ee))==null?void 0:j.value)!=null?U:"",be=(Z=(Q=l.current.get(ee))==null?void 0:Q.keywords)!=null?Z:[],De=he(ge,be);r.current.filtered.items.set(ee,De),De>0&&re++}for(let[ee,ge]of s.current)for(let be of ge)if(r.current.filtered.items.get(be)>0){r.current.filtered.groups.add(ee);break}r.current.filtered.count=re}function ae(){var j,U,Q;let Z=me();Z&&(((j=Z.parentElement)==null?void 0:j.firstChild)===Z&&((Q=(U=Z.closest(Ls))==null?void 0:U.querySelector(eI))==null||Q.scrollIntoView({block:"nearest"})),Z.scrollIntoView({block:"nearest"}))}function me(){var j;return(j=L.current)==null?void 0:j.querySelector(`${bC}[aria-selected="true"]`)}function ye(){var j;return Array.from(((j=L.current)==null?void 0:j.querySelectorAll(Qx))||[])}function D(j){let U=ye()[j];U&&H.setState("value",U.getAttribute(xa))}function Y(j){var U;let Q=me(),Z=ye(),re=Z.findIndex(ge=>ge===Q),ee=Z[re+j];(U=d.current)!=null&&U.loop&&(ee=re+j<0?Z[Z.length-1]:re+j===Z.length?Z[0]:Z[re+j]),ee&&H.setState("value",ee.getAttribute(xa))}function ne(j){let U=me(),Q=U?.closest(Ls),Z;for(;Q&&!Z;)Q=j>0?uI(Q,Ls):dI(Q,Ls),Z=Q?.querySelector(Qx);Z?H.setState("value",Z.getAttribute(xa)):Y(j)}let J=()=>D(ye().length-1),W=j=>{j.preventDefault(),j.metaKey?J():j.altKey?ne(1):Y(1)},N=j=>{j.preventDefault(),j.metaKey?D(0):j.altKey?ne(-1):Y(-1)};return S.createElement(Ie.div,{ref:n,tabIndex:-1,...T,"cmdk-root":"",onKeyDown:j=>{var U;(U=T.onKeyDown)==null||U.call(T,j);let Q=j.nativeEvent.isComposing||j.keyCode===229;if(!(j.defaultPrevented||Q))switch(j.key){case"n":case"j":{E&&j.ctrlKey&&W(j);break}case"ArrowDown":{W(j);break}case"p":case"k":{E&&j.ctrlKey&&N(j);break}case"ArrowUp":{N(j);break}case"Home":{j.preventDefault(),D(0);break}case"End":{j.preventDefault(),J();break}case"Enter":{j.preventDefault();let Z=me();if(Z){let re=new Event(Bm);Z.dispatchEvent(re)}}}}},S.createElement("label",{"cmdk-label":"",htmlFor:I.inputId,id:I.labelId,style:mI},h),cd(e,j=>S.createElement(SC.Provider,{value:H},S.createElement(xC.Provider,{value:I},j))))}),nI=S.forwardRef((e,n)=>{var r,i;let s=hn(),l=S.useRef(null),u=S.useContext(wC),d=bl(),h=CC(e),m=(i=(r=h.current)==null?void 0:r.forceMount)!=null?i:u?.forceMount;bi(()=>{if(!m)return d.item(s,u?.id)},[m]);let y=EC(s,l,[e.value,e.children,l],e.keywords),v=ng(),b=$o(q=>q.value&&q.value===y.current),x=$o(q=>m||d.filter()===!1?!0:q.search?q.filtered.items.get(s)>0:!0);S.useEffect(()=>{let q=l.current;if(!(!q||e.disabled))return q.addEventListener(Bm,C),()=>q.removeEventListener(Bm,C)},[x,e.onSelect,e.disabled]);function C(){var q,H;_(),(H=(q=h.current).onSelect)==null||H.call(q,y.current)}function _(){v.setState("value",y.current,!0)}if(!x)return null;let{disabled:E,value:T,onSelect:O,forceMount:A,keywords:k,...L}=e;return S.createElement(Ie.div,{ref:ja(l,n),...L,id:s,"cmdk-item":"",role:"option","aria-disabled":!!E,"aria-selected":!!b,"data-disabled":!!E,"data-selected":!!b,onPointerMove:E||d.getDisablePointerSelection()?void 0:_,onClick:E?void 0:C},e.children)}),rI=S.forwardRef((e,n)=>{let{heading:r,children:i,forceMount:s,...l}=e,u=hn(),d=S.useRef(null),h=S.useRef(null),m=hn(),y=bl(),v=$o(x=>s||y.filter()===!1?!0:x.search?x.filtered.groups.has(u):!0);bi(()=>y.group(u),[]),EC(u,d,[e.value,e.heading,h]);let b=S.useMemo(()=>({id:u,forceMount:s}),[s]);return S.createElement(Ie.div,{ref:ja(d,n),...l,"cmdk-group":"",role:"presentation",hidden:v?void 0:!0},r&&S.createElement("div",{ref:h,"cmdk-group-heading":"","aria-hidden":!0,id:m},r),cd(e,x=>S.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?m:void 0},S.createElement(wC.Provider,{value:b},x))))}),oI=S.forwardRef((e,n)=>{let{alwaysRender:r,...i}=e,s=S.useRef(null),l=$o(u=>!u.search);return!r&&!l?null:S.createElement(Ie.div,{ref:ja(s,n),...i,"cmdk-separator":"",role:"separator"})}),iI=S.forwardRef((e,n)=>{let{onValueChange:r,...i}=e,s=e.value!=null,l=ng(),u=$o(m=>m.search),d=$o(m=>m.selectedItemId),h=bl();return S.useEffect(()=>{e.value!=null&&l.setState("search",e.value)},[e.value]),S.createElement(Ie.input,{ref:n,...i,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":h.listId,"aria-labelledby":h.labelId,"aria-activedescendant":d,id:h.inputId,type:"text",value:s?e.value:u,onChange:m=>{s||l.setState("search",m.target.value),r?.(m.target.value)}})}),aI=S.forwardRef((e,n)=>{let{children:r,label:i="Suggestions",...s}=e,l=S.useRef(null),u=S.useRef(null),d=$o(m=>m.selectedItemId),h=bl();return S.useEffect(()=>{if(u.current&&l.current){let m=u.current,y=l.current,v,b=new ResizeObserver(()=>{v=requestAnimationFrame(()=>{let x=m.offsetHeight;y.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return b.observe(m),()=>{cancelAnimationFrame(v),b.unobserve(m)}}},[]),S.createElement(Ie.div,{ref:ja(l,n),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":i,id:h.listId},cd(e,m=>S.createElement("div",{ref:ja(u,h.listInnerRef),"cmdk-list-sizer":""},m)))}),sI=S.forwardRef((e,n)=>{let{open:r,onOpenChange:i,overlayClassName:s,contentClassName:l,container:u,...d}=e;return S.createElement(np,{open:r,onOpenChange:i},S.createElement(op,{container:u},S.createElement(ip,{"cmdk-overlay":"",className:s}),S.createElement(ap,{"aria-label":e.label,"cmdk-dialog":"",className:l},S.createElement(_C,{ref:n,...d}))))}),lI=S.forwardRef((e,n)=>$o(r=>r.filtered.count===0)?S.createElement(Ie.div,{ref:n,...e,"cmdk-empty":"",role:"presentation"}):null),cI=S.forwardRef((e,n)=>{let{progress:r,children:i,label:s="Loading...",...l}=e;return S.createElement(Ie.div,{ref:n,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},cd(e,u=>S.createElement("div",{"aria-hidden":!0},u)))}),ld=Object.assign(_C,{List:aI,Item:nI,Input:iI,Group:rI,Separator:oI,Dialog:sI,Empty:lI,Loading:cI});function uI(e,n){let r=e.nextElementSibling;for(;r;){if(r.matches(n))return r;r=r.nextElementSibling}}function dI(e,n){let r=e.previousElementSibling;for(;r;){if(r.matches(n))return r;r=r.previousElementSibling}}function CC(e){let n=S.useRef(e);return bi(()=>{n.current=e}),n}var bi=typeof window>"u"?S.useEffect:S.useLayoutEffect;function Sa(e){let n=S.useRef();return n.current===void 0&&(n.current=e()),n}function $o(e){let n=ng(),r=()=>e(n.snapshot());return S.useSyncExternalStore(n.subscribe,r,r)}function EC(e,n,r,i=[]){let s=S.useRef(),l=bl();return bi(()=>{var u;let d=(()=>{var m;for(let y of r){if(typeof y=="string")return y.trim();if(typeof y=="object"&&"current"in y)return y.current?(m=y.current.textContent)==null?void 0:m.trim():s.current}})(),h=i.map(m=>m.trim());l.value(e,d,h),(u=n.current)==null||u.setAttribute(xa,d),s.current=d}),s}var fI=()=>{let[e,n]=S.useState(),r=Sa(()=>new Map);return bi(()=>{r.current.forEach(i=>i()),r.current=new Map},[e]),(i,s)=>{r.current.set(i,s),n({})}};function hI(e){let n=e.type;return typeof n=="function"?n(e.props):"render"in n?n.render(e.props):e}function cd({asChild:e,children:n},r){return e&&S.isValidElement(n)?S.cloneElement(hI(n),{ref:n.ref},r(n.props.children)):r(n)}var mI={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function pI({className:e,...n}){return g.jsx(ld,{"data-slot":"command",className:et("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...n})}function gI({className:e,...n}){return g.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[g.jsx(Q1,{className:"size-4 shrink-0 opacity-50"}),g.jsx(ld.Input,{"data-slot":"command-input",className:et("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n})]})}function vI({className:e,...n}){return g.jsx(ld.List,{"data-slot":"command-list",className:et("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...n})}function yI({className:e,...n}){return g.jsx(ld.Item,{"data-slot":"command-item",className:et("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",e),...n})}function Xx(e,n){if(!e)return{score:0,hits:[]};const r=e.toLowerCase(),i=n.toLowerCase();let s=0,l=0,u=0;const d=[];for(let h=0;h3&&i.endsWith("ies")?s=i.slice(0,-3)+"y":i.length>3&&i.endsWith("es")?s=i.slice(0,-2):i.length>2&&i.endsWith("s")&&(s=i.slice(0,-1)),s?Xx(s,n):null}function xI({text:e,hits:n}){const r=[];let i=0;return n.forEach((s,l)=>{s>i&&r.push(e.slice(i,s)),r.push(g.jsx("b",{children:e[s]},l)),i=s+1}),r.push(e.slice(i)),g.jsx("span",{className:"plabel",children:r})}function SI({open:e,onClose:n,candidates:r}){const[i,s]=S.useState(""),l=S.useMemo(()=>{if(!e)return[];const d=[];for(const h of r()){const m=bI(i,h.label);m&&d.push({...h,score:m.score,hits:m.hits})}return d.sort((h,m)=>m.score-h.score),d.slice(0,40)},[e,i,r]);S.useEffect(()=>{e&&s("")},[e]);const u=d=>{n(),d.run()};return g.jsx(kp,{open:e,onOpenChange:d=>!d&&n(),children:g.jsxs(Lp,{id:"palette",className:"palette",showCloseButton:!1,"aria-describedby":void 0,children:[g.jsx(Yu,{className:"sr-only",children:"Search and quick actions"}),g.jsxs(pI,{shouldFilter:!1,loop:!0,children:[g.jsxs("div",{id:"palette-inputwrap",children:[g.jsx(Yt,{name:"search"}),g.jsx(gI,{id:"palette-input",placeholder:"Search file names, projects, actions…",autoComplete:"off",spellCheck:!1,value:i,onValueChange:s})]}),g.jsx(vI,{id:"palette-results",children:l.length===0?g.jsx("div",{className:"pempty",children:"No matches — search covers file names, projects, and actions"}):l.map(d=>g.jsxs(yI,{value:d.kind+":"+d.label,onSelect:()=>u(d),children:[g.jsx("span",{className:"picon",children:g.jsx(Yt,{name:d.icon})}),g.jsx(xI,{text:d.label,hits:d.hits}),g.jsx("span",{className:"pkind",children:d.kind})]},d.kind+":"+d.label))}),g.jsx("footer",{id:"palette-hint",children:"↑↓ navigate · ⏎ select · esc close"})]})]})})}const Ps=3,wa=30;function wI(e,n){return vn({queryKey:["heatDevices",e],queryFn:()=>Nn(e+"heat?by=device&days=30"),enabled:n,retry:!1,staleTime:6e4}).data?.devices??null}function Jx(e){const[n,r]=S.useState("all"),{flatFiles:i,heatMap:s,devices:l,scope:u}=e,d=b=>!u||b===u||b.startsWith(u+"/"),h=u?i.filter(b=>d(b.path)):i,m=l&&u?l.map(b=>{const x={};for(const[C,_]of Object.entries(b.folders||{}))d(C)&&(x[C]=_);return{...b,folders:x}}).filter(b=>Object.keys(b.folders).length>0):l,y=Date.now(),v=h.map(b=>{const x=s&&s[b.path]||{},C=b.time?Math.max(0,(y-new Date(b.time).getTime())/864e5):0,_=n==="all"?sl(x):x[n]||0;return{path:b.path,reads:_,agent:x.agent||0,total:sl(x),days:C,danger:_>=Ps&&C>=wa}});return g.jsxs("div",{className:"insights",children:[g.jsxs("h1",{className:"in-title",children:["Knowledge insights",u?g.jsxs("span",{className:"in-scope",children:[" · ",u]}):null]}),g.jsx("p",{className:"dl-sub",children:u?`Reads over the last 30 days × freshness, for ${u} and everything in it.`:"Reads over the last 30 days × how long since each file changed. Hot but stale knowledge — read a lot, maintained by nobody — is the danger zone."}),g.jsx("div",{className:"in-lens",children:["all","human","agent"].map(b=>g.jsx("button",{className:"in-lens-btn"+(b===n?" active":""),onClick:()=>r(b),children:b==="all"?"All reads":b==="human"?"Human reads":"Agent reads"},b))}),g.jsx("h3",{className:"dl-h3",children:"Map — cell size = reads, color = freshness"}),g.jsx(CI,{pts:v,onOpenFile:e.onOpenFile,onOpenFolder:e.onOpenFolder,isFolder:e.isFolder}),g.jsx("h3",{className:"dl-h3",children:"Reads × freshness"}),g.jsx(EI,{pts:v,onOpenFile:e.onOpenFile}),g.jsx("h3",{className:"dl-h3",children:"Hot path — top files by reads"}),g.jsx(RI,{pts:v,lens:n,onOpenFile:e.onOpenFile}),m&&m.length>0&&g.jsxs(g.Fragment,{children:[g.jsx("h3",{className:"dl-h3",children:"Agent coverage — which agents read which areas"}),g.jsx(TI,{devices:m})]})]})}function _I(e){const n=[[76,195,138],[232,196,84],[224,93,93]],r=Math.min(1,Math.max(0,e/300))*(n.length-1),i=Math.min(n.length-2,Math.floor(r)),s=r-i,l=n[i].map((u,d)=>Math.round(u+(n[i+1][d]-u)*s));return`rgb(${l[0]},${l[1]},${l[2]})`}function Wx(e,n,r,i,s){const l=e.reduce((m,y)=>m+y.value,0);if(!l||i<=0||s<=0)return[];const u=e.slice().sort((m,y)=>y.value-m.value).map(m=>({it:m,a:m.value/l*i*s})),d=(m,y)=>{const b=m.reduce((C,_)=>C+_.a,0)/y;let x=0;for(const C of m){const _=C.a/b;x=Math.max(x,_/b,b/_)}return x},h=[];for(;u.length;){const m=i>=s,y=m?s:i,v=[u.shift()];for(;u.length&&d(v.concat(u[0]),y)<=d(v,y);)v.push(u.shift());const b=v.reduce((C,_)=>C+_.a,0)/y;let x=0;for(const C of v){const _=C.a/b;m?h.push({item:C.it,x:n,y:r+x,w:b,h:_}):h.push({item:C.it,x:n+x,y:r,w:_,h:b}),x+=_}m?(n+=b,i-=b):(r+=b,s-=b)}return h}const om=15;function CI({pts:e,onOpenFile:n,onOpenFolder:r,isFolder:i}){const u=new Map;for(const h of e){const m=h.path.includes("/")?h.path.split("/")[0]:"/";let y=u.get(m);y||u.set(m,y={name:m,files:[],value:0}),y.files.push(h),y.value+=h.reads+1}const d=[];for(const h of Wx([...u.values()],0,0,720,480)){const m=h.item,y=m.name==="/"?"":m.name;if(d.push(g.jsx("rect",{x:h.x+1,y:h.y+1,width:Math.max(0,h.w-2),height:Math.max(0,h.h-2),rx:3,className:"in-tm-group","data-dir":y},"g"+m.name)),h.w>46&&h.h>om+10){let b=m.name==="/"?"(root)":m.name;const x=Math.floor((h.w-8)/6);b.length>x&&(b=b.slice(0,Math.max(1,x-1))+"…"),d.push(g.jsx("text",{x:h.x+5,y:h.y+12,className:"in-tm-glabel","data-dir":y,children:b},"gl"+m.name))}const v=Wx(m.files.map(b=>({...b,name:b.path.split("/").pop(),value:b.reads+1})),h.x+2,h.y+om,Math.max(0,h.w-4),Math.max(0,h.h-om-2));for(const b of v)if(d.push(g.jsx("rect",{x:b.x+.6,y:b.y+.6,width:Math.max(.4,b.w-1.2),height:Math.max(.4,b.h-1.2),rx:1.5,fill:_I(b.item.days),className:"in-tm-cell","data-path":b.item.path,children:g.jsx("title",{children:`${b.item.path} — ${b.item.reads} read${b.item.reads===1?"":"s"}/30d · changed ${Math.round(b.item.days)}d ago`})},b.item.path)),b.w>54&&b.h>16){const x=Math.floor((b.w-8)/6);let C=(b.item.danger?"⚠ ":"")+b.item.name;C.length>x&&(C=C.slice(0,Math.max(1,x-1))+"…"),x>=5&&d.push(g.jsx("text",{x:b.x+4.5,y:b.y+12.5,className:"in-tm-label","data-path":b.item.path,children:C},"l"+b.item.path))}}return g.jsx("svg",{viewBox:"0 0 720 480",className:"in-chart in-treemap",onClick:h=>{const m=h.target.closest("[data-path], [data-dir]");if(!m)return;const y=m.getAttribute("data-path");if(y)return n(y);const v=m.getAttribute("data-dir");v&&i(v)&&r(v)},children:d})}function EI({pts:e,onOpenFile:n}){const s={l:44,r:16,t:20,b:34},l=Math.max(wa*2,...e.map(v=>v.days)),u=Math.max(Ps*2,...e.map(v=>v.reads)),d=v=>Math.log10(v+1)/Math.log10(l+1),h=v=>Math.log10(v+1)/Math.log10(u+1),m=v=>s.l+d(v)*(720-s.l-s.r),y=v=>360-s.b-h(v)*(360-s.t-s.b);return g.jsxs("svg",{viewBox:"0 0 720 360",className:"in-chart",children:[g.jsx("rect",{x:m(wa),y:s.t,width:720-s.r-m(wa),height:y(Ps)-s.t,className:"in-danger-zone"}),g.jsx("line",{x1:m(wa),y1:s.t,x2:m(wa),y2:360-s.b,className:"in-threshold"}),g.jsx("line",{x1:s.l,y1:y(Ps),x2:720-s.r,y2:y(Ps),className:"in-threshold"}),g.jsx("line",{x1:s.l,y1:360-s.b,x2:720-s.r,y2:360-s.b,className:"in-axis"}),g.jsx("line",{x1:s.l,y1:s.t,x2:s.l,y2:360-s.b,className:"in-axis"}),g.jsx("text",{x:(s.l+720-s.r)/2,y:352,className:"in-label",children:"days since last change →"}),g.jsx("text",{x:12,y:(s.t+360-s.b)/2,className:"in-label",transform:`rotate(-90 12 ${(s.t+360-s.b)/2})`,children:"reads / 30d →"}),g.jsx("text",{x:720-s.r-6,y:s.t+14,className:"in-quad in-quad-danger",textAnchor:"end",children:"hot + stale"}),g.jsx("text",{x:s.l+6,y:s.t+14,className:"in-quad",children:"hot + fresh"}),g.jsx("text",{x:720-s.r-6,y:360-s.b-8,className:"in-quad",textAnchor:"end",children:"cold + stale"}),g.jsx("text",{x:720-s.r-6,y:s.t+28,className:"in-label",textAnchor:"end",children:"dot size = agent share of reads"}),e.map(v=>{const b=v.total?(v.agent||0)/v.total:0;return g.jsx("circle",{cx:Number(m(v.days).toFixed(1)),cy:Number(y(v.reads).toFixed(1)),r:Number((3+4*b).toFixed(1)),className:"in-pt"+(v.danger?" danger":v.reads?"":" cold"),onClick:()=>n(v.path),children:g.jsx("title",{children:`${v.path} — ${v.reads} read${v.reads===1?"":"s"} / 30d · changed ${Math.round(v.days)}d ago`})},v.path)})]})}function RI({pts:e,lens:n,onOpenFile:r}){const i=e.filter(l=>l.reads>0).sort((l,u)=>u.reads-l.reads||u.days-l.days).slice(0,20);if(!i.length)return g.jsx("div",{className:"dl-empty",children:"No reads in the window yet."});const s=i[0].reads;return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"in-hotpath",children:i.map(l=>{const u=n==="agent"?1:n==="human"?0:l.total?l.agent/l.total:0,d=l.reads/s*100;return g.jsxs("div",{className:"in-hp-row",tabIndex:0,role:"button",title:l.danger?`${l.reads} read${l.reads===1?"":"s"}/30d · unchanged ${Math.round(l.days)}d — review this file`:l.path,onClick:()=>r(l.path),onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),r(l.path))},children:[g.jsx("span",{className:"in-hp-name"+(l.danger?" danger":""),children:l.path+(l.danger?" ⚠":"")}),g.jsxs("span",{className:"in-hp-bar",children:[g.jsx("span",{className:"in-hp-agent",style:{width:(d*u).toFixed(1)+"%"}}),g.jsx("span",{className:"in-hp-human",style:{width:(d*(1-u)).toFixed(1)+"%"}})]}),g.jsx("span",{className:"in-hp-count",children:l.reads})]},l.path)})}),g.jsxs("p",{className:"in-legend",children:[g.jsx("span",{className:"in-sw agent"})," agent reads ",g.jsx("span",{className:"in-sw human"})," human reads"]})]})}function TI({devices:e}){const n=new Map;for(const b of e)for(const[x,C]of Object.entries(b.folders||{}))n.set(x,(n.get(x)||0)+C);const r=[...n.entries()].sort((b,x)=>x[1]-b[1]).slice(0,12).map(b=>b[0]),i=e.slice(0,12),s=140,l=6,u=Math.min(76,Math.max(34,(720-s-8)/r.length)),d=26,h=720,m=l+i.length*d+58,y=Math.max(1,...i.flatMap(b=>r.map(x=>(b.folders||{})[x]||0))),v=b=>{const x=[23,25,31],C=[245,166,35],_=x.map((E,T)=>Math.round(E+(C[T]-E)*b));return`rgb(${_[0]},${_[1]},${_[2]})`};return g.jsxs("svg",{viewBox:`0 0 ${h} ${m}`,className:"in-chart in-matrix",children:[i.map((b,x)=>{let C=b.name||b.id||"";return C.length>20&&(C=C.slice(0,19)+"…"),g.jsxs("g",{children:[g.jsx("text",{x:s-8,y:l+x*d+17,textAnchor:"end",className:"in-label",children:C}),r.map((_,E)=>{const T=(b.folders||{})[_]||0;return g.jsx("rect",{x:s+E*u,y:l+x*d,width:u-4,height:d-4,rx:3,fill:v(Math.sqrt(T/y)),children:g.jsx("title",{children:`${b.name||b.id} × ${_||"(root)"}: ${T} read${T===1?"":"s"}/30d`})},_)})]},b.id||x)}),r.map((b,x)=>{const C=s+x*u+(u-4)/2,_=l+i.length*d+14;return g.jsx("text",{x:C,y:_,className:"in-label",textAnchor:"end",transform:`rotate(-28 ${C} ${_})`,children:b||"(root)"},b)})]})}function OI(e){const{apiBase:n,target:r,isFolder:i,onMeta:s,onRendered:l}=e,u=r?i(r)?{prefix:r+"/"}:{path:r}:{prefix:""},d="path"in u&&u.path!==void 0?"path="+encodeURIComponent(u.path):"prefix="+encodeURIComponent(u.prefix??""),{data:h,error:m}=vn({queryKey:["history",n,d,200],queryFn:()=>Nn(n+"history?"+d+"&n=200"),staleTime:15e3});if(S.useEffect(()=>{m&&s("History unavailable: "+m.message)},[m,s]),S.useEffect(()=>{h&&l?.()},[h,l]),!h)return null;const y=h.entries||[];return g.jsxs("div",{className:"history",children:[y.length===0&&g.jsx("div",{className:"empty",children:"No history yet."}),y.map((v,b)=>g.jsx(vC,{entry:v,onOpen:e.onOpen},b))]})}function AI(e,n){return e?n(e)?e+"/ (folder)":e:"all changes"}function RC(e){const{config:n,apiBase:r,route:i,hub:s,project:l}=e,u=Fp(),d=ka(),{tree:h,flatFiles:m,dirIndex:y,loaded:v}=l$(r,!s||!!l),b=c$(r,s&&!!l&&!!n.reads?.enabled),x=s&&!!l&&!i.path&&!i.view,C=!!e.canInsights&&(i.view==="insights"||x),_=wI(r,C);S.useEffect(()=>{C&&d.invalidateQueries({queryKey:["heat",r]})},[C,r,d]);const E=i.path,T=E||(i.view==="insights"||i.view==="history")&&i.viewTarget||"",O=!!E&&y.has(E),A=!!E&&v&&!O&&m.some(Fe=>Fe.path===E),k=!!E&&v&&!O&&!A,L=O&&!i.view,[q,H]=S.useState(()=>new Set),I=S.useRef(!0);S.useEffect(()=>{if(!h||!I.current)return;I.current=!1;const Fe=(h.children||[]).filter(ze=>ze.dir);Fe.length===1&&H(ze=>new Set(ze).add(Fe[0].path))},[h]),S.useEffect(()=>{!T||!v||H(Fe=>{const ze=new Set(Fe);for(const We of j$(T))ze.add(We);return y.has(T)&&ze.add(T),ze})},[T,v,y]);const he=S.useCallback(Fe=>{H(ze=>{const We=new Set(ze);return We.has(Fe)?We.delete(Fe):We.add(Fe),We})},[]),ve=S.useRef(null),de=S.useRef(new Map),le=S.useRef({key:"",want:0,attempts:0});S.useEffect(()=>{le.current={key:u,want:Bk()==="POP"?de.current.get(u)??0:0,attempts:0}},[u]);const ae=S.useCallback(()=>{const Fe=ve.current,ze=le.current;!Fe||ze.key!==u||ze.attempts>=3||(ze.attempts++,Fe.scrollTo({top:ze.want,behavior:"instant"}))},[u]),me=S.useCallback(()=>{ve.current&&de.current.set(u,ve.current.scrollTop)},[u]),ye=S.useCallback(Fe=>{fn(Hk(Fe,l?.id)),hr()},[l?.id]),D=S.useCallback(Fe=>fn(_a("history",l?.id,Fe)),[l?.id]),[Y,ne]=S.useState(""),[J,W]=S.useState(null),[N,j]=S.useState(!1),[U,Q]=S.useState(!1);S.useEffect(()=>rz(()=>Q(!0)),[]);const Z=S.useRef(null),re=e.panel??null,ee=!re&&s&&!!l&&A&&Ru(l.perm,"write"),ge=!re&&s&&!!l,be=!re&&A,De=!re&&(A||s&&!!l&&O),Ve=r+"download?path="+encodeURIComponent(E),Ue=S.useCallback(async()=>{try{const Fe=await fetch(r+"shares",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:E})});if(!Fe.ok)throw new Error(await Fe.text());const ze=await Fe.json(),We=await il(ze.url);W({url:ze.url,copied:We})}catch(Fe){Xe("Share failed: "+Fe.message,!0)}},[r,E]),lt=S.useCallback(()=>{if(!E)return D("");D(O?E+"/":E)},[E,O,D]);S.useEffect(()=>{const Fe=ze=>{(ze.metaKey||ze.ctrlKey)&&ze.key.toLowerCase()==="k"&&(ze.preventDefault(),Q(We=>!We))};return window.addEventListener("keydown",Fe),()=>window.removeEventListener("keydown",Fe)},[]);const Je=S.useCallback(()=>{const Fe=[],ze=(We,zt,to,ir)=>Fe.push({icon:We,label:zt,kind:to,run:ir});if(s&&l&&E&&(A&&ze("share","Share: "+E,"action",Ue),ze("hist","History: "+E,"action",lt),A&&ze("download","Download: "+E,"action",()=>Z.current?.click())),s&&l&&ze("hist","History: whole project","action",()=>D("")),s)for(const We of e.projects||[])(!l||We.id!==l.id)&&ze("folder","Switch to project: "+We.name,"project",()=>fn("/"+We.id));n.auth?.enabled&&ze("power","Sign out","action",()=>window.location.href="/auth/logout");for(const We of y.keys())ze("folder",We,"folder",()=>ye(We));for(const We of m)ze("doc",We.path,"file",()=>ye(We.path));return Fe},[s,l,E,A,n.auth?.enabled,y,m,e.projects,Ue,lt,D,ye]);S.useEffect(()=>{if(!N)return;const Fe=()=>j(!1);return document.addEventListener("click",Fe),()=>document.removeEventListener("click",Fe)},[N]);const Xt=S.useCallback(Fe=>y.has(Fe),[y]);let mn="app",qt,Pt;re?Pt=re.body:i.view==="insights"?Pt=e.canInsights?g.jsx(Jx,{flatFiles:m,heatMap:b,devices:_,scope:i.viewTarget||"",onOpenFile:ye,onOpenFolder:ye,isFolder:Xt}):g.jsx("div",{className:"empty",children:"Insights is for hub admins and org owners."}):i.view==="history"?Pt=g.jsx(OI,{apiBase:r,target:i.viewTarget||"",isFolder:Xt,onOpen:ye,onMeta:ne,onRendered:ae}):E?v?k?Pt=g.jsxs("div",{className:"notfound",children:[g.jsx("h1",{children:"Couldn't find that"}),g.jsxs("p",{children:[g.jsx("code",{children:E})," isn't in this project right now."]}),g.jsx("p",{className:"nf-sub",children:"If it was just created, it may still be uploading or syncing from a teammate's device — this page checks again automatically every few seconds, so refresh or come back in a moment."}),g.jsx("button",{className:"pbtn",onClick:()=>d.invalidateQueries({queryKey:["tree",r]}),children:"Check again"})]}):O?Pt=g.jsx(k$,{node:y.get(E),heatMap:b,hub:s&&!!l,apiBase:r,onOpen:ye,onFullHistory:D,onRendered:ae}):(mn=rC.test(E)?"wide":"read",qt="markdown",Pt=g.jsx($$,{apiBase:r,path:E,heatMap:b,flatFiles:m,onOpenFile:ye,onMeta:ne,onRendered:ae})):Pt=g.jsx("div",{className:"empty",children:"Loading…"}):x?Pt=g.jsxs(g.Fragment,{children:[g.jsx(pC,{project:l}),e.canInsights&&g.jsx("div",{className:"home-insights",children:g.jsx(Jx,{flatFiles:m,heatMap:b,devices:_,onOpenFile:ye,onOpenFolder:ye,isFolder:Xt})})]}):Pt=g.jsx("div",{className:"empty",children:"Select a file to read it."});const Ut=re?re.crumb:E?g.jsx(N$,{path:E,onOpenFolder:ye}):i.view==="insights"?"Insights — "+(i.viewTarget||l?.name||""):i.view==="history"?"History — "+AI(i.viewTarget||"",Xt):x?l.name:null,or=g.jsx(el,{crumb:Ut,meta:Y,actions:g.jsxs(g.Fragment,{children:[ee&&g.jsx(Nt,{id:"share-btn",variant:"toolbar",className:"icon-only",title:"Share","aria-label":"Share",onClick:Ue,children:g.jsx(Yt,{name:"share"})}),ge&&!E&&!i.view&&g.jsxs(Nt,{id:"history-btn",variant:"toolbar",onClick:lt,children:[g.jsx(Yt,{name:"hist"})," ",g.jsx("span",{className:"lbl",children:"History"})]}),be&&g.jsx("a",{id:"download",hidden:!0,download:!0,href:Ve,ref:Z,children:"Download"}),De&&g.jsx(Nt,{id:"more-btn",variant:"toolbar",className:"icon-only",title:"More actions","aria-label":"More actions",onClick:Fe=>{Fe.stopPropagation(),j(!N)},children:g.jsx(Yt,{name:"dots"})}),N&&g.jsxs("div",{id:"more-menu",role:"menu",children:[ge&&g.jsx("button",{className:"more-item",onClick:lt,children:"History"}),be&&g.jsx("button",{className:"more-item",onClick:()=>Z.current?.click(),children:"Download"}),e.canInsights&&g.jsx("button",{className:"more-item",onClick:()=>{e.onClosePanel?.(),fn(_a("insights",l?.id,E))},children:"Insights"})]})]})});return g.jsxs(g.Fragment,{children:[g.jsx(Ws,{vault:e.sidebar.vault,projectsNav:e.sidebar.projectsNav,orgBar:e.sidebar.orgBar,tree:g.jsx(M$,{root:h,expanded:q,onToggle:he,currentPath:T,listingShowing:L,onOpen:ye}),topbar:or,contentRef:ve,onContentScroll:me,children:g.jsx(vu,{width:mn,className:qt,children:Pt})}),J&&g.jsx(B$,{url:J.url,copied:J.copied,onClose:()=>W(null)}),g.jsx(SI,{open:U,onClose:()=>Q(!1),candidates:Je})]})}function MI({config:e}){const n=Fp(),r=Ip(),[i,s]=S.useState(null),[l,u]=S.useState(null);S.useEffect(()=>u(null),[n]);const d=S.useMemo(()=>{const I=n.match(/^\/join\/([0-9a-f]+)\/?$/);return I?I[1]:null},[n]),{data:h}=Vk(!d),{data:m}=Fk(!d),y=!!e.auth.admin,{data:v}=o_(y),b=S.useMemo(()=>a_(n,"hub"),[n]),x=S.useMemo(()=>h&&(h.find(I=>I.id===b.project)||i&&h.find(I=>I.org===i)||h[0])||null,[h,b.project,i]);if(S.useEffect(()=>{document.title=x?x.name+" — BearDrive":e.brand||"BearDrive"},[x,e]),d)return g.jsx(jI,{token:d,onDone:async I=>{s(I),await r(),fn("/",{replace:!0})}});const C=e.brand||"BearDrive",_=x&&m?.find(I=>I.id===x.org)||null,E=y||(_?_.role==="owner":!1),T=g.jsx(Ku,{name:C,onHome:()=>fn("/"),search:!!x}),O=e.me?g.jsx(K8,{me:e.me,org:_,orgActive:!!b.org,admin:y?{pending:v?.length||0,onClick:()=>{u({kind:"hub"}),hr()}}:void 0}):void 0;if(!h||!m)return g.jsx(Ws,{vault:T,topbar:g.jsx(el,{}),children:g.jsx(vu,{children:g.jsx("div",{className:"empty",children:"Loading…"})})});if(!x)return g.jsx(Ws,{vault:T,projectsNav:g.jsx(Ux,{projects:h}),orgBar:O,topbar:g.jsx(el,{}),children:g.jsx(vu,{children:g.jsx(s$,{authEnabled:e.auth.enabled,onCreate:async I=>{if(!I){Xe("Give the project a name.",!0);return}try{const he=await Ma("/api/projects",{name:I});await r(),fn("/"+he.project.id),Xe(`Created “${he.project.name}”.`)}catch(he){Xe("Could not create the project: "+he.message,!0)}}})})});const A=l?.kind==="hub"?{crumb:"Signup & access",body:g.jsx(F8,{})}:null,k=b.org?m.find(I=>I.id===b.org):null,q=b.org&&!k?{crumb:"Organization",body:g.jsxs("div",{className:"empty",children:[g.jsx("h3",{children:"Organization not found"}),g.jsx("p",{children:"This organization doesn't exist, or you're no longer a member."}),g.jsx("p",{children:g.jsxs("a",{...l_("/"+x.id),children:["Back to ",x.name]})})]})}:k?{crumb:"Organization",body:g.jsx(L8,{org:k,projects:h,myEmail:e.me?.email||""})}:null,H=b.view==="settings"?{crumb:"Project settings",body:g.jsx(J8,{project:x,org:_,onDeleted:async()=>{await r(),fn("/")}})}:b.view==="install"?{crumb:"Installation",body:g.jsx(pC,{project:x})}:null;return!b.org&&b.project!==x.id?g.jsx(qk,{to:"/"+x.id}):g.jsx(RC,{config:e,apiBase:"/api/p/"+x.id+"/",route:b,hub:!0,project:x,projects:h,canInsights:E,sidebar:{vault:T,projectsNav:g.jsx(Ux,{projects:h,currentId:x.id,menu:{active:l?null:b.view==="insights"&&!b.viewTarget?"dashboard":b.view==="install"?"install":b.view==="history"&&!b.viewTarget?"history":b.view==="settings"?"settings":null,onDashboard:()=>{u(null),fn(_a("insights",x.id)),hr()},onInstall:()=>{u(null),fn(_a("install",x.id)),hr()},onHistory:()=>{u(null),fn(_a("history",x.id)),hr()},onSettings:()=>{u(null),fn(_a("settings",x.id)),hr()}}}),orgBar:O},panel:A||q||H,onClosePanel:()=>u(null)},x.id)}function jI({token:e,onDone:n}){return S.useEffect(()=>{let r=!1;return Ma("/api/invites/"+e).then(i=>{r||(Xe(`Welcome — you joined the “${i.org.name}” team. Opening its projects…`),n(i.org.id))}).catch(i=>{r||String(i.message).includes("signing in")||(Xe("Could not accept the invite: "+i.message,!0),n(null))}),()=>{r=!0}},[e]),g.jsx(Ws,{vault:g.jsx(Ku,{name:"BearDrive"}),topbar:g.jsx(el,{}),children:g.jsx(vu,{children:g.jsx("div",{className:"empty",children:"Joining…"})})})}function NI({config:e}){const n=Fp(),r=e.volume||"BearDrive";S.useEffect(()=>{document.title=e.brand||r},[e,r]);const i=S.useMemo(()=>a_(n,"volume"),[n]);return g.jsx(RC,{config:e,apiBase:"/api/",route:i,hub:!1,sidebar:{vault:g.jsx(Ku,{name:r,showSignout:e.auth.enabled,search:!0})}})}function zI(){const{data:e}=z2();return g.jsxs(WN,{delayDuration:150,children:[e?e.mode==="hub"?g.jsx(MI,{config:e}):g.jsx(NI,{config:e}):g.jsx(Ws,{vault:g.jsx(Ku,{name:"…",showSignout:!1}),topbar:g.jsx(el,{}),children:g.jsx("div",{className:"empty",children:"Loading…"})}),g.jsx(jk,{}),g.jsx(Lk,{})]})}const DI=new b2({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});ZR.createRoot(document.getElementById("root")).render(g.jsx(S.StrictMode,{children:g.jsx(x2,{client:DI,children:g.jsx(zI,{})})})); diff --git a/internal/webapp/static/assets/index-Vwh6tzvU.js b/internal/webapp/static/assets/index-Vwh6tzvU.js deleted file mode 100644 index 74a5320..0000000 --- a/internal/webapp/static/assets/index-Vwh6tzvU.js +++ /dev/null @@ -1,121 +0,0 @@ -function DR(e,n){for(var r=0;ri[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function r(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(s){if(s.ep)return;s.ep=!0;const l=r(s);fetch(s.href,l)}})();function Qx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ph={exports:{}},Os={};var q0;function kR(){if(q0)return Os;q0=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(i,s,l){var u=null;if(l!==void 0&&(u=""+l),s.key!==void 0&&(u=""+s.key),"key"in s){l={};for(var d in s)d!=="key"&&(l[d]=s[d])}else l=s;return s=l.ref,{$$typeof:e,type:i,key:u,ref:s!==void 0?s:null,props:l}}return Os.Fragment=n,Os.jsx=r,Os.jsxs=r,Os}var G0;function LR(){return G0||(G0=1,ph.exports=kR()),ph.exports}var g=LR(),gh={exports:{}},Pe={};var Z0;function IR(){if(Z0)return Pe;Z0=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),b=Symbol.iterator;function S(z){return z===null||typeof z!="object"?null:(z=b&&z[b]||z["@@iterator"],typeof z=="function"?z:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,E={};function T(z,j,U){this.props=z,this.context=j,this.refs=E,this.updater=U||_}T.prototype.isReactComponent={},T.prototype.setState=function(z,j){if(typeof z!="object"&&typeof z!="function"&&z!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,j,"setState")},T.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function O(){}O.prototype=T.prototype;function M(z,j,U){this.props=z,this.context=j,this.refs=E,this.updater=U||_}var k=M.prototype=new O;k.constructor=M,C(k,T.prototype),k.isPureReactComponent=!0;var L=Array.isArray;function q(){}var H={H:null,A:null,T:null,S:null},$=Object.prototype.hasOwnProperty;function he(z,j,U){var Q=U.ref;return{$$typeof:e,type:z,key:j,ref:Q!==void 0?Q:null,props:U}}function ve(z,j){return he(z.type,j,z.props)}function de(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function le(z){var j={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(U){return j[U]})}var ae=/\/+/g;function me(z,j){return typeof z=="object"&&z!==null&&z.key!=null?le(""+z.key):j.toString(36)}function ye(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(q,q):(z.status="pending",z.then(function(j){z.status==="pending"&&(z.status="fulfilled",z.value=j)},function(j){z.status==="pending"&&(z.status="rejected",z.reason=j)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function D(z,j,U,Q,Z){var re=typeof z;(re==="undefined"||re==="boolean")&&(z=null);var ee=!1;if(z===null)ee=!0;else switch(re){case"bigint":case"string":case"number":ee=!0;break;case"object":switch(z.$$typeof){case e:case n:ee=!0;break;case y:return ee=z._init,D(ee(z._payload),j,U,Q,Z)}}if(ee)return Z=Z(z),ee=Q===""?"."+me(z,0):Q,L(Z)?(U="",ee!=null&&(U=ee.replace(ae,"$&/")+"/"),D(Z,j,U,"",function(De){return De})):Z!=null&&(de(Z)&&(Z=ve(Z,U+(Z.key==null||z&&z.key===Z.key?"":(""+Z.key).replace(ae,"$&/")+"/")+ee)),j.push(Z)),1;ee=0;var ge=Q===""?".":Q+":";if(L(z))for(var be=0;be>>1,W=D[J];if(0>>1;Js(U,ne))Qs(Z,U)?(D[J]=Z,D[Q]=ne,J=Q):(D[J]=U,D[j]=ne,J=j);else if(Qs(Z,ne))D[J]=Z,D[Q]=ne,J=Q;else break e}}return Y}function s(D,Y){var ne=D.sortIndex-Y.sortIndex;return ne!==0?ne:D.id-Y.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var m=[],h=[],y=1,v=null,b=3,S=!1,_=!1,C=!1,E=!1,T=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function k(D){for(var Y=r(h);Y!==null;){if(Y.callback===null)i(h);else if(Y.startTime<=D)i(h),Y.sortIndex=Y.expirationTime,n(m,Y);else break;Y=r(h)}}function L(D){if(C=!1,k(D),!_)if(r(m)!==null)_=!0,q||(q=!0,le());else{var Y=r(h);Y!==null&&ye(L,Y.startTime-D)}}var q=!1,H=-1,$=5,he=-1;function ve(){return E?!0:!(e.unstable_now()-he<$)}function de(){if(E=!1,q){var D=e.unstable_now();he=D;var Y=!0;try{e:{_=!1,C&&(C=!1,O(H),H=-1),S=!0;var ne=b;try{t:{for(k(D),v=r(m);v!==null&&!(v.expirationTime>D&&ve());){var J=v.callback;if(typeof J=="function"){v.callback=null,b=v.priorityLevel;var W=J(v.expirationTime<=D);if(D=e.unstable_now(),typeof W=="function"){v.callback=W,k(D),Y=!0;break t}v===r(m)&&i(m),k(D)}else i(m);v=r(m)}if(v!==null)Y=!0;else{var z=r(h);z!==null&&ye(L,z.startTime-D),Y=!1}}break e}finally{v=null,b=ne,S=!1}Y=void 0}}finally{Y?le():q=!1}}}var le;if(typeof M=="function")le=function(){M(de)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,me=ae.port2;ae.port1.onmessage=de,le=function(){me.postMessage(null)}}else le=function(){T(de,0)};function ye(D,Y){H=T(function(){D(e.unstable_now())},Y)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(D){D.callback=null},e.unstable_forceFrameRate=function(D){0>D||125J?(D.sortIndex=ne,n(h,D),r(m)===null&&D===r(h)&&(C?(O(H),H=-1):C=!0,ye(L,ne-J))):(D.sortIndex=W,n(m,D),_||S||(_=!0,q||(q=!0,le()))),D},e.unstable_shouldYield=ve,e.unstable_wrapCallback=function(D){var Y=b;return function(){var ne=b;b=Y;try{return D.apply(this,arguments)}finally{b=ne}}}})(bh)),bh}var Q0;function VR(){return Q0||(Q0=1,yh.exports=$R()),yh.exports}var xh={exports:{}},un={};var X0;function FR(){if(X0)return un;X0=1;var e=Um();function n(m){var h="https://react.dev/errors/"+m;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),xh.exports=FR(),xh.exports}var W0;function PR(){if(W0)return Ms;W0=1;var e=VR(),n=Um(),r=Xx();function i(t){var o="https://react.dev/errors/"+t;if(1W||(t.current=J[W],J[W]=null,W--)}function U(t,o){W++,J[W]=t.current,t.current=o}var Q=z(null),Z=z(null),re=z(null),ee=z(null);function ge(t,o){switch(U(re,o),U(Z,t),U(Q,null),o.nodeType){case 9:case 11:t=(t=o.documentElement)&&(t=t.namespaceURI)?m0(t):0;break;default:if(t=o.tagName,o=o.namespaceURI)o=m0(o),t=p0(o,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}j(Q),U(Q,t)}function be(){j(Q),j(Z),j(re)}function De(t){t.memoizedState!==null&&U(ee,t);var o=Q.current,a=p0(o,t.type);o!==a&&(U(Z,t),U(Q,a))}function Ve(t){Z.current===t&&(j(Q),j(Z)),ee.current===t&&(j(ee),Cs._currentValue=ne)}var Ue,lt;function Xe(t){if(Ue===void 0)try{throw Error()}catch(a){var o=a.stack.trim().match(/\n( *(at )?)/);Ue=o&&o[1]||"",lt=-1)":-1f||N[c]!==G[f]){var te=` -`+N[c].replace(" at new "," at ");return t.displayName&&te.includes("")&&(te=te.replace("",t.displayName)),te}while(1<=c&&0<=f);break}}}finally{Xt=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?Xe(a):""}function qt(t,o){switch(t.tag){case 26:case 27:case 5:return Xe(t.type);case 16:return Xe("Lazy");case 13:return t.child!==o&&o!==null?Xe("Suspense Fallback"):Xe("Suspense");case 19:return Xe("SuspenseList");case 0:case 15:return mn(t.type,!1);case 11:return mn(t.type.render,!1);case 1:return mn(t.type,!0);case 31:return Xe("Activity");default:return""}}function Pt(t){try{var o="",a=null;do o+=qt(t,a),a=t,t=t.return;while(t);return o}catch(c){return` -Error generating stack: `+c.message+` -`+c.stack}}var Ut=Object.prototype.hasOwnProperty,rr=e.unstable_scheduleCallback,Fe=e.unstable_cancelCallback,Ne=e.unstable_shouldYield,Je=e.unstable_requestPaint,zt=e.unstable_now,eo=e.unstable_getCurrentPriorityLevel,or=e.unstable_ImmediatePriority,Ri=e.unstable_UserBlockingPriority,to=e.unstable_NormalPriority,Ti=e.unstable_LowPriority,Un=e.unstable_IdlePriority,A=e.log,V=e.unstable_setDisableYieldValue,F=null,se=null;function ue(t){if(typeof A=="function"&&V(t),se&&typeof se.setStrictMode=="function")try{se.setStrictMode(F,t)}catch{}}var pe=Math.clz32?Math.clz32:Te,xe=Math.log,Se=Math.LN2;function Te(t){return t>>>=0,t===0?32:31-(xe(t)/Se|0)|0}var rt=256,wt=262144,Jt=4194304;function Nt(t){var o=t&42;if(o!==0)return o;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function je(t,o,a){var c=t.pendingLanes;if(c===0)return 0;var f=0,p=t.suspendedLanes,w=t.pingedLanes;t=t.warmLanes;var R=c&134217727;return R!==0?(c=R&~p,c!==0?f=Nt(c):(w&=R,w!==0?f=Nt(w):a||(a=R&~t,a!==0&&(f=Nt(a))))):(R=c&~p,R!==0?f=Nt(R):w!==0?f=Nt(w):a||(a=c&~t,a!==0&&(f=Nt(a)))),f===0?0:o!==0&&o!==f&&(o&p)===0&&(p=f&-f,a=o&-o,p>=a||p===32&&(a&4194048)!==0)?o:f}function pt(t,o){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&o)===0}function bt(t,o){switch(t){case 1:case 2:case 4:case 8:case 64:return o+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Gt(){var t=Jt;return Jt<<=1,(Jt&62914560)===0&&(Jt=4194304),t}function ir(t){for(var o=[],a=0;31>a;a++)o.push(t);return o}function _t(t,o){t.pendingLanes|=o,o!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function yn(t,o,a,c,f,p){var w=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var R=t.entanglements,N=t.expirationTimes,G=t.hiddenUpdates;for(a=w&~a;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var OC=/[\n"\\]/g;function Bn(t){return t.replace(OC,function(o){return"\\"+o.charCodeAt(0).toString(16)+" "})}function ld(t,o,a,c,f,p,w,R){t.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?t.type=w:t.removeAttribute("type"),o!=null?w==="number"?(o===0&&t.value===""||t.value!=o)&&(t.value=""+Hn(o)):t.value!==""+Hn(o)&&(t.value=""+Hn(o)):w!=="submit"&&w!=="reset"||t.removeAttribute("value"),o!=null?cd(t,w,Hn(o)):a!=null?cd(t,w,Hn(a)):c!=null&&t.removeAttribute("value"),f==null&&p!=null&&(t.defaultChecked=!!p),f!=null&&(t.checked=f&&typeof f!="function"&&typeof f!="symbol"),R!=null&&typeof R!="function"&&typeof R!="symbol"&&typeof R!="boolean"?t.name=""+Hn(R):t.removeAttribute("name")}function lg(t,o,a,c,f,p,w,R){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(t.type=p),o!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||o!=null)){sd(t);return}a=a!=null?""+Hn(a):"",o=o!=null?""+Hn(o):a,R||o===t.value||(t.value=o),t.defaultValue=o}c=c??f,c=typeof c!="function"&&typeof c!="symbol"&&!!c,t.checked=R?t.checked:!!c,t.defaultChecked=!!c,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(t.name=w),sd(t)}function cd(t,o,a){o==="number"&&Sl(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function Di(t,o,a,c){if(t=t.options,o){o={};for(var f=0;f"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),md=!1;if(zr)try{var Ua={};Object.defineProperty(Ua,"passive",{get:function(){md=!0}}),window.addEventListener("test",Ua,Ua),window.removeEventListener("test",Ua,Ua)}catch{md=!1}var ro=null,pd=null,_l=null;function pg(){if(_l)return _l;var t,o=pd,a=o.length,c,f="value"in ro?ro.value:ro.textContent,p=f.length;for(t=0;t=qa),Sg=" ",wg=!1;function _g(t,o){switch(t){case"keyup":return nE.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Cg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var $i=!1;function oE(t,o){switch(t){case"compositionend":return Cg(o);case"keypress":return o.which!==32?null:(wg=!0,Sg);case"textInput":return t=o.data,t===Sg&&wg?null:t;default:return null}}function iE(t,o){if($i)return t==="compositionend"||!xd&&_g(t,o)?(t=pg(),_l=pd=ro=null,$i=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1=o)return{node:a,offset:o-t};t=c}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=zg(a)}}function Dg(t,o){return t&&o?t===o?!0:t&&t.nodeType===3?!1:o&&o.nodeType===3?Dg(t,o.parentNode):"contains"in t?t.contains(o):t.compareDocumentPosition?!!(t.compareDocumentPosition(o)&16):!1:!1}function kg(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var o=Sl(t.document);o instanceof t.HTMLIFrameElement;){try{var a=typeof o.contentWindow.location.href=="string"}catch{a=!1}if(a)t=o.contentWindow;else break;o=Sl(t.document)}return o}function _d(t){var o=t&&t.nodeName&&t.nodeName.toLowerCase();return o&&(o==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||o==="textarea"||t.contentEditable==="true")}var hE=zr&&"documentMode"in document&&11>=document.documentMode,Vi=null,Cd=null,Ya=null,Ed=!1;function Lg(t,o,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Ed||Vi==null||Vi!==Sl(c)||(c=Vi,"selectionStart"in c&&_d(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Ya&&Ka(Ya,c)||(Ya=c,c=gc(Cd,"onSelect"),0>=w,f-=w,vr=1<<32-pe(o)+f|a<Be?(Ye=Oe,Oe=null):Ye=Oe.sibling;var nt=K(P,Oe,B[Be],oe);if(nt===null){Oe===null&&(Oe=Ye);break}t&&Oe&&nt.alternate===null&&o(P,Oe),I=p(nt,I,Be),tt===null?Me=nt:tt.sibling=nt,tt=nt,Oe=Ye}if(Be===B.length)return a(P,Oe),Qe&&Dr(P,Be),Me;if(Oe===null){for(;BeBe?(Ye=Oe,Oe=null):Ye=Oe.sibling;var Ro=K(P,Oe,nt.value,oe);if(Ro===null){Oe===null&&(Oe=Ye);break}t&&Oe&&Ro.alternate===null&&o(P,Oe),I=p(Ro,I,Be),tt===null?Me=Ro:tt.sibling=Ro,tt=Ro,Oe=Ye}if(nt.done)return a(P,Oe),Qe&&Dr(P,Be),Me;if(Oe===null){for(;!nt.done;Be++,nt=B.next())nt=ie(P,nt.value,oe),nt!==null&&(I=p(nt,I,Be),tt===null?Me=nt:tt.sibling=nt,tt=nt);return Qe&&Dr(P,Be),Me}for(Oe=c(Oe);!nt.done;Be++,nt=B.next())nt=X(Oe,P,Be,nt.value,oe),nt!==null&&(t&&nt.alternate!==null&&Oe.delete(nt.key===null?Be:nt.key),I=p(nt,I,Be),tt===null?Me=nt:tt.sibling=nt,tt=nt);return t&&Oe.forEach(function(NR){return o(P,NR)}),Qe&&Dr(P,Be),Me}function dt(P,I,B,oe){if(typeof B=="object"&&B!==null&&B.type===C&&B.key===null&&(B=B.props.children),typeof B=="object"&&B!==null){switch(B.$$typeof){case S:e:{for(var Me=B.key;I!==null;){if(I.key===Me){if(Me=B.type,Me===C){if(I.tag===7){a(P,I.sibling),oe=f(I,B.props.children),oe.return=P,P=oe;break e}}else if(I.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===$&&ni(Me)===I.type){a(P,I.sibling),oe=f(I,B.props),ts(oe,B),oe.return=P,P=oe;break e}a(P,I);break}else o(P,I);I=I.sibling}B.type===C?(oe=Xo(B.props.children,P.mode,oe,B.key),oe.return=P,P=oe):(oe=Nl(B.type,B.key,B.props,null,P.mode,oe),ts(oe,B),oe.return=P,P=oe)}return w(P);case _:e:{for(Me=B.key;I!==null;){if(I.key===Me)if(I.tag===4&&I.stateNode.containerInfo===B.containerInfo&&I.stateNode.implementation===B.implementation){a(P,I.sibling),oe=f(I,B.children||[]),oe.return=P,P=oe;break e}else{a(P,I);break}else o(P,I);I=I.sibling}oe=zd(B,P.mode,oe),oe.return=P,P=oe}return w(P);case $:return B=ni(B),dt(P,I,B,oe)}if(ye(B))return Ee(P,I,B,oe);if(le(B)){if(Me=le(B),typeof Me!="function")throw Error(i(150));return B=Me.call(B),ze(P,I,B,oe)}if(typeof B.then=="function")return dt(P,I,Fl(B),oe);if(B.$$typeof===M)return dt(P,I,Ll(P,B),oe);Pl(P,B)}return typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint"?(B=""+B,I!==null&&I.tag===6?(a(P,I.sibling),oe=f(I,B),oe.return=P,P=oe):(a(P,I),oe=jd(B,P.mode,oe),oe.return=P,P=oe),w(P)):a(P,I)}return function(P,I,B,oe){try{es=0;var Me=dt(P,I,B,oe);return Qi=null,Me}catch(Oe){if(Oe===Yi||Oe===$l)throw Oe;var tt=Nn(29,Oe,null,P.mode);return tt.lanes=oe,tt.return=P,tt}}}var oi=iv(!0),av=iv(!1),lo=!1;function Bd(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qd(t,o){t=t.updateQueue,o.updateQueue===t&&(o.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function co(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function uo(t,o,a){var c=t.updateQueue;if(c===null)return null;if(c=c.shared,(ot&2)!==0){var f=c.pending;return f===null?o.next=o:(o.next=f.next,f.next=o),c.pending=o,o=zl(t),Hg(t,null,a),o}return jl(t,c,o,a),zl(t)}function ns(t,o,a){if(o=o.updateQueue,o!==null&&(o=o.shared,(a&4194048)!==0)){var c=o.lanes;c&=t.pendingLanes,a|=c,o.lanes=a,bn(t,a)}}function Gd(t,o){var a=t.updateQueue,c=t.alternate;if(c!==null&&(c=c.updateQueue,a===c)){var f=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var w={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?f=p=w:p=p.next=w,a=a.next}while(a!==null);p===null?f=p=o:p=p.next=o}else f=p=o;a={baseState:c.baseState,firstBaseUpdate:f,lastBaseUpdate:p,shared:c.shared,callbacks:c.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=o:t.next=o,a.lastBaseUpdate=o}var Zd=!1;function rs(){if(Zd){var t=Ki;if(t!==null)throw t}}function os(t,o,a,c){Zd=!1;var f=t.updateQueue;lo=!1;var p=f.firstBaseUpdate,w=f.lastBaseUpdate,R=f.shared.pending;if(R!==null){f.shared.pending=null;var N=R,G=N.next;N.next=null,w===null?p=G:w.next=G,w=N;var te=t.alternate;te!==null&&(te=te.updateQueue,R=te.lastBaseUpdate,R!==w&&(R===null?te.firstBaseUpdate=G:R.next=G,te.lastBaseUpdate=N))}if(p!==null){var ie=f.baseState;w=0,te=G=N=null,R=p;do{var K=R.lane&-536870913,X=K!==R.lane;if(X?(Ke&K)===K:(c&K)===K){K!==0&&K===Zi&&(Zd=!0),te!==null&&(te=te.next={lane:0,tag:R.tag,payload:R.payload,callback:null,next:null});e:{var Ee=t,ze=R;K=o;var dt=a;switch(ze.tag){case 1:if(Ee=ze.payload,typeof Ee=="function"){ie=Ee.call(dt,ie,K);break e}ie=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=ze.payload,K=typeof Ee=="function"?Ee.call(dt,ie,K):Ee,K==null)break e;ie=v({},ie,K);break e;case 2:lo=!0}}K=R.callback,K!==null&&(t.flags|=64,X&&(t.flags|=8192),X=f.callbacks,X===null?f.callbacks=[K]:X.push(K))}else X={lane:K,tag:R.tag,payload:R.payload,callback:R.callback,next:null},te===null?(G=te=X,N=ie):te=te.next=X,w|=K;if(R=R.next,R===null){if(R=f.shared.pending,R===null)break;X=R,R=X.next,X.next=null,f.lastBaseUpdate=X,f.shared.pending=null}}while(!0);te===null&&(N=ie),f.baseState=N,f.firstBaseUpdate=G,f.lastBaseUpdate=te,p===null&&(f.shared.lanes=0),go|=w,t.lanes=w,t.memoizedState=ie}}function sv(t,o){if(typeof t!="function")throw Error(i(191,t));t.call(o)}function lv(t,o){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;tp?p:8;var w=D.T,R={};D.T=R,hf(t,!1,o,a);try{var N=f(),G=D.S;if(G!==null&&G(R,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var te=wE(N,c);ss(t,o,te,$n(t))}else ss(t,o,c,$n(t))}catch(ie){ss(t,o,{then:function(){},status:"rejected",reason:ie},$n())}finally{Y.p=p,w!==null&&R.types!==null&&(w.types=R.types),D.T=w}}function OE(){}function df(t,o,a,c){if(t.tag!==5)throw Error(i(476));var f=Fv(t).queue;Vv(t,f,o,ne,a===null?OE:function(){return Pv(t),a(c)})}function Fv(t){var o=t.memoizedState;if(o!==null)return o;o={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$r,lastRenderedState:ne},next:null};var a={};return o.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$r,lastRenderedState:a},next:null},t.memoizedState=o,t=t.alternate,t!==null&&(t.memoizedState=o),o}function Pv(t){var o=Fv(t);o.next===null&&(o=t.alternate.memoizedState),ss(t,o.next.queue,{},$n())}function ff(){return tn(Cs)}function Uv(){return Mt().memoizedState}function Hv(){return Mt().memoizedState}function ME(t){for(var o=t.return;o!==null;){switch(o.tag){case 24:case 3:var a=$n();t=co(a);var c=uo(o,t,a);c!==null&&(Tn(c,o,a),ns(c,o,a)),o={cache:Fd()},t.payload=o;return}o=o.return}}function AE(t,o,a){var c=$n();a={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Xl(t)?qv(o,a):(a=Md(t,o,a,c),a!==null&&(Tn(a,t,c),Gv(a,o,c)))}function Bv(t,o,a){var c=$n();ss(t,o,a,c)}function ss(t,o,a,c){var f={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Xl(t))qv(o,f);else{var p=t.alternate;if(t.lanes===0&&(p===null||p.lanes===0)&&(p=o.lastRenderedReducer,p!==null))try{var w=o.lastRenderedState,R=p(w,a);if(f.hasEagerState=!0,f.eagerState=R,zn(R,w))return jl(t,o,f,0),mt===null&&Al(),!1}catch{}if(a=Md(t,o,f,c),a!==null)return Tn(a,t,c),Gv(a,o,c),!0}return!1}function hf(t,o,a,c){if(c={lane:2,revertLane:qf(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Xl(t)){if(o)throw Error(i(479))}else o=Md(t,a,c,2),o!==null&&Tn(o,t,2)}function Xl(t){var o=t.alternate;return t===He||o!==null&&o===He}function qv(t,o){Ji=Bl=!0;var a=t.pending;a===null?o.next=o:(o.next=a.next,a.next=o),t.pending=o}function Gv(t,o,a){if((a&4194048)!==0){var c=o.lanes;c&=t.pendingLanes,a|=c,o.lanes=a,bn(t,a)}}var ls={readContext:tn,use:Zl,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useLayoutEffect:Et,useInsertionEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useSyncExternalStore:Et,useId:Et,useHostTransitionStatus:Et,useFormState:Et,useActionState:Et,useOptimistic:Et,useMemoCache:Et,useCacheRefresh:Et};ls.useEffectEvent=Et;var Zv={readContext:tn,use:Zl,useCallback:function(t,o){return pn().memoizedState=[t,o===void 0?null:o],t},useContext:tn,useEffect:Av,useImperativeHandle:function(t,o,a){a=a!=null?a.concat([t]):null,Yl(4194308,4,Dv.bind(null,o,t),a)},useLayoutEffect:function(t,o){return Yl(4194308,4,t,o)},useInsertionEffect:function(t,o){Yl(4,2,t,o)},useMemo:function(t,o){var a=pn();o=o===void 0?null:o;var c=t();if(ii){ue(!0);try{t()}finally{ue(!1)}}return a.memoizedState=[c,o],c},useReducer:function(t,o,a){var c=pn();if(a!==void 0){var f=a(o);if(ii){ue(!0);try{a(o)}finally{ue(!1)}}}else f=o;return c.memoizedState=c.baseState=f,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:f},c.queue=t,t=t.dispatch=AE.bind(null,He,t),[c.memoizedState,t]},useRef:function(t){var o=pn();return t={current:t},o.memoizedState=t},useState:function(t){t=af(t);var o=t.queue,a=Bv.bind(null,He,o);return o.dispatch=a,[t.memoizedState,a]},useDebugValue:cf,useDeferredValue:function(t,o){var a=pn();return uf(a,t,o)},useTransition:function(){var t=af(!1);return t=Vv.bind(null,He,t.queue,!0,!1),pn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,o,a){var c=He,f=pn();if(Qe){if(a===void 0)throw Error(i(407));a=a()}else{if(a=o(),mt===null)throw Error(i(349));(Ke&127)!==0||mv(c,o,a)}f.memoizedState=a;var p={value:a,getSnapshot:o};return f.queue=p,Av(gv.bind(null,c,p,t),[t]),c.flags|=2048,ea(9,{destroy:void 0},pv.bind(null,c,p,a,o),null),a},useId:function(){var t=pn(),o=mt.identifierPrefix;if(Qe){var a=yr,c=vr;a=(c&~(1<<32-pe(c)-1)).toString(32)+a,o="_"+o+"R_"+a,a=ql++,0<\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof c.is=="string"?w.createElement("select",{is:c.is}):w.createElement("select"),c.multiple?p.multiple=!0:c.size&&(p.size=c.size);break;default:p=typeof c.is=="string"?w.createElement(f,{is:c.is}):w.createElement(f)}}p[Wt]=o,p[Sn]=c;e:for(w=o.child;w!==null;){if(w.tag===5||w.tag===6)p.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===o)break e;for(;w.sibling===null;){if(w.return===null||w.return===o)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}o.stateNode=p;e:switch(rn(p,f,c),f){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Fr(o)}}return vt(o),Tf(o,o.type,t===null?null:t.memoizedProps,o.pendingProps,a),null;case 6:if(t&&o.stateNode!=null)t.memoizedProps!==c&&Fr(o);else{if(typeof c!="string"&&o.stateNode===null)throw Error(i(166));if(t=re.current,qi(o)){if(t=o.stateNode,a=o.memoizedProps,c=null,f=en,f!==null)switch(f.tag){case 27:case 5:c=f.memoizedProps}t[Wt]=o,t=!!(t.nodeValue===a||c!==null&&c.suppressHydrationWarning===!0||f0(t.nodeValue,a)),t||ao(o,!0)}else t=vc(t).createTextNode(c),t[Wt]=o,o.stateNode=t}return vt(o),null;case 31:if(a=o.memoizedState,t===null||t.memoizedState!==null){if(c=qi(o),a!==null){if(t===null){if(!c)throw Error(i(318));if(t=o.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(557));t[Wt]=o}else Jo(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;vt(o),t=!1}else a=Ld(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),t=!0;if(!t)return o.flags&256?(kn(o),o):(kn(o),null);if((o.flags&128)!==0)throw Error(i(558))}return vt(o),null;case 13:if(c=o.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(f=qi(o),c!==null&&c.dehydrated!==null){if(t===null){if(!f)throw Error(i(318));if(f=o.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(i(317));f[Wt]=o}else Jo(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;vt(o),f=!1}else f=Ld(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=f),f=!0;if(!f)return o.flags&256?(kn(o),o):(kn(o),null)}return kn(o),(o.flags&128)!==0?(o.lanes=a,o):(a=c!==null,t=t!==null&&t.memoizedState!==null,a&&(c=o.child,f=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(f=c.alternate.memoizedState.cachePool.pool),p=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(p=c.memoizedState.cachePool.pool),p!==f&&(c.flags|=2048)),a!==t&&a&&(o.child.flags|=8192),nc(o,o.updateQueue),vt(o),null);case 4:return be(),t===null&&Yf(o.stateNode.containerInfo),vt(o),null;case 10:return Lr(o.type),vt(o),null;case 19:if(j(Ot),c=o.memoizedState,c===null)return vt(o),null;if(f=(o.flags&128)!==0,p=c.rendering,p===null)if(f)us(c,!1);else{if(Rt!==0||t!==null&&(t.flags&128)!==0)for(t=o.child;t!==null;){if(p=Hl(t),p!==null){for(o.flags|=128,us(c,!1),t=p.updateQueue,o.updateQueue=t,nc(o,t),o.subtreeFlags=0,t=a,a=o.child;a!==null;)Bg(a,t),a=a.sibling;return U(Ot,Ot.current&1|2),Qe&&Dr(o,c.treeForkCount),o.child}t=t.sibling}c.tail!==null&&zt()>sc&&(o.flags|=128,f=!0,us(c,!1),o.lanes=4194304)}else{if(!f)if(t=Hl(p),t!==null){if(o.flags|=128,f=!0,t=t.updateQueue,o.updateQueue=t,nc(o,t),us(c,!0),c.tail===null&&c.tailMode==="hidden"&&!p.alternate&&!Qe)return vt(o),null}else 2*zt()-c.renderingStartTime>sc&&a!==536870912&&(o.flags|=128,f=!0,us(c,!1),o.lanes=4194304);c.isBackwards?(p.sibling=o.child,o.child=p):(t=c.last,t!==null?t.sibling=p:o.child=p,c.last=p)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=zt(),t.sibling=null,a=Ot.current,U(Ot,f?a&1|2:a&1),Qe&&Dr(o,c.treeForkCount),t):(vt(o),null);case 22:case 23:return kn(o),Yd(),c=o.memoizedState!==null,t!==null?t.memoizedState!==null!==c&&(o.flags|=8192):c&&(o.flags|=8192),c?(a&536870912)!==0&&(o.flags&128)===0&&(vt(o),o.subtreeFlags&6&&(o.flags|=8192)):vt(o),a=o.updateQueue,a!==null&&nc(o,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),c=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(c=o.memoizedState.cachePool.pool),c!==a&&(o.flags|=2048),t!==null&&j(ti),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),o.memoizedState.cache!==a&&(o.flags|=2048),Lr(Dt),vt(o),null;case 25:return null;case 30:return null}throw Error(i(156,o.tag))}function kE(t,o){switch(Dd(o),o.tag){case 1:return t=o.flags,t&65536?(o.flags=t&-65537|128,o):null;case 3:return Lr(Dt),be(),t=o.flags,(t&65536)!==0&&(t&128)===0?(o.flags=t&-65537|128,o):null;case 26:case 27:case 5:return Ve(o),null;case 31:if(o.memoizedState!==null){if(kn(o),o.alternate===null)throw Error(i(340));Jo()}return t=o.flags,t&65536?(o.flags=t&-65537|128,o):null;case 13:if(kn(o),t=o.memoizedState,t!==null&&t.dehydrated!==null){if(o.alternate===null)throw Error(i(340));Jo()}return t=o.flags,t&65536?(o.flags=t&-65537|128,o):null;case 19:return j(Ot),null;case 4:return be(),null;case 10:return Lr(o.type),null;case 22:case 23:return kn(o),Yd(),t!==null&&j(ti),t=o.flags,t&65536?(o.flags=t&-65537|128,o):null;case 24:return Lr(Dt),null;case 25:return null;default:return null}}function vy(t,o){switch(Dd(o),o.tag){case 3:Lr(Dt),be();break;case 26:case 27:case 5:Ve(o);break;case 4:be();break;case 31:o.memoizedState!==null&&kn(o);break;case 13:kn(o);break;case 19:j(Ot);break;case 10:Lr(o.type);break;case 22:case 23:kn(o),Yd(),t!==null&&j(ti);break;case 24:Lr(Dt)}}function ds(t,o){try{var a=o.updateQueue,c=a!==null?a.lastEffect:null;if(c!==null){var f=c.next;a=f;do{if((a.tag&t)===t){c=void 0;var p=a.create,w=a.inst;c=p(),w.destroy=c}a=a.next}while(a!==f)}}catch(R){st(o,o.return,R)}}function mo(t,o,a){try{var c=o.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var p=f.next;c=p;do{if((c.tag&t)===t){var w=c.inst,R=w.destroy;if(R!==void 0){w.destroy=void 0,f=o;var N=a,G=R;try{G()}catch(te){st(f,N,te)}}}c=c.next}while(c!==p)}}catch(te){st(o,o.return,te)}}function yy(t){var o=t.updateQueue;if(o!==null){var a=t.stateNode;try{lv(o,a)}catch(c){st(t,t.return,c)}}}function by(t,o,a){a.props=ai(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(c){st(t,o,c)}}function fs(t,o){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var c=t.stateNode;break;case 30:c=t.stateNode;break;default:c=t.stateNode}typeof a=="function"?t.refCleanup=a(c):a.current=c}}catch(f){st(t,o,f)}}function br(t,o){var a=t.ref,c=t.refCleanup;if(a!==null)if(typeof c=="function")try{c()}catch(f){st(t,o,f)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){st(t,o,f)}else a.current=null}function xy(t){var o=t.type,a=t.memoizedProps,c=t.stateNode;try{e:switch(o){case"button":case"input":case"select":case"textarea":a.autoFocus&&c.focus();break e;case"img":a.src?c.src=a.src:a.srcSet&&(c.srcset=a.srcSet)}}catch(f){st(t,t.return,f)}}function Of(t,o,a){try{var c=t.stateNode;rR(c,t.type,a,o),c[Sn]=o}catch(f){st(t,t.return,f)}}function Sy(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&So(t.type)||t.tag===4}function Mf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Sy(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&So(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Af(t,o,a){var c=t.tag;if(c===5||c===6)t=t.stateNode,o?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,o):(o=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,o.appendChild(t),a=a._reactRootContainer,a!=null||o.onclick!==null||(o.onclick=jr));else if(c!==4&&(c===27&&So(t.type)&&(a=t.stateNode,o=null),t=t.child,t!==null))for(Af(t,o,a),t=t.sibling;t!==null;)Af(t,o,a),t=t.sibling}function rc(t,o,a){var c=t.tag;if(c===5||c===6)t=t.stateNode,o?a.insertBefore(t,o):a.appendChild(t);else if(c!==4&&(c===27&&So(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(rc(t,o,a),t=t.sibling;t!==null;)rc(t,o,a),t=t.sibling}function wy(t){var o=t.stateNode,a=t.memoizedProps;try{for(var c=t.type,f=o.attributes;f.length;)o.removeAttributeNode(f[0]);rn(o,c,a),o[Wt]=t,o[Sn]=a}catch(p){st(t,t.return,p)}}var Pr=!1,It=!1,jf=!1,_y=typeof WeakSet=="function"?WeakSet:Set,Kt=null;function LE(t,o){if(t=t.containerInfo,Jf=Cc,t=kg(t),_d(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var c=a.getSelection&&a.getSelection();if(c&&c.rangeCount!==0){a=c.anchorNode;var f=c.anchorOffset,p=c.focusNode;c=c.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var w=0,R=-1,N=-1,G=0,te=0,ie=t,K=null;t:for(;;){for(var X;ie!==a||f!==0&&ie.nodeType!==3||(R=w+f),ie!==p||c!==0&&ie.nodeType!==3||(N=w+c),ie.nodeType===3&&(w+=ie.nodeValue.length),(X=ie.firstChild)!==null;)K=ie,ie=X;for(;;){if(ie===t)break t;if(K===a&&++G===f&&(R=w),K===p&&++te===c&&(N=w),(X=ie.nextSibling)!==null)break;ie=K,K=ie.parentNode}ie=X}a=R===-1||N===-1?null:{start:R,end:N}}else a=null}a=a||{start:0,end:0}}else a=null;for(Wf={focusedElem:t,selectionRange:a},Cc=!1,Kt=o;Kt!==null;)if(o=Kt,t=o.child,(o.subtreeFlags&1028)!==0&&t!==null)t.return=o,Kt=t;else for(;Kt!==null;){switch(o=Kt,p=o.alternate,t=o.flags,o.tag){case 0:if((t&4)!==0&&(t=o.updateQueue,t=t!==null?t.events:null,t!==null))for(a=0;a title"))),rn(p,c,a),p[Wt]=t,Zt(p),c=p;break e;case"link":var w=M0("link","href",f).get(c+(a.href||""));if(w){for(var R=0;Rdt&&(w=dt,dt=ze,ze=w);var P=Ng(R,ze),I=Ng(R,dt);if(P&&I&&(X.rangeCount!==1||X.anchorNode!==P.node||X.anchorOffset!==P.offset||X.focusNode!==I.node||X.focusOffset!==I.offset)){var B=ie.createRange();B.setStart(P.node,P.offset),X.removeAllRanges(),ze>dt?(X.addRange(B),X.extend(I.node,I.offset)):(B.setEnd(I.node,I.offset),X.addRange(B))}}}}for(ie=[],X=R;X=X.parentNode;)X.nodeType===1&&ie.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof R.focus=="function"&&R.focus(),R=0;Ra?32:a,D.T=null,a=$f,$f=null;var p=yo,w=Gr;if(Ht=0,ia=yo=null,Gr=0,(ot&6)!==0)throw Error(i(331));var R=ot;if(ot|=4,Dy(p.current),jy(p,p.current,w,a),ot=R,ys(0,!1),se&&typeof se.onPostCommitFiberRoot=="function")try{se.onPostCommitFiberRoot(F,p)}catch{}return!0}finally{Y.p=f,D.T=c,Jy(t,o)}}function e0(t,o,a){o=Gn(a,o),o=vf(t.stateNode,o,2),t=uo(t,o,2),t!==null&&(_t(t,2),xr(t))}function st(t,o,a){if(t.tag===3)e0(t,t,a);else for(;o!==null;){if(o.tag===3){e0(o,t,a);break}else if(o.tag===1){var c=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(vo===null||!vo.has(c))){t=Gn(a,t),a=ty(2),c=uo(o,a,2),c!==null&&(ny(a,c,o,t),_t(c,2),xr(c));break}}o=o.return}}function Uf(t,o,a){var c=t.pingCache;if(c===null){c=t.pingCache=new VE;var f=new Set;c.set(o,f)}else f=c.get(o),f===void 0&&(f=new Set,c.set(o,f));f.has(a)||(Df=!0,f.add(a),t=BE.bind(null,t,o,a),o.then(t,t))}function BE(t,o,a){var c=t.pingCache;c!==null&&c.delete(o),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,mt===t&&(Ke&a)===a&&(Rt===4||Rt===3&&(Ke&62914560)===Ke&&300>zt()-ac?(ot&2)===0&&aa(t,0):kf|=a,oa===Ke&&(oa=0)),xr(t)}function t0(t,o){o===0&&(o=Gt()),t=Qo(t,o),t!==null&&(_t(t,o),xr(t))}function qE(t){var o=t.memoizedState,a=0;o!==null&&(a=o.retryLane),t0(t,a)}function GE(t,o){var a=0;switch(t.tag){case 31:case 13:var c=t.stateNode,f=t.memoizedState;f!==null&&(a=f.retryLane);break;case 19:c=t.stateNode;break;case 22:c=t.stateNode._retryCache;break;default:throw Error(i(314))}c!==null&&c.delete(o),t0(t,a)}function ZE(t,o){return rr(t,o)}var hc=null,la=null,Hf=!1,mc=!1,Bf=!1,xo=0;function xr(t){t!==la&&t.next===null&&(la===null?hc=la=t:la=la.next=t),mc=!0,Hf||(Hf=!0,YE())}function ys(t,o){if(!Bf&&mc){Bf=!0;do for(var a=!1,c=hc;c!==null;){if(t!==0){var f=c.pendingLanes;if(f===0)var p=0;else{var w=c.suspendedLanes,R=c.pingedLanes;p=(1<<31-pe(42|t)+1)-1,p&=f&~(w&~R),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,i0(c,p))}else p=Ke,p=je(c,c===mt?p:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(p&3)===0||pt(c,p)||(a=!0,i0(c,p));c=c.next}while(a);Bf=!1}}function KE(){n0()}function n0(){mc=Hf=!1;var t=0;xo!==0&&iR()&&(t=xo);for(var o=zt(),a=null,c=hc;c!==null;){var f=c.next,p=r0(c,o);p===0?(c.next=null,a===null?hc=f:a.next=f,f===null&&(la=a)):(a=c,(t!==0||(p&3)!==0)&&(mc=!0)),c=f}Ht!==0&&Ht!==5||ys(t),xo!==0&&(xo=0)}function r0(t,o){for(var a=t.suspendedLanes,c=t.pingedLanes,f=t.expirationTimes,p=t.pendingLanes&-62914561;0R)break;var te=N.transferSize,ie=N.initiatorType;te&&h0(ie)&&(N=N.responseEnd,w+=te*(N"u"?null:document;function E0(t,o,a){var c=ca;if(c&&typeof o=="string"&&o){var f=Bn(o);f='link[rel="'+t+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),C0.has(f)||(C0.add(f),t={rel:t,crossOrigin:a,href:o},c.querySelector(f)===null&&(o=c.createElement("link"),rn(o,"link",t),Zt(o),c.head.appendChild(o)))}}function mR(t){Zr.D(t),E0("dns-prefetch",t,null)}function pR(t,o){Zr.C(t,o),E0("preconnect",t,o)}function gR(t,o,a){Zr.L(t,o,a);var c=ca;if(c&&t&&o){var f='link[rel="preload"][as="'+Bn(o)+'"]';o==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Bn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Bn(a.imageSizes)+'"]')):f+='[href="'+Bn(t)+'"]';var p=f;switch(o){case"style":p=ua(t);break;case"script":p=da(t)}Jn.has(p)||(t=v({rel:"preload",href:o==="image"&&a&&a.imageSrcSet?void 0:t,as:o},a),Jn.set(p,t),c.querySelector(f)!==null||o==="style"&&c.querySelector(ws(p))||o==="script"&&c.querySelector(_s(p))||(o=c.createElement("link"),rn(o,"link",t),Zt(o),c.head.appendChild(o)))}}function vR(t,o){Zr.m(t,o);var a=ca;if(a&&t){var c=o&&typeof o.as=="string"?o.as:"script",f='link[rel="modulepreload"][as="'+Bn(c)+'"][href="'+Bn(t)+'"]',p=f;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=da(t)}if(!Jn.has(p)&&(t=v({rel:"modulepreload",href:t},o),Jn.set(p,t),a.querySelector(f)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(_s(p)))return}c=a.createElement("link"),rn(c,"link",t),Zt(c),a.head.appendChild(c)}}}function yR(t,o,a){Zr.S(t,o,a);var c=ca;if(c&&t){var f=zi(c).hoistableStyles,p=ua(t);o=o||"default";var w=f.get(p);if(!w){var R={loading:0,preload:null};if(w=c.querySelector(ws(p)))R.loading=5;else{t=v({rel:"stylesheet",href:t,"data-precedence":o},a),(a=Jn.get(p))&&ah(t,a);var N=w=c.createElement("link");Zt(N),rn(N,"link",t),N._p=new Promise(function(G,te){N.onload=G,N.onerror=te}),N.addEventListener("load",function(){R.loading|=1}),N.addEventListener("error",function(){R.loading|=2}),R.loading|=4,bc(w,o,c)}w={type:"stylesheet",instance:w,count:1,state:R},f.set(p,w)}}}function bR(t,o){Zr.X(t,o);var a=ca;if(a&&t){var c=zi(a).hoistableScripts,f=da(t),p=c.get(f);p||(p=a.querySelector(_s(f)),p||(t=v({src:t,async:!0},o),(o=Jn.get(f))&&sh(t,o),p=a.createElement("script"),Zt(p),rn(p,"link",t),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},c.set(f,p))}}function xR(t,o){Zr.M(t,o);var a=ca;if(a&&t){var c=zi(a).hoistableScripts,f=da(t),p=c.get(f);p||(p=a.querySelector(_s(f)),p||(t=v({src:t,async:!0,type:"module"},o),(o=Jn.get(f))&&sh(t,o),p=a.createElement("script"),Zt(p),rn(p,"link",t),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},c.set(f,p))}}function R0(t,o,a,c){var f=(f=re.current)?yc(f):null;if(!f)throw Error(i(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(o=ua(a.href),a=zi(f).hoistableStyles,c=a.get(o),c||(c={type:"style",instance:null,count:0,state:null},a.set(o,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=ua(a.href);var p=zi(f).hoistableStyles,w=p.get(t);if(w||(f=f.ownerDocument||f,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(t,w),(p=f.querySelector(ws(t)))&&!p._p&&(w.instance=p,w.state.loading=5),Jn.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Jn.set(t,a),p||SR(f,t,a,w.state))),o&&c===null)throw Error(i(528,""));return w}if(o&&c!==null)throw Error(i(529,""));return null;case"script":return o=a.async,a=a.src,typeof a=="string"&&o&&typeof o!="function"&&typeof o!="symbol"?(o=da(a),a=zi(f).hoistableScripts,c=a.get(o),c||(c={type:"script",instance:null,count:0,state:null},a.set(o,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,t))}}function ua(t){return'href="'+Bn(t)+'"'}function ws(t){return'link[rel="stylesheet"]['+t+"]"}function T0(t){return v({},t,{"data-precedence":t.precedence,precedence:null})}function SR(t,o,a,c){t.querySelector('link[rel="preload"][as="style"]['+o+"]")?c.loading=1:(o=t.createElement("link"),c.preload=o,o.addEventListener("load",function(){return c.loading|=1}),o.addEventListener("error",function(){return c.loading|=2}),rn(o,"link",a),Zt(o),t.head.appendChild(o))}function da(t){return'[src="'+Bn(t)+'"]'}function _s(t){return"script[async]"+t}function O0(t,o,a){if(o.count++,o.instance===null)switch(o.type){case"style":var c=t.querySelector('style[data-href~="'+Bn(a.href)+'"]');if(c)return o.instance=c,Zt(c),c;var f=v({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return c=(t.ownerDocument||t).createElement("style"),Zt(c),rn(c,"style",f),bc(c,a.precedence,t),o.instance=c;case"stylesheet":f=ua(a.href);var p=t.querySelector(ws(f));if(p)return o.state.loading|=4,o.instance=p,Zt(p),p;c=T0(a),(f=Jn.get(f))&&ah(c,f),p=(t.ownerDocument||t).createElement("link"),Zt(p);var w=p;return w._p=new Promise(function(R,N){w.onload=R,w.onerror=N}),rn(p,"link",c),o.state.loading|=4,bc(p,a.precedence,t),o.instance=p;case"script":return p=da(a.src),(f=t.querySelector(_s(p)))?(o.instance=f,Zt(f),f):(c=a,(f=Jn.get(p))&&(c=v({},a),sh(c,f)),t=t.ownerDocument||t,f=t.createElement("script"),Zt(f),rn(f,"link",c),t.head.appendChild(f),o.instance=f);case"void":return null;default:throw Error(i(443,o.type))}else o.type==="stylesheet"&&(o.state.loading&4)===0&&(c=o.instance,o.state.loading|=4,bc(c,a.precedence,t));return o.instance}function bc(t,o,a){for(var c=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=c.length?c[c.length-1]:null,p=f,w=0;w title"):null)}function wR(t,o,a){if(a===1||o.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof o.precedence!="string"||typeof o.href!="string"||o.href==="")break;return!0;case"link":if(typeof o.rel!="string"||typeof o.href!="string"||o.href===""||o.onLoad||o.onError)break;return o.rel==="stylesheet"?(t=o.disabled,typeof o.precedence=="string"&&t==null):!0;case"script":if(o.async&&typeof o.async!="function"&&typeof o.async!="symbol"&&!o.onLoad&&!o.onError&&o.src&&typeof o.src=="string")return!0}return!1}function j0(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function _R(t,o,a,c){if(a.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var f=ua(c.href),p=o.querySelector(ws(f));if(p){o=p._p,o!==null&&typeof o=="object"&&typeof o.then=="function"&&(t.count++,t=Sc.bind(t),o.then(t,t)),a.state.loading|=4,a.instance=p,Zt(p);return}p=o.ownerDocument||o,c=T0(c),(f=Jn.get(f))&&ah(c,f),p=p.createElement("link"),Zt(p);var w=p;w._p=new Promise(function(R,N){w.onload=R,w.onerror=N}),rn(p,"link",c),a.instance=p}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(a,o),(o=a.state.preload)&&(a.state.loading&3)===0&&(t.count++,a=Sc.bind(t),o.addEventListener("load",a),o.addEventListener("error",a))}}var lh=0;function CR(t,o){return t.stylesheets&&t.count===0&&_c(t,t.stylesheets),0lh?50:800)+o);return t.unsuspend=a,function(){t.unsuspend=null,clearTimeout(c),clearTimeout(f)}}:null}function Sc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)_c(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var wc=null;function _c(t,o){t.stylesheets=null,t.unsuspend!==null&&(t.count++,wc=new Map,o.forEach(ER,t),wc=null,Sc.call(t))}function ER(t,o){if(!(o.state.loading&4)){var a=wc.get(t);if(a)var c=a.get(null);else{a=new Map,wc.set(t,a);for(var f=t.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),vh.exports=PR(),vh.exports}var HR=UR(),al=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},BR=class extends al{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},Hm=new BR,qR={setTimeout:(e,n)=>setTimeout(e,n),clearTimeout:e=>clearTimeout(e),setInterval:(e,n)=>setInterval(e,n),clearInterval:e=>clearInterval(e)},GR=class{#e=qR;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,n){return this.#e.setTimeout(e,n)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,n){return this.#e.setInterval(e,n)}clearInterval(e){this.#e.clearInterval(e)}},fi=new GR;function ZR(e){setTimeout(e,0)}var KR=typeof window>"u"||"Deno"in globalThis;function Mn(){}function YR(e,n){return typeof e=="function"?e(n):e}function rm(e){return typeof e=="number"&&e>=0&&e!==1/0}function Jx(e,n){return Math.max(e+(n||0)-Date.now(),0)}function jo(e,n){return typeof e=="function"?e(n):e}function Vn(e,n){return typeof e=="function"?e(n):e}function tb(e,n){const{type:r="all",exact:i,fetchStatus:s,predicate:l,queryKey:u,stale:d}=e;if(u){if(i){if(n.queryHash!==Bm(u,n.options))return!1}else if(!Bs(n.queryKey,u))return!1}if(r!=="all"){const m=n.isActive();if(r==="active"&&!m||r==="inactive"&&m)return!1}return!(typeof d=="boolean"&&n.isStale()!==d||s&&s!==n.state.fetchStatus||l&&!l(n))}function nb(e,n){const{exact:r,status:i,predicate:s,mutationKey:l}=e;if(l){if(!n.options.mutationKey)return!1;if(r){if(Hs(n.options.mutationKey)!==Hs(l))return!1}else if(!Bs(n.options.mutationKey,l))return!1}return!(i&&n.state.status!==i||s&&!s(n))}function Bm(e,n){return(n?.queryKeyHashFn||Hs)(e)}function Hs(e){return JSON.stringify(e,(n,r)=>im(r)?Object.keys(r).sort().reduce((i,s)=>(i[s]=r[s],i),{}):r)}function Bs(e,n){return e===n?!0:typeof e!=typeof n?!1:e&&n&&typeof e=="object"&&typeof n=="object"?Object.keys(n).every(r=>Bs(e[r],n[r])):!1}var QR=Object.prototype.hasOwnProperty;function Wx(e,n,r=0){if(e===n)return e;if(r>500)return n;const i=rb(e)&&rb(n);if(!i&&!(im(e)&&im(n)))return n;const l=(i?e:Object.keys(e)).length,u=i?n:Object.keys(n),d=u.length,m=i?new Array(d):{};let h=0;for(let y=0;y{fi.setTimeout(n,e)})}function am(e,n,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,n):r.structuralSharing!==!1?Wx(e,n):n}function JR(e,n,r=0){const i=[...e,n];return r&&i.length>r?i.slice(1):i}function WR(e,n,r=0){const i=[n,...e];return r&&i.length>r?i.slice(0,-1):i}var qm=Symbol();function eS(e,n){return!e.queryFn&&n?.initialPromise?()=>n.initialPromise:!e.queryFn||e.queryFn===qm?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function tS(e,n){return typeof e=="function"?e(...n):!!e}function e2(e,n,r){let i=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??=n(),i||(i=!0,s.aborted?r():s.addEventListener("abort",r,{once:!0})),s)}),e}var qs=(()=>{let e=()=>KR;return{isServer(){return e()},setIsServer(n){e=n}}})();function sm(){let e,n;const r=new Promise((s,l)=>{e=s,n=l});r.status="pending",r.catch(()=>{});function i(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{i({status:"fulfilled",value:s}),e(s)},r.reject=s=>{i({status:"rejected",reason:s}),n(s)},r}var t2=ZR;function n2(){let e=[],n=0,r=d=>{d()},i=d=>{d()},s=t2;const l=d=>{n?e.push(d):s(()=>{r(d)})},u=()=>{const d=e;e=[],d.length&&s(()=>{i(()=>{d.forEach(m=>{r(m)})})})};return{batch:d=>{let m;n++;try{m=d()}finally{n--,n||u()}return m},batchCalls:d=>(...m)=>{l(()=>{d(...m)})},schedule:l,setNotifyFunction:d=>{r=d},setBatchNotifyFunction:d=>{i=d},setScheduler:d=>{s=d}}}var sn=n2(),r2=class extends al{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(r=>{r(e)}))}isOnline(){return this.#e}},ru=new r2;function o2(e){return Math.min(1e3*2**e,3e4)}function nS(e){return(e??"online")==="online"?ru.isOnline():!0}var lm=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function rS(e){let n=!1,r=0,i;const s=sm(),l=()=>s.status!=="pending",u=C=>{if(!l()){const E=new lm(C);b(E),e.onCancel?.(E)}},d=()=>{n=!0},m=()=>{n=!1},h=()=>Hm.isFocused()&&(e.networkMode==="always"||ru.isOnline())&&e.canRun(),y=()=>nS(e.networkMode)&&e.canRun(),v=C=>{l()||(i?.(),s.resolve(C))},b=C=>{l()||(i?.(),s.reject(C))},S=()=>new Promise(C=>{i=E=>{(l()||h())&&C(E)},e.onPause?.()}).then(()=>{i=void 0,l()||e.onContinue?.()}),_=()=>{if(l())return;let C;const E=r===0?e.initialPromise:void 0;try{C=E??e.fn()}catch(T){C=Promise.reject(T)}Promise.resolve(C).then(v).catch(T=>{if(l())return;const O=e.retry??(qs.isServer()?0:3),M=e.retryDelay??o2,k=typeof M=="function"?M(r,T):M,L=O===!0||typeof O=="number"&&rh()?void 0:S()).then(()=>{n?b(T):_()})})};return{promise:s,status:()=>s.status,cancel:u,continue:()=>(i?.(),s),cancelRetry:d,continueRetry:m,canStart:y,start:()=>(y()?_():S().then(_),s)}}var oS=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),rm(this.gcTime)&&(this.#e=fi.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(qs.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(fi.clearTimeout(this.#e),this.#e=void 0)}};function i2(e){return{onFetch:(n,r)=>{const i=n.options,s=n.fetchOptions?.meta?.fetchMore?.direction,l=n.state.data?.pages||[],u=n.state.data?.pageParams||[];let d={pages:[],pageParams:[]},m=0;const h=async()=>{let y=!1;const v=_=>{e2(_,()=>n.signal,()=>y=!0)},b=eS(n.options,n.fetchOptions),S=async(_,C,E)=>{if(y)return Promise.reject(n.signal.reason);if(C==null&&_.pages.length)return Promise.resolve(_);const O=(()=>{const q={client:n.client,queryKey:n.queryKey,pageParam:C,direction:E?"backward":"forward",meta:n.options.meta};return v(q),q})(),M=await b(O),{maxPages:k}=n.options,L=E?WR:JR;return{pages:L(_.pages,M,k),pageParams:L(_.pageParams,C,k)}};if(s&&l.length){const _=s==="backward",C=_?a2:ib,E={pages:l,pageParams:u},T=C(i,E);d=await S(E,T,_)}else{const _=e??l.length;do{const C=m===0?u[0]??i.initialPageParam:ib(i,d);if(m>0&&C==null)break;d=await S(d,C),m++}while(m<_)}return d};n.options.persister?n.fetchFn=()=>n.options.persister?.(h,{client:n.client,queryKey:n.queryKey,meta:n.options.meta,signal:n.signal},r):n.fetchFn=h}}}function ib(e,{pages:n,pageParams:r}){const i=n.length-1;return n.length>0?e.getNextPageParam(n[i],n,r[i],r):void 0}function a2(e,{pages:n,pageParams:r}){return n.length>0?e.getPreviousPageParam?.(n[0],n,r[0],r):void 0}var s2=class extends oS{#e;#t;#n;#r;#i;#o;#s;#a;constructor(e){super(),this.#a=!1,this.#s=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=sb(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#o?.promise}setOptions(e){if(this.options={...this.#s,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=sb(this.options);n.data!==void 0&&(this.setState(ab(n.data,n.dataUpdatedAt)),this.#t=n)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,n){const r=am(this.state.data,e,this.options);return this.#l({data:r,type:"success",dataUpdatedAt:n?.updatedAt,manual:n?.manual}),r}setState(e){this.#l({type:"setState",state:e})}cancel(e){const n=this.#o?.promise;return this.#o?.cancel(e),n?n.then(Mn).catch(Mn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Vn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===qm||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>jo(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Jx(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(n=>n.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#o?.continue()}onOnline(){this.observers.find(n=>n.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#o?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(this.#o&&(this.#a||this.#u()?this.#o.cancel({revert:!0}):this.#o.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#u(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#l({type:"invalidate"})}async fetch(e,n){if(this.state.fetchStatus!=="idle"&&this.#o?.status()!=="rejected"){if(this.state.data!==void 0&&n?.cancelRefetch)this.cancel({silent:!0});else if(this.#o)return this.#o.continueRetry(),this.#o.promise}if(e&&this.setOptions(e),!this.options.queryFn){const m=this.observers.find(h=>h.options.queryFn);m&&this.setOptions(m.options)}const r=new AbortController,i=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(this.#a=!0,r.signal)})},s=()=>{const m=eS(this.options,n),y=(()=>{const v={client:this.#i,queryKey:this.queryKey,meta:this.meta};return i(v),v})();return this.#a=!1,this.options.persister?this.options.persister(m,y,this):m(y)},u=(()=>{const m={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:s};return i(m),m})();(this.#e==="infinite"?i2(this.options.pages):this.options.behavior)?.onFetch(u,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==u.fetchOptions?.meta)&&this.#l({type:"fetch",meta:u.fetchOptions?.meta}),this.#o=rS({initialPromise:n?.initialPromise,fn:u.fetchFn,onCancel:m=>{m instanceof lm&&m.revert&&this.setState({...this.#n,fetchStatus:"idle"}),r.abort()},onFail:(m,h)=>{this.#l({type:"failed",failureCount:m,error:h})},onPause:()=>{this.#l({type:"pause"})},onContinue:()=>{this.#l({type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0});try{const m=await this.#o.start();if(m===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(m),this.#r.config.onSuccess?.(m,this),this.#r.config.onSettled?.(m,this.state.error,this),m}catch(m){if(m instanceof lm){if(m.silent)return this.#o.promise;if(m.revert){if(this.state.data===void 0)throw m;return this.state.data}}throw this.#l({type:"error",error:m}),this.#r.config.onError?.(m,this),this.#r.config.onSettled?.(this.state.data,m,this),m}finally{this.scheduleGc()}}#l(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...iS(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...ab(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?i:void 0,i;case"error":const s=e.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),sn.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function iS(e,n){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:nS(n.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ab(e,n){return{data:e,dataUpdatedAt:n??Date.now(),error:null,isInvalidated:!1,status:"success"}}function sb(e){const n=typeof e.initialData=="function"?e.initialData():e.initialData,r=n!==void 0,i=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:n,dataUpdateCount:0,dataUpdatedAt:r?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var l2=class extends al{constructor(e,n){super(),this.options=n,this.#e=e,this.#a=null,this.#s=sm(),this.bindMethods(),this.setOptions(n)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#o;#s;#a;#u;#l;#m;#d;#f;#c;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),lb(this.#t,this.options)?this.#h():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return cm(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return cm(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#S(),this.#t.removeObserver(this)}setOptions(e){const n=this.options,r=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Vn(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#w(),this.#t.setOptions(this.options),n._defaulted&&!om(this.options,n)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const i=this.hasListeners();i&&cb(this.#t,r,this.options,n)&&this.#h(),this.updateResult(),i&&(this.#t!==r||Vn(this.options.enabled,this.#t)!==Vn(n.enabled,this.#t)||jo(this.options.staleTime,this.#t)!==jo(n.staleTime,this.#t))&&this.#g();const s=this.#v();i&&(this.#t!==r||Vn(this.options.enabled,this.#t)!==Vn(n.enabled,this.#t)||s!==this.#c)&&this.#y(s)}getOptimisticResult(e){const n=this.#e.getQueryCache().build(this.#e,e),r=this.createResult(n,e);return u2(this,r)&&(this.#r=r,this.#o=this.options,this.#i=this.#t.state),r}getCurrentResult(){return this.#r}trackResult(e,n){return new Proxy(e,{get:(r,i)=>(this.trackProp(i),n?.(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#s.status==="pending"&&this.#s.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=this.#e.defaultQueryOptions(e),r=this.#e.getQueryCache().build(this.#e,n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#w();let n=this.#t.fetch(this.options,e);return e?.throwOnError||(n=n.catch(Mn)),n}#g(){this.#x();const e=jo(this.options.staleTime,this.#t);if(qs.isServer()||this.#r.isStale||!rm(e))return;const r=Jx(this.#r.dataUpdatedAt,e)+1;this.#d=fi.setTimeout(()=>{this.#r.isStale||this.updateResult()},r)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(e){this.#S(),this.#c=e,!(qs.isServer()||Vn(this.options.enabled,this.#t)===!1||!rm(this.#c)||this.#c===0)&&(this.#f=fi.setInterval(()=>{(this.options.refetchIntervalInBackground||Hm.isFocused())&&this.#h()},this.#c))}#b(){this.#g(),this.#y(this.#v())}#x(){this.#d!==void 0&&(fi.clearTimeout(this.#d),this.#d=void 0)}#S(){this.#f!==void 0&&(fi.clearInterval(this.#f),this.#f=void 0)}createResult(e,n){const r=this.#t,i=this.options,s=this.#r,l=this.#i,u=this.#o,m=e!==r?e.state:this.#n,{state:h}=e;let y={...h},v=!1,b;if(n._optimisticResults){const $=this.hasListeners(),he=!$&&lb(e,n),ve=$&&cb(e,r,n,i);(he||ve)&&(y={...y,...iS(h.data,e.options)}),n._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:S,errorUpdatedAt:_,status:C}=y;b=y.data;let E=!1;if(n.placeholderData!==void 0&&b===void 0&&C==="pending"){let $;s?.isPlaceholderData&&n.placeholderData===u?.placeholderData?($=s.data,E=!0):$=typeof n.placeholderData=="function"?n.placeholderData(this.#m?.state.data,this.#m):n.placeholderData,$!==void 0&&(C="success",b=am(s?.data,$,n),v=!0)}if(n.select&&b!==void 0&&!E)if(s&&b===l?.data&&n.select===this.#u)b=this.#l;else try{this.#u=n.select,b=n.select(b),b=am(s?.data,b,n),this.#l=b,this.#a=null}catch($){this.#a=$}this.#a&&(S=this.#a,b=this.#l,_=Date.now(),C="error");const T=y.fetchStatus==="fetching",O=C==="pending",M=C==="error",k=O&&T,L=b!==void 0,H={status:C,fetchStatus:y.fetchStatus,isPending:O,isSuccess:C==="success",isError:M,isInitialLoading:k,isLoading:k,data:b,dataUpdatedAt:y.dataUpdatedAt,error:S,errorUpdatedAt:_,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:y.dataUpdateCount>m.dataUpdateCount||y.errorUpdateCount>m.errorUpdateCount,isFetching:T,isRefetching:T&&!O,isLoadingError:M&&!L,isPaused:y.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:M&&L,isStale:Gm(e,n),refetch:this.refetch,promise:this.#s,isEnabled:Vn(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const $=H.data!==void 0,he=H.status==="error"&&!$,ve=ae=>{he?ae.reject(H.error):$&&ae.resolve(H.data)},de=()=>{const ae=this.#s=H.promise=sm();ve(ae)},le=this.#s;switch(le.status){case"pending":e.queryHash===r.queryHash&&ve(le);break;case"fulfilled":(he||H.data!==le.value)&&de();break;case"rejected":(!he||H.error!==le.reason)&&de();break}}return H}updateResult(){const e=this.#r,n=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#o=this.options,this.#i.data!==void 0&&(this.#m=this.#t),om(n,e))return;this.#r=n;const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!this.#p.size)return!0;const l=new Set(s??this.#p);return this.options.throwOnError&&l.add("error"),Object.keys(this.#r).some(u=>{const d=u;return this.#r[d]!==e[d]&&l.has(d)})};this.#_({listeners:r()})}#w(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const n=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(n?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#_(e){sn.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function c2(e,n){return Vn(n.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Vn(n.retryOnMount,e)===!1)}function lb(e,n){return c2(e,n)||e.state.data!==void 0&&cm(e,n,n.refetchOnMount)}function cm(e,n,r){if(Vn(n.enabled,e)!==!1&&jo(n.staleTime,e)!=="static"){const i=typeof r=="function"?r(e):r;return i==="always"||i!==!1&&Gm(e,n)}return!1}function cb(e,n,r,i){return(e!==n||Vn(i.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Gm(e,r)}function Gm(e,n){return Vn(n.enabled,e)!==!1&&e.isStaleByTime(jo(n.staleTime,e))}function u2(e,n){return!om(e.getCurrentResult(),n)}var d2=class extends oS{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||f2(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(n=>n!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){const n=()=>{this.#i({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=rS({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(l,u)=>{this.#i({type:"failed",failureCount:l,error:u})},onPause:()=>{this.#i({type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const i=this.state.status==="pending",s=!this.#r.canStart();try{if(i)n();else{this.#i({type:"pending",variables:e,isPaused:s}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,r);const u=await this.options.onMutate?.(e,r);u!==this.state.context&&this.#i({type:"pending",context:u,variables:e,isPaused:s})}const l=await this.#r.start();return await this.#n.config.onSuccess?.(l,e,this.state.context,this,r),await this.options.onSuccess?.(l,e,this.state.context,r),await this.#n.config.onSettled?.(l,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(l,null,e,this.state.context,r),this.#i({type:"success",data:l}),l}catch(l){try{await this.#n.config.onError?.(l,e,this.state.context,this,r)}catch(u){Promise.reject(u)}try{await this.options.onError?.(l,e,this.state.context,r)}catch(u){Promise.reject(u)}try{await this.#n.config.onSettled?.(void 0,l,this.state.variables,this.state.context,this,r)}catch(u){Promise.reject(u)}try{await this.options.onSettled?.(void 0,l,e,this.state.context,r)}catch(u){Promise.reject(u)}throw this.#i({type:"error",error:l}),l}finally{this.#n.runNext(this)}}#i(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),sn.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function f2(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var h2=class extends al{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,n,r){const i=new d2({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){this.#e.add(e);const n=jc(e);if(typeof n=="string"){const r=this.#t.get(n);r?r.push(e):this.#t.set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const n=jc(e);if(typeof n=="string"){const r=this.#t.get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&this.#t.delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=jc(e);if(typeof n=="string"){const i=this.#t.get(n)?.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){const n=jc(e);return typeof n=="string"?this.#t.get(n)?.find(i=>i!==e&&i.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){sn.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const n={exact:!0,...e};return this.getAll().find(r=>nb(n,r))}findAll(e={}){return this.getAll().filter(n=>nb(e,n))}notify(e){sn.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return sn.batch(()=>Promise.all(e.map(n=>n.continue().catch(Mn))))}};function jc(e){return e.options.scope?.id}var m2=class extends al{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,n,r){const i=n.queryKey,s=n.queryHash??Bm(i,n);let l=this.get(s);return l||(l=new s2({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(l)),l}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=this.#e.get(e.queryHash);n&&(e.destroy(),n===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){sn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>tb(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>tb(e,r)):n}notify(e){sn.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){sn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){sn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},p2=class{#e;#t;#n;#r;#i;#o;#s;#a;constructor(e={}){this.#e=e.queryCache||new m2,this.#t=e.mutationCache||new h2,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#o=0}mount(){this.#o++,this.#o===1&&(this.#s=Hm.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=ru.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#o--,this.#o===0&&(this.#s?.(),this.#s=void 0,this.#a?.(),this.#a=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const n=this.defaultQueryOptions({queryKey:e});return this.#e.get(n.queryHash)?.state.data}ensureQueryData(e){const n=this.defaultQueryOptions(e),r=this.#e.build(this,n),i=r.state.data;return i===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(jo(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(i))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:n,state:r})=>{const i=r.data;return[n,i]})}setQueryData(e,n,r){const i=this.defaultQueryOptions({queryKey:e}),l=this.#e.get(i.queryHash)?.state.data,u=YR(n,l);if(u!==void 0)return this.#e.build(this,i).setData(u,{...r,manual:!0})}setQueriesData(e,n,r){return sn.batch(()=>this.#e.findAll(e).map(({queryKey:i})=>[i,this.setQueryData(i,n,r)]))}getQueryState(e){const n=this.defaultQueryOptions({queryKey:e});return this.#e.get(n.queryHash)?.state}removeQueries(e){const n=this.#e;sn.batch(()=>{n.findAll(e).forEach(r=>{n.remove(r)})})}resetQueries(e,n){const r=this.#e;return sn.batch(()=>(r.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...e},n)))}cancelQueries(e,n={}){const r={revert:!0,...n},i=sn.batch(()=>this.#e.findAll(e).map(s=>s.cancel(r)));return Promise.all(i).then(Mn).catch(Mn)}invalidateQueries(e,n={}){return sn.batch(()=>(this.#e.findAll(e).forEach(r=>{r.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},n)))}refetchQueries(e,n={}){const r={...n,cancelRefetch:n.cancelRefetch??!0},i=sn.batch(()=>this.#e.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let l=s.fetch(void 0,r);return r.throwOnError||(l=l.catch(Mn)),s.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(i).then(Mn)}fetchQuery(e){const n=this.defaultQueryOptions(e);n.retry===void 0&&(n.retry=!1);const r=this.#e.build(this,n);return r.isStaleByTime(jo(n.staleTime,r))?r.fetch(n):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Mn).catch(Mn)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Mn).catch(Mn)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return ru.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,n){this.#r.set(Hs(e),{queryKey:e,defaultOptions:n})}getQueryDefaults(e){const n=[...this.#r.values()],r={};return n.forEach(i=>{Bs(e,i.queryKey)&&Object.assign(r,i.defaultOptions)}),r}setMutationDefaults(e,n){this.#i.set(Hs(e),{mutationKey:e,defaultOptions:n})}getMutationDefaults(e){const n=[...this.#i.values()],r={};return n.forEach(i=>{Bs(e,i.mutationKey)&&Object.assign(r,i.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const n={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return n.queryHash||(n.queryHash=Bm(n.queryKey,n)),n.refetchOnReconnect===void 0&&(n.refetchOnReconnect=n.networkMode!=="always"),n.throwOnError===void 0&&(n.throwOnError=!!n.suspense),!n.networkMode&&n.persister&&(n.networkMode="offlineFirst"),n.queryFn===qm&&(n.enabled=!1),n}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},aS=x.createContext(void 0),sl=e=>{const n=x.useContext(aS);if(!n)throw new Error("No QueryClient set, use QueryClientProvider to set one");return n},g2=({client:e,children:n})=>(x.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),g.jsx(aS.Provider,{value:e,children:n})),sS=x.createContext(!1),v2=()=>x.useContext(sS);sS.Provider;function y2(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var b2=x.createContext(y2()),x2=()=>x.useContext(b2),S2=(e,n,r)=>{const i=r?.state.error&&typeof e.throwOnError=="function"?tS(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||i)&&(n.isReset()||(e.retryOnMount=!1))},w2=e=>{x.useEffect(()=>{e.clearReset()},[e])},_2=({result:e,errorResetBoundary:n,throwOnError:r,query:i,suspense:s})=>e.isError&&!n.isReset()&&!e.isFetching&&i&&(s&&e.data===void 0||tS(r,[e.error,i])),C2=e=>{if(e.suspense){const r=s=>s==="static"?s:Math.max(s??1e3,1e3),i=e.staleTime;e.staleTime=typeof i=="function"?(...s)=>r(i(...s)):r(i),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},E2=(e,n)=>e.isLoading&&e.isFetching&&!n,R2=(e,n)=>e?.suspense&&n.isPending,ub=(e,n,r)=>n.fetchOptimistic(e).catch(()=>{r.clearReset()});function T2(e,n,r){const i=v2(),s=x2(),l=sl(),u=l.defaultQueryOptions(e);l.getDefaultOptions().queries?._experimental_beforeQuery?.(u);const d=l.getQueryCache().get(u.queryHash),m=e.subscribed!==!1;u._optimisticResults=i?"isRestoring":m?"optimistic":void 0,C2(u),S2(u,s,d),w2(s);const h=!l.getQueryCache().get(u.queryHash),[y]=x.useState(()=>new n(l,u)),v=y.getOptimisticResult(u),b=!i&&m;if(x.useSyncExternalStore(x.useCallback(S=>{const _=b?y.subscribe(sn.batchCalls(S)):Mn;return y.updateResult(),_},[y,b]),()=>y.getCurrentResult(),()=>y.getCurrentResult()),x.useEffect(()=>{y.setOptions(u)},[u,y]),R2(u,v))throw ub(u,y,s);if(_2({result:v,errorResetBoundary:s,throwOnError:u.throwOnError,query:d,suspense:u.suspense}))throw v.error;return l.getDefaultOptions().queries?._experimental_afterQuery?.(u,v),u.experimental_prefetchInRender&&!qs.isServer()&&E2(v,i)&&(h?ub(u,y,s):d?.promise)?.catch(Mn).finally(()=>{y.updateResult()}),u.notifyOnChangeProps?v:y.trackResult(v)}function jn(e,n){return T2(e,l2)}function lS(){throw location.href="/auth/login?next="+encodeURIComponent(location.pathname+location.search),new Error("signing in…")}function O2(e,n){const r=n.trim();switch(e){case 403:return r.includes("seat")?"This plan is out of seats. Upgrade to add more people.":r.includes("owner")?"Only owners can do that.":"You don't have access to that.";case 409:return r?r[0].toUpperCase()+r.slice(1):"That is managed outside this hub.";case 404:return"That is gone — it may have been removed already.";case 429:return"Too many requests. Give it a moment.";default:return e>=500?"The server had a problem. Try again.":r?r[0].toUpperCase()+r.slice(1):"Something went wrong."}}async function Zm(e){throw new Error(O2(e.status,await e.text()))}async function Fn(e){const n=await fetch(e);return n.status===401&&lS(),n.ok||await Zm(n),n.json()}async function zo(e,n,r){const i={method:e};r!==void 0&&(i.headers={"Content-Type":"application/json"},i.body=JSON.stringify(r));const s=await fetch(n,i);return s.ok||await Zm(s),s.status===204?{}:s.json()}async function Aa(e,n){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n||{})});return r.status===401&&lS(),r.ok||await Zm(r),r.json()}function M2(){return jn({queryKey:["config"],queryFn:async()=>{const e=await Fn("/api/config");return e.auth.enabled&&!e.me&&(location.href="/auth/login?next="+encodeURIComponent(location.pathname+location.search),await new Promise(()=>{})),e},staleTime:1/0})}var xi=Xx();const A2=Qx(xi);function db(e,n){if(typeof e=="function")return e(n);e!=null&&(e.current=n)}function ja(...e){return n=>{let r=!1;const i=e.map(s=>{const l=db(s,n);return!r&&typeof l=="function"&&(r=!0),l});if(r)return()=>{for(let s=0;s{let{children:s,...l}=r,u=null,d=!1;const m=[];fb(s)&&typeof zc=="function"&&(s=zc(s._payload)),x.Children.forEach(s,b=>{if(L2(b)){d=!0;const S=b;let _="child"in S.props?S.props.child:S.props.children;fb(_)&&typeof zc=="function"&&(_=zc(_._payload)),u=N2(S,_),m.push(u?.props?.children)}else m.push(b)}),u?u=x.cloneElement(u,void 0,m):!d&&x.Children.count(s)===1&&x.isValidElement(s)&&(u=s);const h=u?k2(u):void 0,y=it(i,h);if(!u){if(s||s===0)throw new Error(d?F2(e):V2(e));return s}const v=D2(l,u.props??{});return u.type!==x.Fragment&&(v.ref=i?y:h),x.cloneElement(u,v)});return n.displayName=`${e}.Slot`,n}var j2=hi("Slot"),cS=Symbol.for("radix.slottable");function z2(e){const n=r=>"child"in r?r.children(r.child):r.children;return n.displayName=`${e}.Slottable`,n.__radixId=cS,n}var N2=(e,n)=>{if("child"in e.props){const r=e.props.child;return x.isValidElement(r)?x.cloneElement(r,void 0,e.props.children(r.props.children)):null}return x.isValidElement(n)?n:null};function D2(e,n){const r={...n};for(const i in n){const s=e[i],l=n[i];/^on[A-Z]/.test(i)?s&&l?r[i]=(...d)=>{const m=l(...d);return s(...d),m}:s&&(r[i]=s):i==="style"?r[i]={...s,...l}:i==="className"&&(r[i]=[s,l].filter(Boolean).join(" "))}return{...e,...r}}function k2(e){let n=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?e.ref:(n=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function L2(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===cS}var I2=Symbol.for("react.lazy");function fb(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===I2&&"_payload"in e&&$2(e._payload)}function $2(e){return typeof e=="object"&&e!==null&&"then"in e}var V2=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,F2=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,zc=_u[" use ".trim().toString()],P2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$e=P2.reduce((e,n)=>{const r=hi(`Primitive.${n}`),i=x.forwardRef((s,l)=>{const{asChild:u,...d}=s,m=u?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(m,{...d,ref:l})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{});function uS(e,n){e&&xi.flushSync(()=>e.dispatchEvent(n))}var dS=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),U2="VisuallyHidden",fS=x.forwardRef((e,n)=>g.jsx($e.span,{...e,ref:n,style:{...dS,...e.style}}));fS.displayName=U2;var H2=fS;function $o(e,n=[]){let r=[];function i(l,u){const d=x.createContext(u);d.displayName=l+"Context";const m=r.length;r=[...r,u];const h=v=>{const{scope:b,children:S,..._}=v,C=b?.[e]?.[m]||d,E=x.useMemo(()=>_,Object.values(_));return g.jsx(C.Provider,{value:E,children:S})};h.displayName=l+"Provider";function y(v,b,S={}){const{optional:_=!1}=S,C=b?.[e]?.[m]||d,E=x.useContext(C);if(E)return E;if(u!==void 0)return u;if(!_)throw new Error(`\`${v}\` must be used within \`${l}\``)}return[h,y]}const s=()=>{const l=r.map(u=>x.createContext(u));return function(d){const m=d?.[e]||l;return x.useMemo(()=>({[`__scope${e}`]:{...d,[e]:m}}),[d,m])}};return s.scopeName=e,[i,B2(s,...n)]}function B2(...e){const n=e[0];if(e.length===1)return n;const r=()=>{const i=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(l){const u=i.reduce((d,{useScope:m,scopeName:h})=>{const v=m(l)[`__scope${h}`];return{...d,...v}},{});return x.useMemo(()=>({[`__scope${n.scopeName}`]:u}),[u])}};return r.scopeName=n.scopeName,r}function Km(e){const n=e+"CollectionProvider",[r,i]=$o(n),[s,l]=r(n,{collectionRef:{current:null},itemMap:new Map}),u=C=>{const{scope:E,children:T}=C,O=x.useRef(null),M=x.useRef(new Map).current;return g.jsx(s,{scope:E,itemMap:M,collectionRef:O,children:T})};u.displayName=n;const d=e+"CollectionSlot",m=hi(d),h=x.forwardRef((C,E)=>{const{scope:T,children:O}=C,M=l(d,T),k=it(E,M.collectionRef);return g.jsx(m,{ref:k,children:O})});h.displayName=d;const y=e+"CollectionItemSlot",v="data-radix-collection-item",b=hi(y),S=x.forwardRef((C,E)=>{const{scope:T,children:O,...M}=C,k=x.useRef(null),L=it(E,k),q=l(y,T);return x.useEffect(()=>(q.itemMap.set(k,{ref:k,...M}),()=>{q.itemMap.delete(k)})),g.jsx(b,{[v]:"",ref:L,children:O})});S.displayName=y;function _(C){const E=l(e+"CollectionConsumer",C);return x.useCallback(()=>{const O=E.collectionRef.current;if(!O)return[];const M=Array.from(O.querySelectorAll(`[${v}]`));return Array.from(E.itemMap.values()).sort((q,H)=>M.indexOf(q.ref.current)-M.indexOf(H.ref.current))},[E.collectionRef,E.itemMap])}return[{Provider:u,Slot:h,ItemSlot:S},_,i]}function Re(e,n,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e?.(s),r===!1||!s||!s.defaultPrevented)return n?.(s)}}var Qt=globalThis?.document?x.useLayoutEffect:()=>{},q2=_u[" useInsertionEffect ".trim().toString()]||Qt;function za({prop:e,defaultProp:n,onChange:r=()=>{},caller:i}){const[s,l,u]=G2({defaultProp:n,onChange:r}),d=e!==void 0,m=d?e:s;{const y=x.useRef(e!==void 0);x.useEffect(()=>{const v=y.current;v!==d&&console.warn(`${i} is changing from ${v?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),y.current=d},[d,i])}const h=x.useCallback(y=>{if(d){const v=Z2(y)?y(e):y;v!==e&&u.current?.(v)}else l(y)},[d,e,l,u]);return[m,h]}function G2({defaultProp:e,onChange:n}){const[r,i]=x.useState(e),s=x.useRef(r),l=x.useRef(n);return q2(()=>{l.current=n},[n]),x.useEffect(()=>{s.current!==r&&(l.current?.(r),s.current=r)},[r,s]),[r,i,l]}function Z2(e){return typeof e=="function"}function K2(e,n){return x.useReducer((r,i)=>n[r][i]??r,e)}var pr=e=>{const{present:n,children:r}=e,i=Y2(n),s=typeof r=="function"?r({present:i.isPresent}):x.Children.only(r),l=Q2(i.ref,X2(s));return typeof r=="function"||i.isPresent?x.cloneElement(s,{ref:l}):null};pr.displayName="Presence";function Y2(e){const[n,r]=x.useState(),i=x.useRef(null),s=x.useRef(e),l=x.useRef("none"),u=x.useRef(void 0),d=e?"mounted":"unmounted",[m,h]=K2(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{m==="mounted"?(l.current=u.current??As(i.current),u.current=void 0):l.current="none"},[m]),Qt(()=>{const y=i.current,v=s.current;if(v!==e){const S=l.current,_=As(y);e?(u.current=_,h("MOUNT")):_==="none"||y?.display==="none"?h("UNMOUNT"):h(v&&S!==_?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,h]),Qt(()=>{if(n){let y;const v=n.ownerDocument.defaultView??window,b=_=>{const E=As(i.current).includes(CSS.escape(_.animationName));if(_.target===n&&E&&(h("ANIMATION_END"),!s.current)){const T=n.style.animationFillMode;n.style.animationFillMode="forwards",y=v.setTimeout(()=>{n.style.animationFillMode==="forwards"&&(n.style.animationFillMode=T)})}},S=_=>{_.target===n&&(l.current=As(i.current))};return n.addEventListener("animationstart",S),n.addEventListener("animationcancel",b),n.addEventListener("animationend",b),()=>{v.clearTimeout(y),n.removeEventListener("animationstart",S),n.removeEventListener("animationcancel",b),n.removeEventListener("animationend",b)}}else h("ANIMATION_END")},[n,h]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:x.useCallback(y=>{if(y){const v=getComputedStyle(y);i.current=v,u.current=As(v)}else i.current=null;r(y)},[])}}function hb(e,n){if(typeof e=="function")return e(n);e!=null&&(e.current=n)}function Q2(...e){const n=x.useRef(e);return n.current=e,x.useCallback(r=>{const i=n.current;let s=!1;const l=i.map(u=>{const d=hb(u,r);return!s&&typeof d=="function"&&(s=!0),d});if(s)return()=>{for(let u=0;u{}),W2=0;function hn(e){const[n,r]=x.useState(J2());return Qt(()=>{r(i=>i??String(W2++))},[e]),n?`radix-${n}`:""}var eT=x.createContext(void 0);function Ym(e){const n=x.useContext(eT);return e||n||"ltr"}function tr(e){const n=x.useRef(e);return x.useEffect(()=>{n.current=e}),x.useMemo(()=>((...r)=>n.current?.(...r)),[])}var tT="DismissableLayer",um="dismissableLayer.update",nT="dismissableLayer.pointerDownOutside",rT="dismissableLayer.focusOutside",mb,Qm=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),ll=x.forwardRef((e,n)=>{const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,onDismiss:m,...h}=e,y=x.useContext(Qm),[v,b]=x.useState(null),S=v?.ownerDocument??globalThis?.document,[,_]=x.useState({}),C=it(n,b),E=Array.from(y.layers),[T]=[...y.layersWithOutsidePointerEventsDisabled].slice(-1),O=T?E.indexOf(T):-1,M=v?E.indexOf(v):-1,k=y.layersWithOutsidePointerEventsDisabled.size>0,L=M>=O,q=x.useRef(!1),H=lT(de=>{l?.(de),d?.(de),de.defaultPrevented||m?.()},{ownerDocument:S,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:q,dismissableSurfaces:y.dismissableSurfaces,shouldHandlePointerDownOutside:x.useCallback(de=>{if(!(de instanceof Node))return!1;const le=[...y.branches].some(ae=>ae.contains(de));return L&&!le},[y.branches,L])}),$=cT(de=>{if(i&&q.current)return;const le=de.target;[...y.branches].some(me=>me.contains(le))||(u?.(de),d?.(de),de.defaultPrevented||m?.())},S),he=v?M===E.length-1:!1,ve=tr(de=>{de.key==="Escape"&&(s?.(de),!de.defaultPrevented&&m&&(de.preventDefault(),m()))});return x.useEffect(()=>{if(he)return S.addEventListener("keydown",ve,{capture:!0}),()=>S.removeEventListener("keydown",ve,{capture:!0})},[S,he,ve]),x.useEffect(()=>{if(v)return r&&(y.layersWithOutsidePointerEventsDisabled.size===0&&(mb=S.body.style.pointerEvents,S.body.style.pointerEvents="none"),y.layersWithOutsidePointerEventsDisabled.add(v)),y.layers.add(v),pb(),()=>{r&&(y.layersWithOutsidePointerEventsDisabled.delete(v),y.layersWithOutsidePointerEventsDisabled.size===0&&(S.body.style.pointerEvents=mb))}},[v,S,r,y]),x.useEffect(()=>()=>{v&&(y.layers.delete(v),y.layersWithOutsidePointerEventsDisabled.delete(v),pb())},[v,y]),x.useEffect(()=>{const de=()=>_({});return document.addEventListener(um,de),()=>document.removeEventListener(um,de)},[]),g.jsx($e.div,{...h,ref:C,style:{pointerEvents:k?L?"auto":"none":void 0,...e.style},onFocusCapture:Re(e.onFocusCapture,$.onFocusCapture),onBlurCapture:Re(e.onBlurCapture,$.onBlurCapture),onPointerDownCapture:Re(e.onPointerDownCapture,H.onPointerDownCapture)})});ll.displayName=tT;var oT="DismissableLayerBranch",iT=x.forwardRef((e,n)=>{const r=x.useContext(Qm),i=x.useRef(null),s=it(n,i);return x.useEffect(()=>{const l=i.current;if(l)return r.branches.add(l),()=>{r.branches.delete(l)}},[r.branches]),g.jsx($e.div,{...e,ref:s})});iT.displayName=oT;function aT(){const e=x.useContext(Qm),[n,r]=x.useState(null);return x.useEffect(()=>{if(n)return e.dismissableSurfaces.add(n),()=>{e.dismissableSurfaces.delete(n)}},[n,e.dismissableSurfaces]),r}var sT=()=>!0;function lT(e,n){const{ownerDocument:r=globalThis?.document,deferPointerDownOutside:i=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:l,shouldHandlePointerDownOutside:u=sT}=n,d=tr(e),m=x.useRef(!1),h=x.useRef(!1),y=x.useRef(new Map),v=x.useRef(()=>{});return x.useEffect(()=>{function b(){h.current=!1,s.current=!1,y.current.clear()}function S(){return Array.from(y.current.values()).some(Boolean)}function _(M){if(!h.current)return;const k=M.target;k instanceof Node&&[...l].some(q=>q.contains(k))||y.current.set(M.type,!0),M.type==="click"&&window.setTimeout(()=>{h.current&&v.current()},0)}function C(M){h.current&&y.current.set(M.type,!1)}const E=M=>{if(M.target&&!m.current){let k=function(){r.removeEventListener("click",v.current);const q=S();b(),q||hS(nT,d,L,{discrete:!0})};if(!u(M.target)){r.removeEventListener("click",v.current),b(),m.current=!1;return}const L={originalEvent:M};h.current=!0,s.current=i&&M.button===0,y.current.clear(),!i||M.button!==0?k():(r.removeEventListener("click",v.current),v.current=k,r.addEventListener("click",v.current,{once:!0}))}else r.removeEventListener("click",v.current),b();m.current=!1},T=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const M of T)r.addEventListener(M,_,!0),r.addEventListener(M,C);const O=window.setTimeout(()=>{r.addEventListener("pointerdown",E)},0);return()=>{window.clearTimeout(O),r.removeEventListener("pointerdown",E),r.removeEventListener("click",v.current);for(const M of T)r.removeEventListener(M,_,!0),r.removeEventListener(M,C)}},[r,d,i,s,l,u]),{onPointerDownCapture:()=>m.current=!0}}function cT(e,n=globalThis?.document){const r=tr(e),i=x.useRef(!1);return x.useEffect(()=>{const s=l=>{l.target&&!i.current&&hS(rT,r,{originalEvent:l},{discrete:!1})};return n.addEventListener("focusin",s),()=>n.removeEventListener("focusin",s)},[n,r]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function pb(){const e=new CustomEvent(um);document.dispatchEvent(e)}function hS(e,n,r,{discrete:i}){const s=r.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});n&&s.addEventListener(e,n,{once:!0}),i?uS(s,l):s.dispatchEvent(l)}var Sh="focusScope.autoFocusOnMount",wh="focusScope.autoFocusOnUnmount",gb={bubbles:!1,cancelable:!0},uT="FocusScope",Cu=x.forwardRef((e,n)=>{const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:l,...u}=e,[d,m]=x.useState(null),h=tr(s),y=tr(l),v=x.useRef(null),b=it(n,m),S=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(i){let C=function(M){if(S.paused||!d)return;const k=M.target;d.contains(k)?v.current=k:Oo(v.current,{select:!0})},E=function(M){if(S.paused||!d)return;const k=M.relatedTarget;k!==null&&(d.contains(k)||Oo(v.current,{select:!0}))},T=function(M){if(document.activeElement===document.body)for(const L of M)L.removedNodes.length>0&&Oo(d)};document.addEventListener("focusin",C),document.addEventListener("focusout",E);const O=new MutationObserver(T);return d&&O.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",C),document.removeEventListener("focusout",E),O.disconnect()}}},[i,d,S.paused]),x.useEffect(()=>{if(d){yb.add(S);const C=document.activeElement;if(!d.contains(C)){const T=new CustomEvent(Sh,gb);d.addEventListener(Sh,h),d.dispatchEvent(T),T.defaultPrevented||(dT(gT(mS(d)),{select:!0}),document.activeElement===C&&Oo(d))}return()=>{d.removeEventListener(Sh,h),setTimeout(()=>{const T=new CustomEvent(wh,gb);d.addEventListener(wh,y),d.dispatchEvent(T),T.defaultPrevented||Oo(C??document.body,{select:!0}),d.removeEventListener(wh,y),yb.remove(S)},0)}}},[d,h,y,S]);const _=x.useCallback(C=>{if(!r&&!i||S.paused)return;const E=C.key==="Tab"&&!C.altKey&&!C.ctrlKey&&!C.metaKey,T=document.activeElement;if(E&&T){const O=C.currentTarget,[M,k]=fT(O);M&&k?!C.shiftKey&&T===k?(C.preventDefault(),r&&Oo(M,{select:!0})):C.shiftKey&&T===M&&(C.preventDefault(),r&&Oo(k,{select:!0})):T===O&&C.preventDefault()}},[r,i,S.paused]);return g.jsx($e.div,{tabIndex:-1,...u,ref:b,onKeyDown:_})});Cu.displayName=uT;function dT(e,{select:n=!1}={}){const r=document.activeElement;for(const i of e)if(Oo(i,{select:n}),document.activeElement!==r)return}function fT(e){const n=mS(e),r=vb(n,e),i=vb(n.reverse(),e);return[r,i]}function mS(e){const n=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const s=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||s?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)n.push(r.currentNode);return n}function vb(e,n){const r=typeof n.checkVisibility=="function"&&n.checkVisibility({checkVisibilityCSS:!0});for(const i of e)if(!(r?!i.checkVisibility({checkVisibilityCSS:!0}):hT(i,{upTo:n})))return i}function hT(e,{upTo:n}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(n!==void 0&&e===n)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function mT(e){return e instanceof HTMLInputElement&&"select"in e}function Oo(e,{select:n=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&mT(e)&&n&&e.select()}}var yb=pT();function pT(){let e=[];return{add(n){const r=e[0];n!==r&&r?.pause(),e=bb(e,n),e.unshift(n)},remove(n){e=bb(e,n),e[0]?.resume()}}}function bb(e,n){const r=[...e],i=r.indexOf(n);return i!==-1&&r.splice(i,1),r}function gT(e){return e.filter(n=>n.tagName!=="A")}var vT="Portal",cl=x.forwardRef((e,n)=>{const{container:r,...i}=e,[s,l]=x.useState(!1);Qt(()=>l(!0),[]);const u=r||s&&globalThis?.document?.body;return u?xi.createPortal(g.jsx($e.div,{...i,ref:n}),u):null});cl.displayName=vT;var Nc=0,ha=null;function Xm(){x.useEffect(()=>{ha||(ha={start:xb(),end:xb()});const{start:e,end:n}=ha;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==n&&document.body.insertAdjacentElement("beforeend",n),Nc++,()=>{Nc===1&&(ha?.start.remove(),ha?.end.remove(),ha=null),Nc=Math.max(0,Nc-1)}},[])}function xb(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Er=function(){return Er=Object.assign||function(n){for(var r,i=1,s=arguments.length;i"u")return DT;var n=kT(e),r=document.documentElement.clientWidth,i=window.innerWidth;return{left:n[0],top:n[1],right:n[2],gap:Math.max(0,i-r+n[2]-n[0])}},IT=yS(),Ea="data-scroll-locked",$T=function(e,n,r,i){var s=e.left,l=e.top,u=e.right,d=e.gap;return r===void 0&&(r="margin"),` - .`.concat(bT,` { - overflow: hidden `).concat(i,`; - padding-right: `).concat(d,"px ").concat(i,`; - } - body[`).concat(Ea,`] { - overflow: hidden `).concat(i,`; - overscroll-behavior: contain; - `).concat([n&&"position: relative ".concat(i,";"),r==="margin"&&` - padding-left: `.concat(s,`px; - padding-top: `).concat(l,`px; - padding-right: `).concat(u,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(d,"px ").concat(i,`; - `),r==="padding"&&"padding-right: ".concat(d,"px ").concat(i,";")].filter(Boolean).join(""),` - } - - .`).concat(Qc,` { - right: `).concat(d,"px ").concat(i,`; - } - - .`).concat(Xc,` { - margin-right: `).concat(d,"px ").concat(i,`; - } - - .`).concat(Qc," .").concat(Qc,` { - right: 0 `).concat(i,`; - } - - .`).concat(Xc," .").concat(Xc,` { - margin-right: 0 `).concat(i,`; - } - - body[`).concat(Ea,`] { - `).concat(xT,": ").concat(d,`px; - } -`)},wb=function(){var e=parseInt(document.body.getAttribute(Ea)||"0",10);return isFinite(e)?e:0},VT=function(){x.useEffect(function(){return document.body.setAttribute(Ea,(wb()+1).toString()),function(){var e=wb()-1;e<=0?document.body.removeAttribute(Ea):document.body.setAttribute(Ea,e.toString())}},[])},FT=function(e){var n=e.noRelative,r=e.noImportant,i=e.gapMode,s=i===void 0?"margin":i;VT();var l=x.useMemo(function(){return LT(s)},[s]);return x.createElement(IT,{styles:$T(l,!n,s,r?"":"!important")})},dm=!1;if(typeof window<"u")try{var Dc=Object.defineProperty({},"passive",{get:function(){return dm=!0,!0}});window.addEventListener("test",Dc,Dc),window.removeEventListener("test",Dc,Dc)}catch{dm=!1}var ma=dm?{passive:!1}:!1,PT=function(e){return e.tagName==="TEXTAREA"},bS=function(e,n){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[n]!=="hidden"&&!(r.overflowY===r.overflowX&&!PT(e)&&r[n]==="visible")},UT=function(e){return bS(e,"overflowY")},HT=function(e){return bS(e,"overflowX")},_b=function(e,n){var r=n.ownerDocument,i=n;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var s=xS(e,i);if(s){var l=SS(e,i),u=l[1],d=l[2];if(u>d)return!0}i=i.parentNode}while(i&&i!==r.body);return!1},BT=function(e){var n=e.scrollTop,r=e.scrollHeight,i=e.clientHeight;return[n,r,i]},qT=function(e){var n=e.scrollLeft,r=e.scrollWidth,i=e.clientWidth;return[n,r,i]},xS=function(e,n){return e==="v"?UT(n):HT(n)},SS=function(e,n){return e==="v"?BT(n):qT(n)},GT=function(e,n){return e==="h"&&n==="rtl"?-1:1},ZT=function(e,n,r,i,s){var l=GT(e,window.getComputedStyle(n).direction),u=l*i,d=r.target,m=n.contains(d),h=!1,y=u>0,v=0,b=0;do{if(!d)break;var S=SS(e,d),_=S[0],C=S[1],E=S[2],T=C-E-l*_;(_||T)&&xS(e,d)&&(v+=T,b+=_);var O=d.parentNode;d=O&&O.nodeType===Node.DOCUMENT_FRAGMENT_NODE?O.host:O}while(!m&&d!==document.body||m&&(n.contains(d)||n===d));return(y&&Math.abs(v)<1||!y&&Math.abs(b)<1)&&(h=!0),h},kc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Cb=function(e){return[e.deltaX,e.deltaY]},Eb=function(e){return e&&"current"in e?e.current:e},KT=function(e,n){return e[0]===n[0]&&e[1]===n[1]},YT=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},QT=0,pa=[];function XT(e){var n=x.useRef([]),r=x.useRef([0,0]),i=x.useRef(),s=x.useState(QT++)[0],l=x.useState(yS)[0],u=x.useRef(e);x.useEffect(function(){u.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var C=yT([e.lockRef.current],(e.shards||[]).map(Eb),!0).filter(Boolean);return C.forEach(function(E){return E.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),C.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var d=x.useCallback(function(C,E){if("touches"in C&&C.touches.length===2||C.type==="wheel"&&C.ctrlKey)return!u.current.allowPinchZoom;var T=kc(C),O=r.current,M="deltaX"in C?C.deltaX:O[0]-T[0],k="deltaY"in C?C.deltaY:O[1]-T[1],L,q=C.target,H=Math.abs(M)>Math.abs(k)?"h":"v";if("touches"in C&&H==="h"&&q.type==="range")return!1;var $=window.getSelection(),he=$&&$.anchorNode,ve=he?he===q||he.contains(q):!1;if(ve)return!1;var de=_b(H,q);if(!de)return!0;if(de?L=H:(L=H==="v"?"h":"v",de=_b(H,q)),!de)return!1;if(!i.current&&"changedTouches"in C&&(M||k)&&(i.current=L),!L)return!0;var le=i.current||L;return ZT(le,E,C,le==="h"?M:k)},[]),m=x.useCallback(function(C){var E=C;if(!(!pa.length||pa[pa.length-1]!==l)){var T="deltaY"in E?Cb(E):kc(E),O=n.current.filter(function(L){return L.name===E.type&&(L.target===E.target||E.target===L.shadowParent)&&KT(L.delta,T)})[0];if(O&&O.should){E.cancelable&&E.preventDefault();return}if(!O){var M=(u.current.shards||[]).map(Eb).filter(Boolean).filter(function(L){return L.contains(E.target)}),k=M.length>0?d(E,M[0]):!u.current.noIsolation;k&&E.cancelable&&E.preventDefault()}}},[]),h=x.useCallback(function(C,E,T,O){var M={name:C,delta:E,target:T,should:O,shadowParent:JT(T)};n.current.push(M),setTimeout(function(){n.current=n.current.filter(function(k){return k!==M})},1)},[]),y=x.useCallback(function(C){r.current=kc(C),i.current=void 0},[]),v=x.useCallback(function(C){h(C.type,Cb(C),C.target,d(C,e.lockRef.current))},[]),b=x.useCallback(function(C){h(C.type,kc(C),C.target,d(C,e.lockRef.current))},[]);x.useEffect(function(){return pa.push(l),e.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:b}),document.addEventListener("wheel",m,ma),document.addEventListener("touchmove",m,ma),document.addEventListener("touchstart",y,ma),function(){pa=pa.filter(function(C){return C!==l}),document.removeEventListener("wheel",m,ma),document.removeEventListener("touchmove",m,ma),document.removeEventListener("touchstart",y,ma)}},[]);var S=e.removeScrollBar,_=e.inert;return x.createElement(x.Fragment,null,_?x.createElement(l,{styles:YT(s)}):null,S?x.createElement(FT,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function JT(e){for(var n=null;e!==null;)e instanceof ShadowRoot&&(n=e.host,e=e.host),e=e.parentNode;return n}const WT=TT(vS,XT);var Ru=x.forwardRef(function(e,n){return x.createElement(Eu,Er({},e,{ref:n,sideCar:WT}))});Ru.classNames=Eu.classNames;var eO=function(e){if(typeof document>"u")return null;var n=Array.isArray(e)?e[0]:e;return n.ownerDocument.body},ga=new WeakMap,Lc=new WeakMap,Ic={},Rh=0,wS=function(e){return e&&(e.host||wS(e.parentNode))},tO=function(e,n){return n.map(function(r){if(e.contains(r))return r;var i=wS(r);return i&&e.contains(i)?i:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},nO=function(e,n,r,i){var s=tO(n,Array.isArray(e)?e:[e]);Ic[r]||(Ic[r]=new WeakMap);var l=Ic[r],u=[],d=new Set,m=new Set(s),h=function(v){!v||d.has(v)||(d.add(v),h(v.parentNode))};s.forEach(h);var y=function(v){!v||m.has(v)||Array.prototype.forEach.call(v.children,function(b){if(d.has(b))y(b);else try{var S=b.getAttribute(i),_=S!==null&&S!=="false",C=(ga.get(b)||0)+1,E=(l.get(b)||0)+1;ga.set(b,C),l.set(b,E),u.push(b),C===1&&_&&Lc.set(b,!0),E===1&&b.setAttribute(r,"true"),_||b.setAttribute(i,"true")}catch(T){console.error("aria-hidden: cannot operate on ",b,T)}})};return y(n),d.clear(),Rh++,function(){u.forEach(function(v){var b=ga.get(v)-1,S=l.get(v)-1;ga.set(v,b),l.set(v,S),b||(Lc.has(v)||v.removeAttribute(i),Lc.delete(v)),S||v.removeAttribute(r)}),Rh--,Rh||(ga=new WeakMap,ga=new WeakMap,Lc=new WeakMap,Ic={})}},Jm=function(e,n,r){r===void 0&&(r="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),s=eO(e);return s?(i.push.apply(i,Array.from(s.querySelectorAll("[aria-live], script"))),nO(i,s,r,"aria-hidden")):function(){return null}},Tu="Dialog",[_S]=$o(Tu),[rO,gr]=_S(Tu),Wm=e=>{const{__scopeDialog:n,children:r,open:i,defaultOpen:s,onOpenChange:l,modal:u=!0}=e,d=x.useRef(null),m=x.useRef(null),[h,y]=za({prop:i,defaultProp:s??!1,onChange:l,caller:Tu});return g.jsx(rO,{scope:n,triggerRef:d,contentRef:m,contentId:hn(),titleId:hn(),descriptionId:hn(),open:h,onOpenChange:y,onOpenToggle:x.useCallback(()=>y(v=>!v),[y]),modal:u,children:r})};Wm.displayName=Tu;var CS="DialogTrigger",oO=x.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=gr(CS,r),l=it(n,s.triggerRef);return g.jsx($e.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":op(s.open),...i,ref:l,onClick:Re(e.onClick,s.onOpenToggle)})});oO.displayName=CS;var ep="DialogPortal",[iO,ES]=_S(ep,{forceMount:void 0}),tp=e=>{const{__scopeDialog:n,forceMount:r,children:i,container:s}=e,l=gr(ep,n);return g.jsx(iO,{scope:n,forceMount:r,children:x.Children.map(i,u=>g.jsx(pr,{present:r||l.open,children:g.jsx(cl,{asChild:!0,container:s,children:u})}))})};tp.displayName=ep;var ou="DialogOverlay",np=x.forwardRef((e,n)=>{const r=ES(ou,e.__scopeDialog),{forceMount:i=r.forceMount,...s}=e,l=gr(ou,e.__scopeDialog);return l.modal?g.jsx(pr,{present:i||l.open,children:g.jsx(sO,{...s,ref:n})}):null});np.displayName=ou;var aO=hi("DialogOverlay.RemoveScroll"),sO=x.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=gr(ou,r),l=aT(),u=it(n,l);return g.jsx(Ru,{as:aO,allowPinchZoom:!0,shards:[s.contentRef],children:g.jsx($e.div,{"data-state":op(s.open),...i,ref:u,style:{pointerEvents:"auto",...i.style}})})}),Na="DialogContent",rp=x.forwardRef((e,n)=>{const r=ES(Na,e.__scopeDialog),{forceMount:i=r.forceMount,...s}=e,l=gr(Na,e.__scopeDialog);return g.jsx(pr,{present:i||l.open,children:l.modal?g.jsx(lO,{...s,ref:n}):g.jsx(cO,{...s,ref:n})})});rp.displayName=Na;var lO=x.forwardRef((e,n)=>{const r=gr(Na,e.__scopeDialog),i=x.useRef(null),s=it(n,r.contentRef,i);return x.useEffect(()=>{const l=i.current;if(l)return Jm(l)},[]),g.jsx(RS,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Re(e.onCloseAutoFocus,l=>{l.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Re(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0;(u.button===2||d)&&l.preventDefault()}),onFocusOutside:Re(e.onFocusOutside,l=>l.preventDefault())})}),cO=x.forwardRef((e,n)=>{const r=gr(Na,e.__scopeDialog),i=x.useRef(!1),s=x.useRef(!1);return g.jsx(RS,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{e.onCloseAutoFocus?.(l),l.defaultPrevented||(i.current||r.triggerRef.current?.focus(),l.preventDefault()),i.current=!1,s.current=!1},onInteractOutside:l=>{e.onInteractOutside?.(l),l.defaultPrevented||(i.current=!0,l.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const u=l.target;r.triggerRef.current?.contains(u)&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&s.current&&l.preventDefault()}})}),RS=x.forwardRef((e,n)=>{const{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:l,...u}=e,d=gr(Na,r);return Xm(),g.jsx(g.Fragment,{children:g.jsx(Cu,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:s,onUnmountAutoFocus:l,children:g.jsx(ll,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":op(d.open),...u,ref:n,deferPointerDownOutside:!0,onDismiss:()=>d.onOpenChange(!1)})})})}),TS="DialogTitle",OS=x.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=gr(TS,r);return g.jsx($e.h2,{id:s.titleId,...i,ref:n})});OS.displayName=TS;var MS="DialogDescription",uO=x.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=gr(MS,r);return g.jsx($e.p,{id:s.descriptionId,...i,ref:n})});uO.displayName=MS;var AS="DialogClose",jS=x.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=gr(AS,r);return g.jsx($e.button,{type:"button",...i,ref:n,onClick:Re(e.onClick,()=>s.onOpenChange(!1))})});jS.displayName=AS;function op(e){return e?"open":"closed"}function dO(e){const n=x.useRef({value:e,previous:e});return x.useMemo(()=>(n.current.value!==e&&(n.current.previous=n.current.value,n.current.value=e),n.current.previous),[e])}function fO(e){const[n,r]=x.useState(void 0);return Qt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const l=s[0];let u,d;if("borderBoxSize"in l){const m=l.borderBoxSize,h=Array.isArray(m)?m[0]:m;u=h.inlineSize,d=h.blockSize}else u=e.offsetWidth,d=e.offsetHeight;r({width:u,height:d})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else r(void 0)},[e]),n}const hO=["top","right","bottom","left"],No=Math.min,Qr=Math.max,iu=Math.round,$c=Math.floor,Xr=e=>({x:e,y:e}),mO={left:"right",right:"left",bottom:"top",top:"bottom"};function zS(e,n,r){return Qr(e,No(n,r))}function Jr(e,n){return typeof e=="function"?e(n):e}function Do(e){return e.split("-")[0]}function ka(e){return e.split("-")[1]}function ip(e){return e==="x"?"y":"x"}function ap(e){return e==="y"?"height":"width"}function Rr(e){const n=e[0];return n==="t"||n==="b"?"y":"x"}function sp(e){return ip(Rr(e))}function pO(e,n,r){r===void 0&&(r=!1);const i=ka(e),s=sp(e),l=ap(s);let u=s==="x"?i===(r?"end":"start")?"right":"left":i==="start"?"bottom":"top";return n.reference[l]>n.floating[l]&&(u=au(u)),[u,au(u)]}function gO(e){const n=au(e);return[fm(e),n,fm(n)]}function fm(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Rb=["left","right"],Tb=["right","left"],vO=["top","bottom"],yO=["bottom","top"];function bO(e,n,r){switch(e){case"top":case"bottom":return r?n?Tb:Rb:n?Rb:Tb;case"left":case"right":return n?vO:yO;default:return[]}}function xO(e,n,r,i){const s=ka(e);let l=bO(Do(e),r==="start",i);return s&&(l=l.map(u=>u+"-"+s),n&&(l=l.concat(l.map(fm)))),l}function au(e){const n=Do(e);return mO[n]+e.slice(n.length)}function SO(e){var n,r,i,s;return{top:(n=e.top)!=null?n:0,right:(r=e.right)!=null?r:0,bottom:(i=e.bottom)!=null?i:0,left:(s=e.left)!=null?s:0}}function NS(e){return typeof e!="number"?SO(e):{top:e,right:e,bottom:e,left:e}}function su(e){const{x:n,y:r,width:i,height:s}=e;return{width:i,height:s,top:r,left:n,right:n+i,bottom:r+s,x:n,y:r}}function Ob(e,n,r){let{reference:i,floating:s}=e;const l=Rr(n),u=sp(n),d=ap(u),m=Do(n),h=l==="y",y=i.x+i.width/2-s.width/2,v=i.y+i.height/2-s.height/2,b=i[d]/2-s[d]/2;let S;switch(m){case"top":S={x:y,y:i.y-s.height};break;case"bottom":S={x:y,y:i.y+i.height};break;case"right":S={x:i.x+i.width,y:v};break;case"left":S={x:i.x-s.width,y:v};break;default:S={x:i.x,y:i.y}}const _=ka(n);return _&&(S[u]+=b*(_==="end"?1:-1)*(r&&h?-1:1)),S}async function wO(e,n){var r;n===void 0&&(n={});const{x:i,y:s,platform:l,rects:u,elements:d,strategy:m}=e,{boundary:h="clippingAncestors",rootBoundary:y="viewport",elementContext:v="floating",altBoundary:b=!1,padding:S=0}=Jr(n,e),_=NS(S),E=d[b?v==="floating"?"reference":"floating":v],T=su(await l.getClippingRect({element:(r=await(l.isElement==null?void 0:l.isElement(E)))==null||r?E:E.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(d.floating)),boundary:h,rootBoundary:y,strategy:m})),O=v==="floating"?{x:i,y:s,width:u.floating.width,height:u.floating.height}:u.reference,M=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d.floating)),k=await(l.isElement==null?void 0:l.isElement(M))&&await(l.getScale==null?void 0:l.getScale(M))||{x:1,y:1},L=su(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:O,offsetParent:M,strategy:m}):O);return{top:(T.top-L.top+_.top)/k.y,bottom:(L.bottom-T.bottom+_.bottom)/k.y,left:(T.left-L.left+_.left)/k.x,right:(L.right-T.right+_.right)/k.x}}const _O=50,CO=async(e,n,r)=>{const{placement:i="bottom",strategy:s="absolute",middleware:l=[],platform:u}=r,d=u.detectOverflow?u:{...u,detectOverflow:wO},m=await(u.isRTL==null?void 0:u.isRTL(n));let h=await u.getElementRects({reference:e,floating:n,strategy:s}),{x:y,y:v}=Ob(h,i,m),b=i,S=0;const _={};for(let C=0;C({name:"arrow",options:e,async fn(n){const{x:r,y:i,placement:s,rects:l,platform:u,elements:d,middlewareData:m}=n,{element:h,padding:y=0}=Jr(e,n)||{};if(h==null)return{};const v=NS(y),b={x:r,y:i},S=sp(s),_=ap(S),C=await u.getDimensions(h),E=S==="y",T=E?"top":"left",O=E?"bottom":"right",M=E?"clientHeight":"clientWidth",k=l.reference[_]+l.reference[S]-b[S]-l.floating[_],L=b[S]-l.reference[S],q=await(u.getOffsetParent==null?void 0:u.getOffsetParent(h));let H=q?q[M]:0;(!H||!await(u.isElement==null?void 0:u.isElement(q)))&&(H=d.floating[M]||l.floating[_]);const $=k/2-L/2,he=H/2-C[_]/2-1,ve=No(v[T],he),de=No(v[O],he),le=H-C[_]-de,ae=H/2-C[_]/2+$,me=zS(ve,ae,le),ye=!m.arrow&&ka(s)!=null&&ae!==me&&l.reference[_]/2-(aeme<=0)){var de,le;const me=(((de=l.flip)==null?void 0:de.index)||0)+1,ye=H[me];if(ye&&(!(v==="alignment"?O!==Rr(ye):!1)||ve.every(ne=>Rr(ne.placement)===O?ne.overflows[0]>0:!0)))return{data:{index:me,overflows:ve},reset:{placement:ye}};let D=(le=ve.filter(Y=>Y.overflows[0]<=0).sort((Y,ne)=>Y.overflows[1]-ne.overflows[1])[0])==null?void 0:le.placement;if(!D)switch(S){case"bestFit":{var ae;const Y=(ae=ve.filter(ne=>{if(q){const J=Rr(ne.placement);return J===O||J==="y"}return!0}).map(ne=>[ne.placement,ne.overflows.filter(J=>J>0).reduce((J,W)=>J+W,0)]).sort((ne,J)=>ne[1]-J[1])[0])==null?void 0:ae[0];Y&&(D=Y);break}case"initialPlacement":D=d;break}if(s!==D)return{reset:{placement:D}}}return{}}}};function Mb(e,n){return{top:e.top-n.height,right:e.right-n.width,bottom:e.bottom-n.height,left:e.left-n.width}}function Ab(e){return hO.some(n=>e[n]>=0)}const TO=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(n){const{rects:r,platform:i}=n,{strategy:s="referenceHidden",...l}=Jr(e,n);switch(s){case"referenceHidden":{const u=await i.detectOverflow(n,{...l,elementContext:"reference"}),d=Mb(u,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:Ab(d)}}}case"escaped":{const u=await i.detectOverflow(n,{...l,altBoundary:!0}),d=Mb(u,r.floating);return{data:{escapedOffsets:d,escaped:Ab(d)}}}default:return{}}}}},DS=new Set(["left","top"]);async function OO(e,n){const{placement:r,platform:i,elements:s}=e,l=await(i.isRTL==null?void 0:i.isRTL(s.floating)),u=Do(r),d=ka(r),m=Rr(r)==="y",h=DS.has(u)?-1:1,y=l&&m?-1:1,v=Jr(n,e);let{mainAxis:b,crossAxis:S,alignmentAxis:_}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return d&&typeof _=="number"&&(S=d==="end"?_*-1:_),m?{x:S*y,y:b*h}:{x:b*h,y:S*y}}const MO=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(n){var r,i;const{x:s,y:l,placement:u,middlewareData:d}=n,m=await OO(n,e);return u===((r=d.offset)==null?void 0:r.placement)&&(i=d.arrow)!=null&&i.alignmentOffset?{}:{x:s+m.x,y:l+m.y,data:{...m,placement:u}}}}},AO=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(n){const{x:r,y:i,placement:s,platform:l}=n,{mainAxis:u=!0,crossAxis:d=!1,limiter:m={fn:O=>{let{x:M,y:k}=O;return{x:M,y:k}}},...h}=Jr(e,n),y={x:r,y:i},v=await l.detectOverflow(n,h),b=Rr(s),S=ip(b);let _=y[S],C=y[b];const E=(O,M)=>zS(M+v[O==="y"?"top":"left"],M,M-v[O==="y"?"bottom":"right"]);u&&(_=E(S,_)),d&&(C=E(b,C));const T=m.fn({...n,[S]:_,[b]:C});return{...T,data:{x:T.x-r,y:T.y-i,enabled:{[S]:u,[b]:d}}}}}},jO=function(e){return e===void 0&&(e={}),{options:e,fn(n){var r,i;const{x:s,y:l,placement:u,rects:d,middlewareData:m}=n,{offset:h=0,mainAxis:y=!0,crossAxis:v=!0}=Jr(e,n),b={x:s,y:l},S=Rr(u),_=ip(S);let C=b[_],E=b[S];const T=Jr(h,n),O=typeof T=="number"?{mainAxis:T,crossAxis:0}:{mainAxis:(r=T.mainAxis)!=null?r:0,crossAxis:(i=T.crossAxis)!=null?i:0};if(y){const L=_==="y"?"height":"width",q=d.reference[_]-d.floating[L]+O.mainAxis,H=d.reference[_]+d.reference[L]-O.mainAxis;CH&&(C=H)}if(v){var M,k;const L=_==="y"?"width":"height",q=DS.has(Do(u)),H=d.reference[S]-d.floating[L]+(q&&((M=m.offset)==null?void 0:M[S])||0)+(q?0:O.crossAxis),$=d.reference[S]+d.reference[L]+(q?0:((k=m.offset)==null?void 0:k[S])||0)-(q?O.crossAxis:0);E$&&(E=$)}return{[_]:C,[S]:E}}}},zO=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(n){const{placement:r,rects:i,platform:s,elements:l}=n,{apply:u=()=>{},...d}=Jr(e,n),m=await s.detectOverflow(n,d),h=Do(r),y=ka(r),v=Rr(r)==="y",{width:b,height:S}=i.floating;let _,C;h==="top"||h==="bottom"?(_=h,C=y===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(C=h,_=y==="end"?"top":"bottom");const E=S-m.top-m.bottom,T=b-m.left-m.right,O=No(S-m[_],E),M=No(b-m[C],T),k=n.middlewareData.shift,L=!k;let q=O,H=M;k!=null&&k.enabled.x&&(H=T),k!=null&&k.enabled.y&&(q=E),L&&!y&&(v?H=b-2*Qr(m.left,m.right):q=S-2*Qr(m.top,m.bottom)),await u({...n,availableWidth:H,availableHeight:q});const $=await s.getDimensions(l.floating);return b!==$.width||S!==$.height?{reset:{rects:!0}}:{}}}};function Ou(){return typeof window<"u"}function La(e){return kS(e)?(e.nodeName||"").toLowerCase():"#document"}function An(e){var n;return(e==null||(n=e.ownerDocument)==null?void 0:n.defaultView)||window}function Wr(e){var n;return(n=(kS(e)?e.ownerDocument:e.document)||window.document)==null?void 0:n.documentElement}function kS(e){return Ou()?e instanceof Node||e instanceof An(e).Node:!1}function Tr(e){return Ou()?e instanceof Element||e instanceof An(e).Element:!1}function Vo(e){return Ou()?e instanceof HTMLElement||e instanceof An(e).HTMLElement:!1}function jb(e){return!Ou()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof An(e).ShadowRoot}function Mu(e){const{overflow:n,overflowX:r,overflowY:i,display:s}=Or(e);return/auto|scroll|overlay|hidden|clip/.test(n+i+r)&&s!=="inline"&&s!=="contents"}function NO(e){return/^(table|td|th)$/.test(La(e))}function Au(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const DO=/transform|translate|scale|rotate|perspective|filter/,kO=/paint|layout|strict|content/,ci=e=>!!e&&e!=="none";let Th;function lp(e){const n=Tr(e)?Or(e):e;return ci(n.transform)||ci(n.translate)||ci(n.scale)||ci(n.rotate)||ci(n.perspective)||!cp()&&(ci(n.backdropFilter)||ci(n.filter))||DO.test(n.willChange||"")||kO.test(n.contain||"")}function LO(e){let n=mi(e);for(;Vo(n)&&!Gs(n);){if(lp(n))return n;if(Au(n))return null;n=mi(n)}return null}function cp(){return Th==null&&(Th=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Th}function Gs(e){return/^(html|body|#document)$/.test(La(e))}function Or(e){return An(e).getComputedStyle(e)}function ju(e){return Tr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function mi(e){if(La(e)==="html")return e;const n=e.assignedSlot||e.parentNode||jb(e)&&e.host||Wr(e);return jb(n)?n.host:n}function LS(e){const n=mi(e);return Gs(n)?(e.ownerDocument||e).body:Vo(n)&&Mu(n)?n:LS(n)}function Zs(e,n,r){var i;n===void 0&&(n=[]),r===void 0&&(r=!0);const s=LS(e),l=s===((i=e.ownerDocument)==null?void 0:i.body),u=An(s);if(l){const d=hm(u);return n.concat(u,u.visualViewport||[],Mu(s)?s:[],d&&r?Zs(d):[])}else return n.concat(s,Zs(s,[],r))}function hm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function IS(e){const n=Or(e);let r=parseFloat(n.width)||0,i=parseFloat(n.height)||0;const s=Vo(e),l=s?e.offsetWidth:r,u=s?e.offsetHeight:i,d=iu(r)!==l||iu(i)!==u;return d&&(r=l,i=u),{width:r,height:i,$:d}}function up(e){return Tr(e)?e:e.contextElement}function Ra(e){const n=up(e);if(!Vo(n))return Xr(1);const r=n.getBoundingClientRect(),{width:i,height:s,$:l}=IS(n);let u=(l?iu(r.width):r.width)/i,d=(l?iu(r.height):r.height)/s;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const IO=Xr(0);function $S(e){const n=An(e);return!cp()||!n.visualViewport?IO:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function $O(e,n,r){return n===void 0&&(n=!1),!!r&&n&&r===An(e)}function pi(e,n,r,i){n===void 0&&(n=!1),r===void 0&&(r=!1);const s=e.getBoundingClientRect(),l=up(e);let u=Xr(1);n&&(i?Tr(i)&&(u=Ra(i)):u=Ra(e));const d=$O(l,r,i)?$S(l):Xr(0);let m=(s.left+d.x)/u.x,h=(s.top+d.y)/u.y,y=s.width/u.x,v=s.height/u.y;if(l&&i){const b=An(l),S=Tr(i)?An(i):i;let _=b,C=hm(_);for(;C&&S!==_;){const E=Ra(C),T=C.getBoundingClientRect(),O=Or(C),M=T.left+(C.clientLeft+parseFloat(O.paddingLeft))*E.x,k=T.top+(C.clientTop+parseFloat(O.paddingTop))*E.y;m*=E.x,h*=E.y,y*=E.x,v*=E.y,m+=M,h+=k,_=An(C),C=hm(_)}}return su({width:y,height:v,x:m,y:h})}function zu(e,n){const r=ju(e).scrollLeft;return n?n.left+r:pi(Wr(e)).left+r}function VS(e,n){const r=e.getBoundingClientRect(),i=r.left+n.scrollLeft-zu(e,r),s=r.top+n.scrollTop;return{x:i,y:s}}function VO(e){let{elements:n,rect:r,offsetParent:i,strategy:s}=e;const l=s==="fixed",u=Wr(i),d=n?Au(n.floating):!1;if(i===u||d&&l)return r;let m={scrollLeft:0,scrollTop:0},h=Xr(1);const y=Xr(0),v=Vo(i);if((v||!l)&&((La(i)!=="body"||Mu(u))&&(m=ju(i)),v)){const S=pi(i);h=Ra(i),y.x=S.x+i.clientLeft,y.y=S.y+i.clientTop}const b=u&&!v&&!l?VS(u,m):Xr(0);return{width:r.width*h.x,height:r.height*h.y,x:r.x*h.x-m.scrollLeft*h.x+y.x+b.x,y:r.y*h.y-m.scrollTop*h.y+y.y+b.y}}function FO(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function PO(e){const n=ju(e),r=e.ownerDocument.body,i=Qr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Qr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+zu(e);const u=-n.scrollTop;return Or(r).direction==="rtl"&&(l+=Qr(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:l,y:u}}const UO=25;function HO(e,n,r){r===void 0&&(r="viewport");const i=r==="layoutViewport",s=An(e),l=Wr(e),u=s.visualViewport;let d=l.clientWidth,m=l.clientHeight,h=0,y=0;if(u){const b=!cp()||n==="fixed";i?b||(h=-u.offsetLeft,y=-u.offsetTop):(d=u.width,m=u.height,b&&(h=u.offsetLeft,y=u.offsetTop))}if(zu(l)<=0){const b=l.ownerDocument,S=b.body,_=getComputedStyle(S),C=b.compatMode==="CSS1Compat"&&parseFloat(_.marginLeft)+parseFloat(_.marginRight)||0,E=Math.abs(l.clientWidth-S.clientWidth-C),T=getComputedStyle(l).scrollbarGutter==="stable both-edges"?E/2:E;T<=UO&&(d-=T)}return{width:d,height:m,x:h,y}}function BO(e,n){const r=pi(e,!0,n==="fixed"),i=r.top+e.clientTop,s=r.left+e.clientLeft,l=Ra(e),u=e.clientWidth*l.x,d=e.clientHeight*l.y,m=s*l.x,h=i*l.y;return{width:u,height:d,x:m,y:h}}function zb(e,n,r){let i;if(n==="viewport"||n==="layoutViewport")i=HO(e,r,n);else if(n==="document")i=PO(Wr(e));else if(Tr(n))i=BO(n,r);else{const s=$S(e);i={x:n.x-s.x,y:n.y-s.y,width:n.width,height:n.height}}return su(i)}function qO(e,n){const r=n.get(e);if(r)return r;let i=Zs(e,[],!1).filter(d=>Tr(d)&&La(d)!=="body"),s=null;const l=Or(e).position==="fixed";let u=l?mi(e):e;for(;Tr(u)&&!Gs(u);){const d=Or(u),m=lp(u),h=s?s.position:l?"fixed":"";!m&&(h==="fixed"||h==="absolute"&&d.position==="static")?i=i.filter(v=>v!==u):s=d,u=mi(u)}return n.set(e,i),i}function GO(e){let{element:n,boundary:r,rootBoundary:i,strategy:s}=e;const u=[...r==="clippingAncestors"?Au(n)?[]:qO(n,this._c):[].concat(r),i],d=zb(n,u[0],s);let m=d.top,h=d.right,y=d.bottom,v=d.left;for(let b=1;b{d(!1,1e-7)},1e3)}H=!1}try{i=new IntersectionObserver($,{...q,root:l.ownerDocument})}catch{i=new IntersectionObserver($,q)}i.observe(e)}const m=An(e),h=()=>d(r);return m.addEventListener("resize",h),d(!0),()=>{m.removeEventListener("resize",h),u()}}function WO(e,n,r,i){i===void 0&&(i={});const{ancestorScroll:s=!0,ancestorResize:l=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:m=!1}=i,h=up(e),y=s||l?[...h?Zs(h):[],...n?Zs(n):[]]:[];y.forEach(T=>{s&&T.addEventListener("scroll",r),l&&T.addEventListener("resize",r)});const v=h&&d?JO(h,r,l):null;let b=-1,S=null;u&&(S=new ResizeObserver(T=>{let[O]=T;O&&O.target===h&&S&&n&&(S.unobserve(n),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var M;(M=S)==null||M.observe(n)})),r()}),h&&!m&&S.observe(h),n&&S.observe(n));let _,C=m?pi(e):null;m&&E();function E(){const T=pi(e);C&&!PS(C,T)&&r(),C=T,_=requestAnimationFrame(E)}return r(),()=>{var T;y.forEach(O=>{s&&O.removeEventListener("scroll",r),l&&O.removeEventListener("resize",r)}),v?.(),(T=S)==null||T.disconnect(),S=null,m&&cancelAnimationFrame(_)}}const eM=MO,tM=AO,nM=RO,rM=zO,oM=TO,Db=EO,iM=jO,aM=(e,n,r)=>{const i=new Map,s=r??{},l={...XO,...s.platform,_c:i};return CO(e,n,{...s,platform:l})};var sM=typeof document<"u",lM=function(){},Jc=sM?x.useLayoutEffect:lM;function lu(e,n){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(typeof e=="function"&&e.toString()===n.toString())return!0;let r,i,s;if(e&&n&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==n.length)return!1;for(i=r;i--!==0;)if(!lu(e[i],n[i]))return!1;return!0}if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!{}.hasOwnProperty.call(n,s[i]))return!1;for(i=r;i--!==0;){const l=s[i];if(!(l==="_owner"&&e.$$typeof)&&!lu(e[l],n[l]))return!1}return!0}return e!==e&&n!==n}function US(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function kb(e,n){const r=US(e);return Math.round(n*r)/r}function Mh(e){const n=x.useRef(e);return Jc(()=>{n.current=e}),n}function cM(e){e===void 0&&(e={});const{placement:n="bottom",strategy:r="absolute",middleware:i=[],platform:s,elements:{reference:l,floating:u}={},transform:d=!0,whileElementsMounted:m,open:h}=e,[y,v]=x.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[b,S]=x.useState(i);lu(b,i)||S(i);const[_,C]=x.useState(null),[E,T]=x.useState(null),O=x.useCallback(ne=>{ne!==q.current&&(q.current=ne,C(ne))},[]),M=x.useCallback(ne=>{ne!==H.current&&(H.current=ne,T(ne))},[]),k=l||_,L=u||E,q=x.useRef(null),H=x.useRef(null),$=x.useRef(y),he=m!=null,ve=Mh(m),de=Mh(s),le=Mh(h),ae=x.useCallback(()=>{if(!q.current||!H.current)return;const ne={placement:n,strategy:r,middleware:b};de.current&&(ne.platform=de.current),aM(q.current,H.current,ne).then(J=>{const W={...J,isPositioned:le.current!==!1};me.current&&!lu($.current,W)&&($.current=W,xi.flushSync(()=>{v(W)}))})},[b,n,r,de,le]);Jc(()=>{h===!1&&$.current.isPositioned&&($.current.isPositioned=!1,v(ne=>({...ne,isPositioned:!1})))},[h]);const me=x.useRef(!1);Jc(()=>(me.current=!0,()=>{me.current=!1}),[]),Jc(()=>{if(k&&(q.current=k),L&&(H.current=L),k&&L){if(ve.current)return ve.current(k,L,ae);ae()}},[k,L,ae,ve,he]);const ye=x.useMemo(()=>({reference:q,floating:H,setReference:O,setFloating:M}),[O,M]),D=x.useMemo(()=>({reference:k,floating:L}),[k,L]),Y=x.useMemo(()=>{const ne={position:r,left:0,top:0};if(!D.floating)return ne;const J=kb(D.floating,y.x),W=kb(D.floating,y.y);return d?{...ne,transform:"translate("+J+"px, "+W+"px)",...US(D.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:J,top:W}},[r,d,D.floating,y.x,y.y]);return x.useMemo(()=>({...y,update:ae,refs:ye,elements:D,floatingStyles:Y}),[y,ae,ye,D,Y])}const uM=e=>{function n(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:i,padding:s}=typeof e=="function"?e(r):e;return i&&n(i)?i.current!=null?Db({element:i.current,padding:s}).fn(r):{}:i?Db({element:i,padding:s}).fn(r):{}}}},dM=(e,n)=>{const r=eM(e);return{name:r.name,fn:r.fn,options:[e,n]}},fM=(e,n)=>{const r=tM(e);return{name:r.name,fn:r.fn,options:[e,n]}},hM=(e,n)=>({fn:iM(e).fn,options:[e,n]}),mM=(e,n)=>{const r=nM(e);return{name:r.name,fn:r.fn,options:[e,n]}},pM=(e,n)=>{const r=rM(e);return{name:r.name,fn:r.fn,options:[e,n]}},gM=(e,n)=>{const r=oM(e);return{name:r.name,fn:r.fn,options:[e,n]}},vM=(e,n)=>{const r=uM(e);return{name:r.name,fn:r.fn,options:[e,n]}};var yM="Arrow",HS=x.forwardRef((e,n)=>{const{children:r,width:i=10,height:s=5,...l}=e;return g.jsx($e.svg,{...l,ref:n,width:i,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});HS.displayName=yM;var bM=HS,dp="Popper",[BS,Ia]=$o(dp),[xM,qS]=BS(dp),GS=e=>{const{__scopePopper:n,children:r}=e,[i,s]=x.useState(null),[l,u]=x.useState(void 0);return g.jsx(xM,{scope:n,anchor:i,onAnchorChange:s,placementState:l,setPlacementState:u,children:r})};GS.displayName=dp;var ZS="PopperAnchor",KS=x.forwardRef((e,n)=>{const{__scopePopper:r,virtualRef:i,...s}=e,l=qS(ZS,r),u=x.useRef(null),d=l.onAnchorChange,m=x.useCallback(_=>{u.current=_,_&&d(_)},[d]),h=it(n,m),y=x.useRef(null);x.useEffect(()=>{if(!i)return;const _=y.current;y.current=i.current,_!==y.current&&d(y.current)});const v=l.placementState&&hp(l.placementState),b=v?.[0],S=v?.[1];return i?null:g.jsx($e.div,{"data-radix-popper-side":b,"data-radix-popper-align":S,...s,ref:h})});KS.displayName=ZS;var fp="PopperContent",[SM,wM]=BS(fp),YS=x.forwardRef((e,n)=>{const{__scopePopper:r,side:i="bottom",sideOffset:s=0,align:l="center",alignOffset:u=0,arrowPadding:d=0,avoidCollisions:m=!0,collisionBoundary:h=[],collisionPadding:y=0,sticky:v="partial",hideWhenDetached:b=!1,updatePositionStrategy:S="optimized",onPlaced:_,...C}=e,E=qS(fp,r),[T,O]=x.useState(null),M=it(n,O),[k,L]=x.useState(null),q=fO(k),H=q?.width??0,$=q?.height??0,he=i+(l!=="center"?"-"+l:""),ve=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},de=Array.isArray(h)?h:[h],le=de.length>0,ae={padding:ve,boundary:de.filter(CM),altBoundary:le},{refs:me,floatingStyles:ye,placement:D,isPositioned:Y,middlewareData:ne}=cM({strategy:"fixed",placement:he,whileElementsMounted:(...ge)=>WO(...ge,{animationFrame:S==="always"}),elements:{reference:E.anchor},middleware:[dM({mainAxis:s+$,alignmentAxis:u}),m&&fM({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?hM():void 0,...ae}),m&&mM({...ae}),pM({...ae,apply:({elements:ge,rects:be,availableWidth:De,availableHeight:Ve})=>{const{width:Ue,height:lt}=be.reference,Xe=ge.floating.style;Xe.setProperty("--radix-popper-available-width",`${De}px`),Xe.setProperty("--radix-popper-available-height",`${Ve}px`),Xe.setProperty("--radix-popper-anchor-width",`${Ue}px`),Xe.setProperty("--radix-popper-anchor-height",`${lt}px`)}}),k&&vM({element:k,padding:d}),EM({arrowWidth:H,arrowHeight:$}),b&&gM({strategy:"referenceHidden",...ae,boundary:le?ae.boundary:void 0})]}),J=E.setPlacementState;Qt(()=>(J(D),()=>{J(void 0)}),[D,J]);const[W,z]=hp(D),j=tr(_);Qt(()=>{Y&&j?.()},[Y,j]);const U=ne.arrow?.x,Q=ne.arrow?.y,Z=ne.arrow?.centerOffset!==0,[re,ee]=x.useState();return Qt(()=>{T&&ee(window.getComputedStyle(T).zIndex)},[T]),g.jsx("div",{ref:me.setFloating,"data-radix-popper-content-wrapper":"",style:{...ye,transform:Y?ye.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:re,"--radix-popper-transform-origin":[ne.transformOrigin?.x,ne.transformOrigin?.y].join(" "),...ne.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:g.jsx(SM,{scope:r,placedSide:W,placedAlign:z,onArrowChange:L,arrowX:U,arrowY:Q,shouldHideArrow:Z,children:g.jsx($e.div,{"data-side":W,"data-align":z,...C,ref:M,style:{...C.style,animation:Y?void 0:"none"}})})})});YS.displayName=fp;var QS="PopperArrow",_M={top:"bottom",right:"left",bottom:"top",left:"right"},XS=x.forwardRef(function(n,r){const{__scopePopper:i,...s}=n,l=wM(QS,i),u=_M[l.placedSide];return g.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:g.jsx(bM,{...s,ref:r,style:{...s.style,display:"block"}})})});XS.displayName=QS;function CM(e){return e!==null}var EM=e=>({name:"transformOrigin",options:e,fn(n){const{placement:r,rects:i,middlewareData:s}=n,u=s.arrow?.centerOffset!==0,d=u?0:e.arrowWidth,m=u?0:e.arrowHeight,[h,y]=hp(r),v={start:"0%",center:"50%",end:"100%"}[y],b=(s.arrow?.x??0)+d/2,S=(s.arrow?.y??0)+m/2;let _="",C="";return h==="bottom"?(_=u?v:`${b}px`,C=`${-m}px`):h==="top"?(_=u?v:`${b}px`,C=`${i.floating.height+m}px`):h==="right"?(_=`${-m}px`,C=u?v:`${S}px`):h==="left"&&(_=`${i.floating.width+m}px`,C=u?v:`${S}px`),{data:{x:_,y:C}}}});function hp(e){const[n,r="center"]=e.split("-");return[n,r]}var mp=GS,pp=KS,gp=YS,vp=XS,Ah=!1;function RM(){const[e,n]=x.useState(Ah);return x.useEffect(()=>{Ah||(Ah=!0,n(!0))},[]),e}var JS=_u[" useSyncExternalStore ".trim().toString()];function TM(){return()=>{}}function OM(){return JS(TM,()=>!0,()=>!1)}var MM=typeof JS=="function"?OM:RM,jh="rovingFocusGroup.onEntryFocus",AM={bubbles:!1,cancelable:!0},ul="RovingFocusGroup",[mm,WS,jM]=Km(ul),[zM,ew]=$o(ul,[jM]),[NM,DM]=zM(ul),tw=x.forwardRef((e,n)=>g.jsx(mm.Provider,{scope:e.__scopeRovingFocusGroup,children:g.jsx(mm.Slot,{scope:e.__scopeRovingFocusGroup,children:g.jsx(kM,{...e,ref:n})})}));tw.displayName=ul;var kM=x.forwardRef((e,n)=>{const{__scopeRovingFocusGroup:r,orientation:i,loop:s=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:m,onEntryFocus:h,preventScrollOnEntryFocus:y=!1,...v}=e,b=x.useRef(null),S=it(n,b),_=Ym(l),[C,E]=za({prop:u,defaultProp:d??null,onChange:m,caller:ul}),[T,O]=x.useState(!1),M=tr(h),k=WS(r),L=x.useRef(!1),[q,H]=x.useState(0);return x.useEffect(()=>{const $=b.current;if($)return $.addEventListener(jh,M),()=>$.removeEventListener(jh,M)},[M]),g.jsx(NM,{scope:r,orientation:i,dir:_,loop:s,currentTabStopId:C,onItemFocus:x.useCallback($=>E($),[E]),onItemShiftTab:x.useCallback(()=>O(!0),[]),onFocusableItemAdd:x.useCallback(()=>H($=>$+1),[]),onFocusableItemRemove:x.useCallback(()=>H($=>$-1),[]),children:g.jsx($e.div,{tabIndex:T||q===0?-1:0,"data-orientation":i,...v,ref:S,style:{outline:"none",...e.style},onMouseDown:Re(e.onMouseDown,()=>{L.current=!0}),onFocus:Re(e.onFocus,$=>{const he=!L.current;if($.target===$.currentTarget&&he&&!T){const ve=new CustomEvent(jh,AM);if($.currentTarget.dispatchEvent(ve),!ve.defaultPrevented){const de=k().filter(D=>D.focusable),le=de.find(D=>D.active),ae=de.find(D=>D.id===C),ye=[le,ae,...de].filter(Boolean).map(D=>D.ref.current);ow(ye,y)}}L.current=!1}),onBlur:Re(e.onBlur,()=>O(!1))})})}),nw="RovingFocusGroupItem",rw=x.forwardRef((e,n)=>{const{__scopeRovingFocusGroup:r,focusable:i=!0,active:s=!1,tabStopId:l,children:u,...d}=e,m=hn(),h=l||m,y=DM(nw,r),v=y.currentTabStopId===h,b=WS(r),{onFocusableItemAdd:S,onFocusableItemRemove:_,currentTabStopId:C}=y,E=MM();return Qt(()=>{if(!(!E||!i))return S(),()=>_()},[E,i,S,_]),x.useEffect(()=>{if(!(E||!i))return S(),()=>_()},[E,i,S,_]),g.jsx(mm.ItemSlot,{scope:r,id:h,focusable:i,active:s,children:g.jsx($e.span,{tabIndex:v?0:-1,"data-orientation":y.orientation,...d,ref:n,onMouseDown:Re(e.onMouseDown,T=>{i?y.onItemFocus(h):T.preventDefault()}),onFocus:Re(e.onFocus,()=>y.onItemFocus(h)),onKeyDown:Re(e.onKeyDown,T=>{if(T.key==="Tab"&&T.shiftKey){y.onItemShiftTab();return}if(T.target!==T.currentTarget)return;const O=$M(T,y.orientation,y.dir);if(O!==void 0){if(T.metaKey||T.ctrlKey||T.altKey||T.shiftKey)return;T.preventDefault();let k=b().filter(L=>L.focusable).map(L=>L.ref.current);if(O==="last")k.reverse();else if(O==="prev"||O==="next"){O==="prev"&&k.reverse();const L=k.indexOf(T.currentTarget);k=y.loop?VM(k,L+1):k.slice(L+1)}setTimeout(()=>ow(k))}}),children:typeof u=="function"?u({isCurrentTabStop:v,hasTabStop:C!=null}):u})})});rw.displayName=nw;var LM={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function IM(e,n){return n!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function $M(e,n,r){const i=IM(e.key,r);if(!(n==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(n==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return LM[i]}function ow(e,n=!1){const r=document.activeElement;for(const i of e)if(i===r||(i.focus({preventScroll:n}),document.activeElement!==r))return}function VM(e,n){return e.map((r,i)=>e[(n+i)%e.length])}var FM=tw,PM=rw,pm=["Enter"," "],UM=["ArrowDown","PageUp","Home"],iw=["ArrowUp","PageDown","End"],HM=[...UM,...iw],BM={ltr:[...pm,"ArrowRight"],rtl:[...pm,"ArrowLeft"]},qM={ltr:["ArrowLeft"],rtl:["ArrowRight"]},dl="Menu",[Ks,GM,ZM]=Km(dl),[Si,aw]=$o(dl,[ZM,Ia,ew]),Nu=Ia(),sw=ew(),[KM,wi]=Si(dl),[YM,fl]=Si(dl),lw=e=>{const{__scopeMenu:n,open:r=!1,children:i,dir:s,onOpenChange:l,modal:u=!0}=e,d=Nu(n),[m,h]=x.useState(null),y=x.useRef(!1),v=tr(l),b=Ym(s);return x.useEffect(()=>{const S=()=>{y.current=!0,document.addEventListener("pointerdown",_,{capture:!0,once:!0}),document.addEventListener("pointermove",_,{capture:!0,once:!0})},_=()=>y.current=!1;return document.addEventListener("keydown",S,{capture:!0}),()=>{document.removeEventListener("keydown",S,{capture:!0}),document.removeEventListener("pointerdown",_,{capture:!0}),document.removeEventListener("pointermove",_,{capture:!0})}},[]),x.useEffect(()=>{if(!r)return;const S=()=>v(!1);return window.addEventListener("blur",S),()=>window.removeEventListener("blur",S)},[r,v]),g.jsx(mp,{...d,children:g.jsx(KM,{scope:n,open:r,onOpenChange:v,content:m,onContentChange:h,children:g.jsx(YM,{scope:n,onClose:x.useCallback(()=>v(!1),[v]),isUsingKeyboardRef:y,dir:b,modal:u,children:i})})})};lw.displayName=dl;var QM="MenuAnchor",yp=x.forwardRef((e,n)=>{const{__scopeMenu:r,...i}=e,s=Nu(r);return g.jsx(pp,{...s,...i,ref:n})});yp.displayName=QM;var bp="MenuPortal",[XM,cw]=Si(bp,{forceMount:void 0}),uw=e=>{const{__scopeMenu:n,forceMount:r,children:i,container:s}=e,l=wi(bp,n);return g.jsx(XM,{scope:n,forceMount:r,children:g.jsx(pr,{present:r||l.open,children:g.jsx(cl,{asChild:!0,container:s,children:i})})})};uw.displayName=bp;var er="MenuContent",[JM,xp]=Si(er),dw=x.forwardRef((e,n)=>{const r=cw(er,e.__scopeMenu),{forceMount:i=r.forceMount,...s}=e,l=wi(er,e.__scopeMenu),u=fl(er,e.__scopeMenu);return g.jsx(Ks.Provider,{scope:e.__scopeMenu,children:g.jsx(pr,{present:i||l.open,children:g.jsx(Ks.Slot,{scope:e.__scopeMenu,children:u.modal?g.jsx(WM,{...s,ref:n}):g.jsx(eA,{...s,ref:n})})})})}),WM=x.forwardRef((e,n)=>{const r=wi(er,e.__scopeMenu),i=x.useRef(null),s=it(n,i);return x.useEffect(()=>{const l=i.current;if(l)return Jm(l)},[]),g.jsx(Sp,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Re(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),eA=x.forwardRef((e,n)=>{const r=wi(er,e.__scopeMenu);return g.jsx(Sp,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),tA=hi("MenuContent.ScrollLock"),Sp=x.forwardRef((e,n)=>{const{__scopeMenu:r,loop:i=!1,trapFocus:s,onOpenAutoFocus:l,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:m,onEscapeKeyDown:h,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:b,onDismiss:S,disableOutsideScroll:_,...C}=e,E=wi(er,r),T=fl(er,r),O=Nu(r),M=sw(r),k=GM(r),[L,q]=x.useState(null),H=x.useRef(null),$=it(n,H,E.onContentChange),he=x.useRef(0),ve=x.useRef(""),de=x.useRef(0),le=x.useRef(null),ae=x.useRef("right"),me=x.useRef(0),ye=_?Ru:x.Fragment,D=_?{as:tA,allowPinchZoom:!0}:void 0,Y=J=>{const W=ve.current+J,z=k().filter(ee=>!ee.disabled),j=document.activeElement,U=z.find(ee=>ee.ref.current===j)?.textValue,Q=z.map(ee=>ee.textValue),Z=hA(Q,W,U),re=z.find(ee=>ee.textValue===Z)?.ref.current;(function ee(ge){ve.current=ge,window.clearTimeout(he.current),ge!==""&&(he.current=window.setTimeout(()=>ee(""),1e3))})(W),re&&setTimeout(()=>re.focus())};x.useEffect(()=>()=>window.clearTimeout(he.current),[]),Xm();const ne=x.useCallback(J=>ae.current===le.current?.side&&pA(J,le.current?.area),[]);return g.jsx(JM,{scope:r,searchRef:ve,onItemEnter:x.useCallback(J=>{ne(J)&&J.preventDefault()},[ne]),onItemLeave:x.useCallback(J=>{ne(J)||(H.current?.focus(),q(null))},[ne]),onTriggerLeave:x.useCallback(J=>{ne(J)&&J.preventDefault()},[ne]),pointerGraceTimerRef:de,onPointerGraceIntentChange:x.useCallback(J=>{le.current=J},[]),children:g.jsx(ye,{...D,children:g.jsx(Cu,{asChild:!0,trapped:s,onMountAutoFocus:Re(l,J=>{J.preventDefault(),H.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:g.jsx(ll,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:h,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:b,onDismiss:S,children:g.jsx(FM,{asChild:!0,...M,dir:T.dir,orientation:"vertical",loop:i,currentTabStopId:L,onCurrentTabStopIdChange:q,onEntryFocus:Re(m,J=>{T.isUsingKeyboardRef.current||J.preventDefault()}),preventScrollOnEntryFocus:!0,children:g.jsx(gp,{role:"menu","aria-orientation":"vertical","data-state":Tw(E.open),"data-radix-menu-content":"",dir:T.dir,...O,...C,ref:$,style:{outline:"none",...C.style},onKeyDown:Re(C.onKeyDown,J=>{const z=J.target.closest("[data-radix-menu-content]")===J.currentTarget,j=J.ctrlKey||J.altKey||J.metaKey,U=J.key.length===1;z&&(J.key==="Tab"&&J.preventDefault(),!j&&U&&Y(J.key));const Q=H.current;if(J.target!==Q||!HM.includes(J.key))return;J.preventDefault();const re=k().filter(ee=>!ee.disabled).map(ee=>ee.ref.current);iw.includes(J.key)&&re.reverse(),dA(re)}),onBlur:Re(e.onBlur,J=>{J.currentTarget.contains(J.target)||(window.clearTimeout(he.current),ve.current="")}),onPointerMove:Re(e.onPointerMove,Ys(J=>{const W=J.target,z=me.current!==J.clientX;if(J.currentTarget.contains(W)&&z){const j=J.clientX>me.current?"right":"left";ae.current=j,me.current=J.clientX}}))})})})})})})});dw.displayName=er;var nA="MenuGroup",wp=x.forwardRef((e,n)=>{const{__scopeMenu:r,...i}=e;return g.jsx($e.div,{role:"group",...i,ref:n})});wp.displayName=nA;var rA="MenuLabel",fw=x.forwardRef((e,n)=>{const{__scopeMenu:r,...i}=e;return g.jsx($e.div,{...i,ref:n})});fw.displayName=rA;var cu="MenuItem",Lb="menu.itemSelect",Du=x.forwardRef((e,n)=>{const{disabled:r=!1,onSelect:i,...s}=e,l=x.useRef(null),u=fl(cu,e.__scopeMenu),d=xp(cu,e.__scopeMenu),m=it(n,l),h=x.useRef(!1),y=()=>{const v=l.current;if(!r&&v){const b=new CustomEvent(Lb,{bubbles:!0,cancelable:!0});v.addEventListener(Lb,S=>i?.(S),{once:!0}),uS(v,b),b.defaultPrevented?h.current=!1:u.onClose()}};return g.jsx(hw,{...s,ref:m,disabled:r,onClick:Re(e.onClick,y),onPointerDown:v=>{e.onPointerDown?.(v),h.current=!0},onPointerUp:Re(e.onPointerUp,v=>{h.current||v.currentTarget?.click()}),onKeyDown:Re(e.onKeyDown,v=>{r||v.target!==v.currentTarget||d.searchRef.current!==""&&v.key===" "||pm.includes(v.key)&&(v.currentTarget.click(),v.preventDefault())})})});Du.displayName=cu;var hw=x.forwardRef((e,n)=>{const{__scopeMenu:r,disabled:i=!1,textValue:s,...l}=e,u=xp(cu,r),d=sw(r),m=x.useRef(null),h=it(n,m),[y,v]=x.useState(!1),[b,S]=x.useState("");return x.useEffect(()=>{const _=m.current;_&&S((_.textContent??"").trim())},[l.children]),g.jsx(Ks.ItemSlot,{scope:r,disabled:i,textValue:s??b,children:g.jsx(PM,{asChild:!0,...d,focusable:!i,children:g.jsx($e.div,{role:"menuitem","data-highlighted":y?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...l,ref:h,onPointerMove:Re(e.onPointerMove,Ys(_=>{i?u.onItemLeave(_):(u.onItemEnter(_),_.defaultPrevented||_.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Re(e.onPointerLeave,Ys(_=>u.onItemLeave(_))),onFocus:Re(e.onFocus,()=>v(!0)),onBlur:Re(e.onBlur,()=>v(!1))})})})}),oA="MenuCheckboxItem",mw=x.forwardRef((e,n)=>{const{checked:r=!1,onCheckedChange:i,...s}=e;return g.jsx(bw,{scope:e.__scopeMenu,checked:r,children:g.jsx(Du,{role:"menuitemcheckbox","aria-checked":uu(r)?"mixed":r,...s,ref:n,"data-state":Cp(r),onSelect:Re(s.onSelect,()=>i?.(uu(r)?!0:!r),{checkForDefaultPrevented:!1})})})});mw.displayName=oA;var pw="MenuRadioGroup",[iA,aA]=Si(pw,{value:void 0,onValueChange:()=>{}}),gw=x.forwardRef((e,n)=>{const{value:r,onValueChange:i,...s}=e,l=tr(i);return g.jsx(iA,{scope:e.__scopeMenu,value:r,onValueChange:l,children:g.jsx(wp,{...s,ref:n})})});gw.displayName=pw;var vw="MenuRadioItem",yw=x.forwardRef((e,n)=>{const{value:r,...i}=e,s=aA(vw,e.__scopeMenu),l=r===s.value;return g.jsx(bw,{scope:e.__scopeMenu,checked:l,children:g.jsx(Du,{role:"menuitemradio","aria-checked":l,...i,ref:n,"data-state":Cp(l),onSelect:Re(i.onSelect,()=>s.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});yw.displayName=vw;var _p="MenuItemIndicator",[bw,sA]=Si(_p,{checked:!1}),xw=x.forwardRef((e,n)=>{const{__scopeMenu:r,forceMount:i,...s}=e,l=sA(_p,r);return g.jsx(pr,{present:i||uu(l.checked)||l.checked===!0,children:g.jsx($e.span,{...s,ref:n,"data-state":Cp(l.checked)})})});xw.displayName=_p;var lA="MenuSeparator",Sw=x.forwardRef((e,n)=>{const{__scopeMenu:r,...i}=e;return g.jsx($e.div,{role:"separator","aria-orientation":"horizontal",...i,ref:n})});Sw.displayName=lA;var cA="MenuArrow",ww=x.forwardRef((e,n)=>{const{__scopeMenu:r,...i}=e,s=Nu(r);return g.jsx(vp,{...s,...i,ref:n})});ww.displayName=cA;var uA="MenuSub",[M$,_w]=Si(uA),Ls="MenuSubTrigger",Cw=x.forwardRef((e,n)=>{const r=wi(Ls,e.__scopeMenu),i=fl(Ls,e.__scopeMenu),s=_w(Ls,e.__scopeMenu),l=xp(Ls,e.__scopeMenu),u=x.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:m}=l,h={__scopeMenu:e.__scopeMenu},y=x.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);x.useEffect(()=>y,[y]),x.useEffect(()=>{const b=d.current;return()=>{window.clearTimeout(b),m(null)}},[d,m]);const v=it(n,s.onTriggerChange);return g.jsx(yp,{asChild:!0,...h,children:g.jsx(hw,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?s.contentId:void 0,"data-state":Tw(r.open),...e,ref:v,onClick:b=>{e.onClick?.(b),!(e.disabled||b.defaultPrevented)&&(b.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Re(e.onPointerMove,Ys(b=>{l.onItemEnter(b),!b.defaultPrevented&&!e.disabled&&!r.open&&!u.current&&(l.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{r.onOpenChange(!0),y()},100))})),onPointerLeave:Re(e.onPointerLeave,Ys(b=>{y();const S=r.content?.getBoundingClientRect();if(S){const _=r.content?.dataset.side,C=_==="right",E=C?-5:5,T=S[C?"left":"right"],O=S[C?"right":"left"];l.onPointerGraceIntentChange({area:[{x:b.clientX+E,y:b.clientY},{x:T,y:S.top},{x:O,y:S.top},{x:O,y:S.bottom},{x:T,y:S.bottom}],side:_}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(b),b.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:Re(e.onKeyDown,b=>{e.disabled||b.target!==b.currentTarget||l.searchRef.current!==""&&b.key===" "||BM[i.dir].includes(b.key)&&(r.onOpenChange(!0),r.content?.focus(),b.preventDefault())})})})});Cw.displayName=Ls;var Ew="MenuSubContent",Rw=x.forwardRef((e,n)=>{const r=cw(er,e.__scopeMenu),{forceMount:i=r.forceMount,align:s="start",...l}=e,u=wi(er,e.__scopeMenu),d=fl(er,e.__scopeMenu),m=_w(Ew,e.__scopeMenu),h=x.useRef(null),y=it(n,h);return g.jsx(Ks.Provider,{scope:e.__scopeMenu,children:g.jsx(pr,{present:i||u.open,children:g.jsx(Ks.Slot,{scope:e.__scopeMenu,children:g.jsx(Sp,{id:m.contentId,"aria-labelledby":m.triggerId,...l,ref:y,align:s,side:d.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:v=>{d.isUsingKeyboardRef.current&&h.current?.focus(),v.preventDefault()},onCloseAutoFocus:v=>v.preventDefault(),onFocusOutside:Re(e.onFocusOutside,v=>{v.target!==m.trigger&&u.onOpenChange(!1)}),onEscapeKeyDown:Re(e.onEscapeKeyDown,v=>{d.onClose(),v.preventDefault()}),onKeyDown:Re(e.onKeyDown,v=>{const b=v.currentTarget.contains(v.target),S=qM[d.dir].includes(v.key);b&&S&&(u.onOpenChange(!1),m.trigger?.focus(),v.preventDefault())})})})})})});Rw.displayName=Ew;function Tw(e){return e?"open":"closed"}function uu(e){return e==="indeterminate"}function Cp(e){return uu(e)?"indeterminate":e?"checked":"unchecked"}function dA(e){const n=document.activeElement;for(const r of e)if(r===n||(r.focus(),document.activeElement!==n))return}function fA(e,n){return e.map((r,i)=>e[(n+i)%e.length])}function hA(e,n,r){const s=n.length>1&&Array.from(n).every(h=>h===n[0])?n[0]:n,l=r?e.indexOf(r):-1;let u=fA(e,Math.max(l,0));s.length===1&&(u=u.filter(h=>h!==r));const m=u.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return m!==r?m:void 0}function mA(e,n){const{x:r,y:i}=e;let s=!1;for(let l=0,u=n.length-1;li!=b>i&&r<(v-h)*(i-y)/(b-y)+h&&(s=!s)}return s}function pA(e,n){if(!n)return!1;const r={x:e.clientX,y:e.clientY};return mA(r,n)}function Ys(e){return n=>n.pointerType==="mouse"?e(n):void 0}var gA=lw,vA=yp,yA=uw,bA=dw,xA=wp,SA=fw,wA=Du,_A=mw,CA=gw,EA=yw,RA=xw,TA=Sw,OA=ww,MA=Cw,AA=Rw,ku="DropdownMenu",[jA]=$o(ku,[aw]),vn=aw(),[zA,Ow]=jA(ku),Mw=e=>{const{__scopeDropdownMenu:n,children:r,dir:i,open:s,defaultOpen:l,onOpenChange:u,modal:d=!0}=e,m=vn(n),h=x.useRef(null),[y,v]=za({prop:s,defaultProp:l??!1,onChange:u,caller:ku});return g.jsx(zA,{scope:n,triggerId:hn(),triggerRef:h,contentId:hn(),open:y,onOpenChange:v,onOpenToggle:x.useCallback(()=>v(b=>!b),[v]),modal:d,children:g.jsx(gA,{...m,open:y,onOpenChange:v,dir:i,modal:d,children:r})})};Mw.displayName=ku;var Aw="DropdownMenuTrigger",jw=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,disabled:i=!1,...s}=e,l=Ow(Aw,r),u=vn(r),d=it(n,l.triggerRef);return g.jsx(vA,{asChild:!0,...u,children:g.jsx($e.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":i?"":void 0,disabled:i,...s,ref:d,onPointerDown:Re(e.onPointerDown,m=>{!i&&m.button===0&&m.ctrlKey===!1&&(l.onOpenToggle(),l.open||m.preventDefault())}),onKeyDown:Re(e.onKeyDown,m=>{i||(["Enter"," "].includes(m.key)&&l.onOpenToggle(),m.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(m.key)&&m.preventDefault())})})})});jw.displayName=Aw;var NA="DropdownMenuPortal",zw=e=>{const{__scopeDropdownMenu:n,...r}=e,i=vn(n);return g.jsx(yA,{...i,...r})};zw.displayName=NA;var Nw="DropdownMenuContent",Dw=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=Ow(Nw,r),l=vn(r),u=x.useRef(!1);return g.jsx(bA,{id:s.contentId,"aria-labelledby":s.triggerId,...l,...i,ref:n,onCloseAutoFocus:Re(e.onCloseAutoFocus,d=>{u.current||s.triggerRef.current?.focus(),u.current=!1,d.preventDefault()}),onInteractOutside:Re(e.onInteractOutside,d=>{const m=d.detail.originalEvent,h=m.button===0&&m.ctrlKey===!0,y=m.button===2||h;(!s.modal||y)&&(u.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Dw.displayName=Nw;var DA="DropdownMenuGroup",kA=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return g.jsx(xA,{...s,...i,ref:n})});kA.displayName=DA;var LA="DropdownMenuLabel",kw=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return g.jsx(SA,{...s,...i,ref:n})});kw.displayName=LA;var IA="DropdownMenuItem",Lw=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return g.jsx(wA,{...s,...i,ref:n})});Lw.displayName=IA;var $A="DropdownMenuCheckboxItem",VA=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return g.jsx(_A,{...s,...i,ref:n})});VA.displayName=$A;var FA="DropdownMenuRadioGroup",PA=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return g.jsx(CA,{...s,...i,ref:n})});PA.displayName=FA;var UA="DropdownMenuRadioItem",HA=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return g.jsx(EA,{...s,...i,ref:n})});HA.displayName=UA;var BA="DropdownMenuItemIndicator",qA=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return g.jsx(RA,{...s,...i,ref:n})});qA.displayName=BA;var GA="DropdownMenuSeparator",ZA=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return g.jsx(TA,{...s,...i,ref:n})});ZA.displayName=GA;var KA="DropdownMenuArrow",YA=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return g.jsx(OA,{...s,...i,ref:n})});YA.displayName=KA;var QA="DropdownMenuSubTrigger",XA=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return g.jsx(MA,{...s,...i,ref:n})});XA.displayName=QA;var JA="DropdownMenuSubContent",WA=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return g.jsx(AA,{...s,...i,ref:n,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});WA.displayName=JA;var ej=Mw,tj=jw,nj=zw,rj=Dw,oj=kw,ij=Lw,aj="Label",Iw=x.forwardRef((e,n)=>g.jsx($e.label,{...e,ref:n,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Iw.displayName=aj;var sj=Iw;function Ib(e,[n,r]){return Math.min(r,Math.max(n,e))}var lj=[" ","Enter","ArrowUp","ArrowDown"],cj=[" ","Enter"],gi="Select",[Lu,Iu,uj]=Km(gi),[_i]=$o(gi,[uj,Ia]),$u=Ia(),[dj,Fo]=_i(gi),[fj,hj]=_i(gi),mj="SelectProvider";function $w(e){const{__scopeSelect:n,children:r,open:i,defaultOpen:s,onOpenChange:l,value:u,defaultValue:d,onValueChange:m,dir:h,name:y,autoComplete:v,disabled:b,required:S,form:_,internal_do_not_use_render:C}=e,E=$u(n),[T,O]=x.useState(null),[M,k]=x.useState(null),[L,q]=x.useState(!1),H=Ym(h),[$,he]=za({prop:i,defaultProp:s??!1,onChange:l,caller:gi}),[ve,de]=za({prop:u,defaultProp:d,onChange:m,caller:gi}),le=x.useRef(null),ae=x.useRef(ve);x.useEffect(()=>{const j=_?T?.ownerDocument.getElementById(_):T?.form;if(j instanceof HTMLFormElement){const U=()=>de(ae.current);return j.addEventListener("reset",U),()=>j.removeEventListener("reset",U)}},[_,T,de]);const me=T?!!_||!!T.closest("form"):!0,[ye,D]=x.useState(new Set),Y=hn(),ne=Array.from(ye).map(j=>j.props.value).join(";"),J=x.useCallback(j=>{D(U=>new Set(U).add(j))},[]),W=x.useCallback(j=>{D(U=>{const Q=new Set(U);return Q.delete(j),Q})},[]),z={required:S,trigger:T,onTriggerChange:O,valueNode:M,onValueNodeChange:k,valueNodeHasChildren:L,onValueNodeHasChildrenChange:q,contentId:Y,value:ve,onValueChange:de,open:$,onOpenChange:he,dir:H,triggerPointerDownPosRef:le,disabled:b,name:y,autoComplete:v,form:_,nativeOptions:ye,nativeSelectKey:ne,isFormControl:me};return g.jsx(mp,{...E,children:g.jsx(dj,{scope:n,...z,children:g.jsx(Lu.Provider,{scope:n,children:g.jsx(fj,{scope:n,onNativeOptionAdd:J,onNativeOptionRemove:W,children:jj(C)?C(z):r})})})})}$w.displayName=mj;var Vw=e=>{const{__scopeSelect:n,children:r,...i}=e;return g.jsx($w,{__scopeSelect:n,...i,internal_do_not_use_render:({isFormControl:s})=>g.jsxs(g.Fragment,{children:[r,s?g.jsx(d1,{__scopeSelect:n}):null]})})};Vw.displayName=gi;var Fw="SelectTrigger",Pw=x.forwardRef((e,n)=>{const{__scopeSelect:r,disabled:i=!1,...s}=e,l=$u(r),u=Fo(Fw,r),d=u.disabled||i,m=it(n,u.onTriggerChange),h=Iu(r),y=x.useRef("touch"),[v,b,S]=f1(C=>{const E=h().filter(M=>!M.disabled),T=E.find(M=>M.value===u.value),O=h1(E,C,T);O!==void 0&&u.onValueChange(O.value)}),_=C=>{d||(u.onOpenChange(!0),S()),C&&(u.triggerPointerDownPosRef.current={x:Math.round(C.pageX),y:Math.round(C.pageY)})};return g.jsx(pp,{asChild:!0,...l,children:g.jsx($e.button,{type:"button",role:"combobox","aria-controls":u.open?u.contentId:void 0,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":Vu(u.value)?"":void 0,...s,ref:m,onClick:Re(s.onClick,C=>{C.currentTarget.focus(),y.current!=="mouse"&&_(C)}),onPointerDown:Re(s.onPointerDown,C=>{y.current=C.pointerType;const E=C.target;E.hasPointerCapture(C.pointerId)&&E.releasePointerCapture(C.pointerId),C.button===0&&C.ctrlKey===!1&&C.pointerType==="mouse"&&(_(C),C.preventDefault())}),onKeyDown:Re(s.onKeyDown,C=>{const E=v.current!=="";!(C.ctrlKey||C.altKey||C.metaKey)&&C.key.length===1&&b(C.key),!(E&&C.key===" ")&&lj.includes(C.key)&&(_(),C.preventDefault())})})})});Pw.displayName=Fw;var Uw="SelectValue",Hw=x.forwardRef((e,n)=>{const{__scopeSelect:r,className:i,style:s,children:l,placeholder:u="",...d}=e,m=Fo(Uw,r),{onValueNodeHasChildrenChange:h}=m,y=l!==void 0,v=it(n,m.onValueNodeChange);Qt(()=>{h(y)},[h,y]);const b=Vu(m.value);return g.jsx($e.span,{...d,asChild:b?!1:d.asChild,ref:v,style:{pointerEvents:"none"},children:g.jsx(x.Fragment,{children:b?u:l},b?"placeholder":"value")})});Hw.displayName=Uw;var pj="SelectIcon",Bw=x.forwardRef((e,n)=>{const{__scopeSelect:r,children:i,...s}=e;return g.jsx($e.span,{"aria-hidden":!0,...s,ref:n,children:i||"▼"})});Bw.displayName=pj;var qw="SelectPortal",[gj,vj]=_i(qw,{forceMount:void 0}),Gw=e=>{const{__scopeSelect:n,forceMount:r,...i}=e;return g.jsx(gj,{scope:e.__scopeSelect,forceMount:r,children:g.jsx(cl,{asChild:!0,...i})})};Gw.displayName=qw;var ko="SelectContent",Zw=x.forwardRef((e,n)=>{const r=vj(ko,e.__scopeSelect),{forceMount:i=r.forceMount,...s}=e,l=Fo(ko,e.__scopeSelect),[u,d]=x.useState();return Qt(()=>{d(new DocumentFragment)},[]),g.jsx(pr,{present:i||l.open,children:({present:m})=>m?g.jsx(Qw,{...s,ref:n}):g.jsx(Kw,{...s,fragment:u})})});Zw.displayName=ko;var Kw=x.forwardRef((e,n)=>{const{__scopeSelect:r,children:i,fragment:s}=e;return s?xi.createPortal(g.jsx(Yw,{scope:r,children:g.jsx(Lu.Slot,{scope:r,children:g.jsx("div",{ref:n,children:i})})}),s):null});Kw.displayName="SelectContentFragment";var ur=10,[Yw,Po]=_i(ko),yj="SelectContentImpl",bj=hi("SelectContent.RemoveScroll"),Qw=x.forwardRef((e,n)=>{const{__scopeSelect:r}=e,{position:i="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:l,onPointerDownOutside:u,side:d,sideOffset:m,align:h,alignOffset:y,arrowPadding:v,collisionBoundary:b,collisionPadding:S,sticky:_,hideWhenDetached:C,avoidCollisions:E,...T}=e,O=Fo(ko,r),[M,k]=x.useState(null),[L,q]=x.useState(null),H=it(n,k),[$,he]=x.useState(null),[ve,de]=x.useState(null),le=Iu(r),[ae,me]=x.useState(!1),ye=x.useRef(!1);x.useEffect(()=>{if(M)return Jm(M)},[M]),Xm();const D=x.useCallback(ee=>{const[ge,...be]=le().map(Ue=>Ue.ref.current),[De]=be.slice(-1),Ve=document.activeElement;for(const Ue of ee)if(Ue===Ve||(Ue?.scrollIntoView({block:"nearest"}),Ue===ge&&L&&(L.scrollTop=0),Ue===De&&L&&(L.scrollTop=L.scrollHeight),Ue?.focus(),document.activeElement!==Ve))return},[le,L]),Y=x.useCallback(()=>D([$,M]),[D,$,M]);x.useEffect(()=>{ae&&Y()},[ae,Y]);const{onOpenChange:ne,triggerPointerDownPosRef:J}=O;x.useEffect(()=>{if(M){let ee={x:0,y:0};const ge=De=>{ee={x:Math.abs(Math.round(De.pageX)-(J.current?.x??0)),y:Math.abs(Math.round(De.pageY)-(J.current?.y??0))}},be=De=>{ee.x<=10&&ee.y<=10?De.preventDefault():De.composedPath().includes(M)||ne(!1),document.removeEventListener("pointermove",ge),J.current=null};return J.current!==null&&(document.addEventListener("pointermove",ge),document.addEventListener("pointerup",be,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ge),document.removeEventListener("pointerup",be,{capture:!0})}}},[M,ne,J]),x.useEffect(()=>{const ee=()=>ne(!1);return window.addEventListener("blur",ee),window.addEventListener("resize",ee),()=>{window.removeEventListener("blur",ee),window.removeEventListener("resize",ee)}},[ne]);const[W,z]=f1(ee=>{const ge=le().filter(Ve=>!Ve.disabled),be=ge.find(Ve=>Ve.ref.current===document.activeElement),De=h1(ge,ee,be);De&&setTimeout(()=>De.ref.current?.focus())}),j=x.useCallback((ee,ge,be)=>{const De=!ye.current&&!be;(O.value!==void 0&&O.value===ge||De)&&(he(ee),De&&(ye.current=!0))},[O.value]),U=x.useCallback(()=>M?.focus(),[M]),Q=x.useCallback((ee,ge,be)=>{const De=!ye.current&&!be;(O.value!==void 0&&O.value===ge||De)&&de(ee)},[O.value]),Z=i==="popper"?gm:Xw,re=Z===gm?{side:d,sideOffset:m,align:h,alignOffset:y,arrowPadding:v,collisionBoundary:b,collisionPadding:S,sticky:_,hideWhenDetached:C,avoidCollisions:E}:{};return g.jsx(Yw,{scope:r,content:M,viewport:L,onViewportChange:q,itemRefCallback:j,selectedItem:$,onItemLeave:U,itemTextRefCallback:Q,focusSelectedItem:Y,selectedItemText:ve,position:i,isPositioned:ae,searchRef:W,children:g.jsx(Ru,{as:bj,allowPinchZoom:!0,children:g.jsx(Cu,{asChild:!0,trapped:O.open,onMountAutoFocus:ee=>{ee.preventDefault()},onUnmountAutoFocus:Re(s,ee=>{O.trigger?.focus({preventScroll:!0}),ee.preventDefault()}),children:g.jsx(ll,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:ee=>ee.preventDefault(),onDismiss:()=>O.onOpenChange(!1),children:g.jsx(Z,{role:"listbox",id:O.contentId,"data-state":O.open?"open":"closed",dir:O.dir,onContextMenu:ee=>ee.preventDefault(),...T,...re,onPlaced:()=>me(!0),ref:H,style:{display:"flex",flexDirection:"column",outline:"none",...T.style},onKeyDown:Re(T.onKeyDown,ee=>{const ge=ee.ctrlKey||ee.altKey||ee.metaKey;if(ee.key==="Tab"&&ee.preventDefault(),!ge&&ee.key.length===1&&z(ee.key),["ArrowUp","ArrowDown","Home","End"].includes(ee.key)){let De=le().filter(Ve=>!Ve.disabled).map(Ve=>Ve.ref.current);if(["ArrowUp","End"].includes(ee.key)&&(De=De.slice().reverse()),["ArrowUp","ArrowDown"].includes(ee.key)){const Ve=ee.target,Ue=De.indexOf(Ve);De=De.slice(Ue+1)}setTimeout(()=>D(De)),ee.preventDefault()}})})})})})})});Qw.displayName=yj;var xj="SelectItemAlignedPosition",Xw=x.forwardRef((e,n)=>{const{__scopeSelect:r,onPlaced:i,...s}=e,l=Fo(ko,r),u=Po(ko,r),[d,m]=x.useState(null),[h,y]=x.useState(null),v=it(n,y),b=Iu(r),S=x.useRef(!1),_=x.useRef(!0),{viewport:C,selectedItem:E,selectedItemText:T,focusSelectedItem:O}=u,M=x.useCallback(()=>{if(l.trigger&&l.valueNode&&d&&h&&C&&E&&T){const H=l.trigger.getBoundingClientRect(),$=h.getBoundingClientRect(),he=l.valueNode.getBoundingClientRect(),ve=T.getBoundingClientRect();if(l.dir!=="rtl"){const Ve=ve.left-$.left,Ue=he.left-Ve,lt=H.left-Ue,Xe=H.width+lt,Xt=Math.max(Xe,$.width),mn=window.innerWidth-ur,qt=Ib(Ue,[ur,Math.max(ur,mn-Xt)]);d.style.minWidth=Xe+"px",d.style.left=qt+"px"}else{const Ve=$.right-ve.right,Ue=window.innerWidth-he.right-Ve,lt=window.innerWidth-H.right-Ue,Xe=H.width+lt,Xt=Math.max(Xe,$.width),mn=window.innerWidth-ur,qt=Ib(Ue,[ur,Math.max(ur,mn-Xt)]);d.style.minWidth=Xe+"px",d.style.right=qt+"px"}const de=b(),le=window.innerHeight-ur*2,ae=C.scrollHeight,me=window.getComputedStyle(h),ye=parseInt(me.borderTopWidth,10),D=parseInt(me.paddingTop,10),Y=parseInt(me.borderBottomWidth,10),ne=parseInt(me.paddingBottom,10),J=ye+D+ae+ne+Y,W=Math.min(E.offsetHeight*5,J),z=window.getComputedStyle(C),j=parseInt(z.paddingTop,10),U=parseInt(z.paddingBottom,10),Q=H.top+H.height/2-ur,Z=le-Q,re=E.offsetHeight/2,ee=E.offsetTop+re,ge=ye+D+ee,be=J-ge;if(ge<=Q){const Ve=de.length>0&&E===de[de.length-1].ref.current;d.style.bottom="0px";const Ue=h.clientHeight-C.offsetTop-C.offsetHeight,lt=Math.max(Z,re+(Ve?U:0)+Ue+Y),Xe=ge+lt;d.style.height=Xe+"px"}else{const Ve=de.length>0&&E===de[0].ref.current;d.style.top="0px";const lt=Math.max(Q,ye+C.offsetTop+(Ve?j:0)+re)+be;d.style.height=lt+"px",C.scrollTop=ge-Q+C.offsetTop}d.style.margin=`${ur}px 0`,d.style.minHeight=W+"px",d.style.maxHeight=le+"px",i?.(),requestAnimationFrame(()=>S.current=!0)}},[b,l.trigger,l.valueNode,d,h,C,E,T,l.dir,i]);Qt(()=>M(),[M]);const[k,L]=x.useState();Qt(()=>{h&&L(window.getComputedStyle(h).zIndex)},[h]);const q=x.useCallback(H=>{H&&_.current===!0&&(M(),O?.(),_.current=!1)},[M,O]);return g.jsx(wj,{scope:r,contentWrapper:d,shouldExpandOnScrollRef:S,onScrollButtonChange:q,children:g.jsx("div",{ref:m,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:g.jsx($e.div,{...s,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Xw.displayName=xj;var Sj="SelectPopperPosition",gm=x.forwardRef((e,n)=>{const{__scopeSelect:r,align:i="start",collisionPadding:s=ur,...l}=e,u=$u(r);return g.jsx(gp,{...u,...l,ref:n,align:i,collisionPadding:s,style:{boxSizing:"border-box",...l.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});gm.displayName=Sj;var[wj,Ep]=_i(ko,{}),vm="SelectViewport",Jw=x.forwardRef((e,n)=>{const{__scopeSelect:r,nonce:i,...s}=e,l=Po(vm,r),u=Ep(vm,r),d=it(n,l.onViewportChange),m=x.useRef(0);return g.jsxs(g.Fragment,{children:[g.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),g.jsx(Lu.Slot,{scope:r,children:g.jsx($e.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Re(s.onScroll,h=>{const y=h.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:b}=u;if(b?.current&&v){const S=Math.abs(m.current-y.scrollTop);if(S>0){const _=window.innerHeight-ur*2,C=parseFloat(v.style.minHeight),E=parseFloat(v.style.height),T=Math.max(C,E);if(T<_){const O=T+S,M=Math.min(_,O),k=O-M;v.style.height=M+"px",v.style.bottom==="0px"&&(y.scrollTop=k>0?k:0,v.style.justifyContent="flex-end")}}}m.current=y.scrollTop})})})]})});Jw.displayName=vm;var Ww="SelectGroup",[_j,Cj]=_i(Ww),Ej=x.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e,s=hn();return g.jsx(_j,{scope:r,id:s,children:g.jsx($e.div,{role:"group","aria-labelledby":s,...i,ref:n})})});Ej.displayName=Ww;var e1="SelectLabel",Rj=x.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e,s=Cj(e1,r);return g.jsx($e.div,{id:s.id,...i,ref:n})});Rj.displayName=e1;var du="SelectItem",[Tj,t1]=_i(du),n1=x.forwardRef((e,n)=>{const{__scopeSelect:r,value:i,disabled:s=!1,textValue:l,...u}=e,d=Fo(du,r),m=Po(du,r),h=d.value===i,[y,v]=x.useState(l??""),[b,S]=x.useState(!1),_=tr(M=>m.itemRefCallback?.(M,i,s)),C=it(n,_),E=hn(),T=x.useRef("touch"),O=()=>{s||(d.onValueChange(i),d.onOpenChange(!1))};return g.jsx(Tj,{scope:r,value:i,disabled:s,textId:E,isSelected:h,onItemTextChange:x.useCallback(M=>{v(k=>k||(M?.textContent??"").trim())},[]),children:g.jsx(Lu.ItemSlot,{scope:r,value:i,disabled:s,textValue:y,children:g.jsx($e.div,{role:"option","aria-labelledby":E,"data-highlighted":b?"":void 0,"aria-selected":h&&b,"data-state":h?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...u,ref:C,onFocus:Re(u.onFocus,()=>S(!0)),onBlur:Re(u.onBlur,()=>S(!1)),onClick:Re(u.onClick,()=>{T.current!=="mouse"&&O()}),onPointerUp:Re(u.onPointerUp,()=>{T.current==="mouse"&&O()}),onPointerDown:Re(u.onPointerDown,M=>{T.current=M.pointerType}),onPointerMove:Re(u.onPointerMove,M=>{T.current=M.pointerType,s?m.onItemLeave?.():T.current==="mouse"&&M.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Re(u.onPointerLeave,M=>{M.currentTarget===document.activeElement&&m.onItemLeave?.()}),onKeyDown:Re(u.onKeyDown,M=>{s||M.target!==M.currentTarget||m.searchRef?.current!==""&&M.key===" "||(cj.includes(M.key)&&O(),M.key===" "&&M.preventDefault())})})})})});n1.displayName=du;var Is="SelectItemText",r1=x.forwardRef((e,n)=>{const{__scopeSelect:r,className:i,style:s,...l}=e,u=Fo(Is,r),d=Po(Is,r),m=t1(Is,r),h=hj(Is,r),[y,v]=x.useState(null),b=tr(O=>d.itemTextRefCallback?.(O,m.value,m.disabled)),S=it(n,v,m.onItemTextChange,b),_=y?.textContent,C=x.useMemo(()=>g.jsx("option",{value:m.value,disabled:m.disabled,children:_},m.value),[m.disabled,m.value,_]),{onNativeOptionAdd:E,onNativeOptionRemove:T}=h;return Qt(()=>(E(C),()=>T(C)),[E,T,C]),g.jsxs(g.Fragment,{children:[g.jsx($e.span,{id:m.textId,...l,ref:S}),m.isSelected&&u.valueNode&&!u.valueNodeHasChildren&&!Vu(u.value)?xi.createPortal(l.children,u.valueNode):null]})});r1.displayName=Is;var o1="SelectItemIndicator",i1=x.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e;return t1(o1,r).isSelected?g.jsx($e.span,{"aria-hidden":!0,...i,ref:n}):null});i1.displayName=o1;var ym="SelectScrollUpButton",a1=x.forwardRef((e,n)=>{const r=Po(ym,e.__scopeSelect),i=Ep(ym,e.__scopeSelect),[s,l]=x.useState(!1),u=it(n,i.onScrollButtonChange);return Qt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const h=m.scrollTop>0;l(h)};const m=r.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),s?g.jsx(l1,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=r;d&&m&&(d.scrollTop=d.scrollTop-m.offsetHeight)}}):null});a1.displayName=ym;var bm="SelectScrollDownButton",s1=x.forwardRef((e,n)=>{const r=Po(bm,e.__scopeSelect),i=Ep(bm,e.__scopeSelect),[s,l]=x.useState(!1),u=it(n,i.onScrollButtonChange);return Qt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const h=m.scrollHeight-m.clientHeight,y=Math.ceil(m.scrollTop)m.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),s?g.jsx(l1,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=r;d&&m&&(d.scrollTop=d.scrollTop+m.offsetHeight)}}):null});s1.displayName=bm;var l1=x.forwardRef((e,n)=>{const{__scopeSelect:r,onAutoScroll:i,...s}=e,l=Po("SelectScrollButton",r),u=x.useRef(null),d=Iu(r),m=x.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return x.useEffect(()=>()=>m(),[m]),Qt(()=>{d().find(y=>y.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[d]),g.jsx($e.div,{"aria-hidden":!0,...s,ref:n,style:{flexShrink:0,...s.style},onPointerDown:Re(s.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(i,50))}),onPointerMove:Re(s.onPointerMove,()=>{l.onItemLeave?.(),u.current===null&&(u.current=window.setInterval(i,50))}),onPointerLeave:Re(s.onPointerLeave,()=>{m()})})}),Oj="SelectSeparator",Mj=x.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e;return g.jsx($e.div,{"aria-hidden":!0,...i,ref:n})});Mj.displayName=Oj;var c1="SelectArrow",Aj=x.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e,s=$u(r);return Po(c1,r).position==="popper"?g.jsx(vp,{...s,...i,ref:n}):null});Aj.displayName=c1;var u1="SelectBubbleInput",d1=x.forwardRef(({__scopeSelect:e,...n},r)=>{const i=Fo(u1,e),{value:s,onValueChange:l,required:u,disabled:d,name:m,autoComplete:h,form:y}=i,{nativeOptions:v,nativeSelectKey:b}=i,S=x.useRef(null),_=it(r,S),C=s??"",E=dO(C),T=Array.from(v).some(O=>(O.props.value??"")==="");return x.useEffect(()=>{const O=S.current;if(!O)return;const M=window.HTMLSelectElement.prototype,L=Object.getOwnPropertyDescriptor(M,"value").set;if(E!==C&&L){const q=new Event("change",{bubbles:!0});L.call(O,C),O.dispatchEvent(q)}},[E,C]),g.jsxs($e.select,{"aria-hidden":!0,required:u,tabIndex:-1,name:m,autoComplete:h,disabled:d,form:y,onChange:O=>l(O.target.value),...n,style:{...dS,...n.style},ref:_,defaultValue:C,children:[Vu(s)&&!T?g.jsx("option",{value:""}):null,Array.from(v)]},b)});d1.displayName=u1;function jj(e){return typeof e=="function"}function Vu(e){return e===""||e===void 0}function f1(e){const n=tr(e),r=x.useRef(""),i=x.useRef(0),s=x.useCallback(u=>{const d=r.current+u;n(d),(function m(h){r.current=h,window.clearTimeout(i.current),h!==""&&(i.current=window.setTimeout(()=>m(""),1e3))})(d)},[n]),l=x.useCallback(()=>{r.current="",window.clearTimeout(i.current)},[]);return x.useEffect(()=>()=>window.clearTimeout(i.current),[]),[r,s,l]}function h1(e,n,r){const s=n.length>1&&Array.from(n).every(h=>h===n[0])?n[0]:n,l=r?e.indexOf(r):-1;let u=zj(e,Math.max(l,0));s.length===1&&(u=u.filter(h=>h!==r));const m=u.find(h=>h.textValue.toLowerCase().startsWith(s.toLowerCase()));return m!==r?m:void 0}function zj(e,n){return e.map((r,i)=>e[(n+i)%e.length])}var Nj="Separator",$b="horizontal",Dj=["horizontal","vertical"],m1=x.forwardRef((e,n)=>{const{decorative:r,orientation:i=$b,...s}=e,l=kj(i)?i:$b,d=r?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return g.jsx($e.div,{"data-orientation":l,...d,...s,ref:n})});m1.displayName=Nj;function kj(e){return Dj.includes(e)}var Lj=m1,[Fu]=$o("Tooltip",[Ia]),Pu=Ia(),p1="TooltipProvider",Ij=700,xm="tooltip.open",[$j,Rp]=Fu(p1),g1=e=>{const{__scopeTooltip:n,delayDuration:r=Ij,skipDelayDuration:i=300,disableHoverableContent:s=!1,children:l}=e,u=x.useRef(!0),d=x.useRef(!1),m=x.useRef(0);return x.useEffect(()=>{const h=m.current;return()=>window.clearTimeout(h)},[]),g.jsx($j,{scope:n,isOpenDelayedRef:u,delayDuration:r,onOpen:x.useCallback(()=>{i<=0||(window.clearTimeout(m.current),u.current=!1)},[i]),onClose:x.useCallback(()=>{i<=0||(window.clearTimeout(m.current),m.current=window.setTimeout(()=>u.current=!0,i))},[i]),isPointerInTransitRef:d,onPointerInTransitChange:x.useCallback(h=>{d.current=h},[]),disableHoverableContent:s,children:l})};g1.displayName=p1;var Qs="Tooltip",[Vj,hl]=Fu(Qs),v1=e=>{const{__scopeTooltip:n,children:r,open:i,defaultOpen:s,onOpenChange:l,disableHoverableContent:u,delayDuration:d}=e,m=Rp(Qs,e.__scopeTooltip),h=Pu(n),[y,v]=x.useState(null),b=hn(),S=x.useRef(0),_=u??m.disableHoverableContent,C=d??m.delayDuration,E=x.useRef(!1),[T,O]=za({prop:i,defaultProp:s??!1,onChange:H=>{H?(m.onOpen(),document.dispatchEvent(new CustomEvent(xm))):m.onClose(),l?.(H)},caller:Qs}),M=x.useMemo(()=>T?E.current?"delayed-open":"instant-open":"closed",[T]),k=x.useCallback(()=>{window.clearTimeout(S.current),S.current=0,E.current=!1,O(!0)},[O]),L=x.useCallback(()=>{window.clearTimeout(S.current),S.current=0,O(!1)},[O]),q=x.useCallback(()=>{window.clearTimeout(S.current),S.current=window.setTimeout(()=>{E.current=!0,O(!0),S.current=0},C)},[C,O]);return x.useEffect(()=>()=>{S.current&&(window.clearTimeout(S.current),S.current=0)},[]),g.jsx(mp,{...h,children:g.jsx(Vj,{scope:n,contentId:b,open:T,stateAttribute:M,trigger:y,onTriggerChange:v,onTriggerEnter:x.useCallback(()=>{m.isOpenDelayedRef.current?q():k()},[m.isOpenDelayedRef,q,k]),onTriggerLeave:x.useCallback(()=>{_?L():(window.clearTimeout(S.current),S.current=0)},[L,_]),onOpen:k,onClose:L,disableHoverableContent:_,children:r})})};v1.displayName=Qs;var Sm="TooltipTrigger",y1=x.forwardRef((e,n)=>{const{__scopeTooltip:r,...i}=e,s=hl(Sm,r),l=Rp(Sm,r),u=Pu(r),d=x.useRef(null),m=it(n,d,s.onTriggerChange),h=x.useRef(!1),y=x.useRef(!1),v=x.useCallback(()=>h.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),g.jsx(pp,{asChild:!0,...u,children:g.jsx($e.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...i,ref:m,onPointerMove:Re(e.onPointerMove,b=>{b.pointerType!=="touch"&&!y.current&&!l.isPointerInTransitRef.current&&(s.onTriggerEnter(),y.current=!0)}),onPointerLeave:Re(e.onPointerLeave,()=>{s.onTriggerLeave(),y.current=!1}),onPointerDown:Re(e.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:Re(e.onFocus,()=>{h.current||s.onOpen()}),onBlur:Re(e.onBlur,s.onClose),onClick:Re(e.onClick,s.onClose)})})});y1.displayName=Sm;var Tp="TooltipPortal",[Fj,Pj]=Fu(Tp,{forceMount:void 0}),b1=e=>{const{__scopeTooltip:n,forceMount:r,children:i,container:s}=e,l=hl(Tp,n);return g.jsx(Fj,{scope:n,forceMount:r,children:g.jsx(pr,{present:r||l.open,children:g.jsx(cl,{asChild:!0,container:s,children:i})})})};b1.displayName=Tp;var Da="TooltipContent",x1=x.forwardRef((e,n)=>{const r=Pj(Da,e.__scopeTooltip),{forceMount:i=r.forceMount,side:s="top",...l}=e,u=hl(Da,e.__scopeTooltip);return g.jsx(pr,{present:i||u.open,children:u.disableHoverableContent?g.jsx(S1,{side:s,...l,ref:n}):g.jsx(Uj,{side:s,...l,ref:n})})}),Uj=x.forwardRef((e,n)=>{const r=hl(Da,e.__scopeTooltip),i=Rp(Da,e.__scopeTooltip),s=x.useRef(null),l=it(n,s),[u,d]=x.useState(null),{trigger:m,onClose:h}=r,y=s.current,{onPointerInTransitChange:v}=i,b=x.useCallback(()=>{d(null),v(!1)},[v]),S=x.useCallback((_,C)=>{const E=_.currentTarget,T={x:_.clientX,y:_.clientY},O=Gj(T,E.getBoundingClientRect()),M=Zj(T,O),k=Kj(C.getBoundingClientRect()),L=Qj([...M,...k]);d(L),v(!0)},[v]);return x.useEffect(()=>()=>b(),[b]),x.useEffect(()=>{if(m&&y){const _=E=>S(E,y),C=E=>S(E,m);return m.addEventListener("pointerleave",_),y.addEventListener("pointerleave",C),()=>{m.removeEventListener("pointerleave",_),y.removeEventListener("pointerleave",C)}}},[m,y,S,b]),x.useEffect(()=>{if(u){const _=C=>{const E=C.target,T={x:C.clientX,y:C.clientY},O=m?.contains(E)||y?.contains(E),M=!Yj(T,u);O?b():M&&(b(),h())};return document.addEventListener("pointermove",_),()=>document.removeEventListener("pointermove",_)}},[m,y,u,h,b]),g.jsx(S1,{...e,ref:l})}),[Hj,Bj]=Fu(Qs,{isInside:!1}),qj=z2("TooltipContent"),S1=x.forwardRef((e,n)=>{const{__scopeTooltip:r,children:i,"aria-label":s,onEscapeKeyDown:l,onPointerDownOutside:u,...d}=e,m=hl(Da,r),h=Pu(r),{onClose:y}=m;return x.useEffect(()=>(document.addEventListener(xm,y),()=>document.removeEventListener(xm,y)),[y]),x.useEffect(()=>{if(m.trigger){const v=b=>{b.target instanceof Node&&b.target.contains(m.trigger)&&y()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[m.trigger,y]),g.jsx(ll,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:v=>v.preventDefault(),onDismiss:y,children:g.jsxs(gp,{"data-state":m.stateAttribute,...h,...d,ref:n,style:{...d.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[g.jsx(qj,{children:i}),g.jsx(Hj,{scope:r,isInside:!0,children:g.jsx(H2,{id:m.contentId,role:"tooltip",children:s||i})})]})})});x1.displayName=Da;var w1="TooltipArrow",_1=x.forwardRef((e,n)=>{const{__scopeTooltip:r,...i}=e,s=Pu(r);return Bj(w1,r).isInside?null:g.jsx(vp,{...s,...i,ref:n})});_1.displayName=w1;function Gj(e,n){const r=Math.abs(n.top-e.y),i=Math.abs(n.bottom-e.y),s=Math.abs(n.right-e.x),l=Math.abs(n.left-e.x);switch(Math.min(r,i,s,l)){case l:return"left";case s:return"right";case r:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function Zj(e,n,r=5){const i=[];switch(n){case"top":i.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":i.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":i.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":i.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return i}function Kj(e){const{top:n,right:r,bottom:i,left:s}=e;return[{x:s,y:n},{x:r,y:n},{x:r,y:i},{x:s,y:i}]}function Yj(e,n){const{x:r,y:i}=e;let s=!1;for(let l=0,u=n.length-1;li!=b>i&&r<(v-h)*(i-y)/(b-y)+h&&(s=!s)}return s}function Qj(e){const n=e.slice();return n.sort((r,i)=>r.xi.x?1:r.yi.y?1:0),Xj(n)}function Xj(e){if(e.length<=1)return e.slice();const n=[];for(let i=0;i=2;){const l=n[n.length-1],u=n[n.length-2];if((l.x-u.x)*(s.y-u.y)>=(l.y-u.y)*(s.x-u.x))n.pop();else break}n.push(s)}n.pop();const r=[];for(let i=e.length-1;i>=0;i--){const s=e[i];for(;r.length>=2;){const l=r[r.length-1],u=r[r.length-2];if((l.x-u.x)*(s.y-u.y)>=(l.y-u.y)*(s.x-u.x))r.pop();else break}r.push(s)}return r.pop(),n.length===1&&r.length===1&&n[0].x===r[0].x&&n[0].y===r[0].y?n:n.concat(r)}var Jj=g1,Wj=v1,ez=y1,tz=b1,nz=x1,rz=_1;function C1(e){var n,r,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(n=0;n{const r=new Array(e.length+n.length);for(let i=0;i({classGroupId:e,validator:n}),R1=(e=new Map,n=null,r)=>({nextPart:e,validators:n,classGroupId:r}),fu="-",Vb=[],az="arbitrary..",sz=e=>{const n=cz(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return lz(u);const d=u.split(fu),m=d[0]===""&&d.length>1?1:0;return T1(d,m,n)},getConflictingClassGroupIds:(u,d)=>{if(d){const m=i[u],h=r[u];return m?h?oz(h,m):m:h||Vb}return r[u]||Vb}}},T1=(e,n,r)=>{if(e.length-n===0)return r.classGroupId;const s=e[n],l=r.nextPart.get(s);if(l){const h=T1(e,n+1,l);if(h)return h}const u=r.validators;if(u===null)return;const d=n===0?e.join(fu):e.slice(n).join(fu),m=u.length;for(let h=0;he.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const n=e.slice(1,-1),r=n.indexOf(":"),i=n.slice(0,r);return i?az+i:void 0})(),cz=e=>{const{theme:n,classGroups:r}=e;return uz(r,n)},uz=(e,n)=>{const r=R1();for(const i in e){const s=e[i];Op(s,r,i,n)}return r},Op=(e,n,r,i)=>{const s=e.length;for(let l=0;l{if(typeof e=="string"){fz(e,n,r);return}if(typeof e=="function"){hz(e,n,r,i);return}mz(e,n,r,i)},fz=(e,n,r)=>{const i=e===""?n:O1(n,e);i.classGroupId=r},hz=(e,n,r,i)=>{if(pz(e)){Op(e(i),n,r,i);return}n.validators===null&&(n.validators=[]),n.validators.push(iz(r,e))},mz=(e,n,r,i)=>{const s=Object.entries(e),l=s.length;for(let u=0;u{let r=e;const i=n.split(fu),s=i.length;for(let l=0;l"isThemeGetter"in e&&e.isThemeGetter===!0,gz=e=>{if(e<1)return{get:()=>{},set:()=>{}};let n=0,r=Object.create(null),i=Object.create(null);const s=(l,u)=>{r[l]=u,n++,n>e&&(n=0,i=r,r=Object.create(null))};return{get(l){let u=r[l];if(u!==void 0)return u;if((u=i[l])!==void 0)return s(l,u),u},set(l,u){l in r?r[l]=u:s(l,u)}}},wm="!",Fb=":",vz=[],Pb=(e,n,r,i,s)=>({modifiers:e,hasImportantModifier:n,baseClassName:r,maybePostfixModifierPosition:i,isExternal:s}),yz=e=>{const{prefix:n,experimentalParseClassName:r}=e;let i=s=>{const l=[];let u=0,d=0,m=0,h;const y=s.length;for(let C=0;Cm?h-m:void 0;return Pb(l,S,b,_)};if(n){const s=n+Fb,l=i;i=u=>u.startsWith(s)?l(u.slice(s.length)):Pb(vz,!1,u,void 0,!0)}if(r){const s=i;i=l=>r({className:l,parseClassName:s})}return i},bz=e=>{const n=new Map;return e.orderSensitiveModifiers.forEach((r,i)=>{n.set(r,1e6+i)}),r=>{const i=[];let s=[];for(let l=0;l0&&(s.sort(),i.push(...s),s=[]),i.push(u)):s.push(u)}return s.length>0&&(s.sort(),i.push(...s)),i}},xz=e=>({cache:gz(e.cacheSize),parseClassName:yz(e),sortModifiers:bz(e),postfixLookupClassGroupIds:Sz(e),...sz(e)}),Sz=e=>{const n=Object.create(null),r=e.postfixLookupClassGroups;if(r)for(let i=0;i{const{parseClassName:r,getClassGroupId:i,getConflictingClassGroupIds:s,sortModifiers:l,postfixLookupClassGroupIds:u}=n,d=[],m=e.trim().split(wz);let h="";for(let y=m.length-1;y>=0;y-=1){const v=m[y],{isExternal:b,modifiers:S,hasImportantModifier:_,baseClassName:C,maybePostfixModifierPosition:E}=r(v);if(b){h=v+(h.length>0?" "+h:h);continue}let T=!!E,O;if(T){const H=C.substring(0,E);O=i(H);const $=O&&u[O]?i(C):void 0;$&&$!==O&&(O=$,T=!1)}else O=i(C);if(!O){if(!T){h=v+(h.length>0?" "+h:h);continue}if(O=i(C),!O){h=v+(h.length>0?" "+h:h);continue}T=!1}const M=S.length===0?"":S.length===1?S[0]:l(S).join(":"),k=_?M+wm:M,L=k+O;if(d.indexOf(L)>-1)continue;d.push(L);const q=s(O,T);for(let H=0;H0?" "+h:h)}return h},Cz=(...e)=>{let n=0,r,i,s="";for(;n{if(typeof e=="string")return e;let n,r="";for(let i=0;i{let r,i,s,l;const u=m=>{const h=n.reduce((y,v)=>v(y),e());return r=xz(h),i=r.cache.get,s=r.cache.set,l=d,d(m)},d=m=>{const h=i(m);if(h)return h;const y=_z(m,r);return s(m,y),y};return l=u,(...m)=>l(Cz(...m))},Rz=[],Bt=e=>{const n=r=>r[e]||Rz;return n.isThemeGetter=!0,n},A1=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,j1=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Tz=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Oz=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Mz=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Az=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,jz=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,zz=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,To=e=>Tz.test(e),qe=e=>!!e&&!Number.isNaN(Number(e)),Sr=e=>!!e&&Number.isInteger(Number(e)),zh=e=>e.endsWith("%")&&qe(e.slice(0,-1)),Kr=e=>Oz.test(e),z1=()=>!0,Nz=e=>Mz.test(e)&&!Az.test(e),Mp=()=>!1,Dz=e=>jz.test(e),kz=e=>zz.test(e),Lz=e=>!_e(e)&&!Ce(e),Iz=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),$z=e=>Uo(e,k1,Mp),_e=e=>A1.test(e),ui=e=>Uo(e,L1,Nz),Ub=e=>Uo(e,Gz,qe),Vz=e=>Uo(e,$1,z1),Fz=e=>Uo(e,I1,Mp),Hb=e=>Uo(e,N1,Mp),Pz=e=>Uo(e,D1,kz),Vc=e=>Uo(e,V1,Dz),Ce=e=>j1.test(e),js=e=>Ci(e,L1),Uz=e=>Ci(e,I1),Bb=e=>Ci(e,N1),Hz=e=>Ci(e,k1),Bz=e=>Ci(e,D1),Fc=e=>Ci(e,V1,!0),qz=e=>Ci(e,$1,!0),Uo=(e,n,r)=>{const i=A1.exec(e);return i?i[1]?n(i[1]):r(i[2]):!1},Ci=(e,n,r=!1)=>{const i=j1.exec(e);return i?i[1]?n(i[1]):r:!1},N1=e=>e==="position"||e==="percentage",D1=e=>e==="image"||e==="url",k1=e=>e==="length"||e==="size"||e==="bg-size",L1=e=>e==="length",Gz=e=>e==="number",I1=e=>e==="family-name",$1=e=>e==="number"||e==="weight",V1=e=>e==="shadow",Zz=()=>{const e=Bt("color"),n=Bt("font"),r=Bt("text"),i=Bt("font-weight"),s=Bt("tracking"),l=Bt("leading"),u=Bt("breakpoint"),d=Bt("container"),m=Bt("spacing"),h=Bt("radius"),y=Bt("shadow"),v=Bt("inset-shadow"),b=Bt("text-shadow"),S=Bt("drop-shadow"),_=Bt("blur"),C=Bt("perspective"),E=Bt("aspect"),T=Bt("ease"),O=Bt("animate"),M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...k(),Ce,_e],q=()=>["auto","hidden","clip","visible","scroll"],H=()=>["auto","contain","none"],$=()=>[Ce,_e,m],he=()=>[To,"full","auto",...$()],ve=()=>[Sr,"none","subgrid",Ce,_e],de=()=>["auto",{span:["full",Sr,Ce,_e]},Sr,Ce,_e],le=()=>[Sr,"auto",Ce,_e],ae=()=>["auto","min","max","fr",Ce,_e],me=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ye=()=>["start","end","center","stretch","center-safe","end-safe"],D=()=>["auto",...$()],Y=()=>[To,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...$()],ne=()=>[To,"screen","full","dvw","lvw","svw","min","max","fit",...$()],J=()=>[To,"screen","full","lh","dvh","lvh","svh","min","max","fit",...$()],W=()=>[e,Ce,_e],z=()=>[...k(),Bb,Hb,{position:[Ce,_e]}],j=()=>["no-repeat",{repeat:["","x","y","space","round"]}],U=()=>["auto","cover","contain",Hz,$z,{size:[Ce,_e]}],Q=()=>[zh,js,ui],Z=()=>["","none","full",h,Ce,_e],re=()=>["",qe,js,ui],ee=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],be=()=>[qe,zh,Bb,Hb],De=()=>["","none",_,Ce,_e],Ve=()=>["none",qe,Ce,_e],Ue=()=>["none",qe,Ce,_e],lt=()=>[qe,Ce,_e],Xe=()=>[To,"full",...$()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Kr],breakpoint:[Kr],color:[z1],container:[Kr],"drop-shadow":[Kr],ease:["in","out","in-out"],font:[Lz],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Kr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Kr],shadow:[Kr],spacing:["px",qe],text:[Kr],"text-shadow":[Kr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",To,_e,Ce,E]}],container:["container"],"container-type":[{"@container":["","normal","size",Ce,_e]}],"container-named":[Iz],columns:[{columns:[qe,_e,Ce,d]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:q()}],"overflow-x":[{"overflow-x":q()}],"overflow-y":[{"overflow-y":q()}],overscroll:[{overscroll:H()}],"overscroll-x":[{"overscroll-x":H()}],"overscroll-y":[{"overscroll-y":H()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:he()}],"inset-x":[{"inset-x":he()}],"inset-y":[{"inset-y":he()}],start:[{"inset-s":he(),start:he()}],end:[{"inset-e":he(),end:he()}],"inset-bs":[{"inset-bs":he()}],"inset-be":[{"inset-be":he()}],top:[{top:he()}],right:[{right:he()}],bottom:[{bottom:he()}],left:[{left:he()}],visibility:["visible","invisible","collapse"],z:[{z:[Sr,"auto",Ce,_e]}],basis:[{basis:[To,"full","auto",d,...$()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[qe,To,"auto","initial","none",_e]}],grow:[{grow:["",qe,Ce,_e]}],shrink:[{shrink:["",qe,Ce,_e]}],order:[{order:[Sr,"first","last","none",Ce,_e]}],"grid-cols":[{"grid-cols":ve()}],"col-start-end":[{col:de()}],"col-start":[{"col-start":le()}],"col-end":[{"col-end":le()}],"grid-rows":[{"grid-rows":ve()}],"row-start-end":[{row:de()}],"row-start":[{"row-start":le()}],"row-end":[{"row-end":le()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ae()}],"auto-rows":[{"auto-rows":ae()}],gap:[{gap:$()}],"gap-x":[{"gap-x":$()}],"gap-y":[{"gap-y":$()}],"justify-content":[{justify:[...me(),"normal"]}],"justify-items":[{"justify-items":[...ye(),"normal"]}],"justify-self":[{"justify-self":["auto",...ye()]}],"align-content":[{content:["normal",...me()]}],"align-items":[{items:[...ye(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ye(),{baseline:["","last"]}]}],"place-content":[{"place-content":me()}],"place-items":[{"place-items":[...ye(),"baseline"]}],"place-self":[{"place-self":["auto",...ye()]}],p:[{p:$()}],px:[{px:$()}],py:[{py:$()}],ps:[{ps:$()}],pe:[{pe:$()}],pbs:[{pbs:$()}],pbe:[{pbe:$()}],pt:[{pt:$()}],pr:[{pr:$()}],pb:[{pb:$()}],pl:[{pl:$()}],m:[{m:D()}],mx:[{mx:D()}],my:[{my:D()}],ms:[{ms:D()}],me:[{me:D()}],mbs:[{mbs:D()}],mbe:[{mbe:D()}],mt:[{mt:D()}],mr:[{mr:D()}],mb:[{mb:D()}],ml:[{ml:D()}],"space-x":[{"space-x":$()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":$()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],"inline-size":[{inline:["auto",...ne()]}],"min-inline-size":[{"min-inline":["auto",...ne()]}],"max-inline-size":[{"max-inline":["none",...ne()]}],"block-size":[{block:["auto",...J()]}],"min-block-size":[{"min-block":["auto",...J()]}],"max-block-size":[{"max-block":["none",...J()]}],w:[{w:[d,"screen",...Y()]}],"min-w":[{"min-w":[d,"screen","none",...Y()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[u]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",r,js,ui]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,qz,Vz]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",zh,_e]}],"font-family":[{font:[Uz,Fz,n]}],"font-features":[{"font-features":[_e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Ce,_e]}],"line-clamp":[{"line-clamp":[qe,"none",Ce,Ub]}],leading:[{leading:[l,...$()]}],"list-image":[{"list-image":["none",Ce,_e]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ce,_e]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[qe,"from-font","auto",Ce,ui]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[qe,"auto",Ce,_e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:$()}],"tab-size":[{tab:[Sr,Ce,_e]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ce,_e]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ce,_e]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:z()}],"bg-repeat":[{bg:j()}],"bg-size":[{bg:U()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Sr,Ce,_e],radial:["",Ce,_e],conic:[Sr,Ce,_e]},Bz,Pz]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:Z()}],"rounded-s":[{"rounded-s":Z()}],"rounded-e":[{"rounded-e":Z()}],"rounded-t":[{"rounded-t":Z()}],"rounded-r":[{"rounded-r":Z()}],"rounded-b":[{"rounded-b":Z()}],"rounded-l":[{"rounded-l":Z()}],"rounded-ss":[{"rounded-ss":Z()}],"rounded-se":[{"rounded-se":Z()}],"rounded-ee":[{"rounded-ee":Z()}],"rounded-es":[{"rounded-es":Z()}],"rounded-tl":[{"rounded-tl":Z()}],"rounded-tr":[{"rounded-tr":Z()}],"rounded-br":[{"rounded-br":Z()}],"rounded-bl":[{"rounded-bl":Z()}],"border-w":[{border:re()}],"border-w-x":[{"border-x":re()}],"border-w-y":[{"border-y":re()}],"border-w-s":[{"border-s":re()}],"border-w-e":[{"border-e":re()}],"border-w-bs":[{"border-bs":re()}],"border-w-be":[{"border-be":re()}],"border-w-t":[{"border-t":re()}],"border-w-r":[{"border-r":re()}],"border-w-b":[{"border-b":re()}],"border-w-l":[{"border-l":re()}],"divide-x":[{"divide-x":re()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":re()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-bs":[{"border-bs":W()}],"border-color-be":[{"border-be":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[qe,Ce,_e]}],"outline-w":[{outline:["",qe,js,ui]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",y,Fc,Vc]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",v,Fc,Vc]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[qe,ui]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":re()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",b,Fc,Vc]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[qe,Ce,_e]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[qe]}],"mask-image-linear-from-pos":[{"mask-linear-from":be()}],"mask-image-linear-to-pos":[{"mask-linear-to":be()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":be()}],"mask-image-t-to-pos":[{"mask-t-to":be()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":be()}],"mask-image-r-to-pos":[{"mask-r-to":be()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":be()}],"mask-image-b-to-pos":[{"mask-b-to":be()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":be()}],"mask-image-l-to-pos":[{"mask-l-to":be()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":be()}],"mask-image-x-to-pos":[{"mask-x-to":be()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":be()}],"mask-image-y-to-pos":[{"mask-y-to":be()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[Ce,_e]}],"mask-image-radial-from-pos":[{"mask-radial-from":be()}],"mask-image-radial-to-pos":[{"mask-radial-to":be()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[qe]}],"mask-image-conic-from-pos":[{"mask-conic-from":be()}],"mask-image-conic-to-pos":[{"mask-conic-to":be()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:z()}],"mask-repeat":[{mask:j()}],"mask-size":[{mask:U()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ce,_e]}],filter:[{filter:["","none",Ce,_e]}],blur:[{blur:De()}],brightness:[{brightness:[qe,Ce,_e]}],contrast:[{contrast:[qe,Ce,_e]}],"drop-shadow":[{"drop-shadow":["","none",S,Fc,Vc]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",qe,Ce,_e]}],"hue-rotate":[{"hue-rotate":[qe,Ce,_e]}],invert:[{invert:["",qe,Ce,_e]}],saturate:[{saturate:[qe,Ce,_e]}],sepia:[{sepia:["",qe,Ce,_e]}],"backdrop-filter":[{"backdrop-filter":["","none",Ce,_e]}],"backdrop-blur":[{"backdrop-blur":De()}],"backdrop-brightness":[{"backdrop-brightness":[qe,Ce,_e]}],"backdrop-contrast":[{"backdrop-contrast":[qe,Ce,_e]}],"backdrop-grayscale":[{"backdrop-grayscale":["",qe,Ce,_e]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[qe,Ce,_e]}],"backdrop-invert":[{"backdrop-invert":["",qe,Ce,_e]}],"backdrop-opacity":[{"backdrop-opacity":[qe,Ce,_e]}],"backdrop-saturate":[{"backdrop-saturate":[qe,Ce,_e]}],"backdrop-sepia":[{"backdrop-sepia":["",qe,Ce,_e]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":$()}],"border-spacing-x":[{"border-spacing-x":$()}],"border-spacing-y":[{"border-spacing-y":$()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ce,_e]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[qe,"initial",Ce,_e]}],ease:[{ease:["linear","initial",T,Ce,_e]}],delay:[{delay:[qe,Ce,_e]}],animate:[{animate:["none",O,Ce,_e]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[C,Ce,_e]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Ve()}],"rotate-x":[{"rotate-x":Ve()}],"rotate-y":[{"rotate-y":Ve()}],"rotate-z":[{"rotate-z":Ve()}],scale:[{scale:Ue()}],"scale-x":[{"scale-x":Ue()}],"scale-y":[{"scale-y":Ue()}],"scale-z":[{"scale-z":Ue()}],"scale-3d":["scale-3d"],skew:[{skew:lt()}],"skew-x":[{"skew-x":lt()}],"skew-y":[{"skew-y":lt()}],transform:[{transform:[Ce,_e,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Xe()}],"translate-x":[{"translate-x":Xe()}],"translate-y":[{"translate-y":Xe()}],"translate-z":[{"translate-z":Xe()}],"translate-none":["translate-none"],zoom:[{zoom:[Sr,Ce,_e]}],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ce,_e]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":W()}],"scrollbar-track-color":[{"scrollbar-track":W()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":$()}],"scroll-mx":[{"scroll-mx":$()}],"scroll-my":[{"scroll-my":$()}],"scroll-ms":[{"scroll-ms":$()}],"scroll-me":[{"scroll-me":$()}],"scroll-mbs":[{"scroll-mbs":$()}],"scroll-mbe":[{"scroll-mbe":$()}],"scroll-mt":[{"scroll-mt":$()}],"scroll-mr":[{"scroll-mr":$()}],"scroll-mb":[{"scroll-mb":$()}],"scroll-ml":[{"scroll-ml":$()}],"scroll-p":[{"scroll-p":$()}],"scroll-px":[{"scroll-px":$()}],"scroll-py":[{"scroll-py":$()}],"scroll-ps":[{"scroll-ps":$()}],"scroll-pe":[{"scroll-pe":$()}],"scroll-pbs":[{"scroll-pbs":$()}],"scroll-pbe":[{"scroll-pbe":$()}],"scroll-pt":[{"scroll-pt":$()}],"scroll-pr":[{"scroll-pr":$()}],"scroll-pb":[{"scroll-pb":$()}],"scroll-pl":[{"scroll-pl":$()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ce,_e]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[qe,js,ui,Ub]}],stroke:[{stroke:["none",...W()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Kz=Ez(Zz);function et(...e){return Kz(E1(e))}function Yz({delayDuration:e=0,...n}){return g.jsx(Jj,{"data-slot":"tooltip-provider",delayDuration:e,...n})}function Qz({...e}){return g.jsx(Wj,{"data-slot":"tooltip",...e})}function Xz({...e}){return g.jsx(ez,{"data-slot":"tooltip-trigger",...e})}function Jz({className:e,sideOffset:n=0,children:r,...i}){return g.jsx(tz,{children:g.jsxs(nz,{"data-slot":"tooltip-content",sideOffset:n,className:et("z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",e),...i,children:[r,g.jsx(rz,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}const _m=new Set;function Wz(e){return _m.add(e),()=>_m.delete(e)}function eN(){for(const e of _m)e()}const F1=(...e)=>e.filter((n,r,i)=>!!n&&n.trim()!==""&&i.indexOf(n)===r).join(" ").trim();const tN=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const nN=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,r,i)=>i?i.toUpperCase():r.toLowerCase());const qb=e=>{const n=nN(e);return n.charAt(0).toUpperCase()+n.slice(1)};var Nh={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const rN=e=>{for(const n in e)if(n.startsWith("aria-")||n==="role"||n==="title")return!0;return!1},oN=x.createContext({}),iN=()=>x.useContext(oN),aN=x.forwardRef(({color:e,size:n,strokeWidth:r,absoluteStrokeWidth:i,className:s="",children:l,iconNode:u,...d},m)=>{const{size:h=24,strokeWidth:y=2,absoluteStrokeWidth:v=!1,color:b="currentColor",className:S=""}=iN()??{},_=i??v?Number(r??y)*24/Number(n??h):r??y;return x.createElement("svg",{ref:m,...Nh,width:n??h??Nh.width,height:n??h??Nh.height,stroke:e??b,strokeWidth:_,className:F1("lucide",S,s),...!l&&!rN(d)&&{"aria-hidden":"true"},...d},[...u.map(([C,E])=>x.createElement(C,E)),...Array.isArray(l)?l:[l]])});const Ae=(e,n)=>{const r=x.forwardRef(({className:i,...s},l)=>x.createElement(aN,{ref:l,iconNode:n,className:F1(`lucide-${tN(qb(e))}`,`lucide-${e}`,i),...s}));return r.displayName=qb(e),r};const sN=[["path",{d:"M4.5 3h15",key:"c7n0jr"}],["path",{d:"M6 3v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V3",key:"m1uhx7"}],["path",{d:"M6 14h12",key:"4cwo0f"}]],lN=Ae("beaker",sN);const cN=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],uN=Ae("book-open",cN);const dN=[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]],fN=Ae("briefcase",dN);const hN=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],mN=Ae("bug",hN);const pN=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],gN=Ae("calendar",pN);const vN=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],P1=Ae("check",vN);const yN=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ap=Ae("chevron-down",yN);const bN=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],xN=Ae("chevron-right",bN);const SN=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],wN=Ae("chevron-up",SN);const _N=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],CN=Ae("circle-check",_N);const EN=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],U1=Ae("clock",EN);const RN=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],TN=Ae("code",RN);const ON=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}]],MN=Ae("compass",ON);const AN=[["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"}]],jN=Ae("copy",AN);const zN=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],NN=Ae("database",zN);const DN=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],kN=Ae("download",DN);const LN=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],IN=Ae("ellipsis",LN);const $N=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],H1=Ae("file-text",$N);const VN=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],FN=Ae("flag",VN);const PN=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],jp=Ae("folder",PN);const UN=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],HN=Ae("gauge",UN);const BN=[["path",{d:"m14 13-8.381 8.38a1 1 0 0 1-3.001-3l8.384-8.381",key:"pgg06f"}],["path",{d:"m16 16 6-6",key:"vzrcl6"}],["path",{d:"m21.5 10.5-8-8",key:"a17d9x"}],["path",{d:"m8 8 6-6",key:"18bi4p"}],["path",{d:"m8.5 7.5 8 8",key:"1oyaui"}]],qN=Ae("gavel",BN);const GN=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],B1=Ae("globe",GN);const ZN=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],KN=Ae("graduation-cap",ZN);const YN=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],QN=Ae("heart",YN);const XN=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],JN=Ae("history",XN);const WN=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],eD=Ae("image",WN);const tD=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],nD=Ae("info",tD);const rD=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],oD=Ae("layout-dashboard",rD);const iD=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],aD=Ae("lightbulb",iD);const sD=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],lD=Ae("link",sD);const cD=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],uD=Ae("loader-circle",cD);const dD=[["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"}]],q1=Ae("lock",dD);const fD=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],hD=Ae("log-out",fD);const mD=[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]],pD=Ae("megaphone",mD);const gD=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],vD=Ae("menu",gD);const yD=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],bD=Ae("music",yD);const xD=[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],SD=Ae("octagon-x",xD);const wD=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],_D=Ae("package",wD);const CD=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],ED=Ae("pen-line",CD);const RD=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],TD=Ae("plus",RD);const OD=[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]],MD=Ae("rocket",OD);const AD=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],G1=Ae("search",AD);const jD=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],zD=Ae("settings",jD);const ND=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],DD=Ae("share-2",ND);const kD=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Z1=Ae("shield",kD);const LD=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],K1=Ae("square-terminal",LD);const ID=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],$D=Ae("star",ID);const VD=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],FD=Ae("trash-2",VD);const PD=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Y1=Ae("triangle-alert",PD);const UD=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],HD=Ae("upload",UD);const BD=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Q1=Ae("users",BD);const qD=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],GD=Ae("wrench",qD);const ZD=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],X1=Ae("x",ZD);function KD(){const e=!document.body.classList.contains("sb-open");document.body.classList.toggle("sb-open"),Uu(),e?document.getElementById("sidebar")?.querySelector(YD)?.focus():document.getElementById("menu-btn")?.focus()}const YD='a[href], button:not(:disabled), select, input, [tabindex]:not([tabindex="-1"])';function fr(){const e=document.body.classList.contains("sb-open");document.body.classList.remove("sb-open"),Uu(),e&&window.innerWidth<=Wc&&document.getElementById("menu-btn")?.focus()}const Wc=900;function Uu(){const e=document.getElementById("sidebar");if(!e)return;const n=document.body.classList.contains("sb-open");window.innerWidth<=Wc&&!n?e.setAttribute("inert",""):e.removeAttribute("inert");const i=document.getElementById("main");i&&(n&&window.innerWidth<=Wc?i.setAttribute("inert",""):i.removeAttribute("inert")),e.setAttribute("aria-modal",String(n&&window.innerWidth<=Wc)),document.getElementById("menu-btn")?.setAttribute("aria-expanded",String(n))}typeof window<"u"&&(window.addEventListener("resize",Uu),window.addEventListener("keydown",e=>{e.key==="Escape"&&document.body.classList.contains("sb-open")&&fr()}));const QD={alert:Y1,check:P1,chev:xN,chevd:Ap,clock:U1,copy:jN,doc:H1,dots:IN,download:kN,folder:jp,dashboard:oD,gear:zD,globe:B1,hist:JN,link:lD,lock:q1,menu:vD,plus:TD,power:hD,search:G1,share:DD,shield:Z1,terminal:K1,trash:FD,upload:HD,users:Q1,x:X1};function Yt({name:e}){const n=QD[e];return n?g.jsx(n,{className:"ico","aria-hidden":"true"}):null}const J1={folder:jp,"book-open":uN,"file-text":H1,"pen-line":ED,users:Q1,briefcase:fN,megaphone:pD,rocket:MD,lightbulb:aD,flag:FN,star:$D,heart:QN,code:TN,"square-terminal":K1,bug:mN,wrench:GD,database:NN,package:_D,beaker:lN,gauge:HN,shield:Z1,lock:q1,gavel:qN,globe:B1,compass:MN,calendar:gN,clock:U1,"graduation-cap":KN,image:eD,music:bD};function Ta({name:e,className:n}){const r=J1[e??""]??jp;return g.jsx(r,{className:n,"aria-hidden":"true"})}function XD({size:e=22}){return g.jsxs("svg",{width:e,height:e,viewBox:"0 0 32 32",fill:"currentColor",role:"img","aria-label":"BearDrive",children:[g.jsx("rect",{x:"4",y:"4",width:"5.6",height:"24"}),g.jsx("rect",{x:"11.2",y:"4",width:"14.4",height:"11.2"}),g.jsx("rect",{x:"11.2",y:"16.8",width:"16.8",height:"11.2"})]})}function hu(e){const n=["page",e.width??"app",e.className].filter(Boolean).join(" ");return g.jsx("div",{className:n,children:e.children})}function JD(e){e&&Uu()}function Xs(e){return g.jsxs(g.Fragment,{children:[g.jsx("div",{id:"sb-backdrop",onClick:fr}),g.jsxs("aside",{id:"sidebar",ref:JD,children:[e.vault,e.projectsNav,e.tree??g.jsx("nav",{id:"tree","aria-label":"Files"}),e.orgBar]}),g.jsxs("main",{id:"main",children:[e.topbar,g.jsx("article",{id:"content",ref:e.contentRef,onScroll:e.onContentScroll,children:e.children})]})]})}function Hu(e){const{name:n,onHome:r,showSignout:i,search:s}=e;return g.jsxs("header",{id:"vault",children:[g.jsx("span",{id:"vault-badge",children:g.jsx(XD,{size:22})}),g.jsx("span",{id:"vault-name",className:r?"vault-link":void 0,onClick:r,role:r?"button":void 0,tabIndex:r?0:void 0,onKeyDown:l=>{r&&(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),r())},children:n}),g.jsxs("div",{className:"vault-actions",children:[s&&g.jsxs(Qz,{delayDuration:150,children:[g.jsx(Xz,{asChild:!0,children:g.jsx("button",{id:"search-btn",className:"icon-btn2","aria-label":"Search",onClick:()=>{eN(),fr()},children:g.jsx(Yt,{name:"search"})})}),g.jsxs(Jz,{className:"tipcard",sideOffset:6,children:["Search ",g.jsx("kbd",{children:"⌘K"})]})]}),i&&g.jsx("a",{id:"signout",href:"/auth/logout",title:"Sign out","aria-label":"Sign out",children:g.jsx(Yt,{name:"power"})})]})]})}function Js(e){return g.jsxs("header",{id:"topbar",children:[g.jsx("button",{id:"menu-btn",className:"icon-btn",title:"Menu","aria-label":"Menu","aria-controls":"sidebar","aria-expanded":"false",onClick:KD,children:g.jsx(Yt,{name:"menu"})}),g.jsx("span",{id:"crumb",children:e.crumb}),g.jsx("span",{id:"meta",children:e.meta}),e.actions]})}function WD(e){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const ek=e=>{switch(e){case"success":return rk;case"info":return ik;case"warning":return ok;case"error":return ak;default:return null}},tk=Array(12).fill(0),nk=({visible:e,className:n})=>fe.createElement("div",{className:["sonner-loading-wrapper",n].filter(Boolean).join(" "),"data-visible":e},fe.createElement("div",{className:"sonner-spinner"},tk.map((r,i)=>fe.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${i}`})))),rk=fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},fe.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),ok=fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},fe.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),ik=fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},fe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),ak=fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},fe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),sk=fe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},fe.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),fe.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),lk=()=>{const[e,n]=fe.useState(document.hidden);return fe.useEffect(()=>{const r=()=>{n(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let Cm=1;class ck{constructor(){this.subscribe=n=>(this.subscribers.push(n),()=>{const r=this.subscribers.indexOf(n);this.subscribers.splice(r,1)}),this.publish=n=>{this.subscribers.forEach(r=>r(n))},this.addToast=n=>{this.publish(n),this.toasts=[...this.toasts,n]},this.create=n=>{var r;const{message:i,...s}=n,l=typeof n?.id=="number"||((r=n.id)==null?void 0:r.length)>0?n.id:Cm++,u=this.toasts.find(m=>m.id===l),d=n.dismissible===void 0?!0:n.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),u?this.toasts=this.toasts.map(m=>m.id===l?(this.publish({...m,...n,id:l,title:i}),{...m,...n,id:l,dismissible:d,title:i}):m):this.addToast({title:i,...s,dismissible:d,id:l}),l},this.dismiss=n=>(n?(this.dismissedToasts.add(n),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:n,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(i=>i({id:r.id,dismiss:!0}))}),n),this.message=(n,r)=>this.create({...r,message:n}),this.error=(n,r)=>this.create({...r,message:n,type:"error"}),this.success=(n,r)=>this.create({...r,type:"success",message:n}),this.info=(n,r)=>this.create({...r,type:"info",message:n}),this.warning=(n,r)=>this.create({...r,type:"warning",message:n}),this.loading=(n,r)=>this.create({...r,type:"loading",message:n}),this.promise=(n,r)=>{if(!r)return;let i;r.loading!==void 0&&(i=this.create({...r,promise:n,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const s=Promise.resolve(n instanceof Function?n():n);let l=i!==void 0,u;const d=s.then(async h=>{if(u=["resolve",h],fe.isValidElement(h))l=!1,this.create({id:i,type:"default",message:h});else if(dk(h)&&!h.ok){l=!1;const v=typeof r.error=="function"?await r.error(`HTTP error! status: ${h.status}`):r.error,b=typeof r.description=="function"?await r.description(`HTTP error! status: ${h.status}`):r.description,_=typeof v=="object"&&!fe.isValidElement(v)?v:{message:v};this.create({id:i,type:"error",description:b,..._})}else if(h instanceof Error){l=!1;const v=typeof r.error=="function"?await r.error(h):r.error,b=typeof r.description=="function"?await r.description(h):r.description,_=typeof v=="object"&&!fe.isValidElement(v)?v:{message:v};this.create({id:i,type:"error",description:b,..._})}else if(r.success!==void 0){l=!1;const v=typeof r.success=="function"?await r.success(h):r.success,b=typeof r.description=="function"?await r.description(h):r.description,_=typeof v=="object"&&!fe.isValidElement(v)?v:{message:v};this.create({id:i,type:"success",description:b,..._})}}).catch(async h=>{if(u=["reject",h],r.error!==void 0){l=!1;const y=typeof r.error=="function"?await r.error(h):r.error,v=typeof r.description=="function"?await r.description(h):r.description,S=typeof y=="object"&&!fe.isValidElement(y)?y:{message:y};this.create({id:i,type:"error",description:v,...S})}}).finally(()=>{l&&(this.dismiss(i),i=void 0),r.finally==null||r.finally.call(r)}),m=()=>new Promise((h,y)=>d.then(()=>u[0]==="reject"?y(u[1]):h(u[1])).catch(y));return typeof i!="string"&&typeof i!="number"?{unwrap:m}:Object.assign(i,{unwrap:m})},this.custom=(n,r)=>{const i=r?.id||Cm++;return this.create({jsx:n(i),id:i,...r}),i},this.getActiveToasts=()=>this.toasts.filter(n=>!this.dismissedToasts.has(n.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const On=new ck,uk=(e,n)=>{const r=n?.id||Cm++;return On.addToast({title:e,...n,id:r}),r},dk=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",fk=uk,hk=()=>On.toasts,mk=()=>On.getActiveToasts(),Gb=Object.assign(fk,{success:On.success,info:On.info,warning:On.warning,error:On.error,custom:On.custom,message:On.message,promise:On.promise,dismiss:On.dismiss,loading:On.loading},{getHistory:hk,getToasts:mk});WD("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Pc(e){return e.label!==void 0}const pk=3,gk="24px",vk="16px",Zb=4e3,yk=356,bk=14,xk=45,Sk=200;function wr(...e){return e.filter(Boolean).join(" ")}function wk(e){const[n,r]=e.split("-"),i=[];return n&&i.push(n),r&&i.push(r),i}const _k=e=>{var n,r,i,s,l,u,d,m,h;const{invert:y,toast:v,unstyled:b,interacting:S,setHeights:_,visibleToasts:C,heights:E,index:T,toasts:O,expanded:M,removeToast:k,defaultRichColors:L,closeButton:q,style:H,cancelButtonStyle:$,actionButtonStyle:he,className:ve="",descriptionClassName:de="",duration:le,position:ae,gap:me,expandByDefault:ye,classNames:D,icons:Y,closeButtonAriaLabel:ne="Close toast"}=e,[J,W]=fe.useState(null),[z,j]=fe.useState(null),[U,Q]=fe.useState(!1),[Z,re]=fe.useState(!1),[ee,ge]=fe.useState(!1),[be,De]=fe.useState(!1),[Ve,Ue]=fe.useState(!1),[lt,Xe]=fe.useState(0),[Xt,mn]=fe.useState(0),qt=fe.useRef(v.duration||le||Zb),Pt=fe.useRef(null),Ut=fe.useRef(null),rr=T===0,Fe=T+1<=C,Ne=v.type,Je=v.dismissible!==!1,zt=v.className||"",eo=v.descriptionClassName||"",or=fe.useMemo(()=>E.findIndex(je=>je.toastId===v.id)||0,[E,v.id]),Ri=fe.useMemo(()=>{var je;return(je=v.closeButton)!=null?je:q},[v.closeButton,q]),to=fe.useMemo(()=>v.duration||le||Zb,[v.duration,le]),Ti=fe.useRef(0),Un=fe.useRef(0),A=fe.useRef(0),V=fe.useRef(null),[F,se]=ae.split("-"),ue=fe.useMemo(()=>E.reduce((je,pt,bt)=>bt>=or?je:je+pt.height,0),[E,or]),pe=lk(),xe=v.invert||y,Se=Ne==="loading";Un.current=fe.useMemo(()=>or*me+ue,[or,ue]),fe.useEffect(()=>{qt.current=to},[to]),fe.useEffect(()=>{Q(!0)},[]),fe.useEffect(()=>{const je=Ut.current;if(je){const pt=je.getBoundingClientRect().height;return mn(pt),_(bt=>[{toastId:v.id,height:pt,position:v.position},...bt]),()=>_(bt=>bt.filter(Gt=>Gt.toastId!==v.id))}},[_,v.id]),fe.useLayoutEffect(()=>{if(!U)return;const je=Ut.current,pt=je.style.height;je.style.height="auto";const bt=je.getBoundingClientRect().height;je.style.height=pt,mn(bt),_(Gt=>Gt.find(_t=>_t.toastId===v.id)?Gt.map(_t=>_t.toastId===v.id?{..._t,height:bt}:_t):[{toastId:v.id,height:bt,position:v.position},...Gt])},[U,v.title,v.description,_,v.id,v.jsx,v.action,v.cancel]);const Te=fe.useCallback(()=>{re(!0),Xe(Un.current),_(je=>je.filter(pt=>pt.toastId!==v.id)),setTimeout(()=>{k(v)},Sk)},[v,k,_,Un]);fe.useEffect(()=>{if(v.promise&&Ne==="loading"||v.duration===1/0||v.type==="loading")return;let je;return M||S||pe?(()=>{if(A.current{v.onAutoClose==null||v.onAutoClose.call(v,v),Te()},qt.current)),()=>clearTimeout(je)},[M,S,v,Ne,pe,Te]),fe.useEffect(()=>{v.delete&&(Te(),v.onDismiss==null||v.onDismiss.call(v,v))},[Te,v.delete]);function rt(){var je;if(Y?.loading){var pt;return fe.createElement("div",{className:wr(D?.loader,v==null||(pt=v.classNames)==null?void 0:pt.loader,"sonner-loader"),"data-visible":Ne==="loading"},Y.loading)}return fe.createElement(nk,{className:wr(D?.loader,v==null||(je=v.classNames)==null?void 0:je.loader),visible:Ne==="loading"})}const wt=v.icon||Y?.[Ne]||ek(Ne);var Jt,Nt;return fe.createElement("li",{tabIndex:0,ref:Ut,className:wr(ve,zt,D?.toast,v==null||(n=v.classNames)==null?void 0:n.toast,D?.default,D?.[Ne],v==null||(r=v.classNames)==null?void 0:r[Ne]),"data-sonner-toast":"","data-rich-colors":(Jt=v.richColors)!=null?Jt:L,"data-styled":!(v.jsx||v.unstyled||b),"data-mounted":U,"data-promise":!!v.promise,"data-swiped":Ve,"data-removed":Z,"data-visible":Fe,"data-y-position":F,"data-x-position":se,"data-index":T,"data-front":rr,"data-swiping":ee,"data-dismissible":Je,"data-type":Ne,"data-invert":xe,"data-swipe-out":be,"data-swipe-direction":z,"data-expanded":!!(M||ye&&U),"data-testid":v.testId,style:{"--index":T,"--toasts-before":T,"--z-index":O.length-T,"--offset":`${Z?lt:Un.current}px`,"--initial-height":ye?"auto":`${Xt}px`,...H,...v.style},onDragEnd:()=>{ge(!1),W(null),V.current=null},onPointerDown:je=>{je.button!==2&&(Se||!Je||(Pt.current=new Date,Xe(Un.current),je.target.setPointerCapture(je.pointerId),je.target.tagName!=="BUTTON"&&(ge(!0),V.current={x:je.clientX,y:je.clientY})))},onPointerUp:()=>{var je,pt,bt;if(be||!Je)return;V.current=null;const Gt=Number(((je=Ut.current)==null?void 0:je.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ir=Number(((pt=Ut.current)==null?void 0:pt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),_t=new Date().getTime()-((bt=Pt.current)==null?void 0:bt.getTime()),yn=J==="x"?Gt:ir,qo=Math.abs(yn)/_t;if(Math.abs(yn)>=xk||qo>.11){Xe(Un.current),v.onDismiss==null||v.onDismiss.call(v,v),j(J==="x"?Gt>0?"right":"left":ir>0?"down":"up"),Te(),De(!0);return}else{var bn,xn;(bn=Ut.current)==null||bn.style.setProperty("--swipe-amount-x","0px"),(xn=Ut.current)==null||xn.style.setProperty("--swipe-amount-y","0px")}Ue(!1),ge(!1),W(null)},onPointerMove:je=>{var pt,bt,Gt;if(!V.current||!Je||((pt=window.getSelection())==null?void 0:pt.toString().length)>0)return;const _t=je.clientY-V.current.y,yn=je.clientX-V.current.x;var qo;const bn=(qo=e.swipeDirections)!=null?qo:wk(ae);!J&&(Math.abs(yn)>1||Math.abs(_t)>1)&&W(Math.abs(yn)>Math.abs(_t)?"x":"y");let xn={x:0,y:0};const Oi=ar=>1/(1.5+Math.abs(ar)/20);if(J==="y"){if(bn.includes("top")||bn.includes("bottom"))if(bn.includes("top")&&_t<0||bn.includes("bottom")&&_t>0)xn.y=_t;else{const ar=_t*Oi(_t);xn.y=Math.abs(ar)0)xn.x=yn;else{const ar=yn*Oi(yn);xn.x=Math.abs(ar)0||Math.abs(xn.y)>0)&&Ue(!0),(bt=Ut.current)==null||bt.style.setProperty("--swipe-amount-x",`${xn.x}px`),(Gt=Ut.current)==null||Gt.style.setProperty("--swipe-amount-y",`${xn.y}px`)}},Ri&&!v.jsx&&Ne!=="loading"?fe.createElement("button",{"aria-label":ne,"data-disabled":Se,"data-close-button":!0,onClick:Se||!Je?()=>{}:()=>{Te(),v.onDismiss==null||v.onDismiss.call(v,v)},className:wr(D?.closeButton,v==null||(i=v.classNames)==null?void 0:i.closeButton)},(Nt=Y?.close)!=null?Nt:sk):null,(Ne||v.icon||v.promise)&&v.icon!==null&&(Y?.[Ne]!==null||v.icon)?fe.createElement("div",{"data-icon":"",className:wr(D?.icon,v==null||(s=v.classNames)==null?void 0:s.icon)},v.promise||v.type==="loading"&&!v.icon?v.icon||rt():null,v.type!=="loading"?wt:null):null,fe.createElement("div",{"data-content":"",className:wr(D?.content,v==null||(l=v.classNames)==null?void 0:l.content)},fe.createElement("div",{"data-title":"",className:wr(D?.title,v==null||(u=v.classNames)==null?void 0:u.title)},v.jsx?v.jsx:typeof v.title=="function"?v.title():v.title),v.description?fe.createElement("div",{"data-description":"",className:wr(de,eo,D?.description,v==null||(d=v.classNames)==null?void 0:d.description)},typeof v.description=="function"?v.description():v.description):null),fe.isValidElement(v.cancel)?v.cancel:v.cancel&&Pc(v.cancel)?fe.createElement("button",{"data-button":!0,"data-cancel":!0,style:v.cancelButtonStyle||$,onClick:je=>{Pc(v.cancel)&&Je&&(v.cancel.onClick==null||v.cancel.onClick.call(v.cancel,je),Te())},className:wr(D?.cancelButton,v==null||(m=v.classNames)==null?void 0:m.cancelButton)},v.cancel.label):null,fe.isValidElement(v.action)?v.action:v.action&&Pc(v.action)?fe.createElement("button",{"data-button":!0,"data-action":!0,style:v.actionButtonStyle||he,onClick:je=>{Pc(v.action)&&(v.action.onClick==null||v.action.onClick.call(v.action,je),!je.defaultPrevented&&Te())},className:wr(D?.actionButton,v==null||(h=v.classNames)==null?void 0:h.actionButton)},v.action.label):null)};function Kb(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function Ck(e,n){const r={};return[e,n].forEach((i,s)=>{const l=s===1,u=l?"--mobile-offset":"--offset",d=l?vk:gk;function m(h){["top","right","bottom","left"].forEach(y=>{r[`${u}-${y}`]=typeof h=="number"?`${h}px`:h})}typeof i=="number"||typeof i=="string"?m(i):typeof i=="object"?["top","right","bottom","left"].forEach(h=>{i[h]===void 0?r[`${u}-${h}`]=d:r[`${u}-${h}`]=typeof i[h]=="number"?`${i[h]}px`:i[h]}):m(d)}),r}const Ek=fe.forwardRef(function(n,r){const{id:i,invert:s,position:l="bottom-right",hotkey:u=["altKey","KeyT"],expand:d,closeButton:m,className:h,offset:y,mobileOffset:v,theme:b="light",richColors:S,duration:_,style:C,visibleToasts:E=pk,toastOptions:T,dir:O=Kb(),gap:M=bk,icons:k,containerAriaLabel:L="Notifications"}=n,[q,H]=fe.useState([]),$=fe.useMemo(()=>i?q.filter(U=>U.toasterId===i):q.filter(U=>!U.toasterId),[q,i]),he=fe.useMemo(()=>Array.from(new Set([l].concat($.filter(U=>U.position).map(U=>U.position)))),[$,l]),[ve,de]=fe.useState([]),[le,ae]=fe.useState(!1),[me,ye]=fe.useState(!1),[D,Y]=fe.useState(b!=="system"?b:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),ne=fe.useRef(null),J=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),W=fe.useRef(null),z=fe.useRef(!1),j=fe.useCallback(U=>{H(Q=>{var Z;return(Z=Q.find(re=>re.id===U.id))!=null&&Z.delete||On.dismiss(U.id),Q.filter(({id:re})=>re!==U.id)})},[]);return fe.useEffect(()=>On.subscribe(U=>{if(U.dismiss){requestAnimationFrame(()=>{H(Q=>Q.map(Z=>Z.id===U.id?{...Z,delete:!0}:Z))});return}setTimeout(()=>{A2.flushSync(()=>{H(Q=>{const Z=Q.findIndex(re=>re.id===U.id);return Z!==-1?[...Q.slice(0,Z),{...Q[Z],...U},...Q.slice(Z+1)]:[U,...Q]})})})}),[q]),fe.useEffect(()=>{if(b!=="system"){Y(b);return}if(b==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Y("dark"):Y("light")),typeof window>"u")return;const U=window.matchMedia("(prefers-color-scheme: dark)");try{U.addEventListener("change",({matches:Q})=>{Y(Q?"dark":"light")})}catch{U.addListener(({matches:Z})=>{try{Y(Z?"dark":"light")}catch(re){console.error(re)}})}},[b]),fe.useEffect(()=>{q.length<=1&&ae(!1)},[q]),fe.useEffect(()=>{const U=Q=>{var Z;if(u.every(ge=>Q[ge]||Q.code===ge)){var ee;ae(!0),(ee=ne.current)==null||ee.focus()}Q.code==="Escape"&&(document.activeElement===ne.current||(Z=ne.current)!=null&&Z.contains(document.activeElement))&&ae(!1)};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[u]),fe.useEffect(()=>{if(ne.current)return()=>{W.current&&(W.current.focus({preventScroll:!0}),W.current=null,z.current=!1)}},[ne.current]),fe.createElement("section",{ref:r,"aria-label":`${L} ${J}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},he.map((U,Q)=>{var Z;const[re,ee]=U.split("-");return $.length?fe.createElement("ol",{key:U,dir:O==="auto"?Kb():O,tabIndex:-1,ref:ne,className:h,"data-sonner-toaster":!0,"data-sonner-theme":D,"data-y-position":re,"data-x-position":ee,style:{"--front-toast-height":`${((Z=ve[0])==null?void 0:Z.height)||0}px`,"--width":`${yk}px`,"--gap":`${M}px`,...C,...Ck(y,v)},onBlur:ge=>{z.current&&!ge.currentTarget.contains(ge.relatedTarget)&&(z.current=!1,W.current&&(W.current.focus({preventScroll:!0}),W.current=null))},onFocus:ge=>{ge.target instanceof HTMLElement&&ge.target.dataset.dismissible==="false"||z.current||(z.current=!0,W.current=ge.relatedTarget)},onMouseEnter:()=>ae(!0),onMouseMove:()=>ae(!0),onMouseLeave:()=>{me||ae(!1)},onDragEnd:()=>ae(!1),onPointerDown:ge=>{ge.target instanceof HTMLElement&&ge.target.dataset.dismissible==="false"||ye(!0)},onPointerUp:()=>ye(!1)},$.filter(ge=>!ge.position&&Q===0||ge.position===U).map((ge,be)=>{var De,Ve;return fe.createElement(_k,{key:ge.id,icons:k,index:be,toast:ge,defaultRichColors:S,duration:(De=T?.duration)!=null?De:_,className:T?.className,descriptionClassName:T?.descriptionClassName,invert:s,visibleToasts:E,closeButton:(Ve=T?.closeButton)!=null?Ve:m,interacting:me,position:U,style:T?.style,unstyled:T?.unstyled,classNames:T?.classNames,cancelButtonStyle:T?.cancelButtonStyle,actionButtonStyle:T?.actionButtonStyle,closeButtonAriaLabel:T?.closeButtonAriaLabel,removeToast:j,toasts:$.filter(Ue=>Ue.position==ge.position),heights:ve.filter(Ue=>Ue.position==ge.position),setHeights:de,expandByDefault:d,gap:M,expanded:le,swipeDirections:n.swipeDirections})})):null}))}),Rk=({...e})=>g.jsx(Ek,{theme:"dark",className:"toaster group",icons:{success:g.jsx(CN,{className:"size-4"}),info:g.jsx(nD,{className:"size-4"}),warning:g.jsx(Y1,{className:"size-4"}),error:g.jsx(SD,{className:"size-4"}),loading:g.jsx(uD,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius-ctl)"},...e});function We(e,n=!1){n?Gb.error(e,{duration:1/0,closeButton:!0}):Gb(e)}function Tk(){return g.jsx(Rk,{position:"bottom-center"})}const Yb=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Qb=E1,Ok=(e,n)=>r=>{var i;if(n?.variants==null)return Qb(e,r?.class,r?.className);const{variants:s,defaultVariants:l}=n,u=Object.keys(s).map(h=>{const y=r?.[h],v=l?.[h];if(y===null)return null;const b=Yb(y)||Yb(v);return s[h][b]}),d=r&&Object.entries(r).reduce((h,y)=>{let[v,b]=y;return b===void 0||(h[v]=b),h},{}),m=n==null||(i=n.compoundVariants)===null||i===void 0?void 0:i.reduce((h,y)=>{let{class:v,className:b,...S}=y;return Object.entries(S).every(_=>{let[C,E]=_;return Array.isArray(E)?E.includes({...l,...d}[C]):{...l,...d}[C]===E})?[...h,v,b]:h},[]);return Qb(e,u,m,r?.class,r?.className)},Mk=Ok("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[background-color,border-color,color] disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",primary:"pbtn",danger:"danger-btn",subtle:"ai-btn",toolbar:"btn",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function $t({className:e,variant:n="default",size:r="default",asChild:i=!1,...s}){const l=i?j2:"button";return g.jsx(l,{"data-slot":"button","data-variant":n,"data-size":r,className:et(Mk({variant:n,size:r,className:e})),...s})}function zp({...e}){return g.jsx(Wm,{"data-slot":"dialog",...e})}function Ak({...e}){return g.jsx(tp,{"data-slot":"dialog-portal",...e})}function jk({className:e,...n}){return g.jsx(np,{"data-slot":"dialog-overlay",className:et("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",e),...n})}function Np({className:e,children:n,showCloseButton:r=!0,...i}){return g.jsxs(Ak,{"data-slot":"dialog-portal",children:[g.jsx(jk,{}),g.jsxs(rp,{"data-slot":"dialog-content",className:et("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",e),...i,children:[n,r&&g.jsxs(jS,{"data-slot":"dialog-close",className:"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[g.jsx(X1,{}),g.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Bu({className:e,...n}){return g.jsx(OS,{"data-slot":"dialog-title",className:et("text-lg leading-none font-semibold",e),...n})}let W1=null,eu=[];function ml(e){W1=e,eu.forEach(n=>n())}function e_(e,n,r="",i="OK",s={}){return new Promise(l=>ml({kind:"prompt",title:e,label:n,value:r,okLabel:i,...s,resolve:l}))}function Dp(e,n,r="Confirm",i=!1){return new Promise(s=>ml({kind:"confirm",title:e,message:n,confirmLabel:r,danger:i,resolve:s}))}function zk(){const e=x.useSyncExternalStore(r=>(eu.push(r),()=>{eu=eu.filter(i=>i!==r)}),()=>W1);if(!e)return null;const n=()=>{ml(null),e.kind==="prompt"?e.resolve(null):e.resolve(!1)};return g.jsx(zp,{open:!0,onOpenChange:r=>!r&&n(),children:g.jsx(Np,{className:"modal",showCloseButton:!1,children:e.kind==="prompt"?g.jsx(Nk,{m:e}):g.jsx(Dk,{m:e})})})}function Nk({m:e}){const n=x.useRef(null),r=h=>{ml(null),e.resolve(h)},[i,s]=x.useState(""),[l,u]=x.useState(e.value),d=e.match===void 0||l.trim()===e.match,m=()=>{const h=l;if(d){if(!h.trim()){s("Give it a name."),n.current.focus();return}r(h)}};return g.jsxs(g.Fragment,{children:[g.jsx(Bu,{asChild:!0,children:g.jsx("h3",{children:e.title})}),g.jsx("label",{className:"modal-label",htmlFor:"modal-input",children:e.label}),g.jsx("input",{className:"modal-input",type:"text",autoComplete:"off",value:l,ref:n,id:"modal-input",autoFocus:!0,onFocus:h=>h.currentTarget.select(),"aria-invalid":!!i,"aria-describedby":i?"modal-input-err":void 0,onChange:h=>{u(h.currentTarget.value),i&&s("")},onKeyDown:h=>h.key==="Enter"&&m()}),i&&g.jsx("span",{id:"modal-input-err",role:"alert",className:"field-err",children:i}),g.jsxs("div",{className:"modal-actions",children:[g.jsx($t,{variant:"subtle",onClick:()=>r(null),children:"Cancel"}),g.jsx($t,{variant:e.danger?"danger":"primary",onClick:m,disabled:!d,children:e.okLabel})]})]})}function Dk({m:e}){const n=r=>{ml(null),e.resolve(r)};return g.jsxs(g.Fragment,{children:[g.jsx(Bu,{asChild:!0,children:g.jsx("h3",{children:e.title})}),g.jsx("p",{className:"modal-msg",children:e.message}),g.jsxs("div",{className:"modal-actions",children:[g.jsx($t,{variant:"subtle",onClick:()=>n(!1),autoFocus:e.danger,children:"Cancel"}),g.jsx($t,{variant:e.danger?"danger":"primary",onClick:()=>n(!0),autoFocus:!e.danger,children:e.confirmLabel})]})]})}function kk(e){return jn({queryKey:["projects"],queryFn:()=>Fn("/api/projects"),enabled:e,refetchInterval:3e4,select:n=>n.projects||[]})}function Lk(e){return jn({queryKey:["orgs"],queryFn:()=>Fn("/api/orgs"),enabled:e,select:n=>n.orgs||[]})}function t_(e){return jn({queryKey:["admin","pending"],queryFn:()=>Fn("/api/admin/pending"),enabled:e,select:n=>n.pending||[]})}function kp(){const e=sl();return()=>Promise.all([e.invalidateQueries({queryKey:["projects"]}),e.invalidateQueries({queryKey:["orgs"]})]).then(()=>{})}function n_(e){return e.split("/").map(encodeURIComponent).join("/")}function Xb(e){return e.split("/").map(decodeURIComponent).join("/")}const Ik=new Set(["insights","history","install","settings"]);function r_(e,n){const r=e.replace(/^\/+/,"");if(n!=="hub")return{path:r?Xb(r):""};if(r==="orgs"||r.startsWith("orgs/"))return{org:r.slice(5).replace(/\/+$/,""),path:""};const i=r.indexOf("/");if(i===-1)return{project:r,path:""};const s={project:r.slice(0,i),path:Xb(r.slice(i+1))},l=s.path.indexOf("/"),u=l===-1?s.path:s.path.slice(0,l);return Ik.has(u)&&(s.view=u,s.viewTarget=l===-1?"":s.path.slice(l+1).replace(/\/+$/,""),s.path=""),s}function $k(e,n){const r=n_(e);return n?"/"+n+(r?"/"+r:""):"/"+r}function _a(e,n,r){let i=(n?"/"+n:"")+"/"+e;return r&&(i+="/"+n_(r.replace(/\/+$/,""))),i}let Lp="POP";const Em=new Set;function o_(){for(const e of Em)e()}window.addEventListener("popstate",()=>{Lp="POP",o_()});function fn(e,n){const r=location.pathname+location.search;!n?.replace&&r===e||(history[n?.replace?"replaceState":"pushState"](null,"",e),Lp=n?.replace?"REPLACE":"PUSH",o_())}function Ip(){return x.useSyncExternalStore(e=>(Em.add(e),()=>{Em.delete(e)}),()=>location.pathname)}function Vk(){return Lp}function i_(e){return e.startsWith("/")&&!e.startsWith("//")?{href:e,onClick:r=>{r.defaultPrevented||r.metaKey||r.ctrlKey||r.shiftKey||r.altKey||r.button!==0||(r.preventDefault(),fn(e),document.body.classList.remove("sb-open"))}}:{href:e,target:"_blank",rel:"noopener noreferrer"}}function Fk({to:e}){return x.useEffect(()=>{fn(e,{replace:!0})},[e]),null}function a_(){return{accessor:(e,n)=>typeof e=="function"?{...n,accessorFn:e}:{...n,accessorKey:e},display:e=>e,group:e=>e}}function Mo(e,n){return typeof e=="function"?e(n):e}function Pn(e,n){return r=>{n.setState(i=>({...i,[e]:Mo(r,i[e])}))}}function qu(e){return e instanceof Function}function Pk(e){return Array.isArray(e)&&e.every(n=>typeof n=="number")}function Uk(e,n){const r=[],i=s=>{s.forEach(l=>{r.push(l);const u=n(l);u!=null&&u.length&&i(u)})};return i(e),r}function ke(e,n,r){let i=[],s;return l=>{let u;r.key&&r.debug&&(u=Date.now());const d=e(l);if(!(d.length!==i.length||d.some((y,v)=>i[v]!==y)))return s;i=d;let h;if(r.key&&r.debug&&(h=Date.now()),s=n(...d),r==null||r.onChange==null||r.onChange(s),r.key&&r.debug&&r!=null&&r.debug()){const y=Math.round((Date.now()-u)*100)/100,v=Math.round((Date.now()-h)*100)/100,b=v/16,S=(_,C)=>{for(_=String(_);_.length{var s;return(s=e?.debugAll)!=null?s:e[n]},key:!1,onChange:i}}function Hk(e,n,r,i){const s=()=>{var u;return(u=l.getValue())!=null?u:e.options.renderFallbackValue},l={id:`${n.id}_${r.id}`,row:n,column:r,getValue:()=>n.getValue(i),renderValue:s,getContext:ke(()=>[e,r,n,l],(u,d,m,h)=>({table:u,column:d,row:m,cell:h,getValue:h.getValue,renderValue:h.renderValue}),Le(e.options,"debugCells"))};return e._features.forEach(u=>{u.createCell==null||u.createCell(l,r,n,e)},{}),l}function Bk(e,n,r,i){var s,l;const d={...e._getDefaultColumnDef(),...n},m=d.accessorKey;let h=(s=(l=d.id)!=null?l:m?typeof String.prototype.replaceAll=="function"?m.replaceAll(".","_"):m.replace(/\./g,"_"):void 0)!=null?s:typeof d.header=="string"?d.header:void 0,y;if(d.accessorFn?y=d.accessorFn:m&&(m.includes(".")?y=b=>{let S=b;for(const C of m.split(".")){var _;S=(_=S)==null?void 0:_[C]}return S}:y=b=>b[d.accessorKey]),!h)throw new Error;let v={id:`${String(h)}`,accessorFn:y,parent:i,depth:r,columnDef:d,columns:[],getFlatColumns:ke(()=>[!0],()=>{var b;return[v,...(b=v.columns)==null?void 0:b.flatMap(S=>S.getFlatColumns())]},Le(e.options,"debugColumns")),getLeafColumns:ke(()=>[e._getOrderColumnsFn()],b=>{var S;if((S=v.columns)!=null&&S.length){let _=v.columns.flatMap(C=>C.getLeafColumns());return b(_)}return[v]},Le(e.options,"debugColumns"))};for(const b of e._features)b.createColumn==null||b.createColumn(v,e);return v}const dn="debugHeaders";function Jb(e,n,r){var i;let l={id:(i=r.id)!=null?i:n.id,column:n,index:r.index,isPlaceholder:!!r.isPlaceholder,placeholderId:r.placeholderId,depth:r.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const u=[],d=m=>{m.subHeaders&&m.subHeaders.length&&m.subHeaders.map(d),u.push(m)};return d(l),u},getContext:()=>({table:e,header:l,column:n})};return e._features.forEach(u=>{u.createHeader==null||u.createHeader(l,e)}),l}const qk={createTable:e=>{e.getHeaderGroups=ke(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,r,i,s)=>{var l,u;const d=(l=i?.map(v=>r.find(b=>b.id===v)).filter(Boolean))!=null?l:[],m=(u=s?.map(v=>r.find(b=>b.id===v)).filter(Boolean))!=null?u:[],h=r.filter(v=>!(i!=null&&i.includes(v.id))&&!(s!=null&&s.includes(v.id)));return Uc(n,[...d,...h,...m],e)},Le(e.options,dn)),e.getCenterHeaderGroups=ke(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,r,i,s)=>(r=r.filter(l=>!(i!=null&&i.includes(l.id))&&!(s!=null&&s.includes(l.id))),Uc(n,r,e,"center")),Le(e.options,dn)),e.getLeftHeaderGroups=ke(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(n,r,i)=>{var s;const l=(s=i?.map(u=>r.find(d=>d.id===u)).filter(Boolean))!=null?s:[];return Uc(n,l,e,"left")},Le(e.options,dn)),e.getRightHeaderGroups=ke(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(n,r,i)=>{var s;const l=(s=i?.map(u=>r.find(d=>d.id===u)).filter(Boolean))!=null?s:[];return Uc(n,l,e,"right")},Le(e.options,dn)),e.getFooterGroups=ke(()=>[e.getHeaderGroups()],n=>[...n].reverse(),Le(e.options,dn)),e.getLeftFooterGroups=ke(()=>[e.getLeftHeaderGroups()],n=>[...n].reverse(),Le(e.options,dn)),e.getCenterFooterGroups=ke(()=>[e.getCenterHeaderGroups()],n=>[...n].reverse(),Le(e.options,dn)),e.getRightFooterGroups=ke(()=>[e.getRightHeaderGroups()],n=>[...n].reverse(),Le(e.options,dn)),e.getFlatHeaders=ke(()=>[e.getHeaderGroups()],n=>n.map(r=>r.headers).flat(),Le(e.options,dn)),e.getLeftFlatHeaders=ke(()=>[e.getLeftHeaderGroups()],n=>n.map(r=>r.headers).flat(),Le(e.options,dn)),e.getCenterFlatHeaders=ke(()=>[e.getCenterHeaderGroups()],n=>n.map(r=>r.headers).flat(),Le(e.options,dn)),e.getRightFlatHeaders=ke(()=>[e.getRightHeaderGroups()],n=>n.map(r=>r.headers).flat(),Le(e.options,dn)),e.getCenterLeafHeaders=ke(()=>[e.getCenterFlatHeaders()],n=>n.filter(r=>{var i;return!((i=r.subHeaders)!=null&&i.length)}),Le(e.options,dn)),e.getLeftLeafHeaders=ke(()=>[e.getLeftFlatHeaders()],n=>n.filter(r=>{var i;return!((i=r.subHeaders)!=null&&i.length)}),Le(e.options,dn)),e.getRightLeafHeaders=ke(()=>[e.getRightFlatHeaders()],n=>n.filter(r=>{var i;return!((i=r.subHeaders)!=null&&i.length)}),Le(e.options,dn)),e.getLeafHeaders=ke(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(n,r,i)=>{var s,l,u,d,m,h;return[...(s=(l=n[0])==null?void 0:l.headers)!=null?s:[],...(u=(d=r[0])==null?void 0:d.headers)!=null?u:[],...(m=(h=i[0])==null?void 0:h.headers)!=null?m:[]].map(y=>y.getLeafHeaders()).flat()},Le(e.options,dn))}};function Uc(e,n,r,i){var s,l;let u=0;const d=function(b,S){S===void 0&&(S=1),u=Math.max(u,S),b.filter(_=>_.getIsVisible()).forEach(_=>{var C;(C=_.columns)!=null&&C.length&&d(_.columns,S+1)},0)};d(e);let m=[];const h=(b,S)=>{const _={depth:S,id:[i,`${S}`].filter(Boolean).join("_"),headers:[]},C=[];b.forEach(E=>{const T=[...C].reverse()[0],O=E.column.depth===_.depth;let M,k=!1;if(O&&E.column.parent?M=E.column.parent:(M=E.column,k=!0),T&&T?.column===M)T.subHeaders.push(E);else{const L=Jb(r,M,{id:[i,S,M.id,E?.id].filter(Boolean).join("_"),isPlaceholder:k,placeholderId:k?`${C.filter(q=>q.column===M).length}`:void 0,depth:S,index:C.length});L.subHeaders.push(E),C.push(L)}_.headers.push(E),E.headerGroup=_}),m.push(_),S>0&&h(C,S-1)},y=n.map((b,S)=>Jb(r,b,{depth:u,index:S}));h(y,u-1),m.reverse();const v=b=>b.filter(_=>_.column.getIsVisible()).map(_=>{let C=0,E=0,T=[0];_.subHeaders&&_.subHeaders.length?(T=[],v(_.subHeaders).forEach(M=>{let{colSpan:k,rowSpan:L}=M;C+=k,T.push(L)})):C=1;const O=Math.min(...T);return E=E+O,_.colSpan=C,_.rowSpan=E,{colSpan:C,rowSpan:E}});return v((s=(l=m[0])==null?void 0:l.headers)!=null?s:[]),m}const Gk=(e,n,r,i,s,l,u)=>{let d={id:n,index:i,original:r,depth:s,parentId:u,_valuesCache:{},_uniqueValuesCache:{},getValue:m=>{if(d._valuesCache.hasOwnProperty(m))return d._valuesCache[m];const h=e.getColumn(m);if(h!=null&&h.accessorFn)return d._valuesCache[m]=h.accessorFn(d.original,i),d._valuesCache[m]},getUniqueValues:m=>{if(d._uniqueValuesCache.hasOwnProperty(m))return d._uniqueValuesCache[m];const h=e.getColumn(m);if(h!=null&&h.accessorFn)return h.columnDef.getUniqueValues?(d._uniqueValuesCache[m]=h.columnDef.getUniqueValues(d.original,i),d._uniqueValuesCache[m]):(d._uniqueValuesCache[m]=[d.getValue(m)],d._uniqueValuesCache[m])},renderValue:m=>{var h;return(h=d.getValue(m))!=null?h:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>Uk(d.subRows,m=>m.subRows),getParentRow:()=>d.parentId?e.getRow(d.parentId,!0):void 0,getParentRows:()=>{let m=[],h=d;for(;;){const y=h.getParentRow();if(!y)break;m.push(y),h=y}return m.reverse()},getAllCells:ke(()=>[e.getAllLeafColumns()],m=>m.map(h=>Hk(e,d,h,h.id)),Le(e.options,"debugRows")),_getAllCellsByColumnId:ke(()=>[d.getAllCells()],m=>m.reduce((h,y)=>(h[y.column.id]=y,h),{}),Le(e.options,"debugRows"))};for(let m=0;m{e._getFacetedRowModel=n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():n.getPreFilteredRowModel(),e._getFacetedUniqueValues=n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},s_=(e,n,r)=>{var i,s;const l=r==null||(i=r.toString())==null?void 0:i.toLowerCase();return!!(!((s=e.getValue(n))==null||(s=s.toString())==null||(s=s.toLowerCase())==null)&&s.includes(l))};s_.autoRemove=e=>mr(e);const l_=(e,n,r)=>{var i;return!!(!((i=e.getValue(n))==null||(i=i.toString())==null)&&i.includes(r))};l_.autoRemove=e=>mr(e);const c_=(e,n,r)=>{var i;return((i=e.getValue(n))==null||(i=i.toString())==null?void 0:i.toLowerCase())===r?.toLowerCase()};c_.autoRemove=e=>mr(e);const u_=(e,n,r)=>{var i;return(i=e.getValue(n))==null?void 0:i.includes(r)};u_.autoRemove=e=>mr(e);const d_=(e,n,r)=>!r.some(i=>{var s;return!((s=e.getValue(n))!=null&&s.includes(i))});d_.autoRemove=e=>mr(e)||!(e!=null&&e.length);const f_=(e,n,r)=>r.some(i=>{var s;return(s=e.getValue(n))==null?void 0:s.includes(i)});f_.autoRemove=e=>mr(e)||!(e!=null&&e.length);const h_=(e,n,r)=>e.getValue(n)===r;h_.autoRemove=e=>mr(e);const m_=(e,n,r)=>e.getValue(n)==r;m_.autoRemove=e=>mr(e);const $p=(e,n,r)=>{let[i,s]=r;const l=e.getValue(n);return l>=i&&l<=s};$p.resolveFilterValue=e=>{let[n,r]=e,i=typeof n!="number"?parseFloat(n):n,s=typeof r!="number"?parseFloat(r):r,l=n===null||Number.isNaN(i)?-1/0:i,u=r===null||Number.isNaN(s)?1/0:s;if(l>u){const d=l;l=u,u=d}return[l,u]};$p.autoRemove=e=>mr(e)||mr(e[0])&&mr(e[1]);const Yr={includesString:s_,includesStringSensitive:l_,equalsString:c_,arrIncludes:u_,arrIncludesAll:d_,arrIncludesSome:f_,equals:h_,weakEquals:m_,inNumberRange:$p};function mr(e){return e==null||e===""}const Kk={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Pn("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,n)=>{e.getAutoFilterFn=()=>{const r=n.getCoreRowModel().flatRows[0],i=r?.getValue(e.id);return typeof i=="string"?Yr.includesString:typeof i=="number"?Yr.inNumberRange:typeof i=="boolean"||i!==null&&typeof i=="object"?Yr.equals:Array.isArray(i)?Yr.arrIncludes:Yr.weakEquals},e.getFilterFn=()=>{var r,i;return qu(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(r=(i=n.options.filterFns)==null?void 0:i[e.columnDef.filterFn])!=null?r:Yr[e.columnDef.filterFn]},e.getCanFilter=()=>{var r,i,s;return((r=e.columnDef.enableColumnFilter)!=null?r:!0)&&((i=n.options.enableColumnFilters)!=null?i:!0)&&((s=n.options.enableFilters)!=null?s:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var r;return(r=n.getState().columnFilters)==null||(r=r.find(i=>i.id===e.id))==null?void 0:r.value},e.getFilterIndex=()=>{var r,i;return(r=(i=n.getState().columnFilters)==null?void 0:i.findIndex(s=>s.id===e.id))!=null?r:-1},e.setFilterValue=r=>{n.setColumnFilters(i=>{const s=e.getFilterFn(),l=i?.find(y=>y.id===e.id),u=Mo(r,l?l.value:void 0);if(Wb(s,u,e)){var d;return(d=i?.filter(y=>y.id!==e.id))!=null?d:[]}const m={id:e.id,value:u};if(l){var h;return(h=i?.map(y=>y.id===e.id?m:y))!=null?h:[]}return i!=null&&i.length?[...i,m]:[m]})}},createRow:(e,n)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=n=>{const r=e.getAllLeafColumns(),i=s=>{var l;return(l=Mo(n,s))==null?void 0:l.filter(u=>{const d=r.find(m=>m.id===u.id);if(d){const m=d.getFilterFn();if(Wb(m,u.value,d))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(i)},e.resetColumnFilters=n=>{var r,i;e.setColumnFilters(n?[]:(r=(i=e.initialState)==null?void 0:i.columnFilters)!=null?r:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function Wb(e,n,r){return(e&&e.autoRemove?e.autoRemove(n,r):!1)||typeof n>"u"||typeof n=="string"&&!n}const Yk=(e,n,r)=>r.reduce((i,s)=>{const l=s.getValue(e);return i+(typeof l=="number"?l:0)},0),Qk=(e,n,r)=>{let i;return r.forEach(s=>{const l=s.getValue(e);l!=null&&(i>l||i===void 0&&l>=l)&&(i=l)}),i},Xk=(e,n,r)=>{let i;return r.forEach(s=>{const l=s.getValue(e);l!=null&&(i=l)&&(i=l)}),i},Jk=(e,n,r)=>{let i,s;return r.forEach(l=>{const u=l.getValue(e);u!=null&&(i===void 0?u>=u&&(i=s=u):(i>u&&(i=u),s{let r=0,i=0;if(n.forEach(s=>{let l=s.getValue(e);l!=null&&(l=+l)>=l&&(++r,i+=l)}),r)return i/r},e3=(e,n)=>{if(!n.length)return;const r=n.map(l=>l.getValue(e));if(!Pk(r))return;if(r.length===1)return r[0];const i=Math.floor(r.length/2),s=r.sort((l,u)=>l-u);return r.length%2!==0?s[i]:(s[i-1]+s[i])/2},t3=(e,n)=>Array.from(new Set(n.map(r=>r.getValue(e))).values()),n3=(e,n)=>new Set(n.map(r=>r.getValue(e))).size,r3=(e,n)=>n.length,Dh={sum:Yk,min:Qk,max:Xk,extent:Jk,mean:Wk,median:e3,unique:t3,uniqueCount:n3,count:r3},o3={getDefaultColumnDef:()=>({aggregatedCell:e=>{var n,r;return(n=(r=e.getValue())==null||r.toString==null?void 0:r.toString())!=null?n:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Pn("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,n)=>{e.toggleGrouping=()=>{n.setGrouping(r=>r!=null&&r.includes(e.id)?r.filter(i=>i!==e.id):[...r??[],e.id])},e.getCanGroup=()=>{var r,i;return((r=e.columnDef.enableGrouping)!=null?r:!0)&&((i=n.options.enableGrouping)!=null?i:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var r;return(r=n.getState().grouping)==null?void 0:r.includes(e.id)},e.getGroupedIndex=()=>{var r;return(r=n.getState().grouping)==null?void 0:r.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const r=e.getCanGroup();return()=>{r&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const r=n.getCoreRowModel().flatRows[0],i=r?.getValue(e.id);if(typeof i=="number")return Dh.sum;if(Object.prototype.toString.call(i)==="[object Date]")return Dh.extent},e.getAggregationFn=()=>{var r,i;if(!e)throw new Error;return qu(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(r=(i=n.options.aggregationFns)==null?void 0:i[e.columnDef.aggregationFn])!=null?r:Dh[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=n=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(n),e.resetGrouping=n=>{var r,i;e.setGrouping(n?[]:(r=(i=e.initialState)==null?void 0:i.grouping)!=null?r:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,n)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=r=>{if(e._groupingValuesCache.hasOwnProperty(r))return e._groupingValuesCache[r];const i=n.getColumn(r);return i!=null&&i.columnDef.getGroupingValue?(e._groupingValuesCache[r]=i.columnDef.getGroupingValue(e.original),e._groupingValuesCache[r]):e.getValue(r)},e._groupingValuesCache={}},createCell:(e,n,r,i)=>{e.getIsGrouped=()=>n.getIsGrouped()&&n.id===r.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&n.getIsGrouped(),e.getIsAggregated=()=>{var s;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((s=r.subRows)!=null&&s.length)}}};function i3(e,n,r){if(!(n!=null&&n.length)||!r)return e;const i=e.filter(l=>!n.includes(l.id));return r==="remove"?i:[...n.map(l=>e.find(u=>u.id===l)).filter(Boolean),...i]}const a3={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Pn("columnOrder",e)}),createColumn:(e,n)=>{e.getIndex=ke(r=>[Fs(n,r)],r=>r.findIndex(i=>i.id===e.id),Le(n.options,"debugColumns")),e.getIsFirstColumn=r=>{var i;return((i=Fs(n,r)[0])==null?void 0:i.id)===e.id},e.getIsLastColumn=r=>{var i;const s=Fs(n,r);return((i=s[s.length-1])==null?void 0:i.id)===e.id}},createTable:e=>{e.setColumnOrder=n=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(n),e.resetColumnOrder=n=>{var r;e.setColumnOrder(n?[]:(r=e.initialState.columnOrder)!=null?r:[])},e._getOrderColumnsFn=ke(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(n,r,i)=>s=>{let l=[];if(!(n!=null&&n.length))l=s;else{const u=[...n],d=[...s];for(;d.length&&u.length;){const m=u.shift(),h=d.findIndex(y=>y.id===m);h>-1&&l.push(d.splice(h,1)[0])}l=[...l,...d]}return i3(l,r,i)},Le(e.options,"debugTable"))}},kh=()=>({left:[],right:[]}),s3={getInitialState:e=>({columnPinning:kh(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Pn("columnPinning",e)}),createColumn:(e,n)=>{e.pin=r=>{const i=e.getLeafColumns().map(s=>s.id).filter(Boolean);n.setColumnPinning(s=>{var l,u;if(r==="right"){var d,m;return{left:((d=s?.left)!=null?d:[]).filter(v=>!(i!=null&&i.includes(v))),right:[...((m=s?.right)!=null?m:[]).filter(v=>!(i!=null&&i.includes(v))),...i]}}if(r==="left"){var h,y;return{left:[...((h=s?.left)!=null?h:[]).filter(v=>!(i!=null&&i.includes(v))),...i],right:((y=s?.right)!=null?y:[]).filter(v=>!(i!=null&&i.includes(v)))}}return{left:((l=s?.left)!=null?l:[]).filter(v=>!(i!=null&&i.includes(v))),right:((u=s?.right)!=null?u:[]).filter(v=>!(i!=null&&i.includes(v)))}})},e.getCanPin=()=>e.getLeafColumns().some(i=>{var s,l,u;return((s=i.columnDef.enablePinning)!=null?s:!0)&&((l=(u=n.options.enableColumnPinning)!=null?u:n.options.enablePinning)!=null?l:!0)}),e.getIsPinned=()=>{const r=e.getLeafColumns().map(d=>d.id),{left:i,right:s}=n.getState().columnPinning,l=r.some(d=>i?.includes(d)),u=r.some(d=>s?.includes(d));return l?"left":u?"right":!1},e.getPinnedIndex=()=>{var r,i;const s=e.getIsPinned();return s?(r=(i=n.getState().columnPinning)==null||(i=i[s])==null?void 0:i.indexOf(e.id))!=null?r:-1:0}},createRow:(e,n)=>{e.getCenterVisibleCells=ke(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left,n.getState().columnPinning.right],(r,i,s)=>{const l=[...i??[],...s??[]];return r.filter(u=>!l.includes(u.column.id))},Le(n.options,"debugRows")),e.getLeftVisibleCells=ke(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left],(r,i)=>(i??[]).map(l=>r.find(u=>u.column.id===l)).filter(Boolean).map(l=>({...l,position:"left"})),Le(n.options,"debugRows")),e.getRightVisibleCells=ke(()=>[e._getAllVisibleCells(),n.getState().columnPinning.right],(r,i)=>(i??[]).map(l=>r.find(u=>u.column.id===l)).filter(Boolean).map(l=>({...l,position:"right"})),Le(n.options,"debugRows"))},createTable:e=>{e.setColumnPinning=n=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(n),e.resetColumnPinning=n=>{var r,i;return e.setColumnPinning(n?kh():(r=(i=e.initialState)==null?void 0:i.columnPinning)!=null?r:kh())},e.getIsSomeColumnsPinned=n=>{var r;const i=e.getState().columnPinning;if(!n){var s,l;return!!((s=i.left)!=null&&s.length||(l=i.right)!=null&&l.length)}return!!((r=i[n])!=null&&r.length)},e.getLeftLeafColumns=ke(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(n,r)=>(r??[]).map(i=>n.find(s=>s.id===i)).filter(Boolean),Le(e.options,"debugColumns")),e.getRightLeafColumns=ke(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(n,r)=>(r??[]).map(i=>n.find(s=>s.id===i)).filter(Boolean),Le(e.options,"debugColumns")),e.getCenterLeafColumns=ke(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,r,i)=>{const s=[...r??[],...i??[]];return n.filter(l=>!s.includes(l.id))},Le(e.options,"debugColumns"))}};function l3(e){return e||(typeof document<"u"?document:null)}const Hc={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Lh=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),c3={getDefaultColumnDef:()=>Hc,getInitialState:e=>({columnSizing:{},columnSizingInfo:Lh(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Pn("columnSizing",e),onColumnSizingInfoChange:Pn("columnSizingInfo",e)}),createColumn:(e,n)=>{e.getSize=()=>{var r,i,s;const l=n.getState().columnSizing[e.id];return Math.min(Math.max((r=e.columnDef.minSize)!=null?r:Hc.minSize,(i=l??e.columnDef.size)!=null?i:Hc.size),(s=e.columnDef.maxSize)!=null?s:Hc.maxSize)},e.getStart=ke(r=>[r,Fs(n,r),n.getState().columnSizing],(r,i)=>i.slice(0,e.getIndex(r)).reduce((s,l)=>s+l.getSize(),0),Le(n.options,"debugColumns")),e.getAfter=ke(r=>[r,Fs(n,r),n.getState().columnSizing],(r,i)=>i.slice(e.getIndex(r)+1).reduce((s,l)=>s+l.getSize(),0),Le(n.options,"debugColumns")),e.resetSize=()=>{n.setColumnSizing(r=>{let{[e.id]:i,...s}=r;return s})},e.getCanResize=()=>{var r,i;return((r=e.columnDef.enableResizing)!=null?r:!0)&&((i=n.options.enableColumnResizing)!=null?i:!0)},e.getIsResizing=()=>n.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,n)=>{e.getSize=()=>{let r=0;const i=s=>{if(s.subHeaders.length)s.subHeaders.forEach(i);else{var l;r+=(l=s.column.getSize())!=null?l:0}};return i(e),r},e.getStart=()=>{if(e.index>0){const r=e.headerGroup.headers[e.index-1];return r.getStart()+r.getSize()}return 0},e.getResizeHandler=r=>{const i=n.getColumn(e.column.id),s=i?.getCanResize();return l=>{if(!i||!s||(l.persist==null||l.persist(),Ih(l)&&l.touches&&l.touches.length>1))return;const u=e.getSize(),d=e?e.getLeafHeaders().map(T=>[T.column.id,T.column.getSize()]):[[i.id,i.getSize()]],m=Ih(l)?Math.round(l.touches[0].clientX):l.clientX,h={},y=(T,O)=>{typeof O=="number"&&(n.setColumnSizingInfo(M=>{var k,L;const q=n.options.columnResizeDirection==="rtl"?-1:1,H=(O-((k=M?.startOffset)!=null?k:0))*q,$=Math.max(H/((L=M?.startSize)!=null?L:0),-.999999);return M.columnSizingStart.forEach(he=>{let[ve,de]=he;h[ve]=Math.round(Math.max(de+de*$,0)*100)/100}),{...M,deltaOffset:H,deltaPercentage:$}}),(n.options.columnResizeMode==="onChange"||T==="end")&&n.setColumnSizing(M=>({...M,...h})))},v=T=>y("move",T),b=T=>{y("end",T),n.setColumnSizingInfo(O=>({...O,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},S=l3(r),_={moveHandler:T=>v(T.clientX),upHandler:T=>{S?.removeEventListener("mousemove",_.moveHandler),S?.removeEventListener("mouseup",_.upHandler),b(T.clientX)}},C={moveHandler:T=>(T.cancelable&&(T.preventDefault(),T.stopPropagation()),v(T.touches[0].clientX),!1),upHandler:T=>{var O;S?.removeEventListener("touchmove",C.moveHandler),S?.removeEventListener("touchend",C.upHandler),T.cancelable&&(T.preventDefault(),T.stopPropagation()),b((O=T.touches[0])==null?void 0:O.clientX)}},E=u3()?{passive:!1}:!1;Ih(l)?(S?.addEventListener("touchmove",C.moveHandler,E),S?.addEventListener("touchend",C.upHandler,E)):(S?.addEventListener("mousemove",_.moveHandler,E),S?.addEventListener("mouseup",_.upHandler,E)),n.setColumnSizingInfo(T=>({...T,startOffset:m,startSize:u,deltaOffset:0,deltaPercentage:0,columnSizingStart:d,isResizingColumn:i.id}))}}},createTable:e=>{e.setColumnSizing=n=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(n),e.setColumnSizingInfo=n=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(n),e.resetColumnSizing=n=>{var r;e.setColumnSizing(n?{}:(r=e.initialState.columnSizing)!=null?r:{})},e.resetHeaderSizeInfo=n=>{var r;e.setColumnSizingInfo(n?Lh():(r=e.initialState.columnSizingInfo)!=null?r:Lh())},e.getTotalSize=()=>{var n,r;return(n=(r=e.getHeaderGroups()[0])==null?void 0:r.headers.reduce((i,s)=>i+s.getSize(),0))!=null?n:0},e.getLeftTotalSize=()=>{var n,r;return(n=(r=e.getLeftHeaderGroups()[0])==null?void 0:r.headers.reduce((i,s)=>i+s.getSize(),0))!=null?n:0},e.getCenterTotalSize=()=>{var n,r;return(n=(r=e.getCenterHeaderGroups()[0])==null?void 0:r.headers.reduce((i,s)=>i+s.getSize(),0))!=null?n:0},e.getRightTotalSize=()=>{var n,r;return(n=(r=e.getRightHeaderGroups()[0])==null?void 0:r.headers.reduce((i,s)=>i+s.getSize(),0))!=null?n:0}}};let Bc=null;function u3(){if(typeof Bc=="boolean")return Bc;let e=!1;try{const n={get passive(){return e=!0,!1}},r=()=>{};window.addEventListener("test",r,n),window.removeEventListener("test",r)}catch{e=!1}return Bc=e,Bc}function Ih(e){return e.type==="touchstart"}const d3={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Pn("columnVisibility",e)}),createColumn:(e,n)=>{e.toggleVisibility=r=>{e.getCanHide()&&n.setColumnVisibility(i=>({...i,[e.id]:r??!e.getIsVisible()}))},e.getIsVisible=()=>{var r,i;const s=e.columns;return(r=s.length?s.some(l=>l.getIsVisible()):(i=n.getState().columnVisibility)==null?void 0:i[e.id])!=null?r:!0},e.getCanHide=()=>{var r,i;return((r=e.columnDef.enableHiding)!=null?r:!0)&&((i=n.options.enableHiding)!=null?i:!0)},e.getToggleVisibilityHandler=()=>r=>{e.toggleVisibility==null||e.toggleVisibility(r.target.checked)}},createRow:(e,n)=>{e._getAllVisibleCells=ke(()=>[e.getAllCells(),n.getState().columnVisibility],r=>r.filter(i=>i.column.getIsVisible()),Le(n.options,"debugRows")),e.getVisibleCells=ke(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(r,i,s)=>[...r,...i,...s],Le(n.options,"debugRows"))},createTable:e=>{const n=(r,i)=>ke(()=>[i(),i().filter(s=>s.getIsVisible()).map(s=>s.id).join("_")],s=>s.filter(l=>l.getIsVisible==null?void 0:l.getIsVisible()),Le(e.options,"debugColumns"));e.getVisibleFlatColumns=n("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=n("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=n("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=n("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=n("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=r=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(r),e.resetColumnVisibility=r=>{var i;e.setColumnVisibility(r?{}:(i=e.initialState.columnVisibility)!=null?i:{})},e.toggleAllColumnsVisible=r=>{var i;r=(i=r)!=null?i:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((s,l)=>({...s,[l.id]:r||!(l.getCanHide!=null&&l.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(r=>!(r.getIsVisible!=null&&r.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(r=>r.getIsVisible==null?void 0:r.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>r=>{var i;e.toggleAllColumnsVisible((i=r.target)==null?void 0:i.checked)}}};function Fs(e,n){return n?n==="center"?e.getCenterVisibleLeafColumns():n==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const f3={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},h3={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Pn("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:n=>{var r;const i=(r=e.getCoreRowModel().flatRows[0])==null||(r=r._getAllCellsByColumnId()[n.id])==null?void 0:r.getValue();return typeof i=="string"||typeof i=="number"}}),createColumn:(e,n)=>{e.getCanGlobalFilter=()=>{var r,i,s,l;return((r=e.columnDef.enableGlobalFilter)!=null?r:!0)&&((i=n.options.enableGlobalFilter)!=null?i:!0)&&((s=n.options.enableFilters)!=null?s:!0)&&((l=n.options.getColumnCanGlobalFilter==null?void 0:n.options.getColumnCanGlobalFilter(e))!=null?l:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>Yr.includesString,e.getGlobalFilterFn=()=>{var n,r;const{globalFilterFn:i}=e.options;return qu(i)?i:i==="auto"?e.getGlobalAutoFilterFn():(n=(r=e.options.filterFns)==null?void 0:r[i])!=null?n:Yr[i]},e.setGlobalFilter=n=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(n)},e.resetGlobalFilter=n=>{e.setGlobalFilter(n?void 0:e.initialState.globalFilter)}}},m3={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Pn("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let n=!1,r=!1;e._autoResetExpanded=()=>{var i,s;if(!n){e._queue(()=>{n=!0});return}if((i=(s=e.options.autoResetAll)!=null?s:e.options.autoResetExpanded)!=null?i:!e.options.manualExpanding){if(r)return;r=!0,e._queue(()=>{e.resetExpanded(),r=!1})}},e.setExpanded=i=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(i),e.toggleAllRowsExpanded=i=>{i??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=i=>{var s,l;e.setExpanded(i?{}:(s=(l=e.initialState)==null?void 0:l.expanded)!=null?s:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(i=>i.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>i=>{i.persist==null||i.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const i=e.getState().expanded;return i===!0||Object.values(i).some(Boolean)},e.getIsAllRowsExpanded=()=>{const i=e.getState().expanded;return typeof i=="boolean"?i===!0:!(!Object.keys(i).length||e.getRowModel().flatRows.some(s=>!s.getIsExpanded()))},e.getExpandedDepth=()=>{let i=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(l=>{const u=l.split(".");i=Math.max(i,u.length)}),i},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,n)=>{e.toggleExpanded=r=>{n.setExpanded(i=>{var s;const l=i===!0?!0:!!(i!=null&&i[e.id]);let u={};if(i===!0?Object.keys(n.getRowModel().rowsById).forEach(d=>{u[d]=!0}):u=i,r=(s=r)!=null?s:!l,!l&&r)return{...u,[e.id]:!0};if(l&&!r){const{[e.id]:d,...m}=u;return m}return i})},e.getIsExpanded=()=>{var r;const i=n.getState().expanded;return!!((r=n.options.getIsRowExpanded==null?void 0:n.options.getIsRowExpanded(e))!=null?r:i===!0||i?.[e.id])},e.getCanExpand=()=>{var r,i,s;return(r=n.options.getRowCanExpand==null?void 0:n.options.getRowCanExpand(e))!=null?r:((i=n.options.enableExpanding)!=null?i:!0)&&!!((s=e.subRows)!=null&&s.length)},e.getIsAllParentsExpanded=()=>{let r=!0,i=e;for(;r&&i.parentId;)i=n.getRow(i.parentId,!0),r=i.getIsExpanded();return r},e.getToggleExpandedHandler=()=>{const r=e.getCanExpand();return()=>{r&&e.toggleExpanded()}}}},Rm=0,Tm=10,$h=()=>({pageIndex:Rm,pageSize:Tm}),p3={getInitialState:e=>({...e,pagination:{...$h(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:Pn("pagination",e)}),createTable:e=>{let n=!1,r=!1;e._autoResetPageIndex=()=>{var i,s;if(!n){e._queue(()=>{n=!0});return}if((i=(s=e.options.autoResetAll)!=null?s:e.options.autoResetPageIndex)!=null?i:!e.options.manualPagination){if(r)return;r=!0,e._queue(()=>{e.resetPageIndex(),r=!1})}},e.setPagination=i=>{const s=l=>Mo(i,l);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(s)},e.resetPagination=i=>{var s;e.setPagination(i?$h():(s=e.initialState.pagination)!=null?s:$h())},e.setPageIndex=i=>{e.setPagination(s=>{let l=Mo(i,s.pageIndex);const u=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return l=Math.max(0,Math.min(l,u)),{...s,pageIndex:l}})},e.resetPageIndex=i=>{var s,l;e.setPageIndex(i?Rm:(s=(l=e.initialState)==null||(l=l.pagination)==null?void 0:l.pageIndex)!=null?s:Rm)},e.resetPageSize=i=>{var s,l;e.setPageSize(i?Tm:(s=(l=e.initialState)==null||(l=l.pagination)==null?void 0:l.pageSize)!=null?s:Tm)},e.setPageSize=i=>{e.setPagination(s=>{const l=Math.max(1,Mo(i,s.pageSize)),u=s.pageSize*s.pageIndex,d=Math.floor(u/l);return{...s,pageIndex:d,pageSize:l}})},e.setPageCount=i=>e.setPagination(s=>{var l;let u=Mo(i,(l=e.options.pageCount)!=null?l:-1);return typeof u=="number"&&(u=Math.max(-1,u)),{...s,pageCount:u}}),e.getPageOptions=ke(()=>[e.getPageCount()],i=>{let s=[];return i&&i>0&&(s=[...new Array(i)].fill(null).map((l,u)=>u)),s},Le(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:i}=e.getState().pagination,s=e.getPageCount();return s===-1?!0:s===0?!1:ie.setPageIndex(i=>i-1),e.nextPage=()=>e.setPageIndex(i=>i+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var i;return(i=e.options.pageCount)!=null?i:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var i;return(i=e.options.rowCount)!=null?i:e.getPrePaginationRowModel().rows.length}}},Vh=()=>({top:[],bottom:[]}),g3={getInitialState:e=>({rowPinning:Vh(),...e}),getDefaultOptions:e=>({onRowPinningChange:Pn("rowPinning",e)}),createRow:(e,n)=>{e.pin=(r,i,s)=>{const l=i?e.getLeafRows().map(m=>{let{id:h}=m;return h}):[],u=s?e.getParentRows().map(m=>{let{id:h}=m;return h}):[],d=new Set([...u,e.id,...l]);n.setRowPinning(m=>{var h,y;if(r==="bottom"){var v,b;return{top:((v=m?.top)!=null?v:[]).filter(C=>!(d!=null&&d.has(C))),bottom:[...((b=m?.bottom)!=null?b:[]).filter(C=>!(d!=null&&d.has(C))),...Array.from(d)]}}if(r==="top"){var S,_;return{top:[...((S=m?.top)!=null?S:[]).filter(C=>!(d!=null&&d.has(C))),...Array.from(d)],bottom:((_=m?.bottom)!=null?_:[]).filter(C=>!(d!=null&&d.has(C)))}}return{top:((h=m?.top)!=null?h:[]).filter(C=>!(d!=null&&d.has(C))),bottom:((y=m?.bottom)!=null?y:[]).filter(C=>!(d!=null&&d.has(C)))}})},e.getCanPin=()=>{var r;const{enableRowPinning:i,enablePinning:s}=n.options;return typeof i=="function"?i(e):(r=i??s)!=null?r:!0},e.getIsPinned=()=>{const r=[e.id],{top:i,bottom:s}=n.getState().rowPinning,l=r.some(d=>i?.includes(d)),u=r.some(d=>s?.includes(d));return l?"top":u?"bottom":!1},e.getPinnedIndex=()=>{var r,i;const s=e.getIsPinned();if(!s)return-1;const l=(r=s==="top"?n.getTopRows():n.getBottomRows())==null?void 0:r.map(u=>{let{id:d}=u;return d});return(i=l?.indexOf(e.id))!=null?i:-1}},createTable:e=>{e.setRowPinning=n=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(n),e.resetRowPinning=n=>{var r,i;return e.setRowPinning(n?Vh():(r=(i=e.initialState)==null?void 0:i.rowPinning)!=null?r:Vh())},e.getIsSomeRowsPinned=n=>{var r;const i=e.getState().rowPinning;if(!n){var s,l;return!!((s=i.top)!=null&&s.length||(l=i.bottom)!=null&&l.length)}return!!((r=i[n])!=null&&r.length)},e._getPinnedRows=(n,r,i)=>{var s;return((s=e.options.keepPinnedRows)==null||s?(r??[]).map(u=>{const d=e.getRow(u,!0);return d.getIsAllParentsExpanded()?d:null}):(r??[]).map(u=>n.find(d=>d.id===u))).filter(Boolean).map(u=>({...u,position:i}))},e.getTopRows=ke(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(n,r)=>e._getPinnedRows(n,r,"top"),Le(e.options,"debugRows")),e.getBottomRows=ke(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(n,r)=>e._getPinnedRows(n,r,"bottom"),Le(e.options,"debugRows")),e.getCenterRows=ke(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(n,r,i)=>{const s=new Set([...r??[],...i??[]]);return n.filter(l=>!s.has(l.id))},Le(e.options,"debugRows"))}},v3={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Pn("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=n=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(n),e.resetRowSelection=n=>{var r;return e.setRowSelection(n?{}:(r=e.initialState.rowSelection)!=null?r:{})},e.toggleAllRowsSelected=n=>{e.setRowSelection(r=>{n=typeof n<"u"?n:!e.getIsAllRowsSelected();const i={...r},s=e.getPreGroupedRowModel().flatRows;return n?s.forEach(l=>{l.getCanSelect()&&(i[l.id]=!0)}):s.forEach(l=>{delete i[l.id]}),i})},e.toggleAllPageRowsSelected=n=>e.setRowSelection(r=>{const i=typeof n<"u"?n:!e.getIsAllPageRowsSelected(),s={...r};return e.getRowModel().rows.forEach(l=>{Om(s,l.id,i,!0,e)}),s}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=ke(()=>[e.getState().rowSelection,e.getCoreRowModel()],(n,r)=>Object.keys(n).length?Fh(e,r):{rows:[],flatRows:[],rowsById:{}},Le(e.options,"debugTable")),e.getFilteredSelectedRowModel=ke(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(n,r)=>Object.keys(n).length?Fh(e,r):{rows:[],flatRows:[],rowsById:{}},Le(e.options,"debugTable")),e.getGroupedSelectedRowModel=ke(()=>[e.getState().rowSelection,e.getSortedRowModel()],(n,r)=>Object.keys(n).length?Fh(e,r):{rows:[],flatRows:[],rowsById:{}},Le(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const n=e.getFilteredRowModel().flatRows,{rowSelection:r}=e.getState();let i=!!(n.length&&Object.keys(r).length);return i&&n.some(s=>s.getCanSelect()&&!r[s.id])&&(i=!1),i},e.getIsAllPageRowsSelected=()=>{const n=e.getPaginationRowModel().flatRows.filter(s=>s.getCanSelect()),{rowSelection:r}=e.getState();let i=!!n.length;return i&&n.some(s=>!r[s.id])&&(i=!1),i},e.getIsSomeRowsSelected=()=>{var n;const r=Object.keys((n=e.getState().rowSelection)!=null?n:{}).length;return r>0&&r{const n=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:n.filter(r=>r.getCanSelect()).some(r=>r.getIsSelected()||r.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>n=>{e.toggleAllRowsSelected(n.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>n=>{e.toggleAllPageRowsSelected(n.target.checked)}},createRow:(e,n)=>{e.toggleSelected=(r,i)=>{const s=e.getIsSelected();n.setRowSelection(l=>{var u;if(r=typeof r<"u"?r:!s,e.getCanSelect()&&s===r)return l;const d={...l};return Om(d,e.id,r,(u=i?.selectChildren)!=null?u:!0,n),d})},e.getIsSelected=()=>{const{rowSelection:r}=n.getState();return Vp(e,r)},e.getIsSomeSelected=()=>{const{rowSelection:r}=n.getState();return Mm(e,r)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:r}=n.getState();return Mm(e,r)==="all"},e.getCanSelect=()=>{var r;return typeof n.options.enableRowSelection=="function"?n.options.enableRowSelection(e):(r=n.options.enableRowSelection)!=null?r:!0},e.getCanSelectSubRows=()=>{var r;return typeof n.options.enableSubRowSelection=="function"?n.options.enableSubRowSelection(e):(r=n.options.enableSubRowSelection)!=null?r:!0},e.getCanMultiSelect=()=>{var r;return typeof n.options.enableMultiRowSelection=="function"?n.options.enableMultiRowSelection(e):(r=n.options.enableMultiRowSelection)!=null?r:!0},e.getToggleSelectedHandler=()=>{const r=e.getCanSelect();return i=>{var s;r&&e.toggleSelected((s=i.target)==null?void 0:s.checked)}}}},Om=(e,n,r,i,s)=>{var l;const u=s.getRow(n,!0);r?(u.getCanMultiSelect()||Object.keys(e).forEach(d=>delete e[d]),u.getCanSelect()&&(e[n]=!0)):delete e[n],i&&(l=u.subRows)!=null&&l.length&&u.getCanSelectSubRows()&&u.subRows.forEach(d=>Om(e,d.id,r,i,s))};function Fh(e,n){const r=e.getState().rowSelection,i=[],s={},l=function(u,d){return u.map(m=>{var h;const y=Vp(m,r);if(y&&(i.push(m),s[m.id]=m),(h=m.subRows)!=null&&h.length&&(m={...m,subRows:l(m.subRows)}),y)return m}).filter(Boolean)};return{rows:l(n.rows),flatRows:i,rowsById:s}}function Vp(e,n){var r;return(r=n[e.id])!=null?r:!1}function Mm(e,n,r){var i;if(!((i=e.subRows)!=null&&i.length))return!1;let s=!0,l=!1;return e.subRows.forEach(u=>{if(!(l&&!s)&&(u.getCanSelect()&&(Vp(u,n)?l=!0:s=!1),u.subRows&&u.subRows.length)){const d=Mm(u,n);d==="all"?l=!0:(d==="some"&&(l=!0),s=!1)}}),s?"all":l?"some":!1}const Am=/([0-9]+)/gm,y3=(e,n,r)=>p_(Lo(e.getValue(r)).toLowerCase(),Lo(n.getValue(r)).toLowerCase()),b3=(e,n,r)=>p_(Lo(e.getValue(r)),Lo(n.getValue(r))),x3=(e,n,r)=>Fp(Lo(e.getValue(r)).toLowerCase(),Lo(n.getValue(r)).toLowerCase()),S3=(e,n,r)=>Fp(Lo(e.getValue(r)),Lo(n.getValue(r))),w3=(e,n,r)=>{const i=e.getValue(r),s=n.getValue(r);return i>s?1:iFp(e.getValue(r),n.getValue(r));function Fp(e,n){return e===n?0:e>n?1:-1}function Lo(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function p_(e,n){const r=e.split(Am).filter(Boolean),i=n.split(Am).filter(Boolean);for(;r.length&&i.length;){const s=r.shift(),l=i.shift(),u=parseInt(s,10),d=parseInt(l,10),m=[u,d].sort();if(isNaN(m[0])){if(s>l)return 1;if(l>s)return-1;continue}if(isNaN(m[1]))return isNaN(u)?-1:1;if(u>d)return 1;if(d>u)return-1}return r.length-i.length}const zs={alphanumeric:y3,alphanumericCaseSensitive:b3,text:x3,textCaseSensitive:S3,datetime:w3,basic:_3},C3={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Pn("sorting",e),isMultiSortEvent:n=>n.shiftKey}),createColumn:(e,n)=>{e.getAutoSortingFn=()=>{const r=n.getFilteredRowModel().flatRows.slice(10);let i=!1;for(const s of r){const l=s?.getValue(e.id);if(Object.prototype.toString.call(l)==="[object Date]")return zs.datetime;if(typeof l=="string"&&(i=!0,l.split(Am).length>1))return zs.alphanumeric}return i?zs.text:zs.basic},e.getAutoSortDir=()=>{const r=n.getFilteredRowModel().flatRows[0];return typeof r?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var r,i;if(!e)throw new Error;return qu(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(r=(i=n.options.sortingFns)==null?void 0:i[e.columnDef.sortingFn])!=null?r:zs[e.columnDef.sortingFn]},e.toggleSorting=(r,i)=>{const s=e.getNextSortingOrder(),l=typeof r<"u"&&r!==null;n.setSorting(u=>{const d=u?.find(S=>S.id===e.id),m=u?.findIndex(S=>S.id===e.id);let h=[],y,v=l?r:s==="desc";if(u!=null&&u.length&&e.getCanMultiSort()&&i?d?y="toggle":y="add":u!=null&&u.length&&m!==u.length-1?y="replace":d?y="toggle":y="replace",y==="toggle"&&(l||s||(y="remove")),y==="add"){var b;h=[...u,{id:e.id,desc:v}],h.splice(0,h.length-((b=n.options.maxMultiSortColCount)!=null?b:Number.MAX_SAFE_INTEGER))}else y==="toggle"?h=u.map(S=>S.id===e.id?{...S,desc:v}:S):y==="remove"?h=u.filter(S=>S.id!==e.id):h=[{id:e.id,desc:v}];return h})},e.getFirstSortDir=()=>{var r,i;return((r=(i=e.columnDef.sortDescFirst)!=null?i:n.options.sortDescFirst)!=null?r:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=r=>{var i,s;const l=e.getFirstSortDir(),u=e.getIsSorted();return u?u!==l&&((i=n.options.enableSortingRemoval)==null||i)&&(!(r&&(s=n.options.enableMultiRemove)!=null)||s)?!1:u==="desc"?"asc":"desc":l},e.getCanSort=()=>{var r,i;return((r=e.columnDef.enableSorting)!=null?r:!0)&&((i=n.options.enableSorting)!=null?i:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var r,i;return(r=(i=e.columnDef.enableMultiSort)!=null?i:n.options.enableMultiSort)!=null?r:!!e.accessorFn},e.getIsSorted=()=>{var r;const i=(r=n.getState().sorting)==null?void 0:r.find(s=>s.id===e.id);return i?i.desc?"desc":"asc":!1},e.getSortIndex=()=>{var r,i;return(r=(i=n.getState().sorting)==null?void 0:i.findIndex(s=>s.id===e.id))!=null?r:-1},e.clearSorting=()=>{n.setSorting(r=>r!=null&&r.length?r.filter(i=>i.id!==e.id):[])},e.getToggleSortingHandler=()=>{const r=e.getCanSort();return i=>{r&&(i.persist==null||i.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?n.options.isMultiSortEvent==null?void 0:n.options.isMultiSortEvent(i):!1))}}},createTable:e=>{e.setSorting=n=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(n),e.resetSorting=n=>{var r,i;e.setSorting(n?[]:(r=(i=e.initialState)==null?void 0:i.sorting)!=null?r:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},E3=[qk,d3,a3,s3,Zk,Kk,f3,h3,C3,o3,m3,p3,g3,v3,c3];function R3(e){var n,r;const i=[...E3,...(n=e._features)!=null?n:[]];let s={_features:i};const l=s._features.reduce((b,S)=>Object.assign(b,S.getDefaultOptions==null?void 0:S.getDefaultOptions(s)),{}),u=b=>s.options.mergeOptions?s.options.mergeOptions(l,b):{...l,...b};let m={...{},...(r=e.initialState)!=null?r:{}};s._features.forEach(b=>{var S;m=(S=b.getInitialState==null?void 0:b.getInitialState(m))!=null?S:m});const h=[];let y=!1;const v={_features:i,options:{...l,...e},initialState:m,_queue:b=>{h.push(b),y||(y=!0,Promise.resolve().then(()=>{for(;h.length;)h.shift()();y=!1}).catch(S=>setTimeout(()=>{throw S})))},reset:()=>{s.setState(s.initialState)},setOptions:b=>{const S=Mo(b,s.options);s.options=u(S)},getState:()=>s.options.state,setState:b=>{s.options.onStateChange==null||s.options.onStateChange(b)},_getRowId:(b,S,_)=>{var C;return(C=s.options.getRowId==null?void 0:s.options.getRowId(b,S,_))!=null?C:`${_?[_.id,S].join("."):S}`},getCoreRowModel:()=>(s._getCoreRowModel||(s._getCoreRowModel=s.options.getCoreRowModel(s)),s._getCoreRowModel()),getRowModel:()=>s.getPaginationRowModel(),getRow:(b,S)=>{let _=(S?s.getPrePaginationRowModel():s.getRowModel()).rowsById[b];if(!_&&(_=s.getCoreRowModel().rowsById[b],!_))throw new Error;return _},_getDefaultColumnDef:ke(()=>[s.options.defaultColumn],b=>{var S;return b=(S=b)!=null?S:{},{header:_=>{const C=_.header.column.columnDef;return C.accessorKey?C.accessorKey:C.accessorFn?C.id:null},cell:_=>{var C,E;return(C=(E=_.renderValue())==null||E.toString==null?void 0:E.toString())!=null?C:null},...s._features.reduce((_,C)=>Object.assign(_,C.getDefaultColumnDef==null?void 0:C.getDefaultColumnDef()),{}),...b}},Le(e,"debugColumns")),_getColumnDefs:()=>s.options.columns,getAllColumns:ke(()=>[s._getColumnDefs()],b=>{const S=function(_,C,E){return E===void 0&&(E=0),_.map(T=>{const O=Bk(s,T,E,C),M=T;return O.columns=M.columns?S(M.columns,O,E+1):[],O})};return S(b)},Le(e,"debugColumns")),getAllFlatColumns:ke(()=>[s.getAllColumns()],b=>b.flatMap(S=>S.getFlatColumns()),Le(e,"debugColumns")),_getAllFlatColumnsById:ke(()=>[s.getAllFlatColumns()],b=>b.reduce((S,_)=>(S[_.id]=_,S),{}),Le(e,"debugColumns")),getAllLeafColumns:ke(()=>[s.getAllColumns(),s._getOrderColumnsFn()],(b,S)=>{let _=b.flatMap(C=>C.getLeafColumns());return S(_)},Le(e,"debugColumns")),getColumn:b=>s._getAllFlatColumnsById()[b]};Object.assign(s,v);for(let b=0;bke(()=>[e.options.data],n=>{const r={rows:[],flatRows:[],rowsById:{}},i=function(s,l,u){l===void 0&&(l=0);const d=[];for(let h=0;he._autoResetPageIndex()))}function v_(){return e=>ke(()=>[e.getState().sorting,e.getPreSortedRowModel()],(n,r)=>{if(!r.rows.length||!(n!=null&&n.length))return r;const i=e.getState().sorting,s=[],l=i.filter(m=>{var h;return(h=e.getColumn(m.id))==null?void 0:h.getCanSort()}),u={};l.forEach(m=>{const h=e.getColumn(m.id);h&&(u[m.id]={sortUndefined:h.columnDef.sortUndefined,invertSorting:h.columnDef.invertSorting,sortingFn:h.getSortingFn()})});const d=m=>{const h=m.map(y=>({...y}));return h.sort((y,v)=>{for(let S=0;S{var v;s.push(y),(v=y.subRows)!=null&&v.length&&(y.subRows=d(y.subRows))}),h};return{rows:d(r.rows),flatRows:s,rowsById:r.rowsById}},Le(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function mu(e,n){return e?T3(e)?x.createElement(e,n):e:null}function T3(e){return O3(e)||typeof e=="function"||M3(e)}function O3(e){return typeof e=="function"&&(()=>{const n=Object.getPrototypeOf(e);return n.prototype&&n.prototype.isReactComponent})()}function M3(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function y_(e){const n={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[r]=x.useState(()=>({current:R3(n)})),[i,s]=x.useState(()=>r.current.initialState);return r.current.setOptions(l=>({...l,...e,state:{...i,...e.state},onStateChange:u=>{s(u),e.onStateChange==null||e.onStateChange(u)}})),r.current}var pl=e=>e.type==="checkbox",Ao=e=>e instanceof Date,an=e=>e==null;const Pp=e=>typeof e=="object";var Tt=e=>!an(e)&&!Array.isArray(e)&&Pp(e)&&!Ao(e),A3=e=>Tt(e)&&e.target?pl(e.target)?e.target.checked:e.target.value:e,j3=(e,n)=>n.split(".").some((r,i,s)=>!isNaN(Number(r))&&e.has(s.slice(0,i).join("."))),b_=e=>{const n=e.constructor&&e.constructor.prototype;return Tt(n)&&n.hasOwnProperty("isPrototypeOf")},Gu=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function At(e){if(e instanceof Date)return new Date(e);const n=typeof FileList<"u"&&e instanceof FileList;if(Gu&&(e instanceof Blob||n))return e;const r=Array.isArray(e);if(!r&&!(Tt(e)&&b_(e)))return e;const i=r?[]:Object.create(Object.getPrototypeOf(e));for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(i[s]=At(e[s]));return i}const va={BLUR:"blur",FOCUS_OUT:"focusout",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},hr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},dr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},x_="root",Up=["__proto__","constructor","prototype"],z3=/^\w*$/;var gl=e=>z3.test(e),yt=e=>e===void 0;const N3=/[.[\]'"]/;var Zu=e=>e.split(N3).filter(Boolean),we=(e,n,r)=>{if(!n||!Tt(e))return r;const i=gl(n)?[n]:Zu(n);if(i.some(l=>Up.includes(l)))return r;const s=i.reduce((l,u)=>an(l)?void 0:l[u],e);return yt(s)||s===e?yt(e[n])?r:e[n]:s},_r=e=>typeof e=="boolean",Wn=e=>typeof e=="function",ft=(e,n,r)=>{let i=-1;const s=gl(n)?[n]:Zu(n),l=s.length,u=l-1;for(;++i{const s={};for(const l in e)Object.defineProperty(s,l,{get:()=>{const u=l;return n._proxyFormState[u]!==hr.all&&(n._proxyFormState[u]=!i||hr.all),e[u]}});return s};const L3=Gu?fe.useLayoutEffect:fe.useEffect;var ln=e=>typeof e=="string",I3=(e,n,r,i,s)=>ln(e)?(i&&n.watch.add(e),we(r,e,s)):Array.isArray(e)?e.map(l=>(i&&n.watch.add(l),we(r,l))):(i&&(n.watchAll=!0),r),jm=e=>an(e)||!Pp(e);const ex=(e,n)=>n.length===0&&!Array.isArray(e)&&!b_(e);function Cr(e,n,r=new WeakMap){if(e===n)return!0;if(jm(e)||jm(n))return Object.is(e,n);if(Ao(e)&&Ao(n))return Object.is(e.getTime(),n.getTime());const i=Object.keys(e),s=Object.keys(n);if(i.length!==s.length)return!1;if(ex(e,i)||ex(n,s))return Object.is(e,n);if(!i.length&&Array.isArray(e)!==Array.isArray(n))return!1;const l=r.get(e);if(l&&l.has(n))return!0;if(l)l.add(n);else{const u=new WeakSet;u.add(n),r.set(e,u)}for(const u of i){const d=e[u];if(!(u in n))return!1;if(u!=="ref"){const m=n[u];if(Ao(d)&&Ao(m)||(Tt(d)||Array.isArray(d))&&(Tt(m)||Array.isArray(m))?!Cr(d,m,r):!Object.is(d,m))return!1}}return!0}var qc=e=>({isOnSubmit:!e||e===hr.onSubmit,isOnBlur:e===hr.onBlur,isOnChange:e===hr.onChange,isOnAll:e===hr.all,isOnTouch:e===hr.onTouched}),Ph=(e,n,r)=>{if(r)return!1;if(n.watchAll||n.watch.has(e))return!0;for(const i of n.watch)if(e.startsWith(i)&&e.charAt(i.length)===".")return!0;return!1};const Ps=(e,n,r,i)=>{for(const s of r||Object.keys(e)){const l=we(e,s);if(l){const{_f:u,...d}=l;if(u){if(u.refs&&u.refs[0]&&n(u.refs[0],s)&&!i)return!0;if(u.ref&&n(u.ref,u.name)&&!i)return!0;if(Ps(d,n))break}else if(Tt(d)&&Ps(d,n))break}}};var tx=(e,n,r)=>{const i=we(e,r),s=Array.isArray(i)?i:[];return ft(s,x_,n[r]),ft(e,r,s),e},on=e=>Tt(e)&&!Object.keys(e).length,Hp=e=>e.type==="file",pu=e=>{if(!Gu)return!1;const n=e?e.ownerDocument:0;return e instanceof(n&&n.defaultView?n.defaultView.HTMLElement:HTMLElement)},Bp=e=>e.type==="radio",gu=e=>e instanceof RegExp,qp=(e,n,r,i,s)=>n?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[i]:s||!0}}:{};const nx={value:!1,isValid:!1},rx={value:!0,isValid:!0};var S_=e=>{if(Array.isArray(e)){if(e.length>1){const n=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:n,isValid:!!n.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!yt(e[0].attributes.value)?yt(e[0].value)||e[0].value===""?rx:{value:e[0].value,isValid:!0}:rx:nx}return nx};const ox={isValid:!1,value:null};var w_=e=>Array.isArray(e)?e.reduce((n,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:n,ox):ox;function ix(e,n,r="validate"){if(ln(e)||Array.isArray(e)&&e.every(ln)||_r(e)&&!e)return{type:r,message:ln(e)?e:"",ref:n}}var ya=e=>Tt(e)&&!gu(e)?e:{value:e,message:""},ax=async(e,n,r,i,s,l)=>{const{ref:u,refs:d,required:m,maxLength:h,minLength:y,min:v,max:b,pattern:S,validate:_,name:C,valueAsNumber:E,mount:T}=e._f,O=we(r,C);if(!T||n.has(C))return{};const M=d?d[0]:u,k=le=>{if(s&&M.reportValidity){const ae=_r(le)?"":le||"";d?d.forEach(me=>me.setCustomValidity(ae)):M.setCustomValidity(ae),M.reportValidity()}},L={},q=Bp(u),H=pl(u),$=q||H,he=(E||Hp(u))&&yt(u.value)&&yt(O)||pu(u)&&u.value===""||O===""||Array.isArray(O)&&!O.length,ve=qp.bind(null,C,i,L),de=(le,ae,me,ye=dr.maxLength,D=dr.minLength)=>{const Y=le?ae:me;L[C]={type:le?ye:D,message:Y,ref:u,...ve(le?ye:D,Y)}};if(l?!Array.isArray(O)||!O.length:m&&(!$&&(he||an(O))||_r(O)&&!O||H&&!S_(d).isValid||q&&!w_(d).isValid)){const{value:le,message:ae}=ln(m)?{value:!!m,message:m}:ya(m);if(le&&(L[C]={type:dr.required,message:ae,ref:M,...ve(dr.required,ae)},!i))return k(ae),L}if(!he&&(!an(v)||!an(b))){let le,ae;const me=ya(b),ye=ya(v);if(!an(O)&&!isNaN(O)){const D=u.valueAsNumber||O&&+O;an(me.value)||(le=D>me.value),an(ye.value)||(ae=Dnew Date(new Date().toDateString()+" "+W),ne=u.type=="time",J=u.type=="week";ln(me.value)&&O&&(le=ne?Y(O)>Y(me.value):J?O>me.value:D>new Date(me.value)),ln(ye.value)&&O&&(ae=ne?Y(O)+le.value,ye=!an(ae.value)&&O.length<+ae.value;if((me||ye)&&(de(me,le.message,ae.message),!i))return k(L[C].message),L}if(S&&!he&&ln(O)){const{value:le,message:ae}=ya(S);if(gu(le)&&!O.match(le)&&(L[C]={type:dr.pattern,message:ae,ref:u,...ve(dr.pattern,ae)},!i))return k(ae),L}if(_){if(Wn(_)){const le=await _(O,r),ae=ix(le,M);if(ae&&(L[C]={...ae,...ve(dr.validate,ae.message)},!i))return k(ae.message),L}else if(Tt(_)){let le={};for(const ae in _){if(!on(le)&&!i)break;const me=ix(await _[ae](O,r),M,ae);me&&(le={...me,...ve(ae,me.message)},k(me.message),i&&(L[C]=le))}if(!on(le)&&(L[C]={ref:M,...le},!i))return L}}return k(!0),L},tu=e=>Array.isArray(e)?e:[e],__=e=>Array.isArray(e)?e.filter(Boolean):[];function $3(e,n){const r=n.slice(0,-1).length;let i=0;for(;iUp.includes(String(u))))return e;const i=r.length===1?e:$3(e,r),s=r.length-1,l=r[s];return i&&delete i[l],s!==0&&(Tt(i)&&on(i)||Array.isArray(i)&&V3(i))&&jt(e,r.slice(0,-1)),e}const C_=e=>{const n={};for(const r of Object.keys(e))if(Pp(e[r])&&e[r]!==null&&!Ao(e[r])){const i=C_(e[r]);for(const s of Object.keys(i))n[`${r}.${s}`]=i[s]}else n[r]=e[r];return n},F3=fe.createContext(null);F3.displayName="HookFormContext";var sx=()=>{let e=[];return{get observers(){return e},next:s=>{for(const l of e)l.next&&l.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(l=>l!==s)}}),unsubscribe:()=>{e=[]}}};function E_(e,n){const r={};for(const i in e)if(e.hasOwnProperty(i)){const s=e[i],l=n[i];if(s&&Tt(s)&&l){const u=E_(s,l);Tt(u)&&(r[i]=u)}else e[i]&&(r[i]=l)}return r}var R_=e=>e.type==="select-multiple",P3=e=>Bp(e)||pl(e),Uh=e=>pu(e)&&e.isConnected,U3=e=>{for(const n in e)if(Wn(e[n]))return!0;return!1};function T_(e){return Array.isArray(e)||Tt(e)&&!U3(e)}function O_(e){return!!(e&&"_f"in e)}function M_(e){return Array.isArray(e)?!e.some(n=>!yt(n)):!Object.keys(e).length}function zm(e,n){Array.isArray(e)?e[n]=void 0:delete e[n]}function Nm(e,n={},r){for(const i in e){const s=e[i],l=r&&r[i];T_(s)&&(!Array.isArray(s)||!O_(l))?(n[i]=Array.isArray(s)?[]:{},Nm(s,n[i],l),M_(n[i])&&zm(n,i)):yt(s)||(n[i]=!0)}return n}function di(e,n,r,i){r||(r=Nm(n,{},i));for(const s in e){const l=e[s],u=i&&i[s];T_(l)&&(!Array.isArray(l)||!O_(u))?(yt(n)||jm(r[s])?r[s]=Nm(l,Array.isArray(l)?[]:{},u):di(l,an(n)?{}:n[s],r[s],u),M_(r[s])&&zm(r,s)):Cr(l,n[s])?zm(r,s):r[s]=!0}return r}var A_=(e,{valueAsNumber:n,valueAsDate:r,setValueAs:i})=>yt(e)?e:n?e===""?NaN:e&&+e:r&&ln(e)?new Date(e):i?i(e):e;function lx(e){const n=e.ref;return Hp(n)?n.files:Bp(n)?w_(e.refs).value:R_(n)?[...n.selectedOptions].map(({value:r})=>r):pl(n)?S_(e.refs).value:A_(yt(n.value)?e.ref.value:n.value,e)}var H3=(e,n,r,i)=>{const s={};for(const l of e){const u=we(n,l);u&&ft(s,l,u._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:i}},Ns=e=>yt(e)?e:gu(e)?e.source:Tt(e)?gu(e.value)?e.value.source:e.value:e;const cx="AsyncFunction";var B3=e=>{if(!e||!e.validate)return!1;if(Wn(e.validate))return e.validate.constructor.name===cx;if(Tt(e.validate)){for(const n in e.validate)if(e.validate[n].constructor.name===cx)return!0}return!1},q3=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function ux(e,n,r){const i=we(e,r);if(i||gl(r))return{error:i,name:r};const s=r.split(".");for(;s.length;){const l=s.join("."),u=we(n,l),d=we(e,l);if(u&&!Array.isArray(u)&&r!==l)return{name:r};if(d&&d.type)return{name:l,error:d};if(d&&d.root&&d.root.type)return{name:`${l}.root`,error:d.root};s.pop()}return{name:r}}var G3=(e,n,r,i)=>{r(e);const{name:s,...l}=e,u=Object.keys(l);return!u.length||i&&u.length>=Object.keys(n).length||u.find(d=>n[d]===(!i||hr.all))},Z3=(e,n,r)=>!e||!n||e===n||tu(e).some(i=>i&&(r?i===n||i.startsWith(n+"."):i.startsWith(n)||n.startsWith(i))),K3=(e,n,r,i,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(n||e):(r?i.isOnBlur:s.isOnBlur)?!e:(r?i.isOnChange:s.isOnChange)?e:!0,Y3=(e,n)=>!__(we(e,n)).length&&jt(e,n);const Q3={mode:hr.onSubmit,reValidateMode:hr.onChange,shouldFocusError:!0},Hh="form",j_={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function X3(e={}){let n={...Q3,...e},r={...At(j_),isLoading:Wn(n.defaultValues),errors:n.errors||{},disabled:n.disabled||!1},i={},s=Tt(n.defaultValues)||Tt(n.values)?At(n.defaultValues||n.values)||{}:{},l=n.shouldUnregister?{}:At(s),u={action:!1,mount:!1,watch:!1,keepIsValid:!1},d={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set};const m={},h={};let y=0,v=qc(n.mode),b=qc(n.reValidateMode);const S={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},_={...S};let C={..._};const E={array:sx(),state:sx()};let T=0;const O=n.criteriaMode===hr.all,M=(A,V)=>F=>{clearTimeout(h[A]),h[A]=setTimeout(V,F)},k=async A=>{if(!u.keepIsValid&&!n.disabled&&(_.isValid||C.isValid||A)){const V=++T;let F;n.resolver?(F=on((await me()).errors),V===T&&L()):F=await Y({fields:i,onlyCheckValid:!0,eventType:va.VALID}),V===T&&F!==r.isValid&&E.state.next({isValid:F})}},L=(A,V)=>{!n.disabled&&(_.isValidating||_.validatingFields||C.isValidating||C.validatingFields)&&((A||Array.from(d.mount)).forEach(F=>{F&&(V?ft(r.validatingFields,F,V):jt(r.validatingFields,F))}),E.state.next({validatingFields:r.validatingFields,isValidating:!on(r.validatingFields)}))},q=()=>{r.dirtyFields=di(s,l,void 0,i)},H=(A,V=[],F,se,ue=!0,pe=!0)=>{if(se&&F&&!n.disabled){if(u.action=!0,pe&&Array.isArray(we(i,A))){const xe=F(we(i,A),se.argA,se.argB);ue&&ft(i,A,xe)}if(pe&&Array.isArray(we(r.errors,A))){const xe=F(we(r.errors,A),se.argA,se.argB);ue&&ft(r.errors,A,xe),Y3(r.errors,A)}if((_.touchedFields||C.touchedFields)&&pe&&Array.isArray(we(r.touchedFields,A))){const xe=F(we(r.touchedFields,A),se.argA,se.argB);ue&&ft(r.touchedFields,A,xe)}(_.dirtyFields||C.dirtyFields)&&q(),E.state.next({name:A,isDirty:J(A,V),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ft(l,A,V)},$=(A,V)=>{ft(r.errors,A,V),r.errors={...r.errors},E.state.next({errors:r.errors})},he=A=>{r.errors=A,E.state.next({errors:r.errors,isValid:!1})},ve=A=>{const V=gl(A)?[A]:Zu(A);let F=l,se=s;for(let ue=0;ue{const ue=we(i,A);if(ue){if(ve(A))return;const pe=yt(we(l,A)),xe=we(l,A,yt(F)?we(s,A):F);yt(xe)||se&&se.defaultChecked||V?ft(l,A,V?xe:lx(ue._f)):j(A,xe),u.mount&&!u.action&&(k(),pe&&r.isDirty&&(_.isDirty||C.isDirty)&&(J()||(r.isDirty=!1,E.state.next({...r}))),e.shouldUnregister&&pe&&!yt(we(l,A))&&Ph(A,d)&&(u.watch=!0))}},le=(A,V,F,se,ue)=>{let pe=!1,xe=!1;const Se={name:A};if(!n.disabled||se===!0){if(!F||se){const Te=Cr(we(s,A),V);(_.isDirty||C.isDirty)&&(xe=r.isDirty,r.isDirty=Se.isDirty=!Te||J(),pe=xe!==Se.isDirty),xe=!!we(r.dirtyFields,A),Te!==r.isDirty?r.dirtyFields=di(s,l,void 0,i):Te?jt(r.dirtyFields,A):ft(r.dirtyFields,A,!0),Se.dirtyFields=r.dirtyFields,pe=pe||(_.dirtyFields||C.dirtyFields)&&xe!==!Te}if(F){const Te=we(r.touchedFields,A);Te||(ft(r.touchedFields,A,F),Se.touchedFields=r.touchedFields,pe=pe||(_.touchedFields||C.touchedFields)&&Te!==F)}pe&&ue&&E.state.next(Se)}return pe?Se:{}},ae=(A,V,F,se)=>{const ue=we(r.errors,A),pe=(_.isValid||C.isValid)&&_r(V)&&r.isValid!==V;if(n.delayError&&F?(m[A]=M(A,()=>$(A,F)),m[A](n.delayError)):(clearTimeout(h[A]),delete m[A],F?ft(r.errors,A,F):jt(r.errors,A),r.errors={...r.errors}),(F?!Cr(ue,F):ue)||!on(se)||pe){const xe={...se,...pe&&_r(V)?{isValid:V}:{},errors:r.errors,name:A};r={...r,...xe},E.state.next(xe)}},me=async A=>(L(A,!0),await n.resolver(l,n.context,H3(A||d.mount,i,n.criteriaMode,n.shouldUseNativeValidation))),ye=async A=>{const{errors:V}=await me(A);if(L(A),A){for(const F of A){const se=we(V,F);se?d.array.has(F)&&Tt(se)&&!Object.keys(se).some(ue=>!Number.isNaN(Number(ue)))?tx(r.errors,{[F]:se},F):ft(r.errors,F,se):jt(r.errors,F)}r.errors={...r.errors}}else r.errors=V;return V},D=async({name:A,eventType:V})=>{if(e.validate){const F=await e.validate({formValues:l,formState:r,name:A,eventType:V});if(Tt(F))for(const se in F){const ue=F[se];ue&<(`${Hh}.${se}`,{message:ln(ue.message)?ue.message:"",type:ue.type||dr.validate})}else ln(F)||!F?lt(Hh,{message:F||"",type:dr.validate}):Ue(Hh);return F}return!0},Y=async({fields:A,onlyCheckValid:V,name:F,eventType:se,context:ue={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(ue.runRootValidation=!0,!await D({name:F,eventType:se})&&(ue.valid=!1,V)))return ue.valid;for(const pe in A){const xe=A[pe];if(xe){const{_f:Se,...Te}=xe;if(Se){const rt=d.array.has(Se.name),wt=xe._f&&B3(xe._f),Jt=_.validatingFields||_.isValidating||C.validatingFields||C.isValidating;wt&&Jt&&L([Se.name],!0);const Nt=await ax(xe,d.disabled,l,O,n.shouldUseNativeValidation&&!V,rt);if(wt&&Jt&&L([Se.name]),Nt[Se.name]&&(ue.valid=!1,V)||(!V&&(we(Nt,Se.name)?rt?tx(r.errors,Nt,Se.name):ft(r.errors,Se.name,Nt[Se.name]):jt(r.errors,Se.name)),e.shouldUseNativeValidation&&Nt[Se.name]))break}!on(Te)&&await Y({context:ue,onlyCheckValid:V,fields:Te,name:pe,eventType:se})}}return ue.valid},ne=()=>{for(const A of d.unMount){const V=we(i,A);V&&(V._f.refs?V._f.refs.every(F=>!Uh(F)):!Uh(V._f.ref))&&qt(A)}d.unMount=new Set},J=(A,V)=>(A&&V&&ft(l,A,V),!Cr(u.mount?l:s,s)),W=(A,V,F)=>I3(A,d,{...u.mount?l:yt(V)?s:ln(A)?{[A]:V}:V},F,V),z=A=>__(we(u.mount?l:s,A,n.shouldUnregister?we(s,A,[]):[])),j=(A,V,F={},se=!1,ue=!1)=>{const pe=we(i,A);let xe=V;if(pe){const Se=pe._f;Se&&(!Se.disabled&&ft(l,A,A_(V,Se)),xe=pu(Se.ref)&&an(V)?"":V,R_(Se.ref)?[...Se.ref.options].forEach(Te=>Te.selected=xe.includes(Te.value)):Se.refs?pl(Se.ref)?Se.refs.forEach(Te=>{(!Te.defaultChecked||!Te.disabled)&&(Array.isArray(xe)?Te.checked=!!xe.find(rt=>rt===Te.value):Te.checked=xe===Te.value||!!xe)}):Se.refs.forEach(Te=>Te.checked=Te.value===xe):Hp(Se.ref)?Se.ref.value="":(Se.ref.value=xe,!Se.ref.type&&!ue&&E.state.next({name:A,values:se?l:At(l)})))}(F.shouldDirty||F.shouldTouch)&&le(A,xe,F.shouldTouch,F.shouldDirty,!ue),F.shouldValidate&&be(A,{delayError:F.delayError})},U=(A,V,F,se=!1,ue=!1)=>{for(const pe in V){if(!V.hasOwnProperty(pe))return;const xe=V[pe],Se=A+"."+pe,Te=we(i,Se);(d.array.has(A)||Tt(xe)||Te&&!Te._f)&&!Ao(xe)?U(Se,xe,F,se,ue):j(Se,xe,F,se,ue)}},Q=(A,V,F,se,ue=!1)=>{const pe=we(i,A),xe=d.array.has(A),Se=se?V:At(V),Te=we(l,A),rt=Cr(Te,Se);if(rt||ft(l,A,Se),xe)E.array.next({name:A,values:se?l:At(l)}),(_.isDirty||_.dirtyFields||C.isDirty||C.dirtyFields)&&F.shouldDirty&&(q(),ue||E.state.next({name:A,dirtyFields:r.dirtyFields,isDirty:J(A,Se)}));else{const wt=Array.isArray(Se)&&!Se.length||on(Se);!pe||pe._f||an(Se)||wt?j(A,Se,F,se,ue):U(A,Se,F,se,ue)}if(!rt&&!ue){const wt=Ph(A,d),Jt=se?l:At(l);E.state.next({...wt&&r,name:u.mount||wt?A:void 0,values:Jt})}},Z=(A,V,F={})=>Q(A,V,F,!1),re=(A,V={})=>{const F=Wn(A)?A(l):A;if(!Cr(l,F)){l={...l,...F};const se=C_(F);for(const ue of d.mount)ue in se&&Q(ue,se[ue],V,!0,!0);E.state.next({...r,name:void 0,type:void 0,...y?{values:l}:{}}),V.shouldValidate&&k()}},ee=async A=>{u.mount=!0;const V=A.target;let F=V.name,se=!0;const ue=we(i,F),pe=xe=>{se=Number.isNaN(xe)||Ao(xe)&&isNaN(xe.getTime())||Cr(xe,we(l,F,xe))};if(ue){let xe,Se;const Te=V.type?lx(ue._f):A3(A),rt=A.type===va.BLUR||A.type===va.FOCUS_OUT,wt=!q3(ue._f)&&!e.validate&&!n.resolver&&!we(r.errors,F)&&!ue._f.deps,Jt=wt||K3(rt,we(r.touchedFields,F),r.isSubmitted,b,v),Nt=Ph(F,d,rt);if(ft(l,F,Te),rt){if(!V||!V.readOnly){ue._f.onBlur&&ue._f.onBlur(A);const bt=m[F];bt&&bt(0)}}else ue._f.onChange&&ue._f.onChange(A);const je=le(F,Te,rt),pt=!on(je)||Nt;if(!rt&&E.state.next({name:F,type:A.type,...y?{values:At(l)}:{}}),Jt)return(!wt||!r.isValid)&&(_.isValid||C.isValid)&&(n.mode==="onBlur"?rt&&k():rt||k()),pt&&E.state.next({name:F,...Nt?{}:je});if(!n.resolver&&e.validate&&await D({name:F,eventType:A.type}),!rt&&Nt&&E.state.next({...r}),n.resolver){const{errors:bt}=await me([F]);if(L([F]),pe(Te),!se){!on(je)&&E.state.next(je);return}const Gt=ux(r.errors,i,F),ir=ux(bt,i,Gt.name||F);xe=ir.error,F=ir.name,Se=on(bt)}else L([F],!0),xe=(await ax(ue,d.disabled,l,O,n.shouldUseNativeValidation))[F],L([F]),pe(Te),se&&(xe?Se=!1:(_.isValid||C.isValid)&&(Se=await Y({fields:i,onlyCheckValid:!0,name:F,eventType:A.type})));se&&(ue._f.deps&&(!Array.isArray(ue._f.deps)||ue._f.deps.length>0)&&be(ue._f.deps),ae(F,Se,xe,je))}},ge=(A,V)=>{if(we(r.errors,V)&&A.focus)return A.focus(),1},be=async(A,V={})=>{let F,se;const ue=tu(A);if(n.resolver){const pe=await ye(yt(A)?A:ue);F=on(pe),se=A?!ue.some(xe=>we(pe,xe)):F}else A?(se=(await Promise.all(ue.map(async pe=>{const xe=we(i,pe);return await Y({fields:xe&&xe._f?{[pe]:xe}:xe,eventType:va.TRIGGER})}))).every(Boolean),!(!se&&!r.isValid)&&k()):se=F=await Y({fields:i,name:A,eventType:va.TRIGGER});if(V.delayError&&n.delayError&&ln(A)){const pe=we(r.errors,A);pe?(jt(r.errors,A),m[A]=M(A,()=>$(A,pe)),m[A](n.delayError)):(clearTimeout(h[A]),delete m[A])}return E.state.next({...!ln(A)||(_.isValid||C.isValid)&&F!==r.isValid?{}:{name:A},...n.resolver||!A?{isValid:F}:{},errors:r.errors}),V.shouldFocus&&!se&&Ps(i,ge,A?ue:d.mount),se},De=(A,V)=>{let F={...u.mount?l:s};return V&&(F=E_(V.dirtyFields?r.dirtyFields:r.touchedFields,F)),yt(A)?F:ln(A)?we(F,A):A.map(se=>we(F,se))},Ve=(A,V)=>({invalid:!!we((V||r).errors,A),isDirty:!!we((V||r).dirtyFields,A),error:we((V||r).errors,A),isValidating:!!we(r.validatingFields,A),isTouched:!!we((V||r).touchedFields,A)}),Ue=A=>{const V=A?tu(A):void 0;V?.forEach(F=>jt(r.errors,F)),V?V.forEach(F=>{E.state.next({name:F,errors:r.errors})}):E.state.next({errors:{}})},lt=(A,V,F)=>{const se=(we(i,A,{_f:{}})._f||{}).ref,ue=we(r.errors,A)||{},{ref:pe,message:xe,type:Se,...Te}=ue;ft(r.errors,A,{...Te,...V,ref:se}),E.state.next({name:A,errors:r.errors,isValid:!1}),F&&F.shouldFocus&&se&&se.focus&&se.focus()},Xe=(A,V)=>{if(Wn(A)){y++;const{unsubscribe:F}=E.state.subscribe({next:ue=>"values"in ue&&A(ue.values||W(void 0,V),ue)});let se=!1;return{unsubscribe:()=>{se||(se=!0,y--,F())}}}return W(A,V,!0)},Xt=A=>{var V;const F=!!(!((V=A.formState)===null||V===void 0)&&V.values);F&&y++;const{unsubscribe:se}=E.state.subscribe({next:pe=>{if(Z3(A.name,pe.name,A.exact)&&G3(pe,A.formState||_,Ri,A.reRenderRoot)){const xe={...l};A.callback({values:xe,...r,...pe,defaultValues:s})}}});if(!F)return se;let ue=!1;return()=>{ue||(ue=!0,y--,se())}},mn=A=>(u.mount=!0,C={...C,...A.formState},Xt({...A,formState:{...S,...A.formState}})),qt=(A,V={})=>{for(const F of A?tu(A):d.mount)d.mount.delete(F),d.array.delete(F),V.keepValue||(jt(i,F),jt(l,F)),!V.keepError&&jt(r.errors,F),!V.keepDirty&&jt(r.dirtyFields,F),!V.keepTouched&&jt(r.touchedFields,F),!V.keepIsValidating&&jt(r.validatingFields,F),!n.shouldUnregister&&!V.keepDefaultValue&&jt(s,F);E.state.next({values:At(l)}),E.state.next({...r,...V.keepDirty?{isDirty:J()}:{}}),!V.keepIsValid&&k()},Pt=({disabled:A,name:V})=>{if(_r(A)&&u.mount||A||d.disabled.has(V)){const ue=d.disabled.has(V)!==!!A;A?d.disabled.add(V):d.disabled.delete(V),ue&&u.mount&&!u.action&&k()}},Ut=(A,V={})=>{let F=we(i,A);const se=_r(V.disabled)||_r(n.disabled),ue=!d.registerName.has(A)&&F&&F._f&&!F._f.mount;return ft(i,A,{...F||{},_f:{...F&&F._f?F._f:{ref:{name:A}},name:A,mount:!0,...V}}),d.mount.add(A),F&&!ue?Pt({disabled:_r(V.disabled)?V.disabled:n.disabled,name:A}):de(A,!0,V.value),{...se?{disabled:V.disabled||n.disabled}:{},...n.progressive?{required:!!V.required,min:Ns(V.min),max:Ns(V.max),minLength:Ns(V.minLength),maxLength:Ns(V.maxLength),pattern:Ns(V.pattern)}:{},name:A,onChange:ee,onBlur:ee,ref:pe=>{if(pe){d.registerName.add(A),Ut(A,V),d.registerName.delete(A),F=we(i,A);const xe=yt(pe.value)&&pe.querySelectorAll&&pe.querySelectorAll("input,select,textarea")[0]||pe,Se=P3(xe),Te=F._f.refs||[];if(Se?Te.find(rt=>rt===xe):xe===F._f.ref)return;ft(i,A,{_f:{...F._f,...Se?{refs:[...Te.filter(Uh),xe,...Array.isArray(we(s,A))?[{}]:[]],ref:{type:xe.type,name:A}}:{ref:xe}}}),de(A,!1,void 0,xe)}else F=we(i,A,{}),F._f&&(F._f.mount=!1),(n.shouldUnregister||V.shouldUnregister)&&!(j3(d.array,A)&&u.action)&&d.unMount.add(A)}}},rr=()=>n.shouldFocusError&&!n.shouldUseNativeValidation&&Ps(i,ge,d.mount),Fe=A=>{_r(A)&&(E.state.next({disabled:A}),Ps(i,(V,F)=>{const se=we(i,F);se&&(V.disabled=se._f.disabled||A,Array.isArray(se._f.refs)&&se._f.refs.forEach(ue=>{ue.disabled=se._f.disabled||A}))},0,!1))},Ne=(A,V)=>async F=>{let se;F&&(F.preventDefault&&F.preventDefault(),F.persist&&F.persist());let ue=At(l);if(E.state.next({isSubmitting:!0}),n.resolver){const{errors:pe,values:xe}=await me();L(),r.errors=pe,ue=At(xe)}else await Y({fields:i,eventType:va.SUBMIT});if(d.disabled.size)for(const pe of d.disabled)jt(ue,pe);if(jt(r.errors,x_),on(r.errors)){E.state.next({errors:{}});try{await A(ue,F)}catch(pe){se=pe}}else V&&await V({...r.errors},F),rr(),setTimeout(rr);if(E.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:on(r.errors)&&!se,submitCount:r.submitCount+1,errors:r.errors}),se)throw se},Je=(A,V={})=>{we(i,A)&&(yt(V.defaultValue)?Z(A,At(we(s,A))):(Z(A,V.defaultValue),ft(s,A,At(V.defaultValue))),V.keepTouched||jt(r.touchedFields,A),V.keepDirty||(jt(r.dirtyFields,A),r.isDirty=V.defaultValue?J(A,At(we(s,A))):J()),V.keepError||(jt(r.errors,A),_.isValid&&k()),E.state.next({...r}))},zt=(A,V={})=>{const F=A?At(A):s,se=At(F),ue=on(A),pe=se,xe=i;if(V.keepDefaultValues||(s=F),!V.keepValues){if(V.keepDirtyValues){const Se=new Set([...d.mount,...Object.keys(di(s,l,void 0,xe))]);for(const Te of Array.from(Se)){const rt=we(r.dirtyFields,Te),wt=we(l,Te),Jt=we(pe,Te);rt&&!yt(wt)?ft(pe,Te,wt):!rt&&!yt(Jt)&&Z(Te,Jt)}}else{if(Gu&&yt(A))for(const Se of d.mount){const Te=we(i,Se);if(Te&&Te._f){const rt=Array.isArray(Te._f.refs)?Te._f.refs[0]:Te._f.ref;if(pu(rt)){const wt=rt.closest("form");if(wt){wt.reset();break}}}}if(V.keepFieldsRef)for(const Se of d.mount)Z(Se,we(pe,Se));else i={}}if(n.shouldUnregister){if(l=V.keepDefaultValues?At(s):{},V.keepFieldsRef)for(const Se of d.mount)ft(l,Se,we(pe,Se))}else l=At(pe);E.array.next({values:{...pe}}),E.state.next({name:void 0,type:void 0,values:{...pe}})}d={mount:V.keepDirtyValues?d.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},u.mount=!_.isValid||!!V.keepIsValid||!!V.keepDirtyValues||!n.shouldUnregister&&!on(pe),u.watch=!!n.shouldUnregister,u.keepIsValid=!!V.keepIsValid,u.action=!1,V.keepErrors||(r.errors={}),E.state.next({submitCount:V.keepSubmitCount?r.submitCount:0,isDirty:ue?!1:V.keepDirty?r.isDirty:V.keepValues?J():!!(V.keepDefaultValues&&!Cr(A,s)),isSubmitted:V.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:ue?{}:V.keepDirtyValues?V.keepDefaultValues&&l?di(s,l,void 0,xe):r.dirtyFields:V.keepDefaultValues&&A?di(s,A,void 0,xe):V.keepDirty?r.dirtyFields:{},touchedFields:V.keepTouched?r.touchedFields:{},errors:V.keepErrors?r.errors:{},isSubmitSuccessful:V.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},eo=(A,V)=>zt(Wn(A)?A(l):A,{...n.resetOptions,...V}),or=(A,V={})=>{const F=we(i,A),se=F&&F._f;if(se){const ue=se.refs?se.refs[0]:se.ref;ue.focus&&setTimeout(()=>{ue.focus(),V.shouldSelect&&Wn(ue.select)&&ue.select()})}},Ri=A=>{const{name:V,type:F,values:se,...ue}=A;r={...r,...ue}},Un={control:{register:Ut,unregister:qt,getFieldState:Ve,handleSubmit:Ne,setError:lt,_subscribe:Xt,_runSchema:me,_updateIsValidating:L,_focusError:rr,_getWatch:W,_getDirty:J,_setValid:k,_setFieldArray:H,_setDisabledField:Pt,_setErrors:he,_getFieldArray:z,_reset:zt,_resetDefaultValues:()=>Wn(n.defaultValues)&&n.defaultValues().then(A=>{eo(A,n.resetOptions),E.state.next({isLoading:!1})}),_removeUnmounted:ne,_disableForm:Fe,_subjects:E,_proxyFormState:_,get _fields(){return i},get _formValues(){return l},get _state(){return u},set _state(A){u=A},get _defaultValues(){return s},get _names(){return d},set _names(A){d=A},get _formState(){return r},get _options(){return n},set _options(A){n={...n,...A},v=qc(n.mode),b=qc(n.reValidateMode)}},subscribe:mn,trigger:be,register:Ut,handleSubmit:Ne,watch:Xe,setValue:Z,setValues:re,getValues:De,reset:eo,resetField:Je,resetDefaultValues:(A,V={})=>{if(s=At(A),!V.keepDirty){const F=di(s,l,void 0,i);r.dirtyFields=F,r.isDirty=!on(F)}V.keepIsValid||k(),E.state.next({...r,defaultValues:s})},clearErrors:Ue,unregister:qt,setError:lt,setFocus:or,getFieldState:Ve};return{...Un,formControl:Un}}function Ws(e={}){const n=fe.useRef(void 0),r=fe.useRef(void 0),i=fe.useRef(e.formControl),[s,l]=fe.useState(()=>({...At(j_),isLoading:Wn(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Wn(e.defaultValues)?void 0:e.defaultValues}));if(!n.current||e.formControl&&i.current!==e.formControl)if(i.current=e.formControl,e.formControl)n.current={...e.formControl,formState:s},e.defaultValues&&!Wn(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:d,...m}=X3(e);n.current={...m,formState:s}}const u=n.current.control;return u._options=e,L3(()=>{const d=u._subscribe({formState:u._proxyFormState,callback:()=>l({...u._formState,defaultValues:u._defaultValues}),reRenderRoot:!0});return l(m=>({...m,isReady:!0})),u._formState.isReady=!0,d},[u]),fe.useEffect(()=>u._disableForm(e.disabled),[u,e.disabled]),fe.useEffect(()=>{e.mode&&(u._options.mode=e.mode),e.reValidateMode&&(u._options.reValidateMode=e.reValidateMode)},[u,e.mode,e.reValidateMode]),fe.useEffect(()=>{e.errors&&(u._setErrors(e.errors),u._focusError())},[u,e.errors]),fe.useEffect(()=>{e.shouldUnregister&&u._subjects.state.next({values:u._getWatch()})},[u,e.shouldUnregister]),fe.useEffect(()=>{if(u._proxyFormState.isDirty){const d=u._getDirty();d!==s.isDirty&&u._subjects.state.next({isDirty:d})}},[u,s.isDirty]),fe.useEffect(()=>{var d;e.values&&!Cr(e.values,r.current)?(u._reset(e.values,{keepFieldsRef:!0,...u._options.resetOptions}),!((d=u._options.resetOptions)===null||d===void 0)&&d.keepIsValid||u._setValid(),r.current=e.values,l(m=>({...m}))):u._resetDefaultValues()},[u,e.values]),fe.useEffect(()=>{u._state.mount||(u._setValid(),u._state.mount=!0),u._state.watch&&(u._state.watch=!1,u._subjects.state.next({...u._formState})),u._removeUnmounted()}),n.current.formState=fe.useMemo(()=>k3(s,u),[u,s]),n.current}const dx=(e,n,r)=>{if(e&&"reportValidity"in e){const i=we(r,n);e.setCustomValidity(i&&i.message||""),e.reportValidity()}},Dm=(e,n)=>{for(const r in n.fields){const i=n.fields[r];i&&i.ref&&"reportValidity"in i.ref?dx(i.ref,r,e):i&&i.refs&&i.refs.forEach(s=>dx(s,r,e))}},fx=(e,n)=>{n.shouldUseNativeValidation&&Dm(e,n);const r={};for(const i in e){const s=we(n.fields,i),l=Object.assign(e[i]||{},{ref:s&&s.ref});if(J3(n.names||Object.keys(e),i)){const u=Object.assign({},we(r,i));ft(u,"root",l),ft(r,i,u)}else ft(r,i,l)}return r},J3=(e,n)=>{const r=hx(n).replace(/[.*+?^${}()|\\]/g,"\\$&");return e.some(i=>hx(i).match(`^${r}\\.\\d+`))};function hx(e){return e.replace(/[\[\]]/g,"")}var mx;function ce(e,n,r){function i(d,m){if(d._zod||Object.defineProperty(d,"_zod",{value:{def:m,constr:u,traits:new Set},enumerable:!1}),d._zod.traits.has(e))return;d._zod.traits.add(e),n(d,m);const h=u.prototype,y=Object.keys(h);for(let v=0;vr?.Parent&&d instanceof r.Parent?!0:d?._zod?.traits?.has(e)}),Object.defineProperty(u,"name",{value:e}),u}class Oa extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class z_ extends Error{constructor(n){super(`Encountered unidirectional transform during encode: ${n}`),this.name="ZodEncodeError"}}(mx=globalThis).__zod_globalConfig??(mx.__zod_globalConfig={});const Gp=globalThis.__zod_globalConfig;function vi(e){return Gp}function N_(e){const n=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,s])=>n.indexOf(+i)===-1).map(([i,s])=>s)}function km(e,n){return typeof n=="bigint"?n.toString():n}function Zp(e){return{get value(){{const n=e();return Object.defineProperty(this,"value",{value:n}),n}}}}function Kp(e){return e==null}function Yp(e){const n=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(n,r)}const px=Symbol("evaluating");function ht(e,n,r){let i;Object.defineProperty(e,n,{get(){if(i!==px)return i===void 0&&(i=px,i=r()),i},set(s){Object.defineProperty(e,n,{value:s})},configurable:!0})}function Ei(e,n,r){Object.defineProperty(e,n,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ho(...e){const n={};for(const r of e){const i=Object.getOwnPropertyDescriptors(r);Object.assign(n,i)}return Object.defineProperties({},n)}function gx(e){return JSON.stringify(e)}function W3(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const D_="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function vu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const e4=Zp(()=>{if(Gp.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function el(e){if(vu(e)===!1)return!1;const n=e.constructor;if(n===void 0||typeof n!="function")return!0;const r=n.prototype;return!(vu(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function k_(e){return el(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const t4=new Set(["string","number","symbol"]);function Ku(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Bo(e,n,r){const i=new e._zod.constr(n??e._zod.def);return(!n||r?.parent)&&(i._zod.parent=e),i}function Ie(e){const n=e;if(!n)return{};if(typeof n=="string")return{error:()=>n};if(n?.message!==void 0){if(n?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");n.error=n.message}return delete n.message,typeof n.error=="string"?{...n,error:()=>n.error}:n}function n4(e){return Object.keys(e).filter(n=>e[n]._zod.optin==="optional"&&e[n]._zod.optout==="optional")}function r4(e,n){const r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const l=Ho(e._zod.def,{get shape(){const u={};for(const d in n){if(!(d in r.shape))throw new Error(`Unrecognized key: "${d}"`);n[d]&&(u[d]=r.shape[d])}return Ei(this,"shape",u),u},checks:[]});return Bo(e,l)}function o4(e,n){const r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const l=Ho(e._zod.def,{get shape(){const u={...e._zod.def.shape};for(const d in n){if(!(d in r.shape))throw new Error(`Unrecognized key: "${d}"`);n[d]&&delete u[d]}return Ei(this,"shape",u),u},checks:[]});return Bo(e,l)}function i4(e,n){if(!el(n))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const l=e._zod.def.shape;for(const u in n)if(Object.getOwnPropertyDescriptor(l,u)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=Ho(e._zod.def,{get shape(){const l={...e._zod.def.shape,...n};return Ei(this,"shape",l),l}});return Bo(e,s)}function a4(e,n){if(!el(n))throw new Error("Invalid input to safeExtend: expected a plain object");const r=Ho(e._zod.def,{get shape(){const i={...e._zod.def.shape,...n};return Ei(this,"shape",i),i}});return Bo(e,r)}function s4(e,n){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const r=Ho(e._zod.def,{get shape(){const i={...e._zod.def.shape,...n._zod.def.shape};return Ei(this,"shape",i),i},get catchall(){return n._zod.def.catchall},checks:n._zod.def.checks??[]});return Bo(e,r)}function l4(e,n,r){const s=n._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const u=Ho(n._zod.def,{get shape(){const d=n._zod.def.shape,m={...d};if(r)for(const h in r){if(!(h in d))throw new Error(`Unrecognized key: "${h}"`);r[h]&&(m[h]=e?new e({type:"optional",innerType:d[h]}):d[h])}else for(const h in d)m[h]=e?new e({type:"optional",innerType:d[h]}):d[h];return Ei(this,"shape",m),m},checks:[]});return Bo(n,u)}function c4(e,n,r){const i=Ho(n._zod.def,{get shape(){const s=n._zod.def.shape,l={...s};if(r)for(const u in r){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(l[u]=new e({type:"nonoptional",innerType:s[u]}))}else for(const u in s)l[u]=new e({type:"nonoptional",innerType:s[u]});return Ei(this,"shape",l),l}});return Bo(n,i)}function Ca(e,n=0){if(e.aborted===!0)return!0;for(let r=n;r{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function Gc(e){return typeof e=="string"?e:e?.message}function yi(e,n,r){const i=e.message?e.message:Gc(e.inst?._zod.def?.error?.(e))??Gc(n?.error?.(e))??Gc(r.customError?.(e))??Gc(r.localeError?.(e))??"Invalid input",{inst:s,continue:l,input:u,...d}=e;return d.path??(d.path=[]),d.message=i,n?.reportInput&&(d.input=u),d}function Qp(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function tl(...e){const[n,r,i]=e;return typeof n=="string"?{message:n,code:"custom",input:r,inst:i}:{...n}}const I_=(e,n)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:n,enumerable:!1}),e.message=JSON.stringify(n,km,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Xp=ce("$ZodError",I_),Yu=ce("$ZodError",I_,{Parent:Error});function d4(e,n=r=>r.message){const r={},i=[];for(const s of e.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(n(s))):i.push(n(s));return{formErrors:i,fieldErrors:r}}function f4(e,n=r=>r.message){const r={_errors:[]},i=(s,l=[])=>{for(const u of s.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>i({issues:d},[...l,...u.path]));else if(u.code==="invalid_key")i({issues:u.issues},[...l,...u.path]);else if(u.code==="invalid_element")i({issues:u.issues},[...l,...u.path]);else{const d=[...l,...u.path];if(d.length===0)r._errors.push(n(u));else{let m=r,h=0;for(;h(n,r,i,s)=>{const l=i?{...i,async:!1}:{async:!1},u=n._zod.run({value:r,issues:[]},l);if(u instanceof Promise)throw new Oa;if(u.issues.length){const d=new(s?.Err??e)(u.issues.map(m=>yi(m,l,vi())));throw D_(d,s?.callee),d}return u.value},h4=Qu(Yu),Xu=e=>async(n,r,i,s)=>{const l=i?{...i,async:!0}:{async:!0};let u=n._zod.run({value:r,issues:[]},l);if(u instanceof Promise&&(u=await u),u.issues.length){const d=new(s?.Err??e)(u.issues.map(m=>yi(m,l,vi())));throw D_(d,s?.callee),d}return u.value},m4=Xu(Yu),Ju=e=>(n,r,i)=>{const s=i?{...i,async:!1}:{async:!1},l=n._zod.run({value:r,issues:[]},s);if(l instanceof Promise)throw new Oa;return l.issues.length?{success:!1,error:new(e??Xp)(l.issues.map(u=>yi(u,s,vi())))}:{success:!0,data:l.value}},p4=Ju(Yu),Wu=e=>async(n,r,i)=>{const s=i?{...i,async:!0}:{async:!0};let l=n._zod.run({value:r,issues:[]},s);return l instanceof Promise&&(l=await l),l.issues.length?{success:!1,error:new e(l.issues.map(u=>yi(u,s,vi())))}:{success:!0,data:l.value}},g4=Wu(Yu),v4=e=>(n,r,i)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return Qu(e)(n,r,s)},y4=e=>(n,r,i)=>Qu(e)(n,r,i),b4=e=>async(n,r,i)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return Xu(e)(n,r,s)},x4=e=>async(n,r,i)=>Xu(e)(n,r,i),S4=e=>(n,r,i)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return Ju(e)(n,r,s)},w4=e=>(n,r,i)=>Ju(e)(n,r,i),_4=e=>async(n,r,i)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return Wu(e)(n,r,s)},C4=e=>async(n,r,i)=>Wu(e)(n,r,i),E4=/^[cC][0-9a-z]{6,}$/,R4=/^[0-9a-z]+$/,T4=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,O4=/^[0-9a-vA-V]{20}$/,M4=/^[A-Za-z0-9]{27}$/,A4=/^[a-zA-Z0-9_-]{21}$/,j4=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,z4=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,vx=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,N4=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,D4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function k4(){return new RegExp(D4,"u")}const L4=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,I4=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,$4=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,V4=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,F4=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$_=/^[A-Za-z0-9_-]*$/,P4=/^https?$/,U4=/^\+[1-9]\d{6,14}$/,V_="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",H4=new RegExp(`^${V_}$`);function F_(e){const n="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${n}`:e.precision===0?`${n}:[0-5]\\d`:`${n}:[0-5]\\d\\.\\d{${e.precision}}`:`${n}(?::[0-5]\\d(?:\\.\\d+)?)?`}function B4(e){return new RegExp(`^${F_(e)}$`)}function q4(e){const n=F_({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${n}(?:${r.join("|")})`;return new RegExp(`^${V_}T(?:${i})$`)}const G4=e=>{const n=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${n}$`)},Z4=/^(?:true|false)$/i,K4=/^[^A-Z]*$/,Y4=/^[^a-z]*$/,Mr=ce("$ZodCheck",(e,n)=>{var r;e._zod??(e._zod={}),e._zod.def=n,(r=e._zod).onattach??(r.onattach=[])}),Q4=ce("$ZodCheckMaxLength",(e,n)=>{var r;Mr.init(e,n),(r=e._zod.def).when??(r.when=i=>{const s=i.value;return!Kp(s)&&s.length!==void 0}),e._zod.onattach.push(i=>{const s=i._zod.bag.maximum??Number.POSITIVE_INFINITY;n.maximum{const s=i.value;if(s.length<=n.maximum)return;const u=Qp(s);i.issues.push({origin:u,code:"too_big",maximum:n.maximum,inclusive:!0,input:s,inst:e,continue:!n.abort})}}),X4=ce("$ZodCheckMinLength",(e,n)=>{var r;Mr.init(e,n),(r=e._zod.def).when??(r.when=i=>{const s=i.value;return!Kp(s)&&s.length!==void 0}),e._zod.onattach.push(i=>{const s=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;n.minimum>s&&(i._zod.bag.minimum=n.minimum)}),e._zod.check=i=>{const s=i.value;if(s.length>=n.minimum)return;const u=Qp(s);i.issues.push({origin:u,code:"too_small",minimum:n.minimum,inclusive:!0,input:s,inst:e,continue:!n.abort})}}),J4=ce("$ZodCheckLengthEquals",(e,n)=>{var r;Mr.init(e,n),(r=e._zod.def).when??(r.when=i=>{const s=i.value;return!Kp(s)&&s.length!==void 0}),e._zod.onattach.push(i=>{const s=i._zod.bag;s.minimum=n.length,s.maximum=n.length,s.length=n.length}),e._zod.check=i=>{const s=i.value,l=s.length;if(l===n.length)return;const u=Qp(s),d=l>n.length;i.issues.push({origin:u,...d?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!n.abort})}}),ed=ce("$ZodCheckStringFormat",(e,n)=>{var r,i;Mr.init(e,n),e._zod.onattach.push(s=>{const l=s._zod.bag;l.format=n.format,n.pattern&&(l.patterns??(l.patterns=new Set),l.patterns.add(n.pattern))}),n.pattern?(r=e._zod).check??(r.check=s=>{n.pattern.lastIndex=0,!n.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:n.format,input:s.value,...n.pattern?{pattern:n.pattern.toString()}:{},inst:e,continue:!n.abort})}):(i=e._zod).check??(i.check=()=>{})}),W4=ce("$ZodCheckRegex",(e,n)=>{ed.init(e,n),e._zod.check=r=>{n.pattern.lastIndex=0,!n.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:n.pattern.toString(),inst:e,continue:!n.abort})}}),e5=ce("$ZodCheckLowerCase",(e,n)=>{n.pattern??(n.pattern=K4),ed.init(e,n)}),t5=ce("$ZodCheckUpperCase",(e,n)=>{n.pattern??(n.pattern=Y4),ed.init(e,n)}),n5=ce("$ZodCheckIncludes",(e,n)=>{Mr.init(e,n);const r=Ku(n.includes),i=new RegExp(typeof n.position=="number"?`^.{${n.position}}${r}`:r);n.pattern=i,e._zod.onattach.push(s=>{const l=s._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(i)}),e._zod.check=s=>{s.value.includes(n.includes,n.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:n.includes,input:s.value,inst:e,continue:!n.abort})}}),r5=ce("$ZodCheckStartsWith",(e,n)=>{Mr.init(e,n);const r=new RegExp(`^${Ku(n.prefix)}.*`);n.pattern??(n.pattern=r),e._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=i=>{i.value.startsWith(n.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:n.prefix,input:i.value,inst:e,continue:!n.abort})}}),o5=ce("$ZodCheckEndsWith",(e,n)=>{Mr.init(e,n);const r=new RegExp(`.*${Ku(n.suffix)}$`);n.pattern??(n.pattern=r),e._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=i=>{i.value.endsWith(n.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:n.suffix,input:i.value,inst:e,continue:!n.abort})}}),i5=ce("$ZodCheckOverwrite",(e,n)=>{Mr.init(e,n),e._zod.check=r=>{r.value=n.tx(r.value)}});class a5{constructor(n=[]){this.content=[],this.indent=0,this&&(this.args=n)}indented(n){this.indent+=1,n(this),this.indent-=1}write(n){if(typeof n=="function"){n(this,{execution:"sync"}),n(this,{execution:"async"});return}const i=n.split(` -`).filter(u=>u),s=Math.min(...i.map(u=>u.length-u.trimStart().length)),l=i.map(u=>u.slice(s)).map(u=>" ".repeat(this.indent*2)+u);for(const u of l)this.content.push(u)}compile(){const n=Function,r=this?.args,s=[...(this?.content??[""]).map(l=>` ${l}`)];return new n(...r,s.join(` -`))}}const s5={major:4,minor:4,patch:3},Vt=ce("$ZodType",(e,n)=>{var r;e??(e={}),e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=s5;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const s of i)for(const l of s._zod.onattach)l(e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(u,d,m)=>{let h=Ca(u),y;for(const v of d){if(v._zod.def.when){if(u4(u)||!v._zod.def.when(u))continue}else if(h)continue;const b=u.issues.length,S=v._zod.check(u);if(S instanceof Promise&&m?.async===!1)throw new Oa;if(y||S instanceof Promise)y=(y??Promise.resolve()).then(async()=>{await S,u.issues.length!==b&&(h||(h=Ca(u,b)))});else{if(u.issues.length===b)continue;h||(h=Ca(u,b))}}return y?y.then(()=>u):u},l=(u,d,m)=>{if(Ca(u))return u.aborted=!0,u;const h=s(d,i,m);if(h instanceof Promise){if(m.async===!1)throw new Oa;return h.then(y=>e._zod.parse(y,m))}return e._zod.parse(h,m)};e._zod.run=(u,d)=>{if(d.skipChecks)return e._zod.parse(u,d);if(d.direction==="backward"){const h=e._zod.parse({value:u.value,issues:[]},{...d,skipChecks:!0});return h instanceof Promise?h.then(y=>l(y,u,d)):l(h,u,d)}const m=e._zod.parse(u,d);if(m instanceof Promise){if(d.async===!1)throw new Oa;return m.then(h=>s(h,i,d))}return s(m,i,d)}}ht(e,"~standard",()=>({validate:s=>{try{const l=p4(e,s);return l.success?{value:l.data}:{issues:l.error?.issues}}catch{return g4(e,s).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},vendor:"zod",version:1}))}),Jp=ce("$ZodString",(e,n)=>{Vt.init(e,n),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??G4(e._zod.bag),e._zod.parse=(r,i)=>{if(n.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),St=ce("$ZodStringFormat",(e,n)=>{ed.init(e,n),Jp.init(e,n)}),l5=ce("$ZodGUID",(e,n)=>{n.pattern??(n.pattern=z4),St.init(e,n)}),c5=ce("$ZodUUID",(e,n)=>{if(n.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[n.version];if(i===void 0)throw new Error(`Invalid UUID version: "${n.version}"`);n.pattern??(n.pattern=vx(i))}else n.pattern??(n.pattern=vx());St.init(e,n)}),u5=ce("$ZodEmail",(e,n)=>{n.pattern??(n.pattern=N4),St.init(e,n)}),d5=ce("$ZodURL",(e,n)=>{St.init(e,n),e._zod.check=r=>{try{const i=r.value.trim();if(!n.normalize&&n.protocol?.source===P4.source&&!/^https?:\/\//i.test(i)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!n.abort});return}const s=new URL(i);n.hostname&&(n.hostname.lastIndex=0,n.hostname.test(s.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:n.hostname.source,input:r.value,inst:e,continue:!n.abort})),n.protocol&&(n.protocol.lastIndex=0,n.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:n.protocol.source,input:r.value,inst:e,continue:!n.abort})),n.normalize?r.value=s.href:r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!n.abort})}}}),f5=ce("$ZodEmoji",(e,n)=>{n.pattern??(n.pattern=k4()),St.init(e,n)}),h5=ce("$ZodNanoID",(e,n)=>{n.pattern??(n.pattern=A4),St.init(e,n)}),m5=ce("$ZodCUID",(e,n)=>{n.pattern??(n.pattern=E4),St.init(e,n)}),p5=ce("$ZodCUID2",(e,n)=>{n.pattern??(n.pattern=R4),St.init(e,n)}),g5=ce("$ZodULID",(e,n)=>{n.pattern??(n.pattern=T4),St.init(e,n)}),v5=ce("$ZodXID",(e,n)=>{n.pattern??(n.pattern=O4),St.init(e,n)}),y5=ce("$ZodKSUID",(e,n)=>{n.pattern??(n.pattern=M4),St.init(e,n)}),b5=ce("$ZodISODateTime",(e,n)=>{n.pattern??(n.pattern=q4(n)),St.init(e,n)}),x5=ce("$ZodISODate",(e,n)=>{n.pattern??(n.pattern=H4),St.init(e,n)}),S5=ce("$ZodISOTime",(e,n)=>{n.pattern??(n.pattern=B4(n)),St.init(e,n)}),w5=ce("$ZodISODuration",(e,n)=>{n.pattern??(n.pattern=j4),St.init(e,n)}),_5=ce("$ZodIPv4",(e,n)=>{n.pattern??(n.pattern=L4),St.init(e,n),e._zod.bag.format="ipv4"}),C5=ce("$ZodIPv6",(e,n)=>{n.pattern??(n.pattern=I4),St.init(e,n),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!n.abort})}}}),E5=ce("$ZodCIDRv4",(e,n)=>{n.pattern??(n.pattern=$4),St.init(e,n)}),R5=ce("$ZodCIDRv6",(e,n)=>{n.pattern??(n.pattern=V4),St.init(e,n),e._zod.check=r=>{const i=r.value.split("/");try{if(i.length!==2)throw new Error;const[s,l]=i;if(!l)throw new Error;const u=Number(l);if(`${u}`!==l)throw new Error;if(u<0||u>128)throw new Error;new URL(`http://[${s}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!n.abort})}}});function P_(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const T5=ce("$ZodBase64",(e,n)=>{n.pattern??(n.pattern=F4),St.init(e,n),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{P_(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!n.abort})}});function O5(e){if(!$_.test(e))return!1;const n=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=n.padEnd(Math.ceil(n.length/4)*4,"=");return P_(r)}const M5=ce("$ZodBase64URL",(e,n)=>{n.pattern??(n.pattern=$_),St.init(e,n),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{O5(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!n.abort})}}),A5=ce("$ZodE164",(e,n)=>{n.pattern??(n.pattern=U4),St.init(e,n)});function j5(e,n=null){try{const r=e.split(".");if(r.length!==3)return!1;const[i]=r;if(!i)return!1;const s=JSON.parse(atob(i));return!("typ"in s&&s?.typ!=="JWT"||!s.alg||n&&(!("alg"in s)||s.alg!==n))}catch{return!1}}const z5=ce("$ZodJWT",(e,n)=>{St.init(e,n),e._zod.check=r=>{j5(r.value,n.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!n.abort})}}),N5=ce("$ZodBoolean",(e,n)=>{Vt.init(e,n),e._zod.pattern=Z4,e._zod.parse=(r,i)=>{if(n.coerce)try{r.value=!!r.value}catch{}const s=r.value;return typeof s=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),r}}),D5=ce("$ZodUnknown",(e,n)=>{Vt.init(e,n),e._zod.parse=r=>r}),k5=ce("$ZodNever",(e,n)=>{Vt.init(e,n),e._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function yx(e,n,r){e.issues.length&&n.issues.push(...L_(r,e.issues)),n.value[r]=e.value}const L5=ce("$ZodArray",(e,n)=>{Vt.init(e,n),e._zod.parse=(r,i)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=Array(s.length);const l=[];for(let u=0;uyx(h,r,u))):yx(m,r,u)}return l.length?Promise.all(l).then(()=>r):r}});function yu(e,n,r,i,s,l){const u=r in i;if(e.issues.length){if(s&&l&&!u)return;n.issues.push(...L_(r,e.issues))}if(!u&&!s){e.issues.length||n.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?u&&(n.value[r]=void 0):n.value[r]=e.value}function U_(e){const n=Object.keys(e.shape);for(const i of n)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);const r=n4(e.shape);return{...e,keys:n,keySet:new Set(n),numKeys:n.length,optionalKeys:new Set(r)}}function H_(e,n,r,i,s,l){const u=[],d=s.keySet,m=s.catchall._zod,h=m.def.type,y=m.optin==="optional",v=m.optout==="optional";for(const b in n){if(b==="__proto__"||d.has(b))continue;if(h==="never"){u.push(b);continue}const S=m.run({value:n[b],issues:[]},i);S instanceof Promise?e.push(S.then(_=>yu(_,r,b,n,y,v))):yu(S,r,b,n,y,v)}return u.length&&r.issues.push({code:"unrecognized_keys",keys:u,input:n,inst:l}),e.length?Promise.all(e).then(()=>r):r}const I5=ce("$ZodObject",(e,n)=>{if(Vt.init(e,n),!Object.getOwnPropertyDescriptor(n,"shape")?.get){const d=n.shape;Object.defineProperty(n,"shape",{get:()=>{const m={...d};return Object.defineProperty(n,"shape",{value:m}),m}})}const i=Zp(()=>U_(n));ht(e._zod,"propValues",()=>{const d=n.shape,m={};for(const h in d){const y=d[h]._zod;if(y.values){m[h]??(m[h]=new Set);for(const v of y.values)m[h].add(v)}}return m});const s=vu,l=n.catchall;let u;e._zod.parse=(d,m)=>{u??(u=i.value);const h=d.value;if(!s(h))return d.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),d;d.value={};const y=[],v=u.shape;for(const b of u.keys){const S=v[b],_=S._zod.optin==="optional",C=S._zod.optout==="optional",E=S._zod.run({value:h[b],issues:[]},m);E instanceof Promise?y.push(E.then(T=>yu(T,d,b,h,_,C))):yu(E,d,b,h,_,C)}return l?H_(y,h,d,m,i.value,e):y.length?Promise.all(y).then(()=>d):d}}),$5=ce("$ZodObjectJIT",(e,n)=>{I5.init(e,n);const r=e._zod.parse,i=Zp(()=>U_(n)),s=b=>{const S=new a5(["shape","payload","ctx"]),_=i.value,C=M=>{const k=gx(M);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};S.write("const input = payload.value;");const E=Object.create(null);let T=0;for(const M of _.keys)E[M]=`key_${T++}`;S.write("const newResult = {};");for(const M of _.keys){const k=E[M],L=gx(M),q=b[M],H=q?._zod?.optin==="optional",$=q?._zod?.optout==="optional";S.write(`const ${k} = ${C(M)};`),H&&$?S.write(` - if (${k}.issues.length) { - if (${L} in input) { - payload.issues = payload.issues.concat(${k}.issues.map(iss => ({ - ...iss, - path: iss.path ? [${L}, ...iss.path] : [${L}] - }))); - } - } - - if (${k}.value === undefined) { - if (${L} in input) { - newResult[${L}] = undefined; - } - } else { - newResult[${L}] = ${k}.value; - } - - `):H?S.write(` - if (${k}.issues.length) { - payload.issues = payload.issues.concat(${k}.issues.map(iss => ({ - ...iss, - path: iss.path ? [${L}, ...iss.path] : [${L}] - }))); - } - - if (${k}.value === undefined) { - if (${L} in input) { - newResult[${L}] = undefined; - } - } else { - newResult[${L}] = ${k}.value; - } - - `):S.write(` - const ${k}_present = ${L} in input; - if (${k}.issues.length) { - payload.issues = payload.issues.concat(${k}.issues.map(iss => ({ - ...iss, - path: iss.path ? [${L}, ...iss.path] : [${L}] - }))); - } - if (!${k}_present && !${k}.issues.length) { - payload.issues.push({ - code: "invalid_type", - expected: "nonoptional", - input: undefined, - path: [${L}] - }); - } - - if (${k}_present) { - if (${k}.value === undefined) { - newResult[${L}] = undefined; - } else { - newResult[${L}] = ${k}.value; - } - } - - `)}S.write("payload.value = newResult;"),S.write("return payload;");const O=S.compile();return(M,k)=>O(b,M,k)};let l;const u=vu,d=!Gp.jitless,h=d&&e4.value,y=n.catchall;let v;e._zod.parse=(b,S)=>{v??(v=i.value);const _=b.value;return u(_)?d&&h&&S?.async===!1&&S.jitless!==!0?(l||(l=s(n.shape)),b=l(b,S),y?H_([],_,b,S,v,e):b):r(b,S):(b.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),b)}});function bx(e,n,r,i){for(const l of e)if(l.issues.length===0)return n.value=l.value,n;const s=e.filter(l=>!Ca(l));return s.length===1?(n.value=s[0].value,s[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:r,errors:e.map(l=>l.issues.map(u=>yi(u,i,vi())))}),n)}const V5=ce("$ZodUnion",(e,n)=>{Vt.init(e,n),ht(e._zod,"optin",()=>n.options.some(i=>i._zod.optin==="optional")?"optional":void 0),ht(e._zod,"optout",()=>n.options.some(i=>i._zod.optout==="optional")?"optional":void 0),ht(e._zod,"values",()=>{if(n.options.every(i=>i._zod.values))return new Set(n.options.flatMap(i=>Array.from(i._zod.values)))}),ht(e._zod,"pattern",()=>{if(n.options.every(i=>i._zod.pattern)){const i=n.options.map(s=>s._zod.pattern);return new RegExp(`^(${i.map(s=>Yp(s.source)).join("|")})$`)}});const r=n.options.length===1?n.options[0]._zod.run:null;e._zod.parse=(i,s)=>{if(r)return r(i,s);let l=!1;const u=[];for(const d of n.options){const m=d._zod.run({value:i.value,issues:[]},s);if(m instanceof Promise)u.push(m),l=!0;else{if(m.issues.length===0)return m;u.push(m)}}return l?Promise.all(u).then(d=>bx(d,i,e,s)):bx(u,i,e,s)}}),F5=ce("$ZodIntersection",(e,n)=>{Vt.init(e,n),e._zod.parse=(r,i)=>{const s=r.value,l=n.left._zod.run({value:s,issues:[]},i),u=n.right._zod.run({value:s,issues:[]},i);return l instanceof Promise||u instanceof Promise?Promise.all([l,u]).then(([m,h])=>xx(r,m,h)):xx(r,l,u)}});function Lm(e,n){if(e===n)return{valid:!0,data:e};if(e instanceof Date&&n instanceof Date&&+e==+n)return{valid:!0,data:e};if(el(e)&&el(n)){const r=Object.keys(n),i=Object.keys(e).filter(l=>r.indexOf(l)!==-1),s={...e,...n};for(const l of i){const u=Lm(e[l],n[l]);if(!u.valid)return{valid:!1,mergeErrorPath:[l,...u.mergeErrorPath]};s[l]=u.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let i=0;id.l&&d.r).map(([d])=>d);if(l.length&&s&&e.issues.push({...s,keys:l}),Ca(e))return e;const u=Lm(n.value,r.value);if(!u.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`);return e.value=u.data,e}const P5=ce("$ZodEnum",(e,n)=>{Vt.init(e,n);const r=N_(n.entries),i=new Set(r);e._zod.values=i,e._zod.pattern=new RegExp(`^(${r.filter(s=>t4.has(typeof s)).map(s=>typeof s=="string"?Ku(s):s.toString()).join("|")})$`),e._zod.parse=(s,l)=>{const u=s.value;return i.has(u)||s.issues.push({code:"invalid_value",values:r,input:u,inst:e}),s}}),U5=ce("$ZodTransform",(e,n)=>{Vt.init(e,n),e._zod.optin="optional",e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new z_(e.constructor.name);const s=n.transform(r.value,r);if(i.async)return(s instanceof Promise?s:Promise.resolve(s)).then(u=>(r.value=u,r.fallback=!0,r));if(s instanceof Promise)throw new Oa;return r.value=s,r.fallback=!0,r}});function Sx(e,n){return n===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const B_=ce("$ZodOptional",(e,n)=>{Vt.init(e,n),e._zod.optin="optional",e._zod.optout="optional",ht(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0),ht(e._zod,"pattern",()=>{const r=n.innerType._zod.pattern;return r?new RegExp(`^(${Yp(r.source)})?$`):void 0}),e._zod.parse=(r,i)=>{if(n.innerType._zod.optin==="optional"){const s=r.value,l=n.innerType._zod.run(r,i);return l instanceof Promise?l.then(u=>Sx(u,s)):Sx(l,s)}return r.value===void 0?r:n.innerType._zod.run(r,i)}}),H5=ce("$ZodExactOptional",(e,n)=>{B_.init(e,n),ht(e._zod,"values",()=>n.innerType._zod.values),ht(e._zod,"pattern",()=>n.innerType._zod.pattern),e._zod.parse=(r,i)=>n.innerType._zod.run(r,i)}),B5=ce("$ZodNullable",(e,n)=>{Vt.init(e,n),ht(e._zod,"optin",()=>n.innerType._zod.optin),ht(e._zod,"optout",()=>n.innerType._zod.optout),ht(e._zod,"pattern",()=>{const r=n.innerType._zod.pattern;return r?new RegExp(`^(${Yp(r.source)}|null)$`):void 0}),ht(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,null]):void 0),e._zod.parse=(r,i)=>r.value===null?r:n.innerType._zod.run(r,i)}),q5=ce("$ZodDefault",(e,n)=>{Vt.init(e,n),e._zod.optin="optional",ht(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(r,i)=>{if(i.direction==="backward")return n.innerType._zod.run(r,i);if(r.value===void 0)return r.value=n.defaultValue,r;const s=n.innerType._zod.run(r,i);return s instanceof Promise?s.then(l=>wx(l,n)):wx(s,n)}});function wx(e,n){return e.value===void 0&&(e.value=n.defaultValue),e}const G5=ce("$ZodPrefault",(e,n)=>{Vt.init(e,n),e._zod.optin="optional",ht(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(r,i)=>(i.direction==="backward"||r.value===void 0&&(r.value=n.defaultValue),n.innerType._zod.run(r,i))}),Z5=ce("$ZodNonOptional",(e,n)=>{Vt.init(e,n),ht(e._zod,"values",()=>{const r=n.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),e._zod.parse=(r,i)=>{const s=n.innerType._zod.run(r,i);return s instanceof Promise?s.then(l=>_x(l,e)):_x(s,e)}});function _x(e,n){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:n}),e}const K5=ce("$ZodCatch",(e,n)=>{Vt.init(e,n),e._zod.optin="optional",ht(e._zod,"optout",()=>n.innerType._zod.optout),ht(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(r,i)=>{if(i.direction==="backward")return n.innerType._zod.run(r,i);const s=n.innerType._zod.run(r,i);return s instanceof Promise?s.then(l=>(r.value=l.value,l.issues.length&&(r.value=n.catchValue({...r,error:{issues:l.issues.map(u=>yi(u,i,vi()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=s.value,s.issues.length&&(r.value=n.catchValue({...r,error:{issues:s.issues.map(l=>yi(l,i,vi()))},input:r.value}),r.issues=[],r.fallback=!0),r)}}),Y5=ce("$ZodPipe",(e,n)=>{Vt.init(e,n),ht(e._zod,"values",()=>n.in._zod.values),ht(e._zod,"optin",()=>n.in._zod.optin),ht(e._zod,"optout",()=>n.out._zod.optout),ht(e._zod,"propValues",()=>n.in._zod.propValues),e._zod.parse=(r,i)=>{if(i.direction==="backward"){const l=n.out._zod.run(r,i);return l instanceof Promise?l.then(u=>Zc(u,n.in,i)):Zc(l,n.in,i)}const s=n.in._zod.run(r,i);return s instanceof Promise?s.then(l=>Zc(l,n.out,i)):Zc(s,n.out,i)}});function Zc(e,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}const Q5=ce("$ZodReadonly",(e,n)=>{Vt.init(e,n),ht(e._zod,"propValues",()=>n.innerType._zod.propValues),ht(e._zod,"values",()=>n.innerType._zod.values),ht(e._zod,"optin",()=>n.innerType?._zod?.optin),ht(e._zod,"optout",()=>n.innerType?._zod?.optout),e._zod.parse=(r,i)=>{if(i.direction==="backward")return n.innerType._zod.run(r,i);const s=n.innerType._zod.run(r,i);return s instanceof Promise?s.then(Cx):Cx(s)}});function Cx(e){return e.value=Object.freeze(e.value),e}const X5=ce("$ZodCustom",(e,n)=>{Mr.init(e,n),Vt.init(e,n),e._zod.parse=(r,i)=>r,e._zod.check=r=>{const i=r.value,s=n.fn(i);if(s instanceof Promise)return s.then(l=>Ex(l,r,i,e));Ex(s,r,i,e)}});function Ex(e,n,r,i){if(!e){const s={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(s.params=i._zod.def.params),n.issues.push(tl(s))}}var Rx;class J5{constructor(){this._map=new WeakMap,this._idmap=new Map}add(n,...r){const i=r[0];return this._map.set(n,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,n),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(n){const r=this._map.get(n);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(n),this}get(n){const r=n._zod.parent;if(r){const i={...this.get(r)??{}};delete i.id;const s={...i,...this._map.get(n)};return Object.keys(s).length?s:void 0}return this._map.get(n)}has(n){return this._map.has(n)}}function W5(){return new J5}(Rx=globalThis).__zod_globalRegistry??(Rx.__zod_globalRegistry=W5());const $s=globalThis.__zod_globalRegistry;function e6(e,n){return new e({type:"string",...Ie(n)})}function t6(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ie(n)})}function Tx(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ie(n)})}function n6(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ie(n)})}function r6(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ie(n)})}function o6(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ie(n)})}function i6(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ie(n)})}function a6(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ie(n)})}function s6(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ie(n)})}function l6(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ie(n)})}function c6(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ie(n)})}function u6(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ie(n)})}function d6(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ie(n)})}function f6(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ie(n)})}function h6(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ie(n)})}function m6(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ie(n)})}function p6(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ie(n)})}function g6(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ie(n)})}function v6(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ie(n)})}function y6(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ie(n)})}function b6(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ie(n)})}function x6(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ie(n)})}function S6(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ie(n)})}function w6(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ie(n)})}function _6(e,n){return new e({type:"string",format:"date",check:"string_format",...Ie(n)})}function C6(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ie(n)})}function E6(e,n){return new e({type:"string",format:"duration",check:"string_format",...Ie(n)})}function R6(e,n){return new e({type:"boolean",...Ie(n)})}function T6(e){return new e({type:"unknown"})}function O6(e,n){return new e({type:"never",...Ie(n)})}function q_(e,n){return new Q4({check:"max_length",...Ie(n),maximum:e})}function bu(e,n){return new X4({check:"min_length",...Ie(n),minimum:e})}function G_(e,n){return new J4({check:"length_equals",...Ie(n),length:e})}function M6(e,n){return new W4({check:"string_format",format:"regex",...Ie(n),pattern:e})}function A6(e){return new e5({check:"string_format",format:"lowercase",...Ie(e)})}function j6(e){return new t5({check:"string_format",format:"uppercase",...Ie(e)})}function z6(e,n){return new n5({check:"string_format",format:"includes",...Ie(n),includes:e})}function N6(e,n){return new r5({check:"string_format",format:"starts_with",...Ie(n),prefix:e})}function D6(e,n){return new o5({check:"string_format",format:"ends_with",...Ie(n),suffix:e})}function $a(e){return new i5({check:"overwrite",tx:e})}function k6(e){return $a(n=>n.normalize(e))}function L6(){return $a(e=>e.trim())}function I6(){return $a(e=>e.toLowerCase())}function $6(){return $a(e=>e.toUpperCase())}function V6(){return $a(e=>W3(e))}function F6(e,n,r){return new e({type:"array",element:n,...Ie(r)})}function P6(e,n,r){return new e({type:"custom",check:"custom",fn:n,...Ie(r)})}function U6(e,n){const r=H6(i=>(i.addIssue=s=>{if(typeof s=="string")i.issues.push(tl(s,i.value,r._zod.def));else{const l=s;l.fatal&&(l.continue=!1),l.code??(l.code="custom"),l.input??(l.input=i.value),l.inst??(l.inst=r),l.continue??(l.continue=!r._zod.def.abort),i.issues.push(tl(l))}},e(i.value,i)),n);return r}function H6(e,n){const r=new Mr({check:"custom",...Ie(n)});return r._zod.check=e,r}function Z_(e){let n=e?.target??"draft-2020-12";return n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??$s,target:n,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function cn(e,n,r={path:[],schemaPath:[]}){var i;const s=e._zod.def,l=n.seen.get(e);if(l)return l.count++,r.schemaPath.includes(e)&&(l.cycle=r.path),l.schema;const u={schema:{},count:1,cycle:void 0,path:r.path};n.seen.set(e,u);const d=e._zod.toJSONSchema?.();if(d)u.schema=d;else{const y={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(n,u.schema,y);else{const b=u.schema,S=n.processors[s.type];if(!S)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);S(e,n,b,y)}const v=e._zod.parent;v&&(u.ref||(u.ref=v),cn(v,n,y),n.seen.get(v).isParent=!0)}const m=n.metadataRegistry.get(e);return m&&Object.assign(u.schema,m),n.io==="input"&&gn(e)&&(delete u.schema.examples,delete u.schema.default),n.io==="input"&&"_prefault"in u.schema&&((i=u.schema).default??(i.default=u.schema._prefault)),delete u.schema._prefault,n.seen.get(e).schema}function K_(e,n){const r=e.seen.get(n);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=new Map;for(const u of e.seen.entries()){const d=e.metadataRegistry.get(u[0])?.id;if(d){const m=i.get(d);if(m&&m!==u[0])throw new Error(`Duplicate schema id "${d}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(d,u[0])}}const s=u=>{const d=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const v=e.external.registry.get(u[0])?.id,b=e.external.uri??(_=>_);if(v)return{ref:b(v)};const S=u[1].defId??u[1].schema.id??`schema${e.counter++}`;return u[1].defId=S,{defId:S,ref:`${b("__shared")}#/${d}/${S}`}}if(u[1]===r)return{ref:"#"};const h=`#/${d}/`,y=u[1].schema.id??`__schema${e.counter++}`;return{defId:y,ref:h+y}},l=u=>{if(u[1].schema.$ref)return;const d=u[1],{ref:m,defId:h}=s(u);d.def={...d.schema},h&&(d.defId=h);const y=d.schema;for(const v in y)delete y[v];y.$ref=m};if(e.cycles==="throw")for(const u of e.seen.entries()){const d=u[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/ - -Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of e.seen.entries()){const d=u[1];if(n===u[0]){l(u);continue}if(e.external){const h=e.external.registry.get(u[0])?.id;if(n!==u[0]&&h){l(u);continue}}if(e.metadataRegistry.get(u[0])?.id){l(u);continue}if(d.cycle){l(u);continue}if(d.count>1&&e.reused==="ref"){l(u);continue}}}function Y_(e,n){const r=e.seen.get(n);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=d=>{const m=e.seen.get(d);if(m.ref===null)return;const h=m.def??m.schema,y={...h},v=m.ref;if(m.ref=null,v){i(v);const S=e.seen.get(v),_=S.schema;if(_.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(_)):Object.assign(h,_),Object.assign(h,y),d._zod.parent===v)for(const E in h)E==="$ref"||E==="allOf"||E in y||delete h[E];if(_.$ref&&S.def)for(const E in h)E==="$ref"||E==="allOf"||E in S.def&&JSON.stringify(h[E])===JSON.stringify(S.def[E])&&delete h[E]}const b=d._zod.parent;if(b&&b!==v){i(b);const S=e.seen.get(b);if(S?.schema.$ref&&(h.$ref=S.schema.$ref,S.def))for(const _ in h)_==="$ref"||_==="allOf"||_ in S.def&&JSON.stringify(h[_])===JSON.stringify(S.def[_])&&delete h[_]}e.override({zodSchema:d,jsonSchema:h,path:m.path??[]})};for(const d of[...e.seen.entries()].reverse())i(d[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const d=e.external.registry.get(n)?.id;if(!d)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(d)}Object.assign(s,r.def??r.schema);const l=e.metadataRegistry.get(n)?.id;l!==void 0&&s.id===l&&delete s.id;const u=e.external?.defs??{};for(const d of e.seen.entries()){const m=d[1];m.def&&m.defId&&(m.def.id===m.defId&&delete m.def.id,u[m.defId]=m.def)}e.external||Object.keys(u).length>0&&(e.target==="draft-2020-12"?s.$defs=u:s.definitions=u);try{const d=JSON.parse(JSON.stringify(s));return Object.defineProperty(d,"~standard",{value:{...n["~standard"],jsonSchema:{input:xu(n,"input",e.processors),output:xu(n,"output",e.processors)}},enumerable:!1,writable:!1}),d}catch{throw new Error("Error converting schema to JSON.")}}function gn(e,n){const r=n??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return gn(i.element,r);if(i.type==="set")return gn(i.valueType,r);if(i.type==="lazy")return gn(i.getter(),r);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return gn(i.innerType,r);if(i.type==="intersection")return gn(i.left,r)||gn(i.right,r);if(i.type==="record"||i.type==="map")return gn(i.keyType,r)||gn(i.valueType,r);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:gn(i.in,r)||gn(i.out,r);if(i.type==="object"){for(const s in i.shape)if(gn(i.shape[s],r))return!0;return!1}if(i.type==="union"){for(const s of i.options)if(gn(s,r))return!0;return!1}if(i.type==="tuple"){for(const s of i.items)if(gn(s,r))return!0;return!!(i.rest&&gn(i.rest,r))}return!1}const B6=(e,n={})=>r=>{const i=Z_({...r,processors:n});return cn(e,i),K_(i,e),Y_(i,e)},xu=(e,n,r={})=>i=>{const{libraryOptions:s,target:l}=i??{},u=Z_({...s??{},target:l,io:n,processors:r});return cn(e,u),K_(u,e),Y_(u,e)},q6={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},G6=(e,n,r,i)=>{const s=r;s.type="string";const{minimum:l,maximum:u,format:d,patterns:m,contentEncoding:h}=e._zod.bag;if(typeof l=="number"&&(s.minLength=l),typeof u=="number"&&(s.maxLength=u),d&&(s.format=q6[d]??d,s.format===""&&delete s.format,d==="time"&&delete s.format),h&&(s.contentEncoding=h),m&&m.size>0){const y=[...m];y.length===1?s.pattern=y[0].source:y.length>1&&(s.allOf=[...y.map(v=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:v.source}))])}},Z6=(e,n,r,i)=>{r.type="boolean"},K6=(e,n,r,i)=>{r.not={}},Y6=(e,n,r,i)=>{},Q6=(e,n,r,i)=>{const s=e._zod.def,l=N_(s.entries);l.every(u=>typeof u=="number")&&(r.type="number"),l.every(u=>typeof u=="string")&&(r.type="string"),r.enum=l},X6=(e,n,r,i)=>{if(n.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},J6=(e,n,r,i)=>{if(n.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},W6=(e,n,r,i)=>{const s=r,l=e._zod.def,{minimum:u,maximum:d}=e._zod.bag;typeof u=="number"&&(s.minItems=u),typeof d=="number"&&(s.maxItems=d),s.type="array",s.items=cn(l.element,n,{...i,path:[...i.path,"items"]})},eL=(e,n,r,i)=>{const s=r,l=e._zod.def;s.type="object",s.properties={};const u=l.shape;for(const h in u)s.properties[h]=cn(u[h],n,{...i,path:[...i.path,"properties",h]});const d=new Set(Object.keys(u)),m=new Set([...d].filter(h=>{const y=l.shape[h]._zod;return n.io==="input"?y.optin===void 0:y.optout===void 0}));m.size>0&&(s.required=Array.from(m)),l.catchall?._zod.def.type==="never"?s.additionalProperties=!1:l.catchall?l.catchall&&(s.additionalProperties=cn(l.catchall,n,{...i,path:[...i.path,"additionalProperties"]})):n.io==="output"&&(s.additionalProperties=!1)},tL=(e,n,r,i)=>{const s=e._zod.def,l=s.inclusive===!1,u=s.options.map((d,m)=>cn(d,n,{...i,path:[...i.path,l?"oneOf":"anyOf",m]}));l?r.oneOf=u:r.anyOf=u},nL=(e,n,r,i)=>{const s=e._zod.def,l=cn(s.left,n,{...i,path:[...i.path,"allOf",0]}),u=cn(s.right,n,{...i,path:[...i.path,"allOf",1]}),d=h=>"allOf"in h&&Object.keys(h).length===1,m=[...d(l)?l.allOf:[l],...d(u)?u.allOf:[u]];r.allOf=m},rL=(e,n,r,i)=>{const s=e._zod.def,l=cn(s.innerType,n,i),u=n.seen.get(e);n.target==="openapi-3.0"?(u.ref=s.innerType,r.nullable=!0):r.anyOf=[l,{type:"null"}]},oL=(e,n,r,i)=>{const s=e._zod.def;cn(s.innerType,n,i);const l=n.seen.get(e);l.ref=s.innerType},iL=(e,n,r,i)=>{const s=e._zod.def;cn(s.innerType,n,i);const l=n.seen.get(e);l.ref=s.innerType,r.default=JSON.parse(JSON.stringify(s.defaultValue))},aL=(e,n,r,i)=>{const s=e._zod.def;cn(s.innerType,n,i);const l=n.seen.get(e);l.ref=s.innerType,n.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},sL=(e,n,r,i)=>{const s=e._zod.def;cn(s.innerType,n,i);const l=n.seen.get(e);l.ref=s.innerType;let u;try{u=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=u},lL=(e,n,r,i)=>{const s=e._zod.def,l=s.in._zod.traits.has("$ZodTransform"),u=n.io==="input"?l?s.out:s.in:s.out;cn(u,n,i);const d=n.seen.get(e);d.ref=u},cL=(e,n,r,i)=>{const s=e._zod.def;cn(s.innerType,n,i);const l=n.seen.get(e);l.ref=s.innerType,r.readOnly=!0},Q_=(e,n,r,i)=>{const s=e._zod.def;cn(s.innerType,n,i);const l=n.seen.get(e);l.ref=s.innerType};function Im(){return Im=Object.assign?Object.assign.bind():function(e){for(var n=1;n0){var m=s.errors[0][0];r[d]={message:m.message,type:m.code}}else r[d]={message:u,type:l};if(s.code==="invalid_union"&&s.errors.forEach(function(v){return v.forEach(function(b){return e.push(Im({},b,{path:[].concat(s.path,b.path)}))})}),n){var h=r[d].types,y=h&&h[s.code];r[d]=qp(d,n,r,l,y?[].concat(y,s.message):s.message)}e.shift()};e.length;)i();return r}function nl(e,n,r){if(r===void 0&&(r={}),(function(i){return"_def"in i&&typeof i._def=="object"&&"typeName"in i._def})(e))return function(i,s,l){try{return Promise.resolve(Ox(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](i,n)).then(function(u){return l.shouldUseNativeValidation&&Dm({},l),{errors:{},values:r.raw?Object.assign({},i):u}})},function(u){if((function(d){return Array.isArray(d?.issues)})(u))return{values:{},errors:fx(uL(u.errors,!l.shouldUseNativeValidation&&l.criteriaMode==="all"),l)};throw u}))}catch(u){return Promise.reject(u)}};if((function(i){return"_zod"in i&&typeof i._zod=="object"})(e))return function(i,s,l){try{return Promise.resolve(Ox(function(){return Promise.resolve((r.mode==="sync"?h4:m4)(e,i,n)).then(function(u){return l.shouldUseNativeValidation&&Dm({},l),{errors:{},values:r.raw?Object.assign({},i):u}})},function(u){if((function(d){return d instanceof Xp})(u))return{values:{},errors:fx(dL(u.issues,!l.shouldUseNativeValidation&&l.criteriaMode==="all"),l)};throw u}))}catch(u){return Promise.reject(u)}};throw new Error("Invalid input: not a Zod schema")}const fL=ce("ZodISODateTime",(e,n)=>{b5.init(e,n),Ct.init(e,n)});function hL(e){return w6(fL,e)}const mL=ce("ZodISODate",(e,n)=>{x5.init(e,n),Ct.init(e,n)});function pL(e){return _6(mL,e)}const gL=ce("ZodISOTime",(e,n)=>{S5.init(e,n),Ct.init(e,n)});function vL(e){return C6(gL,e)}const yL=ce("ZodISODuration",(e,n)=>{w5.init(e,n),Ct.init(e,n)});function bL(e){return E6(yL,e)}const xL=(e,n)=>{Xp.init(e,n),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>f4(e,r)},flatten:{value:r=>d4(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,km,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,km,2)}},isEmpty:{get(){return e.issues.length===0}}})},nr=ce("ZodError",xL,{Parent:Error}),SL=Qu(nr),wL=Xu(nr),_L=Ju(nr),CL=Wu(nr),EL=v4(nr),RL=y4(nr),TL=b4(nr),OL=x4(nr),ML=S4(nr),AL=w4(nr),jL=_4(nr),zL=C4(nr),Mx=new WeakMap;function td(e,n,r){const i=Object.getPrototypeOf(e);let s=Mx.get(i);if(s||(s=new Set,Mx.set(i,s)),!s.has(n)){s.add(n);for(const l in r){const u=r[l];Object.defineProperty(i,l,{configurable:!0,enumerable:!1,get(){const d=u.bind(this);return Object.defineProperty(this,l,{configurable:!0,writable:!0,enumerable:!0,value:d}),d},set(d){Object.defineProperty(this,l,{configurable:!0,writable:!0,enumerable:!0,value:d})}})}}}const Ft=ce("ZodType",(e,n)=>(Vt.init(e,n),Object.assign(e["~standard"],{jsonSchema:{input:xu(e,"input"),output:xu(e,"output")}}),e.toJSONSchema=B6(e,{}),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.parse=(r,i)=>SL(e,r,i,{callee:e.parse}),e.safeParse=(r,i)=>_L(e,r,i),e.parseAsync=async(r,i)=>wL(e,r,i,{callee:e.parseAsync}),e.safeParseAsync=async(r,i)=>CL(e,r,i),e.spa=e.safeParseAsync,e.encode=(r,i)=>EL(e,r,i),e.decode=(r,i)=>RL(e,r,i),e.encodeAsync=async(r,i)=>TL(e,r,i),e.decodeAsync=async(r,i)=>OL(e,r,i),e.safeEncode=(r,i)=>ML(e,r,i),e.safeDecode=(r,i)=>AL(e,r,i),e.safeEncodeAsync=async(r,i)=>jL(e,r,i),e.safeDecodeAsync=async(r,i)=>zL(e,r,i),td(e,"ZodType",{check(...r){const i=this.def;return this.clone(Ho(i,{checks:[...i.checks??[],...r.map(s=>typeof s=="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,i){return Bo(this,r,i)},brand(){return this},register(r,i){return r.add(this,i),this},refine(r,i){return this.check(E8(r,i))},superRefine(r,i){return this.check(R8(r,i))},overwrite(r){return this.check($a(r))},optional(){return Nx(this)},exactOptional(){return f8(this)},nullable(){return Dx(this)},nullish(){return Nx(Dx(this))},nonoptional(r){return y8(this,r)},array(){return n8(this)},or(r){return i8([this,r])},and(r){return s8(this,r)},transform(r){return kx(this,u8(r))},default(r){return p8(this,r)},prefault(r){return v8(this,r)},catch(r){return x8(this,r)},pipe(r){return kx(this,r)},readonly(){return _8(this)},describe(r){const i=this.clone();return $s.add(i,{description:r}),i},meta(...r){if(r.length===0)return $s.get(this);const i=this.clone();return $s.add(i,r[0]),i},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return $s.get(e)?.description},configurable:!0}),e)),X_=ce("_ZodString",(e,n)=>{Jp.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(i,s,l)=>G6(e,i,s);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,td(e,"_ZodString",{regex(...i){return this.check(M6(...i))},includes(...i){return this.check(z6(...i))},startsWith(...i){return this.check(N6(...i))},endsWith(...i){return this.check(D6(...i))},min(...i){return this.check(bu(...i))},max(...i){return this.check(q_(...i))},length(...i){return this.check(G_(...i))},nonempty(...i){return this.check(bu(1,...i))},lowercase(i){return this.check(A6(i))},uppercase(i){return this.check(j6(i))},trim(){return this.check(L6())},normalize(...i){return this.check(k6(...i))},toLowerCase(){return this.check(I6())},toUpperCase(){return this.check($6())},slugify(){return this.check(V6())}})}),NL=ce("ZodString",(e,n)=>{Jp.init(e,n),X_.init(e,n),e.email=r=>e.check(t6(DL,r)),e.url=r=>e.check(a6(kL,r)),e.jwt=r=>e.check(S6(QL,r)),e.emoji=r=>e.check(s6(LL,r)),e.guid=r=>e.check(Tx(Ax,r)),e.uuid=r=>e.check(n6(Kc,r)),e.uuidv4=r=>e.check(r6(Kc,r)),e.uuidv6=r=>e.check(o6(Kc,r)),e.uuidv7=r=>e.check(i6(Kc,r)),e.nanoid=r=>e.check(l6(IL,r)),e.guid=r=>e.check(Tx(Ax,r)),e.cuid=r=>e.check(c6($L,r)),e.cuid2=r=>e.check(u6(VL,r)),e.ulid=r=>e.check(d6(FL,r)),e.base64=r=>e.check(y6(ZL,r)),e.base64url=r=>e.check(b6(KL,r)),e.xid=r=>e.check(f6(PL,r)),e.ksuid=r=>e.check(h6(UL,r)),e.ipv4=r=>e.check(m6(HL,r)),e.ipv6=r=>e.check(p6(BL,r)),e.cidrv4=r=>e.check(g6(qL,r)),e.cidrv6=r=>e.check(v6(GL,r)),e.e164=r=>e.check(x6(YL,r)),e.datetime=r=>e.check(hL(r)),e.date=r=>e.check(pL(r)),e.time=r=>e.check(vL(r)),e.duration=r=>e.check(bL(r))});function Ma(e){return e6(NL,e)}const Ct=ce("ZodStringFormat",(e,n)=>{St.init(e,n),X_.init(e,n)}),DL=ce("ZodEmail",(e,n)=>{u5.init(e,n),Ct.init(e,n)}),Ax=ce("ZodGUID",(e,n)=>{l5.init(e,n),Ct.init(e,n)}),Kc=ce("ZodUUID",(e,n)=>{c5.init(e,n),Ct.init(e,n)}),kL=ce("ZodURL",(e,n)=>{d5.init(e,n),Ct.init(e,n)}),LL=ce("ZodEmoji",(e,n)=>{f5.init(e,n),Ct.init(e,n)}),IL=ce("ZodNanoID",(e,n)=>{h5.init(e,n),Ct.init(e,n)}),$L=ce("ZodCUID",(e,n)=>{m5.init(e,n),Ct.init(e,n)}),VL=ce("ZodCUID2",(e,n)=>{p5.init(e,n),Ct.init(e,n)}),FL=ce("ZodULID",(e,n)=>{g5.init(e,n),Ct.init(e,n)}),PL=ce("ZodXID",(e,n)=>{v5.init(e,n),Ct.init(e,n)}),UL=ce("ZodKSUID",(e,n)=>{y5.init(e,n),Ct.init(e,n)}),HL=ce("ZodIPv4",(e,n)=>{_5.init(e,n),Ct.init(e,n)}),BL=ce("ZodIPv6",(e,n)=>{C5.init(e,n),Ct.init(e,n)}),qL=ce("ZodCIDRv4",(e,n)=>{E5.init(e,n),Ct.init(e,n)}),GL=ce("ZodCIDRv6",(e,n)=>{R5.init(e,n),Ct.init(e,n)}),ZL=ce("ZodBase64",(e,n)=>{T5.init(e,n),Ct.init(e,n)}),KL=ce("ZodBase64URL",(e,n)=>{M5.init(e,n),Ct.init(e,n)}),YL=ce("ZodE164",(e,n)=>{A5.init(e,n),Ct.init(e,n)}),QL=ce("ZodJWT",(e,n)=>{z5.init(e,n),Ct.init(e,n)}),XL=ce("ZodBoolean",(e,n)=>{N5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>Z6(e,r,i)});function jx(e){return R6(XL,e)}const JL=ce("ZodUnknown",(e,n)=>{D5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>Y6()});function zx(){return T6(JL)}const WL=ce("ZodNever",(e,n)=>{k5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>K6(e,r,i)});function e8(e){return O6(WL,e)}const t8=ce("ZodArray",(e,n)=>{L5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>W6(e,r,i,s),e.element=n.element,td(e,"ZodArray",{min(r,i){return this.check(bu(r,i))},nonempty(r){return this.check(bu(1,r))},max(r,i){return this.check(q_(r,i))},length(r,i){return this.check(G_(r,i))},unwrap(){return this.element}})});function n8(e,n){return F6(t8,e,n)}const r8=ce("ZodObject",(e,n)=>{$5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>eL(e,r,i,s),ht(e,"shape",()=>n.shape),td(e,"ZodObject",{keyof(){return l8(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:zx()})},loose(){return this.clone({...this._zod.def,catchall:zx()})},strict(){return this.clone({...this._zod.def,catchall:e8()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return i4(this,r)},safeExtend(r){return a4(this,r)},merge(r){return s4(this,r)},pick(r){return r4(this,r)},omit(r){return o4(this,r)},partial(...r){return l4(J_,this,r[0])},required(...r){return c4(W_,this,r[0])}})});function vl(e,n){const r={type:"object",shape:e??{},...Ie(n)};return new r8(r)}const o8=ce("ZodUnion",(e,n)=>{V5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>tL(e,r,i,s),e.options=n.options});function i8(e,n){return new o8({type:"union",options:e,...Ie(n)})}const a8=ce("ZodIntersection",(e,n)=>{F5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>nL(e,r,i,s)});function s8(e,n){return new a8({type:"intersection",left:e,right:n})}const $m=ce("ZodEnum",(e,n)=>{P5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(i,s,l)=>Q6(e,i,s),e.enum=n.entries,e.options=Object.values(n.entries);const r=new Set(Object.keys(n.entries));e.extract=(i,s)=>{const l={};for(const u of i)if(r.has(u))l[u]=n.entries[u];else throw new Error(`Key ${u} not found in enum`);return new $m({...n,checks:[],...Ie(s),entries:l})},e.exclude=(i,s)=>{const l={...n.entries};for(const u of i)if(r.has(u))delete l[u];else throw new Error(`Key ${u} not found in enum`);return new $m({...n,checks:[],...Ie(s),entries:l})}});function l8(e,n){const r=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new $m({type:"enum",entries:r,...Ie(n)})}const c8=ce("ZodTransform",(e,n)=>{U5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>J6(e,r),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new z_(e.constructor.name);r.addIssue=l=>{if(typeof l=="string")r.issues.push(tl(l,r.value,n));else{const u=l;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=r.value),u.inst??(u.inst=e),r.issues.push(tl(u))}};const s=n.transform(r.value,r);return s instanceof Promise?s.then(l=>(r.value=l,r.fallback=!0,r)):(r.value=s,r.fallback=!0,r)}});function u8(e){return new c8({type:"transform",transform:e})}const J_=ce("ZodOptional",(e,n)=>{B_.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>Q_(e,r,i,s),e.unwrap=()=>e._zod.def.innerType});function Nx(e){return new J_({type:"optional",innerType:e})}const d8=ce("ZodExactOptional",(e,n)=>{H5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>Q_(e,r,i,s),e.unwrap=()=>e._zod.def.innerType});function f8(e){return new d8({type:"optional",innerType:e})}const h8=ce("ZodNullable",(e,n)=>{B5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>rL(e,r,i,s),e.unwrap=()=>e._zod.def.innerType});function Dx(e){return new h8({type:"nullable",innerType:e})}const m8=ce("ZodDefault",(e,n)=>{q5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>iL(e,r,i,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function p8(e,n){return new m8({type:"default",innerType:e,get defaultValue(){return typeof n=="function"?n():k_(n)}})}const g8=ce("ZodPrefault",(e,n)=>{G5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>aL(e,r,i,s),e.unwrap=()=>e._zod.def.innerType});function v8(e,n){return new g8({type:"prefault",innerType:e,get defaultValue(){return typeof n=="function"?n():k_(n)}})}const W_=ce("ZodNonOptional",(e,n)=>{Z5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>oL(e,r,i,s),e.unwrap=()=>e._zod.def.innerType});function y8(e,n){return new W_({type:"nonoptional",innerType:e,...Ie(n)})}const b8=ce("ZodCatch",(e,n)=>{K5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>sL(e,r,i,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function x8(e,n){return new b8({type:"catch",innerType:e,catchValue:typeof n=="function"?n:()=>n})}const S8=ce("ZodPipe",(e,n)=>{Y5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>lL(e,r,i,s),e.in=n.in,e.out=n.out});function kx(e,n){return new S8({type:"pipe",in:e,out:n})}const w8=ce("ZodReadonly",(e,n)=>{Q5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>cL(e,r,i,s),e.unwrap=()=>e._zod.def.innerType});function _8(e){return new w8({type:"readonly",innerType:e})}const C8=ce("ZodCustom",(e,n)=>{X5.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>X6(e,r)});function E8(e,n={}){return P6(C8,e,n)}function R8(e,n){return U6(e,n)}const T8=/\.(md|markdown)$/i,O8=/\.(png|jpe?g|gif|svg|webp|ico|bmp|avif)$/i,eC=/\.html?$/i,M8=/\.(txt|log|json|ya?ml|toml|csv|go|py|js|ts|jsx|tsx|sh|bash|zsh|rb|rs|c|h|cpp|java|kt|swift|sql|css|xml|ini|conf|env|mod|sum|jsonl)$/i;function tC(e){if(e<1024)return e+" B";const n=["KB","MB","GB","TB"];let r=-1;do e/=1024,r++;while(e>=1024&&r[role=checkbox]]:translate-y-[2px]",e),...n})}function aC({className:e,...n}){return g.jsx("td",{"data-slot":"table-cell",className:et("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...n})}const A8=vl({name:Ma().trim().min(1,"Give the organization a name.").max(60,"Keep it under 60 characters.")});function sC({header:e}){const n=e.column.getIsSorted();return e.column.getCanSort()?g.jsx(Lx,{"data-sort":n||void 0,"aria-sort":n==="asc"?"ascending":n==="desc"?"descending":"none",children:g.jsxs("button",{type:"button",className:"th-sort",onClick:e.column.getToggleSortingHandler(),children:[mu(e.column.columnDef.header,e.getContext()),n==="asc"?" ↑":n==="desc"?" ↓":""]})}):g.jsx(Lx,{children:mu(e.column.columnDef.header,e.getContext())})}function j8({org:e,projects:n,myEmail:r}){const i=sl(),s=e.role==="owner",l=()=>i.invalidateQueries({queryKey:["orgs"]}),u=()=>i.invalidateQueries({queryKey:["invites",e.id]}),d=()=>i.invalidateQueries({queryKey:["orgShares",e.id]}),m=Ws({resolver:nl(A8),values:{name:e.name}}),{data:h}=jn({queryKey:["invites",e.id],queryFn:()=>Fn(`/api/orgs/${e.id}/invites`),enabled:s,select:b=>b.invites||[]}),{data:y}=jn({queryKey:["orgShares",e.id],queryFn:()=>Fn(`/api/orgs/${e.id}/shares`),enabled:s,select:b=>b.shares||[]}),v=n.filter(b=>b.org===e.id);return g.jsxs("div",{className:"admin",children:[g.jsx("h1",{id:"org-title",children:e.name}),!s&&g.jsx("p",{className:"role-chip-row",children:g.jsx("span",{className:"ai-tag role-chip",children:"Member"})}),!s&&g.jsx("p",{className:"admin-sub",children:"Only owners can rename this organization, manage members, or issue invite links."}),s&&g.jsxs("form",{className:"admin-row",onSubmit:m.handleSubmit(async({name:b})=>{try{await zo("PATCH","/api/orgs/"+e.id,{name:b}),We("Renamed."),l()}catch(S){We(S.message,!0)}}),children:[g.jsx("label",{className:"admin-lbl",htmlFor:"org-rename",children:"Organization name"}),g.jsx("input",{id:"org-rename",type:"text","aria-invalid":!!m.formState.errors.name,"aria-describedby":m.formState.errors.name?"org-rename-err":void 0,...m.register("name")}),g.jsx($t,{variant:"subtle",id:"org-rename-btn",type:"submit",disabled:!m.formState.isDirty,children:"Rename org"}),m.formState.errors.name&&g.jsx("span",{id:"org-rename-err",role:"alert",className:"field-err",children:m.formState.errors.name.message})]}),g.jsx("h3",{children:"Members"}),g.jsx(z8,{org:e,owner:s,myEmail:r,onChanged:l}),g.jsx("h3",{children:"Projects"}),g.jsxs("div",{className:"admin-list",children:[v.length===0&&g.jsx("div",{className:"admin-empty",children:"No projects yet."}),v.map(b=>g.jsx("div",{className:"admin-item",children:g.jsx("span",{className:"ai-main",title:b.name,children:b.name})},b.id))]}),s&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"admin-h",children:[g.jsx("h3",{children:"Invite links"}),g.jsx($t,{variant:"primary",onClick:async()=>{try{const b=await Aa(`/api/orgs/${e.id}/invites`),S=await rl(b.url);We(S?"Invite link copied to clipboard.":"Invite created — copy it from the list below."),u()}catch(b){We(b.message,!0)}},children:"New invite"})]}),g.jsxs("div",{className:"admin-list",children:[h&&h.length===0&&g.jsx("div",{className:"admin-empty",children:"No active invite links."}),(h||[]).map(b=>g.jsxs("div",{className:"admin-item",children:[g.jsx("button",{type:"button",className:"ai-main mono ai-copy","aria-label":`Copy invite link ${b.url}`,title:b.url,onClick:()=>rl(b.url).then(S=>We(S?"Copied.":"Select and copy the link.")),children:b.url}),g.jsx("span",{className:"ai-tag",children:(b.creator?"by "+b.creator+" · ":"")+(b.uses?b.uses+" joined · ":"unused · ")+"expires "+new Date(b.expires).toLocaleDateString()}),g.jsx("button",{className:"ai-del","aria-label":`Revoke invite ${b.token.slice(0,8)}`,onClick:async()=>{if(await Dp("Revoke invite",`Revoke the link starting ${b.token.slice(0,8)}…? Anyone still holding it won't be able to join.`,"Revoke",!0))try{await zo("DELETE",`/api/orgs/${e.id}/invites/${b.token}`),We("Revoked."),u()}catch(S){We(S.message,!0)}},children:"Revoke"})]},b.token))]}),g.jsx("h3",{children:"Public share links"}),g.jsx(N8,{shares:y||[],onChanged:d})]})]})}function z8({org:e,owner:n,myEmail:r,onChanged:i}){const[s,l]=x.useState([{id:"email",desc:!1}]),u=x.useMemo(()=>a_(),[]),d=x.useMemo(()=>[u.accessor("email",{id:"email",header:"Member",cell:h=>{const y=!!r&&h.getValue().toLowerCase()===r.toLowerCase();return g.jsx("span",{className:"ai-main",title:h.getValue(),children:h.getValue()+(y?" (you)":"")})}}),u.accessor("role",{id:"role",header:"Role",cell:h=>{const y=h.row.original,v=!!r&&y.email.toLowerCase()===r.toLowerCase();return!n||v?g.jsx("span",{className:"ai-tag role-static",children:y.role}):g.jsxs("span",{className:"role-cell",children:[g.jsxs("select",{"aria-label":`Role for ${y.email}`,value:y.role,onChange:async b=>{try{await zo("PATCH",`/api/orgs/${e.id}/members/${encodeURIComponent(y.email)}`,{role:b.target.value}),We("Role updated.")}catch(S){We(S.message,!0)}i()},children:[g.jsx("option",{value:"owner",children:"owner"}),g.jsx("option",{value:"member",children:"member"})]}),g.jsx("button",{className:"ai-del","aria-label":`Remove ${y.email}`,onClick:async()=>{if(await Dp("Remove member",`Remove ${y.email} from ${e.name}?`,"Remove",!0))try{await zo("DELETE",`/api/orgs/${e.id}/members/${encodeURIComponent(y.email)}`),We("Removed."),i()}catch(b){We(b.message,!0)}},children:"Remove"})]})}})],[u,e.id,e.name,n,r]),m=y_({data:e.members,columns:d,state:{sorting:s},onSortingChange:l,getCoreRowModel:g_(),getSortedRowModel:v_()});return g.jsx("div",{className:"admin-list admin-card-table",children:g.jsxs(rC,{className:"admin-table",children:[g.jsx(oC,{children:m.getHeaderGroups().map(h=>g.jsx(Su,{children:h.headers.map(y=>g.jsx(sC,{header:y},y.id))},h.id))}),g.jsx(iC,{children:m.getRowModel().rows.map(h=>g.jsx(Su,{className:"admin-item",children:h.getVisibleCells().map(y=>g.jsx(aC,{children:mu(y.column.columnDef.cell,y.getContext())},y.id))},h.id))})]})})}function N8({shares:e,onChanged:n}){const[r,i]=x.useState([]),s=x.useMemo(()=>a_(),[]),l=x.useMemo(()=>[s.accessor("path",{header:"Path",cell:d=>g.jsx("a",{className:"ai-main mono",href:d.row.original.url,target:"_blank",rel:"noopener noreferrer",title:d.getValue(),children:d.getValue()})}),s.accessor(d=>d.project_name||"",{id:"project",header:"Project",cell:d=>g.jsx("span",{className:"ai-tag",children:(d.getValue()||"")+(d.row.original.creator?" · by "+d.row.original.creator:"")+(d.row.original.created?" · "+new Date(d.row.original.created).toLocaleDateString():"")})}),s.display({id:"actions",header:"",cell:d=>g.jsx("button",{className:"ai-del","aria-label":`Revoke the share of ${d.row.original.path}`,onClick:async()=>{const m=d.row.original;if(await Dp("Revoke share link",`Revoke the public link to “${m.path}”? Anyone with the URL will lose access.`,"Revoke",!0))try{await zo("DELETE","/api/shares/"+m.token),We("Share revoked."),n()}catch(h){We(h.message,!0)}},children:"Revoke"})})],[s,n]),u=y_({data:e,columns:l,state:{sorting:r},onSortingChange:i,getCoreRowModel:g_(),getSortedRowModel:v_()});return e.length===0?g.jsx("div",{className:"admin-list",children:g.jsx("div",{className:"admin-empty",children:"No public shares."})}):g.jsx("div",{className:"admin-list admin-card-table",children:g.jsxs(rC,{className:"admin-table",children:[g.jsx(oC,{children:u.getHeaderGroups().map(d=>g.jsx(Su,{children:d.headers.map(m=>g.jsx(sC,{header:m},m.id))},d.id))}),g.jsx(iC,{children:u.getRowModel().rows.map(d=>g.jsx(Su,{className:"admin-item",children:d.getVisibleCells().map(m=>g.jsx(aC,{children:mu(m.column.columnDef.cell,m.getContext())},m.id))},d.id))})]})})}const D8=vl({require_verification:jx(),require_approval:jx()});function k8(){const e=sl(),{data:n,error:r}=jn({queryKey:["admin","policy"],queryFn:()=>Fn("/api/admin/policy")}),{data:i}=t_(!0),s=Ws({resolver:nl(D8),values:n?{require_verification:n.require_verification&&n.mailer,require_approval:n.require_approval}:{require_verification:!1,require_approval:!1}});if(x.useEffect(()=>{r&&We(r.message,!0)},[r]),!n)return null;const l=async(u,d,m)=>{try{await Aa(`/api/admin/pending/${u}/${d}`),We((d==="approve"?"Approved ":"Denied ")+m),e.invalidateQueries({queryKey:["admin","pending"]})}catch(h){We(h.message,!0)}};return g.jsxs("div",{className:"admin",children:[g.jsx("h1",{children:"Signup & access"}),g.jsx("p",{className:"admin-sub",children:"Who can create an account on this hub, and how new accounts are vetted."}),g.jsx("h3",{children:"New-account vetting"}),g.jsxs("form",{onSubmit:s.handleSubmit(async u=>{try{await Aa("/api/admin/policy",u),We("Signup policy saved."),e.invalidateQueries({queryKey:["admin","policy"]})}catch(d){We(d.message,!0)}}),children:[g.jsxs("div",{className:"admin-list",children:[g.jsx(Ix,{label:"Require email verification",desc:n.mailer?"New accounts must click an emailed link before they can sign in — proves they control the address.":"Configure SMTP on the server (auth.smtp) to enable email verification.",disabled:!n.mailer,inputProps:s.register("require_verification")}),g.jsx(Ix,{label:"Require admin approval",desc:"New accounts wait for a hub admin to approve them before they gain access.",inputProps:s.register("require_approval")})]}),g.jsx($t,{variant:"primary",type:"submit",style:{marginTop:14},disabled:!s.formState.isDirty,children:"Save policy"})]}),g.jsx("h3",{children:"Who can sign up"}),g.jsxs("div",{className:"admin-list",children:[g.jsxs("div",{className:"admin-item",children:[g.jsx("span",{className:"ai-main",children:"Allowed email domains"}),g.jsx("span",{className:"ai-tag",children:n.allowed_domains&&n.allowed_domains.length?n.allowed_domains.map(u=>"@"+u).join(", "):"any"})]}),g.jsxs("div",{className:"admin-item",children:[g.jsx("span",{className:"ai-main",children:"Self-signup"}),g.jsx("span",{className:"ai-tag",children:n.allow_signup?"open":"invite-only"})]}),g.jsxs("div",{className:"admin-item",children:[g.jsx("span",{className:"ai-main",children:"Hub admins"}),g.jsx("span",{className:"ai-tag",children:n.admins&&n.admins.length?n.admins.join(", "):"none"})]})]}),g.jsx("p",{className:"admin-sub",children:"Domains and admins are set in the server config file (they can't be widened from the browser)."}),g.jsx("h3",{children:"Pending signups"}),g.jsxs("div",{className:"admin-list",children:[(!i||i.length===0)&&g.jsx("div",{className:"admin-empty",children:"No one is waiting for approval."}),(i||[]).map(u=>g.jsxs("div",{className:"admin-item",children:[g.jsx("span",{className:"ai-main",children:(u.name?u.name+" · ":"")+u.email}),g.jsx($t,{variant:"primary",onClick:()=>l(u.id,"approve",u.email),children:"Approve"}),g.jsx("button",{className:"ai-del",onClick:()=>l(u.id,"deny",u.email),children:"Deny"})]},u.id))]})]})}function Ix({label:e,desc:n,disabled:r,inputProps:i}){return g.jsxs("label",{className:"admin-item toggle",style:r?{opacity:.55}:void 0,children:[g.jsxs("span",{className:"ai-main",children:[g.jsx("div",{className:"tg-label",children:e}),g.jsx("div",{className:"tg-desc",children:n})]}),g.jsx("input",{type:"checkbox",disabled:r,...i})]})}function L8({...e}){return g.jsx(Vw,{"data-slot":"select",...e})}function I8({...e}){return g.jsx(Hw,{"data-slot":"select-value",...e})}function $8({className:e,size:n="default",children:r,...i}){return g.jsxs(Pw,{"data-slot":"select-trigger","data-size":n,className:et("flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",e),...i,children:[r,g.jsx(Bw,{asChild:!0,children:g.jsx(Ap,{className:"size-4 opacity-50"})})]})}function V8({className:e,children:n,position:r="item-aligned",align:i="center",...s}){return g.jsx(Gw,{children:g.jsxs(Zw,{"data-slot":"select-content",className:et("relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,align:i,...s,children:[g.jsx(P8,{}),g.jsx(Jw,{className:et("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:n}),g.jsx(U8,{})]})})}function F8({className:e,children:n,...r}){return g.jsxs(n1,{"data-slot":"select-item",className:et("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...r,children:[g.jsx("span",{"data-slot":"select-item-indicator",className:"absolute right-2 flex size-3.5 items-center justify-center",children:g.jsx(i1,{children:g.jsx(P1,{className:"size-4"})})}),g.jsx(r1,{children:n})]})}function P8({className:e,...n}){return g.jsx(a1,{"data-slot":"select-scroll-up-button",className:et("flex cursor-default items-center justify-center py-1",e),...n,children:g.jsx(wN,{className:"size-4"})})}function U8({className:e,...n}){return g.jsx(s1,{"data-slot":"select-scroll-down-button",className:et("flex cursor-default items-center justify-center py-1",e),...n,children:g.jsx(Ap,{className:"size-4"})})}const $x=["#5b8def","#f5a623","#4cc38a","#e0679b","#8b7bf0","#3ec8c8","#e6934a"];function ol(e){let n=0;for(const r of e)n=n*31+r.charCodeAt(0)>>>0;return $x[n%$x.length]}function Vx({projects:e,currentId:n,menu:r}){const i=kp(),s=e.find(u=>u.id===n),l=async()=>{const u=await e_("New project","Project name","","Create");if(u!==null)try{const d=await Aa("/api/projects",{name:u});await i(),fn("/"+d.project.id),We(`Created “${d.project.name}”.`)}catch(d){We("Could not create the project: "+d.message,!0)}};return g.jsxs("nav",{id:"projects","aria-label":"Projects",children:[g.jsxs("div",{className:"nav-head",children:[g.jsx("span",{children:"Projects"}),g.jsx("button",{className:"nav-add",title:"New project","aria-label":"New project",onClick:l,children:"+"})]}),g.jsx("div",{className:"proj-row",children:g.jsxs(L8,{value:n||"",onValueChange:u=>{u&&u!==n&&(fn("/"+u),fr())},children:[g.jsxs($8,{id:"project-select","aria-label":`Switch project — current: ${s?.name??"none"}`,title:s?.name,className:"proj-trigger",children:[s&&g.jsx("span",{className:"proj-mark","aria-hidden":"true",style:{background:ol(s.name)},children:g.jsx(Ta,{name:s.icon})}),s?g.jsx("span",{"data-slot":"select-value",children:s.name}):g.jsx(I8,{placeholder:"Select a project"})]}),g.jsx(V8,{className:"proj-menu",position:"popper",sideOffset:4,children:e.map(u=>g.jsxs(F8,{value:u.id,children:[g.jsx("span",{className:"proj-mark","aria-hidden":"true",style:{background:ol(u.name)},children:g.jsx(Ta,{name:u.icon})}),u.name]},u.id))})]})}),r&&g.jsx("ul",{className:"nav-menu","aria-label":"Project pages",children:[["dashboard","Dashboard","dashboard",r.onDashboard],["install","Installation","terminal",r.onInstall],["history","History","hist",r.onHistory],["settings","Settings","gear",r.onSettings]].map(([u,d,m,h])=>g.jsx("li",{children:g.jsxs("div",{id:"nav-"+u,className:"row"+(r.active===u?" active":""),role:"button",tabIndex:0,onClick:h,onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),h())},children:[g.jsx(Yt,{name:m}),g.jsx("span",{className:"label",children:d})]})},u))})]})}function lC({...e}){return g.jsx(ej,{"data-slot":"dropdown-menu",...e})}function cC({...e}){return g.jsx(tj,{"data-slot":"dropdown-menu-trigger",...e})}function uC({className:e,sideOffset:n=4,...r}){return g.jsx(nj,{children:g.jsx(rj,{"data-slot":"dropdown-menu-content",sideOffset:n,className:et("z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",e),...r})})}function Us({className:e,inset:n,variant:r="default",...i}){return g.jsx(ij,{"data-slot":"dropdown-menu-item","data-inset":n,"data-variant":r,className:et("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!",e),...i})}function Bh({className:e,inset:n,...r}){return g.jsx(oj,{"data-slot":"dropdown-menu-label","data-inset":n,className:et("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r})}function H8({me:e,org:n,admin:r,orgActive:i}){const s=e.name||e.email,[l,u]=x.useState(!1),d=n?i_(n.manage_url):null;return g.jsx("footer",{id:"accountbar",children:g.jsxs(lC,{modal:!1,open:l,onOpenChange:u,children:[g.jsx(cC,{asChild:!0,children:g.jsxs("button",{id:"account-btn",className:i?"active":void 0,"aria-label":"Account menu",children:[g.jsx("span",{className:"avatar",style:{background:ol(e.email)},"aria-hidden":"true",children:(s.trim()[0]||"?").toUpperCase()}),g.jsxs("span",{className:"acct",children:[g.jsx("b",{children:s}),e.name&&g.jsx("small",{children:e.email})]}),g.jsx(Yt,{name:"chev"})]})}),g.jsxs(uC,{id:"account-menu",side:"top",align:"start",sideOffset:6,className:"acct-menu",children:[n&&g.jsxs(g.Fragment,{children:[g.jsx(Bh,{className:"menu-sec",children:"Organization"}),g.jsx(Us,{asChild:!0,children:g.jsxs("a",{id:"menu-org-settings","aria-current":i?"page":void 0,...d,onClick:m=>{d?.onClick?.(m),u(!1)},children:[g.jsx(Yt,{name:"gear"}),g.jsxs("span",{children:[g.jsx("b",{children:n.name})," Settings"]}),!n.manage_url.startsWith("/")&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"ext","aria-hidden":"true",children:"↗"}),g.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]})]})})]}),r&&g.jsxs(g.Fragment,{children:[g.jsx(Bh,{className:"menu-sec",children:"Hub"}),g.jsxs(Us,{id:"menu-hub-admin",onSelect:r.onClick,children:[g.jsx(Yt,{name:"shield"}),g.jsxs("span",{children:["Signup & access",r.pending?` · ${r.pending}`:""]})]})]}),g.jsx(Bh,{className:"menu-sec",children:"Account"}),g.jsx(Us,{asChild:!0,children:g.jsxs("a",{id:"signout",href:"/auth/logout",children:[g.jsx(Yt,{name:"power"}),g.jsx("span",{children:"Log out"})]})})]})]})})}function qh({className:e,...n}){return g.jsx("div",{"data-slot":"card",className:et("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...n})}function Gh({className:e,...n}){return g.jsx("div",{"data-slot":"card-header",className:et("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...n})}function Zh({className:e,...n}){return g.jsx("div",{"data-slot":"card-title",className:et("leading-none font-semibold",e),...n})}function B8({className:e,...n}){return g.jsx("div",{"data-slot":"card-description",className:et("text-muted-foreground text-sm",e),...n})}function Kh({className:e,...n}){return g.jsx("div",{"data-slot":"card-content",className:et("px-6",e),...n})}function q8({className:e,type:n,...r}){return g.jsx("input",{type:n,"data-slot":"input",className:et("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",e),...r})}function Yh({className:e,...n}){return g.jsx(sj,{"data-slot":"label",className:et("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...n})}function Yc({className:e,orientation:n="horizontal",decorative:r=!0,...i}){return g.jsx(Lj,{"data-slot":"separator",decorative:r,orientation:n,className:et("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...i})}function G8({className:e,...n}){return g.jsx("textarea",{"data-slot":"textarea",className:et("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...n})}const Vm=280,Z8=vl({name:Ma().trim().min(1,"Give the project a name.").max(120,"Keep the name under 120 characters."),description:Ma().max(Vm,`Keep the description under ${Vm} characters.`),icon:Ma()});function K8({project:e,org:n,onDeleted:r}){const i=kp(),s=n?.role==="owner",l=Ws({resolver:nl(Z8),defaultValues:{name:e.name,description:e.description??"",icon:e.icon??""}});x.useEffect(()=>{l.reset({name:e.name,description:e.description??"",icon:e.icon??""})},[e.id,e.name,e.description,e.icon]);const u=l.watch("icon"),d=l.watch("description"),m=l.handleSubmit(async h=>{const y=l.formState.dirtyFields,v={};if(y.name&&(v.name=h.name.trim()),y.description&&(v.description=h.description),y.icon&&(v.icon=h.icon),Object.keys(v).length!==0)try{await zo("PATCH","/api/projects/"+e.id,v),We("Saved."),l.reset({...h,name:h.name.trim()}),await i()}catch(b){We(b.message,!0)}});return g.jsxs("div",{className:"project-settings",children:[g.jsx("h2",{children:e.name}),g.jsxs(qh,{children:[g.jsxs(Gh,{children:[g.jsx(Zh,{children:"General"}),g.jsx(B8,{children:"Name, description and icon for this project."})]}),g.jsx(Yc,{}),g.jsx(Kh,{children:g.jsxs("form",{className:"ps-form",onSubmit:m,children:[g.jsxs("div",{className:"ps-field",children:[g.jsx(Yh,{htmlFor:"ps-icon-btn",children:"Icon"}),g.jsxs("div",{className:"ps-icon-row",children:[g.jsx("span",{className:"proj-mark","aria-hidden":"true",style:{background:ol(e.name)},children:g.jsx(Ta,{name:u})}),g.jsxs(lC,{children:[g.jsx(cC,{asChild:!0,children:g.jsx($t,{id:"ps-icon-btn",type:"button",variant:"subtle",disabled:!s,children:"Change"})}),g.jsxs(uC,{align:"start",className:"ps-icon-grid",children:[g.jsx(Us,{className:"ps-icon-cell"+(u===""?" active":""),title:"Default","aria-label":"Default icon",onSelect:()=>l.setValue("icon","",{shouldDirty:!0}),children:g.jsx(Ta,{})}),Object.keys(J1).map(h=>g.jsx(Us,{className:"ps-icon-cell"+(u===h?" active":""),title:h,"aria-label":h,onSelect:()=>l.setValue("icon",h,{shouldDirty:!0}),children:g.jsx(Ta,{name:h})},h))]})]})]})]}),g.jsxs("div",{className:"ps-field",children:[g.jsx(Yh,{htmlFor:"ps-name",children:"Name"}),g.jsx(q8,{id:"ps-name",disabled:!s,"aria-invalid":!!l.formState.errors.name,"aria-describedby":l.formState.errors.name?"ps-name-err":void 0,...l.register("name")}),l.formState.errors.name&&g.jsx("span",{id:"ps-name-err",role:"alert",className:"field-err",children:l.formState.errors.name.message})]}),g.jsxs("div",{className:"ps-field",children:[g.jsxs(Yh,{htmlFor:"ps-desc",children:["Description ",g.jsx("span",{className:"ps-opt",children:"(optional)"})]}),g.jsx(G8,{id:"ps-desc",rows:2,disabled:!s,placeholder:"What this project is for.","aria-invalid":!!l.formState.errors.description,"aria-describedby":l.formState.errors.description?"ps-desc-err":void 0,...l.register("description")}),g.jsxs("div",{className:"ps-meta",children:[l.formState.errors.description?g.jsx("span",{id:"ps-desc-err",role:"alert",className:"field-err",children:l.formState.errors.description.message}):g.jsx("span",{}),g.jsxs("span",{className:"ps-count",children:[d.length," / ",Vm]})]})]}),s&&g.jsxs(g.Fragment,{children:[g.jsx(Yc,{}),g.jsx("div",{className:"ps-actions",children:g.jsx($t,{id:"ps-save",type:"submit",variant:"primary",disabled:!l.formState.isDirty||l.formState.isSubmitting,children:"Save changes"})})]})]})})]}),g.jsxs(qh,{children:[g.jsx(Gh,{children:g.jsx(Zh,{children:"About"})}),g.jsx(Yc,{}),g.jsx(Kh,{children:g.jsxs("dl",{className:"ps-facts",children:[g.jsx("dt",{children:"Project id"}),g.jsx("dd",{children:g.jsx("code",{children:e.id})}),n&&g.jsxs(g.Fragment,{children:[g.jsx("dt",{children:"Workspace"}),g.jsx("dd",{children:n.name})]}),e.created&&g.jsxs(g.Fragment,{children:[g.jsx("dt",{children:"Created"}),g.jsx("dd",{children:new Date(e.created).toLocaleDateString()})]})]})})]}),n?.role==="owner"&&g.jsxs(qh,{className:"ps-danger",children:[g.jsx(Gh,{children:g.jsx(Zh,{children:"Danger zone"})}),g.jsx(Yc,{}),g.jsxs(Kh,{children:[g.jsx("p",{children:"Deleting removes the project from this hub. Its files stay in storage. This can't be undone."}),g.jsx($t,{variant:"danger",onClick:async()=>{if(await e_(`Delete “${e.name}”?`,"This can't be undone. Type the project name to confirm:","","Delete project",{match:e.name,danger:!0})!==null)try{await zo("DELETE","/api/projects/"+e.id),We(`Deleted “${e.name}”.`),await r()}catch(y){We(y.message,!0)}},children:"Delete project"})]})]})]})}const Qh=[{key:"claude",label:"Claude Code & Cowork"},{key:"hermes",label:"Hermes",agent:"hermes",skillDir:"~/.hermes/skills/beardrive/"},{key:"codex",label:"Codex",agent:"codex",skillDir:"~/.codex/skills/beardrive/",extra:"Codex asks once to trust the project's .codex hooks layer — answer yes (or run /hooks) and from then on every turn pulls, edits push automatically, and reads are reported to Insights."}];function Y8(e,n){const r=window.location.origin,i=n.id;return e.key==="claude"?[{title:"Add the BearDrive plugin",desc:"One time, in any Claude Code session. The plugin ships the beardrive skill, the /beardrive commands, and turn-boundary sync hooks — and Claude Cowork shares the same plugins, so installing it once covers both.",code:`/plugin marketplace add runbear-io/beardrive -/plugin install beardrive@beardrive`},{title:"Set up this project conversationally",desc:"In a Claude Code or Cowork session in the folder where you want the files, run:",code:"/beardrive:install connect to "+r+", project "+i,extra:"Claude installs the CLI, signs this machine in, mounts the project, and registers the sync hooks — pull the latest before every turn, push after edits (stamped with the session that made them), and report file reads to Insights. It asks before anything it changes."}]:[{title:"Paste this into "+e.label,desc:"Start "+e.label+" in the folder where you want the files (an existing folder works too — contents merge), then paste:",code:Q8(e,n),extra:"Approve the shell commands when it asks. It installs the CLI, signs this machine in (it hands you a code and a URL — the folder itself never holds credentials), mounts the project, and registers the sync hooks: pull before every turn, push after edits stamped with the session that made them, file reads into Insights. It also keeps the beardrive skill in "+e.skillDir+", so from here on you can just ask."+(e.extra?" "+e.extra:"")}]}function Q8(e,n){return["Set up BearDrive in this folder.","1. If `bdrive` is missing, install it: brew install runbear-io/tap/beardrive"," (no Homebrew? grab the release binary for this OS/arch from"," https://github.com/runbear-io/beardrive/releases)","2. bdrive skill install --agent "+e.agent+" # so you know the CLI next time","3. bdrive login --device "+window.location.origin+" # show me the code and the URL","4. bdrive init --project "+n.id,"5. bdrive hooks install # don't skip this - it's what syncs every turn","Then tell me what got set up."].join(` -`)}function X8(e,n){return`brew install runbear-io/tap/beardrive -bdrive skill install --agent `+e.agent+` -bdrive login `+window.location.origin+` -bdrive init --project `+n.id+` -bdrive hooks install --agent `+e.agent}function J8(){try{return localStorage.getItem("bdrive-guide-agent")||"claude"}catch{return"claude"}}function dC({project:e}){const[n,r]=x.useState(J8),i=Qh.find(l=>l.key===n)||Qh[0],s=Y8(i,e);return g.jsxs("div",{className:"guide",children:[g.jsxs("h1",{className:"in-title gd-head",children:[g.jsx("span",{className:"proj-mark","aria-hidden":"true",style:{background:ol(e.name)},children:g.jsx(Ta,{name:e.icon})}),e.name]}),e.description&&g.jsx("p",{className:"in-desc",children:e.description}),g.jsx("p",{className:"dl-sub",children:"Mount this project as a folder on any machine and connect your coding agent: files sync both ways in the background, every change is journaled with who made it, and agent reads feed Insights."}),g.jsx("div",{className:"gd-tabs",children:Qh.map(l=>g.jsx("button",{className:"gd-tab"+(l.key===i.key?" active":""),"data-key":l.key,onClick:()=>{r(l.key);try{localStorage.setItem("bdrive-guide-agent",l.key)}catch{}},children:l.label},l.key))}),g.jsxs("div",{className:"gd-body",children:[s.map((l,u)=>g.jsxs("div",{className:"gd-step"+(s.length>1?"":" gd-solo"),children:[g.jsxs("div",{className:"gd-step-head",children:[s.length>1&&g.jsx("span",{className:"gd-num",children:u+1}),g.jsx("span",{className:"gd-step-title",children:l.title})]}),l.desc&&g.jsx("p",{className:"gd-desc",children:l.desc}),l.code&&g.jsx(Fx,{code:l.code}),l.extra&&g.jsx("p",{className:"gd-desc gd-extra",children:l.extra})]},u)),i.agent&&g.jsxs("details",{className:"gd-manual",children:[g.jsx("summary",{children:"Or run it yourself"}),g.jsx("p",{className:"gd-desc",children:"Same result, in the folder you want the files. Don't skip the last line — the hooks are what keep every turn starting from the latest state."}),g.jsx(Fx,{code:X8(i,e)})]}),g.jsx("p",{className:"gd-done",children:"That's it — the folder now syncs on its own. Every agent turn starts from the latest state, edits appear here (and on every teammate's mount) within seconds, and what your agents read shows up in Insights."})]})]})}function Fx({code:e}){const[n,r]=x.useState("Copy");return g.jsxs("pre",{className:"gd-code",children:[g.jsx("code",{children:e}),g.jsx("button",{className:"gd-copy",onClick:async()=>{r(await rl(e)?"Copied":"Copy failed"),setTimeout(()=>r("Copy"),1400)},children:n})]})}const W8=vl({invite:Ma().trim().refine(e=>/join\/([0-9a-f]+)/.test(e)||/^[0-9a-f]{8,}$/.test(e),{message:"That doesn't look like an invite link."})}),eI=vl({name:Ma().trim().min(1,"Give the project a name.").max(60,"Keep it under 60 characters.")});function tI({authEnabled:e,onCreate:n}){const r=Ws({resolver:nl(W8),defaultValues:{invite:""}}),i=Ws({resolver:nl(eI),defaultValues:{name:""}});return g.jsxs("div",{className:"onboard",children:[g.jsx("h1",{children:"Welcome to BearDrive"}),g.jsx("p",{children:"You're signed in, but you're not part of any project yet."}),e&&g.jsxs("div",{className:"ob-card",children:[g.jsx("h3",{children:"Have an invite link?"}),g.jsx("p",{children:"A teammate can send you a join link. Paste it here:"}),g.jsxs("form",{className:"ob-row",onSubmit:r.handleSubmit(({invite:s})=>{const l=s.match(/join\/([0-9a-f]+)/)||s.match(/^([0-9a-f]{8,})$/);location.href="/join/"+l[1]}),children:[g.jsx("input",{id:"ob-invite",type:"text",placeholder:"https://…/join/…",autoComplete:"off",...r.register("invite")}),g.jsx($t,{id:"ob-join",variant:"primary",type:"submit",children:"Join"})]}),r.formState.errors.invite&&g.jsx("p",{className:"field-err",children:r.formState.errors.invite.message})]}),g.jsxs("div",{className:"ob-card",children:[g.jsx("h3",{children:"Or start a new project"}),g.jsx("p",{children:"Create a shared space for your team's files."}),g.jsxs("form",{className:"ob-row",onSubmit:i.handleSubmit(({name:s})=>n(s)),children:[g.jsx("input",{id:"ob-name",type:"text",placeholder:"Project name, e.g. wiki",autoComplete:"off",...i.register("name")}),g.jsx($t,{id:"ob-create",variant:"primary",type:"submit",children:"Create"})]}),i.formState.errors.name&&g.jsx("p",{className:"field-err",children:i.formState.errors.name.message})]})]})}function nI(e,n=!0){const r=jn({queryKey:["tree",e],queryFn:()=>Fn(e+"tree"),enabled:n,refetchInterval:15e3}),i=x.useMemo(()=>{const s=[],l=new Map,u=d=>{for(const m of d.children||[])m.dir?(l.set(m.path,m),u(m)):s.push(m)};return r.data&&u(r.data),{flatFiles:s,dirIndex:l}},[r.data]);return{tree:r.data,...i,loaded:!!r.data}}function rI(e,n){return jn({queryKey:["heat",e],queryFn:()=>Fn(e+"heat?days=30"),enabled:n,staleTime:6e4,refetchInterval:6e4}).data?.entries??null}function oI(e,n,r){return jn({queryKey:["history",e,"prefix",n,20],queryFn:()=>Fn(e+"history?prefix="+encodeURIComponent(n)+"&n=20"),enabled:r,staleTime:15e3}).data?.entries??null}function Px(e,n,r){if(!e)return null;if(!r)return e[n]||null;const i={human:0,agent:0,share:0};for(const[s,l]of Object.entries(e))s.startsWith(n+"/")&&(i.human+=l.human||0,i.agent+=l.agent||0,i.share+=l.share||0);return i.human||i.agent||i.share?i:null}function il(e){return(e.human||0)+(e.agent||0)+(e.share||0)}function nu(e){const n=il(e);if(!n)return"";let r=n+(n===1?" read":" reads");return e.agent&&(r+=" ("+e.agent+" agent)"),r}function iI(e){const n=il(e);return n?n<3?1:n<10?2:n<30?3:4:0}function aI(e,n,r){const i=new Array(e);return new Proxy(i,{get(s,l,u){if(typeof l=="string"){const d=l.charCodeAt(0);if(d>=48&&d<=57){const m=+l;if(Number.isInteger(m)&&m>=0&&mi[y]!==h))&&(i=d,s=n(...d),r?.onChange&&!(l&&r.skipInitialOnChange)&&r.onChange(s),l=!1),s}return u.updateDeps=d=>{i=d},u}function Ux(e,n){if(e===void 0)throw new Error("Unexpected undefined");return e}const sI=(e,n)=>Math.abs(e-n)<1.01,lI=(e,n,r)=>{let i;return function(...s){e.clearTimeout(i),i=e.setTimeout(()=>n.apply(this,s),r)}};let Ds;const Xh=()=>{if(Ds!==void 0)return Ds;if(typeof navigator>"u")return Ds=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Ds=!0;const e=navigator.maxTouchPoints;return Ds=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Hx=e=>{const{offsetWidth:n,offsetHeight:r}=e;return{width:n,height:r}},cI=e=>e,uI=e=>{const n=Math.max(e.startIndex-e.overscan,0),i=Math.min(e.endIndex+e.overscan,e.count-1)-n+1,s=new Array(i);for(let l=0;l{const r=e.scrollElement;if(!r)return;const i=e.targetWindow;if(!i)return;const s=u=>{const{width:d,height:m}=u;n({width:Math.round(d),height:Math.round(m)})};if(s(Hx(r)),!i.ResizeObserver)return()=>{};const l=new i.ResizeObserver(u=>{const d=()=>{const m=u[0];if(m?.borderBoxSize){const h=m.borderBoxSize[0];if(h){s({width:h.inlineSize,height:h.blockSize});return}}s(Hx(r))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return l.observe(r,{box:"border-box"}),()=>{l.unobserve(r)}},wu={passive:!0},fI=typeof window>"u"?!0:"onscrollend"in window,hI=(e,n,r)=>{const i=e.scrollElement;if(!i)return;const s=e.targetWindow;if(!s)return;const l=e.options.useScrollendEvent&&fI;let u=0;const d=l?null:lI(s,()=>n(u,!1),e.options.isScrollingResetDelay),m=v=>()=>{u=r(i),d?.(),n(u,v)},h=m(!0),y=m(!1);return i.addEventListener("scroll",h,wu),l&&i.addEventListener("scrollend",y,wu),()=>{i.removeEventListener("scroll",h),l&&i.removeEventListener("scrollend",y)}},mI=(e,n)=>hI(e,n,r=>{const{horizontal:i,isRtl:s}=e.options;return i?r.scrollLeft*(s&&-1||1):r.scrollTop}),pI=(e,n,r)=>{if(r.options.useCachedMeasurements){const i=r.indexFromElement(e),s=r.options.getItemKey(i);return r.itemSizeCache.get(s)??r.options.estimateSize(i)}if(n?.borderBoxSize){const i=n.borderBoxSize[0];if(i)return Math.round(i[r.options.horizontal?"inlineSize":"blockSize"])}if(!n){const i=r.indexFromElement(e),s=r.options.getItemKey(i),l=r.itemSizeCache.get(s);if(l!==void 0)return l}return e[r.options.horizontal?"offsetWidth":"offsetHeight"]},gI=(e,{adjustments:n=0,behavior:r},i)=>{var s,l;(l=(s=i.scrollElement)==null?void 0:s.scrollTo)==null||l.call(s,{[i.options.horizontal?"left":"top"]:e+n,behavior:r})},vI=gI;class yI{constructor(n){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var r,i,s;return((s=(i=(r=this.targetWindow)==null?void 0:r.performance)==null?void 0:i.now)==null?void 0:s.call(i))??Date.now()},this.observer=(()=>{let r=null;const i=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(s=>{s.forEach(l=>{const u=()=>{const d=l.target,m=this.indexFromElement(d);if(!d.isConnected){this.observer.unobserve(d);for(const[h,y]of this.elementsCache)if(y===d){this.elementsCache.delete(h);break}return}this.shouldMeasureDuringScroll(m)&&this.resizeItem(m,this.options.measureElement(d,l,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(u):u()})}));return{disconnect:()=>{var s;(s=i())==null||s.disconnect(),r=null},observe:s=>{var l;return(l=i())==null?void 0:l.observe(s,{box:"border-box"})},unobserve:s=>{var l;return(l=i())==null?void 0:l.unobserve(s)}}})(),this.range=null,this.setOptions=r=>{var i,s;const l={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:cI,rangeExtractor:uI,onChange:()=>{},measureElement:pI,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const b in r){const S=r[b];S!==void 0&&(l[b]=S)}const u=this.options;let d=null,m=null,h=!1;if(u!==void 0&&u.enabled&&l.enabled&&l.anchorTo==="end"&&this.scrollElement!==null){const b=u.count,S=l.count,_=this.getMeasurements(),C=b>0?((i=_[0])==null?void 0:i.key)??u.getItemKey(0):null,E=b>0?((s=_[b-1])==null?void 0:s.key)??u.getItemKey(b-1):null;if(S!==b||b>0&&S>0&&(l.getItemKey(0)!==C||l.getItemKey(S-1)!==E)){h=!0;const M=b>0?this.getVirtualItemForOffset(this.getScrollOffset())??_[0]:null;M&&(d=[M.key,this.getScrollOffset()-M.start]);const k=l.followOnAppend===!0?"auto":l.followOnAppend||null;k&&S>b&&this.isAtEnd(u.scrollEndThreshold)&&(b===0||l.getItemKey(S-1)!==E)&&(m=k)}}this.options=l,h&&(this.pendingMin=0,this.itemSizeCacheVersion++);let y=!1,v=0;if(d&&this.scrollOffset!==null){const[b,S]=d,_=this.getMeasurements(),{count:C,getItemKey:E}=this.options;let T=0;for(;T{var i,s;(s=(i=this.options).onChange)==null||s.call(i,this,r)},this.maybeNotify=ba(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}if(this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(l=>{this.observer.observe(l)}),this.unsubs.push(this.options.observeElementRect(this,l=>{this.scrollRect=l,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(l,u)=>{if(u&&this._intendedScrollOffset===null&&l===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(l-this._intendedScrollOffset)<1.5&&(l=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;const d=this.getScrollOffset();this.scrollDirection=u?d===l?this.scrollDirection:d{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},d=()=>{this._iosTouching=!1,!(!Xh()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};l.addEventListener("touchstart",u,wu),l.addEventListener("touchend",d,wu),this.unsubs.push(()=>{l.removeEventListener("touchstart",u),l.removeEventListener("touchend",d),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const s=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,s&&this.scrollElement&&this.options.enabled){const[l,u,d,m]=s;l!==null&&!d&&(Xh()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?m!==0&&(this._iosDeferredAdjustment+=m):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),d&&this.scrollToEnd({behavior:d})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const r=this.getScrollOffset(),i=this.getMaxScrollOffset();if(r<0||r>i)return;const s=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(r,{adjustments:this.scrollAdjustments+=s,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=ba(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(r,i,s,l,u,d,m,h)=>(this.prevLanes!==void 0&&this.prevLanes!==d&&(this.lanesChangedFlag=!0),this.prevLanes=d,this.pendingMin=null,{count:r,paddingStart:i,scrollMargin:s,getItemKey:l,enabled:u,lanes:d,laneAssignmentMode:m,gap:h}),{key:!1}),this.getMeasurements=ba(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:r,paddingStart:i,scrollMargin:s,getItemKey:l,enabled:u,lanes:d,laneAssignmentMode:m,gap:h},y)=>{const v=this.itemSizeCache;if(!u)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const T of this.laneAssignments.keys())T>=r&&this.laneAssignments.delete(T);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(T=>{this.itemSizeCache.set(T.key,T.size)}));const b=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1),d===1){const T=r*2;let O=this._flatMeasurements;if(!O||O.length0&&L.set(O.subarray(0,b*2)),O=L,this._flatMeasurements=O}let M;if(b===0)M=i+s;else{const L=b-1;M=O[L*2]+O[L*2+1]+h}for(let L=b;L1){k=M;const ve=_[k],de=ve!==void 0?S[ve]:void 0;L=de?de.end+h:i+s}else if(E===d){let ve=0,de=C[0],le=_[0];for(let ae=1;aethis.options.debug}),this.calculateRange=ba(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,i,s,l)=>r.length===0||i===0?(this.range=null,null):(this.range=xI(r,i,s,l,l===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=ba(()=>{let r=null,i=null;const s=this.calculateRange();return s&&(r=s.startIndex,i=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,i]},(r,i,s,l,u)=>l===null||u===null?[]:r({startIndex:l,endIndex:u,overscan:i,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=r=>{const i=this.options.indexAttribute,s=r.getAttribute(i);return s?parseInt(s,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=r=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const s=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(s!==void 0&&this.range){const l=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),u=Math.max(0,s-l),d=Math.min(this.options.count-1,s+l);return r>=u&&r<=d}return!0},this.measureElement=r=>{if(!r){this.elementsCache.forEach((u,d)=>{u.isConnected||(this.observer.unobserve(u),this.elementsCache.delete(d))});return}const i=this.indexFromElement(r),s=this.options.getItemKey(i),l=this.elementsCache.get(s);l!==r&&(l&&this.observer.unobserve(l),this.observer.observe(r),this.elementsCache.set(s,r)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(r,void 0,this))},this.resizeItem=(r,i)=>{var s,l;if(r<0||r>=this.options.count)return;let u,d,m;const h=this._flatMeasurements;if(this.options.lanes===1&&h!==null)m=this.options.getItemKey(r),d=h[r*2],u=h[r*2+1];else{const b=this.measurementsCache[r];if(!b)return;m=b.key,d=b.start,u=b.size}const y=this.itemSizeCache.get(m)??u,v=i-y;if(v!==0){const b=this.options.anchorTo==="end"&&((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,S=b?this.getTotalSize():0,_=((l=this.scrollState)==null?void 0:l.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[r]??{index:r,key:m,start:d,size:u,end:d+u,lane:0},v,this):d[this.getVirtualIndexes(),this.getMeasurements()],(r,i)=>{const s=[];for(let l=0,u=r.length;lthis.options.debug}),this.getVirtualItemForOffset=r=>{const i=this.getMeasurements();if(i.length===0)return;const s=this._flatMeasurements,l=this.options.lanes===1&&s!=null,u=fC(0,i.length-1,l?d=>s[d*2]:d=>Ux(i[d]).start,r);return Ux(i[u])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const r=this.scrollElement.document.documentElement;return this.options.horizontal?r.scrollWidth-this.scrollElement.innerWidth:r.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(r=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=r,this.getOffsetForAlignment=(r,i,s=0)=>{if(!this.scrollElement)return 0;const l=this.getSize(),u=this.getScrollOffset();i==="auto"&&(i=r>=u+l?"end":"start"),i==="center"?r+=(s-l)/2:i==="end"&&(r-=l);const d=this.getMaxScrollOffset();return Math.max(Math.min(d,r),0)},this.getOffsetForIndex=(r,i="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const s=this.getSize(),l=this.getScrollOffset(),u=this.measurementsCache[r];if(!u)return;if(i==="auto")if(u.end>=l+s-this.options.scrollPaddingEnd)i="end";else if(u.start<=l+this.options.scrollPaddingStart)i="start";else return[l,i];if(i==="end"&&r===this.options.count-1)return[this.getMaxScrollOffset(),i];const d=i==="end"?u.end+this.options.scrollPaddingEnd:u.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(d,i,u.size),i]},this.scrollToOffset=(r,{align:i="start",behavior:s="auto"}={})=>{const l=this.getOffsetForAlignment(r,i),u=this.now();this.scrollState={index:null,align:i,behavior:s,startedAt:u,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToIndex=(r,{align:i="auto",behavior:s="auto"}={})=>{r=Math.max(0,Math.min(r,this.options.count-1));const l=this.getOffsetForIndex(r,i);if(!l)return;const[u,d]=l,m=this.now();this.scrollState={index:r,align:d,behavior:s,startedAt:m,lastTargetOffset:u,stableFrames:0},this._scrollToOffset(u,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollBy=(r,{behavior:i="auto"}={})=>{const s=this.getScrollOffset()+r,l=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:l,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:r="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:r});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:r})},this.getTotalSize=()=>{var r;const i=this.getMeasurements();let s;if(i.length===0)s=this.options.paddingStart;else if(this.options.lanes===1){const l=i.length-1,u=this._flatMeasurements;u!=null?s=u[l*2]+u[l*2+1]:s=((r=i[l])==null?void 0:r.end)??0}else{const l=Array(this.options.lanes).fill(null);let u=i.length-1;for(;u>=0&&l.some(d=>d===null);){const d=i[u];l[d.lane]===null&&(l[d.lane]=d.end),u--}s=Math.max(...l.filter(d=>d!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const r=[];if(this.itemSizeCache.size===0)return r;const i=this.getMeasurements();for(const s of i)s&&this.itemSizeCache.has(s.key)&&r.push({index:s.index,key:s.key,start:s.start,size:s.size,end:s.end,lane:s.lane});return r},this._scrollToOffset=(r,{adjustments:i,behavior:s})=>{this._intendedScrollOffset=r+(i??0),this.options.scrollToFn(r,{behavior:s,adjustments:i},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(n)}applyScrollAdjustment(n,r){n!==0&&(Xh()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=n:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=n,behavior:r}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,s=i?i[0]:this.scrollState.lastTargetOffset,l=1,u=s!==this.scrollState.lastTargetOffset;if(!u&&sI(s,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=l){this.getScrollOffset()!==s&&this._scrollToOffset(s,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,u){const d=this.getSize()||600,m=Math.abs(s-this.getScrollOffset()),h=this.scrollState.behavior==="smooth"&&m>d;this.scrollState.lastTargetOffset=s,h||(this.scrollState.behavior="auto"),this._scrollToOffset(s,{adjustments:void 0,behavior:h?"smooth":"auto"})}this.scheduleScrollReconcile()}}const fC=(e,n,r,i)=>{for(;e<=n;){const s=(e+n)/2|0,l=r(s);if(li)n=s-1;else return s}return e>0?e-1:0};function bI(e,n,r){let i=0;for(;i<=n;){const s=(i+n)/2|0,l=e[s*2];if(lr)n=s-1;else return s}return i>0?i-1:0}function xI(e,n,r,i,s){const l=e.length-1;if(e.length<=i)return{startIndex:0,endIndex:l};if(i===1&&s!==null){const h=bI(s,l,r);let y=h;const v=r+n;for(;ye[h].start,r),m=d;if(i===1)for(;m1){const h=Array(i).fill(0);for(;mv=0&&y.some(v=>v>=r);){const v=e[d];y[v.lane]=v.start,d--}d=Math.max(0,d-d%i),m=Math.min(l,m+(i-1-m%i))}return{startIndex:d,endIndex:m}}const Jh=typeof document<"u"?x.useLayoutEffect:x.useEffect;function SI({useFlushSync:e=!0,directDomUpdates:n=!1,directDomUpdatesMode:r="transform",...i}){const s=x.useReducer(h=>h+1,0)[1],l=x.useRef({enabled:n,mode:r,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});l.current.enabled=n,l.current.mode=r;const u=h=>{const y=l.current;if(!y.enabled||!y.container)return;const v=h.getTotalSize();if(v!==y.lastSize){y.lastSize=v;const T=h.options.horizontal?"width":"height";y.container.style[T]=`${v}px`}const b=!!h.options.horizontal,S=y.mode==="transform",_=b?"left":"top",C=h.options.scrollMargin,E=h.getVirtualItems();for(const T of E){const O=T.start-C,M=h.elementsCache.get(T.key);M&&y.lastPositions.get(M)!==O&&(y.lastPositions.set(M,O),S?M.style.transform=b?`translate3d(${O}px, 0, 0)`:`translate3d(0, ${O}px, 0)`:M.style[_]=`${O}px`)}},d={...i,onChange:(h,y)=>{var v;const b=l.current;let S=!0;if(b.enabled){u(h);const _=h.range,C=b.prevRange;S=!C||C.isScrolling!==h.isScrolling||C.startIndex!==_?.startIndex||C.endIndex!==_?.endIndex,S&&(b.prevRange=_?{startIndex:_.startIndex,endIndex:_.endIndex,isScrolling:h.isScrolling}:null)}S&&(e&&y?xi.flushSync(s):s()),(v=i.onChange)==null||v.call(i,h,y)}},[m]=x.useState(()=>{const h=new yI(d);return Object.assign(h,{containerRef:y=>{const v=l.current;if(v.container=y,v.lastSize=null,y&&v.enabled){const b=h.getTotalSize();v.lastSize=b;const S=h.options.horizontal?"width":"height";y.style[S]=`${b}px`}}})});return m.setOptions(d),Jh(()=>m._didMount(),[]),Jh(()=>m._willUpdate()),Jh(()=>{u(m)}),m}function wI(e){return SI({observeElementRect:dI,observeElementOffset:mI,scrollToFn:vI,...e})}function _I(e,n){const r=[],i=(s,l)=>{for(const u of s)r.push({node:u,depth:l}),u.dir&&n.has(u.path)&&i(u.children||[],l+1)};return i(e?.children||[],0),r}function CI(e){const{root:n,expanded:r,onToggle:i,currentPath:s,listingShowing:l,onOpen:u}=e,d=x.useRef(null),m=x.useMemo(()=>_I(n,r),[n,r]),h=wI({count:m.length,getScrollElement:()=>d.current,estimateSize:()=>window.matchMedia("(max-width: 768px)").matches?44:28,overscan:12,getItemKey:y=>m[y].node.path});return x.useEffect(()=>{if(!s)return;const y=m.findIndex(v=>v.node.path===s);y>=0&&h.scrollToIndex(y,{align:"auto"})},[s,m]),g.jsx("nav",{id:"tree","aria-label":"Files",ref:d,children:g.jsx("div",{style:{height:h.getTotalSize(),position:"relative"},children:h.getVirtualItems().map(y=>{const{node:v,depth:b}=m[y.index],S=v.dir?r.has(v.path):!1,_=()=>{if(v.dir&&s===v.path&&l){i(v.path);return}u(v.path),v.dir||fr()};return g.jsxs("div",{className:"row "+(v.dir?"dir":"file")+(s===v.path?" active":"")+(v.dir&&!S?" collapsed":""),"data-path":v.path,tabIndex:0,role:"button",title:v.name,"aria-expanded":v.dir?S:void 0,style:{position:"absolute",top:0,left:0,right:0,transform:`translateY(${y.start}px)`,paddingLeft:8+b*13},onClick:_,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),_())},children:[Array.from({length:b},(C,E)=>g.jsx("span",{className:"tguide",style:{left:8+E*13+5},"aria-hidden":"true"},E)),g.jsx("span",{className:"chev",onClick:C=>{v.dir&&(C.stopPropagation(),i(v.path))},children:g.jsx(Yt,{name:"chevd"})}),g.jsx("span",{className:"ticon",children:g.jsx(Yt,{name:v.dir?"folder":"doc"})}),g.jsx("span",{className:"label",children:v.name})]},y.key)})})})}function EI(e){const n=e.split("/"),r=[];let i="";for(let s=0;s{i=i?i+"/"+s:s;const u=i,d=l===r.length-1;return g.jsxs("span",{children:[l>0&&g.jsx("span",{className:"crumb-sep",children:"/"}),d?g.jsx("span",{children:s}):g.jsx("span",{className:"crumb-seg",title:u,onClick:()=>n(u),children:s})]},u)})})}const TI={add:"plus",edit:"edit",delete:"x"},OI={add:"added",edit:"edited",delete:"deleted"};function hC({entry:e,onOpen:n}){const[r,i]=x.useState(!1),s=e.kind==="put"?"edit":e.kind,l=e.user_name?`${e.user_name} <${e.user}>`:e.user||e.author||"unknown",u=[e.device.name||e.device.id,e.device.os,e.device.ip].filter(Boolean).join(" · "),d=s!=="delete",m=h=>{h.target.tagName!=="A"&&d&&n(e.path)};return g.jsxs("div",{className:"hentry "+s+(d?" clickable":""),tabIndex:d?0:void 0,role:d?"button":void 0,onClick:m,onKeyDown:h=>{d&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),n(e.path))},children:[g.jsxs("div",{className:"hline",children:[g.jsx("span",{className:"hkind",children:g.jsx(Yt,{name:TI[s]||"dot"})}),g.jsx("span",{className:"hpath",children:e.path}),g.jsx("span",{className:"htag",children:OI[s]||s}),g.jsx("span",{className:"htime",children:new Date(e.time).toLocaleString()})]}),g.jsxs("div",{className:"hmeta",children:[g.jsx("span",{className:"hwho",children:l}),g.jsx("span",{className:"hdev",children:u}),g.jsx("span",{className:"hsize",children:e.size?tC(e.size):""})]}),e.note&&g.jsx("div",{className:"hnote"+(r?" open":""),tabIndex:0,role:"button",title:r?"Collapse note":"Show full note","aria-expanded":r,onClick:h=>{h.stopPropagation(),h.target.tagName!=="A"&&i(!r)},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),h.stopPropagation(),i(!r))},children:e.note.split(/(https?:\/\/\S+)/).map((h,y)=>/^https?:\/\//.test(h)?g.jsx("a",{href:h,target:"_blank",rel:"noopener",children:h},y):h)})]})}function MI(e){const{node:n,heatMap:r,onOpen:i}=e,s=(n.children||[]).slice().sort((h,y)=>Number(y.dir||!1)-Number(h.dir||!1)||h.name.localeCompare(y.name)),l=s.filter(h=>h.dir).length,u=s.length-l,d=[];l&&d.push(l+(l===1?" folder":" folders")),u&&d.push(u+(u===1?" file":" files"));const m=Px(r,n.path,!0);return m&&d.push(nu(m)+" in 30 days"),g.jsxs("div",{className:"dirlist",children:[g.jsxs("h1",{className:"dl-title",children:[g.jsx("span",{className:"dl-title-icon",children:g.jsx(Yt,{name:"folder"})}),g.jsx("span",{children:n.name})]}),g.jsx("p",{className:"dl-sub",children:d.join(" · ")||"Empty folder"}),s.length===0?g.jsx("div",{className:"dl-empty",children:"Nothing in this folder yet."}):g.jsx("div",{className:"dl-items",children:s.map(h=>{let y="";if(h.dir){const b=(h.children||[]).length;y=b+(b===1?" item":" items")}else y=[h.size?tC(h.size):"",h.time?new Date(h.time).toLocaleDateString():""].filter(Boolean).join(" · ");const v=Px(r,h.path,!!h.dir);return v&&(y=nu(v)+(y?" · "+y:"")),g.jsxs("div",{className:"dl-row",tabIndex:0,role:"button",title:h.path,onClick:()=>i(h.path),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),i(h.path))},children:[g.jsx("span",{className:"ticon",children:g.jsx(Yt,{name:h.dir?"folder":"doc"})}),g.jsx("span",{className:"dl-name",children:h.name}),v&&g.jsx("span",{className:"heatdot lvl"+iI(v),title:nu(v)+" in 30 days"}),g.jsx("span",{className:"dl-meta",children:y})]},h.path)})}),e.hub&&g.jsx(AI,{apiBase:e.apiBase,prefix:n.path+"/",onOpen:i,onFullHistory:()=>e.onFullHistory(n.path+"/"),onRendered:e.onRendered})]})}function AI(e){const n=oI(e.apiBase,e.prefix,!0),{onRendered:r}=e;return x.useEffect(()=>{n&&n.length&&r&&r()},[n,r]),!n||n.length===0?null:g.jsxs("div",{className:"dl-history",children:[g.jsx("h3",{className:"dl-h3",children:"Recent changes"}),g.jsx("div",{className:"history dl-hlist",children:n.map((i,s)=>g.jsx(hC,{entry:i,onOpen:e.onOpen},s))}),g.jsx("button",{className:"ai-btn dl-more",onClick:e.onFullHistory,children:"Full history"})]})}function jI(e){const{apiBase:n,path:r,onMeta:i}=e,s=n+"file?path="+encodeURIComponent(r);return x.useEffect(()=>()=>i(""),[r,i]),T8.test(r)?g.jsx(zI,{...e}):eC.test(r)?g.jsx("iframe",{className:"htmlview",sandbox:"allow-scripts",src:s,title:r,onLoad:e.onRendered}):O8.test(r)?g.jsx(kI,{src:s,alt:r,onRendered:e.onRendered}):M8.test(r)?g.jsx(LI,{...e,fileURL:s}):g.jsxs("div",{className:"filecard",children:[g.jsx("div",{className:"name",children:r.split("/").pop()}),g.jsx("p",{children:"No preview for this file type."}),g.jsx("a",{className:"btn",download:!0,href:n+"download?path="+encodeURIComponent(r),children:"Download"})]})}function zI(e){const{apiBase:n,path:r,heatMap:i,flatFiles:s,onOpenFile:l,onMeta:u,onRendered:d}=e,{data:m,error:h}=jn({queryKey:["render",n,r],queryFn:()=>Fn(n+"render?path="+encodeURIComponent(r))}),y=x.useMemo(()=>m?DI(m.html,r,n):"",[m,r,n]);return x.useEffect(()=>{if(!m)return;const v=[];m.author&&v.push(m.author+(m.device?" on "+m.device:"")),m.time&&v.push(new Date(m.time).toLocaleString());const b=i&&i[m.path];b&&il(b)&&v.push(nu(b)+" / 30d"),u(v.join(" · ")),d?.()},[m,i,u,d]),h?g.jsxs("div",{className:"empty",children:["Could not load file: ",h.message]}):m?g.jsx("div",{dangerouslySetInnerHTML:{__html:y},onClick:v=>NI(v,r,s,l)}):null}function NI(e,n,r,i){const s=e.target.closest("a");if(!s||!e.currentTarget.contains(s))return;const l=s.getAttribute("href")||"",u=n.includes("/")?n.slice(0,n.lastIndexOf("/")):"";l.startsWith("wiki:")?(e.preventDefault(),II(decodeURIComponent(l.slice(5)),r,i)):/^([a-z]+:|\/|#)/i.test(l)||(e.preventDefault(),i(nC(u,decodeURIComponent(l))))}function DI(e,n,r){const i=n.includes("/")?n.slice(0,n.lastIndexOf("/")):"",s=u=>r+"file?path="+encodeURIComponent(u),l=new DOMParser().parseFromString(e,"text/html");for(const u of l.querySelectorAll("img")){const d=u.getAttribute("src")||"";/^([a-z]+:|\/)/i.test(d)||u.setAttribute("src",s(nC(i,d)))}for(const u of l.querySelectorAll("a")){const d=u.getAttribute("href")||"";/^https?:/i.test(d)&&(u.setAttribute("target","_blank"),u.setAttribute("rel","noopener"))}return l.body.innerHTML}function kI({src:e,alt:n,onRendered:r}){return g.jsx("img",{src:e,alt:n,onLoad:r})}function LI(e){const{path:n,fileURL:r,onRendered:i}=e,{data:s,error:l}=jn({queryKey:["text",r],queryFn:async()=>{const u=await fetch(r);if(!u.ok)throw new Error(await u.text());return u.text()}});return x.useEffect(()=>{s!=null&&i?.()},[s,i]),l?g.jsxs("div",{className:"empty",children:["Could not load file: ",l.message]}):s==null?null:g.jsx("pre",{className:"plain",children:s},n)}function II(e,n,r){const i=e.toLowerCase(),s=n.find(l=>l.path.toLowerCase()===i||l.path.toLowerCase()===i+".md")||n.find(l=>{const u=l.name.toLowerCase();return u===i||u===i+".md"});s&&r(s.path)}function $I({url:e,copied:n,onClose:r}){const i=e.split("/s/")[1];return g.jsx(zp,{open:!0,onOpenChange:s=>!s&&r(),children:g.jsxs(Np,{className:"modal",showCloseButton:!1,children:[g.jsx(Bu,{asChild:!0,children:g.jsx("h3",{children:"Public link created"})}),g.jsxs("p",{children:[g.jsx("b",{children:"Anyone with this link can view this file"})," — no account needed. It always shows the latest version until you revoke it."]}),g.jsx("div",{className:"modal-url",children:e}),g.jsxs("div",{className:"modal-actions",children:[g.jsx($t,{variant:"primary",onClick:()=>rl(e).then(s=>We(s?"Copied.":"Select and copy the link above.")),children:n?"Copied ✓":"Copy link"}),g.jsx($t,{variant:"subtle",onClick:()=>window.open(e,"_blank"),children:"Open"}),g.jsx($t,{variant:"subtle",className:"ai-del",onClick:async()=>{try{await zo("DELETE","/api/shares/"+i),We("Link revoked — it no longer works."),r()}catch(s){We(s.message,!0)}},children:"Revoke"}),g.jsx($t,{variant:"subtle",onClick:r,children:"Done"})]})]})})}var Bx=1,VI=.9,FI=.8,PI=.17,Wh=.1,em=.999,UI=.9999,HI=.99,BI=/[\\\/_+.#"@\[\(\{&]/,qI=/[\\\/_+.#"@\[\(\{&]/g,GI=/[\s-]/,mC=/[\s-]/g;function Fm(e,n,r,i,s,l,u){if(l===n.length)return s===e.length?Bx:HI;var d=`${s},${l}`;if(u[d]!==void 0)return u[d];for(var m=i.charAt(l),h=r.indexOf(m,s),y=0,v,b,S,_;h>=0;)v=Fm(e,n,r,i,h+1,l+1,u),v>y&&(h===s?v*=Bx:BI.test(e.charAt(h-1))?(v*=FI,S=e.slice(s,h-1).match(qI),S&&s>0&&(v*=Math.pow(em,S.length))):GI.test(e.charAt(h-1))?(v*=VI,_=e.slice(s,h-1).match(mC),_&&s>0&&(v*=Math.pow(em,_.length))):(v*=PI,s>0&&(v*=Math.pow(em,h-s))),e.charAt(h)!==n.charAt(l)&&(v*=UI)),(vv&&(v=b*Wh)),v>y&&(y=v),h=r.indexOf(m,h+1);return u[d]=y,y}function qx(e){return e.toLowerCase().replace(mC," ")}function ZI(e,n,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,Fm(e,n,qx(e),qx(n),0,0,{})}var ks='[cmdk-group=""]',tm='[cmdk-group-items=""]',KI='[cmdk-group-heading=""]',pC='[cmdk-item=""]',Gx=`${pC}:not([aria-disabled="true"])`,Pm="cmdk-item-select",xa="data-value",YI=(e,n,r)=>ZI(e,n,r),gC=x.createContext(void 0),yl=()=>x.useContext(gC),vC=x.createContext(void 0),Wp=()=>x.useContext(vC),yC=x.createContext(void 0),bC=x.forwardRef((e,n)=>{let r=Sa(()=>{var j,U;return{search:"",value:(U=(j=e.value)!=null?j:e.defaultValue)!=null?U:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),i=Sa(()=>new Set),s=Sa(()=>new Map),l=Sa(()=>new Map),u=Sa(()=>new Set),d=xC(e),{label:m,children:h,value:y,onValueChange:v,filter:b,shouldFilter:S,loop:_,disablePointerSelection:C=!1,vimBindings:E=!0,...T}=e,O=hn(),M=hn(),k=hn(),L=x.useRef(null),q=a$();bi(()=>{if(y!==void 0){let j=y.trim();r.current.value=j,H.emit()}},[y]),bi(()=>{q(6,ae)},[]);let H=x.useMemo(()=>({subscribe:j=>(u.current.add(j),()=>u.current.delete(j)),snapshot:()=>r.current,setState:(j,U,Q)=>{var Z,re,ee,ge;if(!Object.is(r.current[j],U)){if(r.current[j]=U,j==="search")le(),ve(),q(1,de);else if(j==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let be=document.getElementById(k);be?be.focus():(Z=document.getElementById(O))==null||Z.focus()}if(q(7,()=>{var be;r.current.selectedItemId=(be=me())==null?void 0:be.id,H.emit()}),Q||q(5,ae),((re=d.current)==null?void 0:re.value)!==void 0){let be=U??"";(ge=(ee=d.current).onValueChange)==null||ge.call(ee,be);return}}H.emit()}},emit:()=>{u.current.forEach(j=>j())}}),[]),$=x.useMemo(()=>({value:(j,U,Q)=>{var Z;U!==((Z=l.current.get(j))==null?void 0:Z.value)&&(l.current.set(j,{value:U,keywords:Q}),r.current.filtered.items.set(j,he(U,Q)),q(2,()=>{ve(),H.emit()}))},item:(j,U)=>(i.current.add(j),U&&(s.current.has(U)?s.current.get(U).add(j):s.current.set(U,new Set([j]))),q(3,()=>{le(),ve(),r.current.value||de(),H.emit()}),()=>{l.current.delete(j),i.current.delete(j),r.current.filtered.items.delete(j);let Q=me();q(4,()=>{le(),Q?.getAttribute("id")===j&&de(),H.emit()})}),group:j=>(s.current.has(j)||s.current.set(j,new Set),()=>{l.current.delete(j),s.current.delete(j)}),filter:()=>d.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:O,inputId:k,labelId:M,listInnerRef:L}),[]);function he(j,U){var Q,Z;let re=(Z=(Q=d.current)==null?void 0:Q.filter)!=null?Z:YI;return j?re(j,r.current.search,U):0}function ve(){if(!r.current.search||d.current.shouldFilter===!1)return;let j=r.current.filtered.items,U=[];r.current.filtered.groups.forEach(Z=>{let re=s.current.get(Z),ee=0;re.forEach(ge=>{let be=j.get(ge);ee=Math.max(be,ee)}),U.push([Z,ee])});let Q=L.current;ye().sort((Z,re)=>{var ee,ge;let be=Z.getAttribute("id"),De=re.getAttribute("id");return((ee=j.get(De))!=null?ee:0)-((ge=j.get(be))!=null?ge:0)}).forEach(Z=>{let re=Z.closest(tm);re?re.appendChild(Z.parentElement===re?Z:Z.closest(`${tm} > *`)):Q.appendChild(Z.parentElement===Q?Z:Z.closest(`${tm} > *`))}),U.sort((Z,re)=>re[1]-Z[1]).forEach(Z=>{var re;let ee=(re=L.current)==null?void 0:re.querySelector(`${ks}[${xa}="${encodeURIComponent(Z[0])}"]`);ee?.parentElement.appendChild(ee)})}function de(){let j=ye().find(Q=>Q.getAttribute("aria-disabled")!=="true"),U=j?.getAttribute(xa);H.setState("value",U||void 0)}function le(){var j,U,Q,Z;if(!r.current.search||d.current.shouldFilter===!1){r.current.filtered.count=i.current.size;return}r.current.filtered.groups=new Set;let re=0;for(let ee of i.current){let ge=(U=(j=l.current.get(ee))==null?void 0:j.value)!=null?U:"",be=(Z=(Q=l.current.get(ee))==null?void 0:Q.keywords)!=null?Z:[],De=he(ge,be);r.current.filtered.items.set(ee,De),De>0&&re++}for(let[ee,ge]of s.current)for(let be of ge)if(r.current.filtered.items.get(be)>0){r.current.filtered.groups.add(ee);break}r.current.filtered.count=re}function ae(){var j,U,Q;let Z=me();Z&&(((j=Z.parentElement)==null?void 0:j.firstChild)===Z&&((Q=(U=Z.closest(ks))==null?void 0:U.querySelector(KI))==null||Q.scrollIntoView({block:"nearest"})),Z.scrollIntoView({block:"nearest"}))}function me(){var j;return(j=L.current)==null?void 0:j.querySelector(`${pC}[aria-selected="true"]`)}function ye(){var j;return Array.from(((j=L.current)==null?void 0:j.querySelectorAll(Gx))||[])}function D(j){let U=ye()[j];U&&H.setState("value",U.getAttribute(xa))}function Y(j){var U;let Q=me(),Z=ye(),re=Z.findIndex(ge=>ge===Q),ee=Z[re+j];(U=d.current)!=null&&U.loop&&(ee=re+j<0?Z[Z.length-1]:re+j===Z.length?Z[0]:Z[re+j]),ee&&H.setState("value",ee.getAttribute(xa))}function ne(j){let U=me(),Q=U?.closest(ks),Z;for(;Q&&!Z;)Q=j>0?o$(Q,ks):i$(Q,ks),Z=Q?.querySelector(Gx);Z?H.setState("value",Z.getAttribute(xa)):Y(j)}let J=()=>D(ye().length-1),W=j=>{j.preventDefault(),j.metaKey?J():j.altKey?ne(1):Y(1)},z=j=>{j.preventDefault(),j.metaKey?D(0):j.altKey?ne(-1):Y(-1)};return x.createElement($e.div,{ref:n,tabIndex:-1,...T,"cmdk-root":"",onKeyDown:j=>{var U;(U=T.onKeyDown)==null||U.call(T,j);let Q=j.nativeEvent.isComposing||j.keyCode===229;if(!(j.defaultPrevented||Q))switch(j.key){case"n":case"j":{E&&j.ctrlKey&&W(j);break}case"ArrowDown":{W(j);break}case"p":case"k":{E&&j.ctrlKey&&z(j);break}case"ArrowUp":{z(j);break}case"Home":{j.preventDefault(),D(0);break}case"End":{j.preventDefault(),J();break}case"Enter":{j.preventDefault();let Z=me();if(Z){let re=new Event(Pm);Z.dispatchEvent(re)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:$.inputId,id:$.labelId,style:l$},m),rd(e,j=>x.createElement(vC.Provider,{value:H},x.createElement(gC.Provider,{value:$},j))))}),QI=x.forwardRef((e,n)=>{var r,i;let s=hn(),l=x.useRef(null),u=x.useContext(yC),d=yl(),m=xC(e),h=(i=(r=m.current)==null?void 0:r.forceMount)!=null?i:u?.forceMount;bi(()=>{if(!h)return d.item(s,u?.id)},[h]);let y=SC(s,l,[e.value,e.children,l],e.keywords),v=Wp(),b=Io(q=>q.value&&q.value===y.current),S=Io(q=>h||d.filter()===!1?!0:q.search?q.filtered.items.get(s)>0:!0);x.useEffect(()=>{let q=l.current;if(!(!q||e.disabled))return q.addEventListener(Pm,_),()=>q.removeEventListener(Pm,_)},[S,e.onSelect,e.disabled]);function _(){var q,H;C(),(H=(q=m.current).onSelect)==null||H.call(q,y.current)}function C(){v.setState("value",y.current,!0)}if(!S)return null;let{disabled:E,value:T,onSelect:O,forceMount:M,keywords:k,...L}=e;return x.createElement($e.div,{ref:ja(l,n),...L,id:s,"cmdk-item":"",role:"option","aria-disabled":!!E,"aria-selected":!!b,"data-disabled":!!E,"data-selected":!!b,onPointerMove:E||d.getDisablePointerSelection()?void 0:C,onClick:E?void 0:_},e.children)}),XI=x.forwardRef((e,n)=>{let{heading:r,children:i,forceMount:s,...l}=e,u=hn(),d=x.useRef(null),m=x.useRef(null),h=hn(),y=yl(),v=Io(S=>s||y.filter()===!1?!0:S.search?S.filtered.groups.has(u):!0);bi(()=>y.group(u),[]),SC(u,d,[e.value,e.heading,m]);let b=x.useMemo(()=>({id:u,forceMount:s}),[s]);return x.createElement($e.div,{ref:ja(d,n),...l,"cmdk-group":"",role:"presentation",hidden:v?void 0:!0},r&&x.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:h},r),rd(e,S=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?h:void 0},x.createElement(yC.Provider,{value:b},S))))}),JI=x.forwardRef((e,n)=>{let{alwaysRender:r,...i}=e,s=x.useRef(null),l=Io(u=>!u.search);return!r&&!l?null:x.createElement($e.div,{ref:ja(s,n),...i,"cmdk-separator":"",role:"separator"})}),WI=x.forwardRef((e,n)=>{let{onValueChange:r,...i}=e,s=e.value!=null,l=Wp(),u=Io(h=>h.search),d=Io(h=>h.selectedItemId),m=yl();return x.useEffect(()=>{e.value!=null&&l.setState("search",e.value)},[e.value]),x.createElement($e.input,{ref:n,...i,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":d,id:m.inputId,type:"text",value:s?e.value:u,onChange:h=>{s||l.setState("search",h.target.value),r?.(h.target.value)}})}),e$=x.forwardRef((e,n)=>{let{children:r,label:i="Suggestions",...s}=e,l=x.useRef(null),u=x.useRef(null),d=Io(h=>h.selectedItemId),m=yl();return x.useEffect(()=>{if(u.current&&l.current){let h=u.current,y=l.current,v,b=new ResizeObserver(()=>{v=requestAnimationFrame(()=>{let S=h.offsetHeight;y.style.setProperty("--cmdk-list-height",S.toFixed(1)+"px")})});return b.observe(h),()=>{cancelAnimationFrame(v),b.unobserve(h)}}},[]),x.createElement($e.div,{ref:ja(l,n),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":i,id:m.listId},rd(e,h=>x.createElement("div",{ref:ja(u,m.listInnerRef),"cmdk-list-sizer":""},h)))}),t$=x.forwardRef((e,n)=>{let{open:r,onOpenChange:i,overlayClassName:s,contentClassName:l,container:u,...d}=e;return x.createElement(Wm,{open:r,onOpenChange:i},x.createElement(tp,{container:u},x.createElement(np,{"cmdk-overlay":"",className:s}),x.createElement(rp,{"aria-label":e.label,"cmdk-dialog":"",className:l},x.createElement(bC,{ref:n,...d}))))}),n$=x.forwardRef((e,n)=>Io(r=>r.filtered.count===0)?x.createElement($e.div,{ref:n,...e,"cmdk-empty":"",role:"presentation"}):null),r$=x.forwardRef((e,n)=>{let{progress:r,children:i,label:s="Loading...",...l}=e;return x.createElement($e.div,{ref:n,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},rd(e,u=>x.createElement("div",{"aria-hidden":!0},u)))}),nd=Object.assign(bC,{List:e$,Item:QI,Input:WI,Group:XI,Separator:JI,Dialog:t$,Empty:n$,Loading:r$});function o$(e,n){let r=e.nextElementSibling;for(;r;){if(r.matches(n))return r;r=r.nextElementSibling}}function i$(e,n){let r=e.previousElementSibling;for(;r;){if(r.matches(n))return r;r=r.previousElementSibling}}function xC(e){let n=x.useRef(e);return bi(()=>{n.current=e}),n}var bi=typeof window>"u"?x.useEffect:x.useLayoutEffect;function Sa(e){let n=x.useRef();return n.current===void 0&&(n.current=e()),n}function Io(e){let n=Wp(),r=()=>e(n.snapshot());return x.useSyncExternalStore(n.subscribe,r,r)}function SC(e,n,r,i=[]){let s=x.useRef(),l=yl();return bi(()=>{var u;let d=(()=>{var h;for(let y of r){if(typeof y=="string")return y.trim();if(typeof y=="object"&&"current"in y)return y.current?(h=y.current.textContent)==null?void 0:h.trim():s.current}})(),m=i.map(h=>h.trim());l.value(e,d,m),(u=n.current)==null||u.setAttribute(xa,d),s.current=d}),s}var a$=()=>{let[e,n]=x.useState(),r=Sa(()=>new Map);return bi(()=>{r.current.forEach(i=>i()),r.current=new Map},[e]),(i,s)=>{r.current.set(i,s),n({})}};function s$(e){let n=e.type;return typeof n=="function"?n(e.props):"render"in n?n.render(e.props):e}function rd({asChild:e,children:n},r){return e&&x.isValidElement(n)?x.cloneElement(s$(n),{ref:n.ref},r(n.props.children)):r(n)}var l$={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function c$({className:e,...n}){return g.jsx(nd,{"data-slot":"command",className:et("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...n})}function u$({className:e,...n}){return g.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[g.jsx(G1,{className:"size-4 shrink-0 opacity-50"}),g.jsx(nd.Input,{"data-slot":"command-input",className:et("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n})]})}function d$({className:e,...n}){return g.jsx(nd.List,{"data-slot":"command-list",className:et("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...n})}function f$({className:e,...n}){return g.jsx(nd.Item,{"data-slot":"command-item",className:et("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",e),...n})}function Zx(e,n){if(!e)return{score:0,hits:[]};const r=e.toLowerCase(),i=n.toLowerCase();let s=0,l=0,u=0;const d=[];for(let m=0;m3&&i.endsWith("ies")?s=i.slice(0,-3)+"y":i.length>3&&i.endsWith("es")?s=i.slice(0,-2):i.length>2&&i.endsWith("s")&&(s=i.slice(0,-1)),s?Zx(s,n):null}function m$({text:e,hits:n}){const r=[];let i=0;return n.forEach((s,l)=>{s>i&&r.push(e.slice(i,s)),r.push(g.jsx("b",{children:e[s]},l)),i=s+1}),r.push(e.slice(i)),g.jsx("span",{className:"plabel",children:r})}function p$({open:e,onClose:n,candidates:r}){const[i,s]=x.useState(""),l=x.useMemo(()=>{if(!e)return[];const d=[];for(const m of r()){const h=h$(i,m.label);h&&d.push({...m,score:h.score,hits:h.hits})}return d.sort((m,h)=>h.score-m.score),d.slice(0,40)},[e,i,r]);x.useEffect(()=>{e&&s("")},[e]);const u=d=>{n(),d.run()};return g.jsx(zp,{open:e,onOpenChange:d=>!d&&n(),children:g.jsxs(Np,{id:"palette",className:"palette",showCloseButton:!1,"aria-describedby":void 0,children:[g.jsx(Bu,{className:"sr-only",children:"Search and quick actions"}),g.jsxs(c$,{shouldFilter:!1,loop:!0,children:[g.jsxs("div",{id:"palette-inputwrap",children:[g.jsx(Yt,{name:"search"}),g.jsx(u$,{id:"palette-input",placeholder:"Search file names, projects, actions…",autoComplete:"off",spellCheck:!1,value:i,onValueChange:s})]}),g.jsx(d$,{id:"palette-results",children:l.length===0?g.jsx("div",{className:"pempty",children:"No matches — search covers file names, projects, and actions"}):l.map(d=>g.jsxs(f$,{value:d.kind+":"+d.label,onSelect:()=>u(d),children:[g.jsx("span",{className:"picon",children:g.jsx(Yt,{name:d.icon})}),g.jsx(m$,{text:d.label,hits:d.hits}),g.jsx("span",{className:"pkind",children:d.kind})]},d.kind+":"+d.label))}),g.jsx("footer",{id:"palette-hint",children:"↑↓ navigate · ⏎ select · esc close"})]})]})})}const Vs=3,wa=30;function g$(e,n){return jn({queryKey:["heatDevices",e],queryFn:()=>Fn(e+"heat?by=device&days=30"),enabled:n,retry:!1,staleTime:6e4}).data?.devices??null}function Kx(e){const[n,r]=x.useState("all"),{flatFiles:i,heatMap:s,devices:l,scope:u}=e,d=b=>!u||b===u||b.startsWith(u+"/"),m=u?i.filter(b=>d(b.path)):i,h=l&&u?l.map(b=>{const S={};for(const[_,C]of Object.entries(b.folders||{}))d(_)&&(S[_]=C);return{...b,folders:S}}).filter(b=>Object.keys(b.folders).length>0):l,y=Date.now(),v=m.map(b=>{const S=s&&s[b.path]||{},_=b.time?Math.max(0,(y-new Date(b.time).getTime())/864e5):0,C=n==="all"?il(S):S[n]||0;return{path:b.path,reads:C,agent:S.agent||0,total:il(S),days:_,danger:C>=Vs&&_>=wa}});return g.jsxs("div",{className:"insights",children:[g.jsxs("h1",{className:"in-title",children:["Knowledge insights",u?g.jsxs("span",{className:"in-scope",children:[" · ",u]}):null]}),g.jsx("p",{className:"dl-sub",children:u?`Reads over the last 30 days × freshness, for ${u} and everything in it.`:"Reads over the last 30 days × how long since each file changed. Hot but stale knowledge — read a lot, maintained by nobody — is the danger zone."}),g.jsx("div",{className:"in-lens",children:["all","human","agent"].map(b=>g.jsx("button",{className:"in-lens-btn"+(b===n?" active":""),onClick:()=>r(b),children:b==="all"?"All reads":b==="human"?"Human reads":"Agent reads"},b))}),g.jsx("h3",{className:"dl-h3",children:"Map — cell size = reads, color = freshness"}),g.jsx(y$,{pts:v,onOpenFile:e.onOpenFile,onOpenFolder:e.onOpenFolder,isFolder:e.isFolder}),g.jsx("h3",{className:"dl-h3",children:"Reads × freshness"}),g.jsx(b$,{pts:v,onOpenFile:e.onOpenFile}),g.jsx("h3",{className:"dl-h3",children:"Hot path — top files by reads"}),g.jsx(x$,{pts:v,lens:n,onOpenFile:e.onOpenFile}),h&&h.length>0&&g.jsxs(g.Fragment,{children:[g.jsx("h3",{className:"dl-h3",children:"Agent coverage — which agents read which areas"}),g.jsx(S$,{devices:h})]})]})}function v$(e){const n=[[76,195,138],[232,196,84],[224,93,93]],r=Math.min(1,Math.max(0,e/300))*(n.length-1),i=Math.min(n.length-2,Math.floor(r)),s=r-i,l=n[i].map((u,d)=>Math.round(u+(n[i+1][d]-u)*s));return`rgb(${l[0]},${l[1]},${l[2]})`}function Yx(e,n,r,i,s){const l=e.reduce((h,y)=>h+y.value,0);if(!l||i<=0||s<=0)return[];const u=e.slice().sort((h,y)=>y.value-h.value).map(h=>({it:h,a:h.value/l*i*s})),d=(h,y)=>{const b=h.reduce((_,C)=>_+C.a,0)/y;let S=0;for(const _ of h){const C=_.a/b;S=Math.max(S,C/b,b/C)}return S},m=[];for(;u.length;){const h=i>=s,y=h?s:i,v=[u.shift()];for(;u.length&&d(v.concat(u[0]),y)<=d(v,y);)v.push(u.shift());const b=v.reduce((_,C)=>_+C.a,0)/y;let S=0;for(const _ of v){const C=_.a/b;h?m.push({item:_.it,x:n,y:r+S,w:b,h:C}):m.push({item:_.it,x:n+S,y:r,w:C,h:b}),S+=C}h?(n+=b,i-=b):(r+=b,s-=b)}return m}const nm=15;function y$({pts:e,onOpenFile:n,onOpenFolder:r,isFolder:i}){const u=new Map;for(const m of e){const h=m.path.includes("/")?m.path.split("/")[0]:"/";let y=u.get(h);y||u.set(h,y={name:h,files:[],value:0}),y.files.push(m),y.value+=m.reads+1}const d=[];for(const m of Yx([...u.values()],0,0,720,480)){const h=m.item,y=h.name==="/"?"":h.name;if(d.push(g.jsx("rect",{x:m.x+1,y:m.y+1,width:Math.max(0,m.w-2),height:Math.max(0,m.h-2),rx:3,className:"in-tm-group","data-dir":y},"g"+h.name)),m.w>46&&m.h>nm+10){let b=h.name==="/"?"(root)":h.name;const S=Math.floor((m.w-8)/6);b.length>S&&(b=b.slice(0,Math.max(1,S-1))+"…"),d.push(g.jsx("text",{x:m.x+5,y:m.y+12,className:"in-tm-glabel","data-dir":y,children:b},"gl"+h.name))}const v=Yx(h.files.map(b=>({...b,name:b.path.split("/").pop(),value:b.reads+1})),m.x+2,m.y+nm,Math.max(0,m.w-4),Math.max(0,m.h-nm-2));for(const b of v)if(d.push(g.jsx("rect",{x:b.x+.6,y:b.y+.6,width:Math.max(.4,b.w-1.2),height:Math.max(.4,b.h-1.2),rx:1.5,fill:v$(b.item.days),className:"in-tm-cell","data-path":b.item.path,children:g.jsx("title",{children:`${b.item.path} — ${b.item.reads} read${b.item.reads===1?"":"s"}/30d · changed ${Math.round(b.item.days)}d ago`})},b.item.path)),b.w>54&&b.h>16){const S=Math.floor((b.w-8)/6);let _=(b.item.danger?"⚠ ":"")+b.item.name;_.length>S&&(_=_.slice(0,Math.max(1,S-1))+"…"),S>=5&&d.push(g.jsx("text",{x:b.x+4.5,y:b.y+12.5,className:"in-tm-label","data-path":b.item.path,children:_},"l"+b.item.path))}}return g.jsx("svg",{viewBox:"0 0 720 480",className:"in-chart in-treemap",onClick:m=>{const h=m.target.closest("[data-path], [data-dir]");if(!h)return;const y=h.getAttribute("data-path");if(y)return n(y);const v=h.getAttribute("data-dir");v&&i(v)&&r(v)},children:d})}function b$({pts:e,onOpenFile:n}){const s={l:44,r:16,t:20,b:34},l=Math.max(wa*2,...e.map(v=>v.days)),u=Math.max(Vs*2,...e.map(v=>v.reads)),d=v=>Math.log10(v+1)/Math.log10(l+1),m=v=>Math.log10(v+1)/Math.log10(u+1),h=v=>s.l+d(v)*(720-s.l-s.r),y=v=>360-s.b-m(v)*(360-s.t-s.b);return g.jsxs("svg",{viewBox:"0 0 720 360",className:"in-chart",children:[g.jsx("rect",{x:h(wa),y:s.t,width:720-s.r-h(wa),height:y(Vs)-s.t,className:"in-danger-zone"}),g.jsx("line",{x1:h(wa),y1:s.t,x2:h(wa),y2:360-s.b,className:"in-threshold"}),g.jsx("line",{x1:s.l,y1:y(Vs),x2:720-s.r,y2:y(Vs),className:"in-threshold"}),g.jsx("line",{x1:s.l,y1:360-s.b,x2:720-s.r,y2:360-s.b,className:"in-axis"}),g.jsx("line",{x1:s.l,y1:s.t,x2:s.l,y2:360-s.b,className:"in-axis"}),g.jsx("text",{x:(s.l+720-s.r)/2,y:352,className:"in-label",children:"days since last change →"}),g.jsx("text",{x:12,y:(s.t+360-s.b)/2,className:"in-label",transform:`rotate(-90 12 ${(s.t+360-s.b)/2})`,children:"reads / 30d →"}),g.jsx("text",{x:720-s.r-6,y:s.t+14,className:"in-quad in-quad-danger",textAnchor:"end",children:"hot + stale"}),g.jsx("text",{x:s.l+6,y:s.t+14,className:"in-quad",children:"hot + fresh"}),g.jsx("text",{x:720-s.r-6,y:360-s.b-8,className:"in-quad",textAnchor:"end",children:"cold + stale"}),g.jsx("text",{x:720-s.r-6,y:s.t+28,className:"in-label",textAnchor:"end",children:"dot size = agent share of reads"}),e.map(v=>{const b=v.total?(v.agent||0)/v.total:0;return g.jsx("circle",{cx:Number(h(v.days).toFixed(1)),cy:Number(y(v.reads).toFixed(1)),r:Number((3+4*b).toFixed(1)),className:"in-pt"+(v.danger?" danger":v.reads?"":" cold"),onClick:()=>n(v.path),children:g.jsx("title",{children:`${v.path} — ${v.reads} read${v.reads===1?"":"s"} / 30d · changed ${Math.round(v.days)}d ago`})},v.path)})]})}function x$({pts:e,lens:n,onOpenFile:r}){const i=e.filter(l=>l.reads>0).sort((l,u)=>u.reads-l.reads||u.days-l.days).slice(0,20);if(!i.length)return g.jsx("div",{className:"dl-empty",children:"No reads in the window yet."});const s=i[0].reads;return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"in-hotpath",children:i.map(l=>{const u=n==="agent"?1:n==="human"?0:l.total?l.agent/l.total:0,d=l.reads/s*100;return g.jsxs("div",{className:"in-hp-row",tabIndex:0,role:"button",title:l.danger?`${l.reads} read${l.reads===1?"":"s"}/30d · unchanged ${Math.round(l.days)}d — review this file`:l.path,onClick:()=>r(l.path),onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),r(l.path))},children:[g.jsx("span",{className:"in-hp-name"+(l.danger?" danger":""),children:l.path+(l.danger?" ⚠":"")}),g.jsxs("span",{className:"in-hp-bar",children:[g.jsx("span",{className:"in-hp-agent",style:{width:(d*u).toFixed(1)+"%"}}),g.jsx("span",{className:"in-hp-human",style:{width:(d*(1-u)).toFixed(1)+"%"}})]}),g.jsx("span",{className:"in-hp-count",children:l.reads})]},l.path)})}),g.jsxs("p",{className:"in-legend",children:[g.jsx("span",{className:"in-sw agent"})," agent reads ",g.jsx("span",{className:"in-sw human"})," human reads"]})]})}function S$({devices:e}){const n=new Map;for(const b of e)for(const[S,_]of Object.entries(b.folders||{}))n.set(S,(n.get(S)||0)+_);const r=[...n.entries()].sort((b,S)=>S[1]-b[1]).slice(0,12).map(b=>b[0]),i=e.slice(0,12),s=140,l=6,u=Math.min(76,Math.max(34,(720-s-8)/r.length)),d=26,m=720,h=l+i.length*d+58,y=Math.max(1,...i.flatMap(b=>r.map(S=>(b.folders||{})[S]||0))),v=b=>{const S=[23,25,31],_=[245,166,35],C=S.map((E,T)=>Math.round(E+(_[T]-E)*b));return`rgb(${C[0]},${C[1]},${C[2]})`};return g.jsxs("svg",{viewBox:`0 0 ${m} ${h}`,className:"in-chart in-matrix",children:[i.map((b,S)=>{let _=b.name||b.id||"";return _.length>20&&(_=_.slice(0,19)+"…"),g.jsxs("g",{children:[g.jsx("text",{x:s-8,y:l+S*d+17,textAnchor:"end",className:"in-label",children:_}),r.map((C,E)=>{const T=(b.folders||{})[C]||0;return g.jsx("rect",{x:s+E*u,y:l+S*d,width:u-4,height:d-4,rx:3,fill:v(Math.sqrt(T/y)),children:g.jsx("title",{children:`${b.name||b.id} × ${C||"(root)"}: ${T} read${T===1?"":"s"}/30d`})},C)})]},b.id||S)}),r.map((b,S)=>{const _=s+S*u+(u-4)/2,C=l+i.length*d+14;return g.jsx("text",{x:_,y:C,className:"in-label",textAnchor:"end",transform:`rotate(-28 ${_} ${C})`,children:b||"(root)"},b)})]})}function w$(e){const{apiBase:n,target:r,isFolder:i,onMeta:s,onRendered:l}=e,u=r?i(r)?{prefix:r+"/"}:{path:r}:{prefix:""},d="path"in u&&u.path!==void 0?"path="+encodeURIComponent(u.path):"prefix="+encodeURIComponent(u.prefix??""),{data:m,error:h}=jn({queryKey:["history",n,d,200],queryFn:()=>Fn(n+"history?"+d+"&n=200"),staleTime:15e3});if(x.useEffect(()=>{h&&s("History unavailable: "+h.message)},[h,s]),x.useEffect(()=>{m&&l?.()},[m,l]),!m)return null;const y=m.entries||[];return g.jsxs("div",{className:"history",children:[y.length===0&&g.jsx("div",{className:"empty",children:"No history yet."}),y.map((v,b)=>g.jsx(hC,{entry:v,onOpen:e.onOpen},b))]})}function _$(e,n){return e?n(e)?e+"/ (folder)":e:"all changes"}function wC(e){const{config:n,apiBase:r,route:i,hub:s,project:l}=e,u=Ip(),d=sl(),{tree:m,flatFiles:h,dirIndex:y,loaded:v}=nI(r,!s||!!l),b=rI(r,s&&!!l&&!!n.reads?.enabled),S=s&&!!l&&!i.path&&!i.view,_=!!e.canInsights&&(i.view==="insights"||S),C=g$(r,_);x.useEffect(()=>{_&&d.invalidateQueries({queryKey:["heat",r]})},[_,r,d]);const E=i.path,T=E||(i.view==="insights"||i.view==="history")&&i.viewTarget||"",O=!!E&&y.has(E),M=!!E&&v&&!O&&h.some(Fe=>Fe.path===E),k=!!E&&v&&!O&&!M,L=O&&!i.view,[q,H]=x.useState(()=>new Set),$=x.useRef(!0);x.useEffect(()=>{if(!m||!$.current)return;$.current=!1;const Fe=(m.children||[]).filter(Ne=>Ne.dir);Fe.length===1&&H(Ne=>new Set(Ne).add(Fe[0].path))},[m]),x.useEffect(()=>{!T||!v||H(Fe=>{const Ne=new Set(Fe);for(const Je of EI(T))Ne.add(Je);return y.has(T)&&Ne.add(T),Ne})},[T,v,y]);const he=x.useCallback(Fe=>{H(Ne=>{const Je=new Set(Ne);return Je.has(Fe)?Je.delete(Fe):Je.add(Fe),Je})},[]),ve=x.useRef(null),de=x.useRef(new Map),le=x.useRef({key:"",want:0,attempts:0});x.useEffect(()=>{le.current={key:u,want:Vk()==="POP"?de.current.get(u)??0:0,attempts:0}},[u]);const ae=x.useCallback(()=>{const Fe=ve.current,Ne=le.current;!Fe||Ne.key!==u||Ne.attempts>=3||(Ne.attempts++,Fe.scrollTo({top:Ne.want,behavior:"instant"}))},[u]),me=x.useCallback(()=>{ve.current&&de.current.set(u,ve.current.scrollTop)},[u]),ye=x.useCallback(Fe=>{fn($k(Fe,l?.id)),fr()},[l?.id]),D=x.useCallback(Fe=>fn(_a("history",l?.id,Fe)),[l?.id]),[Y,ne]=x.useState(""),[J,W]=x.useState(null),[z,j]=x.useState(!1),[U,Q]=x.useState(!1);x.useEffect(()=>Wz(()=>Q(!0)),[]);const Z=x.useRef(null),re=e.panel??null,ee=!re&&s&&!!l&&M,ge=!re&&s&&!!l,be=!re&&M,De=!re&&(M||s&&!!l&&O),Ve=r+"download?path="+encodeURIComponent(E),Ue=x.useCallback(async()=>{try{const Fe=await fetch(r+"shares",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:E})});if(!Fe.ok)throw new Error(await Fe.text());const Ne=await Fe.json(),Je=await rl(Ne.url);W({url:Ne.url,copied:Je})}catch(Fe){We("Share failed: "+Fe.message,!0)}},[r,E]),lt=x.useCallback(()=>{if(!E)return D("");D(O?E+"/":E)},[E,O,D]);x.useEffect(()=>{const Fe=Ne=>{(Ne.metaKey||Ne.ctrlKey)&&Ne.key.toLowerCase()==="k"&&(Ne.preventDefault(),Q(Je=>!Je))};return window.addEventListener("keydown",Fe),()=>window.removeEventListener("keydown",Fe)},[]);const Xe=x.useCallback(()=>{const Fe=[],Ne=(Je,zt,eo,or)=>Fe.push({icon:Je,label:zt,kind:eo,run:or});if(s&&l&&E&&(M&&Ne("share","Share: "+E,"action",Ue),Ne("hist","History: "+E,"action",lt),M&&Ne("download","Download: "+E,"action",()=>Z.current?.click())),s&&l&&Ne("hist","History: whole project","action",()=>D("")),s)for(const Je of e.projects||[])(!l||Je.id!==l.id)&&Ne("folder","Switch to project: "+Je.name,"project",()=>fn("/"+Je.id));n.auth?.enabled&&Ne("power","Sign out","action",()=>window.location.href="/auth/logout");for(const Je of y.keys())Ne("folder",Je,"folder",()=>ye(Je));for(const Je of h)Ne("doc",Je.path,"file",()=>ye(Je.path));return Fe},[s,l,E,M,n.auth?.enabled,y,h,e.projects,Ue,lt,D,ye]);x.useEffect(()=>{if(!z)return;const Fe=()=>j(!1);return document.addEventListener("click",Fe),()=>document.removeEventListener("click",Fe)},[z]);const Xt=x.useCallback(Fe=>y.has(Fe),[y]);let mn="app",qt,Pt;re?Pt=re.body:i.view==="insights"?Pt=e.canInsights?g.jsx(Kx,{flatFiles:h,heatMap:b,devices:C,scope:i.viewTarget||"",onOpenFile:ye,onOpenFolder:ye,isFolder:Xt}):g.jsx("div",{className:"empty",children:"Insights is for hub admins and org owners."}):i.view==="history"?Pt=g.jsx(w$,{apiBase:r,target:i.viewTarget||"",isFolder:Xt,onOpen:ye,onMeta:ne,onRendered:ae}):E?v?k?Pt=g.jsxs("div",{className:"notfound",children:[g.jsx("h1",{children:"Couldn't find that"}),g.jsxs("p",{children:[g.jsx("code",{children:E})," isn't in this project right now."]}),g.jsx("p",{className:"nf-sub",children:"If it was just created, it may still be uploading or syncing from a teammate's device — this page checks again automatically every few seconds, so refresh or come back in a moment."}),g.jsx("button",{className:"pbtn",onClick:()=>d.invalidateQueries({queryKey:["tree",r]}),children:"Check again"})]}):O?Pt=g.jsx(MI,{node:y.get(E),heatMap:b,hub:s&&!!l,apiBase:r,onOpen:ye,onFullHistory:D,onRendered:ae}):(mn=eC.test(E)?"wide":"read",qt="markdown",Pt=g.jsx(jI,{apiBase:r,path:E,heatMap:b,flatFiles:h,onOpenFile:ye,onMeta:ne,onRendered:ae})):Pt=g.jsx("div",{className:"empty",children:"Loading…"}):S?Pt=g.jsxs(g.Fragment,{children:[g.jsx(dC,{project:l}),e.canInsights&&g.jsx("div",{className:"home-insights",children:g.jsx(Kx,{flatFiles:h,heatMap:b,devices:C,onOpenFile:ye,onOpenFolder:ye,isFolder:Xt})})]}):Pt=g.jsx("div",{className:"empty",children:"Select a file to read it."});const Ut=re?re.crumb:E?g.jsx(RI,{path:E,onOpenFolder:ye}):i.view==="insights"?"Insights — "+(i.viewTarget||l?.name||""):i.view==="history"?"History — "+_$(i.viewTarget||"",Xt):S?l.name:null,rr=g.jsx(Js,{crumb:Ut,meta:Y,actions:g.jsxs(g.Fragment,{children:[ee&&g.jsx($t,{id:"share-btn",variant:"toolbar",className:"icon-only",title:"Share","aria-label":"Share",onClick:Ue,children:g.jsx(Yt,{name:"share"})}),ge&&!E&&!i.view&&g.jsxs($t,{id:"history-btn",variant:"toolbar",onClick:lt,children:[g.jsx(Yt,{name:"hist"})," ",g.jsx("span",{className:"lbl",children:"History"})]}),be&&g.jsx("a",{id:"download",hidden:!0,download:!0,href:Ve,ref:Z,children:"Download"}),De&&g.jsx($t,{id:"more-btn",variant:"toolbar",className:"icon-only",title:"More actions","aria-label":"More actions",onClick:Fe=>{Fe.stopPropagation(),j(!z)},children:g.jsx(Yt,{name:"dots"})}),z&&g.jsxs("div",{id:"more-menu",role:"menu",children:[ge&&g.jsx("button",{className:"more-item",onClick:lt,children:"History"}),be&&g.jsx("button",{className:"more-item",onClick:()=>Z.current?.click(),children:"Download"}),e.canInsights&&g.jsx("button",{className:"more-item",onClick:()=>{e.onClosePanel?.(),fn(_a("insights",l?.id,E))},children:"Insights"})]})]})});return g.jsxs(g.Fragment,{children:[g.jsx(Xs,{vault:e.sidebar.vault,projectsNav:e.sidebar.projectsNav,orgBar:e.sidebar.orgBar,tree:g.jsx(CI,{root:m,expanded:q,onToggle:he,currentPath:T,listingShowing:L,onOpen:ye}),topbar:rr,contentRef:ve,onContentScroll:me,children:g.jsx(hu,{width:mn,className:qt,children:Pt})}),J&&g.jsx($I,{url:J.url,copied:J.copied,onClose:()=>W(null)}),g.jsx(p$,{open:U,onClose:()=>Q(!1),candidates:Xe})]})}function C$({config:e}){const n=Ip(),r=kp(),[i,s]=x.useState(null),[l,u]=x.useState(null);x.useEffect(()=>u(null),[n]);const d=x.useMemo(()=>{const $=n.match(/^\/join\/([0-9a-f]+)\/?$/);return $?$[1]:null},[n]),{data:m}=kk(!d),{data:h}=Lk(!d),y=!!e.auth.admin,{data:v}=t_(y),b=x.useMemo(()=>r_(n,"hub"),[n]),S=x.useMemo(()=>m&&(m.find($=>$.id===b.project)||i&&m.find($=>$.org===i)||m[0])||null,[m,b.project,i]);if(x.useEffect(()=>{document.title=S?S.name+" — BearDrive":e.brand||"BearDrive"},[S,e]),d)return g.jsx(E$,{token:d,onDone:async $=>{s($),await r(),fn("/",{replace:!0})}});const _=e.brand||"BearDrive",C=S&&h?.find($=>$.id===S.org)||null,E=y||(C?C.role==="owner":!1),T=g.jsx(Hu,{name:_,onHome:()=>fn("/"),search:!!S}),O=e.me?g.jsx(H8,{me:e.me,org:C,orgActive:!!b.org,admin:y?{pending:v?.length||0,onClick:()=>{u({kind:"hub"}),fr()}}:void 0}):void 0;if(!m||!h)return g.jsx(Xs,{vault:T,topbar:g.jsx(Js,{}),children:g.jsx(hu,{children:g.jsx("div",{className:"empty",children:"Loading…"})})});if(!S)return g.jsx(Xs,{vault:T,projectsNav:g.jsx(Vx,{projects:m}),orgBar:O,topbar:g.jsx(Js,{}),children:g.jsx(hu,{children:g.jsx(tI,{authEnabled:e.auth.enabled,onCreate:async $=>{if(!$){We("Give the project a name.",!0);return}try{const he=await Aa("/api/projects",{name:$});await r(),fn("/"+he.project.id),We(`Created “${he.project.name}”.`)}catch(he){We("Could not create the project: "+he.message,!0)}}})})});const M=l?.kind==="hub"?{crumb:"Signup & access",body:g.jsx(k8,{})}:null,k=b.org?h.find($=>$.id===b.org):null,q=b.org&&!k?{crumb:"Organization",body:g.jsxs("div",{className:"empty",children:[g.jsx("h3",{children:"Organization not found"}),g.jsx("p",{children:"This organization doesn't exist, or you're no longer a member."}),g.jsx("p",{children:g.jsxs("a",{...i_("/"+S.id),children:["Back to ",S.name]})})]})}:k?{crumb:"Organization",body:g.jsx(j8,{org:k,projects:m,myEmail:e.me?.email||""})}:null,H=b.view==="settings"?{crumb:"Project settings",body:g.jsx(K8,{project:S,org:C,onDeleted:async()=>{await r(),fn("/")}})}:b.view==="install"?{crumb:"Installation",body:g.jsx(dC,{project:S})}:null;return!b.org&&b.project!==S.id?g.jsx(Fk,{to:"/"+S.id}):g.jsx(wC,{config:e,apiBase:"/api/p/"+S.id+"/",route:b,hub:!0,project:S,projects:m,canInsights:E,sidebar:{vault:T,projectsNav:g.jsx(Vx,{projects:m,currentId:S.id,menu:{active:l?null:b.view==="insights"&&!b.viewTarget?"dashboard":b.view==="install"?"install":b.view==="history"&&!b.viewTarget?"history":b.view==="settings"?"settings":null,onDashboard:()=>{u(null),fn(_a("insights",S.id)),fr()},onInstall:()=>{u(null),fn(_a("install",S.id)),fr()},onHistory:()=>{u(null),fn(_a("history",S.id)),fr()},onSettings:()=>{u(null),fn(_a("settings",S.id)),fr()}}}),orgBar:O},panel:M||q||H,onClosePanel:()=>u(null)},S.id)}function E$({token:e,onDone:n}){return x.useEffect(()=>{let r=!1;return Aa("/api/invites/"+e).then(i=>{r||(We(`Welcome — you joined the “${i.org.name}” team. Opening its projects…`),n(i.org.id))}).catch(i=>{r||String(i.message).includes("signing in")||(We("Could not accept the invite: "+i.message,!0),n(null))}),()=>{r=!0}},[e]),g.jsx(Xs,{vault:g.jsx(Hu,{name:"BearDrive"}),topbar:g.jsx(Js,{}),children:g.jsx(hu,{children:g.jsx("div",{className:"empty",children:"Joining…"})})})}function R$({config:e}){const n=Ip(),r=e.volume||"BearDrive";x.useEffect(()=>{document.title=e.brand||r},[e,r]);const i=x.useMemo(()=>r_(n,"volume"),[n]);return g.jsx(wC,{config:e,apiBase:"/api/",route:i,hub:!1,sidebar:{vault:g.jsx(Hu,{name:r,showSignout:e.auth.enabled,search:!0})}})}function T$(){const{data:e}=M2();return g.jsxs(Yz,{delayDuration:150,children:[e?e.mode==="hub"?g.jsx(C$,{config:e}):g.jsx(R$,{config:e}):g.jsx(Xs,{vault:g.jsx(Hu,{name:"…",showSignout:!1}),topbar:g.jsx(Js,{}),children:g.jsx("div",{className:"empty",children:"Loading…"})}),g.jsx(Tk,{}),g.jsx(zk,{})]})}const O$=new p2({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});HR.createRoot(document.getElementById("root")).render(g.jsx(x.StrictMode,{children:g.jsx(g2,{client:O$,children:g.jsx(T$,{})})})); diff --git a/internal/webapp/static/index.html b/internal/webapp/static/index.html index 5b9418b..44c1b6c 100644 --- a/internal/webapp/static/index.html +++ b/internal/webapp/static/index.html @@ -5,8 +5,8 @@ BearDrive - - + +
diff --git a/plugin/skills/beardrive/SKILL.md b/plugin/skills/beardrive/SKILL.md index ccee16c..a7e3df8 100644 --- a/plugin/skills/beardrive/SKILL.md +++ b/plugin/skills/beardrive/SKILL.md @@ -455,7 +455,12 @@ Interpretation: - **`remote`** — `(none — local only)` means changes are journaled locally but never leave the device. - **`daemon`** — `running (pid N)` or `stopped`. If stopped, run `bdrive init ` to start a daemon, or `bdrive sync ` for a one-shot. - **`files`** — tracked file count and total bytes. -- **`pending`** — local journal ops not yet pushed. Should be 0 shortly after a successful sync. Stuck > 0 usually means broken remote/creds, stopped daemon, or a custom `--remote-interval`. +- **`pending`** — local journal ops not yet pushed. Should be 0 shortly after a successful sync. Stuck > 0 usually means broken remote/creds, stopped daemon, or a custom `--remote-interval` — or an `access:` line below. +- **`access`** — only printed when the hub is refusing this device. Two forms, and they are not the same as being offline: + - `read-only (pull only) — N local change(s) stay on this device` — you have `read` on this project. The daemon keeps pulling teammates' changes and materializing them; your own edits are journaled locally and never pushed (never lost either — they go out if you're granted `write` again). + - `no access to this project — sync paused` — your access was revoked. Nothing is pulled, pushed, or written; your files are left exactly as they are. Re-granting access resumes on the next tick with nothing to do by hand. + + Same two lines appear in the `bdrive sync` output as `remote: read-only (pull only)` / `remote: no access — sync paused`, and once (not per tick) in `daemon.log`. Ask a project admin or workspace owner for access. ### `bdrive log []` @@ -513,11 +518,12 @@ Useful when `pending` is stuck > 0, the daemon flips to `stopped` after a restar ### Diagnostic flow ("beardrive doesn't seem to be working") -1. `bdrive status` — folder listed? daemon `running`? `pending` stuck > 0? +1. `bdrive status` — folder listed? daemon `running`? `pending` stuck > 0? any `access:` line? 2. `daemon: stopped` → `bdrive init ` to restart it. -3. `pending` stuck → `bdrive sync ` and read the cycle output. Errors here point at the remote — see the cloud-storage troubleshooting table above. -4. Sync succeeds but the other device doesn't see changes → `bdrive sync` on the other device + `bdrive log` to confirm the op crossed over. -5. Daemon keeps dying → tail `~/.bdrive/volumes//daemon.log` for the cause. +3. `access: read-only` or `access: no access` → this is a **permissions** answer, not a broken remote. Nothing to fix on the device; the project's admin (or a workspace owner) has to raise the level in the hub's Project settings → People. Local files and journal are intact either way, and the daemon resumes on its own once the grant changes. +4. `pending` stuck (with no `access:` line) → `bdrive sync ` and read the cycle output. Errors here point at the remote — see the cloud-storage troubleshooting table above. +5. Sync succeeds but the other device doesn't see changes → `bdrive sync` on the other device + `bdrive log` to confirm the op crossed over. +6. Daemon keeps dying → tail `~/.bdrive/volumes//daemon.log` for the cause. --- diff --git a/web/docs/astro.config.mjs b/web/docs/astro.config.mjs index 995bbc3..b1d643c 100644 --- a/web/docs/astro.config.mjs +++ b/web/docs/astro.config.mjs @@ -118,7 +118,10 @@ export default defineConfig({ }, { label: "Concepts", - items: [{ label: "How sync works", slug: "concepts/how-it-works" }], + items: [ + { label: "How sync works", slug: "concepts/how-it-works" }, + { label: "Project permissions", slug: "concepts/permissions" }, + ], }, ], }), diff --git a/web/docs/src/content/docs/concepts/permissions.md b/web/docs/src/content/docs/concepts/permissions.md new file mode 100644 index 0000000..88c3ae5 --- /dev/null +++ b/web/docs/src/content/docs/concepts/permissions.md @@ -0,0 +1,93 @@ +--- +title: Project permissions +description: Four levels per project — none, read, write, admin — plus invite-only projects and what a read-only or revoked device actually does. +--- + +Organizations decide who is in your workspace. **Project permissions** decide +what each of those people can do with each project. + +Nothing here changes an existing hub until you use it: the default is `write` +for every workspace member, which is exactly the behavior BearDrive has always +had. + +## The four levels + +Higher includes lower. + +| Level | Can | +|---|---| +| `none` | nothing — the project is hidden: absent from the project list, every request denied | +| `read` | browse, view, render, download, per-file history, read heat — and **pull**, so a device stays current | +| `write` | everything in `read`, plus upload, sync push, and creating or revoking share links | +| `admin` | everything in `write`, plus rename the project, delete it, and edit its permissions | + +Edit them in the hub UI: **Project settings → People**. Everyone with access +sees the section; only an admin gets live controls. + +## Who is what + +- **The default** applies to every workspace member without an explicit grant. + It starts as `write`. +- **Exceptions** are per-person grants. They are limited to members of the + project's workspace — there are no outside collaborators. +- **The creator** of a project becomes its first admin. +- **Workspace owners are implicitly admin** on every project in their + workspace, whether or not they appear in the list. Granting an owner a level + is refused rather than silently ignored: they always resolve to admin, so a + project admin can never lock an owner out. +- **A project always keeps at least one admin.** Removing or demoting the last + explicit admin grant is refused — including an admin trying to remove + themselves. + +Projects created before permissions existed have no recorded creator, so they +start with no explicit admins and are governed by workspace owners until +someone grants one. If your workspace has no owner-level account left, you +cannot administer those projects — promote an owner first. + +## Invite-only projects + +Set the **default** to `No access` and the project becomes invite-only: only +the people listed as exceptions (and workspace owners) can see it. Everyone +else is treated exactly like a non-member — the project does not appear in +their project list at all. + +## What a device does when it is refused + +A hub saying *no* is not the same as a hub being unreachable, and BearDrive +keeps them apart. In both cases your local files and your local history are +left alone — losing access never deletes or reverts anything on your disk. + +### Read-only: the daemon goes pull-only + +Your teammates' changes keep arriving and materializing normally. Your own +edits are still journaled locally; they are simply never pushed. They are not +dropped either — if you are granted `write` again, they go out on the next +cycle with nothing to do by hand. + +``` + pending: 3 local change(s) not yet pushed + access: read-only (pull only) — 3 local change(s) stay on this device +``` + +### No access: sync pauses + +Nothing is pulled, pushed, or written. The daemon keeps ticking cheaply and +re-checks, so a re-grant resumes on its own. + +``` + access: no access to this project — sync paused +``` + +Either line shows up in `bdrive status`, in `bdrive sync` output as +`remote: read-only (pull only)` / `remote: no access — sync paused`, and once +— on the transition, not every tick — in the project's `daemon.log`. + +If you see one, there is nothing to fix on the device. Ask a project admin or +a workspace owner to change your level. + +## Share links are not affected + +Public `/s/` links are anonymous by design and keep serving until +revoked. Cutting someone's access to a project does **not** kill share links +they minted — revoke those separately (`bdrive share --list` / +`bdrive share --revoke`, or the workspace's shares view). diff --git a/web/docs/src/content/docs/reference/cli.md b/web/docs/src/content/docs/reference/cli.md index ff910df..c161ab7 100644 --- a/web/docs/src/content/docs/reference/cli.md +++ b/web/docs/src/content/docs/reference/cli.md @@ -49,6 +49,30 @@ Stamps session context — an agent session id, say — onto changes. It shows u `bdrive log` and hub history, and keeps applying to daemon-committed changes until `--note-ttl` expires. +### `bdrive status` — and the two degraded access states + +Alongside `pending`, `status` prints an `access:` line whenever the hub is +refusing this device. Neither is the same as being offline, and neither ever +touches your files: + +``` + pending: 3 local change(s) not yet pushed + access: read-only (pull only) — 3 local change(s) stay on this device +``` + +- **`read-only (pull only)`** — you have `read` on the project. The daemon keeps + pulling teammates' changes; your own edits stay journaled locally, never + pushed and never dropped. They go out if you are granted `write` again. +- **`no access to this project — sync paused`** — your access was revoked. + Nothing is pulled, pushed, or written; the working folder is left exactly as + it is. Re-granting resumes on the next tick with no manual step. + +`bdrive sync` shows the same two as `remote: read-only (pull only)` / +`remote: no access — sync paused`, and the daemon logs each once on +transition rather than on every tick. Both are permission answers: they are +fixed in the hub's Project settings → People, not on the device. See +[Project permissions](/concepts/permissions/). + ### `bdrive login` and switching hubs `bdrive login` remembers the server in `settings.json` under the bdrive home. To diff --git a/web/docs/src/content/docs/reference/hub-config.md b/web/docs/src/content/docs/reference/hub-config.md index 8161b77..0464d03 100644 --- a/web/docs/src/content/docs/reference/hub-config.md +++ b/web/docs/src/content/docs/reference/hub-config.md @@ -98,5 +98,11 @@ falling back to relaying when the backend can't presign. Journals are never presigned — only immutable blobs. Client pushes and project creation require the server to run with `--upload`. -Against a read-only hub, clients still pull and their pushes wait (offline -semantics) until allowed. +Against a read-only hub, clients still pull, and `bdrive status` says +`access: read-only (pull only)` rather than reporting a phantom outage. + +Per-project permissions gate the same API: `read` admits `store/list`, +`store/object`, and `store/exists` — everything a pull needs — while +`PUT store/object` and `store/sign` need `write`. That is what makes a +read-only teammate's device pull-only instead of stuck. See +[Project permissions](/concepts/permissions/).