diff --git a/architecture/cli-sync.md b/architecture/cli-sync.md index 8f7f006..be91854 100644 --- a/architecture/cli-sync.md +++ b/architecture/cli-sync.md @@ -19,6 +19,7 @@ classDiagram +Account config.Settings +Backend remote.Backend +Note string + +SessionID string +Prune bool +OnProgress func +Cycle(ctx) Result @@ -107,7 +108,8 @@ classDiagram +LoadCache / SaveCache mountID +LoadSync / SaveSync +SaveNote / LoadNote - +PendingReads read spool + +LogRead(rel, session) read spool + +PendingReads dedup on path+session +Lock() flock } note for Store "internal/store — ~/.bdrive/volumes/mount-id: content-addressed blobs, per-device journal copies, state cache, paused marker (free funcs Paused/SetPaused, no flock)" @@ -117,9 +119,10 @@ classDiagram +Author +User +UserName +Kind put or delete +Path +Blob +Size +Mode +Note + +Session agent session, hook-set +Mtime when the file was written } - note for Op "internal/journal — Less orders by (lamport, time, device, seq); Replay folds to LWW-per-path state; each device writes only its own journal. Mtime is display-only (bdrive log shows it, falling back to Time) and never feeds Less or Replay" + note for Op "internal/journal — Less orders by (lamport, time, device, seq); Replay folds to LWW-per-path state; each device writes only its own journal. Mtime is display-only (bdrive log shows it, falling back to Time) and never feeds Less or Replay. Session holds the same standing: set only by `bdrive sync --hook` (never by --note, which any member can spell), display/join-only, and the key History run cards group on — a note is forgeable, a session id is not" note for Op "Op now owns its own JSON: a Path that is not valid UTF-8 rides as a base64 `path_raw` sidecar and is restored only when the lossy form still matches, so one line can never name two different files on two readers. Less falls through to Kind/Path/Blob/Size/Mode, making the order TOTAL — two ops can no longer tie and replay differently per device. Parse skips an undecodable line and drops an unknown Kind instead of failing the whole journal" class Backend { diff --git a/architecture/webapp-server.md b/architecture/webapp-server.md index 8a9ae38..bd48d9c 100644 --- a/architecture/webapp-server.md +++ b/architecture/webapp-server.md @@ -295,15 +295,23 @@ classDiagram class ReadLedger { -repo ReadRepo - -retention - -byKey, dirty, seen + -sessions SessionReadRepo + -retention, sessionRetention + -byKey, dirty, seen, pendingSess +Record(...) + +RecordSession(project, session, device, path) +Heat(project, prefix, days) + +SessionPaths(project, session, device) + +WithSessions(repo, days) +ShareOpens(project) } class ReadStat { +Project +Path +Day +Kind +Actor +Count +Last } + class SessionRead { + +Project +Session +Device +Path +Last + } + note for SessionRead "One row per (session, device, path) — the per-session detail a History run card joins its writes to, on the un-forgeable Op.Session and never on the note. Deliberately OUTSIDE ReadLedger.byKey: that map is loaded whole at boot and full-scanned by Heat on every request, hub-wide, so session cardinality in it would slow the Dashboard for projects that never ran an agent. Device is always the ownsDevice-validated id, never a client field, so a report naming someone else's session can only ever be found under the forger's own device. Its own, much shorter retention (session_retention_days, default 30) DELETES rather than folds — no heat total was ever derived from it" class HeatEntry { +Human +Agent +Share +Readers +LastRead } @@ -415,6 +423,7 @@ classDiagram RemoteSource ..> sourcedOp : attribution comes from the journal key RemoteSource *-- cachedJournal : parsed ops, keyed on size+mtime ReadLedger ..> ReadStat + ReadLedger ..> SessionRead ReadLedger ..> HeatEntry ReadLedger ..> ShareOpen ShareDB ..> ShareOpen : shares list joins the open count per path @@ -446,6 +455,7 @@ classDiagram +Shares() ShareRepo +Devices() DeviceRepo +Reads() ReadRepo + +SessionReads() SessionReadRepo +Close() } @@ -500,7 +510,7 @@ classDiagram storable / storableMap checkAccount checkToken checkProject checkOrg checkInvite checkShare - checkDevice checkReadStat + checkDevice checkReadStat checkSessionRead } note for storable "Called at the top of every repo write in BOTH backends. A NUL byte or invalid UTF-8 in a name is accepted by JSON and rejected by Postgres, so the file backend used to persist rows the SQL backend would refuse — the same hub, migrated, would silently lose them. Refusing at one gate makes the two backends agree on what is storable" class ReadRepo { @@ -508,6 +518,11 @@ classDiagram +Load() +PutBatch +DeleteBatch } note for ReadRepo "batch-oriented: one flush = one write" + class SessionReadRepo { + <> + +PutBatch +ListBySession +PruneBefore + } + note for SessionReadRepo "read_sessions / sessions.json — never Load()ed whole; queried by (project, session, device) and pruned by date, which is what keeps the boot load and Heat's scan the size they are today" class fileMetaStore { JSON files, atomic rewrite per change @@ -530,6 +545,7 @@ classDiagram MetaStore *-- ShareRepo MetaStore *-- DeviceRepo MetaStore *-- ReadRepo + MetaStore *-- SessionReadRepo class BuiltinAuth class ProjectDB @@ -544,6 +560,7 @@ classDiagram ShareDB o-- ShareRepo DeviceRegistry o-- DeviceRepo ReadLedger o-- ReadRepo + ReadLedger o-- SessionReadRepo BuiltinAuth *-- versionGate ProjectDB *-- versionGate diff --git a/cmd/bdrive/hooksync.go b/cmd/bdrive/hooksync.go index 5dd43eb..9b9162a 100644 --- a/cmd/bdrive/hooksync.go +++ b/cmd/bdrive/hooksync.go @@ -44,6 +44,14 @@ type hookLink struct { // mounts. func hookSessionID(cmd *cobra.Command) string { data, _ := io.ReadAll(io.LimitReader(cmd.InOrStdin(), 1<<20)) + return eventSessionID(data) +} + +// eventSessionID is that parse over an already-read payload — `bdrive +// read-log` consumes the same stdin for its own reasons and tags every read +// it spools with the same id, which is what lets the hub join a run's reads +// to its writes. +func eventSessionID(data []byte) string { var event struct { SessionID string `json:"session_id"` } @@ -64,6 +72,12 @@ func runHookSync(cmd *cobra.Command, target, sessionID, label string) (string, b if err := sess.Store.SaveNote(note, hookNoteTTL); err == nil { sess.Note = note } + // The hook is the ONLY writer of Op.Session — `bdrive sync --note` + // cannot reach it, which is what makes a run card's identity + // un-forgeable. Unlike the note it is not persisted with a TTL: a + // later daemon scan should not credit its own changes to a session + // that has moved on. + sess.SessionID = sessionID } // The pull. Offline is fine — the link formula below is still valid diff --git a/cmd/bdrive/readlog.go b/cmd/bdrive/readlog.go index 3ce0c02..33469aa 100644 --- a/cmd/bdrive/readlog.go +++ b/cmd/bdrive/readlog.go @@ -41,18 +41,22 @@ to run it by hand.`, return nil } data, _ := io.ReadAll(io.LimitReader(cmd.InOrStdin(), 1<<20)) + // Parsed once, like syncCmd hoists it: stdin is already drained + // here, and logReads runs once per mount. + session := eventSessionID(data) // The session's directory is rarely the mount root, so reads are // attributed to whichever mount actually contains them. for _, target := range syncTargets(folder) { - logReads(target, data) + logReads(target, data, session) } return nil }, } } -// logReads spools the reads from one hook event that fall inside one mount. -func logReads(folder string, data []byte) { +// logReads spools the reads from one hook event that fall inside one mount, +// tagged with the agent session they happened in (see store.ReadEvent). +func logReads(folder string, data []byte, session string) { // LoadProject, not ResolveMount: a hook must never enroll this // device (registry self-heal) — and syncBlocked keeps a paused // or never-inited project's spool from even being created. @@ -89,7 +93,7 @@ func logReads(folder string, data []byte) { if filter.Skip(rel) { continue // not part of the project (ignore/include rules) } - st.LogRead(rel) // best-effort; the hook must never fail the turn + st.LogRead(rel, session) // best-effort; the hook must never fail the turn } } diff --git a/cmd/bdrive/readlog_test.go b/cmd/bdrive/readlog_test.go index d58acb0..3f2eb16 100644 --- a/cmd/bdrive/readlog_test.go +++ b/cmd/bdrive/readlog_test.go @@ -135,6 +135,12 @@ func TestReadLogCommand(t *testing.T) { if len(evs) != 1 || evs[0].Path != "wiki/a.md" { t.Fatalf("spool = %+v, want just the in-project read, mount-relative", evs) } + // The same session id `bdrive sync --hook` stamps onto the writes, off + // the same stdin payload — it is what lets the hub join this read to the + // run card that turn produced. + if evs[0].Session != "abc" { + t.Fatalf("spooled read Session = %q, want the event's session_id", evs[0].Session) + } } // read-log fires on every agent tool call in every folder, so it must be diff --git a/cmd/bdrive/session_stamp_test.go b/cmd/bdrive/session_stamp_test.go new file mode 100644 index 0000000..8f74ab3 --- /dev/null +++ b/cmd/bdrive/session_stamp_test.go @@ -0,0 +1,117 @@ +package main + +import ( + "bytes" + "os" + "path/filepath" + "strings" + "testing" + + "github.com/runbear-io/beardrive/internal/config" + "github.com/runbear-io/beardrive/internal/journal" +) + +// journalOps reads the ops this device wrote for a project. +func journalOps(t *testing.T, projectID, deviceID string) []journal.Op { + t.Helper() + vdir, err := config.VolumeDir(projectID) + if err != nil { + t.Fatal(err) + } + data, err := os.ReadFile(filepath.Join(vdir, "journal", deviceID+".jsonl")) + if err != nil { + t.Fatal(err) + } + ops, err := journal.Parse(data) + if err != nil { + t.Fatal(err) + } + return ops +} + +// stampFixture is a mount with one file, ready to commit. +func stampFixture(t *testing.T) (folder string, proj config.Project) { + t.Helper() + t.Setenv("BDRIVE_HOME", t.TempDir()) + folder = t.TempDir() + folder, _ = filepath.EvalSymlinks(folder) + var err error + proj, err = config.SaveProject(folder, config.Project{ + Volume: "wiki", + Remote: "https://hub.example.com/p/p-12345678", // unreachable: the cycle degrades offline, the scan still commits + }) + if err != nil { + t.Fatal(err) + } + if _, _, err := config.EnrollMount(folder); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(filepath.Join(folder, "a.md"), []byte("hello\n"), 0o644); err != nil { + t.Fatal(err) + } + return folder, proj +} + +func thisDevice(t *testing.T) string { + t.Helper() + dev, err := config.LoadDevice() + if err != nil { + t.Fatal(err) + } + return dev.ID +} + +// The hook sets BOTH the note and the session id — the note is the label a +// reader sees, the session is the key a run card joins its reads on. +func TestHookStampsSession(t *testing.T) { + folder, proj := stampFixture(t) + + c := syncCmd() + c.SetOut(&bytes.Buffer{}) + c.SetIn(strings.NewReader(`{"session_id":"sess-42"}`)) + c.SetArgs([]string{folder, "--hook", "claude-code"}) + if err := c.Execute(); err != nil { + t.Fatalf("hook mode must never fail: %v", err) + } + + ops := journalOps(t, proj.ID, thisDevice(t)) + if len(ops) == 0 { + t.Fatal("the hook run committed nothing") + } + for _, op := range ops { + if op.Session != "sess-42" { + t.Errorf("op %q Session = %q, want sess-42", op.Path, op.Session) + } + if op.Note != "claude-code session sess-42" { + t.Errorf("op %q Note = %q", op.Path, op.Note) + } + } +} + +// Landmine 1, tested explicitly: Op.Note is user-settable, so `bdrive sync +// --note` can spell out any other member's session card verbatim. It must +// still produce an EMPTY Op.Session, so nothing it writes can attach to that +// member's run — the join reads the session, never the note. +func TestSyncNoteCannotForgeASession(t *testing.T) { + folder, proj := stampFixture(t) + + c := syncCmd() + c.SetOut(&bytes.Buffer{}) + c.SetArgs([]string{folder, "--note", "claude-code session sess-42"}) + if err := c.Execute(); err != nil { + t.Fatalf("sync: %v", err) + } + + ops := journalOps(t, proj.ID, thisDevice(t)) + if len(ops) == 0 { + t.Fatal("the sync committed nothing") + } + for _, op := range ops { + if op.Session != "" { + t.Errorf("--note forged a session id on %q: %q", op.Path, op.Session) + } + if op.Note != "claude-code session sess-42" { + t.Errorf("op %q Note = %q, want the note to still be settable", op.Path, op.Note) + } + } +} diff --git a/cmd/bdrive/web.go b/cmd/bdrive/web.go index c77a18e..3b07f82 100644 --- a/cmd/bdrive/web.go +++ b/cmd/bdrive/web.go @@ -70,6 +70,12 @@ type webConfig struct { Reads *struct { Enabled *bool `json:"enabled,omitempty"` // default true RetentionDays int `json:"retention_days,omitempty"` // default 400; older days fold into all-time + // SessionRetentionDays bounds the per-session read detail behind + // History's run cards (which files an agent session read). Default + // 30, and deliberately much shorter than RetentionDays: this is + // event-shaped rather than aggregate, and rows past it are deleted, + // which changes no heat total. + SessionRetentionDays int `json:"session_retention_days,omitempty"` } `json:"reads,omitempty"` } @@ -380,23 +386,29 @@ credentials); otherwise it is relayed through this server.`, return fmt.Errorf("open share registry: %w", err) } srv.Shares = shares - readsOn, retention := true, 0 + readsOn, retention, sessRetention := true, 0, 0 if cfg.Reads != nil { if cfg.Reads.Enabled != nil { readsOn = *cfg.Reads.Enabled } retention = cfg.Reads.RetentionDays + sessRetention = cfg.Reads.SessionRetentionDays } if readsOn { var reads *webapp.ReadLedger + var sessions webapp.SessionReadRepo if meta != nil { reads, err = webapp.NewReadLedger(meta.Reads(), retention) + sessions = meta.SessionReads() } else { - reads, err = webapp.OpenReadLedger(filepath.Join(filepath.Dir(projectsDB), "reads.json"), retention) + dir := filepath.Dir(projectsDB) + reads, err = webapp.OpenReadLedger(filepath.Join(dir, "reads.json"), retention) + sessions = webapp.OpenSessionReadRepo(filepath.Join(dir, "sessions.json")) } if err != nil { return fmt.Errorf("open read ledger: %w", err) } + reads.WithSessions(sessions, sessRetention) defer reads.Close() srv.Reads = reads } diff --git a/internal/journal/journal.go b/internal/journal/journal.go index 1831462..0c6fdbb 100644 --- a/internal/journal/journal.go +++ b/internal/journal/journal.go @@ -43,6 +43,18 @@ type Op struct { Size int64 `json:"size,omitempty"` Mode uint32 `json:"mode,omitempty"` // permission bits Note string `json:"note,omitempty"` // e.g. "conflict copy of " + // Session is the agent session this op was committed during, set ONLY by + // the agent sync hook (`bdrive sync --hook`). Display/join only — never an + // input to Less or Replay, exactly like Mtime below, so replay stays + // deterministic and ops written before this field existed simply carry "". + // + // It exists because Note is user-settable (`bdrive sync --note`): joining + // a run's reads to its writes on the note string would let any member with + // write access forge a note that collides with a teammate's session and + // hang their reads off it. This field is the un-forgeable half of that + // pair, so the join reads it and never the note. + Session string `json:"session,omitempty"` + // Mtime is when the file was last written, as opposed to Time, which is // when the op was committed. Display only — never an input to Less or // Replay, since it comes from the filesystem and can be anything. diff --git a/internal/journal/session_test.go b/internal/journal/session_test.go new file mode 100644 index 0000000..b785d15 --- /dev/null +++ b/internal/journal/session_test.go @@ -0,0 +1,58 @@ +package journal + +import ( + "strings" + "testing" +) + +// Op.Session holds the same standing as Mtime: additive on the wire, and +// invisible to the ordering. A journal written by this code still parses in +// the old shape, and an op written before the field existed reads back as "". +func TestSessionIsAdditive(t *testing.T) { + with := op(1, "a", 1, KindPut, "x.txt", "blob1") + with.Session = "8f21e4" + without := op(2, "a", 2, KindPut, "y.txt", "blob2") + + data, err := Marshal([]Op{with, without}) + if err != nil { + t.Fatal(err) + } + lines := strings.Split(strings.TrimSpace(string(data)), "\n") + if !strings.Contains(lines[0], `"session":"8f21e4"`) { + t.Fatalf("op lost its session: %s", lines[0]) + } + if strings.Contains(lines[1], "session") { + t.Fatalf("op without a session should emit no session key: %s", lines[1]) + } + + got, err := Parse(data) + if err != nil { + t.Fatal(err) + } + if got[0].Session != "8f21e4" { + t.Fatalf("Session = %q, want 8f21e4", got[0].Session) + } + if got[1].Session != "" { + t.Fatalf("Session should be empty, got %q", got[1].Session) + } + // A line written by an older device carries no session key at all. + legacy, err := Parse([]byte(`{"seq":1,"lamport":1,"device":"a","kind":"put","path":"z.txt"}`)) + if err != nil { + t.Fatal(err) + } + if legacy[0].Session != "" { + t.Fatalf("legacy op invented a session: %q", legacy[0].Session) + } +} + +// Replay determinism is the invariant this field must not touch: two ops +// differing ONLY in Session compare equal under Less in both directions, so +// no peer's ordering can depend on it. +func TestSessionDoesNotOrder(t *testing.T) { + a := op(1, "dev", 1, KindPut, "x.txt", "blob1") + b := a + b.Session = "8f21e4" + if Less(a, b) || Less(b, a) { + t.Fatalf("Session must not be an input to Less: Less(a,b)=%v Less(b,a)=%v", Less(a, b), Less(b, a)) + } +} diff --git a/internal/remote/remote.go b/internal/remote/remote.go index 2ebb29d..63d218f 100644 --- a/internal/remote/remote.go +++ b/internal/remote/remote.go @@ -65,8 +65,13 @@ type Backend interface { // ReadEvent is one agent file read reported to the hub for its read heatmap. type ReadEvent struct { - Path string `json:"path"` - Time time.Time `json:"time,omitzero"` + Path string `json:"path"` + // Session is the agent session the read happened in, so the hub can join + // a run's reads to the writes journal.Op.Session carries. A client string + // — the hub pins each recorded row to the device it validated, never to + // anything in this body (see handleReadReport). + Session string `json:"session,omitempty"` + Time time.Time `json:"time,omitzero"` } // ReadReporter is the optional read-telemetry capability, in the PutSigner diff --git a/internal/store/reads.go b/internal/store/reads.go index a3892cc..26ad48a 100644 --- a/internal/store/reads.go +++ b/internal/store/reads.go @@ -16,8 +16,12 @@ import ( // ReadEvent is one observed read of a synced file (mount-relative path). type ReadEvent struct { - Path string `json:"path"` - Time time.Time `json:"time"` + Path string `json:"path"` + // Session is the agent session the read happened in, from the same hook + // payload the sync hook stamps journal.Op.Session from. Empty for reads + // with no session (a platform that reports none, or an older client). + Session string `json:"session,omitempty"` + Time time.Time `json:"time"` } // readSpoolMax caps the spool: past it new events are dropped rather than @@ -32,11 +36,11 @@ func (s *Store) readFlushPath() string { return filepath.Join(s.dir, "reads-flus // LogRead appends one read event to the spool. Single-line O_APPEND writes // keep concurrent hook invocations from interleaving. -func (s *Store) LogRead(rel string) error { +func (s *Store) LogRead(rel, session string) error { if fi, err := os.Stat(s.readSpoolPath()); err == nil && fi.Size() > readSpoolMax { return nil // spool full: drop, never grow unbounded } - line, err := json.Marshal(ReadEvent{Path: rel, Time: time.Now().UTC()}) + line, err := json.Marshal(ReadEvent{Path: rel, Session: session, Time: time.Now().UTC()}) if err != nil { return err } @@ -50,10 +54,14 @@ func (s *Store) LogRead(rel string) error { return err } -// PendingReads returns the queued batch awaiting report, deduplicated by path -// (latest time wins). The spool is rotated aside first, so events logged -// after this call land in a fresh spool; the batch survives until -// ClearPendingReads — a failed report is simply retried next cycle. +// PendingReads returns the queued batch awaiting report, deduplicated by +// (path, session) — latest time wins. Not by path alone: two agent sessions +// on one device between syncs both reading wiki/a.md are two reads by two +// sessions, and collapsing them would report one, carrying whichever session +// happened to flush last — one session's reads silently credited to another. +// The spool is rotated aside first, so events logged after this call land in +// a fresh spool; the batch survives until ClearPendingReads — a failed report +// is simply retried next cycle. func (s *Store) PendingReads() ([]ReadEvent, error) { if _, err := os.Stat(s.readFlushPath()); os.IsNotExist(err) { if err := os.Rename(s.readSpoolPath(), s.readFlushPath()); err != nil { @@ -70,8 +78,9 @@ func (s *Store) PendingReads() ([]ReadEvent, error) { } return nil, err } - latest := map[string]time.Time{} - var order []string + type readKey struct{ path, session string } + latest := map[readKey]time.Time{} + var order []readKey for _, line := range bytes.Split(data, []byte("\n")) { if len(bytes.TrimSpace(line)) == 0 { continue @@ -80,19 +89,20 @@ func (s *Store) PendingReads() ([]ReadEvent, error) { if json.Unmarshal(line, &e) != nil || e.Path == "" { continue // torn or corrupt line; drop it } - if _, ok := latest[e.Path]; !ok { - order = append(order, e.Path) + k := readKey{e.Path, e.Session} + if _, ok := latest[k]; !ok { + order = append(order, k) } - if e.Time.After(latest[e.Path]) { - latest[e.Path] = e.Time + if e.Time.After(latest[k]) { + latest[k] = e.Time } } if len(order) > readReportMax { order = order[len(order)-readReportMax:] } out := make([]ReadEvent, 0, len(order)) - for _, p := range order { - out = append(out, ReadEvent{Path: p, Time: latest[p]}) + for _, k := range order { + out = append(out, ReadEvent{Path: k.path, Session: k.session, Time: latest[k]}) } return out, nil } diff --git a/internal/store/reads_test.go b/internal/store/reads_test.go index ab52bea..d54fdbd 100644 --- a/internal/store/reads_test.go +++ b/internal/store/reads_test.go @@ -26,11 +26,11 @@ func TestReadSpool(t *testing.T) { // Repeat reads of one path dedupe to its latest event. for i := 0; i < 3; i++ { - if err := s.LogRead("wiki/a.md"); err != nil { + if err := s.LogRead("wiki/a.md", ""); err != nil { t.Fatal(err) } } - if err := s.LogRead("b.md"); err != nil { + if err := s.LogRead("b.md", ""); err != nil { t.Fatal(err) } evs, err := s.PendingReads() @@ -46,7 +46,7 @@ func TestReadSpool(t *testing.T) { // The batch survives until cleared — a failed report just retries — and // reads logged meanwhile land in a fresh spool behind it. - if err := s.LogRead("c.md"); err != nil { + if err := s.LogRead("c.md", ""); err != nil { t.Fatal(err) } again, err := s.PendingReads() @@ -74,14 +74,14 @@ func TestReadSpool(t *testing.T) { func TestReadSpoolSurvivesCorruptLines(t *testing.T) { s := openTestStore(t) - s.LogRead("good.md") + s.LogRead("good.md", "") f, err := os.OpenFile(s.readSpoolPath(), os.O_WRONLY|os.O_APPEND, 0o644) if err != nil { t.Fatal(err) } f.WriteString(`{"path": "torn`) // a torn write f.Close() - s.LogRead("also-good.md") + s.LogRead("also-good.md", "") evs, err := s.PendingReads() if err != nil { t.Fatal(err) @@ -97,7 +97,7 @@ func TestReadSpoolCap(t *testing.T) { s := openTestStore(t) long := strings.Repeat("d", 1024) for i := 0; i < 1100; i++ { // ~1.1 MB of events - if err := s.LogRead(long + "/" + string(rune('a'+i%26)) + ".md"); err != nil { + if err := s.LogRead(long+"/"+string(rune('a'+i%26))+".md", ""); err != nil { t.Fatal(err) } } @@ -109,3 +109,39 @@ func TestReadSpoolCap(t *testing.T) { t.Fatalf("spool grew past its cap: %d bytes", fi.Size()) } } + +// Two agent sessions on one device between syncs, both reading one path, are +// two reads by two sessions — the spool must not collapse them into one +// event carrying whichever session flushed last, which would credit one +// session's reads to another on the History run card. +func TestReadSpoolDedupesPerSession(t *testing.T) { + s := openTestStore(t) + for _, e := range []struct{ path, session string }{ + {"wiki/a.md", "sess-1"}, + {"wiki/a.md", "sess-2"}, + {"wiki/a.md", "sess-1"}, // a repeat within one session still collapses + {"wiki/b.md", "sess-1"}, + {"wiki/c.md", ""}, // no session (an older client / a platform that reports none) + } { + if err := s.LogRead(e.path, e.session); err != nil { + t.Fatal(err) + } + } + evs, err := s.PendingReads() + if err != nil { + t.Fatal(err) + } + got := map[string]bool{} + for _, e := range evs { + got[e.Path+"|"+e.Session] = true + } + want := []string{"wiki/a.md|sess-1", "wiki/a.md|sess-2", "wiki/b.md|sess-1", "wiki/c.md|"} + if len(evs) != len(want) { + t.Fatalf("batch = %+v, want %d entries", evs, len(want)) + } + for _, w := range want { + if !got[w] { + t.Errorf("batch is missing %q: %+v", w, evs) + } + } +} diff --git a/internal/store/sec_defer_test.go b/internal/store/sec_defer_test.go index 8003cb2..87d757a 100644 --- a/internal/store/sec_defer_test.go +++ b/internal/store/sec_defer_test.go @@ -48,7 +48,7 @@ func secdefModes(t *testing.T, dir string) map[string]os.FileMode { // beside it in the same 0755 volume directory at mode 0644. func TestSec_Store_ReadSpoolIsNotWorldReadable(t *testing.T) { s, _ := secpkgStore(t) - if err := s.LogRead("secret-project/acquisition-plan.md"); err != nil { + if err := s.LogRead("secret-project/acquisition-plan.md", ""); err != nil { t.Fatal(err) } found := false @@ -88,7 +88,7 @@ func TestSec_Store_ReadSpoolSurvivesAHostilePathAsData(t *testing.T) { "tab\there.md", } for _, p := range hostile { - if err := s.LogRead(p); err != nil { + if err := s.LogRead(p, ""); err != nil { t.Fatalf("LogRead(%q): %v", p, err) } } diff --git a/internal/syncer/reads_flow_test.go b/internal/syncer/reads_flow_test.go index 69122b9..51aaed1 100644 --- a/internal/syncer/reads_flow_test.go +++ b/internal/syncer/reads_flow_test.go @@ -52,9 +52,9 @@ func TestAgentReadReporting(t *testing.T) { write(t, a.Folder, "wiki/a.md", "content") // The agent read a.md twice and b.md once before this cycle. - a.Store.LogRead("wiki/a.md") - a.Store.LogRead("wiki/a.md") - a.Store.LogRead("b.md") + a.Store.LogRead("wiki/a.md", "") + a.Store.LogRead("wiki/a.md", "") + a.Store.LogRead("b.md", "") res := cycle(t, a) if !res.Pushed { t.Fatal("cycle should have pushed") @@ -74,7 +74,7 @@ func TestAgentReadReporting(t *testing.T) { // Hub down: the cycle still succeeds and the batch stays queued. hub.setFail(true) - a.Store.LogRead("wiki/a.md") + a.Store.LogRead("wiki/a.md", "") if res := cycle(t, a); res.Offline { t.Fatal("a failed read report must not mark the cycle offline") } @@ -93,9 +93,73 @@ func TestAgentReadReporting(t *testing.T) { // queued reads: the cycle runs, the spool just keeps waiting. b := newDevice(t, "devb", sharedRemote(t)) write(t, b.Folder, "x.md", "x") - b.Store.LogRead("x.md") + b.Store.LogRead("x.md", "") cycle(t, b) if evs, err := b.Store.PendingReads(); err != nil || len(evs) != 1 { t.Fatalf("spool on a hubless device = %v, %v; want the read still queued", evs, err) } } + +// TestSessionCarriesThroughTwoDevices is the multi-device shape of the join: +// a device syncing under an agent session stamps that session onto every op +// it commits AND onto every read it reports, its peer converges on ops that +// carry the id, and a device with no session leaves both empty — so a run +// card can never claim another device's work. +func TestSessionCarriesThroughTwoDevices(t *testing.T) { + shared := sharedRemote(t) + hubA := &readReportingRemote{Backend: shared} + hubB := &readReportingRemote{Backend: shared} + a := newDevice(t, "deva", hubA) + b := newDevice(t, "devb", hubB) + + // Device A works inside an agent session: it reads two files and writes one. + a.SessionID = "8f21e4" + write(t, a.Folder, "wiki/a.md", "written by the run") + a.Store.LogRead("wiki/a.md", "8f21e4") + a.Store.LogRead("wiki/reference.md", "8f21e4") + cycle(t, a) + + if reports := hubA.all(); len(reports) != 1 || len(reports[0]) != 2 { + t.Fatalf("reports = %+v, want one batch of 2", reports) + } else { + for _, e := range reports[0] { + if e.Session != "8f21e4" { + t.Fatalf("reported read %+v lost its session", e) + } + } + } + + // Device B, no session at all: its own op carries none, and the read it + // reports carries none — nothing of B's can land on A's card. + write(t, b.Folder, "wiki/b.md", "written by a human") + b.Store.LogRead("wiki/b.md", "") + cycle(t, b) + if reports := hubB.all(); len(reports) != 1 || reports[0][0].Session != "" { + t.Fatalf("sessionless device reported %+v, want an empty session", reports) + } + + // Both peers converge, and each op keeps the session of the device that + // wrote it — replay does not touch the field. + cycle(t, a) + cycle(t, b) + for _, d := range []*Session{a, b} { + ops, err := d.Store.AllOps() + if err != nil { + t.Fatal(err) + } + seen := map[string]string{} + for _, op := range ops { + seen[op.Path] = op.Session + } + if seen["wiki/a.md"] != "8f21e4" { + t.Errorf("%s sees wiki/a.md session %q, want 8f21e4", d.Device.ID, seen["wiki/a.md"]) + } + if seen["wiki/b.md"] != "" { + t.Errorf("%s sees wiki/b.md session %q, want empty", d.Device.ID, seen["wiki/b.md"]) + } + } + // Convergence itself: both folders hold both files. + if got, want := snapshotDir(t, a.Folder), snapshotDir(t, b.Folder); len(got) != len(want) { + t.Fatalf("folders diverged: %v vs %v", got, want) + } +} diff --git a/internal/syncer/syncer.go b/internal/syncer/syncer.go index 07d0e9f..fa26b29 100644 --- a/internal/syncer/syncer.go +++ b/internal/syncer/syncer.go @@ -66,6 +66,14 @@ type Session struct { // `bdrive sync --note` leave context that the daemon's later scans also // stamp. Conflict-copy ops keep their own explanatory note. Note string + // SessionID is the agent session every op this cycle commits is stamped + // with (journal.Op.Session). Set only by `bdrive sync --hook`, and + // deliberately NOT persisted the way Note is (store.SaveNote): the note + // is context that outlives the hook turn, the session id is an identity + // that must not be attached to changes the daemon commits on its own + // later. So a daemon scan after the hook turn carries the note and no + // session — the asymmetry is intended. + SessionID string // Prune makes this cycle reconcile the hub against the shared ignore // rules: every path the remote still holds that .bdriveignore (or a // builtin never-sync rule) now excludes is journaled as a delete, so it @@ -435,7 +443,7 @@ func (s *Session) Cycle(ctx context.Context) (*Result, error) { if evs, err := s.Store.PendingReads(); err == nil && len(evs) > 0 { reads := make([]remote.ReadEvent, len(evs)) for i, e := range evs { - reads[i] = remote.ReadEvent{Path: e.Path, Time: e.Time} + reads[i] = remote.ReadEvent{Path: e.Path, Session: e.Session, Time: e.Time} } if rr.ReportReads(ctx, reads) == nil { s.Store.ClearPendingReads() @@ -482,7 +490,7 @@ func (s *Session) scan(cache map[string]store.CachedFile, st *store.SyncState, s Seq: seqBase, Lamport: st.Lamport, Time: time.Now().UTC(), Device: s.Device.ID, DeviceName: s.Device.Name, Author: s.Device.Author, User: s.Account.Email, UserName: s.Account.Name, - Kind: kind, Path: rel, Note: note, + Kind: kind, Path: rel, Note: note, Session: s.SessionID, } } diff --git a/internal/webapp/db.go b/internal/webapp/db.go index 6b4f1dc..15a73d1 100644 --- a/internal/webapp/db.go +++ b/internal/webapp/db.go @@ -3,6 +3,7 @@ package webapp import ( "fmt" "strings" + "time" "unicode/utf8" ) @@ -25,6 +26,7 @@ type MetaStore interface { Shares() ShareRepo Devices() DeviceRepo Reads() ReadRepo + SessionReads() SessionReadRepo Close() error } @@ -78,6 +80,19 @@ type ReadRepo interface { DeleteBatch(keys []ReadStatKey) error } +// SessionReadRepo persists which paths one agent session read (see +// SessionRead). Deliberately its OWN repo rather than a session column on +// read_stats: ReadLedger loads every read_stats row into one map at boot and +// ReadLedger.Heat linearly scans that whole map on every heat request, +// hub-wide — so multiplying its row count by session cardinality would slow +// the Dashboard for projects that never ran an agent. These rows never enter +// that map; they are queried by primary key and pruned by date. +type SessionReadRepo interface { + PutBatch(reads []SessionRead) error // upsert by (project, session, device, path) + ListBySession(project, session, device string) ([]SessionRead, error) + PruneBefore(t time.Time) error +} + // ---- cheap change detection --------------------------------------------- // Versioned is the optional "has anything moved?" check on a repository: a @@ -206,3 +221,7 @@ func checkDevice(d DeviceInfo) error { func checkReadStat(s ReadStat) error { return storable(s.Project, s.Path, s.Day, s.Kind, s.Actor) } + +func checkSessionRead(s SessionRead) error { + return storable(s.Project, s.Session, s.Path, s.Device) +} diff --git a/internal/webapp/db_conformance_test.go b/internal/webapp/db_conformance_test.go index d07bf83..e57e14f 100644 --- a/internal/webapp/db_conformance_test.go +++ b/internal/webapp/db_conformance_test.go @@ -65,7 +65,7 @@ func metaBackends(t *testing.T) []metaBackend { // device_rows rows behind for the following test to inherit. db.Exec(`DROP TABLE IF EXISTS accounts, tokens, auth_policy, projects, project_perms, orgs, org_members, invites, shares, devices, device_rows, read_stats, - meta_version, schema_meta`) + read_sessions, meta_version, schema_meta`) }, open: func(t *testing.T) MetaStore { s, err := OpenSQLStore("pgx", dsn) @@ -221,9 +221,22 @@ func TestMetaStoreConformance(t *testing.T) { reads.Record(p1.ID, "handbook.md", ReadKindHuman, "dev@x.io") reads.Record(p1.ID, "handbook.md", ReadKindHuman, "boss@x.io") reads.Record(p1.ID, "wiki/deep.md", ReadKindAgent, "d1") + // Per-session read detail rides its own repo, so it needs its own + // pass on every backend: two sessions on one device must stay two + // sets of rows, and one of them must prune away by date. + reads.WithSessions(st.SessionReads(), 0) + reads.RecordSession(p1.ID, "sess-a", "d1", "handbook.md") + reads.RecordSession(p1.ID, "sess-a", "d1", "wiki/deep.md") + reads.RecordSession(p1.ID, "sess-b", "d1", "handbook.md") if err := reads.Close(); err != nil { t.Fatal(err) } + if err := st.SessionReads().PutBatch([]SessionRead{{ + Project: p1.ID, Session: "sess-old", Device: "d1", Path: "handbook.md", + Last: time.Now().UTC().Add(-90 * 24 * time.Hour), + }}); err != nil { + t.Fatal(err) + } if err := st.Close(); err != nil { t.Fatal(err) @@ -323,6 +336,37 @@ func TestMetaStoreConformance(t *testing.T) { if sub := reads2.Heat(p1.ID, "wiki", time.Time{}); len(sub) != 1 { t.Fatalf("prefix heat = %+v, want only wiki/deep.md", sub) } + + sessions := st2.SessionReads() + got, err := sessions.ListBySession(p1.ID, "sess-a", "d1") + if err != nil { + t.Fatal(err) + } + if len(got) != 2 || got[0].Path != "handbook.md" || got[1].Path != "wiki/deep.md" { + t.Fatalf("session-a rows lost across reload: %+v", got) + } + if other, _ := sessions.ListBySession(p1.ID, "sess-b", "d1"); len(other) != 1 { + t.Fatalf("session-b rows = %+v, want its own single row", other) + } + // Wrong device, same session id: the query is keyed on both, which + // is what keeps a forged report off somebody else's run card. + if none, _ := sessions.ListBySession(p1.ID, "sess-a", "d2"); len(none) != 0 { + t.Fatalf("session rows leaked across devices: %+v", none) + } + if err := sessions.PruneBefore(time.Now().UTC().AddDate(0, 0, -30)); err != nil { + t.Fatal(err) + } + if old, _ := sessions.ListBySession(p1.ID, "sess-old", "d1"); len(old) != 0 { + t.Fatalf("prune left expired session rows: %+v", old) + } + if kept, _ := sessions.ListBySession(p1.ID, "sess-a", "d1"); len(kept) != 2 { + t.Fatalf("prune took recent session rows too: %+v", kept) + } + // The aggregate the run cards do NOT come from is untouched by any + // of that — session rows never enter the bucket map. + if e := reads2.Heat(p1.ID, "", time.Time{})["handbook.md"]; e.Human != 2 { + t.Fatalf("bucket heat changed with session rows: %+v", e) + } }) } } diff --git a/internal/webapp/db_file.go b/internal/webapp/db_file.go index 7fb391e..c63dffa 100644 --- a/internal/webapp/db_file.go +++ b/internal/webapp/db_file.go @@ -90,6 +90,7 @@ type fileMetaStore struct { shares *fileShareRepo devices *fileDeviceRepo reads *fileReadRepo + sessions *fileSessionReadRepo } // OpenFileStore builds the file backend over dir, using the historical @@ -102,16 +103,18 @@ func OpenFileStore(dir string) (MetaStore, error) { shares: newFileShareRepo(filepath.Join(dir, "shares.json")), devices: newFileDeviceRepo(filepath.Join(dir, "devices.json")), reads: newFileReadRepo(filepath.Join(dir, "reads.json")), + sessions: newFileSessionReadRepo(filepath.Join(dir, "sessions.json")), }, nil } -func (s *fileMetaStore) Accounts() AccountRepo { return s.accounts } -func (s *fileMetaStore) Projects() ProjectRepo { return s.projects } -func (s *fileMetaStore) Orgs() OrgRepo { return s.orgs } -func (s *fileMetaStore) Shares() ShareRepo { return s.shares } -func (s *fileMetaStore) Devices() DeviceRepo { return s.devices } -func (s *fileMetaStore) Reads() ReadRepo { return s.reads } -func (s *fileMetaStore) Close() error { return nil } +func (s *fileMetaStore) Accounts() AccountRepo { return s.accounts } +func (s *fileMetaStore) Projects() ProjectRepo { return s.projects } +func (s *fileMetaStore) Orgs() OrgRepo { return s.orgs } +func (s *fileMetaStore) Shares() ShareRepo { return s.shares } +func (s *fileMetaStore) Devices() DeviceRepo { return s.devices } +func (s *fileMetaStore) Reads() ReadRepo { return s.reads } +func (s *fileMetaStore) SessionReads() SessionReadRepo { return s.sessions } +func (s *fileMetaStore) Close() error { return nil } // ---- accounts (auth.json: users + tokens + policy) ---- @@ -768,3 +771,106 @@ func (r *fileReadRepo) DeleteBatch(keys []ReadStatKey) error { } return r.write() } + +// ---- session reads (sessions.json) ---- + +type fileSessionReadRepo struct { + path string + mu sync.Mutex + byKey map[sessionReadKey]SessionRead +} + +func newFileSessionReadRepo(path string) *fileSessionReadRepo { + return &fileSessionReadRepo{path: path, byKey: map[sessionReadKey]SessionRead{}} +} + +// reload re-reads before every write, for fileReadRepo.reload's reason: a +// stale rewrite erases rows another hub process recorded since boot. Callers +// hold mu. +func (r *fileSessionReadRepo) reload() error { + var f struct { + Sessions []SessionRead `json:"sessions"` + } + if _, err := readJSONFile(r.path, &f); err != nil { + return err + } + r.byKey = map[sessionReadKey]SessionRead{} + for _, sr := range f.Sessions { + r.byKey[sr.key()] = sr + } + return nil +} + +func (r *fileSessionReadRepo) write() error { + var f struct { + Sessions []SessionRead `json:"sessions"` + } + f.Sessions = make([]SessionRead, 0, len(r.byKey)) + for _, sr := range r.byKey { + f.Sessions = append(f.Sessions, sr) + } + sort.Slice(f.Sessions, func(i, j int) bool { + a, b := f.Sessions[i], f.Sessions[j] + if a.Session != b.Session { + return a.Session < b.Session + } + return a.Path < b.Path + }) + data, err := json.Marshal(f) // telemetry: compact beats pretty + if err != nil { + return err + } + return writeFileAtomic(r.path, append(data, '\n')) +} + +func (r *fileSessionReadRepo) PutBatch(reads []SessionRead) error { + for _, sr := range reads { + if err := checkSessionRead(sr); err != nil { + return err + } + } + r.mu.Lock() + defer r.mu.Unlock() + if err := r.reload(); err != nil { + return err + } + for _, sr := range reads { + r.byKey[sr.key()] = sr + } + return r.write() +} + +func (r *fileSessionReadRepo) ListBySession(project, session, device string) ([]SessionRead, error) { + r.mu.Lock() + defer r.mu.Unlock() + if err := r.reload(); err != nil { + return nil, err + } + var out []SessionRead + for k, sr := range r.byKey { + if k.Project == project && k.Session == session && k.Device == device { + out = append(out, sr) + } + } + sort.Slice(out, func(i, j int) bool { return out[i].Path < out[j].Path }) + return out, nil +} + +func (r *fileSessionReadRepo) PruneBefore(t time.Time) error { + r.mu.Lock() + defer r.mu.Unlock() + if err := r.reload(); err != nil { + return err + } + n := 0 + for k, sr := range r.byKey { + if sr.Last.Before(t) { + delete(r.byKey, k) + n++ + } + } + if n == 0 { + return nil + } + return r.write() +} diff --git a/internal/webapp/db_sql.go b/internal/webapp/db_sql.go index 54fcddf..633aff7 100644 --- a/internal/webapp/db_sql.go +++ b/internal/webapp/db_sql.go @@ -36,6 +36,7 @@ type sqlMetaStore struct { shares *sqlShareRepo devices *sqlDeviceRepo reads *sqlReadRepo + sessions *sqlSessionReadRepo } // OpenSQLStore opens (and migrates) a SQL metadata store. driver is "sqlite" @@ -70,16 +71,18 @@ func OpenSQLStore(driver, dsn string) (MetaStore, error) { s.shares = &sqlShareRepo{s: s, w: regWriter{s, regShares}} s.devices = &sqlDeviceRepo{s: s, w: regWriter{s, regDevices}} s.reads = &sqlReadRepo{s: s, w: regWriter{s, regReads}} + s.sessions = &sqlSessionReadRepo{s: s} return s, nil } -func (s *sqlMetaStore) Accounts() AccountRepo { return s.accounts } -func (s *sqlMetaStore) Projects() ProjectRepo { return s.projects } -func (s *sqlMetaStore) Orgs() OrgRepo { return s.orgs } -func (s *sqlMetaStore) Shares() ShareRepo { return s.shares } -func (s *sqlMetaStore) Devices() DeviceRepo { return s.devices } -func (s *sqlMetaStore) Reads() ReadRepo { return s.reads } -func (s *sqlMetaStore) Close() error { return s.db.Close() } +func (s *sqlMetaStore) Accounts() AccountRepo { return s.accounts } +func (s *sqlMetaStore) Projects() ProjectRepo { return s.projects } +func (s *sqlMetaStore) Orgs() OrgRepo { return s.orgs } +func (s *sqlMetaStore) Shares() ShareRepo { return s.shares } +func (s *sqlMetaStore) Devices() DeviceRepo { return s.devices } +func (s *sqlMetaStore) Reads() ReadRepo { return s.reads } +func (s *sqlMetaStore) SessionReads() SessionReadRepo { return s.sessions } +func (s *sqlMetaStore) Close() error { return s.db.Close() } // q rebinds ?-placeholders to $1,$2,… for Postgres; SQLite keeps ?. func (s *sqlMetaStore) q(query string) string { @@ -244,6 +247,16 @@ 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))`, + // Which paths one agent session read. Its own table, NOT a column on + // read_stats: read_stats is loaded whole into ReadLedger's map at boot + // and linearly scanned on every heat request, so session cardinality + // there would cost every project on the hub. Queried by primary key + // prefix, pruned by date — never loaded whole. + `CREATE TABLE IF NOT EXISTS read_sessions ( + project TEXT NOT NULL, session TEXT NOT NULL, device TEXT NOT NULL, + path TEXT NOT NULL, last TEXT NOT NULL DEFAULT '', + PRIMARY KEY (project, session, device, path))`, + `CREATE INDEX IF NOT EXISTS read_sessions_last ON read_sessions (last)`, `CREATE TABLE IF NOT EXISTS project_perms ( project TEXT NOT NULL, email TEXT NOT NULL, level TEXT NOT NULL, PRIMARY KEY (project, email))`, @@ -903,3 +916,58 @@ func (r *sqlReadRepo) DeleteBatch(keys []ReadStatKey) error { return nil }) } + +// ---- session reads ---- + +// No regWriter: these rows are telemetry detail, never read through a +// registry's refresh path, so there is no version counter to bump. +type sqlSessionReadRepo struct { + s *sqlMetaStore +} + +func (r *sqlSessionReadRepo) PutBatch(reads []SessionRead) error { + for _, sr := range reads { + if err := checkSessionRead(sr); err != nil { + return err + } + } + tx, err := r.s.db.Begin() + if err != nil { + return err + } + defer tx.Rollback() + for _, sr := range reads { + if _, err := tx.Exec(r.s.q(`INSERT INTO read_sessions (project,session,device,path,last) + VALUES (?,?,?,?,?) + ON CONFLICT(project,session,device,path) DO UPDATE SET last=excluded.last`), + sr.Project, sr.Session, sr.Device, sr.Path, tenc(sr.Last)); err != nil { + return err + } + } + return tx.Commit() +} + +func (r *sqlSessionReadRepo) ListBySession(project, session, device string) ([]SessionRead, error) { + rows, err := r.s.db.Query(r.s.q(`SELECT project, session, device, path, last FROM read_sessions + WHERE project = ? AND session = ? AND device = ? ORDER BY path`), project, session, device) + if err != nil { + return nil, err + } + defer rows.Close() + var out []SessionRead + for rows.Next() { + var sr SessionRead + var last string + if err := rows.Scan(&sr.Project, &sr.Session, &sr.Device, &sr.Path, &last); err != nil { + return nil, err + } + sr.Last = tdec(last) + out = append(out, sr) + } + return out, rows.Err() +} + +func (r *sqlSessionReadRepo) PruneBefore(t time.Time) error { + _, err := r.s.db.Exec(r.s.q(`DELETE FROM read_sessions WHERE last < ?`), tenc(t)) + return err +} diff --git a/internal/webapp/e2e_serve_test.go b/internal/webapp/e2e_serve_test.go index 990036f..34614ae 100644 --- a/internal/webapp/e2e_serve_test.go +++ b/internal/webapp/e2e_serve_test.go @@ -28,7 +28,9 @@ import ( ) const ( - e2eAddr = "0.0.0.0:8993" + e2eAddr = "0.0.0.0:8993" + // e2eSession is the agent session the seeded run card belongs to. + e2eSession = "8f21e4" e2eAdmin = "e2e@example.com" e2eMember = "member@example.com" e2eSolo = "solo@example.com" @@ -103,6 +105,16 @@ func TestE2EServe(t *testing.T) { if err != nil { t.Fatal(err) } + // Per-session read detail, so the seeded run card has both halves of the + // story: what the run changed AND what it read (BEA-98). + srv.Reads.WithSessions(OpenSessionReadRepo(filepath.Join(state, "sessions.json")), 0) + for _, path := range []string{ + "notes/readme.md", // read AND rewritten by the run + "index.md", // read, never changed + "archive/retired-spec.md", // read, never changed — the hot+stale one + } { + srv.Reads.RecordSession(p.ID, e2eSession, "seed", path) + } srv.Devices, _ = OpenDeviceRegistry(filepath.Join(state, "devices.json")) srv.Devices.Observe(DeviceInfo{ID: "seed", Name: "seed-agent", OS: "linux/amd64"}) @@ -247,8 +259,12 @@ func seedE2E(t *testing.T, state, prefix, projectID string) { // of their path, so neither row offers a restore (BEA-57). put("notes/readme.md", "# Notes\n\nRewritten during the agent run.\n", 90*time.Minute) put("runbook.md", "# Runbook\n\nCreated during the agent run.\n", 90*time.Minute) - ops[len(ops)-1].Note = "claude-code session 8f21e4" - ops[len(ops)-2].Note = "claude-code session 8f21e4" + ops[len(ops)-1].Note = "claude-code session " + e2eSession + ops[len(ops)-2].Note = "claude-code session " + e2eSession + // The un-forgeable half of the run identity: the note is what a reader + // sees, this is what the card groups and joins its reads on. + ops[len(ops)-1].Session = e2eSession + ops[len(ops)-2].Session = e2eSession // A second version of the same binary, so the history diff has a // predecessor to refuse to diff (the "binary — no diff" path). put("assets/logo.png", png+"\x00trailing", 3*time.Hour) diff --git a/internal/webapp/frontend/e2e/browse.spec.ts b/internal/webapp/frontend/e2e/browse.spec.ts index 3fb1215..5d022e3 100644 --- a/internal/webapp/frontend/e2e/browse.spec.ts +++ b/internal/webapp/frontend/e2e/browse.spec.ts @@ -515,7 +515,8 @@ test("history groups one agent run into a single card", async ({ page }) => { const run = page.locator(".hrun"); await expect(run).toHaveCount(1); await expect(run.locator(".hrun-note")).toHaveText("claude-code session 8f21e4"); - await expect(run.locator(".hrun-meta")).toContainText("2 files"); + // Both halves of the run, since the seed gives it session reads (BEA-98). + await expect(run.locator(".hrun-meta")).toContainText("changed 2"); await expect(run.locator(".hrun-meta")).toContainText("seed-agent"); // Both of the run's changes live inside the card... await expect(run.locator(".hentry")).toHaveCount(2); diff --git a/internal/webapp/frontend/e2e/session-run.spec.ts b/internal/webapp/frontend/e2e/session-run.spec.ts new file mode 100644 index 0000000..0ffcb6d --- /dev/null +++ b/internal/webapp/frontend/e2e/session-run.spec.ts @@ -0,0 +1,45 @@ +import { test, expect } from "@playwright/test"; +import { login, wikiId } from "./helpers"; + +/* One agent run, both halves (BEA-98). History used to show only what a run + CHANGED; the reads lived in a daily aggregate with no session dimension and + could not be joined to it. The seeded run reads three files and rewrites + one of them. */ + +test("a run card shows what the session read as well as what it changed", async ({ page }) => { + await login(page); + const pid = await wikiId(page); + await page.goto(`/${pid}/history`); + + const card = page.locator(".hrun").first(); + await expect(card).toBeVisible(); + // The header counts both halves now. + await expect(card.locator(".hrun-meta")).toContainText("read 3"); + await expect(card.locator(".hrun-meta")).toContainText("changed 2"); + + // The file the run read AND rewrote carries the read marker on its own row. + const rewritten = card.locator(".hentry", { hasText: "notes/readme.md" }); + await expect(rewritten.locator(".hread")).toHaveText("read"); + // The file it created was never read, so that row has no marker. + await expect(card.locator(".hentry", { hasText: "runbook.md" }).locator(".hread")).toHaveCount(0); + + // What it read and did not touch is its own list. + const readOnly = card.locator(".hrun-read"); + await expect(readOnly).toHaveCount(2); + await expect(readOnly.first()).toContainText("archive/retired-spec.md"); + await expect(readOnly.last()).toContainText("index.md"); + + // Landmine 3 is on screen, not folded into a comment: a file the run read + // and then deleted shows a write with no read, and the card says why. + await expect(card.locator(".hrun-foot")).toHaveText( + "Reads shown only for files the project still has.", + ); +}); + +test("a read-only row opens the file it names", async ({ page }) => { + await login(page); + const pid = await wikiId(page); + await page.goto(`/${pid}/history`); + await page.locator(".hrun-read", { hasText: "index.md" }).click(); + await expect(page).toHaveURL(new RegExp(`/${pid}/index.md`)); +}); diff --git a/internal/webapp/frontend/src/api/types.ts b/internal/webapp/frontend/src/api/types.ts index 358556d..1a0843b 100644 --- a/internal/webapp/frontend/src/api/types.ts +++ b/internal/webapp/frontend/src/api/types.ts @@ -183,6 +183,10 @@ export interface HistoryEntry { author?: string; device: DeviceInfo; note?: string; + // The agent session this change was committed during (hook-set, and unlike + // the note not settable by hand). It groups a run card and is the key the + // card's reads are fetched with. + session?: string; } // POST .../shares (handleShareCreate, shares.go) diff --git a/internal/webapp/frontend/src/components/HistoryRow.tsx b/internal/webapp/frontend/src/components/HistoryRow.tsx index eed9c5d..f32571c 100644 --- a/internal/webapp/frontend/src/components/HistoryRow.tsx +++ b/internal/webapp/frontend/src/components/HistoryRow.tsx @@ -58,6 +58,7 @@ export function HistoryRow({ remove, restoreSha, inRun, + read, }: { entry: HistoryEntry; // Its own prop, not something nested in `diff`: the version controls below @@ -80,6 +81,9 @@ export function HistoryRow({ // Inside a run card, where "this run created the file" is a statement we // can actually make. inRun?: boolean; + // The run that wrote this row also READ this path. Only ever set inside a + // run card, where a session id makes the join possible at all. + read?: boolean; }) { const [noteOpen, setNoteOpen] = useState(false); const [diffOpen, setDiffOpen] = useState(false); @@ -125,6 +129,13 @@ export function HistoryRow({ >
{KIND_LABEL[kind] || kind} + {/* The run read this file before it wrote it — the whole point of the + card, so it sits on the row rather than in a separate list. */} + {read && ( + + read + + )} {e.path} {when}
diff --git a/internal/webapp/frontend/src/components/HistoryView.tsx b/internal/webapp/frontend/src/components/HistoryView.tsx index 42f929d..4627d6a 100644 --- a/internal/webapp/frontend/src/components/HistoryView.tsx +++ b/internal/webapp/frontend/src/components/HistoryView.tsx @@ -1,5 +1,5 @@ import { useEffect, useRef, useState } from "react"; -import { useInfiniteQuery } from "@tanstack/react-query"; +import { useInfiniteQuery, useQuery } from "@tanstack/react-query"; import { getJSON } from "../api/http"; import type { HistoryEntry } from "../api/types"; import { HistoryRow, NoteText, type RemoveAction, type RestoreAction } from "./HistoryRow"; @@ -203,6 +203,26 @@ function RunGroup({ const first = run.entries[0]; const who = whoChanged(first); const dev = [first.device.name || first.device.id, first.device.os].filter(Boolean).join(" · "); + // What this run READ, joined on the session id its own ops carry — never on + // the note, which anyone can set to anything. Both the session and the + // device are required by the server, so a card only ever shows reads its + // own device reported. + const sid = first.session; + const did = first.device?.id; + const { data: reads } = useQuery({ + queryKey: ["session-reads", apiBase, sid, did], + queryFn: () => + getJSON<{ paths: string[] }>( + apiBase + "heat?session=" + encodeURIComponent(sid!) + "&device=" + encodeURIComponent(did!), + ), + enabled: !!sid && !!did, + staleTime: 30_000, + }); + const readPaths = new Set(reads?.paths ?? []); + const written = new Set(run.entries.map((e) => e.path)); + // Read but never written: the half of the run that History could not show + // before, and usually the half that answers "what did it look at?". + const readOnly = [...readPaths].filter((p) => !written.has(p)).sort(); const times = run.entries.map((e) => new Date(e.time).getTime()); const span = fmtSpan(Math.min(...times), Math.max(...times)); // Distinct paths, not ops: repeat edits to one file must not inflate the @@ -226,7 +246,8 @@ function RunGroup({ - {n} file{n === 1 ? "" : "s"} · {who} + {readPaths.size > 0 ? `read ${readPaths.size} · changed ${n}` : `${n} file${n === 1 ? "" : "s"}`} ·{" "} + {who} {dev ? " · " + dev : ""} {span} @@ -247,8 +268,26 @@ function RunGroup({ remove={remove} restoreSha={restoreSha(run.idx[k])} inRun + read={readPaths.has(e.path)} /> ))} + {readOnly.length > 0 && ( +
+
Read, not changed
+ {readOnly.map((p) => ( + + ))} +
+ )} + {/* Not decoration: reads are recorded only for paths the project + still has, so a file this run read and then deleted shows its + write with no read. Saying so beats reading as a bug. */} + {sid && ( +
Reads shown only for files the project still has.
+ )} )} diff --git a/internal/webapp/frontend/src/lib/runs.test.ts b/internal/webapp/frontend/src/lib/runs.test.ts index 789fc84..832f829 100644 --- a/internal/webapp/frontend/src/lib/runs.test.ts +++ b/internal/webapp/frontend/src/lib/runs.test.ts @@ -129,3 +129,65 @@ test("a run split across two pages groups into one card", () => { assert.deepEqual(items[1].run?.entries.map((x) => x.path), ["a.md", "b.md", "c.md"]); assert.deepEqual(items[1].run?.idx, [1, 2, 3]); // idx still addresses the flat feed }); + +// ---- grouping on the session id (BEA-98) ---- + +const es = (path: string, session?: string, note = "claude-code session x", device = "mac-mini"): HistoryEntry => ({ + time: "2026-07-29T14:02:00Z", + kind: "edit", + path, + note, + session, + device: { id: device }, +}); + +test("legacy entries (no session) still group by note + device, unchanged", () => { + const items = groupRuns([e("a.md", "session-1"), e("b.md", "session-1")]); + assert.equal(items.length, 1); + assert.equal(items[0].run?.entries.length, 2); + assert.equal(items[0].run?.session, undefined); +}); + +test("one note, two sessions = two runs — a note cannot merge into someone's card", () => { + const items = groupRuns([ + es("a.md", "sess-1"), + es("b.md", "sess-1"), + es("c.md", "sess-2"), + es("d.md", "sess-2"), + ]); + assert.equal(items.length, 2); + assert.deepEqual( + items.map((i) => i.run?.session), + ["sess-1", "sess-2"], + ); +}); + +test("one session on two devices is still two runs", () => { + const items = groupRuns([ + es("a.md", "sess-1", "note", "mac-mini"), + es("b.md", "sess-1", "note", "mac-mini"), + es("c.md", "sess-1", "note", "linux-box"), + es("d.md", "sess-1", "note", "linux-box"), + ]); + assert.equal(items.length, 2); +}); + +test("a session-keyed run never merges with a note-keyed one", () => { + // The legacy rows carry the same note the session rows do; only the + // session-bearing ones may group together. + const items = groupRuns([ + es("a.md", "sess-1"), + es("b.md", "sess-1"), + e("c.md", "claude-code session x"), + e("d.md", "claude-code session x"), + ]); + assert.equal(items.length, 2); + assert.equal(items[0].run?.session, "sess-1"); + assert.equal(items[1].run?.session, undefined); +}); + +test("a session with no note at all still forms a run", () => { + const items = groupRuns([es("a.md", "sess-1", ""), es("b.md", "sess-1", "")]); + assert.equal(items.length, 1); + assert.equal(items[0].run?.entries.length, 2); +}); diff --git a/internal/webapp/frontend/src/lib/runs.ts b/internal/webapp/frontend/src/lib/runs.ts index 20136cf..dd749be 100644 --- a/internal/webapp/frontend/src/lib/runs.ts +++ b/internal/webapp/frontend/src/lib/runs.ts @@ -4,9 +4,10 @@ import type { HistoryEntry } from "../api/types"; Pure grouping for the history feed, no React: the run card's shape and the one number in its header, unit-tested on node (`npm test`). */ -// One run: the entries that share a (note, device), with the index each came -// from so diff lookups still address the flat feed. -export type Run = { note: string; entries: HistoryEntry[]; idx: number[] }; +// One run: the entries that share a (session, device) — or a (note, device) +// for ops written before session ids existed — with the index each came from +// so diff lookups still address the flat feed. +export type Run = { note: string; session?: string; entries: HistoryEntry[]; idx: number[] }; export type Item = { run?: Run; i: number }; // How much of the project a run touched: distinct paths, not ops. A path @@ -17,27 +18,36 @@ export function runFileCount(run: Run): number { return new Set(run.entries.map((e) => e.path)).size; } -/* Group key = note + device id, exact match. Deliberately simple, and it - guarantees a group never spans two journals — one writer, one op range — - which is what a later run-wide restore needs. Two devices that happen to - write the same note are two runs. Grouping spans the whole window rather - than only consecutive rows, so a run whose ops interleave with another - device's still reads as one thing; each group sits where its newest - member did, keeping the feed newest-first. */ +/* Group key = session id + device id when the entry carries a session, + falling back to note + device id for ops written before Op.Session existed. + The session is preferred because it is the one of the two the writer cannot + choose: `bdrive sync --note` sets any note it likes, so grouping on the + note alone let a member forge a string that collides with a teammate's run + and merge into their card. The key still guarantees a group never spans two + journals — one writer, one op range — which is what a later run-wide + restore needs. Two devices that happen to share a note (or a session) are + two runs. Grouping spans the whole window rather than only consecutive + rows, so a run whose ops interleave with another device's still reads as + one thing; each group sits where its newest member did, keeping the feed + newest-first. */ export function groupRuns(entries: HistoryEntry[]): Item[] { - // NUL separator: it cannot occur in a note or a device id, so no pair of - // them can collide into one key. - const key = (e: HistoryEntry) => e.note + "\0" + (e.device?.id ?? ""); + // NUL separator: it cannot occur in a note, a session id or a device id, so + // no pair of them can collide into one key. Written as "\0", never pasted + // as a literal NUL (BEA-70: a Bin diff on a .tsx is the tell). + // The "s"/"n" tag keeps a session-keyed group from ever colliding with a + // note-keyed one on a device that writes both. + const key = (e: HistoryEntry) => + (e.session ? "s\0" + e.session : "n\0" + e.note) + "\0" + (e.device?.id ?? ""); const runs = new Map(); entries.forEach((e, i) => { - if (!e.note) return; + if (!e.note && !e.session) return; const run = runs.get(key(e)); if (run) { run.entries.push(e); run.idx.push(i); return; } - runs.set(key(e), { note: e.note, entries: [e], idx: [i] }); + runs.set(key(e), { note: e.note ?? "", session: e.session, entries: [e], idx: [i] }); }); // A run that touched one file is not worth a card: the row already shows // its note, and wrapping it would say the same thing twice. Grouping earns @@ -47,7 +57,7 @@ export function groupRuns(entries: HistoryEntry[]): Item[] { const out: Item[] = []; const carded = new Set(); entries.forEach((e, i) => { - const run = e.note ? runs.get(key(e)) : undefined; + const run = e.note || e.session ? runs.get(key(e)) : undefined; if (!run || runFileCount(run) < 2) { out.push({ i }); return; diff --git a/internal/webapp/frontend/src/style.css b/internal/webapp/frontend/src/style.css index 63268a9..4bc0271 100644 --- a/internal/webapp/frontend/src/style.css +++ b/internal/webapp/frontend/src/style.css @@ -780,6 +780,17 @@ a.ai-main:hover { color: var(--accent); } /* Rows inside a card don't repeat the card's own border or note. */ .hrun-body { border-top: 1px solid var(--border); } .hrun-body .hentry:last-child { border-bottom: none; } +/* "this run read it too" — a quieter badge than the kind pill it follows, + because the change is still the headline of the row. */ +.hread { flex: none; padding: 2px 6px; border-radius: 4px; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; color: var(--text-dim); background: var(--hover); } +/* What the run read and did NOT change: same two columns as a change row so + the eye reads one list, dimmer because nothing moved. */ +.hrun-reads { border-top: 1px solid var(--border); padding: 4px 0 6px; } +.hrun-reads-head { padding: 6px 14px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); } +.hrun-read { display: flex; gap: 10px; align-items: center; width: 100%; padding: 5px 14px; border: none; background: none; font: inherit; text-align: left; cursor: pointer; } +.hrun-read:hover { background: rgba(255,255,255,.015); } +.hrun-read .hkind { color: var(--text-dim); background: var(--hover); } +.hrun-foot { padding: 8px 14px 10px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-faint); } /* ---- restore / remove ---- */ .hrestore-btn, .hremove-btn { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; padding: 2px 8px 2px 5px; border: 1px solid var(--border); border-radius: 5px; background: none; color: var(--text-faint); font: inherit; font-size: 12px; cursor: pointer; } diff --git a/internal/webapp/history.go b/internal/webapp/history.go index 0b0628e..7a267cf 100644 --- a/internal/webapp/history.go +++ b/internal/webapp/history.go @@ -44,6 +44,12 @@ type HistoryEntry struct { Author string `json:"author,omitempty"` // offline/git fallback identity Device historyDevice `json:"device"` Note string `json:"note,omitempty"` + // Session is the agent session the op was committed during (hook-set, + // see journal.Op.Session). It is the run card's group key and the only + // place a session id is ever served: it is never enumerated, never a + // column in /heat's output, and never in ?by=device — it appears here, + // on the op that carries it, and is accepted as a ?session= filter INPUT. + Session string `json:"session,omitempty"` } // histLess is the display order of the history feed: newest wall-clock time @@ -263,7 +269,7 @@ func (s *Server) handleHistory(v *volume, w http.ResponseWriter, r *http.Request Time: op.Time.UTC().Format("2006-01-02T15:04:05Z"), Kind: kinds[i], Path: op.Path, Size: op.Size, Blob: op.Blob, User: op.User, UserName: op.UserName, Author: op.Author, - Device: dev, Note: op.Note, + Device: dev, Note: op.Note, Session: op.Session, }, op}) } // Truncation happens AFTER the sort: cutting during the walk above would diff --git a/internal/webapp/perms_test.go b/internal/webapp/perms_test.go index 2a39e82..95d3754 100644 --- a/internal/webapp/perms_test.go +++ b/internal/webapp/perms_test.go @@ -27,8 +27,15 @@ func TestPermRankAndAtLeast(t *testing.T) { // 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) { + h, srv, cookies, p, _ = permHubAt(t) + return +} + +// permHubAt is permHub plus the storage root, for tests that seed a journal +// through newFakeRemoteAt. +func permHubAt(t *testing.T) (h http.Handler, srv *Server, cookies map[string]*http.Cookie, p Project, root string) { t.Helper() - srv, _, _ = newHub(t, true, nil) + srv, _, root = newHub(t, true, nil) auth, err := OpenBuiltinAuth(filepath.Join(t.TempDir(), "auth.json"), true, nil) if err != nil { t.Fatal(err) @@ -75,7 +82,7 @@ func permHub(t *testing.T) (h http.Handler, srv *Server, cookies map[string]*htt t.Fatal(err) } } - return h, srv, cookies, p + return h, srv, cookies, p, root } // Nothing changes for an existing hub: with no permission edits, every org diff --git a/internal/webapp/reads.go b/internal/webapp/reads.go index 5412ae2..934abcd 100644 --- a/internal/webapp/reads.go +++ b/internal/webapp/reads.go @@ -27,6 +27,12 @@ import ( // /store/* sync traffic is replication, not reading, and is never counted; // history /blob views are spelunking, not consumption, and aren't either. // +// One exception to "never an event log": session reads (SessionRead), the +// per-session detail behind a History run card. They are a separate table +// with their own, shorter retention, and they never enter the ledger's +// in-memory bucket map — see SessionReadRepo for why that separation is the +// whole point. +// // Privacy: rows are daily aggregation buckets, never an event log. The actor // column (account email / device id / share token) exists only to count // distinct readers and never appears in an API response — with exactly one @@ -40,6 +46,15 @@ import ( // arbitrary string, and never someone else's machine. This route also never // registers a device: registering the id it is about to judge is what turned // the round-2 check into a one-request speed bump. +// +// A session id is identity-adjacent and gets the same ruling, written down +// before anything serves it: a session id appears ONLY in History responses, +// on the op that carries it, and as a ?session= filter INPUT. It is never +// enumerated — no "list sessions" response, no session column in /heat's +// output, nothing new in ?by=device. That is sound because the id is already +// visible to every project member inside Op.Note today, so serving it as its +// own field discloses nothing new, while refusing to enumerate keeps /heat +// identity-free exactly as documented above. // Read kinds. const ( @@ -69,6 +84,25 @@ func (s ReadStat) key() ReadStatKey { return ReadStatKey{s.Project, s.Path, s.Day, s.Kind, s.Actor} } +// SessionRead records that one agent session read one path, from one device. +// Not a count and not a bucket: the run card asks "did this session read this +// file?", and one row per (session, device, path) answers it with no +// aggregation. Device is always the hub-validated device the report arrived +// from, never anything the client put in the body. +type SessionRead struct { + Project string `json:"project"` + Session string `json:"session"` + Device string `json:"device"` + Path string `json:"path"` + Last time.Time `json:"last"` +} + +type sessionReadKey struct{ Project, Session, Device, Path string } + +func (s SessionRead) key() sessionReadKey { + return sessionReadKey{s.Project, s.Session, s.Device, s.Path} +} + // HeatEntry is the per-path aggregate the heat API returns. Counts only — // never identities. type HeatEntry struct { @@ -90,6 +124,15 @@ const ( // DefaultReadRetentionDays is how long daily buckets keep per-day // resolution before folding into the all-time row. DefaultReadRetentionDays = 400 + // DefaultSessionRetentionDays is how long per-session read detail is + // kept. Much shorter than the bucket retention: this is event-shaped + // data whose only consumer is a History run card, and a month covers a + // retro. Rows past it are deleted, not folded — the heat totals were + // never derived from them, so nothing is lost from any count. + DefaultSessionRetentionDays = 30 + // sessionPruneEvery throttles the retention delete; it rides the same + // flush the buckets use rather than owning a goroutine. + sessionPruneEvery = time.Hour ) // ReadLedger is the in-memory read-telemetry service over a ReadRepo, in the @@ -100,19 +143,29 @@ type ReadLedger struct { repo ReadRepo retention time.Duration + // Session-read detail, optional (nil = off) and deliberately outside + // byKey: these rows are never loaded into memory in bulk, so Heat's full + // map scan and the boot load are unaffected by session cardinality. If a + // future change ever moves them into byKey, Heat (below) is what pays. + sessions SessionReadRepo + sessionRetention time.Duration + // scans counts ShareOpens passes over byKey. Tests assert one per // project per list render — the "never one scan per share" rule is // invisible in the response body, so this is the only thing that can // catch the regression. scans atomic.Int64 - mu sync.Mutex - byKey map[ReadStatKey]ReadStat - dirty map[ReadStatKey]bool - pendingDel []ReadStatKey // retention deletions awaiting a successful flush - seen map[ReadStatKey]time.Time // debounce; Day field unused ("") - lastFlush time.Time - warned bool + mu sync.Mutex + byKey map[ReadStatKey]ReadStat + dirty map[ReadStatKey]bool + pendingDel []ReadStatKey // retention deletions awaiting a successful flush + seen map[ReadStatKey]time.Time // debounce; Day field unused ("") + pendingSess map[sessionReadKey]SessionRead + lastFlush time.Time + lastSessPrun time.Time + warned bool + sessWarned bool } // NewReadLedger loads the ledger and immediately folds buckets older than the @@ -153,6 +206,29 @@ func OpenReadLedger(path string, retentionDays int) (*ReadLedger, error) { return NewReadLedger(newFileReadRepo(path), retentionDays) } +// OpenSessionReadRepo is the file-backed session-read store, for hubs +// running without a MetaStore (the historical JSON-files layout). +func OpenSessionReadRepo(path string) SessionReadRepo { return newFileSessionReadRepo(path) } + +// WithSessions turns on per-session read detail (the data behind a History +// run card). Separate from the constructor so every existing caller — and +// every backend that has no session repo — keeps working with it off. +// retentionDays <= 0 means the default. +func (l *ReadLedger) WithSessions(repo SessionReadRepo, retentionDays int) *ReadLedger { + if l == nil || repo == nil { + return l + } + if retentionDays <= 0 { + retentionDays = DefaultSessionRetentionDays + } + l.mu.Lock() + defer l.mu.Unlock() + l.sessions = repo + l.sessionRetention = time.Duration(retentionDays) * 24 * time.Hour + l.pendingSess = map[sessionReadKey]SessionRead{} + return l +} + // Record counts one read. Nil-safe and never fails: telemetry must not break // the page view (or sync cycle) that triggered it. func (l *ReadLedger) Record(project, path, kind, actor string) { @@ -180,6 +256,97 @@ func (l *ReadLedger) Record(project, path, kind, actor string) { } } +// RecordSession notes that one agent session read one path from one device. +// Nil-safe, off when no session repo is configured, and — like Record — +// never fails: telemetry must not break the sync cycle that reported it. +// Unlike Record it is NOT debounced: a row is a fact ("this session read this +// file"), not a count, so repeats are the same row rewritten. +func (l *ReadLedger) RecordSession(project, session, device, path string) { + if l == nil || project == "" || session == "" || device == "" || path == "" { + return + } + l.mu.Lock() + defer l.mu.Unlock() + if l.sessions == nil { + return + } + now := time.Now() + sr := SessionRead{Project: project, Session: session, Device: device, Path: path, Last: now.UTC()} + l.pendingSess[sr.key()] = sr + // Same throttle the buckets use. Record's own flush check sits behind its + // debounce return, so a report whose buckets are all debounced would + // otherwise leave these rows buffered indefinitely. + if now.Sub(l.lastFlush) >= readFlushEvery { + l.flushLocked() + } +} + +// SessionPaths returns the paths one session read from one device, for the +// History run card. Both the session and the device are required by the +// caller (handleHeat): a session-only lookup would return rows a member +// reported under someone else's session id, which pinning to the validated +// device is what makes harmless. +func (l *ReadLedger) SessionPaths(project, session, device string) []string { + if l == nil || project == "" || session == "" || device == "" { + return nil + } + l.mu.Lock() + repo := l.sessions + // Flush first, so a card opened seconds after a sync sees that sync's + // reads instead of an empty list. + if repo != nil { + l.flushSessionsLocked() + } + l.mu.Unlock() + if repo == nil { + return nil + } + rows, err := repo.ListBySession(project, session, device) + if err != nil { + log.Printf("beardrive: session reads lookup failed: %v", err) + return nil + } + out := make([]string, 0, len(rows)) + for _, r := range rows { + out = append(out, r.Path) + } + return out +} + +// flushSessionsLocked persists buffered session rows and, at most hourly, +// deletes the ones past the session retention. Failures keep the buffer for +// the next attempt and log once — a read_sessions failure must never affect +// read_stats, so this is deliberately separate from persistLocked. Callers +// hold mu. +func (l *ReadLedger) flushSessionsLocked() { + if l.sessions == nil { + return + } + if len(l.pendingSess) > 0 { + batch := make([]SessionRead, 0, len(l.pendingSess)) + for _, sr := range l.pendingSess { + batch = append(batch, sr) + } + if err := l.sessions.PutBatch(batch); err != nil { + if !l.sessWarned { + l.sessWarned = true + log.Printf("beardrive: session read flush failed (will retry): %v", err) + } + } else { + l.sessWarned = false + l.pendingSess = map[sessionReadKey]SessionRead{} + } + } + now := time.Now() + if now.Sub(l.lastSessPrun) < sessionPruneEvery { + return + } + l.lastSessPrun = now + if err := l.sessions.PruneBefore(now.UTC().Add(-l.sessionRetention)); err != nil { + log.Printf("beardrive: session read prune failed (will retry): %v", err) + } +} + // Heat aggregates reads per path for one project. since bounds the window // (zero = all time, including retention folds); prefix "" means the whole // project, otherwise paths under "/". @@ -358,6 +525,7 @@ func (l *ReadLedger) flushLocked() { } else { l.warned = false } + l.flushSessionsLocked() } // compactLocked folds daily buckets older than the retention horizon into @@ -516,6 +684,25 @@ func (s *Server) handleHeat(v *volume, w http.ResponseWriter, r *http.Request) { } _ = v q := r.URL.Query() + // ?session=&device= is the run-card join: which paths that agent session + // read. Both are required — a session-only query would also return rows a + // member reported under someone else's session id, which pinning the row + // to the reporting device (handleReadReport) is what makes harmless. This + // is a filter INPUT only: nothing here or anywhere else enumerates + // sessions, and the response carries paths, no identities and no counts. + if session := q.Get("session"); session != "" || q.Get("device") != "" { + device := q.Get("device") + if session == "" || device == "" { + http.Error(w, "session and device must be given together", http.StatusBadRequest) + return + } + paths := s.Reads.SessionPaths(projectID(r), session, device) + if paths == nil { + paths = []string{} // an empty list, never a null the client must special-case + } + writeJSON(w, map[string]any{"paths": paths}) + return + } days := 30 if raw := q.Get("days"); raw != "" { var err error @@ -600,6 +787,10 @@ func (s *Server) handleReadReport(v *volume, w http.ResponseWriter, r *http.Requ var req struct { Reads []struct { Path string `json:"path"` + // Session is the agent session the read happened in — a CLIENT + // string, so it is only ever stored alongside the device the hub + // validated below, never on its own. See the row write. + Session string `json:"session,omitempty"` // Time is accepted for forward compatibility but buckets use // server time: client clocks are unreliable and late flushes are // telemetry noise, not data loss. @@ -656,6 +847,16 @@ func (s *Server) handleReadReport(v *volume, w http.ResponseWriter, r *http.Requ continue // no such file in this project: a read of nothing is not a read } s.Reads.Record(project, e.Path, ReadKindAgent, device) + // The session id is the one field here the hub cannot vouch for: it + // arrives in the body, so any member could report reads naming a + // teammate's session and paint files onto that teammate's run card. + // The row is therefore pinned to `device` — the id ownsDevice just + // validated — and the query side requires BOTH session and device, so + // a forged row can only ever be found under the forger's own device, + // which MayActAs guarantees is never someone else's. + if sess := trimText(e.Session, 128); sess != "" && journal.SafeText(sess) { + s.Reads.RecordSession(project, sess, device, e.Path) + } n++ } writeJSON(w, map[string]any{"accepted": n}) diff --git a/internal/webapp/sec_fixes11_test.go b/internal/webapp/sec_fixes11_test.go index 899b431..ecfb4f8 100644 --- a/internal/webapp/sec_fixes11_test.go +++ b/internal/webapp/sec_fixes11_test.go @@ -163,6 +163,10 @@ func TestSec_Store_AJournalsAuthorFieldsAreCheckedLikeItsNote(t *testing.T) { {"author", "Alice\x1b[2Kx", "C0 escape in author"}, {"user_name", "Bob\u202egnp.exe", "bidi override in user_name"}, {"user_name", "Bob\u0085\u009bx", "C1 control in user_name"}, + // Op.Session (BEA-98) is served by History and rendered next to the + // note, so it is the same class of peer-written free text. + {"session", "8f21e4\u202ex", "bidi override in session"}, + {"session", "8f21e4\x1b[2Kx", "C0 escape in session"}, } { op := map[string]any{ "device": bobDev, "path": "row-" + tc.field + ".md", diff --git a/internal/webapp/session_reads_test.go b/internal/webapp/session_reads_test.go new file mode 100644 index 0000000..4750b0e --- /dev/null +++ b/internal/webapp/session_reads_test.go @@ -0,0 +1,224 @@ +package webapp + +import ( + "encoding/json" + "net/http" + "net/http/httptest" + "path/filepath" + "strings" + "testing" + "time" +) + +// sessionHub is permHub with read telemetry that also keeps session detail — +// the shape a served hub has (cmd/bdrive/web.go). +func sessionHub(t *testing.T) (http.Handler, *Server, map[string]*http.Cookie, Project, string) { + t.Helper() + h, srv, c, p, root := permHubAt(t) + reads, err := OpenReadLedger(filepath.Join(t.TempDir(), "reads.json"), 0) + if err != nil { + t.Fatal(err) + } + srv.Reads = reads.WithSessions(OpenSessionReadRepo(filepath.Join(t.TempDir(), "sessions.json")), 0) + return h, srv, c, p, root +} + +func sessionPaths(t *testing.T, h http.Handler, p Project, c *http.Cookie, session, device string) []string { + t.Helper() + rec := doAs(t, h, "GET", + "/api/p/"+p.ID+"/heat?session="+session+"&device="+device, nil, c) + if rec.Code != 200 { + t.Fatalf("session heat: %d %s", rec.Code, rec.Body) + } + var out struct { + Paths []string `json:"paths"` + } + if err := json.Unmarshal(rec.Body.Bytes(), &out); err != nil { + t.Fatal(err) + } + return out.Paths +} + +func reportRead(t *testing.T, h http.Handler, p Project, c *http.Cookie, device string, reads []map[string]string) *httptest.ResponseRecorder { + t.Helper() + return secfixDo(t, h, "POST", "/api/p/"+p.ID+"/reads", + map[string]any{"reads": reads}, c, map[string]string{"X-Bdrive-Device": device}) +} + +// The join, end to end: a session's reads come back for the session+device +// pair its own ops carry, and only for files the project actually has. +func TestSessionReadsRoundTrip(t *testing.T) { + h, _, c, p, root := sessionHub(t) + f := newFakeRemoteAt(t, filepath.Join(root, p.ID)) + f.putAs("dev1", "alice@x.io", "Alice", "wiki/plan.md", "# plan") + f.putAs("dev1", "alice@x.io", "Alice", "wiki/spec.md", "# spec") + + // dev1 is alice's: one sync registers it, as /store/* traffic does. + if rec := secfixSync(t, h, p.ID, c["alice"], "dev1", "laptop", "mac"); rec.Code != 200 { + t.Fatalf("alice sync: %d %s", rec.Code, rec.Body) + } + rec := reportRead(t, h, p, c["alice"], "dev1", []map[string]string{ + {"path": "wiki/plan.md", "session": "8f21e4"}, + {"path": "wiki/spec.md", "session": "8f21e4"}, + {"path": "wiki/gone.md", "session": "8f21e4"}, // landmine 3: no such file, records nothing + {"path": "wiki/plan.md", "session": "other"}, // a different session, its own row + }) + if rec.Code != 200 { + t.Fatalf("report: %d %s", rec.Code, rec.Body) + } + + got := sessionPaths(t, h, p, c["alice"], "8f21e4", "dev1") + if len(got) != 2 || got[0] != "wiki/plan.md" || got[1] != "wiki/spec.md" { + t.Fatalf("session paths = %v, want plan.md + spec.md (gone.md is not in the project)", got) + } + if got := sessionPaths(t, h, p, c["alice"], "other", "dev1"); len(got) != 1 || got[0] != "wiki/plan.md" { + t.Fatalf("second session = %v, want only plan.md — sessions must not merge", got) + } + // A member who is not the reporting device still sees the run's reads: + // the card is project-wide, and this response carries no identities. + if got := sessionPaths(t, h, p, c["bob"], "8f21e4", "dev1"); len(got) != 2 { + t.Fatalf("member view = %v, want the same two paths", got) + } + // An unknown session is an empty list, never an error and never a hint + // that some other session exists. + if got := sessionPaths(t, h, p, c["alice"], "no-such-session", "dev1"); len(got) != 0 { + t.Fatalf("unknown session = %v, want empty", got) + } +} + +// Landmine 1's read-half twin: the session id in a read report is a CLIENT +// string, so bob can report reads naming alice's session. The row is pinned +// to the device the hub validated — bob's, never alice's — and the query +// requires both, so his rows can never surface on her run card. +func TestSessionReadsCannotBePaintedOntoAnotherDevicesRun(t *testing.T) { + h, srv, c, p, root := sessionHub(t) + f := newFakeRemoteAt(t, filepath.Join(root, p.ID)) + f.putAs("dev1", "alice@x.io", "Alice", "wiki/plan.md", "# plan") + f.putAs("dev1", "alice@x.io", "Alice", "payroll.md", "secret") + + // alice-mbp is claimed by alice, as `bdrive login` claims it + // (DeviceRegistry.Bind) — the state in which MayActAs has something to + // refuse. + srv.Devices.Observe(DeviceInfo{ID: "alice-mbp", Name: "laptop", OS: "mac", User: "alice@x.io"}) + if rec := secfixSync(t, h, p.ID, c["bob"], "bob-mbp", "laptop", "linux"); rec.Code != 200 { + t.Fatalf("bob sync: %d %s", rec.Code, rec.Body) + } + if rec := reportRead(t, h, p, c["alice"], "alice-mbp", []map[string]string{ + {"path": "wiki/plan.md", "session": "8f21e4"}, + }); rec.Code != 200 { + t.Fatalf("alice report: %d %s", rec.Code, rec.Body) + } + // bob reports under ALICE's session id, from his own device. + if rec := reportRead(t, h, p, c["bob"], "bob-mbp", []map[string]string{ + {"path": "payroll.md", "session": "8f21e4"}, + }); rec.Code != 200 { + t.Fatalf("bob report: %d %s", rec.Code, rec.Body) + } + // bob naming alice's DEVICE outright is refused by ownsDevice, so it + // records for nobody. + if rec := reportRead(t, h, p, c["bob"], "alice-mbp", []map[string]string{ + {"path": "payroll.md", "session": "8f21e4"}, + }); rec.Code != 200 { + t.Fatalf("bob's forged-device report: %d %s", rec.Code, rec.Body) + } + + got := sessionPaths(t, h, p, c["alice"], "8f21e4", "alice-mbp") + if len(got) != 1 || got[0] != "wiki/plan.md" { + t.Fatalf("alice's run card = %v, want only her own read — bob painted onto it", got) + } +} + +// The API shape: ?session= is a filter INPUT that requires its device, and +// the route is membership-gated exactly as /heat is. +func TestSessionHeatQueryContract(t *testing.T) { + h, _, c, p, _ := sessionHub(t) + base := "/api/p/" + p.ID + "/heat" + + for _, u := range []string{base + "?session=8f21e4", base + "?device=dev1"} { + if rec := doAs(t, h, "GET", u, nil, c["alice"]); rec.Code != 400 { + t.Fatalf("GET %s: %d, want 400 (session and device are required together)", u, rec.Code) + } + } + // dave is in no org here: a non-member is walled out of the session + // query exactly as they are out of plain heat. + for _, u := range []string{base, base + "?session=8f21e4&device=dev1"} { + if rec := doAs(t, h, "GET", u, nil, c["dave"]); rec.Code != http.StatusForbidden { + t.Fatalf("outsider GET %s: %d, want 403", u, rec.Code) + } + } +} + +// The privacy ruling, tested: nothing enumerates sessions. ?by=device output +// is byte-identical with session rows present, and plain /heat never grows a +// session column. +func TestSessionIdsAreNeverEnumerated(t *testing.T) { + h, _, c, p, root := sessionHub(t) + f := newFakeRemoteAt(t, filepath.Join(root, p.ID)) + f.putAs("dev1", "alice@x.io", "Alice", "wiki/plan.md", "# plan") + if rec := secfixSync(t, h, p.ID, c["alice"], "dev1", "laptop", "mac"); rec.Code != 200 { + t.Fatalf("alice sync: %d %s", rec.Code, rec.Body) + } + + if rec := reportRead(t, h, p, c["alice"], "dev1", []map[string]string{ + {"path": "wiki/plan.md", "session": "8f21e4"}, + }); rec.Code != 200 { + t.Fatalf("report: %d %s", rec.Code, rec.Body) + } + for _, body := range []string{ + doAs(t, h, "GET", "/api/p/"+p.ID+"/heat?by=device", nil, c["alice"]).Body.String(), + doAs(t, h, "GET", "/api/p/"+p.ID+"/heat", nil, c["alice"]).Body.String(), + } { + if strings.Contains(body, "8f21e4") || strings.Contains(body, "session") { + t.Fatalf("a heat response enumerated a session: %s", body) + } + } +} + +// Retention: session rows past the horizon are DELETED, not folded, and the +// path's heat totals — which were never derived from them — are unchanged. +func TestSessionReadRetentionPrunes(t *testing.T) { + repo := OpenSessionReadRepo(filepath.Join(t.TempDir(), "sessions.json")) + l, _ := openTestLedger(t, 0) + l.WithSessions(repo, 1) // one day + + l.Record("p-1", "a.md", ReadKindAgent, "dev1") + l.RecordSession("p-1", "old", "dev1", "a.md") + l.RecordSession("p-1", "new", "dev1", "a.md") + // Age the "old" session past the horizon, then force a prune. + l.mu.Lock() + for k, sr := range l.pendingSess { + if k.Session == "old" { + sr.Last = time.Now().UTC().Add(-48 * time.Hour) + l.pendingSess[k] = sr + } + } + l.lastSessPrun = time.Time{} + l.flushSessionsLocked() + l.mu.Unlock() + + if got, _ := repo.ListBySession("p-1", "old", "dev1"); len(got) != 0 { + t.Fatalf("expired session rows survived: %+v", got) + } + if got, _ := repo.ListBySession("p-1", "new", "dev1"); len(got) != 1 { + t.Fatalf("recent session rows = %+v, want the one row", got) + } + // The aggregate is untouched by any of it. + if e := l.Heat("p-1", "", time.Time{})["a.md"]; e.Agent != 1 { + t.Fatalf("heat after the session prune = %+v, want agent 1", e) + } +} + +// With no session repo the ledger behaves exactly as before: recording is a +// no-op and a lookup is empty, never a panic. +func TestSessionReadsOffByDefault(t *testing.T) { + l, _ := openTestLedger(t, 0) + l.RecordSession("p-1", "s1", "dev1", "a.md") + if got := l.SessionPaths("p-1", "s1", "dev1"); len(got) != 0 { + t.Fatalf("session paths with no repo = %v, want none", got) + } + var nilLedger *ReadLedger + nilLedger.RecordSession("p-1", "s1", "dev1", "a.md") + if got := nilLedger.SessionPaths("p-1", "s1", "dev1"); got != nil { + t.Fatalf("nil ledger = %v", got) + } +} diff --git a/internal/webapp/static/assets/index-C64R_Rr_.js b/internal/webapp/static/assets/index-C64R_Rr_.js deleted file mode 100644 index 4e1168c..0000000 --- a/internal/webapp/static/assets/index-C64R_Rr_.js +++ /dev/null @@ -1,122 +0,0 @@ -function y2(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 bw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Rh={exports:{}},Ps={};var lb;function b2(){if(lb)return Ps;lb=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 Ps.Fragment=n,Ps.jsx=r,Ps.jsxs=r,Ps}var cb;function x2(){return cb||(cb=1,Rh.exports=b2()),Rh.exports}var f=x2(),jh={exports:{}},Pe={};var ub;function w2(){if(ub)return Pe;ub=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"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),b=Symbol.iterator;function x(D){return D===null||typeof D!="object"?null:(D=b&&D[b]||D["@@iterator"],typeof D=="function"?D:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,E={};function R(D,M,B){this.props=D,this.context=M,this.refs=E,this.updater=B||w}R.prototype.isReactComponent={},R.prototype.setState=function(D,M){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,M,"setState")},R.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function T(){}T.prototype=R.prototype;function O(D,M,B){this.props=D,this.context=M,this.refs=E,this.updater=B||w}var N=O.prototype=new T;N.constructor=O,_(N,R.prototype),N.isPureReactComponent=!0;var L=Array.isArray;function P(){}var F={H:null,A:null,T:null,S:null},V=Object.prototype.hasOwnProperty;function ye(D,M,B){var J=B.ref;return{$$typeof:e,type:D,key:M,ref:J!==void 0?J:null,props:B}}function be(D,M){return ye(D.type,M,D.props)}function he(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function X(D){var M={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(B){return M[B]})}var ue=/\/+/g;function pe(D,M){return typeof D=="object"&&D!==null&&D.key!=null?X(""+D.key):M.toString(36)}function ge(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(P,P):(D.status="pending",D.then(function(M){D.status==="pending"&&(D.status="fulfilled",D.value=M)},function(M){D.status==="pending"&&(D.status="rejected",D.reason=M)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function k(D,M,B,J,Y){var le=typeof D;(le==="undefined"||le==="boolean")&&(D=null);var ae=!1;if(D===null)ae=!0;else switch(le){case"bigint":case"string":case"number":ae=!0;break;case"object":switch(D.$$typeof){case e:case n:ae=!0;break;case y:return ae=D._init,k(ae(D._payload),M,B,J,Y)}}if(ae)return Y=Y(D),ae=J===""?"."+pe(D,0):J,L(Y)?(B="",ae!=null&&(B=ae.replace(ue,"$&/")+"/"),k(Y,M,B,"",function(Oe){return Oe})):Y!=null&&(he(Y)&&(Y=be(Y,B+(Y.key==null||D&&D.key===Y.key?"":(""+Y.key).replace(ue,"$&/")+"/")+ae)),M.push(Y)),1;ae=0;var ve=J===""?".":J+":";if(L(D))for(var xe=0;xe>>1,te=k[W];if(0>>1;Ws(B,re))Js(Y,B)?(k[W]=Y,k[J]=re,W=J):(k[W]=B,k[M]=re,W=M);else if(Js(Y,re))k[W]=Y,k[J]=re,W=J;else break e}}return K}function s(k,K){var re=k.sortIndex-K.sortIndex;return re!==0?re:k.id-K.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 p=[],m=[],y=1,v=null,b=3,x=!1,w=!1,_=!1,E=!1,R=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function N(k){for(var K=r(m);K!==null;){if(K.callback===null)i(m);else if(K.startTime<=k)i(m),K.sortIndex=K.expirationTime,n(p,K);else break;K=r(m)}}function L(k){if(_=!1,N(k),!w)if(r(p)!==null)w=!0,P||(P=!0,X());else{var K=r(m);K!==null&&ge(L,K.startTime-k)}}var P=!1,F=-1,V=5,ye=-1;function be(){return E?!0:!(e.unstable_now()-yek&&be());){var W=v.callback;if(typeof W=="function"){v.callback=null,b=v.priorityLevel;var te=W(v.expirationTime<=k);if(k=e.unstable_now(),typeof te=="function"){v.callback=te,N(k),K=!0;break t}v===r(p)&&i(p),N(k)}else i(p);v=r(p)}if(v!==null)K=!0;else{var D=r(m);D!==null&&ge(L,D.startTime-k),K=!1}}break e}finally{v=null,b=re,x=!1}K=void 0}}finally{K?X():P=!1}}}var X;if(typeof O=="function")X=function(){O(he)};else if(typeof MessageChannel<"u"){var ue=new MessageChannel,pe=ue.port2;ue.port1.onmessage=he,X=function(){pe.postMessage(null)}}else X=function(){R(he,0)};function ge(k,K){F=R(function(){k(e.unstable_now())},K)}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(k){k.callback=null},e.unstable_forceFrameRate=function(k){0>k||125W?(k.sortIndex=re,n(m,k),r(p)===null&&k===r(m)&&(_?(T(F),F=-1):_=!0,ge(L,re-W))):(k.sortIndex=te,n(p,k),w||x||(w=!0,P||(P=!0,X()))),k},e.unstable_shouldYield=be,e.unstable_wrapCallback=function(k){var K=b;return function(){var re=b;b=K;try{return k.apply(this,arguments)}finally{b=re}}}})(Ah)),Ah}var hb;function _2(){return hb||(hb=1,Oh.exports=S2()),Oh.exports}var Mh={exports:{}},cn={};var mb;function C2(){if(mb)return cn;mb=1;var e=np();function n(p){var m="https://react.dev/errors/"+p;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Mh.exports=C2(),Mh.exports}var gb;function E2(){if(gb)return Fs;gb=1;var e=_2(),n=np(),r=xw();function i(t){var a="https://react.dev/errors/"+t;if(1te||(t.current=W[te],W[te]=null,te--)}function B(t,a){te++,W[te]=t.current,t.current=a}var J=D(null),Y=D(null),le=D(null),ae=D(null);function ve(t,a){switch(B(le,a),B(Y,t),B(J,null),a.nodeType){case 9:case 11:t=(t=a.documentElement)&&(t=t.namespaceURI)?M0(t):0;break;default:if(t=a.tagName,a=a.namespaceURI)a=M0(a),t=N0(a,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}M(J),B(J,t)}function xe(){M(J),M(Y),M(le)}function Oe(t){t.memoizedState!==null&&B(ae,t);var a=J.current,o=N0(a,t.type);a!==o&&(B(Y,t),B(J,o))}function Ie(t){Y.current===t&&(M(J),M(Y)),ae.current===t&&(M(ae),ks._currentValue=re)}var Ve,it;function Qe(t){if(Ve===void 0)try{throw Error()}catch(o){var a=o.stack.trim().match(/\n( *(at )?)/);Ve=a&&a[1]||"",it=-1)":-1h||z[c]!==G[h]){var ie=` -`+z[c].replace(" at new "," at ");return t.displayName&&ie.includes("")&&(ie=ie.replace("",t.displayName)),ie}while(1<=c&&0<=h);break}}}finally{fn=!1,Error.prepareStackTrace=o}return(o=t?t.displayName||t.name:"")?Qe(o):""}function Qt(t,a){switch(t.tag){case 26:case 27:case 5:return Qe(t.type);case 16:return Qe("Lazy");case 13:return t.child!==a&&a!==null?Qe("Suspense Fallback"):Qe("Suspense");case 19:return Qe("SuspenseList");case 0:case 15:return hn(t.type,!1);case 11:return hn(t.type.render,!1);case 1:return hn(t.type,!0);case 31:return Qe("Activity");default:return""}}function br(t){try{var a="",o=null;do a+=Qt(t,o),o=t,t=t.return;while(t);return a}catch(c){return` -Error generating stack: `+c.message+` -`+c.stack}}var jt=Object.prototype.hasOwnProperty,rr=e.unstable_scheduleCallback,xr=e.unstable_cancelCallback,Tt=e.unstable_shouldYield,Vn=e.unstable_requestPaint,Dt=e.unstable_now,kr=e.unstable_getCurrentPriorityLevel,ar=e.unstable_ImmediatePriority,ir=e.unstable_UserBlockingPriority,wr=e.unstable_NormalPriority,or=e.unstable_LowPriority,mn=e.unstable_IdlePriority,A=e.log,I=e.unstable_setDisableYieldValue,U=null,ce=null;function Z(t){if(typeof A=="function"&&I(t),ce&&typeof ce.setStrictMode=="function")try{ce.setStrictMode(U,t)}catch{}}var ne=Math.clz32?Math.clz32:Ee,de=Math.log,we=Math.LN2;function Ee(t){return t>>>=0,t===0?32:31-(de(t)/we|0)|0}var Xe=256,wt=262144,Xt=4194304;function zt(t){var a=t&42;if(a!==0)return a;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 Ne(t,a,o){var c=t.pendingLanes;if(c===0)return 0;var h=0,g=t.suspendedLanes,C=t.pingedLanes;t=t.warmLanes;var j=c&134217727;return j!==0?(c=j&~g,c!==0?h=zt(c):(C&=j,C!==0?h=zt(C):o||(o=j&~t,o!==0&&(h=zt(o))))):(j=c&~g,j!==0?h=zt(j):C!==0?h=zt(C):o||(o=c&~t,o!==0&&(h=zt(o)))),h===0?0:a!==0&&a!==h&&(a&g)===0&&(g=h&-h,o=a&-a,g>=o||g===32&&(o&4194048)!==0)?a:h}function ht(t,a){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&a)===0}function yt(t,a){switch(t){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 Bt(){var t=Xt;return Xt<<=1,(Xt&62914560)===0&&(Xt=4194304),t}function sr(t){for(var a=[],o=0;31>o;o++)a.push(t);return a}function St(t,a){t.pendingLanes|=a,a!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function yn(t,a,o,c,h,g){var C=t.pendingLanes;t.pendingLanes=o,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=o,t.entangledLanes&=o,t.errorRecoveryDisabledLanes&=o,t.shellSuspendCounter=0;var j=t.entanglements,z=t.expirationTimes,G=t.hiddenUpdates;for(o=C&~o;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var fE=/[\n"\\]/g;function Hn(t){return t.replace(fE,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function bd(t,a,o,c,h,g,C,j){t.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?t.type=C:t.removeAttribute("type"),a!=null?C==="number"?(a===0&&t.value===""||t.value!=a)&&(t.value=""+Un(a)):t.value!==""+Un(a)&&(t.value=""+Un(a)):C!=="submit"&&C!=="reset"||t.removeAttribute("value"),a!=null?xd(t,C,Un(a)):o!=null?xd(t,C,Un(o)):c!=null&&t.removeAttribute("value"),h==null&&g!=null&&(t.defaultChecked=!!g),h!=null&&(t.checked=h&&typeof h!="function"&&typeof h!="symbol"),j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?t.name=""+Un(j):t.removeAttribute("name")}function Eg(t,a,o,c,h,g,C,j){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(t.type=g),a!=null||o!=null){if(!(g!=="submit"&&g!=="reset"||a!=null)){yd(t);return}o=o!=null?""+Un(o):"",a=a!=null?""+Un(a):o,j||a===t.value||(t.value=a),t.defaultValue=a}c=c??h,c=typeof c!="function"&&typeof c!="symbol"&&!!c,t.checked=j?t.checked:!!c,t.defaultChecked=!!c,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(t.name=C),yd(t)}function xd(t,a,o){a==="number"&&Al(t.ownerDocument)===t||t.defaultValue===""+o||(t.defaultValue=""+o)}function Hi(t,a,o,c){if(t=t.options,a){a={};for(var h=0;h"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ed=!1;if(Ir)try{var Wo={};Object.defineProperty(Wo,"passive",{get:function(){Ed=!0}}),window.addEventListener("test",Wo,Wo),window.removeEventListener("test",Wo,Wo)}catch{Ed=!1}var la=null,Rd=null,Nl=null;function Ng(){if(Nl)return Nl;var t,a=Rd,o=a.length,c,h="value"in la?la.value:la.textContent,g=h.length;for(t=0;t=ns),Ig=" ",Pg=!1;function Fg(t,a){switch(t){case"keyup":return FE.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Zi=!1;function UE(t,a){switch(t){case"compositionend":return Vg(a);case"keypress":return a.which!==32?null:(Pg=!0,Ig);case"textInput":return t=a.data,t===Ig&&Pg?null:t;default:return null}}function HE(t,a){if(Zi)return t==="compositionend"||!Md&&Fg(t,a)?(t=Ng(),Nl=Rd=la=null,Zi=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1=a)return{node:o,offset:a-t};t=c}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Yg(o)}}function Xg(t,a){return t&&a?t===a?!0:t&&t.nodeType===3?!1:a&&a.nodeType===3?Xg(t,a.parentNode):"contains"in t?t.contains(a):t.compareDocumentPosition?!!(t.compareDocumentPosition(a)&16):!1:!1}function Jg(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var a=Al(t.document);a instanceof t.HTMLIFrameElement;){try{var o=typeof a.contentWindow.location.href=="string"}catch{o=!1}if(o)t=a.contentWindow;else break;a=Al(t.document)}return a}function zd(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a&&(a==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||a==="textarea"||t.contentEditable==="true")}var XE=Ir&&"documentMode"in document&&11>=document.documentMode,Ki=null,kd=null,os=null,Ld=!1;function Wg(t,a,o){var c=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Ld||Ki==null||Ki!==Al(c)||(c=Ki,"selectionStart"in c&&zd(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}),os&&is(os,c)||(os=c,c=Ec(kd,"onSelect"),0>=C,h-=C,Sr=1<<32-ne(a)+h|o<Ue?(Ze=Te,Te=null):Ze=Te.sibling;var et=Q(H,Te,q[Ue],oe);if(et===null){Te===null&&(Te=Ze);break}t&&Te&&et.alternate===null&&a(H,Te),$=g(et,$,Ue),We===null?Ae=et:We.sibling=et,We=et,Te=Ze}if(Ue===q.length)return o(H,Te),Ye&&Fr(H,Ue),Ae;if(Te===null){for(;UeUe?(Ze=Te,Te=null):Ze=Te.sibling;var Aa=Q(H,Te,et.value,oe);if(Aa===null){Te===null&&(Te=Ze);break}t&&Te&&Aa.alternate===null&&a(H,Te),$=g(Aa,$,Ue),We===null?Ae=Aa:We.sibling=Aa,We=Aa,Te=Ze}if(et.done)return o(H,Te),Ye&&Fr(H,Ue),Ae;if(Te===null){for(;!et.done;Ue++,et=q.next())et=se(H,et.value,oe),et!==null&&($=g(et,$,Ue),We===null?Ae=et:We.sibling=et,We=et);return Ye&&Fr(H,Ue),Ae}for(Te=c(Te);!et.done;Ue++,et=q.next())et=ee(Te,H,Ue,et.value,oe),et!==null&&(t&&et.alternate!==null&&Te.delete(et.key===null?Ue:et.key),$=g(et,$,Ue),We===null?Ae=et:We.sibling=et,We=et);return t&&Te.forEach(function(v2){return a(H,v2)}),Ye&&Fr(H,Ue),Ae}function lt(H,$,q,oe){if(typeof q=="object"&&q!==null&&q.type===_&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case x:e:{for(var Ae=q.key;$!==null;){if($.key===Ae){if(Ae=q.type,Ae===_){if($.tag===7){o(H,$.sibling),oe=h($,q.props.children),oe.return=H,H=oe;break e}}else if($.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===V&&ui(Ae)===$.type){o(H,$.sibling),oe=h($,q.props),fs(oe,q),oe.return=H,H=oe;break e}o(H,$);break}else a(H,$);$=$.sibling}q.type===_?(oe=ii(q.props.children,H.mode,oe,q.key),oe.return=H,H=oe):(oe=Ul(q.type,q.key,q.props,null,H.mode,oe),fs(oe,q),oe.return=H,H=oe)}return C(H);case w:e:{for(Ae=q.key;$!==null;){if($.key===Ae)if($.tag===4&&$.stateNode.containerInfo===q.containerInfo&&$.stateNode.implementation===q.implementation){o(H,$.sibling),oe=h($,q.children||[]),oe.return=H,H=oe;break e}else{o(H,$);break}else a(H,$);$=$.sibling}oe=Hd(q,H.mode,oe),oe.return=H,H=oe}return C(H);case V:return q=ui(q),lt(H,$,q,oe)}if(ge(q))return Re(H,$,q,oe);if(X(q)){if(Ae=X(q),typeof Ae!="function")throw Error(i(150));return q=Ae.call(q),De(H,$,q,oe)}if(typeof q.then=="function")return lt(H,$,Yl(q),oe);if(q.$$typeof===O)return lt(H,$,ql(H,q),oe);Ql(H,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,$!==null&&$.tag===6?(o(H,$.sibling),oe=h($,q),oe.return=H,H=oe):(o(H,$),oe=Ud(q,H.mode,oe),oe.return=H,H=oe),C(H)):o(H,$)}return function(H,$,q,oe){try{ds=0;var Ae=lt(H,$,q,oe);return io=null,Ae}catch(Te){if(Te===ao||Te===Zl)throw Te;var We=Nn(29,Te,null,H.mode);return We.lanes=oe,We.return=H,We}}}var fi=Sv(!0),_v=Sv(!1),ha=!1;function tf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function nf(t,a){t=t.updateQueue,a.updateQueue===t&&(a.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function ma(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function pa(t,a,o){var c=t.updateQueue;if(c===null)return null;if(c=c.shared,(tt&2)!==0){var h=c.pending;return h===null?a.next=a:(a.next=h.next,h.next=a),c.pending=a,a=Vl(t),ov(t,null,o),a}return Fl(t,c,a,o),Vl(t)}function hs(t,a,o){if(a=a.updateQueue,a!==null&&(a=a.shared,(o&4194048)!==0)){var c=a.lanes;c&=t.pendingLanes,o|=c,a.lanes=o,bn(t,o)}}function rf(t,a){var o=t.updateQueue,c=t.alternate;if(c!==null&&(c=c.updateQueue,o===c)){var h=null,g=null;if(o=o.firstBaseUpdate,o!==null){do{var C={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};g===null?h=g=C:g=g.next=C,o=o.next}while(o!==null);g===null?h=g=a:g=g.next=a}else h=g=a;o={baseState:c.baseState,firstBaseUpdate:h,lastBaseUpdate:g,shared:c.shared,callbacks:c.callbacks},t.updateQueue=o;return}t=o.lastBaseUpdate,t===null?o.firstBaseUpdate=a:t.next=a,o.lastBaseUpdate=a}var af=!1;function ms(){if(af){var t=ro;if(t!==null)throw t}}function ps(t,a,o,c){af=!1;var h=t.updateQueue;ha=!1;var g=h.firstBaseUpdate,C=h.lastBaseUpdate,j=h.shared.pending;if(j!==null){h.shared.pending=null;var z=j,G=z.next;z.next=null,C===null?g=G:C.next=G,C=z;var ie=t.alternate;ie!==null&&(ie=ie.updateQueue,j=ie.lastBaseUpdate,j!==C&&(j===null?ie.firstBaseUpdate=G:j.next=G,ie.lastBaseUpdate=z))}if(g!==null){var se=h.baseState;C=0,ie=G=z=null,j=g;do{var Q=j.lane&-536870913,ee=Q!==j.lane;if(ee?(Ge&Q)===Q:(c&Q)===Q){Q!==0&&Q===no&&(af=!0),ie!==null&&(ie=ie.next={lane:0,tag:j.tag,payload:j.payload,callback:null,next:null});e:{var Re=t,De=j;Q=a;var lt=o;switch(De.tag){case 1:if(Re=De.payload,typeof Re=="function"){se=Re.call(lt,se,Q);break e}se=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=De.payload,Q=typeof Re=="function"?Re.call(lt,se,Q):Re,Q==null)break e;se=v({},se,Q);break e;case 2:ha=!0}}Q=j.callback,Q!==null&&(t.flags|=64,ee&&(t.flags|=8192),ee=h.callbacks,ee===null?h.callbacks=[Q]:ee.push(Q))}else ee={lane:Q,tag:j.tag,payload:j.payload,callback:j.callback,next:null},ie===null?(G=ie=ee,z=se):ie=ie.next=ee,C|=Q;if(j=j.next,j===null){if(j=h.shared.pending,j===null)break;ee=j,j=ee.next,ee.next=null,h.lastBaseUpdate=ee,h.shared.pending=null}}while(!0);ie===null&&(z=se),h.baseState=z,h.firstBaseUpdate=G,h.lastBaseUpdate=ie,g===null&&(h.shared.lanes=0),xa|=C,t.lanes=C,t.memoizedState=se}}function Cv(t,a){if(typeof t!="function")throw Error(i(191,t));t.call(a)}function Ev(t,a){var o=t.callbacks;if(o!==null)for(t.callbacks=null,t=0;tg?g:8;var C=k.T,j={};k.T=j,Cf(t,!1,a,o);try{var z=h(),G=k.S;if(G!==null&&G(j,z),z!==null&&typeof z=="object"&&typeof z.then=="function"){var ie=oR(z,c);ys(t,a,ie,$n(t))}else ys(t,a,c,$n(t))}catch(se){ys(t,a,{then:function(){},status:"rejected",reason:se},$n())}finally{K.p=g,C!==null&&j.types!==null&&(C.types=j.types),k.T=C}}function fR(){}function Sf(t,a,o,c){if(t.tag!==5)throw Error(i(476));var h=ry(t).queue;ny(t,h,a,re,o===null?fR:function(){return ay(t),o(c)})}function ry(t){var a=t.memoizedState;if(a!==null)return a;a={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Br,lastRenderedState:re},next:null};var o={};return a.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Br,lastRenderedState:o},next:null},t.memoizedState=a,t=t.alternate,t!==null&&(t.memoizedState=a),a}function ay(t){var a=ry(t);a.next===null&&(a=t.alternate.memoizedState),ys(t,a.next.queue,{},$n())}function _f(){return en(ks)}function iy(){return At().memoizedState}function oy(){return At().memoizedState}function hR(t){for(var a=t.return;a!==null;){switch(a.tag){case 24:case 3:var o=$n();t=ma(o);var c=pa(a,t,o);c!==null&&(jn(c,a,o),hs(c,a,o)),a={cache:Xd()},t.payload=a;return}a=a.return}}function mR(t,a,o){var c=$n();o={lane:c,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},oc(t)?ly(a,o):(o=Fd(t,a,o,c),o!==null&&(jn(o,t,c),cy(o,a,c)))}function sy(t,a,o){var c=$n();ys(t,a,o,c)}function ys(t,a,o,c){var h={lane:c,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(oc(t))ly(a,h);else{var g=t.alternate;if(t.lanes===0&&(g===null||g.lanes===0)&&(g=a.lastRenderedReducer,g!==null))try{var C=a.lastRenderedState,j=g(C,o);if(h.hasEagerState=!0,h.eagerState=j,Mn(j,C))return Fl(t,a,h,0),ft===null&&Pl(),!1}catch{}if(o=Fd(t,a,h,c),o!==null)return jn(o,t,c),cy(o,a,c),!0}return!1}function Cf(t,a,o,c){if(c={lane:2,revertLane:nh(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},oc(t)){if(a)throw Error(i(479))}else a=Fd(t,o,c,2),a!==null&&jn(a,t,2)}function oc(t){var a=t.alternate;return t===Fe||a!==null&&a===Fe}function ly(t,a){so=Wl=!0;var o=t.pending;o===null?a.next=a:(a.next=o.next,o.next=a),t.pending=a}function cy(t,a,o){if((o&4194048)!==0){var c=a.lanes;c&=t.pendingLanes,o|=c,a.lanes=o,bn(t,o)}}var bs={readContext:en,use:nc,useCallback:Ct,useContext:Ct,useEffect:Ct,useImperativeHandle:Ct,useLayoutEffect:Ct,useInsertionEffect:Ct,useMemo:Ct,useReducer:Ct,useRef:Ct,useState:Ct,useDebugValue:Ct,useDeferredValue:Ct,useTransition:Ct,useSyncExternalStore:Ct,useId:Ct,useHostTransitionStatus:Ct,useFormState:Ct,useActionState:Ct,useOptimistic:Ct,useMemoCache:Ct,useCacheRefresh:Ct};bs.useEffectEvent=Ct;var uy={readContext:en,use:nc,useCallback:function(t,a){return pn().memoizedState=[t,a===void 0?null:a],t},useContext:en,useEffect:Zv,useImperativeHandle:function(t,a,o){o=o!=null?o.concat([t]):null,ac(4194308,4,Xv.bind(null,a,t),o)},useLayoutEffect:function(t,a){return ac(4194308,4,t,a)},useInsertionEffect:function(t,a){ac(4,2,t,a)},useMemo:function(t,a){var o=pn();a=a===void 0?null:a;var c=t();if(hi){Z(!0);try{t()}finally{Z(!1)}}return o.memoizedState=[c,a],c},useReducer:function(t,a,o){var c=pn();if(o!==void 0){var h=o(a);if(hi){Z(!0);try{o(a)}finally{Z(!1)}}}else h=a;return c.memoizedState=c.baseState=h,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:h},c.queue=t,t=t.dispatch=mR.bind(null,Fe,t),[c.memoizedState,t]},useRef:function(t){var a=pn();return t={current:t},a.memoizedState=t},useState:function(t){t=vf(t);var a=t.queue,o=sy.bind(null,Fe,a);return a.dispatch=o,[t.memoizedState,o]},useDebugValue:xf,useDeferredValue:function(t,a){var o=pn();return wf(o,t,a)},useTransition:function(){var t=vf(!1);return t=ny.bind(null,Fe,t.queue,!0,!1),pn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,a,o){var c=Fe,h=pn();if(Ye){if(o===void 0)throw Error(i(407));o=o()}else{if(o=a(),ft===null)throw Error(i(349));(Ge&127)!==0||Mv(c,a,o)}h.memoizedState=o;var g={value:o,getSnapshot:a};return h.queue=g,Zv(Dv.bind(null,c,g,t),[t]),c.flags|=2048,co(9,{destroy:void 0},Nv.bind(null,c,g,o,a),null),o},useId:function(){var t=pn(),a=ft.identifierPrefix;if(Ye){var o=_r,c=Sr;o=(c&~(1<<32-ne(c)-1)).toString(32)+o,a="_"+a+"R_"+o,o=ec++,0<\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof c.is=="string"?C.createElement("select",{is:c.is}):C.createElement("select"),c.multiple?g.multiple=!0:c.size&&(g.size=c.size);break;default:g=typeof c.is=="string"?C.createElement(h,{is:c.is}):C.createElement(h)}}g[Jt]=a,g[wn]=c;e:for(C=a.child;C!==null;){if(C.tag===5||C.tag===6)g.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===a)break e;for(;C.sibling===null;){if(C.return===null||C.return===a)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}a.stateNode=g;e:switch(nn(g,h,c),h){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Gr(a)}}return pt(a),If(a,a.type,t===null?null:t.memoizedProps,a.pendingProps,o),null;case 6:if(t&&a.stateNode!=null)t.memoizedProps!==c&&Gr(a);else{if(typeof c!="string"&&a.stateNode===null)throw Error(i(166));if(t=le.current,eo(a)){if(t=a.stateNode,o=a.memoizedProps,c=null,h=Wt,h!==null)switch(h.tag){case 27:case 5:c=h.memoizedProps}t[Jt]=a,t=!!(t.nodeValue===o||c!==null&&c.suppressHydrationWarning===!0||O0(t.nodeValue,o)),t||da(a,!0)}else t=Rc(t).createTextNode(c),t[Jt]=a,a.stateNode=t}return pt(a),null;case 31:if(o=a.memoizedState,t===null||t.memoizedState!==null){if(c=eo(a),o!==null){if(t===null){if(!c)throw Error(i(318));if(t=a.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(557));t[Jt]=a}else oi(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;pt(a),t=!1}else o=Zd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=o),t=!0;if(!t)return a.flags&256?(zn(a),a):(zn(a),null);if((a.flags&128)!==0)throw Error(i(558))}return pt(a),null;case 13:if(c=a.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=eo(a),c!==null&&c.dehydrated!==null){if(t===null){if(!h)throw Error(i(318));if(h=a.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(i(317));h[Jt]=a}else oi(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;pt(a),h=!1}else h=Zd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)return a.flags&256?(zn(a),a):(zn(a),null)}return zn(a),(a.flags&128)!==0?(a.lanes=o,a):(o=c!==null,t=t!==null&&t.memoizedState!==null,o&&(c=a.child,h=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(h=c.alternate.memoizedState.cachePool.pool),g=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(g=c.memoizedState.cachePool.pool),g!==h&&(c.flags|=2048)),o!==t&&o&&(a.child.flags|=8192),dc(a,a.updateQueue),pt(a),null);case 4:return xe(),t===null&&oh(a.stateNode.containerInfo),pt(a),null;case 10:return Ur(a.type),pt(a),null;case 19:if(M(Ot),c=a.memoizedState,c===null)return pt(a),null;if(h=(a.flags&128)!==0,g=c.rendering,g===null)if(h)ws(c,!1);else{if(Et!==0||t!==null&&(t.flags&128)!==0)for(t=a.child;t!==null;){if(g=Jl(t),g!==null){for(a.flags|=128,ws(c,!1),t=g.updateQueue,a.updateQueue=t,dc(a,t),a.subtreeFlags=0,t=o,o=a.child;o!==null;)sv(o,t),o=o.sibling;return B(Ot,Ot.current&1|2),Ye&&Fr(a,c.treeForkCount),a.child}t=t.sibling}c.tail!==null&&Dt()>gc&&(a.flags|=128,h=!0,ws(c,!1),a.lanes=4194304)}else{if(!h)if(t=Jl(g),t!==null){if(a.flags|=128,h=!0,t=t.updateQueue,a.updateQueue=t,dc(a,t),ws(c,!0),c.tail===null&&c.tailMode==="hidden"&&!g.alternate&&!Ye)return pt(a),null}else 2*Dt()-c.renderingStartTime>gc&&o!==536870912&&(a.flags|=128,h=!0,ws(c,!1),a.lanes=4194304);c.isBackwards?(g.sibling=a.child,a.child=g):(t=c.last,t!==null?t.sibling=g:a.child=g,c.last=g)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=Dt(),t.sibling=null,o=Ot.current,B(Ot,h?o&1|2:o&1),Ye&&Fr(a,c.treeForkCount),t):(pt(a),null);case 22:case 23:return zn(a),sf(),c=a.memoizedState!==null,t!==null?t.memoizedState!==null!==c&&(a.flags|=8192):c&&(a.flags|=8192),c?(o&536870912)!==0&&(a.flags&128)===0&&(pt(a),a.subtreeFlags&6&&(a.flags|=8192)):pt(a),o=a.updateQueue,o!==null&&dc(a,o.retryQueue),o=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(o=t.memoizedState.cachePool.pool),c=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(c=a.memoizedState.cachePool.pool),c!==o&&(a.flags|=2048),t!==null&&M(ci),null;case 24:return o=null,t!==null&&(o=t.memoizedState.cache),a.memoizedState.cache!==o&&(a.flags|=2048),Ur(kt),pt(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function bR(t,a){switch(qd(a),a.tag){case 1:return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 3:return Ur(kt),xe(),t=a.flags,(t&65536)!==0&&(t&128)===0?(a.flags=t&-65537|128,a):null;case 26:case 27:case 5:return Ie(a),null;case 31:if(a.memoizedState!==null){if(zn(a),a.alternate===null)throw Error(i(340));oi()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 13:if(zn(a),t=a.memoizedState,t!==null&&t.dehydrated!==null){if(a.alternate===null)throw Error(i(340));oi()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 19:return M(Ot),null;case 4:return xe(),null;case 10:return Ur(a.type),null;case 22:case 23:return zn(a),sf(),t!==null&&M(ci),t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 24:return Ur(kt),null;case 25:return null;default:return null}}function zy(t,a){switch(qd(a),a.tag){case 3:Ur(kt),xe();break;case 26:case 27:case 5:Ie(a);break;case 4:xe();break;case 31:a.memoizedState!==null&&zn(a);break;case 13:zn(a);break;case 19:M(Ot);break;case 10:Ur(a.type);break;case 22:case 23:zn(a),sf(),t!==null&&M(ci);break;case 24:Ur(kt)}}function Ss(t,a){try{var o=a.updateQueue,c=o!==null?o.lastEffect:null;if(c!==null){var h=c.next;o=h;do{if((o.tag&t)===t){c=void 0;var g=o.create,C=o.inst;c=g(),C.destroy=c}o=o.next}while(o!==h)}}catch(j){at(a,a.return,j)}}function ya(t,a,o){try{var c=a.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var g=h.next;c=g;do{if((c.tag&t)===t){var C=c.inst,j=C.destroy;if(j!==void 0){C.destroy=void 0,h=a;var z=o,G=j;try{G()}catch(ie){at(h,z,ie)}}}c=c.next}while(c!==g)}}catch(ie){at(a,a.return,ie)}}function ky(t){var a=t.updateQueue;if(a!==null){var o=t.stateNode;try{Ev(a,o)}catch(c){at(t,t.return,c)}}}function Ly(t,a,o){o.props=mi(t.type,t.memoizedProps),o.state=t.memoizedState;try{o.componentWillUnmount()}catch(c){at(t,a,c)}}function _s(t,a){try{var o=t.ref;if(o!==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 o=="function"?t.refCleanup=o(c):o.current=c}}catch(h){at(t,a,h)}}function Cr(t,a){var o=t.ref,c=t.refCleanup;if(o!==null)if(typeof c=="function")try{c()}catch(h){at(t,a,h)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(h){at(t,a,h)}else o.current=null}function $y(t){var a=t.type,o=t.memoizedProps,c=t.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":o.autoFocus&&c.focus();break e;case"img":o.src?c.src=o.src:o.srcSet&&(c.srcset=o.srcSet)}}catch(h){at(t,t.return,h)}}function Pf(t,a,o){try{var c=t.stateNode;VR(c,t.type,o,a),c[wn]=a}catch(h){at(t,t.return,h)}}function Iy(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Ea(t.type)||t.tag===4}function Ff(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Iy(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&&Ea(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 Vf(t,a,o){var c=t.tag;if(c===5||c===6)t=t.stateNode,a?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(t,a):(a=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,a.appendChild(t),o=o._reactRootContainer,o!=null||a.onclick!==null||(a.onclick=$r));else if(c!==4&&(c===27&&Ea(t.type)&&(o=t.stateNode,a=null),t=t.child,t!==null))for(Vf(t,a,o),t=t.sibling;t!==null;)Vf(t,a,o),t=t.sibling}function fc(t,a,o){var c=t.tag;if(c===5||c===6)t=t.stateNode,a?o.insertBefore(t,a):o.appendChild(t);else if(c!==4&&(c===27&&Ea(t.type)&&(o=t.stateNode),t=t.child,t!==null))for(fc(t,a,o),t=t.sibling;t!==null;)fc(t,a,o),t=t.sibling}function Py(t){var a=t.stateNode,o=t.memoizedProps;try{for(var c=t.type,h=a.attributes;h.length;)a.removeAttributeNode(h[0]);nn(a,c,o),a[Jt]=t,a[wn]=o}catch(g){at(t,t.return,g)}}var Zr=!1,It=!1,Uf=!1,Fy=typeof WeakSet=="function"?WeakSet:Set,Gt=null;function xR(t,a){if(t=t.containerInfo,ch=Dc,t=Jg(t),zd(t)){if("selectionStart"in t)var o={start:t.selectionStart,end:t.selectionEnd};else e:{o=(o=t.ownerDocument)&&o.defaultView||window;var c=o.getSelection&&o.getSelection();if(c&&c.rangeCount!==0){o=c.anchorNode;var h=c.anchorOffset,g=c.focusNode;c=c.focusOffset;try{o.nodeType,g.nodeType}catch{o=null;break e}var C=0,j=-1,z=-1,G=0,ie=0,se=t,Q=null;t:for(;;){for(var ee;se!==o||h!==0&&se.nodeType!==3||(j=C+h),se!==g||c!==0&&se.nodeType!==3||(z=C+c),se.nodeType===3&&(C+=se.nodeValue.length),(ee=se.firstChild)!==null;)Q=se,se=ee;for(;;){if(se===t)break t;if(Q===o&&++G===h&&(j=C),Q===g&&++ie===c&&(z=C),(ee=se.nextSibling)!==null)break;se=Q,Q=se.parentNode}se=ee}o=j===-1||z===-1?null:{start:j,end:z}}else o=null}o=o||{start:0,end:0}}else o=null;for(uh={focusedElem:t,selectionRange:o},Dc=!1,Gt=a;Gt!==null;)if(a=Gt,t=a.child,(a.subtreeFlags&1028)!==0&&t!==null)t.return=a,Gt=t;else for(;Gt!==null;){switch(a=Gt,g=a.alternate,t=a.flags,a.tag){case 0:if((t&4)!==0&&(t=a.updateQueue,t=t!==null?t.events:null,t!==null))for(o=0;o title"))),nn(g,c,o),g[Jt]=t,qt(g),c=g;break e;case"link":var C=G0("link","href",h).get(c+(o.href||""));if(C){for(var j=0;jlt&&(C=lt,lt=De,De=C);var H=Qg(j,De),$=Qg(j,lt);if(H&&$&&(ee.rangeCount!==1||ee.anchorNode!==H.node||ee.anchorOffset!==H.offset||ee.focusNode!==$.node||ee.focusOffset!==$.offset)){var q=se.createRange();q.setStart(H.node,H.offset),ee.removeAllRanges(),De>lt?(ee.addRange(q),ee.extend($.node,$.offset)):(q.setEnd($.node,$.offset),ee.addRange(q))}}}}for(se=[],ee=j;ee=ee.parentNode;)ee.nodeType===1&&se.push({element:ee,left:ee.scrollLeft,top:ee.scrollTop});for(typeof j.focus=="function"&&j.focus(),j=0;jo?32:o,k.T=null,o=Yf,Yf=null;var g=Sa,C=Jr;if(Vt=0,po=Sa=null,Jr=0,(tt&6)!==0)throw Error(i(331));var j=tt;if(tt|=4,Xy(g.current),Ky(g,g.current,C,o),tt=j,Os(0,!1),ce&&typeof ce.onPostCommitFiberRoot=="function")try{ce.onPostCommitFiberRoot(U,g)}catch{}return!0}finally{K.p=h,k.T=c,p0(t,a)}}function v0(t,a,o){a=qn(o,a),a=Tf(t.stateNode,a,2),t=pa(t,a,2),t!==null&&(St(t,2),Er(t))}function at(t,a,o){if(t.tag===3)v0(t,t,o);else for(;a!==null;){if(a.tag===3){v0(a,t,o);break}else if(a.tag===1){var c=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(wa===null||!wa.has(c))){t=qn(o,t),o=yy(2),c=pa(a,o,2),c!==null&&(by(o,c,a,t),St(c,2),Er(c));break}}a=a.return}}function Wf(t,a,o){var c=t.pingCache;if(c===null){c=t.pingCache=new _R;var h=new Set;c.set(a,h)}else h=c.get(a),h===void 0&&(h=new Set,c.set(a,h));h.has(o)||(qf=!0,h.add(o),t=TR.bind(null,t,a,o),a.then(t,t))}function TR(t,a,o){var c=t.pingCache;c!==null&&c.delete(a),t.pingedLanes|=t.suspendedLanes&o,t.warmLanes&=~o,ft===t&&(Ge&o)===o&&(Et===4||Et===3&&(Ge&62914560)===Ge&&300>Dt()-pc?(tt&2)===0&&go(t,0):Gf|=o,mo===Ge&&(mo=0)),Er(t)}function y0(t,a){a===0&&(a=Bt()),t=ai(t,a),t!==null&&(St(t,a),Er(t))}function OR(t){var a=t.memoizedState,o=0;a!==null&&(o=a.retryLane),y0(t,o)}function AR(t,a){var o=0;switch(t.tag){case 31:case 13:var c=t.stateNode,h=t.memoizedState;h!==null&&(o=h.retryLane);break;case 19:c=t.stateNode;break;case 22:c=t.stateNode._retryCache;break;default:throw Error(i(314))}c!==null&&c.delete(a),y0(t,o)}function MR(t,a){return rr(t,a)}var Sc=null,yo=null,eh=!1,_c=!1,th=!1,Ca=0;function Er(t){t!==yo&&t.next===null&&(yo===null?Sc=yo=t:yo=yo.next=t),_c=!0,eh||(eh=!0,DR())}function Os(t,a){if(!th&&_c){th=!0;do for(var o=!1,c=Sc;c!==null;){if(t!==0){var h=c.pendingLanes;if(h===0)var g=0;else{var C=c.suspendedLanes,j=c.pingedLanes;g=(1<<31-ne(42|t)+1)-1,g&=h&~(C&~j),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(o=!0,S0(c,g))}else g=Ge,g=Ne(c,c===ft?g:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(g&3)===0||ht(c,g)||(o=!0,S0(c,g));c=c.next}while(o);th=!1}}function NR(){b0()}function b0(){_c=eh=!1;var t=0;Ca!==0&&HR()&&(t=Ca);for(var a=Dt(),o=null,c=Sc;c!==null;){var h=c.next,g=x0(c,a);g===0?(c.next=null,o===null?Sc=h:o.next=h,h===null&&(yo=o)):(o=c,(t!==0||(g&3)!==0)&&(_c=!0)),c=h}Vt!==0&&Vt!==5||Os(t),Ca!==0&&(Ca=0)}function x0(t,a){for(var o=t.suspendedLanes,c=t.pingedLanes,h=t.expirationTimes,g=t.pendingLanes&-62914561;0j)break;var ie=z.transferSize,se=z.initiatorType;ie&&A0(se)&&(z=z.responseEnd,C+=ie*(z"u"?null:document;function U0(t,a,o){var c=bo;if(c&&typeof a=="string"&&a){var h=Hn(a);h='link[rel="'+t+'"][href="'+h+'"]',typeof o=="string"&&(h+='[crossorigin="'+o+'"]'),V0.has(h)||(V0.add(h),t={rel:t,crossOrigin:o,href:a},c.querySelector(h)===null&&(a=c.createElement("link"),nn(a,"link",t),qt(a),c.head.appendChild(a)))}}function JR(t){Wr.D(t),U0("dns-prefetch",t,null)}function WR(t,a){Wr.C(t,a),U0("preconnect",t,a)}function e2(t,a,o){Wr.L(t,a,o);var c=bo;if(c&&t&&a){var h='link[rel="preload"][as="'+Hn(a)+'"]';a==="image"&&o&&o.imageSrcSet?(h+='[imagesrcset="'+Hn(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(h+='[imagesizes="'+Hn(o.imageSizes)+'"]')):h+='[href="'+Hn(t)+'"]';var g=h;switch(a){case"style":g=xo(t);break;case"script":g=wo(t)}Xn.has(g)||(t=v({rel:"preload",href:a==="image"&&o&&o.imageSrcSet?void 0:t,as:a},o),Xn.set(g,t),c.querySelector(h)!==null||a==="style"&&c.querySelector(Ds(g))||a==="script"&&c.querySelector(zs(g))||(a=c.createElement("link"),nn(a,"link",t),qt(a),c.head.appendChild(a)))}}function t2(t,a){Wr.m(t,a);var o=bo;if(o&&t){var c=a&&typeof a.as=="string"?a.as:"script",h='link[rel="modulepreload"][as="'+Hn(c)+'"][href="'+Hn(t)+'"]',g=h;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=wo(t)}if(!Xn.has(g)&&(t=v({rel:"modulepreload",href:t},a),Xn.set(g,t),o.querySelector(h)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(zs(g)))return}c=o.createElement("link"),nn(c,"link",t),qt(c),o.head.appendChild(c)}}}function n2(t,a,o){Wr.S(t,a,o);var c=bo;if(c&&t){var h=Vi(c).hoistableStyles,g=xo(t);a=a||"default";var C=h.get(g);if(!C){var j={loading:0,preload:null};if(C=c.querySelector(Ds(g)))j.loading=5;else{t=v({rel:"stylesheet",href:t,"data-precedence":a},o),(o=Xn.get(g))&&vh(t,o);var z=C=c.createElement("link");qt(z),nn(z,"link",t),z._p=new Promise(function(G,ie){z.onload=G,z.onerror=ie}),z.addEventListener("load",function(){j.loading|=1}),z.addEventListener("error",function(){j.loading|=2}),j.loading|=4,Tc(C,a,c)}C={type:"stylesheet",instance:C,count:1,state:j},h.set(g,C)}}}function r2(t,a){Wr.X(t,a);var o=bo;if(o&&t){var c=Vi(o).hoistableScripts,h=wo(t),g=c.get(h);g||(g=o.querySelector(zs(h)),g||(t=v({src:t,async:!0},a),(a=Xn.get(h))&&yh(t,a),g=o.createElement("script"),qt(g),nn(g,"link",t),o.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},c.set(h,g))}}function a2(t,a){Wr.M(t,a);var o=bo;if(o&&t){var c=Vi(o).hoistableScripts,h=wo(t),g=c.get(h);g||(g=o.querySelector(zs(h)),g||(t=v({src:t,async:!0,type:"module"},a),(a=Xn.get(h))&&yh(t,a),g=o.createElement("script"),qt(g),nn(g,"link",t),o.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},c.set(h,g))}}function H0(t,a,o,c){var h=(h=le.current)?jc(h):null;if(!h)throw Error(i(446));switch(t){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(a=xo(o.href),o=Vi(h).hoistableStyles,c=o.get(a),c||(c={type:"style",instance:null,count:0,state:null},o.set(a,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){t=xo(o.href);var g=Vi(h).hoistableStyles,C=g.get(t);if(C||(h=h.ownerDocument||h,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(t,C),(g=h.querySelector(Ds(t)))&&!g._p&&(C.instance=g,C.state.loading=5),Xn.has(t)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},Xn.set(t,o),g||i2(h,t,o,C.state))),a&&c===null)throw Error(i(528,""));return C}if(a&&c!==null)throw Error(i(529,""));return null;case"script":return a=o.async,o=o.src,typeof o=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=wo(o),o=Vi(h).hoistableScripts,c=o.get(a),c||(c={type:"script",instance:null,count:0,state:null},o.set(a,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,t))}}function xo(t){return'href="'+Hn(t)+'"'}function Ds(t){return'link[rel="stylesheet"]['+t+"]"}function B0(t){return v({},t,{"data-precedence":t.precedence,precedence:null})}function i2(t,a,o,c){t.querySelector('link[rel="preload"][as="style"]['+a+"]")?c.loading=1:(a=t.createElement("link"),c.preload=a,a.addEventListener("load",function(){return c.loading|=1}),a.addEventListener("error",function(){return c.loading|=2}),nn(a,"link",o),qt(a),t.head.appendChild(a))}function wo(t){return'[src="'+Hn(t)+'"]'}function zs(t){return"script[async]"+t}function q0(t,a,o){if(a.count++,a.instance===null)switch(a.type){case"style":var c=t.querySelector('style[data-href~="'+Hn(o.href)+'"]');if(c)return a.instance=c,qt(c),c;var h=v({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return c=(t.ownerDocument||t).createElement("style"),qt(c),nn(c,"style",h),Tc(c,o.precedence,t),a.instance=c;case"stylesheet":h=xo(o.href);var g=t.querySelector(Ds(h));if(g)return a.state.loading|=4,a.instance=g,qt(g),g;c=B0(o),(h=Xn.get(h))&&vh(c,h),g=(t.ownerDocument||t).createElement("link"),qt(g);var C=g;return C._p=new Promise(function(j,z){C.onload=j,C.onerror=z}),nn(g,"link",c),a.state.loading|=4,Tc(g,o.precedence,t),a.instance=g;case"script":return g=wo(o.src),(h=t.querySelector(zs(g)))?(a.instance=h,qt(h),h):(c=o,(h=Xn.get(g))&&(c=v({},o),yh(c,h)),t=t.ownerDocument||t,h=t.createElement("script"),qt(h),nn(h,"link",c),t.head.appendChild(h),a.instance=h);case"void":return null;default:throw Error(i(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(c=a.instance,a.state.loading|=4,Tc(c,o.precedence,t));return a.instance}function Tc(t,a,o){for(var c=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=c.length?c[c.length-1]:null,g=h,C=0;C title"):null)}function o2(t,a,o){if(o===1||a.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(t=a.disabled,typeof a.precedence=="string"&&t==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function K0(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function s2(t,a,o,c){if(o.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var h=xo(c.href),g=a.querySelector(Ds(h));if(g){a=g._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(t.count++,t=Ac.bind(t),a.then(t,t)),o.state.loading|=4,o.instance=g,qt(g);return}g=a.ownerDocument||a,c=B0(c),(h=Xn.get(h))&&vh(c,h),g=g.createElement("link"),qt(g);var C=g;C._p=new Promise(function(j,z){C.onload=j,C.onerror=z}),nn(g,"link",c),o.instance=g}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(o,a),(a=o.state.preload)&&(o.state.loading&3)===0&&(t.count++,o=Ac.bind(t),a.addEventListener("load",o),a.addEventListener("error",o))}}var bh=0;function l2(t,a){return t.stylesheets&&t.count===0&&Nc(t,t.stylesheets),0bh?50:800)+a);return t.unsuspend=o,function(){t.unsuspend=null,clearTimeout(c),clearTimeout(h)}}:null}function Ac(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Nc(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Mc=null;function Nc(t,a){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Mc=new Map,a.forEach(c2,t),Mc=null,Ac.call(t))}function c2(t,a){if(!(a.state.loading&4)){var o=Mc.get(t);if(o)var c=o.get(null);else{o=new Map,Mc.set(t,o);for(var h=t.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Th.exports=E2(),Th.exports}var j2=R2(),pl=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(){}},T2=class extends pl{#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"}},rp=new T2,O2={setTimeout:(e,n)=>setTimeout(e,n),clearTimeout:e=>clearTimeout(e),setInterval:(e,n)=>setInterval(e,n),clearInterval:e=>clearInterval(e)},A2=class{#e=O2;#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)}},xi=new A2;function M2(e){setTimeout(e,0)}var N2=typeof window>"u"||"Deno"in globalThis;function On(){}function D2(e,n){return typeof e=="function"?e(n):e}function um(e){return typeof e=="number"&&e>=0&&e!==1/0}function ww(e,n){return Math.max(e+(n||0)-Date.now(),0)}function La(e,n){return typeof e=="function"?e(n):e}function In(e,n){return typeof e=="function"?e(n):e}function yb(e,n){const{type:r="all",exact:i,fetchStatus:s,predicate:l,queryKey:u,stale:d}=e;if(u){if(i){if(n.queryHash!==ap(u,n.options))return!1}else if(!nl(n.queryKey,u))return!1}if(r!=="all"){const p=n.isActive();if(r==="active"&&!p||r==="inactive"&&p)return!1}return!(typeof d=="boolean"&&n.isStale()!==d||s&&s!==n.state.fetchStatus||l&&!l(n))}function bb(e,n){const{exact:r,status:i,predicate:s,mutationKey:l}=e;if(l){if(!n.options.mutationKey)return!1;if(r){if(tl(n.options.mutationKey)!==tl(l))return!1}else if(!nl(n.options.mutationKey,l))return!1}return!(i&&n.state.status!==i||s&&!s(n))}function ap(e,n){return(n?.queryKeyHashFn||tl)(e)}function tl(e){return JSON.stringify(e,(n,r)=>fm(r)?Object.keys(r).sort().reduce((i,s)=>(i[s]=r[s],i),{}):r)}function nl(e,n){return e===n?!0:typeof e!=typeof n?!1:e&&n&&typeof e=="object"&&typeof n=="object"?Object.keys(n).every(r=>nl(e[r],n[r])):!1}var z2=Object.prototype.hasOwnProperty;function Sw(e,n,r=0){if(e===n)return e;if(r>500)return n;const i=xb(e)&&xb(n);if(!i&&!(fm(e)&&fm(n)))return n;const l=(i?e:Object.keys(e)).length,u=i?n:Object.keys(n),d=u.length,p=i?new Array(d):{};let m=0;for(let y=0;y{xi.setTimeout(n,e)})}function hm(e,n,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,n):r.structuralSharing!==!1?Sw(e,n):n}function L2(e,n,r=0){const i=[...e,n];return r&&i.length>r?i.slice(1):i}function $2(e,n,r=0){const i=[n,...e];return r&&i.length>r?i.slice(0,-1):i}var ip=Symbol();function _w(e,n){return!e.queryFn&&n?.initialPromise?()=>n.initialPromise:!e.queryFn||e.queryFn===ip?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Cw(e,n){return typeof e=="function"?e(...n):!!e}function I2(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 rl=(()=>{let e=()=>N2;return{isServer(){return e()},setIsServer(n){e=n}}})();function mm(){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 P2=M2;function F2(){let e=[],n=0,r=d=>{d()},i=d=>{d()},s=P2;const l=d=>{n?e.push(d):s(()=>{r(d)})},u=()=>{const d=e;e=[],d.length&&s(()=>{i(()=>{d.forEach(p=>{r(p)})})})};return{batch:d=>{let p;n++;try{p=d()}finally{n--,n||u()}return p},batchCalls:d=>(...p)=>{l(()=>{d(...p)})},schedule:l,setNotifyFunction:d=>{r=d},setBatchNotifyFunction:d=>{i=d},setScheduler:d=>{s=d}}}var on=F2(),V2=class extends pl{#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}},fu=new V2;function U2(e){return Math.min(1e3*2**e,3e4)}function Ew(e){return(e??"online")==="online"?fu.isOnline():!0}var pm=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Rw(e){let n=!1,r=0,i;const s=mm(),l=()=>s.status!=="pending",u=_=>{if(!l()){const E=new pm(_);b(E),e.onCancel?.(E)}},d=()=>{n=!0},p=()=>{n=!1},m=()=>rp.isFocused()&&(e.networkMode==="always"||fu.isOnline())&&e.canRun(),y=()=>Ew(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?.()}),w=()=>{if(l())return;let _;const E=r===0?e.initialPromise:void 0;try{_=E??e.fn()}catch(R){_=Promise.reject(R)}Promise.resolve(_).then(v).catch(R=>{if(l())return;const T=e.retry??(rl.isServer()?0:3),O=e.retryDelay??U2,N=typeof O=="function"?O(r,R):O,L=T===!0||typeof T=="number"&&rm()?void 0:x()).then(()=>{n?b(R):w()})})};return{promise:s,status:()=>s.status,cancel:u,continue:()=>(i?.(),s),cancelRetry:d,continueRetry:p,canStart:y,start:()=>(y()?w():x().then(w),s)}}var jw=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),um(this.gcTime)&&(this.#e=xi.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(rl.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(xi.clearTimeout(this.#e),this.#e=void 0)}};function H2(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:[]},p=0;const m=async()=>{let y=!1;const v=w=>{I2(w,()=>n.signal,()=>y=!0)},b=_w(n.options,n.fetchOptions),x=async(w,_,E)=>{if(y)return Promise.reject(n.signal.reason);if(_==null&&w.pages.length)return Promise.resolve(w);const T=(()=>{const P={client:n.client,queryKey:n.queryKey,pageParam:_,direction:E?"backward":"forward",meta:n.options.meta};return v(P),P})(),O=await b(T),{maxPages:N}=n.options,L=E?$2:L2;return{pages:L(w.pages,O,N),pageParams:L(w.pageParams,_,N)}};if(s&&l.length){const w=s==="backward",_=w?Tw:gm,E={pages:l,pageParams:u},R=_(i,E);d=await x(E,R,w)}else{const w=e??l.length;do{const _=p===0?u[0]??i.initialPageParam:gm(i,d);if(p>0&&_==null)break;d=await x(d,_),p++}while(pn.options.persister?.(m,{client:n.client,queryKey:n.queryKey,meta:n.options.meta,signal:n.signal},r):n.fetchFn=m}}}function gm(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 Tw(e,{pages:n,pageParams:r}){return n.length>0?e.getPreviousPageParam?.(n[0],n,r[0],r):void 0}function B2(e,n){return n?gm(e,n)!=null:!1}function q2(e,n){return!n||!e.getPreviousPageParam?!1:Tw(e,n)!=null}var G2=class extends jw{#e;#t;#n;#r;#i;#a;#s;#o;constructor(e){super(),this.#o=!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=_b(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.#a?.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=_b(this.options);n.data!==void 0&&(this.setState(Sb(n.data,n.dataUpdatedAt)),this.#t=n)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,n){const r=hm(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.#a?.promise;return this.#a?.cancel(e),n?n.then(On).catch(On):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=>In(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ip||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>La(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:!ww(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(n=>n.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(n=>n.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.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.#a&&(this.#o||this.#u()?this.#a.cancel({revert:!0}):this.#a.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.#a?.status()!=="rejected"){if(this.state.data!==void 0&&n?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){const p=this.observers.find(m=>m.options.queryFn);p&&this.setOptions(p.options)}const r=new AbortController,i=p=>{Object.defineProperty(p,"signal",{enumerable:!0,get:()=>(this.#o=!0,r.signal)})},s=()=>{const p=_w(this.options,n),y=(()=>{const v={client:this.#i,queryKey:this.queryKey,meta:this.meta};return i(v),v})();return this.#o=!1,this.options.persister?this.options.persister(p,y,this):p(y)},u=(()=>{const p={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:s};return i(p),p})();(this.#e==="infinite"?H2(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.#a=Rw({initialPromise:n?.initialPromise,fn:u.fetchFn,onCancel:p=>{p instanceof pm&&p.revert&&this.setState({...this.#n,fetchStatus:"idle"}),r.abort()},onFail:(p,m)=>{this.#l({type:"failed",failureCount:p,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 p=await this.#a.start();if(p===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(p),this.#r.config.onSuccess?.(p,this),this.#r.config.onSettled?.(p,this.state.error,this),p}catch(p){if(p instanceof pm){if(p.silent)return this.#a.promise;if(p.revert){if(this.state.data===void 0)throw p;return this.state.data}}throw this.#l({type:"error",error:p}),this.#r.config.onError?.(p,this),this.#r.config.onSettled?.(this.state.data,p,this),p}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,...Ow(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...Sb(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),on.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function Ow(e,n){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ew(n.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Sb(e,n){return{data:e,dataUpdatedAt:n??Date.now(),error:null,isInvalidated:!1,status:"success"}}function _b(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 Aw=class extends pl{constructor(e,n){super(),this.options=n,this.#e=e,this.#o=null,this.#s=mm(),this.bindMethods(),this.setOptions(n)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#s;#o;#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),Cb(this.#t,this.options)?this.#h():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return vm(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return vm(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#w(),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 In(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),n._defaulted&&!dm(this.options,n)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const i=this.hasListeners();i&&Eb(this.#t,r,this.options,n)&&this.#h(),this.updateResult(),i&&(this.#t!==r||In(this.options.enabled,this.#t)!==In(n.enabled,this.#t)||La(this.options.staleTime,this.#t)!==La(n.staleTime,this.#t))&&this.#g();const s=this.#v();i&&(this.#t!==r||In(this.options.enabled,this.#t)!==In(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 K2(this,r)&&(this.#r=r,this.#a=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.#S();let n=this.#t.fetch(this.options,e);return e?.throwOnError||(n=n.catch(On)),n}#g(){this.#x();const e=La(this.options.staleTime,this.#t);if(rl.isServer()||this.#r.isStale||!um(e))return;const r=ww(this.#r.dataUpdatedAt,e)+1;this.#d=xi.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.#w(),this.#c=e,!(rl.isServer()||In(this.options.enabled,this.#t)===!1||!um(this.#c)||this.#c===0)&&(this.#f=xi.setInterval(()=>{(this.options.refetchIntervalInBackground||rp.isFocused())&&this.#h()},this.#c))}#b(){this.#g(),this.#y(this.#v())}#x(){this.#d!==void 0&&(xi.clearTimeout(this.#d),this.#d=void 0)}#w(){this.#f!==void 0&&(xi.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.#a,p=e!==r?e.state:this.#n,{state:m}=e;let y={...m},v=!1,b;if(n._optimisticResults){const V=this.hasListeners(),ye=!V&&Cb(e,n),be=V&&Eb(e,r,n,i);(ye||be)&&(y={...y,...Ow(m.data,e.options)}),n._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:x,errorUpdatedAt:w,status:_}=y;b=y.data;let E=!1;if(n.placeholderData!==void 0&&b===void 0&&_==="pending"){let V;s?.isPlaceholderData&&n.placeholderData===u?.placeholderData?(V=s.data,E=!0):V=typeof n.placeholderData=="function"?n.placeholderData(this.#m?.state.data,this.#m):n.placeholderData,V!==void 0&&(_="success",b=hm(s?.data,V,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=hm(s?.data,b,n),this.#l=b,this.#o=null}catch(V){this.#o=V}this.#o&&(x=this.#o,b=this.#l,w=Date.now(),_="error");const R=y.fetchStatus==="fetching",T=_==="pending",O=_==="error",N=T&&R,L=b!==void 0,F={status:_,fetchStatus:y.fetchStatus,isPending:T,isSuccess:_==="success",isError:O,isInitialLoading:N,isLoading:N,data:b,dataUpdatedAt:y.dataUpdatedAt,error:x,errorUpdatedAt:w,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:y.dataUpdateCount>p.dataUpdateCount||y.errorUpdateCount>p.errorUpdateCount,isFetching:R,isRefetching:R&&!T,isLoadingError:O&&!L,isPaused:y.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:O&&L,isStale:op(e,n),refetch:this.refetch,promise:this.#s,isEnabled:In(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const V=F.data!==void 0,ye=F.status==="error"&&!V,be=ue=>{ye?ue.reject(F.error):V&&ue.resolve(F.data)},he=()=>{const ue=this.#s=F.promise=mm();be(ue)},X=this.#s;switch(X.status){case"pending":e.queryHash===r.queryHash&&be(X);break;case"fulfilled":(ye||F.data!==X.value)&&he();break;case"rejected":(!ye||F.error!==X.reason)&&he();break}}return F}updateResult(){const e=this.#r,n=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#m=this.#t),dm(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()})}#S(){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){on.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function Z2(e,n){return In(n.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&In(n.retryOnMount,e)===!1)}function Cb(e,n){return Z2(e,n)||e.state.data!==void 0&&vm(e,n,n.refetchOnMount)}function vm(e,n,r){if(In(n.enabled,e)!==!1&&La(n.staleTime,e)!=="static"){const i=typeof r=="function"?r(e):r;return i==="always"||i!==!1&&op(e,n)}return!1}function Eb(e,n,r,i){return(e!==n||In(i.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&op(e,r)}function op(e,n){return In(n.enabled,e)!==!1&&e.isStaleByTime(La(n.staleTime,e))}function K2(e,n){return!dm(e.getCurrentResult(),n)}var Y2=class extends Aw{constructor(e,n){super(e,n)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,n){const{state:r}=e,i=super.createResult(e,n),{isFetching:s,isRefetching:l,isError:u,isRefetchError:d}=i,p=r.fetchMeta?.fetchMore?.direction,m=u&&p==="forward",y=s&&p==="forward",v=u&&p==="backward",b=s&&p==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:B2(n,r.data),hasPreviousPage:q2(n,r.data),isFetchNextPageError:m,isFetchingNextPage:y,isFetchPreviousPageError:v,isFetchingPreviousPage:b,isRefetchError:d&&!m&&!v,isRefetching:l&&!y&&!b}}},Q2=class extends jw{#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||X2(),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=Rw({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),on.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function X2(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var J2=class extends pl{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 Q2({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=Fc(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=Fc(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=Fc(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=Fc(e);return typeof n=="string"?this.#t.get(n)?.find(i=>i!==e&&i.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){on.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=>bb(n,r))}findAll(e={}){return this.getAll().filter(n=>bb(e,n))}notify(e){on.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return on.batch(()=>Promise.all(e.map(n=>n.continue().catch(On))))}};function Fc(e){return e.options.scope?.id}var W2=class extends pl{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,n,r){const i=n.queryKey,s=n.queryHash??ap(i,n);let l=this.get(s);return l||(l=new G2({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(){on.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=>yb(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>yb(e,r)):n}notify(e){on.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){on.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){on.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ej=class{#e;#t;#n;#r;#i;#a;#s;#o;constructor(e={}){this.#e=e.queryCache||new W2,this.#t=e.mutationCache||new J2,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#s=rp.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#o=fu.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#s?.(),this.#s=void 0,this.#o?.(),this.#o=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(La(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=D2(n,l);if(u!==void 0)return this.#e.build(this,i).setData(u,{...r,manual:!0})}setQueriesData(e,n,r){return on.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;on.batch(()=>{n.findAll(e).forEach(r=>{n.remove(r)})})}resetQueries(e,n){const r=this.#e;return on.batch(()=>(r.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...e},n)))}cancelQueries(e,n={}){const r={revert:!0,...n},i=on.batch(()=>this.#e.findAll(e).map(s=>s.cancel(r)));return Promise.all(i).then(On).catch(On)}invalidateQueries(e,n={}){return on.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=on.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(On)),s.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(i).then(On)}fetchQuery(e){const n=this.defaultQueryOptions(e);n.retry===void 0&&(n.retry=!1);const r=this.#e.build(this,n);return r.isStaleByTime(La(n.staleTime,r))?r.fetch(n):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(On).catch(On)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(On).catch(On)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return fu.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(tl(e),{queryKey:e,defaultOptions:n})}getQueryDefaults(e){const n=[...this.#r.values()],r={};return n.forEach(i=>{nl(e,i.queryKey)&&Object.assign(r,i.defaultOptions)}),r}setMutationDefaults(e,n){this.#i.set(tl(e),{mutationKey:e,defaultOptions:n})}getMutationDefaults(e){const n=[...this.#i.values()],r={};return n.forEach(i=>{nl(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=ap(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===ip&&(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()}},Mw=S.createContext(void 0),Ai=e=>{const n=S.useContext(Mw);if(!n)throw new Error("No QueryClient set, use QueryClientProvider to set one");return n},tj=({client:e,children:n})=>(S.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),f.jsx(Mw.Provider,{value:e,children:n})),Nw=S.createContext(!1),nj=()=>S.useContext(Nw);Nw.Provider;function rj(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var aj=S.createContext(rj()),ij=()=>S.useContext(aj),oj=(e,n,r)=>{const i=r?.state.error&&typeof e.throwOnError=="function"?Cw(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||i)&&(n.isReset()||(e.retryOnMount=!1))},sj=e=>{S.useEffect(()=>{e.clearReset()},[e])},lj=({result:e,errorResetBoundary:n,throwOnError:r,query:i,suspense:s})=>e.isError&&!n.isReset()&&!e.isFetching&&i&&(s&&e.data===void 0||Cw(r,[e.error,i])),cj=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))}},uj=(e,n)=>e.isLoading&&e.isFetching&&!n,dj=(e,n)=>e?.suspense&&n.isPending,Rb=(e,n,r)=>n.fetchOptimistic(e).catch(()=>{r.clearReset()});function Dw(e,n,r){const i=nj(),s=ij(),l=Ai(),u=l.defaultQueryOptions(e);l.getDefaultOptions().queries?._experimental_beforeQuery?.(u);const d=l.getQueryCache().get(u.queryHash),p=e.subscribed!==!1;u._optimisticResults=i?"isRestoring":p?"optimistic":void 0,cj(u),oj(u,s,d),sj(s);const m=!l.getQueryCache().get(u.queryHash),[y]=S.useState(()=>new n(l,u)),v=y.getOptimisticResult(u),b=!i&&p;if(S.useSyncExternalStore(S.useCallback(x=>{const w=b?y.subscribe(on.batchCalls(x)):On;return y.updateResult(),w},[y,b]),()=>y.getCurrentResult(),()=>y.getCurrentResult()),S.useEffect(()=>{y.setOptions(u)},[u,y]),dj(u,v))throw Rb(u,y,s);if(lj({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&&!rl.isServer()&&uj(v,i)&&(m?Rb(u,y,s):d?.promise)?.catch(On).finally(()=>{y.updateResult()}),u.notifyOnChangeProps?v:y.trackResult(v)}function Ht(e,n){return Dw(e,Aw)}function fj(e,n){return Dw(e,Y2)}let jb=!1;function hj(e){const n=e.analytics;if(!n?.key||jb)return;jb=!0;const r=document.createElement("script");r.src=n.host.replace(".i.posthog.com","-assets.i.posthog.com")+"/static/array.js",r.async=!0,r.onload=()=>{const i=window.posthog;i&&(i.init(n.key,{api_host:n.host,defaults:"2026-05-30",capture_pageview:"history_change",session_recording:{maskAllInputs:!0,maskTextSelector:"*"}}),e.me&&i.identify(e.me.email,{email:e.me.email,name:e.me.name,...e.billing?{plan:e.billing.plan}:{}}))},document.head.appendChild(r)}function zw(e,n){window.posthog?.capture(e,n)}const mj=[[/^POST \/api\/projects$/,"project_created"],[/^DELETE \/api\/projects\//,"project_deleted"],[/^POST \/api\/p\/[^/]+\/restore$/,"file_restored"],[/^DELETE \/api\/shares\//,"share_revoked"],[/^PATCH \/api\/shares\//,"share_expiry_changed"],[/^POST \/api\/orgs\/[^/]+\/invites$/,"invite_created"],[/^DELETE \/api\/orgs\/[^/]+\/invites\//,"invite_revoked"],[/^POST \/api\/invites\//,"invite_accepted"],[/^PUT \/api\/p\/[^/]+\/permissions\/./,"project_access_granted"],[/^DELETE \/api\/p\/[^/]+\/permissions\/./,"project_access_revoked"]];function kw(e,n){const r=e+" "+n.split("?")[0],i=mj.find(([s])=>s.test(r));i&&zw(i[1])}function sp(){throw location.href="/auth/login?next="+encodeURIComponent(location.pathname+location.search),new Error("signing in…")}function pj(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 413:return"This project is over its plan limit.";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 Mu(e){throw new Error(pj(e.status,await e.text()))}async function Yt(e){const n=await fetch(e,{headers:{Accept:"application/json"}});return n.status===401&&sp(),n.ok||await Mu(n),n.json()}async function gj(e){const n=await fetch(e);return n.status===401&&sp(),n.ok||await Mu(n),n}async function Wn(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 Mu(s),kw(e,n),s.status===204?{}:s.json()}async function Si(e,n){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n||{})});return r.status===401&&sp(),r.ok||await Mu(r),kw("POST",e),r.json()}function vj(){return Ht({queryKey:["config"],queryFn:async()=>{const e=await Yt("/api/config");return e.auth.enabled&&!e.me&&(location.href="/auth/login?next="+encodeURIComponent(location.pathname+location.search),await new Promise(()=>{})),hj(e),e},staleTime:1/0})}var Mi=xw();const yj=bw(Mi);function Tb(e,n){if(typeof e=="function")return e(n);e!=null&&(e.current=n)}function Fo(...e){return n=>{let r=!1;const i=e.map(s=>{const l=Tb(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 p=[];Ob(s)&&typeof Vc=="function"&&(s=Vc(s._payload)),S.Children.forEach(s,b=>{if(Cj(b)){d=!0;const x=b;let w="child"in x.props?x.props.child:x.props.children;Ob(w)&&typeof Vc=="function"&&(w=Vc(w._payload)),u=wj(x,w),p.push(u?.props?.children)}else p.push(b)}),u?u=S.cloneElement(u,void 0,p):!d&&S.Children.count(s)===1&&S.isValidElement(s)&&(u=s);const m=u?_j(u):void 0,y=nt(i,m);if(!u){if(s||s===0)throw new Error(d?Tj(e):jj(e));return s}const v=Sj(l,u.props??{});return u.type!==S.Fragment&&(v.ref=i?y:m),S.cloneElement(u,v)});return n.displayName=`${e}.Slot`,n}var bj=_i("Slot"),Lw=Symbol.for("radix.slottable");function xj(e){const n=r=>"child"in r?r.children(r.child):r.children;return n.displayName=`${e}.Slottable`,n.__radixId=Lw,n}var wj=(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 Sj(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 p=l(...d);return s(...d),p}:s&&(r[i]=s):i==="style"?r[i]={...s,...l}:i==="className"&&(r[i]=[s,l].filter(Boolean).join(" "))}return{...e,...r}}function _j(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 Cj(e){return S.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Lw}var Ej=Symbol.for("react.lazy");function Ob(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Ej&&"_payload"in e&&Rj(e._payload)}function Rj(e){return typeof e=="object"&&e!==null&&"then"in e}var jj=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Tj=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Vc=Au[" use ".trim().toString()],Oj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$e=Oj.reduce((e,n)=>{const r=_i(`Primitive.${n}`),i=S.forwardRef((s,l)=>{const{asChild:u,...d}=s,p=u?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(p,{...d,ref:l})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{});function $w(e,n){e&&Mi.flushSync(()=>e.dispatchEvent(n))}var Iw=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"}),Aj="VisuallyHidden",Pw=S.forwardRef((e,n)=>f.jsx($e.span,{...e,ref:n,style:{...Iw,...e.style}}));Pw.displayName=Aj;var Mj=Pw;function Ga(e,n=[]){let r=[];function i(l,u){const d=S.createContext(u);d.displayName=l+"Context";const p=r.length;r=[...r,u];const m=v=>{const{scope:b,children:x,...w}=v,_=b?.[e]?.[p]||d,E=S.useMemo(()=>w,Object.values(w));return f.jsx(_.Provider,{value:E,children:x})};m.displayName=l+"Provider";function y(v,b,x={}){const{optional:w=!1}=x,_=b?.[e]?.[p]||d,E=S.useContext(_);if(E)return E;if(u!==void 0)return u;if(!w)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 p=d?.[e]||l;return S.useMemo(()=>({[`__scope${e}`]:{...d,[e]:p}}),[d,p])}};return s.scopeName=e,[i,Nj(s,...n)]}function Nj(...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:p,scopeName:m})=>{const v=p(l)[`__scope${m}`];return{...d,...v}},{});return S.useMemo(()=>({[`__scope${n.scopeName}`]:u}),[u])}};return r.scopeName=n.scopeName,r}function lp(e){const n=e+"CollectionProvider",[r,i]=Ga(n),[s,l]=r(n,{collectionRef:{current:null},itemMap:new Map}),u=_=>{const{scope:E,children:R}=_,T=S.useRef(null),O=S.useRef(new Map).current;return f.jsx(s,{scope:E,itemMap:O,collectionRef:T,children:R})};u.displayName=n;const d=e+"CollectionSlot",p=_i(d),m=S.forwardRef((_,E)=>{const{scope:R,children:T}=_,O=l(d,R),N=nt(E,O.collectionRef);return f.jsx(p,{ref:N,children:T})});m.displayName=d;const y=e+"CollectionItemSlot",v="data-radix-collection-item",b=_i(y),x=S.forwardRef((_,E)=>{const{scope:R,children:T,...O}=_,N=S.useRef(null),L=nt(E,N),P=l(y,R);return S.useEffect(()=>(P.itemMap.set(N,{ref:N,...O}),()=>{P.itemMap.delete(N)})),f.jsx(b,{[v]:"",ref:L,children:T})});x.displayName=y;function w(_){const E=l(e+"CollectionConsumer",_);return S.useCallback(()=>{const T=E.collectionRef.current;if(!T)return[];const O=Array.from(T.querySelectorAll(`[${v}]`));return Array.from(E.itemMap.values()).sort((P,F)=>O.indexOf(P.ref.current)-O.indexOf(F.ref.current))},[E.collectionRef,E.itemMap])}return[{Provider:u,Slot:m,ItemSlot:x},w,i]}function je(e,n,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e?.(s),r===!1||!s||!s.defaultPrevented)return n?.(s)}}var Kt=globalThis?.document?S.useLayoutEffect:()=>{},Dj=Au[" useInsertionEffect ".trim().toString()]||Kt;function Vo({prop:e,defaultProp:n,onChange:r=()=>{},caller:i}){const[s,l,u]=zj({defaultProp:n,onChange:r}),d=e!==void 0,p=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=kj(y)?y(e):y;v!==e&&u.current?.(v)}else l(y)},[d,e,l,u]);return[p,m]}function zj({defaultProp:e,onChange:n}){const[r,i]=S.useState(e),s=S.useRef(r),l=S.useRef(n);return Dj(()=>{l.current=n},[n]),S.useEffect(()=>{s.current!==r&&(l.current?.(r),s.current=r)},[r,s]),[r,i,l]}function kj(e){return typeof e=="function"}function Lj(e,n){return S.useReducer((r,i)=>n[r][i]??r,e)}var vr=e=>{const{present:n,children:r}=e,i=$j(n),s=typeof r=="function"?r({present:i.isPresent}):S.Children.only(r),l=Ij(i.ref,Pj(s));return typeof r=="function"||i.isPresent?S.cloneElement(s,{ref:l}):null};vr.displayName="Presence";function $j(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",[p,m]=Lj(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return S.useEffect(()=>{p==="mounted"?(l.current=u.current??Vs(i.current),u.current=void 0):l.current="none"},[p]),Kt(()=>{const y=i.current,v=s.current;if(v!==e){const x=l.current,w=Vs(y);e?(u.current=w,m("MOUNT")):w==="none"||y?.display==="none"?m("UNMOUNT"):m(v&&x!==w?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,m]),Kt(()=>{if(n){let y;const v=n.ownerDocument.defaultView??window,b=w=>{const E=Vs(i.current).includes(CSS.escape(w.animationName));if(w.target===n&&E&&(m("ANIMATION_END"),!s.current)){const R=n.style.animationFillMode;n.style.animationFillMode="forwards",y=v.setTimeout(()=>{n.style.animationFillMode==="forwards"&&(n.style.animationFillMode=R)})}},x=w=>{w.target===n&&(l.current=Vs(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(p),ref:S.useCallback(y=>{if(y){const v=getComputedStyle(y);i.current=v,u.current=Vs(v)}else i.current=null;r(y)},[])}}function Ab(e,n){if(typeof e=="function")return e(n);e!=null&&(e.current=n)}function Ij(...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=Ab(u,r);return!s&&typeof d=="function"&&(s=!0),d});if(s)return()=>{for(let u=0;u{}),Vj=0;function dn(e){const[n,r]=S.useState(Fj());return Kt(()=>{r(i=>i??String(Vj++))},[e]),n?`radix-${n}`:""}var Uj=S.createContext(void 0);function cp(e){const n=S.useContext(Uj);return e||n||"ltr"}function tr(e){const n=S.useRef(e);return S.useEffect(()=>{n.current=e}),S.useMemo(()=>((...r)=>n.current?.(...r)),[])}var Hj="DismissableLayer",ym="dismissableLayer.update",Bj="dismissableLayer.pointerDownOutside",qj="dismissableLayer.focusOutside",Mb,up=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),gl=S.forwardRef((e,n)=>{const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,onDismiss:p,...m}=e,y=S.useContext(up),[v,b]=S.useState(null),x=v?.ownerDocument??globalThis?.document,[,w]=S.useState({}),_=nt(n,b),E=Array.from(y.layers),[R]=[...y.layersWithOutsidePointerEventsDisabled].slice(-1),T=R?E.indexOf(R):-1,O=v?E.indexOf(v):-1,N=y.layersWithOutsidePointerEventsDisabled.size>0,L=O>=T,P=S.useRef(!1),F=Qj(he=>{l?.(he),d?.(he),he.defaultPrevented||p?.()},{ownerDocument:x,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:P,dismissableSurfaces:y.dismissableSurfaces,shouldHandlePointerDownOutside:S.useCallback(he=>{if(!(he instanceof Node))return!1;const X=[...y.branches].some(ue=>ue.contains(he));return L&&!X},[y.branches,L])}),V=Xj(he=>{if(i&&P.current)return;const X=he.target;[...y.branches].some(pe=>pe.contains(X))||(u?.(he),d?.(he),he.defaultPrevented||p?.())},x),ye=v?O===E.length-1:!1,be=tr(he=>{he.key==="Escape"&&(s?.(he),!he.defaultPrevented&&p&&(he.preventDefault(),p()))});return S.useEffect(()=>{if(ye)return x.addEventListener("keydown",be,{capture:!0}),()=>x.removeEventListener("keydown",be,{capture:!0})},[x,ye,be]),S.useEffect(()=>{if(v)return r&&(y.layersWithOutsidePointerEventsDisabled.size===0&&(Mb=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),y.layersWithOutsidePointerEventsDisabled.add(v)),y.layers.add(v),Nb(),()=>{r&&(y.layersWithOutsidePointerEventsDisabled.delete(v),y.layersWithOutsidePointerEventsDisabled.size===0&&(x.body.style.pointerEvents=Mb))}},[v,x,r,y]),S.useEffect(()=>()=>{v&&(y.layers.delete(v),y.layersWithOutsidePointerEventsDisabled.delete(v),Nb())},[v,y]),S.useEffect(()=>{const he=()=>w({});return document.addEventListener(ym,he),()=>document.removeEventListener(ym,he)},[]),f.jsx($e.div,{...m,ref:_,style:{pointerEvents:N?L?"auto":"none":void 0,...e.style},onFocusCapture:je(e.onFocusCapture,V.onFocusCapture),onBlurCapture:je(e.onBlurCapture,V.onBlurCapture),onPointerDownCapture:je(e.onPointerDownCapture,F.onPointerDownCapture)})});gl.displayName=Hj;var Gj="DismissableLayerBranch",Zj=S.forwardRef((e,n)=>{const r=S.useContext(up),i=S.useRef(null),s=nt(n,i);return S.useEffect(()=>{const l=i.current;if(l)return r.branches.add(l),()=>{r.branches.delete(l)}},[r.branches]),f.jsx($e.div,{...e,ref:s})});Zj.displayName=Gj;function Kj(){const e=S.useContext(up),[n,r]=S.useState(null);return S.useEffect(()=>{if(n)return e.dismissableSurfaces.add(n),()=>{e.dismissableSurfaces.delete(n)}},[n,e.dismissableSurfaces]),r}var Yj=()=>!0;function Qj(e,n){const{ownerDocument:r=globalThis?.document,deferPointerDownOutside:i=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:l,shouldHandlePointerDownOutside:u=Yj}=n,d=tr(e),p=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 w(O){if(!m.current)return;const N=O.target;N instanceof Node&&[...l].some(P=>P.contains(N))||y.current.set(O.type,!0),O.type==="click"&&window.setTimeout(()=>{m.current&&v.current()},0)}function _(O){m.current&&y.current.set(O.type,!1)}const E=O=>{if(O.target&&!p.current){let N=function(){r.removeEventListener("click",v.current);const P=x();b(),P||Fw(Bj,d,L,{discrete:!0})};if(!u(O.target)){r.removeEventListener("click",v.current),b(),p.current=!1;return}const L={originalEvent:O};m.current=!0,s.current=i&&O.button===0,y.current.clear(),!i||O.button!==0?N():(r.removeEventListener("click",v.current),v.current=N,r.addEventListener("click",v.current,{once:!0}))}else r.removeEventListener("click",v.current),b();p.current=!1},R=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const O of R)r.addEventListener(O,w,!0),r.addEventListener(O,_);const T=window.setTimeout(()=>{r.addEventListener("pointerdown",E)},0);return()=>{window.clearTimeout(T),r.removeEventListener("pointerdown",E),r.removeEventListener("click",v.current);for(const O of R)r.removeEventListener(O,w,!0),r.removeEventListener(O,_)}},[r,d,i,s,l,u]),{onPointerDownCapture:()=>p.current=!0}}function Xj(e,n=globalThis?.document){const r=tr(e),i=S.useRef(!1);return S.useEffect(()=>{const s=l=>{l.target&&!i.current&&Fw(qj,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 Nb(){const e=new CustomEvent(ym);document.dispatchEvent(e)}function Fw(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?$w(s,l):s.dispatchEvent(l)}var Nh="focusScope.autoFocusOnMount",Dh="focusScope.autoFocusOnUnmount",Db={bubbles:!1,cancelable:!0},Jj="FocusScope",Nu=S.forwardRef((e,n)=>{const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:l,...u}=e,[d,p]=S.useState(null),m=tr(s),y=tr(l),v=S.useRef(null),b=nt(n,p),x=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(i){let _=function(O){if(x.paused||!d)return;const N=O.target;d.contains(N)?v.current=N:Na(v.current,{select:!0})},E=function(O){if(x.paused||!d)return;const N=O.relatedTarget;N!==null&&(d.contains(N)||Na(v.current,{select:!0}))},R=function(O){if(document.activeElement===document.body)for(const L of O)L.removedNodes.length>0&&Na(d)};document.addEventListener("focusin",_),document.addEventListener("focusout",E);const T=new MutationObserver(R);return d&&T.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",E),T.disconnect()}}},[i,d,x.paused]),S.useEffect(()=>{if(d){kb.add(x);const _=document.activeElement;if(!d.contains(_)){const R=new CustomEvent(Nh,Db);d.addEventListener(Nh,m),d.dispatchEvent(R),R.defaultPrevented||(Wj(aT(Vw(d)),{select:!0}),document.activeElement===_&&Na(d))}return()=>{d.removeEventListener(Nh,m),setTimeout(()=>{const R=new CustomEvent(Dh,Db);d.addEventListener(Dh,y),d.dispatchEvent(R),R.defaultPrevented||Na(_??document.body,{select:!0}),d.removeEventListener(Dh,y),kb.remove(x)},0)}}},[d,m,y,x]);const w=S.useCallback(_=>{if(!r&&!i||x.paused)return;const E=_.key==="Tab"&&!_.altKey&&!_.ctrlKey&&!_.metaKey,R=document.activeElement;if(E&&R){const T=_.currentTarget,[O,N]=eT(T);O&&N?!_.shiftKey&&R===N?(_.preventDefault(),r&&Na(O,{select:!0})):_.shiftKey&&R===O&&(_.preventDefault(),r&&Na(N,{select:!0})):R===T&&_.preventDefault()}},[r,i,x.paused]);return f.jsx($e.div,{tabIndex:-1,...u,ref:b,onKeyDown:w})});Nu.displayName=Jj;function Wj(e,{select:n=!1}={}){const r=document.activeElement;for(const i of e)if(Na(i,{select:n}),document.activeElement!==r)return}function eT(e){const n=Vw(e),r=zb(n,e),i=zb(n.reverse(),e);return[r,i]}function Vw(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 zb(e,n){const r=typeof n.checkVisibility=="function"&&n.checkVisibility({checkVisibilityCSS:!0});for(const i of e)if(!(r?!i.checkVisibility({checkVisibilityCSS:!0}):tT(i,{upTo:n})))return i}function tT(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 nT(e){return e instanceof HTMLInputElement&&"select"in e}function Na(e,{select:n=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&nT(e)&&n&&e.select()}}var kb=rT();function rT(){let e=[];return{add(n){const r=e[0];n!==r&&r?.pause(),e=Lb(e,n),e.unshift(n)},remove(n){e=Lb(e,n),e[0]?.resume()}}}function Lb(e,n){const r=[...e],i=r.indexOf(n);return i!==-1&&r.splice(i,1),r}function aT(e){return e.filter(n=>n.tagName!=="A")}var iT="Portal",vl=S.forwardRef((e,n)=>{const{container:r,...i}=e,[s,l]=S.useState(!1);Kt(()=>l(!0),[]);const u=r||s&&globalThis?.document?.body;return u?Mi.createPortal(f.jsx($e.div,{...i,ref:n}),u):null});vl.displayName=iT;var Uc=0,_o=null;function dp(){S.useEffect(()=>{_o||(_o={start:$b(),end:$b()});const{start:e,end:n}=_o;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==n&&document.body.insertAdjacentElement("beforeend",n),Uc++,()=>{Uc===1&&(_o?.start.remove(),_o?.end.remove(),_o=null),Uc=Math.max(0,Uc-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 Ar=function(){return Ar=Object.assign||function(n){for(var r,i=1,s=arguments.length;i"u")return ST;var n=_T(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])}},ET=qw(),ko="data-scroll-locked",RT=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(sT,` { - overflow: hidden `).concat(i,`; - padding-right: `).concat(d,"px ").concat(i,`; - } - body[`).concat(ko,`] { - 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(au,` { - right: `).concat(d,"px ").concat(i,`; - } - - .`).concat(iu,` { - margin-right: `).concat(d,"px ").concat(i,`; - } - - .`).concat(au," .").concat(au,` { - right: 0 `).concat(i,`; - } - - .`).concat(iu," .").concat(iu,` { - margin-right: 0 `).concat(i,`; - } - - body[`).concat(ko,`] { - `).concat(lT,": ").concat(d,`px; - } -`)},Pb=function(){var e=parseInt(document.body.getAttribute(ko)||"0",10);return isFinite(e)?e:0},jT=function(){S.useEffect(function(){return document.body.setAttribute(ko,(Pb()+1).toString()),function(){var e=Pb()-1;e<=0?document.body.removeAttribute(ko):document.body.setAttribute(ko,e.toString())}},[])},TT=function(e){var n=e.noRelative,r=e.noImportant,i=e.gapMode,s=i===void 0?"margin":i;jT();var l=S.useMemo(function(){return CT(s)},[s]);return S.createElement(ET,{styles:RT(l,!n,s,r?"":"!important")})},bm=!1;if(typeof window<"u")try{var Hc=Object.defineProperty({},"passive",{get:function(){return bm=!0,!0}});window.addEventListener("test",Hc,Hc),window.removeEventListener("test",Hc,Hc)}catch{bm=!1}var Co=bm?{passive:!1}:!1,OT=function(e){return e.tagName==="TEXTAREA"},Gw=function(e,n){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[n]!=="hidden"&&!(r.overflowY===r.overflowX&&!OT(e)&&r[n]==="visible")},AT=function(e){return Gw(e,"overflowY")},MT=function(e){return Gw(e,"overflowX")},Fb=function(e,n){var r=n.ownerDocument,i=n;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var s=Zw(e,i);if(s){var l=Kw(e,i),u=l[1],d=l[2];if(u>d)return!0}i=i.parentNode}while(i&&i!==r.body);return!1},NT=function(e){var n=e.scrollTop,r=e.scrollHeight,i=e.clientHeight;return[n,r,i]},DT=function(e){var n=e.scrollLeft,r=e.scrollWidth,i=e.clientWidth;return[n,r,i]},Zw=function(e,n){return e==="v"?AT(n):MT(n)},Kw=function(e,n){return e==="v"?NT(n):DT(n)},zT=function(e,n){return e==="h"&&n==="rtl"?-1:1},kT=function(e,n,r,i,s){var l=zT(e,window.getComputedStyle(n).direction),u=l*i,d=r.target,p=n.contains(d),m=!1,y=u>0,v=0,b=0;do{if(!d)break;var x=Kw(e,d),w=x[0],_=x[1],E=x[2],R=_-E-l*w;(w||R)&&Zw(e,d)&&(v+=R,b+=w);var T=d.parentNode;d=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!p&&d!==document.body||p&&(n.contains(d)||n===d));return(y&&Math.abs(v)<1||!y&&Math.abs(b)<1)&&(m=!0),m},Bc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Vb=function(e){return[e.deltaX,e.deltaY]},Ub=function(e){return e&&"current"in e?e.current:e},LT=function(e,n){return e[0]===n[0]&&e[1]===n[1]},$T=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},IT=0,Eo=[];function PT(e){var n=S.useRef([]),r=S.useRef([0,0]),i=S.useRef(),s=S.useState(IT++)[0],l=S.useState(qw)[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 _=oT([e.lockRef.current],(e.shards||[]).map(Ub),!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 R=Bc(_),T=r.current,O="deltaX"in _?_.deltaX:T[0]-R[0],N="deltaY"in _?_.deltaY:T[1]-R[1],L,P=_.target,F=Math.abs(O)>Math.abs(N)?"h":"v";if("touches"in _&&F==="h"&&P.type==="range")return!1;var V=window.getSelection(),ye=V&&V.anchorNode,be=ye?ye===P||ye.contains(P):!1;if(be)return!1;var he=Fb(F,P);if(!he)return!0;if(he?L=F:(L=F==="v"?"h":"v",he=Fb(F,P)),!he)return!1;if(!i.current&&"changedTouches"in _&&(O||N)&&(i.current=L),!L)return!0;var X=i.current||L;return kT(X,E,_,X==="h"?O:N)},[]),p=S.useCallback(function(_){var E=_;if(!(!Eo.length||Eo[Eo.length-1]!==l)){var R="deltaY"in E?Vb(E):Bc(E),T=n.current.filter(function(L){return L.name===E.type&&(L.target===E.target||E.target===L.shadowParent)&<(L.delta,R)})[0];if(T&&T.should){E.cancelable&&E.preventDefault();return}if(!T){var O=(u.current.shards||[]).map(Ub).filter(Boolean).filter(function(L){return L.contains(E.target)}),N=O.length>0?d(E,O[0]):!u.current.noIsolation;N&&E.cancelable&&E.preventDefault()}}},[]),m=S.useCallback(function(_,E,R,T){var O={name:_,delta:E,target:R,should:T,shadowParent:FT(R)};n.current.push(O),setTimeout(function(){n.current=n.current.filter(function(N){return N!==O})},1)},[]),y=S.useCallback(function(_){r.current=Bc(_),i.current=void 0},[]),v=S.useCallback(function(_){m(_.type,Vb(_),_.target,d(_,e.lockRef.current))},[]),b=S.useCallback(function(_){m(_.type,Bc(_),_.target,d(_,e.lockRef.current))},[]);S.useEffect(function(){return Eo.push(l),e.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:b}),document.addEventListener("wheel",p,Co),document.addEventListener("touchmove",p,Co),document.addEventListener("touchstart",y,Co),function(){Eo=Eo.filter(function(_){return _!==l}),document.removeEventListener("wheel",p,Co),document.removeEventListener("touchmove",p,Co),document.removeEventListener("touchstart",y,Co)}},[]);var x=e.removeScrollBar,w=e.inert;return S.createElement(S.Fragment,null,w?S.createElement(l,{styles:$T(s)}):null,x?S.createElement(TT,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function FT(e){for(var n=null;e!==null;)e instanceof ShadowRoot&&(n=e.host,e=e.host),e=e.parentNode;return n}const VT=pT(Bw,PT);var zu=S.forwardRef(function(e,n){return S.createElement(Du,Ar({},e,{ref:n,sideCar:VT}))});zu.classNames=Du.classNames;var UT=function(e){if(typeof document>"u")return null;var n=Array.isArray(e)?e[0]:e;return n.ownerDocument.body},Ro=new WeakMap,qc=new WeakMap,Gc={},$h=0,Yw=function(e){return e&&(e.host||Yw(e.parentNode))},HT=function(e,n){return n.map(function(r){if(e.contains(r))return r;var i=Yw(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})},BT=function(e,n,r,i){var s=HT(n,Array.isArray(e)?e:[e]);Gc[r]||(Gc[r]=new WeakMap);var l=Gc[r],u=[],d=new Set,p=new Set(s),m=function(v){!v||d.has(v)||(d.add(v),m(v.parentNode))};s.forEach(m);var y=function(v){!v||p.has(v)||Array.prototype.forEach.call(v.children,function(b){if(d.has(b))y(b);else try{var x=b.getAttribute(i),w=x!==null&&x!=="false",_=(Ro.get(b)||0)+1,E=(l.get(b)||0)+1;Ro.set(b,_),l.set(b,E),u.push(b),_===1&&w&&qc.set(b,!0),E===1&&b.setAttribute(r,"true"),w||b.setAttribute(i,"true")}catch(R){console.error("aria-hidden: cannot operate on ",b,R)}})};return y(n),d.clear(),$h++,function(){u.forEach(function(v){var b=Ro.get(v)-1,x=l.get(v)-1;Ro.set(v,b),l.set(v,x),b||(qc.has(v)||v.removeAttribute(i),qc.delete(v)),x||v.removeAttribute(r)}),$h--,$h||(Ro=new WeakMap,Ro=new WeakMap,qc=new WeakMap,Gc={})}},fp=function(e,n,r){r===void 0&&(r="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),s=UT(e);return s?(i.push.apply(i,Array.from(s.querySelectorAll("[aria-live], script"))),BT(i,s,r,"aria-hidden")):function(){return null}},ku="Dialog",[Qw]=Ga(ku),[qT,yr]=Qw(ku),hp=e=>{const{__scopeDialog:n,children:r,open:i,defaultOpen:s,onOpenChange:l,modal:u=!0}=e,d=S.useRef(null),p=S.useRef(null),[m,y]=Vo({prop:i,defaultProp:s??!1,onChange:l,caller:ku});return f.jsx(qT,{scope:n,triggerRef:d,contentRef:p,contentId:dn(),titleId:dn(),descriptionId:dn(),open:m,onOpenChange:y,onOpenToggle:S.useCallback(()=>y(v=>!v),[y]),modal:u,children:r})};hp.displayName=ku;var Xw="DialogTrigger",GT=S.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=yr(Xw,r),l=nt(n,s.triggerRef);return f.jsx($e.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":yp(s.open),...i,ref:l,onClick:je(e.onClick,s.onOpenToggle)})});GT.displayName=Xw;var mp="DialogPortal",[ZT,Jw]=Qw(mp,{forceMount:void 0}),pp=e=>{const{__scopeDialog:n,forceMount:r,children:i,container:s}=e,l=yr(mp,n);return f.jsx(ZT,{scope:n,forceMount:r,children:S.Children.map(i,u=>f.jsx(vr,{present:r||l.open,children:f.jsx(vl,{asChild:!0,container:s,children:u})}))})};pp.displayName=mp;var hu="DialogOverlay",gp=S.forwardRef((e,n)=>{const r=Jw(hu,e.__scopeDialog),{forceMount:i=r.forceMount,...s}=e,l=yr(hu,e.__scopeDialog);return l.modal?f.jsx(vr,{present:i||l.open,children:f.jsx(YT,{...s,ref:n})}):null});gp.displayName=hu;var KT=_i("DialogOverlay.RemoveScroll"),YT=S.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=yr(hu,r),l=Kj(),u=nt(n,l);return f.jsx(zu,{as:KT,allowPinchZoom:!0,shards:[s.contentRef],children:f.jsx($e.div,{"data-state":yp(s.open),...i,ref:u,style:{pointerEvents:"auto",...i.style}})})}),Uo="DialogContent",vp=S.forwardRef((e,n)=>{const r=Jw(Uo,e.__scopeDialog),{forceMount:i=r.forceMount,...s}=e,l=yr(Uo,e.__scopeDialog);return f.jsx(vr,{present:i||l.open,children:l.modal?f.jsx(QT,{...s,ref:n}):f.jsx(XT,{...s,ref:n})})});vp.displayName=Uo;var QT=S.forwardRef((e,n)=>{const r=yr(Uo,e.__scopeDialog),i=S.useRef(null),s=nt(n,r.contentRef,i);return S.useEffect(()=>{const l=i.current;if(l)return fp(l)},[]),f.jsx(Ww,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:je(e.onCloseAutoFocus,l=>{l.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:je(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0;(u.button===2||d)&&l.preventDefault()}),onFocusOutside:je(e.onFocusOutside,l=>l.preventDefault())})}),XT=S.forwardRef((e,n)=>{const r=yr(Uo,e.__scopeDialog),i=S.useRef(!1),s=S.useRef(!1);return f.jsx(Ww,{...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()}})}),Ww=S.forwardRef((e,n)=>{const{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:l,...u}=e,d=yr(Uo,r);return dp(),f.jsx(f.Fragment,{children:f.jsx(Nu,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:s,onUnmountAutoFocus:l,children:f.jsx(gl,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":yp(d.open),...u,ref:n,deferPointerDownOutside:!0,onDismiss:()=>d.onOpenChange(!1)})})})}),eS="DialogTitle",tS=S.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=yr(eS,r);return f.jsx($e.h2,{id:s.titleId,...i,ref:n})});tS.displayName=eS;var nS="DialogDescription",JT=S.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=yr(nS,r);return f.jsx($e.p,{id:s.descriptionId,...i,ref:n})});JT.displayName=nS;var rS="DialogClose",aS=S.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=yr(rS,r);return f.jsx($e.button,{type:"button",...i,ref:n,onClick:je(e.onClick,()=>s.onOpenChange(!1))})});aS.displayName=rS;function yp(e){return e?"open":"closed"}function WT(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 eO(e){const[n,r]=S.useState(void 0);return Kt(()=>{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 p=l.borderBoxSize,m=Array.isArray(p)?p[0]:p;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 tO=["top","right","bottom","left"],Va=Math.min,ra=Math.max,mu=Math.round,Zc=Math.floor,aa=e=>({x:e,y:e}),nO={left:"right",right:"left",bottom:"top",top:"bottom"};function iS(e,n,r){return ra(e,Va(n,r))}function ia(e,n){return typeof e=="function"?e(n):e}function Ua(e){return e.split("-")[0]}function Go(e){return e.split("-")[1]}function bp(e){return e==="x"?"y":"x"}function xp(e){return e==="y"?"height":"width"}function Mr(e){const n=e[0];return n==="t"||n==="b"?"y":"x"}function wp(e){return bp(Mr(e))}function rO(e,n,r){r===void 0&&(r=!1);const i=Go(e),s=wp(e),l=xp(s);let u=s==="x"?i===(r?"end":"start")?"right":"left":i==="start"?"bottom":"top";return n.reference[l]>n.floating[l]&&(u=pu(u)),[u,pu(u)]}function aO(e){const n=pu(e);return[xm(e),n,xm(n)]}function xm(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Hb=["left","right"],Bb=["right","left"],iO=["top","bottom"],oO=["bottom","top"];function sO(e,n,r){switch(e){case"top":case"bottom":return r?n?Bb:Hb:n?Hb:Bb;case"left":case"right":return n?iO:oO;default:return[]}}function lO(e,n,r,i){const s=Go(e);let l=sO(Ua(e),r==="start",i);return s&&(l=l.map(u=>u+"-"+s),n&&(l=l.concat(l.map(xm)))),l}function pu(e){const n=Ua(e);return nO[n]+e.slice(n.length)}function cO(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 oS(e){return typeof e!="number"?cO(e):{top:e,right:e,bottom:e,left:e}}function gu(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 qb(e,n,r){let{reference:i,floating:s}=e;const l=Mr(n),u=wp(n),d=xp(u),p=Ua(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(p){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 w=Go(n);return w&&(x[u]+=b*(w==="end"?1:-1)*(r&&m?-1:1)),x}async function uO(e,n){var r;n===void 0&&(n={});const{x:i,y:s,platform:l,rects:u,elements:d,strategy:p}=e,{boundary:m="clippingAncestors",rootBoundary:y="viewport",elementContext:v="floating",altBoundary:b=!1,padding:x=0}=ia(n,e),w=oS(x),E=d[b?v==="floating"?"reference":"floating":v],R=gu(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:p})),T=v==="floating"?{x:i,y:s,width:u.floating.width,height:u.floating.height}:u.reference,O=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d.floating)),N=await(l.isElement==null?void 0:l.isElement(O))&&await(l.getScale==null?void 0:l.getScale(O))||{x:1,y:1},L=gu(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:T,offsetParent:O,strategy:p}):T);return{top:(R.top-L.top+w.top)/N.y,bottom:(L.bottom-R.bottom+w.bottom)/N.y,left:(R.left-L.left+w.left)/N.x,right:(L.right-R.right+w.right)/N.x}}const dO=50,fO=async(e,n,r)=>{const{placement:i="bottom",strategy:s="absolute",middleware:l=[],platform:u}=r,d=u.detectOverflow?u:{...u,detectOverflow:uO},p=await(u.isRTL==null?void 0:u.isRTL(n));let m=await u.getElementRects({reference:e,floating:n,strategy:s}),{x:y,y:v}=qb(m,i,p),b=i,x=0;const w={};for(let _=0;_({name:"arrow",options:e,async fn(n){const{x:r,y:i,placement:s,rects:l,platform:u,elements:d,middlewareData:p}=n,{element:m,padding:y=0}=ia(e,n)||{};if(m==null)return{};const v=oS(y),b={x:r,y:i},x=wp(s),w=xp(x),_=await u.getDimensions(m),E=x==="y",R=E?"top":"left",T=E?"bottom":"right",O=E?"clientHeight":"clientWidth",N=l.reference[w]+l.reference[x]-b[x]-l.floating[w],L=b[x]-l.reference[x],P=await(u.getOffsetParent==null?void 0:u.getOffsetParent(m));let F=P?P[O]:0;(!F||!await(u.isElement==null?void 0:u.isElement(P)))&&(F=d.floating[O]||l.floating[w]);const V=N/2-L/2,ye=F/2-_[w]/2-1,be=Va(v[R],ye),he=Va(v[T],ye),X=F-_[w]-he,ue=F/2-_[w]/2+V,pe=iS(be,ue,X),ge=!p.arrow&&Go(s)!=null&&ue!==pe&&l.reference[w]/2-(uepe<=0)){var he,X;const pe=(((he=l.flip)==null?void 0:he.index)||0)+1,ge=F[pe];if(ge&&(!(v==="alignment"?T!==Mr(ge):!1)||be.every(re=>Mr(re.placement)===T?re.overflows[0]>0:!0)))return{data:{index:pe,overflows:be},reset:{placement:ge}};let k=(X=be.filter(K=>K.overflows[0]<=0).sort((K,re)=>K.overflows[1]-re.overflows[1])[0])==null?void 0:X.placement;if(!k)switch(x){case"bestFit":{var ue;const K=(ue=be.filter(re=>{if(P){const W=Mr(re.placement);return W===T||W==="y"}return!0}).map(re=>[re.placement,re.overflows.filter(W=>W>0).reduce((W,te)=>W+te,0)]).sort((re,W)=>re[1]-W[1])[0])==null?void 0:ue[0];K&&(k=K);break}case"initialPlacement":k=d;break}if(s!==k)return{reset:{placement:k}}}return{}}}};function Gb(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 tO.some(n=>e[n]>=0)}const pO=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(n){const{rects:r,platform:i}=n,{strategy:s="referenceHidden",...l}=ia(e,n);switch(s){case"referenceHidden":{const u=await i.detectOverflow(n,{...l,elementContext:"reference"}),d=Gb(u,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:Zb(d)}}}case"escaped":{const u=await i.detectOverflow(n,{...l,altBoundary:!0}),d=Gb(u,r.floating);return{data:{escapedOffsets:d,escaped:Zb(d)}}}default:return{}}}}},sS=new Set(["left","top"]);async function gO(e,n){const{placement:r,platform:i,elements:s}=e,l=await(i.isRTL==null?void 0:i.isRTL(s.floating)),u=Ua(r),d=Go(r),p=Mr(r)==="y",m=sS.has(u)?-1:1,y=l&&p?-1:1,v=ia(n,e);let{mainAxis:b,crossAxis:x,alignmentAxis:w}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return d&&typeof w=="number"&&(x=d==="end"?w*-1:w),p?{x:x*y,y:b*m}:{x:b*m,y:x*y}}const vO=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,p=await gO(n,e);return u===((r=d.offset)==null?void 0:r.placement)&&(i=d.arrow)!=null&&i.alignmentOffset?{}:{x:s+p.x,y:l+p.y,data:{...p,placement:u}}}}},yO=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:p={fn:T=>{let{x:O,y:N}=T;return{x:O,y:N}}},...m}=ia(e,n),y={x:r,y:i},v=await l.detectOverflow(n,m),b=Mr(s),x=bp(b);let w=y[x],_=y[b];const E=(T,O)=>iS(O+v[T==="y"?"top":"left"],O,O-v[T==="y"?"bottom":"right"]);u&&(w=E(x,w)),d&&(_=E(b,_));const R=p.fn({...n,[x]:w,[b]:_});return{...R,data:{x:R.x-r,y:R.y-i,enabled:{[x]:u,[b]:d}}}}}},bO=function(e){return e===void 0&&(e={}),{options:e,fn(n){var r,i;const{x:s,y:l,placement:u,rects:d,middlewareData:p}=n,{offset:m=0,mainAxis:y=!0,crossAxis:v=!0}=ia(e,n),b={x:s,y:l},x=Mr(u),w=bp(x);let _=b[w],E=b[x];const R=ia(m,n),T=typeof R=="number"?{mainAxis:R,crossAxis:0}:{mainAxis:(r=R.mainAxis)!=null?r:0,crossAxis:(i=R.crossAxis)!=null?i:0};if(y){const L=w==="y"?"height":"width",P=d.reference[w]-d.floating[L]+T.mainAxis,F=d.reference[w]+d.reference[L]-T.mainAxis;_F&&(_=F)}if(v){var O,N;const L=w==="y"?"width":"height",P=sS.has(Ua(u)),F=d.reference[x]-d.floating[L]+(P&&((O=p.offset)==null?void 0:O[x])||0)+(P?0:T.crossAxis),V=d.reference[x]+d.reference[L]+(P?0:((N=p.offset)==null?void 0:N[x])||0)-(P?T.crossAxis:0);EV&&(E=V)}return{[w]:_,[x]:E}}}},xO=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}=ia(e,n),p=await s.detectOverflow(n,d),m=Ua(r),y=Go(r),v=Mr(r)==="y",{width:b,height:x}=i.floating;let w,_;m==="top"||m==="bottom"?(w=m,_=y===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(_=m,w=y==="end"?"top":"bottom");const E=x-p.top-p.bottom,R=b-p.left-p.right,T=Va(x-p[w],E),O=Va(b-p[_],R),N=n.middlewareData.shift,L=!N;let P=T,F=O;N!=null&&N.enabled.x&&(F=R),N!=null&&N.enabled.y&&(P=E),L&&!y&&(v?F=b-2*ra(p.left,p.right):P=x-2*ra(p.top,p.bottom)),await u({...n,availableWidth:F,availableHeight:P});const V=await s.getDimensions(l.floating);return b!==V.width||x!==V.height?{reset:{rects:!0}}:{}}}};function Lu(){return typeof window<"u"}function Zo(e){return lS(e)?(e.nodeName||"").toLowerCase():"#document"}function An(e){var n;return(e==null||(n=e.ownerDocument)==null?void 0:n.defaultView)||window}function oa(e){var n;return(n=(lS(e)?e.ownerDocument:e.document)||window.document)==null?void 0:n.documentElement}function lS(e){return Lu()?e instanceof Node||e instanceof An(e).Node:!1}function Nr(e){return Lu()?e instanceof Element||e instanceof An(e).Element:!1}function Za(e){return Lu()?e instanceof HTMLElement||e instanceof An(e).HTMLElement:!1}function Kb(e){return!Lu()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof An(e).ShadowRoot}function $u(e){const{overflow:n,overflowX:r,overflowY:i,display:s}=Dr(e);return/auto|scroll|overlay|hidden|clip/.test(n+i+r)&&s!=="inline"&&s!=="contents"}function wO(e){return/^(table|td|th)$/.test(Zo(e))}function Iu(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const SO=/transform|translate|scale|rotate|perspective|filter/,_O=/paint|layout|strict|content/,vi=e=>!!e&&e!=="none";let Ih;function Sp(e){const n=Nr(e)?Dr(e):e;return vi(n.transform)||vi(n.translate)||vi(n.scale)||vi(n.rotate)||vi(n.perspective)||!_p()&&(vi(n.backdropFilter)||vi(n.filter))||SO.test(n.willChange||"")||_O.test(n.contain||"")}function CO(e){let n=Ci(e);for(;Za(n)&&!al(n);){if(Sp(n))return n;if(Iu(n))return null;n=Ci(n)}return null}function _p(){return Ih==null&&(Ih=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ih}function al(e){return/^(html|body|#document)$/.test(Zo(e))}function Dr(e){return An(e).getComputedStyle(e)}function Pu(e){return Nr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ci(e){if(Zo(e)==="html")return e;const n=e.assignedSlot||e.parentNode||Kb(e)&&e.host||oa(e);return Kb(n)?n.host:n}function cS(e){const n=Ci(e);return al(n)?(e.ownerDocument||e).body:Za(n)&&$u(n)?n:cS(n)}function il(e,n,r){var i;n===void 0&&(n=[]),r===void 0&&(r=!0);const s=cS(e),l=s===((i=e.ownerDocument)==null?void 0:i.body),u=An(s);if(l){const d=wm(u);return n.concat(u,u.visualViewport||[],$u(s)?s:[],d&&r?il(d):[])}else return n.concat(s,il(s,[],r))}function wm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function uS(e){const n=Dr(e);let r=parseFloat(n.width)||0,i=parseFloat(n.height)||0;const s=Za(e),l=s?e.offsetWidth:r,u=s?e.offsetHeight:i,d=mu(r)!==l||mu(i)!==u;return d&&(r=l,i=u),{width:r,height:i,$:d}}function Cp(e){return Nr(e)?e:e.contextElement}function Lo(e){const n=Cp(e);if(!Za(n))return aa(1);const r=n.getBoundingClientRect(),{width:i,height:s,$:l}=uS(n);let u=(l?mu(r.width):r.width)/i,d=(l?mu(r.height):r.height)/s;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const EO=aa(0);function dS(e){const n=An(e);return!_p()||!n.visualViewport?EO:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function RO(e,n,r){return n===void 0&&(n=!1),!!r&&n&&r===An(e)}function Ei(e,n,r,i){n===void 0&&(n=!1),r===void 0&&(r=!1);const s=e.getBoundingClientRect(),l=Cp(e);let u=aa(1);n&&(i?Nr(i)&&(u=Lo(i)):u=Lo(e));const d=RO(l,r,i)?dS(l):aa(0);let p=(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=An(l),x=Nr(i)?An(i):i;let w=b,_=wm(w);for(;_&&x!==w;){const E=Lo(_),R=_.getBoundingClientRect(),T=Dr(_),O=R.left+(_.clientLeft+parseFloat(T.paddingLeft))*E.x,N=R.top+(_.clientTop+parseFloat(T.paddingTop))*E.y;p*=E.x,m*=E.y,y*=E.x,v*=E.y,p+=O,m+=N,w=An(_),_=wm(w)}}return gu({width:y,height:v,x:p,y:m})}function Fu(e,n){const r=Pu(e).scrollLeft;return n?n.left+r:Ei(oa(e)).left+r}function fS(e,n){const r=e.getBoundingClientRect(),i=r.left+n.scrollLeft-Fu(e,r),s=r.top+n.scrollTop;return{x:i,y:s}}function jO(e){let{elements:n,rect:r,offsetParent:i,strategy:s}=e;const l=s==="fixed",u=oa(i),d=n?Iu(n.floating):!1;if(i===u||d&&l)return r;let p={scrollLeft:0,scrollTop:0},m=aa(1);const y=aa(0),v=Za(i);if((v||!l)&&((Zo(i)!=="body"||$u(u))&&(p=Pu(i)),v)){const x=Ei(i);m=Lo(i),y.x=x.x+i.clientLeft,y.y=x.y+i.clientTop}const b=u&&!v&&!l?fS(u,p):aa(0);return{width:r.width*m.x,height:r.height*m.y,x:r.x*m.x-p.scrollLeft*m.x+y.x+b.x,y:r.y*m.y-p.scrollTop*m.y+y.y+b.y}}function TO(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function OO(e){const n=Pu(e),r=e.ownerDocument.body,i=ra(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=ra(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Fu(e);const u=-n.scrollTop;return Dr(r).direction==="rtl"&&(l+=ra(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:l,y:u}}const AO=25;function MO(e,n,r){r===void 0&&(r="viewport");const i=r==="layoutViewport",s=An(e),l=oa(e),u=s.visualViewport;let d=l.clientWidth,p=l.clientHeight,m=0,y=0;if(u){const b=!_p()||n==="fixed";i?b||(m=-u.offsetLeft,y=-u.offsetTop):(d=u.width,p=u.height,b&&(m=u.offsetLeft,y=u.offsetTop))}if(Fu(l)<=0){const b=l.ownerDocument,x=b.body,w=getComputedStyle(x),_=b.compatMode==="CSS1Compat"&&parseFloat(w.marginLeft)+parseFloat(w.marginRight)||0,E=Math.abs(l.clientWidth-x.clientWidth-_),R=getComputedStyle(l).scrollbarGutter==="stable both-edges"?E/2:E;R<=AO&&(d-=R)}return{width:d,height:p,x:m,y}}function NO(e,n){const r=Ei(e,!0,n==="fixed"),i=r.top+e.clientTop,s=r.left+e.clientLeft,l=Lo(e),u=e.clientWidth*l.x,d=e.clientHeight*l.y,p=s*l.x,m=i*l.y;return{width:u,height:d,x:p,y:m}}function Yb(e,n,r){let i;if(n==="viewport"||n==="layoutViewport")i=MO(e,r,n);else if(n==="document")i=OO(oa(e));else if(Nr(n))i=NO(n,r);else{const s=dS(e);i={x:n.x-s.x,y:n.y-s.y,width:n.width,height:n.height}}return gu(i)}function DO(e,n){const r=n.get(e);if(r)return r;let i=il(e,[],!1).filter(d=>Nr(d)&&Zo(d)!=="body"),s=null;const l=Dr(e).position==="fixed";let u=l?Ci(e):e;for(;Nr(u)&&!al(u);){const d=Dr(u),p=Sp(u),m=s?s.position:l?"fixed":"";!p&&(m==="fixed"||m==="absolute"&&d.position==="static")?i=i.filter(v=>v!==u):s=d,u=Ci(u)}return n.set(e,i),i}function zO(e){let{element:n,boundary:r,rootBoundary:i,strategy:s}=e;const u=[...r==="clippingAncestors"?Iu(n)?[]:DO(n,this._c):[].concat(r),i],d=Yb(n,u[0],s);let p=d.top,m=d.right,y=d.bottom,v=d.left;for(let b=1;b{d(!1,1e-7)},1e3)}F=!1}try{i=new IntersectionObserver(V,{...P,root:l.ownerDocument})}catch{i=new IntersectionObserver(V,P)}i.observe(e)}const p=An(e),m=()=>d(r);return p.addEventListener("resize",m),d(!0),()=>{p.removeEventListener("resize",m),u()}}function VO(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:p=!1}=i,m=Cp(e),y=s||l?[...m?il(m):[],...n?il(n):[]]:[];y.forEach(R=>{s&&R.addEventListener("scroll",r),l&&R.addEventListener("resize",r)});const v=m&&d?FO(m,r,l):null;let b=-1,x=null;u&&(x=new ResizeObserver(R=>{let[T]=R;T&&T.target===m&&x&&n&&(x.unobserve(n),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var O;(O=x)==null||O.observe(n)})),r()}),m&&!p&&x.observe(m),n&&x.observe(n));let w,_=p?Ei(e):null;p&&E();function E(){const R=Ei(e);_&&!mS(_,R)&&r(),_=R,w=requestAnimationFrame(E)}return r(),()=>{var R;y.forEach(T=>{s&&T.removeEventListener("scroll",r),l&&T.removeEventListener("resize",r)}),v?.(),(R=x)==null||R.disconnect(),x=null,p&&cancelAnimationFrame(w)}}const UO=vO,HO=yO,BO=mO,qO=xO,GO=pO,Xb=hO,ZO=bO,KO=(e,n,r)=>{const i=new Map,s=r??{},l={...PO,...s.platform,_c:i};return fO(e,n,{...s,platform:l})};var YO=typeof document<"u",QO=function(){},ou=YO?S.useLayoutEffect:QO;function vu(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(!vu(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)&&!vu(e[l],n[l]))return!1}return!0}return e!==e&&n!==n}function pS(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Jb(e,n){const r=pS(e);return Math.round(n*r)/r}function Fh(e){const n=S.useRef(e);return ou(()=>{n.current=e}),n}function XO(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:p,open:m}=e,[y,v]=S.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[b,x]=S.useState(i);vu(b,i)||x(i);const[w,_]=S.useState(null),[E,R]=S.useState(null),T=S.useCallback(re=>{re!==P.current&&(P.current=re,_(re))},[]),O=S.useCallback(re=>{re!==F.current&&(F.current=re,R(re))},[]),N=l||w,L=u||E,P=S.useRef(null),F=S.useRef(null),V=S.useRef(y),ye=p!=null,be=Fh(p),he=Fh(s),X=Fh(m),ue=S.useCallback(()=>{if(!P.current||!F.current)return;const re={placement:n,strategy:r,middleware:b};he.current&&(re.platform=he.current),KO(P.current,F.current,re).then(W=>{const te={...W,isPositioned:X.current!==!1};pe.current&&!vu(V.current,te)&&(V.current=te,Mi.flushSync(()=>{v(te)}))})},[b,n,r,he,X]);ou(()=>{m===!1&&V.current.isPositioned&&(V.current.isPositioned=!1,v(re=>({...re,isPositioned:!1})))},[m]);const pe=S.useRef(!1);ou(()=>(pe.current=!0,()=>{pe.current=!1}),[]),ou(()=>{if(N&&(P.current=N),L&&(F.current=L),N&&L){if(be.current)return be.current(N,L,ue);ue()}},[N,L,ue,be,ye]);const ge=S.useMemo(()=>({reference:P,floating:F,setReference:T,setFloating:O}),[T,O]),k=S.useMemo(()=>({reference:N,floating:L}),[N,L]),K=S.useMemo(()=>{const re={position:r,left:0,top:0};if(!k.floating)return re;const W=Jb(k.floating,y.x),te=Jb(k.floating,y.y);return d?{...re,transform:"translate("+W+"px, "+te+"px)",...pS(k.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:W,top:te}},[r,d,k.floating,y.x,y.y]);return S.useMemo(()=>({...y,update:ue,refs:ge,elements:k,floatingStyles:K}),[y,ue,ge,k,K])}const JO=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?Xb({element:i.current,padding:s}).fn(r):{}:i?Xb({element:i,padding:s}).fn(r):{}}}},WO=(e,n)=>{const r=UO(e);return{name:r.name,fn:r.fn,options:[e,n]}},eA=(e,n)=>{const r=HO(e);return{name:r.name,fn:r.fn,options:[e,n]}},tA=(e,n)=>({fn:ZO(e).fn,options:[e,n]}),nA=(e,n)=>{const r=BO(e);return{name:r.name,fn:r.fn,options:[e,n]}},rA=(e,n)=>{const r=qO(e);return{name:r.name,fn:r.fn,options:[e,n]}},aA=(e,n)=>{const r=GO(e);return{name:r.name,fn:r.fn,options:[e,n]}},iA=(e,n)=>{const r=JO(e);return{name:r.name,fn:r.fn,options:[e,n]}};var oA="Arrow",gS=S.forwardRef((e,n)=>{const{children:r,width:i=10,height:s=5,...l}=e;return f.jsx($e.svg,{...l,ref:n,width:i,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});gS.displayName=oA;var sA=gS,Ep="Popper",[vS,Ko]=Ga(Ep),[lA,yS]=vS(Ep),bS=e=>{const{__scopePopper:n,children:r}=e,[i,s]=S.useState(null),[l,u]=S.useState(void 0);return f.jsx(lA,{scope:n,anchor:i,onAnchorChange:s,placementState:l,setPlacementState:u,children:r})};bS.displayName=Ep;var xS="PopperAnchor",wS=S.forwardRef((e,n)=>{const{__scopePopper:r,virtualRef:i,...s}=e,l=yS(xS,r),u=S.useRef(null),d=l.onAnchorChange,p=S.useCallback(w=>{u.current=w,w&&d(w)},[d]),m=nt(n,p),y=S.useRef(null);S.useEffect(()=>{if(!i)return;const w=y.current;y.current=i.current,w!==y.current&&d(y.current)});const v=l.placementState&&jp(l.placementState),b=v?.[0],x=v?.[1];return i?null:f.jsx($e.div,{"data-radix-popper-side":b,"data-radix-popper-align":x,...s,ref:m})});wS.displayName=xS;var Rp="PopperContent",[cA,uA]=vS(Rp),SS=S.forwardRef((e,n)=>{const{__scopePopper:r,side:i="bottom",sideOffset:s=0,align:l="center",alignOffset:u=0,arrowPadding:d=0,avoidCollisions:p=!0,collisionBoundary:m=[],collisionPadding:y=0,sticky:v="partial",hideWhenDetached:b=!1,updatePositionStrategy:x="optimized",onPlaced:w,..._}=e,E=yS(Rp,r),[R,T]=S.useState(null),O=nt(n,T),[N,L]=S.useState(null),P=eO(N),F=P?.width??0,V=P?.height??0,ye=i+(l!=="center"?"-"+l:""),be=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},he=Array.isArray(m)?m:[m],X=he.length>0,ue={padding:be,boundary:he.filter(fA),altBoundary:X},{refs:pe,floatingStyles:ge,placement:k,isPositioned:K,middlewareData:re}=XO({strategy:"fixed",placement:ye,whileElementsMounted:(...ve)=>VO(...ve,{animationFrame:x==="always"}),elements:{reference:E.anchor},middleware:[WO({mainAxis:s+V,alignmentAxis:u}),p&&eA({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?tA():void 0,...ue}),p&&nA({...ue}),rA({...ue,apply:({elements:ve,rects:xe,availableWidth:Oe,availableHeight:Ie})=>{const{width:Ve,height:it}=xe.reference,Qe=ve.floating.style;Qe.setProperty("--radix-popper-available-width",`${Oe}px`),Qe.setProperty("--radix-popper-available-height",`${Ie}px`),Qe.setProperty("--radix-popper-anchor-width",`${Ve}px`),Qe.setProperty("--radix-popper-anchor-height",`${it}px`)}}),N&&iA({element:N,padding:d}),hA({arrowWidth:F,arrowHeight:V}),b&&aA({strategy:"referenceHidden",...ue,boundary:X?ue.boundary:void 0})]}),W=E.setPlacementState;Kt(()=>(W(k),()=>{W(void 0)}),[k,W]);const[te,D]=jp(k),M=tr(w);Kt(()=>{K&&M?.()},[K,M]);const B=re.arrow?.x,J=re.arrow?.y,Y=re.arrow?.centerOffset!==0,[le,ae]=S.useState();return Kt(()=>{R&&ae(window.getComputedStyle(R).zIndex)},[R]),f.jsx("div",{ref:pe.setFloating,"data-radix-popper-content-wrapper":"",style:{...ge,transform:K?ge.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:le,"--radix-popper-transform-origin":[re.transformOrigin?.x,re.transformOrigin?.y].join(" "),...re.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:f.jsx(cA,{scope:r,placedSide:te,placedAlign:D,onArrowChange:L,arrowX:B,arrowY:J,shouldHideArrow:Y,children:f.jsx($e.div,{"data-side":te,"data-align":D,..._,ref:O,style:{..._.style,animation:K?void 0:"none"}})})})});SS.displayName=Rp;var _S="PopperArrow",dA={top:"bottom",right:"left",bottom:"top",left:"right"},CS=S.forwardRef(function(n,r){const{__scopePopper:i,...s}=n,l=uA(_S,i),u=dA[l.placedSide];return f.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:f.jsx(sA,{...s,ref:r,style:{...s.style,display:"block"}})})});CS.displayName=_S;function fA(e){return e!==null}var hA=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,p=u?0:e.arrowHeight,[m,y]=jp(r),v={start:"0%",center:"50%",end:"100%"}[y],b=(s.arrow?.x??0)+d/2,x=(s.arrow?.y??0)+p/2;let w="",_="";return m==="bottom"?(w=u?v:`${b}px`,_=`${-p}px`):m==="top"?(w=u?v:`${b}px`,_=`${i.floating.height+p}px`):m==="right"?(w=`${-p}px`,_=u?v:`${x}px`):m==="left"&&(w=`${i.floating.width+p}px`,_=u?v:`${x}px`),{data:{x:w,y:_}}}});function jp(e){const[n,r="center"]=e.split("-");return[n,r]}var Tp=bS,Op=wS,Ap=SS,Mp=CS,Vh=!1;function mA(){const[e,n]=S.useState(Vh);return S.useEffect(()=>{Vh||(Vh=!0,n(!0))},[]),e}var ES=Au[" useSyncExternalStore ".trim().toString()];function pA(){return()=>{}}function gA(){return ES(pA,()=>!0,()=>!1)}var vA=typeof ES=="function"?gA:mA,Uh="rovingFocusGroup.onEntryFocus",yA={bubbles:!1,cancelable:!0},yl="RovingFocusGroup",[Sm,RS,bA]=lp(yl),[xA,jS]=Ga(yl,[bA]),[wA,SA]=xA(yl),TS=S.forwardRef((e,n)=>f.jsx(Sm.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(Sm.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(_A,{...e,ref:n})})}));TS.displayName=yl;var _A=S.forwardRef((e,n)=>{const{__scopeRovingFocusGroup:r,orientation:i,loop:s=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:p,onEntryFocus:m,preventScrollOnEntryFocus:y=!1,...v}=e,b=S.useRef(null),x=nt(n,b),w=cp(l),[_,E]=Vo({prop:u,defaultProp:d??null,onChange:p,caller:yl}),[R,T]=S.useState(!1),O=tr(m),N=RS(r),L=S.useRef(!1),[P,F]=S.useState(0);return S.useEffect(()=>{const V=b.current;if(V)return V.addEventListener(Uh,O),()=>V.removeEventListener(Uh,O)},[O]),f.jsx(wA,{scope:r,orientation:i,dir:w,loop:s,currentTabStopId:_,onItemFocus:S.useCallback(V=>E(V),[E]),onItemShiftTab:S.useCallback(()=>T(!0),[]),onFocusableItemAdd:S.useCallback(()=>F(V=>V+1),[]),onFocusableItemRemove:S.useCallback(()=>F(V=>V-1),[]),children:f.jsx($e.div,{tabIndex:R||P===0?-1:0,"data-orientation":i,...v,ref:x,style:{outline:"none",...e.style},onMouseDown:je(e.onMouseDown,()=>{L.current=!0}),onFocus:je(e.onFocus,V=>{const ye=!L.current;if(V.target===V.currentTarget&&ye&&!R){const be=new CustomEvent(Uh,yA);if(V.currentTarget.dispatchEvent(be),!be.defaultPrevented){const he=N().filter(k=>k.focusable),X=he.find(k=>k.active),ue=he.find(k=>k.id===_),ge=[X,ue,...he].filter(Boolean).map(k=>k.ref.current);MS(ge,y)}}L.current=!1}),onBlur:je(e.onBlur,()=>T(!1))})})}),OS="RovingFocusGroupItem",AS=S.forwardRef((e,n)=>{const{__scopeRovingFocusGroup:r,focusable:i=!0,active:s=!1,tabStopId:l,children:u,...d}=e,p=dn(),m=l||p,y=SA(OS,r),v=y.currentTabStopId===m,b=RS(r),{onFocusableItemAdd:x,onFocusableItemRemove:w,currentTabStopId:_}=y,E=vA();return Kt(()=>{if(!(!E||!i))return x(),()=>w()},[E,i,x,w]),S.useEffect(()=>{if(!(E||!i))return x(),()=>w()},[E,i,x,w]),f.jsx(Sm.ItemSlot,{scope:r,id:m,focusable:i,active:s,children:f.jsx($e.span,{tabIndex:v?0:-1,"data-orientation":y.orientation,...d,ref:n,onMouseDown:je(e.onMouseDown,R=>{i?y.onItemFocus(m):R.preventDefault()}),onFocus:je(e.onFocus,()=>y.onItemFocus(m)),onKeyDown:je(e.onKeyDown,R=>{if(R.key==="Tab"&&R.shiftKey){y.onItemShiftTab();return}if(R.target!==R.currentTarget)return;const T=RA(R,y.orientation,y.dir);if(T!==void 0){if(R.metaKey||R.ctrlKey||R.altKey||R.shiftKey)return;R.preventDefault();let N=b().filter(L=>L.focusable).map(L=>L.ref.current);if(T==="last")N.reverse();else if(T==="prev"||T==="next"){T==="prev"&&N.reverse();const L=N.indexOf(R.currentTarget);N=y.loop?jA(N,L+1):N.slice(L+1)}setTimeout(()=>MS(N))}}),children:typeof u=="function"?u({isCurrentTabStop:v,hasTabStop:_!=null}):u})})});AS.displayName=OS;var CA={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function EA(e,n){return n!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function RA(e,n,r){const i=EA(e.key,r);if(!(n==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(n==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return CA[i]}function MS(e,n=!1){const r=document.activeElement;for(const i of e)if(i===r||(i.focus({preventScroll:n}),document.activeElement!==r))return}function jA(e,n){return e.map((r,i)=>e[(n+i)%e.length])}var TA=TS,OA=AS,_m=["Enter"," "],AA=["ArrowDown","PageUp","Home"],NS=["ArrowUp","PageDown","End"],MA=[...AA,...NS],NA={ltr:[..._m,"ArrowRight"],rtl:[..._m,"ArrowLeft"]},DA={ltr:["ArrowLeft"],rtl:["ArrowRight"]},bl="Menu",[ol,zA,kA]=lp(bl),[Ni,DS]=Ga(bl,[kA,Ko,jS]),Vu=Ko(),zS=jS(),[LA,Di]=Ni(bl),[$A,xl]=Ni(bl),kS=e=>{const{__scopeMenu:n,open:r=!1,children:i,dir:s,onOpenChange:l,modal:u=!0}=e,d=Vu(n),[p,m]=S.useState(null),y=S.useRef(!1),v=tr(l),b=cp(s);return S.useEffect(()=>{const x=()=>{y.current=!0,document.addEventListener("pointerdown",w,{capture:!0,once:!0}),document.addEventListener("pointermove",w,{capture:!0,once:!0})},w=()=>y.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}),document.removeEventListener("pointermove",w,{capture:!0})}},[]),S.useEffect(()=>{if(!r)return;const x=()=>v(!1);return window.addEventListener("blur",x),()=>window.removeEventListener("blur",x)},[r,v]),f.jsx(Tp,{...d,children:f.jsx(LA,{scope:n,open:r,onOpenChange:v,content:p,onContentChange:m,children:f.jsx($A,{scope:n,onClose:S.useCallback(()=>v(!1),[v]),isUsingKeyboardRef:y,dir:b,modal:u,children:i})})})};kS.displayName=bl;var IA="MenuAnchor",Np=S.forwardRef((e,n)=>{const{__scopeMenu:r,...i}=e,s=Vu(r);return f.jsx(Op,{...s,...i,ref:n})});Np.displayName=IA;var Dp="MenuPortal",[PA,LS]=Ni(Dp,{forceMount:void 0}),$S=e=>{const{__scopeMenu:n,forceMount:r,children:i,container:s}=e,l=Di(Dp,n);return f.jsx(PA,{scope:n,forceMount:r,children:f.jsx(vr,{present:r||l.open,children:f.jsx(vl,{asChild:!0,container:s,children:i})})})};$S.displayName=Dp;var er="MenuContent",[FA,zp]=Ni(er),IS=S.forwardRef((e,n)=>{const r=LS(er,e.__scopeMenu),{forceMount:i=r.forceMount,...s}=e,l=Di(er,e.__scopeMenu),u=xl(er,e.__scopeMenu);return f.jsx(ol.Provider,{scope:e.__scopeMenu,children:f.jsx(vr,{present:i||l.open,children:f.jsx(ol.Slot,{scope:e.__scopeMenu,children:u.modal?f.jsx(VA,{...s,ref:n}):f.jsx(UA,{...s,ref:n})})})})}),VA=S.forwardRef((e,n)=>{const r=Di(er,e.__scopeMenu),i=S.useRef(null),s=nt(n,i);return S.useEffect(()=>{const l=i.current;if(l)return fp(l)},[]),f.jsx(kp,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:je(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),UA=S.forwardRef((e,n)=>{const r=Di(er,e.__scopeMenu);return f.jsx(kp,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),HA=_i("MenuContent.ScrollLock"),kp=S.forwardRef((e,n)=>{const{__scopeMenu:r,loop:i=!1,trapFocus:s,onOpenAutoFocus:l,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:p,onEscapeKeyDown:m,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:b,onDismiss:x,disableOutsideScroll:w,..._}=e,E=Di(er,r),R=xl(er,r),T=Vu(r),O=zS(r),N=zA(r),[L,P]=S.useState(null),F=S.useRef(null),V=nt(n,F,E.onContentChange),ye=S.useRef(0),be=S.useRef(""),he=S.useRef(0),X=S.useRef(null),ue=S.useRef("right"),pe=S.useRef(0),ge=w?zu:S.Fragment,k=w?{as:HA,allowPinchZoom:!0}:void 0,K=W=>{const te=be.current+W,D=N().filter(ae=>!ae.disabled),M=document.activeElement,B=D.find(ae=>ae.ref.current===M)?.textValue,J=D.map(ae=>ae.textValue),Y=tM(J,te,B),le=D.find(ae=>ae.textValue===Y)?.ref.current;(function ae(ve){be.current=ve,window.clearTimeout(ye.current),ve!==""&&(ye.current=window.setTimeout(()=>ae(""),1e3))})(te),le&&setTimeout(()=>le.focus())};S.useEffect(()=>()=>window.clearTimeout(ye.current),[]),dp();const re=S.useCallback(W=>ue.current===X.current?.side&&rM(W,X.current?.area),[]);return f.jsx(FA,{scope:r,searchRef:be,onItemEnter:S.useCallback(W=>{re(W)&&W.preventDefault()},[re]),onItemLeave:S.useCallback(W=>{re(W)||(F.current?.focus(),P(null))},[re]),onTriggerLeave:S.useCallback(W=>{re(W)&&W.preventDefault()},[re]),pointerGraceTimerRef:he,onPointerGraceIntentChange:S.useCallback(W=>{X.current=W},[]),children:f.jsx(ge,{...k,children:f.jsx(Nu,{asChild:!0,trapped:s,onMountAutoFocus:je(l,W=>{W.preventDefault(),F.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:f.jsx(gl,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:m,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:b,onDismiss:x,children:f.jsx(TA,{asChild:!0,...O,dir:R.dir,orientation:"vertical",loop:i,currentTabStopId:L,onCurrentTabStopIdChange:P,onEntryFocus:je(p,W=>{R.isUsingKeyboardRef.current||W.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(Ap,{role:"menu","aria-orientation":"vertical","data-state":e1(E.open),"data-radix-menu-content":"",dir:R.dir,...T,..._,ref:V,style:{outline:"none",..._.style},onKeyDown:je(_.onKeyDown,W=>{const D=W.target.closest("[data-radix-menu-content]")===W.currentTarget,M=W.ctrlKey||W.altKey||W.metaKey,B=W.key.length===1;D&&(W.key==="Tab"&&W.preventDefault(),!M&&B&&K(W.key));const J=F.current;if(W.target!==J||!MA.includes(W.key))return;W.preventDefault();const le=N().filter(ae=>!ae.disabled).map(ae=>ae.ref.current);NS.includes(W.key)&&le.reverse(),WA(le)}),onBlur:je(e.onBlur,W=>{W.currentTarget.contains(W.target)||(window.clearTimeout(ye.current),be.current="")}),onPointerMove:je(e.onPointerMove,sl(W=>{const te=W.target,D=pe.current!==W.clientX;if(W.currentTarget.contains(te)&&D){const M=W.clientX>pe.current?"right":"left";ue.current=M,pe.current=W.clientX}}))})})})})})})});IS.displayName=er;var BA="MenuGroup",Lp=S.forwardRef((e,n)=>{const{__scopeMenu:r,...i}=e;return f.jsx($e.div,{role:"group",...i,ref:n})});Lp.displayName=BA;var qA="MenuLabel",PS=S.forwardRef((e,n)=>{const{__scopeMenu:r,...i}=e;return f.jsx($e.div,{...i,ref:n})});PS.displayName=qA;var yu="MenuItem",Wb="menu.itemSelect",Uu=S.forwardRef((e,n)=>{const{disabled:r=!1,onSelect:i,...s}=e,l=S.useRef(null),u=xl(yu,e.__scopeMenu),d=zp(yu,e.__scopeMenu),p=nt(n,l),m=S.useRef(!1),y=()=>{const v=l.current;if(!r&&v){const b=new CustomEvent(Wb,{bubbles:!0,cancelable:!0});v.addEventListener(Wb,x=>i?.(x),{once:!0}),$w(v,b),b.defaultPrevented?m.current=!1:u.onClose()}};return f.jsx(FS,{...s,ref:p,disabled:r,onClick:je(e.onClick,y),onPointerDown:v=>{e.onPointerDown?.(v),m.current=!0},onPointerUp:je(e.onPointerUp,v=>{m.current||v.currentTarget?.click()}),onKeyDown:je(e.onKeyDown,v=>{r||v.target!==v.currentTarget||d.searchRef.current!==""&&v.key===" "||_m.includes(v.key)&&(v.currentTarget.click(),v.preventDefault())})})});Uu.displayName=yu;var FS=S.forwardRef((e,n)=>{const{__scopeMenu:r,disabled:i=!1,textValue:s,...l}=e,u=zp(yu,r),d=zS(r),p=S.useRef(null),m=nt(n,p),[y,v]=S.useState(!1),[b,x]=S.useState("");return S.useEffect(()=>{const w=p.current;w&&x((w.textContent??"").trim())},[l.children]),f.jsx(ol.ItemSlot,{scope:r,disabled:i,textValue:s??b,children:f.jsx(OA,{asChild:!0,...d,focusable:!i,children:f.jsx($e.div,{role:"menuitem","data-highlighted":y?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...l,ref:m,onPointerMove:je(e.onPointerMove,sl(w=>{i?u.onItemLeave(w):(u.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:je(e.onPointerLeave,sl(w=>u.onItemLeave(w))),onFocus:je(e.onFocus,()=>v(!0)),onBlur:je(e.onBlur,()=>v(!1))})})})}),GA="MenuCheckboxItem",VS=S.forwardRef((e,n)=>{const{checked:r=!1,onCheckedChange:i,...s}=e;return f.jsx(GS,{scope:e.__scopeMenu,checked:r,children:f.jsx(Uu,{role:"menuitemcheckbox","aria-checked":bu(r)?"mixed":r,...s,ref:n,"data-state":Ip(r),onSelect:je(s.onSelect,()=>i?.(bu(r)?!0:!r),{checkForDefaultPrevented:!1})})})});VS.displayName=GA;var US="MenuRadioGroup",[ZA,KA]=Ni(US,{value:void 0,onValueChange:()=>{}}),HS=S.forwardRef((e,n)=>{const{value:r,onValueChange:i,...s}=e,l=tr(i);return f.jsx(ZA,{scope:e.__scopeMenu,value:r,onValueChange:l,children:f.jsx(Lp,{...s,ref:n})})});HS.displayName=US;var BS="MenuRadioItem",qS=S.forwardRef((e,n)=>{const{value:r,...i}=e,s=KA(BS,e.__scopeMenu),l=r===s.value;return f.jsx(GS,{scope:e.__scopeMenu,checked:l,children:f.jsx(Uu,{role:"menuitemradio","aria-checked":l,...i,ref:n,"data-state":Ip(l),onSelect:je(i.onSelect,()=>s.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});qS.displayName=BS;var $p="MenuItemIndicator",[GS,YA]=Ni($p,{checked:!1}),ZS=S.forwardRef((e,n)=>{const{__scopeMenu:r,forceMount:i,...s}=e,l=YA($p,r);return f.jsx(vr,{present:i||bu(l.checked)||l.checked===!0,children:f.jsx($e.span,{...s,ref:n,"data-state":Ip(l.checked)})})});ZS.displayName=$p;var QA="MenuSeparator",KS=S.forwardRef((e,n)=>{const{__scopeMenu:r,...i}=e;return f.jsx($e.div,{role:"separator","aria-orientation":"horizontal",...i,ref:n})});KS.displayName=QA;var XA="MenuArrow",YS=S.forwardRef((e,n)=>{const{__scopeMenu:r,...i}=e,s=Vu(r);return f.jsx(Mp,{...s,...i,ref:n})});YS.displayName=XA;var JA="MenuSub",[sF,QS]=Ni(JA),Zs="MenuSubTrigger",XS=S.forwardRef((e,n)=>{const r=Di(Zs,e.__scopeMenu),i=xl(Zs,e.__scopeMenu),s=QS(Zs,e.__scopeMenu),l=zp(Zs,e.__scopeMenu),u=S.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:p}=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),p(null)}},[d,p]);const v=nt(n,s.onTriggerChange);return f.jsx(Np,{asChild:!0,...m,children:f.jsx(FS,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?s.contentId:void 0,"data-state":e1(r.open),...e,ref:v,onClick:b=>{e.onClick?.(b),!(e.disabled||b.defaultPrevented)&&(b.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:je(e.onPointerMove,sl(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:je(e.onPointerLeave,sl(b=>{y();const x=r.content?.getBoundingClientRect();if(x){const w=r.content?.dataset.side,_=w==="right",E=_?-5:5,R=x[_?"left":"right"],T=x[_?"right":"left"];l.onPointerGraceIntentChange({area:[{x:b.clientX+E,y:b.clientY},{x:R,y:x.top},{x:T,y:x.top},{x:T,y:x.bottom},{x:R,y:x.bottom}],side:w}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(b),b.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:je(e.onKeyDown,b=>{e.disabled||b.target!==b.currentTarget||l.searchRef.current!==""&&b.key===" "||NA[i.dir].includes(b.key)&&(r.onOpenChange(!0),r.content?.focus(),b.preventDefault())})})})});XS.displayName=Zs;var JS="MenuSubContent",WS=S.forwardRef((e,n)=>{const r=LS(er,e.__scopeMenu),{forceMount:i=r.forceMount,align:s="start",...l}=e,u=Di(er,e.__scopeMenu),d=xl(er,e.__scopeMenu),p=QS(JS,e.__scopeMenu),m=S.useRef(null),y=nt(n,m);return f.jsx(ol.Provider,{scope:e.__scopeMenu,children:f.jsx(vr,{present:i||u.open,children:f.jsx(ol.Slot,{scope:e.__scopeMenu,children:f.jsx(kp,{id:p.contentId,"aria-labelledby":p.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:je(e.onFocusOutside,v=>{v.target!==p.trigger&&u.onOpenChange(!1)}),onEscapeKeyDown:je(e.onEscapeKeyDown,v=>{d.onClose(),v.preventDefault()}),onKeyDown:je(e.onKeyDown,v=>{const b=v.currentTarget.contains(v.target),x=DA[d.dir].includes(v.key);b&&x&&(u.onOpenChange(!1),p.trigger?.focus(),v.preventDefault())})})})})})});WS.displayName=JS;function e1(e){return e?"open":"closed"}function bu(e){return e==="indeterminate"}function Ip(e){return bu(e)?"indeterminate":e?"checked":"unchecked"}function WA(e){const n=document.activeElement;for(const r of e)if(r===n||(r.focus(),document.activeElement!==n))return}function eM(e,n){return e.map((r,i)=>e[(n+i)%e.length])}function tM(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=eM(e,Math.max(l,0));s.length===1&&(u=u.filter(m=>m!==r));const p=u.find(m=>m.toLowerCase().startsWith(s.toLowerCase()));return p!==r?p:void 0}function nM(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 rM(e,n){if(!n)return!1;const r={x:e.clientX,y:e.clientY};return nM(r,n)}function sl(e){return n=>n.pointerType==="mouse"?e(n):void 0}var aM=kS,iM=Np,oM=$S,sM=IS,lM=Lp,cM=PS,uM=Uu,dM=VS,fM=HS,hM=qS,mM=ZS,pM=KS,gM=YS,vM=XS,yM=WS,Hu="DropdownMenu",[bM]=Ga(Hu,[DS]),vn=DS(),[xM,t1]=bM(Hu),n1=e=>{const{__scopeDropdownMenu:n,children:r,dir:i,open:s,defaultOpen:l,onOpenChange:u,modal:d=!0}=e,p=vn(n),m=S.useRef(null),[y,v]=Vo({prop:s,defaultProp:l??!1,onChange:u,caller:Hu});return f.jsx(xM,{scope:n,triggerId:dn(),triggerRef:m,contentId:dn(),open:y,onOpenChange:v,onOpenToggle:S.useCallback(()=>v(b=>!b),[v]),modal:d,children:f.jsx(aM,{...p,open:y,onOpenChange:v,dir:i,modal:d,children:r})})};n1.displayName=Hu;var r1="DropdownMenuTrigger",a1=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,disabled:i=!1,...s}=e,l=t1(r1,r),u=vn(r),d=nt(n,l.triggerRef);return f.jsx(iM,{asChild:!0,...u,children:f.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:je(e.onPointerDown,p=>{!i&&p.button===0&&p.ctrlKey===!1&&(l.onOpenToggle(),l.open||p.preventDefault())}),onKeyDown:je(e.onKeyDown,p=>{i||(["Enter"," "].includes(p.key)&&l.onOpenToggle(),p.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(p.key)&&p.preventDefault())})})})});a1.displayName=r1;var wM="DropdownMenuPortal",i1=e=>{const{__scopeDropdownMenu:n,...r}=e,i=vn(n);return f.jsx(oM,{...i,...r})};i1.displayName=wM;var o1="DropdownMenuContent",s1=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=t1(o1,r),l=vn(r),u=S.useRef(!1);return f.jsx(sM,{id:s.contentId,"aria-labelledby":s.triggerId,...l,...i,ref:n,onCloseAutoFocus:je(e.onCloseAutoFocus,d=>{u.current||s.triggerRef.current?.focus(),u.current=!1,d.preventDefault()}),onInteractOutside:je(e.onInteractOutside,d=>{const p=d.detail.originalEvent,m=p.button===0&&p.ctrlKey===!0,y=p.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)"}})});s1.displayName=o1;var SM="DropdownMenuGroup",_M=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return f.jsx(lM,{...s,...i,ref:n})});_M.displayName=SM;var CM="DropdownMenuLabel",l1=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return f.jsx(cM,{...s,...i,ref:n})});l1.displayName=CM;var EM="DropdownMenuItem",c1=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return f.jsx(uM,{...s,...i,ref:n})});c1.displayName=EM;var RM="DropdownMenuCheckboxItem",jM=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return f.jsx(dM,{...s,...i,ref:n})});jM.displayName=RM;var TM="DropdownMenuRadioGroup",OM=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return f.jsx(fM,{...s,...i,ref:n})});OM.displayName=TM;var AM="DropdownMenuRadioItem",MM=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return f.jsx(hM,{...s,...i,ref:n})});MM.displayName=AM;var NM="DropdownMenuItemIndicator",DM=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return f.jsx(mM,{...s,...i,ref:n})});DM.displayName=NM;var zM="DropdownMenuSeparator",kM=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return f.jsx(pM,{...s,...i,ref:n})});kM.displayName=zM;var LM="DropdownMenuArrow",$M=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return f.jsx(gM,{...s,...i,ref:n})});$M.displayName=LM;var IM="DropdownMenuSubTrigger",PM=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return f.jsx(vM,{...s,...i,ref:n})});PM.displayName=IM;var FM="DropdownMenuSubContent",VM=S.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,s=vn(r);return f.jsx(yM,{...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)"}})});VM.displayName=FM;var UM=n1,HM=a1,BM=i1,qM=s1,GM=l1,ZM=c1,KM="Label",u1=S.forwardRef((e,n)=>f.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())}}));u1.displayName=KM;var YM=u1;function ex(e,[n,r]){return Math.min(r,Math.max(n,e))}var QM=[" ","Enter","ArrowUp","ArrowDown"],XM=[" ","Enter"],Ri="Select",[Bu,qu,JM]=lp(Ri),[zi]=Ga(Ri,[JM,Ko]),Gu=Ko(),[WM,Ka]=zi(Ri),[eN,tN]=zi(Ri),nN="SelectProvider";function d1(e){const{__scopeSelect:n,children:r,open:i,defaultOpen:s,onOpenChange:l,value:u,defaultValue:d,onValueChange:p,dir:m,name:y,autoComplete:v,disabled:b,required:x,form:w,internal_do_not_use_render:_}=e,E=Gu(n),[R,T]=S.useState(null),[O,N]=S.useState(null),[L,P]=S.useState(!1),F=cp(m),[V,ye]=Vo({prop:i,defaultProp:s??!1,onChange:l,caller:Ri}),[be,he]=Vo({prop:u,defaultProp:d,onChange:p,caller:Ri}),X=S.useRef(null),ue=S.useRef(be);S.useEffect(()=>{const M=w?R?.ownerDocument.getElementById(w):R?.form;if(M instanceof HTMLFormElement){const B=()=>he(ue.current);return M.addEventListener("reset",B),()=>M.removeEventListener("reset",B)}},[w,R,he]);const pe=R?!!w||!!R.closest("form"):!0,[ge,k]=S.useState(new Set),K=dn(),re=Array.from(ge).map(M=>M.props.value).join(";"),W=S.useCallback(M=>{k(B=>new Set(B).add(M))},[]),te=S.useCallback(M=>{k(B=>{const J=new Set(B);return J.delete(M),J})},[]),D={required:x,trigger:R,onTriggerChange:T,valueNode:O,onValueNodeChange:N,valueNodeHasChildren:L,onValueNodeHasChildrenChange:P,contentId:K,value:be,onValueChange:he,open:V,onOpenChange:ye,dir:F,triggerPointerDownPosRef:X,disabled:b,name:y,autoComplete:v,form:w,nativeOptions:ge,nativeSelectKey:re,isFormControl:pe};return f.jsx(Tp,{...E,children:f.jsx(WM,{scope:n,...D,children:f.jsx(Bu.Provider,{scope:n,children:f.jsx(eN,{scope:n,onNativeOptionAdd:W,onNativeOptionRemove:te,children:bN(_)?_(D):r})})})})}d1.displayName=nN;var f1=e=>{const{__scopeSelect:n,children:r,...i}=e;return f.jsx(d1,{__scopeSelect:n,...i,internal_do_not_use_render:({isFormControl:s})=>f.jsxs(f.Fragment,{children:[r,s?f.jsx(I1,{__scopeSelect:n}):null]})})};f1.displayName=Ri;var h1="SelectTrigger",m1=S.forwardRef((e,n)=>{const{__scopeSelect:r,disabled:i=!1,...s}=e,l=Gu(r),u=Ka(h1,r),d=u.disabled||i,p=nt(n,u.onTriggerChange),m=qu(r),y=S.useRef("touch"),[v,b,x]=P1(_=>{const E=m().filter(O=>!O.disabled),R=E.find(O=>O.value===u.value),T=F1(E,_,R);T!==void 0&&u.onValueChange(T.value)}),w=_=>{d||(u.onOpenChange(!0),x()),_&&(u.triggerPointerDownPosRef.current={x:Math.round(_.pageX),y:Math.round(_.pageY)})};return f.jsx(Op,{asChild:!0,...l,children:f.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":Zu(u.value)?"":void 0,...s,ref:p,onClick:je(s.onClick,_=>{_.currentTarget.focus(),y.current!=="mouse"&&w(_)}),onPointerDown:je(s.onPointerDown,_=>{y.current=_.pointerType;const E=_.target;E.hasPointerCapture(_.pointerId)&&E.releasePointerCapture(_.pointerId),_.button===0&&_.ctrlKey===!1&&_.pointerType==="mouse"&&(w(_),_.preventDefault())}),onKeyDown:je(s.onKeyDown,_=>{const E=v.current!=="";!(_.ctrlKey||_.altKey||_.metaKey)&&_.key.length===1&&b(_.key),!(E&&_.key===" ")&&QM.includes(_.key)&&(w(),_.preventDefault())})})})});m1.displayName=h1;var p1="SelectValue",g1=S.forwardRef((e,n)=>{const{__scopeSelect:r,className:i,style:s,children:l,placeholder:u="",...d}=e,p=Ka(p1,r),{onValueNodeHasChildrenChange:m}=p,y=l!==void 0,v=nt(n,p.onValueNodeChange);Kt(()=>{m(y)},[m,y]);const b=Zu(p.value);return f.jsx($e.span,{...d,asChild:b?!1:d.asChild,ref:v,style:{pointerEvents:"none"},children:f.jsx(S.Fragment,{children:b?u:l},b?"placeholder":"value")})});g1.displayName=p1;var rN="SelectIcon",v1=S.forwardRef((e,n)=>{const{__scopeSelect:r,children:i,...s}=e;return f.jsx($e.span,{"aria-hidden":!0,...s,ref:n,children:i||"▼"})});v1.displayName=rN;var y1="SelectPortal",[aN,iN]=zi(y1,{forceMount:void 0}),b1=e=>{const{__scopeSelect:n,forceMount:r,...i}=e;return f.jsx(aN,{scope:e.__scopeSelect,forceMount:r,children:f.jsx(vl,{asChild:!0,...i})})};b1.displayName=y1;var Ha="SelectContent",x1=S.forwardRef((e,n)=>{const r=iN(Ha,e.__scopeSelect),{forceMount:i=r.forceMount,...s}=e,l=Ka(Ha,e.__scopeSelect),[u,d]=S.useState();return Kt(()=>{d(new DocumentFragment)},[]),f.jsx(vr,{present:i||l.open,children:({present:p})=>p?f.jsx(_1,{...s,ref:n}):f.jsx(w1,{...s,fragment:u})})});x1.displayName=Ha;var w1=S.forwardRef((e,n)=>{const{__scopeSelect:r,children:i,fragment:s}=e;return s?Mi.createPortal(f.jsx(S1,{scope:r,children:f.jsx(Bu.Slot,{scope:r,children:f.jsx("div",{ref:n,children:i})})}),s):null});w1.displayName="SelectContentFragment";var fr=10,[S1,Ya]=zi(Ha),oN="SelectContentImpl",sN=_i("SelectContent.RemoveScroll"),_1=S.forwardRef((e,n)=>{const{__scopeSelect:r}=e,{position:i="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:l,onPointerDownOutside:u,side:d,sideOffset:p,align:m,alignOffset:y,arrowPadding:v,collisionBoundary:b,collisionPadding:x,sticky:w,hideWhenDetached:_,avoidCollisions:E,...R}=e,T=Ka(Ha,r),[O,N]=S.useState(null),[L,P]=S.useState(null),F=nt(n,N),[V,ye]=S.useState(null),[be,he]=S.useState(null),X=qu(r),[ue,pe]=S.useState(!1),ge=S.useRef(!1);S.useEffect(()=>{if(O)return fp(O)},[O]),dp();const k=S.useCallback(ae=>{const[ve,...xe]=X().map(Ve=>Ve.ref.current),[Oe]=xe.slice(-1),Ie=document.activeElement;for(const Ve of ae)if(Ve===Ie||(Ve?.scrollIntoView({block:"nearest"}),Ve===ve&&L&&(L.scrollTop=0),Ve===Oe&&L&&(L.scrollTop=L.scrollHeight),Ve?.focus(),document.activeElement!==Ie))return},[X,L]),K=S.useCallback(()=>k([V,O]),[k,V,O]);S.useEffect(()=>{ue&&K()},[ue,K]);const{onOpenChange:re,triggerPointerDownPosRef:W}=T;S.useEffect(()=>{if(O){let ae={x:0,y:0};const ve=Oe=>{ae={x:Math.abs(Math.round(Oe.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(Oe.pageY)-(W.current?.y??0))}},xe=Oe=>{ae.x<=10&&ae.y<=10?Oe.preventDefault():Oe.composedPath().includes(O)||re(!1),document.removeEventListener("pointermove",ve),W.current=null};return W.current!==null&&(document.addEventListener("pointermove",ve),document.addEventListener("pointerup",xe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ve),document.removeEventListener("pointerup",xe,{capture:!0})}}},[O,re,W]),S.useEffect(()=>{const ae=()=>re(!1);return window.addEventListener("blur",ae),window.addEventListener("resize",ae),()=>{window.removeEventListener("blur",ae),window.removeEventListener("resize",ae)}},[re]);const[te,D]=P1(ae=>{const ve=X().filter(Ie=>!Ie.disabled),xe=ve.find(Ie=>Ie.ref.current===document.activeElement),Oe=F1(ve,ae,xe);Oe&&setTimeout(()=>Oe.ref.current?.focus())}),M=S.useCallback((ae,ve,xe)=>{const Oe=!ge.current&&!xe;(T.value!==void 0&&T.value===ve||Oe)&&(ye(ae),Oe&&(ge.current=!0))},[T.value]),B=S.useCallback(()=>O?.focus(),[O]),J=S.useCallback((ae,ve,xe)=>{const Oe=!ge.current&&!xe;(T.value!==void 0&&T.value===ve||Oe)&&he(ae)},[T.value]),Y=i==="popper"?Cm:C1,le=Y===Cm?{side:d,sideOffset:p,align:m,alignOffset:y,arrowPadding:v,collisionBoundary:b,collisionPadding:x,sticky:w,hideWhenDetached:_,avoidCollisions:E}:{};return f.jsx(S1,{scope:r,content:O,viewport:L,onViewportChange:P,itemRefCallback:M,selectedItem:V,onItemLeave:B,itemTextRefCallback:J,focusSelectedItem:K,selectedItemText:be,position:i,isPositioned:ue,searchRef:te,children:f.jsx(zu,{as:sN,allowPinchZoom:!0,children:f.jsx(Nu,{asChild:!0,trapped:T.open,onMountAutoFocus:ae=>{ae.preventDefault()},onUnmountAutoFocus:je(s,ae=>{T.trigger?.focus({preventScroll:!0}),ae.preventDefault()}),children:f.jsx(gl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:ae=>ae.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:f.jsx(Y,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:ae=>ae.preventDefault(),...R,...le,onPlaced:()=>pe(!0),ref:F,style:{display:"flex",flexDirection:"column",outline:"none",...R.style},onKeyDown:je(R.onKeyDown,ae=>{const ve=ae.ctrlKey||ae.altKey||ae.metaKey;if(ae.key==="Tab"&&ae.preventDefault(),!ve&&ae.key.length===1&&D(ae.key),["ArrowUp","ArrowDown","Home","End"].includes(ae.key)){let Oe=X().filter(Ie=>!Ie.disabled).map(Ie=>Ie.ref.current);if(["ArrowUp","End"].includes(ae.key)&&(Oe=Oe.slice().reverse()),["ArrowUp","ArrowDown"].includes(ae.key)){const Ie=ae.target,Ve=Oe.indexOf(Ie);Oe=Oe.slice(Ve+1)}setTimeout(()=>k(Oe)),ae.preventDefault()}})})})})})})});_1.displayName=oN;var lN="SelectItemAlignedPosition",C1=S.forwardRef((e,n)=>{const{__scopeSelect:r,onPlaced:i,...s}=e,l=Ka(Ha,r),u=Ya(Ha,r),[d,p]=S.useState(null),[m,y]=S.useState(null),v=nt(n,y),b=qu(r),x=S.useRef(!1),w=S.useRef(!0),{viewport:_,selectedItem:E,selectedItemText:R,focusSelectedItem:T}=u,O=S.useCallback(()=>{if(l.trigger&&l.valueNode&&d&&m&&_&&E&&R){const F=l.trigger.getBoundingClientRect(),V=m.getBoundingClientRect(),ye=l.valueNode.getBoundingClientRect(),be=R.getBoundingClientRect();if(l.dir!=="rtl"){const Ie=be.left-V.left,Ve=ye.left-Ie,it=F.left-Ve,Qe=F.width+it,fn=Math.max(Qe,V.width),hn=window.innerWidth-fr,Qt=ex(Ve,[fr,Math.max(fr,hn-fn)]);d.style.minWidth=Qe+"px",d.style.left=Qt+"px"}else{const Ie=V.right-be.right,Ve=window.innerWidth-ye.right-Ie,it=window.innerWidth-F.right-Ve,Qe=F.width+it,fn=Math.max(Qe,V.width),hn=window.innerWidth-fr,Qt=ex(Ve,[fr,Math.max(fr,hn-fn)]);d.style.minWidth=Qe+"px",d.style.right=Qt+"px"}const he=b(),X=window.innerHeight-fr*2,ue=_.scrollHeight,pe=window.getComputedStyle(m),ge=parseInt(pe.borderTopWidth,10),k=parseInt(pe.paddingTop,10),K=parseInt(pe.borderBottomWidth,10),re=parseInt(pe.paddingBottom,10),W=ge+k+ue+re+K,te=Math.min(E.offsetHeight*5,W),D=window.getComputedStyle(_),M=parseInt(D.paddingTop,10),B=parseInt(D.paddingBottom,10),J=F.top+F.height/2-fr,Y=X-J,le=E.offsetHeight/2,ae=E.offsetTop+le,ve=ge+k+ae,xe=W-ve;if(ve<=J){const Ie=he.length>0&&E===he[he.length-1].ref.current;d.style.bottom="0px";const Ve=m.clientHeight-_.offsetTop-_.offsetHeight,it=Math.max(Y,le+(Ie?B:0)+Ve+K),Qe=ve+it;d.style.height=Qe+"px"}else{const Ie=he.length>0&&E===he[0].ref.current;d.style.top="0px";const it=Math.max(J,ge+_.offsetTop+(Ie?M:0)+le)+xe;d.style.height=it+"px",_.scrollTop=ve-J+_.offsetTop}d.style.margin=`${fr}px 0`,d.style.minHeight=te+"px",d.style.maxHeight=X+"px",i?.(),requestAnimationFrame(()=>x.current=!0)}},[b,l.trigger,l.valueNode,d,m,_,E,R,l.dir,i]);Kt(()=>O(),[O]);const[N,L]=S.useState();Kt(()=>{m&&L(window.getComputedStyle(m).zIndex)},[m]);const P=S.useCallback(F=>{F&&w.current===!0&&(O(),T?.(),w.current=!1)},[O,T]);return f.jsx(uN,{scope:r,contentWrapper:d,shouldExpandOnScrollRef:x,onScrollButtonChange:P,children:f.jsx("div",{ref:p,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:f.jsx($e.div,{...s,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});C1.displayName=lN;var cN="SelectPopperPosition",Cm=S.forwardRef((e,n)=>{const{__scopeSelect:r,align:i="start",collisionPadding:s=fr,...l}=e,u=Gu(r);return f.jsx(Ap,{...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)"}})});Cm.displayName=cN;var[uN,Pp]=zi(Ha,{}),Em="SelectViewport",E1=S.forwardRef((e,n)=>{const{__scopeSelect:r,nonce:i,...s}=e,l=Ya(Em,r),u=Pp(Em,r),d=nt(n,l.onViewportChange),p=S.useRef(0);return f.jsxs(f.Fragment,{children:[f.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}),f.jsx(Bu.Slot,{scope:r,children:f.jsx($e.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:je(s.onScroll,m=>{const y=m.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:b}=u;if(b?.current&&v){const x=Math.abs(p.current-y.scrollTop);if(x>0){const w=window.innerHeight-fr*2,_=parseFloat(v.style.minHeight),E=parseFloat(v.style.height),R=Math.max(_,E);if(R0?N:0,v.style.justifyContent="flex-end")}}}p.current=y.scrollTop})})})]})});E1.displayName=Em;var R1="SelectGroup",[dN,fN]=zi(R1),hN=S.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e,s=dn();return f.jsx(dN,{scope:r,id:s,children:f.jsx($e.div,{role:"group","aria-labelledby":s,...i,ref:n})})});hN.displayName=R1;var j1="SelectLabel",mN=S.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e,s=fN(j1,r);return f.jsx($e.div,{id:s.id,...i,ref:n})});mN.displayName=j1;var xu="SelectItem",[pN,T1]=zi(xu),O1=S.forwardRef((e,n)=>{const{__scopeSelect:r,value:i,disabled:s=!1,textValue:l,...u}=e,d=Ka(xu,r),p=Ya(xu,r),m=d.value===i,[y,v]=S.useState(l??""),[b,x]=S.useState(!1),w=tr(O=>p.itemRefCallback?.(O,i,s)),_=nt(n,w),E=dn(),R=S.useRef("touch"),T=()=>{s||(d.onValueChange(i),d.onOpenChange(!1))};return f.jsx(pN,{scope:r,value:i,disabled:s,textId:E,isSelected:m,onItemTextChange:S.useCallback(O=>{v(N=>N||(O?.textContent??"").trim())},[]),children:f.jsx(Bu.ItemSlot,{scope:r,value:i,disabled:s,textValue:y,children:f.jsx($e.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:je(u.onFocus,()=>x(!0)),onBlur:je(u.onBlur,()=>x(!1)),onClick:je(u.onClick,()=>{R.current!=="mouse"&&T()}),onPointerUp:je(u.onPointerUp,()=>{R.current==="mouse"&&T()}),onPointerDown:je(u.onPointerDown,O=>{R.current=O.pointerType}),onPointerMove:je(u.onPointerMove,O=>{R.current=O.pointerType,s?p.onItemLeave?.():R.current==="mouse"&&O.currentTarget.focus({preventScroll:!0})}),onPointerLeave:je(u.onPointerLeave,O=>{O.currentTarget===document.activeElement&&p.onItemLeave?.()}),onKeyDown:je(u.onKeyDown,O=>{s||O.target!==O.currentTarget||p.searchRef?.current!==""&&O.key===" "||(XM.includes(O.key)&&T(),O.key===" "&&O.preventDefault())})})})})});O1.displayName=xu;var Ks="SelectItemText",A1=S.forwardRef((e,n)=>{const{__scopeSelect:r,className:i,style:s,...l}=e,u=Ka(Ks,r),d=Ya(Ks,r),p=T1(Ks,r),m=tN(Ks,r),[y,v]=S.useState(null),b=tr(T=>d.itemTextRefCallback?.(T,p.value,p.disabled)),x=nt(n,v,p.onItemTextChange,b),w=y?.textContent,_=S.useMemo(()=>f.jsx("option",{value:p.value,disabled:p.disabled,children:w},p.value),[p.disabled,p.value,w]),{onNativeOptionAdd:E,onNativeOptionRemove:R}=m;return Kt(()=>(E(_),()=>R(_)),[E,R,_]),f.jsxs(f.Fragment,{children:[f.jsx($e.span,{id:p.textId,...l,ref:x}),p.isSelected&&u.valueNode&&!u.valueNodeHasChildren&&!Zu(u.value)?Mi.createPortal(l.children,u.valueNode):null]})});A1.displayName=Ks;var M1="SelectItemIndicator",N1=S.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e;return T1(M1,r).isSelected?f.jsx($e.span,{"aria-hidden":!0,...i,ref:n}):null});N1.displayName=M1;var Rm="SelectScrollUpButton",D1=S.forwardRef((e,n)=>{const r=Ya(Rm,e.__scopeSelect),i=Pp(Rm,e.__scopeSelect),[s,l]=S.useState(!1),u=nt(n,i.onScrollButtonChange);return Kt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const m=p.scrollTop>0;l(m)};const p=r.viewport;return d(),p.addEventListener("scroll",d),()=>p.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),s?f.jsx(k1,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:p}=r;d&&p&&(d.scrollTop=d.scrollTop-p.offsetHeight)}}):null});D1.displayName=Rm;var jm="SelectScrollDownButton",z1=S.forwardRef((e,n)=>{const r=Ya(jm,e.__scopeSelect),i=Pp(jm,e.__scopeSelect),[s,l]=S.useState(!1),u=nt(n,i.onScrollButtonChange);return Kt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const m=p.scrollHeight-p.clientHeight,y=Math.ceil(p.scrollTop)p.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),s?f.jsx(k1,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:p}=r;d&&p&&(d.scrollTop=d.scrollTop+p.offsetHeight)}}):null});z1.displayName=jm;var k1=S.forwardRef((e,n)=>{const{__scopeSelect:r,onAutoScroll:i,...s}=e,l=Ya("SelectScrollButton",r),u=S.useRef(null),d=qu(r),p=S.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return S.useEffect(()=>()=>p(),[p]),Kt(()=>{d().find(y=>y.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[d]),f.jsx($e.div,{"aria-hidden":!0,...s,ref:n,style:{flexShrink:0,...s.style},onPointerDown:je(s.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(i,50))}),onPointerMove:je(s.onPointerMove,()=>{l.onItemLeave?.(),u.current===null&&(u.current=window.setInterval(i,50))}),onPointerLeave:je(s.onPointerLeave,()=>{p()})})}),gN="SelectSeparator",vN=S.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e;return f.jsx($e.div,{"aria-hidden":!0,...i,ref:n})});vN.displayName=gN;var L1="SelectArrow",yN=S.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e,s=Gu(r);return Ya(L1,r).position==="popper"?f.jsx(Mp,{...s,...i,ref:n}):null});yN.displayName=L1;var $1="SelectBubbleInput",I1=S.forwardRef(({__scopeSelect:e,...n},r)=>{const i=Ka($1,e),{value:s,onValueChange:l,required:u,disabled:d,name:p,autoComplete:m,form:y}=i,{nativeOptions:v,nativeSelectKey:b}=i,x=S.useRef(null),w=nt(r,x),_=s??"",E=WT(_),R=Array.from(v).some(T=>(T.props.value??"")==="");return S.useEffect(()=>{const T=x.current;if(!T)return;const O=window.HTMLSelectElement.prototype,L=Object.getOwnPropertyDescriptor(O,"value").set;if(E!==_&&L){const P=new Event("change",{bubbles:!0});L.call(T,_),T.dispatchEvent(P)}},[E,_]),f.jsxs($e.select,{"aria-hidden":!0,required:u,tabIndex:-1,name:p,autoComplete:m,disabled:d,form:y,onChange:T=>l(T.target.value),...n,style:{...Iw,...n.style},ref:w,defaultValue:_,children:[Zu(s)&&!R?f.jsx("option",{value:""}):null,Array.from(v)]},b)});I1.displayName=$1;function bN(e){return typeof e=="function"}function Zu(e){return e===""||e===void 0}function P1(e){const n=tr(e),r=S.useRef(""),i=S.useRef(0),s=S.useCallback(u=>{const d=r.current+u;n(d),(function p(m){r.current=m,window.clearTimeout(i.current),m!==""&&(i.current=window.setTimeout(()=>p(""),1e3))})(d)},[n]),l=S.useCallback(()=>{r.current="",window.clearTimeout(i.current)},[]);return S.useEffect(()=>()=>window.clearTimeout(i.current),[]),[r,s,l]}function F1(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=xN(e,Math.max(l,0));s.length===1&&(u=u.filter(m=>m!==r));const p=u.find(m=>m.textValue.toLowerCase().startsWith(s.toLowerCase()));return p!==r?p:void 0}function xN(e,n){return e.map((r,i)=>e[(n+i)%e.length])}var wN="Separator",tx="horizontal",SN=["horizontal","vertical"],V1=S.forwardRef((e,n)=>{const{decorative:r,orientation:i=tx,...s}=e,l=_N(i)?i:tx,d=r?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return f.jsx($e.div,{"data-orientation":l,...d,...s,ref:n})});V1.displayName=wN;function _N(e){return SN.includes(e)}var CN=V1,[Ku]=Ga("Tooltip",[Ko]),Yu=Ko(),U1="TooltipProvider",EN=700,Tm="tooltip.open",[RN,Fp]=Ku(U1),H1=e=>{const{__scopeTooltip:n,delayDuration:r=EN,skipDelayDuration:i=300,disableHoverableContent:s=!1,children:l}=e,u=S.useRef(!0),d=S.useRef(!1),p=S.useRef(0);return S.useEffect(()=>{const m=p.current;return()=>window.clearTimeout(m)},[]),f.jsx(RN,{scope:n,isOpenDelayedRef:u,delayDuration:r,onOpen:S.useCallback(()=>{i<=0||(window.clearTimeout(p.current),u.current=!1)},[i]),onClose:S.useCallback(()=>{i<=0||(window.clearTimeout(p.current),p.current=window.setTimeout(()=>u.current=!0,i))},[i]),isPointerInTransitRef:d,onPointerInTransitChange:S.useCallback(m=>{d.current=m},[]),disableHoverableContent:s,children:l})};H1.displayName=U1;var ll="Tooltip",[jN,wl]=Ku(ll),B1=e=>{const{__scopeTooltip:n,children:r,open:i,defaultOpen:s,onOpenChange:l,disableHoverableContent:u,delayDuration:d}=e,p=Fp(ll,e.__scopeTooltip),m=Yu(n),[y,v]=S.useState(null),b=dn(),x=S.useRef(0),w=u??p.disableHoverableContent,_=d??p.delayDuration,E=S.useRef(!1),[R,T]=Vo({prop:i,defaultProp:s??!1,onChange:F=>{F?(p.onOpen(),document.dispatchEvent(new CustomEvent(Tm))):p.onClose(),l?.(F)},caller:ll}),O=S.useMemo(()=>R?E.current?"delayed-open":"instant-open":"closed",[R]),N=S.useCallback(()=>{window.clearTimeout(x.current),x.current=0,E.current=!1,T(!0)},[T]),L=S.useCallback(()=>{window.clearTimeout(x.current),x.current=0,T(!1)},[T]),P=S.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{E.current=!0,T(!0),x.current=0},_)},[_,T]);return S.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),f.jsx(Tp,{...m,children:f.jsx(jN,{scope:n,contentId:b,open:R,stateAttribute:O,trigger:y,onTriggerChange:v,onTriggerEnter:S.useCallback(()=>{p.isOpenDelayedRef.current?P():N()},[p.isOpenDelayedRef,P,N]),onTriggerLeave:S.useCallback(()=>{w?L():(window.clearTimeout(x.current),x.current=0)},[L,w]),onOpen:N,onClose:L,disableHoverableContent:w,children:r})})};B1.displayName=ll;var Om="TooltipTrigger",q1=S.forwardRef((e,n)=>{const{__scopeTooltip:r,...i}=e,s=wl(Om,r),l=Fp(Om,r),u=Yu(r),d=S.useRef(null),p=nt(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]),f.jsx(Op,{asChild:!0,...u,children:f.jsx($e.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...i,ref:p,onPointerMove:je(e.onPointerMove,b=>{b.pointerType!=="touch"&&!y.current&&!l.isPointerInTransitRef.current&&(s.onTriggerEnter(),y.current=!0)}),onPointerLeave:je(e.onPointerLeave,()=>{s.onTriggerLeave(),y.current=!1}),onPointerDown:je(e.onPointerDown,()=>{s.open&&s.onClose(),m.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:je(e.onFocus,()=>{m.current||s.onOpen()}),onBlur:je(e.onBlur,s.onClose),onClick:je(e.onClick,s.onClose)})})});q1.displayName=Om;var Vp="TooltipPortal",[TN,ON]=Ku(Vp,{forceMount:void 0}),G1=e=>{const{__scopeTooltip:n,forceMount:r,children:i,container:s}=e,l=wl(Vp,n);return f.jsx(TN,{scope:n,forceMount:r,children:f.jsx(vr,{present:r||l.open,children:f.jsx(vl,{asChild:!0,container:s,children:i})})})};G1.displayName=Vp;var Ho="TooltipContent",Z1=S.forwardRef((e,n)=>{const r=ON(Ho,e.__scopeTooltip),{forceMount:i=r.forceMount,side:s="top",...l}=e,u=wl(Ho,e.__scopeTooltip);return f.jsx(vr,{present:i||u.open,children:u.disableHoverableContent?f.jsx(K1,{side:s,...l,ref:n}):f.jsx(AN,{side:s,...l,ref:n})})}),AN=S.forwardRef((e,n)=>{const r=wl(Ho,e.__scopeTooltip),i=Fp(Ho,e.__scopeTooltip),s=S.useRef(null),l=nt(n,s),[u,d]=S.useState(null),{trigger:p,onClose:m}=r,y=s.current,{onPointerInTransitChange:v}=i,b=S.useCallback(()=>{d(null),v(!1)},[v]),x=S.useCallback((w,_)=>{const E=w.currentTarget,R={x:w.clientX,y:w.clientY},T=zN(R,E.getBoundingClientRect()),O=kN(R,T),N=LN(_.getBoundingClientRect()),L=IN([...O,...N]);d(L),v(!0)},[v]);return S.useEffect(()=>()=>b(),[b]),S.useEffect(()=>{if(p&&y){const w=E=>x(E,y),_=E=>x(E,p);return p.addEventListener("pointerleave",w),y.addEventListener("pointerleave",_),()=>{p.removeEventListener("pointerleave",w),y.removeEventListener("pointerleave",_)}}},[p,y,x,b]),S.useEffect(()=>{if(u){const w=_=>{const E=_.target,R={x:_.clientX,y:_.clientY},T=p?.contains(E)||y?.contains(E),O=!$N(R,u);T?b():O&&(b(),m())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[p,y,u,m,b]),f.jsx(K1,{...e,ref:l})}),[MN,NN]=Ku(ll,{isInside:!1}),DN=xj("TooltipContent"),K1=S.forwardRef((e,n)=>{const{__scopeTooltip:r,children:i,"aria-label":s,onEscapeKeyDown:l,onPointerDownOutside:u,...d}=e,p=wl(Ho,r),m=Yu(r),{onClose:y}=p;return S.useEffect(()=>(document.addEventListener(Tm,y),()=>document.removeEventListener(Tm,y)),[y]),S.useEffect(()=>{if(p.trigger){const v=b=>{b.target instanceof Node&&b.target.contains(p.trigger)&&y()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[p.trigger,y]),f.jsx(gl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:v=>v.preventDefault(),onDismiss:y,children:f.jsxs(Ap,{"data-state":p.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:[f.jsx(DN,{children:i}),f.jsx(MN,{scope:r,isInside:!0,children:f.jsx(Mj,{id:p.contentId,role:"tooltip",children:s||i})})]})})});Z1.displayName=Ho;var Y1="TooltipArrow",Q1=S.forwardRef((e,n)=>{const{__scopeTooltip:r,...i}=e,s=Yu(r);return NN(Y1,r).isInside?null:f.jsx(Mp,{...s,...i,ref:n})});Q1.displayName=Y1;function zN(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 kN(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 LN(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 $N(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 IN(e){const n=e.slice();return n.sort((r,i)=>r.xi.x?1:r.yi.y?1:0),PN(n)}function PN(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 FN=H1,VN=B1,UN=q1,HN=G1,BN=Z1,qN=Q1;function X1(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}),W1=(e=new Map,n=null,r)=>({nextPart:e,validators:n,classGroupId:r}),wu="-",nx=[],KN="arbitrary..",YN=e=>{const n=XN(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return QN(u);const d=u.split(wu),p=d[0]===""&&d.length>1?1:0;return e_(d,p,n)},getConflictingClassGroupIds:(u,d)=>{if(d){const p=i[u],m=r[u];return p?m?GN(m,p):p:m||nx}return r[u]||nx}}},e_=(e,n,r)=>{if(e.length-n===0)return r.classGroupId;const s=e[n],l=r.nextPart.get(s);if(l){const m=e_(e,n+1,l);if(m)return m}const u=r.validators;if(u===null)return;const d=n===0?e.join(wu):e.slice(n).join(wu),p=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?KN+i:void 0})(),XN=e=>{const{theme:n,classGroups:r}=e;return JN(r,n)},JN=(e,n)=>{const r=W1();for(const i in e){const s=e[i];Up(s,r,i,n)}return r},Up=(e,n,r,i)=>{const s=e.length;for(let l=0;l{if(typeof e=="string"){eD(e,n,r);return}if(typeof e=="function"){tD(e,n,r,i);return}nD(e,n,r,i)},eD=(e,n,r)=>{const i=e===""?n:t_(n,e);i.classGroupId=r},tD=(e,n,r,i)=>{if(rD(e)){Up(e(i),n,r,i);return}n.validators===null&&(n.validators=[]),n.validators.push(ZN(r,e))},nD=(e,n,r,i)=>{const s=Object.entries(e),l=s.length;for(let u=0;u{let r=e;const i=n.split(wu),s=i.length;for(let l=0;l"isThemeGetter"in e&&e.isThemeGetter===!0,aD=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)}}},Am="!",rx=":",iD=[],ax=(e,n,r,i,s)=>({modifiers:e,hasImportantModifier:n,baseClassName:r,maybePostfixModifierPosition:i,isExternal:s}),oD=e=>{const{prefix:n,experimentalParseClassName:r}=e;let i=s=>{const l=[];let u=0,d=0,p=0,m;const y=s.length;for(let _=0;_p?m-p:void 0;return ax(l,x,b,w)};if(n){const s=n+rx,l=i;i=u=>u.startsWith(s)?l(u.slice(s.length)):ax(iD,!1,u,void 0,!0)}if(r){const s=i;i=l=>r({className:l,parseClassName:s})}return i},sD=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}},lD=e=>({cache:aD(e.cacheSize),parseClassName:oD(e),sortModifiers:sD(e),postfixLookupClassGroupIds:cD(e),...YN(e)}),cD=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=[],p=e.trim().split(uD);let m="";for(let y=p.length-1;y>=0;y-=1){const v=p[y],{isExternal:b,modifiers:x,hasImportantModifier:w,baseClassName:_,maybePostfixModifierPosition:E}=r(v);if(b){m=v+(m.length>0?" "+m:m);continue}let R=!!E,T;if(R){const F=_.substring(0,E);T=i(F);const V=T&&u[T]?i(_):void 0;V&&V!==T&&(T=V,R=!1)}else T=i(_);if(!T){if(!R){m=v+(m.length>0?" "+m:m);continue}if(T=i(_),!T){m=v+(m.length>0?" "+m:m);continue}R=!1}const O=x.length===0?"":x.length===1?x[0]:l(x).join(":"),N=w?O+Am:O,L=N+T;if(d.indexOf(L)>-1)continue;d.push(L);const P=s(T,R);for(let F=0;F0?" "+m:m)}return m},fD=(...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=p=>{const m=n.reduce((y,v)=>v(y),e());return r=lD(m),i=r.cache.get,s=r.cache.set,l=d,d(p)},d=p=>{const m=i(p);if(m)return m;const y=dD(p,r);return s(p,y),y};return l=u,(...p)=>l(fD(...p))},mD=[],Ut=e=>{const n=r=>r[e]||mD;return n.isThemeGetter=!0,n},r_=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,a_=/^\((?:(\w[\w-]*):)?(.+)\)$/i,pD=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,gD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,vD=/\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$/,yD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,bD=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ma=e=>pD.test(e),He=e=>!!e&&!Number.isNaN(Number(e)),Rr=e=>!!e&&Number.isInteger(Number(e)),Hh=e=>e.endsWith("%")&&He(e.slice(0,-1)),ea=e=>gD.test(e),i_=()=>!0,wD=e=>vD.test(e)&&!yD.test(e),Hp=()=>!1,SD=e=>bD.test(e),_D=e=>xD.test(e),CD=e=>!_e(e)&&!Ce(e),ED=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)),RD=e=>Qa(e,l_,Hp),_e=e=>r_.test(e),yi=e=>Qa(e,c_,wD),ix=e=>Qa(e,zD,He),jD=e=>Qa(e,d_,i_),TD=e=>Qa(e,u_,Hp),ox=e=>Qa(e,o_,Hp),OD=e=>Qa(e,s_,_D),Kc=e=>Qa(e,f_,SD),Ce=e=>a_.test(e),Us=e=>ki(e,c_),AD=e=>ki(e,u_),sx=e=>ki(e,o_),MD=e=>ki(e,l_),ND=e=>ki(e,s_),Yc=e=>ki(e,f_,!0),DD=e=>ki(e,d_,!0),Qa=(e,n,r)=>{const i=r_.exec(e);return i?i[1]?n(i[1]):r(i[2]):!1},ki=(e,n,r=!1)=>{const i=a_.exec(e);return i?i[1]?n(i[1]):r:!1},o_=e=>e==="position"||e==="percentage",s_=e=>e==="image"||e==="url",l_=e=>e==="length"||e==="size"||e==="bg-size",c_=e=>e==="length",zD=e=>e==="number",u_=e=>e==="family-name",d_=e=>e==="number"||e==="weight",f_=e=>e==="shadow",kD=()=>{const e=Ut("color"),n=Ut("font"),r=Ut("text"),i=Ut("font-weight"),s=Ut("tracking"),l=Ut("leading"),u=Ut("breakpoint"),d=Ut("container"),p=Ut("spacing"),m=Ut("radius"),y=Ut("shadow"),v=Ut("inset-shadow"),b=Ut("text-shadow"),x=Ut("drop-shadow"),w=Ut("blur"),_=Ut("perspective"),E=Ut("aspect"),R=Ut("ease"),T=Ut("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...N(),Ce,_e],P=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto","contain","none"],V=()=>[Ce,_e,p],ye=()=>[Ma,"full","auto",...V()],be=()=>[Rr,"none","subgrid",Ce,_e],he=()=>["auto",{span:["full",Rr,Ce,_e]},Rr,Ce,_e],X=()=>[Rr,"auto",Ce,_e],ue=()=>["auto","min","max","fr",Ce,_e],pe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ge=()=>["start","end","center","stretch","center-safe","end-safe"],k=()=>["auto",...V()],K=()=>[Ma,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...V()],re=()=>[Ma,"screen","full","dvw","lvw","svw","min","max","fit",...V()],W=()=>[Ma,"screen","full","lh","dvh","lvh","svh","min","max","fit",...V()],te=()=>[e,Ce,_e],D=()=>[...N(),sx,ox,{position:[Ce,_e]}],M=()=>["no-repeat",{repeat:["","x","y","space","round"]}],B=()=>["auto","cover","contain",MD,RD,{size:[Ce,_e]}],J=()=>[Hh,Us,yi],Y=()=>["","none","full",m,Ce,_e],le=()=>["",He,Us,yi],ae=()=>["solid","dashed","dotted","double"],ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],xe=()=>[He,Hh,sx,ox],Oe=()=>["","none",w,Ce,_e],Ie=()=>["none",He,Ce,_e],Ve=()=>["none",He,Ce,_e],it=()=>[He,Ce,_e],Qe=()=>[Ma,"full",...V()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ea],breakpoint:[ea],color:[i_],container:[ea],"drop-shadow":[ea],ease:["in","out","in-out"],font:[CD],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ea],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ea],shadow:[ea],spacing:["px",He],text:[ea],"text-shadow":[ea],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ma,_e,Ce,E]}],container:["container"],"container-type":[{"@container":["","normal","size",Ce,_e]}],"container-named":[ED],columns:[{columns:[He,_e,Ce,d]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"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:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ye()}],"inset-x":[{"inset-x":ye()}],"inset-y":[{"inset-y":ye()}],start:[{"inset-s":ye(),start:ye()}],end:[{"inset-e":ye(),end:ye()}],"inset-bs":[{"inset-bs":ye()}],"inset-be":[{"inset-be":ye()}],top:[{top:ye()}],right:[{right:ye()}],bottom:[{bottom:ye()}],left:[{left:ye()}],visibility:["visible","invisible","collapse"],z:[{z:[Rr,"auto",Ce,_e]}],basis:[{basis:[Ma,"full","auto",d,...V()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[He,Ma,"auto","initial","none",_e]}],grow:[{grow:["",He,Ce,_e]}],shrink:[{shrink:["",He,Ce,_e]}],order:[{order:[Rr,"first","last","none",Ce,_e]}],"grid-cols":[{"grid-cols":be()}],"col-start-end":[{col:he()}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":be()}],"row-start-end":[{row:he()}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ue()}],"auto-rows":[{"auto-rows":ue()}],gap:[{gap:V()}],"gap-x":[{"gap-x":V()}],"gap-y":[{"gap-y":V()}],"justify-content":[{justify:[...pe(),"normal"]}],"justify-items":[{"justify-items":[...ge(),"normal"]}],"justify-self":[{"justify-self":["auto",...ge()]}],"align-content":[{content:["normal",...pe()]}],"align-items":[{items:[...ge(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ge(),{baseline:["","last"]}]}],"place-content":[{"place-content":pe()}],"place-items":[{"place-items":[...ge(),"baseline"]}],"place-self":[{"place-self":["auto",...ge()]}],p:[{p:V()}],px:[{px:V()}],py:[{py:V()}],ps:[{ps:V()}],pe:[{pe:V()}],pbs:[{pbs:V()}],pbe:[{pbe:V()}],pt:[{pt:V()}],pr:[{pr:V()}],pb:[{pb:V()}],pl:[{pl:V()}],m:[{m:k()}],mx:[{mx:k()}],my:[{my:k()}],ms:[{ms:k()}],me:[{me:k()}],mbs:[{mbs:k()}],mbe:[{mbe:k()}],mt:[{mt:k()}],mr:[{mr:k()}],mb:[{mb:k()}],ml:[{ml:k()}],"space-x":[{"space-x":V()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":V()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],"inline-size":[{inline:["auto",...re()]}],"min-inline-size":[{"min-inline":["auto",...re()]}],"max-inline-size":[{"max-inline":["none",...re()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[d,"screen",...K()]}],"min-w":[{"min-w":[d,"screen","none",...K()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[u]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",r,Us,yi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,DD,jD]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Hh,_e]}],"font-family":[{font:[AD,TD,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":[He,"none",Ce,ix]}],leading:[{leading:[l,...V()]}],"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:te()}],"text-color":[{text:te()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ae(),"wavy"]}],"text-decoration-thickness":[{decoration:[He,"from-font","auto",Ce,yi]}],"text-decoration-color":[{decoration:te()}],"underline-offset":[{"underline-offset":[He,"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:V()}],"tab-size":[{tab:[Rr,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:D()}],"bg-repeat":[{bg:M()}],"bg-size":[{bg:B()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Rr,Ce,_e],radial:["",Ce,_e],conic:[Rr,Ce,_e]},ND,OD]}],"bg-color":[{bg:te()}],"gradient-from-pos":[{from:J()}],"gradient-via-pos":[{via:J()}],"gradient-to-pos":[{to:J()}],"gradient-from":[{from:te()}],"gradient-via":[{via:te()}],"gradient-to":[{to:te()}],rounded:[{rounded:Y()}],"rounded-s":[{"rounded-s":Y()}],"rounded-e":[{"rounded-e":Y()}],"rounded-t":[{"rounded-t":Y()}],"rounded-r":[{"rounded-r":Y()}],"rounded-b":[{"rounded-b":Y()}],"rounded-l":[{"rounded-l":Y()}],"rounded-ss":[{"rounded-ss":Y()}],"rounded-se":[{"rounded-se":Y()}],"rounded-ee":[{"rounded-ee":Y()}],"rounded-es":[{"rounded-es":Y()}],"rounded-tl":[{"rounded-tl":Y()}],"rounded-tr":[{"rounded-tr":Y()}],"rounded-br":[{"rounded-br":Y()}],"rounded-bl":[{"rounded-bl":Y()}],"border-w":[{border:le()}],"border-w-x":[{"border-x":le()}],"border-w-y":[{"border-y":le()}],"border-w-s":[{"border-s":le()}],"border-w-e":[{"border-e":le()}],"border-w-bs":[{"border-bs":le()}],"border-w-be":[{"border-be":le()}],"border-w-t":[{"border-t":le()}],"border-w-r":[{"border-r":le()}],"border-w-b":[{"border-b":le()}],"border-w-l":[{"border-l":le()}],"divide-x":[{"divide-x":le()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":le()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ae(),"hidden","none"]}],"divide-style":[{divide:[...ae(),"hidden","none"]}],"border-color":[{border:te()}],"border-color-x":[{"border-x":te()}],"border-color-y":[{"border-y":te()}],"border-color-s":[{"border-s":te()}],"border-color-e":[{"border-e":te()}],"border-color-bs":[{"border-bs":te()}],"border-color-be":[{"border-be":te()}],"border-color-t":[{"border-t":te()}],"border-color-r":[{"border-r":te()}],"border-color-b":[{"border-b":te()}],"border-color-l":[{"border-l":te()}],"divide-color":[{divide:te()}],"outline-style":[{outline:[...ae(),"none","hidden"]}],"outline-offset":[{"outline-offset":[He,Ce,_e]}],"outline-w":[{outline:["",He,Us,yi]}],"outline-color":[{outline:te()}],shadow:[{shadow:["","none",y,Yc,Kc]}],"shadow-color":[{shadow:te()}],"inset-shadow":[{"inset-shadow":["none",v,Yc,Kc]}],"inset-shadow-color":[{"inset-shadow":te()}],"ring-w":[{ring:le()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:te()}],"ring-offset-w":[{"ring-offset":[He,yi]}],"ring-offset-color":[{"ring-offset":te()}],"inset-ring-w":[{"inset-ring":le()}],"inset-ring-color":[{"inset-ring":te()}],"text-shadow":[{"text-shadow":["none",b,Yc,Kc]}],"text-shadow-color":[{"text-shadow":te()}],opacity:[{opacity:[He,Ce,_e]}],"mix-blend":[{"mix-blend":[...ve(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ve()}],"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":[He]}],"mask-image-linear-from-pos":[{"mask-linear-from":xe()}],"mask-image-linear-to-pos":[{"mask-linear-to":xe()}],"mask-image-linear-from-color":[{"mask-linear-from":te()}],"mask-image-linear-to-color":[{"mask-linear-to":te()}],"mask-image-t-from-pos":[{"mask-t-from":xe()}],"mask-image-t-to-pos":[{"mask-t-to":xe()}],"mask-image-t-from-color":[{"mask-t-from":te()}],"mask-image-t-to-color":[{"mask-t-to":te()}],"mask-image-r-from-pos":[{"mask-r-from":xe()}],"mask-image-r-to-pos":[{"mask-r-to":xe()}],"mask-image-r-from-color":[{"mask-r-from":te()}],"mask-image-r-to-color":[{"mask-r-to":te()}],"mask-image-b-from-pos":[{"mask-b-from":xe()}],"mask-image-b-to-pos":[{"mask-b-to":xe()}],"mask-image-b-from-color":[{"mask-b-from":te()}],"mask-image-b-to-color":[{"mask-b-to":te()}],"mask-image-l-from-pos":[{"mask-l-from":xe()}],"mask-image-l-to-pos":[{"mask-l-to":xe()}],"mask-image-l-from-color":[{"mask-l-from":te()}],"mask-image-l-to-color":[{"mask-l-to":te()}],"mask-image-x-from-pos":[{"mask-x-from":xe()}],"mask-image-x-to-pos":[{"mask-x-to":xe()}],"mask-image-x-from-color":[{"mask-x-from":te()}],"mask-image-x-to-color":[{"mask-x-to":te()}],"mask-image-y-from-pos":[{"mask-y-from":xe()}],"mask-image-y-to-pos":[{"mask-y-to":xe()}],"mask-image-y-from-color":[{"mask-y-from":te()}],"mask-image-y-to-color":[{"mask-y-to":te()}],"mask-image-radial":[{"mask-radial":[Ce,_e]}],"mask-image-radial-from-pos":[{"mask-radial-from":xe()}],"mask-image-radial-to-pos":[{"mask-radial-to":xe()}],"mask-image-radial-from-color":[{"mask-radial-from":te()}],"mask-image-radial-to-color":[{"mask-radial-to":te()}],"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":N()}],"mask-image-conic-pos":[{"mask-conic":[He]}],"mask-image-conic-from-pos":[{"mask-conic-from":xe()}],"mask-image-conic-to-pos":[{"mask-conic-to":xe()}],"mask-image-conic-from-color":[{"mask-conic-from":te()}],"mask-image-conic-to-color":[{"mask-conic-to":te()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:D()}],"mask-repeat":[{mask:M()}],"mask-size":[{mask:B()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ce,_e]}],filter:[{filter:["","none",Ce,_e]}],blur:[{blur:Oe()}],brightness:[{brightness:[He,Ce,_e]}],contrast:[{contrast:[He,Ce,_e]}],"drop-shadow":[{"drop-shadow":["","none",x,Yc,Kc]}],"drop-shadow-color":[{"drop-shadow":te()}],grayscale:[{grayscale:["",He,Ce,_e]}],"hue-rotate":[{"hue-rotate":[He,Ce,_e]}],invert:[{invert:["",He,Ce,_e]}],saturate:[{saturate:[He,Ce,_e]}],sepia:[{sepia:["",He,Ce,_e]}],"backdrop-filter":[{"backdrop-filter":["","none",Ce,_e]}],"backdrop-blur":[{"backdrop-blur":Oe()}],"backdrop-brightness":[{"backdrop-brightness":[He,Ce,_e]}],"backdrop-contrast":[{"backdrop-contrast":[He,Ce,_e]}],"backdrop-grayscale":[{"backdrop-grayscale":["",He,Ce,_e]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[He,Ce,_e]}],"backdrop-invert":[{"backdrop-invert":["",He,Ce,_e]}],"backdrop-opacity":[{"backdrop-opacity":[He,Ce,_e]}],"backdrop-saturate":[{"backdrop-saturate":[He,Ce,_e]}],"backdrop-sepia":[{"backdrop-sepia":["",He,Ce,_e]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":V()}],"border-spacing-x":[{"border-spacing-x":V()}],"border-spacing-y":[{"border-spacing-y":V()}],"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:[He,"initial",Ce,_e]}],ease:[{ease:["linear","initial",R,Ce,_e]}],delay:[{delay:[He,Ce,_e]}],animate:[{animate:["none",T,Ce,_e]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[_,Ce,_e]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Ie()}],"rotate-x":[{"rotate-x":Ie()}],"rotate-y":[{"rotate-y":Ie()}],"rotate-z":[{"rotate-z":Ie()}],scale:[{scale:Ve()}],"scale-x":[{"scale-x":Ve()}],"scale-y":[{"scale-y":Ve()}],"scale-z":[{"scale-z":Ve()}],"scale-3d":["scale-3d"],skew:[{skew:it()}],"skew-x":[{"skew-x":it()}],"skew-y":[{"skew-y":it()}],transform:[{transform:[Ce,_e,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Qe()}],"translate-x":[{"translate-x":Qe()}],"translate-y":[{"translate-y":Qe()}],"translate-z":[{"translate-z":Qe()}],"translate-none":["translate-none"],zoom:[{zoom:[Rr,Ce,_e]}],accent:[{accent:te()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:te()}],"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":te()}],"scrollbar-track-color":[{"scrollbar-track":te()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":V()}],"scroll-mx":[{"scroll-mx":V()}],"scroll-my":[{"scroll-my":V()}],"scroll-ms":[{"scroll-ms":V()}],"scroll-me":[{"scroll-me":V()}],"scroll-mbs":[{"scroll-mbs":V()}],"scroll-mbe":[{"scroll-mbe":V()}],"scroll-mt":[{"scroll-mt":V()}],"scroll-mr":[{"scroll-mr":V()}],"scroll-mb":[{"scroll-mb":V()}],"scroll-ml":[{"scroll-ml":V()}],"scroll-p":[{"scroll-p":V()}],"scroll-px":[{"scroll-px":V()}],"scroll-py":[{"scroll-py":V()}],"scroll-ps":[{"scroll-ps":V()}],"scroll-pe":[{"scroll-pe":V()}],"scroll-pbs":[{"scroll-pbs":V()}],"scroll-pbe":[{"scroll-pbe":V()}],"scroll-pt":[{"scroll-pt":V()}],"scroll-pr":[{"scroll-pr":V()}],"scroll-pb":[{"scroll-pb":V()}],"scroll-pl":[{"scroll-pl":V()}],"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",...te()]}],"stroke-w":[{stroke:[He,Us,yi,ix]}],stroke:[{stroke:["none",...te()]}],"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"]}},LD=hD(kD);function Je(...e){return LD(J1(e))}function $D({delayDuration:e=0,...n}){return f.jsx(FN,{"data-slot":"tooltip-provider",delayDuration:e,...n})}function ID({...e}){return f.jsx(VN,{"data-slot":"tooltip",...e})}function PD({...e}){return f.jsx(UN,{"data-slot":"tooltip-trigger",...e})}function FD({className:e,sideOffset:n=0,children:r,...i}){return f.jsx(HN,{children:f.jsxs(BN,{"data-slot":"tooltip-content",sideOffset:n,className:Je("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,f.jsx(qN,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}const Mm=new Set;function VD(e){return Mm.add(e),()=>Mm.delete(e)}function UD(){for(const e of Mm)e()}const h_=(...e)=>e.filter((n,r,i)=>!!n&&n.trim()!==""&&i.indexOf(n)===r).join(" ").trim();const HD=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const BD=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,r,i)=>i?i.toUpperCase():r.toLowerCase());const lx=e=>{const n=BD(e);return n.charAt(0).toUpperCase()+n.slice(1)};var Bh={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 qD=e=>{for(const n in e)if(n.startsWith("aria-")||n==="role"||n==="title")return!0;return!1},GD=S.createContext({}),ZD=()=>S.useContext(GD),KD=S.forwardRef(({color:e,size:n,strokeWidth:r,absoluteStrokeWidth:i,className:s="",children:l,iconNode:u,...d},p)=>{const{size:m=24,strokeWidth:y=2,absoluteStrokeWidth:v=!1,color:b="currentColor",className:x=""}=ZD()??{},w=i??v?Number(r??y)*24/Number(n??m):r??y;return S.createElement("svg",{ref:p,...Bh,width:n??m??Bh.width,height:n??m??Bh.height,stroke:e??b,strokeWidth:w,className:h_("lucide",x,s),...!l&&!qD(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(KD,{ref:l,iconNode:n,className:h_(`lucide-${HD(lx(e))}`,`lucide-${e}`,i),...s}));return r.displayName=lx(e),r};const YD=[["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"}]],QD=Me("beaker",YD);const XD=[["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"}]],JD=Me("book-open",XD);const WD=[["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"}]],ez=Me("briefcase",WD);const tz=[["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"}]],nz=Me("bug",tz);const rz=[["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"}]],az=Me("calendar",rz);const iz=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],m_=Me("check",iz);const oz=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Bp=Me("chevron-down",oz);const sz=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],lz=Me("chevron-right",sz);const cz=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],uz=Me("chevron-up",cz);const dz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],fz=Me("circle-check",dz);const hz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],p_=Me("clock",hz);const mz=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],pz=Me("code",mz);const gz=[["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"}]],vz=Me("compass",gz);const yz=[["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"}]],bz=Me("copy",yz);const xz=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],wz=Me("credit-card",xz);const Sz=[["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",Sz);const Cz=[["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"}]],Ez=Me("download",Cz);const Rz=[["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"}]],jz=Me("ellipsis",Rz);const Tz=[["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"}]],g_=Me("file-text",Tz);const Oz=[["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"}]],Az=Me("flag",Oz);const Mz=[["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"}]],qp=Me("folder",Mz);const Nz=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Dz=Me("gauge",Nz);const zz=[["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"}]],kz=Me("gavel",zz);const Lz=[["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"}]],v_=Me("globe",Lz);const $z=[["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"}]],Iz=Me("graduation-cap",$z);const Pz=[["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"}]],Fz=Me("heart",Pz);const Vz=[["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"}]],Uz=Me("history",Vz);const Hz=[["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"}]],Bz=Me("image",Hz);const qz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Gz=Me("info",qz);const Zz=[["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"}]],Kz=Me("layout-dashboard",Zz);const Yz=[["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"}]],Qz=Me("lightbulb",Yz);const Xz=[["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"}]],Jz=Me("link",Xz);const Wz=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ek=Me("loader-circle",Wz);const tk=[["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"}]],y_=Me("lock",tk);const nk=[["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"}]],rk=Me("log-out",nk);const ak=[["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"}]],ik=Me("megaphone",ak);const ok=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],sk=Me("menu",ok);const lk=[["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"}]],ck=Me("music",lk);const uk=[["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"}]],dk=Me("octagon-x",uk);const fk=[["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"}]],hk=Me("package",fk);const mk=[["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"}]],pk=Me("pen-line",mk);const gk=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],vk=Me("plus",gk);const yk=[["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"}]],bk=Me("rocket",yk);const xk=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],b_=Me("search",xk);const wk=[["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"}]],Sk=Me("settings",wk);const _k=[["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"}]],Ck=Me("share-2",_k);const Ek=[["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"}]],x_=Me("shield",Ek);const Rk=[["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"}]],w_=Me("square-terminal",Rk);const jk=[["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"}]],Tk=Me("star",jk);const Ok=[["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"}]],Ak=Me("trash-2",Ok);const Mk=[["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"}]],S_=Me("triangle-alert",Mk);const Nk=[["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"}]],Dk=Me("upload",Nk);const zk=[["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"}]],__=Me("users",zk);const kk=[["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"}]],Lk=Me("wrench",kk);const $k=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],C_=Me("x",$k);function Ik(){const e=!document.body.classList.contains("sb-open");document.body.classList.toggle("sb-open"),Qu(),e?document.getElementById("sidebar")?.querySelector(Pk)?.focus():document.getElementById("menu-btn")?.focus()}const Pk='a[href], button:not(:disabled), select, input, [tabindex]:not([tabindex="-1"])';function mr(){const e=document.body.classList.contains("sb-open");document.body.classList.remove("sb-open"),Qu(),e&&window.innerWidth<=su&&document.getElementById("menu-btn")?.focus()}const su=900;function Qu(){const e=document.getElementById("sidebar");if(!e)return;const n=document.body.classList.contains("sb-open");window.innerWidth<=su&&!n?e.setAttribute("inert",""):e.removeAttribute("inert");const i=document.getElementById("main");i&&(n&&window.innerWidth<=su?i.setAttribute("inert",""):i.removeAttribute("inert")),e.setAttribute("aria-modal",String(n&&window.innerWidth<=su)),document.getElementById("menu-btn")?.setAttribute("aria-expanded",String(n))}typeof window<"u"&&(window.addEventListener("resize",Qu),window.addEventListener("keydown",e=>{e.key==="Escape"&&document.body.classList.contains("sb-open")&&mr()}));const Fk={alert:S_,card:wz,check:m_,chev:lz,chevd:Bp,clock:p_,copy:bz,doc:g_,dots:jz,download:Ez,folder:qp,dashboard:Kz,gear:Sk,globe:v_,hist:Uz,link:Jz,lock:y_,menu:sk,plus:vk,power:rk,search:b_,share:Ck,shield:x_,terminal:w_,trash:Ak,upload:Dk,users:__,x:C_};function ut({name:e}){const n=Fk[e];return n?f.jsx(n,{className:"ico","aria-hidden":"true"}):null}const Nm={folder:qp,"book-open":JD,"file-text":g_,"pen-line":pk,users:__,briefcase:ez,megaphone:ik,rocket:bk,lightbulb:Qz,flag:Az,star:Tk,heart:Fz,code:pz,"square-terminal":w_,bug:nz,wrench:Lk,database:_z,package:hk,beaker:QD,gauge:Dz,shield:x_,lock:y_,gavel:kz,globe:v_,compass:vz,calendar:az,clock:p_,"graduation-cap":Iz,image:Bz,music:ck};function $o({name:e,className:n}){const r=e??"",i=Object.hasOwn(Nm,r)?Nm[r]:qp;return f.jsx(i,{className:n,"aria-hidden":"true"})}function Vk({size:e=22}){return f.jsxs("svg",{width:e,height:e,viewBox:"0 0 32 32",fill:"currentColor",role:"img","aria-label":"BearDrive",children:[f.jsx("rect",{x:"4",y:"4",width:"5.6",height:"24"}),f.jsx("rect",{x:"11.2",y:"4",width:"14.4",height:"11.2"}),f.jsx("rect",{x:"11.2",y:"16.8",width:"16.8",height:"11.2"})]})}function Su(e){const n=["page",e.width??"app",e.className].filter(Boolean).join(" ");return f.jsx("div",{className:n,children:e.children})}function Uk(e){e&&Qu()}function cl(e){return f.jsxs(f.Fragment,{children:[f.jsx("div",{id:"sb-backdrop",onClick:mr}),f.jsxs("aside",{id:"sidebar",ref:Uk,children:[e.vault,e.projectsNav,e.tree??f.jsx("nav",{id:"tree","aria-label":"Files"}),e.orgBar]}),f.jsxs("main",{id:"main",children:[e.topbar,f.jsx("article",{id:"content",ref:e.contentRef,onScroll:e.onContentScroll,children:e.children})]})]})}function Xu(e){const{name:n,onHome:r,showSignout:i,search:s}=e;return f.jsxs("header",{id:"vault",children:[f.jsx("span",{id:"vault-badge",children:f.jsx(Vk,{size:22})}),f.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}),f.jsxs("div",{className:"vault-actions",children:[s&&f.jsxs(ID,{delayDuration:150,children:[f.jsx(PD,{asChild:!0,children:f.jsx("button",{id:"search-btn",className:"icon-btn2","aria-label":"Search",onClick:()=>{UD(),mr()},children:f.jsx(ut,{name:"search"})})}),f.jsxs(FD,{className:"tipcard",sideOffset:6,children:["Search ",f.jsx("kbd",{children:"⌘K"})]})]}),i&&f.jsx("a",{id:"signout",href:"/auth/logout",title:"Sign out","aria-label":"Sign out",children:f.jsx(ut,{name:"power"})})]})]})}function ul(e){return f.jsxs("header",{id:"topbar",children:[f.jsx("button",{id:"menu-btn",className:"icon-btn",title:"Menu","aria-label":"Menu","aria-controls":"sidebar","aria-expanded":"false",onClick:Ik,children:f.jsx(ut,{name:"menu"})}),f.jsx("span",{id:"crumb",children:e.crumb}),f.jsx("span",{id:"meta",children:e.meta}),e.actions]})}function Hk(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 Bk=e=>{switch(e){case"success":return Zk;case"info":return Yk;case"warning":return Kk;case"error":return Qk;default:return null}},qk=Array(12).fill(0),Gk=({visible:e,className:n})=>me.createElement("div",{className:["sonner-loading-wrapper",n].filter(Boolean).join(" "),"data-visible":e},me.createElement("div",{className:"sonner-spinner"},qk.map((r,i)=>me.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${i}`})))),Zk=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},me.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"})),Kk=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},me.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"})),Yk=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},me.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"})),Qk=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},me.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"})),Xk=me.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"},me.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),me.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Jk=()=>{const[e,n]=me.useState(document.hidden);return me.useEffect(()=>{const r=()=>{n(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let Dm=1;class Wk{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:Dm++,u=this.toasts.find(p=>p.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(p=>p.id===l?(this.publish({...p,...n,id:l,title:i}),{...p,...n,id:l,dismissible:d,title:i}):p):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],me.isValidElement(m))l=!1,this.create({id:i,type:"default",message:m});else if(t3(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,w=typeof v=="object"&&!me.isValidElement(v)?v:{message:v};this.create({id:i,type:"error",description:b,...w})}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,w=typeof v=="object"&&!me.isValidElement(v)?v:{message:v};this.create({id:i,type:"error",description:b,...w})}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,w=typeof v=="object"&&!me.isValidElement(v)?v:{message:v};this.create({id:i,type:"success",description:b,...w})}}).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"&&!me.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)}),p=()=>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:p}:Object.assign(i,{unwrap:p})},this.custom=(n,r)=>{const i=r?.id||Dm++;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 Tn=new Wk,e3=(e,n)=>{const r=n?.id||Dm++;return Tn.addToast({title:e,...n,id:r}),r},t3=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",n3=e3,r3=()=>Tn.toasts,a3=()=>Tn.getActiveToasts(),cx=Object.assign(n3,{success:Tn.success,info:Tn.info,warning:Tn.warning,error:Tn.error,custom:Tn.custom,message:Tn.message,promise:Tn.promise,dismiss:Tn.dismiss,loading:Tn.loading},{getHistory:r3,getToasts:a3});Hk("[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 Qc(e){return e.label!==void 0}const i3=3,o3="24px",s3="16px",ux=4e3,l3=356,c3=14,u3=45,d3=200;function jr(...e){return e.filter(Boolean).join(" ")}function f3(e){const[n,r]=e.split("-"),i=[];return n&&i.push(n),r&&i.push(r),i}const h3=e=>{var n,r,i,s,l,u,d,p,m;const{invert:y,toast:v,unstyled:b,interacting:x,setHeights:w,visibleToasts:_,heights:E,index:R,toasts:T,expanded:O,removeToast:N,defaultRichColors:L,closeButton:P,style:F,cancelButtonStyle:V,actionButtonStyle:ye,className:be="",descriptionClassName:he="",duration:X,position:ue,gap:pe,expandByDefault:ge,classNames:k,icons:K,closeButtonAriaLabel:re="Close toast"}=e,[W,te]=me.useState(null),[D,M]=me.useState(null),[B,J]=me.useState(!1),[Y,le]=me.useState(!1),[ae,ve]=me.useState(!1),[xe,Oe]=me.useState(!1),[Ie,Ve]=me.useState(!1),[it,Qe]=me.useState(0),[fn,hn]=me.useState(0),Qt=me.useRef(v.duration||X||ux),br=me.useRef(null),jt=me.useRef(null),rr=R===0,xr=R+1<=_,Tt=v.type,Vn=v.dismissible!==!1,Dt=v.className||"",kr=v.descriptionClassName||"",ar=me.useMemo(()=>E.findIndex(Ne=>Ne.toastId===v.id)||0,[E,v.id]),ir=me.useMemo(()=>{var Ne;return(Ne=v.closeButton)!=null?Ne:P},[v.closeButton,P]),wr=me.useMemo(()=>v.duration||X||ux,[v.duration,X]),or=me.useRef(0),mn=me.useRef(0),A=me.useRef(0),I=me.useRef(null),[U,ce]=ue.split("-"),Z=me.useMemo(()=>E.reduce((Ne,ht,yt)=>yt>=ar?Ne:Ne+ht.height,0),[E,ar]),ne=Jk(),de=v.invert||y,we=Tt==="loading";mn.current=me.useMemo(()=>ar*pe+Z,[ar,Z]),me.useEffect(()=>{Qt.current=wr},[wr]),me.useEffect(()=>{J(!0)},[]),me.useEffect(()=>{const Ne=jt.current;if(Ne){const ht=Ne.getBoundingClientRect().height;return hn(ht),w(yt=>[{toastId:v.id,height:ht,position:v.position},...yt]),()=>w(yt=>yt.filter(Bt=>Bt.toastId!==v.id))}},[w,v.id]),me.useLayoutEffect(()=>{if(!B)return;const Ne=jt.current,ht=Ne.style.height;Ne.style.height="auto";const yt=Ne.getBoundingClientRect().height;Ne.style.height=ht,hn(yt),w(Bt=>Bt.find(St=>St.toastId===v.id)?Bt.map(St=>St.toastId===v.id?{...St,height:yt}:St):[{toastId:v.id,height:yt,position:v.position},...Bt])},[B,v.title,v.description,w,v.id,v.jsx,v.action,v.cancel]);const Ee=me.useCallback(()=>{le(!0),Qe(mn.current),w(Ne=>Ne.filter(ht=>ht.toastId!==v.id)),setTimeout(()=>{N(v)},d3)},[v,N,w,mn]);me.useEffect(()=>{if(v.promise&&Tt==="loading"||v.duration===1/0||v.type==="loading")return;let Ne;return O||x||ne?(()=>{if(A.current{v.onAutoClose==null||v.onAutoClose.call(v,v),Ee()},Qt.current)),()=>clearTimeout(Ne)},[O,x,v,Tt,ne,Ee]),me.useEffect(()=>{v.delete&&(Ee(),v.onDismiss==null||v.onDismiss.call(v,v))},[Ee,v.delete]);function Xe(){var Ne;if(K?.loading){var ht;return me.createElement("div",{className:jr(k?.loader,v==null||(ht=v.classNames)==null?void 0:ht.loader,"sonner-loader"),"data-visible":Tt==="loading"},K.loading)}return me.createElement(Gk,{className:jr(k?.loader,v==null||(Ne=v.classNames)==null?void 0:Ne.loader),visible:Tt==="loading"})}const wt=v.icon||K?.[Tt]||Bk(Tt);var Xt,zt;return me.createElement("li",{tabIndex:0,ref:jt,className:jr(be,Dt,k?.toast,v==null||(n=v.classNames)==null?void 0:n.toast,k?.default,k?.[Tt],v==null||(r=v.classNames)==null?void 0:r[Tt]),"data-sonner-toast":"","data-rich-colors":(Xt=v.richColors)!=null?Xt:L,"data-styled":!(v.jsx||v.unstyled||b),"data-mounted":B,"data-promise":!!v.promise,"data-swiped":Ie,"data-removed":Y,"data-visible":xr,"data-y-position":U,"data-x-position":ce,"data-index":R,"data-front":rr,"data-swiping":ae,"data-dismissible":Vn,"data-type":Tt,"data-invert":de,"data-swipe-out":xe,"data-swipe-direction":D,"data-expanded":!!(O||ge&&B),"data-testid":v.testId,style:{"--index":R,"--toasts-before":R,"--z-index":T.length-R,"--offset":`${Y?it:mn.current}px`,"--initial-height":ge?"auto":`${fn}px`,...F,...v.style},onDragEnd:()=>{ve(!1),te(null),I.current=null},onPointerDown:Ne=>{Ne.button!==2&&(we||!Vn||(br.current=new Date,Qe(mn.current),Ne.target.setPointerCapture(Ne.pointerId),Ne.target.tagName!=="BUTTON"&&(ve(!0),I.current={x:Ne.clientX,y:Ne.clientY})))},onPointerUp:()=>{var Ne,ht,yt;if(xe||!Vn)return;I.current=null;const Bt=Number(((Ne=jt.current)==null?void 0:Ne.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),sr=Number(((ht=jt.current)==null?void 0:ht.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),St=new Date().getTime()-((yt=br.current)==null?void 0:yt.getTime()),yn=W==="x"?Bt:sr,Wa=Math.abs(yn)/St;if(Math.abs(yn)>=u3||Wa>.11){Qe(mn.current),v.onDismiss==null||v.onDismiss.call(v,v),M(W==="x"?Bt>0?"right":"left":sr>0?"down":"up"),Ee(),Oe(!0);return}else{var bn,xn;(bn=jt.current)==null||bn.style.setProperty("--swipe-amount-x","0px"),(xn=jt.current)==null||xn.style.setProperty("--swipe-amount-y","0px")}Ve(!1),ve(!1),te(null)},onPointerMove:Ne=>{var ht,yt,Bt;if(!I.current||!Vn||((ht=window.getSelection())==null?void 0:ht.toString().length)>0)return;const St=Ne.clientY-I.current.y,yn=Ne.clientX-I.current.x;var Wa;const bn=(Wa=e.swipeDirections)!=null?Wa:f3(ue);!W&&(Math.abs(yn)>1||Math.abs(St)>1)&&te(Math.abs(yn)>Math.abs(St)?"x":"y");let xn={x:0,y:0};const $i=lr=>1/(1.5+Math.abs(lr)/20);if(W==="y"){if(bn.includes("top")||bn.includes("bottom"))if(bn.includes("top")&&St<0||bn.includes("bottom")&&St>0)xn.y=St;else{const lr=St*$i(St);xn.y=Math.abs(lr)0)xn.x=yn;else{const lr=yn*$i(yn);xn.x=Math.abs(lr)0||Math.abs(xn.y)>0)&&Ve(!0),(yt=jt.current)==null||yt.style.setProperty("--swipe-amount-x",`${xn.x}px`),(Bt=jt.current)==null||Bt.style.setProperty("--swipe-amount-y",`${xn.y}px`)}},ir&&!v.jsx&&Tt!=="loading"?me.createElement("button",{"aria-label":re,"data-disabled":we,"data-close-button":!0,onClick:we||!Vn?()=>{}:()=>{Ee(),v.onDismiss==null||v.onDismiss.call(v,v)},className:jr(k?.closeButton,v==null||(i=v.classNames)==null?void 0:i.closeButton)},(zt=K?.close)!=null?zt:Xk):null,(Tt||v.icon||v.promise)&&v.icon!==null&&(K?.[Tt]!==null||v.icon)?me.createElement("div",{"data-icon":"",className:jr(k?.icon,v==null||(s=v.classNames)==null?void 0:s.icon)},v.promise||v.type==="loading"&&!v.icon?v.icon||Xe():null,v.type!=="loading"?wt:null):null,me.createElement("div",{"data-content":"",className:jr(k?.content,v==null||(l=v.classNames)==null?void 0:l.content)},me.createElement("div",{"data-title":"",className:jr(k?.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?me.createElement("div",{"data-description":"",className:jr(he,kr,k?.description,v==null||(d=v.classNames)==null?void 0:d.description)},typeof v.description=="function"?v.description():v.description):null),me.isValidElement(v.cancel)?v.cancel:v.cancel&&Qc(v.cancel)?me.createElement("button",{"data-button":!0,"data-cancel":!0,style:v.cancelButtonStyle||V,onClick:Ne=>{Qc(v.cancel)&&Vn&&(v.cancel.onClick==null||v.cancel.onClick.call(v.cancel,Ne),Ee())},className:jr(k?.cancelButton,v==null||(p=v.classNames)==null?void 0:p.cancelButton)},v.cancel.label):null,me.isValidElement(v.action)?v.action:v.action&&Qc(v.action)?me.createElement("button",{"data-button":!0,"data-action":!0,style:v.actionButtonStyle||ye,onClick:Ne=>{Qc(v.action)&&(v.action.onClick==null||v.action.onClick.call(v.action,Ne),!Ne.defaultPrevented&&Ee())},className:jr(k?.actionButton,v==null||(m=v.classNames)==null?void 0:m.actionButton)},v.action.label):null)};function dx(){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 m3(e,n){const r={};return[e,n].forEach((i,s)=>{const l=s===1,u=l?"--mobile-offset":"--offset",d=l?s3:o3;function p(m){["top","right","bottom","left"].forEach(y=>{r[`${u}-${y}`]=typeof m=="number"?`${m}px`:m})}typeof i=="number"||typeof i=="string"?p(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]}):p(d)}),r}const p3=me.forwardRef(function(n,r){const{id:i,invert:s,position:l="bottom-right",hotkey:u=["altKey","KeyT"],expand:d,closeButton:p,className:m,offset:y,mobileOffset:v,theme:b="light",richColors:x,duration:w,style:_,visibleToasts:E=i3,toastOptions:R,dir:T=dx(),gap:O=c3,icons:N,containerAriaLabel:L="Notifications"}=n,[P,F]=me.useState([]),V=me.useMemo(()=>i?P.filter(B=>B.toasterId===i):P.filter(B=>!B.toasterId),[P,i]),ye=me.useMemo(()=>Array.from(new Set([l].concat(V.filter(B=>B.position).map(B=>B.position)))),[V,l]),[be,he]=me.useState([]),[X,ue]=me.useState(!1),[pe,ge]=me.useState(!1),[k,K]=me.useState(b!=="system"?b:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),re=me.useRef(null),W=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),te=me.useRef(null),D=me.useRef(!1),M=me.useCallback(B=>{F(J=>{var Y;return(Y=J.find(le=>le.id===B.id))!=null&&Y.delete||Tn.dismiss(B.id),J.filter(({id:le})=>le!==B.id)})},[]);return me.useEffect(()=>Tn.subscribe(B=>{if(B.dismiss){requestAnimationFrame(()=>{F(J=>J.map(Y=>Y.id===B.id?{...Y,delete:!0}:Y))});return}setTimeout(()=>{yj.flushSync(()=>{F(J=>{const Y=J.findIndex(le=>le.id===B.id);return Y!==-1?[...J.slice(0,Y),{...J[Y],...B},...J.slice(Y+1)]:[B,...J]})})})}),[P]),me.useEffect(()=>{if(b!=="system"){K(b);return}if(b==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?K("dark"):K("light")),typeof window>"u")return;const B=window.matchMedia("(prefers-color-scheme: dark)");try{B.addEventListener("change",({matches:J})=>{K(J?"dark":"light")})}catch{B.addListener(({matches:Y})=>{try{K(Y?"dark":"light")}catch(le){console.error(le)}})}},[b]),me.useEffect(()=>{P.length<=1&&ue(!1)},[P]),me.useEffect(()=>{const B=J=>{var Y;if(u.every(ve=>J[ve]||J.code===ve)){var ae;ue(!0),(ae=re.current)==null||ae.focus()}J.code==="Escape"&&(document.activeElement===re.current||(Y=re.current)!=null&&Y.contains(document.activeElement))&&ue(!1)};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[u]),me.useEffect(()=>{if(re.current)return()=>{te.current&&(te.current.focus({preventScroll:!0}),te.current=null,D.current=!1)}},[re.current]),me.createElement("section",{ref:r,"aria-label":`${L} ${W}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},ye.map((B,J)=>{var Y;const[le,ae]=B.split("-");return V.length?me.createElement("ol",{key:B,dir:T==="auto"?dx():T,tabIndex:-1,ref:re,className:m,"data-sonner-toaster":!0,"data-sonner-theme":k,"data-y-position":le,"data-x-position":ae,style:{"--front-toast-height":`${((Y=be[0])==null?void 0:Y.height)||0}px`,"--width":`${l3}px`,"--gap":`${O}px`,..._,...m3(y,v)},onBlur:ve=>{D.current&&!ve.currentTarget.contains(ve.relatedTarget)&&(D.current=!1,te.current&&(te.current.focus({preventScroll:!0}),te.current=null))},onFocus:ve=>{ve.target instanceof HTMLElement&&ve.target.dataset.dismissible==="false"||D.current||(D.current=!0,te.current=ve.relatedTarget)},onMouseEnter:()=>ue(!0),onMouseMove:()=>ue(!0),onMouseLeave:()=>{pe||ue(!1)},onDragEnd:()=>ue(!1),onPointerDown:ve=>{ve.target instanceof HTMLElement&&ve.target.dataset.dismissible==="false"||ge(!0)},onPointerUp:()=>ge(!1)},V.filter(ve=>!ve.position&&J===0||ve.position===B).map((ve,xe)=>{var Oe,Ie;return me.createElement(h3,{key:ve.id,icons:N,index:xe,toast:ve,defaultRichColors:x,duration:(Oe=R?.duration)!=null?Oe:w,className:R?.className,descriptionClassName:R?.descriptionClassName,invert:s,visibleToasts:E,closeButton:(Ie=R?.closeButton)!=null?Ie:p,interacting:pe,position:B,style:R?.style,unstyled:R?.unstyled,classNames:R?.classNames,cancelButtonStyle:R?.cancelButtonStyle,actionButtonStyle:R?.actionButtonStyle,closeButtonAriaLabel:R?.closeButtonAriaLabel,removeToast:M,toasts:V.filter(Ve=>Ve.position==ve.position),heights:be.filter(Ve=>Ve.position==ve.position),setHeights:he,expandByDefault:d,gap:O,expanded:X,swipeDirections:n.swipeDirections})})):null}))}),g3=({...e})=>f.jsx(p3,{theme:"dark",className:"toaster group",icons:{success:f.jsx(fz,{className:"size-4"}),info:f.jsx(Gz,{className:"size-4"}),warning:f.jsx(S_,{className:"size-4"}),error:f.jsx(dk,{className:"size-4"}),loading:f.jsx(ek,{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 Ke(e,n=!1){n?cx.error(e,{duration:1/0,closeButton:!0}):cx(e)}function v3(){return f.jsx(g3,{position:"bottom-center"})}const fx=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,hx=J1,y3=(e,n)=>r=>{var i;if(n?.variants==null)return hx(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=fx(y)||fx(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},{}),p=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(w=>{let[_,E]=w;return Array.isArray(E)?E.includes({...l,...d}[_]):{...l,...d}[_]===E})?[...m,v,b]:m},[]);return hx(e,u,p,r?.class,r?.className)},b3=y3("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 vt({className:e,variant:n="default",size:r="default",asChild:i=!1,...s}){const l=i?bj:"button";return f.jsx(l,{"data-slot":"button","data-variant":n,"data-size":r,className:Je(b3({variant:n,size:r,className:e})),...s})}function Ju({...e}){return f.jsx(hp,{"data-slot":"dialog",...e})}function x3({...e}){return f.jsx(pp,{"data-slot":"dialog-portal",...e})}function w3({className:e,...n}){return f.jsx(gp,{"data-slot":"dialog-overlay",className:Je("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 Wu({className:e,children:n,showCloseButton:r=!0,...i}){return f.jsxs(x3,{"data-slot":"dialog-portal",children:[f.jsx(w3,{}),f.jsxs(vp,{"data-slot":"dialog-content",className:Je("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&&f.jsxs(aS,{"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:[f.jsx(C_,{}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Sl({className:e,...n}){return f.jsx(tS,{"data-slot":"dialog-title",className:Je("text-lg leading-none font-semibold",e),...n})}let E_=null,lu=[];function _l(e){E_=e,lu.forEach(n=>n())}function R_(e,n,r="",i="OK",s={}){return new Promise(l=>_l({kind:"prompt",title:e,label:n,value:r,okLabel:i,...s,resolve:l}))}function Cl(e,n,r="Confirm",i=!1){return new Promise(s=>_l({kind:"confirm",title:e,message:n,confirmLabel:r,danger:i,resolve:s}))}function S3(){const e=S.useSyncExternalStore(r=>(lu.push(r),()=>{lu=lu.filter(i=>i!==r)}),()=>E_);if(!e)return null;const n=()=>{_l(null),e.kind==="prompt"?e.resolve(null):e.resolve(!1)};return f.jsx(Ju,{open:!0,onOpenChange:r=>!r&&n(),children:f.jsx(Wu,{className:"modal",showCloseButton:!1,children:e.kind==="prompt"?f.jsx(_3,{m:e}):f.jsx(C3,{m:e})})})}function _3({m:e}){const n=S.useRef(null),r=m=>{_l(null),e.resolve(m)},[i,s]=S.useState(""),[l,u]=S.useState(e.value),d=e.match===void 0||l.trim()===e.match,p=()=>{const m=l;if(d){if(!m.trim()){s("Give it a name."),n.current.focus();return}r(m)}};return f.jsxs(f.Fragment,{children:[f.jsx(Sl,{asChild:!0,children:f.jsx("h3",{children:e.title})}),f.jsx("label",{className:"modal-label",htmlFor:"modal-input",children:e.label}),f.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"&&p()}),i&&f.jsx("span",{id:"modal-input-err",role:"alert",className:"field-err",children:i}),f.jsxs("div",{className:"modal-actions",children:[f.jsx(vt,{variant:"subtle",onClick:()=>r(null),children:"Cancel"}),f.jsx(vt,{variant:e.danger?"danger":"primary",onClick:p,disabled:!d,children:e.okLabel})]})]})}function C3({m:e}){const n=r=>{_l(null),e.resolve(r)};return f.jsxs(f.Fragment,{children:[f.jsx(Sl,{asChild:!0,children:f.jsx("h3",{children:e.title})}),f.jsx("p",{className:"modal-msg",children:e.message}),f.jsxs("div",{className:"modal-actions",children:[f.jsx(vt,{variant:"subtle",onClick:()=>n(!1),autoFocus:e.danger,children:"Cancel"}),f.jsx(vt,{variant:e.danger?"danger":"primary",onClick:()=>n(!0),autoFocus:!e.danger,children:e.confirmLabel})]})]})}function E3(e){return Ht({queryKey:["projects"],queryFn:()=>Yt("/api/projects"),enabled:e,refetchInterval:3e4,select:n=>n.projects||[]})}function R3(e){return Ht({queryKey:["orgs"],queryFn:()=>Yt("/api/orgs"),enabled:e,select:n=>n.orgs||[]})}function j3(e){return Ht({queryKey:["permissions",e],queryFn:()=>Yt(`/api/p/${e}/permissions`),enabled:!!e})}function j_(e,n=!0){return Ht({queryKey:["shares",e],queryFn:()=>Yt(`/api/p/${e}/shares`),enabled:!!e&&n,select:r=>r.shares||[]})}function T_(e){return Ht({queryKey:["admin","pending"],queryFn:()=>Yt("/api/admin/pending"),enabled:e,select:n=>n.pending||[]})}function O_(){const e=Ai();return()=>Promise.all([e.invalidateQueries({queryKey:["projects"]}),e.invalidateQueries({queryKey:["orgs"]})]).then(()=>{})}function A_(e){return e.split("/").map(encodeURIComponent).join("/")}function T3(e){try{return decodeURIComponent(e)}catch{return e}}function M_(e){return e.split("/").map(T3).join("/")}const O3=new Set(["dashboard","history","install","settings"]),mx={insights:"dashboard"};function A3(e){return Object.hasOwn(mx,e)?mx[e]:void 0}const Gp=["q","user","since","until"];function Zp(e){return!!e&&Gp.some(n=>!!e[n])}function N_(e){const n=new URLSearchParams;for(const i of Gp)e?.[i]&&n.set(i,e[i]);const r=n.toString();return r?"?"+r:""}function D_(e,n){const r=e.indexOf("?"),i=r===-1?null:new URLSearchParams(e.slice(r)),s=i?.get("v")||"",l=i?.get("connect")||"",u=M3(r===-1?e:e.slice(0,r),n);s&&(u.version=s),l&&(u.connect=l);const d={};for(const p of Gp){const m=i?.get(p);m&&(d[p]=m)}if(Zp(d)&&(u.filters=d),u.view==="history"&&!u.viewTarget){const p=(i?.get("path")||i?.get("prefix")||"").replace(/^\/+|\/+$/g,"");p&&(u.viewTarget=M_(p),u.queryTarget=!0)}return u}function px(e,n){const r=n.replace(/\/+$/,"");return r!==n&&(e.trailingSlash=!0),e.path=r?M_(r):"",e}function M3(e,n){const r=e.replace(/^\/+/,"");if(n!=="hub")return px({path:""},r);if(r==="orgs"||r.startsWith("orgs/"))return{org:r.slice(5).replace(/\/+$/,""),path:""};if(r==="billing"||r.startsWith("billing/"))return{billing:!0,path:""};const i=r.indexOf("/");if(i===-1)return{project:r,path:""};const s=px({project:r.slice(0,i),path:""},r.slice(i+1)),l=s.path.indexOf("/"),u=l===-1?s.path:s.path.slice(0,l),d=A3(u);return(O3.has(u)||d)&&(s.view=d||u,d&&(s.legacyView=!0),s.viewTarget=l===-1?"":s.path.slice(l+1).replace(/\/+$/,""),s.path=""),s}function dl(e,n,r){const i=A_(e),s=r?"?v="+r:"";return n?"/"+n+(i?"/"+i:"")+s:"/"+i+s}function Pn(e,n,r,i){let s=(n?"/"+n:"")+"/"+e;return r&&(s+="/"+A_(r.replace(/\/+$/,""))),s+(e==="history"?N_(i):"")}let Kp="POP";const zm=new Set;function z_(){for(const e of zm)e()}window.addEventListener("popstate",()=>{Kp="POP",z_()});function Zt(e,n){const r=location.pathname+location.search;!n?.replace&&r===e||(history[n?.replace?"replaceState":"pushState"](null,"",e),Kp=n?.replace?"REPLACE":"PUSH",z_())}function Yp(){return S.useSyncExternalStore(e=>(zm.add(e),()=>{zm.delete(e)}),()=>location.pathname+location.search)}function N3(){return Kp}function Bo(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(),Zt(e),document.body.classList.remove("sb-open"))}}:{href:e,target:"_blank",rel:"noopener noreferrer"}}function Ys({to:e}){return S.useEffect(()=>{Zt(e,{replace:!0})},[e]),null}function k_(){return{accessor:(e,n)=>typeof e=="function"?{...n,accessorFn:e}:{...n,accessorKey:e},display:e=>e,group:e=>e}}function Da(e,n){return typeof e=="function"?e(n):e}function Fn(e,n){return r=>{n.setState(i=>({...i,[e]:Da(r,i[e])}))}}function ed(e){return e instanceof Function}function D3(e){return Array.isArray(e)&&e.every(n=>typeof n=="number")}function z3(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 ze(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=(w,_)=>{for(w=String(w);w.length<_;)w=" "+w;return w};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 ke(e,n,r,i){return{debug:()=>{var s;return(s=e?.debugAll)!=null?s:e[n]},key:!1,onChange:i}}function k3(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:ze(()=>[e,r,n,l],(u,d,p,m)=>({table:u,column:d,row:p,cell:m,getValue:m.getValue,renderValue:m.renderValue}),ke(e.options,"debugCells"))};return e._features.forEach(u=>{u.createCell==null||u.createCell(l,r,n,e)},{}),l}function L3(e,n,r,i){var s,l;const d={...e._getDefaultColumnDef(),...n},p=d.accessorKey;let m=(s=(l=d.id)!=null?l:p?typeof String.prototype.replaceAll=="function"?p.replaceAll(".","_"):p.replace(/\./g,"_"):void 0)!=null?s:typeof d.header=="string"?d.header:void 0,y;if(d.accessorFn?y=d.accessorFn:p&&(p.includes(".")?y=b=>{let x=b;for(const _ of p.split(".")){var w;x=(w=x)==null?void 0:w[_]}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:ze(()=>[!0],()=>{var b;return[v,...(b=v.columns)==null?void 0:b.flatMap(x=>x.getFlatColumns())]},ke(e.options,"debugColumns")),getLeafColumns:ze(()=>[e._getOrderColumnsFn()],b=>{var x;if((x=v.columns)!=null&&x.length){let w=v.columns.flatMap(_=>_.getLeafColumns());return b(w)}return[v]},ke(e.options,"debugColumns"))};for(const b of e._features)b.createColumn==null||b.createColumn(v,e);return v}const un="debugHeaders";function gx(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=p=>{p.subHeaders&&p.subHeaders.length&&p.subHeaders.map(d),u.push(p)};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 $3={createTable:e=>{e.getHeaderGroups=ze(()=>[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:[],p=(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 Xc(n,[...d,...m,...p],e)},ke(e.options,un)),e.getCenterHeaderGroups=ze(()=>[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))),Xc(n,r,e,"center")),ke(e.options,un)),e.getLeftHeaderGroups=ze(()=>[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 Xc(n,l,e,"left")},ke(e.options,un)),e.getRightHeaderGroups=ze(()=>[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 Xc(n,l,e,"right")},ke(e.options,un)),e.getFooterGroups=ze(()=>[e.getHeaderGroups()],n=>[...n].reverse(),ke(e.options,un)),e.getLeftFooterGroups=ze(()=>[e.getLeftHeaderGroups()],n=>[...n].reverse(),ke(e.options,un)),e.getCenterFooterGroups=ze(()=>[e.getCenterHeaderGroups()],n=>[...n].reverse(),ke(e.options,un)),e.getRightFooterGroups=ze(()=>[e.getRightHeaderGroups()],n=>[...n].reverse(),ke(e.options,un)),e.getFlatHeaders=ze(()=>[e.getHeaderGroups()],n=>n.map(r=>r.headers).flat(),ke(e.options,un)),e.getLeftFlatHeaders=ze(()=>[e.getLeftHeaderGroups()],n=>n.map(r=>r.headers).flat(),ke(e.options,un)),e.getCenterFlatHeaders=ze(()=>[e.getCenterHeaderGroups()],n=>n.map(r=>r.headers).flat(),ke(e.options,un)),e.getRightFlatHeaders=ze(()=>[e.getRightHeaderGroups()],n=>n.map(r=>r.headers).flat(),ke(e.options,un)),e.getCenterLeafHeaders=ze(()=>[e.getCenterFlatHeaders()],n=>n.filter(r=>{var i;return!((i=r.subHeaders)!=null&&i.length)}),ke(e.options,un)),e.getLeftLeafHeaders=ze(()=>[e.getLeftFlatHeaders()],n=>n.filter(r=>{var i;return!((i=r.subHeaders)!=null&&i.length)}),ke(e.options,un)),e.getRightLeafHeaders=ze(()=>[e.getRightFlatHeaders()],n=>n.filter(r=>{var i;return!((i=r.subHeaders)!=null&&i.length)}),ke(e.options,un)),e.getLeafHeaders=ze(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(n,r,i)=>{var s,l,u,d,p,m;return[...(s=(l=n[0])==null?void 0:l.headers)!=null?s:[],...(u=(d=r[0])==null?void 0:d.headers)!=null?u:[],...(p=(m=i[0])==null?void 0:m.headers)!=null?p:[]].map(y=>y.getLeafHeaders()).flat()},ke(e.options,un))}};function Xc(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(w=>w.getIsVisible()).forEach(w=>{var _;(_=w.columns)!=null&&_.length&&d(w.columns,x+1)},0)};d(e);let p=[];const m=(b,x)=>{const w={depth:x,id:[i,`${x}`].filter(Boolean).join("_"),headers:[]},_=[];b.forEach(E=>{const R=[..._].reverse()[0],T=E.column.depth===w.depth;let O,N=!1;if(T&&E.column.parent?O=E.column.parent:(O=E.column,N=!0),R&&R?.column===O)R.subHeaders.push(E);else{const L=gx(r,O,{id:[i,x,O.id,E?.id].filter(Boolean).join("_"),isPlaceholder:N,placeholderId:N?`${_.filter(P=>P.column===O).length}`:void 0,depth:x,index:_.length});L.subHeaders.push(E),_.push(L)}w.headers.push(E),E.headerGroup=w}),p.push(w),x>0&&m(_,x-1)},y=n.map((b,x)=>gx(r,b,{depth:u,index:x}));m(y,u-1),p.reverse();const v=b=>b.filter(w=>w.column.getIsVisible()).map(w=>{let _=0,E=0,R=[0];w.subHeaders&&w.subHeaders.length?(R=[],v(w.subHeaders).forEach(O=>{let{colSpan:N,rowSpan:L}=O;_+=N,R.push(L)})):_=1;const T=Math.min(...R);return E=E+T,w.colSpan=_,w.rowSpan=E,{colSpan:_,rowSpan:E}});return v((s=(l=p[0])==null?void 0:l.headers)!=null?s:[]),p}const I3=(e,n,r,i,s,l,u)=>{let d={id:n,index:i,original:r,depth:s,parentId:u,_valuesCache:{},_uniqueValuesCache:{},getValue:p=>{if(d._valuesCache.hasOwnProperty(p))return d._valuesCache[p];const m=e.getColumn(p);if(m!=null&&m.accessorFn)return d._valuesCache[p]=m.accessorFn(d.original,i),d._valuesCache[p]},getUniqueValues:p=>{if(d._uniqueValuesCache.hasOwnProperty(p))return d._uniqueValuesCache[p];const m=e.getColumn(p);if(m!=null&&m.accessorFn)return m.columnDef.getUniqueValues?(d._uniqueValuesCache[p]=m.columnDef.getUniqueValues(d.original,i),d._uniqueValuesCache[p]):(d._uniqueValuesCache[p]=[d.getValue(p)],d._uniqueValuesCache[p])},renderValue:p=>{var m;return(m=d.getValue(p))!=null?m:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>z3(d.subRows,p=>p.subRows),getParentRow:()=>d.parentId?e.getRow(d.parentId,!0):void 0,getParentRows:()=>{let p=[],m=d;for(;;){const y=m.getParentRow();if(!y)break;p.push(y),m=y}return p.reverse()},getAllCells:ze(()=>[e.getAllLeafColumns()],p=>p.map(m=>k3(e,d,m,m.id)),ke(e.options,"debugRows")),_getAllCellsByColumnId:ze(()=>[d.getAllCells()],p=>p.reduce((m,y)=>(m[y.column.id]=y,m),{}),ke(e.options,"debugRows"))};for(let p=0;p{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()}}},L_=(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))};L_.autoRemove=e=>gr(e);const $_=(e,n,r)=>{var i;return!!(!((i=e.getValue(n))==null||(i=i.toString())==null)&&i.includes(r))};$_.autoRemove=e=>gr(e);const I_=(e,n,r)=>{var i;return((i=e.getValue(n))==null||(i=i.toString())==null?void 0:i.toLowerCase())===r?.toLowerCase()};I_.autoRemove=e=>gr(e);const P_=(e,n,r)=>{var i;return(i=e.getValue(n))==null?void 0:i.includes(r)};P_.autoRemove=e=>gr(e);const F_=(e,n,r)=>!r.some(i=>{var s;return!((s=e.getValue(n))!=null&&s.includes(i))});F_.autoRemove=e=>gr(e)||!(e!=null&&e.length);const V_=(e,n,r)=>r.some(i=>{var s;return(s=e.getValue(n))==null?void 0:s.includes(i)});V_.autoRemove=e=>gr(e)||!(e!=null&&e.length);const U_=(e,n,r)=>e.getValue(n)===r;U_.autoRemove=e=>gr(e);const H_=(e,n,r)=>e.getValue(n)==r;H_.autoRemove=e=>gr(e);const Qp=(e,n,r)=>{let[i,s]=r;const l=e.getValue(n);return l>=i&&l<=s};Qp.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]};Qp.autoRemove=e=>gr(e)||gr(e[0])&&gr(e[1]);const ta={includesString:L_,includesStringSensitive:$_,equalsString:I_,arrIncludes:P_,arrIncludesAll:F_,arrIncludesSome:V_,equals:U_,weakEquals:H_,inNumberRange:Qp};function gr(e){return e==null||e===""}const F3={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Fn("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"?ta.includesString:typeof i=="number"?ta.inNumberRange:typeof i=="boolean"||i!==null&&typeof i=="object"?ta.equals:Array.isArray(i)?ta.arrIncludes:ta.weakEquals},e.getFilterFn=()=>{var r,i;return ed(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:ta[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=Da(r,l?l.value:void 0);if(vx(s,u,e)){var d;return(d=i?.filter(y=>y.id!==e.id))!=null?d:[]}const p={id:e.id,value:u};if(l){var m;return(m=i?.map(y=>y.id===e.id?p:y))!=null?m:[]}return i!=null&&i.length?[...i,p]:[p]})}},createRow:(e,n)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=n=>{const r=e.getAllLeafColumns(),i=s=>{var l;return(l=Da(n,s))==null?void 0:l.filter(u=>{const d=r.find(p=>p.id===u.id);if(d){const p=d.getFilterFn();if(vx(p,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 vx(e,n,r){return(e&&e.autoRemove?e.autoRemove(n,r):!1)||typeof n>"u"||typeof n=="string"&&!n}const V3=(e,n,r)=>r.reduce((i,s)=>{const l=s.getValue(e);return i+(typeof l=="number"?l:0)},0),U3=(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},H3=(e,n,r)=>{let i;return r.forEach(s=>{const l=s.getValue(e);l!=null&&(i=l)&&(i=l)}),i},B3=(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},G3=(e,n)=>{if(!n.length)return;const r=n.map(l=>l.getValue(e));if(!D3(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},Z3=(e,n)=>Array.from(new Set(n.map(r=>r.getValue(e))).values()),K3=(e,n)=>new Set(n.map(r=>r.getValue(e))).size,Y3=(e,n)=>n.length,qh={sum:V3,min:U3,max:H3,extent:B3,mean:q3,median:G3,unique:Z3,uniqueCount:K3,count:Y3},Q3={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:Fn("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 qh.sum;if(Object.prototype.toString.call(i)==="[object Date]")return qh.extent},e.getAggregationFn=()=>{var r,i;if(!e)throw new Error;return ed(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:qh[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 X3(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 J3={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Fn("columnOrder",e)}),createColumn:(e,n)=>{e.getIndex=ze(r=>[Ws(n,r)],r=>r.findIndex(i=>i.id===e.id),ke(n.options,"debugColumns")),e.getIsFirstColumn=r=>{var i;return((i=Ws(n,r)[0])==null?void 0:i.id)===e.id},e.getIsLastColumn=r=>{var i;const s=Ws(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=ze(()=>[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 p=u.shift(),m=d.findIndex(y=>y.id===p);m>-1&&l.push(d.splice(m,1)[0])}l=[...l,...d]}return X3(l,r,i)},ke(e.options,"debugTable"))}},Gh=()=>({left:[],right:[]}),W3={getInitialState:e=>({columnPinning:Gh(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Fn("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,p;return{left:((d=s?.left)!=null?d:[]).filter(v=>!(i!=null&&i.includes(v))),right:[...((p=s?.right)!=null?p:[]).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=ze(()=>[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))},ke(n.options,"debugRows")),e.getLeftVisibleCells=ze(()=>[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"})),ke(n.options,"debugRows")),e.getRightVisibleCells=ze(()=>[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"})),ke(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?Gh():(r=(i=e.initialState)==null?void 0:i.columnPinning)!=null?r:Gh())},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=ze(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(n,r)=>(r??[]).map(i=>n.find(s=>s.id===i)).filter(Boolean),ke(e.options,"debugColumns")),e.getRightLeafColumns=ze(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(n,r)=>(r??[]).map(i=>n.find(s=>s.id===i)).filter(Boolean),ke(e.options,"debugColumns")),e.getCenterLeafColumns=ze(()=>[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))},ke(e.options,"debugColumns"))}};function e4(e){return e||(typeof document<"u"?document:null)}const Jc={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Zh=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),t4={getDefaultColumnDef:()=>Jc,getInitialState:e=>({columnSizing:{},columnSizingInfo:Zh(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Fn("columnSizing",e),onColumnSizingInfoChange:Fn("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:Jc.minSize,(i=l??e.columnDef.size)!=null?i:Jc.size),(s=e.columnDef.maxSize)!=null?s:Jc.maxSize)},e.getStart=ze(r=>[r,Ws(n,r),n.getState().columnSizing],(r,i)=>i.slice(0,e.getIndex(r)).reduce((s,l)=>s+l.getSize(),0),ke(n.options,"debugColumns")),e.getAfter=ze(r=>[r,Ws(n,r),n.getState().columnSizing],(r,i)=>i.slice(e.getIndex(r)+1).reduce((s,l)=>s+l.getSize(),0),ke(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(),Kh(l)&&l.touches&&l.touches.length>1))return;const u=e.getSize(),d=e?e.getLeafHeaders().map(R=>[R.column.id,R.column.getSize()]):[[i.id,i.getSize()]],p=Kh(l)?Math.round(l.touches[0].clientX):l.clientX,m={},y=(R,T)=>{typeof T=="number"&&(n.setColumnSizingInfo(O=>{var N,L;const P=n.options.columnResizeDirection==="rtl"?-1:1,F=(T-((N=O?.startOffset)!=null?N:0))*P,V=Math.max(F/((L=O?.startSize)!=null?L:0),-.999999);return O.columnSizingStart.forEach(ye=>{let[be,he]=ye;m[be]=Math.round(Math.max(he+he*V,0)*100)/100}),{...O,deltaOffset:F,deltaPercentage:V}}),(n.options.columnResizeMode==="onChange"||R==="end")&&n.setColumnSizing(O=>({...O,...m})))},v=R=>y("move",R),b=R=>{y("end",R),n.setColumnSizingInfo(T=>({...T,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},x=e4(r),w={moveHandler:R=>v(R.clientX),upHandler:R=>{x?.removeEventListener("mousemove",w.moveHandler),x?.removeEventListener("mouseup",w.upHandler),b(R.clientX)}},_={moveHandler:R=>(R.cancelable&&(R.preventDefault(),R.stopPropagation()),v(R.touches[0].clientX),!1),upHandler:R=>{var T;x?.removeEventListener("touchmove",_.moveHandler),x?.removeEventListener("touchend",_.upHandler),R.cancelable&&(R.preventDefault(),R.stopPropagation()),b((T=R.touches[0])==null?void 0:T.clientX)}},E=n4()?{passive:!1}:!1;Kh(l)?(x?.addEventListener("touchmove",_.moveHandler,E),x?.addEventListener("touchend",_.upHandler,E)):(x?.addEventListener("mousemove",w.moveHandler,E),x?.addEventListener("mouseup",w.upHandler,E)),n.setColumnSizingInfo(R=>({...R,startOffset:p,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?Zh():(r=e.initialState.columnSizingInfo)!=null?r:Zh())},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 Wc=null;function n4(){if(typeof Wc=="boolean")return Wc;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 Wc=e,Wc}function Kh(e){return e.type==="touchstart"}const r4={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Fn("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=ze(()=>[e.getAllCells(),n.getState().columnVisibility],r=>r.filter(i=>i.column.getIsVisible()),ke(n.options,"debugRows")),e.getVisibleCells=ze(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(r,i,s)=>[...r,...i,...s],ke(n.options,"debugRows"))},createTable:e=>{const n=(r,i)=>ze(()=>[i(),i().filter(s=>s.getIsVisible()).map(s=>s.id).join("_")],s=>s.filter(l=>l.getIsVisible==null?void 0:l.getIsVisible()),ke(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 Ws(e,n){return n?n==="center"?e.getCenterVisibleLeafColumns():n==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const a4={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()}}},i4={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Fn("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=()=>ta.includesString,e.getGlobalFilterFn=()=>{var n,r;const{globalFilterFn:i}=e.options;return ed(i)?i:i==="auto"?e.getGlobalAutoFilterFn():(n=(r=e.options.filterFns)==null?void 0:r[i])!=null?n:ta[i]},e.setGlobalFilter=n=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(n)},e.resetGlobalFilter=n=>{e.setGlobalFilter(n?void 0:e.initialState.globalFilter)}}},o4={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Fn("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,...p}=u;return p}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()}}}},km=0,Lm=10,Yh=()=>({pageIndex:km,pageSize:Lm}),s4={getInitialState:e=>({...e,pagination:{...Yh(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:Fn("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=>Da(i,l);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(s)},e.resetPagination=i=>{var s;e.setPagination(i?Yh():(s=e.initialState.pagination)!=null?s:Yh())},e.setPageIndex=i=>{e.setPagination(s=>{let l=Da(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?km:(s=(l=e.initialState)==null||(l=l.pagination)==null?void 0:l.pageIndex)!=null?s:km)},e.resetPageSize=i=>{var s,l;e.setPageSize(i?Lm:(s=(l=e.initialState)==null||(l=l.pagination)==null?void 0:l.pageSize)!=null?s:Lm)},e.setPageSize=i=>{e.setPagination(s=>{const l=Math.max(1,Da(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=Da(i,(l=e.options.pageCount)!=null?l:-1);return typeof u=="number"&&(u=Math.max(-1,u)),{...s,pageCount:u}}),e.getPageOptions=ze(()=>[e.getPageCount()],i=>{let s=[];return i&&i>0&&(s=[...new Array(i)].fill(null).map((l,u)=>u)),s},ke(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:[]}),l4={getInitialState:e=>({rowPinning:Qh(),...e}),getDefaultOptions:e=>({onRowPinningChange:Fn("rowPinning",e)}),createRow:(e,n)=>{e.pin=(r,i,s)=>{const l=i?e.getLeafRows().map(p=>{let{id:m}=p;return m}):[],u=s?e.getParentRows().map(p=>{let{id:m}=p;return m}):[],d=new Set([...u,e.id,...l]);n.setRowPinning(p=>{var m,y;if(r==="bottom"){var v,b;return{top:((v=p?.top)!=null?v:[]).filter(_=>!(d!=null&&d.has(_))),bottom:[...((b=p?.bottom)!=null?b:[]).filter(_=>!(d!=null&&d.has(_))),...Array.from(d)]}}if(r==="top"){var x,w;return{top:[...((x=p?.top)!=null?x:[]).filter(_=>!(d!=null&&d.has(_))),...Array.from(d)],bottom:((w=p?.bottom)!=null?w:[]).filter(_=>!(d!=null&&d.has(_)))}}return{top:((m=p?.top)!=null?m:[]).filter(_=>!(d!=null&&d.has(_))),bottom:((y=p?.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=ze(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(n,r)=>e._getPinnedRows(n,r,"top"),ke(e.options,"debugRows")),e.getBottomRows=ze(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(n,r)=>e._getPinnedRows(n,r,"bottom"),ke(e.options,"debugRows")),e.getCenterRows=ze(()=>[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))},ke(e.options,"debugRows"))}},c4={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Fn("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=>{$m(s,l.id,i,!0,e)}),s}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=ze(()=>[e.getState().rowSelection,e.getCoreRowModel()],(n,r)=>Object.keys(n).length?Xh(e,r):{rows:[],flatRows:[],rowsById:{}},ke(e.options,"debugTable")),e.getFilteredSelectedRowModel=ze(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(n,r)=>Object.keys(n).length?Xh(e,r):{rows:[],flatRows:[],rowsById:{}},ke(e.options,"debugTable")),e.getGroupedSelectedRowModel=ze(()=>[e.getState().rowSelection,e.getSortedRowModel()],(n,r)=>Object.keys(n).length?Xh(e,r):{rows:[],flatRows:[],rowsById:{}},ke(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 $m(d,e.id,r,(u=i?.selectChildren)!=null?u:!0,n),d})},e.getIsSelected=()=>{const{rowSelection:r}=n.getState();return Xp(e,r)},e.getIsSomeSelected=()=>{const{rowSelection:r}=n.getState();return Im(e,r)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:r}=n.getState();return Im(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)}}}},$m=(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=>$m(e,d.id,r,i,s))};function Xh(e,n){const r=e.getState().rowSelection,i=[],s={},l=function(u,d){return u.map(p=>{var m;const y=Xp(p,r);if(y&&(i.push(p),s[p.id]=p),(m=p.subRows)!=null&&m.length&&(p={...p,subRows:l(p.subRows)}),y)return p}).filter(Boolean)};return{rows:l(n.rows),flatRows:i,rowsById:s}}function Xp(e,n){var r;return(r=n[e.id])!=null?r:!1}function Im(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()&&(Xp(u,n)?l=!0:s=!1),u.subRows&&u.subRows.length)){const d=Im(u,n);d==="all"?l=!0:(d==="some"&&(l=!0),s=!1)}}),s?"all":l?"some":!1}const Pm=/([0-9]+)/gm,u4=(e,n,r)=>B_(Ba(e.getValue(r)).toLowerCase(),Ba(n.getValue(r)).toLowerCase()),d4=(e,n,r)=>B_(Ba(e.getValue(r)),Ba(n.getValue(r))),f4=(e,n,r)=>Jp(Ba(e.getValue(r)).toLowerCase(),Ba(n.getValue(r)).toLowerCase()),h4=(e,n,r)=>Jp(Ba(e.getValue(r)),Ba(n.getValue(r))),m4=(e,n,r)=>{const i=e.getValue(r),s=n.getValue(r);return i>s?1:iJp(e.getValue(r),n.getValue(r));function Jp(e,n){return e===n?0:e>n?1:-1}function Ba(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function B_(e,n){const r=e.split(Pm).filter(Boolean),i=n.split(Pm).filter(Boolean);for(;r.length&&i.length;){const s=r.shift(),l=i.shift(),u=parseInt(s,10),d=parseInt(l,10),p=[u,d].sort();if(isNaN(p[0])){if(s>l)return 1;if(l>s)return-1;continue}if(isNaN(p[1]))return isNaN(u)?-1:1;if(u>d)return 1;if(d>u)return-1}return r.length-i.length}const Hs={alphanumeric:u4,alphanumericCaseSensitive:d4,text:f4,textCaseSensitive:h4,datetime:m4,basic:p4},g4={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Fn("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 Hs.datetime;if(typeof l=="string"&&(i=!0,l.split(Pm).length>1))return Hs.alphanumeric}return i?Hs.text:Hs.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 ed(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:Hs[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),p=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&&p!==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())}},v4=[$3,r4,J3,W3,P3,F3,a4,i4,g4,Q3,o4,s4,l4,c4,t4];function y4(e){var n,r;const i=[...v4,...(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 p={...{},...(r=e.initialState)!=null?r:{}};s._features.forEach(b=>{var x;p=(x=b.getInitialState==null?void 0:b.getInitialState(p))!=null?x:p});const m=[];let y=!1;const v={_features:i,options:{...l,...e},initialState:p,_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=Da(b,s.options);s.options=u(x)},getState:()=>s.options.state,setState:b=>{s.options.onStateChange==null||s.options.onStateChange(b)},_getRowId:(b,x,w)=>{var _;return(_=s.options.getRowId==null?void 0:s.options.getRowId(b,x,w))!=null?_:`${w?[w.id,x].join("."):x}`},getCoreRowModel:()=>(s._getCoreRowModel||(s._getCoreRowModel=s.options.getCoreRowModel(s)),s._getCoreRowModel()),getRowModel:()=>s.getPaginationRowModel(),getRow:(b,x)=>{let w=(x?s.getPrePaginationRowModel():s.getRowModel()).rowsById[b];if(!w&&(w=s.getCoreRowModel().rowsById[b],!w))throw new Error;return w},_getDefaultColumnDef:ze(()=>[s.options.defaultColumn],b=>{var x;return b=(x=b)!=null?x:{},{header:w=>{const _=w.header.column.columnDef;return _.accessorKey?_.accessorKey:_.accessorFn?_.id:null},cell:w=>{var _,E;return(_=(E=w.renderValue())==null||E.toString==null?void 0:E.toString())!=null?_:null},...s._features.reduce((w,_)=>Object.assign(w,_.getDefaultColumnDef==null?void 0:_.getDefaultColumnDef()),{}),...b}},ke(e,"debugColumns")),_getColumnDefs:()=>s.options.columns,getAllColumns:ze(()=>[s._getColumnDefs()],b=>{const x=function(w,_,E){return E===void 0&&(E=0),w.map(R=>{const T=L3(s,R,E,_),O=R;return T.columns=O.columns?x(O.columns,T,E+1):[],T})};return x(b)},ke(e,"debugColumns")),getAllFlatColumns:ze(()=>[s.getAllColumns()],b=>b.flatMap(x=>x.getFlatColumns()),ke(e,"debugColumns")),_getAllFlatColumnsById:ze(()=>[s.getAllFlatColumns()],b=>b.reduce((x,w)=>(x[w.id]=w,x),{}),ke(e,"debugColumns")),getAllLeafColumns:ze(()=>[s.getAllColumns(),s._getOrderColumnsFn()],(b,x)=>{let w=b.flatMap(_=>_.getLeafColumns());return x(w)},ke(e,"debugColumns")),getColumn:b=>s._getAllFlatColumnsById()[b]};Object.assign(s,v);for(let b=0;bze(()=>[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 G_(){return e=>ze(()=>[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(p=>{var m;return(m=e.getColumn(p.id))==null?void 0:m.getCanSort()}),u={};l.forEach(p=>{const m=e.getColumn(p.id);m&&(u[p.id]={sortUndefined:m.columnDef.sortUndefined,invertSorting:m.columnDef.invertSorting,sortingFn:m.getSortingFn()})});const d=p=>{const m=p.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}},ke(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function Fm(e,n){return e?b4(e)?S.createElement(e,n):e:null}function b4(e){return x4(e)||typeof e=="function"||w4(e)}function x4(e){return typeof e=="function"&&(()=>{const n=Object.getPrototypeOf(e);return n.prototype&&n.prototype.isReactComponent})()}function w4(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Z_(e){const n={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[r]=S.useState(()=>({current:y4(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 El=e=>e.type==="checkbox",za=e=>e instanceof Date,an=e=>e==null;const Wp=e=>typeof e=="object";var Rt=e=>!an(e)&&!Array.isArray(e)&&Wp(e)&&!za(e),S4=e=>Rt(e)&&e.target?El(e.target)?e.target.checked:e.target.value:e,_4=(e,n)=>n.split(".").some((r,i,s)=>!isNaN(Number(r))&&e.has(s.slice(0,i).join("."))),K_=e=>{const n=e.constructor&&e.constructor.prototype;return Rt(n)&&n.hasOwnProperty("isPrototypeOf")},td=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(td&&(e instanceof Blob||n))return e;const r=Array.isArray(e);if(!r&&!(Rt(e)&&K_(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 jo={BLUR:"blur",FOCUS_OUT:"focusout",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},pr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},hr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Y_="root",eg=["__proto__","constructor","prototype"],C4=/^\w*$/;var Rl=e=>C4.test(e),gt=e=>e===void 0;const E4=/[.[\]'"]/;var nd=e=>e.split(E4).filter(Boolean),Se=(e,n,r)=>{if(!n||!Rt(e))return r;const i=Rl(n)?[n]:nd(n);if(i.some(l=>eg.includes(l)))return r;const s=i.reduce((l,u)=>an(l)?void 0:l[u],e);return gt(s)||s===e?gt(e[n])?r:e[n]:s},Tr=e=>typeof e=="boolean",Jn=e=>typeof e=="function",ct=(e,n,r)=>{let i=-1;const s=Rl(n)?[n]:nd(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]!==pr.all&&(n._proxyFormState[u]=!i||pr.all),e[u]}});return s};const T4=td?me.useLayoutEffect:me.useEffect;var sn=e=>typeof e=="string",O4=(e,n,r,i,s)=>sn(e)?(i&&n.watch.add(e),Se(r,e,s)):Array.isArray(e)?e.map(l=>(i&&n.watch.add(l),Se(r,l))):(i&&(n.watchAll=!0),r),Vm=e=>an(e)||!Wp(e);const yx=(e,n)=>n.length===0&&!Array.isArray(e)&&!K_(e);function Or(e,n,r=new WeakMap){if(e===n)return!0;if(Vm(e)||Vm(n))return Object.is(e,n);if(za(e)&&za(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(yx(e,i)||yx(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 p=n[u];if(za(d)&&za(p)||(Rt(d)||Array.isArray(d))&&(Rt(p)||Array.isArray(p))?!Or(d,p,r):!Object.is(d,p))return!1}}return!0}var eu=e=>({isOnSubmit:!e||e===pr.onSubmit,isOnBlur:e===pr.onBlur,isOnChange:e===pr.onChange,isOnAll:e===pr.all,isOnTouch:e===pr.onTouched}),Jh=(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 el=(e,n,r,i)=>{for(const s of r||Object.keys(e)){const l=Se(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(el(d,n))break}else if(Rt(d)&&el(d,n))break}}};var bx=(e,n,r)=>{const i=Se(e,r),s=Array.isArray(i)?i:[];return ct(s,Y_,n[r]),ct(e,r,s),e},rn=e=>Rt(e)&&!Object.keys(e).length,tg=e=>e.type==="file",_u=e=>{if(!td)return!1;const n=e?e.ownerDocument:0;return e instanceof(n&&n.defaultView?n.defaultView.HTMLElement:HTMLElement)},ng=e=>e.type==="radio",Cu=e=>e instanceof RegExp,rg=(e,n,r,i,s)=>n?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[i]:s||!0}}:{};const xx={value:!1,isValid:!1},wx={value:!0,isValid:!0};var Q_=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&&!gt(e[0].attributes.value)?gt(e[0].value)||e[0].value===""?wx:{value:e[0].value,isValid:!0}:wx:xx}return xx};const Sx={isValid:!1,value:null};var X_=e=>Array.isArray(e)?e.reduce((n,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:n,Sx):Sx;function _x(e,n,r="validate"){if(sn(e)||Array.isArray(e)&&e.every(sn)||Tr(e)&&!e)return{type:r,message:sn(e)?e:"",ref:n}}var To=e=>Rt(e)&&!Cu(e)?e:{value:e,message:""},Cx=async(e,n,r,i,s,l)=>{const{ref:u,refs:d,required:p,maxLength:m,minLength:y,min:v,max:b,pattern:x,validate:w,name:_,valueAsNumber:E,mount:R}=e._f,T=Se(r,_);if(!R||n.has(_))return{};const O=d?d[0]:u,N=X=>{if(s&&O.reportValidity){const ue=Tr(X)?"":X||"";d?d.forEach(pe=>pe.setCustomValidity(ue)):O.setCustomValidity(ue),O.reportValidity()}},L={},P=ng(u),F=El(u),V=P||F,ye=(E||tg(u))&>(u.value)&>(T)||_u(u)&&u.value===""||T===""||Array.isArray(T)&&!T.length,be=rg.bind(null,_,i,L),he=(X,ue,pe,ge=hr.maxLength,k=hr.minLength)=>{const K=X?ue:pe;L[_]={type:X?ge:k,message:K,ref:u,...be(X?ge:k,K)}};if(l?!Array.isArray(T)||!T.length:p&&(!V&&(ye||an(T))||Tr(T)&&!T||F&&!Q_(d).isValid||P&&!X_(d).isValid)){const{value:X,message:ue}=sn(p)?{value:!!p,message:p}:To(p);if(X&&(L[_]={type:hr.required,message:ue,ref:O,...be(hr.required,ue)},!i))return N(ue),L}if(!ye&&(!an(v)||!an(b))){let X,ue;const pe=To(b),ge=To(v);if(!an(T)&&!isNaN(T)){const k=u.valueAsNumber||T&&+T;an(pe.value)||(X=k>pe.value),an(ge.value)||(ue=knew Date(new Date().toDateString()+" "+te),re=u.type=="time",W=u.type=="week";sn(pe.value)&&T&&(X=re?K(T)>K(pe.value):W?T>pe.value:k>new Date(pe.value)),sn(ge.value)&&T&&(ue=re?K(T)+X.value,ge=!an(ue.value)&&T.length<+ue.value;if((pe||ge)&&(he(pe,X.message,ue.message),!i))return N(L[_].message),L}if(x&&!ye&&sn(T)){const{value:X,message:ue}=To(x);if(Cu(X)&&!T.match(X)&&(L[_]={type:hr.pattern,message:ue,ref:u,...be(hr.pattern,ue)},!i))return N(ue),L}if(w){if(Jn(w)){const X=await w(T,r),ue=_x(X,O);if(ue&&(L[_]={...ue,...be(hr.validate,ue.message)},!i))return N(ue.message),L}else if(Rt(w)){let X={};for(const ue in w){if(!rn(X)&&!i)break;const pe=_x(await w[ue](T,r),O,ue);pe&&(X={...pe,...be(ue,pe.message)},N(pe.message),i&&(L[_]=X))}if(!rn(X)&&(L[_]={ref:O,...X},!i))return L}}return N(!0),L},cu=e=>Array.isArray(e)?e:[e],J_=e=>Array.isArray(e)?e.filter(Boolean):[];function A4(e,n){const r=n.slice(0,-1).length;let i=0;for(;ieg.includes(String(u))))return e;const i=r.length===1?e:A4(e,r),s=r.length-1,l=r[s];return i&&delete i[l],s!==0&&(Rt(i)&&rn(i)||Array.isArray(i)&&M4(i))&&Nt(e,r.slice(0,-1)),e}const W_=e=>{const n={};for(const r of Object.keys(e))if(Wp(e[r])&&e[r]!==null&&!za(e[r])){const i=W_(e[r]);for(const s of Object.keys(i))n[`${r}.${s}`]=i[s]}else n[r]=e[r];return n},N4=me.createContext(null);N4.displayName="HookFormContext";var Ex=()=>{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 eC(e,n){const r={};for(const i in e)if(e.hasOwnProperty(i)){const s=e[i],l=n[i];if(s&&Rt(s)&&l){const u=eC(s,l);Rt(u)&&(r[i]=u)}else e[i]&&(r[i]=l)}return r}var tC=e=>e.type==="select-multiple",D4=e=>ng(e)||El(e),Wh=e=>_u(e)&&e.isConnected,z4=e=>{for(const n in e)if(Jn(e[n]))return!0;return!1};function nC(e){return Array.isArray(e)||Rt(e)&&!z4(e)}function rC(e){return!!(e&&"_f"in e)}function aC(e){return Array.isArray(e)?!e.some(n=>!gt(n)):!Object.keys(e).length}function Um(e,n){Array.isArray(e)?e[n]=void 0:delete e[n]}function Hm(e,n={},r){for(const i in e){const s=e[i],l=r&&r[i];nC(s)&&(!Array.isArray(s)||!rC(l))?(n[i]=Array.isArray(s)?[]:{},Hm(s,n[i],l),aC(n[i])&&Um(n,i)):gt(s)||(n[i]=!0)}return n}function bi(e,n,r,i){r||(r=Hm(n,{},i));for(const s in e){const l=e[s],u=i&&i[s];nC(l)&&(!Array.isArray(l)||!rC(u))?(gt(n)||Vm(r[s])?r[s]=Hm(l,Array.isArray(l)?[]:{},u):bi(l,an(n)?{}:n[s],r[s],u),aC(r[s])&&Um(r,s)):Or(l,n[s])?Um(r,s):r[s]=!0}return r}var iC=(e,{valueAsNumber:n,valueAsDate:r,setValueAs:i})=>gt(e)?e:n?e===""?NaN:e&&+e:r&&sn(e)?new Date(e):i?i(e):e;function Rx(e){const n=e.ref;return tg(n)?n.files:ng(n)?X_(e.refs).value:tC(n)?[...n.selectedOptions].map(({value:r})=>r):El(n)?Q_(e.refs).value:iC(gt(n.value)?e.ref.value:n.value,e)}var k4=(e,n,r,i)=>{const s={};for(const l of e){const u=Se(n,l);u&&ct(s,l,u._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:i}},Bs=e=>gt(e)?e:Cu(e)?e.source:Rt(e)?Cu(e.value)?e.value.source:e.value:e;const jx="AsyncFunction";var L4=e=>{if(!e||!e.validate)return!1;if(Jn(e.validate))return e.validate.constructor.name===jx;if(Rt(e.validate)){for(const n in e.validate)if(e.validate[n].constructor.name===jx)return!0}return!1},$4=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Tx(e,n,r){const i=Se(e,r);if(i||Rl(r))return{error:i,name:r};const s=r.split(".");for(;s.length;){const l=s.join("."),u=Se(n,l),d=Se(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 I4=(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||pr.all))},P4=(e,n,r)=>!e||!n||e===n||cu(e).some(i=>i&&(r?i===n||i.startsWith(n+"."):i.startsWith(n)||n.startsWith(i))),F4=(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,V4=(e,n)=>!J_(Se(e,n)).length&&Nt(e,n);const U4={mode:pr.onSubmit,reValidateMode:pr.onChange,shouldFocusError:!0},em="form",oC={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function H4(e={}){let n={...U4,...e},r={...Mt(oC),isLoading:Jn(n.defaultValues),errors:n.errors||{},disabled:n.disabled||!1},i={},s=Rt(n.defaultValues)||Rt(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 p={},m={};let y=0,v=eu(n.mode),b=eu(n.reValidateMode);const x={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},w={...x};let _={...w};const E={array:Ex(),state:Ex()};let R=0;const T=n.criteriaMode===pr.all,O=(A,I)=>U=>{clearTimeout(m[A]),m[A]=setTimeout(I,U)},N=async A=>{if(!u.keepIsValid&&!n.disabled&&(w.isValid||_.isValid||A)){const I=++R;let U;n.resolver?(U=rn((await pe()).errors),I===R&&L()):U=await K({fields:i,onlyCheckValid:!0,eventType:jo.VALID}),I===R&&U!==r.isValid&&E.state.next({isValid:U})}},L=(A,I)=>{!n.disabled&&(w.isValidating||w.validatingFields||_.isValidating||_.validatingFields)&&((A||Array.from(d.mount)).forEach(U=>{U&&(I?ct(r.validatingFields,U,I):Nt(r.validatingFields,U))}),E.state.next({validatingFields:r.validatingFields,isValidating:!rn(r.validatingFields)}))},P=()=>{r.dirtyFields=bi(s,l,void 0,i)},F=(A,I=[],U,ce,Z=!0,ne=!0)=>{if(ce&&U&&!n.disabled){if(u.action=!0,ne&&Array.isArray(Se(i,A))){const de=U(Se(i,A),ce.argA,ce.argB);Z&&ct(i,A,de)}if(ne&&Array.isArray(Se(r.errors,A))){const de=U(Se(r.errors,A),ce.argA,ce.argB);Z&&ct(r.errors,A,de),V4(r.errors,A)}if((w.touchedFields||_.touchedFields)&&ne&&Array.isArray(Se(r.touchedFields,A))){const de=U(Se(r.touchedFields,A),ce.argA,ce.argB);Z&&ct(r.touchedFields,A,de)}(w.dirtyFields||_.dirtyFields)&&P(),E.state.next({name:A,isDirty:W(A,I),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ct(l,A,I)},V=(A,I)=>{ct(r.errors,A,I),r.errors={...r.errors},E.state.next({errors:r.errors})},ye=A=>{r.errors=A,E.state.next({errors:r.errors,isValid:!1})},be=A=>{const I=Rl(A)?[A]:nd(A);let U=l,ce=s;for(let Z=0;Z{const Z=Se(i,A);if(Z){if(be(A))return;const ne=gt(Se(l,A)),de=Se(l,A,gt(U)?Se(s,A):U);gt(de)||ce&&ce.defaultChecked||I?ct(l,A,I?de:Rx(Z._f)):M(A,de),u.mount&&!u.action&&(N(),ne&&r.isDirty&&(w.isDirty||_.isDirty)&&(W()||(r.isDirty=!1,E.state.next({...r}))),e.shouldUnregister&&ne&&!gt(Se(l,A))&&Jh(A,d)&&(u.watch=!0))}},X=(A,I,U,ce,Z)=>{let ne=!1,de=!1;const we={name:A};if(!n.disabled||ce===!0){if(!U||ce){const Ee=Or(Se(s,A),I);(w.isDirty||_.isDirty)&&(de=r.isDirty,r.isDirty=we.isDirty=!Ee||W(),ne=de!==we.isDirty),de=!!Se(r.dirtyFields,A),Ee!==r.isDirty?r.dirtyFields=bi(s,l,void 0,i):Ee?Nt(r.dirtyFields,A):ct(r.dirtyFields,A,!0),we.dirtyFields=r.dirtyFields,ne=ne||(w.dirtyFields||_.dirtyFields)&&de!==!Ee}if(U){const Ee=Se(r.touchedFields,A);Ee||(ct(r.touchedFields,A,U),we.touchedFields=r.touchedFields,ne=ne||(w.touchedFields||_.touchedFields)&&Ee!==U)}ne&&Z&&E.state.next(we)}return ne?we:{}},ue=(A,I,U,ce)=>{const Z=Se(r.errors,A),ne=(w.isValid||_.isValid)&&Tr(I)&&r.isValid!==I;if(n.delayError&&U?(p[A]=O(A,()=>V(A,U)),p[A](n.delayError)):(clearTimeout(m[A]),delete p[A],U?ct(r.errors,A,U):Nt(r.errors,A),r.errors={...r.errors}),(U?!Or(Z,U):Z)||!rn(ce)||ne){const de={...ce,...ne&&Tr(I)?{isValid:I}:{},errors:r.errors,name:A};r={...r,...de},E.state.next(de)}},pe=async A=>(L(A,!0),await n.resolver(l,n.context,k4(A||d.mount,i,n.criteriaMode,n.shouldUseNativeValidation))),ge=async A=>{const{errors:I}=await pe(A);if(L(A),A){for(const U of A){const ce=Se(I,U);ce?d.array.has(U)&&Rt(ce)&&!Object.keys(ce).some(Z=>!Number.isNaN(Number(Z)))?bx(r.errors,{[U]:ce},U):ct(r.errors,U,ce):Nt(r.errors,U)}r.errors={...r.errors}}else r.errors=I;return I},k=async({name:A,eventType:I})=>{if(e.validate){const U=await e.validate({formValues:l,formState:r,name:A,eventType:I});if(Rt(U))for(const ce in U){const Z=U[ce];Z&&it(`${em}.${ce}`,{message:sn(Z.message)?Z.message:"",type:Z.type||hr.validate})}else sn(U)||!U?it(em,{message:U||"",type:hr.validate}):Ve(em);return U}return!0},K=async({fields:A,onlyCheckValid:I,name:U,eventType:ce,context:Z={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(Z.runRootValidation=!0,!await k({name:U,eventType:ce})&&(Z.valid=!1,I)))return Z.valid;for(const ne in A){const de=A[ne];if(de){const{_f:we,...Ee}=de;if(we){const Xe=d.array.has(we.name),wt=de._f&&L4(de._f),Xt=w.validatingFields||w.isValidating||_.validatingFields||_.isValidating;wt&&Xt&&L([we.name],!0);const zt=await Cx(de,d.disabled,l,T,n.shouldUseNativeValidation&&!I,Xe);if(wt&&Xt&&L([we.name]),zt[we.name]&&(Z.valid=!1,I)||(!I&&(Se(zt,we.name)?Xe?bx(r.errors,zt,we.name):ct(r.errors,we.name,zt[we.name]):Nt(r.errors,we.name)),e.shouldUseNativeValidation&&zt[we.name]))break}!rn(Ee)&&await K({context:Z,onlyCheckValid:I,fields:Ee,name:ne,eventType:ce})}}return Z.valid},re=()=>{for(const A of d.unMount){const I=Se(i,A);I&&(I._f.refs?I._f.refs.every(U=>!Wh(U)):!Wh(I._f.ref))&&Qt(A)}d.unMount=new Set},W=(A,I)=>(A&&I&&ct(l,A,I),!Or(u.mount?l:s,s)),te=(A,I,U)=>O4(A,d,{...u.mount?l:gt(I)?s:sn(A)?{[A]:I}:I},U,I),D=A=>J_(Se(u.mount?l:s,A,n.shouldUnregister?Se(s,A,[]):[])),M=(A,I,U={},ce=!1,Z=!1)=>{const ne=Se(i,A);let de=I;if(ne){const we=ne._f;we&&(!we.disabled&&ct(l,A,iC(I,we)),de=_u(we.ref)&&an(I)?"":I,tC(we.ref)?[...we.ref.options].forEach(Ee=>Ee.selected=de.includes(Ee.value)):we.refs?El(we.ref)?we.refs.forEach(Ee=>{(!Ee.defaultChecked||!Ee.disabled)&&(Array.isArray(de)?Ee.checked=!!de.find(Xe=>Xe===Ee.value):Ee.checked=de===Ee.value||!!de)}):we.refs.forEach(Ee=>Ee.checked=Ee.value===de):tg(we.ref)?we.ref.value="":(we.ref.value=de,!we.ref.type&&!Z&&E.state.next({name:A,values:ce?l:Mt(l)})))}(U.shouldDirty||U.shouldTouch)&&X(A,de,U.shouldTouch,U.shouldDirty,!Z),U.shouldValidate&&xe(A,{delayError:U.delayError})},B=(A,I,U,ce=!1,Z=!1)=>{for(const ne in I){if(!I.hasOwnProperty(ne))return;const de=I[ne],we=A+"."+ne,Ee=Se(i,we);(d.array.has(A)||Rt(de)||Ee&&!Ee._f)&&!za(de)?B(we,de,U,ce,Z):M(we,de,U,ce,Z)}},J=(A,I,U,ce,Z=!1)=>{const ne=Se(i,A),de=d.array.has(A),we=ce?I:Mt(I),Ee=Se(l,A),Xe=Or(Ee,we);if(Xe||ct(l,A,we),de)E.array.next({name:A,values:ce?l:Mt(l)}),(w.isDirty||w.dirtyFields||_.isDirty||_.dirtyFields)&&U.shouldDirty&&(P(),Z||E.state.next({name:A,dirtyFields:r.dirtyFields,isDirty:W(A,we)}));else{const wt=Array.isArray(we)&&!we.length||rn(we);!ne||ne._f||an(we)||wt?M(A,we,U,ce,Z):B(A,we,U,ce,Z)}if(!Xe&&!Z){const wt=Jh(A,d),Xt=ce?l:Mt(l);E.state.next({...wt&&r,name:u.mount||wt?A:void 0,values:Xt})}},Y=(A,I,U={})=>J(A,I,U,!1),le=(A,I={})=>{const U=Jn(A)?A(l):A;if(!Or(l,U)){l={...l,...U};const ce=W_(U);for(const Z of d.mount)Z in ce&&J(Z,ce[Z],I,!0,!0);E.state.next({...r,name:void 0,type:void 0,...y?{values:l}:{}}),I.shouldValidate&&N()}},ae=async A=>{u.mount=!0;const I=A.target;let U=I.name,ce=!0;const Z=Se(i,U),ne=de=>{ce=Number.isNaN(de)||za(de)&&isNaN(de.getTime())||Or(de,Se(l,U,de))};if(Z){let de,we;const Ee=I.type?Rx(Z._f):S4(A),Xe=A.type===jo.BLUR||A.type===jo.FOCUS_OUT,wt=!$4(Z._f)&&!e.validate&&!n.resolver&&!Se(r.errors,U)&&!Z._f.deps,Xt=wt||F4(Xe,Se(r.touchedFields,U),r.isSubmitted,b,v),zt=Jh(U,d,Xe);if(ct(l,U,Ee),Xe){if(!I||!I.readOnly){Z._f.onBlur&&Z._f.onBlur(A);const yt=p[U];yt&&yt(0)}}else Z._f.onChange&&Z._f.onChange(A);const Ne=X(U,Ee,Xe),ht=!rn(Ne)||zt;if(!Xe&&E.state.next({name:U,type:A.type,...y?{values:Mt(l)}:{}}),Xt)return(!wt||!r.isValid)&&(w.isValid||_.isValid)&&(n.mode==="onBlur"?Xe&&N():Xe||N()),ht&&E.state.next({name:U,...zt?{}:Ne});if(!n.resolver&&e.validate&&await k({name:U,eventType:A.type}),!Xe&&zt&&E.state.next({...r}),n.resolver){const{errors:yt}=await pe([U]);if(L([U]),ne(Ee),!ce){!rn(Ne)&&E.state.next(Ne);return}const Bt=Tx(r.errors,i,U),sr=Tx(yt,i,Bt.name||U);de=sr.error,U=sr.name,we=rn(yt)}else L([U],!0),de=(await Cx(Z,d.disabled,l,T,n.shouldUseNativeValidation))[U],L([U]),ne(Ee),ce&&(de?we=!1:(w.isValid||_.isValid)&&(we=await K({fields:i,onlyCheckValid:!0,name:U,eventType:A.type})));ce&&(Z._f.deps&&(!Array.isArray(Z._f.deps)||Z._f.deps.length>0)&&xe(Z._f.deps),ue(U,we,de,Ne))}},ve=(A,I)=>{if(Se(r.errors,I)&&A.focus)return A.focus(),1},xe=async(A,I={})=>{let U,ce;const Z=cu(A);if(n.resolver){const ne=await ge(gt(A)?A:Z);U=rn(ne),ce=A?!Z.some(de=>Se(ne,de)):U}else A?(ce=(await Promise.all(Z.map(async ne=>{const de=Se(i,ne);return await K({fields:de&&de._f?{[ne]:de}:de,eventType:jo.TRIGGER})}))).every(Boolean),!(!ce&&!r.isValid)&&N()):ce=U=await K({fields:i,name:A,eventType:jo.TRIGGER});if(I.delayError&&n.delayError&&sn(A)){const ne=Se(r.errors,A);ne?(Nt(r.errors,A),p[A]=O(A,()=>V(A,ne)),p[A](n.delayError)):(clearTimeout(m[A]),delete p[A])}return E.state.next({...!sn(A)||(w.isValid||_.isValid)&&U!==r.isValid?{}:{name:A},...n.resolver||!A?{isValid:U}:{},errors:r.errors}),I.shouldFocus&&!ce&&el(i,ve,A?Z:d.mount),ce},Oe=(A,I)=>{let U={...u.mount?l:s};return I&&(U=eC(I.dirtyFields?r.dirtyFields:r.touchedFields,U)),gt(A)?U:sn(A)?Se(U,A):A.map(ce=>Se(U,ce))},Ie=(A,I)=>({invalid:!!Se((I||r).errors,A),isDirty:!!Se((I||r).dirtyFields,A),error:Se((I||r).errors,A),isValidating:!!Se(r.validatingFields,A),isTouched:!!Se((I||r).touchedFields,A)}),Ve=A=>{const I=A?cu(A):void 0;I?.forEach(U=>Nt(r.errors,U)),I?I.forEach(U=>{E.state.next({name:U,errors:r.errors})}):E.state.next({errors:{}})},it=(A,I,U)=>{const ce=(Se(i,A,{_f:{}})._f||{}).ref,Z=Se(r.errors,A)||{},{ref:ne,message:de,type:we,...Ee}=Z;ct(r.errors,A,{...Ee,...I,ref:ce}),E.state.next({name:A,errors:r.errors,isValid:!1}),U&&U.shouldFocus&&ce&&ce.focus&&ce.focus()},Qe=(A,I)=>{if(Jn(A)){y++;const{unsubscribe:U}=E.state.subscribe({next:Z=>"values"in Z&&A(Z.values||te(void 0,I),Z)});let ce=!1;return{unsubscribe:()=>{ce||(ce=!0,y--,U())}}}return te(A,I,!0)},fn=A=>{var I;const U=!!(!((I=A.formState)===null||I===void 0)&&I.values);U&&y++;const{unsubscribe:ce}=E.state.subscribe({next:ne=>{if(P4(A.name,ne.name,A.exact)&&I4(ne,A.formState||w,ir,A.reRenderRoot)){const de={...l};A.callback({values:de,...r,...ne,defaultValues:s})}}});if(!U)return ce;let Z=!1;return()=>{Z||(Z=!0,y--,ce())}},hn=A=>(u.mount=!0,_={..._,...A.formState},fn({...A,formState:{...x,...A.formState}})),Qt=(A,I={})=>{for(const U of A?cu(A):d.mount)d.mount.delete(U),d.array.delete(U),I.keepValue||(Nt(i,U),Nt(l,U)),!I.keepError&&Nt(r.errors,U),!I.keepDirty&&Nt(r.dirtyFields,U),!I.keepTouched&&Nt(r.touchedFields,U),!I.keepIsValidating&&Nt(r.validatingFields,U),!n.shouldUnregister&&!I.keepDefaultValue&&Nt(s,U);E.state.next({values:Mt(l)}),E.state.next({...r,...I.keepDirty?{isDirty:W()}:{}}),!I.keepIsValid&&N()},br=({disabled:A,name:I})=>{if(Tr(A)&&u.mount||A||d.disabled.has(I)){const Z=d.disabled.has(I)!==!!A;A?d.disabled.add(I):d.disabled.delete(I),Z&&u.mount&&!u.action&&N()}},jt=(A,I={})=>{let U=Se(i,A);const ce=Tr(I.disabled)||Tr(n.disabled),Z=!d.registerName.has(A)&&U&&U._f&&!U._f.mount;return ct(i,A,{...U||{},_f:{...U&&U._f?U._f:{ref:{name:A}},name:A,mount:!0,...I}}),d.mount.add(A),U&&!Z?br({disabled:Tr(I.disabled)?I.disabled:n.disabled,name:A}):he(A,!0,I.value),{...ce?{disabled:I.disabled||n.disabled}:{},...n.progressive?{required:!!I.required,min:Bs(I.min),max:Bs(I.max),minLength:Bs(I.minLength),maxLength:Bs(I.maxLength),pattern:Bs(I.pattern)}:{},name:A,onChange:ae,onBlur:ae,ref:ne=>{if(ne){d.registerName.add(A),jt(A,I),d.registerName.delete(A),U=Se(i,A);const de=gt(ne.value)&&ne.querySelectorAll&&ne.querySelectorAll("input,select,textarea")[0]||ne,we=D4(de),Ee=U._f.refs||[];if(we?Ee.find(Xe=>Xe===de):de===U._f.ref)return;ct(i,A,{_f:{...U._f,...we?{refs:[...Ee.filter(Wh),de,...Array.isArray(Se(s,A))?[{}]:[]],ref:{type:de.type,name:A}}:{ref:de}}}),he(A,!1,void 0,de)}else U=Se(i,A,{}),U._f&&(U._f.mount=!1),(n.shouldUnregister||I.shouldUnregister)&&!(_4(d.array,A)&&u.action)&&d.unMount.add(A)}}},rr=()=>n.shouldFocusError&&!n.shouldUseNativeValidation&&el(i,ve,d.mount),xr=A=>{Tr(A)&&(E.state.next({disabled:A}),el(i,(I,U)=>{const ce=Se(i,U);ce&&(I.disabled=ce._f.disabled||A,Array.isArray(ce._f.refs)&&ce._f.refs.forEach(Z=>{Z.disabled=ce._f.disabled||A}))},0,!1))},Tt=(A,I)=>async U=>{let ce;U&&(U.preventDefault&&U.preventDefault(),U.persist&&U.persist());let Z=Mt(l);if(E.state.next({isSubmitting:!0}),n.resolver){const{errors:ne,values:de}=await pe();L(),r.errors=ne,Z=Mt(de)}else await K({fields:i,eventType:jo.SUBMIT});if(d.disabled.size)for(const ne of d.disabled)Nt(Z,ne);if(Nt(r.errors,Y_),rn(r.errors)){E.state.next({errors:{}});try{await A(Z,U)}catch(ne){ce=ne}}else I&&await I({...r.errors},U),rr(),setTimeout(rr);if(E.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:rn(r.errors)&&!ce,submitCount:r.submitCount+1,errors:r.errors}),ce)throw ce},Vn=(A,I={})=>{Se(i,A)&&(gt(I.defaultValue)?Y(A,Mt(Se(s,A))):(Y(A,I.defaultValue),ct(s,A,Mt(I.defaultValue))),I.keepTouched||Nt(r.touchedFields,A),I.keepDirty||(Nt(r.dirtyFields,A),r.isDirty=I.defaultValue?W(A,Mt(Se(s,A))):W()),I.keepError||(Nt(r.errors,A),w.isValid&&N()),E.state.next({...r}))},Dt=(A,I={})=>{const U=A?Mt(A):s,ce=Mt(U),Z=rn(A),ne=ce,de=i;if(I.keepDefaultValues||(s=U),!I.keepValues){if(I.keepDirtyValues){const we=new Set([...d.mount,...Object.keys(bi(s,l,void 0,de))]);for(const Ee of Array.from(we)){const Xe=Se(r.dirtyFields,Ee),wt=Se(l,Ee),Xt=Se(ne,Ee);Xe&&!gt(wt)?ct(ne,Ee,wt):!Xe&&!gt(Xt)&&Y(Ee,Xt)}}else{if(td&>(A))for(const we of d.mount){const Ee=Se(i,we);if(Ee&&Ee._f){const Xe=Array.isArray(Ee._f.refs)?Ee._f.refs[0]:Ee._f.ref;if(_u(Xe)){const wt=Xe.closest("form");if(wt){wt.reset();break}}}}if(I.keepFieldsRef)for(const we of d.mount)Y(we,Se(ne,we));else i={}}if(n.shouldUnregister){if(l=I.keepDefaultValues?Mt(s):{},I.keepFieldsRef)for(const we of d.mount)ct(l,we,Se(ne,we))}else l=Mt(ne);E.array.next({values:{...ne}}),E.state.next({name:void 0,type:void 0,values:{...ne}})}d={mount:I.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=!w.isValid||!!I.keepIsValid||!!I.keepDirtyValues||!n.shouldUnregister&&!rn(ne),u.watch=!!n.shouldUnregister,u.keepIsValid=!!I.keepIsValid,u.action=!1,I.keepErrors||(r.errors={}),E.state.next({submitCount:I.keepSubmitCount?r.submitCount:0,isDirty:Z?!1:I.keepDirty?r.isDirty:I.keepValues?W():!!(I.keepDefaultValues&&!Or(A,s)),isSubmitted:I.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:Z?{}:I.keepDirtyValues?I.keepDefaultValues&&l?bi(s,l,void 0,de):r.dirtyFields:I.keepDefaultValues&&A?bi(s,A,void 0,de):I.keepDirty?r.dirtyFields:{},touchedFields:I.keepTouched?r.touchedFields:{},errors:I.keepErrors?r.errors:{},isSubmitSuccessful:I.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},kr=(A,I)=>Dt(Jn(A)?A(l):A,{...n.resetOptions,...I}),ar=(A,I={})=>{const U=Se(i,A),ce=U&&U._f;if(ce){const Z=ce.refs?ce.refs[0]:ce.ref;Z.focus&&setTimeout(()=>{Z.focus(),I.shouldSelect&&Jn(Z.select)&&Z.select()})}},ir=A=>{const{name:I,type:U,values:ce,...Z}=A;r={...r,...Z}},mn={control:{register:jt,unregister:Qt,getFieldState:Ie,handleSubmit:Tt,setError:it,_subscribe:fn,_runSchema:pe,_updateIsValidating:L,_focusError:rr,_getWatch:te,_getDirty:W,_setValid:N,_setFieldArray:F,_setDisabledField:br,_setErrors:ye,_getFieldArray:D,_reset:Dt,_resetDefaultValues:()=>Jn(n.defaultValues)&&n.defaultValues().then(A=>{kr(A,n.resetOptions),E.state.next({isLoading:!1})}),_removeUnmounted:re,_disableForm:xr,_subjects:E,_proxyFormState:w,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=eu(n.mode),b=eu(n.reValidateMode)}},subscribe:hn,trigger:xe,register:jt,handleSubmit:Tt,watch:Qe,setValue:Y,setValues:le,getValues:Oe,reset:kr,resetField:Vn,resetDefaultValues:(A,I={})=>{if(s=Mt(A),!I.keepDirty){const U=bi(s,l,void 0,i);r.dirtyFields=U,r.isDirty=!rn(U)}I.keepIsValid||N(),E.state.next({...r,defaultValues:s})},clearErrors:Ve,unregister:Qt,setError:it,setFocus:ar,getFieldState:Ie};return{...mn,formControl:mn}}function ag(e={}){const n=me.useRef(void 0),r=me.useRef(void 0),i=me.useRef(e.formControl),[s,l]=me.useState(()=>({...Mt(oC),isLoading:Jn(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Jn(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&&!Jn(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:d,...p}=H4(e);n.current={...p,formState:s}}const u=n.current.control;return u._options=e,T4(()=>{const d=u._subscribe({formState:u._proxyFormState,callback:()=>l({...u._formState,defaultValues:u._defaultValues}),reRenderRoot:!0});return l(p=>({...p,isReady:!0})),u._formState.isReady=!0,d},[u]),me.useEffect(()=>u._disableForm(e.disabled),[u,e.disabled]),me.useEffect(()=>{e.mode&&(u._options.mode=e.mode),e.reValidateMode&&(u._options.reValidateMode=e.reValidateMode)},[u,e.mode,e.reValidateMode]),me.useEffect(()=>{e.errors&&(u._setErrors(e.errors),u._focusError())},[u,e.errors]),me.useEffect(()=>{e.shouldUnregister&&u._subjects.state.next({values:u._getWatch()})},[u,e.shouldUnregister]),me.useEffect(()=>{if(u._proxyFormState.isDirty){const d=u._getDirty();d!==s.isDirty&&u._subjects.state.next({isDirty:d})}},[u,s.isDirty]),me.useEffect(()=>{var d;e.values&&!Or(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(p=>({...p}))):u._resetDefaultValues()},[u,e.values]),me.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=me.useMemo(()=>j4(s,u),[u,s]),n.current}const Ox=(e,n,r)=>{if(e&&"reportValidity"in e){const i=Se(r,n);e.setCustomValidity(i&&i.message||""),e.reportValidity()}},Bm=(e,n)=>{for(const r in n.fields){const i=n.fields[r];i&&i.ref&&"reportValidity"in i.ref?Ox(i.ref,r,e):i&&i.refs&&i.refs.forEach(s=>Ox(s,r,e))}},Ax=(e,n)=>{n.shouldUseNativeValidation&&Bm(e,n);const r={};for(const i in e){const s=Se(n.fields,i),l=Object.assign(e[i]||{},{ref:s&&s.ref});if(B4(n.names||Object.keys(e),i)){const u=Object.assign({},Se(r,i));ct(u,"root",l),ct(r,i,u)}else ct(r,i,l)}return r},B4=(e,n)=>{const r=Mx(n).replace(/[.*+?^${}()|\\]/g,"\\$&");return e.some(i=>Mx(i).match(`^${r}\\.\\d+`))};function Mx(e){return e.replace(/[\[\]]/g,"")}var Nx;function fe(e,n,r){function i(d,p){if(d._zod||Object.defineProperty(d,"_zod",{value:{def:p,constr:u,traits:new Set},enumerable:!1}),d._zod.traits.has(e))return;d._zod.traits.add(e),n(d,p);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 Io extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class sC extends Error{constructor(n){super(`Encountered unidirectional transform during encode: ${n}`),this.name="ZodEncodeError"}}(Nx=globalThis).__zod_globalConfig??(Nx.__zod_globalConfig={});const ig=globalThis.__zod_globalConfig;function ji(e){return ig}function lC(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 qm(e,n){return typeof n=="bigint"?n.toString():n}function og(e){return{get value(){{const n=e();return Object.defineProperty(this,"value",{value:n}),n}}}}function sg(e){return e==null}function lg(e){const n=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(n,r)}const Dx=Symbol("evaluating");function dt(e,n,r){let i;Object.defineProperty(e,n,{get(){if(i!==Dx)return i===void 0&&(i=Dx,i=r()),i},set(s){Object.defineProperty(e,n,{value:s})},configurable:!0})}function Li(e,n,r){Object.defineProperty(e,n,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Xa(...e){const n={};for(const r of e){const i=Object.getOwnPropertyDescriptors(r);Object.assign(n,i)}return Object.defineProperties({},n)}function zx(e){return JSON.stringify(e)}function q4(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const cC="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Eu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const G4=og(()=>{if(ig.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function fl(e){if(Eu(e)===!1)return!1;const n=e.constructor;if(n===void 0||typeof n!="function")return!0;const r=n.prototype;return!(Eu(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function uC(e){return fl(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Z4=new Set(["string","number","symbol"]);function rd(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ja(e,n,r){const i=new e._zod.constr(n??e._zod.def);return(!n||r?.parent)&&(i._zod.parent=e),i}function Le(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 K4(e){return Object.keys(e).filter(n=>e[n]._zod.optin==="optional"&&e[n]._zod.optout==="optional")}function Y4(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=Xa(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 Li(this,"shape",u),u},checks:[]});return Ja(e,l)}function Q4(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=Xa(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 Li(this,"shape",u),u},checks:[]});return Ja(e,l)}function X4(e,n){if(!fl(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=Xa(e._zod.def,{get shape(){const l={...e._zod.def.shape,...n};return Li(this,"shape",l),l}});return Ja(e,s)}function J4(e,n){if(!fl(n))throw new Error("Invalid input to safeExtend: expected a plain object");const r=Xa(e._zod.def,{get shape(){const i={...e._zod.def.shape,...n};return Li(this,"shape",i),i}});return Ja(e,r)}function W4(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=Xa(e._zod.def,{get shape(){const i={...e._zod.def.shape,...n._zod.def.shape};return Li(this,"shape",i),i},get catchall(){return n._zod.def.catchall},checks:n._zod.def.checks??[]});return Ja(e,r)}function e5(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=Xa(n._zod.def,{get shape(){const d=n._zod.def.shape,p={...d};if(r)for(const m in r){if(!(m in d))throw new Error(`Unrecognized key: "${m}"`);r[m]&&(p[m]=e?new e({type:"optional",innerType:d[m]}):d[m])}else for(const m in d)p[m]=e?new e({type:"optional",innerType:d[m]}):d[m];return Li(this,"shape",p),p},checks:[]});return Ja(n,u)}function t5(e,n,r){const i=Xa(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 Li(this,"shape",l),l}});return Ja(n,i)}function Do(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 tu(e){return typeof e=="string"?e:e?.message}function Ti(e,n,r){const i=e.message?e.message:tu(e.inst?._zod.def?.error?.(e))??tu(n?.error?.(e))??tu(r.customError?.(e))??tu(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 cg(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function hl(...e){const[n,r,i]=e;return typeof n=="string"?{message:n,code:"custom",input:r,inst:i}:{...n}}const fC=(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,qm,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ug=fe("$ZodError",fC),ad=fe("$ZodError",fC,{Parent:Error});function r5(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 a5(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 p=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 Io;if(u.issues.length){const d=new(s?.Err??e)(u.issues.map(p=>Ti(p,l,ji())));throw cC(d,s?.callee),d}return u.value},i5=id(ad),od=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(p=>Ti(p,l,ji())));throw cC(d,s?.callee),d}return u.value},o5=od(ad),sd=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 Io;return l.issues.length?{success:!1,error:new(e??ug)(l.issues.map(u=>Ti(u,s,ji())))}:{success:!0,data:l.value}},s5=sd(ad),ld=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=>Ti(u,s,ji())))}:{success:!0,data:l.value}},l5=ld(ad),c5=e=>(n,r,i)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return id(e)(n,r,s)},u5=e=>(n,r,i)=>id(e)(n,r,i),d5=e=>async(n,r,i)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return od(e)(n,r,s)},f5=e=>async(n,r,i)=>od(e)(n,r,i),h5=e=>(n,r,i)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return sd(e)(n,r,s)},m5=e=>(n,r,i)=>sd(e)(n,r,i),p5=e=>async(n,r,i)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return ld(e)(n,r,s)},g5=e=>async(n,r,i)=>ld(e)(n,r,i),v5=/^[cC][0-9a-z]{6,}$/,y5=/^[0-9a-z]+$/,b5=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,x5=/^[0-9a-vA-V]{20}$/,w5=/^[A-Za-z0-9]{27}$/,S5=/^[a-zA-Z0-9_-]{21}$/,_5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,C5=/^([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})$/,kx=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)$/,E5=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,R5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function j5(){return new RegExp(R5,"u")}const T5=/^(?:(?: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])$/,O5=/^(([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}|:))$/,A5=/^((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])$/,M5=/^(([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])$/,N5=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,hC=/^[A-Za-z0-9_-]*$/,D5=/^https?$/,z5=/^\+[1-9]\d{6,14}$/,mC="(?:(?:\\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])))",k5=new RegExp(`^${mC}$`);function pC(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 L5(e){return new RegExp(`^${pC(e)}$`)}function $5(e){const n=pC({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(`^${mC}T(?:${i})$`)}const I5=e=>{const n=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${n}$`)},P5=/^(?:true|false)$/i,F5=/^[^A-Z]*$/,V5=/^[^a-z]*$/,zr=fe("$ZodCheck",(e,n)=>{var r;e._zod??(e._zod={}),e._zod.def=n,(r=e._zod).onattach??(r.onattach=[])}),U5=fe("$ZodCheckMaxLength",(e,n)=>{var r;zr.init(e,n),(r=e._zod.def).when??(r.when=i=>{const s=i.value;return!sg(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=cg(s);i.issues.push({origin:u,code:"too_big",maximum:n.maximum,inclusive:!0,input:s,inst:e,continue:!n.abort})}}),H5=fe("$ZodCheckMinLength",(e,n)=>{var r;zr.init(e,n),(r=e._zod.def).when??(r.when=i=>{const s=i.value;return!sg(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=cg(s);i.issues.push({origin:u,code:"too_small",minimum:n.minimum,inclusive:!0,input:s,inst:e,continue:!n.abort})}}),B5=fe("$ZodCheckLengthEquals",(e,n)=>{var r;zr.init(e,n),(r=e._zod.def).when??(r.when=i=>{const s=i.value;return!sg(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=cg(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})}}),cd=fe("$ZodCheckStringFormat",(e,n)=>{var r,i;zr.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=()=>{})}),q5=fe("$ZodCheckRegex",(e,n)=>{cd.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})}}),G5=fe("$ZodCheckLowerCase",(e,n)=>{n.pattern??(n.pattern=F5),cd.init(e,n)}),Z5=fe("$ZodCheckUpperCase",(e,n)=>{n.pattern??(n.pattern=V5),cd.init(e,n)}),K5=fe("$ZodCheckIncludes",(e,n)=>{zr.init(e,n);const r=rd(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})}}),Y5=fe("$ZodCheckStartsWith",(e,n)=>{zr.init(e,n);const r=new RegExp(`^${rd(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})}}),Q5=fe("$ZodCheckEndsWith",(e,n)=>{zr.init(e,n);const r=new RegExp(`.*${rd(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})}}),X5=fe("$ZodCheckOverwrite",(e,n)=>{zr.init(e,n),e._zod.check=r=>{r.value=n.tx(r.value)}});class J5{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 W5={major:4,minor:4,patch:3},Pt=fe("$ZodType",(e,n)=>{var r;e??(e={}),e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=W5;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,p)=>{let m=Do(u),y;for(const v of d){if(v._zod.def.when){if(n5(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&&p?.async===!1)throw new Io;if(y||x instanceof Promise)y=(y??Promise.resolve()).then(async()=>{await x,u.issues.length!==b&&(m||(m=Do(u,b)))});else{if(u.issues.length===b)continue;m||(m=Do(u,b))}}return y?y.then(()=>u):u},l=(u,d,p)=>{if(Do(u))return u.aborted=!0,u;const m=s(d,i,p);if(m instanceof Promise){if(p.async===!1)throw new Io;return m.then(y=>e._zod.parse(y,p))}return e._zod.parse(m,p)};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 p=e._zod.parse(u,d);if(p instanceof Promise){if(d.async===!1)throw new Io;return p.then(m=>s(m,i,d))}return s(p,i,d)}}dt(e,"~standard",()=>({validate:s=>{try{const l=s5(e,s);return l.success?{value:l.data}:{issues:l.error?.issues}}catch{return l5(e,s).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},vendor:"zod",version:1}))}),dg=fe("$ZodString",(e,n)=>{Pt.init(e,n),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??I5(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}}),xt=fe("$ZodStringFormat",(e,n)=>{cd.init(e,n),dg.init(e,n)}),e6=fe("$ZodGUID",(e,n)=>{n.pattern??(n.pattern=C5),xt.init(e,n)}),t6=fe("$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=kx(i))}else n.pattern??(n.pattern=kx());xt.init(e,n)}),n6=fe("$ZodEmail",(e,n)=>{n.pattern??(n.pattern=E5),xt.init(e,n)}),r6=fe("$ZodURL",(e,n)=>{xt.init(e,n),e._zod.check=r=>{try{const i=r.value.trim();if(!n.normalize&&n.protocol?.source===D5.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})}}}),a6=fe("$ZodEmoji",(e,n)=>{n.pattern??(n.pattern=j5()),xt.init(e,n)}),i6=fe("$ZodNanoID",(e,n)=>{n.pattern??(n.pattern=S5),xt.init(e,n)}),o6=fe("$ZodCUID",(e,n)=>{n.pattern??(n.pattern=v5),xt.init(e,n)}),s6=fe("$ZodCUID2",(e,n)=>{n.pattern??(n.pattern=y5),xt.init(e,n)}),l6=fe("$ZodULID",(e,n)=>{n.pattern??(n.pattern=b5),xt.init(e,n)}),c6=fe("$ZodXID",(e,n)=>{n.pattern??(n.pattern=x5),xt.init(e,n)}),u6=fe("$ZodKSUID",(e,n)=>{n.pattern??(n.pattern=w5),xt.init(e,n)}),d6=fe("$ZodISODateTime",(e,n)=>{n.pattern??(n.pattern=$5(n)),xt.init(e,n)}),f6=fe("$ZodISODate",(e,n)=>{n.pattern??(n.pattern=k5),xt.init(e,n)}),h6=fe("$ZodISOTime",(e,n)=>{n.pattern??(n.pattern=L5(n)),xt.init(e,n)}),m6=fe("$ZodISODuration",(e,n)=>{n.pattern??(n.pattern=_5),xt.init(e,n)}),p6=fe("$ZodIPv4",(e,n)=>{n.pattern??(n.pattern=T5),xt.init(e,n),e._zod.bag.format="ipv4"}),g6=fe("$ZodIPv6",(e,n)=>{n.pattern??(n.pattern=O5),xt.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})}}}),v6=fe("$ZodCIDRv4",(e,n)=>{n.pattern??(n.pattern=A5),xt.init(e,n)}),y6=fe("$ZodCIDRv6",(e,n)=>{n.pattern??(n.pattern=M5),xt.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 gC(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const b6=fe("$ZodBase64",(e,n)=>{n.pattern??(n.pattern=N5),xt.init(e,n),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{gC(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!n.abort})}});function x6(e){if(!hC.test(e))return!1;const n=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=n.padEnd(Math.ceil(n.length/4)*4,"=");return gC(r)}const w6=fe("$ZodBase64URL",(e,n)=>{n.pattern??(n.pattern=hC),xt.init(e,n),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{x6(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!n.abort})}}),S6=fe("$ZodE164",(e,n)=>{n.pattern??(n.pattern=z5),xt.init(e,n)});function _6(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 C6=fe("$ZodJWT",(e,n)=>{xt.init(e,n),e._zod.check=r=>{_6(r.value,n.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!n.abort})}}),E6=fe("$ZodBoolean",(e,n)=>{Pt.init(e,n),e._zod.pattern=P5,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}}),R6=fe("$ZodUnknown",(e,n)=>{Pt.init(e,n),e._zod.parse=r=>r}),j6=fe("$ZodNever",(e,n)=>{Pt.init(e,n),e._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Lx(e,n,r){e.issues.length&&n.issues.push(...dC(r,e.issues)),n.value[r]=e.value}const T6=fe("$ZodArray",(e,n)=>{Pt.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;uLx(m,r,u))):Lx(p,r,u)}return l.length?Promise.all(l).then(()=>r):r}});function Ru(e,n,r,i,s,l){const u=r in i;if(e.issues.length){if(s&&l&&!u)return;n.issues.push(...dC(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 vC(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=K4(e.shape);return{...e,keys:n,keySet:new Set(n),numKeys:n.length,optionalKeys:new Set(r)}}function yC(e,n,r,i,s,l){const u=[],d=s.keySet,p=s.catchall._zod,m=p.def.type,y=p.optin==="optional",v=p.optout==="optional";for(const b in n){if(b==="__proto__"||d.has(b))continue;if(m==="never"){u.push(b);continue}const x=p.run({value:n[b],issues:[]},i);x instanceof Promise?e.push(x.then(w=>Ru(w,r,b,n,y,v))):Ru(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 O6=fe("$ZodObject",(e,n)=>{if(Pt.init(e,n),!Object.getOwnPropertyDescriptor(n,"shape")?.get){const d=n.shape;Object.defineProperty(n,"shape",{get:()=>{const p={...d};return Object.defineProperty(n,"shape",{value:p}),p}})}const i=og(()=>vC(n));dt(e._zod,"propValues",()=>{const d=n.shape,p={};for(const m in d){const y=d[m]._zod;if(y.values){p[m]??(p[m]=new Set);for(const v of y.values)p[m].add(v)}}return p});const s=Eu,l=n.catchall;let u;e._zod.parse=(d,p)=>{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],w=x._zod.optin==="optional",_=x._zod.optout==="optional",E=x._zod.run({value:m[b],issues:[]},p);E instanceof Promise?y.push(E.then(R=>Ru(R,d,b,m,w,_))):Ru(E,d,b,m,w,_)}return l?yC(y,m,d,p,i.value,e):y.length?Promise.all(y).then(()=>d):d}}),A6=fe("$ZodObjectJIT",(e,n)=>{O6.init(e,n);const r=e._zod.parse,i=og(()=>vC(n)),s=b=>{const x=new J5(["shape","payload","ctx"]),w=i.value,_=O=>{const N=zx(O);return`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`};x.write("const input = payload.value;");const E=Object.create(null);let R=0;for(const O of w.keys)E[O]=`key_${R++}`;x.write("const newResult = {};");for(const O of w.keys){const N=E[O],L=zx(O),P=b[O],F=P?._zod?.optin==="optional",V=P?._zod?.optout==="optional";x.write(`const ${N} = ${_(O)};`),F&&V?x.write(` - if (${N}.issues.length) { - if (${L} in input) { - payload.issues = payload.issues.concat(${N}.issues.map(iss => ({ - ...iss, - path: iss.path ? [${L}, ...iss.path] : [${L}] - }))); - } - } - - if (${N}.value === undefined) { - if (${L} in input) { - newResult[${L}] = undefined; - } - } else { - newResult[${L}] = ${N}.value; - } - - `):F?x.write(` - if (${N}.issues.length) { - payload.issues = payload.issues.concat(${N}.issues.map(iss => ({ - ...iss, - path: iss.path ? [${L}, ...iss.path] : [${L}] - }))); - } - - if (${N}.value === undefined) { - if (${L} in input) { - newResult[${L}] = undefined; - } - } else { - newResult[${L}] = ${N}.value; - } - - `):x.write(` - const ${N}_present = ${L} in input; - if (${N}.issues.length) { - payload.issues = payload.issues.concat(${N}.issues.map(iss => ({ - ...iss, - path: iss.path ? [${L}, ...iss.path] : [${L}] - }))); - } - if (!${N}_present && !${N}.issues.length) { - payload.issues.push({ - code: "invalid_type", - expected: "nonoptional", - input: undefined, - path: [${L}] - }); - } - - if (${N}_present) { - if (${N}.value === undefined) { - newResult[${L}] = undefined; - } else { - newResult[${L}] = ${N}.value; - } - } - - `)}x.write("payload.value = newResult;"),x.write("return payload;");const T=x.compile();return(O,N)=>T(b,O,N)};let l;const u=Eu,d=!ig.jitless,m=d&&G4.value,y=n.catchall;let v;e._zod.parse=(b,x)=>{v??(v=i.value);const w=b.value;return u(w)?d&&m&&x?.async===!1&&x.jitless!==!0?(l||(l=s(n.shape)),b=l(b,x),y?yC([],w,b,x,v,e):b):r(b,x):(b.issues.push({expected:"object",code:"invalid_type",input:w,inst:e}),b)}});function $x(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=>!Do(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=>Ti(u,i,ji())))}),n)}const M6=fe("$ZodUnion",(e,n)=>{Pt.init(e,n),dt(e._zod,"optin",()=>n.options.some(i=>i._zod.optin==="optional")?"optional":void 0),dt(e._zod,"optout",()=>n.options.some(i=>i._zod.optout==="optional")?"optional":void 0),dt(e._zod,"values",()=>{if(n.options.every(i=>i._zod.values))return new Set(n.options.flatMap(i=>Array.from(i._zod.values)))}),dt(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=>lg(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 p=d._zod.run({value:i.value,issues:[]},s);if(p instanceof Promise)u.push(p),l=!0;else{if(p.issues.length===0)return p;u.push(p)}}return l?Promise.all(u).then(d=>$x(d,i,e,s)):$x(u,i,e,s)}}),N6=fe("$ZodIntersection",(e,n)=>{Pt.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(([p,m])=>Ix(r,p,m)):Ix(r,l,u)}});function Gm(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(fl(e)&&fl(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=Gm(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}),Do(e))return e;const u=Gm(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 D6=fe("$ZodEnum",(e,n)=>{Pt.init(e,n);const r=lC(n.entries),i=new Set(r);e._zod.values=i,e._zod.pattern=new RegExp(`^(${r.filter(s=>Z4.has(typeof s)).map(s=>typeof s=="string"?rd(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}}),z6=fe("$ZodTransform",(e,n)=>{Pt.init(e,n),e._zod.optin="optional",e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new sC(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 Io;return r.value=s,r.fallback=!0,r}});function Px(e,n){return n===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const bC=fe("$ZodOptional",(e,n)=>{Pt.init(e,n),e._zod.optin="optional",e._zod.optout="optional",dt(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0),dt(e._zod,"pattern",()=>{const r=n.innerType._zod.pattern;return r?new RegExp(`^(${lg(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=>Px(u,s)):Px(l,s)}return r.value===void 0?r:n.innerType._zod.run(r,i)}}),k6=fe("$ZodExactOptional",(e,n)=>{bC.init(e,n),dt(e._zod,"values",()=>n.innerType._zod.values),dt(e._zod,"pattern",()=>n.innerType._zod.pattern),e._zod.parse=(r,i)=>n.innerType._zod.run(r,i)}),L6=fe("$ZodNullable",(e,n)=>{Pt.init(e,n),dt(e._zod,"optin",()=>n.innerType._zod.optin),dt(e._zod,"optout",()=>n.innerType._zod.optout),dt(e._zod,"pattern",()=>{const r=n.innerType._zod.pattern;return r?new RegExp(`^(${lg(r.source)}|null)$`):void 0}),dt(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)}),$6=fe("$ZodDefault",(e,n)=>{Pt.init(e,n),e._zod.optin="optional",dt(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=>Fx(l,n)):Fx(s,n)}});function Fx(e,n){return e.value===void 0&&(e.value=n.defaultValue),e}const I6=fe("$ZodPrefault",(e,n)=>{Pt.init(e,n),e._zod.optin="optional",dt(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))}),P6=fe("$ZodNonOptional",(e,n)=>{Pt.init(e,n),dt(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=>Vx(l,e)):Vx(s,e)}});function Vx(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 F6=fe("$ZodCatch",(e,n)=>{Pt.init(e,n),e._zod.optin="optional",dt(e._zod,"optout",()=>n.innerType._zod.optout),dt(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=>Ti(u,i,ji()))},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=>Ti(l,i,ji()))},input:r.value}),r.issues=[],r.fallback=!0),r)}}),V6=fe("$ZodPipe",(e,n)=>{Pt.init(e,n),dt(e._zod,"values",()=>n.in._zod.values),dt(e._zod,"optin",()=>n.in._zod.optin),dt(e._zod,"optout",()=>n.out._zod.optout),dt(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=>nu(u,n.in,i)):nu(l,n.in,i)}const s=n.in._zod.run(r,i);return s instanceof Promise?s.then(l=>nu(l,n.out,i)):nu(s,n.out,i)}});function nu(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 U6=fe("$ZodReadonly",(e,n)=>{Pt.init(e,n),dt(e._zod,"propValues",()=>n.innerType._zod.propValues),dt(e._zod,"values",()=>n.innerType._zod.values),dt(e._zod,"optin",()=>n.innerType?._zod?.optin),dt(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(Ux):Ux(s)}});function Ux(e){return e.value=Object.freeze(e.value),e}const H6=fe("$ZodCustom",(e,n)=>{zr.init(e,n),Pt.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=>Hx(l,r,i,e));Hx(s,r,i,e)}});function Hx(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(hl(s))}}var Bx;class B6{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 q6(){return new B6}(Bx=globalThis).__zod_globalRegistry??(Bx.__zod_globalRegistry=q6());const Qs=globalThis.__zod_globalRegistry;function G6(e,n){return new e({type:"string",...Le(n)})}function Z6(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Le(n)})}function qx(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Le(n)})}function K6(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Le(n)})}function Y6(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Le(n)})}function Q6(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Le(n)})}function X6(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Le(n)})}function J6(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Le(n)})}function W6(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Le(n)})}function eL(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Le(n)})}function tL(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Le(n)})}function nL(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Le(n)})}function rL(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Le(n)})}function aL(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Le(n)})}function iL(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Le(n)})}function oL(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Le(n)})}function sL(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Le(n)})}function lL(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Le(n)})}function cL(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Le(n)})}function uL(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Le(n)})}function dL(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Le(n)})}function fL(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Le(n)})}function hL(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Le(n)})}function mL(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Le(n)})}function pL(e,n){return new e({type:"string",format:"date",check:"string_format",...Le(n)})}function gL(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,...Le(n)})}function vL(e,n){return new e({type:"string",format:"duration",check:"string_format",...Le(n)})}function yL(e,n){return new e({type:"boolean",...Le(n)})}function bL(e){return new e({type:"unknown"})}function xL(e,n){return new e({type:"never",...Le(n)})}function xC(e,n){return new U5({check:"max_length",...Le(n),maximum:e})}function ju(e,n){return new H5({check:"min_length",...Le(n),minimum:e})}function wC(e,n){return new B5({check:"length_equals",...Le(n),length:e})}function wL(e,n){return new q5({check:"string_format",format:"regex",...Le(n),pattern:e})}function SL(e){return new G5({check:"string_format",format:"lowercase",...Le(e)})}function _L(e){return new Z5({check:"string_format",format:"uppercase",...Le(e)})}function CL(e,n){return new K5({check:"string_format",format:"includes",...Le(n),includes:e})}function EL(e,n){return new Y5({check:"string_format",format:"starts_with",...Le(n),prefix:e})}function RL(e,n){return new Q5({check:"string_format",format:"ends_with",...Le(n),suffix:e})}function Yo(e){return new X5({check:"overwrite",tx:e})}function jL(e){return Yo(n=>n.normalize(e))}function TL(){return Yo(e=>e.trim())}function OL(){return Yo(e=>e.toLowerCase())}function AL(){return Yo(e=>e.toUpperCase())}function ML(){return Yo(e=>q4(e))}function NL(e,n,r){return new e({type:"array",element:n,...Le(r)})}function DL(e,n,r){return new e({type:"custom",check:"custom",fn:n,...Le(r)})}function zL(e,n){const r=kL(i=>(i.addIssue=s=>{if(typeof s=="string")i.issues.push(hl(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(hl(l))}},e(i.value,i)),n);return r}function kL(e,n){const r=new zr({check:"custom",...Le(n)});return r._zod.check=e,r}function SC(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??Qs,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 ln(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),ln(v,n,y),n.seen.get(v).isParent=!0)}const p=n.metadataRegistry.get(e);return p&&Object.assign(u.schema,p),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 _C(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 p=i.get(d);if(p&&p!==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??(w=>w);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:p,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=p};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 CC(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 p=e.seen.get(d);if(p.ref===null)return;const m=p.def??p.schema,y={...m},v=p.ref;if(p.ref=null,v){i(v);const x=e.seen.get(v),w=x.schema;if(w.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(m.allOf=m.allOf??[],m.allOf.push(w)):Object.assign(m,w),Object.assign(m,y),d._zod.parent===v)for(const E in m)E==="$ref"||E==="allOf"||E in y||delete m[E];if(w.$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 w in m)w==="$ref"||w==="allOf"||w in x.def&&JSON.stringify(m[w])===JSON.stringify(x.def[w])&&delete m[w]}e.override({zodSchema:d,jsonSchema:m,path:p.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 p=d[1];p.def&&p.defId&&(p.def.id===p.defId&&delete p.def.id,u[p.defId]=p.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:Tu(n,"input",e.processors),output:Tu(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 LL=(e,n={})=>r=>{const i=SC({...r,processors:n});return ln(e,i),_C(i,e),CC(i,e)},Tu=(e,n,r={})=>i=>{const{libraryOptions:s,target:l}=i??{},u=SC({...s??{},target:l,io:n,processors:r});return ln(e,u),_C(u,e),CC(u,e)},$L={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},IL=(e,n,r,i)=>{const s=r;s.type="string";const{minimum:l,maximum:u,format:d,patterns:p,contentEncoding:m}=e._zod.bag;if(typeof l=="number"&&(s.minLength=l),typeof u=="number"&&(s.maxLength=u),d&&(s.format=$L[d]??d,s.format===""&&delete s.format,d==="time"&&delete s.format),m&&(s.contentEncoding=m),p&&p.size>0){const y=[...p];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}))])}},PL=(e,n,r,i)=>{r.type="boolean"},FL=(e,n,r,i)=>{r.not={}},VL=(e,n,r,i)=>{},UL=(e,n,r,i)=>{const s=e._zod.def,l=lC(s.entries);l.every(u=>typeof u=="number")&&(r.type="number"),l.every(u=>typeof u=="string")&&(r.type="string"),r.enum=l},HL=(e,n,r,i)=>{if(n.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},BL=(e,n,r,i)=>{if(n.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},qL=(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=ln(l.element,n,{...i,path:[...i.path,"items"]})},GL=(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]=ln(u[m],n,{...i,path:[...i.path,"properties",m]});const d=new Set(Object.keys(u)),p=new Set([...d].filter(m=>{const y=l.shape[m]._zod;return n.io==="input"?y.optin===void 0:y.optout===void 0}));p.size>0&&(s.required=Array.from(p)),l.catchall?._zod.def.type==="never"?s.additionalProperties=!1:l.catchall?l.catchall&&(s.additionalProperties=ln(l.catchall,n,{...i,path:[...i.path,"additionalProperties"]})):n.io==="output"&&(s.additionalProperties=!1)},ZL=(e,n,r,i)=>{const s=e._zod.def,l=s.inclusive===!1,u=s.options.map((d,p)=>ln(d,n,{...i,path:[...i.path,l?"oneOf":"anyOf",p]}));l?r.oneOf=u:r.anyOf=u},KL=(e,n,r,i)=>{const s=e._zod.def,l=ln(s.left,n,{...i,path:[...i.path,"allOf",0]}),u=ln(s.right,n,{...i,path:[...i.path,"allOf",1]}),d=m=>"allOf"in m&&Object.keys(m).length===1,p=[...d(l)?l.allOf:[l],...d(u)?u.allOf:[u]];r.allOf=p},YL=(e,n,r,i)=>{const s=e._zod.def,l=ln(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"}]},QL=(e,n,r,i)=>{const s=e._zod.def;ln(s.innerType,n,i);const l=n.seen.get(e);l.ref=s.innerType},XL=(e,n,r,i)=>{const s=e._zod.def;ln(s.innerType,n,i);const l=n.seen.get(e);l.ref=s.innerType,r.default=JSON.parse(JSON.stringify(s.defaultValue))},JL=(e,n,r,i)=>{const s=e._zod.def;ln(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)))},WL=(e,n,r,i)=>{const s=e._zod.def;ln(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},e8=(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;ln(u,n,i);const d=n.seen.get(e);d.ref=u},t8=(e,n,r,i)=>{const s=e._zod.def;ln(s.innerType,n,i);const l=n.seen.get(e);l.ref=s.innerType,r.readOnly=!0},EC=(e,n,r,i)=>{const s=e._zod.def;ln(s.innerType,n,i);const l=n.seen.get(e);l.ref=s.innerType};function Zm(){return Zm=Object.assign?Object.assign.bind():function(e){for(var n=1;n0){var p=s.errors[0][0];r[d]={message:p.message,type:p.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(Zm({},b,{path:[].concat(s.path,b.path)}))})}),n){var m=r[d].types,y=m&&m[s.code];r[d]=rg(d,n,r,l,y?[].concat(y,s.message):s.message)}e.shift()};e.length;)i();return r}function fg(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(Gx(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](i,n)).then(function(u){return l.shouldUseNativeValidation&&Bm({},l),{errors:{},values:r.raw?Object.assign({},i):u}})},function(u){if((function(d){return Array.isArray(d?.issues)})(u))return{values:{},errors:Ax(n8(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(Gx(function(){return Promise.resolve((r.mode==="sync"?i5:o5)(e,i,n)).then(function(u){return l.shouldUseNativeValidation&&Bm({},l),{errors:{},values:r.raw?Object.assign({},i):u}})},function(u){if((function(d){return d instanceof ug})(u))return{values:{},errors:Ax(r8(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 a8=fe("ZodISODateTime",(e,n)=>{d6.init(e,n),_t.init(e,n)});function i8(e){return mL(a8,e)}const o8=fe("ZodISODate",(e,n)=>{f6.init(e,n),_t.init(e,n)});function s8(e){return pL(o8,e)}const l8=fe("ZodISOTime",(e,n)=>{h6.init(e,n),_t.init(e,n)});function c8(e){return gL(l8,e)}const u8=fe("ZodISODuration",(e,n)=>{m6.init(e,n),_t.init(e,n)});function d8(e){return vL(u8,e)}const f8=(e,n)=>{ug.init(e,n),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>a5(e,r)},flatten:{value:r=>r5(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,qm,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,qm,2)}},isEmpty:{get(){return e.issues.length===0}}})},nr=fe("ZodError",f8,{Parent:Error}),h8=id(nr),m8=od(nr),p8=sd(nr),g8=ld(nr),v8=c5(nr),y8=u5(nr),b8=d5(nr),x8=f5(nr),w8=h5(nr),S8=m5(nr),_8=p5(nr),C8=g5(nr),Zx=new WeakMap;function ud(e,n,r){const i=Object.getPrototypeOf(e);let s=Zx.get(i);if(s||(s=new Set,Zx.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=fe("ZodType",(e,n)=>(Pt.init(e,n),Object.assign(e["~standard"],{jsonSchema:{input:Tu(e,"input"),output:Tu(e,"output")}}),e.toJSONSchema=LL(e,{}),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.parse=(r,i)=>h8(e,r,i,{callee:e.parse}),e.safeParse=(r,i)=>p8(e,r,i),e.parseAsync=async(r,i)=>m8(e,r,i,{callee:e.parseAsync}),e.safeParseAsync=async(r,i)=>g8(e,r,i),e.spa=e.safeParseAsync,e.encode=(r,i)=>v8(e,r,i),e.decode=(r,i)=>y8(e,r,i),e.encodeAsync=async(r,i)=>b8(e,r,i),e.decodeAsync=async(r,i)=>x8(e,r,i),e.safeEncode=(r,i)=>w8(e,r,i),e.safeDecode=(r,i)=>S8(e,r,i),e.safeEncodeAsync=async(r,i)=>_8(e,r,i),e.safeDecodeAsync=async(r,i)=>C8(e,r,i),ud(e,"ZodType",{check(...r){const i=this.def;return this.clone(Xa(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 Ja(this,r,i)},brand(){return this},register(r,i){return r.add(this,i),this},refine(r,i){return this.check(v$(r,i))},superRefine(r,i){return this.check(y$(r,i))},overwrite(r){return this.check(Yo(r))},optional(){return Xx(this)},exactOptional(){return a$(this)},nullable(){return Jx(this)},nullish(){return Xx(Jx(this))},nonoptional(r){return u$(this,r)},array(){return K8(this)},or(r){return X8([this,r])},and(r){return W8(this,r)},transform(r){return Wx(this,n$(r))},default(r){return s$(this,r)},prefault(r){return c$(this,r)},catch(r){return f$(this,r)},pipe(r){return Wx(this,r)},readonly(){return p$(this)},describe(r){const i=this.clone();return Qs.add(i,{description:r}),i},meta(...r){if(r.length===0)return Qs.get(this);const i=this.clone();return Qs.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 Qs.get(e)?.description},configurable:!0}),e)),RC=fe("_ZodString",(e,n)=>{dg.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(i,s,l)=>IL(e,i,s);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,ud(e,"_ZodString",{regex(...i){return this.check(wL(...i))},includes(...i){return this.check(CL(...i))},startsWith(...i){return this.check(EL(...i))},endsWith(...i){return this.check(RL(...i))},min(...i){return this.check(ju(...i))},max(...i){return this.check(xC(...i))},length(...i){return this.check(wC(...i))},nonempty(...i){return this.check(ju(1,...i))},lowercase(i){return this.check(SL(i))},uppercase(i){return this.check(_L(i))},trim(){return this.check(TL())},normalize(...i){return this.check(jL(...i))},toLowerCase(){return this.check(OL())},toUpperCase(){return this.check(AL())},slugify(){return this.check(ML())}})}),E8=fe("ZodString",(e,n)=>{dg.init(e,n),RC.init(e,n),e.email=r=>e.check(Z6(R8,r)),e.url=r=>e.check(J6(j8,r)),e.jwt=r=>e.check(hL(U8,r)),e.emoji=r=>e.check(W6(T8,r)),e.guid=r=>e.check(qx(Kx,r)),e.uuid=r=>e.check(K6(ru,r)),e.uuidv4=r=>e.check(Y6(ru,r)),e.uuidv6=r=>e.check(Q6(ru,r)),e.uuidv7=r=>e.check(X6(ru,r)),e.nanoid=r=>e.check(eL(O8,r)),e.guid=r=>e.check(qx(Kx,r)),e.cuid=r=>e.check(tL(A8,r)),e.cuid2=r=>e.check(nL(M8,r)),e.ulid=r=>e.check(rL(N8,r)),e.base64=r=>e.check(uL(P8,r)),e.base64url=r=>e.check(dL(F8,r)),e.xid=r=>e.check(aL(D8,r)),e.ksuid=r=>e.check(iL(z8,r)),e.ipv4=r=>e.check(oL(k8,r)),e.ipv6=r=>e.check(sL(L8,r)),e.cidrv4=r=>e.check(lL($8,r)),e.cidrv6=r=>e.check(cL(I8,r)),e.e164=r=>e.check(fL(V8,r)),e.datetime=r=>e.check(i8(r)),e.date=r=>e.check(s8(r)),e.time=r=>e.check(c8(r)),e.duration=r=>e.check(d8(r))});function uu(e){return G6(E8,e)}const _t=fe("ZodStringFormat",(e,n)=>{xt.init(e,n),RC.init(e,n)}),R8=fe("ZodEmail",(e,n)=>{n6.init(e,n),_t.init(e,n)}),Kx=fe("ZodGUID",(e,n)=>{e6.init(e,n),_t.init(e,n)}),ru=fe("ZodUUID",(e,n)=>{t6.init(e,n),_t.init(e,n)}),j8=fe("ZodURL",(e,n)=>{r6.init(e,n),_t.init(e,n)}),T8=fe("ZodEmoji",(e,n)=>{a6.init(e,n),_t.init(e,n)}),O8=fe("ZodNanoID",(e,n)=>{i6.init(e,n),_t.init(e,n)}),A8=fe("ZodCUID",(e,n)=>{o6.init(e,n),_t.init(e,n)}),M8=fe("ZodCUID2",(e,n)=>{s6.init(e,n),_t.init(e,n)}),N8=fe("ZodULID",(e,n)=>{l6.init(e,n),_t.init(e,n)}),D8=fe("ZodXID",(e,n)=>{c6.init(e,n),_t.init(e,n)}),z8=fe("ZodKSUID",(e,n)=>{u6.init(e,n),_t.init(e,n)}),k8=fe("ZodIPv4",(e,n)=>{p6.init(e,n),_t.init(e,n)}),L8=fe("ZodIPv6",(e,n)=>{g6.init(e,n),_t.init(e,n)}),$8=fe("ZodCIDRv4",(e,n)=>{v6.init(e,n),_t.init(e,n)}),I8=fe("ZodCIDRv6",(e,n)=>{y6.init(e,n),_t.init(e,n)}),P8=fe("ZodBase64",(e,n)=>{b6.init(e,n),_t.init(e,n)}),F8=fe("ZodBase64URL",(e,n)=>{w6.init(e,n),_t.init(e,n)}),V8=fe("ZodE164",(e,n)=>{S6.init(e,n),_t.init(e,n)}),U8=fe("ZodJWT",(e,n)=>{C6.init(e,n),_t.init(e,n)}),H8=fe("ZodBoolean",(e,n)=>{E6.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>PL(e,r,i)});function Yx(e){return yL(H8,e)}const B8=fe("ZodUnknown",(e,n)=>{R6.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>VL()});function Qx(){return bL(B8)}const q8=fe("ZodNever",(e,n)=>{j6.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>FL(e,r,i)});function G8(e){return xL(q8,e)}const Z8=fe("ZodArray",(e,n)=>{T6.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>qL(e,r,i,s),e.element=n.element,ud(e,"ZodArray",{min(r,i){return this.check(ju(r,i))},nonempty(r){return this.check(ju(1,r))},max(r,i){return this.check(xC(r,i))},length(r,i){return this.check(wC(r,i))},unwrap(){return this.element}})});function K8(e,n){return NL(Z8,e,n)}const Y8=fe("ZodObject",(e,n)=>{A6.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>GL(e,r,i,s),dt(e,"shape",()=>n.shape),ud(e,"ZodObject",{keyof(){return e$(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:Qx()})},loose(){return this.clone({...this._zod.def,catchall:Qx()})},strict(){return this.clone({...this._zod.def,catchall:G8()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return X4(this,r)},safeExtend(r){return J4(this,r)},merge(r){return W4(this,r)},pick(r){return Y4(this,r)},omit(r){return Q4(this,r)},partial(...r){return e5(jC,this,r[0])},required(...r){return t5(TC,this,r[0])}})});function hg(e,n){const r={type:"object",shape:e??{},...Le(n)};return new Y8(r)}const Q8=fe("ZodUnion",(e,n)=>{M6.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>ZL(e,r,i,s),e.options=n.options});function X8(e,n){return new Q8({type:"union",options:e,...Le(n)})}const J8=fe("ZodIntersection",(e,n)=>{N6.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>KL(e,r,i,s)});function W8(e,n){return new J8({type:"intersection",left:e,right:n})}const Km=fe("ZodEnum",(e,n)=>{D6.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(i,s,l)=>UL(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 Km({...n,checks:[],...Le(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 Km({...n,checks:[],...Le(s),entries:l})}});function e$(e,n){const r=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new Km({type:"enum",entries:r,...Le(n)})}const t$=fe("ZodTransform",(e,n)=>{z6.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>BL(e,r),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new sC(e.constructor.name);r.addIssue=l=>{if(typeof l=="string")r.issues.push(hl(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(hl(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 n$(e){return new t$({type:"transform",transform:e})}const jC=fe("ZodOptional",(e,n)=>{bC.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>EC(e,r,i,s),e.unwrap=()=>e._zod.def.innerType});function Xx(e){return new jC({type:"optional",innerType:e})}const r$=fe("ZodExactOptional",(e,n)=>{k6.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>EC(e,r,i,s),e.unwrap=()=>e._zod.def.innerType});function a$(e){return new r$({type:"optional",innerType:e})}const i$=fe("ZodNullable",(e,n)=>{L6.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>YL(e,r,i,s),e.unwrap=()=>e._zod.def.innerType});function Jx(e){return new i$({type:"nullable",innerType:e})}const o$=fe("ZodDefault",(e,n)=>{$6.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>XL(e,r,i,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function s$(e,n){return new o$({type:"default",innerType:e,get defaultValue(){return typeof n=="function"?n():uC(n)}})}const l$=fe("ZodPrefault",(e,n)=>{I6.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>JL(e,r,i,s),e.unwrap=()=>e._zod.def.innerType});function c$(e,n){return new l$({type:"prefault",innerType:e,get defaultValue(){return typeof n=="function"?n():uC(n)}})}const TC=fe("ZodNonOptional",(e,n)=>{P6.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>QL(e,r,i,s),e.unwrap=()=>e._zod.def.innerType});function u$(e,n){return new TC({type:"nonoptional",innerType:e,...Le(n)})}const d$=fe("ZodCatch",(e,n)=>{F6.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>WL(e,r,i,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function f$(e,n){return new d$({type:"catch",innerType:e,catchValue:typeof n=="function"?n:()=>n})}const h$=fe("ZodPipe",(e,n)=>{V6.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>e8(e,r,i,s),e.in=n.in,e.out=n.out});function Wx(e,n){return new h$({type:"pipe",in:e,out:n})}const m$=fe("ZodReadonly",(e,n)=>{U6.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>t8(e,r,i,s),e.unwrap=()=>e._zod.def.innerType});function p$(e){return new m$({type:"readonly",innerType:e})}const g$=fe("ZodCustom",(e,n)=>{H6.init(e,n),Ft.init(e,n),e._zod.processJSONSchema=(r,i,s)=>HL(e,r)});function v$(e,n={}){return DL(g$,e,n)}function y$(e,n){return zL(e,n)}const b$=/\.(md|markdown)$/i,x$=/\.(png|jpe?g|gif|svg|webp|ico|bmp|avif)$/i,OC=/\.html?$/i,AC=/\.pdf$/i,w$=/\.(csv|tsv)$/i,S$=/\.(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 mg(e){if(e<1024)return e+" B";const n=["KB","MB","GB","TB"];let r=-1;do e/=1024,r++;while(e>=1024&&r`:e.user||e.author||"unknown"}function E$({className:e,...n}){return f.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:f.jsx("table",{"data-slot":"table",className:Je("w-full caption-bottom text-sm",e),...n})})}function R$({className:e,...n}){return f.jsx("thead",{"data-slot":"table-header",className:Je("[&_tr]:border-b",e),...n})}function j$({className:e,...n}){return f.jsx("tbody",{"data-slot":"table-body",className:Je("[&_tr:last-child]:border-0",e),...n})}function ew({className:e,...n}){return f.jsx("tr",{"data-slot":"table-row",className:Je("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",e),...n})}function tw({className:e,...n}){return f.jsx("th",{"data-slot":"table-head",className:Je("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...n})}function T$({className:e,...n}){return f.jsx("td",{"data-slot":"table-cell",className:Je("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...n})}function O$({header:e}){const n=e.column.getIsSorted();return e.column.getCanSort()?f.jsx(tw,{"data-sort":n||void 0,"aria-sort":n==="asc"?"ascending":n==="desc"?"descending":"none",children:f.jsxs("button",{type:"button",className:"th-sort",onClick:e.column.getToggleSortingHandler(),children:[Fm(e.column.columnDef.header,e.getContext()),n==="asc"?" ↑":n==="desc"?" ↓":""]})}):f.jsx(tw,{children:Fm(e.column.columnDef.header,e.getContext())})}function DC({table:e,className:n}){return f.jsx("div",{className:"admin-list admin-card-table"+(n?" "+n:""),children:f.jsxs(E$,{className:"admin-table",children:[f.jsx(R$,{children:e.getHeaderGroups().map(r=>f.jsx(ew,{children:r.headers.map(i=>f.jsx(O$,{header:i},i.id))},r.id))}),f.jsx(j$,{children:e.getRowModel().rows.map(r=>f.jsx(ew,{className:"admin-item",children:r.getVisibleCells().map(i=>f.jsx(T$,{children:Fm(i.column.columnDef.cell,i.getContext())},i.id))},r.id))})]})})}function zC(e){return e?"expires "+new Date(e).toLocaleDateString():"no expiry"}function A$(e){if(e.opens===void 0)return null;if(e.opens===0)return"not opened yet";const n=`${e.opens} open${e.opens===1?"":"s"}`;return e.last_opened?`${n} · last opened ${new Date(e.last_opened).toLocaleDateString()}`:n}function kC(e,n){const r=[];n&&e.project_name&&r.push(e.project_name),e.creator&&r.push("by "+e.creator),e.created&&r.push(new Date(e.created).toLocaleDateString()),r.push(zC(e.expires));const i=A$(e);return i&&r.push(i),r.join(" · ")}const LC="Opens count how many times a file has been read through a public link. Repeat opens by the same reader within 10 minutes count once.";function $C({shares:e,onChanged:n,showProject:r=!1,canRevoke:i=!0,empty:s="No public shares.",loading:l=!1}){const[u,d]=S.useState([]),p=S.useMemo(()=>k_(),[]),m=S.useMemo(()=>[p.accessor("path",{header:"Path",cell:v=>f.jsx("a",{className:"ai-main mono",title:v.getValue(),...Bo(dl(v.getValue(),v.row.original.project)),children:v.getValue()})}),p.accessor(v=>kC(v,r),{id:"detail",header:r?"Project":"Shared",cell:v=>f.jsx("span",{className:"ai-tag",children:v.getValue()})}),p.display({id:"actions",header:"",cell:v=>i?f.jsx("button",{className:"ai-del","aria-label":`Revoke the share of ${v.row.original.path}`,onClick:()=>IC(v.row.original,n),children:"Revoke"}):null})],[p,n,r,i]),y=Z_({data:e,columns:m,state:{sorting:u},onSortingChange:d,getCoreRowModel:q_(),getSortedRowModel:G_()});return l?f.jsx("div",{className:"admin-list",children:f.jsx("div",{className:"admin-empty",children:"Loading…"})}):e.length===0?f.jsx("div",{className:"admin-list",children:f.jsx("div",{className:"admin-empty",children:s})}):f.jsx(DC,{table:y,className:"shares-table"})}async function IC(e,n){if(await Cl("Revoke share link",`Revoke the public link to “${e.path}”? Anyone with the URL will lose access.`,"Revoke",!0))try{await Wn("DELETE","/api/shares/"+e.token),Ke("Share revoked."),n()}catch(r){Ke(r.message,!0)}}const M$=hg({name:uu().trim().min(1,"Give the organization a name.").max(60,"Keep it under 60 characters.")});function N$({org:e,projects:n,myEmail:r}){const i=Ai(),s=e.role==="owner",l=()=>i.invalidateQueries({queryKey:["orgs"]}),u=()=>i.invalidateQueries({queryKey:["invites",e.id]}),d=()=>i.invalidateQueries({queryKey:["orgShares",e.id]}),p=ag({resolver:fg(M$),values:{name:e.name}}),{data:m}=Ht({queryKey:["invites",e.id],queryFn:()=>Yt(`/api/orgs/${e.id}/invites`),enabled:s,select:x=>x.invites||[]}),{data:y,isLoading:v}=Ht({queryKey:["orgShares",e.id],queryFn:()=>Yt(`/api/orgs/${e.id}/shares`),enabled:s,select:x=>x.shares||[]}),b=n.filter(x=>x.org===e.id);return f.jsxs("div",{className:"admin",children:[f.jsx("h1",{id:"org-title",children:e.name}),!s&&f.jsx("p",{className:"role-chip-row",children:f.jsx("span",{className:"ai-tag role-chip",children:"Member"})}),!s&&f.jsx("p",{className:"admin-sub",children:"Only owners can rename this organization, manage members, or issue invite links."}),s&&f.jsxs("form",{className:"admin-row",onSubmit:p.handleSubmit(async({name:x})=>{try{await Wn("PATCH","/api/orgs/"+e.id,{name:x}),Ke("Renamed."),l()}catch(w){Ke(w.message,!0)}}),children:[f.jsx("label",{className:"admin-lbl",htmlFor:"org-rename",children:"Organization name"}),f.jsx("input",{id:"org-rename",type:"text","aria-invalid":!!p.formState.errors.name,"aria-describedby":p.formState.errors.name?"org-rename-err":void 0,...p.register("name")}),f.jsx(vt,{variant:"subtle",id:"org-rename-btn",type:"submit",disabled:!p.formState.isDirty,children:"Rename org"}),p.formState.errors.name&&f.jsx("span",{id:"org-rename-err",role:"alert",className:"field-err",children:p.formState.errors.name.message})]}),f.jsx("h3",{children:"Members"}),f.jsx(D$,{org:e,owner:s,myEmail:r,onChanged:l}),f.jsx("h3",{children:"Projects"}),f.jsxs("div",{className:"admin-list",children:[b.length===0&&f.jsx("div",{className:"admin-empty",children:"No projects yet."}),b.map(x=>f.jsx("div",{className:"admin-item",children:f.jsx("span",{className:"ai-main",title:x.name,children:x.name})},x.id))]}),s&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"admin-h",children:[f.jsx("h3",{children:"Invite links"}),f.jsx(vt,{variant:"primary",onClick:async()=>{try{const x=await Si(`/api/orgs/${e.id}/invites`),w=await qo(x.url);Ke(w?"Invite link copied to clipboard.":"Invite created — copy it from the list below."),u()}catch(x){Ke(x.message,!0)}},children:"New invite"})]}),f.jsxs("div",{className:"admin-list",children:[m&&m.length===0&&f.jsx("div",{className:"admin-empty",children:"No active invite links."}),(m||[]).map(x=>f.jsxs("div",{className:"admin-item",children:[f.jsx("button",{type:"button",className:"ai-main mono ai-copy","aria-label":`Copy invite link ${x.url}`,title:x.url,onClick:()=>qo(x.url).then(w=>Ke(w?"Copied.":"Select and copy the link.")),children:x.url}),f.jsx("span",{className:"ai-tag",children:(x.creator?"by "+x.creator+" · ":"")+(x.uses?x.uses+" joined · ":"unused · ")+"expires "+new Date(x.expires).toLocaleDateString()}),f.jsx("button",{className:"ai-del","aria-label":`Revoke invite ${x.token.slice(0,8)}`,onClick:async()=>{if(await Cl("Revoke invite",`Revoke the link starting ${x.token.slice(0,8)}…? Anyone still holding it won't be able to join.`,"Revoke",!0))try{await Wn("DELETE",`/api/orgs/${e.id}/invites/${x.token}`),Ke("Revoked."),u()}catch(w){Ke(w.message,!0)}},children:"Revoke"})]},x.token))]}),f.jsx("h3",{children:"Public share links"}),f.jsx("p",{className:"admin-sub",children:"Every live link across this organization's projects. A project's own links are on its Settings page, and on the file itself."}),f.jsx($C,{shares:y||[],loading:v,onChanged:d,showProject:!0})]})]})}function D$({org:e,owner:n,myEmail:r,onChanged:i}){const[s,l]=S.useState([{id:"email",desc:!1}]),u=S.useMemo(()=>k_(),[]),d=S.useMemo(()=>[u.accessor("email",{id:"email",header:"Member",cell:m=>{const y=!!r&&m.getValue().toLowerCase()===r.toLowerCase();return f.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?f.jsx("span",{className:"ai-tag role-static",children:y.role}):f.jsxs("span",{className:"role-cell",children:[f.jsxs("select",{"aria-label":`Role for ${y.email}`,value:y.role,onChange:async b=>{try{await Wn("PATCH",`/api/orgs/${e.id}/members/${encodeURIComponent(y.email)}`,{role:b.target.value}),Ke("Role updated.")}catch(x){Ke(x.message,!0)}i()},children:[f.jsx("option",{value:"owner",children:"owner"}),f.jsx("option",{value:"member",children:"member"})]}),f.jsx("button",{className:"ai-del","aria-label":`Remove ${y.email}`,onClick:async()=>{if(await Cl("Remove member",`Remove ${y.email} from ${e.name}?`,"Remove",!0))try{await Wn("DELETE",`/api/orgs/${e.id}/members/${encodeURIComponent(y.email)}`),Ke("Removed."),i()}catch(b){Ke(b.message,!0)}},children:"Remove"})]})}})],[u,e.id,e.name,n,r]),p=Z_({data:e.members,columns:d,state:{sorting:s},onSortingChange:l,getCoreRowModel:q_(),getSortedRowModel:G_()});return f.jsx(DC,{table:p})}const z$=hg({require_verification:Yx(),require_approval:Yx()});function k$(){const e=Ai(),{data:n,error:r}=Ht({queryKey:["admin","policy"],queryFn:()=>Yt("/api/admin/policy")}),{data:i}=T_(!0),s=ag({resolver:fg(z$),values:n?{require_verification:n.require_verification&&n.mailer,require_approval:n.require_approval}:{require_verification:!1,require_approval:!1}});if(S.useEffect(()=>{r&&Ke(r.message,!0)},[r]),!n)return null;const l=async(u,d,p)=>{try{await Si(`/api/admin/pending/${u}/${d}`),Ke((d==="approve"?"Approved ":"Denied ")+p),e.invalidateQueries({queryKey:["admin","pending"]})}catch(m){Ke(m.message,!0)}};return f.jsxs("div",{className:"admin",children:[f.jsx("h1",{children:"Signup & access"}),f.jsx("p",{className:"admin-sub",children:"Who can create an account on this hub, and how new accounts are vetted."}),f.jsx("h3",{children:"New-account vetting"}),f.jsxs("form",{onSubmit:s.handleSubmit(async u=>{try{await Si("/api/admin/policy",u),Ke("Signup policy saved."),e.invalidateQueries({queryKey:["admin","policy"]})}catch(d){Ke(d.message,!0)}}),children:[f.jsxs("div",{className:"admin-list",children:[f.jsx(nw,{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")}),f.jsx(nw,{label:"Require admin approval",desc:"New accounts wait for a hub admin to approve them before they gain access.",inputProps:s.register("require_approval")})]}),f.jsx(vt,{variant:"primary",type:"submit",style:{marginTop:14},disabled:!s.formState.isDirty,children:"Save policy"})]}),f.jsx("h3",{children:"Who can sign up"}),f.jsxs("div",{className:"admin-list",children:[f.jsxs("div",{className:"admin-item",children:[f.jsx("span",{className:"ai-main",children:"Allowed email domains"}),f.jsx("span",{className:"ai-tag",children:n.allowed_domains&&n.allowed_domains.length?n.allowed_domains.map(u=>"@"+u).join(", "):"any"})]}),f.jsxs("div",{className:"admin-item",children:[f.jsx("span",{className:"ai-main",children:"Self-signup"}),f.jsx("span",{className:"ai-tag",children:n.allow_signup?"open":"invite-only"})]}),f.jsxs("div",{className:"admin-item",children:[f.jsx("span",{className:"ai-main",children:"Hub admins"}),f.jsx("span",{className:"ai-tag",children:n.admins&&n.admins.length?n.admins.join(", "):"none"})]})]}),f.jsx("p",{className:"admin-sub",children:"Domains and admins are set in the server config file (they can't be widened from the browser)."}),f.jsx("h3",{children:"Pending signups"}),f.jsxs("div",{className:"admin-list",children:[(!i||i.length===0)&&f.jsx("div",{className:"admin-empty",children:"No one is waiting for approval."}),(i||[]).map(u=>f.jsxs("div",{className:"admin-item",children:[f.jsx("span",{className:"ai-main",children:(u.name?u.name+" · ":"")+u.email}),f.jsx(vt,{variant:"primary",onClick:()=>l(u.id,"approve",u.email),children:"Approve"}),f.jsx("button",{className:"ai-del",onClick:()=>l(u.id,"deny",u.email),children:"Deny"})]},u.id))]})]})}function nw({label:e,desc:n,disabled:r,inputProps:i}){return f.jsxs("label",{className:"admin-item toggle",style:r?{opacity:.55}:void 0,children:[f.jsxs("span",{className:"ai-main",children:[f.jsx("div",{className:"tg-label",children:e}),f.jsx("div",{className:"tg-desc",children:n})]}),f.jsx("input",{type:"checkbox",disabled:r,...i})]})}function L$({...e}){return f.jsx(f1,{"data-slot":"select",...e})}function $$({...e}){return f.jsx(g1,{"data-slot":"select-value",...e})}function I$({className:e,size:n="default",children:r,...i}){return f.jsxs(m1,{"data-slot":"select-trigger","data-size":n,className:Je("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,f.jsx(v1,{asChild:!0,children:f.jsx(Bp,{className:"size-4 opacity-50"})})]})}function P$({className:e,children:n,position:r="item-aligned",align:i="center",...s}){return f.jsx(b1,{children:f.jsxs(x1,{"data-slot":"select-content",className:Je("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:[f.jsx(V$,{}),f.jsx(E1,{className:Je("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:n}),f.jsx(U$,{})]})})}function F$({className:e,children:n,...r}){return f.jsxs(O1,{"data-slot":"select-item",className:Je("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:[f.jsx("span",{"data-slot":"select-item-indicator",className:"absolute right-2 flex size-3.5 items-center justify-center",children:f.jsx(N1,{children:f.jsx(m_,{className:"size-4"})})}),f.jsx(A1,{children:n})]})}function V$({className:e,...n}){return f.jsx(D1,{"data-slot":"select-scroll-up-button",className:Je("flex cursor-default items-center justify-center py-1",e),...n,children:f.jsx(uz,{className:"size-4"})})}function U$({className:e,...n}){return f.jsx(z1,{"data-slot":"select-scroll-down-button",className:Je("flex cursor-default items-center justify-center py-1",e),...n,children:f.jsx(Bp,{className:"size-4"})})}const rw=["#5b8def","#f5a623","#4cc38a","#e0679b","#8b7bf0","#3ec8c8","#e6934a"];function ml(e){let n=0;for(const r of e)n=n*31+r.charCodeAt(0)>>>0;return rw[n%rw.length]}function aw({projects:e,currentId:n,menu:r,onNew:i}){const s=e.find(l=>l.id===n);return f.jsxs("nav",{id:"projects","aria-label":"Projects",children:[f.jsxs("div",{className:"nav-head",children:[f.jsx("span",{children:"Projects"}),f.jsx("button",{className:"nav-add",title:"New project","aria-label":"New project",onClick:i,children:"+"})]}),f.jsx("div",{className:"proj-row",children:f.jsxs(L$,{value:n||"",onValueChange:l=>{l&&l!==n&&(Zt("/"+l),mr())},children:[f.jsxs(I$,{id:"project-select","aria-label":`Switch project — current: ${s?.name??"none"}`,title:s?.name,className:"proj-trigger",children:[s&&f.jsx("span",{className:"proj-mark","aria-hidden":"true",style:{background:ml(s.name)},children:f.jsx($o,{name:s.icon})}),s?f.jsx("span",{"data-slot":"select-value",children:s.name}):f.jsx($$,{placeholder:"Select a project"})]}),f.jsx(P$,{className:"proj-menu",position:"popper",sideOffset:4,children:e.map(l=>f.jsxs(F$,{value:l.id,children:[f.jsx("span",{className:"proj-mark","aria-hidden":"true",style:{background:ml(l.name)},children:f.jsx($o,{name:l.icon})}),l.name]},l.id))})]})}),r&&f.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(([l,u,d,p])=>f.jsx("li",{children:f.jsxs("div",{id:"nav-"+l,className:"row"+(r.active===l?" active":""),role:"button",tabIndex:0,onClick:p,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),p())},children:[f.jsx(ut,{name:d}),f.jsx("span",{className:"label",children:u})]})},l))})]})}function PC({...e}){return f.jsx(UM,{"data-slot":"dropdown-menu",...e})}function FC({...e}){return f.jsx(HM,{"data-slot":"dropdown-menu-trigger",...e})}function VC({className:e,sideOffset:n=4,...r}){return f.jsx(BM,{children:f.jsx(qM,{"data-slot":"dropdown-menu-content",sideOffset:n,className:Je("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 zo({className:e,inset:n,variant:r="default",...i}){return f.jsx(ZM,{"data-slot":"dropdown-menu-item","data-inset":n,"data-variant":r,className:Je("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 tm({className:e,inset:n,...r}){return f.jsx(GM,{"data-slot":"dropdown-menu-label","data-inset":n,className:Je("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r})}const H$="https://github.com/runbear-io/beardrive";function B$(){return f.jsx("svg",{viewBox:"0 0 16 16",className:"gh-mark",fill:"currentColor","aria-hidden":"true",children:f.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"})})}function q$({me:e,org:n,admin:r,orgActive:i,billing:s}){const l=e.name||e.email,[u,d]=S.useState(!1),p=n?Bo(n.manage_url):null,m=s?Bo(s.url):null;return f.jsxs("footer",{id:"accountbar",children:[f.jsxs("a",{className:"gh-star",href:H$,target:"_blank",rel:"noreferrer",children:[f.jsx(B$,{}),f.jsx("span",{children:"Star on GitHub"}),f.jsx("span",{className:"ext","aria-hidden":"true",children:"↗"}),f.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]}),f.jsxs(PC,{modal:!1,open:u,onOpenChange:d,children:[f.jsx(FC,{asChild:!0,children:f.jsxs("button",{id:"account-btn",className:i?"active":void 0,"aria-label":"Account menu",children:[f.jsx("span",{className:"avatar",style:{background:ml(e.email)},"aria-hidden":"true",children:(l.trim()[0]||"?").toUpperCase()}),f.jsxs("span",{className:"acct",children:[f.jsx("b",{children:l}),e.name&&f.jsx("small",{children:e.email})]}),f.jsx(ut,{name:"chev"})]})}),f.jsxs(VC,{id:"account-menu",side:"top",align:"start",sideOffset:6,className:"acct-menu",children:[n&&f.jsxs(f.Fragment,{children:[f.jsx(tm,{className:"menu-sec",children:"Organization"}),f.jsx(zo,{asChild:!0,children:f.jsxs("a",{id:"menu-org-settings","aria-current":i?"page":void 0,...p,onClick:y=>{p?.onClick?.(y),d(!1)},children:[f.jsx(ut,{name:"gear"}),f.jsxs("span",{children:[f.jsx("b",{children:n.name})," Settings"]}),!n.manage_url.startsWith("/")&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"ext","aria-hidden":"true",children:"↗"}),f.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]})]})}),s&&f.jsx(zo,{asChild:!0,children:f.jsxs("a",{id:"menu-billing",...m,onClick:y=>{m?.onClick?.(y),d(!1)},children:[f.jsx(ut,{name:"card"}),f.jsx("span",{children:"Billing"}),f.jsx("span",{className:"ps-chip plan-chip",children:s.plan})]})})]}),r&&f.jsxs(f.Fragment,{children:[f.jsx(tm,{className:"menu-sec",children:"Hub"}),f.jsxs(zo,{id:"menu-hub-admin",onSelect:r.onClick,children:[f.jsx(ut,{name:"shield"}),f.jsxs("span",{children:["Signup & access",r.pending?` · ${r.pending}`:""]})]})]}),f.jsx(tm,{className:"menu-sec",children:"Account"}),f.jsx(zo,{asChild:!0,children:f.jsxs("a",{id:"signout",href:"/auth/logout",children:[f.jsx(ut,{name:"power"}),f.jsx("span",{children:"Log out"})]})})]})]})]})}function $a({className:e,...n}){return f.jsx("div",{"data-slot":"card",className:Je("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...n})}function Ia({className:e,...n}){return f.jsx("div",{"data-slot":"card-header",className:Je("@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 Pa({className:e,...n}){return f.jsx("div",{"data-slot":"card-title",className:Je("leading-none font-semibold",e),...n})}function Po({className:e,...n}){return f.jsx("div",{"data-slot":"card-description",className:Je("text-muted-foreground text-sm",e),...n})}function Fa({className:e,...n}){return f.jsx("div",{"data-slot":"card-content",className:Je("px-6",e),...n})}function na({className:e,orientation:n="horizontal",decorative:r=!0,...i}){return f.jsx(CN,{"data-slot":"separator",decorative:r,orientation:n,className:Je("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 G$({url:e}){const n=Ht({queryKey:["billing"],queryFn:()=>Yt(e)});if(n.isLoading)return f.jsx("div",{className:"empty",children:"Loading…"});if(n.error||!n.data)return f.jsxs("div",{className:"empty",children:[f.jsx("h3",{children:"Billing is unavailable"}),f.jsx("p",{children:n.error?.message||"Try again shortly."})]});const r=n.data;return f.jsxs("div",{className:"project-settings",id:"billing-view",children:[f.jsxs("h2",{children:["Billing",f.jsx("span",{className:"ps-chip plan-chip",children:r.plan.name})]}),f.jsxs($a,{children:[f.jsxs(Ia,{children:[f.jsxs(Pa,{children:[r.plan.name," plan",r.plan.status?` (${r.plan.status})`:""]}),f.jsxs(Po,{children:["Organization ",r.org," · ",r.usage.used," of ",r.usage.cap," used · ",r.seats.used," of ",r.seats.cap," ",r.seats.cap===1?"seat":"seats"]})]}),f.jsx(na,{}),f.jsx(Fa,{children:f.jsx("div",{className:"usage-bar",children:f.jsx("div",{style:{width:`${r.usage.pct}%`}})})})]}),r.owner?f.jsx("div",{className:"plan-grid",children:r.plans.map(i=>f.jsxs($a,{children:[f.jsxs(Ia,{children:[f.jsx(Pa,{children:i.name}),f.jsx(Po,{children:i.blurb})]}),f.jsx(na,{}),f.jsxs(Fa,{children:[f.jsxs("p",{className:"plan-price",children:[i.price,f.jsx("small",{children:" / user / month"})]}),f.jsxs("form",{method:"post",action:r.checkout_url,children:[f.jsx("input",{type:"hidden",name:"plan",value:i.id}),f.jsx(vt,{type:"submit",disabled:i.current,variant:i.current?"subtle":"default",children:i.current?"Current plan":`Upgrade to ${i.name}`})]})]})]},i.id))}):f.jsx("p",{className:"muted-note",children:"Only an organization owner can change the plan."}),r.owner&&r.has_customer&&f.jsxs($a,{children:[f.jsxs(Ia,{children:[f.jsx(Pa,{children:"Manage subscription"}),f.jsx(Po,{children:"Change seats, update the card, download invoices, or cancel."})]}),f.jsx(na,{}),f.jsx(Fa,{children:f.jsx("form",{method:"post",action:r.portal_url,children:f.jsx(vt,{type:"submit",variant:"subtle",children:"Open the billing portal"})})})]})]})}function du({className:e,type:n,...r}){return f.jsx("input",{type:n,"data-slot":"input",className:Je("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 nm({className:e,...n}){return f.jsx(YM,{"data-slot":"label",className:Je("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 Z$({className:e,...n}){return f.jsx("textarea",{"data-slot":"textarea",className:Je("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 iw={read:1,write:2,admin:3};function wi(e,n){return(iw[e||""]||0)>=(iw[n]||0)}const Ym=280,K$=hg({name:uu().trim().min(1,"Give the project a name.").max(120,"Keep the name under 120 characters."),description:uu().max(Ym,`Keep the description under ${Ym} characters.`),icon:uu()});function Y$({project:e,org:n,onDeleted:r}){const i=O_(),s=wi(e.perm,"admin"),l=ag({resolver:fg(K$),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"),p=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 Wn("PATCH","/api/projects/"+e.id,v),Ke("Saved."),l.reset({...m,name:m.name.trim()}),await i()}catch(b){Ke(b.message,!0)}});return f.jsxs("div",{className:"project-settings",children:[f.jsxs("h2",{children:[e.name,!wi(e.perm,"write")&&f.jsx("span",{className:"ps-chip",children:"Read-only"})]}),f.jsxs($a,{children:[f.jsxs(Ia,{children:[f.jsx(Pa,{children:"General"}),f.jsx(Po,{children:"Name, description and icon for this project."})]}),f.jsx(na,{}),f.jsx(Fa,{children:f.jsxs("form",{className:"ps-form",onSubmit:p,children:[f.jsxs("div",{className:"ps-field",children:[f.jsx(nm,{htmlFor:"ps-icon-btn",children:"Icon"}),f.jsxs("div",{className:"ps-icon-row",children:[f.jsx("span",{className:"proj-mark","aria-hidden":"true",style:{background:ml(e.name)},children:f.jsx($o,{name:u})}),f.jsxs(PC,{children:[f.jsx(FC,{asChild:!0,children:f.jsx(vt,{id:"ps-icon-btn",type:"button",variant:"subtle",disabled:!s,children:"Change"})}),f.jsxs(VC,{align:"start",className:"ps-icon-grid",children:[f.jsx(zo,{className:"ps-icon-cell"+(u===""?" active":""),title:"Default","aria-label":"Default icon",onSelect:()=>l.setValue("icon","",{shouldDirty:!0}),children:f.jsx($o,{})}),Object.keys(Nm).map(m=>f.jsx(zo,{className:"ps-icon-cell"+(u===m?" active":""),title:m,"aria-label":m,onSelect:()=>l.setValue("icon",m,{shouldDirty:!0}),children:f.jsx($o,{name:m})},m))]})]})]})]}),f.jsxs("div",{className:"ps-field",children:[f.jsx(nm,{htmlFor:"ps-name",children:"Name"}),f.jsx(du,{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&&f.jsx("span",{id:"ps-name-err",role:"alert",className:"field-err",children:l.formState.errors.name.message})]}),f.jsxs("div",{className:"ps-field",children:[f.jsxs(nm,{htmlFor:"ps-desc",children:["Description ",f.jsx("span",{className:"ps-opt",children:"(optional)"})]}),f.jsx(Z$,{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")}),f.jsxs("div",{className:"ps-meta",children:[l.formState.errors.description?f.jsx("span",{id:"ps-desc-err",role:"alert",className:"field-err",children:l.formState.errors.description.message}):f.jsx("span",{}),f.jsxs("span",{className:"ps-count",children:[d.length," / ",Ym]})]})]}),s&&f.jsxs(f.Fragment,{children:[f.jsx(na,{}),f.jsx("div",{className:"ps-actions",children:f.jsx(vt,{id:"ps-save",type:"submit",variant:"primary",disabled:!l.formState.isDirty||l.formState.isSubmitting,children:"Save changes"})})]})]})})]}),f.jsx(Q$,{project:e}),f.jsx(J$,{project:e,org:n}),f.jsxs($a,{children:[f.jsx(Ia,{children:f.jsx(Pa,{children:"About"})}),f.jsx(na,{}),f.jsx(Fa,{children:f.jsxs("dl",{className:"ps-facts",children:[f.jsx("dt",{children:"Project id"}),f.jsx("dd",{children:f.jsx("code",{children:e.id})}),n&&f.jsxs(f.Fragment,{children:[f.jsx("dt",{children:"Workspace"}),f.jsx("dd",{children:n.name})]}),e.created&&f.jsxs(f.Fragment,{children:[f.jsx("dt",{children:"Created"}),f.jsx("dd",{children:new Date(e.created).toLocaleDateString()})]})]})})]}),s&&f.jsxs($a,{className:"ps-danger",children:[f.jsx(Ia,{children:f.jsx(Pa,{children:"Danger zone"})}),f.jsx(na,{}),f.jsxs(Fa,{children:[f.jsx("p",{children:"Deleting removes the project from this hub. Its files stay in storage. This can't be undone."}),f.jsx(vt,{variant:"danger",onClick:async()=>{if(await R_(`Delete “${e.name}”?`,"This can't be undone. Type the project name to confirm:","","Delete project",{match:e.name,danger:!0})!==null)try{await Wn("DELETE","/api/projects/"+e.id),Ke(`Deleted “${e.name}”.`),await r()}catch(y){Ke(y.message,!0)}},children:"Delete project"})]})]})]})}function Q$({project:e}){const n=Ai(),{data:r,error:i,isLoading:s}=j_(e.id);return i?null:f.jsxs($a,{children:[f.jsxs(Ia,{children:[f.jsx(Pa,{children:"Public links"}),f.jsxs(Po,{children:["Files in this project that anyone with the URL can read — no account needed.",(r||[]).some(l=>l.opens!==void 0)&&f.jsxs(f.Fragment,{children:[" ",LC]})]})]}),f.jsx(na,{}),f.jsx(Fa,{children:f.jsx($C,{shares:r||[],loading:s,canRevoke:wi(e.perm,"write"),onChanged:()=>n.invalidateQueries({queryKey:["shares",e.id]}),empty:"No public links."})})]})}const Qm=[{value:"admin",label:"Admin"},{value:"write",label:"Write"},{value:"read",label:"Read"},{value:"none",label:"No access"}],X$=Object.fromEntries(Qm.map(e=>[e.value,e.label]));function J$({project:e,org:n}){const r=Ai(),{data:i,error:s}=j3(e.id),l=wi(e.perm,"admin"),u=()=>{r.invalidateQueries({queryKey:["permissions",e.id]}),r.invalidateQueries({queryKey:["projects"]})},d=async(x,w)=>{try{await x(),Ke(w)}catch(_){Ke(_.message,!0)}u()};if(s||!i)return null;const p=i,m=`/api/p/${e.id}/permissions`,y=new Set((n?.members||[]).filter(x=>x.role==="owner").map(x=>x.email.toLowerCase())),v=[...p.grants.filter(x=>!y.has(x.email.toLowerCase())),...[...y].sort().map(x=>({email:x,level:"admin",owner:!0}))],b=async()=>{const x=await R_("Add an exception","Email of a workspace member. They get Read access; change it in the table.","","Add");x===null||!x.trim()||await d(()=>Wn("PUT",`${m}/${encodeURIComponent(x.trim())}`,{level:"read"}),"Added.")};return f.jsxs($a,{className:"ps-people",children:[f.jsxs(Ia,{children:[f.jsx(Pa,{children:"People"}),f.jsx(Po,{children:"Who can see and change this project."})]}),f.jsx(na,{}),f.jsxs(Fa,{children:[f.jsxs("p",{className:"ps-row",children:[f.jsxs("span",{children:["Everyone in ",n?.name||"this workspace"," can"]}),f.jsx("select",{"aria-label":"Default access for workspace members",disabled:!l,value:p.default,onChange:async x=>{const w=x.target.value;if(w==="none"&&!await Cl("Make this project invite-only?","Only people listed below (and workspace owners) will see this project.","Make invite-only")){u();return}await d(()=>Wn("PUT",m,{default:w}),"Default access updated.")},children:Qm.filter(x=>x.value!=="admin").map(x=>f.jsx("option",{value:x.value,children:x.label},x.value))})]}),p.default==="none"&&f.jsx("p",{className:"ps-note",children:"This project is invite-only: only the people below and workspace owners can see it."}),f.jsxs("div",{className:"ps-people-head",children:[f.jsx("h4",{children:"Exceptions"}),l&&f.jsx(vt,{type:"button",variant:"subtle",onClick:b,children:"+ Add"})]}),v.length===0?f.jsx("p",{className:"ps-note",children:"No exceptions — everyone gets the access above."}):f.jsx("div",{className:"admin-list",children:v.map(x=>{const w="owner"in x;return f.jsxs("div",{className:"admin-item",children:[f.jsxs("span",{className:"ai-main",title:x.email,children:[x.email,p.creator&&x.email.toLowerCase()===p.creator.toLowerCase()&&f.jsx("span",{className:"ai-tag",children:" (creator)"})]}),w?f.jsx("span",{className:"ai-tag",children:"Workspace owner — always admin"}):f.jsxs("span",{className:"role-cell",children:[f.jsx("select",{"aria-label":`Access for ${x.email}`,disabled:!l,value:x.level,onChange:_=>d(()=>Wn("PUT",`${m}/${encodeURIComponent(x.email)}`,{level:_.target.value}),`${x.email} is now ${X$[_.target.value]||_.target.value}.`),children:Qm.map(_=>f.jsx("option",{value:_.value,children:_.label},_.value))}),l&&f.jsx("button",{className:"ai-del","aria-label":`Remove exception for ${x.email}`,onClick:()=>d(()=>Wn("DELETE",`${m}/${encodeURIComponent(x.email)}`),"Reverted to the default access."),children:"Remove"})]})]},x.email)})})]})]})}const UC="https://raw.githubusercontent.com/runbear-io/beardrive/main/INSTALL_FOR_AGENTS.md";function HC({project:e,existing:n}){const r=window.location.origin,i=n?'. I already have a folder of notes — ask me which one to sync (the project is named "':'. Ask me which folder to sync (the project is named "',s="Follow "+UC+` -to set up BearDrive project `+e.id+" on "+r+i+e.name+'").',l=`brew install runbear-io/tap/beardrive -bdrive login `+r+` -bdrive init --project `+e.id;return f.jsxs("div",{className:"guide",children:[f.jsxs("h1",{className:"in-title gd-head",children:[f.jsx("span",{className:"proj-mark","aria-hidden":"true",style:{background:ml(e.name)},children:f.jsx($o,{name:e.icon})}),e.name]}),e.description&&f.jsx("p",{className:"in-desc",children:e.description}),f.jsxs("div",{className:"gd-body",children:[f.jsx("p",{className:"gd-desc",children:n?"Paste into your coding agent — Claude Code, Cowork, Codex, Gemini CLI, Hermes — in the folder you already have:":"Paste into your coding agent — Claude Code, Cowork, Codex, Gemini CLI, Hermes — in the folder where you want the files:"}),n&&f.jsx("p",{className:"gd-note",children:"Your files stay exactly where they are. Connecting a folder never moves, renames or overwrites anything in it — it uploads what is there and keeps it in sync."}),f.jsx(Xm,{code:s}),f.jsx("p",{className:"gd-desc",children:"The agent installs the CLI, signs this machine in, and registers the sync hooks — asking before anything it changes."}),f.jsx("p",{className:"gd-desc",children:"Runs on macOS and Linux. Windows is not supported yet."}),f.jsxs("details",{className:"gd-manual",children:[f.jsx("summary",{children:"What exactly happens"}),f.jsxs("ul",{className:"gd-desc gd-list",children:[f.jsx("li",{children:"Sign-in uses a device code you approve in this browser — the folder itself never holds credentials."}),f.jsx("li",{children:"Sync hooks pull the latest before every agent turn, push edits seconds after they happen, and stamp each change with the session that made it; agent reads feed Insights. They register once per machine in your agent's own config, so every session is covered and nothing is written into the synced folder."}),f.jsx("li",{children:"Codex hooks are off by default: set [features] codex_hooks = true in ~/.codex/config.toml."})]})]}),f.jsxs("details",{className:"gd-manual",children:[f.jsx("summary",{children:"Or run it yourself"}),f.jsx("p",{className:"gd-desc",children:"Same result, in the folder you want the files. One command: init signs this device in, registers the sync hooks and starts syncing."}),f.jsx(Xm,{code:l}),f.jsx("p",{className:"gd-desc",children:f.jsx("a",{href:"https://docs.beardrive.ai/manual/install/",target:"_blank",rel:"noreferrer",children:"Full manual setup guide →"})})]})]})]})}function Xm({code:e}){const[n,r]=S.useState("Copy");return f.jsxs("pre",{className:"gd-code",children:[f.jsx("code",{children:e}),f.jsx("button",{className:"gd-copy",onClick:async()=>{r(await qo(e)?"Copied":"Copy failed"),setTimeout(()=>r("Copy"),1400)},children:n})]})}function W$({onNew:e,canCreate:n}){return f.jsxs("div",{className:"onboard",children:[f.jsx("h1",{children:"Welcome to BearDrive"}),f.jsx("p",{children:"You're signed in, but you're not part of any project yet."}),n&&f.jsxs("div",{className:"ob-card ob-start",children:[f.jsx("h3",{children:"Start a project"}),f.jsx("p",{children:"Name it and pick what it starts from — a structure, or nothing at all. Then connect a folder on any machine and it stays in sync."}),f.jsx(vt,{variant:"primary",id:"ob-new",onClick:e,children:"New project"})]}),f.jsxs("div",{className:"ob-card ob-agent",children:[f.jsx("h3",{children:n?"Or let your agent do it":"Connect a new drive to your project"}),f.jsx("p",{children:"Paste into your coding agent — Claude Code, Cowork, Codex, Gemini CLI, Hermes — in the folder where you want the files. It creates the project and starts syncing:"}),f.jsx(Xm,{code:"Follow "+UC+` -to set up a new BearDrive project on `+window.location.origin+". Ask me which folder to sync."}),f.jsx("p",{className:"ob-alt",children:f.jsx("a",{href:"https://docs.beardrive.ai/manual/setup-by-hand/",target:"_blank",rel:"noreferrer",children:"Or start a project manually →"})})]})]})}const BC="__existing__";function eI({templates:e,onCreate:n,onClose:r}){const i=[...e.map(x=>({value:x.name,title:x.title,blurb:x.blurb,rule:!1})),{value:BC,title:"I already have a folder",blurb:"nothing is seeded — connect it and your files stay as they are",rule:!0},{value:"",title:"Empty project",blurb:"just the folder",rule:!1}],[s,l]=S.useState(""),[u,d]=S.useState(i[0].value),[p,m]=S.useState(""),[y,v]=S.useState(!1),b=async()=>{if(!y){if(!s.trim()){m("Give it a name.");return}v(!0);try{await n(s.trim(),u)}finally{v(!1)}}};return f.jsx(Ju,{open:!0,onOpenChange:x=>!x&&r(),children:f.jsxs(Wu,{className:"modal",showCloseButton:!1,children:[f.jsx(Sl,{asChild:!0,children:f.jsx("h3",{children:"New project"})}),f.jsx("label",{className:"modal-label",htmlFor:"modal-input",children:"Name"}),f.jsx("input",{className:"modal-input",type:"text",autoComplete:"off",id:"modal-input",autoFocus:!0,value:s,"aria-invalid":!!p,"aria-describedby":p?"modal-input-err":void 0,onChange:x=>{l(x.currentTarget.value),p&&m("")},onKeyDown:x=>x.key==="Enter"&&b()}),p&&f.jsx("span",{id:"modal-input-err",role:"alert",className:"field-err",children:p}),i.length>1&&f.jsxs("fieldset",{className:"start-points",children:[f.jsx("legend",{className:"modal-label",children:"Starting point"}),i.map((x,w)=>f.jsxs("label",{className:"start-point"+(u===x.value?" on":"")+(x.rule?" sp-rule":""),children:[f.jsx("input",{type:"radio",name:"template",value:x.value,checked:u===x.value,onChange:()=>d(x.value)}),f.jsxs("span",{className:"sp-text",children:[f.jsxs("span",{className:"sp-title",children:[x.title,w===0&&f.jsx("span",{className:"sp-rec",children:"Recommended"})]}),f.jsx("span",{className:"sp-blurb",children:x.blurb})]})]},x.value))]}),f.jsxs("div",{className:"modal-actions",children:[f.jsx(vt,{variant:"subtle",onClick:r,children:"Cancel"}),f.jsx(vt,{variant:"primary",onClick:b,disabled:y,children:"Create"})]})]})})}function ow(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 ka(e){return(e.human||0)+(e.agent||0)+(e.share||0)}function Xs(e){const n=ka(e);if(!n)return"";const r=n+(n===1?" read":" reads");if(!e.agent&&!e.share)return r;const i=[];return e.human&&i.push(e.human+" human"),e.agent&&i.push(e.agent+" agent"),e.share&&i.push(e.share+" shared"),r+" ("+i.join(", ")+")"}function tI(e){const n=ka(e);return n?n<3?1:n<10?2:n<30?3:4:0}function nI(e){const n=ka(e);return n?{agent:(e.agent||0)/n,human:(e.human||0)/n,share:(e.share||0)/n}:{agent:0,human:0,share:0}}function rI(e,n){return e?Object.keys(e).filter(r=>!n.has(r)).sort():[]}const aI=7;function iI(e){if(!e.length)return null;let n=e[0],r=e[0];for(const i of e)ir&&(r=i);return{min:n,max:r}}const oI=(e,n)=>n-el.reads-s.reads).slice(0,lI)){const s=i.path.split("/").pop();let l=i.cx+i.r+4,u="start";l+s.length*cI>n.right&&(l=i.cx-i.r-4,u="end");const d=m=>r.every(y=>Math.abs(y.y-m)>=rm);let p=i.cy;for(;p<=n.bottom&&!d(p);)p+=rm;if(p>n.bottom)for(p=i.cy;p>=n.top&&!d(p);)p-=rm;r.push({path:i.path,name:s,x:l,y:Math.min(n.bottom,Math.max(n.top,p)),anchor:u})}return r}function dI(e,n=!0){const r=Ht({queryKey:["tree",e],queryFn:()=>Yt(e+"tree"),enabled:n,refetchInterval:15e3}),i=S.useMemo(()=>{const s=[],l=new Map,u=d=>{for(const p of d.children||[])p.dir?(l.set(p.path,p),u(p)):s.push(p)};return r.data&&u(r.data),{flatFiles:s,dirIndex:l}},[r.data]);return{tree:r.data,...i,loaded:!!r.data}}function fI(e,n){return Ht({queryKey:["heat",e],queryFn:()=>Yt(e+"heat?days=30"),enabled:n,staleTime:6e4,refetchInterval:6e4}).data?.entries??null}function hI(e,n,r){return Ht({queryKey:["history",e,"prefix",n,20],queryFn:()=>Yt(e+"history?prefix="+encodeURIComponent(n)+"&n=20"),enabled:r,staleTime:15e3}).data?.entries??null}function mI(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 p=+l;if(Number.isInteger(p)&&p>=0&&pi[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 sw(e,n){if(e===void 0)throw new Error("Unexpected undefined");return e}const pI=(e,n)=>Math.abs(e-n)<1.01,gI=(e,n,r)=>{let i;return function(...s){e.clearTimeout(i),i=e.setTimeout(()=>n.apply(this,s),r)}};let qs;const am=()=>{if(qs!==void 0)return qs;if(typeof navigator>"u")return qs=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return qs=!0;const e=navigator.maxTouchPoints;return qs=navigator.platform==="MacIntel"&&e!==void 0&&e>0},lw=e=>{const{offsetWidth:n,offsetHeight:r}=e;return{width:n,height:r}},vI=e=>e,yI=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:p}=u;n({width:Math.round(d),height:Math.round(p)})};if(s(lw(r)),!i.ResizeObserver)return()=>{};const l=new i.ResizeObserver(u=>{const d=()=>{const p=u[0];if(p?.borderBoxSize){const m=p.borderBoxSize[0];if(m){s({width:m.inlineSize,height:m.blockSize});return}}s(lw(r))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return l.observe(r,{box:"border-box"}),()=>{l.unobserve(r)}},Ou={passive:!0},xI=typeof window>"u"?!0:"onscrollend"in window,wI=(e,n,r)=>{const i=e.scrollElement;if(!i)return;const s=e.targetWindow;if(!s)return;const l=e.options.useScrollendEvent&&xI;let u=0;const d=l?null:gI(s,()=>n(u,!1),e.options.isScrollingResetDelay),p=v=>()=>{u=r(i),d?.(),n(u,v)},m=p(!0),y=p(!1);return i.addEventListener("scroll",m,Ou),l&&i.addEventListener("scrollend",y,Ou),()=>{i.removeEventListener("scroll",m),l&&i.removeEventListener("scrollend",y)}},SI=(e,n)=>wI(e,n,r=>{const{horizontal:i,isRtl:s}=e.options;return i?r.scrollLeft*(s&&-1||1):r.scrollTop}),_I=(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"]},CI=(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})},EI=CI;class RI{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,p=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(p)&&this.resizeItem(p,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:vI,rangeExtractor:yI,onChange:()=>{},measureElement:_I,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,p=null,m=!1;if(u!==void 0&&u.enabled&&l.enabled&&l.anchorTo==="end"&&this.scrollElement!==null){const b=u.count,x=l.count,w=this.getMeasurements(),_=b>0?((i=w[0])==null?void 0:i.key)??u.getItemKey(0):null,E=b>0?((s=w[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 O=b>0?this.getVirtualItemForOffset(this.getScrollOffset())??w[0]:null;O&&(d=[O.key,this.getScrollOffset()-O.start]);const N=l.followOnAppend===!0?"auto":l.followOnAppend||null;N&&x>b&&this.isAtEnd(u.scrollEndThreshold)&&(b===0||l.getItemKey(x-1)!==E)&&(p=N)}}this.options=l,m&&(this.pendingMin=0,this.itemSizeCacheVersion++);let y=!1,v=0;if(d&&this.scrollOffset!==null){const[b,x]=d,w=this.getMeasurements(),{count:_,getItemKey:E}=this.options;let R=0;for(;R<_&&E(R)!==b;)R++;if(R<_){const T=w[R];if(T){const O=T.start+x;O!==this.scrollOffset&&(v=O-this.scrollOffset,this.scrollOffset=O,y=!0)}}}(y||p)&&(this.pendingScrollAnchor=[y?d[0]:null,y?d[1]:0,p,v])},this.notify=r=>{var i,s;(s=(i=this.options).onChange)==null||s.call(i,this,r)},this.maybeNotify=Oo(()=>(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,!(!am()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};l.addEventListener("touchstart",u,Ou),l.addEventListener("touchend",d,Ou),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,p]=s;l!==null&&!d&&(am()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?p!==0&&(this._iosDeferredAdjustment+=p):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=Oo(()=>[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,p,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:p,gap:m}),{key:!1}),this.getMeasurements=Oo(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:r,paddingStart:i,scrollMargin:s,getItemKey:l,enabled:u,lanes:d,laneAssignmentMode:p,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 R of this.laneAssignments.keys())R>=r&&this.laneAssignments.delete(R);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(R=>{this.itemSizeCache.set(R.key,R.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 R=r*2;let T=this._flatMeasurements;if(!T||T.length0&&L.set(T.subarray(0,b*2)),T=L,this._flatMeasurements=T}let O;if(b===0)O=i+s;else{const L=b-1;O=T[L*2]+T[L*2+1]+m}for(let L=b;L1){N=O;const be=w[N],he=be!==void 0?x[be]:void 0;L=he?he.end+m:i+s}else if(E===d){let be=0,he=_[0],X=w[0];for(let ue=1;uethis.options.debug}),this.calculateRange=Oo(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,i,s,l)=>r.length===0||i===0?(this.range=null,null):(this.range=TI(r,i,s,l,l===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Oo(()=>{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,p;const m=this._flatMeasurements;if(this.options.lanes===1&&m!==null)p=this.options.getItemKey(r),d=m[r*2],u=m[r*2+1];else{const b=this.measurementsCache[r];if(!b)return;p=b.key,d=b.start,u=b.size}const y=this.itemSizeCache.get(p)??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,w=((l=this.scrollState)==null?void 0:l.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[r]??{index:r,key:p,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=qC(0,i.length-1,l?d=>s[d*2]:d=>sw(i[d]).start,r);return sw(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,p=this.now();this.scrollState={index:r,align:d,behavior:s,startedAt:p,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&&(am()&&(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&&pI(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,p=Math.abs(s-this.getScrollOffset()),m=this.scrollState.behavior==="smooth"&&p>d;this.scrollState.lastTargetOffset=s,m||(this.scrollState.behavior="auto"),this._scrollToOffset(s,{adjustments:void 0,behavior:m?"smooth":"auto"})}this.scheduleScrollReconcile()}}const qC=(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 jI(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 TI(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=jI(s,l,r);let y=m;const v=r+n;for(;ye[m].start,r),p=d;if(i===1)for(;p1){const m=Array(i).fill(0);for(;pv=0&&y.some(v=>v>=r);){const v=e[d];y[v.lane]=v.start,d--}d=Math.max(0,d-d%i),p=Math.min(l,p+(i-1-p%i))}return{startIndex:d,endIndex:p}}const im=typeof document<"u"?S.useLayoutEffect:S.useEffect;function OI({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 R=m.options.horizontal?"width":"height";y.container.style[R]=`${v}px`}const b=!!m.options.horizontal,x=y.mode==="transform",w=b?"left":"top",_=m.options.scrollMargin,E=m.getVirtualItems();for(const R of E){const T=R.start-_,O=m.elementsCache.get(R.key);O&&y.lastPositions.get(O)!==T&&(y.lastPositions.set(O,T),x?O.style.transform=b?`translate3d(${T}px, 0, 0)`:`translate3d(0, ${T}px, 0)`:O.style[w]=`${T}px`)}},d={...i,onChange:(m,y)=>{var v;const b=l.current;let x=!0;if(b.enabled){u(m);const w=m.range,_=b.prevRange;x=!_||_.isScrolling!==m.isScrolling||_.startIndex!==w?.startIndex||_.endIndex!==w?.endIndex,x&&(b.prevRange=w?{startIndex:w.startIndex,endIndex:w.endIndex,isScrolling:m.isScrolling}:null)}x&&(e&&y?Mi.flushSync(s):s()),(v=i.onChange)==null||v.call(i,m,y)}},[p]=S.useState(()=>{const m=new RI(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 p.setOptions(d),im(()=>p._didMount(),[]),im(()=>p._willUpdate()),im(()=>{u(p)}),p}function AI(e){return OI({observeElementRect:bI,observeElementOffset:SI,scrollToFn:EI,...e})}function MI(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 NI(e){const{root:n,expanded:r,onToggle:i,currentPath:s,listingShowing:l,onOpen:u}=e,d=S.useRef(null),p=S.useMemo(()=>MI(n,r),[n,r]),m=AI({count:p.length,getScrollElement:()=>d.current,estimateSize:()=>window.matchMedia("(max-width: 768px)").matches?44:28,overscan:12,getItemKey:y=>p[y].node.path});return S.useEffect(()=>{if(!s)return;const y=p.findIndex(v=>v.node.path===s);y>=0&&m.scrollToIndex(y,{align:"auto"})},[s,p]),f.jsx("nav",{id:"tree","aria-label":"Files",ref:d,children:f.jsx("div",{style:{height:m.getTotalSize(),position:"relative"},children:m.getVirtualItems().map(y=>{const{node:v,depth:b}=p[y.index],x=v.dir?r.has(v.path):!1,w=()=>{if(v.dir&&s===v.path&&l){i(v.path);return}u(v.path),v.dir||mr()};return f.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:w,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),w())},children:[Array.from({length:b},(_,E)=>f.jsx("span",{className:"tguide",style:{left:8+E*13+5},"aria-hidden":"true"},E)),f.jsx("span",{className:"chev",onClick:_=>{v.dir&&(_.stopPropagation(),i(v.path))},children:f.jsx(ut,{name:"chevd"})}),f.jsx("span",{className:"ticon",children:f.jsx(ut,{name:v.dir?"folder":"doc"})}),f.jsx("span",{className:"label",children:v.name})]},y.key)})})})}function DI(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 f.jsxs("span",{children:[l>0&&f.jsx("span",{className:"crumb-sep",children:"/"}),d?f.jsx("span",{children:s}):f.jsx("span",{className:"crumb-seg",title:u,onClick:()=>n(u),children:s})]},u)})})}function cw(e){if(e==="")return[];const n=e.split(` -`);return n[n.length-1]===""&&n.pop(),n}const kI=4e6;function LI(e,n){let r=0;for(;rs.push({op:"-",line:l[v],an:r+v+1}),y=v=>s.push({op:"+",line:u[v],bn:r+v+1});if(d*p>kI){for(let v=0;v=0;w--)for(let _=p-1;_>=0;_--)v[w][_]=l[w]===u[_]?v[w+1][_+1]+1:Math.max(v[w+1][_],v[w][_+1]);let b=0,x=0;for(;b=v[b][x+1]?m(b++):y(x++);for(;bi.op==="+").length,del:r.filter(i=>i.op==="-").length}}const GC=1<<20,II=8192;function PI(e){if(e.byteLength>GC)return{kind:"too-large",size:e.byteLength};if(e.subarray(0,II).includes(0))return{kind:"binary"};try{return{kind:"text",text:new TextDecoder("utf-8",{fatal:!0}).decode(e)}}catch{return{kind:"binary"}}}function Jm(e,n,r,i){let s=e+"blob?sha="+encodeURIComponent(n);return r&&(s+="&name="+encodeURIComponent(r)),i&&(s+="&download=1"),s}async function FI(e){const n=await gj(e),r=Number(n.headers.get("Content-Length"));return r>GC?{kind:"too-large",size:r}:PI(new Uint8Array(await n.arrayBuffer()))}function ZC(e,n,r,i){return Ht({queryKey:n,queryFn:()=>FI(e),enabled:r,...i?{staleTime:1/0,gcTime:1/0}:{},retry:!1})}function uw(e,n,r){return ZC(n?Jm(e,n):"",["blob",e,n],!!n,!0)}function VI(e){return e.slice(e.lastIndexOf("/")+1)}function UI({apiBase:e,path:n,prev:r,cur:i}){const s=VI(n);return f.jsxs("span",{className:"dv-dl",children:[f.jsx("a",{href:Jm(e,r,s,!0),children:"download previous"}),f.jsx("a",{href:Jm(e,i,s,!0),children:"download this version"})]})}function HI({apiBase:e,path:n,prev:r,cur:i}){const s=uw(e,r),l=uw(e,i),u=s.data?.kind==="text"&&l.data?.kind==="text",d=S.useMemo(()=>s.data?.kind==="text"&&l.data?.kind==="text"?$I(s.data.text,l.data.text):null,[s.data,l.data]);if(s.error||l.error)return f.jsx("div",{className:"dv dv-msg",children:"Could not load one of the versions."});if(!s.data||!l.data)return f.jsx("div",{className:"dv dv-msg",children:"Loading changes…"});if(!u){const v=s.data.kind==="too-large"||l.data.kind==="too-large";return f.jsxs("div",{className:"dv dv-msg",children:[v?"Too large to diff — download to compare.":"Binary file — no diff available.",f.jsx(UI,{apiBase:e,path:n,prev:r,cur:i})]})}const{lines:p,add:m,del:y}=d;return f.jsxs("div",{className:"dv",children:[f.jsxs("div",{className:"dv-head",children:[f.jsxs("span",{className:"dv-stat",children:[f.jsxs("span",{className:"dv-add",children:["+",m]})," ",f.jsxs("span",{className:"dv-del",children:["−",y]})]}),m===0&&y===0&&f.jsx("span",{className:"dv-same",children:"No line changes"})]}),f.jsx("div",{className:"dv-body",children:p.map((v,b)=>f.jsxs("div",{className:"dv-line dv-"+(v.op==="="?"ctx":v.op==="+"?"ins":"rm"),children:[f.jsx("span",{className:"dv-n",children:v.an??""}),f.jsx("span",{className:"dv-n",children:v.bn??""}),f.jsx("span",{className:"dv-mark",children:v.op==="="?" ":v.op}),f.jsx("span",{className:"dv-text",children:v.line||" "})]},b))})]})}const BI={add:"added",edit:"edited",delete:"deleted"};function KC({text:e}){return f.jsx(f.Fragment,{children:e.split(/(https?:\/\/\S+)/).map((n,r)=>/^https?:\/\//.test(n)?f.jsx("a",{href:n,target:"_blank",rel:"noopener",children:n},r):n)})}function pg({entry:e,apiBase:n,onOpen:r,diff:i,restore:s,remove:l,restoreSha:u,inRun:d}){const[p,m]=S.useState(!1),[y,v]=S.useState(!1),b=e.kind==="put"?"edit":e.kind,x=dd(e),w=[e.device.name||e.device.id,e.device.os].filter(Boolean).join(" · "),_=b!=="delete",E=!!i&&b!=="delete"&&!!e.blob,R=!!d&&b==="add",T=!!s&&!!u&&!R,O=!!l&&R,N=!!s?.busy&&s.busy===e.path+u,L=!!l?.busy&&l.busy===e.path,P=_&&!!e.blob,F=e.path.split("/").pop()||e.path,V=new Date(e.time).toLocaleString(),ye=n+"blob?sha="+e.blob+"&name="+encodeURIComponent(F)+"&download=1",be=()=>v(!y),he=X=>{X.target.tagName!=="A"&&_&&r(e.path,e.blob)};return f.jsxs("div",{className:"hentry "+b+(_?" clickable":""),tabIndex:_?0:void 0,role:_?"button":void 0,onClick:he,onKeyDown:X=>{_&&(X.key==="Enter"||X.key===" ")&&(X.preventDefault(),r(e.path,e.blob))},children:[f.jsxs("div",{className:"hline",children:[f.jsx("span",{className:"hkind",children:BI[b]||b}),f.jsx("span",{className:"hpath",children:e.path}),f.jsx("span",{className:"htime",children:V})]}),f.jsxs("div",{className:"hmeta",children:[f.jsx("span",{className:"hwho",children:x}),f.jsx("span",{className:"hdev",children:w}),f.jsx("span",{className:"hsize",children:e.size?mg(e.size):""}),T&&f.jsxs("button",{type:"button",className:"hrestore-btn",disabled:N,title:"Put this version of "+e.path+" back as a new change",onClick:X=>{X.stopPropagation(),s.onRestore(e.path,u)},onKeyDown:X=>X.stopPropagation(),children:[f.jsx(ut,{name:"hist"}),N?"restoring…":"restore"]}),O&&f.jsxs("button",{type:"button",className:"hremove-btn",disabled:L,title:"Remove "+e.path+" — this run created it",onClick:X=>{X.stopPropagation(),l.onRemove(e.path)},onKeyDown:X=>X.stopPropagation(),children:[f.jsx(ut,{name:"trash"}),L?"removing…":"undo — remove file"]})]}),e.note&&!d&&f.jsx("div",{className:"hnote"+(p?" open":""),tabIndex:0,role:"button",title:p?"Collapse note":"Show full note","aria-expanded":p,onClick:X=>{X.stopPropagation(),X.target.tagName!=="A"&&m(!p)},onKeyDown:X=>{(X.key==="Enter"||X.key===" ")&&(X.preventDefault(),X.stopPropagation(),m(!p))},children:f.jsx(KC,{text:e.note})}),(E||P)&&f.jsxs("div",{className:"hactions",children:[E&&(i.prev?f.jsxs("button",{type:"button",className:"hdiff-btn"+(y?" open":""),"aria-expanded":y,onClick:X=>{X.stopPropagation(),be()},onKeyDown:X=>X.stopPropagation(),children:[f.jsx(ut,{name:y?"chevd":"chev"}),y?"hide changes":"show changes"]}):f.jsx("div",{className:"hdiff-none",children:"First version — nothing to compare against"})),P&&f.jsxs(f.Fragment,{children:[f.jsxs("button",{type:"button",className:"hver-btn","aria-label":`Open ${F} as of ${V}`,onClick:X=>{X.stopPropagation(),r(e.path,e.blob)},onKeyDown:X=>X.stopPropagation(),children:[f.jsx(ut,{name:"clock"}),"Open this version"]}),f.jsxs("a",{className:"hver-btn",download:!0,href:ye,"aria-label":`Download ${F} as of ${V}`,onClick:X=>X.stopPropagation(),onKeyDown:X=>{X.stopPropagation(),X.key===" "&&(X.preventDefault(),X.currentTarget.click())},children:[f.jsx(ut,{name:"download"}),"Download"]})]})]}),E&&i.prev&&y&&f.jsx("div",{onClick:X=>X.stopPropagation(),children:f.jsx(HI,{apiBase:i.apiBase,path:e.path,prev:i.prev,cur:e.blob})})]})}function qI(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 p=ow(r,n.path,!0);return p&&d.push(Xs(p)+" in 30 days"),f.jsxs("div",{className:"dirlist",children:[f.jsxs("h1",{className:"dl-title",children:[f.jsx("span",{className:"dl-title-icon",children:f.jsx(ut,{name:"folder"})}),f.jsx("span",{children:n.name})]}),f.jsx("p",{className:"dl-sub",children:d.join(" · ")||"Empty folder"}),s.length===0?f.jsx("div",{className:"dl-empty",children:"Nothing in this folder yet."}):f.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?mg(m.size):"",m.time?new Date(m.time).toLocaleDateString():""].filter(Boolean).join(" · ");const v=ow(r,m.path,!!m.dir);return v&&(y=Xs(v)+(y?" · "+y:"")),f.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:[f.jsx("span",{className:"ticon",children:f.jsx(ut,{name:m.dir?"folder":"doc"})}),f.jsx("span",{className:"dl-name",children:m.name}),v&&f.jsx("span",{className:"heatdot lvl"+tI(v),role:"img","aria-label":Xs(v)+" in 30 days",title:Xs(v)+" in 30 days"}),f.jsx("span",{className:"dl-meta",children:y})]},m.path)})}),e.hub&&f.jsx(GI,{apiBase:e.apiBase,prefix:n.path+"/",onOpen:i,onFullHistory:()=>e.onFullHistory(n.path+"/"),onRendered:e.onRendered})]})}function GI(e){const n=hI(e.apiBase,e.prefix,!0),{onRendered:r}=e;return S.useEffect(()=>{n&&n.length&&r&&r()},[n,r]),!n||n.length===0?null:f.jsxs("div",{className:"dl-history",children:[f.jsx("h3",{className:"dl-h3",children:"Recent changes"}),f.jsx("div",{className:"history dl-hlist",children:n.map((i,s)=>f.jsx(pg,{entry:i,apiBase:e.apiBase,onOpen:e.onOpen},s))}),f.jsx("button",{className:"ai-btn dl-more",onClick:e.onFullHistory,children:"Full history"})]})}const YC=5e3;function ZI(e,n,r=YC){const i=[];let s=[],l="",u=!1,d=0;const p=()=>{s.push(l),l="",i.length()=>s(""),[r,s]),b$.test(r)?f.jsx(XI,{...e}):OC.test(r)?f.jsx("iframe",{className:"htmlview",sandbox:"allow-scripts",src:l,title:r,onLoad:e.onRendered}):AC.test(r)?f.jsx("iframe",{className:"pdfview",src:l,title:r,onLoad:e.onRendered}):x$.test(r)?f.jsx(eP,{src:l,alt:r,version:i,onRendered:e.onRendered}):w$.test(r)?f.jsx(dw,{...e,fileURL:l,delim:/\.tsv$/i.test(r)?" ":","}):S$.test(r)?f.jsx(dw,{...e,fileURL:l}):f.jsx(YI,{...e,fileURL:l})}function YI(e){const{apiBase:n,path:r,version:i,fileURL:s,onRendered:l}=e,{data:u,error:d}=ZC(s,["text",s],!0,!!i);return S.useEffect(()=>{u&&l?.()},[u,l]),d?f.jsx(fd,{version:i,err:d}):u?u.kind==="text"?f.jsx("pre",{className:"plain",children:u.text},r):f.jsx(QI,{apiBase:n,path:r,version:i,fileURL:s,children:u.kind==="too-large"?`Too large to preview (${mg(u.size)}).`:"No preview for this file type."}):null}function QI(e){const{apiBase:n,path:r,version:i,fileURL:s}=e;return f.jsxs("div",{className:"filecard",children:[f.jsx("div",{className:"name",children:r.split("/").pop()}),f.jsx("p",{children:e.children}),f.jsx("a",{className:"btn",download:!0,href:i?s+"&download=1":n+"download?path="+encodeURIComponent(r),children:"Download"})]})}function XI(e){const{apiBase:n,path:r,version:i,heatMap:s,flatFiles:l,onOpenFile:u,onMeta:d,onRendered:p}=e,{data:m,error:y}=Ht({queryKey:["render",n,r,i||""],queryFn:()=>Yt(n+"render?path="+encodeURIComponent(r)+(i?"&sha="+i:"")),retry:i?!1:void 0}),v=S.useMemo(()=>m?WI(m.html,r,n):"",[m,r,n]);return S.useEffect(()=>{if(!m)return;const b=[];(m.user_name||m.user||m.author)&&b.push(dd(m)+(m.device?" on "+m.device:"")),m.time&&b.push(new Date(m.time).toLocaleString());const x=i?null:s&&s[m.path];x&&ka(x)&&b.push(Xs(x)+" / 30d"),d(b.join(" · ")),p?.()},[m,i,s,d,p]),y?f.jsx(fd,{version:i,err:y}):m?f.jsx("div",{dangerouslySetInnerHTML:{__html:v},onClick:b=>JI(b,r,l,u)}):null}function JI(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(),nP(decodeURIComponent(l.slice(5)),r,i)):/^([a-z]+:|\/|#)/i.test(l)||(e.preventDefault(),i(MC(u,decodeURIComponent(l))))}function WI(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")||"";/^\s*data:image\/svg/i.test(d)?u.removeAttribute("src"):/^([a-z]+:|\/)/i.test(d)||u.setAttribute("src",s(MC(i,d)))}for(const u of l.querySelectorAll("a")){const d=u.getAttribute("href")||"";/^\s*data:/i.test(d)?u.removeAttribute("href"):/^https?:/i.test(d)&&(u.setAttribute("target","_blank"),u.setAttribute("rel","noopener"))}return l.body.innerHTML}function eP(e){const[n,r]=S.useState(!1);return n?f.jsx(fd,{version:e.version,err:new Error("could not be loaded")}):f.jsx("img",{src:e.src,alt:e.alt,onLoad:e.onRendered,onError:()=>r(!0)})}function fd({version:e,err:n}){return f.jsx("div",{className:"empty",children:e?"That version isn't available.":"Could not load file: "+n.message})}function dw(e){const{path:n,version:r,fileURL:i,delim:s,onRendered:l}=e,{data:u,error:d}=Ht({queryKey:["text",i],queryFn:async()=>{const m=await fetch(i);if(!m.ok)throw new Error(await m.text());return m.text()},retry:r?!1:void 0});S.useEffect(()=>{u!=null&&l?.()},[u,l]);const p=S.useMemo(()=>s&&u!=null?ZI(u,s,YC):null,[u,s]);return d?f.jsx(fd,{version:r,err:d}):u==null?null:p?f.jsx(tP,{csv:p},n):f.jsx("pre",{className:"plain",children:u},n)}function tP({csv:e}){const[n,...r]=e.rows,i=e.rows.reduce((l,u)=>Math.max(l,u.length),0),s=Array.from({length:i},(l,u)=>u);return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"csvbox",children:f.jsxs("table",{className:"csvview",children:[f.jsx("thead",{children:f.jsx("tr",{children:s.map(l=>f.jsx("th",{children:n[l]??""},l))})}),f.jsx("tbody",{children:r.map((l,u)=>f.jsx("tr",{children:s.map(d=>f.jsx("td",{children:l[d]??""},d))},u))})]})}),e.truncated>0&&f.jsxs("p",{className:"csvnote",children:["showing ",e.rows.length.toLocaleString()," of"," ",(e.rows.length+e.truncated).toLocaleString()," rows — Download for the rest"]})]})}function nP(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)}const rP=[{value:"",label:"Never"},{value:"24h",label:"In 24 hours"},{value:"168h",label:"In 7 days"},{value:"720h",label:"In 30 days"}];function aP({url:e,copied:n,onClose:r}){const i=e.split("/s/")[1],[s,l]=S.useState(""),[u,d]=S.useState(),[p,m]=S.useState(!1),y=S.useRef(null);async function v(b){const x=s;l(b),m(!0);try{const w=await Wn("PATCH","/api/shares/"+i,{expires_in:b});d(w.expires)}catch(w){Ke(w.message,!0),l(x)}finally{m(!1)}}return f.jsx(Ju,{open:!0,onOpenChange:b=>!b&&r(),children:f.jsxs(Wu,{className:"modal",showCloseButton:!1,onOpenAutoFocus:b=>{b.preventDefault(),y.current?.focus()},children:[f.jsx(Sl,{asChild:!0,children:f.jsx("h3",{children:"Public link"})}),f.jsxs("p",{children:[f.jsx("b",{children:"Anyone with this link can view this file"})," — no account needed. It always shows the latest version until it expires or you revoke it."]}),f.jsx("div",{className:"modal-url",children:e}),f.jsxs("div",{className:"modal-expiry",children:[f.jsx("label",{htmlFor:"share-expiry",children:"Expires"}),f.jsx("select",{id:"share-expiry",value:s,disabled:p,onChange:b=>v(b.target.value),children:rP.map(b=>f.jsx("option",{value:b.value,children:b.label},b.value))}),f.jsx("span",{className:"modal-expiry-note",children:zC(u)})]}),f.jsxs("div",{className:"modal-actions",children:[f.jsx(vt,{ref:y,variant:"primary",onClick:()=>qo(e).then(b=>Ke(b?"Copied.":"Select and copy the link above.")),children:n?"Copied ✓":"Copy link"}),f.jsx(vt,{variant:"subtle",onClick:()=>window.open(e,"_blank"),children:"Open"}),f.jsx(vt,{variant:"subtle",onClick:r,children:"Done"})]})]})})}function iP({shares:e,canRevoke:n,onChanged:r}){return e.length===0?null:f.jsxs("div",{className:"share-banner",role:"status",children:[f.jsxs("div",{className:"sb-head",children:[f.jsx(ut,{name:"share"}),f.jsx("b",{children:"Publicly shared"}),f.jsxs("span",{className:"sb-count",children:[e.length," active link",e.length>1?"s":""]})]}),f.jsxs("p",{className:"sb-note",children:[f.jsx("b",{children:"Anyone with this link can view this file"})," — no account needed. It always shows the latest version until you revoke it.",e.some(i=>i.opens!==void 0)&&f.jsxs(f.Fragment,{children:[" ",LC]})]}),e.map(i=>f.jsxs("div",{className:"sb-link",children:[f.jsx("span",{className:"sb-url mono",title:i.url,children:i.url}),f.jsx("span",{className:"sb-meta",children:kC(i,!1)}),f.jsxs("span",{className:"sb-actions",children:[f.jsx(vt,{variant:"subtle",onClick:()=>qo(i.url).then(s=>Ke(s?"Copied.":"Select and copy the link.")),children:"Copy link"}),f.jsx(vt,{variant:"subtle",onClick:()=>window.open(i.url,"_blank"),children:"Open"}),n&&f.jsx("button",{className:"ai-del","aria-label":`Revoke the share of ${i.path}`,onClick:()=>IC(i,r),children:"Revoke"})]})]},i.token))]})}var fw=1,oP=.9,sP=.8,lP=.17,om=.1,sm=.999,cP=.9999,uP=.99,dP=/[\\\/_+.#"@\[\(\{&]/,fP=/[\\\/_+.#"@\[\(\{&]/g,hP=/[\s-]/,QC=/[\s-]/g;function Wm(e,n,r,i,s,l,u){if(l===n.length)return s===e.length?fw:uP;var d=`${s},${l}`;if(u[d]!==void 0)return u[d];for(var p=i.charAt(l),m=r.indexOf(p,s),y=0,v,b,x,w;m>=0;)v=Wm(e,n,r,i,m+1,l+1,u),v>y&&(m===s?v*=fw:dP.test(e.charAt(m-1))?(v*=sP,x=e.slice(s,m-1).match(fP),x&&s>0&&(v*=Math.pow(sm,x.length))):hP.test(e.charAt(m-1))?(v*=oP,w=e.slice(s,m-1).match(QC),w&&s>0&&(v*=Math.pow(sm,w.length))):(v*=lP,s>0&&(v*=Math.pow(sm,m-s))),e.charAt(m)!==n.charAt(l)&&(v*=cP)),(vv&&(v=b*om)),v>y&&(y=v),m=r.indexOf(p,m+1);return u[d]=y,y}function hw(e){return e.toLowerCase().replace(QC," ")}function mP(e,n,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,Wm(e,n,hw(e),hw(n),0,0,{})}var Gs='[cmdk-group=""]',lm='[cmdk-group-items=""]',pP='[cmdk-group-heading=""]',XC='[cmdk-item=""]',mw=`${XC}:not([aria-disabled="true"])`,ep="cmdk-item-select",Ao="data-value",gP=(e,n,r)=>mP(e,n,r),JC=S.createContext(void 0),jl=()=>S.useContext(JC),WC=S.createContext(void 0),gg=()=>S.useContext(WC),eE=S.createContext(void 0),tE=S.forwardRef((e,n)=>{let r=Mo(()=>{var M,B;return{search:"",value:(B=(M=e.value)!=null?M:e.defaultValue)!=null?B:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),i=Mo(()=>new Set),s=Mo(()=>new Map),l=Mo(()=>new Map),u=Mo(()=>new Set),d=nE(e),{label:p,children:m,value:y,onValueChange:v,filter:b,shouldFilter:x,loop:w,disablePointerSelection:_=!1,vimBindings:E=!0,...R}=e,T=dn(),O=dn(),N=dn(),L=S.useRef(null),P=jP();Oi(()=>{if(y!==void 0){let M=y.trim();r.current.value=M,F.emit()}},[y]),Oi(()=>{P(6,ue)},[]);let F=S.useMemo(()=>({subscribe:M=>(u.current.add(M),()=>u.current.delete(M)),snapshot:()=>r.current,setState:(M,B,J)=>{var Y,le,ae,ve;if(!Object.is(r.current[M],B)){if(r.current[M]=B,M==="search")X(),be(),P(1,he);else if(M==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let xe=document.getElementById(N);xe?xe.focus():(Y=document.getElementById(T))==null||Y.focus()}if(P(7,()=>{var xe;r.current.selectedItemId=(xe=pe())==null?void 0:xe.id,F.emit()}),J||P(5,ue),((le=d.current)==null?void 0:le.value)!==void 0){let xe=B??"";(ve=(ae=d.current).onValueChange)==null||ve.call(ae,xe);return}}F.emit()}},emit:()=>{u.current.forEach(M=>M())}}),[]),V=S.useMemo(()=>({value:(M,B,J)=>{var Y;B!==((Y=l.current.get(M))==null?void 0:Y.value)&&(l.current.set(M,{value:B,keywords:J}),r.current.filtered.items.set(M,ye(B,J)),P(2,()=>{be(),F.emit()}))},item:(M,B)=>(i.current.add(M),B&&(s.current.has(B)?s.current.get(B).add(M):s.current.set(B,new Set([M]))),P(3,()=>{X(),be(),r.current.value||he(),F.emit()}),()=>{l.current.delete(M),i.current.delete(M),r.current.filtered.items.delete(M);let J=pe();P(4,()=>{X(),J?.getAttribute("id")===M&&he(),F.emit()})}),group:M=>(s.current.has(M)||s.current.set(M,new Set),()=>{l.current.delete(M),s.current.delete(M)}),filter:()=>d.current.shouldFilter,label:p||e["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:T,inputId:N,labelId:O,listInnerRef:L}),[]);function ye(M,B){var J,Y;let le=(Y=(J=d.current)==null?void 0:J.filter)!=null?Y:gP;return M?le(M,r.current.search,B):0}function be(){if(!r.current.search||d.current.shouldFilter===!1)return;let M=r.current.filtered.items,B=[];r.current.filtered.groups.forEach(Y=>{let le=s.current.get(Y),ae=0;le.forEach(ve=>{let xe=M.get(ve);ae=Math.max(xe,ae)}),B.push([Y,ae])});let J=L.current;ge().sort((Y,le)=>{var ae,ve;let xe=Y.getAttribute("id"),Oe=le.getAttribute("id");return((ae=M.get(Oe))!=null?ae:0)-((ve=M.get(xe))!=null?ve:0)}).forEach(Y=>{let le=Y.closest(lm);le?le.appendChild(Y.parentElement===le?Y:Y.closest(`${lm} > *`)):J.appendChild(Y.parentElement===J?Y:Y.closest(`${lm} > *`))}),B.sort((Y,le)=>le[1]-Y[1]).forEach(Y=>{var le;let ae=(le=L.current)==null?void 0:le.querySelector(`${Gs}[${Ao}="${encodeURIComponent(Y[0])}"]`);ae?.parentElement.appendChild(ae)})}function he(){let M=ge().find(J=>J.getAttribute("aria-disabled")!=="true"),B=M?.getAttribute(Ao);F.setState("value",B||void 0)}function X(){var M,B,J,Y;if(!r.current.search||d.current.shouldFilter===!1){r.current.filtered.count=i.current.size;return}r.current.filtered.groups=new Set;let le=0;for(let ae of i.current){let ve=(B=(M=l.current.get(ae))==null?void 0:M.value)!=null?B:"",xe=(Y=(J=l.current.get(ae))==null?void 0:J.keywords)!=null?Y:[],Oe=ye(ve,xe);r.current.filtered.items.set(ae,Oe),Oe>0&&le++}for(let[ae,ve]of s.current)for(let xe of ve)if(r.current.filtered.items.get(xe)>0){r.current.filtered.groups.add(ae);break}r.current.filtered.count=le}function ue(){var M,B,J;let Y=pe();Y&&(((M=Y.parentElement)==null?void 0:M.firstChild)===Y&&((J=(B=Y.closest(Gs))==null?void 0:B.querySelector(pP))==null||J.scrollIntoView({block:"nearest"})),Y.scrollIntoView({block:"nearest"}))}function pe(){var M;return(M=L.current)==null?void 0:M.querySelector(`${XC}[aria-selected="true"]`)}function ge(){var M;return Array.from(((M=L.current)==null?void 0:M.querySelectorAll(mw))||[])}function k(M){let B=ge()[M];B&&F.setState("value",B.getAttribute(Ao))}function K(M){var B;let J=pe(),Y=ge(),le=Y.findIndex(ve=>ve===J),ae=Y[le+M];(B=d.current)!=null&&B.loop&&(ae=le+M<0?Y[Y.length-1]:le+M===Y.length?Y[0]:Y[le+M]),ae&&F.setState("value",ae.getAttribute(Ao))}function re(M){let B=pe(),J=B?.closest(Gs),Y;for(;J&&!Y;)J=M>0?EP(J,Gs):RP(J,Gs),Y=J?.querySelector(mw);Y?F.setState("value",Y.getAttribute(Ao)):K(M)}let W=()=>k(ge().length-1),te=M=>{M.preventDefault(),M.metaKey?W():M.altKey?re(1):K(1)},D=M=>{M.preventDefault(),M.metaKey?k(0):M.altKey?re(-1):K(-1)};return S.createElement($e.div,{ref:n,tabIndex:-1,...R,"cmdk-root":"",onKeyDown:M=>{var B;(B=R.onKeyDown)==null||B.call(R,M);let J=M.nativeEvent.isComposing||M.keyCode===229;if(!(M.defaultPrevented||J))switch(M.key){case"n":case"j":{E&&M.ctrlKey&&te(M);break}case"ArrowDown":{te(M);break}case"p":case"k":{E&&M.ctrlKey&&D(M);break}case"ArrowUp":{D(M);break}case"Home":{M.preventDefault(),k(0);break}case"End":{M.preventDefault(),W();break}case"Enter":{M.preventDefault();let Y=pe();if(Y){let le=new Event(ep);Y.dispatchEvent(le)}}}}},S.createElement("label",{"cmdk-label":"",htmlFor:V.inputId,id:V.labelId,style:OP},p),md(e,M=>S.createElement(WC.Provider,{value:F},S.createElement(JC.Provider,{value:V},M))))}),vP=S.forwardRef((e,n)=>{var r,i;let s=dn(),l=S.useRef(null),u=S.useContext(eE),d=jl(),p=nE(e),m=(i=(r=p.current)==null?void 0:r.forceMount)!=null?i:u?.forceMount;Oi(()=>{if(!m)return d.item(s,u?.id)},[m]);let y=rE(s,l,[e.value,e.children,l],e.keywords),v=gg(),b=qa(P=>P.value&&P.value===y.current),x=qa(P=>m||d.filter()===!1?!0:P.search?P.filtered.items.get(s)>0:!0);S.useEffect(()=>{let P=l.current;if(!(!P||e.disabled))return P.addEventListener(ep,w),()=>P.removeEventListener(ep,w)},[x,e.onSelect,e.disabled]);function w(){var P,F;_(),(F=(P=p.current).onSelect)==null||F.call(P,y.current)}function _(){v.setState("value",y.current,!0)}if(!x)return null;let{disabled:E,value:R,onSelect:T,forceMount:O,keywords:N,...L}=e;return S.createElement($e.div,{ref:Fo(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:w},e.children)}),yP=S.forwardRef((e,n)=>{let{heading:r,children:i,forceMount:s,...l}=e,u=dn(),d=S.useRef(null),p=S.useRef(null),m=dn(),y=jl(),v=qa(x=>s||y.filter()===!1?!0:x.search?x.filtered.groups.has(u):!0);Oi(()=>y.group(u),[]),rE(u,d,[e.value,e.heading,p]);let b=S.useMemo(()=>({id:u,forceMount:s}),[s]);return S.createElement($e.div,{ref:Fo(d,n),...l,"cmdk-group":"",role:"presentation",hidden:v?void 0:!0},r&&S.createElement("div",{ref:p,"cmdk-group-heading":"","aria-hidden":!0,id:m},r),md(e,x=>S.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?m:void 0},S.createElement(eE.Provider,{value:b},x))))}),bP=S.forwardRef((e,n)=>{let{alwaysRender:r,...i}=e,s=S.useRef(null),l=qa(u=>!u.search);return!r&&!l?null:S.createElement($e.div,{ref:Fo(s,n),...i,"cmdk-separator":"",role:"separator"})}),xP=S.forwardRef((e,n)=>{let{onValueChange:r,...i}=e,s=e.value!=null,l=gg(),u=qa(m=>m.search),d=qa(m=>m.selectedItemId),p=jl();return S.useEffect(()=>{e.value!=null&&l.setState("search",e.value)},[e.value]),S.createElement($e.input,{ref:n,...i,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":p.listId,"aria-labelledby":p.labelId,"aria-activedescendant":d,id:p.inputId,type:"text",value:s?e.value:u,onChange:m=>{s||l.setState("search",m.target.value),r?.(m.target.value)}})}),wP=S.forwardRef((e,n)=>{let{children:r,label:i="Suggestions",...s}=e,l=S.useRef(null),u=S.useRef(null),d=qa(m=>m.selectedItemId),p=jl();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($e.div,{ref:Fo(l,n),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":i,id:p.listId},md(e,m=>S.createElement("div",{ref:Fo(u,p.listInnerRef),"cmdk-list-sizer":""},m)))}),SP=S.forwardRef((e,n)=>{let{open:r,onOpenChange:i,overlayClassName:s,contentClassName:l,container:u,...d}=e;return S.createElement(hp,{open:r,onOpenChange:i},S.createElement(pp,{container:u},S.createElement(gp,{"cmdk-overlay":"",className:s}),S.createElement(vp,{"aria-label":e.label,"cmdk-dialog":"",className:l},S.createElement(tE,{ref:n,...d}))))}),_P=S.forwardRef((e,n)=>qa(r=>r.filtered.count===0)?S.createElement($e.div,{ref:n,...e,"cmdk-empty":"",role:"presentation"}):null),CP=S.forwardRef((e,n)=>{let{progress:r,children:i,label:s="Loading...",...l}=e;return S.createElement($e.div,{ref:n,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},md(e,u=>S.createElement("div",{"aria-hidden":!0},u)))}),hd=Object.assign(tE,{List:wP,Item:vP,Input:xP,Group:yP,Separator:bP,Dialog:SP,Empty:_P,Loading:CP});function EP(e,n){let r=e.nextElementSibling;for(;r;){if(r.matches(n))return r;r=r.nextElementSibling}}function RP(e,n){let r=e.previousElementSibling;for(;r;){if(r.matches(n))return r;r=r.previousElementSibling}}function nE(e){let n=S.useRef(e);return Oi(()=>{n.current=e}),n}var Oi=typeof window>"u"?S.useEffect:S.useLayoutEffect;function Mo(e){let n=S.useRef();return n.current===void 0&&(n.current=e()),n}function qa(e){let n=gg(),r=()=>e(n.snapshot());return S.useSyncExternalStore(n.subscribe,r,r)}function rE(e,n,r,i=[]){let s=S.useRef(),l=jl();return Oi(()=>{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}})(),p=i.map(m=>m.trim());l.value(e,d,p),(u=n.current)==null||u.setAttribute(Ao,d),s.current=d}),s}var jP=()=>{let[e,n]=S.useState(),r=Mo(()=>new Map);return Oi(()=>{r.current.forEach(i=>i()),r.current=new Map},[e]),(i,s)=>{r.current.set(i,s),n({})}};function TP(e){let n=e.type;return typeof n=="function"?n(e.props):"render"in n?n.render(e.props):e}function md({asChild:e,children:n},r){return e&&S.isValidElement(n)?S.cloneElement(TP(n),{ref:n.ref},r(n.props.children)):r(n)}var OP={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function AP({className:e,...n}){return f.jsx(hd,{"data-slot":"command",className:Je("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...n})}function MP({className:e,...n}){return f.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[f.jsx(b_,{className:"size-4 shrink-0 opacity-50"}),f.jsx(hd.Input,{"data-slot":"command-input",className:Je("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 NP({className:e,...n}){return f.jsx(hd.List,{"data-slot":"command-list",className:Je("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...n})}function DP({className:e,...n}){return f.jsx(hd.Item,{"data-slot":"command-item",className:Je("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 pw(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 p=0;p3&&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?pw(s,n):null}function kP({text:e,hits:n}){const r=[];let i=0;return n.forEach((s,l)=>{s>i&&r.push(e.slice(i,s)),r.push(f.jsx("b",{children:e[s]},l)),i=s+1}),r.push(e.slice(i)),f.jsx("span",{className:"plabel",children:r})}function LP({open:e,onClose:n,candidates:r}){const[i,s]=S.useState(""),l=S.useMemo(()=>{if(!e)return[];const d=[];for(const p of r()){const m=zP(i,p.label);m&&d.push({...p,score:m.score,hits:m.hits})}return d.sort((p,m)=>m.score-p.score),d.slice(0,40)},[e,i,r]);S.useEffect(()=>{e&&s("")},[e]);const u=d=>{n(),d.run()};return f.jsx(Ju,{open:e,onOpenChange:d=>!d&&n(),children:f.jsxs(Wu,{id:"palette",className:"palette",showCloseButton:!1,"aria-describedby":void 0,children:[f.jsx(Sl,{className:"sr-only",children:"Search and quick actions"}),f.jsxs(AP,{shouldFilter:!1,loop:!0,children:[f.jsxs("div",{id:"palette-inputwrap",children:[f.jsx(ut,{name:"search"}),f.jsx(MP,{placeholder:"Search file names, projects, actions…",autoComplete:"off",spellCheck:!1,value:i,onValueChange:s})]}),f.jsx(NP,{children:l.length===0?f.jsx("div",{className:"pempty",children:"No matches — search covers file names, projects, and actions"}):l.map(d=>f.jsxs(DP,{value:d.kind+":"+d.label,onSelect:()=>u(d),children:[f.jsx("span",{className:"picon",children:f.jsx(ut,{name:d.icon})}),f.jsx(kP,{text:d.label,hits:d.hits}),f.jsx("span",{className:"pkind",children:d.kind})]},d.kind+":"+d.label))}),f.jsx("footer",{id:"palette-hint",children:"↑↓ navigate · ⏎ select · esc close"})]})]})})}const Js=3,No=30;function $P(e,n){return Ht({queryKey:["heatDevices",e],queryFn:()=>Yt(e+"heat?by=device&days=30"),enabled:n,retry:!1,staleTime:6e4}).data?.devices??null}const IP=["all","human","agent","share"],PP={all:"All reads",human:"Human reads",agent:"Agent reads",share:"Shared reads"},FP={agent:{agent:1,human:0,share:0},human:{agent:0,human:1,share:0},share:{agent:0,human:0,share:1}};function gw(e){const[n,r]=S.useState("all"),{flatFiles:i,heatMap:s,devices:l,scope:u}=e,d=w=>!u||w===u||w.startsWith(u+"/"),p=u?i.filter(w=>d(w.path)):i;if(!e.loading&&!p.length)return f.jsxs("div",{className:"insights",children:[f.jsxs("h1",{className:"in-title",children:["Knowledge insights",u?f.jsxs("span",{className:"in-scope",children:[" · ",u]}):null]}),f.jsxs("div",{className:"dl-empty in-blank",children:[f.jsx("p",{children:u?`Nothing in ${u} to chart yet.`:"Nothing to chart yet."}),f.jsx("p",{children:u?`No files under ${u} are syncing here yet.`:"This project has no files. Once a device syncs files here, the map, the reads × freshness plot and the hot path fill in on their own."}),e.installHref&&f.jsx("a",{className:"pbtn",...Bo(e.installHref),children:"Set up a device →"})]})]});const m=l&&u?l.map(w=>{const _=Object.create(null);for(const[E,R]of Object.entries(w.folders||{}))d(E)&&(_[E]=R);return{...w,folders:_}}).filter(w=>Object.keys(w.folders).length>0):l,y=Date.now(),v=p.map(w=>{const _=s&&s[w.path]||{},E=w.time?Math.max(0,(y-new Date(w.time).getTime())/864e5):0,R=n==="all"?ka(_):_[n]||0;return{path:w.path,reads:R,agent:_.agent||0,human:_.human||0,share:_.share||0,total:ka(_),days:E,danger:R>=Js&&E>=No}}),b=rI(s,new Set(i.map(w=>w.path))).filter(d).map(w=>{const _=s[w];return{path:w,reads:n==="all"?ka(_):_[n]||0,agent:_.agent||0,human:_.human||0,share:_.share||0,total:ka(_),days:0,danger:!1,orphan:!0}}).filter(w=>w.reads>0),x=b.length>0?f.jsxs("p",{className:"in-legend in-orphan-note",children:[tp(b.length,"file")," with reads ",b.length===1?"is":"are"," no longer in the project — see Hot path."]}):null;return f.jsxs("div",{className:"insights",children:[f.jsxs("h1",{className:"in-title",children:["Knowledge insights",u?f.jsxs("span",{className:"in-scope",children:[" · ",u]}):null]}),f.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."}),f.jsx("div",{className:"in-lens",children:IP.map(w=>f.jsx("button",{className:"in-lens-btn"+(w===n?" active":""),onClick:()=>r(w),children:PP[w]},w))}),f.jsx("h3",{className:"dl-h3",children:"Map — cell size = reads, color = freshness (scale below)"}),f.jsx(UP,{pts:v,onOpenFile:e.onOpenFile,onOpenFolder:e.onOpenFolder,isFolder:e.isFolder}),x,f.jsxs("h3",{className:"dl-h3 in-h3-row",children:["Reads × freshness",f.jsx("span",{className:"in-cap",children:"dot size = agent share of reads"})]}),f.jsx(BP,{pts:v,onOpenFile:e.onOpenFile}),x,f.jsx("h3",{className:"dl-h3",children:"Hot path — top files by reads"}),f.jsx(qP,{pts:[...v,...b],lens:n,onOpenFile:e.onOpenFile,onOpenHistory:e.onOpenHistory}),m&&m.length>0&&f.jsxs(f.Fragment,{children:[f.jsx("h3",{className:"dl-h3",children:"Agent coverage — which agents read which areas"}),f.jsx(GP,{devices:m})]})]})}const VP="rgb(150,156,164)";function aE(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 vw(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((w,_)=>w+_.a,0)/y;let x=0;for(const w of m){const _=w.a/b;x=Math.max(x,_/b,b/_)}return x},p=[];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((w,_)=>w+_.a,0)/y;let x=0;for(const w of v){const _=w.a/b;m?p.push({item:w.it,x:n,y:r+x,w:b,h:_}):p.push({item:w.it,x:n+x,y:r,w:_,h:b}),x+=_}m?(n+=b,i-=b):(r+=b,s-=b)}return p}const cm=15;function yw(e,n,r){const i=Math.floor((r-8)/6),s=`${e} · ${n}`;return s.length<=i?{label:s,fit:i}:{label:e.length>i?e.slice(0,Math.max(1,i-1))+"…":e,fit:i}}const tp=(e,n)=>`${e} ${n}${e===1?"":"s"}`;function UP({pts:e,onOpenFile:n,onOpenFolder:r,isFolder:i}){const u=iI(e.map(y=>y.days)),d=!!u&&oI(u.min,u.max),p=new Map;for(const y of e){const v=y.path.includes("/")?y.path.split("/")[0]:"/";let b=p.get(v);b||p.set(v,b={name:v,files:[],value:0,reads:0}),b.files.push(y),b.value+=y.reads+1,b.reads+=y.reads}const m=[];for(const y of vw([...p.values()],0,0,720,480)){const v=y.item,b=v.name==="/"?"":v.name,x=v.name==="/"?"(root)":v.name;if(m.push(f.jsx("rect",{x:y.x+1,y:y.y+1,width:Math.max(0,y.w-2),height:Math.max(0,y.h-2),rx:3,className:"in-tm-group","data-dir":b,children:f.jsx("title",{children:`${v.name==="/"?"(root)":v.name+"/"} — ${tp(v.reads,"read")}/30d · ${tp(v.files.length,"file")}`})},"g"+v.name)),y.w>46&&y.h>cm+10){const{label:_}=yw(x,v.reads,y.w);m.push(f.jsx("text",{x:y.x+5,y:y.y+12,className:"in-tm-glabel","data-dir":b,children:_},"gl"+v.name))}const w=vw(v.files.map(_=>({..._,name:_.path.split("/").pop(),value:_.reads+1})),y.x+2,y.y+cm,Math.max(0,y.w-4),Math.max(0,y.h-cm-2));for(const _ of w)if(m.push(f.jsx("rect",{x:_.x+.6,y:_.y+.6,width:Math.max(.4,_.w-1.2),height:Math.max(.4,_.h-1.2),rx:1.5,fill:d?VP:aE(_.item.days),className:"in-tm-cell","data-path":_.item.path,children:f.jsx("title",{children:`${_.item.path} — ${_.item.reads} read${_.item.reads===1?"":"s"}/30d · changed ${Math.round(_.item.days)}d ago`})},_.item.path)),_.w>54&&_.h>16){const{label:E,fit:R}=yw((_.item.danger?"⚠ ":"")+_.item.name,_.item.reads,_.w);R>=5&&m.push(f.jsx("text",{x:_.x+4.5,y:_.y+12.5,className:"in-tm-label","data-path":_.item.path,children:E},"l"+_.item.path))}}return f.jsxs(f.Fragment,{children:[f.jsx("svg",{viewBox:"0 0 720 480",className:"in-chart in-treemap",onClick:y=>{const v=y.target.closest("[data-path], [data-dir]");if(!v)return;const b=v.getAttribute("data-path");if(b)return n(b);const x=v.getAttribute("data-dir");x&&i(x)&&r(x)},children:m}),f.jsx(HP,{range:u,flat:d})]})}function HP({range:e,flat:n}){if(!e)return null;const r=sI(e.min,e.max);return f.jsxs("p",{className:"in-legend in-tm-legend",children:["freshness 0d",f.jsx("span",{className:"in-sw in-sw-age"+(n?" in-sw-flat":""),style:{background:`linear-gradient(to right, ${[0,60,150,300].map(aE).join(", ")})`}}),"300d+",f.jsx("span",{className:"in-tm-range",children:n?`all files here: ${r} old — colour off, not enough range to rank`:`observed: ${r} old`})]})}function BP({pts:e,onOpenFile:n}){const s={l:44,r:16,t:20,b:34},l=Math.max(No*2,...e.map(w=>w.days)),u=Math.max(Js*2,...e.map(w=>w.reads)),d=w=>Math.log10(w+1)/Math.log10(l+1),p=w=>Math.log10(w+1)/Math.log10(u+1),m=w=>3+4*w,y=m(1),v=w=>s.l+y+d(w)*(720-s.l-s.r-2*y),b=w=>360-s.b-y-p(w)*(360-s.t-s.b-2*y),x=uI(e.filter(w=>w.danger).map(w=>({path:w.path,reads:w.reads,cx:v(w.days),cy:b(w.reads),r:m(w.total?(w.agent||0)/w.total:0)})),{right:720-s.r,top:s.t+8,bottom:360-s.b-4});return f.jsxs("svg",{viewBox:"0 0 720 360",className:"in-chart",children:[f.jsx("rect",{x:v(No),y:s.t,width:720-s.r-v(No),height:b(Js)-s.t,className:"in-danger-zone"}),f.jsx("line",{x1:v(No),y1:s.t,x2:v(No),y2:360-s.b,className:"in-threshold"}),f.jsx("line",{x1:s.l,y1:b(Js),x2:720-s.r,y2:b(Js),className:"in-threshold"}),f.jsx("line",{x1:s.l,y1:360-s.b,x2:720-s.r,y2:360-s.b,className:"in-axis"}),f.jsx("line",{x1:s.l,y1:s.t,x2:s.l,y2:360-s.b,className:"in-axis"}),f.jsx("text",{x:(s.l+720-s.r)/2,y:352,className:"in-label",children:"days since last change →"}),f.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 →"}),f.jsx("text",{x:720-s.r-6,y:s.t+14,className:"in-quad in-quad-danger",textAnchor:"end",children:"hot + stale"}),f.jsx("text",{x:s.l+6,y:s.t+14,className:"in-quad",children:"hot + fresh"}),f.jsx("text",{x:720-s.r-6,y:360-s.b-8,className:"in-quad",textAnchor:"end",children:"cold + stale"}),f.jsx("text",{x:s.l+6,y:360-s.b-8,className:"in-quad",children:"cold + fresh"}),e.map(w=>{const _=w.total?(w.agent||0)/w.total:0;return f.jsx("circle",{cx:Number(v(w.days).toFixed(1)),cy:Number(b(w.reads).toFixed(1)),r:Number(m(_).toFixed(1)),className:"in-pt"+(w.danger?" danger":w.reads?"":" cold"),onClick:()=>n(w.path),children:f.jsx("title",{children:`${w.path} — ${w.reads} read${w.reads===1?"":"s"} / 30d · changed ${Math.round(w.days)}d ago`})},w.path)}),x.map(w=>f.jsx("text",{x:Number(w.x.toFixed(1)),y:Number(w.y.toFixed(1)),textAnchor:w.anchor,className:"in-pt-label",children:w.name},w.path))]})}function qP({pts:e,lens:n,onOpenFile:r,onOpenHistory:i}){const s=e.filter(d=>d.reads>0).sort((d,p)=>p.reads-d.reads||p.days-d.days).slice(0,20);if(!s.length)return f.jsx("div",{className:"dl-empty",children:"No reads in the window yet."});const l=s[0].reads,u=s.some(d=>d.share>0);return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"in-hotpath",children:s.map(d=>{const p=FP[n]??nI(d),m=d.reads/l*100,y=()=>d.orphan?i(d.path):r(d.path);return f.jsxs("div",{className:"in-hp-row",tabIndex:0,role:"button",title:d.orphan?`${d.reads} read${d.reads===1?"":"s"}/30d · no longer in the project — open its history`:d.danger?`${d.reads} read${d.reads===1?"":"s"}/30d · unchanged ${Math.round(d.days)}d — review this file`:d.path,onClick:y,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),y())},children:[f.jsx("span",{className:"in-hp-name"+(d.danger?" danger":""),children:d.path+(d.danger?" ⚠":"")}),d.orphan&&f.jsx("span",{className:"in-hp-gone",children:"· no longer in the project"}),f.jsxs("span",{className:"in-hp-bar",children:[f.jsx("span",{className:"in-hp-agent",style:{width:(m*p.agent).toFixed(1)+"%"}}),f.jsx("span",{className:"in-hp-human",style:{width:(m*p.human).toFixed(1)+"%"}}),f.jsx("span",{className:"in-hp-share",style:{width:(m*p.share).toFixed(1)+"%"}})]}),f.jsx("span",{className:"in-hp-count",children:d.reads})]},d.path)})}),f.jsxs("p",{className:"in-legend",children:[f.jsx("span",{className:"in-sw agent"})," agent reads ",f.jsx("span",{className:"in-sw human"})," human reads",u&&f.jsxs(f.Fragment,{children:[" ",f.jsx("span",{className:"in-sw share"})," shared reads"]})]})]})}function GP({devices:e}){const n=new Map;for(const b of e)for(const[x,w]of Object.entries(b.folders||{}))n.set(x,(n.get(x)||0)+w);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,p=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],w=[245,166,35],_=x.map((E,R)=>Math.round(E+(w[R]-E)*b));return`rgb(${_[0]},${_[1]},${_[2]})`};return f.jsxs("svg",{viewBox:`0 0 ${p} ${m}`,className:"in-chart in-matrix",children:[i.map((b,x)=>{let w=b.name||b.id||"";return w.length>20&&(w=w.slice(0,19)+"…"),f.jsxs("g",{children:[f.jsx("text",{x:s-8,y:l+x*d+17,textAnchor:"end",className:"in-label",children:w}),r.map((_,E)=>{const R=(b.folders||{})[_]||0;return f.jsx("rect",{x:s+E*u,y:l+x*d,width:u-4,height:d-4,rx:3,fill:v(Math.sqrt(R/y)),children:f.jsx("title",{children:`${b.name||b.id} × ${_||"(root)"}: ${R} read${R===1?"":"s"}/30d`})},_)})]},b.id||x)}),r.map((b,x)=>{const w=s+x*u+(u-4)/2,_=l+i.length*d+14;return f.jsx("text",{x:w,y:_,className:"in-label",textAnchor:"end",transform:`rotate(-28 ${w} ${_})`,children:b||"(root)"},b)})]})}function iE(e){return new Set(e.entries.map(n=>n.path)).size}function ZP(e){const n=l=>l.note+"\0"+(l.device?.id??""),r=new Map;e.forEach((l,u)=>{if(!l.note)return;const d=r.get(n(l));if(d){d.entries.push(l),d.idx.push(u);return}r.set(n(l),{note:l.note,entries:[l],idx:[u]})});const i=[],s=new Set;return e.forEach((l,u)=>{const d=l.note?r.get(n(l)):void 0;if(!d||iE(d)<2){i.push({i:u});return}s.has(d)||(s.add(d),i.push({run:d,i:u}))}),i}function KP(e){const{filters:n,authors:r,onChange:i}=e,s=(y,v)=>i({...n,[y]:v||void 0}),[l,u]=S.useState(n?.q??""),d=S.useRef(!1);S.useEffect(()=>{d.current||u(n?.q??"")},[n?.q]),S.useEffect(()=>{if(!d.current)return;const y=setTimeout(()=>{d.current=!1,l!==(n?.q??"")&&s("q",l)},250);return()=>clearTimeout(y)},[l]);const p=n?.user&&!r.includes(n.user)?[n.user,...r]:r,m=Zp(n);return f.jsxs("div",{className:"hfilters",children:[f.jsxs("label",{className:"hf-search",children:[f.jsx(ut,{name:"search"}),f.jsx(du,{type:"search",value:l,placeholder:"path contains…","aria-label":"Filter by path",onChange:y=>{d.current=!0,u(y.target.value)}})]}),f.jsxs("select",{className:"hf-user",value:n?.user??"","aria-label":"Filter by author",onChange:y=>s("user",y.target.value),children:[f.jsx("option",{value:"",children:"Anyone"}),p.map(y=>f.jsx("option",{value:y,children:y},y))]}),f.jsxs("span",{className:"hf-dates",children:[f.jsx("span",{className:"hf-lbl",children:"UTC"}),f.jsx(du,{type:"date",className:"hf-date",value:n?.since??"","aria-label":"From date (UTC)",onChange:y=>s("since",y.target.value)}),f.jsx("span",{className:"hf-dash",children:"–"}),f.jsx(du,{type:"date",className:"hf-date",value:n?.until??"","aria-label":"To date (UTC)",onChange:y=>s("until",y.target.value)})]}),m&&f.jsx("button",{type:"button",className:"hf-clear",onClick:()=>i({}),children:"Clear"})]})}function YP(e){const n=new Set;for(const r of e)r.user&&n.add(r.user);return[...n].sort()}function QP(e){const{apiBase:n,target:r,isFolder:i,onMeta:s,onRendered:l,restore:u,remove:d,filters:p}=e,m=r?i(r)?{prefix:r+"/"}:{path:r}:{prefix:""},y=("path"in m&&m.path!==void 0?"path="+encodeURIComponent(m.path):"prefix="+encodeURIComponent(m.prefix??""))+N_(p).replace("?","&"),{data:v,error:b,fetchNextPage:x,hasNextPage:w,isFetchingNextPage:_}=fj({queryKey:["history",n,y],queryFn:({pageParam:P})=>Yt(n+"history?"+y+"&n=100"+(P?"&cursor="+encodeURIComponent(P):"")),initialPageParam:"",getNextPageParam:P=>P.next_cursor,staleTime:15e3}),E=S.useRef(new Set);S.useEffect(()=>{b&&s("History unavailable: "+b.message)},[b,s]),S.useEffect(()=>{v&&l?.()},[v,l]);const R=v?v.pages.flatMap(P=>P.entries||[]):[];for(const P of YP(R))E.current.add(P);const T=e.onFilters&&f.jsx(KP,{filters:p,authors:[...E.current].sort(),onChange:e.onFilters});if(!v)return T?f.jsx("div",{className:"history",children:T}):null;const O=P=>{for(let F=P+1;F{const F=R[P].kind==="delete"?O(P):R[P].blob;return F&&F===N.get(R[P].path)?void 0:F};return f.jsxs("div",{className:"history",children:[T,R.length===0&&(Zp(p)?f.jsxs("div",{className:"empty",children:["No changes match these filters.",f.jsx("br",{}),f.jsx("button",{type:"button",className:"btn hf-clear-empty",onClick:()=>e.onFilters?.({}),children:"Clear filters"})]}):f.jsx("div",{className:"empty",children:"No history yet."})),ZP(R).map((P,F)=>P.run?f.jsx(XP,{run:P.run,onOpen:e.onOpen,apiBase:n,prevBlob:O,restoreSha:L,restore:u,remove:d},"g"+F):f.jsx(pg,{entry:R[P.i],apiBase:n,onOpen:e.onOpen,diff:{apiBase:n,prev:O(P.i)},restore:u,restoreSha:L(P.i)},"r"+P.i)),w&&f.jsx("button",{type:"button",className:"btn hmore",onClick:()=>x(),disabled:_,children:_?"Loading…":"Load more"})]})}function XP({run:e,onOpen:n,apiBase:r,prevBlob:i,restoreSha:s,restore:l,remove:u}){const[d,p]=S.useState(!0),m=e.entries[0],y=dd(m),v=[m.device.name||m.device.id,m.device.os].filter(Boolean).join(" · "),b=e.entries.map(_=>new Date(_.time).getTime()),x=JP(Math.min(...b),Math.max(...b)),w=iE(e);return f.jsxs("div",{className:"hrun"+(d?" open":""),children:[f.jsxs("div",{className:"hrun-head",children:[f.jsx("button",{type:"button",className:"hrun-toggle","aria-expanded":d,title:d?"Collapse this run":"Expand this run",onClick:()=>p(!d),children:f.jsx(ut,{name:d?"chevd":"chev"})}),f.jsx("span",{className:"hrun-note",children:f.jsx(KC,{text:e.note})}),f.jsxs("span",{className:"hrun-meta",children:[w," file",w===1?"":"s"," · ",y,v?" · "+v:""]}),f.jsx("span",{className:"hrun-time",children:x})]}),d&&f.jsx("div",{className:"hrun-body",children:e.entries.map((_,E)=>f.jsx(pg,{entry:_,apiBase:r,onOpen:n,diff:{apiBase:r,prev:i(e.idx[E])},restore:l,remove:u,restoreSha:s(e.idx[E]),inRun:!0},E))})]})}function JP(e,n){const r=new Date(e),i=new Date(n),s=u=>u.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});if(r.toDateString()!==i.toDateString())return r.toLocaleString()+" – "+i.toLocaleString();const l=i.toLocaleDateString();return e===n?l+" "+s(i):l+" "+s(r)+" – "+s(i)}function WP(e,n){return e?n(e)?e+"/ (folder)":e:"all changes"}function eF(e){const{apiBase:n,path:r,version:i}=e,s="path="+encodeURIComponent(r),{data:l}=Ht({queryKey:["history",n,s,200],queryFn:()=>Yt(n+"history?"+s+"&n=200"),staleTime:15e3}),u=l?.entries?.find(y=>y.blob===i),d=u?dd(u):"",p=u?.time?new Date(u.time).toLocaleString():"",m=n+"blob?sha="+i+"&name="+encodeURIComponent(r.split("/").pop()||r)+"&download=1";return f.jsxs("div",{className:"vbanner",role:"status",children:[f.jsx("span",{className:"vb-icon",children:f.jsx(ut,{name:"clock"})}),f.jsxs("div",{className:"vb-text",children:[f.jsx("b",{children:[p&&"Version from "+p,d&&"by "+d].filter(Boolean).join(" ")||"Earlier version"}),f.jsx("span",{children:"This is not the current file."})]}),f.jsxs("div",{className:"vb-actions",children:[f.jsx("button",{className:"ai-btn",onClick:e.onViewCurrent,children:"View current"}),f.jsx("a",{className:"ai-btn",download:!0,href:m,children:"Download this version"})]})]})}function oE(e){const{config:n,apiBase:r,route:i,hub:s,project:l}=e,u=Yp(),d=Ai(),{tree:p,flatFiles:m,dirIndex:y,loaded:v}=dI(r,!s||!!l),b=fI(r,s&&!!l&&!!n.reads?.enabled),x=s&&!!l&&!i.path&&!i.view,w=i.view==="dashboard"||x,_=$P(r,w);S.useEffect(()=>{w&&d.invalidateQueries({queryKey:["heat",r]})},[w,r,d]);const E=i.path,R=i.view?void 0:i.version,T=E||(i.view==="dashboard"||i.view==="history")&&i.viewTarget||"",O=!!E&&y.has(E),N=!!E&&v&&!O&&m.some(Z=>Z.path===E),L=!!E&&v&&!O&&!N,P=O&&!i.view,{data:F}=Ht({queryKey:["resolve",r,E],queryFn:()=>Yt(r+"resolve?path="+encodeURIComponent(E)),enabled:L,retry:!1,staleTime:6e4}),[V,ye]=S.useState(null);S.useEffect(()=>{!L||!F?.to||(ye({from:E,to:F.to}),Zt(dl(F.to,l?.id),{replace:!0}))},[L,F,E,l?.id]);const[be,he]=S.useState(()=>new Set),X=S.useRef(!0);S.useEffect(()=>{if(!p||!X.current)return;X.current=!1;const Z=(p.children||[]).filter(ne=>ne.dir);Z.length===1&&he(ne=>new Set(ne).add(Z[0].path))},[p]),S.useEffect(()=>{!T||!v||he(Z=>{const ne=new Set(Z);for(const de of DI(T))ne.add(de);return y.has(T)&&ne.add(T),ne})},[T,v,y]);const ue=S.useCallback(Z=>{he(ne=>{const de=new Set(ne);return de.has(Z)?de.delete(Z):de.add(Z),de})},[]),pe=S.useRef(null),ge=S.useRef(new Map),k=S.useRef({key:"",want:0,attempts:0});S.useEffect(()=>{k.current={key:u,want:N3()==="POP"?ge.current.get(u)??0:0,attempts:0}},[u]);const K=S.useCallback(()=>{const Z=pe.current,ne=k.current;!Z||ne.key!==u||ne.attempts>=3||(ne.attempts++,Z.scrollTo({top:ne.want,behavior:"instant"}))},[u]),re=S.useCallback(()=>{pe.current&&ge.current.set(u,pe.current.scrollTop)},[u]),W=S.useCallback((Z,ne)=>{Zt(dl(Z,l?.id,ne)),mr()},[l?.id]),te=S.useCallback(Z=>Zt(Pn("history",l?.id,Z)),[l?.id]),[D,M]=S.useState(""),[B,J]=S.useState(null),[Y,le]=S.useState(!1),[ae,ve]=S.useState(!1);S.useEffect(()=>VD(()=>ve(!0)),[]);const xe=S.useRef(null),Oe=e.panel??null,Ie=!Oe&&s&&!!l&&N&&wi(l.perm,"write"),{data:Ve}=j_(l?.id,s&&!!l),it=S.useCallback(()=>{d.invalidateQueries({queryKey:["shares",l?.id]})},[d,l?.id]),Qe=N?(Ve||[]).filter(Z=>Z.path===E):[],fn=!Oe&&s&&!!l,hn=!Oe&&N,Qt=!Oe&&(N||s&&!!l&&O),br=R?r+"blob?sha="+R+"&name="+encodeURIComponent(E)+"&download=1":r+"download?path="+encodeURIComponent(E),jt=S.useCallback(async()=>{try{const Z=await fetch(r+"shares",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:E})});if(!Z.ok)throw new Error(await Z.text());const ne=await Z.json();zw("share_created");const de=await qo(ne.url);J({url:ne.url,copied:de}),it()}catch(Z){Ke("Share failed: "+Z.message,!0)}},[r,E,it]),[rr,xr]=S.useState(""),Tt=s&&!!l&&wi(l?.perm,"write"),Vn=S.useCallback(async(Z,ne)=>{xr(Z+ne);try{await Si(r+"restore",{path:Z,sha:ne}),d.invalidateQueries({queryKey:["history",r]}),d.invalidateQueries({queryKey:["tree",r]}),d.invalidateQueries({queryKey:["render",r,Z]}),d.invalidateQueries({queryKey:["text"]}),Ke("Restored "+Z+" — it syncs to every device like any other change.")}catch(de){Ke("Restore failed: "+de.message,!0)}finally{xr("")}},[r,d]),[Dt,kr]=S.useState(""),ar=S.useCallback(async Z=>{if(await Cl("Remove "+Z+"?","It disappears from every synced device. History keeps it — you can restore it from the DELETED row afterwards.","Remove file",!0)){kr(Z);try{await Si(r+"remove",{path:Z}),d.invalidateQueries({queryKey:["history",r]}),d.invalidateQueries({queryKey:["tree",r]}),d.invalidateQueries({queryKey:["render",r,Z]}),d.invalidateQueries({queryKey:["text"]}),Ke("Removed "+Z+" — it syncs to every device like any other change.")}catch(ne){Ke("Remove failed: "+ne.message,!0)}finally{kr("")}}},[r,d]),ir=S.useCallback(()=>{if(!E)return te("");te(O?E+"/":E)},[E,O,te]);S.useEffect(()=>{const Z=ne=>{(ne.metaKey||ne.ctrlKey)&&ne.key.toLowerCase()==="k"&&(ne.preventDefault(),ve(de=>!de))};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[]);const wr=S.useCallback(()=>{const Z=[],ne=(de,we,Ee,Xe)=>Z.push({icon:de,label:we,kind:Ee,run:Xe});if(s&&l){const de=l.id,we=Ee=>()=>{e.onClosePanel?.(),Zt(Ee)};ne("folder","Go to project root","action",we("/"+de)),ne("dashboard","Dashboard","action",we(Pn("dashboard",de))),ne("terminal","Installation","action",we(Pn("install",de))),ne("gear","Settings","action",we(Pn("settings",de)))}if(s&&l&&E&&(N&&ne("share","Share: "+E,"action",jt),ne("hist","History: "+E,"action",ir),N&&ne("download","Download: "+E,"action",()=>xe.current?.click())),s&&l&&ne("hist","History: whole project","action",()=>te("")),s)for(const de of e.projects||[])(!l||de.id!==l.id)&&ne("folder","Switch to project: "+de.name,"project",()=>Zt("/"+de.id));n.auth?.enabled&&ne("power","Sign out","action",()=>window.location.href="/auth/logout");for(const de of y.keys())ne("folder",de,"folder",()=>W(de));for(const de of m)ne("doc",de.path,"file",()=>W(de.path));return Z},[s,l,E,N,n.auth?.enabled,y,m,e.projects,e.onClosePanel,jt,ir,te,W]);S.useEffect(()=>{if(!Y)return;const Z=()=>le(!1);return document.addEventListener("click",Z),()=>document.removeEventListener("click",Z)},[Y]);const or=S.useCallback(Z=>y.has(Z),[y]);let mn="app",A,I;Oe?I=Oe.body:i.view==="dashboard"?I=f.jsx(gw,{flatFiles:m,heatMap:b,devices:_,scope:i.viewTarget||"",loading:!v,installHref:l?Pn("install",l.id):void 0,onOpenFile:W,onOpenFolder:W,onOpenHistory:te,isFolder:or}):i.view==="history"?I=f.jsx(QP,{apiBase:r,target:i.viewTarget||"",isFolder:or,onOpen:W,onMeta:M,onRendered:K,restore:Tt?{onRestore:Vn,busy:rr}:void 0,remove:Tt?{onRemove:ar,busy:Dt}:void 0,filters:i.filters,onFilters:Z=>Zt(Pn("history",l?.id,i.viewTarget||"",Z))}):E?v?L?I=f.jsxs("div",{className:"notfound",children:[f.jsx("h1",{children:"Couldn't find that"}),f.jsxs("p",{children:[f.jsx("code",{children:E})," isn't in this project right now."]}),f.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."}),f.jsx("button",{className:"pbtn",onClick:()=>d.invalidateQueries({queryKey:["tree",r]}),children:"Check again"})]}):O?I=f.jsx(qI,{node:y.get(E),heatMap:b,hub:s&&!!l,apiBase:r,onOpen:W,onFullHistory:te,onRendered:K}):(mn=OC.test(E)||AC.test(E)?"wide":"read",A="markdown",I=f.jsxs(f.Fragment,{children:[R&&f.jsx(eF,{apiBase:r,path:E,version:R,onViewCurrent:()=>W(E)}),f.jsx(KI,{apiBase:r,path:E,version:R,heatMap:b,flatFiles:m,onOpenFile:W,onMeta:M,onRendered:K})]})):I=f.jsx("div",{className:"empty",children:"Loading…"}):x?I=f.jsxs(f.Fragment,{children:[f.jsx(HC,{project:l,existing:i.connect==="existing"}),f.jsx("div",{className:"home-insights",children:f.jsx(gw,{flatFiles:m,heatMap:b,devices:_,loading:!v,onOpenFile:W,onOpenFolder:W,onOpenHistory:te,isFolder:or})})]}):I=f.jsx("div",{className:"empty",children:"Select a file to read it."}),V&&V.to===E&&(I=f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"vbanner",role:"status",children:[f.jsx("span",{className:"vb-icon",children:f.jsx(ut,{name:"link"})}),f.jsxs("div",{className:"vb-text",children:[f.jsxs("b",{children:["Moved from ",V.from]}),f.jsx("span",{children:"The URL has been updated."})]})]}),I]}));const U=Oe?Oe.crumb:E?f.jsx(zI,{path:E,onOpenFolder:W}):i.view==="dashboard"?"Dashboard — "+(i.viewTarget||l?.name||""):i.view==="history"?"History — "+WP(i.viewTarget||"",or):x?l.name:null,ce=f.jsx(ul,{crumb:U,meta:D,actions:f.jsxs(f.Fragment,{children:[Ie&&f.jsx(vt,{id:"share-btn",variant:"toolbar",className:"icon-only",title:"Share","aria-label":"Share",onClick:jt,children:f.jsx(ut,{name:"share"})}),fn&&!E&&!i.view&&f.jsxs(vt,{id:"history-btn",variant:"toolbar",onClick:ir,children:[f.jsx(ut,{name:"hist"})," ",f.jsx("span",{className:"lbl",children:"History"})]}),hn&&f.jsx("a",{id:"download",hidden:!0,download:!0,href:br,ref:xe,children:"Download"}),Qt&&f.jsx(vt,{id:"more-btn",variant:"toolbar",className:"icon-only",title:"More actions","aria-label":"More actions",onClick:Z=>{Z.stopPropagation(),le(!Y)},children:f.jsx(ut,{name:"dots"})}),Y&&f.jsxs("div",{id:"more-menu",role:"menu",children:[fn&&f.jsx("button",{className:"more-item",onClick:ir,children:"History"}),hn&&f.jsx("button",{className:"more-item",onClick:()=>xe.current?.click(),children:"Download"}),s&&!!l&&f.jsx("button",{className:"more-item",onClick:()=>{e.onClosePanel?.(),Zt(Pn("dashboard",l?.id,E))},children:"Dashboard"})]})]})});return f.jsxs(f.Fragment,{children:[f.jsx(cl,{vault:e.sidebar.vault,projectsNav:e.sidebar.projectsNav,orgBar:e.sidebar.orgBar,tree:f.jsx(NI,{root:p,expanded:be,onToggle:ue,currentPath:T,listingShowing:P,onOpen:W}),topbar:ce,contentRef:pe,onContentScroll:re,children:f.jsxs(Su,{width:mn,className:A,children:[!Oe&&N&&f.jsx(iP,{shares:Qe,canRevoke:!!l&&wi(l.perm,"write"),onChanged:it}),I]})}),B&&f.jsx(aP,{url:B.url,copied:B.copied,onClose:()=>{J(null),it()}}),f.jsx(LP,{open:ae,onClose:()=>ve(!1),candidates:wr})]})}function tF({config:e}){const n=Yp(),r=O_(),[i,s]=S.useState(null),[l,u]=S.useState(null);S.useEffect(()=>u(null),[n]);const d=S.useMemo(()=>{const ge=n.split("?")[0].match(/^\/join\/([0-9a-f]+)\/?$/);return ge?ge[1]:null},[n]),{data:p}=E3(!d),{data:m}=R3(!d),y=!!e.auth.admin,{data:v}=T_(y),b=S.useMemo(()=>D_(n,"hub"),[n]),[x,w]=S.useState(!1),_=e.upload.enabled,E=async(ge,k)=>{const K=k===BC;try{const re=await Si("/api/projects",{name:ge,template:K?"":k});w(!1),await r(),Zt("/"+re.project.id+(K?"?connect=existing":"")),Ke(`Created “${re.project.name}”.`)}catch(re){Ke("Could not create the project: "+re.message,!0)}},R=x?f.jsx(eI,{templates:e.templates??[],onCreate:E,onClose:()=>w(!1)}):null,T=S.useMemo(()=>p&&(p.find(ge=>ge.id===b.project)||i&&p.find(ge=>ge.org===i)||p.find(ge=>ge.id===_$())||p[0])||null,[p,b.project,i]);if(S.useEffect(()=>{document.title=T?T.name+" — BearDrive":e.brand||"BearDrive",T&&C$(T.id)},[T,e]),d)return f.jsx(nF,{token:d,onDone:async ge=>{s(ge),await r(),Zt("/",{replace:!0})}});const O=e.brand||"BearDrive",N=T&&m?.find(ge=>ge.id===T.org)||null,L=f.jsx(Xu,{name:O,onHome:()=>Zt("/"),search:!!T}),P=e.me?f.jsx(q$,{me:e.me,org:N,orgActive:!!b.org,billing:e.billing,admin:y?{pending:v?.length||0,onClick:()=>{u({kind:"hub"}),mr()}}:void 0}):void 0;if(!p||!m)return f.jsx(cl,{vault:L,topbar:f.jsx(ul,{}),children:f.jsx(Su,{children:f.jsx("div",{className:"empty",children:"Loading…"})})});if(!T)return f.jsxs(cl,{vault:L,projectsNav:f.jsx(aw,{projects:p,onNew:()=>w(!0)}),orgBar:P,topbar:f.jsx(ul,{}),children:[f.jsx(Su,{children:f.jsx(W$,{onNew:()=>w(!0),canCreate:_})}),R]});const F=l?.kind==="hub"?{crumb:"Signup & access",body:f.jsx(k$,{})}:null,V=b.org?m.find(ge=>ge.id===b.org):null,be=b.org&&!V?{crumb:"Organization",body:f.jsxs("div",{className:"empty",children:[f.jsx("h3",{children:"Organization not found"}),f.jsx("p",{children:"This organization doesn't exist, or you're no longer a member."}),f.jsx("p",{children:f.jsxs("a",{...Bo("/"+T.id),children:["Back to ",T.name]})})]})}:V?{crumb:"Organization",body:f.jsx(N$,{org:V,projects:p,myEmail:e.me?.email||""})}:null,he=!!b.project&&!p.some(ge=>ge.id===b.project),X=he?{crumb:"Project",body:f.jsxs("div",{className:"empty",children:[f.jsx("h3",{children:"Project not found"}),f.jsx("p",{children:"This project doesn't exist, or you're no longer a member."}),f.jsx("p",{children:f.jsxs("a",{...Bo("/"+T.id),children:["Back to ",T.name]})})]})}:null,ue=b.billing?{crumb:"Billing",body:e.billing?f.jsx(G$,{url:e.billing.url}):f.jsxs("div",{className:"empty",children:[f.jsx("h3",{children:"No billing on this hub"}),f.jsx("p",{children:"This BearDrive hub doesn't have a billing surface."})]})}:null,pe=b.view==="settings"?{crumb:"Project settings",body:f.jsx(Y$,{project:T,org:N,onDeleted:async()=>{await r(),Zt("/")}})}:b.view==="install"?{crumb:"Installation",body:f.jsx(HC,{project:T,existing:b.connect==="existing"})}:null;if(!he){if(!b.org&&!b.billing&&b.project!==T.id)return f.jsx(Ys,{to:"/"+T.id});if(b.legacyView&&b.view)return f.jsx(Ys,{to:Pn(b.view,T.id,b.viewTarget,b.filters)});if(b.queryTarget&&b.view)return f.jsx(Ys,{to:Pn(b.view,T.id,b.viewTarget,b.filters)});if(b.trailingSlash&&b.path)return f.jsx(Ys,{to:dl(b.path,T.id,b.version)})}return f.jsxs(f.Fragment,{children:[f.jsx(oE,{config:e,apiBase:"/api/p/"+T.id+"/",route:b,hub:!0,project:T,projects:p,sidebar:{vault:L,projectsNav:f.jsx(aw,{projects:p,currentId:T.id,onNew:()=>w(!0),menu:{active:l?null:b.view==="dashboard"&&!b.viewTarget?"dashboard":b.view==="install"?"install":b.view==="history"&&!b.viewTarget?"history":b.view==="settings"?"settings":null,onDashboard:()=>{u(null),Zt(Pn("dashboard",T.id)),mr()},onInstall:()=>{u(null),Zt(Pn("install",T.id)),mr()},onHistory:()=>{u(null),Zt(Pn("history",T.id)),mr()},onSettings:()=>{u(null),Zt(Pn("settings",T.id)),mr()}}}),orgBar:P},panel:F||be||X||ue||pe,onClosePanel:()=>u(null)},T.id),R]})}function nF({token:e,onDone:n}){return S.useEffect(()=>{let r=!1;return Si("/api/invites/"+e).then(i=>{r||(Ke(`Welcome — you joined the “${i.org.name}” team. Opening its projects…`),n(i.org.id))}).catch(i=>{r||String(i.message).includes("signing in")||(Ke("Could not accept the invite: "+i.message,!0),n(null))}),()=>{r=!0}},[e]),f.jsx(cl,{vault:f.jsx(Xu,{name:"BearDrive"}),topbar:f.jsx(ul,{}),children:f.jsx(Su,{children:f.jsx("div",{className:"empty",children:"Joining…"})})})}function rF({config:e}){const n=Yp(),r=e.volume||"BearDrive";S.useEffect(()=>{document.title=e.brand||r},[e,r]);const i=S.useMemo(()=>D_(n,"volume"),[n]);return i.trailingSlash&&i.path?f.jsx(Ys,{to:dl(i.path)}):f.jsx(oE,{config:e,apiBase:"/api/",route:i,hub:!1,sidebar:{vault:f.jsx(Xu,{name:r,showSignout:e.auth.enabled,search:!0})}})}function aF(){const{data:e}=vj();return f.jsxs($D,{delayDuration:150,children:[e?e.mode==="hub"?f.jsx(tF,{config:e}):f.jsx(rF,{config:e}):f.jsx(cl,{vault:f.jsx(Xu,{name:"…",showSignout:!1}),topbar:f.jsx(ul,{}),children:f.jsx("div",{className:"empty",children:"Loading…"})}),f.jsx(v3,{}),f.jsx(S3,{})]})}class iF extends S.Component{state={error:null};static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,r){console.error("BearDrive: unhandled render error",n,r.componentStack)}render(){return this.state.error?f.jsxs("div",{className:"mx-auto max-w-lg p-8 text-sm",children:[f.jsx("h1",{className:"mb-2 text-lg font-semibold",children:"This page didn’t load"}),f.jsx("p",{className:"mb-4 opacity-80",children:"Something went wrong rendering this view. The rest of BearDrive is fine."}),f.jsx("p",{className:"mb-4",children:f.jsx("a",{className:"underline",href:"/",children:"Go to the project list"})}),f.jsx("pre",{className:"overflow-x-auto rounded bg-black/5 p-3 text-xs dark:bg-white/10",children:String(this.state.error)})]}):this.props.children}}const oF=new ej({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});j2.createRoot(document.getElementById("root")).render(f.jsx(S.StrictMode,{children:f.jsx(iF,{children:f.jsx(tj,{client:oF,children:f.jsx(aF,{})})})})); diff --git a/internal/webapp/static/assets/index-DRd_YZgy.js b/internal/webapp/static/assets/index-DRd_YZgy.js new file mode 100644 index 0000000..487e4bb --- /dev/null +++ b/internal/webapp/static/assets/index-DRd_YZgy.js @@ -0,0 +1,122 @@ +function y2(e,n){for(var r=0;ri[o]})}}}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 o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const l of o)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(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(o){if(o.ep)return;o.ep=!0;const l=r(o);fetch(o.href,l)}})();function bw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Rh={exports:{}},Po={};var lb;function b2(){if(lb)return Po;lb=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(i,o,l){var u=null;if(l!==void 0&&(u=""+l),o.key!==void 0&&(u=""+o.key),"key"in o){l={};for(var d in o)d!=="key"&&(l[d]=o[d])}else l=o;return o=l.ref,{$$typeof:e,type:i,key:u,ref:o!==void 0?o:null,props:l}}return Po.Fragment=n,Po.jsx=r,Po.jsxs=r,Po}var cb;function x2(){return cb||(cb=1,Rh.exports=b2()),Rh.exports}var f=x2(),jh={exports:{}},Pe={};var ub;function w2(){if(ub)return Pe;ub=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),b=Symbol.iterator;function x(z){return z===null||typeof z!="object"?null:(z=b&&z[b]||z["@@iterator"],typeof z=="function"?z:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,E={};function R(z,N,B){this.props=z,this.context=N,this.refs=E,this.updater=B||S}R.prototype.isReactComponent={},R.prototype.setState=function(z,N){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,N,"setState")},R.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function T(){}T.prototype=R.prototype;function O(z,N,B){this.props=z,this.context=N,this.refs=E,this.updater=B||S}var M=O.prototype=new T;M.constructor=O,_(M,R.prototype),M.isPureReactComponent=!0;var D=Array.isArray;function P(){}var F={H:null,A:null,T:null,S:null},V=Object.prototype.hasOwnProperty;function ve(z,N,B){var J=B.ref;return{$$typeof:e,type:z,key:N,ref:J!==void 0?J:null,props:B}}function be(z,N){return ve(z.type,N,z.props)}function he(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function ue(z){var N={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(B){return N[B]})}var X=/\/+/g;function pe(z,N){return typeof z=="object"&&z!==null&&z.key!=null?ue(""+z.key):N.toString(36)}function ge(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(P,P):(z.status="pending",z.then(function(N){z.status==="pending"&&(z.status="fulfilled",z.value=N)},function(N){z.status==="pending"&&(z.status="rejected",z.reason=N)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function L(z,N,B,J,Y){var le=typeof z;(le==="undefined"||le==="boolean")&&(z=null);var ae=!1;if(z===null)ae=!0;else switch(le){case"bigint":case"string":case"number":ae=!0;break;case"object":switch(z.$$typeof){case e:case n:ae=!0;break;case y:return ae=z._init,L(ae(z._payload),N,B,J,Y)}}if(ae)return Y=Y(z),ae=J===""?"."+pe(z,0):J,D(Y)?(B="",ae!=null&&(B=ae.replace(X,"$&/")+"/"),L(Y,N,B,"",function(Oe){return Oe})):Y!=null&&(he(Y)&&(Y=be(Y,B+(Y.key==null||z&&z.key===Y.key?"":(""+Y.key).replace(X,"$&/")+"/")+ae)),N.push(Y)),1;ae=0;var ye=J===""?".":J+":";if(D(z))for(var xe=0;xe>>1,te=L[W];if(0>>1;Wo(B,re))Jo(Y,B)?(L[W]=Y,L[J]=re,W=J):(L[W]=B,L[N]=re,W=N);else if(Jo(Y,re))L[W]=Y,L[J]=re,W=J;else break e}}return K}function o(L,K){var re=L.sortIndex-K.sortIndex;return re!==0?re:L.id-K.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 p=[],m=[],y=1,v=null,b=3,x=!1,S=!1,_=!1,E=!1,R=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function M(L){for(var K=r(m);K!==null;){if(K.callback===null)i(m);else if(K.startTime<=L)i(m),K.sortIndex=K.expirationTime,n(p,K);else break;K=r(m)}}function D(L){if(_=!1,M(L),!S)if(r(p)!==null)S=!0,P||(P=!0,ue());else{var K=r(m);K!==null&&ge(D,K.startTime-L)}}var P=!1,F=-1,V=5,ve=-1;function be(){return E?!0:!(e.unstable_now()-veL&&be());){var W=v.callback;if(typeof W=="function"){v.callback=null,b=v.priorityLevel;var te=W(v.expirationTime<=L);if(L=e.unstable_now(),typeof te=="function"){v.callback=te,M(L),K=!0;break t}v===r(p)&&i(p),M(L)}else i(p);v=r(p)}if(v!==null)K=!0;else{var z=r(m);z!==null&&ge(D,z.startTime-L),K=!1}}break e}finally{v=null,b=re,x=!1}K=void 0}}finally{K?ue():P=!1}}}var ue;if(typeof O=="function")ue=function(){O(he)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,pe=X.port2;X.port1.onmessage=he,ue=function(){pe.postMessage(null)}}else ue=function(){R(he,0)};function ge(L,K){F=R(function(){L(e.unstable_now())},K)}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(L){L.callback=null},e.unstable_forceFrameRate=function(L){0>L||125W?(L.sortIndex=re,n(m,L),r(p)===null&&L===r(m)&&(_?(T(F),F=-1):_=!0,ge(D,re-W))):(L.sortIndex=te,n(p,L),S||x||(S=!0,P||(P=!0,ue()))),L},e.unstable_shouldYield=be,e.unstable_wrapCallback=function(L){var K=b;return function(){var re=b;b=K;try{return L.apply(this,arguments)}finally{b=re}}}})(Ah)),Ah}var hb;function _2(){return hb||(hb=1,Oh.exports=S2()),Oh.exports}var Mh={exports:{}},cn={};var mb;function C2(){if(mb)return cn;mb=1;var e=np();function n(p){var m="https://react.dev/errors/"+p;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Mh.exports=C2(),Mh.exports}var gb;function E2(){if(gb)return Fo;gb=1;var e=_2(),n=np(),r=xw();function i(t){var a="https://react.dev/errors/"+t;if(1te||(t.current=W[te],W[te]=null,te--)}function B(t,a){te++,W[te]=t.current,t.current=a}var J=z(null),Y=z(null),le=z(null),ae=z(null);function ye(t,a){switch(B(le,a),B(Y,t),B(J,null),a.nodeType){case 9:case 11:t=(t=a.documentElement)&&(t=t.namespaceURI)?M0(t):0;break;default:if(t=a.tagName,a=a.namespaceURI)a=M0(a),t=N0(a,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}N(J),B(J,t)}function xe(){N(J),N(Y),N(le)}function Oe(t){t.memoizedState!==null&&B(ae,t);var a=J.current,s=N0(a,t.type);a!==s&&(B(Y,t),B(J,s))}function Ie(t){Y.current===t&&(N(J),N(Y)),ae.current===t&&(N(ae),ko._currentValue=re)}var Ve,it;function Qe(t){if(Ve===void 0)try{throw Error()}catch(s){var a=s.stack.trim().match(/\n( *(at )?)/);Ve=a&&a[1]||"",it=-1)":-1h||k[c]!==G[h]){var ie=` +`+k[c].replace(" at new "," at ");return t.displayName&&ie.includes("")&&(ie=ie.replace("",t.displayName)),ie}while(1<=c&&0<=h);break}}}finally{fn=!1,Error.prepareStackTrace=s}return(s=t?t.displayName||t.name:"")?Qe(s):""}function Qt(t,a){switch(t.tag){case 26:case 27:case 5:return Qe(t.type);case 16:return Qe("Lazy");case 13:return t.child!==a&&a!==null?Qe("Suspense Fallback"):Qe("Suspense");case 19:return Qe("SuspenseList");case 0:case 15:return hn(t.type,!1);case 11:return hn(t.type.render,!1);case 1:return hn(t.type,!0);case 31:return Qe("Activity");default:return""}}function br(t){try{var a="",s=null;do a+=Qt(t,s),s=t,t=t.return;while(t);return a}catch(c){return` +Error generating stack: `+c.message+` +`+c.stack}}var jt=Object.prototype.hasOwnProperty,rr=e.unstable_scheduleCallback,xr=e.unstable_cancelCallback,Tt=e.unstable_shouldYield,Vn=e.unstable_requestPaint,Dt=e.unstable_now,kr=e.unstable_getCurrentPriorityLevel,ar=e.unstable_ImmediatePriority,ir=e.unstable_UserBlockingPriority,wr=e.unstable_NormalPriority,sr=e.unstable_LowPriority,mn=e.unstable_IdlePriority,A=e.log,I=e.unstable_setDisableYieldValue,U=null,ce=null;function Z(t){if(typeof A=="function"&&I(t),ce&&typeof ce.setStrictMode=="function")try{ce.setStrictMode(U,t)}catch{}}var ne=Math.clz32?Math.clz32:Ee,de=Math.log,we=Math.LN2;function Ee(t){return t>>>=0,t===0?32:31-(de(t)/we|0)|0}var Xe=256,wt=262144,Xt=4194304;function zt(t){var a=t&42;if(a!==0)return a;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 Ne(t,a,s){var c=t.pendingLanes;if(c===0)return 0;var h=0,g=t.suspendedLanes,C=t.pingedLanes;t=t.warmLanes;var j=c&134217727;return j!==0?(c=j&~g,c!==0?h=zt(c):(C&=j,C!==0?h=zt(C):s||(s=j&~t,s!==0&&(h=zt(s))))):(j=c&~g,j!==0?h=zt(j):C!==0?h=zt(C):s||(s=c&~t,s!==0&&(h=zt(s)))),h===0?0:a!==0&&a!==h&&(a&g)===0&&(g=h&-h,s=a&-a,g>=s||g===32&&(s&4194048)!==0)?a:h}function ht(t,a){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&a)===0}function yt(t,a){switch(t){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 qt(){var t=Xt;return Xt<<=1,(Xt&62914560)===0&&(Xt=4194304),t}function or(t){for(var a=[],s=0;31>s;s++)a.push(t);return a}function St(t,a){t.pendingLanes|=a,a!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function yn(t,a,s,c,h,g){var C=t.pendingLanes;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=s,t.entangledLanes&=s,t.errorRecoveryDisabledLanes&=s,t.shellSuspendCounter=0;var j=t.entanglements,k=t.expirationTimes,G=t.hiddenUpdates;for(s=C&~s;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var fE=/[\n"\\]/g;function Hn(t){return t.replace(fE,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function bd(t,a,s,c,h,g,C,j){t.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?t.type=C:t.removeAttribute("type"),a!=null?C==="number"?(a===0&&t.value===""||t.value!=a)&&(t.value=""+Un(a)):t.value!==""+Un(a)&&(t.value=""+Un(a)):C!=="submit"&&C!=="reset"||t.removeAttribute("value"),a!=null?xd(t,C,Un(a)):s!=null?xd(t,C,Un(s)):c!=null&&t.removeAttribute("value"),h==null&&g!=null&&(t.defaultChecked=!!g),h!=null&&(t.checked=h&&typeof h!="function"&&typeof h!="symbol"),j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?t.name=""+Un(j):t.removeAttribute("name")}function Eg(t,a,s,c,h,g,C,j){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(t.type=g),a!=null||s!=null){if(!(g!=="submit"&&g!=="reset"||a!=null)){yd(t);return}s=s!=null?""+Un(s):"",a=a!=null?""+Un(a):s,j||a===t.value||(t.value=a),t.defaultValue=a}c=c??h,c=typeof c!="function"&&typeof c!="symbol"&&!!c,t.checked=j?t.checked:!!c,t.defaultChecked=!!c,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(t.name=C),yd(t)}function xd(t,a,s){a==="number"&&Al(t.ownerDocument)===t||t.defaultValue===""+s||(t.defaultValue=""+s)}function Hi(t,a,s,c){if(t=t.options,a){a={};for(var h=0;h"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ed=!1;if(Ir)try{var Js={};Object.defineProperty(Js,"passive",{get:function(){Ed=!0}}),window.addEventListener("test",Js,Js),window.removeEventListener("test",Js,Js)}catch{Ed=!1}var la=null,Rd=null,Nl=null;function Ng(){if(Nl)return Nl;var t,a=Rd,s=a.length,c,h="value"in la?la.value:la.textContent,g=h.length;for(t=0;t=to),Ig=" ",Pg=!1;function Fg(t,a){switch(t){case"keyup":return FE.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Zi=!1;function UE(t,a){switch(t){case"compositionend":return Vg(a);case"keypress":return a.which!==32?null:(Pg=!0,Ig);case"textInput":return t=a.data,t===Ig&&Pg?null:t;default:return null}}function HE(t,a){if(Zi)return t==="compositionend"||!Md&&Fg(t,a)?(t=Ng(),Nl=Rd=la=null,Zi=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1=a)return{node:s,offset:a-t};t=c}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Yg(s)}}function Xg(t,a){return t&&a?t===a?!0:t&&t.nodeType===3?!1:a&&a.nodeType===3?Xg(t,a.parentNode):"contains"in t?t.contains(a):t.compareDocumentPosition?!!(t.compareDocumentPosition(a)&16):!1:!1}function Jg(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var a=Al(t.document);a instanceof t.HTMLIFrameElement;){try{var s=typeof a.contentWindow.location.href=="string"}catch{s=!1}if(s)t=a.contentWindow;else break;a=Al(t.document)}return a}function zd(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a&&(a==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||a==="textarea"||t.contentEditable==="true")}var XE=Ir&&"documentMode"in document&&11>=document.documentMode,Ki=null,kd=null,io=null,Ld=!1;function Wg(t,a,s){var c=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Ld||Ki==null||Ki!==Al(c)||(c=Ki,"selectionStart"in c&&zd(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}),io&&ao(io,c)||(io=c,c=Ec(kd,"onSelect"),0>=C,h-=C,Sr=1<<32-ne(a)+h|s<Ue?(Ze=Te,Te=null):Ze=Te.sibling;var et=Q(H,Te,q[Ue],se);if(et===null){Te===null&&(Te=Ze);break}t&&Te&&et.alternate===null&&a(H,Te),$=g(et,$,Ue),We===null?Ae=et:We.sibling=et,We=et,Te=Ze}if(Ue===q.length)return s(H,Te),Ye&&Fr(H,Ue),Ae;if(Te===null){for(;UeUe?(Ze=Te,Te=null):Ze=Te.sibling;var Aa=Q(H,Te,et.value,se);if(Aa===null){Te===null&&(Te=Ze);break}t&&Te&&Aa.alternate===null&&a(H,Te),$=g(Aa,$,Ue),We===null?Ae=Aa:We.sibling=Aa,We=Aa,Te=Ze}if(et.done)return s(H,Te),Ye&&Fr(H,Ue),Ae;if(Te===null){for(;!et.done;Ue++,et=q.next())et=oe(H,et.value,se),et!==null&&($=g(et,$,Ue),We===null?Ae=et:We.sibling=et,We=et);return Ye&&Fr(H,Ue),Ae}for(Te=c(Te);!et.done;Ue++,et=q.next())et=ee(Te,H,Ue,et.value,se),et!==null&&(t&&et.alternate!==null&&Te.delete(et.key===null?Ue:et.key),$=g(et,$,Ue),We===null?Ae=et:We.sibling=et,We=et);return t&&Te.forEach(function(v2){return a(H,v2)}),Ye&&Fr(H,Ue),Ae}function lt(H,$,q,se){if(typeof q=="object"&&q!==null&&q.type===_&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case x:e:{for(var Ae=q.key;$!==null;){if($.key===Ae){if(Ae=q.type,Ae===_){if($.tag===7){s(H,$.sibling),se=h($,q.props.children),se.return=H,H=se;break e}}else if($.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===V&&ui(Ae)===$.type){s(H,$.sibling),se=h($,q.props),fo(se,q),se.return=H,H=se;break e}s(H,$);break}else a(H,$);$=$.sibling}q.type===_?(se=ii(q.props.children,H.mode,se,q.key),se.return=H,H=se):(se=Ul(q.type,q.key,q.props,null,H.mode,se),fo(se,q),se.return=H,H=se)}return C(H);case S:e:{for(Ae=q.key;$!==null;){if($.key===Ae)if($.tag===4&&$.stateNode.containerInfo===q.containerInfo&&$.stateNode.implementation===q.implementation){s(H,$.sibling),se=h($,q.children||[]),se.return=H,H=se;break e}else{s(H,$);break}else a(H,$);$=$.sibling}se=Hd(q,H.mode,se),se.return=H,H=se}return C(H);case V:return q=ui(q),lt(H,$,q,se)}if(ge(q))return Re(H,$,q,se);if(ue(q)){if(Ae=ue(q),typeof Ae!="function")throw Error(i(150));return q=Ae.call(q),De(H,$,q,se)}if(typeof q.then=="function")return lt(H,$,Yl(q),se);if(q.$$typeof===O)return lt(H,$,ql(H,q),se);Ql(H,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,$!==null&&$.tag===6?(s(H,$.sibling),se=h($,q),se.return=H,H=se):(s(H,$),se=Ud(q,H.mode,se),se.return=H,H=se),C(H)):s(H,$)}return function(H,$,q,se){try{uo=0;var Ae=lt(H,$,q,se);return is=null,Ae}catch(Te){if(Te===as||Te===Zl)throw Te;var We=Nn(29,Te,null,H.mode);return We.lanes=se,We.return=H,We}}}var fi=Sv(!0),_v=Sv(!1),ha=!1;function tf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function nf(t,a){t=t.updateQueue,a.updateQueue===t&&(a.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function ma(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function pa(t,a,s){var c=t.updateQueue;if(c===null)return null;if(c=c.shared,(tt&2)!==0){var h=c.pending;return h===null?a.next=a:(a.next=h.next,h.next=a),c.pending=a,a=Vl(t),sv(t,null,s),a}return Fl(t,c,a,s),Vl(t)}function ho(t,a,s){if(a=a.updateQueue,a!==null&&(a=a.shared,(s&4194048)!==0)){var c=a.lanes;c&=t.pendingLanes,s|=c,a.lanes=s,bn(t,s)}}function rf(t,a){var s=t.updateQueue,c=t.alternate;if(c!==null&&(c=c.updateQueue,s===c)){var h=null,g=null;if(s=s.firstBaseUpdate,s!==null){do{var C={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};g===null?h=g=C:g=g.next=C,s=s.next}while(s!==null);g===null?h=g=a:g=g.next=a}else h=g=a;s={baseState:c.baseState,firstBaseUpdate:h,lastBaseUpdate:g,shared:c.shared,callbacks:c.callbacks},t.updateQueue=s;return}t=s.lastBaseUpdate,t===null?s.firstBaseUpdate=a:t.next=a,s.lastBaseUpdate=a}var af=!1;function mo(){if(af){var t=rs;if(t!==null)throw t}}function po(t,a,s,c){af=!1;var h=t.updateQueue;ha=!1;var g=h.firstBaseUpdate,C=h.lastBaseUpdate,j=h.shared.pending;if(j!==null){h.shared.pending=null;var k=j,G=k.next;k.next=null,C===null?g=G:C.next=G,C=k;var ie=t.alternate;ie!==null&&(ie=ie.updateQueue,j=ie.lastBaseUpdate,j!==C&&(j===null?ie.firstBaseUpdate=G:j.next=G,ie.lastBaseUpdate=k))}if(g!==null){var oe=h.baseState;C=0,ie=G=k=null,j=g;do{var Q=j.lane&-536870913,ee=Q!==j.lane;if(ee?(Ge&Q)===Q:(c&Q)===Q){Q!==0&&Q===ns&&(af=!0),ie!==null&&(ie=ie.next={lane:0,tag:j.tag,payload:j.payload,callback:null,next:null});e:{var Re=t,De=j;Q=a;var lt=s;switch(De.tag){case 1:if(Re=De.payload,typeof Re=="function"){oe=Re.call(lt,oe,Q);break e}oe=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=De.payload,Q=typeof Re=="function"?Re.call(lt,oe,Q):Re,Q==null)break e;oe=v({},oe,Q);break e;case 2:ha=!0}}Q=j.callback,Q!==null&&(t.flags|=64,ee&&(t.flags|=8192),ee=h.callbacks,ee===null?h.callbacks=[Q]:ee.push(Q))}else ee={lane:Q,tag:j.tag,payload:j.payload,callback:j.callback,next:null},ie===null?(G=ie=ee,k=oe):ie=ie.next=ee,C|=Q;if(j=j.next,j===null){if(j=h.shared.pending,j===null)break;ee=j,j=ee.next,ee.next=null,h.lastBaseUpdate=ee,h.shared.pending=null}}while(!0);ie===null&&(k=oe),h.baseState=k,h.firstBaseUpdate=G,h.lastBaseUpdate=ie,g===null&&(h.shared.lanes=0),xa|=C,t.lanes=C,t.memoizedState=oe}}function Cv(t,a){if(typeof t!="function")throw Error(i(191,t));t.call(a)}function Ev(t,a){var s=t.callbacks;if(s!==null)for(t.callbacks=null,t=0;tg?g:8;var C=L.T,j={};L.T=j,Cf(t,!1,a,s);try{var k=h(),G=L.S;if(G!==null&&G(j,k),k!==null&&typeof k=="object"&&typeof k.then=="function"){var ie=sR(k,c);yo(t,a,ie,$n(t))}else yo(t,a,c,$n(t))}catch(oe){yo(t,a,{then:function(){},status:"rejected",reason:oe},$n())}finally{K.p=g,C!==null&&j.types!==null&&(C.types=j.types),L.T=C}}function fR(){}function Sf(t,a,s,c){if(t.tag!==5)throw Error(i(476));var h=ry(t).queue;ny(t,h,a,re,s===null?fR:function(){return ay(t),s(c)})}function ry(t){var a=t.memoizedState;if(a!==null)return a;a={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Br,lastRenderedState:re},next:null};var s={};return a.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Br,lastRenderedState:s},next:null},t.memoizedState=a,t=t.alternate,t!==null&&(t.memoizedState=a),a}function ay(t){var a=ry(t);a.next===null&&(a=t.alternate.memoizedState),yo(t,a.next.queue,{},$n())}function _f(){return en(ko)}function iy(){return At().memoizedState}function sy(){return At().memoizedState}function hR(t){for(var a=t.return;a!==null;){switch(a.tag){case 24:case 3:var s=$n();t=ma(s);var c=pa(a,t,s);c!==null&&(jn(c,a,s),ho(c,a,s)),a={cache:Xd()},t.payload=a;return}a=a.return}}function mR(t,a,s){var c=$n();s={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},sc(t)?ly(a,s):(s=Fd(t,a,s,c),s!==null&&(jn(s,t,c),cy(s,a,c)))}function oy(t,a,s){var c=$n();yo(t,a,s,c)}function yo(t,a,s,c){var h={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(sc(t))ly(a,h);else{var g=t.alternate;if(t.lanes===0&&(g===null||g.lanes===0)&&(g=a.lastRenderedReducer,g!==null))try{var C=a.lastRenderedState,j=g(C,s);if(h.hasEagerState=!0,h.eagerState=j,Mn(j,C))return Fl(t,a,h,0),ft===null&&Pl(),!1}catch{}if(s=Fd(t,a,h,c),s!==null)return jn(s,t,c),cy(s,a,c),!0}return!1}function Cf(t,a,s,c){if(c={lane:2,revertLane:nh(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},sc(t)){if(a)throw Error(i(479))}else a=Fd(t,s,c,2),a!==null&&jn(a,t,2)}function sc(t){var a=t.alternate;return t===Fe||a!==null&&a===Fe}function ly(t,a){os=Wl=!0;var s=t.pending;s===null?a.next=a:(a.next=s.next,s.next=a),t.pending=a}function cy(t,a,s){if((s&4194048)!==0){var c=a.lanes;c&=t.pendingLanes,s|=c,a.lanes=s,bn(t,s)}}var bo={readContext:en,use:nc,useCallback:Ct,useContext:Ct,useEffect:Ct,useImperativeHandle:Ct,useLayoutEffect:Ct,useInsertionEffect:Ct,useMemo:Ct,useReducer:Ct,useRef:Ct,useState:Ct,useDebugValue:Ct,useDeferredValue:Ct,useTransition:Ct,useSyncExternalStore:Ct,useId:Ct,useHostTransitionStatus:Ct,useFormState:Ct,useActionState:Ct,useOptimistic:Ct,useMemoCache:Ct,useCacheRefresh:Ct};bo.useEffectEvent=Ct;var uy={readContext:en,use:nc,useCallback:function(t,a){return pn().memoizedState=[t,a===void 0?null:a],t},useContext:en,useEffect:Zv,useImperativeHandle:function(t,a,s){s=s!=null?s.concat([t]):null,ac(4194308,4,Xv.bind(null,a,t),s)},useLayoutEffect:function(t,a){return ac(4194308,4,t,a)},useInsertionEffect:function(t,a){ac(4,2,t,a)},useMemo:function(t,a){var s=pn();a=a===void 0?null:a;var c=t();if(hi){Z(!0);try{t()}finally{Z(!1)}}return s.memoizedState=[c,a],c},useReducer:function(t,a,s){var c=pn();if(s!==void 0){var h=s(a);if(hi){Z(!0);try{s(a)}finally{Z(!1)}}}else h=a;return c.memoizedState=c.baseState=h,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:h},c.queue=t,t=t.dispatch=mR.bind(null,Fe,t),[c.memoizedState,t]},useRef:function(t){var a=pn();return t={current:t},a.memoizedState=t},useState:function(t){t=vf(t);var a=t.queue,s=oy.bind(null,Fe,a);return a.dispatch=s,[t.memoizedState,s]},useDebugValue:xf,useDeferredValue:function(t,a){var s=pn();return wf(s,t,a)},useTransition:function(){var t=vf(!1);return t=ny.bind(null,Fe,t.queue,!0,!1),pn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,a,s){var c=Fe,h=pn();if(Ye){if(s===void 0)throw Error(i(407));s=s()}else{if(s=a(),ft===null)throw Error(i(349));(Ge&127)!==0||Mv(c,a,s)}h.memoizedState=s;var g={value:s,getSnapshot:a};return h.queue=g,Zv(Dv.bind(null,c,g,t),[t]),c.flags|=2048,cs(9,{destroy:void 0},Nv.bind(null,c,g,s,a),null),s},useId:function(){var t=pn(),a=ft.identifierPrefix;if(Ye){var s=_r,c=Sr;s=(c&~(1<<32-ne(c)-1)).toString(32)+s,a="_"+a+"R_"+s,s=ec++,0<\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof c.is=="string"?C.createElement("select",{is:c.is}):C.createElement("select"),c.multiple?g.multiple=!0:c.size&&(g.size=c.size);break;default:g=typeof c.is=="string"?C.createElement(h,{is:c.is}):C.createElement(h)}}g[Jt]=a,g[wn]=c;e:for(C=a.child;C!==null;){if(C.tag===5||C.tag===6)g.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===a)break e;for(;C.sibling===null;){if(C.return===null||C.return===a)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}a.stateNode=g;e:switch(nn(g,h,c),h){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Gr(a)}}return pt(a),If(a,a.type,t===null?null:t.memoizedProps,a.pendingProps,s),null;case 6:if(t&&a.stateNode!=null)t.memoizedProps!==c&&Gr(a);else{if(typeof c!="string"&&a.stateNode===null)throw Error(i(166));if(t=le.current,es(a)){if(t=a.stateNode,s=a.memoizedProps,c=null,h=Wt,h!==null)switch(h.tag){case 27:case 5:c=h.memoizedProps}t[Jt]=a,t=!!(t.nodeValue===s||c!==null&&c.suppressHydrationWarning===!0||O0(t.nodeValue,s)),t||da(a,!0)}else t=Rc(t).createTextNode(c),t[Jt]=a,a.stateNode=t}return pt(a),null;case 31:if(s=a.memoizedState,t===null||t.memoizedState!==null){if(c=es(a),s!==null){if(t===null){if(!c)throw Error(i(318));if(t=a.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(557));t[Jt]=a}else si(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;pt(a),t=!1}else s=Zd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=s),t=!0;if(!t)return a.flags&256?(zn(a),a):(zn(a),null);if((a.flags&128)!==0)throw Error(i(558))}return pt(a),null;case 13:if(c=a.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=es(a),c!==null&&c.dehydrated!==null){if(t===null){if(!h)throw Error(i(318));if(h=a.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(i(317));h[Jt]=a}else si(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;pt(a),h=!1}else h=Zd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)return a.flags&256?(zn(a),a):(zn(a),null)}return zn(a),(a.flags&128)!==0?(a.lanes=s,a):(s=c!==null,t=t!==null&&t.memoizedState!==null,s&&(c=a.child,h=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(h=c.alternate.memoizedState.cachePool.pool),g=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(g=c.memoizedState.cachePool.pool),g!==h&&(c.flags|=2048)),s!==t&&s&&(a.child.flags|=8192),dc(a,a.updateQueue),pt(a),null);case 4:return xe(),t===null&&sh(a.stateNode.containerInfo),pt(a),null;case 10:return Ur(a.type),pt(a),null;case 19:if(N(Ot),c=a.memoizedState,c===null)return pt(a),null;if(h=(a.flags&128)!==0,g=c.rendering,g===null)if(h)wo(c,!1);else{if(Et!==0||t!==null&&(t.flags&128)!==0)for(t=a.child;t!==null;){if(g=Jl(t),g!==null){for(a.flags|=128,wo(c,!1),t=g.updateQueue,a.updateQueue=t,dc(a,t),a.subtreeFlags=0,t=s,s=a.child;s!==null;)ov(s,t),s=s.sibling;return B(Ot,Ot.current&1|2),Ye&&Fr(a,c.treeForkCount),a.child}t=t.sibling}c.tail!==null&&Dt()>gc&&(a.flags|=128,h=!0,wo(c,!1),a.lanes=4194304)}else{if(!h)if(t=Jl(g),t!==null){if(a.flags|=128,h=!0,t=t.updateQueue,a.updateQueue=t,dc(a,t),wo(c,!0),c.tail===null&&c.tailMode==="hidden"&&!g.alternate&&!Ye)return pt(a),null}else 2*Dt()-c.renderingStartTime>gc&&s!==536870912&&(a.flags|=128,h=!0,wo(c,!1),a.lanes=4194304);c.isBackwards?(g.sibling=a.child,a.child=g):(t=c.last,t!==null?t.sibling=g:a.child=g,c.last=g)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=Dt(),t.sibling=null,s=Ot.current,B(Ot,h?s&1|2:s&1),Ye&&Fr(a,c.treeForkCount),t):(pt(a),null);case 22:case 23:return zn(a),of(),c=a.memoizedState!==null,t!==null?t.memoizedState!==null!==c&&(a.flags|=8192):c&&(a.flags|=8192),c?(s&536870912)!==0&&(a.flags&128)===0&&(pt(a),a.subtreeFlags&6&&(a.flags|=8192)):pt(a),s=a.updateQueue,s!==null&&dc(a,s.retryQueue),s=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),c=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(c=a.memoizedState.cachePool.pool),c!==s&&(a.flags|=2048),t!==null&&N(ci),null;case 24:return s=null,t!==null&&(s=t.memoizedState.cache),a.memoizedState.cache!==s&&(a.flags|=2048),Ur(kt),pt(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function bR(t,a){switch(qd(a),a.tag){case 1:return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 3:return Ur(kt),xe(),t=a.flags,(t&65536)!==0&&(t&128)===0?(a.flags=t&-65537|128,a):null;case 26:case 27:case 5:return Ie(a),null;case 31:if(a.memoizedState!==null){if(zn(a),a.alternate===null)throw Error(i(340));si()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 13:if(zn(a),t=a.memoizedState,t!==null&&t.dehydrated!==null){if(a.alternate===null)throw Error(i(340));si()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 19:return N(Ot),null;case 4:return xe(),null;case 10:return Ur(a.type),null;case 22:case 23:return zn(a),of(),t!==null&&N(ci),t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 24:return Ur(kt),null;case 25:return null;default:return null}}function zy(t,a){switch(qd(a),a.tag){case 3:Ur(kt),xe();break;case 26:case 27:case 5:Ie(a);break;case 4:xe();break;case 31:a.memoizedState!==null&&zn(a);break;case 13:zn(a);break;case 19:N(Ot);break;case 10:Ur(a.type);break;case 22:case 23:zn(a),of(),t!==null&&N(ci);break;case 24:Ur(kt)}}function So(t,a){try{var s=a.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var h=c.next;s=h;do{if((s.tag&t)===t){c=void 0;var g=s.create,C=s.inst;c=g(),C.destroy=c}s=s.next}while(s!==h)}}catch(j){at(a,a.return,j)}}function ya(t,a,s){try{var c=a.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var g=h.next;c=g;do{if((c.tag&t)===t){var C=c.inst,j=C.destroy;if(j!==void 0){C.destroy=void 0,h=a;var k=s,G=j;try{G()}catch(ie){at(h,k,ie)}}}c=c.next}while(c!==g)}}catch(ie){at(a,a.return,ie)}}function ky(t){var a=t.updateQueue;if(a!==null){var s=t.stateNode;try{Ev(a,s)}catch(c){at(t,t.return,c)}}}function Ly(t,a,s){s.props=mi(t.type,t.memoizedProps),s.state=t.memoizedState;try{s.componentWillUnmount()}catch(c){at(t,a,c)}}function _o(t,a){try{var s=t.ref;if(s!==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 s=="function"?t.refCleanup=s(c):s.current=c}}catch(h){at(t,a,h)}}function Cr(t,a){var s=t.ref,c=t.refCleanup;if(s!==null)if(typeof c=="function")try{c()}catch(h){at(t,a,h)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(h){at(t,a,h)}else s.current=null}function $y(t){var a=t.type,s=t.memoizedProps,c=t.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":s.autoFocus&&c.focus();break e;case"img":s.src?c.src=s.src:s.srcSet&&(c.srcset=s.srcSet)}}catch(h){at(t,t.return,h)}}function Pf(t,a,s){try{var c=t.stateNode;VR(c,t.type,s,a),c[wn]=a}catch(h){at(t,t.return,h)}}function Iy(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Ea(t.type)||t.tag===4}function Ff(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Iy(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&&Ea(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 Vf(t,a,s){var c=t.tag;if(c===5||c===6)t=t.stateNode,a?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(t,a):(a=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,a.appendChild(t),s=s._reactRootContainer,s!=null||a.onclick!==null||(a.onclick=$r));else if(c!==4&&(c===27&&Ea(t.type)&&(s=t.stateNode,a=null),t=t.child,t!==null))for(Vf(t,a,s),t=t.sibling;t!==null;)Vf(t,a,s),t=t.sibling}function fc(t,a,s){var c=t.tag;if(c===5||c===6)t=t.stateNode,a?s.insertBefore(t,a):s.appendChild(t);else if(c!==4&&(c===27&&Ea(t.type)&&(s=t.stateNode),t=t.child,t!==null))for(fc(t,a,s),t=t.sibling;t!==null;)fc(t,a,s),t=t.sibling}function Py(t){var a=t.stateNode,s=t.memoizedProps;try{for(var c=t.type,h=a.attributes;h.length;)a.removeAttributeNode(h[0]);nn(a,c,s),a[Jt]=t,a[wn]=s}catch(g){at(t,t.return,g)}}var Zr=!1,It=!1,Uf=!1,Fy=typeof WeakSet=="function"?WeakSet:Set,Zt=null;function xR(t,a){if(t=t.containerInfo,ch=Dc,t=Jg(t),zd(t)){if("selectionStart"in t)var s={start:t.selectionStart,end:t.selectionEnd};else e:{s=(s=t.ownerDocument)&&s.defaultView||window;var c=s.getSelection&&s.getSelection();if(c&&c.rangeCount!==0){s=c.anchorNode;var h=c.anchorOffset,g=c.focusNode;c=c.focusOffset;try{s.nodeType,g.nodeType}catch{s=null;break e}var C=0,j=-1,k=-1,G=0,ie=0,oe=t,Q=null;t:for(;;){for(var ee;oe!==s||h!==0&&oe.nodeType!==3||(j=C+h),oe!==g||c!==0&&oe.nodeType!==3||(k=C+c),oe.nodeType===3&&(C+=oe.nodeValue.length),(ee=oe.firstChild)!==null;)Q=oe,oe=ee;for(;;){if(oe===t)break t;if(Q===s&&++G===h&&(j=C),Q===g&&++ie===c&&(k=C),(ee=oe.nextSibling)!==null)break;oe=Q,Q=oe.parentNode}oe=ee}s=j===-1||k===-1?null:{start:j,end:k}}else s=null}s=s||{start:0,end:0}}else s=null;for(uh={focusedElem:t,selectionRange:s},Dc=!1,Zt=a;Zt!==null;)if(a=Zt,t=a.child,(a.subtreeFlags&1028)!==0&&t!==null)t.return=a,Zt=t;else for(;Zt!==null;){switch(a=Zt,g=a.alternate,t=a.flags,a.tag){case 0:if((t&4)!==0&&(t=a.updateQueue,t=t!==null?t.events:null,t!==null))for(s=0;s title"))),nn(g,c,s),g[Jt]=t,Gt(g),c=g;break e;case"link":var C=G0("link","href",h).get(c+(s.href||""));if(C){for(var j=0;jlt&&(C=lt,lt=De,De=C);var H=Qg(j,De),$=Qg(j,lt);if(H&&$&&(ee.rangeCount!==1||ee.anchorNode!==H.node||ee.anchorOffset!==H.offset||ee.focusNode!==$.node||ee.focusOffset!==$.offset)){var q=oe.createRange();q.setStart(H.node,H.offset),ee.removeAllRanges(),De>lt?(ee.addRange(q),ee.extend($.node,$.offset)):(q.setEnd($.node,$.offset),ee.addRange(q))}}}}for(oe=[],ee=j;ee=ee.parentNode;)ee.nodeType===1&&oe.push({element:ee,left:ee.scrollLeft,top:ee.scrollTop});for(typeof j.focus=="function"&&j.focus(),j=0;js?32:s,L.T=null,s=Yf,Yf=null;var g=Sa,C=Jr;if(Ut=0,ms=Sa=null,Jr=0,(tt&6)!==0)throw Error(i(331));var j=tt;if(tt|=4,Xy(g.current),Ky(g,g.current,C,s),tt=j,Oo(0,!1),ce&&typeof ce.onPostCommitFiberRoot=="function")try{ce.onPostCommitFiberRoot(U,g)}catch{}return!0}finally{K.p=h,L.T=c,p0(t,a)}}function v0(t,a,s){a=qn(s,a),a=Tf(t.stateNode,a,2),t=pa(t,a,2),t!==null&&(St(t,2),Er(t))}function at(t,a,s){if(t.tag===3)v0(t,t,s);else for(;a!==null;){if(a.tag===3){v0(a,t,s);break}else if(a.tag===1){var c=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(wa===null||!wa.has(c))){t=qn(s,t),s=yy(2),c=pa(a,s,2),c!==null&&(by(s,c,a,t),St(c,2),Er(c));break}}a=a.return}}function Wf(t,a,s){var c=t.pingCache;if(c===null){c=t.pingCache=new _R;var h=new Set;c.set(a,h)}else h=c.get(a),h===void 0&&(h=new Set,c.set(a,h));h.has(s)||(qf=!0,h.add(s),t=TR.bind(null,t,a,s),a.then(t,t))}function TR(t,a,s){var c=t.pingCache;c!==null&&c.delete(a),t.pingedLanes|=t.suspendedLanes&s,t.warmLanes&=~s,ft===t&&(Ge&s)===s&&(Et===4||Et===3&&(Ge&62914560)===Ge&&300>Dt()-pc?(tt&2)===0&&ps(t,0):Gf|=s,hs===Ge&&(hs=0)),Er(t)}function y0(t,a){a===0&&(a=qt()),t=ai(t,a),t!==null&&(St(t,a),Er(t))}function OR(t){var a=t.memoizedState,s=0;a!==null&&(s=a.retryLane),y0(t,s)}function AR(t,a){var s=0;switch(t.tag){case 31:case 13:var c=t.stateNode,h=t.memoizedState;h!==null&&(s=h.retryLane);break;case 19:c=t.stateNode;break;case 22:c=t.stateNode._retryCache;break;default:throw Error(i(314))}c!==null&&c.delete(a),y0(t,s)}function MR(t,a){return rr(t,a)}var Sc=null,vs=null,eh=!1,_c=!1,th=!1,Ca=0;function Er(t){t!==vs&&t.next===null&&(vs===null?Sc=vs=t:vs=vs.next=t),_c=!0,eh||(eh=!0,DR())}function Oo(t,a){if(!th&&_c){th=!0;do for(var s=!1,c=Sc;c!==null;){if(t!==0){var h=c.pendingLanes;if(h===0)var g=0;else{var C=c.suspendedLanes,j=c.pingedLanes;g=(1<<31-ne(42|t)+1)-1,g&=h&~(C&~j),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(s=!0,S0(c,g))}else g=Ge,g=Ne(c,c===ft?g:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(g&3)===0||ht(c,g)||(s=!0,S0(c,g));c=c.next}while(s);th=!1}}function NR(){b0()}function b0(){_c=eh=!1;var t=0;Ca!==0&&HR()&&(t=Ca);for(var a=Dt(),s=null,c=Sc;c!==null;){var h=c.next,g=x0(c,a);g===0?(c.next=null,s===null?Sc=h:s.next=h,h===null&&(vs=s)):(s=c,(t!==0||(g&3)!==0)&&(_c=!0)),c=h}Ut!==0&&Ut!==5||Oo(t),Ca!==0&&(Ca=0)}function x0(t,a){for(var s=t.suspendedLanes,c=t.pingedLanes,h=t.expirationTimes,g=t.pendingLanes&-62914561;0j)break;var ie=k.transferSize,oe=k.initiatorType;ie&&A0(oe)&&(k=k.responseEnd,C+=ie*(k"u"?null:document;function U0(t,a,s){var c=ys;if(c&&typeof a=="string"&&a){var h=Hn(a);h='link[rel="'+t+'"][href="'+h+'"]',typeof s=="string"&&(h+='[crossorigin="'+s+'"]'),V0.has(h)||(V0.add(h),t={rel:t,crossOrigin:s,href:a},c.querySelector(h)===null&&(a=c.createElement("link"),nn(a,"link",t),Gt(a),c.head.appendChild(a)))}}function JR(t){Wr.D(t),U0("dns-prefetch",t,null)}function WR(t,a){Wr.C(t,a),U0("preconnect",t,a)}function e2(t,a,s){Wr.L(t,a,s);var c=ys;if(c&&t&&a){var h='link[rel="preload"][as="'+Hn(a)+'"]';a==="image"&&s&&s.imageSrcSet?(h+='[imagesrcset="'+Hn(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(h+='[imagesizes="'+Hn(s.imageSizes)+'"]')):h+='[href="'+Hn(t)+'"]';var g=h;switch(a){case"style":g=bs(t);break;case"script":g=xs(t)}Xn.has(g)||(t=v({rel:"preload",href:a==="image"&&s&&s.imageSrcSet?void 0:t,as:a},s),Xn.set(g,t),c.querySelector(h)!==null||a==="style"&&c.querySelector(Do(g))||a==="script"&&c.querySelector(zo(g))||(a=c.createElement("link"),nn(a,"link",t),Gt(a),c.head.appendChild(a)))}}function t2(t,a){Wr.m(t,a);var s=ys;if(s&&t){var c=a&&typeof a.as=="string"?a.as:"script",h='link[rel="modulepreload"][as="'+Hn(c)+'"][href="'+Hn(t)+'"]',g=h;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=xs(t)}if(!Xn.has(g)&&(t=v({rel:"modulepreload",href:t},a),Xn.set(g,t),s.querySelector(h)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(zo(g)))return}c=s.createElement("link"),nn(c,"link",t),Gt(c),s.head.appendChild(c)}}}function n2(t,a,s){Wr.S(t,a,s);var c=ys;if(c&&t){var h=Vi(c).hoistableStyles,g=bs(t);a=a||"default";var C=h.get(g);if(!C){var j={loading:0,preload:null};if(C=c.querySelector(Do(g)))j.loading=5;else{t=v({rel:"stylesheet",href:t,"data-precedence":a},s),(s=Xn.get(g))&&vh(t,s);var k=C=c.createElement("link");Gt(k),nn(k,"link",t),k._p=new Promise(function(G,ie){k.onload=G,k.onerror=ie}),k.addEventListener("load",function(){j.loading|=1}),k.addEventListener("error",function(){j.loading|=2}),j.loading|=4,Tc(C,a,c)}C={type:"stylesheet",instance:C,count:1,state:j},h.set(g,C)}}}function r2(t,a){Wr.X(t,a);var s=ys;if(s&&t){var c=Vi(s).hoistableScripts,h=xs(t),g=c.get(h);g||(g=s.querySelector(zo(h)),g||(t=v({src:t,async:!0},a),(a=Xn.get(h))&&yh(t,a),g=s.createElement("script"),Gt(g),nn(g,"link",t),s.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},c.set(h,g))}}function a2(t,a){Wr.M(t,a);var s=ys;if(s&&t){var c=Vi(s).hoistableScripts,h=xs(t),g=c.get(h);g||(g=s.querySelector(zo(h)),g||(t=v({src:t,async:!0,type:"module"},a),(a=Xn.get(h))&&yh(t,a),g=s.createElement("script"),Gt(g),nn(g,"link",t),s.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},c.set(h,g))}}function H0(t,a,s,c){var h=(h=le.current)?jc(h):null;if(!h)throw Error(i(446));switch(t){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(a=bs(s.href),s=Vi(h).hoistableStyles,c=s.get(a),c||(c={type:"style",instance:null,count:0,state:null},s.set(a,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){t=bs(s.href);var g=Vi(h).hoistableStyles,C=g.get(t);if(C||(h=h.ownerDocument||h,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(t,C),(g=h.querySelector(Do(t)))&&!g._p&&(C.instance=g,C.state.loading=5),Xn.has(t)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},Xn.set(t,s),g||i2(h,t,s,C.state))),a&&c===null)throw Error(i(528,""));return C}if(a&&c!==null)throw Error(i(529,""));return null;case"script":return a=s.async,s=s.src,typeof s=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=xs(s),s=Vi(h).hoistableScripts,c=s.get(a),c||(c={type:"script",instance:null,count:0,state:null},s.set(a,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,t))}}function bs(t){return'href="'+Hn(t)+'"'}function Do(t){return'link[rel="stylesheet"]['+t+"]"}function B0(t){return v({},t,{"data-precedence":t.precedence,precedence:null})}function i2(t,a,s,c){t.querySelector('link[rel="preload"][as="style"]['+a+"]")?c.loading=1:(a=t.createElement("link"),c.preload=a,a.addEventListener("load",function(){return c.loading|=1}),a.addEventListener("error",function(){return c.loading|=2}),nn(a,"link",s),Gt(a),t.head.appendChild(a))}function xs(t){return'[src="'+Hn(t)+'"]'}function zo(t){return"script[async]"+t}function q0(t,a,s){if(a.count++,a.instance===null)switch(a.type){case"style":var c=t.querySelector('style[data-href~="'+Hn(s.href)+'"]');if(c)return a.instance=c,Gt(c),c;var h=v({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return c=(t.ownerDocument||t).createElement("style"),Gt(c),nn(c,"style",h),Tc(c,s.precedence,t),a.instance=c;case"stylesheet":h=bs(s.href);var g=t.querySelector(Do(h));if(g)return a.state.loading|=4,a.instance=g,Gt(g),g;c=B0(s),(h=Xn.get(h))&&vh(c,h),g=(t.ownerDocument||t).createElement("link"),Gt(g);var C=g;return C._p=new Promise(function(j,k){C.onload=j,C.onerror=k}),nn(g,"link",c),a.state.loading|=4,Tc(g,s.precedence,t),a.instance=g;case"script":return g=xs(s.src),(h=t.querySelector(zo(g)))?(a.instance=h,Gt(h),h):(c=s,(h=Xn.get(g))&&(c=v({},s),yh(c,h)),t=t.ownerDocument||t,h=t.createElement("script"),Gt(h),nn(h,"link",c),t.head.appendChild(h),a.instance=h);case"void":return null;default:throw Error(i(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(c=a.instance,a.state.loading|=4,Tc(c,s.precedence,t));return a.instance}function Tc(t,a,s){for(var c=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=c.length?c[c.length-1]:null,g=h,C=0;C title"):null)}function s2(t,a,s){if(s===1||a.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(t=a.disabled,typeof a.precedence=="string"&&t==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function K0(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function o2(t,a,s,c){if(s.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var h=bs(c.href),g=a.querySelector(Do(h));if(g){a=g._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(t.count++,t=Ac.bind(t),a.then(t,t)),s.state.loading|=4,s.instance=g,Gt(g);return}g=a.ownerDocument||a,c=B0(c),(h=Xn.get(h))&&vh(c,h),g=g.createElement("link"),Gt(g);var C=g;C._p=new Promise(function(j,k){C.onload=j,C.onerror=k}),nn(g,"link",c),s.instance=g}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(s,a),(a=s.state.preload)&&(s.state.loading&3)===0&&(t.count++,s=Ac.bind(t),a.addEventListener("load",s),a.addEventListener("error",s))}}var bh=0;function l2(t,a){return t.stylesheets&&t.count===0&&Nc(t,t.stylesheets),0bh?50:800)+a);return t.unsuspend=s,function(){t.unsuspend=null,clearTimeout(c),clearTimeout(h)}}:null}function Ac(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Nc(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Mc=null;function Nc(t,a){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Mc=new Map,a.forEach(c2,t),Mc=null,Ac.call(t))}function c2(t,a){if(!(a.state.loading&4)){var s=Mc.get(t);if(s)var c=s.get(null);else{s=new Map,Mc.set(t,s);for(var h=t.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Th.exports=E2(),Th.exports}var j2=R2(),pl=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(){}},T2=class extends pl{#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"}},rp=new T2,O2={setTimeout:(e,n)=>setTimeout(e,n),clearTimeout:e=>clearTimeout(e),setInterval:(e,n)=>setInterval(e,n),clearInterval:e=>clearInterval(e)},A2=class{#e=O2;#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)}},xi=new A2;function M2(e){setTimeout(e,0)}var N2=typeof window>"u"||"Deno"in globalThis;function On(){}function D2(e,n){return typeof e=="function"?e(n):e}function um(e){return typeof e=="number"&&e>=0&&e!==1/0}function ww(e,n){return Math.max(e+(n||0)-Date.now(),0)}function La(e,n){return typeof e=="function"?e(n):e}function In(e,n){return typeof e=="function"?e(n):e}function yb(e,n){const{type:r="all",exact:i,fetchStatus:o,predicate:l,queryKey:u,stale:d}=e;if(u){if(i){if(n.queryHash!==ap(u,n.options))return!1}else if(!nl(n.queryKey,u))return!1}if(r!=="all"){const p=n.isActive();if(r==="active"&&!p||r==="inactive"&&p)return!1}return!(typeof d=="boolean"&&n.isStale()!==d||o&&o!==n.state.fetchStatus||l&&!l(n))}function bb(e,n){const{exact:r,status:i,predicate:o,mutationKey:l}=e;if(l){if(!n.options.mutationKey)return!1;if(r){if(tl(n.options.mutationKey)!==tl(l))return!1}else if(!nl(n.options.mutationKey,l))return!1}return!(i&&n.state.status!==i||o&&!o(n))}function ap(e,n){return(n?.queryKeyHashFn||tl)(e)}function tl(e){return JSON.stringify(e,(n,r)=>fm(r)?Object.keys(r).sort().reduce((i,o)=>(i[o]=r[o],i),{}):r)}function nl(e,n){return e===n?!0:typeof e!=typeof n?!1:e&&n&&typeof e=="object"&&typeof n=="object"?Object.keys(n).every(r=>nl(e[r],n[r])):!1}var z2=Object.prototype.hasOwnProperty;function Sw(e,n,r=0){if(e===n)return e;if(r>500)return n;const i=xb(e)&&xb(n);if(!i&&!(fm(e)&&fm(n)))return n;const l=(i?e:Object.keys(e)).length,u=i?n:Object.keys(n),d=u.length,p=i?new Array(d):{};let m=0;for(let y=0;y{xi.setTimeout(n,e)})}function hm(e,n,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,n):r.structuralSharing!==!1?Sw(e,n):n}function L2(e,n,r=0){const i=[...e,n];return r&&i.length>r?i.slice(1):i}function $2(e,n,r=0){const i=[n,...e];return r&&i.length>r?i.slice(0,-1):i}var ip=Symbol();function _w(e,n){return!e.queryFn&&n?.initialPromise?()=>n.initialPromise:!e.queryFn||e.queryFn===ip?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Cw(e,n){return typeof e=="function"?e(...n):!!e}function I2(e,n,r){let i=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??=n(),i||(i=!0,o.aborted?r():o.addEventListener("abort",r,{once:!0})),o)}),e}var rl=(()=>{let e=()=>N2;return{isServer(){return e()},setIsServer(n){e=n}}})();function mm(){let e,n;const r=new Promise((o,l)=>{e=o,n=l});r.status="pending",r.catch(()=>{});function i(o){Object.assign(r,o),delete r.resolve,delete r.reject}return r.resolve=o=>{i({status:"fulfilled",value:o}),e(o)},r.reject=o=>{i({status:"rejected",reason:o}),n(o)},r}var P2=M2;function F2(){let e=[],n=0,r=d=>{d()},i=d=>{d()},o=P2;const l=d=>{n?e.push(d):o(()=>{r(d)})},u=()=>{const d=e;e=[],d.length&&o(()=>{i(()=>{d.forEach(p=>{r(p)})})})};return{batch:d=>{let p;n++;try{p=d()}finally{n--,n||u()}return p},batchCalls:d=>(...p)=>{l(()=>{d(...p)})},schedule:l,setNotifyFunction:d=>{r=d},setBatchNotifyFunction:d=>{i=d},setScheduler:d=>{o=d}}}var sn=F2(),V2=class extends pl{#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}},fu=new V2;function U2(e){return Math.min(1e3*2**e,3e4)}function Ew(e){return(e??"online")==="online"?fu.isOnline():!0}var pm=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Rw(e){let n=!1,r=0,i;const o=mm(),l=()=>o.status!=="pending",u=_=>{if(!l()){const E=new pm(_);b(E),e.onCancel?.(E)}},d=()=>{n=!0},p=()=>{n=!1},m=()=>rp.isFocused()&&(e.networkMode==="always"||fu.isOnline())&&e.canRun(),y=()=>Ew(e.networkMode)&&e.canRun(),v=_=>{l()||(i?.(),o.resolve(_))},b=_=>{l()||(i?.(),o.reject(_))},x=()=>new Promise(_=>{i=E=>{(l()||m())&&_(E)},e.onPause?.()}).then(()=>{i=void 0,l()||e.onContinue?.()}),S=()=>{if(l())return;let _;const E=r===0?e.initialPromise:void 0;try{_=E??e.fn()}catch(R){_=Promise.reject(R)}Promise.resolve(_).then(v).catch(R=>{if(l())return;const T=e.retry??(rl.isServer()?0:3),O=e.retryDelay??U2,M=typeof O=="function"?O(r,R):O,D=T===!0||typeof T=="number"&&rm()?void 0:x()).then(()=>{n?b(R):S()})})};return{promise:o,status:()=>o.status,cancel:u,continue:()=>(i?.(),o),cancelRetry:d,continueRetry:p,canStart:y,start:()=>(y()?S():x().then(S),o)}}var jw=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),um(this.gcTime)&&(this.#e=xi.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(rl.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(xi.clearTimeout(this.#e),this.#e=void 0)}};function H2(e){return{onFetch:(n,r)=>{const i=n.options,o=n.fetchOptions?.meta?.fetchMore?.direction,l=n.state.data?.pages||[],u=n.state.data?.pageParams||[];let d={pages:[],pageParams:[]},p=0;const m=async()=>{let y=!1;const v=S=>{I2(S,()=>n.signal,()=>y=!0)},b=_w(n.options,n.fetchOptions),x=async(S,_,E)=>{if(y)return Promise.reject(n.signal.reason);if(_==null&&S.pages.length)return Promise.resolve(S);const T=(()=>{const P={client:n.client,queryKey:n.queryKey,pageParam:_,direction:E?"backward":"forward",meta:n.options.meta};return v(P),P})(),O=await b(T),{maxPages:M}=n.options,D=E?$2:L2;return{pages:D(S.pages,O,M),pageParams:D(S.pageParams,_,M)}};if(o&&l.length){const S=o==="backward",_=S?Tw:gm,E={pages:l,pageParams:u},R=_(i,E);d=await x(E,R,S)}else{const S=e??l.length;do{const _=p===0?u[0]??i.initialPageParam:gm(i,d);if(p>0&&_==null)break;d=await x(d,_),p++}while(pn.options.persister?.(m,{client:n.client,queryKey:n.queryKey,meta:n.options.meta,signal:n.signal},r):n.fetchFn=m}}}function gm(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 Tw(e,{pages:n,pageParams:r}){return n.length>0?e.getPreviousPageParam?.(n[0],n,r[0],r):void 0}function B2(e,n){return n?gm(e,n)!=null:!1}function q2(e,n){return!n||!e.getPreviousPageParam?!1:Tw(e,n)!=null}var G2=class extends jw{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=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=_b(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.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=_b(this.options);n.data!==void 0&&(this.setState(Sb(n.data,n.dataUpdatedAt)),this.#t=n)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,n){const r=hm(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.#a?.promise;return this.#a?.cancel(e),n?n.then(On).catch(On):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=>In(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ip||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>La(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:!ww(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(n=>n.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(n=>n.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.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.#a&&(this.#s||this.#u()?this.#a.cancel({revert:!0}):this.#a.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.#a?.status()!=="rejected"){if(this.state.data!==void 0&&n?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){const p=this.observers.find(m=>m.options.queryFn);p&&this.setOptions(p.options)}const r=new AbortController,i=p=>{Object.defineProperty(p,"signal",{enumerable:!0,get:()=>(this.#s=!0,r.signal)})},o=()=>{const p=_w(this.options,n),y=(()=>{const v={client:this.#i,queryKey:this.queryKey,meta:this.meta};return i(v),v})();return this.#s=!1,this.options.persister?this.options.persister(p,y,this):p(y)},u=(()=>{const p={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:o};return i(p),p})();(this.#e==="infinite"?H2(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.#a=Rw({initialPromise:n?.initialPromise,fn:u.fetchFn,onCancel:p=>{p instanceof pm&&p.revert&&this.setState({...this.#n,fetchStatus:"idle"}),r.abort()},onFail:(p,m)=>{this.#l({type:"failed",failureCount:p,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 p=await this.#a.start();if(p===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(p),this.#r.config.onSuccess?.(p,this),this.#r.config.onSettled?.(p,this.state.error,this),p}catch(p){if(p instanceof pm){if(p.silent)return this.#a.promise;if(p.revert){if(this.state.data===void 0)throw p;return this.state.data}}throw this.#l({type:"error",error:p}),this.#r.config.onError?.(p,this),this.#r.config.onSettled?.(this.state.data,p,this),p}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,...Ow(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...Sb(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 o=e.error;return{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,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 Ow(e,n){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ew(n.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Sb(e,n){return{data:e,dataUpdatedAt:n??Date.now(),error:null,isInvalidated:!1,status:"success"}}function _b(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 Aw=class extends pl{constructor(e,n){super(),this.options=n,this.#e=e,this.#s=null,this.#o=mm(),this.bindMethods(),this.setOptions(n)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#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),Cb(this.#t,this.options)?this.#h():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return vm(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return vm(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#w(),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 In(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),n._defaulted&&!dm(this.options,n)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const i=this.hasListeners();i&&Eb(this.#t,r,this.options,n)&&this.#h(),this.updateResult(),i&&(this.#t!==r||In(this.options.enabled,this.#t)!==In(n.enabled,this.#t)||La(this.options.staleTime,this.#t)!==La(n.staleTime,this.#t))&&this.#g();const o=this.#v();i&&(this.#t!==r||In(this.options.enabled,this.#t)!==In(n.enabled,this.#t)||o!==this.#c)&&this.#y(o)}getOptimisticResult(e){const n=this.#e.getQueryCache().build(this.#e,e),r=this.createResult(n,e);return K2(this,r)&&(this.#r=r,this.#a=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.#o.status==="pending"&&this.#o.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.#S();let n=this.#t.fetch(this.options,e);return e?.throwOnError||(n=n.catch(On)),n}#g(){this.#x();const e=La(this.options.staleTime,this.#t);if(rl.isServer()||this.#r.isStale||!um(e))return;const r=ww(this.#r.dataUpdatedAt,e)+1;this.#d=xi.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.#w(),this.#c=e,!(rl.isServer()||In(this.options.enabled,this.#t)===!1||!um(this.#c)||this.#c===0)&&(this.#f=xi.setInterval(()=>{(this.options.refetchIntervalInBackground||rp.isFocused())&&this.#h()},this.#c))}#b(){this.#g(),this.#y(this.#v())}#x(){this.#d!==void 0&&(xi.clearTimeout(this.#d),this.#d=void 0)}#w(){this.#f!==void 0&&(xi.clearInterval(this.#f),this.#f=void 0)}createResult(e,n){const r=this.#t,i=this.options,o=this.#r,l=this.#i,u=this.#a,p=e!==r?e.state:this.#n,{state:m}=e;let y={...m},v=!1,b;if(n._optimisticResults){const V=this.hasListeners(),ve=!V&&Cb(e,n),be=V&&Eb(e,r,n,i);(ve||be)&&(y={...y,...Ow(m.data,e.options)}),n._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:x,errorUpdatedAt:S,status:_}=y;b=y.data;let E=!1;if(n.placeholderData!==void 0&&b===void 0&&_==="pending"){let V;o?.isPlaceholderData&&n.placeholderData===u?.placeholderData?(V=o.data,E=!0):V=typeof n.placeholderData=="function"?n.placeholderData(this.#m?.state.data,this.#m):n.placeholderData,V!==void 0&&(_="success",b=hm(o?.data,V,n),v=!0)}if(n.select&&b!==void 0&&!E)if(o&&b===l?.data&&n.select===this.#u)b=this.#l;else try{this.#u=n.select,b=n.select(b),b=hm(o?.data,b,n),this.#l=b,this.#s=null}catch(V){this.#s=V}this.#s&&(x=this.#s,b=this.#l,S=Date.now(),_="error");const R=y.fetchStatus==="fetching",T=_==="pending",O=_==="error",M=T&&R,D=b!==void 0,F={status:_,fetchStatus:y.fetchStatus,isPending:T,isSuccess:_==="success",isError:O,isInitialLoading:M,isLoading:M,data:b,dataUpdatedAt:y.dataUpdatedAt,error:x,errorUpdatedAt:S,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:y.dataUpdateCount>p.dataUpdateCount||y.errorUpdateCount>p.errorUpdateCount,isFetching:R,isRefetching:R&&!T,isLoadingError:O&&!D,isPaused:y.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:O&&D,isStale:sp(e,n),refetch:this.refetch,promise:this.#o,isEnabled:In(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const V=F.data!==void 0,ve=F.status==="error"&&!V,be=X=>{ve?X.reject(F.error):V&&X.resolve(F.data)},he=()=>{const X=this.#o=F.promise=mm();be(X)},ue=this.#o;switch(ue.status){case"pending":e.queryHash===r.queryHash&&be(ue);break;case"fulfilled":(ve||F.data!==ue.value)&&he();break;case"rejected":(!ve||F.error!==ue.reason)&&he();break}}return F}updateResult(){const e=this.#r,n=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#m=this.#t),dm(n,e))return;this.#r=n;const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,o=typeof i=="function"?i():i;if(o==="all"||!o&&!this.#p.size)return!0;const l=new Set(o??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()})}#S(){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 Z2(e,n){return In(n.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&In(n.retryOnMount,e)===!1)}function Cb(e,n){return Z2(e,n)||e.state.data!==void 0&&vm(e,n,n.refetchOnMount)}function vm(e,n,r){if(In(n.enabled,e)!==!1&&La(n.staleTime,e)!=="static"){const i=typeof r=="function"?r(e):r;return i==="always"||i!==!1&&sp(e,n)}return!1}function Eb(e,n,r,i){return(e!==n||In(i.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&sp(e,r)}function sp(e,n){return In(n.enabled,e)!==!1&&e.isStaleByTime(La(n.staleTime,e))}function K2(e,n){return!dm(e.getCurrentResult(),n)}var Y2=class extends Aw{constructor(e,n){super(e,n)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,n){const{state:r}=e,i=super.createResult(e,n),{isFetching:o,isRefetching:l,isError:u,isRefetchError:d}=i,p=r.fetchMeta?.fetchMore?.direction,m=u&&p==="forward",y=o&&p==="forward",v=u&&p==="backward",b=o&&p==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:B2(n,r.data),hasPreviousPage:q2(n,r.data),isFetchNextPageError:m,isFetchingNextPage:y,isFetchPreviousPageError:v,isFetchingPreviousPage:b,isRefetchError:d&&!m&&!v,isRefetching:l&&!y&&!b}}},Q2=class extends jw{#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||X2(),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=Rw({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",o=!this.#r.canStart();try{if(i)n();else{this.#i({type:"pending",variables:e,isPaused:o}),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:o})}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 X2(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var J2=class extends pl{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 Q2({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=Fc(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=Fc(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=Fc(e);if(typeof n=="string"){const i=this.#t.get(n)?.find(o=>o.state.status==="pending");return!i||i===e}else return!0}runNext(e){const n=Fc(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=>bb(n,r))}findAll(e={}){return this.getAll().filter(n=>bb(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(On))))}};function Fc(e){return e.options.scope?.id}var W2=class extends pl{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,n,r){const i=n.queryKey,o=n.queryHash??ap(i,n);let l=this.get(o);return l||(l=new G2({client:e,queryKey:i,queryHash:o,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=>yb(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>yb(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()})})}},ej=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new W2,this.#t=e.mutationCache||new J2,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=rp.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=fu.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=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(La(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=D2(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(o=>o.cancel(r)));return Promise.all(i).then(On).catch(On)}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(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let l=o.fetch(void 0,r);return r.throwOnError||(l=l.catch(On)),o.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(i).then(On)}fetchQuery(e){const n=this.defaultQueryOptions(e);n.retry===void 0&&(n.retry=!1);const r=this.#e.build(this,n);return r.isStaleByTime(La(n.staleTime,r))?r.fetch(n):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(On).catch(On)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(On).catch(On)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return fu.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(tl(e),{queryKey:e,defaultOptions:n})}getQueryDefaults(e){const n=[...this.#r.values()],r={};return n.forEach(i=>{nl(e,i.queryKey)&&Object.assign(r,i.defaultOptions)}),r}setMutationDefaults(e,n){this.#i.set(tl(e),{mutationKey:e,defaultOptions:n})}getMutationDefaults(e){const n=[...this.#i.values()],r={};return n.forEach(i=>{nl(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=ap(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===ip&&(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()}},Mw=w.createContext(void 0),Ai=e=>{const n=w.useContext(Mw);if(!n)throw new Error("No QueryClient set, use QueryClientProvider to set one");return n},tj=({client:e,children:n})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),f.jsx(Mw.Provider,{value:e,children:n})),Nw=w.createContext(!1),nj=()=>w.useContext(Nw);Nw.Provider;function rj(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var aj=w.createContext(rj()),ij=()=>w.useContext(aj),sj=(e,n,r)=>{const i=r?.state.error&&typeof e.throwOnError=="function"?Cw(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||i)&&(n.isReset()||(e.retryOnMount=!1))},oj=e=>{w.useEffect(()=>{e.clearReset()},[e])},lj=({result:e,errorResetBoundary:n,throwOnError:r,query:i,suspense:o})=>e.isError&&!n.isReset()&&!e.isFetching&&i&&(o&&e.data===void 0||Cw(r,[e.error,i])),cj=e=>{if(e.suspense){const r=o=>o==="static"?o:Math.max(o??1e3,1e3),i=e.staleTime;e.staleTime=typeof i=="function"?(...o)=>r(i(...o)):r(i),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},uj=(e,n)=>e.isLoading&&e.isFetching&&!n,dj=(e,n)=>e?.suspense&&n.isPending,Rb=(e,n,r)=>n.fetchOptimistic(e).catch(()=>{r.clearReset()});function Dw(e,n,r){const i=nj(),o=ij(),l=Ai(),u=l.defaultQueryOptions(e);l.getDefaultOptions().queries?._experimental_beforeQuery?.(u);const d=l.getQueryCache().get(u.queryHash),p=e.subscribed!==!1;u._optimisticResults=i?"isRestoring":p?"optimistic":void 0,cj(u),sj(u,o,d),oj(o);const m=!l.getQueryCache().get(u.queryHash),[y]=w.useState(()=>new n(l,u)),v=y.getOptimisticResult(u),b=!i&&p;if(w.useSyncExternalStore(w.useCallback(x=>{const S=b?y.subscribe(sn.batchCalls(x)):On;return y.updateResult(),S},[y,b]),()=>y.getCurrentResult(),()=>y.getCurrentResult()),w.useEffect(()=>{y.setOptions(u)},[u,y]),dj(u,v))throw Rb(u,y,o);if(lj({result:v,errorResetBoundary:o,throwOnError:u.throwOnError,query:d,suspense:u.suspense}))throw v.error;return l.getDefaultOptions().queries?._experimental_afterQuery?.(u,v),u.experimental_prefetchInRender&&!rl.isServer()&&uj(v,i)&&(m?Rb(u,y,o):d?.promise)?.catch(On).finally(()=>{y.updateResult()}),u.notifyOnChangeProps?v:y.trackResult(v)}function Pt(e,n){return Dw(e,Aw)}function fj(e,n){return Dw(e,Y2)}let jb=!1;function hj(e){const n=e.analytics;if(!n?.key||jb)return;jb=!0;const r=document.createElement("script");r.src=n.host.replace(".i.posthog.com","-assets.i.posthog.com")+"/static/array.js",r.async=!0,r.onload=()=>{const i=window.posthog;i&&(i.init(n.key,{api_host:n.host,defaults:"2026-05-30",capture_pageview:"history_change",session_recording:{maskAllInputs:!0,maskTextSelector:"*"}}),e.me&&i.identify(e.me.email,{email:e.me.email,name:e.me.name,...e.billing?{plan:e.billing.plan}:{}}))},document.head.appendChild(r)}function zw(e,n){window.posthog?.capture(e,n)}const mj=[[/^POST \/api\/projects$/,"project_created"],[/^DELETE \/api\/projects\//,"project_deleted"],[/^POST \/api\/p\/[^/]+\/restore$/,"file_restored"],[/^DELETE \/api\/shares\//,"share_revoked"],[/^PATCH \/api\/shares\//,"share_expiry_changed"],[/^POST \/api\/orgs\/[^/]+\/invites$/,"invite_created"],[/^DELETE \/api\/orgs\/[^/]+\/invites\//,"invite_revoked"],[/^POST \/api\/invites\//,"invite_accepted"],[/^PUT \/api\/p\/[^/]+\/permissions\/./,"project_access_granted"],[/^DELETE \/api\/p\/[^/]+\/permissions\/./,"project_access_revoked"]];function kw(e,n){const r=e+" "+n.split("?")[0],i=mj.find(([o])=>o.test(r));i&&zw(i[1])}function op(){throw location.href="/auth/login?next="+encodeURIComponent(location.pathname+location.search),new Error("signing in…")}function pj(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 413:return"This project is over its plan limit.";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 Mu(e){throw new Error(pj(e.status,await e.text()))}async function Bt(e){const n=await fetch(e,{headers:{Accept:"application/json"}});return n.status===401&&op(),n.ok||await Mu(n),n.json()}async function gj(e){const n=await fetch(e);return n.status===401&&op(),n.ok||await Mu(n),n}async function Wn(e,n,r){const i={method:e};r!==void 0&&(i.headers={"Content-Type":"application/json"},i.body=JSON.stringify(r));const o=await fetch(n,i);return o.ok||await Mu(o),kw(e,n),o.status===204?{}:o.json()}async function Si(e,n){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n||{})});return r.status===401&&op(),r.ok||await Mu(r),kw("POST",e),r.json()}function vj(){return Pt({queryKey:["config"],queryFn:async()=>{const e=await Bt("/api/config");return e.auth.enabled&&!e.me&&(location.href="/auth/login?next="+encodeURIComponent(location.pathname+location.search),await new Promise(()=>{})),hj(e),e},staleTime:1/0})}var Mi=xw();const yj=bw(Mi);function Tb(e,n){if(typeof e=="function")return e(n);e!=null&&(e.current=n)}function Ps(...e){return n=>{let r=!1;const i=e.map(o=>{const l=Tb(o,n);return!r&&typeof l=="function"&&(r=!0),l});if(r)return()=>{for(let o=0;o{let{children:o,...l}=r,u=null,d=!1;const p=[];Ob(o)&&typeof Vc=="function"&&(o=Vc(o._payload)),w.Children.forEach(o,b=>{if(Cj(b)){d=!0;const x=b;let S="child"in x.props?x.props.child:x.props.children;Ob(S)&&typeof Vc=="function"&&(S=Vc(S._payload)),u=wj(x,S),p.push(u?.props?.children)}else p.push(b)}),u?u=w.cloneElement(u,void 0,p):!d&&w.Children.count(o)===1&&w.isValidElement(o)&&(u=o);const m=u?_j(u):void 0,y=nt(i,m);if(!u){if(o||o===0)throw new Error(d?Tj(e):jj(e));return o}const v=Sj(l,u.props??{});return u.type!==w.Fragment&&(v.ref=i?y:m),w.cloneElement(u,v)});return n.displayName=`${e}.Slot`,n}var bj=_i("Slot"),Lw=Symbol.for("radix.slottable");function xj(e){const n=r=>"child"in r?r.children(r.child):r.children;return n.displayName=`${e}.Slottable`,n.__radixId=Lw,n}var wj=(e,n)=>{if("child"in e.props){const r=e.props.child;return w.isValidElement(r)?w.cloneElement(r,void 0,e.props.children(r.props.children)):null}return w.isValidElement(n)?n:null};function Sj(e,n){const r={...n};for(const i in n){const o=e[i],l=n[i];/^on[A-Z]/.test(i)?o&&l?r[i]=(...d)=>{const p=l(...d);return o(...d),p}:o&&(r[i]=o):i==="style"?r[i]={...o,...l}:i==="className"&&(r[i]=[o,l].filter(Boolean).join(" "))}return{...e,...r}}function _j(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 Cj(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Lw}var Ej=Symbol.for("react.lazy");function Ob(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Ej&&"_payload"in e&&Rj(e._payload)}function Rj(e){return typeof e=="object"&&e!==null&&"then"in e}var jj=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Tj=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Vc=Au[" use ".trim().toString()],Oj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$e=Oj.reduce((e,n)=>{const r=_i(`Primitive.${n}`),i=w.forwardRef((o,l)=>{const{asChild:u,...d}=o,p=u?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(p,{...d,ref:l})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{});function $w(e,n){e&&Mi.flushSync(()=>e.dispatchEvent(n))}var Iw=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"}),Aj="VisuallyHidden",Pw=w.forwardRef((e,n)=>f.jsx($e.span,{...e,ref:n,style:{...Iw,...e.style}}));Pw.displayName=Aj;var Mj=Pw;function Ga(e,n=[]){let r=[];function i(l,u){const d=w.createContext(u);d.displayName=l+"Context";const p=r.length;r=[...r,u];const m=v=>{const{scope:b,children:x,...S}=v,_=b?.[e]?.[p]||d,E=w.useMemo(()=>S,Object.values(S));return f.jsx(_.Provider,{value:E,children:x})};m.displayName=l+"Provider";function y(v,b,x={}){const{optional:S=!1}=x,_=b?.[e]?.[p]||d,E=w.useContext(_);if(E)return E;if(u!==void 0)return u;if(!S)throw new Error(`\`${v}\` must be used within \`${l}\``)}return[m,y]}const o=()=>{const l=r.map(u=>w.createContext(u));return function(d){const p=d?.[e]||l;return w.useMemo(()=>({[`__scope${e}`]:{...d,[e]:p}}),[d,p])}};return o.scopeName=e,[i,Nj(o,...n)]}function Nj(...e){const n=e[0];if(e.length===1)return n;const r=()=>{const i=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(l){const u=i.reduce((d,{useScope:p,scopeName:m})=>{const v=p(l)[`__scope${m}`];return{...d,...v}},{});return w.useMemo(()=>({[`__scope${n.scopeName}`]:u}),[u])}};return r.scopeName=n.scopeName,r}function lp(e){const n=e+"CollectionProvider",[r,i]=Ga(n),[o,l]=r(n,{collectionRef:{current:null},itemMap:new Map}),u=_=>{const{scope:E,children:R}=_,T=w.useRef(null),O=w.useRef(new Map).current;return f.jsx(o,{scope:E,itemMap:O,collectionRef:T,children:R})};u.displayName=n;const d=e+"CollectionSlot",p=_i(d),m=w.forwardRef((_,E)=>{const{scope:R,children:T}=_,O=l(d,R),M=nt(E,O.collectionRef);return f.jsx(p,{ref:M,children:T})});m.displayName=d;const y=e+"CollectionItemSlot",v="data-radix-collection-item",b=_i(y),x=w.forwardRef((_,E)=>{const{scope:R,children:T,...O}=_,M=w.useRef(null),D=nt(E,M),P=l(y,R);return w.useEffect(()=>(P.itemMap.set(M,{ref:M,...O}),()=>{P.itemMap.delete(M)})),f.jsx(b,{[v]:"",ref:D,children:T})});x.displayName=y;function S(_){const E=l(e+"CollectionConsumer",_);return w.useCallback(()=>{const T=E.collectionRef.current;if(!T)return[];const O=Array.from(T.querySelectorAll(`[${v}]`));return Array.from(E.itemMap.values()).sort((P,F)=>O.indexOf(P.ref.current)-O.indexOf(F.ref.current))},[E.collectionRef,E.itemMap])}return[{Provider:u,Slot:m,ItemSlot:x},S,i]}function je(e,n,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e?.(o),r===!1||!o||!o.defaultPrevented)return n?.(o)}}var Yt=globalThis?.document?w.useLayoutEffect:()=>{},Dj=Au[" useInsertionEffect ".trim().toString()]||Yt;function Fs({prop:e,defaultProp:n,onChange:r=()=>{},caller:i}){const[o,l,u]=zj({defaultProp:n,onChange:r}),d=e!==void 0,p=d?e:o;{const y=w.useRef(e!==void 0);w.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=w.useCallback(y=>{if(d){const v=kj(y)?y(e):y;v!==e&&u.current?.(v)}else l(y)},[d,e,l,u]);return[p,m]}function zj({defaultProp:e,onChange:n}){const[r,i]=w.useState(e),o=w.useRef(r),l=w.useRef(n);return Dj(()=>{l.current=n},[n]),w.useEffect(()=>{o.current!==r&&(l.current?.(r),o.current=r)},[r,o]),[r,i,l]}function kj(e){return typeof e=="function"}function Lj(e,n){return w.useReducer((r,i)=>n[r][i]??r,e)}var vr=e=>{const{present:n,children:r}=e,i=$j(n),o=typeof r=="function"?r({present:i.isPresent}):w.Children.only(r),l=Ij(i.ref,Pj(o));return typeof r=="function"||i.isPresent?w.cloneElement(o,{ref:l}):null};vr.displayName="Presence";function $j(e){const[n,r]=w.useState(),i=w.useRef(null),o=w.useRef(e),l=w.useRef("none"),u=w.useRef(void 0),d=e?"mounted":"unmounted",[p,m]=Lj(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{p==="mounted"?(l.current=u.current??Vo(i.current),u.current=void 0):l.current="none"},[p]),Yt(()=>{const y=i.current,v=o.current;if(v!==e){const x=l.current,S=Vo(y);e?(u.current=S,m("MOUNT")):S==="none"||y?.display==="none"?m("UNMOUNT"):m(v&&x!==S?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,m]),Yt(()=>{if(n){let y;const v=n.ownerDocument.defaultView??window,b=S=>{const E=Vo(i.current).includes(CSS.escape(S.animationName));if(S.target===n&&E&&(m("ANIMATION_END"),!o.current)){const R=n.style.animationFillMode;n.style.animationFillMode="forwards",y=v.setTimeout(()=>{n.style.animationFillMode==="forwards"&&(n.style.animationFillMode=R)})}},x=S=>{S.target===n&&(l.current=Vo(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(p),ref:w.useCallback(y=>{if(y){const v=getComputedStyle(y);i.current=v,u.current=Vo(v)}else i.current=null;r(y)},[])}}function Ab(e,n){if(typeof e=="function")return e(n);e!=null&&(e.current=n)}function Ij(...e){const n=w.useRef(e);return n.current=e,w.useCallback(r=>{const i=n.current;let o=!1;const l=i.map(u=>{const d=Ab(u,r);return!o&&typeof d=="function"&&(o=!0),d});if(o)return()=>{for(let u=0;u{}),Vj=0;function dn(e){const[n,r]=w.useState(Fj());return Yt(()=>{r(i=>i??String(Vj++))},[e]),n?`radix-${n}`:""}var Uj=w.createContext(void 0);function cp(e){const n=w.useContext(Uj);return e||n||"ltr"}function tr(e){const n=w.useRef(e);return w.useEffect(()=>{n.current=e}),w.useMemo(()=>((...r)=>n.current?.(...r)),[])}var Hj="DismissableLayer",ym="dismissableLayer.update",Bj="dismissableLayer.pointerDownOutside",qj="dismissableLayer.focusOutside",Mb,up=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),gl=w.forwardRef((e,n)=>{const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,onDismiss:p,...m}=e,y=w.useContext(up),[v,b]=w.useState(null),x=v?.ownerDocument??globalThis?.document,[,S]=w.useState({}),_=nt(n,b),E=Array.from(y.layers),[R]=[...y.layersWithOutsidePointerEventsDisabled].slice(-1),T=R?E.indexOf(R):-1,O=v?E.indexOf(v):-1,M=y.layersWithOutsidePointerEventsDisabled.size>0,D=O>=T,P=w.useRef(!1),F=Qj(he=>{l?.(he),d?.(he),he.defaultPrevented||p?.()},{ownerDocument:x,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:P,dismissableSurfaces:y.dismissableSurfaces,shouldHandlePointerDownOutside:w.useCallback(he=>{if(!(he instanceof Node))return!1;const ue=[...y.branches].some(X=>X.contains(he));return D&&!ue},[y.branches,D])}),V=Xj(he=>{if(i&&P.current)return;const ue=he.target;[...y.branches].some(pe=>pe.contains(ue))||(u?.(he),d?.(he),he.defaultPrevented||p?.())},x),ve=v?O===E.length-1:!1,be=tr(he=>{he.key==="Escape"&&(o?.(he),!he.defaultPrevented&&p&&(he.preventDefault(),p()))});return w.useEffect(()=>{if(ve)return x.addEventListener("keydown",be,{capture:!0}),()=>x.removeEventListener("keydown",be,{capture:!0})},[x,ve,be]),w.useEffect(()=>{if(v)return r&&(y.layersWithOutsidePointerEventsDisabled.size===0&&(Mb=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),y.layersWithOutsidePointerEventsDisabled.add(v)),y.layers.add(v),Nb(),()=>{r&&(y.layersWithOutsidePointerEventsDisabled.delete(v),y.layersWithOutsidePointerEventsDisabled.size===0&&(x.body.style.pointerEvents=Mb))}},[v,x,r,y]),w.useEffect(()=>()=>{v&&(y.layers.delete(v),y.layersWithOutsidePointerEventsDisabled.delete(v),Nb())},[v,y]),w.useEffect(()=>{const he=()=>S({});return document.addEventListener(ym,he),()=>document.removeEventListener(ym,he)},[]),f.jsx($e.div,{...m,ref:_,style:{pointerEvents:M?D?"auto":"none":void 0,...e.style},onFocusCapture:je(e.onFocusCapture,V.onFocusCapture),onBlurCapture:je(e.onBlurCapture,V.onBlurCapture),onPointerDownCapture:je(e.onPointerDownCapture,F.onPointerDownCapture)})});gl.displayName=Hj;var Gj="DismissableLayerBranch",Zj=w.forwardRef((e,n)=>{const r=w.useContext(up),i=w.useRef(null),o=nt(n,i);return w.useEffect(()=>{const l=i.current;if(l)return r.branches.add(l),()=>{r.branches.delete(l)}},[r.branches]),f.jsx($e.div,{...e,ref:o})});Zj.displayName=Gj;function Kj(){const e=w.useContext(up),[n,r]=w.useState(null);return w.useEffect(()=>{if(n)return e.dismissableSurfaces.add(n),()=>{e.dismissableSurfaces.delete(n)}},[n,e.dismissableSurfaces]),r}var Yj=()=>!0;function Qj(e,n){const{ownerDocument:r=globalThis?.document,deferPointerDownOutside:i=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:l,shouldHandlePointerDownOutside:u=Yj}=n,d=tr(e),p=w.useRef(!1),m=w.useRef(!1),y=w.useRef(new Map),v=w.useRef(()=>{});return w.useEffect(()=>{function b(){m.current=!1,o.current=!1,y.current.clear()}function x(){return Array.from(y.current.values()).some(Boolean)}function S(O){if(!m.current)return;const M=O.target;M instanceof Node&&[...l].some(P=>P.contains(M))||y.current.set(O.type,!0),O.type==="click"&&window.setTimeout(()=>{m.current&&v.current()},0)}function _(O){m.current&&y.current.set(O.type,!1)}const E=O=>{if(O.target&&!p.current){let M=function(){r.removeEventListener("click",v.current);const P=x();b(),P||Fw(Bj,d,D,{discrete:!0})};if(!u(O.target)){r.removeEventListener("click",v.current),b(),p.current=!1;return}const D={originalEvent:O};m.current=!0,o.current=i&&O.button===0,y.current.clear(),!i||O.button!==0?M():(r.removeEventListener("click",v.current),v.current=M,r.addEventListener("click",v.current,{once:!0}))}else r.removeEventListener("click",v.current),b();p.current=!1},R=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const O of R)r.addEventListener(O,S,!0),r.addEventListener(O,_);const T=window.setTimeout(()=>{r.addEventListener("pointerdown",E)},0);return()=>{window.clearTimeout(T),r.removeEventListener("pointerdown",E),r.removeEventListener("click",v.current);for(const O of R)r.removeEventListener(O,S,!0),r.removeEventListener(O,_)}},[r,d,i,o,l,u]),{onPointerDownCapture:()=>p.current=!0}}function Xj(e,n=globalThis?.document){const r=tr(e),i=w.useRef(!1);return w.useEffect(()=>{const o=l=>{l.target&&!i.current&&Fw(qj,r,{originalEvent:l},{discrete:!1})};return n.addEventListener("focusin",o),()=>n.removeEventListener("focusin",o)},[n,r]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function Nb(){const e=new CustomEvent(ym);document.dispatchEvent(e)}function Fw(e,n,r,{discrete:i}){const o=r.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});n&&o.addEventListener(e,n,{once:!0}),i?$w(o,l):o.dispatchEvent(l)}var Nh="focusScope.autoFocusOnMount",Dh="focusScope.autoFocusOnUnmount",Db={bubbles:!1,cancelable:!0},Jj="FocusScope",Nu=w.forwardRef((e,n)=>{const{loop:r=!1,trapped:i=!1,onMountAutoFocus:o,onUnmountAutoFocus:l,...u}=e,[d,p]=w.useState(null),m=tr(o),y=tr(l),v=w.useRef(null),b=nt(n,p),x=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(i){let _=function(O){if(x.paused||!d)return;const M=O.target;d.contains(M)?v.current=M:Na(v.current,{select:!0})},E=function(O){if(x.paused||!d)return;const M=O.relatedTarget;M!==null&&(d.contains(M)||Na(v.current,{select:!0}))},R=function(O){if(document.activeElement===document.body)for(const D of O)D.removedNodes.length>0&&Na(d)};document.addEventListener("focusin",_),document.addEventListener("focusout",E);const T=new MutationObserver(R);return d&&T.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",E),T.disconnect()}}},[i,d,x.paused]),w.useEffect(()=>{if(d){kb.add(x);const _=document.activeElement;if(!d.contains(_)){const R=new CustomEvent(Nh,Db);d.addEventListener(Nh,m),d.dispatchEvent(R),R.defaultPrevented||(Wj(aT(Vw(d)),{select:!0}),document.activeElement===_&&Na(d))}return()=>{d.removeEventListener(Nh,m),setTimeout(()=>{const R=new CustomEvent(Dh,Db);d.addEventListener(Dh,y),d.dispatchEvent(R),R.defaultPrevented||Na(_??document.body,{select:!0}),d.removeEventListener(Dh,y),kb.remove(x)},0)}}},[d,m,y,x]);const S=w.useCallback(_=>{if(!r&&!i||x.paused)return;const E=_.key==="Tab"&&!_.altKey&&!_.ctrlKey&&!_.metaKey,R=document.activeElement;if(E&&R){const T=_.currentTarget,[O,M]=eT(T);O&&M?!_.shiftKey&&R===M?(_.preventDefault(),r&&Na(O,{select:!0})):_.shiftKey&&R===O&&(_.preventDefault(),r&&Na(M,{select:!0})):R===T&&_.preventDefault()}},[r,i,x.paused]);return f.jsx($e.div,{tabIndex:-1,...u,ref:b,onKeyDown:S})});Nu.displayName=Jj;function Wj(e,{select:n=!1}={}){const r=document.activeElement;for(const i of e)if(Na(i,{select:n}),document.activeElement!==r)return}function eT(e){const n=Vw(e),r=zb(n,e),i=zb(n.reverse(),e);return[r,i]}function Vw(e){const n=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const o=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||o?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)n.push(r.currentNode);return n}function zb(e,n){const r=typeof n.checkVisibility=="function"&&n.checkVisibility({checkVisibilityCSS:!0});for(const i of e)if(!(r?!i.checkVisibility({checkVisibilityCSS:!0}):tT(i,{upTo:n})))return i}function tT(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 nT(e){return e instanceof HTMLInputElement&&"select"in e}function Na(e,{select:n=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&nT(e)&&n&&e.select()}}var kb=rT();function rT(){let e=[];return{add(n){const r=e[0];n!==r&&r?.pause(),e=Lb(e,n),e.unshift(n)},remove(n){e=Lb(e,n),e[0]?.resume()}}}function Lb(e,n){const r=[...e],i=r.indexOf(n);return i!==-1&&r.splice(i,1),r}function aT(e){return e.filter(n=>n.tagName!=="A")}var iT="Portal",vl=w.forwardRef((e,n)=>{const{container:r,...i}=e,[o,l]=w.useState(!1);Yt(()=>l(!0),[]);const u=r||o&&globalThis?.document?.body;return u?Mi.createPortal(f.jsx($e.div,{...i,ref:n}),u):null});vl.displayName=iT;var Uc=0,Ss=null;function dp(){w.useEffect(()=>{Ss||(Ss={start:$b(),end:$b()});const{start:e,end:n}=Ss;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==n&&document.body.insertAdjacentElement("beforeend",n),Uc++,()=>{Uc===1&&(Ss?.start.remove(),Ss?.end.remove(),Ss=null),Uc=Math.max(0,Uc-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 Ar=function(){return Ar=Object.assign||function(n){for(var r,i=1,o=arguments.length;i"u")return ST;var n=_T(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])}},ET=qw(),zs="data-scroll-locked",RT=function(e,n,r,i){var o=e.left,l=e.top,u=e.right,d=e.gap;return r===void 0&&(r="margin"),` + .`.concat(oT,` { + overflow: hidden `).concat(i,`; + padding-right: `).concat(d,"px ").concat(i,`; + } + body[`).concat(zs,`] { + overflow: hidden `).concat(i,`; + overscroll-behavior: contain; + `).concat([n&&"position: relative ".concat(i,";"),r==="margin"&&` + padding-left: `.concat(o,`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(au,` { + right: `).concat(d,"px ").concat(i,`; + } + + .`).concat(iu,` { + margin-right: `).concat(d,"px ").concat(i,`; + } + + .`).concat(au," .").concat(au,` { + right: 0 `).concat(i,`; + } + + .`).concat(iu," .").concat(iu,` { + margin-right: 0 `).concat(i,`; + } + + body[`).concat(zs,`] { + `).concat(lT,": ").concat(d,`px; + } +`)},Pb=function(){var e=parseInt(document.body.getAttribute(zs)||"0",10);return isFinite(e)?e:0},jT=function(){w.useEffect(function(){return document.body.setAttribute(zs,(Pb()+1).toString()),function(){var e=Pb()-1;e<=0?document.body.removeAttribute(zs):document.body.setAttribute(zs,e.toString())}},[])},TT=function(e){var n=e.noRelative,r=e.noImportant,i=e.gapMode,o=i===void 0?"margin":i;jT();var l=w.useMemo(function(){return CT(o)},[o]);return w.createElement(ET,{styles:RT(l,!n,o,r?"":"!important")})},bm=!1;if(typeof window<"u")try{var Hc=Object.defineProperty({},"passive",{get:function(){return bm=!0,!0}});window.addEventListener("test",Hc,Hc),window.removeEventListener("test",Hc,Hc)}catch{bm=!1}var _s=bm?{passive:!1}:!1,OT=function(e){return e.tagName==="TEXTAREA"},Gw=function(e,n){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[n]!=="hidden"&&!(r.overflowY===r.overflowX&&!OT(e)&&r[n]==="visible")},AT=function(e){return Gw(e,"overflowY")},MT=function(e){return Gw(e,"overflowX")},Fb=function(e,n){var r=n.ownerDocument,i=n;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var o=Zw(e,i);if(o){var l=Kw(e,i),u=l[1],d=l[2];if(u>d)return!0}i=i.parentNode}while(i&&i!==r.body);return!1},NT=function(e){var n=e.scrollTop,r=e.scrollHeight,i=e.clientHeight;return[n,r,i]},DT=function(e){var n=e.scrollLeft,r=e.scrollWidth,i=e.clientWidth;return[n,r,i]},Zw=function(e,n){return e==="v"?AT(n):MT(n)},Kw=function(e,n){return e==="v"?NT(n):DT(n)},zT=function(e,n){return e==="h"&&n==="rtl"?-1:1},kT=function(e,n,r,i,o){var l=zT(e,window.getComputedStyle(n).direction),u=l*i,d=r.target,p=n.contains(d),m=!1,y=u>0,v=0,b=0;do{if(!d)break;var x=Kw(e,d),S=x[0],_=x[1],E=x[2],R=_-E-l*S;(S||R)&&Zw(e,d)&&(v+=R,b+=S);var T=d.parentNode;d=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!p&&d!==document.body||p&&(n.contains(d)||n===d));return(y&&Math.abs(v)<1||!y&&Math.abs(b)<1)&&(m=!0),m},Bc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Vb=function(e){return[e.deltaX,e.deltaY]},Ub=function(e){return e&&"current"in e?e.current:e},LT=function(e,n){return e[0]===n[0]&&e[1]===n[1]},$T=function(e){return` + .block-interactivity-`.concat(e,` {pointer-events: none;} + .allow-interactivity-`).concat(e,` {pointer-events: all;} +`)},IT=0,Cs=[];function PT(e){var n=w.useRef([]),r=w.useRef([0,0]),i=w.useRef(),o=w.useState(IT++)[0],l=w.useState(qw)[0],u=w.useRef(e);w.useEffect(function(){u.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var _=sT([e.lockRef.current],(e.shards||[]).map(Ub),!0).filter(Boolean);return _.forEach(function(E){return E.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),_.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var d=w.useCallback(function(_,E){if("touches"in _&&_.touches.length===2||_.type==="wheel"&&_.ctrlKey)return!u.current.allowPinchZoom;var R=Bc(_),T=r.current,O="deltaX"in _?_.deltaX:T[0]-R[0],M="deltaY"in _?_.deltaY:T[1]-R[1],D,P=_.target,F=Math.abs(O)>Math.abs(M)?"h":"v";if("touches"in _&&F==="h"&&P.type==="range")return!1;var V=window.getSelection(),ve=V&&V.anchorNode,be=ve?ve===P||ve.contains(P):!1;if(be)return!1;var he=Fb(F,P);if(!he)return!0;if(he?D=F:(D=F==="v"?"h":"v",he=Fb(F,P)),!he)return!1;if(!i.current&&"changedTouches"in _&&(O||M)&&(i.current=D),!D)return!0;var ue=i.current||D;return kT(ue,E,_,ue==="h"?O:M)},[]),p=w.useCallback(function(_){var E=_;if(!(!Cs.length||Cs[Cs.length-1]!==l)){var R="deltaY"in E?Vb(E):Bc(E),T=n.current.filter(function(D){return D.name===E.type&&(D.target===E.target||E.target===D.shadowParent)&<(D.delta,R)})[0];if(T&&T.should){E.cancelable&&E.preventDefault();return}if(!T){var O=(u.current.shards||[]).map(Ub).filter(Boolean).filter(function(D){return D.contains(E.target)}),M=O.length>0?d(E,O[0]):!u.current.noIsolation;M&&E.cancelable&&E.preventDefault()}}},[]),m=w.useCallback(function(_,E,R,T){var O={name:_,delta:E,target:R,should:T,shadowParent:FT(R)};n.current.push(O),setTimeout(function(){n.current=n.current.filter(function(M){return M!==O})},1)},[]),y=w.useCallback(function(_){r.current=Bc(_),i.current=void 0},[]),v=w.useCallback(function(_){m(_.type,Vb(_),_.target,d(_,e.lockRef.current))},[]),b=w.useCallback(function(_){m(_.type,Bc(_),_.target,d(_,e.lockRef.current))},[]);w.useEffect(function(){return Cs.push(l),e.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:b}),document.addEventListener("wheel",p,_s),document.addEventListener("touchmove",p,_s),document.addEventListener("touchstart",y,_s),function(){Cs=Cs.filter(function(_){return _!==l}),document.removeEventListener("wheel",p,_s),document.removeEventListener("touchmove",p,_s),document.removeEventListener("touchstart",y,_s)}},[]);var x=e.removeScrollBar,S=e.inert;return w.createElement(w.Fragment,null,S?w.createElement(l,{styles:$T(o)}):null,x?w.createElement(TT,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function FT(e){for(var n=null;e!==null;)e instanceof ShadowRoot&&(n=e.host,e=e.host),e=e.parentNode;return n}const VT=pT(Bw,PT);var zu=w.forwardRef(function(e,n){return w.createElement(Du,Ar({},e,{ref:n,sideCar:VT}))});zu.classNames=Du.classNames;var UT=function(e){if(typeof document>"u")return null;var n=Array.isArray(e)?e[0]:e;return n.ownerDocument.body},Es=new WeakMap,qc=new WeakMap,Gc={},$h=0,Yw=function(e){return e&&(e.host||Yw(e.parentNode))},HT=function(e,n){return n.map(function(r){if(e.contains(r))return r;var i=Yw(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})},BT=function(e,n,r,i){var o=HT(n,Array.isArray(e)?e:[e]);Gc[r]||(Gc[r]=new WeakMap);var l=Gc[r],u=[],d=new Set,p=new Set(o),m=function(v){!v||d.has(v)||(d.add(v),m(v.parentNode))};o.forEach(m);var y=function(v){!v||p.has(v)||Array.prototype.forEach.call(v.children,function(b){if(d.has(b))y(b);else try{var x=b.getAttribute(i),S=x!==null&&x!=="false",_=(Es.get(b)||0)+1,E=(l.get(b)||0)+1;Es.set(b,_),l.set(b,E),u.push(b),_===1&&S&&qc.set(b,!0),E===1&&b.setAttribute(r,"true"),S||b.setAttribute(i,"true")}catch(R){console.error("aria-hidden: cannot operate on ",b,R)}})};return y(n),d.clear(),$h++,function(){u.forEach(function(v){var b=Es.get(v)-1,x=l.get(v)-1;Es.set(v,b),l.set(v,x),b||(qc.has(v)||v.removeAttribute(i),qc.delete(v)),x||v.removeAttribute(r)}),$h--,$h||(Es=new WeakMap,Es=new WeakMap,qc=new WeakMap,Gc={})}},fp=function(e,n,r){r===void 0&&(r="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),o=UT(e);return o?(i.push.apply(i,Array.from(o.querySelectorAll("[aria-live], script"))),BT(i,o,r,"aria-hidden")):function(){return null}},ku="Dialog",[Qw]=Ga(ku),[qT,yr]=Qw(ku),hp=e=>{const{__scopeDialog:n,children:r,open:i,defaultOpen:o,onOpenChange:l,modal:u=!0}=e,d=w.useRef(null),p=w.useRef(null),[m,y]=Fs({prop:i,defaultProp:o??!1,onChange:l,caller:ku});return f.jsx(qT,{scope:n,triggerRef:d,contentRef:p,contentId:dn(),titleId:dn(),descriptionId:dn(),open:m,onOpenChange:y,onOpenToggle:w.useCallback(()=>y(v=>!v),[y]),modal:u,children:r})};hp.displayName=ku;var Xw="DialogTrigger",GT=w.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,o=yr(Xw,r),l=nt(n,o.triggerRef);return f.jsx($e.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":yp(o.open),...i,ref:l,onClick:je(e.onClick,o.onOpenToggle)})});GT.displayName=Xw;var mp="DialogPortal",[ZT,Jw]=Qw(mp,{forceMount:void 0}),pp=e=>{const{__scopeDialog:n,forceMount:r,children:i,container:o}=e,l=yr(mp,n);return f.jsx(ZT,{scope:n,forceMount:r,children:w.Children.map(i,u=>f.jsx(vr,{present:r||l.open,children:f.jsx(vl,{asChild:!0,container:o,children:u})}))})};pp.displayName=mp;var hu="DialogOverlay",gp=w.forwardRef((e,n)=>{const r=Jw(hu,e.__scopeDialog),{forceMount:i=r.forceMount,...o}=e,l=yr(hu,e.__scopeDialog);return l.modal?f.jsx(vr,{present:i||l.open,children:f.jsx(YT,{...o,ref:n})}):null});gp.displayName=hu;var KT=_i("DialogOverlay.RemoveScroll"),YT=w.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,o=yr(hu,r),l=Kj(),u=nt(n,l);return f.jsx(zu,{as:KT,allowPinchZoom:!0,shards:[o.contentRef],children:f.jsx($e.div,{"data-state":yp(o.open),...i,ref:u,style:{pointerEvents:"auto",...i.style}})})}),Vs="DialogContent",vp=w.forwardRef((e,n)=>{const r=Jw(Vs,e.__scopeDialog),{forceMount:i=r.forceMount,...o}=e,l=yr(Vs,e.__scopeDialog);return f.jsx(vr,{present:i||l.open,children:l.modal?f.jsx(QT,{...o,ref:n}):f.jsx(XT,{...o,ref:n})})});vp.displayName=Vs;var QT=w.forwardRef((e,n)=>{const r=yr(Vs,e.__scopeDialog),i=w.useRef(null),o=nt(n,r.contentRef,i);return w.useEffect(()=>{const l=i.current;if(l)return fp(l)},[]),f.jsx(Ww,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:je(e.onCloseAutoFocus,l=>{l.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:je(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0;(u.button===2||d)&&l.preventDefault()}),onFocusOutside:je(e.onFocusOutside,l=>l.preventDefault())})}),XT=w.forwardRef((e,n)=>{const r=yr(Vs,e.__scopeDialog),i=w.useRef(!1),o=w.useRef(!1);return f.jsx(Ww,{...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,o.current=!1},onInteractOutside:l=>{e.onInteractOutside?.(l),l.defaultPrevented||(i.current=!0,l.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const u=l.target;r.triggerRef.current?.contains(u)&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&o.current&&l.preventDefault()}})}),Ww=w.forwardRef((e,n)=>{const{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:l,...u}=e,d=yr(Vs,r);return dp(),f.jsx(f.Fragment,{children:f.jsx(Nu,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:o,onUnmountAutoFocus:l,children:f.jsx(gl,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":yp(d.open),...u,ref:n,deferPointerDownOutside:!0,onDismiss:()=>d.onOpenChange(!1)})})})}),eS="DialogTitle",tS=w.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,o=yr(eS,r);return f.jsx($e.h2,{id:o.titleId,...i,ref:n})});tS.displayName=eS;var nS="DialogDescription",JT=w.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,o=yr(nS,r);return f.jsx($e.p,{id:o.descriptionId,...i,ref:n})});JT.displayName=nS;var rS="DialogClose",aS=w.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,o=yr(rS,r);return f.jsx($e.button,{type:"button",...i,ref:n,onClick:je(e.onClick,()=>o.onOpenChange(!1))})});aS.displayName=rS;function yp(e){return e?"open":"closed"}function WT(e){const n=w.useRef({value:e,previous:e});return w.useMemo(()=>(n.current.value!==e&&(n.current.previous=n.current.value,n.current.value=e),n.current.previous),[e])}function eO(e){const[n,r]=w.useState(void 0);return Yt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const l=o[0];let u,d;if("borderBoxSize"in l){const p=l.borderBoxSize,m=Array.isArray(p)?p[0]:p;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 tO=["top","right","bottom","left"],Va=Math.min,ra=Math.max,mu=Math.round,Zc=Math.floor,aa=e=>({x:e,y:e}),nO={left:"right",right:"left",bottom:"top",top:"bottom"};function iS(e,n,r){return ra(e,Va(n,r))}function ia(e,n){return typeof e=="function"?e(n):e}function Ua(e){return e.split("-")[0]}function qs(e){return e.split("-")[1]}function bp(e){return e==="x"?"y":"x"}function xp(e){return e==="y"?"height":"width"}function Mr(e){const n=e[0];return n==="t"||n==="b"?"y":"x"}function wp(e){return bp(Mr(e))}function rO(e,n,r){r===void 0&&(r=!1);const i=qs(e),o=wp(e),l=xp(o);let u=o==="x"?i===(r?"end":"start")?"right":"left":i==="start"?"bottom":"top";return n.reference[l]>n.floating[l]&&(u=pu(u)),[u,pu(u)]}function aO(e){const n=pu(e);return[xm(e),n,xm(n)]}function xm(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Hb=["left","right"],Bb=["right","left"],iO=["top","bottom"],sO=["bottom","top"];function oO(e,n,r){switch(e){case"top":case"bottom":return r?n?Bb:Hb:n?Hb:Bb;case"left":case"right":return n?iO:sO;default:return[]}}function lO(e,n,r,i){const o=qs(e);let l=oO(Ua(e),r==="start",i);return o&&(l=l.map(u=>u+"-"+o),n&&(l=l.concat(l.map(xm)))),l}function pu(e){const n=Ua(e);return nO[n]+e.slice(n.length)}function cO(e){var n,r,i,o;return{top:(n=e.top)!=null?n:0,right:(r=e.right)!=null?r:0,bottom:(i=e.bottom)!=null?i:0,left:(o=e.left)!=null?o:0}}function sS(e){return typeof e!="number"?cO(e):{top:e,right:e,bottom:e,left:e}}function gu(e){const{x:n,y:r,width:i,height:o}=e;return{width:i,height:o,top:r,left:n,right:n+i,bottom:r+o,x:n,y:r}}function qb(e,n,r){let{reference:i,floating:o}=e;const l=Mr(n),u=wp(n),d=xp(u),p=Ua(n),m=l==="y",y=i.x+i.width/2-o.width/2,v=i.y+i.height/2-o.height/2,b=i[d]/2-o[d]/2;let x;switch(p){case"top":x={x:y,y:i.y-o.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-o.width,y:v};break;default:x={x:i.x,y:i.y}}const S=qs(n);return S&&(x[u]+=b*(S==="end"?1:-1)*(r&&m?-1:1)),x}async function uO(e,n){var r;n===void 0&&(n={});const{x:i,y:o,platform:l,rects:u,elements:d,strategy:p}=e,{boundary:m="clippingAncestors",rootBoundary:y="viewport",elementContext:v="floating",altBoundary:b=!1,padding:x=0}=ia(n,e),S=sS(x),E=d[b?v==="floating"?"reference":"floating":v],R=gu(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:p})),T=v==="floating"?{x:i,y:o,width:u.floating.width,height:u.floating.height}:u.reference,O=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d.floating)),M=await(l.isElement==null?void 0:l.isElement(O))&&await(l.getScale==null?void 0:l.getScale(O))||{x:1,y:1},D=gu(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:T,offsetParent:O,strategy:p}):T);return{top:(R.top-D.top+S.top)/M.y,bottom:(D.bottom-R.bottom+S.bottom)/M.y,left:(R.left-D.left+S.left)/M.x,right:(D.right-R.right+S.right)/M.x}}const dO=50,fO=async(e,n,r)=>{const{placement:i="bottom",strategy:o="absolute",middleware:l=[],platform:u}=r,d=u.detectOverflow?u:{...u,detectOverflow:uO},p=await(u.isRTL==null?void 0:u.isRTL(n));let m=await u.getElementRects({reference:e,floating:n,strategy:o}),{x:y,y:v}=qb(m,i,p),b=i,x=0;const S={};for(let _=0;_({name:"arrow",options:e,async fn(n){const{x:r,y:i,placement:o,rects:l,platform:u,elements:d,middlewareData:p}=n,{element:m,padding:y=0}=ia(e,n)||{};if(m==null)return{};const v=sS(y),b={x:r,y:i},x=wp(o),S=xp(x),_=await u.getDimensions(m),E=x==="y",R=E?"top":"left",T=E?"bottom":"right",O=E?"clientHeight":"clientWidth",M=l.reference[S]+l.reference[x]-b[x]-l.floating[S],D=b[x]-l.reference[x],P=await(u.getOffsetParent==null?void 0:u.getOffsetParent(m));let F=P?P[O]:0;(!F||!await(u.isElement==null?void 0:u.isElement(P)))&&(F=d.floating[O]||l.floating[S]);const V=M/2-D/2,ve=F/2-_[S]/2-1,be=Va(v[R],ve),he=Va(v[T],ve),ue=F-_[S]-he,X=F/2-_[S]/2+V,pe=iS(be,X,ue),ge=!p.arrow&&qs(o)!=null&&X!==pe&&l.reference[S]/2-(Xpe<=0)){var he,ue;const pe=(((he=l.flip)==null?void 0:he.index)||0)+1,ge=F[pe];if(ge&&(!(v==="alignment"?T!==Mr(ge):!1)||be.every(re=>Mr(re.placement)===T?re.overflows[0]>0:!0)))return{data:{index:pe,overflows:be},reset:{placement:ge}};let L=(ue=be.filter(K=>K.overflows[0]<=0).sort((K,re)=>K.overflows[1]-re.overflows[1])[0])==null?void 0:ue.placement;if(!L)switch(x){case"bestFit":{var X;const K=(X=be.filter(re=>{if(P){const W=Mr(re.placement);return W===T||W==="y"}return!0}).map(re=>[re.placement,re.overflows.filter(W=>W>0).reduce((W,te)=>W+te,0)]).sort((re,W)=>re[1]-W[1])[0])==null?void 0:X[0];K&&(L=K);break}case"initialPlacement":L=d;break}if(o!==L)return{reset:{placement:L}}}return{}}}};function Gb(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 tO.some(n=>e[n]>=0)}const pO=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(n){const{rects:r,platform:i}=n,{strategy:o="referenceHidden",...l}=ia(e,n);switch(o){case"referenceHidden":{const u=await i.detectOverflow(n,{...l,elementContext:"reference"}),d=Gb(u,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:Zb(d)}}}case"escaped":{const u=await i.detectOverflow(n,{...l,altBoundary:!0}),d=Gb(u,r.floating);return{data:{escapedOffsets:d,escaped:Zb(d)}}}default:return{}}}}},oS=new Set(["left","top"]);async function gO(e,n){const{placement:r,platform:i,elements:o}=e,l=await(i.isRTL==null?void 0:i.isRTL(o.floating)),u=Ua(r),d=qs(r),p=Mr(r)==="y",m=oS.has(u)?-1:1,y=l&&p?-1:1,v=ia(n,e);let{mainAxis:b,crossAxis:x,alignmentAxis:S}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return d&&typeof S=="number"&&(x=d==="end"?S*-1:S),p?{x:x*y,y:b*m}:{x:b*m,y:x*y}}const vO=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(n){var r,i;const{x:o,y:l,placement:u,middlewareData:d}=n,p=await gO(n,e);return u===((r=d.offset)==null?void 0:r.placement)&&(i=d.arrow)!=null&&i.alignmentOffset?{}:{x:o+p.x,y:l+p.y,data:{...p,placement:u}}}}},yO=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(n){const{x:r,y:i,placement:o,platform:l}=n,{mainAxis:u=!0,crossAxis:d=!1,limiter:p={fn:T=>{let{x:O,y:M}=T;return{x:O,y:M}}},...m}=ia(e,n),y={x:r,y:i},v=await l.detectOverflow(n,m),b=Mr(o),x=bp(b);let S=y[x],_=y[b];const E=(T,O)=>iS(O+v[T==="y"?"top":"left"],O,O-v[T==="y"?"bottom":"right"]);u&&(S=E(x,S)),d&&(_=E(b,_));const R=p.fn({...n,[x]:S,[b]:_});return{...R,data:{x:R.x-r,y:R.y-i,enabled:{[x]:u,[b]:d}}}}}},bO=function(e){return e===void 0&&(e={}),{options:e,fn(n){var r,i;const{x:o,y:l,placement:u,rects:d,middlewareData:p}=n,{offset:m=0,mainAxis:y=!0,crossAxis:v=!0}=ia(e,n),b={x:o,y:l},x=Mr(u),S=bp(x);let _=b[S],E=b[x];const R=ia(m,n),T=typeof R=="number"?{mainAxis:R,crossAxis:0}:{mainAxis:(r=R.mainAxis)!=null?r:0,crossAxis:(i=R.crossAxis)!=null?i:0};if(y){const D=S==="y"?"height":"width",P=d.reference[S]-d.floating[D]+T.mainAxis,F=d.reference[S]+d.reference[D]-T.mainAxis;_F&&(_=F)}if(v){var O,M;const D=S==="y"?"width":"height",P=oS.has(Ua(u)),F=d.reference[x]-d.floating[D]+(P&&((O=p.offset)==null?void 0:O[x])||0)+(P?0:T.crossAxis),V=d.reference[x]+d.reference[D]+(P?0:((M=p.offset)==null?void 0:M[x])||0)-(P?T.crossAxis:0);EV&&(E=V)}return{[S]:_,[x]:E}}}},xO=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(n){const{placement:r,rects:i,platform:o,elements:l}=n,{apply:u=()=>{},...d}=ia(e,n),p=await o.detectOverflow(n,d),m=Ua(r),y=qs(r),v=Mr(r)==="y",{width:b,height:x}=i.floating;let S,_;m==="top"||m==="bottom"?(S=m,_=y===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(_=m,S=y==="end"?"top":"bottom");const E=x-p.top-p.bottom,R=b-p.left-p.right,T=Va(x-p[S],E),O=Va(b-p[_],R),M=n.middlewareData.shift,D=!M;let P=T,F=O;M!=null&&M.enabled.x&&(F=R),M!=null&&M.enabled.y&&(P=E),D&&!y&&(v?F=b-2*ra(p.left,p.right):P=x-2*ra(p.top,p.bottom)),await u({...n,availableWidth:F,availableHeight:P});const V=await o.getDimensions(l.floating);return b!==V.width||x!==V.height?{reset:{rects:!0}}:{}}}};function Lu(){return typeof window<"u"}function Gs(e){return lS(e)?(e.nodeName||"").toLowerCase():"#document"}function An(e){var n;return(e==null||(n=e.ownerDocument)==null?void 0:n.defaultView)||window}function sa(e){var n;return(n=(lS(e)?e.ownerDocument:e.document)||window.document)==null?void 0:n.documentElement}function lS(e){return Lu()?e instanceof Node||e instanceof An(e).Node:!1}function Nr(e){return Lu()?e instanceof Element||e instanceof An(e).Element:!1}function Za(e){return Lu()?e instanceof HTMLElement||e instanceof An(e).HTMLElement:!1}function Kb(e){return!Lu()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof An(e).ShadowRoot}function $u(e){const{overflow:n,overflowX:r,overflowY:i,display:o}=Dr(e);return/auto|scroll|overlay|hidden|clip/.test(n+i+r)&&o!=="inline"&&o!=="contents"}function wO(e){return/^(table|td|th)$/.test(Gs(e))}function Iu(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const SO=/transform|translate|scale|rotate|perspective|filter/,_O=/paint|layout|strict|content/,vi=e=>!!e&&e!=="none";let Ih;function Sp(e){const n=Nr(e)?Dr(e):e;return vi(n.transform)||vi(n.translate)||vi(n.scale)||vi(n.rotate)||vi(n.perspective)||!_p()&&(vi(n.backdropFilter)||vi(n.filter))||SO.test(n.willChange||"")||_O.test(n.contain||"")}function CO(e){let n=Ci(e);for(;Za(n)&&!al(n);){if(Sp(n))return n;if(Iu(n))return null;n=Ci(n)}return null}function _p(){return Ih==null&&(Ih=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ih}function al(e){return/^(html|body|#document)$/.test(Gs(e))}function Dr(e){return An(e).getComputedStyle(e)}function Pu(e){return Nr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ci(e){if(Gs(e)==="html")return e;const n=e.assignedSlot||e.parentNode||Kb(e)&&e.host||sa(e);return Kb(n)?n.host:n}function cS(e){const n=Ci(e);return al(n)?(e.ownerDocument||e).body:Za(n)&&$u(n)?n:cS(n)}function il(e,n,r){var i;n===void 0&&(n=[]),r===void 0&&(r=!0);const o=cS(e),l=o===((i=e.ownerDocument)==null?void 0:i.body),u=An(o);if(l){const d=wm(u);return n.concat(u,u.visualViewport||[],$u(o)?o:[],d&&r?il(d):[])}else return n.concat(o,il(o,[],r))}function wm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function uS(e){const n=Dr(e);let r=parseFloat(n.width)||0,i=parseFloat(n.height)||0;const o=Za(e),l=o?e.offsetWidth:r,u=o?e.offsetHeight:i,d=mu(r)!==l||mu(i)!==u;return d&&(r=l,i=u),{width:r,height:i,$:d}}function Cp(e){return Nr(e)?e:e.contextElement}function ks(e){const n=Cp(e);if(!Za(n))return aa(1);const r=n.getBoundingClientRect(),{width:i,height:o,$:l}=uS(n);let u=(l?mu(r.width):r.width)/i,d=(l?mu(r.height):r.height)/o;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const EO=aa(0);function dS(e){const n=An(e);return!_p()||!n.visualViewport?EO:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function RO(e,n,r){return n===void 0&&(n=!1),!!r&&n&&r===An(e)}function Ei(e,n,r,i){n===void 0&&(n=!1),r===void 0&&(r=!1);const o=e.getBoundingClientRect(),l=Cp(e);let u=aa(1);n&&(i?Nr(i)&&(u=ks(i)):u=ks(e));const d=RO(l,r,i)?dS(l):aa(0);let p=(o.left+d.x)/u.x,m=(o.top+d.y)/u.y,y=o.width/u.x,v=o.height/u.y;if(l&&i){const b=An(l),x=Nr(i)?An(i):i;let S=b,_=wm(S);for(;_&&x!==S;){const E=ks(_),R=_.getBoundingClientRect(),T=Dr(_),O=R.left+(_.clientLeft+parseFloat(T.paddingLeft))*E.x,M=R.top+(_.clientTop+parseFloat(T.paddingTop))*E.y;p*=E.x,m*=E.y,y*=E.x,v*=E.y,p+=O,m+=M,S=An(_),_=wm(S)}}return gu({width:y,height:v,x:p,y:m})}function Fu(e,n){const r=Pu(e).scrollLeft;return n?n.left+r:Ei(sa(e)).left+r}function fS(e,n){const r=e.getBoundingClientRect(),i=r.left+n.scrollLeft-Fu(e,r),o=r.top+n.scrollTop;return{x:i,y:o}}function jO(e){let{elements:n,rect:r,offsetParent:i,strategy:o}=e;const l=o==="fixed",u=sa(i),d=n?Iu(n.floating):!1;if(i===u||d&&l)return r;let p={scrollLeft:0,scrollTop:0},m=aa(1);const y=aa(0),v=Za(i);if((v||!l)&&((Gs(i)!=="body"||$u(u))&&(p=Pu(i)),v)){const x=Ei(i);m=ks(i),y.x=x.x+i.clientLeft,y.y=x.y+i.clientTop}const b=u&&!v&&!l?fS(u,p):aa(0);return{width:r.width*m.x,height:r.height*m.y,x:r.x*m.x-p.scrollLeft*m.x+y.x+b.x,y:r.y*m.y-p.scrollTop*m.y+y.y+b.y}}function TO(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function OO(e){const n=Pu(e),r=e.ownerDocument.body,i=ra(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=ra(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Fu(e);const u=-n.scrollTop;return Dr(r).direction==="rtl"&&(l+=ra(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:l,y:u}}const AO=25;function MO(e,n,r){r===void 0&&(r="viewport");const i=r==="layoutViewport",o=An(e),l=sa(e),u=o.visualViewport;let d=l.clientWidth,p=l.clientHeight,m=0,y=0;if(u){const b=!_p()||n==="fixed";i?b||(m=-u.offsetLeft,y=-u.offsetTop):(d=u.width,p=u.height,b&&(m=u.offsetLeft,y=u.offsetTop))}if(Fu(l)<=0){const b=l.ownerDocument,x=b.body,S=getComputedStyle(x),_=b.compatMode==="CSS1Compat"&&parseFloat(S.marginLeft)+parseFloat(S.marginRight)||0,E=Math.abs(l.clientWidth-x.clientWidth-_),R=getComputedStyle(l).scrollbarGutter==="stable both-edges"?E/2:E;R<=AO&&(d-=R)}return{width:d,height:p,x:m,y}}function NO(e,n){const r=Ei(e,!0,n==="fixed"),i=r.top+e.clientTop,o=r.left+e.clientLeft,l=ks(e),u=e.clientWidth*l.x,d=e.clientHeight*l.y,p=o*l.x,m=i*l.y;return{width:u,height:d,x:p,y:m}}function Yb(e,n,r){let i;if(n==="viewport"||n==="layoutViewport")i=MO(e,r,n);else if(n==="document")i=OO(sa(e));else if(Nr(n))i=NO(n,r);else{const o=dS(e);i={x:n.x-o.x,y:n.y-o.y,width:n.width,height:n.height}}return gu(i)}function DO(e,n){const r=n.get(e);if(r)return r;let i=il(e,[],!1).filter(d=>Nr(d)&&Gs(d)!=="body"),o=null;const l=Dr(e).position==="fixed";let u=l?Ci(e):e;for(;Nr(u)&&!al(u);){const d=Dr(u),p=Sp(u),m=o?o.position:l?"fixed":"";!p&&(m==="fixed"||m==="absolute"&&d.position==="static")?i=i.filter(v=>v!==u):o=d,u=Ci(u)}return n.set(e,i),i}function zO(e){let{element:n,boundary:r,rootBoundary:i,strategy:o}=e;const u=[...r==="clippingAncestors"?Iu(n)?[]:DO(n,this._c):[].concat(r),i],d=Yb(n,u[0],o);let p=d.top,m=d.right,y=d.bottom,v=d.left;for(let b=1;b{d(!1,1e-7)},1e3)}F=!1}try{i=new IntersectionObserver(V,{...P,root:l.ownerDocument})}catch{i=new IntersectionObserver(V,P)}i.observe(e)}const p=An(e),m=()=>d(r);return p.addEventListener("resize",m),d(!0),()=>{p.removeEventListener("resize",m),u()}}function VO(e,n,r,i){i===void 0&&(i={});const{ancestorScroll:o=!0,ancestorResize:l=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:p=!1}=i,m=Cp(e),y=o||l?[...m?il(m):[],...n?il(n):[]]:[];y.forEach(R=>{o&&R.addEventListener("scroll",r),l&&R.addEventListener("resize",r)});const v=m&&d?FO(m,r,l):null;let b=-1,x=null;u&&(x=new ResizeObserver(R=>{let[T]=R;T&&T.target===m&&x&&n&&(x.unobserve(n),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var O;(O=x)==null||O.observe(n)})),r()}),m&&!p&&x.observe(m),n&&x.observe(n));let S,_=p?Ei(e):null;p&&E();function E(){const R=Ei(e);_&&!mS(_,R)&&r(),_=R,S=requestAnimationFrame(E)}return r(),()=>{var R;y.forEach(T=>{o&&T.removeEventListener("scroll",r),l&&T.removeEventListener("resize",r)}),v?.(),(R=x)==null||R.disconnect(),x=null,p&&cancelAnimationFrame(S)}}const UO=vO,HO=yO,BO=mO,qO=xO,GO=pO,Xb=hO,ZO=bO,KO=(e,n,r)=>{const i=new Map,o=r??{},l={...PO,...o.platform,_c:i};return fO(e,n,{...o,platform:l})};var YO=typeof document<"u",QO=function(){},su=YO?w.useLayoutEffect:QO;function vu(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,o;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(!vu(e[i],n[i]))return!1;return!0}if(o=Object.keys(e),r=o.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!{}.hasOwnProperty.call(n,o[i]))return!1;for(i=r;i--!==0;){const l=o[i];if(!(l==="_owner"&&e.$$typeof)&&!vu(e[l],n[l]))return!1}return!0}return e!==e&&n!==n}function pS(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Jb(e,n){const r=pS(e);return Math.round(n*r)/r}function Fh(e){const n=w.useRef(e);return su(()=>{n.current=e}),n}function XO(e){e===void 0&&(e={});const{placement:n="bottom",strategy:r="absolute",middleware:i=[],platform:o,elements:{reference:l,floating:u}={},transform:d=!0,whileElementsMounted:p,open:m}=e,[y,v]=w.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[b,x]=w.useState(i);vu(b,i)||x(i);const[S,_]=w.useState(null),[E,R]=w.useState(null),T=w.useCallback(re=>{re!==P.current&&(P.current=re,_(re))},[]),O=w.useCallback(re=>{re!==F.current&&(F.current=re,R(re))},[]),M=l||S,D=u||E,P=w.useRef(null),F=w.useRef(null),V=w.useRef(y),ve=p!=null,be=Fh(p),he=Fh(o),ue=Fh(m),X=w.useCallback(()=>{if(!P.current||!F.current)return;const re={placement:n,strategy:r,middleware:b};he.current&&(re.platform=he.current),KO(P.current,F.current,re).then(W=>{const te={...W,isPositioned:ue.current!==!1};pe.current&&!vu(V.current,te)&&(V.current=te,Mi.flushSync(()=>{v(te)}))})},[b,n,r,he,ue]);su(()=>{m===!1&&V.current.isPositioned&&(V.current.isPositioned=!1,v(re=>({...re,isPositioned:!1})))},[m]);const pe=w.useRef(!1);su(()=>(pe.current=!0,()=>{pe.current=!1}),[]),su(()=>{if(M&&(P.current=M),D&&(F.current=D),M&&D){if(be.current)return be.current(M,D,X);X()}},[M,D,X,be,ve]);const ge=w.useMemo(()=>({reference:P,floating:F,setReference:T,setFloating:O}),[T,O]),L=w.useMemo(()=>({reference:M,floating:D}),[M,D]),K=w.useMemo(()=>{const re={position:r,left:0,top:0};if(!L.floating)return re;const W=Jb(L.floating,y.x),te=Jb(L.floating,y.y);return d?{...re,transform:"translate("+W+"px, "+te+"px)",...pS(L.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:W,top:te}},[r,d,L.floating,y.x,y.y]);return w.useMemo(()=>({...y,update:X,refs:ge,elements:L,floatingStyles:K}),[y,X,ge,L,K])}const JO=e=>{function n(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:i,padding:o}=typeof e=="function"?e(r):e;return i&&n(i)?i.current!=null?Xb({element:i.current,padding:o}).fn(r):{}:i?Xb({element:i,padding:o}).fn(r):{}}}},WO=(e,n)=>{const r=UO(e);return{name:r.name,fn:r.fn,options:[e,n]}},eA=(e,n)=>{const r=HO(e);return{name:r.name,fn:r.fn,options:[e,n]}},tA=(e,n)=>({fn:ZO(e).fn,options:[e,n]}),nA=(e,n)=>{const r=BO(e);return{name:r.name,fn:r.fn,options:[e,n]}},rA=(e,n)=>{const r=qO(e);return{name:r.name,fn:r.fn,options:[e,n]}},aA=(e,n)=>{const r=GO(e);return{name:r.name,fn:r.fn,options:[e,n]}},iA=(e,n)=>{const r=JO(e);return{name:r.name,fn:r.fn,options:[e,n]}};var sA="Arrow",gS=w.forwardRef((e,n)=>{const{children:r,width:i=10,height:o=5,...l}=e;return f.jsx($e.svg,{...l,ref:n,width:i,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});gS.displayName=sA;var oA=gS,Ep="Popper",[vS,Zs]=Ga(Ep),[lA,yS]=vS(Ep),bS=e=>{const{__scopePopper:n,children:r}=e,[i,o]=w.useState(null),[l,u]=w.useState(void 0);return f.jsx(lA,{scope:n,anchor:i,onAnchorChange:o,placementState:l,setPlacementState:u,children:r})};bS.displayName=Ep;var xS="PopperAnchor",wS=w.forwardRef((e,n)=>{const{__scopePopper:r,virtualRef:i,...o}=e,l=yS(xS,r),u=w.useRef(null),d=l.onAnchorChange,p=w.useCallback(S=>{u.current=S,S&&d(S)},[d]),m=nt(n,p),y=w.useRef(null);w.useEffect(()=>{if(!i)return;const S=y.current;y.current=i.current,S!==y.current&&d(y.current)});const v=l.placementState&&jp(l.placementState),b=v?.[0],x=v?.[1];return i?null:f.jsx($e.div,{"data-radix-popper-side":b,"data-radix-popper-align":x,...o,ref:m})});wS.displayName=xS;var Rp="PopperContent",[cA,uA]=vS(Rp),SS=w.forwardRef((e,n)=>{const{__scopePopper:r,side:i="bottom",sideOffset:o=0,align:l="center",alignOffset:u=0,arrowPadding:d=0,avoidCollisions:p=!0,collisionBoundary:m=[],collisionPadding:y=0,sticky:v="partial",hideWhenDetached:b=!1,updatePositionStrategy:x="optimized",onPlaced:S,..._}=e,E=yS(Rp,r),[R,T]=w.useState(null),O=nt(n,T),[M,D]=w.useState(null),P=eO(M),F=P?.width??0,V=P?.height??0,ve=i+(l!=="center"?"-"+l:""),be=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},he=Array.isArray(m)?m:[m],ue=he.length>0,X={padding:be,boundary:he.filter(fA),altBoundary:ue},{refs:pe,floatingStyles:ge,placement:L,isPositioned:K,middlewareData:re}=XO({strategy:"fixed",placement:ve,whileElementsMounted:(...ye)=>VO(...ye,{animationFrame:x==="always"}),elements:{reference:E.anchor},middleware:[WO({mainAxis:o+V,alignmentAxis:u}),p&&eA({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?tA():void 0,...X}),p&&nA({...X}),rA({...X,apply:({elements:ye,rects:xe,availableWidth:Oe,availableHeight:Ie})=>{const{width:Ve,height:it}=xe.reference,Qe=ye.floating.style;Qe.setProperty("--radix-popper-available-width",`${Oe}px`),Qe.setProperty("--radix-popper-available-height",`${Ie}px`),Qe.setProperty("--radix-popper-anchor-width",`${Ve}px`),Qe.setProperty("--radix-popper-anchor-height",`${it}px`)}}),M&&iA({element:M,padding:d}),hA({arrowWidth:F,arrowHeight:V}),b&&aA({strategy:"referenceHidden",...X,boundary:ue?X.boundary:void 0})]}),W=E.setPlacementState;Yt(()=>(W(L),()=>{W(void 0)}),[L,W]);const[te,z]=jp(L),N=tr(S);Yt(()=>{K&&N?.()},[K,N]);const B=re.arrow?.x,J=re.arrow?.y,Y=re.arrow?.centerOffset!==0,[le,ae]=w.useState();return Yt(()=>{R&&ae(window.getComputedStyle(R).zIndex)},[R]),f.jsx("div",{ref:pe.setFloating,"data-radix-popper-content-wrapper":"",style:{...ge,transform:K?ge.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:le,"--radix-popper-transform-origin":[re.transformOrigin?.x,re.transformOrigin?.y].join(" "),...re.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:f.jsx(cA,{scope:r,placedSide:te,placedAlign:z,onArrowChange:D,arrowX:B,arrowY:J,shouldHideArrow:Y,children:f.jsx($e.div,{"data-side":te,"data-align":z,..._,ref:O,style:{..._.style,animation:K?void 0:"none"}})})})});SS.displayName=Rp;var _S="PopperArrow",dA={top:"bottom",right:"left",bottom:"top",left:"right"},CS=w.forwardRef(function(n,r){const{__scopePopper:i,...o}=n,l=uA(_S,i),u=dA[l.placedSide];return f.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:f.jsx(oA,{...o,ref:r,style:{...o.style,display:"block"}})})});CS.displayName=_S;function fA(e){return e!==null}var hA=e=>({name:"transformOrigin",options:e,fn(n){const{placement:r,rects:i,middlewareData:o}=n,u=o.arrow?.centerOffset!==0,d=u?0:e.arrowWidth,p=u?0:e.arrowHeight,[m,y]=jp(r),v={start:"0%",center:"50%",end:"100%"}[y],b=(o.arrow?.x??0)+d/2,x=(o.arrow?.y??0)+p/2;let S="",_="";return m==="bottom"?(S=u?v:`${b}px`,_=`${-p}px`):m==="top"?(S=u?v:`${b}px`,_=`${i.floating.height+p}px`):m==="right"?(S=`${-p}px`,_=u?v:`${x}px`):m==="left"&&(S=`${i.floating.width+p}px`,_=u?v:`${x}px`),{data:{x:S,y:_}}}});function jp(e){const[n,r="center"]=e.split("-");return[n,r]}var Tp=bS,Op=wS,Ap=SS,Mp=CS,Vh=!1;function mA(){const[e,n]=w.useState(Vh);return w.useEffect(()=>{Vh||(Vh=!0,n(!0))},[]),e}var ES=Au[" useSyncExternalStore ".trim().toString()];function pA(){return()=>{}}function gA(){return ES(pA,()=>!0,()=>!1)}var vA=typeof ES=="function"?gA:mA,Uh="rovingFocusGroup.onEntryFocus",yA={bubbles:!1,cancelable:!0},yl="RovingFocusGroup",[Sm,RS,bA]=lp(yl),[xA,jS]=Ga(yl,[bA]),[wA,SA]=xA(yl),TS=w.forwardRef((e,n)=>f.jsx(Sm.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(Sm.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(_A,{...e,ref:n})})}));TS.displayName=yl;var _A=w.forwardRef((e,n)=>{const{__scopeRovingFocusGroup:r,orientation:i,loop:o=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:p,onEntryFocus:m,preventScrollOnEntryFocus:y=!1,...v}=e,b=w.useRef(null),x=nt(n,b),S=cp(l),[_,E]=Fs({prop:u,defaultProp:d??null,onChange:p,caller:yl}),[R,T]=w.useState(!1),O=tr(m),M=RS(r),D=w.useRef(!1),[P,F]=w.useState(0);return w.useEffect(()=>{const V=b.current;if(V)return V.addEventListener(Uh,O),()=>V.removeEventListener(Uh,O)},[O]),f.jsx(wA,{scope:r,orientation:i,dir:S,loop:o,currentTabStopId:_,onItemFocus:w.useCallback(V=>E(V),[E]),onItemShiftTab:w.useCallback(()=>T(!0),[]),onFocusableItemAdd:w.useCallback(()=>F(V=>V+1),[]),onFocusableItemRemove:w.useCallback(()=>F(V=>V-1),[]),children:f.jsx($e.div,{tabIndex:R||P===0?-1:0,"data-orientation":i,...v,ref:x,style:{outline:"none",...e.style},onMouseDown:je(e.onMouseDown,()=>{D.current=!0}),onFocus:je(e.onFocus,V=>{const ve=!D.current;if(V.target===V.currentTarget&&ve&&!R){const be=new CustomEvent(Uh,yA);if(V.currentTarget.dispatchEvent(be),!be.defaultPrevented){const he=M().filter(L=>L.focusable),ue=he.find(L=>L.active),X=he.find(L=>L.id===_),ge=[ue,X,...he].filter(Boolean).map(L=>L.ref.current);MS(ge,y)}}D.current=!1}),onBlur:je(e.onBlur,()=>T(!1))})})}),OS="RovingFocusGroupItem",AS=w.forwardRef((e,n)=>{const{__scopeRovingFocusGroup:r,focusable:i=!0,active:o=!1,tabStopId:l,children:u,...d}=e,p=dn(),m=l||p,y=SA(OS,r),v=y.currentTabStopId===m,b=RS(r),{onFocusableItemAdd:x,onFocusableItemRemove:S,currentTabStopId:_}=y,E=vA();return Yt(()=>{if(!(!E||!i))return x(),()=>S()},[E,i,x,S]),w.useEffect(()=>{if(!(E||!i))return x(),()=>S()},[E,i,x,S]),f.jsx(Sm.ItemSlot,{scope:r,id:m,focusable:i,active:o,children:f.jsx($e.span,{tabIndex:v?0:-1,"data-orientation":y.orientation,...d,ref:n,onMouseDown:je(e.onMouseDown,R=>{i?y.onItemFocus(m):R.preventDefault()}),onFocus:je(e.onFocus,()=>y.onItemFocus(m)),onKeyDown:je(e.onKeyDown,R=>{if(R.key==="Tab"&&R.shiftKey){y.onItemShiftTab();return}if(R.target!==R.currentTarget)return;const T=RA(R,y.orientation,y.dir);if(T!==void 0){if(R.metaKey||R.ctrlKey||R.altKey||R.shiftKey)return;R.preventDefault();let M=b().filter(D=>D.focusable).map(D=>D.ref.current);if(T==="last")M.reverse();else if(T==="prev"||T==="next"){T==="prev"&&M.reverse();const D=M.indexOf(R.currentTarget);M=y.loop?jA(M,D+1):M.slice(D+1)}setTimeout(()=>MS(M))}}),children:typeof u=="function"?u({isCurrentTabStop:v,hasTabStop:_!=null}):u})})});AS.displayName=OS;var CA={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function EA(e,n){return n!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function RA(e,n,r){const i=EA(e.key,r);if(!(n==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(n==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return CA[i]}function MS(e,n=!1){const r=document.activeElement;for(const i of e)if(i===r||(i.focus({preventScroll:n}),document.activeElement!==r))return}function jA(e,n){return e.map((r,i)=>e[(n+i)%e.length])}var TA=TS,OA=AS,_m=["Enter"," "],AA=["ArrowDown","PageUp","Home"],NS=["ArrowUp","PageDown","End"],MA=[...AA,...NS],NA={ltr:[..._m,"ArrowRight"],rtl:[..._m,"ArrowLeft"]},DA={ltr:["ArrowLeft"],rtl:["ArrowRight"]},bl="Menu",[sl,zA,kA]=lp(bl),[Ni,DS]=Ga(bl,[kA,Zs,jS]),Vu=Zs(),zS=jS(),[LA,Di]=Ni(bl),[$A,xl]=Ni(bl),kS=e=>{const{__scopeMenu:n,open:r=!1,children:i,dir:o,onOpenChange:l,modal:u=!0}=e,d=Vu(n),[p,m]=w.useState(null),y=w.useRef(!1),v=tr(l),b=cp(o);return w.useEffect(()=>{const x=()=>{y.current=!0,document.addEventListener("pointerdown",S,{capture:!0,once:!0}),document.addEventListener("pointermove",S,{capture:!0,once:!0})},S=()=>y.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",S,{capture:!0}),document.removeEventListener("pointermove",S,{capture:!0})}},[]),w.useEffect(()=>{if(!r)return;const x=()=>v(!1);return window.addEventListener("blur",x),()=>window.removeEventListener("blur",x)},[r,v]),f.jsx(Tp,{...d,children:f.jsx(LA,{scope:n,open:r,onOpenChange:v,content:p,onContentChange:m,children:f.jsx($A,{scope:n,onClose:w.useCallback(()=>v(!1),[v]),isUsingKeyboardRef:y,dir:b,modal:u,children:i})})})};kS.displayName=bl;var IA="MenuAnchor",Np=w.forwardRef((e,n)=>{const{__scopeMenu:r,...i}=e,o=Vu(r);return f.jsx(Op,{...o,...i,ref:n})});Np.displayName=IA;var Dp="MenuPortal",[PA,LS]=Ni(Dp,{forceMount:void 0}),$S=e=>{const{__scopeMenu:n,forceMount:r,children:i,container:o}=e,l=Di(Dp,n);return f.jsx(PA,{scope:n,forceMount:r,children:f.jsx(vr,{present:r||l.open,children:f.jsx(vl,{asChild:!0,container:o,children:i})})})};$S.displayName=Dp;var er="MenuContent",[FA,zp]=Ni(er),IS=w.forwardRef((e,n)=>{const r=LS(er,e.__scopeMenu),{forceMount:i=r.forceMount,...o}=e,l=Di(er,e.__scopeMenu),u=xl(er,e.__scopeMenu);return f.jsx(sl.Provider,{scope:e.__scopeMenu,children:f.jsx(vr,{present:i||l.open,children:f.jsx(sl.Slot,{scope:e.__scopeMenu,children:u.modal?f.jsx(VA,{...o,ref:n}):f.jsx(UA,{...o,ref:n})})})})}),VA=w.forwardRef((e,n)=>{const r=Di(er,e.__scopeMenu),i=w.useRef(null),o=nt(n,i);return w.useEffect(()=>{const l=i.current;if(l)return fp(l)},[]),f.jsx(kp,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:je(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),UA=w.forwardRef((e,n)=>{const r=Di(er,e.__scopeMenu);return f.jsx(kp,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),HA=_i("MenuContent.ScrollLock"),kp=w.forwardRef((e,n)=>{const{__scopeMenu:r,loop:i=!1,trapFocus:o,onOpenAutoFocus:l,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:p,onEscapeKeyDown:m,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:b,onDismiss:x,disableOutsideScroll:S,..._}=e,E=Di(er,r),R=xl(er,r),T=Vu(r),O=zS(r),M=zA(r),[D,P]=w.useState(null),F=w.useRef(null),V=nt(n,F,E.onContentChange),ve=w.useRef(0),be=w.useRef(""),he=w.useRef(0),ue=w.useRef(null),X=w.useRef("right"),pe=w.useRef(0),ge=S?zu:w.Fragment,L=S?{as:HA,allowPinchZoom:!0}:void 0,K=W=>{const te=be.current+W,z=M().filter(ae=>!ae.disabled),N=document.activeElement,B=z.find(ae=>ae.ref.current===N)?.textValue,J=z.map(ae=>ae.textValue),Y=tM(J,te,B),le=z.find(ae=>ae.textValue===Y)?.ref.current;(function ae(ye){be.current=ye,window.clearTimeout(ve.current),ye!==""&&(ve.current=window.setTimeout(()=>ae(""),1e3))})(te),le&&setTimeout(()=>le.focus())};w.useEffect(()=>()=>window.clearTimeout(ve.current),[]),dp();const re=w.useCallback(W=>X.current===ue.current?.side&&rM(W,ue.current?.area),[]);return f.jsx(FA,{scope:r,searchRef:be,onItemEnter:w.useCallback(W=>{re(W)&&W.preventDefault()},[re]),onItemLeave:w.useCallback(W=>{re(W)||(F.current?.focus(),P(null))},[re]),onTriggerLeave:w.useCallback(W=>{re(W)&&W.preventDefault()},[re]),pointerGraceTimerRef:he,onPointerGraceIntentChange:w.useCallback(W=>{ue.current=W},[]),children:f.jsx(ge,{...L,children:f.jsx(Nu,{asChild:!0,trapped:o,onMountAutoFocus:je(l,W=>{W.preventDefault(),F.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:f.jsx(gl,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:m,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:b,onDismiss:x,children:f.jsx(TA,{asChild:!0,...O,dir:R.dir,orientation:"vertical",loop:i,currentTabStopId:D,onCurrentTabStopIdChange:P,onEntryFocus:je(p,W=>{R.isUsingKeyboardRef.current||W.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(Ap,{role:"menu","aria-orientation":"vertical","data-state":e1(E.open),"data-radix-menu-content":"",dir:R.dir,...T,..._,ref:V,style:{outline:"none",..._.style},onKeyDown:je(_.onKeyDown,W=>{const z=W.target.closest("[data-radix-menu-content]")===W.currentTarget,N=W.ctrlKey||W.altKey||W.metaKey,B=W.key.length===1;z&&(W.key==="Tab"&&W.preventDefault(),!N&&B&&K(W.key));const J=F.current;if(W.target!==J||!MA.includes(W.key))return;W.preventDefault();const le=M().filter(ae=>!ae.disabled).map(ae=>ae.ref.current);NS.includes(W.key)&&le.reverse(),WA(le)}),onBlur:je(e.onBlur,W=>{W.currentTarget.contains(W.target)||(window.clearTimeout(ve.current),be.current="")}),onPointerMove:je(e.onPointerMove,ol(W=>{const te=W.target,z=pe.current!==W.clientX;if(W.currentTarget.contains(te)&&z){const N=W.clientX>pe.current?"right":"left";X.current=N,pe.current=W.clientX}}))})})})})})})});IS.displayName=er;var BA="MenuGroup",Lp=w.forwardRef((e,n)=>{const{__scopeMenu:r,...i}=e;return f.jsx($e.div,{role:"group",...i,ref:n})});Lp.displayName=BA;var qA="MenuLabel",PS=w.forwardRef((e,n)=>{const{__scopeMenu:r,...i}=e;return f.jsx($e.div,{...i,ref:n})});PS.displayName=qA;var yu="MenuItem",Wb="menu.itemSelect",Uu=w.forwardRef((e,n)=>{const{disabled:r=!1,onSelect:i,...o}=e,l=w.useRef(null),u=xl(yu,e.__scopeMenu),d=zp(yu,e.__scopeMenu),p=nt(n,l),m=w.useRef(!1),y=()=>{const v=l.current;if(!r&&v){const b=new CustomEvent(Wb,{bubbles:!0,cancelable:!0});v.addEventListener(Wb,x=>i?.(x),{once:!0}),$w(v,b),b.defaultPrevented?m.current=!1:u.onClose()}};return f.jsx(FS,{...o,ref:p,disabled:r,onClick:je(e.onClick,y),onPointerDown:v=>{e.onPointerDown?.(v),m.current=!0},onPointerUp:je(e.onPointerUp,v=>{m.current||v.currentTarget?.click()}),onKeyDown:je(e.onKeyDown,v=>{r||v.target!==v.currentTarget||d.searchRef.current!==""&&v.key===" "||_m.includes(v.key)&&(v.currentTarget.click(),v.preventDefault())})})});Uu.displayName=yu;var FS=w.forwardRef((e,n)=>{const{__scopeMenu:r,disabled:i=!1,textValue:o,...l}=e,u=zp(yu,r),d=zS(r),p=w.useRef(null),m=nt(n,p),[y,v]=w.useState(!1),[b,x]=w.useState("");return w.useEffect(()=>{const S=p.current;S&&x((S.textContent??"").trim())},[l.children]),f.jsx(sl.ItemSlot,{scope:r,disabled:i,textValue:o??b,children:f.jsx(OA,{asChild:!0,...d,focusable:!i,children:f.jsx($e.div,{role:"menuitem","data-highlighted":y?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...l,ref:m,onPointerMove:je(e.onPointerMove,ol(S=>{i?u.onItemLeave(S):(u.onItemEnter(S),S.defaultPrevented||S.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:je(e.onPointerLeave,ol(S=>u.onItemLeave(S))),onFocus:je(e.onFocus,()=>v(!0)),onBlur:je(e.onBlur,()=>v(!1))})})})}),GA="MenuCheckboxItem",VS=w.forwardRef((e,n)=>{const{checked:r=!1,onCheckedChange:i,...o}=e;return f.jsx(GS,{scope:e.__scopeMenu,checked:r,children:f.jsx(Uu,{role:"menuitemcheckbox","aria-checked":bu(r)?"mixed":r,...o,ref:n,"data-state":Ip(r),onSelect:je(o.onSelect,()=>i?.(bu(r)?!0:!r),{checkForDefaultPrevented:!1})})})});VS.displayName=GA;var US="MenuRadioGroup",[ZA,KA]=Ni(US,{value:void 0,onValueChange:()=>{}}),HS=w.forwardRef((e,n)=>{const{value:r,onValueChange:i,...o}=e,l=tr(i);return f.jsx(ZA,{scope:e.__scopeMenu,value:r,onValueChange:l,children:f.jsx(Lp,{...o,ref:n})})});HS.displayName=US;var BS="MenuRadioItem",qS=w.forwardRef((e,n)=>{const{value:r,...i}=e,o=KA(BS,e.__scopeMenu),l=r===o.value;return f.jsx(GS,{scope:e.__scopeMenu,checked:l,children:f.jsx(Uu,{role:"menuitemradio","aria-checked":l,...i,ref:n,"data-state":Ip(l),onSelect:je(i.onSelect,()=>o.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});qS.displayName=BS;var $p="MenuItemIndicator",[GS,YA]=Ni($p,{checked:!1}),ZS=w.forwardRef((e,n)=>{const{__scopeMenu:r,forceMount:i,...o}=e,l=YA($p,r);return f.jsx(vr,{present:i||bu(l.checked)||l.checked===!0,children:f.jsx($e.span,{...o,ref:n,"data-state":Ip(l.checked)})})});ZS.displayName=$p;var QA="MenuSeparator",KS=w.forwardRef((e,n)=>{const{__scopeMenu:r,...i}=e;return f.jsx($e.div,{role:"separator","aria-orientation":"horizontal",...i,ref:n})});KS.displayName=QA;var XA="MenuArrow",YS=w.forwardRef((e,n)=>{const{__scopeMenu:r,...i}=e,o=Vu(r);return f.jsx(Mp,{...o,...i,ref:n})});YS.displayName=XA;var JA="MenuSub",[oF,QS]=Ni(JA),Zo="MenuSubTrigger",XS=w.forwardRef((e,n)=>{const r=Di(Zo,e.__scopeMenu),i=xl(Zo,e.__scopeMenu),o=QS(Zo,e.__scopeMenu),l=zp(Zo,e.__scopeMenu),u=w.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:p}=l,m={__scopeMenu:e.__scopeMenu},y=w.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);w.useEffect(()=>y,[y]),w.useEffect(()=>{const b=d.current;return()=>{window.clearTimeout(b),p(null)}},[d,p]);const v=nt(n,o.onTriggerChange);return f.jsx(Np,{asChild:!0,...m,children:f.jsx(FS,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?o.contentId:void 0,"data-state":e1(r.open),...e,ref:v,onClick:b=>{e.onClick?.(b),!(e.disabled||b.defaultPrevented)&&(b.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:je(e.onPointerMove,ol(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:je(e.onPointerLeave,ol(b=>{y();const x=r.content?.getBoundingClientRect();if(x){const S=r.content?.dataset.side,_=S==="right",E=_?-5:5,R=x[_?"left":"right"],T=x[_?"right":"left"];l.onPointerGraceIntentChange({area:[{x:b.clientX+E,y:b.clientY},{x:R,y:x.top},{x:T,y:x.top},{x:T,y:x.bottom},{x:R,y:x.bottom}],side:S}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(b),b.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:je(e.onKeyDown,b=>{e.disabled||b.target!==b.currentTarget||l.searchRef.current!==""&&b.key===" "||NA[i.dir].includes(b.key)&&(r.onOpenChange(!0),r.content?.focus(),b.preventDefault())})})})});XS.displayName=Zo;var JS="MenuSubContent",WS=w.forwardRef((e,n)=>{const r=LS(er,e.__scopeMenu),{forceMount:i=r.forceMount,align:o="start",...l}=e,u=Di(er,e.__scopeMenu),d=xl(er,e.__scopeMenu),p=QS(JS,e.__scopeMenu),m=w.useRef(null),y=nt(n,m);return f.jsx(sl.Provider,{scope:e.__scopeMenu,children:f.jsx(vr,{present:i||u.open,children:f.jsx(sl.Slot,{scope:e.__scopeMenu,children:f.jsx(kp,{id:p.contentId,"aria-labelledby":p.triggerId,...l,ref:y,align:o,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:je(e.onFocusOutside,v=>{v.target!==p.trigger&&u.onOpenChange(!1)}),onEscapeKeyDown:je(e.onEscapeKeyDown,v=>{d.onClose(),v.preventDefault()}),onKeyDown:je(e.onKeyDown,v=>{const b=v.currentTarget.contains(v.target),x=DA[d.dir].includes(v.key);b&&x&&(u.onOpenChange(!1),p.trigger?.focus(),v.preventDefault())})})})})})});WS.displayName=JS;function e1(e){return e?"open":"closed"}function bu(e){return e==="indeterminate"}function Ip(e){return bu(e)?"indeterminate":e?"checked":"unchecked"}function WA(e){const n=document.activeElement;for(const r of e)if(r===n||(r.focus(),document.activeElement!==n))return}function eM(e,n){return e.map((r,i)=>e[(n+i)%e.length])}function tM(e,n,r){const o=n.length>1&&Array.from(n).every(m=>m===n[0])?n[0]:n,l=r?e.indexOf(r):-1;let u=eM(e,Math.max(l,0));o.length===1&&(u=u.filter(m=>m!==r));const p=u.find(m=>m.toLowerCase().startsWith(o.toLowerCase()));return p!==r?p:void 0}function nM(e,n){const{x:r,y:i}=e;let o=!1;for(let l=0,u=n.length-1;li!=b>i&&r<(v-m)*(i-y)/(b-y)+m&&(o=!o)}return o}function rM(e,n){if(!n)return!1;const r={x:e.clientX,y:e.clientY};return nM(r,n)}function ol(e){return n=>n.pointerType==="mouse"?e(n):void 0}var aM=kS,iM=Np,sM=$S,oM=IS,lM=Lp,cM=PS,uM=Uu,dM=VS,fM=HS,hM=qS,mM=ZS,pM=KS,gM=YS,vM=XS,yM=WS,Hu="DropdownMenu",[bM]=Ga(Hu,[DS]),vn=DS(),[xM,t1]=bM(Hu),n1=e=>{const{__scopeDropdownMenu:n,children:r,dir:i,open:o,defaultOpen:l,onOpenChange:u,modal:d=!0}=e,p=vn(n),m=w.useRef(null),[y,v]=Fs({prop:o,defaultProp:l??!1,onChange:u,caller:Hu});return f.jsx(xM,{scope:n,triggerId:dn(),triggerRef:m,contentId:dn(),open:y,onOpenChange:v,onOpenToggle:w.useCallback(()=>v(b=>!b),[v]),modal:d,children:f.jsx(aM,{...p,open:y,onOpenChange:v,dir:i,modal:d,children:r})})};n1.displayName=Hu;var r1="DropdownMenuTrigger",a1=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,disabled:i=!1,...o}=e,l=t1(r1,r),u=vn(r),d=nt(n,l.triggerRef);return f.jsx(iM,{asChild:!0,...u,children:f.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,...o,ref:d,onPointerDown:je(e.onPointerDown,p=>{!i&&p.button===0&&p.ctrlKey===!1&&(l.onOpenToggle(),l.open||p.preventDefault())}),onKeyDown:je(e.onKeyDown,p=>{i||(["Enter"," "].includes(p.key)&&l.onOpenToggle(),p.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(p.key)&&p.preventDefault())})})})});a1.displayName=r1;var wM="DropdownMenuPortal",i1=e=>{const{__scopeDropdownMenu:n,...r}=e,i=vn(n);return f.jsx(sM,{...i,...r})};i1.displayName=wM;var s1="DropdownMenuContent",o1=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,o=t1(s1,r),l=vn(r),u=w.useRef(!1);return f.jsx(oM,{id:o.contentId,"aria-labelledby":o.triggerId,...l,...i,ref:n,onCloseAutoFocus:je(e.onCloseAutoFocus,d=>{u.current||o.triggerRef.current?.focus(),u.current=!1,d.preventDefault()}),onInteractOutside:je(e.onInteractOutside,d=>{const p=d.detail.originalEvent,m=p.button===0&&p.ctrlKey===!0,y=p.button===2||m;(!o.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)"}})});o1.displayName=s1;var SM="DropdownMenuGroup",_M=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(lM,{...o,...i,ref:n})});_M.displayName=SM;var CM="DropdownMenuLabel",l1=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(cM,{...o,...i,ref:n})});l1.displayName=CM;var EM="DropdownMenuItem",c1=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(uM,{...o,...i,ref:n})});c1.displayName=EM;var RM="DropdownMenuCheckboxItem",jM=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(dM,{...o,...i,ref:n})});jM.displayName=RM;var TM="DropdownMenuRadioGroup",OM=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(fM,{...o,...i,ref:n})});OM.displayName=TM;var AM="DropdownMenuRadioItem",MM=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(hM,{...o,...i,ref:n})});MM.displayName=AM;var NM="DropdownMenuItemIndicator",DM=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(mM,{...o,...i,ref:n})});DM.displayName=NM;var zM="DropdownMenuSeparator",kM=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(pM,{...o,...i,ref:n})});kM.displayName=zM;var LM="DropdownMenuArrow",$M=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(gM,{...o,...i,ref:n})});$M.displayName=LM;var IM="DropdownMenuSubTrigger",PM=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(vM,{...o,...i,ref:n})});PM.displayName=IM;var FM="DropdownMenuSubContent",VM=w.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(yM,{...o,...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)"}})});VM.displayName=FM;var UM=n1,HM=a1,BM=i1,qM=o1,GM=l1,ZM=c1,KM="Label",u1=w.forwardRef((e,n)=>f.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())}}));u1.displayName=KM;var YM=u1;function ex(e,[n,r]){return Math.min(r,Math.max(n,e))}var QM=[" ","Enter","ArrowUp","ArrowDown"],XM=[" ","Enter"],Ri="Select",[Bu,qu,JM]=lp(Ri),[zi]=Ga(Ri,[JM,Zs]),Gu=Zs(),[WM,Ka]=zi(Ri),[eN,tN]=zi(Ri),nN="SelectProvider";function d1(e){const{__scopeSelect:n,children:r,open:i,defaultOpen:o,onOpenChange:l,value:u,defaultValue:d,onValueChange:p,dir:m,name:y,autoComplete:v,disabled:b,required:x,form:S,internal_do_not_use_render:_}=e,E=Gu(n),[R,T]=w.useState(null),[O,M]=w.useState(null),[D,P]=w.useState(!1),F=cp(m),[V,ve]=Fs({prop:i,defaultProp:o??!1,onChange:l,caller:Ri}),[be,he]=Fs({prop:u,defaultProp:d,onChange:p,caller:Ri}),ue=w.useRef(null),X=w.useRef(be);w.useEffect(()=>{const N=S?R?.ownerDocument.getElementById(S):R?.form;if(N instanceof HTMLFormElement){const B=()=>he(X.current);return N.addEventListener("reset",B),()=>N.removeEventListener("reset",B)}},[S,R,he]);const pe=R?!!S||!!R.closest("form"):!0,[ge,L]=w.useState(new Set),K=dn(),re=Array.from(ge).map(N=>N.props.value).join(";"),W=w.useCallback(N=>{L(B=>new Set(B).add(N))},[]),te=w.useCallback(N=>{L(B=>{const J=new Set(B);return J.delete(N),J})},[]),z={required:x,trigger:R,onTriggerChange:T,valueNode:O,onValueNodeChange:M,valueNodeHasChildren:D,onValueNodeHasChildrenChange:P,contentId:K,value:be,onValueChange:he,open:V,onOpenChange:ve,dir:F,triggerPointerDownPosRef:ue,disabled:b,name:y,autoComplete:v,form:S,nativeOptions:ge,nativeSelectKey:re,isFormControl:pe};return f.jsx(Tp,{...E,children:f.jsx(WM,{scope:n,...z,children:f.jsx(Bu.Provider,{scope:n,children:f.jsx(eN,{scope:n,onNativeOptionAdd:W,onNativeOptionRemove:te,children:bN(_)?_(z):r})})})})}d1.displayName=nN;var f1=e=>{const{__scopeSelect:n,children:r,...i}=e;return f.jsx(d1,{__scopeSelect:n,...i,internal_do_not_use_render:({isFormControl:o})=>f.jsxs(f.Fragment,{children:[r,o?f.jsx(I1,{__scopeSelect:n}):null]})})};f1.displayName=Ri;var h1="SelectTrigger",m1=w.forwardRef((e,n)=>{const{__scopeSelect:r,disabled:i=!1,...o}=e,l=Gu(r),u=Ka(h1,r),d=u.disabled||i,p=nt(n,u.onTriggerChange),m=qu(r),y=w.useRef("touch"),[v,b,x]=P1(_=>{const E=m().filter(O=>!O.disabled),R=E.find(O=>O.value===u.value),T=F1(E,_,R);T!==void 0&&u.onValueChange(T.value)}),S=_=>{d||(u.onOpenChange(!0),x()),_&&(u.triggerPointerDownPosRef.current={x:Math.round(_.pageX),y:Math.round(_.pageY)})};return f.jsx(Op,{asChild:!0,...l,children:f.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":Zu(u.value)?"":void 0,...o,ref:p,onClick:je(o.onClick,_=>{_.currentTarget.focus(),y.current!=="mouse"&&S(_)}),onPointerDown:je(o.onPointerDown,_=>{y.current=_.pointerType;const E=_.target;E.hasPointerCapture(_.pointerId)&&E.releasePointerCapture(_.pointerId),_.button===0&&_.ctrlKey===!1&&_.pointerType==="mouse"&&(S(_),_.preventDefault())}),onKeyDown:je(o.onKeyDown,_=>{const E=v.current!=="";!(_.ctrlKey||_.altKey||_.metaKey)&&_.key.length===1&&b(_.key),!(E&&_.key===" ")&&QM.includes(_.key)&&(S(),_.preventDefault())})})})});m1.displayName=h1;var p1="SelectValue",g1=w.forwardRef((e,n)=>{const{__scopeSelect:r,className:i,style:o,children:l,placeholder:u="",...d}=e,p=Ka(p1,r),{onValueNodeHasChildrenChange:m}=p,y=l!==void 0,v=nt(n,p.onValueNodeChange);Yt(()=>{m(y)},[m,y]);const b=Zu(p.value);return f.jsx($e.span,{...d,asChild:b?!1:d.asChild,ref:v,style:{pointerEvents:"none"},children:f.jsx(w.Fragment,{children:b?u:l},b?"placeholder":"value")})});g1.displayName=p1;var rN="SelectIcon",v1=w.forwardRef((e,n)=>{const{__scopeSelect:r,children:i,...o}=e;return f.jsx($e.span,{"aria-hidden":!0,...o,ref:n,children:i||"▼"})});v1.displayName=rN;var y1="SelectPortal",[aN,iN]=zi(y1,{forceMount:void 0}),b1=e=>{const{__scopeSelect:n,forceMount:r,...i}=e;return f.jsx(aN,{scope:e.__scopeSelect,forceMount:r,children:f.jsx(vl,{asChild:!0,...i})})};b1.displayName=y1;var Ha="SelectContent",x1=w.forwardRef((e,n)=>{const r=iN(Ha,e.__scopeSelect),{forceMount:i=r.forceMount,...o}=e,l=Ka(Ha,e.__scopeSelect),[u,d]=w.useState();return Yt(()=>{d(new DocumentFragment)},[]),f.jsx(vr,{present:i||l.open,children:({present:p})=>p?f.jsx(_1,{...o,ref:n}):f.jsx(w1,{...o,fragment:u})})});x1.displayName=Ha;var w1=w.forwardRef((e,n)=>{const{__scopeSelect:r,children:i,fragment:o}=e;return o?Mi.createPortal(f.jsx(S1,{scope:r,children:f.jsx(Bu.Slot,{scope:r,children:f.jsx("div",{ref:n,children:i})})}),o):null});w1.displayName="SelectContentFragment";var fr=10,[S1,Ya]=zi(Ha),sN="SelectContentImpl",oN=_i("SelectContent.RemoveScroll"),_1=w.forwardRef((e,n)=>{const{__scopeSelect:r}=e,{position:i="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:l,onPointerDownOutside:u,side:d,sideOffset:p,align:m,alignOffset:y,arrowPadding:v,collisionBoundary:b,collisionPadding:x,sticky:S,hideWhenDetached:_,avoidCollisions:E,...R}=e,T=Ka(Ha,r),[O,M]=w.useState(null),[D,P]=w.useState(null),F=nt(n,M),[V,ve]=w.useState(null),[be,he]=w.useState(null),ue=qu(r),[X,pe]=w.useState(!1),ge=w.useRef(!1);w.useEffect(()=>{if(O)return fp(O)},[O]),dp();const L=w.useCallback(ae=>{const[ye,...xe]=ue().map(Ve=>Ve.ref.current),[Oe]=xe.slice(-1),Ie=document.activeElement;for(const Ve of ae)if(Ve===Ie||(Ve?.scrollIntoView({block:"nearest"}),Ve===ye&&D&&(D.scrollTop=0),Ve===Oe&&D&&(D.scrollTop=D.scrollHeight),Ve?.focus(),document.activeElement!==Ie))return},[ue,D]),K=w.useCallback(()=>L([V,O]),[L,V,O]);w.useEffect(()=>{X&&K()},[X,K]);const{onOpenChange:re,triggerPointerDownPosRef:W}=T;w.useEffect(()=>{if(O){let ae={x:0,y:0};const ye=Oe=>{ae={x:Math.abs(Math.round(Oe.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(Oe.pageY)-(W.current?.y??0))}},xe=Oe=>{ae.x<=10&&ae.y<=10?Oe.preventDefault():Oe.composedPath().includes(O)||re(!1),document.removeEventListener("pointermove",ye),W.current=null};return W.current!==null&&(document.addEventListener("pointermove",ye),document.addEventListener("pointerup",xe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ye),document.removeEventListener("pointerup",xe,{capture:!0})}}},[O,re,W]),w.useEffect(()=>{const ae=()=>re(!1);return window.addEventListener("blur",ae),window.addEventListener("resize",ae),()=>{window.removeEventListener("blur",ae),window.removeEventListener("resize",ae)}},[re]);const[te,z]=P1(ae=>{const ye=ue().filter(Ie=>!Ie.disabled),xe=ye.find(Ie=>Ie.ref.current===document.activeElement),Oe=F1(ye,ae,xe);Oe&&setTimeout(()=>Oe.ref.current?.focus())}),N=w.useCallback((ae,ye,xe)=>{const Oe=!ge.current&&!xe;(T.value!==void 0&&T.value===ye||Oe)&&(ve(ae),Oe&&(ge.current=!0))},[T.value]),B=w.useCallback(()=>O?.focus(),[O]),J=w.useCallback((ae,ye,xe)=>{const Oe=!ge.current&&!xe;(T.value!==void 0&&T.value===ye||Oe)&&he(ae)},[T.value]),Y=i==="popper"?Cm:C1,le=Y===Cm?{side:d,sideOffset:p,align:m,alignOffset:y,arrowPadding:v,collisionBoundary:b,collisionPadding:x,sticky:S,hideWhenDetached:_,avoidCollisions:E}:{};return f.jsx(S1,{scope:r,content:O,viewport:D,onViewportChange:P,itemRefCallback:N,selectedItem:V,onItemLeave:B,itemTextRefCallback:J,focusSelectedItem:K,selectedItemText:be,position:i,isPositioned:X,searchRef:te,children:f.jsx(zu,{as:oN,allowPinchZoom:!0,children:f.jsx(Nu,{asChild:!0,trapped:T.open,onMountAutoFocus:ae=>{ae.preventDefault()},onUnmountAutoFocus:je(o,ae=>{T.trigger?.focus({preventScroll:!0}),ae.preventDefault()}),children:f.jsx(gl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:ae=>ae.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:f.jsx(Y,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:ae=>ae.preventDefault(),...R,...le,onPlaced:()=>pe(!0),ref:F,style:{display:"flex",flexDirection:"column",outline:"none",...R.style},onKeyDown:je(R.onKeyDown,ae=>{const ye=ae.ctrlKey||ae.altKey||ae.metaKey;if(ae.key==="Tab"&&ae.preventDefault(),!ye&&ae.key.length===1&&z(ae.key),["ArrowUp","ArrowDown","Home","End"].includes(ae.key)){let Oe=ue().filter(Ie=>!Ie.disabled).map(Ie=>Ie.ref.current);if(["ArrowUp","End"].includes(ae.key)&&(Oe=Oe.slice().reverse()),["ArrowUp","ArrowDown"].includes(ae.key)){const Ie=ae.target,Ve=Oe.indexOf(Ie);Oe=Oe.slice(Ve+1)}setTimeout(()=>L(Oe)),ae.preventDefault()}})})})})})})});_1.displayName=sN;var lN="SelectItemAlignedPosition",C1=w.forwardRef((e,n)=>{const{__scopeSelect:r,onPlaced:i,...o}=e,l=Ka(Ha,r),u=Ya(Ha,r),[d,p]=w.useState(null),[m,y]=w.useState(null),v=nt(n,y),b=qu(r),x=w.useRef(!1),S=w.useRef(!0),{viewport:_,selectedItem:E,selectedItemText:R,focusSelectedItem:T}=u,O=w.useCallback(()=>{if(l.trigger&&l.valueNode&&d&&m&&_&&E&&R){const F=l.trigger.getBoundingClientRect(),V=m.getBoundingClientRect(),ve=l.valueNode.getBoundingClientRect(),be=R.getBoundingClientRect();if(l.dir!=="rtl"){const Ie=be.left-V.left,Ve=ve.left-Ie,it=F.left-Ve,Qe=F.width+it,fn=Math.max(Qe,V.width),hn=window.innerWidth-fr,Qt=ex(Ve,[fr,Math.max(fr,hn-fn)]);d.style.minWidth=Qe+"px",d.style.left=Qt+"px"}else{const Ie=V.right-be.right,Ve=window.innerWidth-ve.right-Ie,it=window.innerWidth-F.right-Ve,Qe=F.width+it,fn=Math.max(Qe,V.width),hn=window.innerWidth-fr,Qt=ex(Ve,[fr,Math.max(fr,hn-fn)]);d.style.minWidth=Qe+"px",d.style.right=Qt+"px"}const he=b(),ue=window.innerHeight-fr*2,X=_.scrollHeight,pe=window.getComputedStyle(m),ge=parseInt(pe.borderTopWidth,10),L=parseInt(pe.paddingTop,10),K=parseInt(pe.borderBottomWidth,10),re=parseInt(pe.paddingBottom,10),W=ge+L+X+re+K,te=Math.min(E.offsetHeight*5,W),z=window.getComputedStyle(_),N=parseInt(z.paddingTop,10),B=parseInt(z.paddingBottom,10),J=F.top+F.height/2-fr,Y=ue-J,le=E.offsetHeight/2,ae=E.offsetTop+le,ye=ge+L+ae,xe=W-ye;if(ye<=J){const Ie=he.length>0&&E===he[he.length-1].ref.current;d.style.bottom="0px";const Ve=m.clientHeight-_.offsetTop-_.offsetHeight,it=Math.max(Y,le+(Ie?B:0)+Ve+K),Qe=ye+it;d.style.height=Qe+"px"}else{const Ie=he.length>0&&E===he[0].ref.current;d.style.top="0px";const it=Math.max(J,ge+_.offsetTop+(Ie?N:0)+le)+xe;d.style.height=it+"px",_.scrollTop=ye-J+_.offsetTop}d.style.margin=`${fr}px 0`,d.style.minHeight=te+"px",d.style.maxHeight=ue+"px",i?.(),requestAnimationFrame(()=>x.current=!0)}},[b,l.trigger,l.valueNode,d,m,_,E,R,l.dir,i]);Yt(()=>O(),[O]);const[M,D]=w.useState();Yt(()=>{m&&D(window.getComputedStyle(m).zIndex)},[m]);const P=w.useCallback(F=>{F&&S.current===!0&&(O(),T?.(),S.current=!1)},[O,T]);return f.jsx(uN,{scope:r,contentWrapper:d,shouldExpandOnScrollRef:x,onScrollButtonChange:P,children:f.jsx("div",{ref:p,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:M},children:f.jsx($e.div,{...o,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});C1.displayName=lN;var cN="SelectPopperPosition",Cm=w.forwardRef((e,n)=>{const{__scopeSelect:r,align:i="start",collisionPadding:o=fr,...l}=e,u=Gu(r);return f.jsx(Ap,{...u,...l,ref:n,align:i,collisionPadding:o,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)"}})});Cm.displayName=cN;var[uN,Pp]=zi(Ha,{}),Em="SelectViewport",E1=w.forwardRef((e,n)=>{const{__scopeSelect:r,nonce:i,...o}=e,l=Ya(Em,r),u=Pp(Em,r),d=nt(n,l.onViewportChange),p=w.useRef(0);return f.jsxs(f.Fragment,{children:[f.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}),f.jsx(Bu.Slot,{scope:r,children:f.jsx($e.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:je(o.onScroll,m=>{const y=m.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:b}=u;if(b?.current&&v){const x=Math.abs(p.current-y.scrollTop);if(x>0){const S=window.innerHeight-fr*2,_=parseFloat(v.style.minHeight),E=parseFloat(v.style.height),R=Math.max(_,E);if(R0?M:0,v.style.justifyContent="flex-end")}}}p.current=y.scrollTop})})})]})});E1.displayName=Em;var R1="SelectGroup",[dN,fN]=zi(R1),hN=w.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e,o=dn();return f.jsx(dN,{scope:r,id:o,children:f.jsx($e.div,{role:"group","aria-labelledby":o,...i,ref:n})})});hN.displayName=R1;var j1="SelectLabel",mN=w.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e,o=fN(j1,r);return f.jsx($e.div,{id:o.id,...i,ref:n})});mN.displayName=j1;var xu="SelectItem",[pN,T1]=zi(xu),O1=w.forwardRef((e,n)=>{const{__scopeSelect:r,value:i,disabled:o=!1,textValue:l,...u}=e,d=Ka(xu,r),p=Ya(xu,r),m=d.value===i,[y,v]=w.useState(l??""),[b,x]=w.useState(!1),S=tr(O=>p.itemRefCallback?.(O,i,o)),_=nt(n,S),E=dn(),R=w.useRef("touch"),T=()=>{o||(d.onValueChange(i),d.onOpenChange(!1))};return f.jsx(pN,{scope:r,value:i,disabled:o,textId:E,isSelected:m,onItemTextChange:w.useCallback(O=>{v(M=>M||(O?.textContent??"").trim())},[]),children:f.jsx(Bu.ItemSlot,{scope:r,value:i,disabled:o,textValue:y,children:f.jsx($e.div,{role:"option","aria-labelledby":E,"data-highlighted":b?"":void 0,"aria-selected":m&&b,"data-state":m?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...u,ref:_,onFocus:je(u.onFocus,()=>x(!0)),onBlur:je(u.onBlur,()=>x(!1)),onClick:je(u.onClick,()=>{R.current!=="mouse"&&T()}),onPointerUp:je(u.onPointerUp,()=>{R.current==="mouse"&&T()}),onPointerDown:je(u.onPointerDown,O=>{R.current=O.pointerType}),onPointerMove:je(u.onPointerMove,O=>{R.current=O.pointerType,o?p.onItemLeave?.():R.current==="mouse"&&O.currentTarget.focus({preventScroll:!0})}),onPointerLeave:je(u.onPointerLeave,O=>{O.currentTarget===document.activeElement&&p.onItemLeave?.()}),onKeyDown:je(u.onKeyDown,O=>{o||O.target!==O.currentTarget||p.searchRef?.current!==""&&O.key===" "||(XM.includes(O.key)&&T(),O.key===" "&&O.preventDefault())})})})})});O1.displayName=xu;var Ko="SelectItemText",A1=w.forwardRef((e,n)=>{const{__scopeSelect:r,className:i,style:o,...l}=e,u=Ka(Ko,r),d=Ya(Ko,r),p=T1(Ko,r),m=tN(Ko,r),[y,v]=w.useState(null),b=tr(T=>d.itemTextRefCallback?.(T,p.value,p.disabled)),x=nt(n,v,p.onItemTextChange,b),S=y?.textContent,_=w.useMemo(()=>f.jsx("option",{value:p.value,disabled:p.disabled,children:S},p.value),[p.disabled,p.value,S]),{onNativeOptionAdd:E,onNativeOptionRemove:R}=m;return Yt(()=>(E(_),()=>R(_)),[E,R,_]),f.jsxs(f.Fragment,{children:[f.jsx($e.span,{id:p.textId,...l,ref:x}),p.isSelected&&u.valueNode&&!u.valueNodeHasChildren&&!Zu(u.value)?Mi.createPortal(l.children,u.valueNode):null]})});A1.displayName=Ko;var M1="SelectItemIndicator",N1=w.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e;return T1(M1,r).isSelected?f.jsx($e.span,{"aria-hidden":!0,...i,ref:n}):null});N1.displayName=M1;var Rm="SelectScrollUpButton",D1=w.forwardRef((e,n)=>{const r=Ya(Rm,e.__scopeSelect),i=Pp(Rm,e.__scopeSelect),[o,l]=w.useState(!1),u=nt(n,i.onScrollButtonChange);return Yt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const m=p.scrollTop>0;l(m)};const p=r.viewport;return d(),p.addEventListener("scroll",d),()=>p.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),o?f.jsx(k1,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:p}=r;d&&p&&(d.scrollTop=d.scrollTop-p.offsetHeight)}}):null});D1.displayName=Rm;var jm="SelectScrollDownButton",z1=w.forwardRef((e,n)=>{const r=Ya(jm,e.__scopeSelect),i=Pp(jm,e.__scopeSelect),[o,l]=w.useState(!1),u=nt(n,i.onScrollButtonChange);return Yt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const m=p.scrollHeight-p.clientHeight,y=Math.ceil(p.scrollTop)p.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),o?f.jsx(k1,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:p}=r;d&&p&&(d.scrollTop=d.scrollTop+p.offsetHeight)}}):null});z1.displayName=jm;var k1=w.forwardRef((e,n)=>{const{__scopeSelect:r,onAutoScroll:i,...o}=e,l=Ya("SelectScrollButton",r),u=w.useRef(null),d=qu(r),p=w.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return w.useEffect(()=>()=>p(),[p]),Yt(()=>{d().find(y=>y.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[d]),f.jsx($e.div,{"aria-hidden":!0,...o,ref:n,style:{flexShrink:0,...o.style},onPointerDown:je(o.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(i,50))}),onPointerMove:je(o.onPointerMove,()=>{l.onItemLeave?.(),u.current===null&&(u.current=window.setInterval(i,50))}),onPointerLeave:je(o.onPointerLeave,()=>{p()})})}),gN="SelectSeparator",vN=w.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e;return f.jsx($e.div,{"aria-hidden":!0,...i,ref:n})});vN.displayName=gN;var L1="SelectArrow",yN=w.forwardRef((e,n)=>{const{__scopeSelect:r,...i}=e,o=Gu(r);return Ya(L1,r).position==="popper"?f.jsx(Mp,{...o,...i,ref:n}):null});yN.displayName=L1;var $1="SelectBubbleInput",I1=w.forwardRef(({__scopeSelect:e,...n},r)=>{const i=Ka($1,e),{value:o,onValueChange:l,required:u,disabled:d,name:p,autoComplete:m,form:y}=i,{nativeOptions:v,nativeSelectKey:b}=i,x=w.useRef(null),S=nt(r,x),_=o??"",E=WT(_),R=Array.from(v).some(T=>(T.props.value??"")==="");return w.useEffect(()=>{const T=x.current;if(!T)return;const O=window.HTMLSelectElement.prototype,D=Object.getOwnPropertyDescriptor(O,"value").set;if(E!==_&&D){const P=new Event("change",{bubbles:!0});D.call(T,_),T.dispatchEvent(P)}},[E,_]),f.jsxs($e.select,{"aria-hidden":!0,required:u,tabIndex:-1,name:p,autoComplete:m,disabled:d,form:y,onChange:T=>l(T.target.value),...n,style:{...Iw,...n.style},ref:S,defaultValue:_,children:[Zu(o)&&!R?f.jsx("option",{value:""}):null,Array.from(v)]},b)});I1.displayName=$1;function bN(e){return typeof e=="function"}function Zu(e){return e===""||e===void 0}function P1(e){const n=tr(e),r=w.useRef(""),i=w.useRef(0),o=w.useCallback(u=>{const d=r.current+u;n(d),(function p(m){r.current=m,window.clearTimeout(i.current),m!==""&&(i.current=window.setTimeout(()=>p(""),1e3))})(d)},[n]),l=w.useCallback(()=>{r.current="",window.clearTimeout(i.current)},[]);return w.useEffect(()=>()=>window.clearTimeout(i.current),[]),[r,o,l]}function F1(e,n,r){const o=n.length>1&&Array.from(n).every(m=>m===n[0])?n[0]:n,l=r?e.indexOf(r):-1;let u=xN(e,Math.max(l,0));o.length===1&&(u=u.filter(m=>m!==r));const p=u.find(m=>m.textValue.toLowerCase().startsWith(o.toLowerCase()));return p!==r?p:void 0}function xN(e,n){return e.map((r,i)=>e[(n+i)%e.length])}var wN="Separator",tx="horizontal",SN=["horizontal","vertical"],V1=w.forwardRef((e,n)=>{const{decorative:r,orientation:i=tx,...o}=e,l=_N(i)?i:tx,d=r?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return f.jsx($e.div,{"data-orientation":l,...d,...o,ref:n})});V1.displayName=wN;function _N(e){return SN.includes(e)}var CN=V1,[Ku]=Ga("Tooltip",[Zs]),Yu=Zs(),U1="TooltipProvider",EN=700,Tm="tooltip.open",[RN,Fp]=Ku(U1),H1=e=>{const{__scopeTooltip:n,delayDuration:r=EN,skipDelayDuration:i=300,disableHoverableContent:o=!1,children:l}=e,u=w.useRef(!0),d=w.useRef(!1),p=w.useRef(0);return w.useEffect(()=>{const m=p.current;return()=>window.clearTimeout(m)},[]),f.jsx(RN,{scope:n,isOpenDelayedRef:u,delayDuration:r,onOpen:w.useCallback(()=>{i<=0||(window.clearTimeout(p.current),u.current=!1)},[i]),onClose:w.useCallback(()=>{i<=0||(window.clearTimeout(p.current),p.current=window.setTimeout(()=>u.current=!0,i))},[i]),isPointerInTransitRef:d,onPointerInTransitChange:w.useCallback(m=>{d.current=m},[]),disableHoverableContent:o,children:l})};H1.displayName=U1;var ll="Tooltip",[jN,wl]=Ku(ll),B1=e=>{const{__scopeTooltip:n,children:r,open:i,defaultOpen:o,onOpenChange:l,disableHoverableContent:u,delayDuration:d}=e,p=Fp(ll,e.__scopeTooltip),m=Yu(n),[y,v]=w.useState(null),b=dn(),x=w.useRef(0),S=u??p.disableHoverableContent,_=d??p.delayDuration,E=w.useRef(!1),[R,T]=Fs({prop:i,defaultProp:o??!1,onChange:F=>{F?(p.onOpen(),document.dispatchEvent(new CustomEvent(Tm))):p.onClose(),l?.(F)},caller:ll}),O=w.useMemo(()=>R?E.current?"delayed-open":"instant-open":"closed",[R]),M=w.useCallback(()=>{window.clearTimeout(x.current),x.current=0,E.current=!1,T(!0)},[T]),D=w.useCallback(()=>{window.clearTimeout(x.current),x.current=0,T(!1)},[T]),P=w.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{E.current=!0,T(!0),x.current=0},_)},[_,T]);return w.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),f.jsx(Tp,{...m,children:f.jsx(jN,{scope:n,contentId:b,open:R,stateAttribute:O,trigger:y,onTriggerChange:v,onTriggerEnter:w.useCallback(()=>{p.isOpenDelayedRef.current?P():M()},[p.isOpenDelayedRef,P,M]),onTriggerLeave:w.useCallback(()=>{S?D():(window.clearTimeout(x.current),x.current=0)},[D,S]),onOpen:M,onClose:D,disableHoverableContent:S,children:r})})};B1.displayName=ll;var Om="TooltipTrigger",q1=w.forwardRef((e,n)=>{const{__scopeTooltip:r,...i}=e,o=wl(Om,r),l=Fp(Om,r),u=Yu(r),d=w.useRef(null),p=nt(n,d,o.onTriggerChange),m=w.useRef(!1),y=w.useRef(!1),v=w.useCallback(()=>m.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),f.jsx(Op,{asChild:!0,...u,children:f.jsx($e.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...i,ref:p,onPointerMove:je(e.onPointerMove,b=>{b.pointerType!=="touch"&&!y.current&&!l.isPointerInTransitRef.current&&(o.onTriggerEnter(),y.current=!0)}),onPointerLeave:je(e.onPointerLeave,()=>{o.onTriggerLeave(),y.current=!1}),onPointerDown:je(e.onPointerDown,()=>{o.open&&o.onClose(),m.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:je(e.onFocus,()=>{m.current||o.onOpen()}),onBlur:je(e.onBlur,o.onClose),onClick:je(e.onClick,o.onClose)})})});q1.displayName=Om;var Vp="TooltipPortal",[TN,ON]=Ku(Vp,{forceMount:void 0}),G1=e=>{const{__scopeTooltip:n,forceMount:r,children:i,container:o}=e,l=wl(Vp,n);return f.jsx(TN,{scope:n,forceMount:r,children:f.jsx(vr,{present:r||l.open,children:f.jsx(vl,{asChild:!0,container:o,children:i})})})};G1.displayName=Vp;var Us="TooltipContent",Z1=w.forwardRef((e,n)=>{const r=ON(Us,e.__scopeTooltip),{forceMount:i=r.forceMount,side:o="top",...l}=e,u=wl(Us,e.__scopeTooltip);return f.jsx(vr,{present:i||u.open,children:u.disableHoverableContent?f.jsx(K1,{side:o,...l,ref:n}):f.jsx(AN,{side:o,...l,ref:n})})}),AN=w.forwardRef((e,n)=>{const r=wl(Us,e.__scopeTooltip),i=Fp(Us,e.__scopeTooltip),o=w.useRef(null),l=nt(n,o),[u,d]=w.useState(null),{trigger:p,onClose:m}=r,y=o.current,{onPointerInTransitChange:v}=i,b=w.useCallback(()=>{d(null),v(!1)},[v]),x=w.useCallback((S,_)=>{const E=S.currentTarget,R={x:S.clientX,y:S.clientY},T=zN(R,E.getBoundingClientRect()),O=kN(R,T),M=LN(_.getBoundingClientRect()),D=IN([...O,...M]);d(D),v(!0)},[v]);return w.useEffect(()=>()=>b(),[b]),w.useEffect(()=>{if(p&&y){const S=E=>x(E,y),_=E=>x(E,p);return p.addEventListener("pointerleave",S),y.addEventListener("pointerleave",_),()=>{p.removeEventListener("pointerleave",S),y.removeEventListener("pointerleave",_)}}},[p,y,x,b]),w.useEffect(()=>{if(u){const S=_=>{const E=_.target,R={x:_.clientX,y:_.clientY},T=p?.contains(E)||y?.contains(E),O=!$N(R,u);T?b():O&&(b(),m())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[p,y,u,m,b]),f.jsx(K1,{...e,ref:l})}),[MN,NN]=Ku(ll,{isInside:!1}),DN=xj("TooltipContent"),K1=w.forwardRef((e,n)=>{const{__scopeTooltip:r,children:i,"aria-label":o,onEscapeKeyDown:l,onPointerDownOutside:u,...d}=e,p=wl(Us,r),m=Yu(r),{onClose:y}=p;return w.useEffect(()=>(document.addEventListener(Tm,y),()=>document.removeEventListener(Tm,y)),[y]),w.useEffect(()=>{if(p.trigger){const v=b=>{b.target instanceof Node&&b.target.contains(p.trigger)&&y()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[p.trigger,y]),f.jsx(gl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:v=>v.preventDefault(),onDismiss:y,children:f.jsxs(Ap,{"data-state":p.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:[f.jsx(DN,{children:i}),f.jsx(MN,{scope:r,isInside:!0,children:f.jsx(Mj,{id:p.contentId,role:"tooltip",children:o||i})})]})})});Z1.displayName=Us;var Y1="TooltipArrow",Q1=w.forwardRef((e,n)=>{const{__scopeTooltip:r,...i}=e,o=Yu(r);return NN(Y1,r).isInside?null:f.jsx(Mp,{...o,...i,ref:n})});Q1.displayName=Y1;function zN(e,n){const r=Math.abs(n.top-e.y),i=Math.abs(n.bottom-e.y),o=Math.abs(n.right-e.x),l=Math.abs(n.left-e.x);switch(Math.min(r,i,o,l)){case l:return"left";case o:return"right";case r:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function kN(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 LN(e){const{top:n,right:r,bottom:i,left:o}=e;return[{x:o,y:n},{x:r,y:n},{x:r,y:i},{x:o,y:i}]}function $N(e,n){const{x:r,y:i}=e;let o=!1;for(let l=0,u=n.length-1;li!=b>i&&r<(v-m)*(i-y)/(b-y)+m&&(o=!o)}return o}function IN(e){const n=e.slice();return n.sort((r,i)=>r.xi.x?1:r.yi.y?1:0),PN(n)}function PN(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)*(o.y-u.y)>=(l.y-u.y)*(o.x-u.x))n.pop();else break}n.push(o)}n.pop();const r=[];for(let i=e.length-1;i>=0;i--){const o=e[i];for(;r.length>=2;){const l=r[r.length-1],u=r[r.length-2];if((l.x-u.x)*(o.y-u.y)>=(l.y-u.y)*(o.x-u.x))r.pop();else break}r.push(o)}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 FN=H1,VN=B1,UN=q1,HN=G1,BN=Z1,qN=Q1;function X1(e){var n,r,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(n=0;n{const r=new Array(e.length+n.length);for(let i=0;i({classGroupId:e,validator:n}),W1=(e=new Map,n=null,r)=>({nextPart:e,validators:n,classGroupId:r}),wu="-",nx=[],KN="arbitrary..",YN=e=>{const n=XN(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return QN(u);const d=u.split(wu),p=d[0]===""&&d.length>1?1:0;return e_(d,p,n)},getConflictingClassGroupIds:(u,d)=>{if(d){const p=i[u],m=r[u];return p?m?GN(m,p):p:m||nx}return r[u]||nx}}},e_=(e,n,r)=>{if(e.length-n===0)return r.classGroupId;const o=e[n],l=r.nextPart.get(o);if(l){const m=e_(e,n+1,l);if(m)return m}const u=r.validators;if(u===null)return;const d=n===0?e.join(wu):e.slice(n).join(wu),p=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?KN+i:void 0})(),XN=e=>{const{theme:n,classGroups:r}=e;return JN(r,n)},JN=(e,n)=>{const r=W1();for(const i in e){const o=e[i];Up(o,r,i,n)}return r},Up=(e,n,r,i)=>{const o=e.length;for(let l=0;l{if(typeof e=="string"){eD(e,n,r);return}if(typeof e=="function"){tD(e,n,r,i);return}nD(e,n,r,i)},eD=(e,n,r)=>{const i=e===""?n:t_(n,e);i.classGroupId=r},tD=(e,n,r,i)=>{if(rD(e)){Up(e(i),n,r,i);return}n.validators===null&&(n.validators=[]),n.validators.push(ZN(r,e))},nD=(e,n,r,i)=>{const o=Object.entries(e),l=o.length;for(let u=0;u{let r=e;const i=n.split(wu),o=i.length;for(let l=0;l"isThemeGetter"in e&&e.isThemeGetter===!0,aD=e=>{if(e<1)return{get:()=>{},set:()=>{}};let n=0,r=Object.create(null),i=Object.create(null);const o=(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 o(l,u),u},set(l,u){l in r?r[l]=u:o(l,u)}}},Am="!",rx=":",iD=[],ax=(e,n,r,i,o)=>({modifiers:e,hasImportantModifier:n,baseClassName:r,maybePostfixModifierPosition:i,isExternal:o}),sD=e=>{const{prefix:n,experimentalParseClassName:r}=e;let i=o=>{const l=[];let u=0,d=0,p=0,m;const y=o.length;for(let _=0;_p?m-p:void 0;return ax(l,x,b,S)};if(n){const o=n+rx,l=i;i=u=>u.startsWith(o)?l(u.slice(o.length)):ax(iD,!1,u,void 0,!0)}if(r){const o=i;i=l=>r({className:l,parseClassName:o})}return i},oD=e=>{const n=new Map;return e.orderSensitiveModifiers.forEach((r,i)=>{n.set(r,1e6+i)}),r=>{const i=[];let o=[];for(let l=0;l0&&(o.sort(),i.push(...o),o=[]),i.push(u)):o.push(u)}return o.length>0&&(o.sort(),i.push(...o)),i}},lD=e=>({cache:aD(e.cacheSize),parseClassName:sD(e),sortModifiers:oD(e),postfixLookupClassGroupIds:cD(e),...YN(e)}),cD=e=>{const n=Object.create(null),r=e.postfixLookupClassGroups;if(r)for(let i=0;i{const{parseClassName:r,getClassGroupId:i,getConflictingClassGroupIds:o,sortModifiers:l,postfixLookupClassGroupIds:u}=n,d=[],p=e.trim().split(uD);let m="";for(let y=p.length-1;y>=0;y-=1){const v=p[y],{isExternal:b,modifiers:x,hasImportantModifier:S,baseClassName:_,maybePostfixModifierPosition:E}=r(v);if(b){m=v+(m.length>0?" "+m:m);continue}let R=!!E,T;if(R){const F=_.substring(0,E);T=i(F);const V=T&&u[T]?i(_):void 0;V&&V!==T&&(T=V,R=!1)}else T=i(_);if(!T){if(!R){m=v+(m.length>0?" "+m:m);continue}if(T=i(_),!T){m=v+(m.length>0?" "+m:m);continue}R=!1}const O=x.length===0?"":x.length===1?x[0]:l(x).join(":"),M=S?O+Am:O,D=M+T;if(d.indexOf(D)>-1)continue;d.push(D);const P=o(T,R);for(let F=0;F0?" "+m:m)}return m},fD=(...e)=>{let n=0,r,i,o="";for(;n{if(typeof e=="string")return e;let n,r="";for(let i=0;i{let r,i,o,l;const u=p=>{const m=n.reduce((y,v)=>v(y),e());return r=lD(m),i=r.cache.get,o=r.cache.set,l=d,d(p)},d=p=>{const m=i(p);if(m)return m;const y=dD(p,r);return o(p,y),y};return l=u,(...p)=>l(fD(...p))},mD=[],Ht=e=>{const n=r=>r[e]||mD;return n.isThemeGetter=!0,n},r_=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,a_=/^\((?:(\w[\w-]*):)?(.+)\)$/i,pD=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,gD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,vD=/\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$/,yD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,bD=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ma=e=>pD.test(e),He=e=>!!e&&!Number.isNaN(Number(e)),Rr=e=>!!e&&Number.isInteger(Number(e)),Hh=e=>e.endsWith("%")&&He(e.slice(0,-1)),ea=e=>gD.test(e),i_=()=>!0,wD=e=>vD.test(e)&&!yD.test(e),Hp=()=>!1,SD=e=>bD.test(e),_D=e=>xD.test(e),CD=e=>!_e(e)&&!Ce(e),ED=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)),RD=e=>Qa(e,l_,Hp),_e=e=>r_.test(e),yi=e=>Qa(e,c_,wD),ix=e=>Qa(e,zD,He),jD=e=>Qa(e,d_,i_),TD=e=>Qa(e,u_,Hp),sx=e=>Qa(e,s_,Hp),OD=e=>Qa(e,o_,_D),Kc=e=>Qa(e,f_,SD),Ce=e=>a_.test(e),Uo=e=>ki(e,c_),AD=e=>ki(e,u_),ox=e=>ki(e,s_),MD=e=>ki(e,l_),ND=e=>ki(e,o_),Yc=e=>ki(e,f_,!0),DD=e=>ki(e,d_,!0),Qa=(e,n,r)=>{const i=r_.exec(e);return i?i[1]?n(i[1]):r(i[2]):!1},ki=(e,n,r=!1)=>{const i=a_.exec(e);return i?i[1]?n(i[1]):r:!1},s_=e=>e==="position"||e==="percentage",o_=e=>e==="image"||e==="url",l_=e=>e==="length"||e==="size"||e==="bg-size",c_=e=>e==="length",zD=e=>e==="number",u_=e=>e==="family-name",d_=e=>e==="number"||e==="weight",f_=e=>e==="shadow",kD=()=>{const e=Ht("color"),n=Ht("font"),r=Ht("text"),i=Ht("font-weight"),o=Ht("tracking"),l=Ht("leading"),u=Ht("breakpoint"),d=Ht("container"),p=Ht("spacing"),m=Ht("radius"),y=Ht("shadow"),v=Ht("inset-shadow"),b=Ht("text-shadow"),x=Ht("drop-shadow"),S=Ht("blur"),_=Ht("perspective"),E=Ht("aspect"),R=Ht("ease"),T=Ht("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[...M(),Ce,_e],P=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto","contain","none"],V=()=>[Ce,_e,p],ve=()=>[Ma,"full","auto",...V()],be=()=>[Rr,"none","subgrid",Ce,_e],he=()=>["auto",{span:["full",Rr,Ce,_e]},Rr,Ce,_e],ue=()=>[Rr,"auto",Ce,_e],X=()=>["auto","min","max","fr",Ce,_e],pe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ge=()=>["start","end","center","stretch","center-safe","end-safe"],L=()=>["auto",...V()],K=()=>[Ma,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...V()],re=()=>[Ma,"screen","full","dvw","lvw","svw","min","max","fit",...V()],W=()=>[Ma,"screen","full","lh","dvh","lvh","svh","min","max","fit",...V()],te=()=>[e,Ce,_e],z=()=>[...M(),ox,sx,{position:[Ce,_e]}],N=()=>["no-repeat",{repeat:["","x","y","space","round"]}],B=()=>["auto","cover","contain",MD,RD,{size:[Ce,_e]}],J=()=>[Hh,Uo,yi],Y=()=>["","none","full",m,Ce,_e],le=()=>["",He,Uo,yi],ae=()=>["solid","dashed","dotted","double"],ye=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],xe=()=>[He,Hh,ox,sx],Oe=()=>["","none",S,Ce,_e],Ie=()=>["none",He,Ce,_e],Ve=()=>["none",He,Ce,_e],it=()=>[He,Ce,_e],Qe=()=>[Ma,"full",...V()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ea],breakpoint:[ea],color:[i_],container:[ea],"drop-shadow":[ea],ease:["in","out","in-out"],font:[CD],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ea],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ea],shadow:[ea],spacing:["px",He],text:[ea],"text-shadow":[ea],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ma,_e,Ce,E]}],container:["container"],"container-type":[{"@container":["","normal","size",Ce,_e]}],"container-named":[ED],columns:[{columns:[He,_e,Ce,d]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"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:D()}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ve()}],"inset-x":[{"inset-x":ve()}],"inset-y":[{"inset-y":ve()}],start:[{"inset-s":ve(),start:ve()}],end:[{"inset-e":ve(),end:ve()}],"inset-bs":[{"inset-bs":ve()}],"inset-be":[{"inset-be":ve()}],top:[{top:ve()}],right:[{right:ve()}],bottom:[{bottom:ve()}],left:[{left:ve()}],visibility:["visible","invisible","collapse"],z:[{z:[Rr,"auto",Ce,_e]}],basis:[{basis:[Ma,"full","auto",d,...V()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[He,Ma,"auto","initial","none",_e]}],grow:[{grow:["",He,Ce,_e]}],shrink:[{shrink:["",He,Ce,_e]}],order:[{order:[Rr,"first","last","none",Ce,_e]}],"grid-cols":[{"grid-cols":be()}],"col-start-end":[{col:he()}],"col-start":[{"col-start":ue()}],"col-end":[{"col-end":ue()}],"grid-rows":[{"grid-rows":be()}],"row-start-end":[{row:he()}],"row-start":[{"row-start":ue()}],"row-end":[{"row-end":ue()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":X()}],"auto-rows":[{"auto-rows":X()}],gap:[{gap:V()}],"gap-x":[{"gap-x":V()}],"gap-y":[{"gap-y":V()}],"justify-content":[{justify:[...pe(),"normal"]}],"justify-items":[{"justify-items":[...ge(),"normal"]}],"justify-self":[{"justify-self":["auto",...ge()]}],"align-content":[{content:["normal",...pe()]}],"align-items":[{items:[...ge(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ge(),{baseline:["","last"]}]}],"place-content":[{"place-content":pe()}],"place-items":[{"place-items":[...ge(),"baseline"]}],"place-self":[{"place-self":["auto",...ge()]}],p:[{p:V()}],px:[{px:V()}],py:[{py:V()}],ps:[{ps:V()}],pe:[{pe:V()}],pbs:[{pbs:V()}],pbe:[{pbe:V()}],pt:[{pt:V()}],pr:[{pr:V()}],pb:[{pb:V()}],pl:[{pl:V()}],m:[{m:L()}],mx:[{mx:L()}],my:[{my:L()}],ms:[{ms:L()}],me:[{me:L()}],mbs:[{mbs:L()}],mbe:[{mbe:L()}],mt:[{mt:L()}],mr:[{mr:L()}],mb:[{mb:L()}],ml:[{ml:L()}],"space-x":[{"space-x":V()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":V()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],"inline-size":[{inline:["auto",...re()]}],"min-inline-size":[{"min-inline":["auto",...re()]}],"max-inline-size":[{"max-inline":["none",...re()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[d,"screen",...K()]}],"min-w":[{"min-w":[d,"screen","none",...K()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[u]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",r,Uo,yi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,DD,jD]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Hh,_e]}],"font-family":[{font:[AD,TD,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:[o,Ce,_e]}],"line-clamp":[{"line-clamp":[He,"none",Ce,ix]}],leading:[{leading:[l,...V()]}],"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:te()}],"text-color":[{text:te()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ae(),"wavy"]}],"text-decoration-thickness":[{decoration:[He,"from-font","auto",Ce,yi]}],"text-decoration-color":[{decoration:te()}],"underline-offset":[{"underline-offset":[He,"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:V()}],"tab-size":[{tab:[Rr,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:N()}],"bg-size":[{bg:B()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Rr,Ce,_e],radial:["",Ce,_e],conic:[Rr,Ce,_e]},ND,OD]}],"bg-color":[{bg:te()}],"gradient-from-pos":[{from:J()}],"gradient-via-pos":[{via:J()}],"gradient-to-pos":[{to:J()}],"gradient-from":[{from:te()}],"gradient-via":[{via:te()}],"gradient-to":[{to:te()}],rounded:[{rounded:Y()}],"rounded-s":[{"rounded-s":Y()}],"rounded-e":[{"rounded-e":Y()}],"rounded-t":[{"rounded-t":Y()}],"rounded-r":[{"rounded-r":Y()}],"rounded-b":[{"rounded-b":Y()}],"rounded-l":[{"rounded-l":Y()}],"rounded-ss":[{"rounded-ss":Y()}],"rounded-se":[{"rounded-se":Y()}],"rounded-ee":[{"rounded-ee":Y()}],"rounded-es":[{"rounded-es":Y()}],"rounded-tl":[{"rounded-tl":Y()}],"rounded-tr":[{"rounded-tr":Y()}],"rounded-br":[{"rounded-br":Y()}],"rounded-bl":[{"rounded-bl":Y()}],"border-w":[{border:le()}],"border-w-x":[{"border-x":le()}],"border-w-y":[{"border-y":le()}],"border-w-s":[{"border-s":le()}],"border-w-e":[{"border-e":le()}],"border-w-bs":[{"border-bs":le()}],"border-w-be":[{"border-be":le()}],"border-w-t":[{"border-t":le()}],"border-w-r":[{"border-r":le()}],"border-w-b":[{"border-b":le()}],"border-w-l":[{"border-l":le()}],"divide-x":[{"divide-x":le()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":le()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ae(),"hidden","none"]}],"divide-style":[{divide:[...ae(),"hidden","none"]}],"border-color":[{border:te()}],"border-color-x":[{"border-x":te()}],"border-color-y":[{"border-y":te()}],"border-color-s":[{"border-s":te()}],"border-color-e":[{"border-e":te()}],"border-color-bs":[{"border-bs":te()}],"border-color-be":[{"border-be":te()}],"border-color-t":[{"border-t":te()}],"border-color-r":[{"border-r":te()}],"border-color-b":[{"border-b":te()}],"border-color-l":[{"border-l":te()}],"divide-color":[{divide:te()}],"outline-style":[{outline:[...ae(),"none","hidden"]}],"outline-offset":[{"outline-offset":[He,Ce,_e]}],"outline-w":[{outline:["",He,Uo,yi]}],"outline-color":[{outline:te()}],shadow:[{shadow:["","none",y,Yc,Kc]}],"shadow-color":[{shadow:te()}],"inset-shadow":[{"inset-shadow":["none",v,Yc,Kc]}],"inset-shadow-color":[{"inset-shadow":te()}],"ring-w":[{ring:le()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:te()}],"ring-offset-w":[{"ring-offset":[He,yi]}],"ring-offset-color":[{"ring-offset":te()}],"inset-ring-w":[{"inset-ring":le()}],"inset-ring-color":[{"inset-ring":te()}],"text-shadow":[{"text-shadow":["none",b,Yc,Kc]}],"text-shadow-color":[{"text-shadow":te()}],opacity:[{opacity:[He,Ce,_e]}],"mix-blend":[{"mix-blend":[...ye(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ye()}],"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":[He]}],"mask-image-linear-from-pos":[{"mask-linear-from":xe()}],"mask-image-linear-to-pos":[{"mask-linear-to":xe()}],"mask-image-linear-from-color":[{"mask-linear-from":te()}],"mask-image-linear-to-color":[{"mask-linear-to":te()}],"mask-image-t-from-pos":[{"mask-t-from":xe()}],"mask-image-t-to-pos":[{"mask-t-to":xe()}],"mask-image-t-from-color":[{"mask-t-from":te()}],"mask-image-t-to-color":[{"mask-t-to":te()}],"mask-image-r-from-pos":[{"mask-r-from":xe()}],"mask-image-r-to-pos":[{"mask-r-to":xe()}],"mask-image-r-from-color":[{"mask-r-from":te()}],"mask-image-r-to-color":[{"mask-r-to":te()}],"mask-image-b-from-pos":[{"mask-b-from":xe()}],"mask-image-b-to-pos":[{"mask-b-to":xe()}],"mask-image-b-from-color":[{"mask-b-from":te()}],"mask-image-b-to-color":[{"mask-b-to":te()}],"mask-image-l-from-pos":[{"mask-l-from":xe()}],"mask-image-l-to-pos":[{"mask-l-to":xe()}],"mask-image-l-from-color":[{"mask-l-from":te()}],"mask-image-l-to-color":[{"mask-l-to":te()}],"mask-image-x-from-pos":[{"mask-x-from":xe()}],"mask-image-x-to-pos":[{"mask-x-to":xe()}],"mask-image-x-from-color":[{"mask-x-from":te()}],"mask-image-x-to-color":[{"mask-x-to":te()}],"mask-image-y-from-pos":[{"mask-y-from":xe()}],"mask-image-y-to-pos":[{"mask-y-to":xe()}],"mask-image-y-from-color":[{"mask-y-from":te()}],"mask-image-y-to-color":[{"mask-y-to":te()}],"mask-image-radial":[{"mask-radial":[Ce,_e]}],"mask-image-radial-from-pos":[{"mask-radial-from":xe()}],"mask-image-radial-to-pos":[{"mask-radial-to":xe()}],"mask-image-radial-from-color":[{"mask-radial-from":te()}],"mask-image-radial-to-color":[{"mask-radial-to":te()}],"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":M()}],"mask-image-conic-pos":[{"mask-conic":[He]}],"mask-image-conic-from-pos":[{"mask-conic-from":xe()}],"mask-image-conic-to-pos":[{"mask-conic-to":xe()}],"mask-image-conic-from-color":[{"mask-conic-from":te()}],"mask-image-conic-to-color":[{"mask-conic-to":te()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:z()}],"mask-repeat":[{mask:N()}],"mask-size":[{mask:B()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ce,_e]}],filter:[{filter:["","none",Ce,_e]}],blur:[{blur:Oe()}],brightness:[{brightness:[He,Ce,_e]}],contrast:[{contrast:[He,Ce,_e]}],"drop-shadow":[{"drop-shadow":["","none",x,Yc,Kc]}],"drop-shadow-color":[{"drop-shadow":te()}],grayscale:[{grayscale:["",He,Ce,_e]}],"hue-rotate":[{"hue-rotate":[He,Ce,_e]}],invert:[{invert:["",He,Ce,_e]}],saturate:[{saturate:[He,Ce,_e]}],sepia:[{sepia:["",He,Ce,_e]}],"backdrop-filter":[{"backdrop-filter":["","none",Ce,_e]}],"backdrop-blur":[{"backdrop-blur":Oe()}],"backdrop-brightness":[{"backdrop-brightness":[He,Ce,_e]}],"backdrop-contrast":[{"backdrop-contrast":[He,Ce,_e]}],"backdrop-grayscale":[{"backdrop-grayscale":["",He,Ce,_e]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[He,Ce,_e]}],"backdrop-invert":[{"backdrop-invert":["",He,Ce,_e]}],"backdrop-opacity":[{"backdrop-opacity":[He,Ce,_e]}],"backdrop-saturate":[{"backdrop-saturate":[He,Ce,_e]}],"backdrop-sepia":[{"backdrop-sepia":["",He,Ce,_e]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":V()}],"border-spacing-x":[{"border-spacing-x":V()}],"border-spacing-y":[{"border-spacing-y":V()}],"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:[He,"initial",Ce,_e]}],ease:[{ease:["linear","initial",R,Ce,_e]}],delay:[{delay:[He,Ce,_e]}],animate:[{animate:["none",T,Ce,_e]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[_,Ce,_e]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:Ie()}],"rotate-x":[{"rotate-x":Ie()}],"rotate-y":[{"rotate-y":Ie()}],"rotate-z":[{"rotate-z":Ie()}],scale:[{scale:Ve()}],"scale-x":[{"scale-x":Ve()}],"scale-y":[{"scale-y":Ve()}],"scale-z":[{"scale-z":Ve()}],"scale-3d":["scale-3d"],skew:[{skew:it()}],"skew-x":[{"skew-x":it()}],"skew-y":[{"skew-y":it()}],transform:[{transform:[Ce,_e,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Qe()}],"translate-x":[{"translate-x":Qe()}],"translate-y":[{"translate-y":Qe()}],"translate-z":[{"translate-z":Qe()}],"translate-none":["translate-none"],zoom:[{zoom:[Rr,Ce,_e]}],accent:[{accent:te()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:te()}],"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":te()}],"scrollbar-track-color":[{"scrollbar-track":te()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":V()}],"scroll-mx":[{"scroll-mx":V()}],"scroll-my":[{"scroll-my":V()}],"scroll-ms":[{"scroll-ms":V()}],"scroll-me":[{"scroll-me":V()}],"scroll-mbs":[{"scroll-mbs":V()}],"scroll-mbe":[{"scroll-mbe":V()}],"scroll-mt":[{"scroll-mt":V()}],"scroll-mr":[{"scroll-mr":V()}],"scroll-mb":[{"scroll-mb":V()}],"scroll-ml":[{"scroll-ml":V()}],"scroll-p":[{"scroll-p":V()}],"scroll-px":[{"scroll-px":V()}],"scroll-py":[{"scroll-py":V()}],"scroll-ps":[{"scroll-ps":V()}],"scroll-pe":[{"scroll-pe":V()}],"scroll-pbs":[{"scroll-pbs":V()}],"scroll-pbe":[{"scroll-pbe":V()}],"scroll-pt":[{"scroll-pt":V()}],"scroll-pr":[{"scroll-pr":V()}],"scroll-pb":[{"scroll-pb":V()}],"scroll-pl":[{"scroll-pl":V()}],"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",...te()]}],"stroke-w":[{stroke:[He,Uo,yi,ix]}],stroke:[{stroke:["none",...te()]}],"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"]}},LD=hD(kD);function Je(...e){return LD(J1(e))}function $D({delayDuration:e=0,...n}){return f.jsx(FN,{"data-slot":"tooltip-provider",delayDuration:e,...n})}function ID({...e}){return f.jsx(VN,{"data-slot":"tooltip",...e})}function PD({...e}){return f.jsx(UN,{"data-slot":"tooltip-trigger",...e})}function FD({className:e,sideOffset:n=0,children:r,...i}){return f.jsx(HN,{children:f.jsxs(BN,{"data-slot":"tooltip-content",sideOffset:n,className:Je("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,f.jsx(qN,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}const Mm=new Set;function VD(e){return Mm.add(e),()=>Mm.delete(e)}function UD(){for(const e of Mm)e()}const h_=(...e)=>e.filter((n,r,i)=>!!n&&n.trim()!==""&&i.indexOf(n)===r).join(" ").trim();const HD=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const BD=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,r,i)=>i?i.toUpperCase():r.toLowerCase());const lx=e=>{const n=BD(e);return n.charAt(0).toUpperCase()+n.slice(1)};var Bh={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 qD=e=>{for(const n in e)if(n.startsWith("aria-")||n==="role"||n==="title")return!0;return!1},GD=w.createContext({}),ZD=()=>w.useContext(GD),KD=w.forwardRef(({color:e,size:n,strokeWidth:r,absoluteStrokeWidth:i,className:o="",children:l,iconNode:u,...d},p)=>{const{size:m=24,strokeWidth:y=2,absoluteStrokeWidth:v=!1,color:b="currentColor",className:x=""}=ZD()??{},S=i??v?Number(r??y)*24/Number(n??m):r??y;return w.createElement("svg",{ref:p,...Bh,width:n??m??Bh.width,height:n??m??Bh.height,stroke:e??b,strokeWidth:S,className:h_("lucide",x,o),...!l&&!qD(d)&&{"aria-hidden":"true"},...d},[...u.map(([_,E])=>w.createElement(_,E)),...Array.isArray(l)?l:[l]])});const Me=(e,n)=>{const r=w.forwardRef(({className:i,...o},l)=>w.createElement(KD,{ref:l,iconNode:n,className:h_(`lucide-${HD(lx(e))}`,`lucide-${e}`,i),...o}));return r.displayName=lx(e),r};const YD=[["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"}]],QD=Me("beaker",YD);const XD=[["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"}]],JD=Me("book-open",XD);const WD=[["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"}]],ez=Me("briefcase",WD);const tz=[["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"}]],nz=Me("bug",tz);const rz=[["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"}]],az=Me("calendar",rz);const iz=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],m_=Me("check",iz);const sz=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Bp=Me("chevron-down",sz);const oz=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],lz=Me("chevron-right",oz);const cz=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],uz=Me("chevron-up",cz);const dz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],fz=Me("circle-check",dz);const hz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],p_=Me("clock",hz);const mz=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],pz=Me("code",mz);const gz=[["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"}]],vz=Me("compass",gz);const yz=[["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"}]],bz=Me("copy",yz);const xz=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],wz=Me("credit-card",xz);const Sz=[["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",Sz);const Cz=[["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"}]],Ez=Me("download",Cz);const Rz=[["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"}]],jz=Me("ellipsis",Rz);const Tz=[["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"}]],g_=Me("file-text",Tz);const Oz=[["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"}]],Az=Me("flag",Oz);const Mz=[["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"}]],qp=Me("folder",Mz);const Nz=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Dz=Me("gauge",Nz);const zz=[["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"}]],kz=Me("gavel",zz);const Lz=[["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"}]],v_=Me("globe",Lz);const $z=[["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"}]],Iz=Me("graduation-cap",$z);const Pz=[["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"}]],Fz=Me("heart",Pz);const Vz=[["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"}]],Uz=Me("history",Vz);const Hz=[["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"}]],Bz=Me("image",Hz);const qz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Gz=Me("info",qz);const Zz=[["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"}]],Kz=Me("layout-dashboard",Zz);const Yz=[["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"}]],Qz=Me("lightbulb",Yz);const Xz=[["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"}]],Jz=Me("link",Xz);const Wz=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ek=Me("loader-circle",Wz);const tk=[["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"}]],y_=Me("lock",tk);const nk=[["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"}]],rk=Me("log-out",nk);const ak=[["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"}]],ik=Me("megaphone",ak);const sk=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],ok=Me("menu",sk);const lk=[["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"}]],ck=Me("music",lk);const uk=[["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"}]],dk=Me("octagon-x",uk);const fk=[["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"}]],hk=Me("package",fk);const mk=[["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"}]],pk=Me("pen-line",mk);const gk=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],vk=Me("plus",gk);const yk=[["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"}]],bk=Me("rocket",yk);const xk=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],b_=Me("search",xk);const wk=[["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"}]],Sk=Me("settings",wk);const _k=[["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"}]],Ck=Me("share-2",_k);const Ek=[["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"}]],x_=Me("shield",Ek);const Rk=[["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"}]],w_=Me("square-terminal",Rk);const jk=[["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"}]],Tk=Me("star",jk);const Ok=[["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"}]],Ak=Me("trash-2",Ok);const Mk=[["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"}]],S_=Me("triangle-alert",Mk);const Nk=[["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"}]],Dk=Me("upload",Nk);const zk=[["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"}]],__=Me("users",zk);const kk=[["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"}]],Lk=Me("wrench",kk);const $k=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],C_=Me("x",$k);function Ik(){const e=!document.body.classList.contains("sb-open");document.body.classList.toggle("sb-open"),Qu(),e?document.getElementById("sidebar")?.querySelector(Pk)?.focus():document.getElementById("menu-btn")?.focus()}const Pk='a[href], button:not(:disabled), select, input, [tabindex]:not([tabindex="-1"])';function mr(){const e=document.body.classList.contains("sb-open");document.body.classList.remove("sb-open"),Qu(),e&&window.innerWidth<=ou&&document.getElementById("menu-btn")?.focus()}const ou=900;function Qu(){const e=document.getElementById("sidebar");if(!e)return;const n=document.body.classList.contains("sb-open");window.innerWidth<=ou&&!n?e.setAttribute("inert",""):e.removeAttribute("inert");const i=document.getElementById("main");i&&(n&&window.innerWidth<=ou?i.setAttribute("inert",""):i.removeAttribute("inert")),e.setAttribute("aria-modal",String(n&&window.innerWidth<=ou)),document.getElementById("menu-btn")?.setAttribute("aria-expanded",String(n))}typeof window<"u"&&(window.addEventListener("resize",Qu),window.addEventListener("keydown",e=>{e.key==="Escape"&&document.body.classList.contains("sb-open")&&mr()}));const Fk={alert:S_,card:wz,check:m_,chev:lz,chevd:Bp,clock:p_,copy:bz,doc:g_,dots:jz,download:Ez,folder:qp,dashboard:Kz,gear:Sk,globe:v_,hist:Uz,link:Jz,lock:y_,menu:ok,plus:vk,power:rk,search:b_,share:Ck,shield:x_,terminal:w_,trash:Ak,upload:Dk,users:__,x:C_};function ut({name:e}){const n=Fk[e];return n?f.jsx(n,{className:"ico","aria-hidden":"true"}):null}const Nm={folder:qp,"book-open":JD,"file-text":g_,"pen-line":pk,users:__,briefcase:ez,megaphone:ik,rocket:bk,lightbulb:Qz,flag:Az,star:Tk,heart:Fz,code:pz,"square-terminal":w_,bug:nz,wrench:Lk,database:_z,package:hk,beaker:QD,gauge:Dz,shield:x_,lock:y_,gavel:kz,globe:v_,compass:vz,calendar:az,clock:p_,"graduation-cap":Iz,image:Bz,music:ck};function Ls({name:e,className:n}){const r=e??"",i=Object.hasOwn(Nm,r)?Nm[r]:qp;return f.jsx(i,{className:n,"aria-hidden":"true"})}function Vk({size:e=22}){return f.jsxs("svg",{width:e,height:e,viewBox:"0 0 32 32",fill:"currentColor",role:"img","aria-label":"BearDrive",children:[f.jsx("rect",{x:"4",y:"4",width:"5.6",height:"24"}),f.jsx("rect",{x:"11.2",y:"4",width:"14.4",height:"11.2"}),f.jsx("rect",{x:"11.2",y:"16.8",width:"16.8",height:"11.2"})]})}function Su(e){const n=["page",e.width??"app",e.className].filter(Boolean).join(" ");return f.jsx("div",{className:n,children:e.children})}function Uk(e){e&&Qu()}function cl(e){return f.jsxs(f.Fragment,{children:[f.jsx("div",{id:"sb-backdrop",onClick:mr}),f.jsxs("aside",{id:"sidebar",ref:Uk,children:[e.vault,e.projectsNav,e.tree??f.jsx("nav",{id:"tree","aria-label":"Files"}),e.orgBar]}),f.jsxs("main",{id:"main",children:[e.topbar,f.jsx("article",{id:"content",ref:e.contentRef,onScroll:e.onContentScroll,children:e.children})]})]})}function Xu(e){const{name:n,onHome:r,showSignout:i,search:o}=e;return f.jsxs("header",{id:"vault",children:[f.jsx("span",{id:"vault-badge",children:f.jsx(Vk,{size:22})}),f.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}),f.jsxs("div",{className:"vault-actions",children:[o&&f.jsxs(ID,{delayDuration:150,children:[f.jsx(PD,{asChild:!0,children:f.jsx("button",{id:"search-btn",className:"icon-btn2","aria-label":"Search",onClick:()=>{UD(),mr()},children:f.jsx(ut,{name:"search"})})}),f.jsxs(FD,{className:"tipcard",sideOffset:6,children:["Search ",f.jsx("kbd",{children:"⌘K"})]})]}),i&&f.jsx("a",{id:"signout",href:"/auth/logout",title:"Sign out","aria-label":"Sign out",children:f.jsx(ut,{name:"power"})})]})]})}function ul(e){return f.jsxs("header",{id:"topbar",children:[f.jsx("button",{id:"menu-btn",className:"icon-btn",title:"Menu","aria-label":"Menu","aria-controls":"sidebar","aria-expanded":"false",onClick:Ik,children:f.jsx(ut,{name:"menu"})}),f.jsx("span",{id:"crumb",children:e.crumb}),f.jsx("span",{id:"meta",children:e.meta}),e.actions]})}function Hk(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 Bk=e=>{switch(e){case"success":return Zk;case"info":return Yk;case"warning":return Kk;case"error":return Qk;default:return null}},qk=Array(12).fill(0),Gk=({visible:e,className:n})=>me.createElement("div",{className:["sonner-loading-wrapper",n].filter(Boolean).join(" "),"data-visible":e},me.createElement("div",{className:"sonner-spinner"},qk.map((r,i)=>me.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${i}`})))),Zk=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},me.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"})),Kk=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},me.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"})),Yk=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},me.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"})),Qk=me.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},me.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"})),Xk=me.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"},me.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),me.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Jk=()=>{const[e,n]=me.useState(document.hidden);return me.useEffect(()=>{const r=()=>{n(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let Dm=1;class Wk{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,...o}=n,l=typeof n?.id=="number"||((r=n.id)==null?void 0:r.length)>0?n.id:Dm++,u=this.toasts.find(p=>p.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(p=>p.id===l?(this.publish({...p,...n,id:l,title:i}),{...p,...n,id:l,dismissible:d,title:i}):p):this.addToast({title:i,...o,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 o=Promise.resolve(n instanceof Function?n():n);let l=i!==void 0,u;const d=o.then(async m=>{if(u=["resolve",m],me.isValidElement(m))l=!1,this.create({id:i,type:"default",message:m});else if(t3(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,S=typeof v=="object"&&!me.isValidElement(v)?v:{message:v};this.create({id:i,type:"error",description:b,...S})}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,S=typeof v=="object"&&!me.isValidElement(v)?v:{message:v};this.create({id:i,type:"error",description:b,...S})}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,S=typeof v=="object"&&!me.isValidElement(v)?v:{message:v};this.create({id:i,type:"success",description:b,...S})}}).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"&&!me.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)}),p=()=>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:p}:Object.assign(i,{unwrap:p})},this.custom=(n,r)=>{const i=r?.id||Dm++;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 Tn=new Wk,e3=(e,n)=>{const r=n?.id||Dm++;return Tn.addToast({title:e,...n,id:r}),r},t3=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",n3=e3,r3=()=>Tn.toasts,a3=()=>Tn.getActiveToasts(),cx=Object.assign(n3,{success:Tn.success,info:Tn.info,warning:Tn.warning,error:Tn.error,custom:Tn.custom,message:Tn.message,promise:Tn.promise,dismiss:Tn.dismiss,loading:Tn.loading},{getHistory:r3,getToasts:a3});Hk("[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 Qc(e){return e.label!==void 0}const i3=3,s3="24px",o3="16px",ux=4e3,l3=356,c3=14,u3=45,d3=200;function jr(...e){return e.filter(Boolean).join(" ")}function f3(e){const[n,r]=e.split("-"),i=[];return n&&i.push(n),r&&i.push(r),i}const h3=e=>{var n,r,i,o,l,u,d,p,m;const{invert:y,toast:v,unstyled:b,interacting:x,setHeights:S,visibleToasts:_,heights:E,index:R,toasts:T,expanded:O,removeToast:M,defaultRichColors:D,closeButton:P,style:F,cancelButtonStyle:V,actionButtonStyle:ve,className:be="",descriptionClassName:he="",duration:ue,position:X,gap:pe,expandByDefault:ge,classNames:L,icons:K,closeButtonAriaLabel:re="Close toast"}=e,[W,te]=me.useState(null),[z,N]=me.useState(null),[B,J]=me.useState(!1),[Y,le]=me.useState(!1),[ae,ye]=me.useState(!1),[xe,Oe]=me.useState(!1),[Ie,Ve]=me.useState(!1),[it,Qe]=me.useState(0),[fn,hn]=me.useState(0),Qt=me.useRef(v.duration||ue||ux),br=me.useRef(null),jt=me.useRef(null),rr=R===0,xr=R+1<=_,Tt=v.type,Vn=v.dismissible!==!1,Dt=v.className||"",kr=v.descriptionClassName||"",ar=me.useMemo(()=>E.findIndex(Ne=>Ne.toastId===v.id)||0,[E,v.id]),ir=me.useMemo(()=>{var Ne;return(Ne=v.closeButton)!=null?Ne:P},[v.closeButton,P]),wr=me.useMemo(()=>v.duration||ue||ux,[v.duration,ue]),sr=me.useRef(0),mn=me.useRef(0),A=me.useRef(0),I=me.useRef(null),[U,ce]=X.split("-"),Z=me.useMemo(()=>E.reduce((Ne,ht,yt)=>yt>=ar?Ne:Ne+ht.height,0),[E,ar]),ne=Jk(),de=v.invert||y,we=Tt==="loading";mn.current=me.useMemo(()=>ar*pe+Z,[ar,Z]),me.useEffect(()=>{Qt.current=wr},[wr]),me.useEffect(()=>{J(!0)},[]),me.useEffect(()=>{const Ne=jt.current;if(Ne){const ht=Ne.getBoundingClientRect().height;return hn(ht),S(yt=>[{toastId:v.id,height:ht,position:v.position},...yt]),()=>S(yt=>yt.filter(qt=>qt.toastId!==v.id))}},[S,v.id]),me.useLayoutEffect(()=>{if(!B)return;const Ne=jt.current,ht=Ne.style.height;Ne.style.height="auto";const yt=Ne.getBoundingClientRect().height;Ne.style.height=ht,hn(yt),S(qt=>qt.find(St=>St.toastId===v.id)?qt.map(St=>St.toastId===v.id?{...St,height:yt}:St):[{toastId:v.id,height:yt,position:v.position},...qt])},[B,v.title,v.description,S,v.id,v.jsx,v.action,v.cancel]);const Ee=me.useCallback(()=>{le(!0),Qe(mn.current),S(Ne=>Ne.filter(ht=>ht.toastId!==v.id)),setTimeout(()=>{M(v)},d3)},[v,M,S,mn]);me.useEffect(()=>{if(v.promise&&Tt==="loading"||v.duration===1/0||v.type==="loading")return;let Ne;return O||x||ne?(()=>{if(A.current{v.onAutoClose==null||v.onAutoClose.call(v,v),Ee()},Qt.current)),()=>clearTimeout(Ne)},[O,x,v,Tt,ne,Ee]),me.useEffect(()=>{v.delete&&(Ee(),v.onDismiss==null||v.onDismiss.call(v,v))},[Ee,v.delete]);function Xe(){var Ne;if(K?.loading){var ht;return me.createElement("div",{className:jr(L?.loader,v==null||(ht=v.classNames)==null?void 0:ht.loader,"sonner-loader"),"data-visible":Tt==="loading"},K.loading)}return me.createElement(Gk,{className:jr(L?.loader,v==null||(Ne=v.classNames)==null?void 0:Ne.loader),visible:Tt==="loading"})}const wt=v.icon||K?.[Tt]||Bk(Tt);var Xt,zt;return me.createElement("li",{tabIndex:0,ref:jt,className:jr(be,Dt,L?.toast,v==null||(n=v.classNames)==null?void 0:n.toast,L?.default,L?.[Tt],v==null||(r=v.classNames)==null?void 0:r[Tt]),"data-sonner-toast":"","data-rich-colors":(Xt=v.richColors)!=null?Xt:D,"data-styled":!(v.jsx||v.unstyled||b),"data-mounted":B,"data-promise":!!v.promise,"data-swiped":Ie,"data-removed":Y,"data-visible":xr,"data-y-position":U,"data-x-position":ce,"data-index":R,"data-front":rr,"data-swiping":ae,"data-dismissible":Vn,"data-type":Tt,"data-invert":de,"data-swipe-out":xe,"data-swipe-direction":z,"data-expanded":!!(O||ge&&B),"data-testid":v.testId,style:{"--index":R,"--toasts-before":R,"--z-index":T.length-R,"--offset":`${Y?it:mn.current}px`,"--initial-height":ge?"auto":`${fn}px`,...F,...v.style},onDragEnd:()=>{ye(!1),te(null),I.current=null},onPointerDown:Ne=>{Ne.button!==2&&(we||!Vn||(br.current=new Date,Qe(mn.current),Ne.target.setPointerCapture(Ne.pointerId),Ne.target.tagName!=="BUTTON"&&(ye(!0),I.current={x:Ne.clientX,y:Ne.clientY})))},onPointerUp:()=>{var Ne,ht,yt;if(xe||!Vn)return;I.current=null;const qt=Number(((Ne=jt.current)==null?void 0:Ne.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),or=Number(((ht=jt.current)==null?void 0:ht.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),St=new Date().getTime()-((yt=br.current)==null?void 0:yt.getTime()),yn=W==="x"?qt:or,Wa=Math.abs(yn)/St;if(Math.abs(yn)>=u3||Wa>.11){Qe(mn.current),v.onDismiss==null||v.onDismiss.call(v,v),N(W==="x"?qt>0?"right":"left":or>0?"down":"up"),Ee(),Oe(!0);return}else{var bn,xn;(bn=jt.current)==null||bn.style.setProperty("--swipe-amount-x","0px"),(xn=jt.current)==null||xn.style.setProperty("--swipe-amount-y","0px")}Ve(!1),ye(!1),te(null)},onPointerMove:Ne=>{var ht,yt,qt;if(!I.current||!Vn||((ht=window.getSelection())==null?void 0:ht.toString().length)>0)return;const St=Ne.clientY-I.current.y,yn=Ne.clientX-I.current.x;var Wa;const bn=(Wa=e.swipeDirections)!=null?Wa:f3(X);!W&&(Math.abs(yn)>1||Math.abs(St)>1)&&te(Math.abs(yn)>Math.abs(St)?"x":"y");let xn={x:0,y:0};const $i=lr=>1/(1.5+Math.abs(lr)/20);if(W==="y"){if(bn.includes("top")||bn.includes("bottom"))if(bn.includes("top")&&St<0||bn.includes("bottom")&&St>0)xn.y=St;else{const lr=St*$i(St);xn.y=Math.abs(lr)0)xn.x=yn;else{const lr=yn*$i(yn);xn.x=Math.abs(lr)0||Math.abs(xn.y)>0)&&Ve(!0),(yt=jt.current)==null||yt.style.setProperty("--swipe-amount-x",`${xn.x}px`),(qt=jt.current)==null||qt.style.setProperty("--swipe-amount-y",`${xn.y}px`)}},ir&&!v.jsx&&Tt!=="loading"?me.createElement("button",{"aria-label":re,"data-disabled":we,"data-close-button":!0,onClick:we||!Vn?()=>{}:()=>{Ee(),v.onDismiss==null||v.onDismiss.call(v,v)},className:jr(L?.closeButton,v==null||(i=v.classNames)==null?void 0:i.closeButton)},(zt=K?.close)!=null?zt:Xk):null,(Tt||v.icon||v.promise)&&v.icon!==null&&(K?.[Tt]!==null||v.icon)?me.createElement("div",{"data-icon":"",className:jr(L?.icon,v==null||(o=v.classNames)==null?void 0:o.icon)},v.promise||v.type==="loading"&&!v.icon?v.icon||Xe():null,v.type!=="loading"?wt:null):null,me.createElement("div",{"data-content":"",className:jr(L?.content,v==null||(l=v.classNames)==null?void 0:l.content)},me.createElement("div",{"data-title":"",className:jr(L?.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?me.createElement("div",{"data-description":"",className:jr(he,kr,L?.description,v==null||(d=v.classNames)==null?void 0:d.description)},typeof v.description=="function"?v.description():v.description):null),me.isValidElement(v.cancel)?v.cancel:v.cancel&&Qc(v.cancel)?me.createElement("button",{"data-button":!0,"data-cancel":!0,style:v.cancelButtonStyle||V,onClick:Ne=>{Qc(v.cancel)&&Vn&&(v.cancel.onClick==null||v.cancel.onClick.call(v.cancel,Ne),Ee())},className:jr(L?.cancelButton,v==null||(p=v.classNames)==null?void 0:p.cancelButton)},v.cancel.label):null,me.isValidElement(v.action)?v.action:v.action&&Qc(v.action)?me.createElement("button",{"data-button":!0,"data-action":!0,style:v.actionButtonStyle||ve,onClick:Ne=>{Qc(v.action)&&(v.action.onClick==null||v.action.onClick.call(v.action,Ne),!Ne.defaultPrevented&&Ee())},className:jr(L?.actionButton,v==null||(m=v.classNames)==null?void 0:m.actionButton)},v.action.label):null)};function dx(){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 m3(e,n){const r={};return[e,n].forEach((i,o)=>{const l=o===1,u=l?"--mobile-offset":"--offset",d=l?o3:s3;function p(m){["top","right","bottom","left"].forEach(y=>{r[`${u}-${y}`]=typeof m=="number"?`${m}px`:m})}typeof i=="number"||typeof i=="string"?p(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]}):p(d)}),r}const p3=me.forwardRef(function(n,r){const{id:i,invert:o,position:l="bottom-right",hotkey:u=["altKey","KeyT"],expand:d,closeButton:p,className:m,offset:y,mobileOffset:v,theme:b="light",richColors:x,duration:S,style:_,visibleToasts:E=i3,toastOptions:R,dir:T=dx(),gap:O=c3,icons:M,containerAriaLabel:D="Notifications"}=n,[P,F]=me.useState([]),V=me.useMemo(()=>i?P.filter(B=>B.toasterId===i):P.filter(B=>!B.toasterId),[P,i]),ve=me.useMemo(()=>Array.from(new Set([l].concat(V.filter(B=>B.position).map(B=>B.position)))),[V,l]),[be,he]=me.useState([]),[ue,X]=me.useState(!1),[pe,ge]=me.useState(!1),[L,K]=me.useState(b!=="system"?b:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),re=me.useRef(null),W=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),te=me.useRef(null),z=me.useRef(!1),N=me.useCallback(B=>{F(J=>{var Y;return(Y=J.find(le=>le.id===B.id))!=null&&Y.delete||Tn.dismiss(B.id),J.filter(({id:le})=>le!==B.id)})},[]);return me.useEffect(()=>Tn.subscribe(B=>{if(B.dismiss){requestAnimationFrame(()=>{F(J=>J.map(Y=>Y.id===B.id?{...Y,delete:!0}:Y))});return}setTimeout(()=>{yj.flushSync(()=>{F(J=>{const Y=J.findIndex(le=>le.id===B.id);return Y!==-1?[...J.slice(0,Y),{...J[Y],...B},...J.slice(Y+1)]:[B,...J]})})})}),[P]),me.useEffect(()=>{if(b!=="system"){K(b);return}if(b==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?K("dark"):K("light")),typeof window>"u")return;const B=window.matchMedia("(prefers-color-scheme: dark)");try{B.addEventListener("change",({matches:J})=>{K(J?"dark":"light")})}catch{B.addListener(({matches:Y})=>{try{K(Y?"dark":"light")}catch(le){console.error(le)}})}},[b]),me.useEffect(()=>{P.length<=1&&X(!1)},[P]),me.useEffect(()=>{const B=J=>{var Y;if(u.every(ye=>J[ye]||J.code===ye)){var ae;X(!0),(ae=re.current)==null||ae.focus()}J.code==="Escape"&&(document.activeElement===re.current||(Y=re.current)!=null&&Y.contains(document.activeElement))&&X(!1)};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[u]),me.useEffect(()=>{if(re.current)return()=>{te.current&&(te.current.focus({preventScroll:!0}),te.current=null,z.current=!1)}},[re.current]),me.createElement("section",{ref:r,"aria-label":`${D} ${W}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},ve.map((B,J)=>{var Y;const[le,ae]=B.split("-");return V.length?me.createElement("ol",{key:B,dir:T==="auto"?dx():T,tabIndex:-1,ref:re,className:m,"data-sonner-toaster":!0,"data-sonner-theme":L,"data-y-position":le,"data-x-position":ae,style:{"--front-toast-height":`${((Y=be[0])==null?void 0:Y.height)||0}px`,"--width":`${l3}px`,"--gap":`${O}px`,..._,...m3(y,v)},onBlur:ye=>{z.current&&!ye.currentTarget.contains(ye.relatedTarget)&&(z.current=!1,te.current&&(te.current.focus({preventScroll:!0}),te.current=null))},onFocus:ye=>{ye.target instanceof HTMLElement&&ye.target.dataset.dismissible==="false"||z.current||(z.current=!0,te.current=ye.relatedTarget)},onMouseEnter:()=>X(!0),onMouseMove:()=>X(!0),onMouseLeave:()=>{pe||X(!1)},onDragEnd:()=>X(!1),onPointerDown:ye=>{ye.target instanceof HTMLElement&&ye.target.dataset.dismissible==="false"||ge(!0)},onPointerUp:()=>ge(!1)},V.filter(ye=>!ye.position&&J===0||ye.position===B).map((ye,xe)=>{var Oe,Ie;return me.createElement(h3,{key:ye.id,icons:M,index:xe,toast:ye,defaultRichColors:x,duration:(Oe=R?.duration)!=null?Oe:S,className:R?.className,descriptionClassName:R?.descriptionClassName,invert:o,visibleToasts:E,closeButton:(Ie=R?.closeButton)!=null?Ie:p,interacting:pe,position:B,style:R?.style,unstyled:R?.unstyled,classNames:R?.classNames,cancelButtonStyle:R?.cancelButtonStyle,actionButtonStyle:R?.actionButtonStyle,closeButtonAriaLabel:R?.closeButtonAriaLabel,removeToast:N,toasts:V.filter(Ve=>Ve.position==ye.position),heights:be.filter(Ve=>Ve.position==ye.position),setHeights:he,expandByDefault:d,gap:O,expanded:ue,swipeDirections:n.swipeDirections})})):null}))}),g3=({...e})=>f.jsx(p3,{theme:"dark",className:"toaster group",icons:{success:f.jsx(fz,{className:"size-4"}),info:f.jsx(Gz,{className:"size-4"}),warning:f.jsx(S_,{className:"size-4"}),error:f.jsx(dk,{className:"size-4"}),loading:f.jsx(ek,{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 Ke(e,n=!1){n?cx.error(e,{duration:1/0,closeButton:!0}):cx(e)}function v3(){return f.jsx(g3,{position:"bottom-center"})}const fx=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,hx=J1,y3=(e,n)=>r=>{var i;if(n?.variants==null)return hx(e,r?.class,r?.className);const{variants:o,defaultVariants:l}=n,u=Object.keys(o).map(m=>{const y=r?.[m],v=l?.[m];if(y===null)return null;const b=fx(y)||fx(v);return o[m][b]}),d=r&&Object.entries(r).reduce((m,y)=>{let[v,b]=y;return b===void 0||(m[v]=b),m},{}),p=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(S=>{let[_,E]=S;return Array.isArray(E)?E.includes({...l,...d}[_]):{...l,...d}[_]===E})?[...m,v,b]:m},[]);return hx(e,u,p,r?.class,r?.className)},b3=y3("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 vt({className:e,variant:n="default",size:r="default",asChild:i=!1,...o}){const l=i?bj:"button";return f.jsx(l,{"data-slot":"button","data-variant":n,"data-size":r,className:Je(b3({variant:n,size:r,className:e})),...o})}function Ju({...e}){return f.jsx(hp,{"data-slot":"dialog",...e})}function x3({...e}){return f.jsx(pp,{"data-slot":"dialog-portal",...e})}function w3({className:e,...n}){return f.jsx(gp,{"data-slot":"dialog-overlay",className:Je("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 Wu({className:e,children:n,showCloseButton:r=!0,...i}){return f.jsxs(x3,{"data-slot":"dialog-portal",children:[f.jsx(w3,{}),f.jsxs(vp,{"data-slot":"dialog-content",className:Je("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&&f.jsxs(aS,{"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:[f.jsx(C_,{}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Sl({className:e,...n}){return f.jsx(tS,{"data-slot":"dialog-title",className:Je("text-lg leading-none font-semibold",e),...n})}let E_=null,lu=[];function _l(e){E_=e,lu.forEach(n=>n())}function R_(e,n,r="",i="OK",o={}){return new Promise(l=>_l({kind:"prompt",title:e,label:n,value:r,okLabel:i,...o,resolve:l}))}function Cl(e,n,r="Confirm",i=!1){return new Promise(o=>_l({kind:"confirm",title:e,message:n,confirmLabel:r,danger:i,resolve:o}))}function S3(){const e=w.useSyncExternalStore(r=>(lu.push(r),()=>{lu=lu.filter(i=>i!==r)}),()=>E_);if(!e)return null;const n=()=>{_l(null),e.kind==="prompt"?e.resolve(null):e.resolve(!1)};return f.jsx(Ju,{open:!0,onOpenChange:r=>!r&&n(),children:f.jsx(Wu,{className:"modal",showCloseButton:!1,children:e.kind==="prompt"?f.jsx(_3,{m:e}):f.jsx(C3,{m:e})})})}function _3({m:e}){const n=w.useRef(null),r=m=>{_l(null),e.resolve(m)},[i,o]=w.useState(""),[l,u]=w.useState(e.value),d=e.match===void 0||l.trim()===e.match,p=()=>{const m=l;if(d){if(!m.trim()){o("Give it a name."),n.current.focus();return}r(m)}};return f.jsxs(f.Fragment,{children:[f.jsx(Sl,{asChild:!0,children:f.jsx("h3",{children:e.title})}),f.jsx("label",{className:"modal-label",htmlFor:"modal-input",children:e.label}),f.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&&o("")},onKeyDown:m=>m.key==="Enter"&&p()}),i&&f.jsx("span",{id:"modal-input-err",role:"alert",className:"field-err",children:i}),f.jsxs("div",{className:"modal-actions",children:[f.jsx(vt,{variant:"subtle",onClick:()=>r(null),children:"Cancel"}),f.jsx(vt,{variant:e.danger?"danger":"primary",onClick:p,disabled:!d,children:e.okLabel})]})]})}function C3({m:e}){const n=r=>{_l(null),e.resolve(r)};return f.jsxs(f.Fragment,{children:[f.jsx(Sl,{asChild:!0,children:f.jsx("h3",{children:e.title})}),f.jsx("p",{className:"modal-msg",children:e.message}),f.jsxs("div",{className:"modal-actions",children:[f.jsx(vt,{variant:"subtle",onClick:()=>n(!1),autoFocus:e.danger,children:"Cancel"}),f.jsx(vt,{variant:e.danger?"danger":"primary",onClick:()=>n(!0),autoFocus:!e.danger,children:e.confirmLabel})]})]})}function E3(e){return Pt({queryKey:["projects"],queryFn:()=>Bt("/api/projects"),enabled:e,refetchInterval:3e4,select:n=>n.projects||[]})}function R3(e){return Pt({queryKey:["orgs"],queryFn:()=>Bt("/api/orgs"),enabled:e,select:n=>n.orgs||[]})}function j3(e){return Pt({queryKey:["permissions",e],queryFn:()=>Bt(`/api/p/${e}/permissions`),enabled:!!e})}function j_(e,n=!0){return Pt({queryKey:["shares",e],queryFn:()=>Bt(`/api/p/${e}/shares`),enabled:!!e&&n,select:r=>r.shares||[]})}function T_(e){return Pt({queryKey:["admin","pending"],queryFn:()=>Bt("/api/admin/pending"),enabled:e,select:n=>n.pending||[]})}function O_(){const e=Ai();return()=>Promise.all([e.invalidateQueries({queryKey:["projects"]}),e.invalidateQueries({queryKey:["orgs"]})]).then(()=>{})}function A_(e){return e.split("/").map(encodeURIComponent).join("/")}function T3(e){try{return decodeURIComponent(e)}catch{return e}}function M_(e){return e.split("/").map(T3).join("/")}const O3=new Set(["dashboard","history","install","settings"]),mx={insights:"dashboard"};function A3(e){return Object.hasOwn(mx,e)?mx[e]:void 0}const Gp=["q","user","since","until"];function Zp(e){return!!e&&Gp.some(n=>!!e[n])}function N_(e){const n=new URLSearchParams;for(const i of Gp)e?.[i]&&n.set(i,e[i]);const r=n.toString();return r?"?"+r:""}function D_(e,n){const r=e.indexOf("?"),i=r===-1?null:new URLSearchParams(e.slice(r)),o=i?.get("v")||"",l=i?.get("connect")||"",u=M3(r===-1?e:e.slice(0,r),n);o&&(u.version=o),l&&(u.connect=l);const d={};for(const p of Gp){const m=i?.get(p);m&&(d[p]=m)}if(Zp(d)&&(u.filters=d),u.view==="history"&&!u.viewTarget){const p=(i?.get("path")||i?.get("prefix")||"").replace(/^\/+|\/+$/g,"");p&&(u.viewTarget=M_(p),u.queryTarget=!0)}return u}function px(e,n){const r=n.replace(/\/+$/,"");return r!==n&&(e.trailingSlash=!0),e.path=r?M_(r):"",e}function M3(e,n){const r=e.replace(/^\/+/,"");if(n!=="hub")return px({path:""},r);if(r==="orgs"||r.startsWith("orgs/"))return{org:r.slice(5).replace(/\/+$/,""),path:""};if(r==="billing"||r.startsWith("billing/"))return{billing:!0,path:""};const i=r.indexOf("/");if(i===-1)return{project:r,path:""};const o=px({project:r.slice(0,i),path:""},r.slice(i+1)),l=o.path.indexOf("/"),u=l===-1?o.path:o.path.slice(0,l),d=A3(u);return(O3.has(u)||d)&&(o.view=d||u,d&&(o.legacyView=!0),o.viewTarget=l===-1?"":o.path.slice(l+1).replace(/\/+$/,""),o.path=""),o}function dl(e,n,r){const i=A_(e),o=r?"?v="+r:"";return n?"/"+n+(i?"/"+i:"")+o:"/"+i+o}function Pn(e,n,r,i){let o=(n?"/"+n:"")+"/"+e;return r&&(o+="/"+A_(r.replace(/\/+$/,""))),o+(e==="history"?N_(i):"")}let Kp="POP";const zm=new Set;function z_(){for(const e of zm)e()}window.addEventListener("popstate",()=>{Kp="POP",z_()});function Kt(e,n){const r=location.pathname+location.search;!n?.replace&&r===e||(history[n?.replace?"replaceState":"pushState"](null,"",e),Kp=n?.replace?"REPLACE":"PUSH",z_())}function Yp(){return w.useSyncExternalStore(e=>(zm.add(e),()=>{zm.delete(e)}),()=>location.pathname+location.search)}function N3(){return Kp}function Hs(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(),Kt(e),document.body.classList.remove("sb-open"))}}:{href:e,target:"_blank",rel:"noopener noreferrer"}}function Yo({to:e}){return w.useEffect(()=>{Kt(e,{replace:!0})},[e]),null}function k_(){return{accessor:(e,n)=>typeof e=="function"?{...n,accessorFn:e}:{...n,accessorKey:e},display:e=>e,group:e=>e}}function Da(e,n){return typeof e=="function"?e(n):e}function Fn(e,n){return r=>{n.setState(i=>({...i,[e]:Da(r,i[e])}))}}function ed(e){return e instanceof Function}function D3(e){return Array.isArray(e)&&e.every(n=>typeof n=="number")}function z3(e,n){const r=[],i=o=>{o.forEach(l=>{r.push(l);const u=n(l);u!=null&&u.length&&i(u)})};return i(e),r}function ze(e,n,r){let i=[],o;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 o;i=d;let m;if(r.key&&r.debug&&(m=Date.now()),o=n(...d),r==null||r.onChange==null||r.onChange(o),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=(S,_)=>{for(S=String(S);S.length<_;)S=" "+S;return S};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 o}}function ke(e,n,r,i){return{debug:()=>{var o;return(o=e?.debugAll)!=null?o:e[n]},key:!1,onChange:i}}function k3(e,n,r,i){const o=()=>{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:o,getContext:ze(()=>[e,r,n,l],(u,d,p,m)=>({table:u,column:d,row:p,cell:m,getValue:m.getValue,renderValue:m.renderValue}),ke(e.options,"debugCells"))};return e._features.forEach(u=>{u.createCell==null||u.createCell(l,r,n,e)},{}),l}function L3(e,n,r,i){var o,l;const d={...e._getDefaultColumnDef(),...n},p=d.accessorKey;let m=(o=(l=d.id)!=null?l:p?typeof String.prototype.replaceAll=="function"?p.replaceAll(".","_"):p.replace(/\./g,"_"):void 0)!=null?o:typeof d.header=="string"?d.header:void 0,y;if(d.accessorFn?y=d.accessorFn:p&&(p.includes(".")?y=b=>{let x=b;for(const _ of p.split(".")){var S;x=(S=x)==null?void 0:S[_]}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:ze(()=>[!0],()=>{var b;return[v,...(b=v.columns)==null?void 0:b.flatMap(x=>x.getFlatColumns())]},ke(e.options,"debugColumns")),getLeafColumns:ze(()=>[e._getOrderColumnsFn()],b=>{var x;if((x=v.columns)!=null&&x.length){let S=v.columns.flatMap(_=>_.getLeafColumns());return b(S)}return[v]},ke(e.options,"debugColumns"))};for(const b of e._features)b.createColumn==null||b.createColumn(v,e);return v}const un="debugHeaders";function gx(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=p=>{p.subHeaders&&p.subHeaders.length&&p.subHeaders.map(d),u.push(p)};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 $3={createTable:e=>{e.getHeaderGroups=ze(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,r,i,o)=>{var l,u;const d=(l=i?.map(v=>r.find(b=>b.id===v)).filter(Boolean))!=null?l:[],p=(u=o?.map(v=>r.find(b=>b.id===v)).filter(Boolean))!=null?u:[],m=r.filter(v=>!(i!=null&&i.includes(v.id))&&!(o!=null&&o.includes(v.id)));return Xc(n,[...d,...m,...p],e)},ke(e.options,un)),e.getCenterHeaderGroups=ze(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,r,i,o)=>(r=r.filter(l=>!(i!=null&&i.includes(l.id))&&!(o!=null&&o.includes(l.id))),Xc(n,r,e,"center")),ke(e.options,un)),e.getLeftHeaderGroups=ze(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(n,r,i)=>{var o;const l=(o=i?.map(u=>r.find(d=>d.id===u)).filter(Boolean))!=null?o:[];return Xc(n,l,e,"left")},ke(e.options,un)),e.getRightHeaderGroups=ze(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(n,r,i)=>{var o;const l=(o=i?.map(u=>r.find(d=>d.id===u)).filter(Boolean))!=null?o:[];return Xc(n,l,e,"right")},ke(e.options,un)),e.getFooterGroups=ze(()=>[e.getHeaderGroups()],n=>[...n].reverse(),ke(e.options,un)),e.getLeftFooterGroups=ze(()=>[e.getLeftHeaderGroups()],n=>[...n].reverse(),ke(e.options,un)),e.getCenterFooterGroups=ze(()=>[e.getCenterHeaderGroups()],n=>[...n].reverse(),ke(e.options,un)),e.getRightFooterGroups=ze(()=>[e.getRightHeaderGroups()],n=>[...n].reverse(),ke(e.options,un)),e.getFlatHeaders=ze(()=>[e.getHeaderGroups()],n=>n.map(r=>r.headers).flat(),ke(e.options,un)),e.getLeftFlatHeaders=ze(()=>[e.getLeftHeaderGroups()],n=>n.map(r=>r.headers).flat(),ke(e.options,un)),e.getCenterFlatHeaders=ze(()=>[e.getCenterHeaderGroups()],n=>n.map(r=>r.headers).flat(),ke(e.options,un)),e.getRightFlatHeaders=ze(()=>[e.getRightHeaderGroups()],n=>n.map(r=>r.headers).flat(),ke(e.options,un)),e.getCenterLeafHeaders=ze(()=>[e.getCenterFlatHeaders()],n=>n.filter(r=>{var i;return!((i=r.subHeaders)!=null&&i.length)}),ke(e.options,un)),e.getLeftLeafHeaders=ze(()=>[e.getLeftFlatHeaders()],n=>n.filter(r=>{var i;return!((i=r.subHeaders)!=null&&i.length)}),ke(e.options,un)),e.getRightLeafHeaders=ze(()=>[e.getRightFlatHeaders()],n=>n.filter(r=>{var i;return!((i=r.subHeaders)!=null&&i.length)}),ke(e.options,un)),e.getLeafHeaders=ze(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(n,r,i)=>{var o,l,u,d,p,m;return[...(o=(l=n[0])==null?void 0:l.headers)!=null?o:[],...(u=(d=r[0])==null?void 0:d.headers)!=null?u:[],...(p=(m=i[0])==null?void 0:m.headers)!=null?p:[]].map(y=>y.getLeafHeaders()).flat()},ke(e.options,un))}};function Xc(e,n,r,i){var o,l;let u=0;const d=function(b,x){x===void 0&&(x=1),u=Math.max(u,x),b.filter(S=>S.getIsVisible()).forEach(S=>{var _;(_=S.columns)!=null&&_.length&&d(S.columns,x+1)},0)};d(e);let p=[];const m=(b,x)=>{const S={depth:x,id:[i,`${x}`].filter(Boolean).join("_"),headers:[]},_=[];b.forEach(E=>{const R=[..._].reverse()[0],T=E.column.depth===S.depth;let O,M=!1;if(T&&E.column.parent?O=E.column.parent:(O=E.column,M=!0),R&&R?.column===O)R.subHeaders.push(E);else{const D=gx(r,O,{id:[i,x,O.id,E?.id].filter(Boolean).join("_"),isPlaceholder:M,placeholderId:M?`${_.filter(P=>P.column===O).length}`:void 0,depth:x,index:_.length});D.subHeaders.push(E),_.push(D)}S.headers.push(E),E.headerGroup=S}),p.push(S),x>0&&m(_,x-1)},y=n.map((b,x)=>gx(r,b,{depth:u,index:x}));m(y,u-1),p.reverse();const v=b=>b.filter(S=>S.column.getIsVisible()).map(S=>{let _=0,E=0,R=[0];S.subHeaders&&S.subHeaders.length?(R=[],v(S.subHeaders).forEach(O=>{let{colSpan:M,rowSpan:D}=O;_+=M,R.push(D)})):_=1;const T=Math.min(...R);return E=E+T,S.colSpan=_,S.rowSpan=E,{colSpan:_,rowSpan:E}});return v((o=(l=p[0])==null?void 0:l.headers)!=null?o:[]),p}const I3=(e,n,r,i,o,l,u)=>{let d={id:n,index:i,original:r,depth:o,parentId:u,_valuesCache:{},_uniqueValuesCache:{},getValue:p=>{if(d._valuesCache.hasOwnProperty(p))return d._valuesCache[p];const m=e.getColumn(p);if(m!=null&&m.accessorFn)return d._valuesCache[p]=m.accessorFn(d.original,i),d._valuesCache[p]},getUniqueValues:p=>{if(d._uniqueValuesCache.hasOwnProperty(p))return d._uniqueValuesCache[p];const m=e.getColumn(p);if(m!=null&&m.accessorFn)return m.columnDef.getUniqueValues?(d._uniqueValuesCache[p]=m.columnDef.getUniqueValues(d.original,i),d._uniqueValuesCache[p]):(d._uniqueValuesCache[p]=[d.getValue(p)],d._uniqueValuesCache[p])},renderValue:p=>{var m;return(m=d.getValue(p))!=null?m:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>z3(d.subRows,p=>p.subRows),getParentRow:()=>d.parentId?e.getRow(d.parentId,!0):void 0,getParentRows:()=>{let p=[],m=d;for(;;){const y=m.getParentRow();if(!y)break;p.push(y),m=y}return p.reverse()},getAllCells:ze(()=>[e.getAllLeafColumns()],p=>p.map(m=>k3(e,d,m,m.id)),ke(e.options,"debugRows")),_getAllCellsByColumnId:ze(()=>[d.getAllCells()],p=>p.reduce((m,y)=>(m[y.column.id]=y,m),{}),ke(e.options,"debugRows"))};for(let p=0;p{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()}}},L_=(e,n,r)=>{var i,o;const l=r==null||(i=r.toString())==null?void 0:i.toLowerCase();return!!(!((o=e.getValue(n))==null||(o=o.toString())==null||(o=o.toLowerCase())==null)&&o.includes(l))};L_.autoRemove=e=>gr(e);const $_=(e,n,r)=>{var i;return!!(!((i=e.getValue(n))==null||(i=i.toString())==null)&&i.includes(r))};$_.autoRemove=e=>gr(e);const I_=(e,n,r)=>{var i;return((i=e.getValue(n))==null||(i=i.toString())==null?void 0:i.toLowerCase())===r?.toLowerCase()};I_.autoRemove=e=>gr(e);const P_=(e,n,r)=>{var i;return(i=e.getValue(n))==null?void 0:i.includes(r)};P_.autoRemove=e=>gr(e);const F_=(e,n,r)=>!r.some(i=>{var o;return!((o=e.getValue(n))!=null&&o.includes(i))});F_.autoRemove=e=>gr(e)||!(e!=null&&e.length);const V_=(e,n,r)=>r.some(i=>{var o;return(o=e.getValue(n))==null?void 0:o.includes(i)});V_.autoRemove=e=>gr(e)||!(e!=null&&e.length);const U_=(e,n,r)=>e.getValue(n)===r;U_.autoRemove=e=>gr(e);const H_=(e,n,r)=>e.getValue(n)==r;H_.autoRemove=e=>gr(e);const Qp=(e,n,r)=>{let[i,o]=r;const l=e.getValue(n);return l>=i&&l<=o};Qp.resolveFilterValue=e=>{let[n,r]=e,i=typeof n!="number"?parseFloat(n):n,o=typeof r!="number"?parseFloat(r):r,l=n===null||Number.isNaN(i)?-1/0:i,u=r===null||Number.isNaN(o)?1/0:o;if(l>u){const d=l;l=u,u=d}return[l,u]};Qp.autoRemove=e=>gr(e)||gr(e[0])&&gr(e[1]);const ta={includesString:L_,includesStringSensitive:$_,equalsString:I_,arrIncludes:P_,arrIncludesAll:F_,arrIncludesSome:V_,equals:U_,weakEquals:H_,inNumberRange:Qp};function gr(e){return e==null||e===""}const F3={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Fn("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"?ta.includesString:typeof i=="number"?ta.inNumberRange:typeof i=="boolean"||i!==null&&typeof i=="object"?ta.equals:Array.isArray(i)?ta.arrIncludes:ta.weakEquals},e.getFilterFn=()=>{var r,i;return ed(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:ta[e.columnDef.filterFn]},e.getCanFilter=()=>{var r,i,o;return((r=e.columnDef.enableColumnFilter)!=null?r:!0)&&((i=n.options.enableColumnFilters)!=null?i:!0)&&((o=n.options.enableFilters)!=null?o:!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(o=>o.id===e.id))!=null?r:-1},e.setFilterValue=r=>{n.setColumnFilters(i=>{const o=e.getFilterFn(),l=i?.find(y=>y.id===e.id),u=Da(r,l?l.value:void 0);if(vx(o,u,e)){var d;return(d=i?.filter(y=>y.id!==e.id))!=null?d:[]}const p={id:e.id,value:u};if(l){var m;return(m=i?.map(y=>y.id===e.id?p:y))!=null?m:[]}return i!=null&&i.length?[...i,p]:[p]})}},createRow:(e,n)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=n=>{const r=e.getAllLeafColumns(),i=o=>{var l;return(l=Da(n,o))==null?void 0:l.filter(u=>{const d=r.find(p=>p.id===u.id);if(d){const p=d.getFilterFn();if(vx(p,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 vx(e,n,r){return(e&&e.autoRemove?e.autoRemove(n,r):!1)||typeof n>"u"||typeof n=="string"&&!n}const V3=(e,n,r)=>r.reduce((i,o)=>{const l=o.getValue(e);return i+(typeof l=="number"?l:0)},0),U3=(e,n,r)=>{let i;return r.forEach(o=>{const l=o.getValue(e);l!=null&&(i>l||i===void 0&&l>=l)&&(i=l)}),i},H3=(e,n,r)=>{let i;return r.forEach(o=>{const l=o.getValue(e);l!=null&&(i=l)&&(i=l)}),i},B3=(e,n,r)=>{let i,o;return r.forEach(l=>{const u=l.getValue(e);u!=null&&(i===void 0?u>=u&&(i=o=u):(i>u&&(i=u),o{let r=0,i=0;if(n.forEach(o=>{let l=o.getValue(e);l!=null&&(l=+l)>=l&&(++r,i+=l)}),r)return i/r},G3=(e,n)=>{if(!n.length)return;const r=n.map(l=>l.getValue(e));if(!D3(r))return;if(r.length===1)return r[0];const i=Math.floor(r.length/2),o=r.sort((l,u)=>l-u);return r.length%2!==0?o[i]:(o[i-1]+o[i])/2},Z3=(e,n)=>Array.from(new Set(n.map(r=>r.getValue(e))).values()),K3=(e,n)=>new Set(n.map(r=>r.getValue(e))).size,Y3=(e,n)=>n.length,qh={sum:V3,min:U3,max:H3,extent:B3,mean:q3,median:G3,unique:Z3,uniqueCount:K3,count:Y3},Q3={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:Fn("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 qh.sum;if(Object.prototype.toString.call(i)==="[object Date]")return qh.extent},e.getAggregationFn=()=>{var r,i;if(!e)throw new Error;return ed(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:qh[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 o;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((o=r.subRows)!=null&&o.length)}}};function X3(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 J3={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Fn("columnOrder",e)}),createColumn:(e,n)=>{e.getIndex=ze(r=>[Wo(n,r)],r=>r.findIndex(i=>i.id===e.id),ke(n.options,"debugColumns")),e.getIsFirstColumn=r=>{var i;return((i=Wo(n,r)[0])==null?void 0:i.id)===e.id},e.getIsLastColumn=r=>{var i;const o=Wo(n,r);return((i=o[o.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=ze(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(n,r,i)=>o=>{let l=[];if(!(n!=null&&n.length))l=o;else{const u=[...n],d=[...o];for(;d.length&&u.length;){const p=u.shift(),m=d.findIndex(y=>y.id===p);m>-1&&l.push(d.splice(m,1)[0])}l=[...l,...d]}return X3(l,r,i)},ke(e.options,"debugTable"))}},Gh=()=>({left:[],right:[]}),W3={getInitialState:e=>({columnPinning:Gh(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Fn("columnPinning",e)}),createColumn:(e,n)=>{e.pin=r=>{const i=e.getLeafColumns().map(o=>o.id).filter(Boolean);n.setColumnPinning(o=>{var l,u;if(r==="right"){var d,p;return{left:((d=o?.left)!=null?d:[]).filter(v=>!(i!=null&&i.includes(v))),right:[...((p=o?.right)!=null?p:[]).filter(v=>!(i!=null&&i.includes(v))),...i]}}if(r==="left"){var m,y;return{left:[...((m=o?.left)!=null?m:[]).filter(v=>!(i!=null&&i.includes(v))),...i],right:((y=o?.right)!=null?y:[]).filter(v=>!(i!=null&&i.includes(v)))}}return{left:((l=o?.left)!=null?l:[]).filter(v=>!(i!=null&&i.includes(v))),right:((u=o?.right)!=null?u:[]).filter(v=>!(i!=null&&i.includes(v)))}})},e.getCanPin=()=>e.getLeafColumns().some(i=>{var o,l,u;return((o=i.columnDef.enablePinning)!=null?o:!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:o}=n.getState().columnPinning,l=r.some(d=>i?.includes(d)),u=r.some(d=>o?.includes(d));return l?"left":u?"right":!1},e.getPinnedIndex=()=>{var r,i;const o=e.getIsPinned();return o?(r=(i=n.getState().columnPinning)==null||(i=i[o])==null?void 0:i.indexOf(e.id))!=null?r:-1:0}},createRow:(e,n)=>{e.getCenterVisibleCells=ze(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left,n.getState().columnPinning.right],(r,i,o)=>{const l=[...i??[],...o??[]];return r.filter(u=>!l.includes(u.column.id))},ke(n.options,"debugRows")),e.getLeftVisibleCells=ze(()=>[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"})),ke(n.options,"debugRows")),e.getRightVisibleCells=ze(()=>[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"})),ke(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?Gh():(r=(i=e.initialState)==null?void 0:i.columnPinning)!=null?r:Gh())},e.getIsSomeColumnsPinned=n=>{var r;const i=e.getState().columnPinning;if(!n){var o,l;return!!((o=i.left)!=null&&o.length||(l=i.right)!=null&&l.length)}return!!((r=i[n])!=null&&r.length)},e.getLeftLeafColumns=ze(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(n,r)=>(r??[]).map(i=>n.find(o=>o.id===i)).filter(Boolean),ke(e.options,"debugColumns")),e.getRightLeafColumns=ze(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(n,r)=>(r??[]).map(i=>n.find(o=>o.id===i)).filter(Boolean),ke(e.options,"debugColumns")),e.getCenterLeafColumns=ze(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,r,i)=>{const o=[...r??[],...i??[]];return n.filter(l=>!o.includes(l.id))},ke(e.options,"debugColumns"))}};function e4(e){return e||(typeof document<"u"?document:null)}const Jc={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Zh=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),t4={getDefaultColumnDef:()=>Jc,getInitialState:e=>({columnSizing:{},columnSizingInfo:Zh(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Fn("columnSizing",e),onColumnSizingInfoChange:Fn("columnSizingInfo",e)}),createColumn:(e,n)=>{e.getSize=()=>{var r,i,o;const l=n.getState().columnSizing[e.id];return Math.min(Math.max((r=e.columnDef.minSize)!=null?r:Jc.minSize,(i=l??e.columnDef.size)!=null?i:Jc.size),(o=e.columnDef.maxSize)!=null?o:Jc.maxSize)},e.getStart=ze(r=>[r,Wo(n,r),n.getState().columnSizing],(r,i)=>i.slice(0,e.getIndex(r)).reduce((o,l)=>o+l.getSize(),0),ke(n.options,"debugColumns")),e.getAfter=ze(r=>[r,Wo(n,r),n.getState().columnSizing],(r,i)=>i.slice(e.getIndex(r)+1).reduce((o,l)=>o+l.getSize(),0),ke(n.options,"debugColumns")),e.resetSize=()=>{n.setColumnSizing(r=>{let{[e.id]:i,...o}=r;return o})},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=o=>{if(o.subHeaders.length)o.subHeaders.forEach(i);else{var l;r+=(l=o.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),o=i?.getCanResize();return l=>{if(!i||!o||(l.persist==null||l.persist(),Kh(l)&&l.touches&&l.touches.length>1))return;const u=e.getSize(),d=e?e.getLeafHeaders().map(R=>[R.column.id,R.column.getSize()]):[[i.id,i.getSize()]],p=Kh(l)?Math.round(l.touches[0].clientX):l.clientX,m={},y=(R,T)=>{typeof T=="number"&&(n.setColumnSizingInfo(O=>{var M,D;const P=n.options.columnResizeDirection==="rtl"?-1:1,F=(T-((M=O?.startOffset)!=null?M:0))*P,V=Math.max(F/((D=O?.startSize)!=null?D:0),-.999999);return O.columnSizingStart.forEach(ve=>{let[be,he]=ve;m[be]=Math.round(Math.max(he+he*V,0)*100)/100}),{...O,deltaOffset:F,deltaPercentage:V}}),(n.options.columnResizeMode==="onChange"||R==="end")&&n.setColumnSizing(O=>({...O,...m})))},v=R=>y("move",R),b=R=>{y("end",R),n.setColumnSizingInfo(T=>({...T,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},x=e4(r),S={moveHandler:R=>v(R.clientX),upHandler:R=>{x?.removeEventListener("mousemove",S.moveHandler),x?.removeEventListener("mouseup",S.upHandler),b(R.clientX)}},_={moveHandler:R=>(R.cancelable&&(R.preventDefault(),R.stopPropagation()),v(R.touches[0].clientX),!1),upHandler:R=>{var T;x?.removeEventListener("touchmove",_.moveHandler),x?.removeEventListener("touchend",_.upHandler),R.cancelable&&(R.preventDefault(),R.stopPropagation()),b((T=R.touches[0])==null?void 0:T.clientX)}},E=n4()?{passive:!1}:!1;Kh(l)?(x?.addEventListener("touchmove",_.moveHandler,E),x?.addEventListener("touchend",_.upHandler,E)):(x?.addEventListener("mousemove",S.moveHandler,E),x?.addEventListener("mouseup",S.upHandler,E)),n.setColumnSizingInfo(R=>({...R,startOffset:p,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?Zh():(r=e.initialState.columnSizingInfo)!=null?r:Zh())},e.getTotalSize=()=>{var n,r;return(n=(r=e.getHeaderGroups()[0])==null?void 0:r.headers.reduce((i,o)=>i+o.getSize(),0))!=null?n:0},e.getLeftTotalSize=()=>{var n,r;return(n=(r=e.getLeftHeaderGroups()[0])==null?void 0:r.headers.reduce((i,o)=>i+o.getSize(),0))!=null?n:0},e.getCenterTotalSize=()=>{var n,r;return(n=(r=e.getCenterHeaderGroups()[0])==null?void 0:r.headers.reduce((i,o)=>i+o.getSize(),0))!=null?n:0},e.getRightTotalSize=()=>{var n,r;return(n=(r=e.getRightHeaderGroups()[0])==null?void 0:r.headers.reduce((i,o)=>i+o.getSize(),0))!=null?n:0}}};let Wc=null;function n4(){if(typeof Wc=="boolean")return Wc;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 Wc=e,Wc}function Kh(e){return e.type==="touchstart"}const r4={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Fn("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 o=e.columns;return(r=o.length?o.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=ze(()=>[e.getAllCells(),n.getState().columnVisibility],r=>r.filter(i=>i.column.getIsVisible()),ke(n.options,"debugRows")),e.getVisibleCells=ze(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(r,i,o)=>[...r,...i,...o],ke(n.options,"debugRows"))},createTable:e=>{const n=(r,i)=>ze(()=>[i(),i().filter(o=>o.getIsVisible()).map(o=>o.id).join("_")],o=>o.filter(l=>l.getIsVisible==null?void 0:l.getIsVisible()),ke(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((o,l)=>({...o,[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 Wo(e,n){return n?n==="center"?e.getCenterVisibleLeafColumns():n==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const a4={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()}}},i4={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Fn("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,o,l;return((r=e.columnDef.enableGlobalFilter)!=null?r:!0)&&((i=n.options.enableGlobalFilter)!=null?i:!0)&&((o=n.options.enableFilters)!=null?o:!0)&&((l=n.options.getColumnCanGlobalFilter==null?void 0:n.options.getColumnCanGlobalFilter(e))!=null?l:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>ta.includesString,e.getGlobalFilterFn=()=>{var n,r;const{globalFilterFn:i}=e.options;return ed(i)?i:i==="auto"?e.getGlobalAutoFilterFn():(n=(r=e.options.filterFns)==null?void 0:r[i])!=null?n:ta[i]},e.setGlobalFilter=n=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(n)},e.resetGlobalFilter=n=>{e.setGlobalFilter(n?void 0:e.initialState.globalFilter)}}},s4={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Fn("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let n=!1,r=!1;e._autoResetExpanded=()=>{var i,o;if(!n){e._queue(()=>{n=!0});return}if((i=(o=e.options.autoResetAll)!=null?o: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 o,l;e.setExpanded(i?{}:(o=(l=e.initialState)==null?void 0:l.expanded)!=null?o:{})},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(o=>!o.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 o;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=(o=r)!=null?o:!l,!l&&r)return{...u,[e.id]:!0};if(l&&!r){const{[e.id]:d,...p}=u;return p}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,o;return(r=n.options.getRowCanExpand==null?void 0:n.options.getRowCanExpand(e))!=null?r:((i=n.options.enableExpanding)!=null?i:!0)&&!!((o=e.subRows)!=null&&o.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()}}}},km=0,Lm=10,Yh=()=>({pageIndex:km,pageSize:Lm}),o4={getInitialState:e=>({...e,pagination:{...Yh(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:Fn("pagination",e)}),createTable:e=>{let n=!1,r=!1;e._autoResetPageIndex=()=>{var i,o;if(!n){e._queue(()=>{n=!0});return}if((i=(o=e.options.autoResetAll)!=null?o:e.options.autoResetPageIndex)!=null?i:!e.options.manualPagination){if(r)return;r=!0,e._queue(()=>{e.resetPageIndex(),r=!1})}},e.setPagination=i=>{const o=l=>Da(i,l);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(o)},e.resetPagination=i=>{var o;e.setPagination(i?Yh():(o=e.initialState.pagination)!=null?o:Yh())},e.setPageIndex=i=>{e.setPagination(o=>{let l=Da(i,o.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)),{...o,pageIndex:l}})},e.resetPageIndex=i=>{var o,l;e.setPageIndex(i?km:(o=(l=e.initialState)==null||(l=l.pagination)==null?void 0:l.pageIndex)!=null?o:km)},e.resetPageSize=i=>{var o,l;e.setPageSize(i?Lm:(o=(l=e.initialState)==null||(l=l.pagination)==null?void 0:l.pageSize)!=null?o:Lm)},e.setPageSize=i=>{e.setPagination(o=>{const l=Math.max(1,Da(i,o.pageSize)),u=o.pageSize*o.pageIndex,d=Math.floor(u/l);return{...o,pageIndex:d,pageSize:l}})},e.setPageCount=i=>e.setPagination(o=>{var l;let u=Da(i,(l=e.options.pageCount)!=null?l:-1);return typeof u=="number"&&(u=Math.max(-1,u)),{...o,pageCount:u}}),e.getPageOptions=ze(()=>[e.getPageCount()],i=>{let o=[];return i&&i>0&&(o=[...new Array(i)].fill(null).map((l,u)=>u)),o},ke(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:i}=e.getState().pagination,o=e.getPageCount();return o===-1?!0:o===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:[]}),l4={getInitialState:e=>({rowPinning:Qh(),...e}),getDefaultOptions:e=>({onRowPinningChange:Fn("rowPinning",e)}),createRow:(e,n)=>{e.pin=(r,i,o)=>{const l=i?e.getLeafRows().map(p=>{let{id:m}=p;return m}):[],u=o?e.getParentRows().map(p=>{let{id:m}=p;return m}):[],d=new Set([...u,e.id,...l]);n.setRowPinning(p=>{var m,y;if(r==="bottom"){var v,b;return{top:((v=p?.top)!=null?v:[]).filter(_=>!(d!=null&&d.has(_))),bottom:[...((b=p?.bottom)!=null?b:[]).filter(_=>!(d!=null&&d.has(_))),...Array.from(d)]}}if(r==="top"){var x,S;return{top:[...((x=p?.top)!=null?x:[]).filter(_=>!(d!=null&&d.has(_))),...Array.from(d)],bottom:((S=p?.bottom)!=null?S:[]).filter(_=>!(d!=null&&d.has(_)))}}return{top:((m=p?.top)!=null?m:[]).filter(_=>!(d!=null&&d.has(_))),bottom:((y=p?.bottom)!=null?y:[]).filter(_=>!(d!=null&&d.has(_)))}})},e.getCanPin=()=>{var r;const{enableRowPinning:i,enablePinning:o}=n.options;return typeof i=="function"?i(e):(r=i??o)!=null?r:!0},e.getIsPinned=()=>{const r=[e.id],{top:i,bottom:o}=n.getState().rowPinning,l=r.some(d=>i?.includes(d)),u=r.some(d=>o?.includes(d));return l?"top":u?"bottom":!1},e.getPinnedIndex=()=>{var r,i;const o=e.getIsPinned();if(!o)return-1;const l=(r=o==="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 o,l;return!!((o=i.top)!=null&&o.length||(l=i.bottom)!=null&&l.length)}return!!((r=i[n])!=null&&r.length)},e._getPinnedRows=(n,r,i)=>{var o;return((o=e.options.keepPinnedRows)==null||o?(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=ze(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(n,r)=>e._getPinnedRows(n,r,"top"),ke(e.options,"debugRows")),e.getBottomRows=ze(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(n,r)=>e._getPinnedRows(n,r,"bottom"),ke(e.options,"debugRows")),e.getCenterRows=ze(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(n,r,i)=>{const o=new Set([...r??[],...i??[]]);return n.filter(l=>!o.has(l.id))},ke(e.options,"debugRows"))}},c4={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Fn("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},o=e.getPreGroupedRowModel().flatRows;return n?o.forEach(l=>{l.getCanSelect()&&(i[l.id]=!0)}):o.forEach(l=>{delete i[l.id]}),i})},e.toggleAllPageRowsSelected=n=>e.setRowSelection(r=>{const i=typeof n<"u"?n:!e.getIsAllPageRowsSelected(),o={...r};return e.getRowModel().rows.forEach(l=>{$m(o,l.id,i,!0,e)}),o}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=ze(()=>[e.getState().rowSelection,e.getCoreRowModel()],(n,r)=>Object.keys(n).length?Xh(e,r):{rows:[],flatRows:[],rowsById:{}},ke(e.options,"debugTable")),e.getFilteredSelectedRowModel=ze(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(n,r)=>Object.keys(n).length?Xh(e,r):{rows:[],flatRows:[],rowsById:{}},ke(e.options,"debugTable")),e.getGroupedSelectedRowModel=ze(()=>[e.getState().rowSelection,e.getSortedRowModel()],(n,r)=>Object.keys(n).length?Xh(e,r):{rows:[],flatRows:[],rowsById:{}},ke(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(o=>o.getCanSelect()&&!r[o.id])&&(i=!1),i},e.getIsAllPageRowsSelected=()=>{const n=e.getPaginationRowModel().flatRows.filter(o=>o.getCanSelect()),{rowSelection:r}=e.getState();let i=!!n.length;return i&&n.some(o=>!r[o.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 o=e.getIsSelected();n.setRowSelection(l=>{var u;if(r=typeof r<"u"?r:!o,e.getCanSelect()&&o===r)return l;const d={...l};return $m(d,e.id,r,(u=i?.selectChildren)!=null?u:!0,n),d})},e.getIsSelected=()=>{const{rowSelection:r}=n.getState();return Xp(e,r)},e.getIsSomeSelected=()=>{const{rowSelection:r}=n.getState();return Im(e,r)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:r}=n.getState();return Im(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 o;r&&e.toggleSelected((o=i.target)==null?void 0:o.checked)}}}},$m=(e,n,r,i,o)=>{var l;const u=o.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=>$m(e,d.id,r,i,o))};function Xh(e,n){const r=e.getState().rowSelection,i=[],o={},l=function(u,d){return u.map(p=>{var m;const y=Xp(p,r);if(y&&(i.push(p),o[p.id]=p),(m=p.subRows)!=null&&m.length&&(p={...p,subRows:l(p.subRows)}),y)return p}).filter(Boolean)};return{rows:l(n.rows),flatRows:i,rowsById:o}}function Xp(e,n){var r;return(r=n[e.id])!=null?r:!1}function Im(e,n,r){var i;if(!((i=e.subRows)!=null&&i.length))return!1;let o=!0,l=!1;return e.subRows.forEach(u=>{if(!(l&&!o)&&(u.getCanSelect()&&(Xp(u,n)?l=!0:o=!1),u.subRows&&u.subRows.length)){const d=Im(u,n);d==="all"?l=!0:(d==="some"&&(l=!0),o=!1)}}),o?"all":l?"some":!1}const Pm=/([0-9]+)/gm,u4=(e,n,r)=>B_(Ba(e.getValue(r)).toLowerCase(),Ba(n.getValue(r)).toLowerCase()),d4=(e,n,r)=>B_(Ba(e.getValue(r)),Ba(n.getValue(r))),f4=(e,n,r)=>Jp(Ba(e.getValue(r)).toLowerCase(),Ba(n.getValue(r)).toLowerCase()),h4=(e,n,r)=>Jp(Ba(e.getValue(r)),Ba(n.getValue(r))),m4=(e,n,r)=>{const i=e.getValue(r),o=n.getValue(r);return i>o?1:iJp(e.getValue(r),n.getValue(r));function Jp(e,n){return e===n?0:e>n?1:-1}function Ba(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function B_(e,n){const r=e.split(Pm).filter(Boolean),i=n.split(Pm).filter(Boolean);for(;r.length&&i.length;){const o=r.shift(),l=i.shift(),u=parseInt(o,10),d=parseInt(l,10),p=[u,d].sort();if(isNaN(p[0])){if(o>l)return 1;if(l>o)return-1;continue}if(isNaN(p[1]))return isNaN(u)?-1:1;if(u>d)return 1;if(d>u)return-1}return r.length-i.length}const Ho={alphanumeric:u4,alphanumericCaseSensitive:d4,text:f4,textCaseSensitive:h4,datetime:m4,basic:p4},g4={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Fn("sorting",e),isMultiSortEvent:n=>n.shiftKey}),createColumn:(e,n)=>{e.getAutoSortingFn=()=>{const r=n.getFilteredRowModel().flatRows.slice(10);let i=!1;for(const o of r){const l=o?.getValue(e.id);if(Object.prototype.toString.call(l)==="[object Date]")return Ho.datetime;if(typeof l=="string"&&(i=!0,l.split(Pm).length>1))return Ho.alphanumeric}return i?Ho.text:Ho.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 ed(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:Ho[e.columnDef.sortingFn]},e.toggleSorting=(r,i)=>{const o=e.getNextSortingOrder(),l=typeof r<"u"&&r!==null;n.setSorting(u=>{const d=u?.find(x=>x.id===e.id),p=u?.findIndex(x=>x.id===e.id);let m=[],y,v=l?r:o==="desc";if(u!=null&&u.length&&e.getCanMultiSort()&&i?d?y="toggle":y="add":u!=null&&u.length&&p!==u.length-1?y="replace":d?y="toggle":y="replace",y==="toggle"&&(l||o||(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,o;const l=e.getFirstSortDir(),u=e.getIsSorted();return u?u!==l&&((i=n.options.enableSortingRemoval)==null||i)&&(!(r&&(o=n.options.enableMultiRemove)!=null)||o)?!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(o=>o.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(o=>o.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())}},v4=[$3,r4,J3,W3,P3,F3,a4,i4,g4,Q3,s4,o4,l4,c4,t4];function y4(e){var n,r;const i=[...v4,...(n=e._features)!=null?n:[]];let o={_features:i};const l=o._features.reduce((b,x)=>Object.assign(b,x.getDefaultOptions==null?void 0:x.getDefaultOptions(o)),{}),u=b=>o.options.mergeOptions?o.options.mergeOptions(l,b):{...l,...b};let p={...{},...(r=e.initialState)!=null?r:{}};o._features.forEach(b=>{var x;p=(x=b.getInitialState==null?void 0:b.getInitialState(p))!=null?x:p});const m=[];let y=!1;const v={_features:i,options:{...l,...e},initialState:p,_queue:b=>{m.push(b),y||(y=!0,Promise.resolve().then(()=>{for(;m.length;)m.shift()();y=!1}).catch(x=>setTimeout(()=>{throw x})))},reset:()=>{o.setState(o.initialState)},setOptions:b=>{const x=Da(b,o.options);o.options=u(x)},getState:()=>o.options.state,setState:b=>{o.options.onStateChange==null||o.options.onStateChange(b)},_getRowId:(b,x,S)=>{var _;return(_=o.options.getRowId==null?void 0:o.options.getRowId(b,x,S))!=null?_:`${S?[S.id,x].join("."):x}`},getCoreRowModel:()=>(o._getCoreRowModel||(o._getCoreRowModel=o.options.getCoreRowModel(o)),o._getCoreRowModel()),getRowModel:()=>o.getPaginationRowModel(),getRow:(b,x)=>{let S=(x?o.getPrePaginationRowModel():o.getRowModel()).rowsById[b];if(!S&&(S=o.getCoreRowModel().rowsById[b],!S))throw new Error;return S},_getDefaultColumnDef:ze(()=>[o.options.defaultColumn],b=>{var x;return b=(x=b)!=null?x:{},{header:S=>{const _=S.header.column.columnDef;return _.accessorKey?_.accessorKey:_.accessorFn?_.id:null},cell:S=>{var _,E;return(_=(E=S.renderValue())==null||E.toString==null?void 0:E.toString())!=null?_:null},...o._features.reduce((S,_)=>Object.assign(S,_.getDefaultColumnDef==null?void 0:_.getDefaultColumnDef()),{}),...b}},ke(e,"debugColumns")),_getColumnDefs:()=>o.options.columns,getAllColumns:ze(()=>[o._getColumnDefs()],b=>{const x=function(S,_,E){return E===void 0&&(E=0),S.map(R=>{const T=L3(o,R,E,_),O=R;return T.columns=O.columns?x(O.columns,T,E+1):[],T})};return x(b)},ke(e,"debugColumns")),getAllFlatColumns:ze(()=>[o.getAllColumns()],b=>b.flatMap(x=>x.getFlatColumns()),ke(e,"debugColumns")),_getAllFlatColumnsById:ze(()=>[o.getAllFlatColumns()],b=>b.reduce((x,S)=>(x[S.id]=S,x),{}),ke(e,"debugColumns")),getAllLeafColumns:ze(()=>[o.getAllColumns(),o._getOrderColumnsFn()],(b,x)=>{let S=b.flatMap(_=>_.getLeafColumns());return x(S)},ke(e,"debugColumns")),getColumn:b=>o._getAllFlatColumnsById()[b]};Object.assign(o,v);for(let b=0;bze(()=>[e.options.data],n=>{const r={rows:[],flatRows:[],rowsById:{}},i=function(o,l,u){l===void 0&&(l=0);const d=[];for(let m=0;me._autoResetPageIndex()))}function G_(){return e=>ze(()=>[e.getState().sorting,e.getPreSortedRowModel()],(n,r)=>{if(!r.rows.length||!(n!=null&&n.length))return r;const i=e.getState().sorting,o=[],l=i.filter(p=>{var m;return(m=e.getColumn(p.id))==null?void 0:m.getCanSort()}),u={};l.forEach(p=>{const m=e.getColumn(p.id);m&&(u[p.id]={sortUndefined:m.columnDef.sortUndefined,invertSorting:m.columnDef.invertSorting,sortingFn:m.getSortingFn()})});const d=p=>{const m=p.map(y=>({...y}));return m.sort((y,v)=>{for(let x=0;x{var v;o.push(y),(v=y.subRows)!=null&&v.length&&(y.subRows=d(y.subRows))}),m};return{rows:d(r.rows),flatRows:o,rowsById:r.rowsById}},ke(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function Fm(e,n){return e?b4(e)?w.createElement(e,n):e:null}function b4(e){return x4(e)||typeof e=="function"||w4(e)}function x4(e){return typeof e=="function"&&(()=>{const n=Object.getPrototypeOf(e);return n.prototype&&n.prototype.isReactComponent})()}function w4(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Z_(e){const n={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[r]=w.useState(()=>({current:y4(n)})),[i,o]=w.useState(()=>r.current.initialState);return r.current.setOptions(l=>({...l,...e,state:{...i,...e.state},onStateChange:u=>{o(u),e.onStateChange==null||e.onStateChange(u)}})),r.current}var El=e=>e.type==="checkbox",za=e=>e instanceof Date,an=e=>e==null;const Wp=e=>typeof e=="object";var Rt=e=>!an(e)&&!Array.isArray(e)&&Wp(e)&&!za(e),S4=e=>Rt(e)&&e.target?El(e.target)?e.target.checked:e.target.value:e,_4=(e,n)=>n.split(".").some((r,i,o)=>!isNaN(Number(r))&&e.has(o.slice(0,i).join("."))),K_=e=>{const n=e.constructor&&e.constructor.prototype;return Rt(n)&&n.hasOwnProperty("isPrototypeOf")},td=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(td&&(e instanceof Blob||n))return e;const r=Array.isArray(e);if(!r&&!(Rt(e)&&K_(e)))return e;const i=r?[]:Object.create(Object.getPrototypeOf(e));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(i[o]=Mt(e[o]));return i}const Rs={BLUR:"blur",FOCUS_OUT:"focusout",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},pr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},hr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Y_="root",eg=["__proto__","constructor","prototype"],C4=/^\w*$/;var Rl=e=>C4.test(e),gt=e=>e===void 0;const E4=/[.[\]'"]/;var nd=e=>e.split(E4).filter(Boolean),Se=(e,n,r)=>{if(!n||!Rt(e))return r;const i=Rl(n)?[n]:nd(n);if(i.some(l=>eg.includes(l)))return r;const o=i.reduce((l,u)=>an(l)?void 0:l[u],e);return gt(o)||o===e?gt(e[n])?r:e[n]:o},Tr=e=>typeof e=="boolean",Jn=e=>typeof e=="function",ct=(e,n,r)=>{let i=-1;const o=Rl(n)?[n]:nd(n),l=o.length,u=l-1;for(;++i{const o={};for(const l in e)Object.defineProperty(o,l,{get:()=>{const u=l;return n._proxyFormState[u]!==pr.all&&(n._proxyFormState[u]=!i||pr.all),e[u]}});return o};const T4=td?me.useLayoutEffect:me.useEffect;var on=e=>typeof e=="string",O4=(e,n,r,i,o)=>on(e)?(i&&n.watch.add(e),Se(r,e,o)):Array.isArray(e)?e.map(l=>(i&&n.watch.add(l),Se(r,l))):(i&&(n.watchAll=!0),r),Vm=e=>an(e)||!Wp(e);const yx=(e,n)=>n.length===0&&!Array.isArray(e)&&!K_(e);function Or(e,n,r=new WeakMap){if(e===n)return!0;if(Vm(e)||Vm(n))return Object.is(e,n);if(za(e)&&za(n))return Object.is(e.getTime(),n.getTime());const i=Object.keys(e),o=Object.keys(n);if(i.length!==o.length)return!1;if(yx(e,i)||yx(n,o))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 p=n[u];if(za(d)&&za(p)||(Rt(d)||Array.isArray(d))&&(Rt(p)||Array.isArray(p))?!Or(d,p,r):!Object.is(d,p))return!1}}return!0}var eu=e=>({isOnSubmit:!e||e===pr.onSubmit,isOnBlur:e===pr.onBlur,isOnChange:e===pr.onChange,isOnAll:e===pr.all,isOnTouch:e===pr.onTouched}),Jh=(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 el=(e,n,r,i)=>{for(const o of r||Object.keys(e)){const l=Se(e,o);if(l){const{_f:u,...d}=l;if(u){if(u.refs&&u.refs[0]&&n(u.refs[0],o)&&!i)return!0;if(u.ref&&n(u.ref,u.name)&&!i)return!0;if(el(d,n))break}else if(Rt(d)&&el(d,n))break}}};var bx=(e,n,r)=>{const i=Se(e,r),o=Array.isArray(i)?i:[];return ct(o,Y_,n[r]),ct(e,r,o),e},rn=e=>Rt(e)&&!Object.keys(e).length,tg=e=>e.type==="file",_u=e=>{if(!td)return!1;const n=e?e.ownerDocument:0;return e instanceof(n&&n.defaultView?n.defaultView.HTMLElement:HTMLElement)},ng=e=>e.type==="radio",Cu=e=>e instanceof RegExp,rg=(e,n,r,i,o)=>n?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[i]:o||!0}}:{};const xx={value:!1,isValid:!1},wx={value:!0,isValid:!0};var Q_=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&&!gt(e[0].attributes.value)?gt(e[0].value)||e[0].value===""?wx:{value:e[0].value,isValid:!0}:wx:xx}return xx};const Sx={isValid:!1,value:null};var X_=e=>Array.isArray(e)?e.reduce((n,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:n,Sx):Sx;function _x(e,n,r="validate"){if(on(e)||Array.isArray(e)&&e.every(on)||Tr(e)&&!e)return{type:r,message:on(e)?e:"",ref:n}}var js=e=>Rt(e)&&!Cu(e)?e:{value:e,message:""},Cx=async(e,n,r,i,o,l)=>{const{ref:u,refs:d,required:p,maxLength:m,minLength:y,min:v,max:b,pattern:x,validate:S,name:_,valueAsNumber:E,mount:R}=e._f,T=Se(r,_);if(!R||n.has(_))return{};const O=d?d[0]:u,M=ue=>{if(o&&O.reportValidity){const X=Tr(ue)?"":ue||"";d?d.forEach(pe=>pe.setCustomValidity(X)):O.setCustomValidity(X),O.reportValidity()}},D={},P=ng(u),F=El(u),V=P||F,ve=(E||tg(u))&>(u.value)&>(T)||_u(u)&&u.value===""||T===""||Array.isArray(T)&&!T.length,be=rg.bind(null,_,i,D),he=(ue,X,pe,ge=hr.maxLength,L=hr.minLength)=>{const K=ue?X:pe;D[_]={type:ue?ge:L,message:K,ref:u,...be(ue?ge:L,K)}};if(l?!Array.isArray(T)||!T.length:p&&(!V&&(ve||an(T))||Tr(T)&&!T||F&&!Q_(d).isValid||P&&!X_(d).isValid)){const{value:ue,message:X}=on(p)?{value:!!p,message:p}:js(p);if(ue&&(D[_]={type:hr.required,message:X,ref:O,...be(hr.required,X)},!i))return M(X),D}if(!ve&&(!an(v)||!an(b))){let ue,X;const pe=js(b),ge=js(v);if(!an(T)&&!isNaN(T)){const L=u.valueAsNumber||T&&+T;an(pe.value)||(ue=L>pe.value),an(ge.value)||(X=Lnew Date(new Date().toDateString()+" "+te),re=u.type=="time",W=u.type=="week";on(pe.value)&&T&&(ue=re?K(T)>K(pe.value):W?T>pe.value:L>new Date(pe.value)),on(ge.value)&&T&&(X=re?K(T)+ue.value,ge=!an(X.value)&&T.length<+X.value;if((pe||ge)&&(he(pe,ue.message,X.message),!i))return M(D[_].message),D}if(x&&!ve&&on(T)){const{value:ue,message:X}=js(x);if(Cu(ue)&&!T.match(ue)&&(D[_]={type:hr.pattern,message:X,ref:u,...be(hr.pattern,X)},!i))return M(X),D}if(S){if(Jn(S)){const ue=await S(T,r),X=_x(ue,O);if(X&&(D[_]={...X,...be(hr.validate,X.message)},!i))return M(X.message),D}else if(Rt(S)){let ue={};for(const X in S){if(!rn(ue)&&!i)break;const pe=_x(await S[X](T,r),O,X);pe&&(ue={...pe,...be(X,pe.message)},M(pe.message),i&&(D[_]=ue))}if(!rn(ue)&&(D[_]={ref:O,...ue},!i))return D}}return M(!0),D},cu=e=>Array.isArray(e)?e:[e],J_=e=>Array.isArray(e)?e.filter(Boolean):[];function A4(e,n){const r=n.slice(0,-1).length;let i=0;for(;ieg.includes(String(u))))return e;const i=r.length===1?e:A4(e,r),o=r.length-1,l=r[o];return i&&delete i[l],o!==0&&(Rt(i)&&rn(i)||Array.isArray(i)&&M4(i))&&Nt(e,r.slice(0,-1)),e}const W_=e=>{const n={};for(const r of Object.keys(e))if(Wp(e[r])&&e[r]!==null&&!za(e[r])){const i=W_(e[r]);for(const o of Object.keys(i))n[`${r}.${o}`]=i[o]}else n[r]=e[r];return n},N4=me.createContext(null);N4.displayName="HookFormContext";var Ex=()=>{let e=[];return{get observers(){return e},next:o=>{for(const l of e)l.next&&l.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(l=>l!==o)}}),unsubscribe:()=>{e=[]}}};function eC(e,n){const r={};for(const i in e)if(e.hasOwnProperty(i)){const o=e[i],l=n[i];if(o&&Rt(o)&&l){const u=eC(o,l);Rt(u)&&(r[i]=u)}else e[i]&&(r[i]=l)}return r}var tC=e=>e.type==="select-multiple",D4=e=>ng(e)||El(e),Wh=e=>_u(e)&&e.isConnected,z4=e=>{for(const n in e)if(Jn(e[n]))return!0;return!1};function nC(e){return Array.isArray(e)||Rt(e)&&!z4(e)}function rC(e){return!!(e&&"_f"in e)}function aC(e){return Array.isArray(e)?!e.some(n=>!gt(n)):!Object.keys(e).length}function Um(e,n){Array.isArray(e)?e[n]=void 0:delete e[n]}function Hm(e,n={},r){for(const i in e){const o=e[i],l=r&&r[i];nC(o)&&(!Array.isArray(o)||!rC(l))?(n[i]=Array.isArray(o)?[]:{},Hm(o,n[i],l),aC(n[i])&&Um(n,i)):gt(o)||(n[i]=!0)}return n}function bi(e,n,r,i){r||(r=Hm(n,{},i));for(const o in e){const l=e[o],u=i&&i[o];nC(l)&&(!Array.isArray(l)||!rC(u))?(gt(n)||Vm(r[o])?r[o]=Hm(l,Array.isArray(l)?[]:{},u):bi(l,an(n)?{}:n[o],r[o],u),aC(r[o])&&Um(r,o)):Or(l,n[o])?Um(r,o):r[o]=!0}return r}var iC=(e,{valueAsNumber:n,valueAsDate:r,setValueAs:i})=>gt(e)?e:n?e===""?NaN:e&&+e:r&&on(e)?new Date(e):i?i(e):e;function Rx(e){const n=e.ref;return tg(n)?n.files:ng(n)?X_(e.refs).value:tC(n)?[...n.selectedOptions].map(({value:r})=>r):El(n)?Q_(e.refs).value:iC(gt(n.value)?e.ref.value:n.value,e)}var k4=(e,n,r,i)=>{const o={};for(const l of e){const u=Se(n,l);u&&ct(o,l,u._f)}return{criteriaMode:r,names:[...e],fields:o,shouldUseNativeValidation:i}},Bo=e=>gt(e)?e:Cu(e)?e.source:Rt(e)?Cu(e.value)?e.value.source:e.value:e;const jx="AsyncFunction";var L4=e=>{if(!e||!e.validate)return!1;if(Jn(e.validate))return e.validate.constructor.name===jx;if(Rt(e.validate)){for(const n in e.validate)if(e.validate[n].constructor.name===jx)return!0}return!1},$4=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Tx(e,n,r){const i=Se(e,r);if(i||Rl(r))return{error:i,name:r};const o=r.split(".");for(;o.length;){const l=o.join("."),u=Se(n,l),d=Se(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};o.pop()}return{name:r}}var I4=(e,n,r,i)=>{r(e);const{name:o,...l}=e,u=Object.keys(l);return!u.length||i&&u.length>=Object.keys(n).length||u.find(d=>n[d]===(!i||pr.all))},P4=(e,n,r)=>!e||!n||e===n||cu(e).some(i=>i&&(r?i===n||i.startsWith(n+"."):i.startsWith(n)||n.startsWith(i))),F4=(e,n,r,i,o)=>o.isOnAll?!1:!r&&o.isOnTouch?!(n||e):(r?i.isOnBlur:o.isOnBlur)?!e:(r?i.isOnChange:o.isOnChange)?e:!0,V4=(e,n)=>!J_(Se(e,n)).length&&Nt(e,n);const U4={mode:pr.onSubmit,reValidateMode:pr.onChange,shouldFocusError:!0},em="form",sC={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function H4(e={}){let n={...U4,...e},r={...Mt(sC),isLoading:Jn(n.defaultValues),errors:n.errors||{},disabled:n.disabled||!1},i={},o=Rt(n.defaultValues)||Rt(n.values)?Mt(n.defaultValues||n.values)||{}:{},l=n.shouldUnregister?{}:Mt(o),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 p={},m={};let y=0,v=eu(n.mode),b=eu(n.reValidateMode);const x={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},S={...x};let _={...S};const E={array:Ex(),state:Ex()};let R=0;const T=n.criteriaMode===pr.all,O=(A,I)=>U=>{clearTimeout(m[A]),m[A]=setTimeout(I,U)},M=async A=>{if(!u.keepIsValid&&!n.disabled&&(S.isValid||_.isValid||A)){const I=++R;let U;n.resolver?(U=rn((await pe()).errors),I===R&&D()):U=await K({fields:i,onlyCheckValid:!0,eventType:Rs.VALID}),I===R&&U!==r.isValid&&E.state.next({isValid:U})}},D=(A,I)=>{!n.disabled&&(S.isValidating||S.validatingFields||_.isValidating||_.validatingFields)&&((A||Array.from(d.mount)).forEach(U=>{U&&(I?ct(r.validatingFields,U,I):Nt(r.validatingFields,U))}),E.state.next({validatingFields:r.validatingFields,isValidating:!rn(r.validatingFields)}))},P=()=>{r.dirtyFields=bi(o,l,void 0,i)},F=(A,I=[],U,ce,Z=!0,ne=!0)=>{if(ce&&U&&!n.disabled){if(u.action=!0,ne&&Array.isArray(Se(i,A))){const de=U(Se(i,A),ce.argA,ce.argB);Z&&ct(i,A,de)}if(ne&&Array.isArray(Se(r.errors,A))){const de=U(Se(r.errors,A),ce.argA,ce.argB);Z&&ct(r.errors,A,de),V4(r.errors,A)}if((S.touchedFields||_.touchedFields)&&ne&&Array.isArray(Se(r.touchedFields,A))){const de=U(Se(r.touchedFields,A),ce.argA,ce.argB);Z&&ct(r.touchedFields,A,de)}(S.dirtyFields||_.dirtyFields)&&P(),E.state.next({name:A,isDirty:W(A,I),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ct(l,A,I)},V=(A,I)=>{ct(r.errors,A,I),r.errors={...r.errors},E.state.next({errors:r.errors})},ve=A=>{r.errors=A,E.state.next({errors:r.errors,isValid:!1})},be=A=>{const I=Rl(A)?[A]:nd(A);let U=l,ce=o;for(let Z=0;Z{const Z=Se(i,A);if(Z){if(be(A))return;const ne=gt(Se(l,A)),de=Se(l,A,gt(U)?Se(o,A):U);gt(de)||ce&&ce.defaultChecked||I?ct(l,A,I?de:Rx(Z._f)):N(A,de),u.mount&&!u.action&&(M(),ne&&r.isDirty&&(S.isDirty||_.isDirty)&&(W()||(r.isDirty=!1,E.state.next({...r}))),e.shouldUnregister&&ne&&!gt(Se(l,A))&&Jh(A,d)&&(u.watch=!0))}},ue=(A,I,U,ce,Z)=>{let ne=!1,de=!1;const we={name:A};if(!n.disabled||ce===!0){if(!U||ce){const Ee=Or(Se(o,A),I);(S.isDirty||_.isDirty)&&(de=r.isDirty,r.isDirty=we.isDirty=!Ee||W(),ne=de!==we.isDirty),de=!!Se(r.dirtyFields,A),Ee!==r.isDirty?r.dirtyFields=bi(o,l,void 0,i):Ee?Nt(r.dirtyFields,A):ct(r.dirtyFields,A,!0),we.dirtyFields=r.dirtyFields,ne=ne||(S.dirtyFields||_.dirtyFields)&&de!==!Ee}if(U){const Ee=Se(r.touchedFields,A);Ee||(ct(r.touchedFields,A,U),we.touchedFields=r.touchedFields,ne=ne||(S.touchedFields||_.touchedFields)&&Ee!==U)}ne&&Z&&E.state.next(we)}return ne?we:{}},X=(A,I,U,ce)=>{const Z=Se(r.errors,A),ne=(S.isValid||_.isValid)&&Tr(I)&&r.isValid!==I;if(n.delayError&&U?(p[A]=O(A,()=>V(A,U)),p[A](n.delayError)):(clearTimeout(m[A]),delete p[A],U?ct(r.errors,A,U):Nt(r.errors,A),r.errors={...r.errors}),(U?!Or(Z,U):Z)||!rn(ce)||ne){const de={...ce,...ne&&Tr(I)?{isValid:I}:{},errors:r.errors,name:A};r={...r,...de},E.state.next(de)}},pe=async A=>(D(A,!0),await n.resolver(l,n.context,k4(A||d.mount,i,n.criteriaMode,n.shouldUseNativeValidation))),ge=async A=>{const{errors:I}=await pe(A);if(D(A),A){for(const U of A){const ce=Se(I,U);ce?d.array.has(U)&&Rt(ce)&&!Object.keys(ce).some(Z=>!Number.isNaN(Number(Z)))?bx(r.errors,{[U]:ce},U):ct(r.errors,U,ce):Nt(r.errors,U)}r.errors={...r.errors}}else r.errors=I;return I},L=async({name:A,eventType:I})=>{if(e.validate){const U=await e.validate({formValues:l,formState:r,name:A,eventType:I});if(Rt(U))for(const ce in U){const Z=U[ce];Z&&it(`${em}.${ce}`,{message:on(Z.message)?Z.message:"",type:Z.type||hr.validate})}else on(U)||!U?it(em,{message:U||"",type:hr.validate}):Ve(em);return U}return!0},K=async({fields:A,onlyCheckValid:I,name:U,eventType:ce,context:Z={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(Z.runRootValidation=!0,!await L({name:U,eventType:ce})&&(Z.valid=!1,I)))return Z.valid;for(const ne in A){const de=A[ne];if(de){const{_f:we,...Ee}=de;if(we){const Xe=d.array.has(we.name),wt=de._f&&L4(de._f),Xt=S.validatingFields||S.isValidating||_.validatingFields||_.isValidating;wt&&Xt&&D([we.name],!0);const zt=await Cx(de,d.disabled,l,T,n.shouldUseNativeValidation&&!I,Xe);if(wt&&Xt&&D([we.name]),zt[we.name]&&(Z.valid=!1,I)||(!I&&(Se(zt,we.name)?Xe?bx(r.errors,zt,we.name):ct(r.errors,we.name,zt[we.name]):Nt(r.errors,we.name)),e.shouldUseNativeValidation&&zt[we.name]))break}!rn(Ee)&&await K({context:Z,onlyCheckValid:I,fields:Ee,name:ne,eventType:ce})}}return Z.valid},re=()=>{for(const A of d.unMount){const I=Se(i,A);I&&(I._f.refs?I._f.refs.every(U=>!Wh(U)):!Wh(I._f.ref))&&Qt(A)}d.unMount=new Set},W=(A,I)=>(A&&I&&ct(l,A,I),!Or(u.mount?l:o,o)),te=(A,I,U)=>O4(A,d,{...u.mount?l:gt(I)?o:on(A)?{[A]:I}:I},U,I),z=A=>J_(Se(u.mount?l:o,A,n.shouldUnregister?Se(o,A,[]):[])),N=(A,I,U={},ce=!1,Z=!1)=>{const ne=Se(i,A);let de=I;if(ne){const we=ne._f;we&&(!we.disabled&&ct(l,A,iC(I,we)),de=_u(we.ref)&&an(I)?"":I,tC(we.ref)?[...we.ref.options].forEach(Ee=>Ee.selected=de.includes(Ee.value)):we.refs?El(we.ref)?we.refs.forEach(Ee=>{(!Ee.defaultChecked||!Ee.disabled)&&(Array.isArray(de)?Ee.checked=!!de.find(Xe=>Xe===Ee.value):Ee.checked=de===Ee.value||!!de)}):we.refs.forEach(Ee=>Ee.checked=Ee.value===de):tg(we.ref)?we.ref.value="":(we.ref.value=de,!we.ref.type&&!Z&&E.state.next({name:A,values:ce?l:Mt(l)})))}(U.shouldDirty||U.shouldTouch)&&ue(A,de,U.shouldTouch,U.shouldDirty,!Z),U.shouldValidate&&xe(A,{delayError:U.delayError})},B=(A,I,U,ce=!1,Z=!1)=>{for(const ne in I){if(!I.hasOwnProperty(ne))return;const de=I[ne],we=A+"."+ne,Ee=Se(i,we);(d.array.has(A)||Rt(de)||Ee&&!Ee._f)&&!za(de)?B(we,de,U,ce,Z):N(we,de,U,ce,Z)}},J=(A,I,U,ce,Z=!1)=>{const ne=Se(i,A),de=d.array.has(A),we=ce?I:Mt(I),Ee=Se(l,A),Xe=Or(Ee,we);if(Xe||ct(l,A,we),de)E.array.next({name:A,values:ce?l:Mt(l)}),(S.isDirty||S.dirtyFields||_.isDirty||_.dirtyFields)&&U.shouldDirty&&(P(),Z||E.state.next({name:A,dirtyFields:r.dirtyFields,isDirty:W(A,we)}));else{const wt=Array.isArray(we)&&!we.length||rn(we);!ne||ne._f||an(we)||wt?N(A,we,U,ce,Z):B(A,we,U,ce,Z)}if(!Xe&&!Z){const wt=Jh(A,d),Xt=ce?l:Mt(l);E.state.next({...wt&&r,name:u.mount||wt?A:void 0,values:Xt})}},Y=(A,I,U={})=>J(A,I,U,!1),le=(A,I={})=>{const U=Jn(A)?A(l):A;if(!Or(l,U)){l={...l,...U};const ce=W_(U);for(const Z of d.mount)Z in ce&&J(Z,ce[Z],I,!0,!0);E.state.next({...r,name:void 0,type:void 0,...y?{values:l}:{}}),I.shouldValidate&&M()}},ae=async A=>{u.mount=!0;const I=A.target;let U=I.name,ce=!0;const Z=Se(i,U),ne=de=>{ce=Number.isNaN(de)||za(de)&&isNaN(de.getTime())||Or(de,Se(l,U,de))};if(Z){let de,we;const Ee=I.type?Rx(Z._f):S4(A),Xe=A.type===Rs.BLUR||A.type===Rs.FOCUS_OUT,wt=!$4(Z._f)&&!e.validate&&!n.resolver&&!Se(r.errors,U)&&!Z._f.deps,Xt=wt||F4(Xe,Se(r.touchedFields,U),r.isSubmitted,b,v),zt=Jh(U,d,Xe);if(ct(l,U,Ee),Xe){if(!I||!I.readOnly){Z._f.onBlur&&Z._f.onBlur(A);const yt=p[U];yt&&yt(0)}}else Z._f.onChange&&Z._f.onChange(A);const Ne=ue(U,Ee,Xe),ht=!rn(Ne)||zt;if(!Xe&&E.state.next({name:U,type:A.type,...y?{values:Mt(l)}:{}}),Xt)return(!wt||!r.isValid)&&(S.isValid||_.isValid)&&(n.mode==="onBlur"?Xe&&M():Xe||M()),ht&&E.state.next({name:U,...zt?{}:Ne});if(!n.resolver&&e.validate&&await L({name:U,eventType:A.type}),!Xe&&zt&&E.state.next({...r}),n.resolver){const{errors:yt}=await pe([U]);if(D([U]),ne(Ee),!ce){!rn(Ne)&&E.state.next(Ne);return}const qt=Tx(r.errors,i,U),or=Tx(yt,i,qt.name||U);de=or.error,U=or.name,we=rn(yt)}else D([U],!0),de=(await Cx(Z,d.disabled,l,T,n.shouldUseNativeValidation))[U],D([U]),ne(Ee),ce&&(de?we=!1:(S.isValid||_.isValid)&&(we=await K({fields:i,onlyCheckValid:!0,name:U,eventType:A.type})));ce&&(Z._f.deps&&(!Array.isArray(Z._f.deps)||Z._f.deps.length>0)&&xe(Z._f.deps),X(U,we,de,Ne))}},ye=(A,I)=>{if(Se(r.errors,I)&&A.focus)return A.focus(),1},xe=async(A,I={})=>{let U,ce;const Z=cu(A);if(n.resolver){const ne=await ge(gt(A)?A:Z);U=rn(ne),ce=A?!Z.some(de=>Se(ne,de)):U}else A?(ce=(await Promise.all(Z.map(async ne=>{const de=Se(i,ne);return await K({fields:de&&de._f?{[ne]:de}:de,eventType:Rs.TRIGGER})}))).every(Boolean),!(!ce&&!r.isValid)&&M()):ce=U=await K({fields:i,name:A,eventType:Rs.TRIGGER});if(I.delayError&&n.delayError&&on(A)){const ne=Se(r.errors,A);ne?(Nt(r.errors,A),p[A]=O(A,()=>V(A,ne)),p[A](n.delayError)):(clearTimeout(m[A]),delete p[A])}return E.state.next({...!on(A)||(S.isValid||_.isValid)&&U!==r.isValid?{}:{name:A},...n.resolver||!A?{isValid:U}:{},errors:r.errors}),I.shouldFocus&&!ce&&el(i,ye,A?Z:d.mount),ce},Oe=(A,I)=>{let U={...u.mount?l:o};return I&&(U=eC(I.dirtyFields?r.dirtyFields:r.touchedFields,U)),gt(A)?U:on(A)?Se(U,A):A.map(ce=>Se(U,ce))},Ie=(A,I)=>({invalid:!!Se((I||r).errors,A),isDirty:!!Se((I||r).dirtyFields,A),error:Se((I||r).errors,A),isValidating:!!Se(r.validatingFields,A),isTouched:!!Se((I||r).touchedFields,A)}),Ve=A=>{const I=A?cu(A):void 0;I?.forEach(U=>Nt(r.errors,U)),I?I.forEach(U=>{E.state.next({name:U,errors:r.errors})}):E.state.next({errors:{}})},it=(A,I,U)=>{const ce=(Se(i,A,{_f:{}})._f||{}).ref,Z=Se(r.errors,A)||{},{ref:ne,message:de,type:we,...Ee}=Z;ct(r.errors,A,{...Ee,...I,ref:ce}),E.state.next({name:A,errors:r.errors,isValid:!1}),U&&U.shouldFocus&&ce&&ce.focus&&ce.focus()},Qe=(A,I)=>{if(Jn(A)){y++;const{unsubscribe:U}=E.state.subscribe({next:Z=>"values"in Z&&A(Z.values||te(void 0,I),Z)});let ce=!1;return{unsubscribe:()=>{ce||(ce=!0,y--,U())}}}return te(A,I,!0)},fn=A=>{var I;const U=!!(!((I=A.formState)===null||I===void 0)&&I.values);U&&y++;const{unsubscribe:ce}=E.state.subscribe({next:ne=>{if(P4(A.name,ne.name,A.exact)&&I4(ne,A.formState||S,ir,A.reRenderRoot)){const de={...l};A.callback({values:de,...r,...ne,defaultValues:o})}}});if(!U)return ce;let Z=!1;return()=>{Z||(Z=!0,y--,ce())}},hn=A=>(u.mount=!0,_={..._,...A.formState},fn({...A,formState:{...x,...A.formState}})),Qt=(A,I={})=>{for(const U of A?cu(A):d.mount)d.mount.delete(U),d.array.delete(U),I.keepValue||(Nt(i,U),Nt(l,U)),!I.keepError&&Nt(r.errors,U),!I.keepDirty&&Nt(r.dirtyFields,U),!I.keepTouched&&Nt(r.touchedFields,U),!I.keepIsValidating&&Nt(r.validatingFields,U),!n.shouldUnregister&&!I.keepDefaultValue&&Nt(o,U);E.state.next({values:Mt(l)}),E.state.next({...r,...I.keepDirty?{isDirty:W()}:{}}),!I.keepIsValid&&M()},br=({disabled:A,name:I})=>{if(Tr(A)&&u.mount||A||d.disabled.has(I)){const Z=d.disabled.has(I)!==!!A;A?d.disabled.add(I):d.disabled.delete(I),Z&&u.mount&&!u.action&&M()}},jt=(A,I={})=>{let U=Se(i,A);const ce=Tr(I.disabled)||Tr(n.disabled),Z=!d.registerName.has(A)&&U&&U._f&&!U._f.mount;return ct(i,A,{...U||{},_f:{...U&&U._f?U._f:{ref:{name:A}},name:A,mount:!0,...I}}),d.mount.add(A),U&&!Z?br({disabled:Tr(I.disabled)?I.disabled:n.disabled,name:A}):he(A,!0,I.value),{...ce?{disabled:I.disabled||n.disabled}:{},...n.progressive?{required:!!I.required,min:Bo(I.min),max:Bo(I.max),minLength:Bo(I.minLength),maxLength:Bo(I.maxLength),pattern:Bo(I.pattern)}:{},name:A,onChange:ae,onBlur:ae,ref:ne=>{if(ne){d.registerName.add(A),jt(A,I),d.registerName.delete(A),U=Se(i,A);const de=gt(ne.value)&&ne.querySelectorAll&&ne.querySelectorAll("input,select,textarea")[0]||ne,we=D4(de),Ee=U._f.refs||[];if(we?Ee.find(Xe=>Xe===de):de===U._f.ref)return;ct(i,A,{_f:{...U._f,...we?{refs:[...Ee.filter(Wh),de,...Array.isArray(Se(o,A))?[{}]:[]],ref:{type:de.type,name:A}}:{ref:de}}}),he(A,!1,void 0,de)}else U=Se(i,A,{}),U._f&&(U._f.mount=!1),(n.shouldUnregister||I.shouldUnregister)&&!(_4(d.array,A)&&u.action)&&d.unMount.add(A)}}},rr=()=>n.shouldFocusError&&!n.shouldUseNativeValidation&&el(i,ye,d.mount),xr=A=>{Tr(A)&&(E.state.next({disabled:A}),el(i,(I,U)=>{const ce=Se(i,U);ce&&(I.disabled=ce._f.disabled||A,Array.isArray(ce._f.refs)&&ce._f.refs.forEach(Z=>{Z.disabled=ce._f.disabled||A}))},0,!1))},Tt=(A,I)=>async U=>{let ce;U&&(U.preventDefault&&U.preventDefault(),U.persist&&U.persist());let Z=Mt(l);if(E.state.next({isSubmitting:!0}),n.resolver){const{errors:ne,values:de}=await pe();D(),r.errors=ne,Z=Mt(de)}else await K({fields:i,eventType:Rs.SUBMIT});if(d.disabled.size)for(const ne of d.disabled)Nt(Z,ne);if(Nt(r.errors,Y_),rn(r.errors)){E.state.next({errors:{}});try{await A(Z,U)}catch(ne){ce=ne}}else I&&await I({...r.errors},U),rr(),setTimeout(rr);if(E.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:rn(r.errors)&&!ce,submitCount:r.submitCount+1,errors:r.errors}),ce)throw ce},Vn=(A,I={})=>{Se(i,A)&&(gt(I.defaultValue)?Y(A,Mt(Se(o,A))):(Y(A,I.defaultValue),ct(o,A,Mt(I.defaultValue))),I.keepTouched||Nt(r.touchedFields,A),I.keepDirty||(Nt(r.dirtyFields,A),r.isDirty=I.defaultValue?W(A,Mt(Se(o,A))):W()),I.keepError||(Nt(r.errors,A),S.isValid&&M()),E.state.next({...r}))},Dt=(A,I={})=>{const U=A?Mt(A):o,ce=Mt(U),Z=rn(A),ne=ce,de=i;if(I.keepDefaultValues||(o=U),!I.keepValues){if(I.keepDirtyValues){const we=new Set([...d.mount,...Object.keys(bi(o,l,void 0,de))]);for(const Ee of Array.from(we)){const Xe=Se(r.dirtyFields,Ee),wt=Se(l,Ee),Xt=Se(ne,Ee);Xe&&!gt(wt)?ct(ne,Ee,wt):!Xe&&!gt(Xt)&&Y(Ee,Xt)}}else{if(td&>(A))for(const we of d.mount){const Ee=Se(i,we);if(Ee&&Ee._f){const Xe=Array.isArray(Ee._f.refs)?Ee._f.refs[0]:Ee._f.ref;if(_u(Xe)){const wt=Xe.closest("form");if(wt){wt.reset();break}}}}if(I.keepFieldsRef)for(const we of d.mount)Y(we,Se(ne,we));else i={}}if(n.shouldUnregister){if(l=I.keepDefaultValues?Mt(o):{},I.keepFieldsRef)for(const we of d.mount)ct(l,we,Se(ne,we))}else l=Mt(ne);E.array.next({values:{...ne}}),E.state.next({name:void 0,type:void 0,values:{...ne}})}d={mount:I.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=!S.isValid||!!I.keepIsValid||!!I.keepDirtyValues||!n.shouldUnregister&&!rn(ne),u.watch=!!n.shouldUnregister,u.keepIsValid=!!I.keepIsValid,u.action=!1,I.keepErrors||(r.errors={}),E.state.next({submitCount:I.keepSubmitCount?r.submitCount:0,isDirty:Z?!1:I.keepDirty?r.isDirty:I.keepValues?W():!!(I.keepDefaultValues&&!Or(A,o)),isSubmitted:I.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:Z?{}:I.keepDirtyValues?I.keepDefaultValues&&l?bi(o,l,void 0,de):r.dirtyFields:I.keepDefaultValues&&A?bi(o,A,void 0,de):I.keepDirty?r.dirtyFields:{},touchedFields:I.keepTouched?r.touchedFields:{},errors:I.keepErrors?r.errors:{},isSubmitSuccessful:I.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},kr=(A,I)=>Dt(Jn(A)?A(l):A,{...n.resetOptions,...I}),ar=(A,I={})=>{const U=Se(i,A),ce=U&&U._f;if(ce){const Z=ce.refs?ce.refs[0]:ce.ref;Z.focus&&setTimeout(()=>{Z.focus(),I.shouldSelect&&Jn(Z.select)&&Z.select()})}},ir=A=>{const{name:I,type:U,values:ce,...Z}=A;r={...r,...Z}},mn={control:{register:jt,unregister:Qt,getFieldState:Ie,handleSubmit:Tt,setError:it,_subscribe:fn,_runSchema:pe,_updateIsValidating:D,_focusError:rr,_getWatch:te,_getDirty:W,_setValid:M,_setFieldArray:F,_setDisabledField:br,_setErrors:ve,_getFieldArray:z,_reset:Dt,_resetDefaultValues:()=>Jn(n.defaultValues)&&n.defaultValues().then(A=>{kr(A,n.resetOptions),E.state.next({isLoading:!1})}),_removeUnmounted:re,_disableForm:xr,_subjects:E,_proxyFormState:S,get _fields(){return i},get _formValues(){return l},get _state(){return u},set _state(A){u=A},get _defaultValues(){return o},get _names(){return d},set _names(A){d=A},get _formState(){return r},get _options(){return n},set _options(A){n={...n,...A},v=eu(n.mode),b=eu(n.reValidateMode)}},subscribe:hn,trigger:xe,register:jt,handleSubmit:Tt,watch:Qe,setValue:Y,setValues:le,getValues:Oe,reset:kr,resetField:Vn,resetDefaultValues:(A,I={})=>{if(o=Mt(A),!I.keepDirty){const U=bi(o,l,void 0,i);r.dirtyFields=U,r.isDirty=!rn(U)}I.keepIsValid||M(),E.state.next({...r,defaultValues:o})},clearErrors:Ve,unregister:Qt,setError:it,setFocus:ar,getFieldState:Ie};return{...mn,formControl:mn}}function ag(e={}){const n=me.useRef(void 0),r=me.useRef(void 0),i=me.useRef(e.formControl),[o,l]=me.useState(()=>({...Mt(sC),isLoading:Jn(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Jn(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:o},e.defaultValues&&!Jn(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:d,...p}=H4(e);n.current={...p,formState:o}}const u=n.current.control;return u._options=e,T4(()=>{const d=u._subscribe({formState:u._proxyFormState,callback:()=>l({...u._formState,defaultValues:u._defaultValues}),reRenderRoot:!0});return l(p=>({...p,isReady:!0})),u._formState.isReady=!0,d},[u]),me.useEffect(()=>u._disableForm(e.disabled),[u,e.disabled]),me.useEffect(()=>{e.mode&&(u._options.mode=e.mode),e.reValidateMode&&(u._options.reValidateMode=e.reValidateMode)},[u,e.mode,e.reValidateMode]),me.useEffect(()=>{e.errors&&(u._setErrors(e.errors),u._focusError())},[u,e.errors]),me.useEffect(()=>{e.shouldUnregister&&u._subjects.state.next({values:u._getWatch()})},[u,e.shouldUnregister]),me.useEffect(()=>{if(u._proxyFormState.isDirty){const d=u._getDirty();d!==o.isDirty&&u._subjects.state.next({isDirty:d})}},[u,o.isDirty]),me.useEffect(()=>{var d;e.values&&!Or(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(p=>({...p}))):u._resetDefaultValues()},[u,e.values]),me.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=me.useMemo(()=>j4(o,u),[u,o]),n.current}const Ox=(e,n,r)=>{if(e&&"reportValidity"in e){const i=Se(r,n);e.setCustomValidity(i&&i.message||""),e.reportValidity()}},Bm=(e,n)=>{for(const r in n.fields){const i=n.fields[r];i&&i.ref&&"reportValidity"in i.ref?Ox(i.ref,r,e):i&&i.refs&&i.refs.forEach(o=>Ox(o,r,e))}},Ax=(e,n)=>{n.shouldUseNativeValidation&&Bm(e,n);const r={};for(const i in e){const o=Se(n.fields,i),l=Object.assign(e[i]||{},{ref:o&&o.ref});if(B4(n.names||Object.keys(e),i)){const u=Object.assign({},Se(r,i));ct(u,"root",l),ct(r,i,u)}else ct(r,i,l)}return r},B4=(e,n)=>{const r=Mx(n).replace(/[.*+?^${}()|\\]/g,"\\$&");return e.some(i=>Mx(i).match(`^${r}\\.\\d+`))};function Mx(e){return e.replace(/[\[\]]/g,"")}var Nx;function fe(e,n,r){function i(d,p){if(d._zod||Object.defineProperty(d,"_zod",{value:{def:p,constr:u,traits:new Set},enumerable:!1}),d._zod.traits.has(e))return;d._zod.traits.add(e),n(d,p);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 $s extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class oC extends Error{constructor(n){super(`Encountered unidirectional transform during encode: ${n}`),this.name="ZodEncodeError"}}(Nx=globalThis).__zod_globalConfig??(Nx.__zod_globalConfig={});const ig=globalThis.__zod_globalConfig;function ji(e){return ig}function lC(e){const n=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,o])=>n.indexOf(+i)===-1).map(([i,o])=>o)}function qm(e,n){return typeof n=="bigint"?n.toString():n}function sg(e){return{get value(){{const n=e();return Object.defineProperty(this,"value",{value:n}),n}}}}function og(e){return e==null}function lg(e){const n=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(n,r)}const Dx=Symbol("evaluating");function dt(e,n,r){let i;Object.defineProperty(e,n,{get(){if(i!==Dx)return i===void 0&&(i=Dx,i=r()),i},set(o){Object.defineProperty(e,n,{value:o})},configurable:!0})}function Li(e,n,r){Object.defineProperty(e,n,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Xa(...e){const n={};for(const r of e){const i=Object.getOwnPropertyDescriptors(r);Object.assign(n,i)}return Object.defineProperties({},n)}function zx(e){return JSON.stringify(e)}function q4(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const cC="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Eu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const G4=sg(()=>{if(ig.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function fl(e){if(Eu(e)===!1)return!1;const n=e.constructor;if(n===void 0||typeof n!="function")return!0;const r=n.prototype;return!(Eu(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function uC(e){return fl(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Z4=new Set(["string","number","symbol"]);function rd(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ja(e,n,r){const i=new e._zod.constr(n??e._zod.def);return(!n||r?.parent)&&(i._zod.parent=e),i}function Le(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 K4(e){return Object.keys(e).filter(n=>e[n]._zod.optin==="optional"&&e[n]._zod.optout==="optional")}function Y4(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=Xa(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 Li(this,"shape",u),u},checks:[]});return Ja(e,l)}function Q4(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=Xa(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 Li(this,"shape",u),u},checks:[]});return Ja(e,l)}function X4(e,n){if(!fl(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 o=Xa(e._zod.def,{get shape(){const l={...e._zod.def.shape,...n};return Li(this,"shape",l),l}});return Ja(e,o)}function J4(e,n){if(!fl(n))throw new Error("Invalid input to safeExtend: expected a plain object");const r=Xa(e._zod.def,{get shape(){const i={...e._zod.def.shape,...n};return Li(this,"shape",i),i}});return Ja(e,r)}function W4(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=Xa(e._zod.def,{get shape(){const i={...e._zod.def.shape,...n._zod.def.shape};return Li(this,"shape",i),i},get catchall(){return n._zod.def.catchall},checks:n._zod.def.checks??[]});return Ja(e,r)}function e5(e,n,r){const o=n._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const u=Xa(n._zod.def,{get shape(){const d=n._zod.def.shape,p={...d};if(r)for(const m in r){if(!(m in d))throw new Error(`Unrecognized key: "${m}"`);r[m]&&(p[m]=e?new e({type:"optional",innerType:d[m]}):d[m])}else for(const m in d)p[m]=e?new e({type:"optional",innerType:d[m]}):d[m];return Li(this,"shape",p),p},checks:[]});return Ja(n,u)}function t5(e,n,r){const i=Xa(n._zod.def,{get shape(){const o=n._zod.def.shape,l={...o};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:o[u]}))}else for(const u in o)l[u]=new e({type:"nonoptional",innerType:o[u]});return Li(this,"shape",l),l}});return Ja(n,i)}function Ns(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 tu(e){return typeof e=="string"?e:e?.message}function Ti(e,n,r){const i=e.message?e.message:tu(e.inst?._zod.def?.error?.(e))??tu(n?.error?.(e))??tu(r.customError?.(e))??tu(r.localeError?.(e))??"Invalid input",{inst:o,continue:l,input:u,...d}=e;return d.path??(d.path=[]),d.message=i,n?.reportInput&&(d.input=u),d}function cg(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function hl(...e){const[n,r,i]=e;return typeof n=="string"?{message:n,code:"custom",input:r,inst:i}:{...n}}const fC=(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,qm,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ug=fe("$ZodError",fC),ad=fe("$ZodError",fC,{Parent:Error});function r5(e,n=r=>r.message){const r={},i=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(n(o))):i.push(n(o));return{formErrors:i,fieldErrors:r}}function a5(e,n=r=>r.message){const r={_errors:[]},i=(o,l=[])=>{for(const u of o.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 p=r,m=0;for(;m(n,r,i,o)=>{const l=i?{...i,async:!1}:{async:!1},u=n._zod.run({value:r,issues:[]},l);if(u instanceof Promise)throw new $s;if(u.issues.length){const d=new(o?.Err??e)(u.issues.map(p=>Ti(p,l,ji())));throw cC(d,o?.callee),d}return u.value},i5=id(ad),sd=e=>async(n,r,i,o)=>{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(o?.Err??e)(u.issues.map(p=>Ti(p,l,ji())));throw cC(d,o?.callee),d}return u.value},s5=sd(ad),od=e=>(n,r,i)=>{const o=i?{...i,async:!1}:{async:!1},l=n._zod.run({value:r,issues:[]},o);if(l instanceof Promise)throw new $s;return l.issues.length?{success:!1,error:new(e??ug)(l.issues.map(u=>Ti(u,o,ji())))}:{success:!0,data:l.value}},o5=od(ad),ld=e=>async(n,r,i)=>{const o=i?{...i,async:!0}:{async:!0};let l=n._zod.run({value:r,issues:[]},o);return l instanceof Promise&&(l=await l),l.issues.length?{success:!1,error:new e(l.issues.map(u=>Ti(u,o,ji())))}:{success:!0,data:l.value}},l5=ld(ad),c5=e=>(n,r,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return id(e)(n,r,o)},u5=e=>(n,r,i)=>id(e)(n,r,i),d5=e=>async(n,r,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return sd(e)(n,r,o)},f5=e=>async(n,r,i)=>sd(e)(n,r,i),h5=e=>(n,r,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return od(e)(n,r,o)},m5=e=>(n,r,i)=>od(e)(n,r,i),p5=e=>async(n,r,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return ld(e)(n,r,o)},g5=e=>async(n,r,i)=>ld(e)(n,r,i),v5=/^[cC][0-9a-z]{6,}$/,y5=/^[0-9a-z]+$/,b5=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,x5=/^[0-9a-vA-V]{20}$/,w5=/^[A-Za-z0-9]{27}$/,S5=/^[a-zA-Z0-9_-]{21}$/,_5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,C5=/^([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})$/,kx=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)$/,E5=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,R5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function j5(){return new RegExp(R5,"u")}const T5=/^(?:(?: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])$/,O5=/^(([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}|:))$/,A5=/^((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])$/,M5=/^(([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])$/,N5=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,hC=/^[A-Za-z0-9_-]*$/,D5=/^https?$/,z5=/^\+[1-9]\d{6,14}$/,mC="(?:(?:\\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])))",k5=new RegExp(`^${mC}$`);function pC(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 L5(e){return new RegExp(`^${pC(e)}$`)}function $5(e){const n=pC({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(`^${mC}T(?:${i})$`)}const I5=e=>{const n=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${n}$`)},P5=/^(?:true|false)$/i,F5=/^[^A-Z]*$/,V5=/^[^a-z]*$/,zr=fe("$ZodCheck",(e,n)=>{var r;e._zod??(e._zod={}),e._zod.def=n,(r=e._zod).onattach??(r.onattach=[])}),U5=fe("$ZodCheckMaxLength",(e,n)=>{var r;zr.init(e,n),(r=e._zod.def).when??(r.when=i=>{const o=i.value;return!og(o)&&o.length!==void 0}),e._zod.onattach.push(i=>{const o=i._zod.bag.maximum??Number.POSITIVE_INFINITY;n.maximum{const o=i.value;if(o.length<=n.maximum)return;const u=cg(o);i.issues.push({origin:u,code:"too_big",maximum:n.maximum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),H5=fe("$ZodCheckMinLength",(e,n)=>{var r;zr.init(e,n),(r=e._zod.def).when??(r.when=i=>{const o=i.value;return!og(o)&&o.length!==void 0}),e._zod.onattach.push(i=>{const o=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;n.minimum>o&&(i._zod.bag.minimum=n.minimum)}),e._zod.check=i=>{const o=i.value;if(o.length>=n.minimum)return;const u=cg(o);i.issues.push({origin:u,code:"too_small",minimum:n.minimum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),B5=fe("$ZodCheckLengthEquals",(e,n)=>{var r;zr.init(e,n),(r=e._zod.def).when??(r.when=i=>{const o=i.value;return!og(o)&&o.length!==void 0}),e._zod.onattach.push(i=>{const o=i._zod.bag;o.minimum=n.length,o.maximum=n.length,o.length=n.length}),e._zod.check=i=>{const o=i.value,l=o.length;if(l===n.length)return;const u=cg(o),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})}}),cd=fe("$ZodCheckStringFormat",(e,n)=>{var r,i;zr.init(e,n),e._zod.onattach.push(o=>{const l=o._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=o=>{n.pattern.lastIndex=0,!n.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:n.format,input:o.value,...n.pattern?{pattern:n.pattern.toString()}:{},inst:e,continue:!n.abort})}):(i=e._zod).check??(i.check=()=>{})}),q5=fe("$ZodCheckRegex",(e,n)=>{cd.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})}}),G5=fe("$ZodCheckLowerCase",(e,n)=>{n.pattern??(n.pattern=F5),cd.init(e,n)}),Z5=fe("$ZodCheckUpperCase",(e,n)=>{n.pattern??(n.pattern=V5),cd.init(e,n)}),K5=fe("$ZodCheckIncludes",(e,n)=>{zr.init(e,n);const r=rd(n.includes),i=new RegExp(typeof n.position=="number"?`^.{${n.position}}${r}`:r);n.pattern=i,e._zod.onattach.push(o=>{const l=o._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(i)}),e._zod.check=o=>{o.value.includes(n.includes,n.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:n.includes,input:o.value,inst:e,continue:!n.abort})}}),Y5=fe("$ZodCheckStartsWith",(e,n)=>{zr.init(e,n);const r=new RegExp(`^${rd(n.prefix)}.*`);n.pattern??(n.pattern=r),e._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.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})}}),Q5=fe("$ZodCheckEndsWith",(e,n)=>{zr.init(e,n);const r=new RegExp(`.*${rd(n.suffix)}$`);n.pattern??(n.pattern=r),e._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.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})}}),X5=fe("$ZodCheckOverwrite",(e,n)=>{zr.init(e,n),e._zod.check=r=>{r.value=n.tx(r.value)}});class J5{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),o=Math.min(...i.map(u=>u.length-u.trimStart().length)),l=i.map(u=>u.slice(o)).map(u=>" ".repeat(this.indent*2)+u);for(const u of l)this.content.push(u)}compile(){const n=Function,r=this?.args,o=[...(this?.content??[""]).map(l=>` ${l}`)];return new n(...r,o.join(` +`))}}const W5={major:4,minor:4,patch:3},Ft=fe("$ZodType",(e,n)=>{var r;e??(e={}),e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=W5;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const o of i)for(const l of o._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 o=(u,d,p)=>{let m=Ns(u),y;for(const v of d){if(v._zod.def.when){if(n5(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&&p?.async===!1)throw new $s;if(y||x instanceof Promise)y=(y??Promise.resolve()).then(async()=>{await x,u.issues.length!==b&&(m||(m=Ns(u,b)))});else{if(u.issues.length===b)continue;m||(m=Ns(u,b))}}return y?y.then(()=>u):u},l=(u,d,p)=>{if(Ns(u))return u.aborted=!0,u;const m=o(d,i,p);if(m instanceof Promise){if(p.async===!1)throw new $s;return m.then(y=>e._zod.parse(y,p))}return e._zod.parse(m,p)};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 p=e._zod.parse(u,d);if(p instanceof Promise){if(d.async===!1)throw new $s;return p.then(m=>o(m,i,d))}return o(p,i,d)}}dt(e,"~standard",()=>({validate:o=>{try{const l=o5(e,o);return l.success?{value:l.data}:{issues:l.error?.issues}}catch{return l5(e,o).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},vendor:"zod",version:1}))}),dg=fe("$ZodString",(e,n)=>{Ft.init(e,n),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??I5(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}}),xt=fe("$ZodStringFormat",(e,n)=>{cd.init(e,n),dg.init(e,n)}),e6=fe("$ZodGUID",(e,n)=>{n.pattern??(n.pattern=C5),xt.init(e,n)}),t6=fe("$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=kx(i))}else n.pattern??(n.pattern=kx());xt.init(e,n)}),n6=fe("$ZodEmail",(e,n)=>{n.pattern??(n.pattern=E5),xt.init(e,n)}),r6=fe("$ZodURL",(e,n)=>{xt.init(e,n),e._zod.check=r=>{try{const i=r.value.trim();if(!n.normalize&&n.protocol?.source===D5.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 o=new URL(i);n.hostname&&(n.hostname.lastIndex=0,n.hostname.test(o.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(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.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=o.href:r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!n.abort})}}}),a6=fe("$ZodEmoji",(e,n)=>{n.pattern??(n.pattern=j5()),xt.init(e,n)}),i6=fe("$ZodNanoID",(e,n)=>{n.pattern??(n.pattern=S5),xt.init(e,n)}),s6=fe("$ZodCUID",(e,n)=>{n.pattern??(n.pattern=v5),xt.init(e,n)}),o6=fe("$ZodCUID2",(e,n)=>{n.pattern??(n.pattern=y5),xt.init(e,n)}),l6=fe("$ZodULID",(e,n)=>{n.pattern??(n.pattern=b5),xt.init(e,n)}),c6=fe("$ZodXID",(e,n)=>{n.pattern??(n.pattern=x5),xt.init(e,n)}),u6=fe("$ZodKSUID",(e,n)=>{n.pattern??(n.pattern=w5),xt.init(e,n)}),d6=fe("$ZodISODateTime",(e,n)=>{n.pattern??(n.pattern=$5(n)),xt.init(e,n)}),f6=fe("$ZodISODate",(e,n)=>{n.pattern??(n.pattern=k5),xt.init(e,n)}),h6=fe("$ZodISOTime",(e,n)=>{n.pattern??(n.pattern=L5(n)),xt.init(e,n)}),m6=fe("$ZodISODuration",(e,n)=>{n.pattern??(n.pattern=_5),xt.init(e,n)}),p6=fe("$ZodIPv4",(e,n)=>{n.pattern??(n.pattern=T5),xt.init(e,n),e._zod.bag.format="ipv4"}),g6=fe("$ZodIPv6",(e,n)=>{n.pattern??(n.pattern=O5),xt.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})}}}),v6=fe("$ZodCIDRv4",(e,n)=>{n.pattern??(n.pattern=A5),xt.init(e,n)}),y6=fe("$ZodCIDRv6",(e,n)=>{n.pattern??(n.pattern=M5),xt.init(e,n),e._zod.check=r=>{const i=r.value.split("/");try{if(i.length!==2)throw new Error;const[o,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://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!n.abort})}}});function gC(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const b6=fe("$ZodBase64",(e,n)=>{n.pattern??(n.pattern=N5),xt.init(e,n),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{gC(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!n.abort})}});function x6(e){if(!hC.test(e))return!1;const n=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=n.padEnd(Math.ceil(n.length/4)*4,"=");return gC(r)}const w6=fe("$ZodBase64URL",(e,n)=>{n.pattern??(n.pattern=hC),xt.init(e,n),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{x6(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!n.abort})}}),S6=fe("$ZodE164",(e,n)=>{n.pattern??(n.pattern=z5),xt.init(e,n)});function _6(e,n=null){try{const r=e.split(".");if(r.length!==3)return!1;const[i]=r;if(!i)return!1;const o=JSON.parse(atob(i));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||n&&(!("alg"in o)||o.alg!==n))}catch{return!1}}const C6=fe("$ZodJWT",(e,n)=>{xt.init(e,n),e._zod.check=r=>{_6(r.value,n.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!n.abort})}}),E6=fe("$ZodBoolean",(e,n)=>{Ft.init(e,n),e._zod.pattern=P5,e._zod.parse=(r,i)=>{if(n.coerce)try{r.value=!!r.value}catch{}const o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),R6=fe("$ZodUnknown",(e,n)=>{Ft.init(e,n),e._zod.parse=r=>r}),j6=fe("$ZodNever",(e,n)=>{Ft.init(e,n),e._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Lx(e,n,r){e.issues.length&&n.issues.push(...dC(r,e.issues)),n.value[r]=e.value}const T6=fe("$ZodArray",(e,n)=>{Ft.init(e,n),e._zod.parse=(r,i)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);const l=[];for(let u=0;uLx(m,r,u))):Lx(p,r,u)}return l.length?Promise.all(l).then(()=>r):r}});function Ru(e,n,r,i,o,l){const u=r in i;if(e.issues.length){if(o&&l&&!u)return;n.issues.push(...dC(r,e.issues))}if(!u&&!o){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 vC(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=K4(e.shape);return{...e,keys:n,keySet:new Set(n),numKeys:n.length,optionalKeys:new Set(r)}}function yC(e,n,r,i,o,l){const u=[],d=o.keySet,p=o.catchall._zod,m=p.def.type,y=p.optin==="optional",v=p.optout==="optional";for(const b in n){if(b==="__proto__"||d.has(b))continue;if(m==="never"){u.push(b);continue}const x=p.run({value:n[b],issues:[]},i);x instanceof Promise?e.push(x.then(S=>Ru(S,r,b,n,y,v))):Ru(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 O6=fe("$ZodObject",(e,n)=>{if(Ft.init(e,n),!Object.getOwnPropertyDescriptor(n,"shape")?.get){const d=n.shape;Object.defineProperty(n,"shape",{get:()=>{const p={...d};return Object.defineProperty(n,"shape",{value:p}),p}})}const i=sg(()=>vC(n));dt(e._zod,"propValues",()=>{const d=n.shape,p={};for(const m in d){const y=d[m]._zod;if(y.values){p[m]??(p[m]=new Set);for(const v of y.values)p[m].add(v)}}return p});const o=Eu,l=n.catchall;let u;e._zod.parse=(d,p)=>{u??(u=i.value);const m=d.value;if(!o(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],S=x._zod.optin==="optional",_=x._zod.optout==="optional",E=x._zod.run({value:m[b],issues:[]},p);E instanceof Promise?y.push(E.then(R=>Ru(R,d,b,m,S,_))):Ru(E,d,b,m,S,_)}return l?yC(y,m,d,p,i.value,e):y.length?Promise.all(y).then(()=>d):d}}),A6=fe("$ZodObjectJIT",(e,n)=>{O6.init(e,n);const r=e._zod.parse,i=sg(()=>vC(n)),o=b=>{const x=new J5(["shape","payload","ctx"]),S=i.value,_=O=>{const M=zx(O);return`shape[${M}]._zod.run({ value: input[${M}], issues: [] }, ctx)`};x.write("const input = payload.value;");const E=Object.create(null);let R=0;for(const O of S.keys)E[O]=`key_${R++}`;x.write("const newResult = {};");for(const O of S.keys){const M=E[O],D=zx(O),P=b[O],F=P?._zod?.optin==="optional",V=P?._zod?.optout==="optional";x.write(`const ${M} = ${_(O)};`),F&&V?x.write(` + if (${M}.issues.length) { + if (${D} in input) { + payload.issues = payload.issues.concat(${M}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${D}, ...iss.path] : [${D}] + }))); + } + } + + if (${M}.value === undefined) { + if (${D} in input) { + newResult[${D}] = undefined; + } + } else { + newResult[${D}] = ${M}.value; + } + + `):F?x.write(` + if (${M}.issues.length) { + payload.issues = payload.issues.concat(${M}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${D}, ...iss.path] : [${D}] + }))); + } + + if (${M}.value === undefined) { + if (${D} in input) { + newResult[${D}] = undefined; + } + } else { + newResult[${D}] = ${M}.value; + } + + `):x.write(` + const ${M}_present = ${D} in input; + if (${M}.issues.length) { + payload.issues = payload.issues.concat(${M}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${D}, ...iss.path] : [${D}] + }))); + } + if (!${M}_present && !${M}.issues.length) { + payload.issues.push({ + code: "invalid_type", + expected: "nonoptional", + input: undefined, + path: [${D}] + }); + } + + if (${M}_present) { + if (${M}.value === undefined) { + newResult[${D}] = undefined; + } else { + newResult[${D}] = ${M}.value; + } + } + + `)}x.write("payload.value = newResult;"),x.write("return payload;");const T=x.compile();return(O,M)=>T(b,O,M)};let l;const u=Eu,d=!ig.jitless,m=d&&G4.value,y=n.catchall;let v;e._zod.parse=(b,x)=>{v??(v=i.value);const S=b.value;return u(S)?d&&m&&x?.async===!1&&x.jitless!==!0?(l||(l=o(n.shape)),b=l(b,x),y?yC([],S,b,x,v,e):b):r(b,x):(b.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),b)}});function $x(e,n,r,i){for(const l of e)if(l.issues.length===0)return n.value=l.value,n;const o=e.filter(l=>!Ns(l));return o.length===1?(n.value=o[0].value,o[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:r,errors:e.map(l=>l.issues.map(u=>Ti(u,i,ji())))}),n)}const M6=fe("$ZodUnion",(e,n)=>{Ft.init(e,n),dt(e._zod,"optin",()=>n.options.some(i=>i._zod.optin==="optional")?"optional":void 0),dt(e._zod,"optout",()=>n.options.some(i=>i._zod.optout==="optional")?"optional":void 0),dt(e._zod,"values",()=>{if(n.options.every(i=>i._zod.values))return new Set(n.options.flatMap(i=>Array.from(i._zod.values)))}),dt(e._zod,"pattern",()=>{if(n.options.every(i=>i._zod.pattern)){const i=n.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>lg(o.source)).join("|")})$`)}});const r=n.options.length===1?n.options[0]._zod.run:null;e._zod.parse=(i,o)=>{if(r)return r(i,o);let l=!1;const u=[];for(const d of n.options){const p=d._zod.run({value:i.value,issues:[]},o);if(p instanceof Promise)u.push(p),l=!0;else{if(p.issues.length===0)return p;u.push(p)}}return l?Promise.all(u).then(d=>$x(d,i,e,o)):$x(u,i,e,o)}}),N6=fe("$ZodIntersection",(e,n)=>{Ft.init(e,n),e._zod.parse=(r,i)=>{const o=r.value,l=n.left._zod.run({value:o,issues:[]},i),u=n.right._zod.run({value:o,issues:[]},i);return l instanceof Promise||u instanceof Promise?Promise.all([l,u]).then(([p,m])=>Ix(r,p,m)):Ix(r,l,u)}});function Gm(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(fl(e)&&fl(n)){const r=Object.keys(n),i=Object.keys(e).filter(l=>r.indexOf(l)!==-1),o={...e,...n};for(const l of i){const u=Gm(e[l],n[l]);if(!u.valid)return{valid:!1,mergeErrorPath:[l,...u.mergeErrorPath]};o[l]=u.data}return{valid:!0,data:o}}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&&o&&e.issues.push({...o,keys:l}),Ns(e))return e;const u=Gm(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 D6=fe("$ZodEnum",(e,n)=>{Ft.init(e,n);const r=lC(n.entries),i=new Set(r);e._zod.values=i,e._zod.pattern=new RegExp(`^(${r.filter(o=>Z4.has(typeof o)).map(o=>typeof o=="string"?rd(o):o.toString()).join("|")})$`),e._zod.parse=(o,l)=>{const u=o.value;return i.has(u)||o.issues.push({code:"invalid_value",values:r,input:u,inst:e}),o}}),z6=fe("$ZodTransform",(e,n)=>{Ft.init(e,n),e._zod.optin="optional",e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new oC(e.constructor.name);const o=n.transform(r.value,r);if(i.async)return(o instanceof Promise?o:Promise.resolve(o)).then(u=>(r.value=u,r.fallback=!0,r));if(o instanceof Promise)throw new $s;return r.value=o,r.fallback=!0,r}});function Px(e,n){return n===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const bC=fe("$ZodOptional",(e,n)=>{Ft.init(e,n),e._zod.optin="optional",e._zod.optout="optional",dt(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0),dt(e._zod,"pattern",()=>{const r=n.innerType._zod.pattern;return r?new RegExp(`^(${lg(r.source)})?$`):void 0}),e._zod.parse=(r,i)=>{if(n.innerType._zod.optin==="optional"){const o=r.value,l=n.innerType._zod.run(r,i);return l instanceof Promise?l.then(u=>Px(u,o)):Px(l,o)}return r.value===void 0?r:n.innerType._zod.run(r,i)}}),k6=fe("$ZodExactOptional",(e,n)=>{bC.init(e,n),dt(e._zod,"values",()=>n.innerType._zod.values),dt(e._zod,"pattern",()=>n.innerType._zod.pattern),e._zod.parse=(r,i)=>n.innerType._zod.run(r,i)}),L6=fe("$ZodNullable",(e,n)=>{Ft.init(e,n),dt(e._zod,"optin",()=>n.innerType._zod.optin),dt(e._zod,"optout",()=>n.innerType._zod.optout),dt(e._zod,"pattern",()=>{const r=n.innerType._zod.pattern;return r?new RegExp(`^(${lg(r.source)}|null)$`):void 0}),dt(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)}),$6=fe("$ZodDefault",(e,n)=>{Ft.init(e,n),e._zod.optin="optional",dt(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 o=n.innerType._zod.run(r,i);return o instanceof Promise?o.then(l=>Fx(l,n)):Fx(o,n)}});function Fx(e,n){return e.value===void 0&&(e.value=n.defaultValue),e}const I6=fe("$ZodPrefault",(e,n)=>{Ft.init(e,n),e._zod.optin="optional",dt(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))}),P6=fe("$ZodNonOptional",(e,n)=>{Ft.init(e,n),dt(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 o=n.innerType._zod.run(r,i);return o instanceof Promise?o.then(l=>Vx(l,e)):Vx(o,e)}});function Vx(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 F6=fe("$ZodCatch",(e,n)=>{Ft.init(e,n),e._zod.optin="optional",dt(e._zod,"optout",()=>n.innerType._zod.optout),dt(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(r,i)=>{if(i.direction==="backward")return n.innerType._zod.run(r,i);const o=n.innerType._zod.run(r,i);return o instanceof Promise?o.then(l=>(r.value=l.value,l.issues.length&&(r.value=n.catchValue({...r,error:{issues:l.issues.map(u=>Ti(u,i,ji()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=o.value,o.issues.length&&(r.value=n.catchValue({...r,error:{issues:o.issues.map(l=>Ti(l,i,ji()))},input:r.value}),r.issues=[],r.fallback=!0),r)}}),V6=fe("$ZodPipe",(e,n)=>{Ft.init(e,n),dt(e._zod,"values",()=>n.in._zod.values),dt(e._zod,"optin",()=>n.in._zod.optin),dt(e._zod,"optout",()=>n.out._zod.optout),dt(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=>nu(u,n.in,i)):nu(l,n.in,i)}const o=n.in._zod.run(r,i);return o instanceof Promise?o.then(l=>nu(l,n.out,i)):nu(o,n.out,i)}});function nu(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 U6=fe("$ZodReadonly",(e,n)=>{Ft.init(e,n),dt(e._zod,"propValues",()=>n.innerType._zod.propValues),dt(e._zod,"values",()=>n.innerType._zod.values),dt(e._zod,"optin",()=>n.innerType?._zod?.optin),dt(e._zod,"optout",()=>n.innerType?._zod?.optout),e._zod.parse=(r,i)=>{if(i.direction==="backward")return n.innerType._zod.run(r,i);const o=n.innerType._zod.run(r,i);return o instanceof Promise?o.then(Ux):Ux(o)}});function Ux(e){return e.value=Object.freeze(e.value),e}const H6=fe("$ZodCustom",(e,n)=>{zr.init(e,n),Ft.init(e,n),e._zod.parse=(r,i)=>r,e._zod.check=r=>{const i=r.value,o=n.fn(i);if(o instanceof Promise)return o.then(l=>Hx(l,r,i,e));Hx(o,r,i,e)}});function Hx(e,n,r,i){if(!e){const o={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(o.params=i._zod.def.params),n.issues.push(hl(o))}}var Bx;class B6{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 o={...i,...this._map.get(n)};return Object.keys(o).length?o:void 0}return this._map.get(n)}has(n){return this._map.has(n)}}function q6(){return new B6}(Bx=globalThis).__zod_globalRegistry??(Bx.__zod_globalRegistry=q6());const Qo=globalThis.__zod_globalRegistry;function G6(e,n){return new e({type:"string",...Le(n)})}function Z6(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Le(n)})}function qx(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Le(n)})}function K6(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Le(n)})}function Y6(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Le(n)})}function Q6(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Le(n)})}function X6(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Le(n)})}function J6(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Le(n)})}function W6(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Le(n)})}function eL(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Le(n)})}function tL(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Le(n)})}function nL(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Le(n)})}function rL(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Le(n)})}function aL(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Le(n)})}function iL(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Le(n)})}function sL(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Le(n)})}function oL(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Le(n)})}function lL(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Le(n)})}function cL(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Le(n)})}function uL(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Le(n)})}function dL(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Le(n)})}function fL(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Le(n)})}function hL(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Le(n)})}function mL(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Le(n)})}function pL(e,n){return new e({type:"string",format:"date",check:"string_format",...Le(n)})}function gL(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,...Le(n)})}function vL(e,n){return new e({type:"string",format:"duration",check:"string_format",...Le(n)})}function yL(e,n){return new e({type:"boolean",...Le(n)})}function bL(e){return new e({type:"unknown"})}function xL(e,n){return new e({type:"never",...Le(n)})}function xC(e,n){return new U5({check:"max_length",...Le(n),maximum:e})}function ju(e,n){return new H5({check:"min_length",...Le(n),minimum:e})}function wC(e,n){return new B5({check:"length_equals",...Le(n),length:e})}function wL(e,n){return new q5({check:"string_format",format:"regex",...Le(n),pattern:e})}function SL(e){return new G5({check:"string_format",format:"lowercase",...Le(e)})}function _L(e){return new Z5({check:"string_format",format:"uppercase",...Le(e)})}function CL(e,n){return new K5({check:"string_format",format:"includes",...Le(n),includes:e})}function EL(e,n){return new Y5({check:"string_format",format:"starts_with",...Le(n),prefix:e})}function RL(e,n){return new Q5({check:"string_format",format:"ends_with",...Le(n),suffix:e})}function Ks(e){return new X5({check:"overwrite",tx:e})}function jL(e){return Ks(n=>n.normalize(e))}function TL(){return Ks(e=>e.trim())}function OL(){return Ks(e=>e.toLowerCase())}function AL(){return Ks(e=>e.toUpperCase())}function ML(){return Ks(e=>q4(e))}function NL(e,n,r){return new e({type:"array",element:n,...Le(r)})}function DL(e,n,r){return new e({type:"custom",check:"custom",fn:n,...Le(r)})}function zL(e,n){const r=kL(i=>(i.addIssue=o=>{if(typeof o=="string")i.issues.push(hl(o,i.value,r._zod.def));else{const l=o;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(hl(l))}},e(i.value,i)),n);return r}function kL(e,n){const r=new zr({check:"custom",...Le(n)});return r._zod.check=e,r}function SC(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??Qo,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 ln(e,n,r={path:[],schemaPath:[]}){var i;const o=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[o.type];if(!x)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);x(e,n,b,y)}const v=e._zod.parent;v&&(u.ref||(u.ref=v),ln(v,n,y),n.seen.get(v).isParent=!0)}const p=n.metadataRegistry.get(e);return p&&Object.assign(u.schema,p),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 _C(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 p=i.get(d);if(p&&p!==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 o=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??(S=>S);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:p,defId:m}=o(u);d.def={...d.schema},m&&(d.defId=m);const y=d.schema;for(const v in y)delete y[v];y.$ref=p};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 CC(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 p=e.seen.get(d);if(p.ref===null)return;const m=p.def??p.schema,y={...m},v=p.ref;if(p.ref=null,v){i(v);const x=e.seen.get(v),S=x.schema;if(S.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(m.allOf=m.allOf??[],m.allOf.push(S)):Object.assign(m,S),Object.assign(m,y),d._zod.parent===v)for(const E in m)E==="$ref"||E==="allOf"||E in y||delete m[E];if(S.$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 S in m)S==="$ref"||S==="allOf"||S in x.def&&JSON.stringify(m[S])===JSON.stringify(x.def[S])&&delete m[S]}e.override({zodSchema:d,jsonSchema:m,path:p.path??[]})};for(const d of[...e.seen.entries()].reverse())i(d[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$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");o.$id=e.external.uri(d)}Object.assign(o,r.def??r.schema);const l=e.metadataRegistry.get(n)?.id;l!==void 0&&o.id===l&&delete o.id;const u=e.external?.defs??{};for(const d of e.seen.entries()){const p=d[1];p.def&&p.defId&&(p.def.id===p.defId&&delete p.def.id,u[p.defId]=p.def)}e.external||Object.keys(u).length>0&&(e.target==="draft-2020-12"?o.$defs=u:o.definitions=u);try{const d=JSON.parse(JSON.stringify(o));return Object.defineProperty(d,"~standard",{value:{...n["~standard"],jsonSchema:{input:Tu(n,"input",e.processors),output:Tu(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 o in i.shape)if(gn(i.shape[o],r))return!0;return!1}if(i.type==="union"){for(const o of i.options)if(gn(o,r))return!0;return!1}if(i.type==="tuple"){for(const o of i.items)if(gn(o,r))return!0;return!!(i.rest&&gn(i.rest,r))}return!1}const LL=(e,n={})=>r=>{const i=SC({...r,processors:n});return ln(e,i),_C(i,e),CC(i,e)},Tu=(e,n,r={})=>i=>{const{libraryOptions:o,target:l}=i??{},u=SC({...o??{},target:l,io:n,processors:r});return ln(e,u),_C(u,e),CC(u,e)},$L={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},IL=(e,n,r,i)=>{const o=r;o.type="string";const{minimum:l,maximum:u,format:d,patterns:p,contentEncoding:m}=e._zod.bag;if(typeof l=="number"&&(o.minLength=l),typeof u=="number"&&(o.maxLength=u),d&&(o.format=$L[d]??d,o.format===""&&delete o.format,d==="time"&&delete o.format),m&&(o.contentEncoding=m),p&&p.size>0){const y=[...p];y.length===1?o.pattern=y[0].source:y.length>1&&(o.allOf=[...y.map(v=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:v.source}))])}},PL=(e,n,r,i)=>{r.type="boolean"},FL=(e,n,r,i)=>{r.not={}},VL=(e,n,r,i)=>{},UL=(e,n,r,i)=>{const o=e._zod.def,l=lC(o.entries);l.every(u=>typeof u=="number")&&(r.type="number"),l.every(u=>typeof u=="string")&&(r.type="string"),r.enum=l},HL=(e,n,r,i)=>{if(n.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},BL=(e,n,r,i)=>{if(n.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},qL=(e,n,r,i)=>{const o=r,l=e._zod.def,{minimum:u,maximum:d}=e._zod.bag;typeof u=="number"&&(o.minItems=u),typeof d=="number"&&(o.maxItems=d),o.type="array",o.items=ln(l.element,n,{...i,path:[...i.path,"items"]})},GL=(e,n,r,i)=>{const o=r,l=e._zod.def;o.type="object",o.properties={};const u=l.shape;for(const m in u)o.properties[m]=ln(u[m],n,{...i,path:[...i.path,"properties",m]});const d=new Set(Object.keys(u)),p=new Set([...d].filter(m=>{const y=l.shape[m]._zod;return n.io==="input"?y.optin===void 0:y.optout===void 0}));p.size>0&&(o.required=Array.from(p)),l.catchall?._zod.def.type==="never"?o.additionalProperties=!1:l.catchall?l.catchall&&(o.additionalProperties=ln(l.catchall,n,{...i,path:[...i.path,"additionalProperties"]})):n.io==="output"&&(o.additionalProperties=!1)},ZL=(e,n,r,i)=>{const o=e._zod.def,l=o.inclusive===!1,u=o.options.map((d,p)=>ln(d,n,{...i,path:[...i.path,l?"oneOf":"anyOf",p]}));l?r.oneOf=u:r.anyOf=u},KL=(e,n,r,i)=>{const o=e._zod.def,l=ln(o.left,n,{...i,path:[...i.path,"allOf",0]}),u=ln(o.right,n,{...i,path:[...i.path,"allOf",1]}),d=m=>"allOf"in m&&Object.keys(m).length===1,p=[...d(l)?l.allOf:[l],...d(u)?u.allOf:[u]];r.allOf=p},YL=(e,n,r,i)=>{const o=e._zod.def,l=ln(o.innerType,n,i),u=n.seen.get(e);n.target==="openapi-3.0"?(u.ref=o.innerType,r.nullable=!0):r.anyOf=[l,{type:"null"}]},QL=(e,n,r,i)=>{const o=e._zod.def;ln(o.innerType,n,i);const l=n.seen.get(e);l.ref=o.innerType},XL=(e,n,r,i)=>{const o=e._zod.def;ln(o.innerType,n,i);const l=n.seen.get(e);l.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},JL=(e,n,r,i)=>{const o=e._zod.def;ln(o.innerType,n,i);const l=n.seen.get(e);l.ref=o.innerType,n.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},WL=(e,n,r,i)=>{const o=e._zod.def;ln(o.innerType,n,i);const l=n.seen.get(e);l.ref=o.innerType;let u;try{u=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=u},e8=(e,n,r,i)=>{const o=e._zod.def,l=o.in._zod.traits.has("$ZodTransform"),u=n.io==="input"?l?o.out:o.in:o.out;ln(u,n,i);const d=n.seen.get(e);d.ref=u},t8=(e,n,r,i)=>{const o=e._zod.def;ln(o.innerType,n,i);const l=n.seen.get(e);l.ref=o.innerType,r.readOnly=!0},EC=(e,n,r,i)=>{const o=e._zod.def;ln(o.innerType,n,i);const l=n.seen.get(e);l.ref=o.innerType};function Zm(){return Zm=Object.assign?Object.assign.bind():function(e){for(var n=1;n0){var p=o.errors[0][0];r[d]={message:p.message,type:p.code}}else r[d]={message:u,type:l};if(o.code==="invalid_union"&&o.errors.forEach(function(v){return v.forEach(function(b){return e.push(Zm({},b,{path:[].concat(o.path,b.path)}))})}),n){var m=r[d].types,y=m&&m[o.code];r[d]=rg(d,n,r,l,y?[].concat(y,o.message):o.message)}e.shift()};e.length;)i();return r}function fg(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,o,l){try{return Promise.resolve(Gx(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](i,n)).then(function(u){return l.shouldUseNativeValidation&&Bm({},l),{errors:{},values:r.raw?Object.assign({},i):u}})},function(u){if((function(d){return Array.isArray(d?.issues)})(u))return{values:{},errors:Ax(n8(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,o,l){try{return Promise.resolve(Gx(function(){return Promise.resolve((r.mode==="sync"?i5:s5)(e,i,n)).then(function(u){return l.shouldUseNativeValidation&&Bm({},l),{errors:{},values:r.raw?Object.assign({},i):u}})},function(u){if((function(d){return d instanceof ug})(u))return{values:{},errors:Ax(r8(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 a8=fe("ZodISODateTime",(e,n)=>{d6.init(e,n),_t.init(e,n)});function i8(e){return mL(a8,e)}const s8=fe("ZodISODate",(e,n)=>{f6.init(e,n),_t.init(e,n)});function o8(e){return pL(s8,e)}const l8=fe("ZodISOTime",(e,n)=>{h6.init(e,n),_t.init(e,n)});function c8(e){return gL(l8,e)}const u8=fe("ZodISODuration",(e,n)=>{m6.init(e,n),_t.init(e,n)});function d8(e){return vL(u8,e)}const f8=(e,n)=>{ug.init(e,n),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>a5(e,r)},flatten:{value:r=>r5(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,qm,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,qm,2)}},isEmpty:{get(){return e.issues.length===0}}})},nr=fe("ZodError",f8,{Parent:Error}),h8=id(nr),m8=sd(nr),p8=od(nr),g8=ld(nr),v8=c5(nr),y8=u5(nr),b8=d5(nr),x8=f5(nr),w8=h5(nr),S8=m5(nr),_8=p5(nr),C8=g5(nr),Zx=new WeakMap;function ud(e,n,r){const i=Object.getPrototypeOf(e);let o=Zx.get(i);if(o||(o=new Set,Zx.set(i,o)),!o.has(n)){o.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 Vt=fe("ZodType",(e,n)=>(Ft.init(e,n),Object.assign(e["~standard"],{jsonSchema:{input:Tu(e,"input"),output:Tu(e,"output")}}),e.toJSONSchema=LL(e,{}),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.parse=(r,i)=>h8(e,r,i,{callee:e.parse}),e.safeParse=(r,i)=>p8(e,r,i),e.parseAsync=async(r,i)=>m8(e,r,i,{callee:e.parseAsync}),e.safeParseAsync=async(r,i)=>g8(e,r,i),e.spa=e.safeParseAsync,e.encode=(r,i)=>v8(e,r,i),e.decode=(r,i)=>y8(e,r,i),e.encodeAsync=async(r,i)=>b8(e,r,i),e.decodeAsync=async(r,i)=>x8(e,r,i),e.safeEncode=(r,i)=>w8(e,r,i),e.safeDecode=(r,i)=>S8(e,r,i),e.safeEncodeAsync=async(r,i)=>_8(e,r,i),e.safeDecodeAsync=async(r,i)=>C8(e,r,i),ud(e,"ZodType",{check(...r){const i=this.def;return this.clone(Xa(i,{checks:[...i.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,i){return Ja(this,r,i)},brand(){return this},register(r,i){return r.add(this,i),this},refine(r,i){return this.check(v$(r,i))},superRefine(r,i){return this.check(y$(r,i))},overwrite(r){return this.check(Ks(r))},optional(){return Xx(this)},exactOptional(){return a$(this)},nullable(){return Jx(this)},nullish(){return Xx(Jx(this))},nonoptional(r){return u$(this,r)},array(){return K8(this)},or(r){return X8([this,r])},and(r){return W8(this,r)},transform(r){return Wx(this,n$(r))},default(r){return o$(this,r)},prefault(r){return c$(this,r)},catch(r){return f$(this,r)},pipe(r){return Wx(this,r)},readonly(){return p$(this)},describe(r){const i=this.clone();return Qo.add(i,{description:r}),i},meta(...r){if(r.length===0)return Qo.get(this);const i=this.clone();return Qo.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 Qo.get(e)?.description},configurable:!0}),e)),RC=fe("_ZodString",(e,n)=>{dg.init(e,n),Vt.init(e,n),e._zod.processJSONSchema=(i,o,l)=>IL(e,i,o);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,ud(e,"_ZodString",{regex(...i){return this.check(wL(...i))},includes(...i){return this.check(CL(...i))},startsWith(...i){return this.check(EL(...i))},endsWith(...i){return this.check(RL(...i))},min(...i){return this.check(ju(...i))},max(...i){return this.check(xC(...i))},length(...i){return this.check(wC(...i))},nonempty(...i){return this.check(ju(1,...i))},lowercase(i){return this.check(SL(i))},uppercase(i){return this.check(_L(i))},trim(){return this.check(TL())},normalize(...i){return this.check(jL(...i))},toLowerCase(){return this.check(OL())},toUpperCase(){return this.check(AL())},slugify(){return this.check(ML())}})}),E8=fe("ZodString",(e,n)=>{dg.init(e,n),RC.init(e,n),e.email=r=>e.check(Z6(R8,r)),e.url=r=>e.check(J6(j8,r)),e.jwt=r=>e.check(hL(U8,r)),e.emoji=r=>e.check(W6(T8,r)),e.guid=r=>e.check(qx(Kx,r)),e.uuid=r=>e.check(K6(ru,r)),e.uuidv4=r=>e.check(Y6(ru,r)),e.uuidv6=r=>e.check(Q6(ru,r)),e.uuidv7=r=>e.check(X6(ru,r)),e.nanoid=r=>e.check(eL(O8,r)),e.guid=r=>e.check(qx(Kx,r)),e.cuid=r=>e.check(tL(A8,r)),e.cuid2=r=>e.check(nL(M8,r)),e.ulid=r=>e.check(rL(N8,r)),e.base64=r=>e.check(uL(P8,r)),e.base64url=r=>e.check(dL(F8,r)),e.xid=r=>e.check(aL(D8,r)),e.ksuid=r=>e.check(iL(z8,r)),e.ipv4=r=>e.check(sL(k8,r)),e.ipv6=r=>e.check(oL(L8,r)),e.cidrv4=r=>e.check(lL($8,r)),e.cidrv6=r=>e.check(cL(I8,r)),e.e164=r=>e.check(fL(V8,r)),e.datetime=r=>e.check(i8(r)),e.date=r=>e.check(o8(r)),e.time=r=>e.check(c8(r)),e.duration=r=>e.check(d8(r))});function uu(e){return G6(E8,e)}const _t=fe("ZodStringFormat",(e,n)=>{xt.init(e,n),RC.init(e,n)}),R8=fe("ZodEmail",(e,n)=>{n6.init(e,n),_t.init(e,n)}),Kx=fe("ZodGUID",(e,n)=>{e6.init(e,n),_t.init(e,n)}),ru=fe("ZodUUID",(e,n)=>{t6.init(e,n),_t.init(e,n)}),j8=fe("ZodURL",(e,n)=>{r6.init(e,n),_t.init(e,n)}),T8=fe("ZodEmoji",(e,n)=>{a6.init(e,n),_t.init(e,n)}),O8=fe("ZodNanoID",(e,n)=>{i6.init(e,n),_t.init(e,n)}),A8=fe("ZodCUID",(e,n)=>{s6.init(e,n),_t.init(e,n)}),M8=fe("ZodCUID2",(e,n)=>{o6.init(e,n),_t.init(e,n)}),N8=fe("ZodULID",(e,n)=>{l6.init(e,n),_t.init(e,n)}),D8=fe("ZodXID",(e,n)=>{c6.init(e,n),_t.init(e,n)}),z8=fe("ZodKSUID",(e,n)=>{u6.init(e,n),_t.init(e,n)}),k8=fe("ZodIPv4",(e,n)=>{p6.init(e,n),_t.init(e,n)}),L8=fe("ZodIPv6",(e,n)=>{g6.init(e,n),_t.init(e,n)}),$8=fe("ZodCIDRv4",(e,n)=>{v6.init(e,n),_t.init(e,n)}),I8=fe("ZodCIDRv6",(e,n)=>{y6.init(e,n),_t.init(e,n)}),P8=fe("ZodBase64",(e,n)=>{b6.init(e,n),_t.init(e,n)}),F8=fe("ZodBase64URL",(e,n)=>{w6.init(e,n),_t.init(e,n)}),V8=fe("ZodE164",(e,n)=>{S6.init(e,n),_t.init(e,n)}),U8=fe("ZodJWT",(e,n)=>{C6.init(e,n),_t.init(e,n)}),H8=fe("ZodBoolean",(e,n)=>{E6.init(e,n),Vt.init(e,n),e._zod.processJSONSchema=(r,i,o)=>PL(e,r,i)});function Yx(e){return yL(H8,e)}const B8=fe("ZodUnknown",(e,n)=>{R6.init(e,n),Vt.init(e,n),e._zod.processJSONSchema=(r,i,o)=>VL()});function Qx(){return bL(B8)}const q8=fe("ZodNever",(e,n)=>{j6.init(e,n),Vt.init(e,n),e._zod.processJSONSchema=(r,i,o)=>FL(e,r,i)});function G8(e){return xL(q8,e)}const Z8=fe("ZodArray",(e,n)=>{T6.init(e,n),Vt.init(e,n),e._zod.processJSONSchema=(r,i,o)=>qL(e,r,i,o),e.element=n.element,ud(e,"ZodArray",{min(r,i){return this.check(ju(r,i))},nonempty(r){return this.check(ju(1,r))},max(r,i){return this.check(xC(r,i))},length(r,i){return this.check(wC(r,i))},unwrap(){return this.element}})});function K8(e,n){return NL(Z8,e,n)}const Y8=fe("ZodObject",(e,n)=>{A6.init(e,n),Vt.init(e,n),e._zod.processJSONSchema=(r,i,o)=>GL(e,r,i,o),dt(e,"shape",()=>n.shape),ud(e,"ZodObject",{keyof(){return e$(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:Qx()})},loose(){return this.clone({...this._zod.def,catchall:Qx()})},strict(){return this.clone({...this._zod.def,catchall:G8()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return X4(this,r)},safeExtend(r){return J4(this,r)},merge(r){return W4(this,r)},pick(r){return Y4(this,r)},omit(r){return Q4(this,r)},partial(...r){return e5(jC,this,r[0])},required(...r){return t5(TC,this,r[0])}})});function hg(e,n){const r={type:"object",shape:e??{},...Le(n)};return new Y8(r)}const Q8=fe("ZodUnion",(e,n)=>{M6.init(e,n),Vt.init(e,n),e._zod.processJSONSchema=(r,i,o)=>ZL(e,r,i,o),e.options=n.options});function X8(e,n){return new Q8({type:"union",options:e,...Le(n)})}const J8=fe("ZodIntersection",(e,n)=>{N6.init(e,n),Vt.init(e,n),e._zod.processJSONSchema=(r,i,o)=>KL(e,r,i,o)});function W8(e,n){return new J8({type:"intersection",left:e,right:n})}const Km=fe("ZodEnum",(e,n)=>{D6.init(e,n),Vt.init(e,n),e._zod.processJSONSchema=(i,o,l)=>UL(e,i,o),e.enum=n.entries,e.options=Object.values(n.entries);const r=new Set(Object.keys(n.entries));e.extract=(i,o)=>{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 Km({...n,checks:[],...Le(o),entries:l})},e.exclude=(i,o)=>{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 Km({...n,checks:[],...Le(o),entries:l})}});function e$(e,n){const r=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new Km({type:"enum",entries:r,...Le(n)})}const t$=fe("ZodTransform",(e,n)=>{z6.init(e,n),Vt.init(e,n),e._zod.processJSONSchema=(r,i,o)=>BL(e,r),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new oC(e.constructor.name);r.addIssue=l=>{if(typeof l=="string")r.issues.push(hl(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(hl(u))}};const o=n.transform(r.value,r);return o instanceof Promise?o.then(l=>(r.value=l,r.fallback=!0,r)):(r.value=o,r.fallback=!0,r)}});function n$(e){return new t$({type:"transform",transform:e})}const jC=fe("ZodOptional",(e,n)=>{bC.init(e,n),Vt.init(e,n),e._zod.processJSONSchema=(r,i,o)=>EC(e,r,i,o),e.unwrap=()=>e._zod.def.innerType});function Xx(e){return new jC({type:"optional",innerType:e})}const r$=fe("ZodExactOptional",(e,n)=>{k6.init(e,n),Vt.init(e,n),e._zod.processJSONSchema=(r,i,o)=>EC(e,r,i,o),e.unwrap=()=>e._zod.def.innerType});function a$(e){return new r$({type:"optional",innerType:e})}const i$=fe("ZodNullable",(e,n)=>{L6.init(e,n),Vt.init(e,n),e._zod.processJSONSchema=(r,i,o)=>YL(e,r,i,o),e.unwrap=()=>e._zod.def.innerType});function Jx(e){return new i$({type:"nullable",innerType:e})}const s$=fe("ZodDefault",(e,n)=>{$6.init(e,n),Vt.init(e,n),e._zod.processJSONSchema=(r,i,o)=>XL(e,r,i,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function o$(e,n){return new s$({type:"default",innerType:e,get defaultValue(){return typeof n=="function"?n():uC(n)}})}const l$=fe("ZodPrefault",(e,n)=>{I6.init(e,n),Vt.init(e,n),e._zod.processJSONSchema=(r,i,o)=>JL(e,r,i,o),e.unwrap=()=>e._zod.def.innerType});function c$(e,n){return new l$({type:"prefault",innerType:e,get defaultValue(){return typeof n=="function"?n():uC(n)}})}const TC=fe("ZodNonOptional",(e,n)=>{P6.init(e,n),Vt.init(e,n),e._zod.processJSONSchema=(r,i,o)=>QL(e,r,i,o),e.unwrap=()=>e._zod.def.innerType});function u$(e,n){return new TC({type:"nonoptional",innerType:e,...Le(n)})}const d$=fe("ZodCatch",(e,n)=>{F6.init(e,n),Vt.init(e,n),e._zod.processJSONSchema=(r,i,o)=>WL(e,r,i,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function f$(e,n){return new d$({type:"catch",innerType:e,catchValue:typeof n=="function"?n:()=>n})}const h$=fe("ZodPipe",(e,n)=>{V6.init(e,n),Vt.init(e,n),e._zod.processJSONSchema=(r,i,o)=>e8(e,r,i,o),e.in=n.in,e.out=n.out});function Wx(e,n){return new h$({type:"pipe",in:e,out:n})}const m$=fe("ZodReadonly",(e,n)=>{U6.init(e,n),Vt.init(e,n),e._zod.processJSONSchema=(r,i,o)=>t8(e,r,i,o),e.unwrap=()=>e._zod.def.innerType});function p$(e){return new m$({type:"readonly",innerType:e})}const g$=fe("ZodCustom",(e,n)=>{H6.init(e,n),Vt.init(e,n),e._zod.processJSONSchema=(r,i,o)=>HL(e,r)});function v$(e,n={}){return DL(g$,e,n)}function y$(e,n){return zL(e,n)}const b$=/\.(md|markdown)$/i,x$=/\.(png|jpe?g|gif|svg|webp|ico|bmp|avif)$/i,OC=/\.html?$/i,AC=/\.pdf$/i,w$=/\.(csv|tsv)$/i,S$=/\.(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 mg(e){if(e<1024)return e+" B";const n=["KB","MB","GB","TB"];let r=-1;do e/=1024,r++;while(e>=1024&&r`:e.user||e.author||"unknown"}function E$({className:e,...n}){return f.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:f.jsx("table",{"data-slot":"table",className:Je("w-full caption-bottom text-sm",e),...n})})}function R$({className:e,...n}){return f.jsx("thead",{"data-slot":"table-header",className:Je("[&_tr]:border-b",e),...n})}function j$({className:e,...n}){return f.jsx("tbody",{"data-slot":"table-body",className:Je("[&_tr:last-child]:border-0",e),...n})}function ew({className:e,...n}){return f.jsx("tr",{"data-slot":"table-row",className:Je("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",e),...n})}function tw({className:e,...n}){return f.jsx("th",{"data-slot":"table-head",className:Je("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...n})}function T$({className:e,...n}){return f.jsx("td",{"data-slot":"table-cell",className:Je("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...n})}function O$({header:e}){const n=e.column.getIsSorted();return e.column.getCanSort()?f.jsx(tw,{"data-sort":n||void 0,"aria-sort":n==="asc"?"ascending":n==="desc"?"descending":"none",children:f.jsxs("button",{type:"button",className:"th-sort",onClick:e.column.getToggleSortingHandler(),children:[Fm(e.column.columnDef.header,e.getContext()),n==="asc"?" ↑":n==="desc"?" ↓":""]})}):f.jsx(tw,{children:Fm(e.column.columnDef.header,e.getContext())})}function DC({table:e,className:n}){return f.jsx("div",{className:"admin-list admin-card-table"+(n?" "+n:""),children:f.jsxs(E$,{className:"admin-table",children:[f.jsx(R$,{children:e.getHeaderGroups().map(r=>f.jsx(ew,{children:r.headers.map(i=>f.jsx(O$,{header:i},i.id))},r.id))}),f.jsx(j$,{children:e.getRowModel().rows.map(r=>f.jsx(ew,{className:"admin-item",children:r.getVisibleCells().map(i=>f.jsx(T$,{children:Fm(i.column.columnDef.cell,i.getContext())},i.id))},r.id))})]})})}function zC(e){return e?"expires "+new Date(e).toLocaleDateString():"no expiry"}function A$(e){if(e.opens===void 0)return null;if(e.opens===0)return"not opened yet";const n=`${e.opens} open${e.opens===1?"":"s"}`;return e.last_opened?`${n} · last opened ${new Date(e.last_opened).toLocaleDateString()}`:n}function kC(e,n){const r=[];n&&e.project_name&&r.push(e.project_name),e.creator&&r.push("by "+e.creator),e.created&&r.push(new Date(e.created).toLocaleDateString()),r.push(zC(e.expires));const i=A$(e);return i&&r.push(i),r.join(" · ")}const LC="Opens count how many times a file has been read through a public link. Repeat opens by the same reader within 10 minutes count once.";function $C({shares:e,onChanged:n,showProject:r=!1,canRevoke:i=!0,empty:o="No public shares.",loading:l=!1}){const[u,d]=w.useState([]),p=w.useMemo(()=>k_(),[]),m=w.useMemo(()=>[p.accessor("path",{header:"Path",cell:v=>f.jsx("a",{className:"ai-main mono",title:v.getValue(),...Hs(dl(v.getValue(),v.row.original.project)),children:v.getValue()})}),p.accessor(v=>kC(v,r),{id:"detail",header:r?"Project":"Shared",cell:v=>f.jsx("span",{className:"ai-tag",children:v.getValue()})}),p.display({id:"actions",header:"",cell:v=>i?f.jsx("button",{className:"ai-del","aria-label":`Revoke the share of ${v.row.original.path}`,onClick:()=>IC(v.row.original,n),children:"Revoke"}):null})],[p,n,r,i]),y=Z_({data:e,columns:m,state:{sorting:u},onSortingChange:d,getCoreRowModel:q_(),getSortedRowModel:G_()});return l?f.jsx("div",{className:"admin-list",children:f.jsx("div",{className:"admin-empty",children:"Loading…"})}):e.length===0?f.jsx("div",{className:"admin-list",children:f.jsx("div",{className:"admin-empty",children:o})}):f.jsx(DC,{table:y,className:"shares-table"})}async function IC(e,n){if(await Cl("Revoke share link",`Revoke the public link to “${e.path}”? Anyone with the URL will lose access.`,"Revoke",!0))try{await Wn("DELETE","/api/shares/"+e.token),Ke("Share revoked."),n()}catch(r){Ke(r.message,!0)}}const M$=hg({name:uu().trim().min(1,"Give the organization a name.").max(60,"Keep it under 60 characters.")});function N$({org:e,projects:n,myEmail:r}){const i=Ai(),o=e.role==="owner",l=()=>i.invalidateQueries({queryKey:["orgs"]}),u=()=>i.invalidateQueries({queryKey:["invites",e.id]}),d=()=>i.invalidateQueries({queryKey:["orgShares",e.id]}),p=ag({resolver:fg(M$),values:{name:e.name}}),{data:m}=Pt({queryKey:["invites",e.id],queryFn:()=>Bt(`/api/orgs/${e.id}/invites`),enabled:o,select:x=>x.invites||[]}),{data:y,isLoading:v}=Pt({queryKey:["orgShares",e.id],queryFn:()=>Bt(`/api/orgs/${e.id}/shares`),enabled:o,select:x=>x.shares||[]}),b=n.filter(x=>x.org===e.id);return f.jsxs("div",{className:"admin",children:[f.jsx("h1",{id:"org-title",children:e.name}),!o&&f.jsx("p",{className:"role-chip-row",children:f.jsx("span",{className:"ai-tag role-chip",children:"Member"})}),!o&&f.jsx("p",{className:"admin-sub",children:"Only owners can rename this organization, manage members, or issue invite links."}),o&&f.jsxs("form",{className:"admin-row",onSubmit:p.handleSubmit(async({name:x})=>{try{await Wn("PATCH","/api/orgs/"+e.id,{name:x}),Ke("Renamed."),l()}catch(S){Ke(S.message,!0)}}),children:[f.jsx("label",{className:"admin-lbl",htmlFor:"org-rename",children:"Organization name"}),f.jsx("input",{id:"org-rename",type:"text","aria-invalid":!!p.formState.errors.name,"aria-describedby":p.formState.errors.name?"org-rename-err":void 0,...p.register("name")}),f.jsx(vt,{variant:"subtle",id:"org-rename-btn",type:"submit",disabled:!p.formState.isDirty,children:"Rename org"}),p.formState.errors.name&&f.jsx("span",{id:"org-rename-err",role:"alert",className:"field-err",children:p.formState.errors.name.message})]}),f.jsx("h3",{children:"Members"}),f.jsx(D$,{org:e,owner:o,myEmail:r,onChanged:l}),f.jsx("h3",{children:"Projects"}),f.jsxs("div",{className:"admin-list",children:[b.length===0&&f.jsx("div",{className:"admin-empty",children:"No projects yet."}),b.map(x=>f.jsx("div",{className:"admin-item",children:f.jsx("span",{className:"ai-main",title:x.name,children:x.name})},x.id))]}),o&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"admin-h",children:[f.jsx("h3",{children:"Invite links"}),f.jsx(vt,{variant:"primary",onClick:async()=>{try{const x=await Si(`/api/orgs/${e.id}/invites`),S=await Bs(x.url);Ke(S?"Invite link copied to clipboard.":"Invite created — copy it from the list below."),u()}catch(x){Ke(x.message,!0)}},children:"New invite"})]}),f.jsxs("div",{className:"admin-list",children:[m&&m.length===0&&f.jsx("div",{className:"admin-empty",children:"No active invite links."}),(m||[]).map(x=>f.jsxs("div",{className:"admin-item",children:[f.jsx("button",{type:"button",className:"ai-main mono ai-copy","aria-label":`Copy invite link ${x.url}`,title:x.url,onClick:()=>Bs(x.url).then(S=>Ke(S?"Copied.":"Select and copy the link.")),children:x.url}),f.jsx("span",{className:"ai-tag",children:(x.creator?"by "+x.creator+" · ":"")+(x.uses?x.uses+" joined · ":"unused · ")+"expires "+new Date(x.expires).toLocaleDateString()}),f.jsx("button",{className:"ai-del","aria-label":`Revoke invite ${x.token.slice(0,8)}`,onClick:async()=>{if(await Cl("Revoke invite",`Revoke the link starting ${x.token.slice(0,8)}…? Anyone still holding it won't be able to join.`,"Revoke",!0))try{await Wn("DELETE",`/api/orgs/${e.id}/invites/${x.token}`),Ke("Revoked."),u()}catch(S){Ke(S.message,!0)}},children:"Revoke"})]},x.token))]}),f.jsx("h3",{children:"Public share links"}),f.jsx("p",{className:"admin-sub",children:"Every live link across this organization's projects. A project's own links are on its Settings page, and on the file itself."}),f.jsx($C,{shares:y||[],loading:v,onChanged:d,showProject:!0})]})]})}function D$({org:e,owner:n,myEmail:r,onChanged:i}){const[o,l]=w.useState([{id:"email",desc:!1}]),u=w.useMemo(()=>k_(),[]),d=w.useMemo(()=>[u.accessor("email",{id:"email",header:"Member",cell:m=>{const y=!!r&&m.getValue().toLowerCase()===r.toLowerCase();return f.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?f.jsx("span",{className:"ai-tag role-static",children:y.role}):f.jsxs("span",{className:"role-cell",children:[f.jsxs("select",{"aria-label":`Role for ${y.email}`,value:y.role,onChange:async b=>{try{await Wn("PATCH",`/api/orgs/${e.id}/members/${encodeURIComponent(y.email)}`,{role:b.target.value}),Ke("Role updated.")}catch(x){Ke(x.message,!0)}i()},children:[f.jsx("option",{value:"owner",children:"owner"}),f.jsx("option",{value:"member",children:"member"})]}),f.jsx("button",{className:"ai-del","aria-label":`Remove ${y.email}`,onClick:async()=>{if(await Cl("Remove member",`Remove ${y.email} from ${e.name}?`,"Remove",!0))try{await Wn("DELETE",`/api/orgs/${e.id}/members/${encodeURIComponent(y.email)}`),Ke("Removed."),i()}catch(b){Ke(b.message,!0)}},children:"Remove"})]})}})],[u,e.id,e.name,n,r]),p=Z_({data:e.members,columns:d,state:{sorting:o},onSortingChange:l,getCoreRowModel:q_(),getSortedRowModel:G_()});return f.jsx(DC,{table:p})}const z$=hg({require_verification:Yx(),require_approval:Yx()});function k$(){const e=Ai(),{data:n,error:r}=Pt({queryKey:["admin","policy"],queryFn:()=>Bt("/api/admin/policy")}),{data:i}=T_(!0),o=ag({resolver:fg(z$),values:n?{require_verification:n.require_verification&&n.mailer,require_approval:n.require_approval}:{require_verification:!1,require_approval:!1}});if(w.useEffect(()=>{r&&Ke(r.message,!0)},[r]),!n)return null;const l=async(u,d,p)=>{try{await Si(`/api/admin/pending/${u}/${d}`),Ke((d==="approve"?"Approved ":"Denied ")+p),e.invalidateQueries({queryKey:["admin","pending"]})}catch(m){Ke(m.message,!0)}};return f.jsxs("div",{className:"admin",children:[f.jsx("h1",{children:"Signup & access"}),f.jsx("p",{className:"admin-sub",children:"Who can create an account on this hub, and how new accounts are vetted."}),f.jsx("h3",{children:"New-account vetting"}),f.jsxs("form",{onSubmit:o.handleSubmit(async u=>{try{await Si("/api/admin/policy",u),Ke("Signup policy saved."),e.invalidateQueries({queryKey:["admin","policy"]})}catch(d){Ke(d.message,!0)}}),children:[f.jsxs("div",{className:"admin-list",children:[f.jsx(nw,{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:o.register("require_verification")}),f.jsx(nw,{label:"Require admin approval",desc:"New accounts wait for a hub admin to approve them before they gain access.",inputProps:o.register("require_approval")})]}),f.jsx(vt,{variant:"primary",type:"submit",style:{marginTop:14},disabled:!o.formState.isDirty,children:"Save policy"})]}),f.jsx("h3",{children:"Who can sign up"}),f.jsxs("div",{className:"admin-list",children:[f.jsxs("div",{className:"admin-item",children:[f.jsx("span",{className:"ai-main",children:"Allowed email domains"}),f.jsx("span",{className:"ai-tag",children:n.allowed_domains&&n.allowed_domains.length?n.allowed_domains.map(u=>"@"+u).join(", "):"any"})]}),f.jsxs("div",{className:"admin-item",children:[f.jsx("span",{className:"ai-main",children:"Self-signup"}),f.jsx("span",{className:"ai-tag",children:n.allow_signup?"open":"invite-only"})]}),f.jsxs("div",{className:"admin-item",children:[f.jsx("span",{className:"ai-main",children:"Hub admins"}),f.jsx("span",{className:"ai-tag",children:n.admins&&n.admins.length?n.admins.join(", "):"none"})]})]}),f.jsx("p",{className:"admin-sub",children:"Domains and admins are set in the server config file (they can't be widened from the browser)."}),f.jsx("h3",{children:"Pending signups"}),f.jsxs("div",{className:"admin-list",children:[(!i||i.length===0)&&f.jsx("div",{className:"admin-empty",children:"No one is waiting for approval."}),(i||[]).map(u=>f.jsxs("div",{className:"admin-item",children:[f.jsx("span",{className:"ai-main",children:(u.name?u.name+" · ":"")+u.email}),f.jsx(vt,{variant:"primary",onClick:()=>l(u.id,"approve",u.email),children:"Approve"}),f.jsx("button",{className:"ai-del",onClick:()=>l(u.id,"deny",u.email),children:"Deny"})]},u.id))]})]})}function nw({label:e,desc:n,disabled:r,inputProps:i}){return f.jsxs("label",{className:"admin-item toggle",style:r?{opacity:.55}:void 0,children:[f.jsxs("span",{className:"ai-main",children:[f.jsx("div",{className:"tg-label",children:e}),f.jsx("div",{className:"tg-desc",children:n})]}),f.jsx("input",{type:"checkbox",disabled:r,...i})]})}function L$({...e}){return f.jsx(f1,{"data-slot":"select",...e})}function $$({...e}){return f.jsx(g1,{"data-slot":"select-value",...e})}function I$({className:e,size:n="default",children:r,...i}){return f.jsxs(m1,{"data-slot":"select-trigger","data-size":n,className:Je("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,f.jsx(v1,{asChild:!0,children:f.jsx(Bp,{className:"size-4 opacity-50"})})]})}function P$({className:e,children:n,position:r="item-aligned",align:i="center",...o}){return f.jsx(b1,{children:f.jsxs(x1,{"data-slot":"select-content",className:Je("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,...o,children:[f.jsx(V$,{}),f.jsx(E1,{className:Je("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:n}),f.jsx(U$,{})]})})}function F$({className:e,children:n,...r}){return f.jsxs(O1,{"data-slot":"select-item",className:Je("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:[f.jsx("span",{"data-slot":"select-item-indicator",className:"absolute right-2 flex size-3.5 items-center justify-center",children:f.jsx(N1,{children:f.jsx(m_,{className:"size-4"})})}),f.jsx(A1,{children:n})]})}function V$({className:e,...n}){return f.jsx(D1,{"data-slot":"select-scroll-up-button",className:Je("flex cursor-default items-center justify-center py-1",e),...n,children:f.jsx(uz,{className:"size-4"})})}function U$({className:e,...n}){return f.jsx(z1,{"data-slot":"select-scroll-down-button",className:Je("flex cursor-default items-center justify-center py-1",e),...n,children:f.jsx(Bp,{className:"size-4"})})}const rw=["#5b8def","#f5a623","#4cc38a","#e0679b","#8b7bf0","#3ec8c8","#e6934a"];function ml(e){let n=0;for(const r of e)n=n*31+r.charCodeAt(0)>>>0;return rw[n%rw.length]}function aw({projects:e,currentId:n,menu:r,onNew:i}){const o=e.find(l=>l.id===n);return f.jsxs("nav",{id:"projects","aria-label":"Projects",children:[f.jsxs("div",{className:"nav-head",children:[f.jsx("span",{children:"Projects"}),f.jsx("button",{className:"nav-add",title:"New project","aria-label":"New project",onClick:i,children:"+"})]}),f.jsx("div",{className:"proj-row",children:f.jsxs(L$,{value:n||"",onValueChange:l=>{l&&l!==n&&(Kt("/"+l),mr())},children:[f.jsxs(I$,{id:"project-select","aria-label":`Switch project — current: ${o?.name??"none"}`,title:o?.name,className:"proj-trigger",children:[o&&f.jsx("span",{className:"proj-mark","aria-hidden":"true",style:{background:ml(o.name)},children:f.jsx(Ls,{name:o.icon})}),o?f.jsx("span",{"data-slot":"select-value",children:o.name}):f.jsx($$,{placeholder:"Select a project"})]}),f.jsx(P$,{className:"proj-menu",position:"popper",sideOffset:4,children:e.map(l=>f.jsxs(F$,{value:l.id,children:[f.jsx("span",{className:"proj-mark","aria-hidden":"true",style:{background:ml(l.name)},children:f.jsx(Ls,{name:l.icon})}),l.name]},l.id))})]})}),r&&f.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(([l,u,d,p])=>f.jsx("li",{children:f.jsxs("div",{id:"nav-"+l,className:"row"+(r.active===l?" active":""),role:"button",tabIndex:0,onClick:p,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),p())},children:[f.jsx(ut,{name:d}),f.jsx("span",{className:"label",children:u})]})},l))})]})}function PC({...e}){return f.jsx(UM,{"data-slot":"dropdown-menu",...e})}function FC({...e}){return f.jsx(HM,{"data-slot":"dropdown-menu-trigger",...e})}function VC({className:e,sideOffset:n=4,...r}){return f.jsx(BM,{children:f.jsx(qM,{"data-slot":"dropdown-menu-content",sideOffset:n,className:Je("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 Ds({className:e,inset:n,variant:r="default",...i}){return f.jsx(ZM,{"data-slot":"dropdown-menu-item","data-inset":n,"data-variant":r,className:Je("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 tm({className:e,inset:n,...r}){return f.jsx(GM,{"data-slot":"dropdown-menu-label","data-inset":n,className:Je("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...r})}const H$="https://github.com/runbear-io/beardrive";function B$(){return f.jsx("svg",{viewBox:"0 0 16 16",className:"gh-mark",fill:"currentColor","aria-hidden":"true",children:f.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"})})}function q$({me:e,org:n,admin:r,orgActive:i,billing:o}){const l=e.name||e.email,[u,d]=w.useState(!1),p=n?Hs(n.manage_url):null,m=o?Hs(o.url):null;return f.jsxs("footer",{id:"accountbar",children:[f.jsxs("a",{className:"gh-star",href:H$,target:"_blank",rel:"noreferrer",children:[f.jsx(B$,{}),f.jsx("span",{children:"Star on GitHub"}),f.jsx("span",{className:"ext","aria-hidden":"true",children:"↗"}),f.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]}),f.jsxs(PC,{modal:!1,open:u,onOpenChange:d,children:[f.jsx(FC,{asChild:!0,children:f.jsxs("button",{id:"account-btn",className:i?"active":void 0,"aria-label":"Account menu",children:[f.jsx("span",{className:"avatar",style:{background:ml(e.email)},"aria-hidden":"true",children:(l.trim()[0]||"?").toUpperCase()}),f.jsxs("span",{className:"acct",children:[f.jsx("b",{children:l}),e.name&&f.jsx("small",{children:e.email})]}),f.jsx(ut,{name:"chev"})]})}),f.jsxs(VC,{id:"account-menu",side:"top",align:"start",sideOffset:6,className:"acct-menu",children:[n&&f.jsxs(f.Fragment,{children:[f.jsx(tm,{className:"menu-sec",children:"Organization"}),f.jsx(Ds,{asChild:!0,children:f.jsxs("a",{id:"menu-org-settings","aria-current":i?"page":void 0,...p,onClick:y=>{p?.onClick?.(y),d(!1)},children:[f.jsx(ut,{name:"gear"}),f.jsxs("span",{children:[f.jsx("b",{children:n.name})," Settings"]}),!n.manage_url.startsWith("/")&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"ext","aria-hidden":"true",children:"↗"}),f.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]})]})}),o&&f.jsx(Ds,{asChild:!0,children:f.jsxs("a",{id:"menu-billing",...m,onClick:y=>{m?.onClick?.(y),d(!1)},children:[f.jsx(ut,{name:"card"}),f.jsx("span",{children:"Billing"}),f.jsx("span",{className:"ps-chip plan-chip",children:o.plan})]})})]}),r&&f.jsxs(f.Fragment,{children:[f.jsx(tm,{className:"menu-sec",children:"Hub"}),f.jsxs(Ds,{id:"menu-hub-admin",onSelect:r.onClick,children:[f.jsx(ut,{name:"shield"}),f.jsxs("span",{children:["Signup & access",r.pending?` · ${r.pending}`:""]})]})]}),f.jsx(tm,{className:"menu-sec",children:"Account"}),f.jsx(Ds,{asChild:!0,children:f.jsxs("a",{id:"signout",href:"/auth/logout",children:[f.jsx(ut,{name:"power"}),f.jsx("span",{children:"Log out"})]})})]})]})]})}function $a({className:e,...n}){return f.jsx("div",{"data-slot":"card",className:Je("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...n})}function Ia({className:e,...n}){return f.jsx("div",{"data-slot":"card-header",className:Je("@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 Pa({className:e,...n}){return f.jsx("div",{"data-slot":"card-title",className:Je("leading-none font-semibold",e),...n})}function Is({className:e,...n}){return f.jsx("div",{"data-slot":"card-description",className:Je("text-muted-foreground text-sm",e),...n})}function Fa({className:e,...n}){return f.jsx("div",{"data-slot":"card-content",className:Je("px-6",e),...n})}function na({className:e,orientation:n="horizontal",decorative:r=!0,...i}){return f.jsx(CN,{"data-slot":"separator",decorative:r,orientation:n,className:Je("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 G$({url:e}){const n=Pt({queryKey:["billing"],queryFn:()=>Bt(e)});if(n.isLoading)return f.jsx("div",{className:"empty",children:"Loading…"});if(n.error||!n.data)return f.jsxs("div",{className:"empty",children:[f.jsx("h3",{children:"Billing is unavailable"}),f.jsx("p",{children:n.error?.message||"Try again shortly."})]});const r=n.data;return f.jsxs("div",{className:"project-settings",id:"billing-view",children:[f.jsxs("h2",{children:["Billing",f.jsx("span",{className:"ps-chip plan-chip",children:r.plan.name})]}),f.jsxs($a,{children:[f.jsxs(Ia,{children:[f.jsxs(Pa,{children:[r.plan.name," plan",r.plan.status?` (${r.plan.status})`:""]}),f.jsxs(Is,{children:["Organization ",r.org," · ",r.usage.used," of ",r.usage.cap," used · ",r.seats.used," of ",r.seats.cap," ",r.seats.cap===1?"seat":"seats"]})]}),f.jsx(na,{}),f.jsx(Fa,{children:f.jsx("div",{className:"usage-bar",children:f.jsx("div",{style:{width:`${r.usage.pct}%`}})})})]}),r.owner?f.jsx("div",{className:"plan-grid",children:r.plans.map(i=>f.jsxs($a,{children:[f.jsxs(Ia,{children:[f.jsx(Pa,{children:i.name}),f.jsx(Is,{children:i.blurb})]}),f.jsx(na,{}),f.jsxs(Fa,{children:[f.jsxs("p",{className:"plan-price",children:[i.price,f.jsx("small",{children:" / user / month"})]}),f.jsxs("form",{method:"post",action:r.checkout_url,children:[f.jsx("input",{type:"hidden",name:"plan",value:i.id}),f.jsx(vt,{type:"submit",disabled:i.current,variant:i.current?"subtle":"default",children:i.current?"Current plan":`Upgrade to ${i.name}`})]})]})]},i.id))}):f.jsx("p",{className:"muted-note",children:"Only an organization owner can change the plan."}),r.owner&&r.has_customer&&f.jsxs($a,{children:[f.jsxs(Ia,{children:[f.jsx(Pa,{children:"Manage subscription"}),f.jsx(Is,{children:"Change seats, update the card, download invoices, or cancel."})]}),f.jsx(na,{}),f.jsx(Fa,{children:f.jsx("form",{method:"post",action:r.portal_url,children:f.jsx(vt,{type:"submit",variant:"subtle",children:"Open the billing portal"})})})]})]})}function du({className:e,type:n,...r}){return f.jsx("input",{type:n,"data-slot":"input",className:Je("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 nm({className:e,...n}){return f.jsx(YM,{"data-slot":"label",className:Je("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 Z$({className:e,...n}){return f.jsx("textarea",{"data-slot":"textarea",className:Je("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 iw={read:1,write:2,admin:3};function wi(e,n){return(iw[e||""]||0)>=(iw[n]||0)}const Ym=280,K$=hg({name:uu().trim().min(1,"Give the project a name.").max(120,"Keep the name under 120 characters."),description:uu().max(Ym,`Keep the description under ${Ym} characters.`),icon:uu()});function Y$({project:e,org:n,onDeleted:r}){const i=O_(),o=wi(e.perm,"admin"),l=ag({resolver:fg(K$),defaultValues:{name:e.name,description:e.description??"",icon:e.icon??""}});w.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"),p=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 Wn("PATCH","/api/projects/"+e.id,v),Ke("Saved."),l.reset({...m,name:m.name.trim()}),await i()}catch(b){Ke(b.message,!0)}});return f.jsxs("div",{className:"project-settings",children:[f.jsxs("h2",{children:[e.name,!wi(e.perm,"write")&&f.jsx("span",{className:"ps-chip",children:"Read-only"})]}),f.jsxs($a,{children:[f.jsxs(Ia,{children:[f.jsx(Pa,{children:"General"}),f.jsx(Is,{children:"Name, description and icon for this project."})]}),f.jsx(na,{}),f.jsx(Fa,{children:f.jsxs("form",{className:"ps-form",onSubmit:p,children:[f.jsxs("div",{className:"ps-field",children:[f.jsx(nm,{htmlFor:"ps-icon-btn",children:"Icon"}),f.jsxs("div",{className:"ps-icon-row",children:[f.jsx("span",{className:"proj-mark","aria-hidden":"true",style:{background:ml(e.name)},children:f.jsx(Ls,{name:u})}),f.jsxs(PC,{children:[f.jsx(FC,{asChild:!0,children:f.jsx(vt,{id:"ps-icon-btn",type:"button",variant:"subtle",disabled:!o,children:"Change"})}),f.jsxs(VC,{align:"start",className:"ps-icon-grid",children:[f.jsx(Ds,{className:"ps-icon-cell"+(u===""?" active":""),title:"Default","aria-label":"Default icon",onSelect:()=>l.setValue("icon","",{shouldDirty:!0}),children:f.jsx(Ls,{})}),Object.keys(Nm).map(m=>f.jsx(Ds,{className:"ps-icon-cell"+(u===m?" active":""),title:m,"aria-label":m,onSelect:()=>l.setValue("icon",m,{shouldDirty:!0}),children:f.jsx(Ls,{name:m})},m))]})]})]})]}),f.jsxs("div",{className:"ps-field",children:[f.jsx(nm,{htmlFor:"ps-name",children:"Name"}),f.jsx(du,{id:"ps-name",disabled:!o,"aria-invalid":!!l.formState.errors.name,"aria-describedby":l.formState.errors.name?"ps-name-err":void 0,...l.register("name")}),l.formState.errors.name&&f.jsx("span",{id:"ps-name-err",role:"alert",className:"field-err",children:l.formState.errors.name.message})]}),f.jsxs("div",{className:"ps-field",children:[f.jsxs(nm,{htmlFor:"ps-desc",children:["Description ",f.jsx("span",{className:"ps-opt",children:"(optional)"})]}),f.jsx(Z$,{id:"ps-desc",rows:2,disabled:!o,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")}),f.jsxs("div",{className:"ps-meta",children:[l.formState.errors.description?f.jsx("span",{id:"ps-desc-err",role:"alert",className:"field-err",children:l.formState.errors.description.message}):f.jsx("span",{}),f.jsxs("span",{className:"ps-count",children:[d.length," / ",Ym]})]})]}),o&&f.jsxs(f.Fragment,{children:[f.jsx(na,{}),f.jsx("div",{className:"ps-actions",children:f.jsx(vt,{id:"ps-save",type:"submit",variant:"primary",disabled:!l.formState.isDirty||l.formState.isSubmitting,children:"Save changes"})})]})]})})]}),f.jsx(Q$,{project:e}),f.jsx(J$,{project:e,org:n}),f.jsxs($a,{children:[f.jsx(Ia,{children:f.jsx(Pa,{children:"About"})}),f.jsx(na,{}),f.jsx(Fa,{children:f.jsxs("dl",{className:"ps-facts",children:[f.jsx("dt",{children:"Project id"}),f.jsx("dd",{children:f.jsx("code",{children:e.id})}),n&&f.jsxs(f.Fragment,{children:[f.jsx("dt",{children:"Workspace"}),f.jsx("dd",{children:n.name})]}),e.created&&f.jsxs(f.Fragment,{children:[f.jsx("dt",{children:"Created"}),f.jsx("dd",{children:new Date(e.created).toLocaleDateString()})]})]})})]}),o&&f.jsxs($a,{className:"ps-danger",children:[f.jsx(Ia,{children:f.jsx(Pa,{children:"Danger zone"})}),f.jsx(na,{}),f.jsxs(Fa,{children:[f.jsx("p",{children:"Deleting removes the project from this hub. Its files stay in storage. This can't be undone."}),f.jsx(vt,{variant:"danger",onClick:async()=>{if(await R_(`Delete “${e.name}”?`,"This can't be undone. Type the project name to confirm:","","Delete project",{match:e.name,danger:!0})!==null)try{await Wn("DELETE","/api/projects/"+e.id),Ke(`Deleted “${e.name}”.`),await r()}catch(y){Ke(y.message,!0)}},children:"Delete project"})]})]})]})}function Q$({project:e}){const n=Ai(),{data:r,error:i,isLoading:o}=j_(e.id);return i?null:f.jsxs($a,{children:[f.jsxs(Ia,{children:[f.jsx(Pa,{children:"Public links"}),f.jsxs(Is,{children:["Files in this project that anyone with the URL can read — no account needed.",(r||[]).some(l=>l.opens!==void 0)&&f.jsxs(f.Fragment,{children:[" ",LC]})]})]}),f.jsx(na,{}),f.jsx(Fa,{children:f.jsx($C,{shares:r||[],loading:o,canRevoke:wi(e.perm,"write"),onChanged:()=>n.invalidateQueries({queryKey:["shares",e.id]}),empty:"No public links."})})]})}const Qm=[{value:"admin",label:"Admin"},{value:"write",label:"Write"},{value:"read",label:"Read"},{value:"none",label:"No access"}],X$=Object.fromEntries(Qm.map(e=>[e.value,e.label]));function J$({project:e,org:n}){const r=Ai(),{data:i,error:o}=j3(e.id),l=wi(e.perm,"admin"),u=()=>{r.invalidateQueries({queryKey:["permissions",e.id]}),r.invalidateQueries({queryKey:["projects"]})},d=async(x,S)=>{try{await x(),Ke(S)}catch(_){Ke(_.message,!0)}u()};if(o||!i)return null;const p=i,m=`/api/p/${e.id}/permissions`,y=new Set((n?.members||[]).filter(x=>x.role==="owner").map(x=>x.email.toLowerCase())),v=[...p.grants.filter(x=>!y.has(x.email.toLowerCase())),...[...y].sort().map(x=>({email:x,level:"admin",owner:!0}))],b=async()=>{const x=await R_("Add an exception","Email of a workspace member. They get Read access; change it in the table.","","Add");x===null||!x.trim()||await d(()=>Wn("PUT",`${m}/${encodeURIComponent(x.trim())}`,{level:"read"}),"Added.")};return f.jsxs($a,{className:"ps-people",children:[f.jsxs(Ia,{children:[f.jsx(Pa,{children:"People"}),f.jsx(Is,{children:"Who can see and change this project."})]}),f.jsx(na,{}),f.jsxs(Fa,{children:[f.jsxs("p",{className:"ps-row",children:[f.jsxs("span",{children:["Everyone in ",n?.name||"this workspace"," can"]}),f.jsx("select",{"aria-label":"Default access for workspace members",disabled:!l,value:p.default,onChange:async x=>{const S=x.target.value;if(S==="none"&&!await Cl("Make this project invite-only?","Only people listed below (and workspace owners) will see this project.","Make invite-only")){u();return}await d(()=>Wn("PUT",m,{default:S}),"Default access updated.")},children:Qm.filter(x=>x.value!=="admin").map(x=>f.jsx("option",{value:x.value,children:x.label},x.value))})]}),p.default==="none"&&f.jsx("p",{className:"ps-note",children:"This project is invite-only: only the people below and workspace owners can see it."}),f.jsxs("div",{className:"ps-people-head",children:[f.jsx("h4",{children:"Exceptions"}),l&&f.jsx(vt,{type:"button",variant:"subtle",onClick:b,children:"+ Add"})]}),v.length===0?f.jsx("p",{className:"ps-note",children:"No exceptions — everyone gets the access above."}):f.jsx("div",{className:"admin-list",children:v.map(x=>{const S="owner"in x;return f.jsxs("div",{className:"admin-item",children:[f.jsxs("span",{className:"ai-main",title:x.email,children:[x.email,p.creator&&x.email.toLowerCase()===p.creator.toLowerCase()&&f.jsx("span",{className:"ai-tag",children:" (creator)"})]}),S?f.jsx("span",{className:"ai-tag",children:"Workspace owner — always admin"}):f.jsxs("span",{className:"role-cell",children:[f.jsx("select",{"aria-label":`Access for ${x.email}`,disabled:!l,value:x.level,onChange:_=>d(()=>Wn("PUT",`${m}/${encodeURIComponent(x.email)}`,{level:_.target.value}),`${x.email} is now ${X$[_.target.value]||_.target.value}.`),children:Qm.map(_=>f.jsx("option",{value:_.value,children:_.label},_.value))}),l&&f.jsx("button",{className:"ai-del","aria-label":`Remove exception for ${x.email}`,onClick:()=>d(()=>Wn("DELETE",`${m}/${encodeURIComponent(x.email)}`),"Reverted to the default access."),children:"Remove"})]})]},x.email)})})]})]})}const UC="https://raw.githubusercontent.com/runbear-io/beardrive/main/INSTALL_FOR_AGENTS.md";function HC({project:e,existing:n}){const r=window.location.origin,i=n?'. I already have a folder of notes — ask me which one to sync (the project is named "':'. Ask me which folder to sync (the project is named "',o="Follow "+UC+` +to set up BearDrive project `+e.id+" on "+r+i+e.name+'").',l=`brew install runbear-io/tap/beardrive +bdrive login `+r+` +bdrive init --project `+e.id;return f.jsxs("div",{className:"guide",children:[f.jsxs("h1",{className:"in-title gd-head",children:[f.jsx("span",{className:"proj-mark","aria-hidden":"true",style:{background:ml(e.name)},children:f.jsx(Ls,{name:e.icon})}),e.name]}),e.description&&f.jsx("p",{className:"in-desc",children:e.description}),f.jsxs("div",{className:"gd-body",children:[f.jsx("p",{className:"gd-desc",children:n?"Paste into your coding agent — Claude Code, Cowork, Codex, Gemini CLI, Hermes — in the folder you already have:":"Paste into your coding agent — Claude Code, Cowork, Codex, Gemini CLI, Hermes — in the folder where you want the files:"}),n&&f.jsx("p",{className:"gd-note",children:"Your files stay exactly where they are. Connecting a folder never moves, renames or overwrites anything in it — it uploads what is there and keeps it in sync."}),f.jsx(Xm,{code:o}),f.jsx("p",{className:"gd-desc",children:"The agent installs the CLI, signs this machine in, and registers the sync hooks — asking before anything it changes."}),f.jsx("p",{className:"gd-desc",children:"Runs on macOS and Linux. Windows is not supported yet."}),f.jsxs("details",{className:"gd-manual",children:[f.jsx("summary",{children:"What exactly happens"}),f.jsxs("ul",{className:"gd-desc gd-list",children:[f.jsx("li",{children:"Sign-in uses a device code you approve in this browser — the folder itself never holds credentials."}),f.jsx("li",{children:"Sync hooks pull the latest before every agent turn, push edits seconds after they happen, and stamp each change with the session that made it; agent reads feed Insights. They register once per machine in your agent's own config, so every session is covered and nothing is written into the synced folder."}),f.jsx("li",{children:"Codex hooks are off by default: set [features] codex_hooks = true in ~/.codex/config.toml."})]})]}),f.jsxs("details",{className:"gd-manual",children:[f.jsx("summary",{children:"Or run it yourself"}),f.jsx("p",{className:"gd-desc",children:"Same result, in the folder you want the files. One command: init signs this device in, registers the sync hooks and starts syncing."}),f.jsx(Xm,{code:l}),f.jsx("p",{className:"gd-desc",children:f.jsx("a",{href:"https://docs.beardrive.ai/manual/install/",target:"_blank",rel:"noreferrer",children:"Full manual setup guide →"})})]})]})]})}function Xm({code:e}){const[n,r]=w.useState("Copy");return f.jsxs("pre",{className:"gd-code",children:[f.jsx("code",{children:e}),f.jsx("button",{className:"gd-copy",onClick:async()=>{r(await Bs(e)?"Copied":"Copy failed"),setTimeout(()=>r("Copy"),1400)},children:n})]})}function W$({onNew:e,canCreate:n}){return f.jsxs("div",{className:"onboard",children:[f.jsx("h1",{children:"Welcome to BearDrive"}),f.jsx("p",{children:"You're signed in, but you're not part of any project yet."}),n&&f.jsxs("div",{className:"ob-card ob-start",children:[f.jsx("h3",{children:"Start a project"}),f.jsx("p",{children:"Name it and pick what it starts from — a structure, or nothing at all. Then connect a folder on any machine and it stays in sync."}),f.jsx(vt,{variant:"primary",id:"ob-new",onClick:e,children:"New project"})]}),f.jsxs("div",{className:"ob-card ob-agent",children:[f.jsx("h3",{children:n?"Or let your agent do it":"Connect a new drive to your project"}),f.jsx("p",{children:"Paste into your coding agent — Claude Code, Cowork, Codex, Gemini CLI, Hermes — in the folder where you want the files. It creates the project and starts syncing:"}),f.jsx(Xm,{code:"Follow "+UC+` +to set up a new BearDrive project on `+window.location.origin+". Ask me which folder to sync."}),f.jsx("p",{className:"ob-alt",children:f.jsx("a",{href:"https://docs.beardrive.ai/manual/setup-by-hand/",target:"_blank",rel:"noreferrer",children:"Or start a project manually →"})})]})]})}const BC="__existing__";function eI({templates:e,onCreate:n,onClose:r}){const i=[...e.map(x=>({value:x.name,title:x.title,blurb:x.blurb,rule:!1})),{value:BC,title:"I already have a folder",blurb:"nothing is seeded — connect it and your files stay as they are",rule:!0},{value:"",title:"Empty project",blurb:"just the folder",rule:!1}],[o,l]=w.useState(""),[u,d]=w.useState(i[0].value),[p,m]=w.useState(""),[y,v]=w.useState(!1),b=async()=>{if(!y){if(!o.trim()){m("Give it a name.");return}v(!0);try{await n(o.trim(),u)}finally{v(!1)}}};return f.jsx(Ju,{open:!0,onOpenChange:x=>!x&&r(),children:f.jsxs(Wu,{className:"modal",showCloseButton:!1,children:[f.jsx(Sl,{asChild:!0,children:f.jsx("h3",{children:"New project"})}),f.jsx("label",{className:"modal-label",htmlFor:"modal-input",children:"Name"}),f.jsx("input",{className:"modal-input",type:"text",autoComplete:"off",id:"modal-input",autoFocus:!0,value:o,"aria-invalid":!!p,"aria-describedby":p?"modal-input-err":void 0,onChange:x=>{l(x.currentTarget.value),p&&m("")},onKeyDown:x=>x.key==="Enter"&&b()}),p&&f.jsx("span",{id:"modal-input-err",role:"alert",className:"field-err",children:p}),i.length>1&&f.jsxs("fieldset",{className:"start-points",children:[f.jsx("legend",{className:"modal-label",children:"Starting point"}),i.map((x,S)=>f.jsxs("label",{className:"start-point"+(u===x.value?" on":"")+(x.rule?" sp-rule":""),children:[f.jsx("input",{type:"radio",name:"template",value:x.value,checked:u===x.value,onChange:()=>d(x.value)}),f.jsxs("span",{className:"sp-text",children:[f.jsxs("span",{className:"sp-title",children:[x.title,S===0&&f.jsx("span",{className:"sp-rec",children:"Recommended"})]}),f.jsx("span",{className:"sp-blurb",children:x.blurb})]})]},x.value))]}),f.jsxs("div",{className:"modal-actions",children:[f.jsx(vt,{variant:"subtle",onClick:r,children:"Cancel"}),f.jsx(vt,{variant:"primary",onClick:b,disabled:y,children:"Create"})]})]})})}function sw(e,n,r){if(!e)return null;if(!r)return e[n]||null;const i={human:0,agent:0,share:0};for(const[o,l]of Object.entries(e))o.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 ka(e){return(e.human||0)+(e.agent||0)+(e.share||0)}function Xo(e){const n=ka(e);if(!n)return"";const r=n+(n===1?" read":" reads");if(!e.agent&&!e.share)return r;const i=[];return e.human&&i.push(e.human+" human"),e.agent&&i.push(e.agent+" agent"),e.share&&i.push(e.share+" shared"),r+" ("+i.join(", ")+")"}function tI(e){const n=ka(e);return n?n<3?1:n<10?2:n<30?3:4:0}function nI(e){const n=ka(e);return n?{agent:(e.agent||0)/n,human:(e.human||0)/n,share:(e.share||0)/n}:{agent:0,human:0,share:0}}function rI(e,n){return e?Object.keys(e).filter(r=>!n.has(r)).sort():[]}const aI=7;function iI(e){if(!e.length)return null;let n=e[0],r=e[0];for(const i of e)ir&&(r=i);return{min:n,max:r}}const sI=(e,n)=>n-el.reads-o.reads).slice(0,lI)){const o=i.path.split("/").pop();let l=i.cx+i.r+4,u="start";l+o.length*cI>n.right&&(l=i.cx-i.r-4,u="end");const d=m=>r.every(y=>Math.abs(y.y-m)>=rm);let p=i.cy;for(;p<=n.bottom&&!d(p);)p+=rm;if(p>n.bottom)for(p=i.cy;p>=n.top&&!d(p);)p-=rm;r.push({path:i.path,name:o,x:l,y:Math.min(n.bottom,Math.max(n.top,p)),anchor:u})}return r}function dI(e,n=!0){const r=Pt({queryKey:["tree",e],queryFn:()=>Bt(e+"tree"),enabled:n,refetchInterval:15e3}),i=w.useMemo(()=>{const o=[],l=new Map,u=d=>{for(const p of d.children||[])p.dir?(l.set(p.path,p),u(p)):o.push(p)};return r.data&&u(r.data),{flatFiles:o,dirIndex:l}},[r.data]);return{tree:r.data,...i,loaded:!!r.data}}function fI(e,n){return Pt({queryKey:["heat",e],queryFn:()=>Bt(e+"heat?days=30"),enabled:n,staleTime:6e4,refetchInterval:6e4}).data?.entries??null}function hI(e,n,r){return Pt({queryKey:["history",e,"prefix",n,20],queryFn:()=>Bt(e+"history?prefix="+encodeURIComponent(n)+"&n=20"),enabled:r,staleTime:15e3}).data?.entries??null}function mI(e,n,r){const i=new Array(e);return new Proxy(i,{get(o,l,u){if(typeof l=="string"){const d=l.charCodeAt(0);if(d>=48&&d<=57){const p=+l;if(Number.isInteger(p)&&p>=0&&pi[y]!==m))&&(i=d,o=n(...d),r?.onChange&&!(l&&r.skipInitialOnChange)&&r.onChange(o),l=!1),o}return u.updateDeps=d=>{i=d},u}function ow(e,n){if(e===void 0)throw new Error("Unexpected undefined");return e}const pI=(e,n)=>Math.abs(e-n)<1.01,gI=(e,n,r)=>{let i;return function(...o){e.clearTimeout(i),i=e.setTimeout(()=>n.apply(this,o),r)}};let qo;const am=()=>{if(qo!==void 0)return qo;if(typeof navigator>"u")return qo=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return qo=!0;const e=navigator.maxTouchPoints;return qo=navigator.platform==="MacIntel"&&e!==void 0&&e>0},lw=e=>{const{offsetWidth:n,offsetHeight:r}=e;return{width:n,height:r}},vI=e=>e,yI=e=>{const n=Math.max(e.startIndex-e.overscan,0),i=Math.min(e.endIndex+e.overscan,e.count-1)-n+1,o=new Array(i);for(let l=0;l{const r=e.scrollElement;if(!r)return;const i=e.targetWindow;if(!i)return;const o=u=>{const{width:d,height:p}=u;n({width:Math.round(d),height:Math.round(p)})};if(o(lw(r)),!i.ResizeObserver)return()=>{};const l=new i.ResizeObserver(u=>{const d=()=>{const p=u[0];if(p?.borderBoxSize){const m=p.borderBoxSize[0];if(m){o({width:m.inlineSize,height:m.blockSize});return}}o(lw(r))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return l.observe(r,{box:"border-box"}),()=>{l.unobserve(r)}},Ou={passive:!0},xI=typeof window>"u"?!0:"onscrollend"in window,wI=(e,n,r)=>{const i=e.scrollElement;if(!i)return;const o=e.targetWindow;if(!o)return;const l=e.options.useScrollendEvent&&xI;let u=0;const d=l?null:gI(o,()=>n(u,!1),e.options.isScrollingResetDelay),p=v=>()=>{u=r(i),d?.(),n(u,v)},m=p(!0),y=p(!1);return i.addEventListener("scroll",m,Ou),l&&i.addEventListener("scrollend",y,Ou),()=>{i.removeEventListener("scroll",m),l&&i.removeEventListener("scrollend",y)}},SI=(e,n)=>wI(e,n,r=>{const{horizontal:i,isRtl:o}=e.options;return i?r.scrollLeft*(o&&-1||1):r.scrollTop}),_I=(e,n,r)=>{if(r.options.useCachedMeasurements){const i=r.indexFromElement(e),o=r.options.getItemKey(i);return r.itemSizeCache.get(o)??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),o=r.options.getItemKey(i),l=r.itemSizeCache.get(o);if(l!==void 0)return l}return e[r.options.horizontal?"offsetWidth":"offsetHeight"]},CI=(e,{adjustments:n=0,behavior:r},i)=>{var o,l;(l=(o=i.scrollElement)==null?void 0:o.scrollTo)==null||l.call(o,{[i.options.horizontal?"left":"top"]:e+n,behavior:r})},EI=CI;class RI{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,o;return((o=(i=(r=this.targetWindow)==null?void 0:r.performance)==null?void 0:i.now)==null?void 0:o.call(i))??Date.now()},this.observer=(()=>{let r=null;const i=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(o=>{o.forEach(l=>{const u=()=>{const d=l.target,p=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(p)&&this.resizeItem(p,this.options.measureElement(d,l,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(u):u()})}));return{disconnect:()=>{var o;(o=i())==null||o.disconnect(),r=null},observe:o=>{var l;return(l=i())==null?void 0:l.observe(o,{box:"border-box"})},unobserve:o=>{var l;return(l=i())==null?void 0:l.unobserve(o)}}})(),this.range=null,this.setOptions=r=>{var i,o;const l={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:vI,rangeExtractor:yI,onChange:()=>{},measureElement:_I,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,p=null,m=!1;if(u!==void 0&&u.enabled&&l.enabled&&l.anchorTo==="end"&&this.scrollElement!==null){const b=u.count,x=l.count,S=this.getMeasurements(),_=b>0?((i=S[0])==null?void 0:i.key)??u.getItemKey(0):null,E=b>0?((o=S[b-1])==null?void 0:o.key)??u.getItemKey(b-1):null;if(x!==b||b>0&&x>0&&(l.getItemKey(0)!==_||l.getItemKey(x-1)!==E)){m=!0;const O=b>0?this.getVirtualItemForOffset(this.getScrollOffset())??S[0]:null;O&&(d=[O.key,this.getScrollOffset()-O.start]);const M=l.followOnAppend===!0?"auto":l.followOnAppend||null;M&&x>b&&this.isAtEnd(u.scrollEndThreshold)&&(b===0||l.getItemKey(x-1)!==E)&&(p=M)}}this.options=l,m&&(this.pendingMin=0,this.itemSizeCacheVersion++);let y=!1,v=0;if(d&&this.scrollOffset!==null){const[b,x]=d,S=this.getMeasurements(),{count:_,getItemKey:E}=this.options;let R=0;for(;R<_&&E(R)!==b;)R++;if(R<_){const T=S[R];if(T){const O=T.start+x;O!==this.scrollOffset&&(v=O-this.scrollOffset,this.scrollOffset=O,y=!0)}}}(y||p)&&(this.pendingScrollAnchor=[y?d[0]:null,y?d[1]:0,p,v])},this.notify=r=>{var i,o;(o=(i=this.options).onChange)==null||o.call(i,this,r)},this.maybeNotify=Ts(()=>(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,!(!am()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};l.addEventListener("touchstart",u,Ou),l.addEventListener("touchend",d,Ou),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 o=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled){const[l,u,d,p]=o;l!==null&&!d&&(am()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?p!==0&&(this._iosDeferredAdjustment+=p):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 o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(r,{adjustments:this.scrollAdjustments+=o,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=Ts(()=>[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,o,l,u,d,p,m)=>(this.prevLanes!==void 0&&this.prevLanes!==d&&(this.lanesChangedFlag=!0),this.prevLanes=d,this.pendingMin=null,{count:r,paddingStart:i,scrollMargin:o,getItemKey:l,enabled:u,lanes:d,laneAssignmentMode:p,gap:m}),{key:!1}),this.getMeasurements=Ts(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:r,paddingStart:i,scrollMargin:o,getItemKey:l,enabled:u,lanes:d,laneAssignmentMode:p,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 R of this.laneAssignments.keys())R>=r&&this.laneAssignments.delete(R);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(R=>{this.itemSizeCache.set(R.key,R.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 R=r*2;let T=this._flatMeasurements;if(!T||T.length0&&D.set(T.subarray(0,b*2)),T=D,this._flatMeasurements=T}let O;if(b===0)O=i+o;else{const D=b-1;O=T[D*2]+T[D*2+1]+m}for(let D=b;D1){M=O;const be=S[M],he=be!==void 0?x[be]:void 0;D=he?he.end+m:i+o}else if(E===d){let be=0,he=_[0],ue=S[0];for(let X=1;Xthis.options.debug}),this.calculateRange=Ts(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,i,o,l)=>r.length===0||i===0?(this.range=null,null):(this.range=TI(r,i,o,l,l===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Ts(()=>{let r=null,i=null;const o=this.calculateRange();return o&&(r=o.startIndex,i=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,i]},(r,i,o,l,u)=>l===null||u===null?[]:r({startIndex:l,endIndex:u,overscan:i,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=r=>{const i=this.options.indexAttribute,o=r.getAttribute(i);return o?parseInt(o,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 o=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(o!==void 0&&this.range){const l=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),u=Math.max(0,o-l),d=Math.min(this.options.count-1,o+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),o=this.options.getItemKey(i),l=this.elementsCache.get(o);l!==r&&(l&&this.observer.unobserve(l),this.observer.observe(r),this.elementsCache.set(o,r)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(r,void 0,this))},this.resizeItem=(r,i)=>{var o,l;if(r<0||r>=this.options.count)return;let u,d,p;const m=this._flatMeasurements;if(this.options.lanes===1&&m!==null)p=this.options.getItemKey(r),d=m[r*2],u=m[r*2+1];else{const b=this.measurementsCache[r];if(!b)return;p=b.key,d=b.start,u=b.size}const y=this.itemSizeCache.get(p)??u,v=i-y;if(v!==0){const b=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,x=b?this.getTotalSize():0,S=((l=this.scrollState)==null?void 0:l.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[r]??{index:r,key:p,start:d,size:u,end:d+u,lane:0},v,this):d[this.getVirtualIndexes(),this.getMeasurements()],(r,i)=>{const o=[];for(let l=0,u=r.length;lthis.options.debug}),this.getVirtualItemForOffset=r=>{const i=this.getMeasurements();if(i.length===0)return;const o=this._flatMeasurements,l=this.options.lanes===1&&o!=null,u=qC(0,i.length-1,l?d=>o[d*2]:d=>ow(i[d]).start,r);return ow(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,o=0)=>{if(!this.scrollElement)return 0;const l=this.getSize(),u=this.getScrollOffset();i==="auto"&&(i=r>=u+l?"end":"start"),i==="center"?r+=(o-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 o=this.getSize(),l=this.getScrollOffset(),u=this.measurementsCache[r];if(!u)return;if(i==="auto")if(u.end>=l+o-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:o="auto"}={})=>{const l=this.getOffsetForAlignment(r,i),u=this.now();this.scrollState={index:null,align:i,behavior:o,startedAt:u,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(r,{align:i="auto",behavior:o="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,p=this.now();this.scrollState={index:r,align:d,behavior:o,startedAt:p,lastTargetOffset:u,stableFrames:0},this._scrollToOffset(u,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(r,{behavior:i="auto"}={})=>{const o=this.getScrollOffset()+r,l=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{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 o;if(i.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const l=i.length-1,u=this._flatMeasurements;u!=null?o=u[l*2]+u[l*2+1]:o=((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--}o=Math.max(...l.filter(d=>d!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const r=[];if(this.itemSizeCache.size===0)return r;const i=this.getMeasurements();for(const o of i)o&&this.itemSizeCache.has(o.key)&&r.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return r},this._scrollToOffset=(r,{adjustments:i,behavior:o})=>{this._intendedScrollOffset=r+(i??0),this.options.scrollToFn(r,{behavior:o,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&&(am()&&(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,o=i?i[0]:this.scrollState.lastTargetOffset,l=1,u=o!==this.scrollState.lastTargetOffset;if(!u&&pI(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=l){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,u){const d=this.getSize()||600,p=Math.abs(o-this.getScrollOffset()),m=this.scrollState.behavior==="smooth"&&p>d;this.scrollState.lastTargetOffset=o,m||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:m?"smooth":"auto"})}this.scheduleScrollReconcile()}}const qC=(e,n,r,i)=>{for(;e<=n;){const o=(e+n)/2|0,l=r(o);if(li)n=o-1;else return o}return e>0?e-1:0};function jI(e,n,r){let i=0;for(;i<=n;){const o=(i+n)/2|0,l=e[o*2];if(lr)n=o-1;else return o}return i>0?i-1:0}function TI(e,n,r,i,o){const l=e.length-1;if(e.length<=i)return{startIndex:0,endIndex:l};if(i===1&&o!==null){const m=jI(o,l,r);let y=m;const v=r+n;for(;ye[m].start,r),p=d;if(i===1)for(;p1){const m=Array(i).fill(0);for(;pv=0&&y.some(v=>v>=r);){const v=e[d];y[v.lane]=v.start,d--}d=Math.max(0,d-d%i),p=Math.min(l,p+(i-1-p%i))}return{startIndex:d,endIndex:p}}const im=typeof document<"u"?w.useLayoutEffect:w.useEffect;function OI({useFlushSync:e=!0,directDomUpdates:n=!1,directDomUpdatesMode:r="transform",...i}){const o=w.useReducer(m=>m+1,0)[1],l=w.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 R=m.options.horizontal?"width":"height";y.container.style[R]=`${v}px`}const b=!!m.options.horizontal,x=y.mode==="transform",S=b?"left":"top",_=m.options.scrollMargin,E=m.getVirtualItems();for(const R of E){const T=R.start-_,O=m.elementsCache.get(R.key);O&&y.lastPositions.get(O)!==T&&(y.lastPositions.set(O,T),x?O.style.transform=b?`translate3d(${T}px, 0, 0)`:`translate3d(0, ${T}px, 0)`:O.style[S]=`${T}px`)}},d={...i,onChange:(m,y)=>{var v;const b=l.current;let x=!0;if(b.enabled){u(m);const S=m.range,_=b.prevRange;x=!_||_.isScrolling!==m.isScrolling||_.startIndex!==S?.startIndex||_.endIndex!==S?.endIndex,x&&(b.prevRange=S?{startIndex:S.startIndex,endIndex:S.endIndex,isScrolling:m.isScrolling}:null)}x&&(e&&y?Mi.flushSync(o):o()),(v=i.onChange)==null||v.call(i,m,y)}},[p]=w.useState(()=>{const m=new RI(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 p.setOptions(d),im(()=>p._didMount(),[]),im(()=>p._willUpdate()),im(()=>{u(p)}),p}function AI(e){return OI({observeElementRect:bI,observeElementOffset:SI,scrollToFn:EI,...e})}function MI(e,n){const r=[],i=(o,l)=>{for(const u of o)r.push({node:u,depth:l}),u.dir&&n.has(u.path)&&i(u.children||[],l+1)};return i(e?.children||[],0),r}function NI(e){const{root:n,expanded:r,onToggle:i,currentPath:o,listingShowing:l,onOpen:u}=e,d=w.useRef(null),p=w.useMemo(()=>MI(n,r),[n,r]),m=AI({count:p.length,getScrollElement:()=>d.current,estimateSize:()=>window.matchMedia("(max-width: 768px)").matches?44:28,overscan:12,getItemKey:y=>p[y].node.path});return w.useEffect(()=>{if(!o)return;const y=p.findIndex(v=>v.node.path===o);y>=0&&m.scrollToIndex(y,{align:"auto"})},[o,p]),f.jsx("nav",{id:"tree","aria-label":"Files",ref:d,children:f.jsx("div",{style:{height:m.getTotalSize(),position:"relative"},children:m.getVirtualItems().map(y=>{const{node:v,depth:b}=p[y.index],x=v.dir?r.has(v.path):!1,S=()=>{if(v.dir&&o===v.path&&l){i(v.path);return}u(v.path),v.dir||mr()};return f.jsxs("div",{className:"row "+(v.dir?"dir":"file")+(o===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:S,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),S())},children:[Array.from({length:b},(_,E)=>f.jsx("span",{className:"tguide",style:{left:8+E*13+5},"aria-hidden":"true"},E)),f.jsx("span",{className:"chev",onClick:_=>{v.dir&&(_.stopPropagation(),i(v.path))},children:f.jsx(ut,{name:"chevd"})}),f.jsx("span",{className:"ticon",children:f.jsx(ut,{name:v.dir?"folder":"doc"})}),f.jsx("span",{className:"label",children:v.name})]},y.key)})})})}function DI(e){const n=e.split("/"),r=[];let i="";for(let o=0;o{i=i?i+"/"+o:o;const u=i,d=l===r.length-1;return f.jsxs("span",{children:[l>0&&f.jsx("span",{className:"crumb-sep",children:"/"}),d?f.jsx("span",{children:o}):f.jsx("span",{className:"crumb-seg",title:u,onClick:()=>n(u),children:o})]},u)})})}function cw(e){if(e==="")return[];const n=e.split(` +`);return n[n.length-1]===""&&n.pop(),n}const kI=4e6;function LI(e,n){let r=0;for(;ro.push({op:"-",line:l[v],an:r+v+1}),y=v=>o.push({op:"+",line:u[v],bn:r+v+1});if(d*p>kI){for(let v=0;v=0;S--)for(let _=p-1;_>=0;_--)v[S][_]=l[S]===u[_]?v[S+1][_+1]+1:Math.max(v[S+1][_],v[S][_+1]);let b=0,x=0;for(;b=v[b][x+1]?m(b++):y(x++);for(;bi.op==="+").length,del:r.filter(i=>i.op==="-").length}}const GC=1<<20,II=8192;function PI(e){if(e.byteLength>GC)return{kind:"too-large",size:e.byteLength};if(e.subarray(0,II).includes(0))return{kind:"binary"};try{return{kind:"text",text:new TextDecoder("utf-8",{fatal:!0}).decode(e)}}catch{return{kind:"binary"}}}function Jm(e,n,r,i){let o=e+"blob?sha="+encodeURIComponent(n);return r&&(o+="&name="+encodeURIComponent(r)),i&&(o+="&download=1"),o}async function FI(e){const n=await gj(e),r=Number(n.headers.get("Content-Length"));return r>GC?{kind:"too-large",size:r}:PI(new Uint8Array(await n.arrayBuffer()))}function ZC(e,n,r,i){return Pt({queryKey:n,queryFn:()=>FI(e),enabled:r,...i?{staleTime:1/0,gcTime:1/0}:{},retry:!1})}function uw(e,n,r){return ZC(n?Jm(e,n):"",["blob",e,n],!!n,!0)}function VI(e){return e.slice(e.lastIndexOf("/")+1)}function UI({apiBase:e,path:n,prev:r,cur:i}){const o=VI(n);return f.jsxs("span",{className:"dv-dl",children:[f.jsx("a",{href:Jm(e,r,o,!0),children:"download previous"}),f.jsx("a",{href:Jm(e,i,o,!0),children:"download this version"})]})}function HI({apiBase:e,path:n,prev:r,cur:i}){const o=uw(e,r),l=uw(e,i),u=o.data?.kind==="text"&&l.data?.kind==="text",d=w.useMemo(()=>o.data?.kind==="text"&&l.data?.kind==="text"?$I(o.data.text,l.data.text):null,[o.data,l.data]);if(o.error||l.error)return f.jsx("div",{className:"dv dv-msg",children:"Could not load one of the versions."});if(!o.data||!l.data)return f.jsx("div",{className:"dv dv-msg",children:"Loading changes…"});if(!u){const v=o.data.kind==="too-large"||l.data.kind==="too-large";return f.jsxs("div",{className:"dv dv-msg",children:[v?"Too large to diff — download to compare.":"Binary file — no diff available.",f.jsx(UI,{apiBase:e,path:n,prev:r,cur:i})]})}const{lines:p,add:m,del:y}=d;return f.jsxs("div",{className:"dv",children:[f.jsxs("div",{className:"dv-head",children:[f.jsxs("span",{className:"dv-stat",children:[f.jsxs("span",{className:"dv-add",children:["+",m]})," ",f.jsxs("span",{className:"dv-del",children:["−",y]})]}),m===0&&y===0&&f.jsx("span",{className:"dv-same",children:"No line changes"})]}),f.jsx("div",{className:"dv-body",children:p.map((v,b)=>f.jsxs("div",{className:"dv-line dv-"+(v.op==="="?"ctx":v.op==="+"?"ins":"rm"),children:[f.jsx("span",{className:"dv-n",children:v.an??""}),f.jsx("span",{className:"dv-n",children:v.bn??""}),f.jsx("span",{className:"dv-mark",children:v.op==="="?" ":v.op}),f.jsx("span",{className:"dv-text",children:v.line||" "})]},b))})]})}const BI={add:"added",edit:"edited",delete:"deleted"};function KC({text:e}){return f.jsx(f.Fragment,{children:e.split(/(https?:\/\/\S+)/).map((n,r)=>/^https?:\/\//.test(n)?f.jsx("a",{href:n,target:"_blank",rel:"noopener",children:n},r):n)})}function pg({entry:e,apiBase:n,onOpen:r,diff:i,restore:o,remove:l,restoreSha:u,inRun:d,read:p}){const[m,y]=w.useState(!1),[v,b]=w.useState(!1),x=e.kind==="put"?"edit":e.kind,S=dd(e),_=[e.device.name||e.device.id,e.device.os].filter(Boolean).join(" · "),E=x!=="delete",R=!!i&&x!=="delete"&&!!e.blob,T=!!d&&x==="add",O=!!o&&!!u&&!T,M=!!l&&T,D=!!o?.busy&&o.busy===e.path+u,P=!!l?.busy&&l.busy===e.path,F=E&&!!e.blob,V=e.path.split("/").pop()||e.path,ve=new Date(e.time).toLocaleString(),be=n+"blob?sha="+e.blob+"&name="+encodeURIComponent(V)+"&download=1",he=()=>b(!v),ue=X=>{X.target.tagName!=="A"&&E&&r(e.path,e.blob)};return f.jsxs("div",{className:"hentry "+x+(E?" clickable":""),tabIndex:E?0:void 0,role:E?"button":void 0,onClick:ue,onKeyDown:X=>{E&&(X.key==="Enter"||X.key===" ")&&(X.preventDefault(),r(e.path,e.blob))},children:[f.jsxs("div",{className:"hline",children:[f.jsx("span",{className:"hkind",children:BI[x]||x}),p&&f.jsx("span",{className:"hread",title:"This run read this file before changing it",children:"read"}),f.jsx("span",{className:"hpath",children:e.path}),f.jsx("span",{className:"htime",children:ve})]}),f.jsxs("div",{className:"hmeta",children:[f.jsx("span",{className:"hwho",children:S}),f.jsx("span",{className:"hdev",children:_}),f.jsx("span",{className:"hsize",children:e.size?mg(e.size):""}),O&&f.jsxs("button",{type:"button",className:"hrestore-btn",disabled:D,title:"Put this version of "+e.path+" back as a new change",onClick:X=>{X.stopPropagation(),o.onRestore(e.path,u)},onKeyDown:X=>X.stopPropagation(),children:[f.jsx(ut,{name:"hist"}),D?"restoring…":"restore"]}),M&&f.jsxs("button",{type:"button",className:"hremove-btn",disabled:P,title:"Remove "+e.path+" — this run created it",onClick:X=>{X.stopPropagation(),l.onRemove(e.path)},onKeyDown:X=>X.stopPropagation(),children:[f.jsx(ut,{name:"trash"}),P?"removing…":"undo — remove file"]})]}),e.note&&!d&&f.jsx("div",{className:"hnote"+(m?" open":""),tabIndex:0,role:"button",title:m?"Collapse note":"Show full note","aria-expanded":m,onClick:X=>{X.stopPropagation(),X.target.tagName!=="A"&&y(!m)},onKeyDown:X=>{(X.key==="Enter"||X.key===" ")&&(X.preventDefault(),X.stopPropagation(),y(!m))},children:f.jsx(KC,{text:e.note})}),(R||F)&&f.jsxs("div",{className:"hactions",children:[R&&(i.prev?f.jsxs("button",{type:"button",className:"hdiff-btn"+(v?" open":""),"aria-expanded":v,onClick:X=>{X.stopPropagation(),he()},onKeyDown:X=>X.stopPropagation(),children:[f.jsx(ut,{name:v?"chevd":"chev"}),v?"hide changes":"show changes"]}):f.jsx("div",{className:"hdiff-none",children:"First version — nothing to compare against"})),F&&f.jsxs(f.Fragment,{children:[f.jsxs("button",{type:"button",className:"hver-btn","aria-label":`Open ${V} as of ${ve}`,onClick:X=>{X.stopPropagation(),r(e.path,e.blob)},onKeyDown:X=>X.stopPropagation(),children:[f.jsx(ut,{name:"clock"}),"Open this version"]}),f.jsxs("a",{className:"hver-btn",download:!0,href:be,"aria-label":`Download ${V} as of ${ve}`,onClick:X=>X.stopPropagation(),onKeyDown:X=>{X.stopPropagation(),X.key===" "&&(X.preventDefault(),X.currentTarget.click())},children:[f.jsx(ut,{name:"download"}),"Download"]})]})]}),R&&i.prev&&v&&f.jsx("div",{onClick:X=>X.stopPropagation(),children:f.jsx(HI,{apiBase:i.apiBase,path:e.path,prev:i.prev,cur:e.blob})})]})}function qI(e){const{node:n,heatMap:r,onOpen:i}=e,o=(n.children||[]).slice().sort((m,y)=>Number(y.dir||!1)-Number(m.dir||!1)||m.name.localeCompare(y.name)),l=o.filter(m=>m.dir).length,u=o.length-l,d=[];l&&d.push(l+(l===1?" folder":" folders")),u&&d.push(u+(u===1?" file":" files"));const p=sw(r,n.path,!0);return p&&d.push(Xo(p)+" in 30 days"),f.jsxs("div",{className:"dirlist",children:[f.jsxs("h1",{className:"dl-title",children:[f.jsx("span",{className:"dl-title-icon",children:f.jsx(ut,{name:"folder"})}),f.jsx("span",{children:n.name})]}),f.jsx("p",{className:"dl-sub",children:d.join(" · ")||"Empty folder"}),o.length===0?f.jsx("div",{className:"dl-empty",children:"Nothing in this folder yet."}):f.jsx("div",{className:"dl-items",children:o.map(m=>{let y="";if(m.dir){const b=(m.children||[]).length;y=b+(b===1?" item":" items")}else y=[m.size?mg(m.size):"",m.time?new Date(m.time).toLocaleDateString():""].filter(Boolean).join(" · ");const v=sw(r,m.path,!!m.dir);return v&&(y=Xo(v)+(y?" · "+y:"")),f.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:[f.jsx("span",{className:"ticon",children:f.jsx(ut,{name:m.dir?"folder":"doc"})}),f.jsx("span",{className:"dl-name",children:m.name}),v&&f.jsx("span",{className:"heatdot lvl"+tI(v),role:"img","aria-label":Xo(v)+" in 30 days",title:Xo(v)+" in 30 days"}),f.jsx("span",{className:"dl-meta",children:y})]},m.path)})}),e.hub&&f.jsx(GI,{apiBase:e.apiBase,prefix:n.path+"/",onOpen:i,onFullHistory:()=>e.onFullHistory(n.path+"/"),onRendered:e.onRendered})]})}function GI(e){const n=hI(e.apiBase,e.prefix,!0),{onRendered:r}=e;return w.useEffect(()=>{n&&n.length&&r&&r()},[n,r]),!n||n.length===0?null:f.jsxs("div",{className:"dl-history",children:[f.jsx("h3",{className:"dl-h3",children:"Recent changes"}),f.jsx("div",{className:"history dl-hlist",children:n.map((i,o)=>f.jsx(pg,{entry:i,apiBase:e.apiBase,onOpen:e.onOpen},o))}),f.jsx("button",{className:"ai-btn dl-more",onClick:e.onFullHistory,children:"Full history"})]})}const YC=5e3;function ZI(e,n,r=YC){const i=[];let o=[],l="",u=!1,d=0;const p=()=>{o.push(l),l="",i.length()=>o(""),[r,o]),b$.test(r)?f.jsx(XI,{...e}):OC.test(r)?f.jsx("iframe",{className:"htmlview",sandbox:"allow-scripts",src:l,title:r,onLoad:e.onRendered}):AC.test(r)?f.jsx("iframe",{className:"pdfview",src:l,title:r,onLoad:e.onRendered}):x$.test(r)?f.jsx(eP,{src:l,alt:r,version:i,onRendered:e.onRendered}):w$.test(r)?f.jsx(dw,{...e,fileURL:l,delim:/\.tsv$/i.test(r)?" ":","}):S$.test(r)?f.jsx(dw,{...e,fileURL:l}):f.jsx(YI,{...e,fileURL:l})}function YI(e){const{apiBase:n,path:r,version:i,fileURL:o,onRendered:l}=e,{data:u,error:d}=ZC(o,["text",o],!0,!!i);return w.useEffect(()=>{u&&l?.()},[u,l]),d?f.jsx(fd,{version:i,err:d}):u?u.kind==="text"?f.jsx("pre",{className:"plain",children:u.text},r):f.jsx(QI,{apiBase:n,path:r,version:i,fileURL:o,children:u.kind==="too-large"?`Too large to preview (${mg(u.size)}).`:"No preview for this file type."}):null}function QI(e){const{apiBase:n,path:r,version:i,fileURL:o}=e;return f.jsxs("div",{className:"filecard",children:[f.jsx("div",{className:"name",children:r.split("/").pop()}),f.jsx("p",{children:e.children}),f.jsx("a",{className:"btn",download:!0,href:i?o+"&download=1":n+"download?path="+encodeURIComponent(r),children:"Download"})]})}function XI(e){const{apiBase:n,path:r,version:i,heatMap:o,flatFiles:l,onOpenFile:u,onMeta:d,onRendered:p}=e,{data:m,error:y}=Pt({queryKey:["render",n,r,i||""],queryFn:()=>Bt(n+"render?path="+encodeURIComponent(r)+(i?"&sha="+i:"")),retry:i?!1:void 0}),v=w.useMemo(()=>m?WI(m.html,r,n):"",[m,r,n]);return w.useEffect(()=>{if(!m)return;const b=[];(m.user_name||m.user||m.author)&&b.push(dd(m)+(m.device?" on "+m.device:"")),m.time&&b.push(new Date(m.time).toLocaleString());const x=i?null:o&&o[m.path];x&&ka(x)&&b.push(Xo(x)+" / 30d"),d(b.join(" · ")),p?.()},[m,i,o,d,p]),y?f.jsx(fd,{version:i,err:y}):m?f.jsx("div",{dangerouslySetInnerHTML:{__html:v},onClick:b=>JI(b,r,l,u)}):null}function JI(e,n,r,i){const o=e.target.closest("a");if(!o||!e.currentTarget.contains(o))return;const l=o.getAttribute("href")||"",u=n.includes("/")?n.slice(0,n.lastIndexOf("/")):"";l.startsWith("wiki:")?(e.preventDefault(),nP(decodeURIComponent(l.slice(5)),r,i)):/^([a-z]+:|\/|#)/i.test(l)||(e.preventDefault(),i(MC(u,decodeURIComponent(l))))}function WI(e,n,r){const i=n.includes("/")?n.slice(0,n.lastIndexOf("/")):"",o=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")||"";/^\s*data:image\/svg/i.test(d)?u.removeAttribute("src"):/^([a-z]+:|\/)/i.test(d)||u.setAttribute("src",o(MC(i,d)))}for(const u of l.querySelectorAll("a")){const d=u.getAttribute("href")||"";/^\s*data:/i.test(d)?u.removeAttribute("href"):/^https?:/i.test(d)&&(u.setAttribute("target","_blank"),u.setAttribute("rel","noopener"))}return l.body.innerHTML}function eP(e){const[n,r]=w.useState(!1);return n?f.jsx(fd,{version:e.version,err:new Error("could not be loaded")}):f.jsx("img",{src:e.src,alt:e.alt,onLoad:e.onRendered,onError:()=>r(!0)})}function fd({version:e,err:n}){return f.jsx("div",{className:"empty",children:e?"That version isn't available.":"Could not load file: "+n.message})}function dw(e){const{path:n,version:r,fileURL:i,delim:o,onRendered:l}=e,{data:u,error:d}=Pt({queryKey:["text",i],queryFn:async()=>{const m=await fetch(i);if(!m.ok)throw new Error(await m.text());return m.text()},retry:r?!1:void 0});w.useEffect(()=>{u!=null&&l?.()},[u,l]);const p=w.useMemo(()=>o&&u!=null?ZI(u,o,YC):null,[u,o]);return d?f.jsx(fd,{version:r,err:d}):u==null?null:p?f.jsx(tP,{csv:p},n):f.jsx("pre",{className:"plain",children:u},n)}function tP({csv:e}){const[n,...r]=e.rows,i=e.rows.reduce((l,u)=>Math.max(l,u.length),0),o=Array.from({length:i},(l,u)=>u);return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"csvbox",children:f.jsxs("table",{className:"csvview",children:[f.jsx("thead",{children:f.jsx("tr",{children:o.map(l=>f.jsx("th",{children:n[l]??""},l))})}),f.jsx("tbody",{children:r.map((l,u)=>f.jsx("tr",{children:o.map(d=>f.jsx("td",{children:l[d]??""},d))},u))})]})}),e.truncated>0&&f.jsxs("p",{className:"csvnote",children:["showing ",e.rows.length.toLocaleString()," of"," ",(e.rows.length+e.truncated).toLocaleString()," rows — Download for the rest"]})]})}function nP(e,n,r){const i=e.toLowerCase(),o=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"});o&&r(o.path)}const rP=[{value:"",label:"Never"},{value:"24h",label:"In 24 hours"},{value:"168h",label:"In 7 days"},{value:"720h",label:"In 30 days"}];function aP({url:e,copied:n,onClose:r}){const i=e.split("/s/")[1],[o,l]=w.useState(""),[u,d]=w.useState(),[p,m]=w.useState(!1),y=w.useRef(null);async function v(b){const x=o;l(b),m(!0);try{const S=await Wn("PATCH","/api/shares/"+i,{expires_in:b});d(S.expires)}catch(S){Ke(S.message,!0),l(x)}finally{m(!1)}}return f.jsx(Ju,{open:!0,onOpenChange:b=>!b&&r(),children:f.jsxs(Wu,{className:"modal",showCloseButton:!1,onOpenAutoFocus:b=>{b.preventDefault(),y.current?.focus()},children:[f.jsx(Sl,{asChild:!0,children:f.jsx("h3",{children:"Public link"})}),f.jsxs("p",{children:[f.jsx("b",{children:"Anyone with this link can view this file"})," — no account needed. It always shows the latest version until it expires or you revoke it."]}),f.jsx("div",{className:"modal-url",children:e}),f.jsxs("div",{className:"modal-expiry",children:[f.jsx("label",{htmlFor:"share-expiry",children:"Expires"}),f.jsx("select",{id:"share-expiry",value:o,disabled:p,onChange:b=>v(b.target.value),children:rP.map(b=>f.jsx("option",{value:b.value,children:b.label},b.value))}),f.jsx("span",{className:"modal-expiry-note",children:zC(u)})]}),f.jsxs("div",{className:"modal-actions",children:[f.jsx(vt,{ref:y,variant:"primary",onClick:()=>Bs(e).then(b=>Ke(b?"Copied.":"Select and copy the link above.")),children:n?"Copied ✓":"Copy link"}),f.jsx(vt,{variant:"subtle",onClick:()=>window.open(e,"_blank"),children:"Open"}),f.jsx(vt,{variant:"subtle",onClick:r,children:"Done"})]})]})})}function iP({shares:e,canRevoke:n,onChanged:r}){return e.length===0?null:f.jsxs("div",{className:"share-banner",role:"status",children:[f.jsxs("div",{className:"sb-head",children:[f.jsx(ut,{name:"share"}),f.jsx("b",{children:"Publicly shared"}),f.jsxs("span",{className:"sb-count",children:[e.length," active link",e.length>1?"s":""]})]}),f.jsxs("p",{className:"sb-note",children:[f.jsx("b",{children:"Anyone with this link can view this file"})," — no account needed. It always shows the latest version until you revoke it.",e.some(i=>i.opens!==void 0)&&f.jsxs(f.Fragment,{children:[" ",LC]})]}),e.map(i=>f.jsxs("div",{className:"sb-link",children:[f.jsx("span",{className:"sb-url mono",title:i.url,children:i.url}),f.jsx("span",{className:"sb-meta",children:kC(i,!1)}),f.jsxs("span",{className:"sb-actions",children:[f.jsx(vt,{variant:"subtle",onClick:()=>Bs(i.url).then(o=>Ke(o?"Copied.":"Select and copy the link.")),children:"Copy link"}),f.jsx(vt,{variant:"subtle",onClick:()=>window.open(i.url,"_blank"),children:"Open"}),n&&f.jsx("button",{className:"ai-del","aria-label":`Revoke the share of ${i.path}`,onClick:()=>IC(i,r),children:"Revoke"})]})]},i.token))]})}var fw=1,sP=.9,oP=.8,lP=.17,sm=.1,om=.999,cP=.9999,uP=.99,dP=/[\\\/_+.#"@\[\(\{&]/,fP=/[\\\/_+.#"@\[\(\{&]/g,hP=/[\s-]/,QC=/[\s-]/g;function Wm(e,n,r,i,o,l,u){if(l===n.length)return o===e.length?fw:uP;var d=`${o},${l}`;if(u[d]!==void 0)return u[d];for(var p=i.charAt(l),m=r.indexOf(p,o),y=0,v,b,x,S;m>=0;)v=Wm(e,n,r,i,m+1,l+1,u),v>y&&(m===o?v*=fw:dP.test(e.charAt(m-1))?(v*=oP,x=e.slice(o,m-1).match(fP),x&&o>0&&(v*=Math.pow(om,x.length))):hP.test(e.charAt(m-1))?(v*=sP,S=e.slice(o,m-1).match(QC),S&&o>0&&(v*=Math.pow(om,S.length))):(v*=lP,o>0&&(v*=Math.pow(om,m-o))),e.charAt(m)!==n.charAt(l)&&(v*=cP)),(vv&&(v=b*sm)),v>y&&(y=v),m=r.indexOf(p,m+1);return u[d]=y,y}function hw(e){return e.toLowerCase().replace(QC," ")}function mP(e,n,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,Wm(e,n,hw(e),hw(n),0,0,{})}var Go='[cmdk-group=""]',lm='[cmdk-group-items=""]',pP='[cmdk-group-heading=""]',XC='[cmdk-item=""]',mw=`${XC}:not([aria-disabled="true"])`,ep="cmdk-item-select",Os="data-value",gP=(e,n,r)=>mP(e,n,r),JC=w.createContext(void 0),jl=()=>w.useContext(JC),WC=w.createContext(void 0),gg=()=>w.useContext(WC),eE=w.createContext(void 0),tE=w.forwardRef((e,n)=>{let r=As(()=>{var N,B;return{search:"",value:(B=(N=e.value)!=null?N:e.defaultValue)!=null?B:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),i=As(()=>new Set),o=As(()=>new Map),l=As(()=>new Map),u=As(()=>new Set),d=nE(e),{label:p,children:m,value:y,onValueChange:v,filter:b,shouldFilter:x,loop:S,disablePointerSelection:_=!1,vimBindings:E=!0,...R}=e,T=dn(),O=dn(),M=dn(),D=w.useRef(null),P=jP();Oi(()=>{if(y!==void 0){let N=y.trim();r.current.value=N,F.emit()}},[y]),Oi(()=>{P(6,X)},[]);let F=w.useMemo(()=>({subscribe:N=>(u.current.add(N),()=>u.current.delete(N)),snapshot:()=>r.current,setState:(N,B,J)=>{var Y,le,ae,ye;if(!Object.is(r.current[N],B)){if(r.current[N]=B,N==="search")ue(),be(),P(1,he);else if(N==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let xe=document.getElementById(M);xe?xe.focus():(Y=document.getElementById(T))==null||Y.focus()}if(P(7,()=>{var xe;r.current.selectedItemId=(xe=pe())==null?void 0:xe.id,F.emit()}),J||P(5,X),((le=d.current)==null?void 0:le.value)!==void 0){let xe=B??"";(ye=(ae=d.current).onValueChange)==null||ye.call(ae,xe);return}}F.emit()}},emit:()=>{u.current.forEach(N=>N())}}),[]),V=w.useMemo(()=>({value:(N,B,J)=>{var Y;B!==((Y=l.current.get(N))==null?void 0:Y.value)&&(l.current.set(N,{value:B,keywords:J}),r.current.filtered.items.set(N,ve(B,J)),P(2,()=>{be(),F.emit()}))},item:(N,B)=>(i.current.add(N),B&&(o.current.has(B)?o.current.get(B).add(N):o.current.set(B,new Set([N]))),P(3,()=>{ue(),be(),r.current.value||he(),F.emit()}),()=>{l.current.delete(N),i.current.delete(N),r.current.filtered.items.delete(N);let J=pe();P(4,()=>{ue(),J?.getAttribute("id")===N&&he(),F.emit()})}),group:N=>(o.current.has(N)||o.current.set(N,new Set),()=>{l.current.delete(N),o.current.delete(N)}),filter:()=>d.current.shouldFilter,label:p||e["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:T,inputId:M,labelId:O,listInnerRef:D}),[]);function ve(N,B){var J,Y;let le=(Y=(J=d.current)==null?void 0:J.filter)!=null?Y:gP;return N?le(N,r.current.search,B):0}function be(){if(!r.current.search||d.current.shouldFilter===!1)return;let N=r.current.filtered.items,B=[];r.current.filtered.groups.forEach(Y=>{let le=o.current.get(Y),ae=0;le.forEach(ye=>{let xe=N.get(ye);ae=Math.max(xe,ae)}),B.push([Y,ae])});let J=D.current;ge().sort((Y,le)=>{var ae,ye;let xe=Y.getAttribute("id"),Oe=le.getAttribute("id");return((ae=N.get(Oe))!=null?ae:0)-((ye=N.get(xe))!=null?ye:0)}).forEach(Y=>{let le=Y.closest(lm);le?le.appendChild(Y.parentElement===le?Y:Y.closest(`${lm} > *`)):J.appendChild(Y.parentElement===J?Y:Y.closest(`${lm} > *`))}),B.sort((Y,le)=>le[1]-Y[1]).forEach(Y=>{var le;let ae=(le=D.current)==null?void 0:le.querySelector(`${Go}[${Os}="${encodeURIComponent(Y[0])}"]`);ae?.parentElement.appendChild(ae)})}function he(){let N=ge().find(J=>J.getAttribute("aria-disabled")!=="true"),B=N?.getAttribute(Os);F.setState("value",B||void 0)}function ue(){var N,B,J,Y;if(!r.current.search||d.current.shouldFilter===!1){r.current.filtered.count=i.current.size;return}r.current.filtered.groups=new Set;let le=0;for(let ae of i.current){let ye=(B=(N=l.current.get(ae))==null?void 0:N.value)!=null?B:"",xe=(Y=(J=l.current.get(ae))==null?void 0:J.keywords)!=null?Y:[],Oe=ve(ye,xe);r.current.filtered.items.set(ae,Oe),Oe>0&&le++}for(let[ae,ye]of o.current)for(let xe of ye)if(r.current.filtered.items.get(xe)>0){r.current.filtered.groups.add(ae);break}r.current.filtered.count=le}function X(){var N,B,J;let Y=pe();Y&&(((N=Y.parentElement)==null?void 0:N.firstChild)===Y&&((J=(B=Y.closest(Go))==null?void 0:B.querySelector(pP))==null||J.scrollIntoView({block:"nearest"})),Y.scrollIntoView({block:"nearest"}))}function pe(){var N;return(N=D.current)==null?void 0:N.querySelector(`${XC}[aria-selected="true"]`)}function ge(){var N;return Array.from(((N=D.current)==null?void 0:N.querySelectorAll(mw))||[])}function L(N){let B=ge()[N];B&&F.setState("value",B.getAttribute(Os))}function K(N){var B;let J=pe(),Y=ge(),le=Y.findIndex(ye=>ye===J),ae=Y[le+N];(B=d.current)!=null&&B.loop&&(ae=le+N<0?Y[Y.length-1]:le+N===Y.length?Y[0]:Y[le+N]),ae&&F.setState("value",ae.getAttribute(Os))}function re(N){let B=pe(),J=B?.closest(Go),Y;for(;J&&!Y;)J=N>0?EP(J,Go):RP(J,Go),Y=J?.querySelector(mw);Y?F.setState("value",Y.getAttribute(Os)):K(N)}let W=()=>L(ge().length-1),te=N=>{N.preventDefault(),N.metaKey?W():N.altKey?re(1):K(1)},z=N=>{N.preventDefault(),N.metaKey?L(0):N.altKey?re(-1):K(-1)};return w.createElement($e.div,{ref:n,tabIndex:-1,...R,"cmdk-root":"",onKeyDown:N=>{var B;(B=R.onKeyDown)==null||B.call(R,N);let J=N.nativeEvent.isComposing||N.keyCode===229;if(!(N.defaultPrevented||J))switch(N.key){case"n":case"j":{E&&N.ctrlKey&&te(N);break}case"ArrowDown":{te(N);break}case"p":case"k":{E&&N.ctrlKey&&z(N);break}case"ArrowUp":{z(N);break}case"Home":{N.preventDefault(),L(0);break}case"End":{N.preventDefault(),W();break}case"Enter":{N.preventDefault();let Y=pe();if(Y){let le=new Event(ep);Y.dispatchEvent(le)}}}}},w.createElement("label",{"cmdk-label":"",htmlFor:V.inputId,id:V.labelId,style:OP},p),md(e,N=>w.createElement(WC.Provider,{value:F},w.createElement(JC.Provider,{value:V},N))))}),vP=w.forwardRef((e,n)=>{var r,i;let o=dn(),l=w.useRef(null),u=w.useContext(eE),d=jl(),p=nE(e),m=(i=(r=p.current)==null?void 0:r.forceMount)!=null?i:u?.forceMount;Oi(()=>{if(!m)return d.item(o,u?.id)},[m]);let y=rE(o,l,[e.value,e.children,l],e.keywords),v=gg(),b=qa(P=>P.value&&P.value===y.current),x=qa(P=>m||d.filter()===!1?!0:P.search?P.filtered.items.get(o)>0:!0);w.useEffect(()=>{let P=l.current;if(!(!P||e.disabled))return P.addEventListener(ep,S),()=>P.removeEventListener(ep,S)},[x,e.onSelect,e.disabled]);function S(){var P,F;_(),(F=(P=p.current).onSelect)==null||F.call(P,y.current)}function _(){v.setState("value",y.current,!0)}if(!x)return null;let{disabled:E,value:R,onSelect:T,forceMount:O,keywords:M,...D}=e;return w.createElement($e.div,{ref:Ps(l,n),...D,id:o,"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:S},e.children)}),yP=w.forwardRef((e,n)=>{let{heading:r,children:i,forceMount:o,...l}=e,u=dn(),d=w.useRef(null),p=w.useRef(null),m=dn(),y=jl(),v=qa(x=>o||y.filter()===!1?!0:x.search?x.filtered.groups.has(u):!0);Oi(()=>y.group(u),[]),rE(u,d,[e.value,e.heading,p]);let b=w.useMemo(()=>({id:u,forceMount:o}),[o]);return w.createElement($e.div,{ref:Ps(d,n),...l,"cmdk-group":"",role:"presentation",hidden:v?void 0:!0},r&&w.createElement("div",{ref:p,"cmdk-group-heading":"","aria-hidden":!0,id:m},r),md(e,x=>w.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?m:void 0},w.createElement(eE.Provider,{value:b},x))))}),bP=w.forwardRef((e,n)=>{let{alwaysRender:r,...i}=e,o=w.useRef(null),l=qa(u=>!u.search);return!r&&!l?null:w.createElement($e.div,{ref:Ps(o,n),...i,"cmdk-separator":"",role:"separator"})}),xP=w.forwardRef((e,n)=>{let{onValueChange:r,...i}=e,o=e.value!=null,l=gg(),u=qa(m=>m.search),d=qa(m=>m.selectedItemId),p=jl();return w.useEffect(()=>{e.value!=null&&l.setState("search",e.value)},[e.value]),w.createElement($e.input,{ref:n,...i,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":p.listId,"aria-labelledby":p.labelId,"aria-activedescendant":d,id:p.inputId,type:"text",value:o?e.value:u,onChange:m=>{o||l.setState("search",m.target.value),r?.(m.target.value)}})}),wP=w.forwardRef((e,n)=>{let{children:r,label:i="Suggestions",...o}=e,l=w.useRef(null),u=w.useRef(null),d=qa(m=>m.selectedItemId),p=jl();return w.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)}}},[]),w.createElement($e.div,{ref:Ps(l,n),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":i,id:p.listId},md(e,m=>w.createElement("div",{ref:Ps(u,p.listInnerRef),"cmdk-list-sizer":""},m)))}),SP=w.forwardRef((e,n)=>{let{open:r,onOpenChange:i,overlayClassName:o,contentClassName:l,container:u,...d}=e;return w.createElement(hp,{open:r,onOpenChange:i},w.createElement(pp,{container:u},w.createElement(gp,{"cmdk-overlay":"",className:o}),w.createElement(vp,{"aria-label":e.label,"cmdk-dialog":"",className:l},w.createElement(tE,{ref:n,...d}))))}),_P=w.forwardRef((e,n)=>qa(r=>r.filtered.count===0)?w.createElement($e.div,{ref:n,...e,"cmdk-empty":"",role:"presentation"}):null),CP=w.forwardRef((e,n)=>{let{progress:r,children:i,label:o="Loading...",...l}=e;return w.createElement($e.div,{ref:n,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},md(e,u=>w.createElement("div",{"aria-hidden":!0},u)))}),hd=Object.assign(tE,{List:wP,Item:vP,Input:xP,Group:yP,Separator:bP,Dialog:SP,Empty:_P,Loading:CP});function EP(e,n){let r=e.nextElementSibling;for(;r;){if(r.matches(n))return r;r=r.nextElementSibling}}function RP(e,n){let r=e.previousElementSibling;for(;r;){if(r.matches(n))return r;r=r.previousElementSibling}}function nE(e){let n=w.useRef(e);return Oi(()=>{n.current=e}),n}var Oi=typeof window>"u"?w.useEffect:w.useLayoutEffect;function As(e){let n=w.useRef();return n.current===void 0&&(n.current=e()),n}function qa(e){let n=gg(),r=()=>e(n.snapshot());return w.useSyncExternalStore(n.subscribe,r,r)}function rE(e,n,r,i=[]){let o=w.useRef(),l=jl();return Oi(()=>{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():o.current}})(),p=i.map(m=>m.trim());l.value(e,d,p),(u=n.current)==null||u.setAttribute(Os,d),o.current=d}),o}var jP=()=>{let[e,n]=w.useState(),r=As(()=>new Map);return Oi(()=>{r.current.forEach(i=>i()),r.current=new Map},[e]),(i,o)=>{r.current.set(i,o),n({})}};function TP(e){let n=e.type;return typeof n=="function"?n(e.props):"render"in n?n.render(e.props):e}function md({asChild:e,children:n},r){return e&&w.isValidElement(n)?w.cloneElement(TP(n),{ref:n.ref},r(n.props.children)):r(n)}var OP={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function AP({className:e,...n}){return f.jsx(hd,{"data-slot":"command",className:Je("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...n})}function MP({className:e,...n}){return f.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[f.jsx(b_,{className:"size-4 shrink-0 opacity-50"}),f.jsx(hd.Input,{"data-slot":"command-input",className:Je("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 NP({className:e,...n}){return f.jsx(hd.List,{"data-slot":"command-list",className:Je("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...n})}function DP({className:e,...n}){return f.jsx(hd.Item,{"data-slot":"command-item",className:Je("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 pw(e,n){if(!e)return{score:0,hits:[]};const r=e.toLowerCase(),i=n.toLowerCase();let o=0,l=0,u=0;const d=[];for(let p=0;p3&&i.endsWith("ies")?o=i.slice(0,-3)+"y":i.length>3&&i.endsWith("es")?o=i.slice(0,-2):i.length>2&&i.endsWith("s")&&(o=i.slice(0,-1)),o?pw(o,n):null}function kP({text:e,hits:n}){const r=[];let i=0;return n.forEach((o,l)=>{o>i&&r.push(e.slice(i,o)),r.push(f.jsx("b",{children:e[o]},l)),i=o+1}),r.push(e.slice(i)),f.jsx("span",{className:"plabel",children:r})}function LP({open:e,onClose:n,candidates:r}){const[i,o]=w.useState(""),l=w.useMemo(()=>{if(!e)return[];const d=[];for(const p of r()){const m=zP(i,p.label);m&&d.push({...p,score:m.score,hits:m.hits})}return d.sort((p,m)=>m.score-p.score),d.slice(0,40)},[e,i,r]);w.useEffect(()=>{e&&o("")},[e]);const u=d=>{n(),d.run()};return f.jsx(Ju,{open:e,onOpenChange:d=>!d&&n(),children:f.jsxs(Wu,{id:"palette",className:"palette",showCloseButton:!1,"aria-describedby":void 0,children:[f.jsx(Sl,{className:"sr-only",children:"Search and quick actions"}),f.jsxs(AP,{shouldFilter:!1,loop:!0,children:[f.jsxs("div",{id:"palette-inputwrap",children:[f.jsx(ut,{name:"search"}),f.jsx(MP,{placeholder:"Search file names, projects, actions…",autoComplete:"off",spellCheck:!1,value:i,onValueChange:o})]}),f.jsx(NP,{children:l.length===0?f.jsx("div",{className:"pempty",children:"No matches — search covers file names, projects, and actions"}):l.map(d=>f.jsxs(DP,{value:d.kind+":"+d.label,onSelect:()=>u(d),children:[f.jsx("span",{className:"picon",children:f.jsx(ut,{name:d.icon})}),f.jsx(kP,{text:d.label,hits:d.hits}),f.jsx("span",{className:"pkind",children:d.kind})]},d.kind+":"+d.label))}),f.jsx("footer",{id:"palette-hint",children:"↑↓ navigate · ⏎ select · esc close"})]})]})})}const Jo=3,Ms=30;function $P(e,n){return Pt({queryKey:["heatDevices",e],queryFn:()=>Bt(e+"heat?by=device&days=30"),enabled:n,retry:!1,staleTime:6e4}).data?.devices??null}const IP=["all","human","agent","share"],PP={all:"All reads",human:"Human reads",agent:"Agent reads",share:"Shared reads"},FP={agent:{agent:1,human:0,share:0},human:{agent:0,human:1,share:0},share:{agent:0,human:0,share:1}};function gw(e){const[n,r]=w.useState("all"),{flatFiles:i,heatMap:o,devices:l,scope:u}=e,d=S=>!u||S===u||S.startsWith(u+"/"),p=u?i.filter(S=>d(S.path)):i;if(!e.loading&&!p.length)return f.jsxs("div",{className:"insights",children:[f.jsxs("h1",{className:"in-title",children:["Knowledge insights",u?f.jsxs("span",{className:"in-scope",children:[" · ",u]}):null]}),f.jsxs("div",{className:"dl-empty in-blank",children:[f.jsx("p",{children:u?`Nothing in ${u} to chart yet.`:"Nothing to chart yet."}),f.jsx("p",{children:u?`No files under ${u} are syncing here yet.`:"This project has no files. Once a device syncs files here, the map, the reads × freshness plot and the hot path fill in on their own."}),e.installHref&&f.jsx("a",{className:"pbtn",...Hs(e.installHref),children:"Set up a device →"})]})]});const m=l&&u?l.map(S=>{const _=Object.create(null);for(const[E,R]of Object.entries(S.folders||{}))d(E)&&(_[E]=R);return{...S,folders:_}}).filter(S=>Object.keys(S.folders).length>0):l,y=Date.now(),v=p.map(S=>{const _=o&&o[S.path]||{},E=S.time?Math.max(0,(y-new Date(S.time).getTime())/864e5):0,R=n==="all"?ka(_):_[n]||0;return{path:S.path,reads:R,agent:_.agent||0,human:_.human||0,share:_.share||0,total:ka(_),days:E,danger:R>=Jo&&E>=Ms}}),b=rI(o,new Set(i.map(S=>S.path))).filter(d).map(S=>{const _=o[S];return{path:S,reads:n==="all"?ka(_):_[n]||0,agent:_.agent||0,human:_.human||0,share:_.share||0,total:ka(_),days:0,danger:!1,orphan:!0}}).filter(S=>S.reads>0),x=b.length>0?f.jsxs("p",{className:"in-legend in-orphan-note",children:[tp(b.length,"file")," with reads ",b.length===1?"is":"are"," no longer in the project — see Hot path."]}):null;return f.jsxs("div",{className:"insights",children:[f.jsxs("h1",{className:"in-title",children:["Knowledge insights",u?f.jsxs("span",{className:"in-scope",children:[" · ",u]}):null]}),f.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."}),f.jsx("div",{className:"in-lens",children:IP.map(S=>f.jsx("button",{className:"in-lens-btn"+(S===n?" active":""),onClick:()=>r(S),children:PP[S]},S))}),f.jsx("h3",{className:"dl-h3",children:"Map — cell size = reads, color = freshness (scale below)"}),f.jsx(UP,{pts:v,onOpenFile:e.onOpenFile,onOpenFolder:e.onOpenFolder,isFolder:e.isFolder}),x,f.jsxs("h3",{className:"dl-h3 in-h3-row",children:["Reads × freshness",f.jsx("span",{className:"in-cap",children:"dot size = agent share of reads"})]}),f.jsx(BP,{pts:v,onOpenFile:e.onOpenFile}),x,f.jsx("h3",{className:"dl-h3",children:"Hot path — top files by reads"}),f.jsx(qP,{pts:[...v,...b],lens:n,onOpenFile:e.onOpenFile,onOpenHistory:e.onOpenHistory}),m&&m.length>0&&f.jsxs(f.Fragment,{children:[f.jsx("h3",{className:"dl-h3",children:"Agent coverage — which agents read which areas"}),f.jsx(GP,{devices:m})]})]})}const VP="rgb(150,156,164)";function aE(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)),o=r-i,l=n[i].map((u,d)=>Math.round(u+(n[i+1][d]-u)*o));return`rgb(${l[0]},${l[1]},${l[2]})`}function vw(e,n,r,i,o){const l=e.reduce((m,y)=>m+y.value,0);if(!l||i<=0||o<=0)return[];const u=e.slice().sort((m,y)=>y.value-m.value).map(m=>({it:m,a:m.value/l*i*o})),d=(m,y)=>{const b=m.reduce((S,_)=>S+_.a,0)/y;let x=0;for(const S of m){const _=S.a/b;x=Math.max(x,_/b,b/_)}return x},p=[];for(;u.length;){const m=i>=o,y=m?o:i,v=[u.shift()];for(;u.length&&d(v.concat(u[0]),y)<=d(v,y);)v.push(u.shift());const b=v.reduce((S,_)=>S+_.a,0)/y;let x=0;for(const S of v){const _=S.a/b;m?p.push({item:S.it,x:n,y:r+x,w:b,h:_}):p.push({item:S.it,x:n+x,y:r,w:_,h:b}),x+=_}m?(n+=b,i-=b):(r+=b,o-=b)}return p}const cm=15;function yw(e,n,r){const i=Math.floor((r-8)/6),o=`${e} · ${n}`;return o.length<=i?{label:o,fit:i}:{label:e.length>i?e.slice(0,Math.max(1,i-1))+"…":e,fit:i}}const tp=(e,n)=>`${e} ${n}${e===1?"":"s"}`;function UP({pts:e,onOpenFile:n,onOpenFolder:r,isFolder:i}){const u=iI(e.map(y=>y.days)),d=!!u&&sI(u.min,u.max),p=new Map;for(const y of e){const v=y.path.includes("/")?y.path.split("/")[0]:"/";let b=p.get(v);b||p.set(v,b={name:v,files:[],value:0,reads:0}),b.files.push(y),b.value+=y.reads+1,b.reads+=y.reads}const m=[];for(const y of vw([...p.values()],0,0,720,480)){const v=y.item,b=v.name==="/"?"":v.name,x=v.name==="/"?"(root)":v.name;if(m.push(f.jsx("rect",{x:y.x+1,y:y.y+1,width:Math.max(0,y.w-2),height:Math.max(0,y.h-2),rx:3,className:"in-tm-group","data-dir":b,children:f.jsx("title",{children:`${v.name==="/"?"(root)":v.name+"/"} — ${tp(v.reads,"read")}/30d · ${tp(v.files.length,"file")}`})},"g"+v.name)),y.w>46&&y.h>cm+10){const{label:_}=yw(x,v.reads,y.w);m.push(f.jsx("text",{x:y.x+5,y:y.y+12,className:"in-tm-glabel","data-dir":b,children:_},"gl"+v.name))}const S=vw(v.files.map(_=>({..._,name:_.path.split("/").pop(),value:_.reads+1})),y.x+2,y.y+cm,Math.max(0,y.w-4),Math.max(0,y.h-cm-2));for(const _ of S)if(m.push(f.jsx("rect",{x:_.x+.6,y:_.y+.6,width:Math.max(.4,_.w-1.2),height:Math.max(.4,_.h-1.2),rx:1.5,fill:d?VP:aE(_.item.days),className:"in-tm-cell","data-path":_.item.path,children:f.jsx("title",{children:`${_.item.path} — ${_.item.reads} read${_.item.reads===1?"":"s"}/30d · changed ${Math.round(_.item.days)}d ago`})},_.item.path)),_.w>54&&_.h>16){const{label:E,fit:R}=yw((_.item.danger?"⚠ ":"")+_.item.name,_.item.reads,_.w);R>=5&&m.push(f.jsx("text",{x:_.x+4.5,y:_.y+12.5,className:"in-tm-label","data-path":_.item.path,children:E},"l"+_.item.path))}}return f.jsxs(f.Fragment,{children:[f.jsx("svg",{viewBox:"0 0 720 480",className:"in-chart in-treemap",onClick:y=>{const v=y.target.closest("[data-path], [data-dir]");if(!v)return;const b=v.getAttribute("data-path");if(b)return n(b);const x=v.getAttribute("data-dir");x&&i(x)&&r(x)},children:m}),f.jsx(HP,{range:u,flat:d})]})}function HP({range:e,flat:n}){if(!e)return null;const r=oI(e.min,e.max);return f.jsxs("p",{className:"in-legend in-tm-legend",children:["freshness 0d",f.jsx("span",{className:"in-sw in-sw-age"+(n?" in-sw-flat":""),style:{background:`linear-gradient(to right, ${[0,60,150,300].map(aE).join(", ")})`}}),"300d+",f.jsx("span",{className:"in-tm-range",children:n?`all files here: ${r} old — colour off, not enough range to rank`:`observed: ${r} old`})]})}function BP({pts:e,onOpenFile:n}){const o={l:44,r:16,t:20,b:34},l=Math.max(Ms*2,...e.map(S=>S.days)),u=Math.max(Jo*2,...e.map(S=>S.reads)),d=S=>Math.log10(S+1)/Math.log10(l+1),p=S=>Math.log10(S+1)/Math.log10(u+1),m=S=>3+4*S,y=m(1),v=S=>o.l+y+d(S)*(720-o.l-o.r-2*y),b=S=>360-o.b-y-p(S)*(360-o.t-o.b-2*y),x=uI(e.filter(S=>S.danger).map(S=>({path:S.path,reads:S.reads,cx:v(S.days),cy:b(S.reads),r:m(S.total?(S.agent||0)/S.total:0)})),{right:720-o.r,top:o.t+8,bottom:360-o.b-4});return f.jsxs("svg",{viewBox:"0 0 720 360",className:"in-chart",children:[f.jsx("rect",{x:v(Ms),y:o.t,width:720-o.r-v(Ms),height:b(Jo)-o.t,className:"in-danger-zone"}),f.jsx("line",{x1:v(Ms),y1:o.t,x2:v(Ms),y2:360-o.b,className:"in-threshold"}),f.jsx("line",{x1:o.l,y1:b(Jo),x2:720-o.r,y2:b(Jo),className:"in-threshold"}),f.jsx("line",{x1:o.l,y1:360-o.b,x2:720-o.r,y2:360-o.b,className:"in-axis"}),f.jsx("line",{x1:o.l,y1:o.t,x2:o.l,y2:360-o.b,className:"in-axis"}),f.jsx("text",{x:(o.l+720-o.r)/2,y:352,className:"in-label",children:"days since last change →"}),f.jsx("text",{x:12,y:(o.t+360-o.b)/2,className:"in-label",transform:`rotate(-90 12 ${(o.t+360-o.b)/2})`,children:"reads / 30d →"}),f.jsx("text",{x:720-o.r-6,y:o.t+14,className:"in-quad in-quad-danger",textAnchor:"end",children:"hot + stale"}),f.jsx("text",{x:o.l+6,y:o.t+14,className:"in-quad",children:"hot + fresh"}),f.jsx("text",{x:720-o.r-6,y:360-o.b-8,className:"in-quad",textAnchor:"end",children:"cold + stale"}),f.jsx("text",{x:o.l+6,y:360-o.b-8,className:"in-quad",children:"cold + fresh"}),e.map(S=>{const _=S.total?(S.agent||0)/S.total:0;return f.jsx("circle",{cx:Number(v(S.days).toFixed(1)),cy:Number(b(S.reads).toFixed(1)),r:Number(m(_).toFixed(1)),className:"in-pt"+(S.danger?" danger":S.reads?"":" cold"),onClick:()=>n(S.path),children:f.jsx("title",{children:`${S.path} — ${S.reads} read${S.reads===1?"":"s"} / 30d · changed ${Math.round(S.days)}d ago`})},S.path)}),x.map(S=>f.jsx("text",{x:Number(S.x.toFixed(1)),y:Number(S.y.toFixed(1)),textAnchor:S.anchor,className:"in-pt-label",children:S.name},S.path))]})}function qP({pts:e,lens:n,onOpenFile:r,onOpenHistory:i}){const o=e.filter(d=>d.reads>0).sort((d,p)=>p.reads-d.reads||p.days-d.days).slice(0,20);if(!o.length)return f.jsx("div",{className:"dl-empty",children:"No reads in the window yet."});const l=o[0].reads,u=o.some(d=>d.share>0);return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"in-hotpath",children:o.map(d=>{const p=FP[n]??nI(d),m=d.reads/l*100,y=()=>d.orphan?i(d.path):r(d.path);return f.jsxs("div",{className:"in-hp-row",tabIndex:0,role:"button",title:d.orphan?`${d.reads} read${d.reads===1?"":"s"}/30d · no longer in the project — open its history`:d.danger?`${d.reads} read${d.reads===1?"":"s"}/30d · unchanged ${Math.round(d.days)}d — review this file`:d.path,onClick:y,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),y())},children:[f.jsx("span",{className:"in-hp-name"+(d.danger?" danger":""),children:d.path+(d.danger?" ⚠":"")}),d.orphan&&f.jsx("span",{className:"in-hp-gone",children:"· no longer in the project"}),f.jsxs("span",{className:"in-hp-bar",children:[f.jsx("span",{className:"in-hp-agent",style:{width:(m*p.agent).toFixed(1)+"%"}}),f.jsx("span",{className:"in-hp-human",style:{width:(m*p.human).toFixed(1)+"%"}}),f.jsx("span",{className:"in-hp-share",style:{width:(m*p.share).toFixed(1)+"%"}})]}),f.jsx("span",{className:"in-hp-count",children:d.reads})]},d.path)})}),f.jsxs("p",{className:"in-legend",children:[f.jsx("span",{className:"in-sw agent"})," agent reads ",f.jsx("span",{className:"in-sw human"})," human reads",u&&f.jsxs(f.Fragment,{children:[" ",f.jsx("span",{className:"in-sw share"})," shared reads"]})]})]})}function GP({devices:e}){const n=new Map;for(const b of e)for(const[x,S]of Object.entries(b.folders||{}))n.set(x,(n.get(x)||0)+S);const r=[...n.entries()].sort((b,x)=>x[1]-b[1]).slice(0,12).map(b=>b[0]),i=e.slice(0,12),o=140,l=6,u=Math.min(76,Math.max(34,(720-o-8)/r.length)),d=26,p=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],S=[245,166,35],_=x.map((E,R)=>Math.round(E+(S[R]-E)*b));return`rgb(${_[0]},${_[1]},${_[2]})`};return f.jsxs("svg",{viewBox:`0 0 ${p} ${m}`,className:"in-chart in-matrix",children:[i.map((b,x)=>{let S=b.name||b.id||"";return S.length>20&&(S=S.slice(0,19)+"…"),f.jsxs("g",{children:[f.jsx("text",{x:o-8,y:l+x*d+17,textAnchor:"end",className:"in-label",children:S}),r.map((_,E)=>{const R=(b.folders||{})[_]||0;return f.jsx("rect",{x:o+E*u,y:l+x*d,width:u-4,height:d-4,rx:3,fill:v(Math.sqrt(R/y)),children:f.jsx("title",{children:`${b.name||b.id} × ${_||"(root)"}: ${R} read${R===1?"":"s"}/30d`})},_)})]},b.id||x)}),r.map((b,x)=>{const S=o+x*u+(u-4)/2,_=l+i.length*d+14;return f.jsx("text",{x:S,y:_,className:"in-label",textAnchor:"end",transform:`rotate(-28 ${S} ${_})`,children:b||"(root)"},b)})]})}function iE(e){return new Set(e.entries.map(n=>n.path)).size}function ZP(e){const n=l=>(l.session?"s\0"+l.session:"n\0"+l.note)+"\0"+(l.device?.id??""),r=new Map;e.forEach((l,u)=>{if(!l.note&&!l.session)return;const d=r.get(n(l));if(d){d.entries.push(l),d.idx.push(u);return}r.set(n(l),{note:l.note??"",session:l.session,entries:[l],idx:[u]})});const i=[],o=new Set;return e.forEach((l,u)=>{const d=l.note||l.session?r.get(n(l)):void 0;if(!d||iE(d)<2){i.push({i:u});return}o.has(d)||(o.add(d),i.push({run:d,i:u}))}),i}function KP(e){const{filters:n,authors:r,onChange:i}=e,o=(y,v)=>i({...n,[y]:v||void 0}),[l,u]=w.useState(n?.q??""),d=w.useRef(!1);w.useEffect(()=>{d.current||u(n?.q??"")},[n?.q]),w.useEffect(()=>{if(!d.current)return;const y=setTimeout(()=>{d.current=!1,l!==(n?.q??"")&&o("q",l)},250);return()=>clearTimeout(y)},[l]);const p=n?.user&&!r.includes(n.user)?[n.user,...r]:r,m=Zp(n);return f.jsxs("div",{className:"hfilters",children:[f.jsxs("label",{className:"hf-search",children:[f.jsx(ut,{name:"search"}),f.jsx(du,{type:"search",value:l,placeholder:"path contains…","aria-label":"Filter by path",onChange:y=>{d.current=!0,u(y.target.value)}})]}),f.jsxs("select",{className:"hf-user",value:n?.user??"","aria-label":"Filter by author",onChange:y=>o("user",y.target.value),children:[f.jsx("option",{value:"",children:"Anyone"}),p.map(y=>f.jsx("option",{value:y,children:y},y))]}),f.jsxs("span",{className:"hf-dates",children:[f.jsx("span",{className:"hf-lbl",children:"UTC"}),f.jsx(du,{type:"date",className:"hf-date",value:n?.since??"","aria-label":"From date (UTC)",onChange:y=>o("since",y.target.value)}),f.jsx("span",{className:"hf-dash",children:"–"}),f.jsx(du,{type:"date",className:"hf-date",value:n?.until??"","aria-label":"To date (UTC)",onChange:y=>o("until",y.target.value)})]}),m&&f.jsx("button",{type:"button",className:"hf-clear",onClick:()=>i({}),children:"Clear"})]})}function YP(e){const n=new Set;for(const r of e)r.user&&n.add(r.user);return[...n].sort()}function QP(e){const{apiBase:n,target:r,isFolder:i,onMeta:o,onRendered:l,restore:u,remove:d,filters:p}=e,m=r?i(r)?{prefix:r+"/"}:{path:r}:{prefix:""},y=("path"in m&&m.path!==void 0?"path="+encodeURIComponent(m.path):"prefix="+encodeURIComponent(m.prefix??""))+N_(p).replace("?","&"),{data:v,error:b,fetchNextPage:x,hasNextPage:S,isFetchingNextPage:_}=fj({queryKey:["history",n,y],queryFn:({pageParam:P})=>Bt(n+"history?"+y+"&n=100"+(P?"&cursor="+encodeURIComponent(P):"")),initialPageParam:"",getNextPageParam:P=>P.next_cursor,staleTime:15e3}),E=w.useRef(new Set);w.useEffect(()=>{b&&o("History unavailable: "+b.message)},[b,o]),w.useEffect(()=>{v&&l?.()},[v,l]);const R=v?v.pages.flatMap(P=>P.entries||[]):[];for(const P of YP(R))E.current.add(P);const T=e.onFilters&&f.jsx(KP,{filters:p,authors:[...E.current].sort(),onChange:e.onFilters});if(!v)return T?f.jsx("div",{className:"history",children:T}):null;const O=P=>{for(let F=P+1;F{const F=R[P].kind==="delete"?O(P):R[P].blob;return F&&F===M.get(R[P].path)?void 0:F};return f.jsxs("div",{className:"history",children:[T,R.length===0&&(Zp(p)?f.jsxs("div",{className:"empty",children:["No changes match these filters.",f.jsx("br",{}),f.jsx("button",{type:"button",className:"btn hf-clear-empty",onClick:()=>e.onFilters?.({}),children:"Clear filters"})]}):f.jsx("div",{className:"empty",children:"No history yet."})),ZP(R).map((P,F)=>P.run?f.jsx(XP,{run:P.run,onOpen:e.onOpen,apiBase:n,prevBlob:O,restoreSha:D,restore:u,remove:d},"g"+F):f.jsx(pg,{entry:R[P.i],apiBase:n,onOpen:e.onOpen,diff:{apiBase:n,prev:O(P.i)},restore:u,restoreSha:D(P.i)},"r"+P.i)),S&&f.jsx("button",{type:"button",className:"btn hmore",onClick:()=>x(),disabled:_,children:_?"Loading…":"Load more"})]})}function XP({run:e,onOpen:n,apiBase:r,prevBlob:i,restoreSha:o,restore:l,remove:u}){const[d,p]=w.useState(!0),m=e.entries[0],y=dd(m),v=[m.device.name||m.device.id,m.device.os].filter(Boolean).join(" · "),b=m.session,x=m.device?.id,{data:S}=Pt({queryKey:["session-reads",r,b,x],queryFn:()=>Bt(r+"heat?session="+encodeURIComponent(b)+"&device="+encodeURIComponent(x)),enabled:!!b&&!!x,staleTime:3e4}),_=new Set(S?.paths??[]),E=new Set(e.entries.map(D=>D.path)),R=[..._].filter(D=>!E.has(D)).sort(),T=e.entries.map(D=>new Date(D.time).getTime()),O=JP(Math.min(...T),Math.max(...T)),M=iE(e);return f.jsxs("div",{className:"hrun"+(d?" open":""),children:[f.jsxs("div",{className:"hrun-head",children:[f.jsx("button",{type:"button",className:"hrun-toggle","aria-expanded":d,title:d?"Collapse this run":"Expand this run",onClick:()=>p(!d),children:f.jsx(ut,{name:d?"chevd":"chev"})}),f.jsx("span",{className:"hrun-note",children:f.jsx(KC,{text:e.note})}),f.jsxs("span",{className:"hrun-meta",children:[_.size>0?`read ${_.size} · changed ${M}`:`${M} file${M===1?"":"s"}`," ·"," ",y,v?" · "+v:""]}),f.jsx("span",{className:"hrun-time",children:O})]}),d&&f.jsxs("div",{className:"hrun-body",children:[e.entries.map((D,P)=>f.jsx(pg,{entry:D,apiBase:r,onOpen:n,diff:{apiBase:r,prev:i(e.idx[P])},restore:l,remove:u,restoreSha:o(e.idx[P]),inRun:!0,read:_.has(D.path)},P)),R.length>0&&f.jsxs("div",{className:"hrun-reads",children:[f.jsx("div",{className:"hrun-reads-head",children:"Read, not changed"}),R.map(D=>f.jsxs("button",{type:"button",className:"hrun-read",onClick:()=>n(D),children:[f.jsx("span",{className:"hkind",children:"read"}),f.jsx("span",{className:"hpath",children:D})]},D))]}),b&&f.jsx("div",{className:"hrun-foot",children:"Reads shown only for files the project still has."})]})]})}function JP(e,n){const r=new Date(e),i=new Date(n),o=u=>u.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});if(r.toDateString()!==i.toDateString())return r.toLocaleString()+" – "+i.toLocaleString();const l=i.toLocaleDateString();return e===n?l+" "+o(i):l+" "+o(r)+" – "+o(i)}function WP(e,n){return e?n(e)?e+"/ (folder)":e:"all changes"}function eF(e){const{apiBase:n,path:r,version:i}=e,o="path="+encodeURIComponent(r),{data:l}=Pt({queryKey:["history",n,o,200],queryFn:()=>Bt(n+"history?"+o+"&n=200"),staleTime:15e3}),u=l?.entries?.find(y=>y.blob===i),d=u?dd(u):"",p=u?.time?new Date(u.time).toLocaleString():"",m=n+"blob?sha="+i+"&name="+encodeURIComponent(r.split("/").pop()||r)+"&download=1";return f.jsxs("div",{className:"vbanner",role:"status",children:[f.jsx("span",{className:"vb-icon",children:f.jsx(ut,{name:"clock"})}),f.jsxs("div",{className:"vb-text",children:[f.jsx("b",{children:[p&&"Version from "+p,d&&"by "+d].filter(Boolean).join(" ")||"Earlier version"}),f.jsx("span",{children:"This is not the current file."})]}),f.jsxs("div",{className:"vb-actions",children:[f.jsx("button",{className:"ai-btn",onClick:e.onViewCurrent,children:"View current"}),f.jsx("a",{className:"ai-btn",download:!0,href:m,children:"Download this version"})]})]})}function sE(e){const{config:n,apiBase:r,route:i,hub:o,project:l}=e,u=Yp(),d=Ai(),{tree:p,flatFiles:m,dirIndex:y,loaded:v}=dI(r,!o||!!l),b=fI(r,o&&!!l&&!!n.reads?.enabled),x=o&&!!l&&!i.path&&!i.view,S=i.view==="dashboard"||x,_=$P(r,S);w.useEffect(()=>{S&&d.invalidateQueries({queryKey:["heat",r]})},[S,r,d]);const E=i.path,R=i.view?void 0:i.version,T=E||(i.view==="dashboard"||i.view==="history")&&i.viewTarget||"",O=!!E&&y.has(E),M=!!E&&v&&!O&&m.some(Z=>Z.path===E),D=!!E&&v&&!O&&!M,P=O&&!i.view,{data:F}=Pt({queryKey:["resolve",r,E],queryFn:()=>Bt(r+"resolve?path="+encodeURIComponent(E)),enabled:D,retry:!1,staleTime:6e4}),[V,ve]=w.useState(null);w.useEffect(()=>{!D||!F?.to||(ve({from:E,to:F.to}),Kt(dl(F.to,l?.id),{replace:!0}))},[D,F,E,l?.id]);const[be,he]=w.useState(()=>new Set),ue=w.useRef(!0);w.useEffect(()=>{if(!p||!ue.current)return;ue.current=!1;const Z=(p.children||[]).filter(ne=>ne.dir);Z.length===1&&he(ne=>new Set(ne).add(Z[0].path))},[p]),w.useEffect(()=>{!T||!v||he(Z=>{const ne=new Set(Z);for(const de of DI(T))ne.add(de);return y.has(T)&&ne.add(T),ne})},[T,v,y]);const X=w.useCallback(Z=>{he(ne=>{const de=new Set(ne);return de.has(Z)?de.delete(Z):de.add(Z),de})},[]),pe=w.useRef(null),ge=w.useRef(new Map),L=w.useRef({key:"",want:0,attempts:0});w.useEffect(()=>{L.current={key:u,want:N3()==="POP"?ge.current.get(u)??0:0,attempts:0}},[u]);const K=w.useCallback(()=>{const Z=pe.current,ne=L.current;!Z||ne.key!==u||ne.attempts>=3||(ne.attempts++,Z.scrollTo({top:ne.want,behavior:"instant"}))},[u]),re=w.useCallback(()=>{pe.current&&ge.current.set(u,pe.current.scrollTop)},[u]),W=w.useCallback((Z,ne)=>{Kt(dl(Z,l?.id,ne)),mr()},[l?.id]),te=w.useCallback(Z=>Kt(Pn("history",l?.id,Z)),[l?.id]),[z,N]=w.useState(""),[B,J]=w.useState(null),[Y,le]=w.useState(!1),[ae,ye]=w.useState(!1);w.useEffect(()=>VD(()=>ye(!0)),[]);const xe=w.useRef(null),Oe=e.panel??null,Ie=!Oe&&o&&!!l&&M&&wi(l.perm,"write"),{data:Ve}=j_(l?.id,o&&!!l),it=w.useCallback(()=>{d.invalidateQueries({queryKey:["shares",l?.id]})},[d,l?.id]),Qe=M?(Ve||[]).filter(Z=>Z.path===E):[],fn=!Oe&&o&&!!l,hn=!Oe&&M,Qt=!Oe&&(M||o&&!!l&&O),br=R?r+"blob?sha="+R+"&name="+encodeURIComponent(E)+"&download=1":r+"download?path="+encodeURIComponent(E),jt=w.useCallback(async()=>{try{const Z=await fetch(r+"shares",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:E})});if(!Z.ok)throw new Error(await Z.text());const ne=await Z.json();zw("share_created");const de=await Bs(ne.url);J({url:ne.url,copied:de}),it()}catch(Z){Ke("Share failed: "+Z.message,!0)}},[r,E,it]),[rr,xr]=w.useState(""),Tt=o&&!!l&&wi(l?.perm,"write"),Vn=w.useCallback(async(Z,ne)=>{xr(Z+ne);try{await Si(r+"restore",{path:Z,sha:ne}),d.invalidateQueries({queryKey:["history",r]}),d.invalidateQueries({queryKey:["tree",r]}),d.invalidateQueries({queryKey:["render",r,Z]}),d.invalidateQueries({queryKey:["text"]}),Ke("Restored "+Z+" — it syncs to every device like any other change.")}catch(de){Ke("Restore failed: "+de.message,!0)}finally{xr("")}},[r,d]),[Dt,kr]=w.useState(""),ar=w.useCallback(async Z=>{if(await Cl("Remove "+Z+"?","It disappears from every synced device. History keeps it — you can restore it from the DELETED row afterwards.","Remove file",!0)){kr(Z);try{await Si(r+"remove",{path:Z}),d.invalidateQueries({queryKey:["history",r]}),d.invalidateQueries({queryKey:["tree",r]}),d.invalidateQueries({queryKey:["render",r,Z]}),d.invalidateQueries({queryKey:["text"]}),Ke("Removed "+Z+" — it syncs to every device like any other change.")}catch(ne){Ke("Remove failed: "+ne.message,!0)}finally{kr("")}}},[r,d]),ir=w.useCallback(()=>{if(!E)return te("");te(O?E+"/":E)},[E,O,te]);w.useEffect(()=>{const Z=ne=>{(ne.metaKey||ne.ctrlKey)&&ne.key.toLowerCase()==="k"&&(ne.preventDefault(),ye(de=>!de))};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[]);const wr=w.useCallback(()=>{const Z=[],ne=(de,we,Ee,Xe)=>Z.push({icon:de,label:we,kind:Ee,run:Xe});if(o&&l){const de=l.id,we=Ee=>()=>{e.onClosePanel?.(),Kt(Ee)};ne("folder","Go to project root","action",we("/"+de)),ne("dashboard","Dashboard","action",we(Pn("dashboard",de))),ne("terminal","Installation","action",we(Pn("install",de))),ne("gear","Settings","action",we(Pn("settings",de)))}if(o&&l&&E&&(M&&ne("share","Share: "+E,"action",jt),ne("hist","History: "+E,"action",ir),M&&ne("download","Download: "+E,"action",()=>xe.current?.click())),o&&l&&ne("hist","History: whole project","action",()=>te("")),o)for(const de of e.projects||[])(!l||de.id!==l.id)&&ne("folder","Switch to project: "+de.name,"project",()=>Kt("/"+de.id));n.auth?.enabled&&ne("power","Sign out","action",()=>window.location.href="/auth/logout");for(const de of y.keys())ne("folder",de,"folder",()=>W(de));for(const de of m)ne("doc",de.path,"file",()=>W(de.path));return Z},[o,l,E,M,n.auth?.enabled,y,m,e.projects,e.onClosePanel,jt,ir,te,W]);w.useEffect(()=>{if(!Y)return;const Z=()=>le(!1);return document.addEventListener("click",Z),()=>document.removeEventListener("click",Z)},[Y]);const sr=w.useCallback(Z=>y.has(Z),[y]);let mn="app",A,I;Oe?I=Oe.body:i.view==="dashboard"?I=f.jsx(gw,{flatFiles:m,heatMap:b,devices:_,scope:i.viewTarget||"",loading:!v,installHref:l?Pn("install",l.id):void 0,onOpenFile:W,onOpenFolder:W,onOpenHistory:te,isFolder:sr}):i.view==="history"?I=f.jsx(QP,{apiBase:r,target:i.viewTarget||"",isFolder:sr,onOpen:W,onMeta:N,onRendered:K,restore:Tt?{onRestore:Vn,busy:rr}:void 0,remove:Tt?{onRemove:ar,busy:Dt}:void 0,filters:i.filters,onFilters:Z=>Kt(Pn("history",l?.id,i.viewTarget||"",Z))}):E?v?D?I=f.jsxs("div",{className:"notfound",children:[f.jsx("h1",{children:"Couldn't find that"}),f.jsxs("p",{children:[f.jsx("code",{children:E})," isn't in this project right now."]}),f.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."}),f.jsx("button",{className:"pbtn",onClick:()=>d.invalidateQueries({queryKey:["tree",r]}),children:"Check again"})]}):O?I=f.jsx(qI,{node:y.get(E),heatMap:b,hub:o&&!!l,apiBase:r,onOpen:W,onFullHistory:te,onRendered:K}):(mn=OC.test(E)||AC.test(E)?"wide":"read",A="markdown",I=f.jsxs(f.Fragment,{children:[R&&f.jsx(eF,{apiBase:r,path:E,version:R,onViewCurrent:()=>W(E)}),f.jsx(KI,{apiBase:r,path:E,version:R,heatMap:b,flatFiles:m,onOpenFile:W,onMeta:N,onRendered:K})]})):I=f.jsx("div",{className:"empty",children:"Loading…"}):x?I=f.jsxs(f.Fragment,{children:[f.jsx(HC,{project:l,existing:i.connect==="existing"}),f.jsx("div",{className:"home-insights",children:f.jsx(gw,{flatFiles:m,heatMap:b,devices:_,loading:!v,onOpenFile:W,onOpenFolder:W,onOpenHistory:te,isFolder:sr})})]}):I=f.jsx("div",{className:"empty",children:"Select a file to read it."}),V&&V.to===E&&(I=f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"vbanner",role:"status",children:[f.jsx("span",{className:"vb-icon",children:f.jsx(ut,{name:"link"})}),f.jsxs("div",{className:"vb-text",children:[f.jsxs("b",{children:["Moved from ",V.from]}),f.jsx("span",{children:"The URL has been updated."})]})]}),I]}));const U=Oe?Oe.crumb:E?f.jsx(zI,{path:E,onOpenFolder:W}):i.view==="dashboard"?"Dashboard — "+(i.viewTarget||l?.name||""):i.view==="history"?"History — "+WP(i.viewTarget||"",sr):x?l.name:null,ce=f.jsx(ul,{crumb:U,meta:z,actions:f.jsxs(f.Fragment,{children:[Ie&&f.jsx(vt,{id:"share-btn",variant:"toolbar",className:"icon-only",title:"Share","aria-label":"Share",onClick:jt,children:f.jsx(ut,{name:"share"})}),fn&&!E&&!i.view&&f.jsxs(vt,{id:"history-btn",variant:"toolbar",onClick:ir,children:[f.jsx(ut,{name:"hist"})," ",f.jsx("span",{className:"lbl",children:"History"})]}),hn&&f.jsx("a",{id:"download",hidden:!0,download:!0,href:br,ref:xe,children:"Download"}),Qt&&f.jsx(vt,{id:"more-btn",variant:"toolbar",className:"icon-only",title:"More actions","aria-label":"More actions",onClick:Z=>{Z.stopPropagation(),le(!Y)},children:f.jsx(ut,{name:"dots"})}),Y&&f.jsxs("div",{id:"more-menu",role:"menu",children:[fn&&f.jsx("button",{className:"more-item",onClick:ir,children:"History"}),hn&&f.jsx("button",{className:"more-item",onClick:()=>xe.current?.click(),children:"Download"}),o&&!!l&&f.jsx("button",{className:"more-item",onClick:()=>{e.onClosePanel?.(),Kt(Pn("dashboard",l?.id,E))},children:"Dashboard"})]})]})});return f.jsxs(f.Fragment,{children:[f.jsx(cl,{vault:e.sidebar.vault,projectsNav:e.sidebar.projectsNav,orgBar:e.sidebar.orgBar,tree:f.jsx(NI,{root:p,expanded:be,onToggle:X,currentPath:T,listingShowing:P,onOpen:W}),topbar:ce,contentRef:pe,onContentScroll:re,children:f.jsxs(Su,{width:mn,className:A,children:[!Oe&&M&&f.jsx(iP,{shares:Qe,canRevoke:!!l&&wi(l.perm,"write"),onChanged:it}),I]})}),B&&f.jsx(aP,{url:B.url,copied:B.copied,onClose:()=>{J(null),it()}}),f.jsx(LP,{open:ae,onClose:()=>ye(!1),candidates:wr})]})}function tF({config:e}){const n=Yp(),r=O_(),[i,o]=w.useState(null),[l,u]=w.useState(null);w.useEffect(()=>u(null),[n]);const d=w.useMemo(()=>{const ge=n.split("?")[0].match(/^\/join\/([0-9a-f]+)\/?$/);return ge?ge[1]:null},[n]),{data:p}=E3(!d),{data:m}=R3(!d),y=!!e.auth.admin,{data:v}=T_(y),b=w.useMemo(()=>D_(n,"hub"),[n]),[x,S]=w.useState(!1),_=e.upload.enabled,E=async(ge,L)=>{const K=L===BC;try{const re=await Si("/api/projects",{name:ge,template:K?"":L});S(!1),await r(),Kt("/"+re.project.id+(K?"?connect=existing":"")),Ke(`Created “${re.project.name}”.`)}catch(re){Ke("Could not create the project: "+re.message,!0)}},R=x?f.jsx(eI,{templates:e.templates??[],onCreate:E,onClose:()=>S(!1)}):null,T=w.useMemo(()=>p&&(p.find(ge=>ge.id===b.project)||i&&p.find(ge=>ge.org===i)||p.find(ge=>ge.id===_$())||p[0])||null,[p,b.project,i]);if(w.useEffect(()=>{document.title=T?T.name+" — BearDrive":e.brand||"BearDrive",T&&C$(T.id)},[T,e]),d)return f.jsx(nF,{token:d,onDone:async ge=>{o(ge),await r(),Kt("/",{replace:!0})}});const O=e.brand||"BearDrive",M=T&&m?.find(ge=>ge.id===T.org)||null,D=f.jsx(Xu,{name:O,onHome:()=>Kt("/"),search:!!T}),P=e.me?f.jsx(q$,{me:e.me,org:M,orgActive:!!b.org,billing:e.billing,admin:y?{pending:v?.length||0,onClick:()=>{u({kind:"hub"}),mr()}}:void 0}):void 0;if(!p||!m)return f.jsx(cl,{vault:D,topbar:f.jsx(ul,{}),children:f.jsx(Su,{children:f.jsx("div",{className:"empty",children:"Loading…"})})});if(!T)return f.jsxs(cl,{vault:D,projectsNav:f.jsx(aw,{projects:p,onNew:()=>S(!0)}),orgBar:P,topbar:f.jsx(ul,{}),children:[f.jsx(Su,{children:f.jsx(W$,{onNew:()=>S(!0),canCreate:_})}),R]});const F=l?.kind==="hub"?{crumb:"Signup & access",body:f.jsx(k$,{})}:null,V=b.org?m.find(ge=>ge.id===b.org):null,be=b.org&&!V?{crumb:"Organization",body:f.jsxs("div",{className:"empty",children:[f.jsx("h3",{children:"Organization not found"}),f.jsx("p",{children:"This organization doesn't exist, or you're no longer a member."}),f.jsx("p",{children:f.jsxs("a",{...Hs("/"+T.id),children:["Back to ",T.name]})})]})}:V?{crumb:"Organization",body:f.jsx(N$,{org:V,projects:p,myEmail:e.me?.email||""})}:null,he=!!b.project&&!p.some(ge=>ge.id===b.project),ue=he?{crumb:"Project",body:f.jsxs("div",{className:"empty",children:[f.jsx("h3",{children:"Project not found"}),f.jsx("p",{children:"This project doesn't exist, or you're no longer a member."}),f.jsx("p",{children:f.jsxs("a",{...Hs("/"+T.id),children:["Back to ",T.name]})})]})}:null,X=b.billing?{crumb:"Billing",body:e.billing?f.jsx(G$,{url:e.billing.url}):f.jsxs("div",{className:"empty",children:[f.jsx("h3",{children:"No billing on this hub"}),f.jsx("p",{children:"This BearDrive hub doesn't have a billing surface."})]})}:null,pe=b.view==="settings"?{crumb:"Project settings",body:f.jsx(Y$,{project:T,org:M,onDeleted:async()=>{await r(),Kt("/")}})}:b.view==="install"?{crumb:"Installation",body:f.jsx(HC,{project:T,existing:b.connect==="existing"})}:null;if(!he){if(!b.org&&!b.billing&&b.project!==T.id)return f.jsx(Yo,{to:"/"+T.id});if(b.legacyView&&b.view)return f.jsx(Yo,{to:Pn(b.view,T.id,b.viewTarget,b.filters)});if(b.queryTarget&&b.view)return f.jsx(Yo,{to:Pn(b.view,T.id,b.viewTarget,b.filters)});if(b.trailingSlash&&b.path)return f.jsx(Yo,{to:dl(b.path,T.id,b.version)})}return f.jsxs(f.Fragment,{children:[f.jsx(sE,{config:e,apiBase:"/api/p/"+T.id+"/",route:b,hub:!0,project:T,projects:p,sidebar:{vault:D,projectsNav:f.jsx(aw,{projects:p,currentId:T.id,onNew:()=>S(!0),menu:{active:l?null:b.view==="dashboard"&&!b.viewTarget?"dashboard":b.view==="install"?"install":b.view==="history"&&!b.viewTarget?"history":b.view==="settings"?"settings":null,onDashboard:()=>{u(null),Kt(Pn("dashboard",T.id)),mr()},onInstall:()=>{u(null),Kt(Pn("install",T.id)),mr()},onHistory:()=>{u(null),Kt(Pn("history",T.id)),mr()},onSettings:()=>{u(null),Kt(Pn("settings",T.id)),mr()}}}),orgBar:P},panel:F||be||ue||X||pe,onClosePanel:()=>u(null)},T.id),R]})}function nF({token:e,onDone:n}){return w.useEffect(()=>{let r=!1;return Si("/api/invites/"+e).then(i=>{r||(Ke(`Welcome — you joined the “${i.org.name}” team. Opening its projects…`),n(i.org.id))}).catch(i=>{r||String(i.message).includes("signing in")||(Ke("Could not accept the invite: "+i.message,!0),n(null))}),()=>{r=!0}},[e]),f.jsx(cl,{vault:f.jsx(Xu,{name:"BearDrive"}),topbar:f.jsx(ul,{}),children:f.jsx(Su,{children:f.jsx("div",{className:"empty",children:"Joining…"})})})}function rF({config:e}){const n=Yp(),r=e.volume||"BearDrive";w.useEffect(()=>{document.title=e.brand||r},[e,r]);const i=w.useMemo(()=>D_(n,"volume"),[n]);return i.trailingSlash&&i.path?f.jsx(Yo,{to:dl(i.path)}):f.jsx(sE,{config:e,apiBase:"/api/",route:i,hub:!1,sidebar:{vault:f.jsx(Xu,{name:r,showSignout:e.auth.enabled,search:!0})}})}function aF(){const{data:e}=vj();return f.jsxs($D,{delayDuration:150,children:[e?e.mode==="hub"?f.jsx(tF,{config:e}):f.jsx(rF,{config:e}):f.jsx(cl,{vault:f.jsx(Xu,{name:"…",showSignout:!1}),topbar:f.jsx(ul,{}),children:f.jsx("div",{className:"empty",children:"Loading…"})}),f.jsx(v3,{}),f.jsx(S3,{})]})}class iF extends w.Component{state={error:null};static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,r){console.error("BearDrive: unhandled render error",n,r.componentStack)}render(){return this.state.error?f.jsxs("div",{className:"mx-auto max-w-lg p-8 text-sm",children:[f.jsx("h1",{className:"mb-2 text-lg font-semibold",children:"This page didn’t load"}),f.jsx("p",{className:"mb-4 opacity-80",children:"Something went wrong rendering this view. The rest of BearDrive is fine."}),f.jsx("p",{className:"mb-4",children:f.jsx("a",{className:"underline",href:"/",children:"Go to the project list"})}),f.jsx("pre",{className:"overflow-x-auto rounded bg-black/5 p-3 text-xs dark:bg-white/10",children:String(this.state.error)})]}):this.props.children}}const sF=new ej({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});j2.createRoot(document.getElementById("root")).render(f.jsx(w.StrictMode,{children:f.jsx(iF,{children:f.jsx(tj,{client:sF,children:f.jsx(aF,{})})})})); diff --git a/internal/webapp/static/assets/index-BdCy9HmN.css b/internal/webapp/static/assets/index-Do25j1to.css similarity index 80% rename from internal/webapp/static/assets/index-BdCy9HmN.css rename to internal/webapp/static/assets/index-Do25j1to.css index 8827612..f63ce17 100644 --- a/internal/webapp/static/assets/index-BdCy9HmN.css +++ b/internal/webapp/static/assets/index-Do25j1to.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-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--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}.collapse{visibility:collapse}.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}.static{position:static}.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%}.isolate{isolation:isolate}.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)}.mx-auto{margin-inline:auto}.my-1{margin-block:var(--spacing)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.ml-auto{margin-left:auto}.block{display:block}.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)}.max-w-lg{max-width:var(--container-lg)}.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}.grow{flex-grow:1}.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{border-radius:.25rem}.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\/5{background-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.bg-black\/5{background-color:color-mix(in oklab,var(--color-black) 5%,transparent)}}.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-3{padding:calc(var(--spacing) * 3)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.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}.uppercase{text-transform:uppercase}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.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}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.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)}}.dark\:bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-white\/10{background-color:color-mix(in oklab,var(--color-white) 10%,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-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@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{color-scheme:dark;--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}.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}.admin-card-table{overflow-x:auto}.shares-table .admin-table th:last-child,.shares-table .admin-table td:last-child{width:110px}.shares-table .admin-table td .ai-tag{white-space:normal;overflow:visible;text-overflow:clip}.share-banner{margin:0 0 18px;padding:12px 14px;border:1px solid var(--border);border-left:3px solid var(--accent);border-radius:var(--r-ctl);background:var(--surface)}.share-banner .sb-head{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--text)}.share-banner .sb-head .ico,.share-banner .sb-head svg{width:15px;height:15px;flex:none;color:var(--accent)}.share-banner .sb-count{color:var(--text-faint);font-size:12px}.share-banner .sb-note{margin:6px 0 10px;font-size:12.5px;line-height:1.55;color:var(--text-faint);max-width:64ch}.share-banner .sb-link{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding-top:8px;border-top:1px solid var(--border)}.share-banner .sb-link+.sb-link{margin-top:8px}.share-banner .sb-url{flex:1 1 260px;min-width:0;font-size:12px;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.share-banner .sb-meta{font-size:11.5px;color:var(--text-faint)}.share-banner .sb-actions{display:flex;align-items:center;gap:6px;margin-left:auto}.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}.gh-star{display:flex;align-items:center;gap:8px;padding:4px 8px;margin-bottom:2px;border-radius:7px;color:var(--text-faint);font-size:11px;text-decoration:none}.gh-star:hover{background:var(--hover);color:var(--text)}.gh-star .gh-mark{width:12px;height:12px;flex:none}.gh-star .ext{margin-left:auto;font-size:9px}#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 .plan-chip{margin-left:auto;color:var(--accent);border-color:var(--border-2)}#account-menu #signout{color:var(--del)}#account-menu #signout:hover{color:var(--del);background:var(--hover)}#billing-view .plan-chip{color:var(--accent)}.plan-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}@media(max-width:700px){.plan-grid{grid-template-columns:1fr}}.usage-bar{background:var(--surface);border:1px solid var(--border);border-radius:4px;height:6px;overflow:hidden}.usage-bar>div{background:var(--accent);height:100%}.plan-price{font-size:20px;font-weight:700;margin:0 0 10px}.plan-price small{font-size:12px;color:var(--text-dim);font-weight:500}.muted-note{color:var(--text-dim);font-size:13px}#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;scrollbar-gutter:stable}@media(pointer:fine){#content::-webkit-scrollbar{width:10px}#content::-webkit-scrollbar-thumb{background:var(--border-2);border-radius:5px}#content::-webkit-scrollbar-track{background:transparent}@supports not selector(::-webkit-scrollbar){#content{scrollbar-width:thin;scrollbar-color:var(--border-2) transparent}}}.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-card.ob-start{border-color:var(--border-2);box-shadow:inset 2px 0 0 var(--accent)}.ob-card.ob-start .pbtn{margin-top:2px}.ob-alt{margin:12px 0 0}.ob-alt a{color:var(--text-faint);font-size:12.5px;font-weight:600;text-decoration:none}.ob-alt a:hover{color:var(--text)}.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;text-decoration:none}.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-name,#crumb,.hpath,.hnote,.hrun-note,.hdev,.ai-main{unicode-bidi:isolate-override;direction:ltr}.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)}#account-btn.active{background:var(--glow)}#account-btn.active .acct b{color:var(--accent-bright)}.gd-body{margin-top:18px}.gd-desc{margin:2px 0 8px;color:var(--text-faint);font-size:13px;line-height:1.5}.gd-list{margin:4px 0 8px;padding-left:18px;display:grid;gap:6px}.gd-code{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:10px;margin:6px 0 10px;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-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:before{content:"▸ ";color:var(--text-ghost)}.gd-manual[open]>summary:before{content:"▾ "}.gd-manual>summary:hover{color:var(--text)}.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-blank{display:grid;justify-items:center;gap:10px;padding:40px 18px;margin-top:14px;max-width:760px}.in-blank p{margin:0;max-width:52ch;line-height:1.55}.in-blank p:first-child{color:var(--text);font-size:14.5px;font-weight:600}.in-blank .pbtn{margin-top:6px}.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-pt-label{fill:var(--text-faint);font-size:11px;pointer-events:none}.in-h3-row{display:flex;justify-content:space-between;align-items:baseline;gap:12px;max-width:760px}.in-cap{font-size:11.5px;color:var(--text-faint);font-weight:400;text-transform:none;letter-spacing:0}.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-share{background:#b478e8}.in-hp-gone{flex:none;font-size:11.5px;color:var(--text-ghost);white-space:nowrap}.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-sw.share{background:#b478e8}.in-sw-age{width:84px;margin:0 5px}.in-sw-flat{filter:grayscale(1);opacity:.45}.in-tm-range{margin-left:14px;color:var(--text-ghost)}.in-matrix rect{transition:opacity .1s}.in-matrix rect:hover{opacity:.85}.hfilters{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:0 0 12px;border-bottom:1px solid var(--border);margin-bottom:4px}.hf-search{position:relative;display:flex;align-items:center;flex:1 1 200px;min-width:160px}.hf-search .ico{position:absolute;left:9px;width:14px;height:14px;color:var(--text-ghost);pointer-events:none}.hf-search input{height:30px;padding-left:29px;font-size:12.5px;border-radius:var(--r-ctl);background:var(--surface)}.hf-search input::-webkit-search-cancel-button{filter:invert(.6)}.hf-user{height:30px;max-width:190px;padding:0 8px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--text);font:inherit;font-size:12.5px;cursor:pointer}.hf-dates{display:flex;align-items:center;gap:6px}.hf-lbl{font-size:10px;letter-spacing:.06em;text-transform:uppercase;color:var(--text-ghost)}.hf-date{width:140px;height:30px;font-size:12.5px;border-radius:var(--r-ctl);background:var(--surface)}.hf-date::-webkit-calendar-picker-indicator{filter:invert(.6);cursor:pointer}.hf-dash{color:var(--text-ghost)}.hf-clear{height:30px;padding:0 10px;border:none;border-radius:var(--r-ctl);background:none;color:var(--text-dim);font:inherit;font-size:12.5px;cursor:pointer}.hf-clear:hover{color:var(--text);background:var(--hover)}.hf-clear-empty{margin-top:12px}.hentry{padding:11px 12px;border-bottom:1px solid var(--border);--hindent: 72px}.hentry:hover{background:#ffffff04}.hline{display:flex;gap:10px;align-items:center}.hkind{flex:none;width:62px;white-space:nowrap;text-align:center;font-size:10px;text-transform:uppercase;letter-spacing:.06em;font-weight:600;padding:2px 6px;border-radius:4px;color:var(--add);background:#4cc38a1f}.hentry.edit .hkind{color:var(--accent-bright);background:var(--glow)}.hentry.delete .hkind{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}.hmore{display:flex;margin:14px auto}.hmore:disabled{opacity:.6;cursor:default}.hmeta{display:flex;align-items:center;gap:14px;margin-top:4px;padding-left:var(--hindent);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:var(--hindent);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:"›";display:inline-block;margin-right:5px;color:var(--text-ghost);transition:transform .12s}.hnote.open:before{transform:rotate(90deg)}.hnote a{color:var(--accent-bright);text-decoration:none}.hnote a:hover{text-decoration:underline}.hrun{border:1px solid var(--border);border-radius:var(--r-card);background:var(--bg-side);margin:10px 0;overflow:hidden}.hrun-head{display:flex;align-items:center;gap:9px;width:100%;padding:9px 12px;color:var(--text);font-size:12.5px}.hrun-toggle{display:flex;flex:none;padding:2px;border:none;border-radius:4px;background:none;color:var(--text-faint);cursor:pointer}.hrun-toggle:hover{color:var(--text);background:var(--hover)}.hrun-toggle .ico{width:13px;height:13px}.hrun-note{font-weight:560;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:46%}.hrun-note a{color:var(--accent-bright);text-decoration:none}.hrun-note a:hover{text-decoration:underline}.hrun-meta{color:var(--text-faint);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.hrun-time{margin-left:auto;flex:none;color:var(--text-faint);font-variant-numeric:tabular-nums}.hrun-body{border-top:1px solid var(--border)}.hrun-body .hentry:last-child{border-bottom:none}.hrestore-btn,.hremove-btn{display:inline-flex;align-items:center;gap:4px;margin-left:auto;padding:2px 8px 2px 5px;border:1px solid var(--border);border-radius:5px;background:none;color:var(--text-faint);font:inherit;font-size:12px;cursor:pointer}.hrestore-btn:hover{color:var(--accent-bright);border-color:var(--border-2);background:var(--hover)}.hremove-btn:hover{color:var(--del);border-color:#f26d6d61;background:var(--hover)}.hrestore-btn:disabled,.hremove-btn:disabled{opacity:.5;cursor:default}.hrestore-btn .ico,.hremove-btn .ico{width:12px;height:12px}.hactions{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:6px 0 0 23px}.hdiff-btn,.hver-btn{display:inline-flex;align-items:center;gap:4px;padding:2px 7px 2px 4px;border:1px solid var(--border);border-radius:5px;background:none;color:var(--text-faint);font:inherit;font-size:12px;cursor:pointer;text-decoration:none}.hdiff-btn:hover,.hver-btn:hover{color:var(--text);border-color:var(--border-2);background:var(--hover)}.hdiff-btn .ico,.hver-btn .ico{width:12px;height:12px}.hdiff-none{flex-basis:100%;font-size:12px;color:var(--text-ghost)}.dv{margin:8px 0 2px 23px;border:1px solid var(--border);border-radius:6px;overflow:hidden}.dv-msg{display:flex;flex-wrap:wrap;align-items:center;gap:12px;padding:9px 11px;font-size:12px;color:var(--text-faint)}.dv-dl{display:flex;gap:12px}.dv-msg a{color:var(--accent-bright);text-decoration:none}.dv-msg a:hover{text-decoration:underline}.dv-head{display:flex;align-items:center;gap:10px;padding:5px 11px;border-bottom:1px solid var(--border);font-size:11px;font-variant-numeric:tabular-nums}.dv-add{color:var(--add);font-weight:600}.dv-del{color:var(--del);font-weight:600}.dv-same{color:var(--text-ghost)}.dv-body{overflow-x:auto;padding:4px 0}.dv-line{display:flex;font-family:var(--mono);font-size:12px;line-height:1.55;white-space:pre}.dv-n{flex:none;width:34px;padding-right:8px;text-align:right;color:var(--text-ghost);-webkit-user-select:none;user-select:none;font-variant-numeric:tabular-nums}.dv-mark{flex:none;width:16px;text-align:center;-webkit-user-select:none;user-select:none}.dv-text{padding-right:12px}.dv-ins{background:#4cc38a1a;color:var(--add)}.dv-rm{background:#f26d6d1a;color:#ff8b8b}.dv-ctx{color:var(--text-dim)}#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{flex:1;width:100%;border:none;background:transparent;box-shadow:none;color:var(--text);font:inherit;font-size:15px;letter-spacing:-.01em;outline:none;padding:0}#palette input::placeholder{color:var(--text-ghost)}#palette-inputwrap .ico{width:17px;height:17px;color:var(--text-faint)}#palette [cmdk-list]{list-style:none;margin:0;padding:8px;max-height:46vh;overflow-y:auto}#palette [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 [cmdk-item][data-selected=true]{background:var(--glow)}#palette [cmdk-item][data-selected=true] .picon{color:var(--accent)}#palette [cmdk-item][data-selected=true] .plabel,#palette [cmdk-item][data-selected=true] .plabel b{color:var(--accent-bright)}#palette [cmdk-item] .picon{width:18px;flex:none;display:flex;justify-content:center;color:var(--text-faint)}#palette [cmdk-item] .picon .ico{width:15px;height:15px}#palette [cmdk-item] .plabel{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--text)}#palette [cmdk-item] .plabel b{color:var(--accent-bright);font-weight:600}#palette [cmdk-item] .pkind{flex:none;font-size:10.5px;text-transform:uppercase;letter-spacing:.05em;color:var(--text-ghost)}#palette [cmdk-list] .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-expiry{display:flex;align-items:center;gap:8px;margin-bottom:16px;font-size:12.5px;color:var(--text-dim)}.modal-expiry 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}.modal-expiry select:disabled{opacity:.6;cursor:default}.modal-expiry-note{margin-left:auto;color:var(--text-dim)}.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)}.start-points{border:0;margin:0 0 18px;padding:0}.start-points legend{padding:0}.start-point{display:flex;align-items:flex-start;gap:10px;padding:9px 11px;border:1px solid var(--border);border-radius:var(--r-ctl);background:var(--surface);cursor:pointer;margin-bottom:6px}.start-point:hover{background:var(--hover)}.start-point.on{border-color:var(--accent);background:var(--hover)}.start-point input{accent-color:var(--accent);margin:2px 0 0;flex:none}.sp-text{display:flex;flex-direction:column;gap:2px;min-width:0}.sp-title{font-size:13.5px;color:var(--text);display:flex;align-items:center;gap:8px}.sp-rec{font-size:10.5px;letter-spacing:.02em;text-transform:uppercase;color:var(--accent);border:1px solid var(--accent);border-radius:999px;padding:0 6px;line-height:15px}.sp-blurb{font-size:12px;color:var(--text-dim);overflow-wrap:anywhere}.start-point.sp-rule{margin-top:16px}.modal{max-height:calc(100vh - 32px);overflow-y:auto}.gd-note{margin:-4px 0 16px;font-size:13px;color:var(--text-dim);border-left:2px solid var(--accent);padding-left:11px;line-height:1.55}[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}#topbar{flex-wrap:wrap;height:auto;min-height:52px}#meta{order:1;flex:1 1 100%;text-align:left;white-space:normal;overflow:visible;padding:0 0 8px}#meta:empty{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%}.admin-item{flex-wrap:wrap;row-gap:8px;padding:12px 14px}.admin-item select,.hf-search input,.hf-user,.hf-date,.hf-clear{height:44px}.hf-dates{flex:1 1 100%}.hf-date{flex:1;width:auto;min-width:0}.hrun-head{flex-wrap:wrap;row-gap:4px}.hrun-note{max-width:none;white-space:normal;overflow:visible}.hrun-meta{order:1;flex:1 1 100%;white-space:normal;overflow:visible}.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{height:auto;min-height:44px}.modal-expiry select{height:44px}.pbtn,#palette [cmdk-item]{height:auto;min-height:44px}.more-item{min-height:44px}}.modal-actions .ai-del{margin-right:auto}@media(max-width:430px){.dl-row{flex-wrap:wrap;row-gap:2px}.dl-meta{flex:1 1 100%;padding-left:27px}.ai-tag{font-size:11px}.htime{white-space:nowrap;font-size:12px}.hline{flex-wrap:wrap}.hentry{--hindent: 0px}.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,.pdfview{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}.vbanner{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:0 0 22px;padding:11px 14px;border:1px solid var(--accent-dim);border-radius:var(--r-card);background:var(--glow)}.vbanner .vb-icon{flex:none;display:flex;color:var(--accent-bright)}.vbanner .vb-text{flex:1 1 220px;min-width:0;display:flex;flex-direction:column;gap:1px;font-size:12.5px;line-height:1.45}.vbanner .vb-text b{color:var(--accent-bright);font-weight:600}.vbanner .vb-text span{color:var(--text-dim)}.vbanner .vb-actions{flex:none;display:flex;gap:8px}.vbanner .vb-actions .ai-btn{display:inline-flex;align-items:center;text-decoration:none}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}.csvbox{overflow-x:auto;width:fit-content;max-width:100%;border:1px solid var(--border);border-radius:var(--r-card);background:var(--code-bg)}.csvbox .csvview{display:table;max-width:none;overflow:visible;margin:0;border-collapse:collapse;font:12.5px/1.5 var(--mono);font-variant-numeric:tabular-nums}.csvbox .csvview th,.csvbox .csvview td{border-bottom:1px solid var(--border);padding:8px 14px;text-align:left;white-space:pre;vertical-align:top;color:#c6cbd3;font-size:12.5px}.csvbox .csvview th{background:var(--surface);color:var(--text-faint);font-size:11px;text-transform:uppercase;letter-spacing:.05em;font-weight:600;border-bottom-color:var(--border-2)}.csvbox .csvview tr:last-child td{border-bottom:none}.csvbox .csvview tbody tr:hover td{background:#ffffff05}.csvnote{color:var(--text-faint);font-size:12px;margin:10px 2px 0}.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-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--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}.collapse{visibility:collapse}.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}.static{position:static}.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%}.isolate{isolation:isolate}.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)}.mx-auto{margin-inline:auto}.my-1{margin-block:var(--spacing)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.ml-auto{margin-left:auto}.block{display:block}.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)}.max-w-lg{max-width:var(--container-lg)}.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}.grow{flex-grow:1}.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{border-radius:.25rem}.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\/5{background-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.bg-black\/5{background-color:color-mix(in oklab,var(--color-black) 5%,transparent)}}.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-3{padding:calc(var(--spacing) * 3)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.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}.uppercase{text-transform:uppercase}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.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}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.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)}}.dark\:bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.dark\:bg-white\/10{background-color:color-mix(in oklab,var(--color-white) 10%,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-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@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{color-scheme:dark;--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}.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}.admin-card-table{overflow-x:auto}.shares-table .admin-table th:last-child,.shares-table .admin-table td:last-child{width:110px}.shares-table .admin-table td .ai-tag{white-space:normal;overflow:visible;text-overflow:clip}.share-banner{margin:0 0 18px;padding:12px 14px;border:1px solid var(--border);border-left:3px solid var(--accent);border-radius:var(--r-ctl);background:var(--surface)}.share-banner .sb-head{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--text)}.share-banner .sb-head .ico,.share-banner .sb-head svg{width:15px;height:15px;flex:none;color:var(--accent)}.share-banner .sb-count{color:var(--text-faint);font-size:12px}.share-banner .sb-note{margin:6px 0 10px;font-size:12.5px;line-height:1.55;color:var(--text-faint);max-width:64ch}.share-banner .sb-link{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding-top:8px;border-top:1px solid var(--border)}.share-banner .sb-link+.sb-link{margin-top:8px}.share-banner .sb-url{flex:1 1 260px;min-width:0;font-size:12px;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.share-banner .sb-meta{font-size:11.5px;color:var(--text-faint)}.share-banner .sb-actions{display:flex;align-items:center;gap:6px;margin-left:auto}.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}.gh-star{display:flex;align-items:center;gap:8px;padding:4px 8px;margin-bottom:2px;border-radius:7px;color:var(--text-faint);font-size:11px;text-decoration:none}.gh-star:hover{background:var(--hover);color:var(--text)}.gh-star .gh-mark{width:12px;height:12px;flex:none}.gh-star .ext{margin-left:auto;font-size:9px}#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 .plan-chip{margin-left:auto;color:var(--accent);border-color:var(--border-2)}#account-menu #signout{color:var(--del)}#account-menu #signout:hover{color:var(--del);background:var(--hover)}#billing-view .plan-chip{color:var(--accent)}.plan-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}@media(max-width:700px){.plan-grid{grid-template-columns:1fr}}.usage-bar{background:var(--surface);border:1px solid var(--border);border-radius:4px;height:6px;overflow:hidden}.usage-bar>div{background:var(--accent);height:100%}.plan-price{font-size:20px;font-weight:700;margin:0 0 10px}.plan-price small{font-size:12px;color:var(--text-dim);font-weight:500}.muted-note{color:var(--text-dim);font-size:13px}#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;scrollbar-gutter:stable}@media(pointer:fine){#content::-webkit-scrollbar{width:10px}#content::-webkit-scrollbar-thumb{background:var(--border-2);border-radius:5px}#content::-webkit-scrollbar-track{background:transparent}@supports not selector(::-webkit-scrollbar){#content{scrollbar-width:thin;scrollbar-color:var(--border-2) transparent}}}.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-card.ob-start{border-color:var(--border-2);box-shadow:inset 2px 0 0 var(--accent)}.ob-card.ob-start .pbtn{margin-top:2px}.ob-alt{margin:12px 0 0}.ob-alt a{color:var(--text-faint);font-size:12.5px;font-weight:600;text-decoration:none}.ob-alt a:hover{color:var(--text)}.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;text-decoration:none}.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-name,#crumb,.hpath,.hnote,.hrun-note,.hdev,.ai-main{unicode-bidi:isolate-override;direction:ltr}.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)}#account-btn.active{background:var(--glow)}#account-btn.active .acct b{color:var(--accent-bright)}.gd-body{margin-top:18px}.gd-desc{margin:2px 0 8px;color:var(--text-faint);font-size:13px;line-height:1.5}.gd-list{margin:4px 0 8px;padding-left:18px;display:grid;gap:6px}.gd-code{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:10px;margin:6px 0 10px;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-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:before{content:"▸ ";color:var(--text-ghost)}.gd-manual[open]>summary:before{content:"▾ "}.gd-manual>summary:hover{color:var(--text)}.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-blank{display:grid;justify-items:center;gap:10px;padding:40px 18px;margin-top:14px;max-width:760px}.in-blank p{margin:0;max-width:52ch;line-height:1.55}.in-blank p:first-child{color:var(--text);font-size:14.5px;font-weight:600}.in-blank .pbtn{margin-top:6px}.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-pt-label{fill:var(--text-faint);font-size:11px;pointer-events:none}.in-h3-row{display:flex;justify-content:space-between;align-items:baseline;gap:12px;max-width:760px}.in-cap{font-size:11.5px;color:var(--text-faint);font-weight:400;text-transform:none;letter-spacing:0}.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-share{background:#b478e8}.in-hp-gone{flex:none;font-size:11.5px;color:var(--text-ghost);white-space:nowrap}.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-sw.share{background:#b478e8}.in-sw-age{width:84px;margin:0 5px}.in-sw-flat{filter:grayscale(1);opacity:.45}.in-tm-range{margin-left:14px;color:var(--text-ghost)}.in-matrix rect{transition:opacity .1s}.in-matrix rect:hover{opacity:.85}.hfilters{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:0 0 12px;border-bottom:1px solid var(--border);margin-bottom:4px}.hf-search{position:relative;display:flex;align-items:center;flex:1 1 200px;min-width:160px}.hf-search .ico{position:absolute;left:9px;width:14px;height:14px;color:var(--text-ghost);pointer-events:none}.hf-search input{height:30px;padding-left:29px;font-size:12.5px;border-radius:var(--r-ctl);background:var(--surface)}.hf-search input::-webkit-search-cancel-button{filter:invert(.6)}.hf-user{height:30px;max-width:190px;padding:0 8px;border-radius:var(--r-ctl);border:1px solid var(--border);background:var(--surface);color:var(--text);font:inherit;font-size:12.5px;cursor:pointer}.hf-dates{display:flex;align-items:center;gap:6px}.hf-lbl{font-size:10px;letter-spacing:.06em;text-transform:uppercase;color:var(--text-ghost)}.hf-date{width:140px;height:30px;font-size:12.5px;border-radius:var(--r-ctl);background:var(--surface)}.hf-date::-webkit-calendar-picker-indicator{filter:invert(.6);cursor:pointer}.hf-dash{color:var(--text-ghost)}.hf-clear{height:30px;padding:0 10px;border:none;border-radius:var(--r-ctl);background:none;color:var(--text-dim);font:inherit;font-size:12.5px;cursor:pointer}.hf-clear:hover{color:var(--text);background:var(--hover)}.hf-clear-empty{margin-top:12px}.hentry{padding:11px 12px;border-bottom:1px solid var(--border);--hindent: 72px}.hentry:hover{background:#ffffff04}.hline{display:flex;gap:10px;align-items:center}.hkind{flex:none;width:62px;white-space:nowrap;text-align:center;font-size:10px;text-transform:uppercase;letter-spacing:.06em;font-weight:600;padding:2px 6px;border-radius:4px;color:var(--add);background:#4cc38a1f}.hentry.edit .hkind{color:var(--accent-bright);background:var(--glow)}.hentry.delete .hkind{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}.hmore{display:flex;margin:14px auto}.hmore:disabled{opacity:.6;cursor:default}.hmeta{display:flex;align-items:center;gap:14px;margin-top:4px;padding-left:var(--hindent);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:var(--hindent);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:"›";display:inline-block;margin-right:5px;color:var(--text-ghost);transition:transform .12s}.hnote.open:before{transform:rotate(90deg)}.hnote a{color:var(--accent-bright);text-decoration:none}.hnote a:hover{text-decoration:underline}.hrun{border:1px solid var(--border);border-radius:var(--r-card);background:var(--bg-side);margin:10px 0;overflow:hidden}.hrun-head{display:flex;align-items:center;gap:9px;width:100%;padding:9px 12px;color:var(--text);font-size:12.5px}.hrun-toggle{display:flex;flex:none;padding:2px;border:none;border-radius:4px;background:none;color:var(--text-faint);cursor:pointer}.hrun-toggle:hover{color:var(--text);background:var(--hover)}.hrun-toggle .ico{width:13px;height:13px}.hrun-note{font-weight:560;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:46%}.hrun-note a{color:var(--accent-bright);text-decoration:none}.hrun-note a:hover{text-decoration:underline}.hrun-meta{color:var(--text-faint);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.hrun-time{margin-left:auto;flex:none;color:var(--text-faint);font-variant-numeric:tabular-nums}.hrun-body{border-top:1px solid var(--border)}.hrun-body .hentry:last-child{border-bottom:none}.hread{flex:none;padding:2px 6px;border-radius:4px;font-size:10px;text-transform:uppercase;letter-spacing:.06em;font-weight:600;color:var(--text-dim);background:var(--hover)}.hrun-reads{border-top:1px solid var(--border);padding:4px 0 6px}.hrun-reads-head{padding:6px 14px 4px;font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--text-faint)}.hrun-read{display:flex;gap:10px;align-items:center;width:100%;padding:5px 14px;border:none;background:none;font:inherit;text-align:left;cursor:pointer}.hrun-read:hover{background:#ffffff04}.hrun-read .hkind{color:var(--text-dim);background:var(--hover)}.hrun-foot{padding:8px 14px 10px;border-top:1px solid var(--border);font-size:11.5px;color:var(--text-faint)}.hrestore-btn,.hremove-btn{display:inline-flex;align-items:center;gap:4px;margin-left:auto;padding:2px 8px 2px 5px;border:1px solid var(--border);border-radius:5px;background:none;color:var(--text-faint);font:inherit;font-size:12px;cursor:pointer}.hrestore-btn:hover{color:var(--accent-bright);border-color:var(--border-2);background:var(--hover)}.hremove-btn:hover{color:var(--del);border-color:#f26d6d61;background:var(--hover)}.hrestore-btn:disabled,.hremove-btn:disabled{opacity:.5;cursor:default}.hrestore-btn .ico,.hremove-btn .ico{width:12px;height:12px}.hactions{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:6px 0 0 23px}.hdiff-btn,.hver-btn{display:inline-flex;align-items:center;gap:4px;padding:2px 7px 2px 4px;border:1px solid var(--border);border-radius:5px;background:none;color:var(--text-faint);font:inherit;font-size:12px;cursor:pointer;text-decoration:none}.hdiff-btn:hover,.hver-btn:hover{color:var(--text);border-color:var(--border-2);background:var(--hover)}.hdiff-btn .ico,.hver-btn .ico{width:12px;height:12px}.hdiff-none{flex-basis:100%;font-size:12px;color:var(--text-ghost)}.dv{margin:8px 0 2px 23px;border:1px solid var(--border);border-radius:6px;overflow:hidden}.dv-msg{display:flex;flex-wrap:wrap;align-items:center;gap:12px;padding:9px 11px;font-size:12px;color:var(--text-faint)}.dv-dl{display:flex;gap:12px}.dv-msg a{color:var(--accent-bright);text-decoration:none}.dv-msg a:hover{text-decoration:underline}.dv-head{display:flex;align-items:center;gap:10px;padding:5px 11px;border-bottom:1px solid var(--border);font-size:11px;font-variant-numeric:tabular-nums}.dv-add{color:var(--add);font-weight:600}.dv-del{color:var(--del);font-weight:600}.dv-same{color:var(--text-ghost)}.dv-body{overflow-x:auto;padding:4px 0}.dv-line{display:flex;font-family:var(--mono);font-size:12px;line-height:1.55;white-space:pre}.dv-n{flex:none;width:34px;padding-right:8px;text-align:right;color:var(--text-ghost);-webkit-user-select:none;user-select:none;font-variant-numeric:tabular-nums}.dv-mark{flex:none;width:16px;text-align:center;-webkit-user-select:none;user-select:none}.dv-text{padding-right:12px}.dv-ins{background:#4cc38a1a;color:var(--add)}.dv-rm{background:#f26d6d1a;color:#ff8b8b}.dv-ctx{color:var(--text-dim)}#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{flex:1;width:100%;border:none;background:transparent;box-shadow:none;color:var(--text);font:inherit;font-size:15px;letter-spacing:-.01em;outline:none;padding:0}#palette input::placeholder{color:var(--text-ghost)}#palette-inputwrap .ico{width:17px;height:17px;color:var(--text-faint)}#palette [cmdk-list]{list-style:none;margin:0;padding:8px;max-height:46vh;overflow-y:auto}#palette [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 [cmdk-item][data-selected=true]{background:var(--glow)}#palette [cmdk-item][data-selected=true] .picon{color:var(--accent)}#palette [cmdk-item][data-selected=true] .plabel,#palette [cmdk-item][data-selected=true] .plabel b{color:var(--accent-bright)}#palette [cmdk-item] .picon{width:18px;flex:none;display:flex;justify-content:center;color:var(--text-faint)}#palette [cmdk-item] .picon .ico{width:15px;height:15px}#palette [cmdk-item] .plabel{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--text)}#palette [cmdk-item] .plabel b{color:var(--accent-bright);font-weight:600}#palette [cmdk-item] .pkind{flex:none;font-size:10.5px;text-transform:uppercase;letter-spacing:.05em;color:var(--text-ghost)}#palette [cmdk-list] .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-expiry{display:flex;align-items:center;gap:8px;margin-bottom:16px;font-size:12.5px;color:var(--text-dim)}.modal-expiry 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}.modal-expiry select:disabled{opacity:.6;cursor:default}.modal-expiry-note{margin-left:auto;color:var(--text-dim)}.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)}.start-points{border:0;margin:0 0 18px;padding:0}.start-points legend{padding:0}.start-point{display:flex;align-items:flex-start;gap:10px;padding:9px 11px;border:1px solid var(--border);border-radius:var(--r-ctl);background:var(--surface);cursor:pointer;margin-bottom:6px}.start-point:hover{background:var(--hover)}.start-point.on{border-color:var(--accent);background:var(--hover)}.start-point input{accent-color:var(--accent);margin:2px 0 0;flex:none}.sp-text{display:flex;flex-direction:column;gap:2px;min-width:0}.sp-title{font-size:13.5px;color:var(--text);display:flex;align-items:center;gap:8px}.sp-rec{font-size:10.5px;letter-spacing:.02em;text-transform:uppercase;color:var(--accent);border:1px solid var(--accent);border-radius:999px;padding:0 6px;line-height:15px}.sp-blurb{font-size:12px;color:var(--text-dim);overflow-wrap:anywhere}.start-point.sp-rule{margin-top:16px}.modal{max-height:calc(100vh - 32px);overflow-y:auto}.gd-note{margin:-4px 0 16px;font-size:13px;color:var(--text-dim);border-left:2px solid var(--accent);padding-left:11px;line-height:1.55}[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}#topbar{flex-wrap:wrap;height:auto;min-height:52px}#meta{order:1;flex:1 1 100%;text-align:left;white-space:normal;overflow:visible;padding:0 0 8px}#meta:empty{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%}.admin-item{flex-wrap:wrap;row-gap:8px;padding:12px 14px}.admin-item select,.hf-search input,.hf-user,.hf-date,.hf-clear{height:44px}.hf-dates{flex:1 1 100%}.hf-date{flex:1;width:auto;min-width:0}.hrun-head{flex-wrap:wrap;row-gap:4px}.hrun-note{max-width:none;white-space:normal;overflow:visible}.hrun-meta{order:1;flex:1 1 100%;white-space:normal;overflow:visible}.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{height:auto;min-height:44px}.modal-expiry select{height:44px}.pbtn,#palette [cmdk-item]{height:auto;min-height:44px}.more-item{min-height:44px}}.modal-actions .ai-del{margin-right:auto}@media(max-width:430px){.dl-row{flex-wrap:wrap;row-gap:2px}.dl-meta{flex:1 1 100%;padding-left:27px}.ai-tag{font-size:11px}.htime{white-space:nowrap;font-size:12px}.hline{flex-wrap:wrap}.hentry{--hindent: 0px}.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,.pdfview{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}.vbanner{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:0 0 22px;padding:11px 14px;border:1px solid var(--accent-dim);border-radius:var(--r-card);background:var(--glow)}.vbanner .vb-icon{flex:none;display:flex;color:var(--accent-bright)}.vbanner .vb-text{flex:1 1 220px;min-width:0;display:flex;flex-direction:column;gap:1px;font-size:12.5px;line-height:1.45}.vbanner .vb-text b{color:var(--accent-bright);font-weight:600}.vbanner .vb-text span{color:var(--text-dim)}.vbanner .vb-actions{flex:none;display:flex;gap:8px}.vbanner .vb-actions .ai-btn{display:inline-flex;align-items:center;text-decoration:none}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}.csvbox{overflow-x:auto;width:fit-content;max-width:100%;border:1px solid var(--border);border-radius:var(--r-card);background:var(--code-bg)}.csvbox .csvview{display:table;max-width:none;overflow:visible;margin:0;border-collapse:collapse;font:12.5px/1.5 var(--mono);font-variant-numeric:tabular-nums}.csvbox .csvview th,.csvbox .csvview td{border-bottom:1px solid var(--border);padding:8px 14px;text-align:left;white-space:pre;vertical-align:top;color:#c6cbd3;font-size:12.5px}.csvbox .csvview th{background:var(--surface);color:var(--text-faint);font-size:11px;text-transform:uppercase;letter-spacing:.05em;font-weight:600;border-bottom-color:var(--border-2)}.csvbox .csvview tr:last-child td{border-bottom:none}.csvbox .csvview tbody tr:hover td{background:#ffffff05}.csvnote{color:var(--text-faint);font-size:12px;margin:10px 2px 0}.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/index.html b/internal/webapp/static/index.html index 3e03266..1954c7f 100644 --- a/internal/webapp/static/index.html +++ b/internal/webapp/static/index.html @@ -5,8 +5,8 @@ BearDrive - - + +
diff --git a/internal/webapp/store.go b/internal/webapp/store.go index 2db3367..a9b06b0 100644 --- a/internal/webapp/store.go +++ b/internal/webapp/store.go @@ -353,7 +353,11 @@ func journalOps(key string, tmp *os.File) ([]journal.Op, error) { // and a C0 run in author is the "renders as nothing" shape its own doc // comment names. DeviceName is absent on purpose: History serves the // device REGISTRY's name, not the op's. - if !journal.SafeText(op.Note) || !journal.SafeText(op.Author) || !journal.SafeText(op.UserName) { + // Op.Session joins that list for the same reason: History serves it + // beside the note and the frontend groups run cards on it, so it is + // peer-written free text rendered in the audit surface. + if !journal.SafeText(op.Note) || !journal.SafeText(op.Author) || + !journal.SafeText(op.UserName) || !journal.SafeText(op.Session) { return nil, fmt.Errorf("journal carries invalid text") } } diff --git a/web/docs/src/content/docs/guides/what-agents-read.md b/web/docs/src/content/docs/guides/what-agents-read.md index 22ef355..e78cf23 100644 --- a/web/docs/src/content/docs/guides/what-agents-read.md +++ b/web/docs/src/content/docs/guides/what-agents-read.md @@ -47,6 +47,30 @@ lens — four views: spotting an agent that never discovered the folder at all, which usually means a missing [root pointer](/guides/shared-agent-memory/). +## One session, read and written + +History groups an agent session's changes into a single **run card**. The card +also shows what that session *read*: files it read before changing them are +marked, and files it read without touching at all get their own **Read, not +changed** list underneath. + +That's the question the heat map alone can't answer — *when my agent answered, +what did it actually look at, and was it the current version or the retired +one?* + +Two things worth knowing: + +- Reads are shown only for files the project still has. A file a run read and + then deleted appears as a change with no read. The card says so on screen. +- The join is on a session id the sync hook stamps, never on the run's note — + the note is free text anyone can set with `bdrive sync --note`, so joining on + it would let one person's changes attach to another person's card. + +Per-session detail is kept for 30 days by default +(`reads.session_retention_days`, see [Hub config](/reference/hub-config/)); +after that the run card shows changes only. Read *counts* are unaffected — they +come from the heat buckets, which have their own, much longer retention. + ## Using it A few things this surfaces that are otherwise guesswork: @@ -67,6 +91,13 @@ distinct-reader counts, and last-read times. **Never who read what.** already public via history. Human email addresses never appear in a heat response. +A session id is treated the same way. It appears only in History, on the change +that carries it, and is accepted as a `?session=&device=` filter +**input** — both are required. Nothing enumerates sessions: no listing +endpoint, no session column in heat output, nothing new in `?by=device`. And a +session's reads are always recorded against the device the hub validated the +report came from, so nobody can paint files onto a teammate's run card. + Telemetry degrades silently: recording or flushing a read can never fail a request or a sync cycle. diff --git a/web/docs/src/content/docs/reference/hub-config.md b/web/docs/src/content/docs/reference/hub-config.md index 237c177..f811e18 100644 --- a/web/docs/src/content/docs/reference/hub-config.md +++ b/web/docs/src/content/docs/reference/hub-config.md @@ -63,7 +63,8 @@ cloud credentials on the serving machine. }, "reads": { // read heatmap telemetry (hub mode) "enabled": true, // default true; aggregate counts only - "retention_days": 400 // daily buckets older than this fold into all-time totals + "retention_days": 400, // daily buckets older than this fold into all-time totals + "session_retention_days": 30 // how long History's run cards keep per-session read detail }, "database": { "driver": "sqlite", "dsn": "/var/lib/bdrive/hub.db" } }