diff --git a/cmd/orchestra-worker/main.go b/cmd/orchestra-worker/main.go index 954a508..94f01f3 100644 --- a/cmd/orchestra-worker/main.go +++ b/cmd/orchestra-worker/main.go @@ -400,7 +400,7 @@ func (w *worker) start(ctx context.Context, t domain.Task, ref string) error { if artErr != nil { return fmt.Errorf("research artifact: %w", artErr) } - r, decErr := workphase.DecodeResearch(b) + r, decErr := workphase.DecodeStoredResearch(b) if decErr != nil { return fmt.Errorf("research artifact: %w", decErr) } @@ -411,7 +411,7 @@ func (w *worker) start(ctx context.Context, t domain.Task, ref string) error { if artErr != nil { return fmt.Errorf("plan artifact: %w", artErr) } - pl, decErr := workphase.DecodePlan(b) + pl, decErr := workphase.DecodeStoredPlan(b) if decErr != nil { return fmt.Errorf("plan artifact: %w", decErr) } @@ -1839,7 +1839,7 @@ type phaseRequest struct { // be left. Phases absent from this table seal nothing. var phaseArtifact = map[domain.WorkPhase]string{ domain.WorkPhaseResearch: "research.json", - domain.WorkPhasePlan: "plan.json", + domain.WorkPhasePlan: "plan.md", } func currentPhase(t domain.Task) domain.WorkPhase { @@ -1946,7 +1946,10 @@ func (w *worker) requestPhase(ctx context.Context, id string, s herdr.Session) b case domain.WorkPhaseResearch: _, decErr = workphase.DecodeResearch(artifact) case domain.WorkPhasePlan: - _, decErr = workphase.DecodePlan(artifact) + // A new seal is markdown. The coordinator re-parses and also + // resolves research citations, which the worker cannot check + // because it does not hold the accepted research. + _, decErr = workphase.ParsePlan(artifact) } if decErr != nil { w.recordError(fmt.Errorf("phase request %s: %s artifact: %w", id, req.From, decErr)) diff --git a/internal/agentctx/agentctx.go b/internal/agentctx/agentctx.go index 1b59c6c..9e3da94 100644 --- a/internal/agentctx/agentctx.go +++ b/internal/agentctx/agentctx.go @@ -53,7 +53,7 @@ type Input struct { // Research and Plan are the sealed outputs of earlier phases. The // implementation phase receives these, never the sessions that wrote them. Research *workphase.Research - Plan *workphase.Plan + Plan *workphase.PlanDoc // Evidence is the verified diff and quality-gate result a reviewing // session works from. Orchestra verifies every field; none of it is the // implementer's account of what it did. @@ -156,7 +156,7 @@ var completionPhase = map[domain.WorkPhase]bool{domain.WorkPhaseReview: true} // and the worker needs to check. var phaseSealFile = map[domain.WorkPhase]string{ domain.WorkPhaseResearch: "research.json", - domain.WorkPhasePlan: "plan.json", + domain.WorkPhasePlan: "plan.md", } // phaseSealSchema is the shape of each sealed artifact, written out for the @@ -171,12 +171,7 @@ var phaseSealSchema = map[domain.WorkPhase]string{ "dead_ends": [{"tried": "", "why_failed": ""}], "unknowns": [""] }`, - domain.WorkPhasePlan: ` { - "changes": [{"target": "", "intent": ""}], - "verification": [""], - "risks": [""], - "human_decisions_needed": [""] - }`, + domain.WorkPhasePlan: planSchema, } // askingBrief narrows step 4 per phase. The bar is not the same everywhere: a @@ -452,18 +447,15 @@ func renderSealed(in Input) string { } } if plan != nil { + // Verbatim, never collapsed. The plan is the execution map an + // implement session works from, and a rotated successor has to receive + // the same one: a phase specification flattened to a bullet line is a + // summary, and nobody can implement a summary. collapse() stays for + // research findings, which really are short claims. b.WriteString("\n## Accepted plan\n\n") - for _, c := range plan.Changes { - fmt.Fprintf(&b, "- %s: %s\n", collapse(c.Target), collapse(c.Intent)) - } - for _, v := range plan.Verification { - fmt.Fprintf(&b, "- verify: %s\n", collapse(v)) - } - for _, r := range plan.Risks { - fmt.Fprintf(&b, "- risk: %s\n", collapse(r)) - } - for _, d := range plan.DecisionsNeeded { - fmt.Fprintf(&b, "- needs a human decision: %s\n", collapse(d)) + b.WriteString(plan.Markdown) + if !strings.HasSuffix(plan.Markdown, "\n") { + b.WriteString("\n") } } return b.String() @@ -548,3 +540,61 @@ func short(sha string) string { } return sha } + +// planSchema is the plan document's required outline, given to the planning +// session verbatim. Run 5 proved the planner follows a stated shape (F38), so +// this block is the delivery mechanism for the structure the seal enforces. +// +// It is markdown rather than JSON because a specification needs paragraphs, +// lists and fenced code, and the old artifact's 500-character single-line rule +// made all three impossible. What a phase needs is not "target and intent" +// but enough for a different session, with none of this one's context, to do +// the work and know when it is done. +const planSchema = "```markdown\n" + `# + +## Overview +## Current state +## Desired end state +## Non-goals +## Approach + +## Phase 1: + +### Files +- + +### Changes + + +### Verification + +#### Automated +- run: ["go", "test", "./internal/foo/..."] + +#### Manual +- + +## Phase 2: + + +## Testing strategy +## Risks and edge cases +## Migration +## References +- research:r1 — +` + "```" + ` + +Rules the seal enforces, so a plan that breaks one is refused: + +- Every section above is required, spelled exactly. +- Phases are numbered from 1 with no gaps, and each carries Files, Changes and + Verification. +- Every phase declares at least one automated or one manual check. A phase + nobody can verify can never be established as done. +- Each "- run:" line is a JSON array of arguments, not a shell command line. + There is no shell, so a pipe or a redirection would be a literal argument. + The project decides which commands may run; a command outside its policy is + refused when you seal, not later. +- Every "research:" you cite must exist in the accepted research above. +- The whole document is at most 128 KiB. There is no per-line limit: write + paragraphs, code blocks and lists as the content needs.` diff --git a/internal/agentctx/agentctx_test.go b/internal/agentctx/agentctx_test.go index c6e529f..2c7f80b 100644 --- a/internal/agentctx/agentctx_test.go +++ b/internal/agentctx/agentctx_test.go @@ -337,7 +337,7 @@ func TestPhaseBriefNamesTheRequestFile(t *testing.T) { func TestPhaseBriefNamesTheArtifactToSeal(t *testing.T) { for phase, file := range map[domain.WorkPhase]string{ domain.WorkPhaseResearch: "research.json", - domain.WorkPhasePlan: "plan.json", + domain.WorkPhasePlan: "plan.md", } { out, err := Build(Input{ Task: domain.Task{ID: "t1", Title: "demo"}, @@ -371,7 +371,18 @@ func TestPhaseSealSchemasDecode(t *testing.T) { case domain.WorkPhaseResearch: _, decErr = workphase.DecodeResearch([]byte(schema)) case domain.WorkPhasePlan: - _, decErr = workphase.DecodePlan([]byte(schema)) + // The plan brief is a markdown outline with placeholders, so it + // cannot itself be a valid plan. What has to stay true is that + // every section the parser requires is named in the brief: F38 + // was a planner guessing a shape nobody had described. + for _, required := range []string{"## Overview", "## Current state", "## Desired end state", + "## Non-goals", "## Approach", "## Phase 1:", "### Files", "### Changes", + "### Verification", "#### Automated", "#### Manual", "## Testing strategy", + "## Risks and edge cases", "## Migration", "## References", "- run:"} { + if !strings.Contains(schema, required) { + t.Fatalf("plan brief never states %q, which the seal requires", required) + } + } default: t.Fatalf("%s has a documented shape with nothing to decode it", phase) } @@ -408,3 +419,150 @@ func TestTerminalPhaseNamesTheCompletionSignal(t *testing.T) { } } } + +// The plan reaches the implementer whole, or the plan machinery is decoration. +// Everything else in this file guards a rule; this guards the one property a +// smaller local model depends on: the specification for phase three is in the +// launch text, not a bullet-line summary of it. +func TestAcceptedPlanRendersVerbatim(t *testing.T) { + doc, err := workphase.ParsePlan([]byte(planFixture)) + if err != nil { + t.Fatalf("fixture: %v", err) + } + out, err := Build(Input{ + Task: domain.Task{ID: "t1", Title: "demo"}, + Phase: domain.WorkPhaseImplement, + Git: GitState{Worktree: "/w", Branch: "orchestra/t1"}, + Plan: &doc, + }) + if err != nil { + t.Fatal(err) + } + if !strings.Contains(out.Task, planFixture) { + t.Fatalf("the sealed plan was not rendered byte for byte:\n%s", out.Task) + } + // The specifics a summary would have destroyed. + for _, want := range []string{ + "## Phase 3: Wire the reducer", + `- run: ["go", "test", "./internal/store/..."]`, + "```go", + "func reduce(", + } { + if !strings.Contains(out.Task, want) { + t.Fatalf("rendered plan lost %q", want) + } + } +} + +// A rotated successor is a different session with none of the predecessor's +// context. It receives the same complete plan, whatever the handoff says. +func TestRotatedSuccessorReceivesTheWholePlan(t *testing.T) { + doc, err := workphase.ParsePlan([]byte(planFixture)) + if err != nil { + t.Fatal(err) + } + base := Input{ + Task: domain.Task{ID: "t1", Title: "demo"}, + Phase: domain.WorkPhaseImplement, + Git: GitState{Worktree: "/w", Branch: "orchestra/t1"}, + Plan: &doc, + } + first, err := Build(base) + if err != nil { + t.Fatal(err) + } + resumed := base + resumed.Handoff = &continuity.Handoff{ + Meta: continuity.Meta{ID: "h1", Reason: "threshold"}, + Anchor: continuity.Anchor{GitSHA: "18ccaf", Branch: "orchestra/t1"}, + Action: "continue phase 2", + Remaining: []string{"phase 3"}, + } + second, err := Build(resumed) + if err != nil { + t.Fatal(err) + } + for name, out := range map[string]string{"launch": first.Task, "resumed": second.Task} { + if !strings.Contains(out, planFixture) { + t.Fatalf("%s context does not carry the complete plan", name) + } + } +} + +const planFixture = "# Reducer implementation plan\n" + ` +## Overview +Wire the reducer. + +## Current state +Nothing reduces the event, per research:r1. + +## Desired end state +The event reduces into a task field. + +## Non-goals +No new event type. + +## Approach +Extend the existing switch. + +## Phase 1: Define the field + +### Files +- internal/domain/domain.go + +### Changes +Add the field. + +### Verification + +#### Automated +- run: ["go", "build", "./..."] + +## Phase 2: Emit the event + +### Files +- internal/operations/plan.go + +### Changes +Append the event. + +### Verification + +#### Automated +- run: ["go", "test", "./internal/operations/..."] + +## Phase 3: Wire the reducer + +### Files +- internal/store/store.go + +### Changes +Add the case to the reducer switch: + +` + "```go" + ` +func reduce(t domain.Task, e domain.Event) domain.Task { + // one arm per event type + return t +} +` + "```" + ` + +### Verification + +#### Automated +- run: ["go", "test", "./internal/store/..."] + +#### Manual +- Replay the log and confirm the field is populated. + +## Testing strategy +Package tests per phase. + +## Risks and edge cases +A replay of an old log must not panic. + +## Migration +None. + +## References +- research:r1 +` diff --git a/internal/authn/http.go b/internal/authn/http.go index c3ad56c..97fbcfc 100644 --- a/internal/authn/http.go +++ b/internal/authn/http.go @@ -145,7 +145,7 @@ func (h HTTP) Account(w http.ResponseWriter, r *http.Request) { if err != nil { switch { case errors.Is(err, ErrInvalidCredentials): - http.Error(w, "current password is incorrect", http.StatusUnauthorized) + http.Error(w, "current password is incorrect", http.StatusForbidden) case errors.Is(err, ErrUsernameExists): http.Error(w, err.Error(), http.StatusConflict) default: diff --git a/internal/authn/http_test.go b/internal/authn/http_test.go index 5718f43..8110d82 100644 --- a/internal/authn/http_test.go +++ b/internal/authn/http_test.go @@ -92,3 +92,60 @@ func TestHTTPAccountUpdateRevokesExistingSessions(t *testing.T) { t.Fatalf("updated login: %v", err) } } + +func TestHTTPAccountRejectsWrongCurrentPasswordWithoutEndingSession(t *testing.T) { + users, _ := openTestStore(t) + if _, _, err := users.SetPassword("operator", "original password"); err != nil { + t.Fatal(err) + } + sessions := &authz.Sessions{} + h := HTTP{Users: users, Sessions: sessions} + value, err := sessions.IssueFor("operator") + if err != nil { + t.Fatal(err) + } + req := httptest.NewRequest(http.MethodPut, "/v1/ui/account", bytes.NewBufferString(`{"current_password":"incorrect password","username":"operator","new_password":"replacement password"}`)) + req.AddCookie(&http.Cookie{Name: authz.SessionCookie, Value: value}) + w := httptest.NewRecorder() + h.Account(w, req) + if w.Code != http.StatusForbidden { + t.Fatalf("status=%d body=%s", w.Code, w.Body) + } + if !sessions.Valid(value) { + t.Fatal("a rejected credential update ended the valid browser session") + } +} + +func TestBrowserAuthHandlersComposeWithSessionMiddleware(t *testing.T) { + users, _ := openTestStore(t) + if _, _, err := users.SetPassword("operator", "correct horse battery"); err != nil { + t.Fatal(err) + } + sessions := &authz.Sessions{} + h := HTTP{Users: users, Sessions: sessions} + mux := http.NewServeMux() + mux.HandleFunc(authz.SessionPath, h.Session) + mux.HandleFunc("/v1/ui/account", h.Account) + server := authz.HTTPWithSessions(nil, sessions, mux) + + w := httptest.NewRecorder() + server.ServeHTTP(w, httptest.NewRequest(http.MethodGet, "/v1/ui/account", nil)) + if w.Code != http.StatusUnauthorized { + t.Fatalf("uncredentialed account status=%d", w.Code) + } + + w = httptest.NewRecorder() + server.ServeHTTP(w, httptest.NewRequest(http.MethodPost, authz.SessionPath, bytes.NewBufferString(`{"username":"operator","password":"correct horse battery"}`))) + if w.Code != http.StatusOK || len(w.Result().Cookies()) != 1 { + t.Fatalf("login status=%d body=%s", w.Code, w.Body) + } + cookie := w.Result().Cookies()[0] + + request := httptest.NewRequest(http.MethodGet, "/v1/ui/account", nil) + request.AddCookie(cookie) + w = httptest.NewRecorder() + server.ServeHTTP(w, request) + if w.Code != http.StatusOK || !bytes.Contains(w.Body.Bytes(), []byte(`"username":"operator"`)) { + t.Fatalf("authenticated account status=%d body=%s", w.Code, w.Body) + } +} diff --git a/internal/authn/store.go b/internal/authn/store.go index cc19b96..3ad3794 100644 --- a/internal/authn/store.go +++ b/internal/authn/store.go @@ -116,7 +116,7 @@ func ValidateUsername(username string) error { } func ValidatePassword(password string) error { - if len(password) < MinimumPassword { + if utf8.RuneCountInString(password) < MinimumPassword { return fmt.Errorf("password must be at least %d characters", MinimumPassword) } if len([]byte(password)) > maximumPassword { diff --git a/internal/authn/store_test.go b/internal/authn/store_test.go index 9ee55ce..0a0b30f 100644 --- a/internal/authn/store_test.go +++ b/internal/authn/store_test.go @@ -2,6 +2,7 @@ package authn import ( "errors" + "os" "path/filepath" "testing" @@ -42,6 +43,13 @@ func TestPasswordRecordPersistsAndAuthenticates(t *testing.T) { if _, err := reopened.Authenticate("kami", "correct horse battery"); err != nil { t.Fatalf("persisted authentication: %v", err) } + info, err := os.Stat(path) + if err != nil { + t.Fatal(err) + } + if got := info.Mode().Perm(); got != databaseFileMode { + t.Fatalf("auth database permissions = %o, want %o", got, databaseFileMode) + } } func TestUpdateRequiresCurrentPasswordAndMovesUsername(t *testing.T) { diff --git a/internal/integration/acefca_test.go b/internal/integration/acefca_test.go index da07e8c..ab41ea3 100644 --- a/internal/integration/acefca_test.go +++ b/internal/integration/acefca_test.go @@ -176,7 +176,7 @@ func buildFor(t *testing.T, s *store.Store, task domain.Task) string { if err != nil { t.Fatal(err) } - p, err := workphase.DecodePlan(b) + p, err := workphase.DecodeStoredPlan(b) if err != nil { t.Fatal(err) } @@ -241,16 +241,58 @@ func sealedResearch(t *testing.T) []byte { func sealedPlan(t *testing.T) []byte { t.Helper() - b, err := workphase.Encode(workphase.Plan{ - Changes: []workphase.Change{{Target: "internal/attr/attr.go", Intent: "add the cache"}}, - Verification: []string{"go test ./internal/attr/"}, - }) - if err != nil { - t.Fatal(err) + b := []byte(planMarkdown) + if _, err := workphase.ParsePlan(b); err != nil { + t.Fatalf("the fixture plan does not satisfy the seal: %v", err) } return b } +// planMarkdown is a real sealed specification, not a fixture shaped to pass. +// The assertions below read its content back out of the rendered context, +// which is what proves the plan survives a phase boundary intact. +const planMarkdown = "# Attribution cache implementation plan\n" + ` +## Overview +Add the cache so attribution stops recomputing per figure. + +## Current state +Attribution runs per figure, per research:r1. + +## Desired end state +internal/attr/attr.go: add the cache, keyed per person. + +## Non-goals +No change to identity semantics. + +## Approach +Memoise inside the existing aggregation loop. + +## Phase 1: Add the cache + +### Files +- internal/attr/attr.go + +### Changes +internal/attr/attr.go: add the cache, keyed per person. + +### Verification + +#### Automated +- run: ["go", "test", "./internal/attr/"] + +## Testing strategy +The package test covers aggregation. + +## Risks and edge cases +A stale entry would misattribute. + +## Migration +None. + +## References +- research:r1 +` + func assertContains(t *testing.T, phase, ctx string, want ...string) { t.Helper() for _, w := range want { @@ -334,7 +376,7 @@ func TestTrajectoryGateCorrectionOutranksTheSealedPlan(t *testing.T) { "## Current human decisions", "add the index instead", "## Accepted plan", - "internal/attr/attr.go: add the cache", + "internal/attr/attr.go: add the cache, keyed per person.", ) } @@ -405,7 +447,7 @@ func TestBlockingQuestionResumesWithTheAnswerOnTop(t *testing.T) { // The resumed context: the answer above the sealed plan, and the question // gone because it is answered. ctx := buildFor(t, s, resumed) - assertContains(t, "resumed", ctx, "break compatibility", "## Accepted plan", "internal/attr/attr.go: add the cache") + assertContains(t, "resumed", ctx, "break compatibility", "## Accepted plan", "internal/attr/attr.go: add the cache, keyed per person.") if strings.Contains(ctx, "## Human decision required") { t.Fatalf("an answered question is still being asked:\n%s", ctx) } @@ -414,7 +456,7 @@ func TestBlockingQuestionResumesWithTheAnswerOnTop(t *testing.T) { "break compatibility", "## Accepted research", "## Accepted plan", - "internal/attr/attr.go: add the cache", + "internal/attr/attr.go: add the cache, keyed per person.", ) } @@ -488,7 +530,7 @@ func TestReviewSessionIsIndependent(t *testing.T) { if err != nil { t.Fatal(err) } - sealedPlanValue, err := workphase.DecodePlan(planArtifact) + sealedPlanValue, err := workphase.DecodeStoredPlan(planArtifact) if err != nil { t.Fatal(err) } diff --git a/internal/operations/phase_request_test.go b/internal/operations/phase_request_test.go index ff4de72..16371d7 100644 --- a/internal/operations/phase_request_test.go +++ b/internal/operations/phase_request_test.go @@ -51,7 +51,7 @@ func TestRequestWorkPhaseAdvancesAndSealsEachArtifact(t *testing.T) { if _, err := RequestWorkPhase(s, project, id, epoch, "op-4", domain.WorkPhasePlan, domain.WorkPhaseImplement, nil); !errors.Is(err, domain.ErrInvalid) { t.Fatalf("leaving plan unsealed must fail, got %v", err) } - if _, err := RequestWorkPhase(s, project, id, epoch, "op-5", domain.WorkPhasePlan, domain.WorkPhaseImplement, sealed(t, plan)); err != nil { + if _, err := RequestWorkPhase(s, project, id, epoch, "op-5", domain.WorkPhasePlan, domain.WorkPhaseImplement, planDoc); err != nil { t.Fatal(err) } got, _ = s.Task(id) diff --git a/internal/operations/review_test.go b/internal/operations/review_test.go index e4d3709..6543c78 100644 --- a/internal/operations/review_test.go +++ b/internal/operations/review_test.go @@ -34,7 +34,7 @@ func atImplement(t *testing.T, project registry.Project) (*store.Store, string) if _, err := AdvanceWorkPhase(s, project, id, sealed(t, research)); err != nil { t.Fatal(err) } - if _, err := AdvanceWorkPhase(s, project, id, sealed(t, plan)); err != nil { + if _, err := AdvanceWorkPhase(s, project, id, planDoc); err != nil { t.Fatal(err) } return s, id diff --git a/internal/operations/trajectory.go b/internal/operations/trajectory.go index 1ba3e7e..835518c 100644 --- a/internal/operations/trajectory.go +++ b/internal/operations/trajectory.go @@ -122,30 +122,15 @@ func TrajectoryGatePacket(s *store.Store, t domain.Task, from, to domain.WorkPha } } if len(planned) > 0 { - { - if p, err := workphase.DecodePlan(planned); err == nil { - b.WriteString("\nProposed changes:\n") - for _, c := range p.Changes { - fmt.Fprintf(&b, "- %s: %s\n", oneLine(c.Target), oneLine(c.Intent)) - } - if len(p.Verification) > 0 { - b.WriteString("\nVerification:\n") - for _, v := range p.Verification { - fmt.Fprintf(&b, "- %s\n", oneLine(v)) - } - } - if len(p.Risks) > 0 { - b.WriteString("\nRisks:\n") - for _, r := range p.Risks { - fmt.Fprintf(&b, "- %s\n", oneLine(r)) - } - } - if len(p.DecisionsNeeded) > 0 { - b.WriteString("\nOpen decisions for you:\n") - for _, d := range p.DecisionsNeeded { - fmt.Fprintf(&b, "- %s\n", oneLine(d)) - } - } + // The plan reaches the human as the document that was sealed. A + // trajectory gate asks whether this direction is right, and a + // flattened summary is not the thing being approved. maxPacketBytes + // below bounds what a notification surface actually carries. + if p, err := workphase.DecodeStoredPlan(planned); err == nil { + b.WriteString("\nProposed plan:\n\n") + b.WriteString(p.Markdown) + if !strings.HasSuffix(p.Markdown, "\n") { + b.WriteString("\n") } } } diff --git a/internal/operations/trajectory_test.go b/internal/operations/trajectory_test.go index 8959050..3faa7c6 100644 --- a/internal/operations/trajectory_test.go +++ b/internal/operations/trajectory_test.go @@ -10,7 +10,6 @@ import ( "orchestra/internal/domain" "orchestra/internal/registry" "orchestra/internal/store" - "orchestra/internal/workphase" ) func gatedProject() registry.Project { @@ -55,11 +54,47 @@ func TestTrajectoryGateBlocksThenClears(t *testing.T) { } // plan to implement is gated. - proposal := sealed(t, workphase.Plan{ - Changes: []workphase.Change{{Target: "internal/attr/attr.go", Intent: "add the cache"}}, - Verification: []string{"go test ./internal/attr/"}, - Risks: []string{"cache invalidation on rename"}, - }) + proposal := []byte("# Attribution cache plan\n" + ` +## Overview +add the cache + +## Current state +runs per figure, per research:r1. + +## Desired end state +Aggregation is cached per person. + +## Non-goals +No identity change. + +## Approach +Memoise in the aggregation loop. + +## Phase 1: Add the cache + +### Files +- internal/attr/attr.go + +### Changes +add the cache to internal/attr/attr.go + +### Verification + +#### Automated +- run: ["go", "test", "./internal/attr/"] + +## Testing strategy +go test ./internal/attr/ + +## Risks and edge cases +cache invalidation on rename + +## Migration +None. + +## References +- research:r1 +`) _, err := AdvanceWorkPhase(s, project, id, proposal) if !errors.Is(err, ErrTrajectoryGate) { t.Fatalf("want ErrTrajectoryGate, got %v", err) @@ -122,7 +157,7 @@ func TestUngatedProjectAdvances(t *testing.T) { if _, err := AdvanceWorkPhase(s, project, id, sealed(t, research)); err != nil { t.Fatal(err) } - if _, err := AdvanceWorkPhase(s, project, id, sealed(t, plan)); err != nil { + if _, err := AdvanceWorkPhase(s, project, id, planDoc); err != nil { t.Fatal(err) } if got, _ := s.Task(id); got.WorkPhase != domain.WorkPhaseImplement { @@ -141,7 +176,7 @@ func TestOlderDecisionDoesNotOpenTheGate(t *testing.T) { if _, err := AdvanceWorkPhase(s, project, id, sealed(t, research)); err != nil { t.Fatal(err) } - if _, err := AdvanceWorkPhase(s, project, id, sealed(t, plan)); !errors.Is(err, ErrTrajectoryGate) { + if _, err := AdvanceWorkPhase(s, project, id, planDoc); !errors.Is(err, ErrTrajectoryGate) { t.Fatalf("want ErrTrajectoryGate, got %v", err) } } diff --git a/internal/operations/workphase.go b/internal/operations/workphase.go index 97b6401..c3ef9d3 100644 --- a/internal/operations/workphase.go +++ b/internal/operations/workphase.go @@ -4,6 +4,7 @@ import ( "encoding/json" "errors" "fmt" + "strings" "orchestra/internal/authz" "orchestra/internal/domain" @@ -71,7 +72,16 @@ func advanceWorkPhase(s *store.Store, project registry.Project, taskID string, a return domain.Event{}, err } case domain.WorkPhasePlan: - if _, err := workphase.DecodePlan(artifact); err != nil { + doc, err := workphase.ParsePlan(artifact) + if err != nil { + return domain.Event{}, err + } + // Citations resolve here and nowhere else: the coordinator holds + // ResearchRef, so this is the only party that can tell whether a + // cited finding exists. A plan resting on a finding nobody + // recorded fails on the planner, while its session is still alive + // to be told, rather than on the implementer later. + if err := resolvePlanReferences(s, t, doc); err != nil { return domain.Event{}, err } } @@ -169,3 +179,27 @@ func phaseOperation(s *store.Store, taskID, operationID string) (domain.Event, b } return domain.Event{}, false } + +// resolvePlanReferences refuses a plan that cites research the task never +// sealed. Its cost is one CAS read against a ref the coordinator already +// holds. +func resolvePlanReferences(s *store.Store, t domain.Task, doc workphase.PlanDoc) error { + if len(doc.References) == 0 { + return nil + } + if t.ResearchRef == "" { + return fmt.Errorf("%w: the plan cites %s but this task sealed no research", domain.ErrInvalid, strings.Join(doc.References, ", ")) + } + raw, err := s.Artifact(t.ResearchRef) + if err != nil { + return fmt.Errorf("resolve plan references: %w", err) + } + r, err := workphase.DecodeStoredResearch(raw) + if err != nil { + return fmt.Errorf("resolve plan references: %w", err) + } + if missing := doc.ResolveReferences(r); len(missing) > 0 { + return fmt.Errorf("%w: the plan cites research:%s, which the accepted research does not contain", domain.ErrInvalid, strings.Join(missing, ", research:")) + } + return nil +} diff --git a/internal/operations/workphase_test.go b/internal/operations/workphase_test.go index 7700dc4..e7aa879 100644 --- a/internal/operations/workphase_test.go +++ b/internal/operations/workphase_test.go @@ -47,7 +47,50 @@ func sealed(t *testing.T, v interface{ Validate() error }) []byte { } var research = workphase.Research{Findings: []workphase.Finding{{ID: "r1", Confidence: workphase.Fact, Claim: "runs per figure", Evidence: "attr.go:88"}}} -var plan = workphase.Plan{Changes: []workphase.Change{{Target: "attr.go", Intent: "aggregate per person"}}} +// planDoc is a real sealed specification. It cites research:r1, which the +// research fixture above contains, so the reference check has something to +// resolve. +var planDoc = []byte("# Attribution plan\n" + ` +## Overview +Aggregate per person. + +## Current state +attr.go aggregates per figure, per research:r1. + +## Desired end state +attr.go aggregates per person. + +## Non-goals +No identity change. + +## Approach +Change the aggregation key. + +## Phase 1: Aggregate per person + +### Files +- attr.go + +### Changes +Change the aggregation key to the person. + +### Verification + +#### Automated +- run: ["go", "test", "./internal/attr/"] + +## Testing strategy +Package test. + +## Risks and edge cases +None known. + +## Migration +None. + +## References +- research:r1 +`) func TestFullPhasePathSealsEachArtifact(t *testing.T) { s, id := phaseStore(t) @@ -79,7 +122,7 @@ func TestFullPhasePathSealsEachArtifact(t *testing.T) { // plan -> implement must seal the plan, and must not overwrite the // research ref. researchRef := got.ResearchRef - if _, err := AdvanceWorkPhase(s, project, id, sealed(t, plan)); err != nil { + if _, err := AdvanceWorkPhase(s, project, id, planDoc); err != nil { t.Fatal(err) } got, _ = s.Task(id) diff --git a/internal/orchestrator/orchestrator.go b/internal/orchestrator/orchestrator.go index 69cffd0..1b87679 100644 --- a/internal/orchestrator/orchestrator.go +++ b/internal/orchestrator/orchestrator.go @@ -1303,12 +1303,12 @@ func (c *Coordinator) research(ref string) (*workphase.Research, error) { return &r, nil } -func (c *Coordinator) plan(ref string) (*workphase.Plan, error) { +func (c *Coordinator) plan(ref string) (*workphase.PlanDoc, error) { b, err := c.Store.Artifact(ref) if err != nil { return nil, err } - p, err := workphase.DecodePlan(b) + p, err := workphase.DecodeStoredPlan(b) if err != nil { return nil, err } diff --git a/internal/webui/assets/assets/index-8NTNRyfU.js b/internal/webui/assets/assets/index-8NTNRyfU.js deleted file mode 100644 index 66904d6..0000000 --- a/internal/webui/assets/assets/index-8NTNRyfU.js +++ /dev/null @@ -1,65 +0,0 @@ -var sy=n=>{throw TypeError(n)};var yo=(n,u,r)=>u.has(n)||sy("Cannot "+r);var x=(n,u,r)=>(yo(n,u,"read from private field"),r?r.call(n):u.get(n)),le=(n,u,r)=>u.has(n)?sy("Cannot add the same private member more than once"):u instanceof WeakSet?u.add(n):u.set(n,r),J=(n,u,r,c)=>(yo(n,u,"write to private field"),c?c.call(n,r):u.set(n,r),r),he=(n,u,r)=>(yo(n,u,"access private method"),r);var Ns=(n,u,r,c)=>({set _(h){J(n,u,h,r)},get _(){return x(n,u,c)}});(function(){const u=document.createElement("link").relList;if(u&&u.supports&&u.supports("modulepreload"))return;for(const h of document.querySelectorAll('link[rel="modulepreload"]'))c(h);new MutationObserver(h=>{for(const d of h)if(d.type==="childList")for(const y of d.addedNodes)y.tagName==="LINK"&&y.rel==="modulepreload"&&c(y)}).observe(document,{childList:!0,subtree:!0});function r(h){const d={};return h.integrity&&(d.integrity=h.integrity),h.referrerPolicy&&(d.referrerPolicy=h.referrerPolicy),h.crossOrigin==="use-credentials"?d.credentials="include":h.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function c(h){if(h.ep)return;h.ep=!0;const d=r(h);fetch(h.href,d)}})();function t0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var po={exports:{}},Ki={};/** - * @license React - * react-jsx-runtime.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var cy;function a0(){if(cy)return Ki;cy=1;var n=Symbol.for("react.transitional.element"),u=Symbol.for("react.fragment");function r(c,h,d){var y=null;if(d!==void 0&&(y=""+d),h.key!==void 0&&(y=""+h.key),"key"in h){d={};for(var v in h)v!=="key"&&(d[v]=h[v])}else d=h;return h=d.ref,{$$typeof:n,type:c,key:y,ref:h!==void 0?h:null,props:d}}return Ki.Fragment=u,Ki.jsx=r,Ki.jsxs=r,Ki}var ry;function l0(){return ry||(ry=1,po.exports=a0()),po.exports}var o=l0(),vo={exports:{}},ce={};/** - * @license React - * react.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var oy;function n0(){if(oy)return ce;oy=1;var n=Symbol.for("react.transitional.element"),u=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),y=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),_=Symbol.iterator;function M(E){return E===null||typeof E!="object"?null:(E=_&&E[_]||E["@@iterator"],typeof E=="function"?E:null)}var Y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},H=Object.assign,U={};function L(E,Q,$){this.props=E,this.context=Q,this.refs=U,this.updater=$||Y}L.prototype.isReactComponent={},L.prototype.setState=function(E,Q){if(typeof E!="object"&&typeof E!="function"&&E!=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,E,Q,"setState")},L.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function k(){}k.prototype=L.prototype;function G(E,Q,$){this.props=E,this.context=Q,this.refs=U,this.updater=$||Y}var X=G.prototype=new k;X.constructor=G,H(X,L.prototype),X.isPureReactComponent=!0;var te=Array.isArray;function F(){}var K={H:null,A:null,T:null,S:null},ae=Object.prototype.hasOwnProperty;function Z(E,Q,$){var I=$.ref;return{$$typeof:n,type:E,key:Q,ref:I!==void 0?I:null,props:$}}function P(E,Q){return Z(E.type,Q,E.props)}function Ee(E){return typeof E=="object"&&E!==null&&E.$$typeof===n}function Le(E){var Q={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function($){return Q[$]})}var jt=/\/+/g;function tt(E,Q){return typeof E=="object"&&E!==null&&E.key!=null?Le(""+E.key):Q.toString(36)}function we(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(F,F):(E.status="pending",E.then(function(Q){E.status==="pending"&&(E.status="fulfilled",E.value=Q)},function(Q){E.status==="pending"&&(E.status="rejected",E.reason=Q)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function w(E,Q,$,I,re){var de=typeof E;(de==="undefined"||de==="boolean")&&(E=null);var Te=!1;if(E===null)Te=!0;else switch(de){case"bigint":case"string":case"number":Te=!0;break;case"object":switch(E.$$typeof){case n:case u:Te=!0;break;case T:return Te=E._init,w(Te(E._payload),Q,$,I,re)}}if(Te)return re=re(E),Te=I===""?"."+tt(E,0):I,te(re)?($="",Te!=null&&($=Te.replace(jt,"$&/")+"/"),w(re,Q,$,"",function(In){return In})):re!=null&&(Ee(re)&&(re=P(re,$+(re.key==null||E&&E.key===re.key?"":(""+re.key).replace(jt,"$&/")+"/")+Te)),Q.push(re)),1;Te=0;var rt=I===""?".":I+":";if(te(E))for(var Xe=0;Xe>>1,Me=w[Ae];if(0>>1;Aeh($,se))Ih(re,$)?(w[Ae]=re,w[I]=se,Ae=I):(w[Ae]=$,w[Q]=se,Ae=Q);else if(Ih(re,se))w[Ae]=re,w[I]=se,Ae=I;else break e}}return V}function h(w,V){var se=w.sortIndex-V.sortIndex;return se!==0?se:w.id-V.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;n.unstable_now=function(){return d.now()}}else{var y=Date,v=y.now();n.unstable_now=function(){return y.now()-v}}var g=[],p=[],T=1,b=null,_=3,M=!1,Y=!1,H=!1,U=!1,L=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,G=typeof setImmediate<"u"?setImmediate:null;function X(w){for(var V=r(p);V!==null;){if(V.callback===null)c(p);else if(V.startTime<=w)c(p),V.sortIndex=V.expirationTime,u(g,V);else break;V=r(p)}}function te(w){if(H=!1,X(w),!Y)if(r(g)!==null)Y=!0,F||(F=!0,Le());else{var V=r(p);V!==null&&we(te,V.startTime-w)}}var F=!1,K=-1,ae=5,Z=-1;function P(){return U?!0:!(n.unstable_now()-Zw&&P());){var Ae=b.callback;if(typeof Ae=="function"){b.callback=null,_=b.priorityLevel;var Me=Ae(b.expirationTime<=w);if(w=n.unstable_now(),typeof Me=="function"){b.callback=Me,X(w),V=!0;break t}b===r(g)&&c(g),X(w)}else c(g);b=r(g)}if(b!==null)V=!0;else{var E=r(p);E!==null&&we(te,E.startTime-w),V=!1}}break e}finally{b=null,_=se,M=!1}V=void 0}}finally{V?Le():F=!1}}}var Le;if(typeof G=="function")Le=function(){G(Ee)};else if(typeof MessageChannel<"u"){var jt=new MessageChannel,tt=jt.port2;jt.port1.onmessage=Ee,Le=function(){tt.postMessage(null)}}else Le=function(){L(Ee,0)};function we(w,V){K=L(function(){w(n.unstable_now())},V)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(w){w.callback=null},n.unstable_forceFrameRate=function(w){0>w||125Ae?(w.sortIndex=se,u(p,w),r(g)===null&&w===r(p)&&(H?(k(K),K=-1):H=!0,we(te,se-Ae))):(w.sortIndex=Me,u(g,w),Y||M||(Y=!0,F||(F=!0,Le()))),w},n.unstable_shouldYield=P,n.unstable_wrapCallback=function(w){var V=_;return function(){var se=_;_=V;try{return w.apply(this,arguments)}finally{_=se}}}})(So)),So}var dy;function s0(){return dy||(dy=1,bo.exports=u0()),bo.exports}var xo={exports:{}},st={};/** - * @license React - * react-dom.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var my;function c0(){if(my)return st;my=1;var n=Xo();function u(g){var p="https://react.dev/errors/"+g;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(u){console.error(u)}}return n(),xo.exports=c0(),xo.exports}/** - * @license React - * react-dom-client.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var py;function o0(){if(py)return Vi;py=1;var n=s0(),u=Xo(),r=r0();function c(e){var t="https://react.dev/errors/"+e;if(1Me||(e.current=Ae[Me],Ae[Me]=null,Me--)}function $(e,t){Me++,Ae[Me]=e.current,e.current=t}var I=E(null),re=E(null),de=E(null),Te=E(null);function rt(e,t){switch($(de,t),$(re,e),$(I,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?_m(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=_m(t),e=zm(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Q(I),$(I,e)}function Xe(){Q(I),Q(re),Q(de)}function In(e){e.memoizedState!==null&&$(Te,e);var t=I.current,a=zm(t,e.type);t!==a&&($(re,e),$(I,a))}function fu(e){re.current===e&&(Q(I),Q(re)),Te.current===e&&(Q(Te),Gi._currentValue=se)}var $s,uf;function Sl(e){if($s===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);$s=t&&t[1]||"",uf=-1)":-1i||S[l]!==A[i]){var D=` -`+S[l].replace(" at new "," at ");return e.displayName&&D.includes("")&&(D=D.replace("",e.displayName)),D}while(1<=l&&0<=i);break}}}finally{Ws=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Sl(a):""}function Mp(e,t){switch(e.tag){case 26:case 27:case 5:return Sl(e.type);case 16:return Sl("Lazy");case 13:return e.child!==t&&t!==null?Sl("Suspense Fallback"):Sl("Suspense");case 19:return Sl("SuspenseList");case 0:case 15:return Ps(e.type,!1);case 11:return Ps(e.type.render,!1);case 1:return Ps(e.type,!0);case 31:return Sl("Activity");default:return""}}function sf(e){try{var t="",a=null;do t+=Mp(e,a),a=e,e=e.return;while(e);return t}catch(l){return` -Error generating stack: `+l.message+` -`+l.stack}}var Is=Object.prototype.hasOwnProperty,ec=n.unstable_scheduleCallback,tc=n.unstable_cancelCallback,Dp=n.unstable_shouldYield,wp=n.unstable_requestPaint,Et=n.unstable_now,Up=n.unstable_getCurrentPriorityLevel,cf=n.unstable_ImmediatePriority,rf=n.unstable_UserBlockingPriority,hu=n.unstable_NormalPriority,Hp=n.unstable_LowPriority,of=n.unstable_IdlePriority,qp=n.log,Lp=n.unstable_setDisableYieldValue,ei=null,Tt=null;function Ha(e){if(typeof qp=="function"&&Lp(e),Tt&&typeof Tt.setStrictMode=="function")try{Tt.setStrictMode(ei,e)}catch{}}var Ct=Math.clz32?Math.clz32:Yp,Bp=Math.log,Qp=Math.LN2;function Yp(e){return e>>>=0,e===0?32:31-(Bp(e)/Qp|0)|0}var du=256,mu=262144,yu=4194304;function xl(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function pu(e,t,a){var l=e.pendingLanes;if(l===0)return 0;var i=0,s=e.suspendedLanes,f=e.pingedLanes;e=e.warmLanes;var m=l&134217727;return m!==0?(l=m&~s,l!==0?i=xl(l):(f&=m,f!==0?i=xl(f):a||(a=m&~e,a!==0&&(i=xl(a))))):(m=l&~s,m!==0?i=xl(m):f!==0?i=xl(f):a||(a=l&~e,a!==0&&(i=xl(a)))),i===0?0:t!==0&&t!==i&&(t&s)===0&&(s=i&-i,a=t&-t,s>=a||s===32&&(a&4194048)!==0)?t:i}function ti(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Gp(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 ff(){var e=yu;return yu<<=1,(yu&62914560)===0&&(yu=4194304),e}function ac(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function ai(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Xp(e,t,a,l,i,s){var f=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var m=e.entanglements,S=e.expirationTimes,A=e.hiddenUpdates;for(a=f&~a;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Fp=/[\n"\\]/g;function Ht(e){return e.replace(Fp,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function cc(e,t,a,l,i,s,f,m){e.name="",f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?e.type=f:e.removeAttribute("type"),t!=null?f==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Ut(t)):e.value!==""+Ut(t)&&(e.value=""+Ut(t)):f!=="submit"&&f!=="reset"||e.removeAttribute("value"),t!=null?rc(e,f,Ut(t)):a!=null?rc(e,f,Ut(a)):l!=null&&e.removeAttribute("value"),i==null&&s!=null&&(e.defaultChecked=!!s),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"?e.name=""+Ut(m):e.removeAttribute("name")}function Tf(e,t,a,l,i,s,f,m){if(s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(e.type=s),t!=null||a!=null){if(!(s!=="submit"&&s!=="reset"||t!=null)){sc(e);return}a=a!=null?""+Ut(a):"",t=t!=null?""+Ut(t):a,m||t===e.value||(e.value=t),e.defaultValue=t}l=l??i,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=m?e.checked:!!l,e.defaultChecked=!!l,f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.name=f),sc(e)}function rc(e,t,a){t==="number"&&bu(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function tn(e,t,a,l){if(e=e.options,t){t={};for(var i=0;i"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),mc=!1;if(da)try{var ui={};Object.defineProperty(ui,"passive",{get:function(){mc=!0}}),window.addEventListener("test",ui,ui),window.removeEventListener("test",ui,ui)}catch{mc=!1}var La=null,yc=null,xu=null;function zf(){if(xu)return xu;var e,t=yc,a=t.length,l,i="value"in La?La.value:La.textContent,s=i.length;for(e=0;e=ri),qf=" ",Lf=!1;function Bf(e,t){switch(e){case"keyup":return Ev.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Qf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var un=!1;function Cv(e,t){switch(e){case"compositionend":return Qf(t);case"keypress":return t.which!==32?null:(Lf=!0,qf);case"textInput":return e=t.data,e===qf&&Lf?null:e;default:return null}}function Rv(e,t){if(un)return e==="compositionend"||!Sc&&Bf(e,t)?(e=zf(),xu=yc=La=null,un=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:a,offset:t-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Jf(a)}}function $f(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?$f(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Wf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=bu(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=bu(e.document)}return t}function Ec(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var wv=da&&"documentMode"in document&&11>=document.documentMode,sn=null,Tc=null,di=null,Cc=!1;function Pf(e,t,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Cc||sn==null||sn!==bu(l)||(l=sn,"selectionStart"in l&&Ec(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),di&&hi(di,l)||(di=l,l=ms(Tc,"onSelect"),0>=f,i-=f,ea=1<<32-Ct(t)+i|a<fe?(ve=ee,ee=null):ve=ee.sibling;var xe=N(R,ee,O[fe],q);if(xe===null){ee===null&&(ee=ve);break}e&&ee&&xe.alternate===null&&t(R,ee),j=s(xe,j,fe),Se===null?ne=xe:Se.sibling=xe,Se=xe,ee=ve}if(fe===O.length)return a(R,ee),ge&&ya(R,fe),ne;if(ee===null){for(;fefe?(ve=ee,ee=null):ve=ee.sibling;var ul=N(R,ee,xe.value,q);if(ul===null){ee===null&&(ee=ve);break}e&&ee&&ul.alternate===null&&t(R,ee),j=s(ul,j,fe),Se===null?ne=ul:Se.sibling=ul,Se=ul,ee=ve}if(xe.done)return a(R,ee),ge&&ya(R,fe),ne;if(ee===null){for(;!xe.done;fe++,xe=O.next())xe=B(R,xe.value,q),xe!==null&&(j=s(xe,j,fe),Se===null?ne=xe:Se.sibling=xe,Se=xe);return ge&&ya(R,fe),ne}for(ee=l(ee);!xe.done;fe++,xe=O.next())xe=z(ee,R,fe,xe.value,q),xe!==null&&(e&&xe.alternate!==null&&ee.delete(xe.key===null?fe:xe.key),j=s(xe,j,fe),Se===null?ne=xe:Se.sibling=xe,Se=xe);return e&&ee.forEach(function(e0){return t(R,e0)}),ge&&ya(R,fe),ne}function ze(R,j,O,q){if(typeof O=="object"&&O!==null&&O.type===H&&O.key===null&&(O=O.props.children),typeof O=="object"&&O!==null){switch(O.$$typeof){case M:e:{for(var ne=O.key;j!==null;){if(j.key===ne){if(ne=O.type,ne===H){if(j.tag===7){a(R,j.sibling),q=i(j,O.props.children),q.return=R,R=q;break e}}else if(j.elementType===ne||typeof ne=="object"&&ne!==null&&ne.$$typeof===ae&&Ml(ne)===j.type){a(R,j.sibling),q=i(j,O.props),bi(q,O),q.return=R,R=q;break e}a(R,j);break}else t(R,j);j=j.sibling}O.type===H?(q=Ol(O.props.children,R.mode,q,O.key),q.return=R,R=q):(q=zu(O.type,O.key,O.props,null,R.mode,q),bi(q,O),q.return=R,R=q)}return f(R);case Y:e:{for(ne=O.key;j!==null;){if(j.key===ne)if(j.tag===4&&j.stateNode.containerInfo===O.containerInfo&&j.stateNode.implementation===O.implementation){a(R,j.sibling),q=i(j,O.children||[]),q.return=R,R=q;break e}else{a(R,j);break}else t(R,j);j=j.sibling}q=Mc(O,R.mode,q),q.return=R,R=q}return f(R);case ae:return O=Ml(O),ze(R,j,O,q)}if(we(O))return W(R,j,O,q);if(Le(O)){if(ne=Le(O),typeof ne!="function")throw Error(c(150));return O=ne.call(O),ie(R,j,O,q)}if(typeof O.then=="function")return ze(R,j,Lu(O),q);if(O.$$typeof===G)return ze(R,j,wu(R,O),q);Bu(R,O)}return typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint"?(O=""+O,j!==null&&j.tag===6?(a(R,j.sibling),q=i(j,O),q.return=R,R=q):(a(R,j),q=zc(O,R.mode,q),q.return=R,R=q),f(R)):a(R,j)}return function(R,j,O,q){try{gi=0;var ne=ze(R,j,O,q);return gn=null,ne}catch(ee){if(ee===vn||ee===Hu)throw ee;var Se=Ot(29,ee,null,R.mode);return Se.lanes=q,Se.return=R,Se}finally{}}}var wl=xh(!0),jh=xh(!1),Xa=!1;function kc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Zc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ka(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Za(e,t,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(je&2)!==0){var i=l.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),l.pending=t,t=_u(e),ih(e,null,a),t}return Nu(e,l,t,a),_u(e)}function Si(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,df(e,a)}}function Kc(e,t){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var i=null,s=null;if(a=a.firstBaseUpdate,a!==null){do{var f={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};s===null?i=s=f:s=s.next=f,a=a.next}while(a!==null);s===null?i=s=t:s=s.next=t}else i=s=t;a={baseState:l.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Vc=!1;function xi(){if(Vc){var e=pn;if(e!==null)throw e}}function ji(e,t,a,l){Vc=!1;var i=e.updateQueue;Xa=!1;var s=i.firstBaseUpdate,f=i.lastBaseUpdate,m=i.shared.pending;if(m!==null){i.shared.pending=null;var S=m,A=S.next;S.next=null,f===null?s=A:f.next=A,f=S;var D=e.alternate;D!==null&&(D=D.updateQueue,m=D.lastBaseUpdate,m!==f&&(m===null?D.firstBaseUpdate=A:m.next=A,D.lastBaseUpdate=S))}if(s!==null){var B=i.baseState;f=0,D=A=S=null,m=s;do{var N=m.lane&-536870913,z=N!==m.lane;if(z?(pe&N)===N:(l&N)===N){N!==0&&N===yn&&(Vc=!0),D!==null&&(D=D.next={lane:0,tag:m.tag,payload:m.payload,callback:null,next:null});e:{var W=e,ie=m;N=t;var ze=a;switch(ie.tag){case 1:if(W=ie.payload,typeof W=="function"){B=W.call(ze,B,N);break e}B=W;break e;case 3:W.flags=W.flags&-65537|128;case 0:if(W=ie.payload,N=typeof W=="function"?W.call(ze,B,N):W,N==null)break e;B=b({},B,N);break e;case 2:Xa=!0}}N=m.callback,N!==null&&(e.flags|=64,z&&(e.flags|=8192),z=i.callbacks,z===null?i.callbacks=[N]:z.push(N))}else z={lane:N,tag:m.tag,payload:m.payload,callback:m.callback,next:null},D===null?(A=D=z,S=B):D=D.next=z,f|=N;if(m=m.next,m===null){if(m=i.shared.pending,m===null)break;z=m,m=z.next,z.next=null,i.lastBaseUpdate=z,i.shared.pending=null}}while(!0);D===null&&(S=B),i.baseState=S,i.firstBaseUpdate=A,i.lastBaseUpdate=D,s===null&&(i.shared.lanes=0),$a|=f,e.lanes=f,e.memoizedState=B}}function Eh(e,t){if(typeof e!="function")throw Error(c(191,e));e.call(t)}function Th(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;es?s:8;var f=w.T,m={};w.T=m,hr(e,!1,t,a);try{var S=i(),A=w.S;if(A!==null&&A(m,S),S!==null&&typeof S=="object"&&typeof S.then=="function"){var D=Xv(S,l);Ci(e,t,D,Mt(e))}else Ci(e,t,l,Mt(e))}catch(B){Ci(e,t,{then:function(){},status:"rejected",reason:B},Mt())}finally{V.p=s,f!==null&&m.types!==null&&(f.types=m.types),w.T=f}}function Fv(){}function or(e,t,a,l){if(e.tag!==5)throw Error(c(476));var i=ad(e).queue;td(e,i,t,se,a===null?Fv:function(){return ld(e),a(l)})}function ad(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ba,lastRenderedState:se},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ba,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ld(e){var t=ad(e);t.next===null&&(t=e.alternate.memoizedState),Ci(e,t.next.queue,{},Mt())}function fr(){return nt(Gi)}function nd(){return Ze().memoizedState}function id(){return Ze().memoizedState}function $v(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=Mt();e=ka(a);var l=Za(t,e,a);l!==null&&(bt(l,t,a),Si(l,t,a)),t={cache:Qc()},e.payload=t;return}t=t.return}}function Wv(e,t,a){var l=Mt();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Fu(e)?sd(t,a):(a=Nc(e,t,a,l),a!==null&&(bt(a,e,l),cd(a,t,l)))}function ud(e,t,a){var l=Mt();Ci(e,t,a,l)}function Ci(e,t,a,l){var i={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Fu(e))sd(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var f=t.lastRenderedState,m=s(f,a);if(i.hasEagerState=!0,i.eagerState=m,Rt(m,f))return Nu(e,t,i,0),De===null&&Au(),!1}catch{}finally{}if(a=Nc(e,t,i,l),a!==null)return bt(a,e,l),cd(a,t,l),!0}return!1}function hr(e,t,a,l){if(l={lane:2,revertLane:kr(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Fu(e)){if(t)throw Error(c(479))}else t=Nc(e,a,l,2),t!==null&&bt(t,e,2)}function Fu(e){var t=e.alternate;return e===oe||t!==null&&t===oe}function sd(e,t){Sn=Gu=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function cd(e,t,a){if((a&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,df(e,a)}}var Ri={readContext:nt,use:Zu,useCallback:Qe,useContext:Qe,useEffect:Qe,useImperativeHandle:Qe,useLayoutEffect:Qe,useInsertionEffect:Qe,useMemo:Qe,useReducer:Qe,useRef:Qe,useState:Qe,useDebugValue:Qe,useDeferredValue:Qe,useTransition:Qe,useSyncExternalStore:Qe,useId:Qe,useHostTransitionStatus:Qe,useFormState:Qe,useActionState:Qe,useOptimistic:Qe,useMemoCache:Qe,useCacheRefresh:Qe};Ri.useEffectEvent=Qe;var rd={readContext:nt,use:Zu,useCallback:function(e,t){return ot().memoizedState=[e,t===void 0?null:t],e},useContext:nt,useEffect:Kh,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Vu(4194308,4,$h.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Vu(4194308,4,e,t)},useInsertionEffect:function(e,t){Vu(4,2,e,t)},useMemo:function(e,t){var a=ot();t=t===void 0?null:t;var l=e();if(Ul){Ha(!0);try{e()}finally{Ha(!1)}}return a.memoizedState=[l,t],l},useReducer:function(e,t,a){var l=ot();if(a!==void 0){var i=a(t);if(Ul){Ha(!0);try{a(t)}finally{Ha(!1)}}}else i=t;return l.memoizedState=l.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},l.queue=e,e=e.dispatch=Wv.bind(null,oe,e),[l.memoizedState,e]},useRef:function(e){var t=ot();return e={current:e},t.memoizedState=e},useState:function(e){e=ir(e);var t=e.queue,a=ud.bind(null,oe,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:cr,useDeferredValue:function(e,t){var a=ot();return rr(a,e,t)},useTransition:function(){var e=ir(!1);return e=td.bind(null,oe,e.queue,!0,!1),ot().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var l=oe,i=ot();if(ge){if(a===void 0)throw Error(c(407));a=a()}else{if(a=t(),De===null)throw Error(c(349));(pe&127)!==0||_h(l,t,a)}i.memoizedState=a;var s={value:a,getSnapshot:t};return i.queue=s,Kh(Mh.bind(null,l,s,e),[e]),l.flags|=2048,jn(9,{destroy:void 0},zh.bind(null,l,s,a,t),null),a},useId:function(){var e=ot(),t=De.identifierPrefix;if(ge){var a=ta,l=ea;a=(l&~(1<<32-Ct(l)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Xu++,0<\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof l.is=="string"?f.createElement("select",{is:l.is}):f.createElement("select"),l.multiple?s.multiple=!0:l.size&&(s.size=l.size);break;default:s=typeof l.is=="string"?f.createElement(i,{is:l.is}):f.createElement(i)}}s[at]=t,s[dt]=l;e:for(f=t.child;f!==null;){if(f.tag===5||f.tag===6)s.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}t.stateNode=s;e:switch(ut(s,i,l),i){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&xa(t)}}return He(t),Rr(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&xa(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(c(166));if(e=de.current,dn(t)){if(e=t.stateNode,a=t.memoizedProps,l=null,i=lt,i!==null)switch(i.tag){case 27:case 5:l=i.memoizedProps}e[at]=t,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||Am(e.nodeValue,a)),e||Ya(t,!0)}else e=ys(e).createTextNode(l),e[at]=t,t.stateNode=e}return He(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(l=dn(t),a!==null){if(e===null){if(!l)throw Error(c(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(557));e[at]=t}else Al(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;He(t),e=!1}else a=Hc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(Nt(t),t):(Nt(t),null);if((t.flags&128)!==0)throw Error(c(558))}return He(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=dn(t),l!==null&&l.dehydrated!==null){if(e===null){if(!i)throw Error(c(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(c(317));i[at]=t}else Al(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;He(t),i=!1}else i=Hc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(Nt(t),t):(Nt(t),null)}return Nt(t),(t.flags&128)!==0?(t.lanes=a,t):(a=l!==null,e=e!==null&&e.memoizedState!==null,a&&(l=t.child,i=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(i=l.alternate.memoizedState.cachePool.pool),s=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(s=l.memoizedState.cachePool.pool),s!==i&&(l.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),es(t,t.updateQueue),He(t),null);case 4:return Xe(),e===null&&Jr(t.stateNode.containerInfo),He(t),null;case 10:return va(t.type),He(t),null;case 19:if(Q(ke),l=t.memoizedState,l===null)return He(t),null;if(i=(t.flags&128)!==0,s=l.rendering,s===null)if(i)Ai(l,!1);else{if(Ye!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(s=Yu(e),s!==null){for(t.flags|=128,Ai(l,!1),e=s.updateQueue,t.updateQueue=e,es(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)uh(a,e),a=a.sibling;return $(ke,ke.current&1|2),ge&&ya(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&Et()>is&&(t.flags|=128,i=!0,Ai(l,!1),t.lanes=4194304)}else{if(!i)if(e=Yu(s),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,es(t,e),Ai(l,!0),l.tail===null&&l.tailMode==="hidden"&&!s.alternate&&!ge)return He(t),null}else 2*Et()-l.renderingStartTime>is&&a!==536870912&&(t.flags|=128,i=!0,Ai(l,!1),t.lanes=4194304);l.isBackwards?(s.sibling=t.child,t.child=s):(e=l.last,e!==null?e.sibling=s:t.child=s,l.last=s)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=Et(),e.sibling=null,a=ke.current,$(ke,i?a&1|2:a&1),ge&&ya(t,l.treeForkCount),e):(He(t),null);case 22:case 23:return Nt(t),Fc(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(a&536870912)!==0&&(t.flags&128)===0&&(He(t),t.subtreeFlags&6&&(t.flags|=8192)):He(t),a=t.updateQueue,a!==null&&es(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==a&&(t.flags|=2048),e!==null&&Q(zl),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),va(Ke),He(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function ag(e,t){switch(wc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return va(Ke),Xe(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return fu(t),null;case 31:if(t.memoizedState!==null){if(Nt(t),t.alternate===null)throw Error(c(340));Al()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Nt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(c(340));Al()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Q(ke),null;case 4:return Xe(),null;case 10:return va(t.type),null;case 22:case 23:return Nt(t),Fc(),e!==null&&Q(zl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return va(Ke),null;case 25:return null;default:return null}}function Dd(e,t){switch(wc(t),t.tag){case 3:va(Ke),Xe();break;case 26:case 27:case 5:fu(t);break;case 4:Xe();break;case 31:t.memoizedState!==null&&Nt(t);break;case 13:Nt(t);break;case 19:Q(ke);break;case 10:va(t.type);break;case 22:case 23:Nt(t),Fc(),e!==null&&Q(zl);break;case 24:va(Ke)}}function Ni(e,t){try{var a=t.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var i=l.next;a=i;do{if((a.tag&e)===e){l=void 0;var s=a.create,f=a.inst;l=s(),f.destroy=l}a=a.next}while(a!==i)}}catch(m){Oe(t,t.return,m)}}function Ja(e,t,a){try{var l=t.updateQueue,i=l!==null?l.lastEffect:null;if(i!==null){var s=i.next;l=s;do{if((l.tag&e)===e){var f=l.inst,m=f.destroy;if(m!==void 0){f.destroy=void 0,i=t;var S=a,A=m;try{A()}catch(D){Oe(i,S,D)}}}l=l.next}while(l!==s)}}catch(D){Oe(t,t.return,D)}}function wd(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Th(t,a)}catch(l){Oe(e,e.return,l)}}}function Ud(e,t,a){a.props=Hl(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){Oe(e,t,l)}}function _i(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof a=="function"?e.refCleanup=a(l):a.current=l}}catch(i){Oe(e,t,i)}}function aa(e,t){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(i){Oe(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(i){Oe(e,t,i)}else a.current=null}function Hd(e){var t=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(i){Oe(e,e.return,i)}}function Or(e,t,a){try{var l=e.stateNode;Tg(l,e.type,a,t),l[dt]=t}catch(i){Oe(e,e.return,i)}}function qd(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&tl(e.type)||e.tag===4}function Ar(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qd(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&tl(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Nr(e,t,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=ha));else if(l!==4&&(l===27&&tl(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Nr(e,t,a),e=e.sibling;e!==null;)Nr(e,t,a),e=e.sibling}function ts(e,t,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(l!==4&&(l===27&&tl(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(ts(e,t,a),e=e.sibling;e!==null;)ts(e,t,a),e=e.sibling}function Ld(e){var t=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);ut(t,l,a),t[at]=e,t[dt]=a}catch(s){Oe(e,e.return,s)}}var ja=!1,Fe=!1,_r=!1,Bd=typeof WeakSet=="function"?WeakSet:Set,Ie=null;function lg(e,t){if(e=e.containerInfo,Wr=js,e=Wf(e),Ec(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var i=l.anchorOffset,s=l.focusNode;l=l.focusOffset;try{a.nodeType,s.nodeType}catch{a=null;break e}var f=0,m=-1,S=-1,A=0,D=0,B=e,N=null;t:for(;;){for(var z;B!==a||i!==0&&B.nodeType!==3||(m=f+i),B!==s||l!==0&&B.nodeType!==3||(S=f+l),B.nodeType===3&&(f+=B.nodeValue.length),(z=B.firstChild)!==null;)N=B,B=z;for(;;){if(B===e)break t;if(N===a&&++A===i&&(m=f),N===s&&++D===l&&(S=f),(z=B.nextSibling)!==null)break;B=N,N=B.parentNode}B=z}a=m===-1||S===-1?null:{start:m,end:S}}else a=null}a=a||{start:0,end:0}}else a=null;for(Pr={focusedElem:e,selectionRange:a},js=!1,Ie=t;Ie!==null;)if(t=Ie,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ie=e;else for(;Ie!==null;){switch(t=Ie,s=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a title"))),ut(s,l,a),s[at]=e,Pe(s),l=s;break e;case"link":var f=Zm("link","href",i).get(l+(a.href||""));if(f){for(var m=0;mze&&(f=ze,ze=ie,ie=f);var R=Ff(m,ie),j=Ff(m,ze);if(R&&j&&(z.rangeCount!==1||z.anchorNode!==R.node||z.anchorOffset!==R.offset||z.focusNode!==j.node||z.focusOffset!==j.offset)){var O=B.createRange();O.setStart(R.node,R.offset),z.removeAllRanges(),ie>ze?(z.addRange(O),z.extend(j.node,j.offset)):(O.setEnd(j.node,j.offset),z.addRange(O))}}}}for(B=[],z=m;z=z.parentNode;)z.nodeType===1&&B.push({element:z,left:z.scrollLeft,top:z.scrollTop});for(typeof m.focus=="function"&&m.focus(),m=0;ma?32:a,w.T=null,a=qr,qr=null;var s=Pa,f=Oa;if($e=0,On=Pa=null,Oa=0,(je&6)!==0)throw Error(c(331));var m=je;if(je|=4,$d(s.current),Vd(s,s.current,f,a),je=m,Hi(0,!1),Tt&&typeof Tt.onPostCommitFiberRoot=="function")try{Tt.onPostCommitFiberRoot(ei,s)}catch{}return!0}finally{V.p=i,w.T=l,mm(e,t)}}function pm(e,t,a){t=Lt(a,t),t=pr(e.stateNode,t,2),e=Za(e,t,2),e!==null&&(ai(e,2),la(e))}function Oe(e,t,a){if(e.tag===3)pm(e,e,a);else for(;t!==null;){if(t.tag===3){pm(t,e,a);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Wa===null||!Wa.has(l))){e=Lt(a,e),a=vd(2),l=Za(t,a,2),l!==null&&(gd(a,l,t,e),ai(l,2),la(l));break}}t=t.return}}function Yr(e,t,a){var l=e.pingCache;if(l===null){l=e.pingCache=new ug;var i=new Set;l.set(t,i)}else i=l.get(t),i===void 0&&(i=new Set,l.set(t,i));i.has(a)||(Dr=!0,i.add(a),e=fg.bind(null,e,t,a),t.then(e,e))}function fg(e,t,a){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,De===e&&(pe&a)===a&&(Ye===4||Ye===3&&(pe&62914560)===pe&&300>Et()-ns?(je&2)===0&&An(e,0):wr|=a,Rn===pe&&(Rn=0)),la(e)}function vm(e,t){t===0&&(t=ff()),e=Rl(e,t),e!==null&&(ai(e,t),la(e))}function hg(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),vm(e,a)}function dg(e,t){var a=0;switch(e.tag){case 31:case 13:var l=e.stateNode,i=e.memoizedState;i!==null&&(a=i.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(c(314))}l!==null&&l.delete(t),vm(e,a)}function mg(e,t){return ec(e,t)}var fs=null,_n=null,Gr=!1,hs=!1,Xr=!1,el=0;function la(e){e!==_n&&e.next===null&&(_n===null?fs=_n=e:_n=_n.next=e),hs=!0,Gr||(Gr=!0,pg())}function Hi(e,t){if(!Xr&&hs){Xr=!0;do for(var a=!1,l=fs;l!==null;){if(e!==0){var i=l.pendingLanes;if(i===0)var s=0;else{var f=l.suspendedLanes,m=l.pingedLanes;s=(1<<31-Ct(42|e)+1)-1,s&=i&~(f&~m),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(a=!0,xm(l,s))}else s=pe,s=pu(l,l===De?s:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(s&3)===0||ti(l,s)||(a=!0,xm(l,s));l=l.next}while(a);Xr=!1}}function yg(){gm()}function gm(){hs=Gr=!1;var e=0;el!==0&&Rg()&&(e=el);for(var t=Et(),a=null,l=fs;l!==null;){var i=l.next,s=bm(l,t);s===0?(l.next=null,a===null?fs=i:a.next=i,i===null&&(_n=a)):(a=l,(e!==0||(s&3)!==0)&&(hs=!0)),l=i}$e!==0&&$e!==5||Hi(e),el!==0&&(el=0)}function bm(e,t){for(var a=e.suspendedLanes,l=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes&-62914561;0m)break;var D=S.transferSize,B=S.initiatorType;D&&Nm(B)&&(S=S.responseEnd,f+=D*(S"u"?null:document;function Ym(e,t,a){var l=zn;if(l&&typeof t=="string"&&t){var i=Ht(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof a=="string"&&(i+='[crossorigin="'+a+'"]'),Qm.has(i)||(Qm.add(i),e={rel:e,crossOrigin:a,href:t},l.querySelector(i)===null&&(t=l.createElement("link"),ut(t,"link",e),Pe(t),l.head.appendChild(t)))}}function Ug(e){Aa.D(e),Ym("dns-prefetch",e,null)}function Hg(e,t){Aa.C(e,t),Ym("preconnect",e,t)}function qg(e,t,a){Aa.L(e,t,a);var l=zn;if(l&&e&&t){var i='link[rel="preload"][as="'+Ht(t)+'"]';t==="image"&&a&&a.imageSrcSet?(i+='[imagesrcset="'+Ht(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(i+='[imagesizes="'+Ht(a.imageSizes)+'"]')):i+='[href="'+Ht(e)+'"]';var s=i;switch(t){case"style":s=Mn(e);break;case"script":s=Dn(e)}kt.has(s)||(e=b({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),kt.set(s,e),l.querySelector(i)!==null||t==="style"&&l.querySelector(Qi(s))||t==="script"&&l.querySelector(Yi(s))||(t=l.createElement("link"),ut(t,"link",e),Pe(t),l.head.appendChild(t)))}}function Lg(e,t){Aa.m(e,t);var a=zn;if(a&&e){var l=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+Ht(l)+'"][href="'+Ht(e)+'"]',s=i;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=Dn(e)}if(!kt.has(s)&&(e=b({rel:"modulepreload",href:e},t),kt.set(s,e),a.querySelector(i)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Yi(s)))return}l=a.createElement("link"),ut(l,"link",e),Pe(l),a.head.appendChild(l)}}}function Bg(e,t,a){Aa.S(e,t,a);var l=zn;if(l&&e){var i=Il(l).hoistableStyles,s=Mn(e);t=t||"default";var f=i.get(s);if(!f){var m={loading:0,preload:null};if(f=l.querySelector(Qi(s)))m.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},a),(a=kt.get(s))&&io(e,a);var S=f=l.createElement("link");Pe(S),ut(S,"link",e),S._p=new Promise(function(A,D){S.onload=A,S.onerror=D}),S.addEventListener("load",function(){m.loading|=1}),S.addEventListener("error",function(){m.loading|=2}),m.loading|=4,vs(f,t,l)}f={type:"stylesheet",instance:f,count:1,state:m},i.set(s,f)}}}function Qg(e,t){Aa.X(e,t);var a=zn;if(a&&e){var l=Il(a).hoistableScripts,i=Dn(e),s=l.get(i);s||(s=a.querySelector(Yi(i)),s||(e=b({src:e,async:!0},t),(t=kt.get(i))&&uo(e,t),s=a.createElement("script"),Pe(s),ut(s,"link",e),a.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(i,s))}}function Yg(e,t){Aa.M(e,t);var a=zn;if(a&&e){var l=Il(a).hoistableScripts,i=Dn(e),s=l.get(i);s||(s=a.querySelector(Yi(i)),s||(e=b({src:e,async:!0,type:"module"},t),(t=kt.get(i))&&uo(e,t),s=a.createElement("script"),Pe(s),ut(s,"link",e),a.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},l.set(i,s))}}function Gm(e,t,a,l){var i=(i=de.current)?ps(i):null;if(!i)throw Error(c(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Mn(a.href),a=Il(i).hoistableStyles,l=a.get(t),l||(l={type:"style",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Mn(a.href);var s=Il(i).hoistableStyles,f=s.get(e);if(f||(i=i.ownerDocument||i,f={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,f),(s=i.querySelector(Qi(e)))&&!s._p&&(f.instance=s,f.state.loading=5),kt.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},kt.set(e,a),s||Gg(i,e,a,f.state))),t&&l===null)throw Error(c(528,""));return f}if(t&&l!==null)throw Error(c(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Dn(a),a=Il(i).hoistableScripts,l=a.get(t),l||(l={type:"script",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(c(444,e))}}function Mn(e){return'href="'+Ht(e)+'"'}function Qi(e){return'link[rel="stylesheet"]['+e+"]"}function Xm(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function Gg(e,t,a,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),ut(t,"link",a),Pe(t),e.head.appendChild(t))}function Dn(e){return'[src="'+Ht(e)+'"]'}function Yi(e){return"script[async]"+e}function km(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+Ht(a.href)+'"]');if(l)return t.instance=l,Pe(l),l;var i=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),Pe(l),ut(l,"style",i),vs(l,a.precedence,e),t.instance=l;case"stylesheet":i=Mn(a.href);var s=e.querySelector(Qi(i));if(s)return t.state.loading|=4,t.instance=s,Pe(s),s;l=Xm(a),(i=kt.get(i))&&io(l,i),s=(e.ownerDocument||e).createElement("link"),Pe(s);var f=s;return f._p=new Promise(function(m,S){f.onload=m,f.onerror=S}),ut(s,"link",l),t.state.loading|=4,vs(s,a.precedence,e),t.instance=s;case"script":return s=Dn(a.src),(i=e.querySelector(Yi(s)))?(t.instance=i,Pe(i),i):(l=a,(i=kt.get(s))&&(l=b({},a),uo(l,i)),e=e.ownerDocument||e,i=e.createElement("script"),Pe(i),ut(i,"link",l),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(c(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,vs(l,a.precedence,e));return t.instance}function vs(e,t,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=l.length?l[l.length-1]:null,s=i,f=0;f title"):null)}function Xg(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Vm(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function kg(e,t,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var i=Mn(l.href),s=t.querySelector(Qi(i));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=bs.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=s,Pe(s);return}s=t.ownerDocument||t,l=Xm(l),(i=kt.get(i))&&io(l,i),s=s.createElement("link"),Pe(s);var f=s;f._p=new Promise(function(m,S){f.onload=m,f.onerror=S}),ut(s,"link",l),a.instance=s}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=bs.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var so=0;function Zg(e,t){return e.stylesheets&&e.count===0&&xs(e,e.stylesheets),0so?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(i)}}:null}function bs(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)xs(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ss=null;function xs(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ss=new Map,t.forEach(Kg,e),Ss=null,bs.call(e))}function Kg(e,t){if(!(t.state.loading&4)){var a=Ss.get(e);if(a)var l=a.get(null);else{a=new Map,Ss.set(e,a);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(u){console.error(u)}}return n(),go.exports=o0(),go.exports}var h0=f0();/** - * react-router v7.18.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */var ko=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Fy=/^[\\/]{2}/;function d0(n,u){return u+n.replace(/\\/g,"/")}var gy="popstate";function by(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function m0(n={}){function u(c,h){var p;let d=(p=h.state)==null?void 0:p.masked,{pathname:y,search:v,hash:g}=d||c.location;return Co("",{pathname:y,search:v,hash:g},h.state&&h.state.usr||null,h.state&&h.state.key||"default",d?{pathname:c.location.pathname,search:c.location.search,hash:c.location.hash}:void 0)}function r(c,h){return typeof h=="string"?h:Wi(h)}return p0(u,r,null,n)}function Be(n,u){if(n===!1||n===null||typeof n>"u")throw new Error(u)}function ca(n,u){if(!n){typeof console<"u"&&console.warn(u);try{throw new Error(u)}catch{}}}function y0(){return Math.random().toString(36).substring(2,10)}function Sy(n,u){return{usr:n.state,key:n.key,idx:u,masked:n.mask?{pathname:n.pathname,search:n.search,hash:n.hash}:void 0}}function Co(n,u,r=null,c,h){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof u=="string"?$n(u):u,state:r,key:u&&u.key||c||y0(),mask:h}}function Wi({pathname:n="/",search:u="",hash:r=""}){return u&&u!=="?"&&(n+=u.charAt(0)==="?"?u:"?"+u),r&&r!=="#"&&(n+=r.charAt(0)==="#"?r:"#"+r),n}function $n(n){let u={};if(n){let r=n.indexOf("#");r>=0&&(u.hash=n.substring(r),n=n.substring(0,r));let c=n.indexOf("?");c>=0&&(u.search=n.substring(c),n=n.substring(0,c)),n&&(u.pathname=n)}return u}function p0(n,u,r,c={}){let{window:h=document.defaultView,v5Compat:d=!1}=c,y=h.history,v="POP",g=null,p=T();p==null&&(p=0,y.replaceState({...y.state,idx:p},""));function T(){return(y.state||{idx:null}).idx}function b(){v="POP";let U=T(),L=U==null?null:U-p;p=U,g&&g({action:v,location:H.location,delta:L})}function _(U,L){v="PUSH";let k=by(U)?U:Co(H.location,U,L);p=T()+1;let G=Sy(k,p),X=H.createHref(k.mask||k);try{y.pushState(G,"",X)}catch(te){if(te instanceof DOMException&&te.name==="DataCloneError")throw te;h.location.assign(X)}d&&g&&g({action:v,location:H.location,delta:1})}function M(U,L){v="REPLACE";let k=by(U)?U:Co(H.location,U,L);p=T();let G=Sy(k,p),X=H.createHref(k.mask||k);y.replaceState(G,"",X),d&&g&&g({action:v,location:H.location,delta:0})}function Y(U){return v0(h,U)}let H={get action(){return v},get location(){return n(h,y)},listen(U){if(g)throw new Error("A history only accepts one active listener");return h.addEventListener(gy,b),g=U,()=>{h.removeEventListener(gy,b),g=null}},createHref(U){return u(h,U)},createURL:Y,encodeLocation(U){let L=Y(U);return{pathname:L.pathname,search:L.search,hash:L.hash}},push:_,replace:M,go(U){return y.go(U)}};return H}function v0(n,u,r=!1){let c="http://localhost";n&&(c=n.location.origin!=="null"?n.location.origin:n.location.href),Be(c,"No window.location.(origin|href) available to create URL");let h=typeof u=="string"?u:Wi(u);return h=h.replace(/ $/,"%20"),!r&&Fy.test(h)&&(h=c+h),new URL(h,c)}function $y(n,u,r="/"){return g0(n,u,r,!1)}function g0(n,u,r,c,h){let d=typeof u=="string"?$n(u):u,y=Ua(d.pathname||"/",r);if(y==null)return null;let v=b0(n),g=null,p=_0(y);for(let T=0;g==null&&T{let T={relativePath:p===void 0?y.path||"":p,caseSensitive:y.caseSensitive===!0,childrenIndex:v,route:y};if(T.relativePath.startsWith("/")){if(!T.relativePath.startsWith(c)&&g)return;Be(T.relativePath.startsWith(c),`Absolute route path "${T.relativePath}" nested under path "${c}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),T.relativePath=T.relativePath.slice(c.length)}let b=Wt([c,T.relativePath]),_=r.concat(T);y.children&&y.children.length>0&&(Be(y.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),Wy(y.children,u,_,b,g)),!(y.path==null&&!y.index)&&u.push({path:b,score:O0(b,y.index),routesMeta:_.map((M,Y)=>{let[H,U]=ep(M.relativePath,M.caseSensitive,Y===_.length-1);return{...M,matcher:H,compiledParams:U}})})};return n.forEach((y,v)=>{var g;if(y.path===""||!((g=y.path)!=null&&g.includes("?")))d(y,v);else for(let p of Py(y.path))d(y,v,!0,p)}),u}function Py(n){let u=n.split("/");if(u.length===0)return[];let[r,...c]=u,h=r.endsWith("?"),d=r.replace(/\?$/,"");if(c.length===0)return h?[d,""]:[d];let y=Py(c.join("/")),v=[];return v.push(...y.map(g=>g===""?d:[d,g].join("/"))),h&&v.push(...y),v.map(g=>n.startsWith("/")&&g===""?"/":g)}function S0(n){n.sort((u,r)=>u.score!==r.score?r.score-u.score:A0(u.routesMeta.map(c=>c.childrenIndex),r.routesMeta.map(c=>c.childrenIndex)))}var x0=/^:[\w-]+$/,j0=3,E0=2,T0=1,C0=10,R0=-2,xy=n=>n==="*";function O0(n,u){let r=n.split("/"),c=r.length;return r.some(xy)&&(c+=R0),u&&(c+=E0),r.filter(h=>!xy(h)).reduce((h,d)=>h+(x0.test(d)?j0:d===""?T0:C0),c)}function A0(n,u){return n.length===u.length&&n.slice(0,-1).every((c,h)=>c===u[h])?n[n.length-1]-u[u.length-1]:0}function N0(n,u,r=!1){let{routesMeta:c}=n,h={},d="/",y=[];for(let v=0;v{if(T==="*"){let Y=v[_]||"";y=d.slice(0,d.length-Y.length).replace(/(.)\/+$/,"$1")}const M=v[_];return b&&!M?p[T]=void 0:p[T]=(M||"").replace(/%2F/g,"/"),p},{}),pathname:d,pathnameBase:y,pattern:n}}function ep(n,u=!1,r=!0){ca(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let c=[],h="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(y,v,g,p,T)=>{if(c.push({paramName:v,isOptional:g!=null}),g){let b=T.charAt(p+y.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(c.push({paramName:"*"}),h+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?h+="\\/*$":n!==""&&n!=="/"&&(h+="(?:(?=\\/|$))"),[new RegExp(h,u?void 0:"i"),c]}function _0(n){try{return n.split("/").map(u=>decodeURIComponent(u).replace(/\//g,"%2F")).join("/")}catch(u){return ca(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${u}).`),n}}function Ua(n,u){if(u==="/")return n;if(!n.toLowerCase().startsWith(u.toLowerCase()))return null;let r=u.endsWith("/")?u.length-1:u.length,c=n.charAt(r);return c&&c!=="/"?null:n.slice(r)||"/"}function z0(n,u="/"){let{pathname:r,search:c="",hash:h=""}=typeof n=="string"?$n(n):n,d;return r?(r=ap(r),r.startsWith("/")?d=jy(r.substring(1),"/"):d=jy(r,u)):d=u,{pathname:d,search:w0(c),hash:U0(h)}}function jy(n,u){let r=Ls(u).split("/");return n.split("/").forEach(h=>{h===".."?r.length>1&&r.pop():h!=="."&&r.push(h)}),r.length>1?r.join("/"):"/"}function jo(n,u,r,c){return`Cannot include a '${n}' character in a manually specified \`to.${u}\` field [${JSON.stringify(c)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function M0(n){return n.filter((u,r)=>r===0||u.route.path&&u.route.path.length>0)}function tp(n){let u=M0(n);return u.map((r,c)=>c===u.length-1?r.pathname:r.pathnameBase)}function Zo(n,u,r,c=!1){let h;typeof n=="string"?h=$n(n):(h={...n},Be(!h.pathname||!h.pathname.includes("?"),jo("?","pathname","search",h)),Be(!h.pathname||!h.pathname.includes("#"),jo("#","pathname","hash",h)),Be(!h.search||!h.search.includes("#"),jo("#","search","hash",h)));let d=n===""||h.pathname==="",y=d?"/":h.pathname,v;if(y==null)v=r;else{let b=u.length-1;if(!c&&y.startsWith("..")){let _=y.split("/");for(;_[0]==="..";)_.shift(),b-=1;h.pathname=_.join("/")}v=b>=0?u[b]:"/"}let g=z0(h,v),p=y&&y!=="/"&&y.endsWith("/"),T=(d||y===".")&&r.endsWith("/");return!g.pathname.endsWith("/")&&(p||T)&&(g.pathname+="/"),g}var ap=n=>n.replace(/[\\/]{2,}/g,"/"),Wt=n=>ap(n.join("/")),Ls=n=>n.replace(/\/+$/,""),D0=n=>Ls(n).replace(/^\/*/,"/"),w0=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,U0=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,H0=class{constructor(n,u,r,c=!1){this.status=n,this.statusText=u||"",this.internal=c,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function q0(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function L0(n){let u=n.map(r=>r.route.path).filter(Boolean);return Wt(u)||"/"}var lp=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function np(n,u){let r=n;if(typeof r!="string"||!ko.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let c=r,h=!1;if(lp)try{let d=new URL(window.location.href),y=Fy.test(r)?new URL(d0(r,d.protocol)):new URL(r),v=Ua(y.pathname,u);y.origin===d.origin&&v!=null?r=v+y.search+y.hash:h=!0}catch{ca(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:c,isExternal:h,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var ip=["POST","PUT","PATCH","DELETE"];new Set(ip);var B0=["GET",...ip];new Set(B0);var Q0=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function Y0(n){try{return Q0.includes(new URL(n).protocol)}catch{return!1}}var Wn=C.createContext(null);Wn.displayName="DataRouter";var Gs=C.createContext(null);Gs.displayName="DataRouterState";var up=C.createContext(!1);function G0(){return C.useContext(up)}var sp=C.createContext({isTransitioning:!1});sp.displayName="ViewTransition";var X0=C.createContext(new Map);X0.displayName="Fetchers";var k0=C.createContext(null);k0.displayName="Await";var Kt=C.createContext(null);Kt.displayName="Navigation";var iu=C.createContext(null);iu.displayName="Location";var ra=C.createContext({outlet:null,matches:[],isDataRoute:!1});ra.displayName="Route";var Ko=C.createContext(null);Ko.displayName="RouteError";var cp="REACT_ROUTER_ERROR",Z0="REDIRECT",K0="ROUTE_ERROR_RESPONSE";function V0(n){if(n.startsWith(`${cp}:${Z0}:{`))try{let u=JSON.parse(n.slice(28));if(typeof u=="object"&&u&&typeof u.status=="number"&&typeof u.statusText=="string"&&typeof u.location=="string"&&typeof u.reloadDocument=="boolean"&&typeof u.replace=="boolean")return u}catch{}}function J0(n){if(n.startsWith(`${cp}:${K0}:{`))try{let u=JSON.parse(n.slice(40));if(typeof u=="object"&&u&&typeof u.status=="number"&&typeof u.statusText=="string")return new H0(u.status,u.statusText,u.data)}catch{}}function F0(n,{relative:u}={}){Be(uu(),"useHref() may be used only in the context of a component.");let{basename:r,navigator:c}=C.useContext(Kt),{hash:h,pathname:d,search:y}=su(n,{relative:u}),v=d;return r!=="/"&&(v=d==="/"?r:Wt([r,d])),c.createHref({pathname:v,search:y,hash:h})}function uu(){return C.useContext(iu)!=null}function oa(){return Be(uu(),"useLocation() may be used only in the context of a component."),C.useContext(iu).location}var rp="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function op(n){C.useContext(Kt).static||C.useLayoutEffect(n)}function Xs(){let{isDataRoute:n}=C.useContext(ra);return n?cb():$0()}function $0(){Be(uu(),"useNavigate() may be used only in the context of a component.");let n=C.useContext(Wn),{basename:u,navigator:r}=C.useContext(Kt),{matches:c}=C.useContext(ra),{pathname:h}=oa(),d=JSON.stringify(tp(c)),y=C.useRef(!1);return op(()=>{y.current=!0}),C.useCallback((g,p={})=>{if(ca(y.current,rp),!y.current)return;if(typeof g=="number"){r.go(g);return}let T=Zo(g,JSON.parse(d),h,p.relative==="path");n==null&&u!=="/"&&(T.pathname=T.pathname==="/"?u:Wt([u,T.pathname])),(p.replace?r.replace:r.push)(T,p.state,p)},[u,r,d,h,n])}C.createContext(null);function fp(){let{matches:n}=C.useContext(ra),u=n[n.length-1];return(u==null?void 0:u.params)??{}}function su(n,{relative:u}={}){let{matches:r}=C.useContext(ra),{pathname:c}=oa(),h=JSON.stringify(tp(r));return C.useMemo(()=>Zo(n,JSON.parse(h),c,u==="path"),[n,h,c,u])}function W0(n,u){return hp(n,u)}function hp(n,u,r){var U;Be(uu(),"useRoutes() may be used only in the context of a component.");let{navigator:c}=C.useContext(Kt),{matches:h}=C.useContext(ra),d=h[h.length-1],y=d?d.params:{},v=d?d.pathname:"/",g=d?d.pathnameBase:"/",p=d&&d.route;{let L=p&&p.path||"";mp(v,!p||L.endsWith("*")||L.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${v}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. - -Please change the parent to .`)}let T=oa(),b;if(u){let L=typeof u=="string"?$n(u):u;Be(g==="/"||((U=L.pathname)==null?void 0:U.startsWith(g)),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${g}" but pathname "${L.pathname}" was given in the \`location\` prop.`),b=L}else b=T;let _=b.pathname||"/",M=_;if(g!=="/"){let L=g.replace(/^\//,"").split("/");M="/"+_.replace(/^\//,"").split("/").slice(L.length).join("/")}let Y=r&&r.state.matches.length?r.state.matches.map(L=>Object.assign(L,{route:r.manifest[L.route.id]||L.route})):$y(n,{pathname:M});ca(p||Y!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),ca(Y==null||Y[Y.length-1].route.element!==void 0||Y[Y.length-1].route.Component!==void 0||Y[Y.length-1].route.lazy!==void 0,`Matched leaf route at location "${b.pathname}${b.search}${b.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let H=ab(Y&&Y.map(L=>Object.assign({},L,{params:Object.assign({},y,L.params),pathname:Wt([g,c.encodeLocation?c.encodeLocation(L.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:L.pathname]),pathnameBase:L.pathnameBase==="/"?g:Wt([g,c.encodeLocation?c.encodeLocation(L.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:L.pathnameBase])})),h,r);return u&&H?C.createElement(iu.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...b},navigationType:"POP"}},H):H}function P0(){let n=sb(),u=q0(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),r=n instanceof Error?n.stack:null,c="rgba(200,200,200, 0.5)",h={padding:"0.5rem",backgroundColor:c},d={padding:"2px 4px",backgroundColor:c},y=null;return console.error("Error handled by React Router default ErrorBoundary:",n),y=C.createElement(C.Fragment,null,C.createElement("p",null,"💿 Hey developer 👋"),C.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",C.createElement("code",{style:d},"ErrorBoundary")," or"," ",C.createElement("code",{style:d},"errorElement")," prop on your route.")),C.createElement(C.Fragment,null,C.createElement("h2",null,"Unexpected Application Error!"),C.createElement("h3",{style:{fontStyle:"italic"}},u),r?C.createElement("pre",{style:h},r):null,y)}var I0=C.createElement(P0,null),dp=class extends C.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,u){return u.location!==n.location||u.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:u.error,location:u.location,revalidation:n.revalidation||u.revalidation}}componentDidCatch(n,u){this.props.onError?this.props.onError(n,u):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const r=J0(n.digest);r&&(n=r)}let u=n!==void 0?C.createElement(ra.Provider,{value:this.props.routeContext},C.createElement(Ko.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?C.createElement(eb,{error:n},u):u}};dp.contextType=up;var Eo=new WeakMap;function eb({children:n,error:u}){let{basename:r}=C.useContext(Kt);if(typeof u=="object"&&u&&"digest"in u&&typeof u.digest=="string"){let c=V0(u.digest);if(c){let h=Eo.get(u);if(h)throw h;let d=np(c.location,r),y=d.absoluteURL||d.to;if(Y0(y))throw new Error("Invalid redirect location");if(lp&&!Eo.get(u))if(d.isExternal||c.reloadDocument)window.location.href=y;else{const v=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(d.to,{replace:c.replace}));throw Eo.set(u,v),v}return C.createElement("meta",{httpEquiv:"refresh",content:`0;url=${y}`})}}return n}function tb({routeContext:n,match:u,children:r}){let c=C.useContext(Wn);return c&&c.static&&c.staticContext&&(u.route.errorElement||u.route.ErrorBoundary)&&(c.staticContext._deepestRenderedBoundaryId=u.route.id),C.createElement(ra.Provider,{value:n},r)}function ab(n,u=[],r){let c=r==null?void 0:r.state;if(n==null){if(!c)return null;if(c.errors)n=c.matches;else if(u.length===0&&!c.initialized&&c.matches.length>0)n=c.matches;else return null}let h=n,d=c==null?void 0:c.errors;if(d!=null){let T=h.findIndex(b=>b.route.id&&(d==null?void 0:d[b.route.id])!==void 0);Be(T>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),h=h.slice(0,Math.min(h.length,T+1))}let y=!1,v=-1;if(r&&c){y=c.renderFallback;for(let T=0;T=0?h=h.slice(0,v+1):h=[h[0]];break}}}}let g=r==null?void 0:r.onError,p=c&&g?(T,b)=>{var _,M;g(T,{location:c.location,params:((M=(_=c.matches)==null?void 0:_[0])==null?void 0:M.params)??{},pattern:L0(c.matches),errorInfo:b})}:void 0;return h.reduceRight((T,b,_)=>{let M,Y=!1,H=null,U=null;c&&(M=d&&b.route.id?d[b.route.id]:void 0,H=b.route.errorElement||I0,y&&(v<0&&_===0?(mp("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),Y=!0,U=null):v===_&&(Y=!0,U=b.route.hydrateFallbackElement||null)));let L=u.concat(h.slice(0,_+1)),k=()=>{let G;return M?G=H:Y?G=U:b.route.Component?G=C.createElement(b.route.Component,null):b.route.element?G=b.route.element:G=T,C.createElement(tb,{match:b,routeContext:{outlet:T,matches:L,isDataRoute:c!=null},children:G})};return c&&(b.route.ErrorBoundary||b.route.errorElement||_===0)?C.createElement(dp,{location:c.location,revalidation:c.revalidation,component:H,error:M,children:k(),routeContext:{outlet:null,matches:L,isDataRoute:!0},onError:p}):k()},null)}function Vo(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function lb(n){let u=C.useContext(Wn);return Be(u,Vo(n)),u}function nb(n){let u=C.useContext(Gs);return Be(u,Vo(n)),u}function ib(n){let u=C.useContext(ra);return Be(u,Vo(n)),u}function Jo(n){let u=ib(n),r=u.matches[u.matches.length-1];return Be(r.route.id,`${n} can only be used on routes that contain a unique "id"`),r.route.id}function ub(){return Jo("useRouteId")}function sb(){var c;let n=C.useContext(Ko),u=nb("useRouteError"),r=Jo("useRouteError");return n!==void 0?n:(c=u.errors)==null?void 0:c[r]}function cb(){let{router:n}=lb("useNavigate"),u=Jo("useNavigate"),r=C.useRef(!1);return op(()=>{r.current=!0}),C.useCallback(async(h,d={})=>{ca(r.current,rp),r.current&&(typeof h=="number"?await n.navigate(h):await n.navigate(h,{fromRouteId:u,...d}))},[n,u])}var Ey={};function mp(n,u,r){!u&&!Ey[n]&&(Ey[n]=!0,ca(!1,r))}C.memo(rb);function rb({routes:n,manifest:u,future:r,state:c,isStatic:h,onError:d}){return hp(n,void 0,{manifest:u,state:c,isStatic:h,onError:d})}function Un(n){Be(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function ob({basename:n="/",children:u=null,location:r,navigationType:c="POP",navigator:h,static:d=!1,useTransitions:y}){Be(!uu(),"You cannot render a inside another . You should never have more than one in your app.");let v=n.replace(/^\/*/,"/"),g=C.useMemo(()=>({basename:v,navigator:h,static:d,useTransitions:y,future:{}}),[v,h,d,y]);typeof r=="string"&&(r=$n(r));let{pathname:p="/",search:T="",hash:b="",state:_=null,key:M="default",mask:Y}=r,H=C.useMemo(()=>{let U=Ua(p,v);return U==null?null:{location:{pathname:U,search:T,hash:b,state:_,key:M,mask:Y},navigationType:c}},[v,p,T,b,_,M,c,Y]);return ca(H!=null,` is not able to match the URL "${p}${T}${b}" because it does not start with the basename, so the won't render anything.`),H==null?null:C.createElement(Kt.Provider,{value:g},C.createElement(iu.Provider,{children:u,value:H}))}function fb({children:n,location:u}){return W0(Ro(n),u)}function Ro(n,u=[]){let r=[];return C.Children.forEach(n,(c,h)=>{if(!C.isValidElement(c))return;let d=[...u,h];if(c.type===C.Fragment){r.push.apply(r,Ro(c.props.children,d));return}Be(c.type===Un,`[${typeof c.type=="string"?c.type:c.type.name}] is not a component. All component children of must be a or `),Be(!c.props.index||!c.props.children,"An index route cannot have child routes.");let y={id:c.props.id||d.join("-"),caseSensitive:c.props.caseSensitive,element:c.props.element,Component:c.props.Component,index:c.props.index,path:c.props.path,middleware:c.props.middleware,loader:c.props.loader,action:c.props.action,hydrateFallbackElement:c.props.hydrateFallbackElement,HydrateFallback:c.props.HydrateFallback,errorElement:c.props.errorElement,ErrorBoundary:c.props.ErrorBoundary,hasErrorBoundary:c.props.hasErrorBoundary===!0||c.props.ErrorBoundary!=null||c.props.errorElement!=null,shouldRevalidate:c.props.shouldRevalidate,handle:c.props.handle,lazy:c.props.lazy};c.props.children&&(y.children=Ro(c.props.children,d)),r.push(y)}),r}var Ds="get",ws="application/x-www-form-urlencoded";function ks(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function hb(n){return ks(n)&&n.tagName.toLowerCase()==="button"}function db(n){return ks(n)&&n.tagName.toLowerCase()==="form"}function mb(n){return ks(n)&&n.tagName.toLowerCase()==="input"}function yb(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function pb(n,u){return n.button===0&&(!u||u==="_self")&&!yb(n)}var _s=null;function vb(){if(_s===null)try{new FormData(document.createElement("form"),0),_s=!1}catch{_s=!0}return _s}var gb=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function To(n){return n!=null&&!gb.has(n)?(ca(!1,`"${n}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${ws}"`),null):n}function bb(n,u){let r,c,h,d,y;if(db(n)){let v=n.getAttribute("action");c=v?Ua(v,u):null,r=n.getAttribute("method")||Ds,h=To(n.getAttribute("enctype"))||ws,d=new FormData(n)}else if(hb(n)||mb(n)&&(n.type==="submit"||n.type==="image")){let v=n.form;if(v==null)throw new Error('Cannot submit a