diff --git a/docs/gitlab.md b/docs/gitlab.md index c8c0f20..f92a7ad 100644 --- a/docs/gitlab.md +++ b/docs/gitlab.md @@ -22,7 +22,9 @@ Then in GitLab, Project (or group, or Admin → System hooks) → Settings → W | Triggers | **Merge request events** · **Comments** | | SSL verification | enabled | -Add one webhook in the console for each hook you set up in GitLab (a system hook, each group hook). Each has its own URL and secret, so one can be given a new secret, disabled or deleted without touching the others. The URL alone picks the host, and only that webhook's secret verifies it. +Add one webhook in the console for each hook you set up in GitLab (a system hook, each group hook). + +**A system hook alone is not enough.** GitLab system hooks send merge request events but never comments, so `@bot` commands and learnings from replies need a group or project webhook with **Comments**. A system hook plus group hooks is fine: the console drops the duplicate merge request event. When a host receives deliveries but no comment events, the Code hosts page and Setup say so. Each has its own URL and secret, so one can be given a new secret, disabled or deleted without touching the others. The URL alone picks the host, and only that webhook's secret verifies it. **Signing tokens (GitLab 19.0+, recommended).** After saving the hook, GitLab shows its signing token (`whsec_…`). Paste it into the webhook in the console. Signed deliveries are then checked by signature. If the host's **Unsigned webhooks** setting is **Reject**, the webhook only works once its signing token is saved. diff --git a/internal/admin/admin_test.go b/internal/admin/admin_test.go index 5f82fb4..2b1e225 100644 --- a/internal/admin/admin_test.go +++ b/internal/admin/admin_test.go @@ -682,3 +682,69 @@ func TestSetupChecklist(t *testing.T) { t.Errorf("reloading /admin/setup must serve the app: %d", code) } } + +func TestCommentEventsWarning(t *testing.T) { + e := setup(t, config.OIDC{AllowedEmails: []string{"alice@example.com"}}) + e.idp.as(map[string]any{"sub": "u1", "email": "alice@example.com", "email_verified": true}) + _ = e.login(t).Body.Close() + ctx := context.Background() + gl, err := e.adm.Hosts.Save(ctx, hosts.Host{Platform: hosts.GitLab, BaseURL: "https://gitlab.example.com", Enabled: true, + Settings: hosts.Settings{BotName: "review-bot"}, Secrets: hosts.Secrets{Token: "t"}}, "a@x") + if err != nil { + t.Fatal(err) + } + hostWarning := func() string { + t.Helper() + _, body := e.do(t, "GET", "/admin/api/hosts", "", nil) + var list struct { + Hosts []struct { + ID int64 + CommentWarning string `json:"comment_warning"` + } + } + _ = json.Unmarshal(body, &list) + for _, h := range list.Hosts { + if h.ID == gl.ID { + return h.CommentWarning + } + } + t.Fatalf("host missing: %s", body) + return "" + } + if w := hostWarning(); w != "" { + t.Errorf("no deliveries yet: no warning, got %q", w) + } + // Only system hook deliveries (merge requests): the issue #25 setup. + _ = e.st.InsertWebhookEvents(ctx, []store.WebhookEvent{ + {Platform: "gitlab", Host: "gitlab.example.com", Event: "System Hook", Kind: "merge_request", Auth: "signature", Outcome: store.HookQueued}, + {Platform: "gitlab", Host: "gitlab.example.com", Event: "Note Hook", Kind: "note", Auth: "failed", Outcome: store.HookRejected}, // unverified: doesn't count + }) + if w := hostWarning(); !strings.Contains(w, "system hooks don't send comments") || !strings.Contains(w, "@review-bot") { + t.Errorf("system hook only: %q", w) + } + code, body := e.do(t, "GET", "/admin/api/setup", "", nil) + if code != 200 || !bytes.Contains(body, []byte(`"id":"comments","title":"Receive comments"`)) || !bytes.Contains(body, []byte("system hooks")) { + t.Errorf("setup comments step: %s", body) + } + // A verified comment clears it. + _ = e.st.InsertWebhookEvents(ctx, []store.WebhookEvent{{Platform: "gitlab", Host: "gitlab.example.com", Event: "Note Hook", Kind: "note", Auth: "token", Outcome: store.HookIgnored}}) + if w := hostWarning(); w != "" { + t.Errorf("after a comment event: %q", w) + } + if _, body := e.do(t, "GET", "/admin/api/setup", "", nil); !bytes.Contains(body, []byte("1 comment event received")) { + t.Errorf("setup after a comment: %s", body) + } +} + +func TestCommentWarningText(t *testing.T) { + gh := hosts.Host{Platform: hosts.GitHub} + if w := commentWarning(gh, store.HostHookStats{Verified: 3}); !strings.Contains(w, "Issue comment") || !strings.Contains(w, "@bot") { + t.Errorf("github: %q", w) + } + if w := commentWarning(hosts.Host{Platform: hosts.Bitbucket}, store.HostHookStats{Verified: 1}); !strings.Contains(w, "Comment created") { + t.Errorf("bitbucket: %q", w) + } + if w := commentWarning(hosts.Host{Platform: hosts.GitLab}, store.HostHookStats{Verified: 2, SystemHook: 1}); !strings.Contains(w, "Turn on Comments") { + t.Errorf("gitlab with a group hook but no comments: %q", w) + } +} diff --git a/internal/admin/handlers.go b/internal/admin/handlers.go index cbcc4e8..dd72124 100644 --- a/internal/admin/handlers.go +++ b/internal/admin/handlers.go @@ -592,6 +592,9 @@ type hostView struct { // Webhooks have their own URL and secrets (added in the admin panel). Webhooks []webhookView `json:"webhooks"` Events []string `json:"events"` + // CommentWarning is set when verified deliveries arrive but no comment + // events do, so @bot commands and learnings would fail silently. + CommentWarning string `json:"comment_warning,omitempty"` // Licensed is false for a host the license does not cover (a second // host on a platform without the hosts feature): it is not used. Licensed bool `json:"licensed"` @@ -603,16 +606,61 @@ var hookEvents = map[string][]string{ hosts.Bitbucket: {"Pull request: Created", "Updated", "Merged", "Declined", "Comment created"}, } -func (a *Admin) viewHost(h hosts.Host) hostView { +func (a *Admin) viewHost(h hosts.Host, stats map[string]store.HostHookStats) hostView { v := hostView{ID: h.ID, Platform: h.Platform, Host: h.Host, BaseURL: h.BaseURL, Name: h.Name, Enabled: h.Enabled, Settings: h.Settings, Secrets: h.SecretStatus(), WebhookURL: a.cfg.BaseURL + "/webhooks/" + h.Platform, Webhooks: []webhookView{}, Events: hookEvents[h.Platform], Licensed: !h.Enabled || a.Hosts.Active(h)} for _, e := range a.Hosts.Endpoints(h.ID) { v.Webhooks = append(v.Webhooks, a.viewWebhook(h.Platform, e)) } + if h.Enabled { + v.CommentWarning = commentWarning(h, stats[h.Platform+":"+h.Host]) + } return v } +// hookStats returns verified-delivery stats by "platform:host" (empty on +// error: the warnings are a hint, not a reason to fail the page). +func (a *Admin) hookStats(ctx context.Context) map[string]store.HostHookStats { + out := map[string]store.HostHookStats{} + list, err := a.store.HookStats(ctx) + if err != nil { + a.logger.Warn("webhook stats unavailable", "error", err) + return out + } + for _, s := range list { + out[s.Platform+":"+s.Host] = s + } + return out +} + +// commentWarning explains why comment events are missing for a host that +// does receive webhooks: a GitLab system hook never sends them, and other +// hooks need the comment events switched on. +func commentWarning(h hosts.Host, s store.HostHookStats) string { + if s.Verified == 0 || s.Comments > 0 { + return "" + } + bot := "@" + h.BotName + if h.BotName == "" { + bot = "@bot" + } + effect := bot + " commands and learnings from replies won't work" + switch h.Platform { + case hosts.GitLab: + if s.SystemHook == s.Verified { + return "Only system hook deliveries so far. GitLab system hooks don't send comments, so " + effect + + ". Add a group or project webhook with Comments (Manage webhooks gives it its own URL)." + } + return "No comment events received yet, so " + effect + ". Turn on Comments on the group or project webhook." + case hosts.GitHub: + return "No comment events received yet, so " + effect + ". Subscribe the webhook or GitHub App to Issue comment and Pull request review comment." + case hosts.Bitbucket: + return "No comment events received yet, so " + effect + ". Turn on the Comment created trigger on the webhook." + } + return "" +} + // webhookView is a webhook endpoint as the admin UI sees it: its URL and // which secrets are set, never their values. type webhookView struct { @@ -736,8 +784,9 @@ func (a *Admin) apiListHosts(w http.ResponseWriter, r *http.Request, s *store.Se return } out := []hostView{} + stats := a.hookStats(r.Context()) for _, h := range a.Hosts.All() { - out = append(out, a.viewHost(h)) + out = append(out, a.viewHost(h, stats)) } writeJSON(w, http.StatusOK, map[string]any{"mode": a.Hosts.Mode(), "hosts": out, "key_env": secrets.EnvKey}) } @@ -793,7 +842,7 @@ func (a *Admin) saveHost(w http.ResponseWriter, r *http.Request, s *store.Sessio if fresh, ok := a.Hosts.Get(saved.ID); ok { saved = fresh } - writeJSON(w, status, a.viewHost(saved)) + writeJSON(w, status, a.viewHost(saved, a.hookStats(r.Context()))) } func (a *Admin) apiCreateHost(w http.ResponseWriter, r *http.Request, s *store.Session) { diff --git a/internal/admin/setup.go b/internal/admin/setup.go index e184d31..e267047 100644 --- a/internal/admin/setup.go +++ b/internal/admin/setup.go @@ -117,6 +117,25 @@ func (a *Admin) setup(ctx context.Context) (setupStatus, error) { } steps = append(steps, delivery) + // 4b. Comments (optional: reviews work without them, @bot commands and + // learnings don't). Shown once deliveries arrive, so it can say why. + if delivery.Done { + comments := setupStep{ID: "comments", Title: "Receive comments", Optional: true, Link: "/hosts", + Help: "@bot commands and learnings from replies need comment events. A GitLab system hook doesn't send them: add a group or project webhook with Comments."} + stats := a.hookStats(ctx) + total := 0 + for _, h := range active { + total += stats[h.Platform+":"+h.Host].Comments + if w := commentWarning(h, stats[h.Platform+":"+h.Host]); w != "" && comments.Detail == "" { + comments.Detail = h.Name + ": " + w + } + } + if total > 0 && comments.Detail == "" { + comments.Done, comments.Detail = true, plural(total, "comment event")+" received" + } + steps = append(steps, comments) + } + // 5. A model. model := setupStep{ID: "model", Title: "Set up a model", Help: "Reviews need at least one model profile: add it under models: in the config file (provider, model and the env var holding the API key), set model: to it, and restart."} diff --git a/internal/admin/ui/assets/index-bZ2wRe7T.js b/internal/admin/ui/assets/index-DMQms6p-.js similarity index 63% rename from internal/admin/ui/assets/index-bZ2wRe7T.js rename to internal/admin/ui/assets/index-DMQms6p-.js index 4b34903..58a4c2c 100644 --- a/internal/admin/ui/assets/index-bZ2wRe7T.js +++ b/internal/admin/ui/assets/index-DMQms6p-.js @@ -1,4 +1,4 @@ -var Xh=n=>{throw TypeError(n)};var Jh=(n,r,i)=>r.has(n)||Xh("Cannot "+i);var ht=(n,r,i)=>(Jh(n,r,"read from private field"),i?i.call(n):r.get(n)),Zh=(n,r,i)=>r.has(n)?Xh("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(n):r.set(n,i),tu=(n,r,i,s)=>(Jh(n,r,"write to private field"),s?s.call(n,i):r.set(n,i),i);function A0(n,r){for(var i=0;is[c]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))s(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&s(f)}).observe(document,{childList:!0,subtree:!0});function i(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function s(c){if(c.ep)return;c.ep=!0;const u=i(c);fetch(c.href,u)}})();function I0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var nu={exports:{}},$i={},ru={exports:{}},Ne={};/** +var Xh=n=>{throw TypeError(n)};var Jh=(n,r,i)=>r.has(n)||Xh("Cannot "+i);var ht=(n,r,i)=>(Jh(n,r,"read from private field"),i?i.call(n):r.get(n)),Zh=(n,r,i)=>r.has(n)?Xh("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(n):r.set(n,i),tu=(n,r,i,l)=>(Jh(n,r,"write to private field"),l?l.call(n,i):r.set(n,i),i);function A0(n,r){for(var i=0;il[c]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))l(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&l(f)}).observe(document,{childList:!0,subtree:!0});function i(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function l(c){if(c.ep)return;c.ep=!0;const u=i(c);fetch(c.href,u)}})();function I0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var nu={exports:{}},$i={},ru={exports:{}},Ne={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var Xh=n=>{throw TypeError(n)};var Jh=(n,r,i)=>r.has(n)||Xh("Cannot "+i);var ht= * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var em;function L0(){if(em)return Ne;em=1;var n=Symbol.for("react.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),f=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),x=Symbol.iterator;function b(M){return M===null||typeof M!="object"?null:(M=x&&M[x]||M["@@iterator"],typeof M=="function"?M:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,S={};function j(M,V,he){this.props=M,this.context=V,this.refs=S,this.updater=he||C}j.prototype.isReactComponent={},j.prototype.setState=function(M,V){if(typeof M!="object"&&typeof M!="function"&&M!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,M,V,"setState")},j.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function E(){}E.prototype=j.prototype;function D(M,V,he){this.props=M,this.context=V,this.refs=S,this.updater=he||C}var T=D.prototype=new E;T.constructor=D,k(T,j.prototype),T.isPureReactComponent=!0;var P=Array.isArray,R=Object.prototype.hasOwnProperty,N={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function L(M,V,he){var be,pe={},Y=null,we=null;if(V!=null)for(be in V.ref!==void 0&&(we=V.ref),V.key!==void 0&&(Y=""+V.key),V)R.call(V,be)&&!I.hasOwnProperty(be)&&(pe[be]=V[be]);var ke=arguments.length-2;if(ke===1)pe.children=he;else if(1{throw TypeError(n)};var Jh=(n,r,i)=>r.has(n)||Xh("Cannot "+i);var ht= * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var nm;function z0(){if(nm)return $i;nm=1;var n=Zu(),r=Symbol.for("react.element"),i=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,c=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function f(h,v,g){var y,x={},b=null,C=null;g!==void 0&&(b=""+g),v.key!==void 0&&(b=""+v.key),v.ref!==void 0&&(C=v.ref);for(y in v)s.call(v,y)&&!u.hasOwnProperty(y)&&(x[y]=v[y]);if(h&&h.defaultProps)for(y in v=h.defaultProps,v)x[y]===void 0&&(x[y]=v[y]);return{$$typeof:r,type:h,key:b,ref:C,props:x,_owner:c.current}}return $i.Fragment=i,$i.jsx=f,$i.jsxs=f,$i}var rm;function F0(){return rm||(rm=1,nu.exports=z0()),nu.exports}var l=F0(),m=Zu();const $0=I0(m),Rr=A0({__proto__:null,default:$0},[m]);var hl={},ou={exports:{}},Dt={},iu={exports:{}},su={};/** + */var nm;function z0(){if(nm)return $i;nm=1;var n=Zu(),r=Symbol.for("react.element"),i=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,c=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function f(h,v,g){var y,x={},b=null,j=null;g!==void 0&&(b=""+g),v.key!==void 0&&(b=""+v.key),v.ref!==void 0&&(j=v.ref);for(y in v)l.call(v,y)&&!u.hasOwnProperty(y)&&(x[y]=v[y]);if(h&&h.defaultProps)for(y in v=h.defaultProps,v)x[y]===void 0&&(x[y]=v[y]);return{$$typeof:r,type:h,key:b,ref:j,props:x,_owner:c.current}}return $i.Fragment=i,$i.jsx=f,$i.jsxs=f,$i}var rm;function F0(){return rm||(rm=1,nu.exports=z0()),nu.exports}var s=F0(),m=Zu();const $0=I0(m),Rr=A0({__proto__:null,default:$0},[m]);var hl={},ou={exports:{}},Dt={},iu={exports:{}},su={};/** * @license React * scheduler.production.min.js * @@ -22,7 +22,7 @@ var Xh=n=>{throw TypeError(n)};var Jh=(n,r,i)=>r.has(n)||Xh("Cannot "+i);var ht= * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var om;function U0(){return om||(om=1,(function(n){function r(W,q){var F=W.length;W.push(q);e:for(;0>>1,V=W[M];if(0>>1;Mc(pe,F))Yc(we,pe)?(W[M]=we,W[Y]=F,M=Y):(W[M]=pe,W[be]=F,M=be);else if(Yc(we,F))W[M]=we,W[Y]=F,M=Y;else break e}}return q}function c(W,q){var F=W.sortIndex-q.sortIndex;return F!==0?F:W.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;n.unstable_now=function(){return u.now()}}else{var f=Date,h=f.now();n.unstable_now=function(){return f.now()-h}}var v=[],g=[],y=1,x=null,b=3,C=!1,k=!1,S=!1,j=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(W){for(var q=i(g);q!==null;){if(q.callback===null)s(g);else if(q.startTime<=W)s(g),q.sortIndex=q.expirationTime,r(v,q);else break;q=i(g)}}function P(W){if(S=!1,T(W),!k)if(i(v)!==null)k=!0,B(R);else{var q=i(g);q!==null&&Z(P,q.startTime-W)}}function R(W,q){k=!1,S&&(S=!1,E(L),L=-1),C=!0;var F=b;try{for(T(q),x=i(v);x!==null&&(!(x.expirationTime>q)||W&&!J());){var M=x.callback;if(typeof M=="function"){x.callback=null,b=x.priorityLevel;var V=M(x.expirationTime<=q);q=n.unstable_now(),typeof V=="function"?x.callback=V:x===i(v)&&s(v),T(q)}else s(v);x=i(v)}if(x!==null)var he=!0;else{var be=i(g);be!==null&&Z(P,be.startTime-q),he=!1}return he}finally{x=null,b=F,C=!1}}var N=!1,I=null,L=-1,Q=5,ee=-1;function J(){return!(n.unstable_now()-eeW||125M?(W.sortIndex=F,r(g,W),i(v)===null&&W===i(g)&&(S?(E(L),L=-1):S=!0,Z(P,F-M))):(W.sortIndex=V,r(v,W),k||C||(k=!0,B(R))),W},n.unstable_shouldYield=J,n.unstable_wrapCallback=function(W){var q=b;return function(){var F=b;b=q;try{return W.apply(this,arguments)}finally{b=F}}}})(su)),su}var im;function B0(){return im||(im=1,iu.exports=U0()),iu.exports}/** + */var om;function U0(){return om||(om=1,(function(n){function r(W,q){var F=W.length;W.push(q);e:for(;0>>1,V=W[M];if(0>>1;Mc(pe,F))Yc(we,pe)?(W[M]=we,W[Y]=F,M=Y):(W[M]=pe,W[be]=F,M=be);else if(Yc(we,F))W[M]=we,W[Y]=F,M=Y;else break e}}return q}function c(W,q){var F=W.sortIndex-q.sortIndex;return F!==0?F:W.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;n.unstable_now=function(){return u.now()}}else{var f=Date,h=f.now();n.unstable_now=function(){return f.now()-h}}var v=[],g=[],y=1,x=null,b=3,j=!1,k=!1,S=!1,C=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(W){for(var q=i(g);q!==null;){if(q.callback===null)l(g);else if(q.startTime<=W)l(g),q.sortIndex=q.expirationTime,r(v,q);else break;q=i(g)}}function P(W){if(S=!1,T(W),!k)if(i(v)!==null)k=!0,B(R);else{var q=i(g);q!==null&&Z(P,q.startTime-W)}}function R(W,q){k=!1,S&&(S=!1,E(L),L=-1),j=!0;var F=b;try{for(T(q),x=i(v);x!==null&&(!(x.expirationTime>q)||W&&!J());){var M=x.callback;if(typeof M=="function"){x.callback=null,b=x.priorityLevel;var V=M(x.expirationTime<=q);q=n.unstable_now(),typeof V=="function"?x.callback=V:x===i(v)&&l(v),T(q)}else l(v);x=i(v)}if(x!==null)var he=!0;else{var be=i(g);be!==null&&Z(P,be.startTime-q),he=!1}return he}finally{x=null,b=F,j=!1}}var N=!1,I=null,L=-1,Q=5,ee=-1;function J(){return!(n.unstable_now()-eeW||125M?(W.sortIndex=F,r(g,W),i(v)===null&&W===i(g)&&(S?(E(L),L=-1):S=!0,Z(P,F-M))):(W.sortIndex=V,r(v,W),k||j||(k=!0,B(R))),W},n.unstable_shouldYield=J,n.unstable_wrapCallback=function(W){var q=b;return function(){var F=b;b=q;try{return W.apply(this,arguments)}finally{b=F}}}})(su)),su}var im;function B0(){return im||(im=1,iu.exports=U0()),iu.exports}/** * @license React * react-dom.production.min.js * @@ -30,14 +30,14 @@ var Xh=n=>{throw TypeError(n)};var Jh=(n,r,i)=>r.has(n)||Xh("Cannot "+i);var ht= * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var sm;function W0(){if(sm)return Dt;sm=1;var n=Zu(),r=B0();function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,o=1;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),v=Object.prototype.hasOwnProperty,g=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,y={},x={};function b(e){return v.call(x,e)?!0:v.call(y,e)?!1:g.test(e)?x[e]=!0:(y[e]=!0,!1)}function C(e,t,o,a){if(o!==null&&o.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return a?!1:o!==null?!o.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function k(e,t,o,a){if(t===null||typeof t>"u"||C(e,t,o,a))return!0;if(a)return!1;if(o!==null)switch(o.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function S(e,t,o,a,d,p,w){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=a,this.attributeNamespace=d,this.mustUseProperty=o,this.propertyName=e,this.type=t,this.sanitizeURL=p,this.removeEmptyString=w}var j={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){j[e]=new S(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];j[t]=new S(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){j[e]=new S(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){j[e]=new S(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){j[e]=new S(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){j[e]=new S(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){j[e]=new S(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){j[e]=new S(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){j[e]=new S(e,5,!1,e.toLowerCase(),null,!1,!1)});var E=/[\-:]([a-z])/g;function D(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(E,D);j[t]=new S(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(E,D);j[t]=new S(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(E,D);j[t]=new S(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){j[e]=new S(e,1,!1,e.toLowerCase(),null,!1,!1)}),j.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){j[e]=new S(e,1,!1,e.toLowerCase(),null,!0,!0)});function T(e,t,o,a){var d=j.hasOwnProperty(t)?j[t]:null;(d!==null?d.type!==0:a||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),v=Object.prototype.hasOwnProperty,g=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,y={},x={};function b(e){return v.call(x,e)?!0:v.call(y,e)?!1:g.test(e)?x[e]=!0:(y[e]=!0,!1)}function j(e,t,o,a){if(o!==null&&o.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return a?!1:o!==null?!o.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function k(e,t,o,a){if(t===null||typeof t>"u"||j(e,t,o,a))return!0;if(a)return!1;if(o!==null)switch(o.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function S(e,t,o,a,d,p,w){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=a,this.attributeNamespace=d,this.mustUseProperty=o,this.propertyName=e,this.type=t,this.sanitizeURL=p,this.removeEmptyString=w}var C={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){C[e]=new S(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];C[t]=new S(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){C[e]=new S(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){C[e]=new S(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){C[e]=new S(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){C[e]=new S(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){C[e]=new S(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){C[e]=new S(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){C[e]=new S(e,5,!1,e.toLowerCase(),null,!1,!1)});var E=/[\-:]([a-z])/g;function D(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(E,D);C[t]=new S(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(E,D);C[t]=new S(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(E,D);C[t]=new S(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){C[e]=new S(e,1,!1,e.toLowerCase(),null,!1,!1)}),C.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){C[e]=new S(e,1,!1,e.toLowerCase(),null,!0,!0)});function T(e,t,o,a){var d=C.hasOwnProperty(t)?C[t]:null;(d!==null?d.type!==0:a||!(2_||d[w]!==p[_]){var O=` -`+d[w].replace(" at new "," at ");return e.displayName&&O.includes("")&&(O=O.replace("",e.displayName)),O}while(1<=w&&0<=_);break}}}finally{he=!1,Error.prepareStackTrace=o}return(e=e?e.displayName||e.name:"")?V(e):""}function pe(e){switch(e.tag){case 5:return V(e.type);case 16:return V("Lazy");case 13:return V("Suspense");case 19:return V("SuspenseList");case 0:case 2:case 15:return e=be(e.type,!1),e;case 11:return e=be(e.type.render,!1),e;case 1:return e=be(e.type,!0),e;default:return""}}function Y(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case I:return"Fragment";case N:return"Portal";case Q:return"Profiler";case L:return"StrictMode";case de:return"Suspense";case re:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case J:return(e.displayName||"Context")+".Consumer";case ee:return(e._context.displayName||"Context")+".Provider";case ne:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ie:return t=e.displayName||null,t!==null?t:Y(e.type)||"Memo";case B:t=e._payload,e=e._init;try{return Y(e(t))}catch{}}return null}function we(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Y(t);case 8:return t===L?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ke(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function me(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Be(e){var t=me(e)?"checked":"value",o=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),a=""+e[t];if(!e.hasOwnProperty(t)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var d=o.get,p=o.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return d.call(this)},set:function(w){a=""+w,p.call(this,w)}}),Object.defineProperty(e,t,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function mt(e){e._valueTracker||(e._valueTracker=Be(e))}function It(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var o=t.getValue(),a="";return e&&(a=me(e)?e.checked?"true":"false":e.value),e=a,e!==o?(t.setValue(e),!0):!1}function ut(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function tt(e,t){var o=t.checked;return F({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??e._wrapperState.initialChecked})}function Jn(e,t){var o=t.defaultValue==null?"":t.defaultValue,a=t.checked!=null?t.checked:t.defaultChecked;o=ke(t.value!=null?t.value:o),e._wrapperState={initialChecked:a,initialValue:o,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Cn(e,t){t=t.checked,t!=null&&T(e,"checked",t,!1)}function dt(e,t){Cn(e,t);var o=ke(t.value),a=t.type;if(o!=null)a==="number"?(o===0&&e.value===""||e.value!=o)&&(e.value=""+o):e.value!==""+o&&(e.value=""+o);else if(a==="submit"||a==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ti(e,t.type,o):t.hasOwnProperty("defaultValue")&&ti(e,t.type,ke(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function is(e,t,o){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var a=t.type;if(!(a!=="submit"&&a!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,o||t===e.value||(e.value=t),e.defaultValue=t}o=e.name,o!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,o!==""&&(e.name=o)}function ti(e,t,o){(t!=="number"||ut(e.ownerDocument)!==e)&&(o==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+o&&(e.defaultValue=""+o))}var Mr=Array.isArray;function Zn(e,t,o,a){if(e=e.options,t){t={};for(var d=0;d"+t.valueOf().toString()+"",t=ss.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ni(e,t){if(t){var o=e.firstChild;if(o&&o===e.lastChild&&o.nodeType===3){o.nodeValue=t;return}}e.textContent=t}var ri={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Fy=["Webkit","ms","Moz","O"];Object.keys(ri).forEach(function(e){Fy.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ri[t]=ri[e]})});function ff(e,t,o){return t==null||typeof t=="boolean"||t===""?"":o||typeof t!="number"||t===0||ri.hasOwnProperty(e)&&ri[e]?(""+t).trim():t+"px"}function pf(e,t){e=e.style;for(var o in t)if(t.hasOwnProperty(o)){var a=o.indexOf("--")===0,d=ff(o,t[o],a);o==="float"&&(o="cssFloat"),a?e.setProperty(o,d):e[o]=d}}var $y=F({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function pa(e,t){if(t){if($y[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!="object")throw Error(i(62))}}function ha(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ma=null;function ga(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var va=null,po=null,ho=null;function hf(e){if(e=Si(e)){if(typeof va!="function")throw Error(i(280));var t=e.stateNode;t&&(t=Rs(t),va(e.stateNode,e.type,t))}}function mf(e){po?ho?ho.push(e):ho=[e]:po=e}function gf(){if(po){var e=po,t=ho;if(ho=po=null,hf(e),t)for(e=0;e>>=0,e===0?32:31-(Xy(e)/Jy|0)|0}var ds=64,fs=4194304;function li(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ps(e,t){var o=e.pendingLanes;if(o===0)return 0;var a=0,d=e.suspendedLanes,p=e.pingedLanes,w=o&268435455;if(w!==0){var _=w&~d;_!==0?a=li(_):(p&=w,p!==0&&(a=li(p)))}else w=o&~d,w!==0?a=li(w):p!==0&&(a=li(p));if(a===0)return 0;if(t!==0&&t!==a&&(t&d)===0&&(d=a&-a,p=t&-t,d>=p||d===16&&(p&4194240)!==0))return t;if((a&4)!==0&&(a|=o&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=a;0o;o++)t.push(e);return t}function ai(e,t,o){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Zt(t),e[t]=o}function nw(e,t){var o=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var a=e.eventTimes;for(e=e.expirationTimes;0=gi),Vf=" ",Hf=!1;function Gf(e,t){switch(e){case"keyup":return Pw.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Kf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var vo=!1;function Tw(e,t){switch(e){case"compositionend":return Kf(t);case"keypress":return t.which!==32?null:(Hf=!0,Vf);case"textInput":return e=t.data,e===Vf&&Hf?null:e;default:return null}}function Ow(e,t){if(vo)return e==="compositionend"||!Aa&&Gf(e,t)?(e=zf(),xs=Ra=ir=null,vo=!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:o,offset:t-e};e=a}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=ep(o)}}function np(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?np(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function rp(){for(var e=window,t=ut();t instanceof e.HTMLIFrameElement;){try{var o=typeof t.contentWindow.location.href=="string"}catch{o=!1}if(o)e=t.contentWindow;else break;t=ut(e.document)}return t}function za(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")}function Bw(e){var t=rp(),o=e.focusedElem,a=e.selectionRange;if(t!==o&&o&&o.ownerDocument&&np(o.ownerDocument.documentElement,o)){if(a!==null&&za(o)){if(t=a.start,e=a.end,e===void 0&&(e=t),"selectionStart"in o)o.selectionStart=t,o.selectionEnd=Math.min(e,o.value.length);else if(e=(t=o.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var d=o.textContent.length,p=Math.min(a.start,d);a=a.end===void 0?p:Math.min(a.end,d),!e.extend&&p>a&&(d=a,a=p,p=d),d=tp(o,p);var w=tp(o,a);d&&w&&(e.rangeCount!==1||e.anchorNode!==d.node||e.anchorOffset!==d.offset||e.focusNode!==w.node||e.focusOffset!==w.offset)&&(t=t.createRange(),t.setStart(d.node,d.offset),e.removeAllRanges(),p>a?(e.addRange(t),e.extend(w.node,w.offset)):(t.setEnd(w.node,w.offset),e.addRange(t)))}}for(t=[],e=o;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o=document.documentMode,xo=null,Fa=null,wi=null,$a=!1;function op(e,t,o){var a=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;$a||xo==null||xo!==ut(a)||(a=xo,"selectionStart"in a&&za(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),wi&&yi(wi,a)||(wi=a,a=Es(Fa,"onSelect"),0Co||(e.current=Ja[Co],Ja[Co]=null,Co--)}function Le(e,t){Co++,Ja[Co]=e.current,e.current=t}var cr={},gt=ar(cr),Et=ar(!1),Lr=cr;function jo(e,t){var o=e.type.contextTypes;if(!o)return cr;var a=e.stateNode;if(a&&a.__reactInternalMemoizedUnmaskedChildContext===t)return a.__reactInternalMemoizedMaskedChildContext;var d={},p;for(p in o)d[p]=t[p];return a&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=d),d}function _t(e){return e=e.childContextTypes,e!=null}function Ps(){$e(Et),$e(gt)}function yp(e,t,o){if(gt.current!==cr)throw Error(i(168));Le(gt,t),Le(Et,o)}function wp(e,t,o){var a=e.stateNode;if(t=t.childContextTypes,typeof a.getChildContext!="function")return o;a=a.getChildContext();for(var d in a)if(!(d in t))throw Error(i(108,we(e)||"Unknown",d));return F({},o,a)}function Ds(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||cr,Lr=gt.current,Le(gt,e),Le(Et,Et.current),!0}function bp(e,t,o){var a=e.stateNode;if(!a)throw Error(i(169));o?(e=wp(e,t,Lr),a.__reactInternalMemoizedMergedChildContext=e,$e(Et),$e(gt),Le(gt,e)):$e(Et),Le(Et,o)}var Sn=null,Ts=!1,Za=!1;function kp(e){Sn===null?Sn=[e]:Sn.push(e)}function e0(e){Ts=!0,kp(e)}function ur(){if(!Za&&Sn!==null){Za=!0;var e=0,t=Ae;try{var o=Sn;for(Ae=1;e>=w,d-=w,En=1<<32-Zt(t)+d|o<ye?(at=xe,xe=null):at=xe.sibling;var Pe=H(z,xe,$[ye],X);if(Pe===null){xe===null&&(xe=at);break}e&&xe&&Pe.alternate===null&&t(z,xe),A=p(Pe,A,ye),ve===null?fe=Pe:ve.sibling=Pe,ve=Pe,xe=at}if(ye===$.length)return o(z,xe),Ue&&Fr(z,ye),fe;if(xe===null){for(;ye<$.length;ye++)xe=K(z,$[ye],X),xe!==null&&(A=p(xe,A,ye),ve===null?fe=xe:ve.sibling=xe,ve=xe);return Ue&&Fr(z,ye),fe}for(xe=a(z,xe);ye<$.length;ye++)at=oe(xe,z,ye,$[ye],X),at!==null&&(e&&at.alternate!==null&&xe.delete(at.key===null?ye:at.key),A=p(at,A,ye),ve===null?fe=at:ve.sibling=at,ve=at);return e&&xe.forEach(function(yr){return t(z,yr)}),Ue&&Fr(z,ye),fe}function ue(z,A,$,X){var fe=q($);if(typeof fe!="function")throw Error(i(150));if($=fe.call($),$==null)throw Error(i(151));for(var ve=fe=null,xe=A,ye=A=0,at=null,Pe=$.next();xe!==null&&!Pe.done;ye++,Pe=$.next()){xe.index>ye?(at=xe,xe=null):at=xe.sibling;var yr=H(z,xe,Pe.value,X);if(yr===null){xe===null&&(xe=at);break}e&&xe&&yr.alternate===null&&t(z,xe),A=p(yr,A,ye),ve===null?fe=yr:ve.sibling=yr,ve=yr,xe=at}if(Pe.done)return o(z,xe),Ue&&Fr(z,ye),fe;if(xe===null){for(;!Pe.done;ye++,Pe=$.next())Pe=K(z,Pe.value,X),Pe!==null&&(A=p(Pe,A,ye),ve===null?fe=Pe:ve.sibling=Pe,ve=Pe);return Ue&&Fr(z,ye),fe}for(xe=a(z,xe);!Pe.done;ye++,Pe=$.next())Pe=oe(xe,z,ye,Pe.value,X),Pe!==null&&(e&&Pe.alternate!==null&&xe.delete(Pe.key===null?ye:Pe.key),A=p(Pe,A,ye),ve===null?fe=Pe:ve.sibling=Pe,ve=Pe);return e&&xe.forEach(function(M0){return t(z,M0)}),Ue&&Fr(z,ye),fe}function qe(z,A,$,X){if(typeof $=="object"&&$!==null&&$.type===I&&$.key===null&&($=$.props.children),typeof $=="object"&&$!==null){switch($.$$typeof){case R:e:{for(var fe=$.key,ve=A;ve!==null;){if(ve.key===fe){if(fe=$.type,fe===I){if(ve.tag===7){o(z,ve.sibling),A=d(ve,$.props.children),A.return=z,z=A;break e}}else if(ve.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===B&&Np(fe)===ve.type){o(z,ve.sibling),A=d(ve,$.props),A.ref=Ei(z,ve,$),A.return=z,z=A;break e}o(z,ve);break}else t(z,ve);ve=ve.sibling}$.type===I?(A=Kr($.props.children,z.mode,X,$.key),A.return=z,z=A):(X=sl($.type,$.key,$.props,null,z.mode,X),X.ref=Ei(z,A,$),X.return=z,z=X)}return w(z);case N:e:{for(ve=$.key;A!==null;){if(A.key===ve)if(A.tag===4&&A.stateNode.containerInfo===$.containerInfo&&A.stateNode.implementation===$.implementation){o(z,A.sibling),A=d(A,$.children||[]),A.return=z,z=A;break e}else{o(z,A);break}else t(z,A);A=A.sibling}A=qc($,z.mode,X),A.return=z,z=A}return w(z);case B:return ve=$._init,qe(z,A,ve($._payload),X)}if(Mr($))return ce(z,A,$,X);if(q($))return ue(z,A,$,X);Is(z,$)}return typeof $=="string"&&$!==""||typeof $=="number"?($=""+$,A!==null&&A.tag===6?(o(z,A.sibling),A=d(A,$),A.return=z,z=A):(o(z,A),A=Yc($,z.mode,X),A.return=z,z=A),w(z)):o(z,A)}return qe}var No=Rp(!0),Pp=Rp(!1),Ls=ar(null),zs=null,Ro=null,ic=null;function sc(){ic=Ro=zs=null}function lc(e){var t=Ls.current;$e(Ls),e._currentValue=t}function ac(e,t,o){for(;e!==null;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,a!==null&&(a.childLanes|=t)):a!==null&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===o)break;e=e.return}}function Po(e,t){zs=e,ic=Ro=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Nt=!0),e.firstContext=null)}function Ht(e){var t=e._currentValue;if(ic!==e)if(e={context:e,memoizedValue:t,next:null},Ro===null){if(zs===null)throw Error(i(308));Ro=e,zs.dependencies={lanes:0,firstContext:e}}else Ro=Ro.next=e;return t}var $r=null;function cc(e){$r===null?$r=[e]:$r.push(e)}function Dp(e,t,o,a){var d=t.interleaved;return d===null?(o.next=o,cc(t)):(o.next=d.next,d.next=o),t.interleaved=o,Nn(e,a)}function Nn(e,t){e.lanes|=t;var o=e.alternate;for(o!==null&&(o.lanes|=t),o=e,e=e.return;e!==null;)e.childLanes|=t,o=e.alternate,o!==null&&(o.childLanes|=t),o=e,e=e.return;return o.tag===3?o.stateNode:null}var dr=!1;function uc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Tp(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Rn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function fr(e,t,o){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(Re&2)!==0){var d=a.pending;return d===null?t.next=t:(t.next=d.next,d.next=t),a.pending=t,Nn(e,o)}return d=a.interleaved,d===null?(t.next=t,cc(a)):(t.next=d.next,d.next=t),a.interleaved=t,Nn(e,o)}function Fs(e,t,o){if(t=t.updateQueue,t!==null&&(t=t.shared,(o&4194240)!==0)){var a=t.lanes;a&=e.pendingLanes,o|=a,t.lanes=o,ja(e,o)}}function Op(e,t){var o=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,o===a)){var d=null,p=null;if(o=o.firstBaseUpdate,o!==null){do{var w={eventTime:o.eventTime,lane:o.lane,tag:o.tag,payload:o.payload,callback:o.callback,next:null};p===null?d=p=w:p=p.next=w,o=o.next}while(o!==null);p===null?d=p=t:p=p.next=t}else d=p=t;o={baseState:a.baseState,firstBaseUpdate:d,lastBaseUpdate:p,shared:a.shared,effects:a.effects},e.updateQueue=o;return}e=o.lastBaseUpdate,e===null?o.firstBaseUpdate=t:e.next=t,o.lastBaseUpdate=t}function $s(e,t,o,a){var d=e.updateQueue;dr=!1;var p=d.firstBaseUpdate,w=d.lastBaseUpdate,_=d.shared.pending;if(_!==null){d.shared.pending=null;var O=_,U=O.next;O.next=null,w===null?p=U:w.next=U,w=O;var G=e.alternate;G!==null&&(G=G.updateQueue,_=G.lastBaseUpdate,_!==w&&(_===null?G.firstBaseUpdate=U:_.next=U,G.lastBaseUpdate=O))}if(p!==null){var K=d.baseState;w=0,G=U=O=null,_=p;do{var H=_.lane,oe=_.eventTime;if((a&H)===H){G!==null&&(G=G.next={eventTime:oe,lane:0,tag:_.tag,payload:_.payload,callback:_.callback,next:null});e:{var ce=e,ue=_;switch(H=t,oe=o,ue.tag){case 1:if(ce=ue.payload,typeof ce=="function"){K=ce.call(oe,K,H);break e}K=ce;break e;case 3:ce.flags=ce.flags&-65537|128;case 0:if(ce=ue.payload,H=typeof ce=="function"?ce.call(oe,K,H):ce,H==null)break e;K=F({},K,H);break e;case 2:dr=!0}}_.callback!==null&&_.lane!==0&&(e.flags|=64,H=d.effects,H===null?d.effects=[_]:H.push(_))}else oe={eventTime:oe,lane:H,tag:_.tag,payload:_.payload,callback:_.callback,next:null},G===null?(U=G=oe,O=K):G=G.next=oe,w|=H;if(_=_.next,_===null){if(_=d.shared.pending,_===null)break;H=_,_=H.next,H.next=null,d.lastBaseUpdate=H,d.shared.pending=null}}while(!0);if(G===null&&(O=K),d.baseState=O,d.firstBaseUpdate=U,d.lastBaseUpdate=G,t=d.shared.interleaved,t!==null){d=t;do w|=d.lane,d=d.next;while(d!==t)}else p===null&&(d.shared.lanes=0);Wr|=w,e.lanes=w,e.memoizedState=K}}function Mp(e,t,o){if(e=t.effects,t.effects=null,e!==null)for(t=0;to?o:4,e(!0);var a=mc.transition;mc.transition={};try{e(!1),t()}finally{Ae=o,mc.transition=a}}function Zp(){return Gt().memoizedState}function o0(e,t,o){var a=gr(e);if(o={lane:a,action:o,hasEagerState:!1,eagerState:null,next:null},eh(e))th(t,o);else if(o=Dp(e,t,o,a),o!==null){var d=Ct();sn(o,e,a,d),nh(o,t,a)}}function i0(e,t,o){var a=gr(e),d={lane:a,action:o,hasEagerState:!1,eagerState:null,next:null};if(eh(e))th(t,d);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=t.lastRenderedReducer,p!==null))try{var w=t.lastRenderedState,_=p(w,o);if(d.hasEagerState=!0,d.eagerState=_,en(_,w)){var O=t.interleaved;O===null?(d.next=d,cc(t)):(d.next=O.next,O.next=d),t.interleaved=d;return}}catch{}finally{}o=Dp(e,t,d,a),o!==null&&(d=Ct(),sn(o,e,a,d),nh(o,t,a))}}function eh(e){var t=e.alternate;return e===Ve||t!==null&&t===Ve}function th(e,t){Pi=Ws=!0;var o=e.pending;o===null?t.next=t:(t.next=o.next,o.next=t),e.pending=t}function nh(e,t,o){if((o&4194240)!==0){var a=t.lanes;a&=e.pendingLanes,o|=a,t.lanes=o,ja(e,o)}}var Gs={readContext:Ht,useCallback:vt,useContext:vt,useEffect:vt,useImperativeHandle:vt,useInsertionEffect:vt,useLayoutEffect:vt,useMemo:vt,useReducer:vt,useRef:vt,useState:vt,useDebugValue:vt,useDeferredValue:vt,useTransition:vt,useMutableSource:vt,useSyncExternalStore:vt,useId:vt,unstable_isNewReconciler:!1},s0={readContext:Ht,useCallback:function(e,t){return pn().memoizedState=[e,t===void 0?null:t],e},useContext:Ht,useEffect:Hp,useImperativeHandle:function(e,t,o){return o=o!=null?o.concat([e]):null,Vs(4194308,4,Qp.bind(null,t,e),o)},useLayoutEffect:function(e,t){return Vs(4194308,4,e,t)},useInsertionEffect:function(e,t){return Vs(4,2,e,t)},useMemo:function(e,t){var o=pn();return t=t===void 0?null:t,e=e(),o.memoizedState=[e,t],e},useReducer:function(e,t,o){var a=pn();return t=o!==void 0?o(t):t,a.memoizedState=a.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},a.queue=e,e=e.dispatch=o0.bind(null,Ve,e),[a.memoizedState,e]},useRef:function(e){var t=pn();return e={current:e},t.memoizedState=e},useState:Wp,useDebugValue:kc,useDeferredValue:function(e){return pn().memoizedState=e},useTransition:function(){var e=Wp(!1),t=e[0];return e=r0.bind(null,e[1]),pn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,o){var a=Ve,d=pn();if(Ue){if(o===void 0)throw Error(i(407));o=o()}else{if(o=t(),lt===null)throw Error(i(349));(Br&30)!==0||zp(a,t,o)}d.memoizedState=o;var p={value:o,getSnapshot:t};return d.queue=p,Hp($p.bind(null,a,p,e),[e]),a.flags|=2048,Oi(9,Fp.bind(null,a,p,o,t),void 0,null),o},useId:function(){var e=pn(),t=lt.identifierPrefix;if(Ue){var o=_n,a=En;o=(a&~(1<<32-Zt(a)-1)).toString(32)+o,t=":"+t+"R"+o,o=Di++,0")&&(O=O.replace("",e.displayName)),O}while(1<=w&&0<=_);break}}}finally{he=!1,Error.prepareStackTrace=o}return(e=e?e.displayName||e.name:"")?V(e):""}function pe(e){switch(e.tag){case 5:return V(e.type);case 16:return V("Lazy");case 13:return V("Suspense");case 19:return V("SuspenseList");case 0:case 2:case 15:return e=be(e.type,!1),e;case 11:return e=be(e.type.render,!1),e;case 1:return e=be(e.type,!0),e;default:return""}}function Y(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case I:return"Fragment";case N:return"Portal";case Q:return"Profiler";case L:return"StrictMode";case de:return"Suspense";case re:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case J:return(e.displayName||"Context")+".Consumer";case ee:return(e._context.displayName||"Context")+".Provider";case ne:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ie:return t=e.displayName||null,t!==null?t:Y(e.type)||"Memo";case B:t=e._payload,e=e._init;try{return Y(e(t))}catch{}}return null}function we(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Y(t);case 8:return t===L?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ke(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function me(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Be(e){var t=me(e)?"checked":"value",o=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),a=""+e[t];if(!e.hasOwnProperty(t)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var d=o.get,p=o.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return d.call(this)},set:function(w){a=""+w,p.call(this,w)}}),Object.defineProperty(e,t,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function mt(e){e._valueTracker||(e._valueTracker=Be(e))}function It(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var o=t.getValue(),a="";return e&&(a=me(e)?e.checked?"true":"false":e.value),e=a,e!==o?(t.setValue(e),!0):!1}function ut(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function tt(e,t){var o=t.checked;return F({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??e._wrapperState.initialChecked})}function Jn(e,t){var o=t.defaultValue==null?"":t.defaultValue,a=t.checked!=null?t.checked:t.defaultChecked;o=ke(t.value!=null?t.value:o),e._wrapperState={initialChecked:a,initialValue:o,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Cn(e,t){t=t.checked,t!=null&&T(e,"checked",t,!1)}function dt(e,t){Cn(e,t);var o=ke(t.value),a=t.type;if(o!=null)a==="number"?(o===0&&e.value===""||e.value!=o)&&(e.value=""+o):e.value!==""+o&&(e.value=""+o);else if(a==="submit"||a==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ti(e,t.type,o):t.hasOwnProperty("defaultValue")&&ti(e,t.type,ke(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function is(e,t,o){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var a=t.type;if(!(a!=="submit"&&a!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,o||t===e.value||(e.value=t),e.defaultValue=t}o=e.name,o!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,o!==""&&(e.name=o)}function ti(e,t,o){(t!=="number"||ut(e.ownerDocument)!==e)&&(o==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+o&&(e.defaultValue=""+o))}var Mr=Array.isArray;function Zn(e,t,o,a){if(e=e.options,t){t={};for(var d=0;d"+t.valueOf().toString()+"",t=ss.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ni(e,t){if(t){var o=e.firstChild;if(o&&o===e.lastChild&&o.nodeType===3){o.nodeValue=t;return}}e.textContent=t}var ri={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Fy=["Webkit","ms","Moz","O"];Object.keys(ri).forEach(function(e){Fy.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ri[t]=ri[e]})});function ff(e,t,o){return t==null||typeof t=="boolean"||t===""?"":o||typeof t!="number"||t===0||ri.hasOwnProperty(e)&&ri[e]?(""+t).trim():t+"px"}function pf(e,t){e=e.style;for(var o in t)if(t.hasOwnProperty(o)){var a=o.indexOf("--")===0,d=ff(o,t[o],a);o==="float"&&(o="cssFloat"),a?e.setProperty(o,d):e[o]=d}}var $y=F({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function pa(e,t){if(t){if($y[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!="object")throw Error(i(62))}}function ha(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ma=null;function ga(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var va=null,po=null,ho=null;function hf(e){if(e=Si(e)){if(typeof va!="function")throw Error(i(280));var t=e.stateNode;t&&(t=Rs(t),va(e.stateNode,e.type,t))}}function mf(e){po?ho?ho.push(e):ho=[e]:po=e}function gf(){if(po){var e=po,t=ho;if(ho=po=null,hf(e),t)for(e=0;e>>=0,e===0?32:31-(Xy(e)/Jy|0)|0}var ds=64,fs=4194304;function li(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ps(e,t){var o=e.pendingLanes;if(o===0)return 0;var a=0,d=e.suspendedLanes,p=e.pingedLanes,w=o&268435455;if(w!==0){var _=w&~d;_!==0?a=li(_):(p&=w,p!==0&&(a=li(p)))}else w=o&~d,w!==0?a=li(w):p!==0&&(a=li(p));if(a===0)return 0;if(t!==0&&t!==a&&(t&d)===0&&(d=a&-a,p=t&-t,d>=p||d===16&&(p&4194240)!==0))return t;if((a&4)!==0&&(a|=o&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=a;0o;o++)t.push(e);return t}function ai(e,t,o){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Zt(t),e[t]=o}function nw(e,t){var o=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var a=e.eventTimes;for(e=e.expirationTimes;0=gi),Vf=" ",Hf=!1;function Gf(e,t){switch(e){case"keyup":return Pw.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Kf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var vo=!1;function Tw(e,t){switch(e){case"compositionend":return Kf(t);case"keypress":return t.which!==32?null:(Hf=!0,Vf);case"textInput":return e=t.data,e===Vf&&Hf?null:e;default:return null}}function Ow(e,t){if(vo)return e==="compositionend"||!Aa&&Gf(e,t)?(e=zf(),xs=Ra=ir=null,vo=!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:o,offset:t-e};e=a}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=ep(o)}}function np(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?np(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function rp(){for(var e=window,t=ut();t instanceof e.HTMLIFrameElement;){try{var o=typeof t.contentWindow.location.href=="string"}catch{o=!1}if(o)e=t.contentWindow;else break;t=ut(e.document)}return t}function za(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")}function Bw(e){var t=rp(),o=e.focusedElem,a=e.selectionRange;if(t!==o&&o&&o.ownerDocument&&np(o.ownerDocument.documentElement,o)){if(a!==null&&za(o)){if(t=a.start,e=a.end,e===void 0&&(e=t),"selectionStart"in o)o.selectionStart=t,o.selectionEnd=Math.min(e,o.value.length);else if(e=(t=o.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var d=o.textContent.length,p=Math.min(a.start,d);a=a.end===void 0?p:Math.min(a.end,d),!e.extend&&p>a&&(d=a,a=p,p=d),d=tp(o,p);var w=tp(o,a);d&&w&&(e.rangeCount!==1||e.anchorNode!==d.node||e.anchorOffset!==d.offset||e.focusNode!==w.node||e.focusOffset!==w.offset)&&(t=t.createRange(),t.setStart(d.node,d.offset),e.removeAllRanges(),p>a?(e.addRange(t),e.extend(w.node,w.offset)):(t.setEnd(w.node,w.offset),e.addRange(t)))}}for(t=[],e=o;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o=document.documentMode,xo=null,Fa=null,wi=null,$a=!1;function op(e,t,o){var a=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;$a||xo==null||xo!==ut(a)||(a=xo,"selectionStart"in a&&za(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),wi&&yi(wi,a)||(wi=a,a=Es(Fa,"onSelect"),0jo||(e.current=Ja[jo],Ja[jo]=null,jo--)}function Le(e,t){jo++,Ja[jo]=e.current,e.current=t}var cr={},gt=ar(cr),Et=ar(!1),Lr=cr;function Co(e,t){var o=e.type.contextTypes;if(!o)return cr;var a=e.stateNode;if(a&&a.__reactInternalMemoizedUnmaskedChildContext===t)return a.__reactInternalMemoizedMaskedChildContext;var d={},p;for(p in o)d[p]=t[p];return a&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=d),d}function _t(e){return e=e.childContextTypes,e!=null}function Ps(){$e(Et),$e(gt)}function yp(e,t,o){if(gt.current!==cr)throw Error(i(168));Le(gt,t),Le(Et,o)}function wp(e,t,o){var a=e.stateNode;if(t=t.childContextTypes,typeof a.getChildContext!="function")return o;a=a.getChildContext();for(var d in a)if(!(d in t))throw Error(i(108,we(e)||"Unknown",d));return F({},o,a)}function Ds(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||cr,Lr=gt.current,Le(gt,e),Le(Et,Et.current),!0}function bp(e,t,o){var a=e.stateNode;if(!a)throw Error(i(169));o?(e=wp(e,t,Lr),a.__reactInternalMemoizedMergedChildContext=e,$e(Et),$e(gt),Le(gt,e)):$e(Et),Le(Et,o)}var En=null,Ts=!1,Za=!1;function kp(e){En===null?En=[e]:En.push(e)}function e0(e){Ts=!0,kp(e)}function ur(){if(!Za&&En!==null){Za=!0;var e=0,t=Ae;try{var o=En;for(Ae=1;e>=w,d-=w,_n=1<<32-Zt(t)+d|o<ye?(at=xe,xe=null):at=xe.sibling;var Pe=H(z,xe,$[ye],X);if(Pe===null){xe===null&&(xe=at);break}e&&xe&&Pe.alternate===null&&t(z,xe),A=p(Pe,A,ye),ve===null?fe=Pe:ve.sibling=Pe,ve=Pe,xe=at}if(ye===$.length)return o(z,xe),Ue&&Fr(z,ye),fe;if(xe===null){for(;ye<$.length;ye++)xe=K(z,$[ye],X),xe!==null&&(A=p(xe,A,ye),ve===null?fe=xe:ve.sibling=xe,ve=xe);return Ue&&Fr(z,ye),fe}for(xe=a(z,xe);ye<$.length;ye++)at=oe(xe,z,ye,$[ye],X),at!==null&&(e&&at.alternate!==null&&xe.delete(at.key===null?ye:at.key),A=p(at,A,ye),ve===null?fe=at:ve.sibling=at,ve=at);return e&&xe.forEach(function(yr){return t(z,yr)}),Ue&&Fr(z,ye),fe}function ue(z,A,$,X){var fe=q($);if(typeof fe!="function")throw Error(i(150));if($=fe.call($),$==null)throw Error(i(151));for(var ve=fe=null,xe=A,ye=A=0,at=null,Pe=$.next();xe!==null&&!Pe.done;ye++,Pe=$.next()){xe.index>ye?(at=xe,xe=null):at=xe.sibling;var yr=H(z,xe,Pe.value,X);if(yr===null){xe===null&&(xe=at);break}e&&xe&&yr.alternate===null&&t(z,xe),A=p(yr,A,ye),ve===null?fe=yr:ve.sibling=yr,ve=yr,xe=at}if(Pe.done)return o(z,xe),Ue&&Fr(z,ye),fe;if(xe===null){for(;!Pe.done;ye++,Pe=$.next())Pe=K(z,Pe.value,X),Pe!==null&&(A=p(Pe,A,ye),ve===null?fe=Pe:ve.sibling=Pe,ve=Pe);return Ue&&Fr(z,ye),fe}for(xe=a(z,xe);!Pe.done;ye++,Pe=$.next())Pe=oe(xe,z,ye,Pe.value,X),Pe!==null&&(e&&Pe.alternate!==null&&xe.delete(Pe.key===null?ye:Pe.key),A=p(Pe,A,ye),ve===null?fe=Pe:ve.sibling=Pe,ve=Pe);return e&&xe.forEach(function(M0){return t(z,M0)}),Ue&&Fr(z,ye),fe}function qe(z,A,$,X){if(typeof $=="object"&&$!==null&&$.type===I&&$.key===null&&($=$.props.children),typeof $=="object"&&$!==null){switch($.$$typeof){case R:e:{for(var fe=$.key,ve=A;ve!==null;){if(ve.key===fe){if(fe=$.type,fe===I){if(ve.tag===7){o(z,ve.sibling),A=d(ve,$.props.children),A.return=z,z=A;break e}}else if(ve.elementType===fe||typeof fe=="object"&&fe!==null&&fe.$$typeof===B&&Np(fe)===ve.type){o(z,ve.sibling),A=d(ve,$.props),A.ref=Ei(z,ve,$),A.return=z,z=A;break e}o(z,ve);break}else t(z,ve);ve=ve.sibling}$.type===I?(A=Kr($.props.children,z.mode,X,$.key),A.return=z,z=A):(X=sl($.type,$.key,$.props,null,z.mode,X),X.ref=Ei(z,A,$),X.return=z,z=X)}return w(z);case N:e:{for(ve=$.key;A!==null;){if(A.key===ve)if(A.tag===4&&A.stateNode.containerInfo===$.containerInfo&&A.stateNode.implementation===$.implementation){o(z,A.sibling),A=d(A,$.children||[]),A.return=z,z=A;break e}else{o(z,A);break}else t(z,A);A=A.sibling}A=qc($,z.mode,X),A.return=z,z=A}return w(z);case B:return ve=$._init,qe(z,A,ve($._payload),X)}if(Mr($))return ce(z,A,$,X);if(q($))return ue(z,A,$,X);Is(z,$)}return typeof $=="string"&&$!==""||typeof $=="number"?($=""+$,A!==null&&A.tag===6?(o(z,A.sibling),A=d(A,$),A.return=z,z=A):(o(z,A),A=Yc($,z.mode,X),A.return=z,z=A),w(z)):o(z,A)}return qe}var No=Rp(!0),Pp=Rp(!1),Ls=ar(null),zs=null,Ro=null,ic=null;function sc(){ic=Ro=zs=null}function lc(e){var t=Ls.current;$e(Ls),e._currentValue=t}function ac(e,t,o){for(;e!==null;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,a!==null&&(a.childLanes|=t)):a!==null&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===o)break;e=e.return}}function Po(e,t){zs=e,ic=Ro=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Nt=!0),e.firstContext=null)}function Ht(e){var t=e._currentValue;if(ic!==e)if(e={context:e,memoizedValue:t,next:null},Ro===null){if(zs===null)throw Error(i(308));Ro=e,zs.dependencies={lanes:0,firstContext:e}}else Ro=Ro.next=e;return t}var $r=null;function cc(e){$r===null?$r=[e]:$r.push(e)}function Dp(e,t,o,a){var d=t.interleaved;return d===null?(o.next=o,cc(t)):(o.next=d.next,d.next=o),t.interleaved=o,Rn(e,a)}function Rn(e,t){e.lanes|=t;var o=e.alternate;for(o!==null&&(o.lanes|=t),o=e,e=e.return;e!==null;)e.childLanes|=t,o=e.alternate,o!==null&&(o.childLanes|=t),o=e,e=e.return;return o.tag===3?o.stateNode:null}var dr=!1;function uc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Tp(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Pn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function fr(e,t,o){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(Re&2)!==0){var d=a.pending;return d===null?t.next=t:(t.next=d.next,d.next=t),a.pending=t,Rn(e,o)}return d=a.interleaved,d===null?(t.next=t,cc(a)):(t.next=d.next,d.next=t),a.interleaved=t,Rn(e,o)}function Fs(e,t,o){if(t=t.updateQueue,t!==null&&(t=t.shared,(o&4194240)!==0)){var a=t.lanes;a&=e.pendingLanes,o|=a,t.lanes=o,Ca(e,o)}}function Op(e,t){var o=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,o===a)){var d=null,p=null;if(o=o.firstBaseUpdate,o!==null){do{var w={eventTime:o.eventTime,lane:o.lane,tag:o.tag,payload:o.payload,callback:o.callback,next:null};p===null?d=p=w:p=p.next=w,o=o.next}while(o!==null);p===null?d=p=t:p=p.next=t}else d=p=t;o={baseState:a.baseState,firstBaseUpdate:d,lastBaseUpdate:p,shared:a.shared,effects:a.effects},e.updateQueue=o;return}e=o.lastBaseUpdate,e===null?o.firstBaseUpdate=t:e.next=t,o.lastBaseUpdate=t}function $s(e,t,o,a){var d=e.updateQueue;dr=!1;var p=d.firstBaseUpdate,w=d.lastBaseUpdate,_=d.shared.pending;if(_!==null){d.shared.pending=null;var O=_,U=O.next;O.next=null,w===null?p=U:w.next=U,w=O;var G=e.alternate;G!==null&&(G=G.updateQueue,_=G.lastBaseUpdate,_!==w&&(_===null?G.firstBaseUpdate=U:_.next=U,G.lastBaseUpdate=O))}if(p!==null){var K=d.baseState;w=0,G=U=O=null,_=p;do{var H=_.lane,oe=_.eventTime;if((a&H)===H){G!==null&&(G=G.next={eventTime:oe,lane:0,tag:_.tag,payload:_.payload,callback:_.callback,next:null});e:{var ce=e,ue=_;switch(H=t,oe=o,ue.tag){case 1:if(ce=ue.payload,typeof ce=="function"){K=ce.call(oe,K,H);break e}K=ce;break e;case 3:ce.flags=ce.flags&-65537|128;case 0:if(ce=ue.payload,H=typeof ce=="function"?ce.call(oe,K,H):ce,H==null)break e;K=F({},K,H);break e;case 2:dr=!0}}_.callback!==null&&_.lane!==0&&(e.flags|=64,H=d.effects,H===null?d.effects=[_]:H.push(_))}else oe={eventTime:oe,lane:H,tag:_.tag,payload:_.payload,callback:_.callback,next:null},G===null?(U=G=oe,O=K):G=G.next=oe,w|=H;if(_=_.next,_===null){if(_=d.shared.pending,_===null)break;H=_,_=H.next,H.next=null,d.lastBaseUpdate=H,d.shared.pending=null}}while(!0);if(G===null&&(O=K),d.baseState=O,d.firstBaseUpdate=U,d.lastBaseUpdate=G,t=d.shared.interleaved,t!==null){d=t;do w|=d.lane,d=d.next;while(d!==t)}else p===null&&(d.shared.lanes=0);Wr|=w,e.lanes=w,e.memoizedState=K}}function Mp(e,t,o){if(e=t.effects,t.effects=null,e!==null)for(t=0;to?o:4,e(!0);var a=mc.transition;mc.transition={};try{e(!1),t()}finally{Ae=o,mc.transition=a}}function Zp(){return Gt().memoizedState}function o0(e,t,o){var a=gr(e);if(o={lane:a,action:o,hasEagerState:!1,eagerState:null,next:null},eh(e))th(t,o);else if(o=Dp(e,t,o,a),o!==null){var d=jt();sn(o,e,a,d),nh(o,t,a)}}function i0(e,t,o){var a=gr(e),d={lane:a,action:o,hasEagerState:!1,eagerState:null,next:null};if(eh(e))th(t,d);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=t.lastRenderedReducer,p!==null))try{var w=t.lastRenderedState,_=p(w,o);if(d.hasEagerState=!0,d.eagerState=_,en(_,w)){var O=t.interleaved;O===null?(d.next=d,cc(t)):(d.next=O.next,O.next=d),t.interleaved=d;return}}catch{}finally{}o=Dp(e,t,d,a),o!==null&&(d=jt(),sn(o,e,a,d),nh(o,t,a))}}function eh(e){var t=e.alternate;return e===Ve||t!==null&&t===Ve}function th(e,t){Pi=Ws=!0;var o=e.pending;o===null?t.next=t:(t.next=o.next,o.next=t),e.pending=t}function nh(e,t,o){if((o&4194240)!==0){var a=t.lanes;a&=e.pendingLanes,o|=a,t.lanes=o,Ca(e,o)}}var Gs={readContext:Ht,useCallback:vt,useContext:vt,useEffect:vt,useImperativeHandle:vt,useInsertionEffect:vt,useLayoutEffect:vt,useMemo:vt,useReducer:vt,useRef:vt,useState:vt,useDebugValue:vt,useDeferredValue:vt,useTransition:vt,useMutableSource:vt,useSyncExternalStore:vt,useId:vt,unstable_isNewReconciler:!1},s0={readContext:Ht,useCallback:function(e,t){return pn().memoizedState=[e,t===void 0?null:t],e},useContext:Ht,useEffect:Hp,useImperativeHandle:function(e,t,o){return o=o!=null?o.concat([e]):null,Vs(4194308,4,Qp.bind(null,t,e),o)},useLayoutEffect:function(e,t){return Vs(4194308,4,e,t)},useInsertionEffect:function(e,t){return Vs(4,2,e,t)},useMemo:function(e,t){var o=pn();return t=t===void 0?null:t,e=e(),o.memoizedState=[e,t],e},useReducer:function(e,t,o){var a=pn();return t=o!==void 0?o(t):t,a.memoizedState=a.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},a.queue=e,e=e.dispatch=o0.bind(null,Ve,e),[a.memoizedState,e]},useRef:function(e){var t=pn();return e={current:e},t.memoizedState=e},useState:Wp,useDebugValue:kc,useDeferredValue:function(e){return pn().memoizedState=e},useTransition:function(){var e=Wp(!1),t=e[0];return e=r0.bind(null,e[1]),pn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,o){var a=Ve,d=pn();if(Ue){if(o===void 0)throw Error(i(407));o=o()}else{if(o=t(),lt===null)throw Error(i(349));(Br&30)!==0||zp(a,t,o)}d.memoizedState=o;var p={value:o,getSnapshot:t};return d.queue=p,Hp($p.bind(null,a,p,e),[e]),a.flags|=2048,Oi(9,Fp.bind(null,a,p,o,t),void 0,null),o},useId:function(){var e=pn(),t=lt.identifierPrefix;if(Ue){var o=Nn,a=_n;o=(a&~(1<<32-Zt(a)-1)).toString(32)+o,t=":"+t+"R"+o,o=Di++,0<\/script>",e=e.removeChild(e.firstChild)):typeof a.is=="string"?e=w.createElement(o,{is:a.is}):(e=w.createElement(o),o==="select"&&(w=e,a.multiple?w.multiple=!0:a.size&&(w.size=a.size))):e=w.createElementNS(e,o),e[dn]=t,e[ji]=a,kh(e,t,!1,!1),t.stateNode=e;e:{switch(w=ha(o,a),o){case"dialog":Fe("cancel",e),Fe("close",e),d=a;break;case"iframe":case"object":case"embed":Fe("load",e),d=a;break;case"video":case"audio":for(d=0;dAo&&(t.flags|=128,a=!0,Mi(p,!1),t.lanes=4194304)}else{if(!a)if(e=Us(w),e!==null){if(t.flags|=128,a=!0,o=e.updateQueue,o!==null&&(t.updateQueue=o,t.flags|=4),Mi(p,!0),p.tail===null&&p.tailMode==="hidden"&&!w.alternate&&!Ue)return xt(t),null}else 2*Ye()-p.renderingStartTime>Ao&&o!==1073741824&&(t.flags|=128,a=!0,Mi(p,!1),t.lanes=4194304);p.isBackwards?(w.sibling=t.child,t.child=w):(o=p.last,o!==null?o.sibling=w:t.child=w,p.last=w)}return p.tail!==null?(t=p.tail,p.rendering=t,p.tail=t.sibling,p.renderingStartTime=Ye(),t.sibling=null,o=We.current,Le(We,a?o&1|2:o&1),t):(xt(t),null);case 22:case 23:return Gc(),a=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==a&&(t.flags|=8192),a&&(t.mode&1)!==0?($t&1073741824)!==0&&(xt(t),t.subtreeFlags&6&&(t.flags|=8192)):xt(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function h0(e,t){switch(tc(t),t.tag){case 1:return _t(t.type)&&Ps(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Do(),$e(Et),$e(gt),hc(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return fc(t),null;case 13:if($e(We),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));_o()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return $e(We),null;case 4:return Do(),null;case 10:return lc(t.type._context),null;case 22:case 23:return Gc(),null;case 24:return null;default:return null}}var qs=!1,yt=!1,m0=typeof WeakSet=="function"?WeakSet:Set,le=null;function Oo(e,t){var o=e.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(a){Ke(e,t,a)}else o.current=null}function Mc(e,t,o){try{o()}catch(a){Ke(e,t,a)}}var Sh=!1;function g0(e,t){if(Ga=gs,e=rp(),za(e)){if("selectionStart"in e)var o={start:e.selectionStart,end:e.selectionEnd};else e:{o=(o=e.ownerDocument)&&o.defaultView||window;var a=o.getSelection&&o.getSelection();if(a&&a.rangeCount!==0){o=a.anchorNode;var d=a.anchorOffset,p=a.focusNode;a=a.focusOffset;try{o.nodeType,p.nodeType}catch{o=null;break e}var w=0,_=-1,O=-1,U=0,G=0,K=e,H=null;t:for(;;){for(var oe;K!==o||d!==0&&K.nodeType!==3||(_=w+d),K!==p||a!==0&&K.nodeType!==3||(O=w+a),K.nodeType===3&&(w+=K.nodeValue.length),(oe=K.firstChild)!==null;)H=K,K=oe;for(;;){if(K===e)break t;if(H===o&&++U===d&&(_=w),H===p&&++G===a&&(O=w),(oe=K.nextSibling)!==null)break;K=H,H=K.parentNode}K=oe}o=_===-1||O===-1?null:{start:_,end:O}}else o=null}o=o||{start:0,end:0}}else o=null;for(Ka={focusedElem:e,selectionRange:o},gs=!1,le=t;le!==null;)if(t=le,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,le=e;else for(;le!==null;){t=le;try{var ce=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(ce!==null){var ue=ce.memoizedProps,qe=ce.memoizedState,z=t.stateNode,A=z.getSnapshotBeforeUpdate(t.elementType===t.type?ue:nn(t.type,ue),qe);z.__reactInternalSnapshotBeforeUpdate=A}break;case 3:var $=t.stateNode.containerInfo;$.nodeType===1?$.textContent="":$.nodeType===9&&$.documentElement&&$.removeChild($.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(X){Ke(t,t.return,X)}if(e=t.sibling,e!==null){e.return=t.return,le=e;break}le=t.return}return ce=Sh,Sh=!1,ce}function Ai(e,t,o){var a=t.updateQueue;if(a=a!==null?a.lastEffect:null,a!==null){var d=a=a.next;do{if((d.tag&e)===e){var p=d.destroy;d.destroy=void 0,p!==void 0&&Mc(t,o,p)}d=d.next}while(d!==a)}}function Xs(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var o=t=t.next;do{if((o.tag&e)===e){var a=o.create;o.destroy=a()}o=o.next}while(o!==t)}}function Ac(e){var t=e.ref;if(t!==null){var o=e.stateNode;switch(e.tag){case 5:e=o;break;default:e=o}typeof t=="function"?t(e):t.current=e}}function Eh(e){var t=e.alternate;t!==null&&(e.alternate=null,Eh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[dn],delete t[ji],delete t[Xa],delete t[Jw],delete t[Zw])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function _h(e){return e.tag===5||e.tag===3||e.tag===4}function Nh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||_h(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.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 Ic(e,t,o){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?o.nodeType===8?o.parentNode.insertBefore(e,t):o.insertBefore(e,t):(o.nodeType===8?(t=o.parentNode,t.insertBefore(e,o)):(t=o,t.appendChild(e)),o=o._reactRootContainer,o!=null||t.onclick!==null||(t.onclick=Ns));else if(a!==4&&(e=e.child,e!==null))for(Ic(e,t,o),e=e.sibling;e!==null;)Ic(e,t,o),e=e.sibling}function Lc(e,t,o){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?o.insertBefore(e,t):o.appendChild(e);else if(a!==4&&(e=e.child,e!==null))for(Lc(e,t,o),e=e.sibling;e!==null;)Lc(e,t,o),e=e.sibling}var ft=null,rn=!1;function pr(e,t,o){for(o=o.child;o!==null;)Rh(e,t,o),o=o.sibling}function Rh(e,t,o){if(un&&typeof un.onCommitFiberUnmount=="function")try{un.onCommitFiberUnmount(us,o)}catch{}switch(o.tag){case 5:yt||Oo(o,t);case 6:var a=ft,d=rn;ft=null,pr(e,t,o),ft=a,rn=d,ft!==null&&(rn?(e=ft,o=o.stateNode,e.nodeType===8?e.parentNode.removeChild(o):e.removeChild(o)):ft.removeChild(o.stateNode));break;case 18:ft!==null&&(rn?(e=ft,o=o.stateNode,e.nodeType===8?qa(e.parentNode,o):e.nodeType===1&&qa(e,o),pi(e)):qa(ft,o.stateNode));break;case 4:a=ft,d=rn,ft=o.stateNode.containerInfo,rn=!0,pr(e,t,o),ft=a,rn=d;break;case 0:case 11:case 14:case 15:if(!yt&&(a=o.updateQueue,a!==null&&(a=a.lastEffect,a!==null))){d=a=a.next;do{var p=d,w=p.destroy;p=p.tag,w!==void 0&&((p&2)!==0||(p&4)!==0)&&Mc(o,t,w),d=d.next}while(d!==a)}pr(e,t,o);break;case 1:if(!yt&&(Oo(o,t),a=o.stateNode,typeof a.componentWillUnmount=="function"))try{a.props=o.memoizedProps,a.state=o.memoizedState,a.componentWillUnmount()}catch(_){Ke(o,t,_)}pr(e,t,o);break;case 21:pr(e,t,o);break;case 22:o.mode&1?(yt=(a=yt)||o.memoizedState!==null,pr(e,t,o),yt=a):pr(e,t,o);break;default:pr(e,t,o)}}function Ph(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var o=e.stateNode;o===null&&(o=e.stateNode=new m0),t.forEach(function(a){var d=S0.bind(null,e,a);o.has(a)||(o.add(a),a.then(d,d))})}}function on(e,t){var o=t.deletions;if(o!==null)for(var a=0;ad&&(d=w),a&=~p}if(a=d,a=Ye()-a,a=(120>a?120:480>a?480:1080>a?1080:1920>a?1920:3e3>a?3e3:4320>a?4320:1960*x0(a/1960))-a,10e?16:e,mr===null)var a=!1;else{if(e=mr,mr=null,nl=0,(Re&6)!==0)throw Error(i(331));var d=Re;for(Re|=4,le=e.current;le!==null;){var p=le,w=p.child;if((le.flags&16)!==0){var _=p.deletions;if(_!==null){for(var O=0;O<_.length;O++){var U=_[O];for(le=U;le!==null;){var G=le;switch(G.tag){case 0:case 11:case 15:Ai(8,G,p)}var K=G.child;if(K!==null)K.return=G,le=K;else for(;le!==null;){G=le;var H=G.sibling,oe=G.return;if(Eh(G),G===U){le=null;break}if(H!==null){H.return=oe,le=H;break}le=oe}}}var ce=p.alternate;if(ce!==null){var ue=ce.child;if(ue!==null){ce.child=null;do{var qe=ue.sibling;ue.sibling=null,ue=qe}while(ue!==null)}}le=p}}if((p.subtreeFlags&2064)!==0&&w!==null)w.return=p,le=w;else e:for(;le!==null;){if(p=le,(p.flags&2048)!==0)switch(p.tag){case 0:case 11:case 15:Ai(9,p,p.return)}var z=p.sibling;if(z!==null){z.return=p.return,le=z;break e}le=p.return}}var A=e.current;for(le=A;le!==null;){w=le;var $=w.child;if((w.subtreeFlags&2064)!==0&&$!==null)$.return=w,le=$;else e:for(w=A;le!==null;){if(_=le,(_.flags&2048)!==0)try{switch(_.tag){case 0:case 11:case 15:Xs(9,_)}}catch(fe){Ke(_,_.return,fe)}if(_===w){le=null;break e}var X=_.sibling;if(X!==null){X.return=_.return,le=X;break e}le=_.return}}if(Re=d,ur(),un&&typeof un.onPostCommitFiberRoot=="function")try{un.onPostCommitFiberRoot(us,e)}catch{}a=!0}return a}finally{Ae=o,Kt.transition=t}}return!1}function Bh(e,t,o){t=To(o,t),t=sh(e,t,1),e=fr(e,t,1),t=Ct(),e!==null&&(ai(e,1,t),Pt(e,t))}function Ke(e,t,o){if(e.tag===3)Bh(e,e,o);else for(;t!==null;){if(t.tag===3){Bh(t,e,o);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(hr===null||!hr.has(a))){e=To(o,e),e=lh(t,e,1),t=fr(t,e,1),e=Ct(),t!==null&&(ai(t,1,e),Pt(t,e));break}}t=t.return}}function C0(e,t,o){var a=e.pingCache;a!==null&&a.delete(t),t=Ct(),e.pingedLanes|=e.suspendedLanes&o,lt===e&&(pt&o)===o&&(rt===4||rt===3&&(pt&130023424)===pt&&500>Ye()-$c?Hr(e,0):Fc|=o),Pt(e,t)}function Wh(e,t){t===0&&((e.mode&1)===0?t=1:(t=fs,fs<<=1,(fs&130023424)===0&&(fs=4194304)));var o=Ct();e=Nn(e,t),e!==null&&(ai(e,t,o),Pt(e,o))}function j0(e){var t=e.memoizedState,o=0;t!==null&&(o=t.retryLane),Wh(e,o)}function S0(e,t){var o=0;switch(e.tag){case 13:var a=e.stateNode,d=e.memoizedState;d!==null&&(o=d.retryLane);break;case 19:a=e.stateNode;break;default:throw Error(i(314))}a!==null&&a.delete(t),Wh(e,o)}var Vh;Vh=function(e,t,o){if(e!==null)if(e.memoizedProps!==t.pendingProps||Et.current)Nt=!0;else{if((e.lanes&o)===0&&(t.flags&128)===0)return Nt=!1,f0(e,t,o);Nt=(e.flags&131072)!==0}else Nt=!1,Ue&&(t.flags&1048576)!==0&&Cp(t,Ms,t.index);switch(t.lanes=0,t.tag){case 2:var a=t.type;Ys(e,t),e=t.pendingProps;var d=jo(t,gt.current);Po(t,o),d=vc(null,t,a,e,d,o);var p=xc();return t.flags|=1,typeof d=="object"&&d!==null&&typeof d.render=="function"&&d.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,_t(a)?(p=!0,Ds(t)):p=!1,t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,uc(t),d.updater=Ks,t.stateNode=d,d._reactInternals=t,jc(t,a,e,o),t=Nc(null,t,a,!0,p,o)):(t.tag=0,Ue&&p&&ec(t),kt(null,t,d,o),t=t.child),t;case 16:a=t.elementType;e:{switch(Ys(e,t),e=t.pendingProps,d=a._init,a=d(a._payload),t.type=a,d=t.tag=_0(a),e=nn(a,e),d){case 0:t=_c(null,t,a,e,o);break e;case 1:t=gh(null,t,a,e,o);break e;case 11:t=dh(null,t,a,e,o);break e;case 14:t=fh(null,t,a,nn(a.type,e),o);break e}throw Error(i(306,a,""))}return t;case 0:return a=t.type,d=t.pendingProps,d=t.elementType===a?d:nn(a,d),_c(e,t,a,d,o);case 1:return a=t.type,d=t.pendingProps,d=t.elementType===a?d:nn(a,d),gh(e,t,a,d,o);case 3:e:{if(vh(t),e===null)throw Error(i(387));a=t.pendingProps,p=t.memoizedState,d=p.element,Tp(e,t),$s(t,a,null,o);var w=t.memoizedState;if(a=w.element,p.isDehydrated)if(p={element:a,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},t.updateQueue.baseState=p,t.memoizedState=p,t.flags&256){d=To(Error(i(423)),t),t=xh(e,t,a,o,d);break e}else if(a!==d){d=To(Error(i(424)),t),t=xh(e,t,a,o,d);break e}else for(Ft=lr(t.stateNode.containerInfo.firstChild),zt=t,Ue=!0,tn=null,o=Pp(t,null,a,o),t.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(_o(),a===d){t=Pn(e,t,o);break e}kt(e,t,a,o)}t=t.child}return t;case 5:return Ap(t),e===null&&rc(t),a=t.type,d=t.pendingProps,p=e!==null?e.memoizedProps:null,w=d.children,Qa(a,d)?w=null:p!==null&&Qa(a,p)&&(t.flags|=32),mh(e,t),kt(e,t,w,o),t.child;case 6:return e===null&&rc(t),null;case 13:return yh(e,t,o);case 4:return dc(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=No(t,null,a,o):kt(e,t,a,o),t.child;case 11:return a=t.type,d=t.pendingProps,d=t.elementType===a?d:nn(a,d),dh(e,t,a,d,o);case 7:return kt(e,t,t.pendingProps,o),t.child;case 8:return kt(e,t,t.pendingProps.children,o),t.child;case 12:return kt(e,t,t.pendingProps.children,o),t.child;case 10:e:{if(a=t.type._context,d=t.pendingProps,p=t.memoizedProps,w=d.value,Le(Ls,a._currentValue),a._currentValue=w,p!==null)if(en(p.value,w)){if(p.children===d.children&&!Et.current){t=Pn(e,t,o);break e}}else for(p=t.child,p!==null&&(p.return=t);p!==null;){var _=p.dependencies;if(_!==null){w=p.child;for(var O=_.firstContext;O!==null;){if(O.context===a){if(p.tag===1){O=Rn(-1,o&-o),O.tag=2;var U=p.updateQueue;if(U!==null){U=U.shared;var G=U.pending;G===null?O.next=O:(O.next=G.next,G.next=O),U.pending=O}}p.lanes|=o,O=p.alternate,O!==null&&(O.lanes|=o),ac(p.return,o,t),_.lanes|=o;break}O=O.next}}else if(p.tag===10)w=p.type===t.type?null:p.child;else if(p.tag===18){if(w=p.return,w===null)throw Error(i(341));w.lanes|=o,_=w.alternate,_!==null&&(_.lanes|=o),ac(w,o,t),w=p.sibling}else w=p.child;if(w!==null)w.return=p;else for(w=p;w!==null;){if(w===t){w=null;break}if(p=w.sibling,p!==null){p.return=w.return,w=p;break}w=w.return}p=w}kt(e,t,d.children,o),t=t.child}return t;case 9:return d=t.type,a=t.pendingProps.children,Po(t,o),d=Ht(d),a=a(d),t.flags|=1,kt(e,t,a,o),t.child;case 14:return a=t.type,d=nn(a,t.pendingProps),d=nn(a.type,d),fh(e,t,a,d,o);case 15:return ph(e,t,t.type,t.pendingProps,o);case 17:return a=t.type,d=t.pendingProps,d=t.elementType===a?d:nn(a,d),Ys(e,t),t.tag=1,_t(a)?(e=!0,Ds(t)):e=!1,Po(t,o),oh(t,a,d),jc(t,a,d,o),Nc(null,t,a,!0,e,o);case 19:return bh(e,t,o);case 22:return hh(e,t,o)}throw Error(i(156,t.tag))};function Hh(e,t){return jf(e,t)}function E0(e,t,o,a){this.tag=e,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qt(e,t,o,a){return new E0(e,t,o,a)}function Qc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _0(e){if(typeof e=="function")return Qc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ne)return 11;if(e===ie)return 14}return 2}function xr(e,t){var o=e.alternate;return o===null?(o=Qt(e.tag,t,e.key,e.mode),o.elementType=e.elementType,o.type=e.type,o.stateNode=e.stateNode,o.alternate=e,e.alternate=o):(o.pendingProps=t,o.type=e.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=e.flags&14680064,o.childLanes=e.childLanes,o.lanes=e.lanes,o.child=e.child,o.memoizedProps=e.memoizedProps,o.memoizedState=e.memoizedState,o.updateQueue=e.updateQueue,t=e.dependencies,o.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},o.sibling=e.sibling,o.index=e.index,o.ref=e.ref,o}function sl(e,t,o,a,d,p){var w=2;if(a=e,typeof e=="function")Qc(e)&&(w=1);else if(typeof e=="string")w=5;else e:switch(e){case I:return Kr(o.children,d,p,t);case L:w=8,d|=8;break;case Q:return e=Qt(12,o,t,d|2),e.elementType=Q,e.lanes=p,e;case de:return e=Qt(13,o,t,d),e.elementType=de,e.lanes=p,e;case re:return e=Qt(19,o,t,d),e.elementType=re,e.lanes=p,e;case Z:return ll(o,d,p,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ee:w=10;break e;case J:w=9;break e;case ne:w=11;break e;case ie:w=14;break e;case B:w=16,a=null;break e}throw Error(i(130,e==null?e:typeof e,""))}return t=Qt(w,o,t,d),t.elementType=e,t.type=a,t.lanes=p,t}function Kr(e,t,o,a){return e=Qt(7,e,a,t),e.lanes=o,e}function ll(e,t,o,a){return e=Qt(22,e,a,t),e.elementType=Z,e.lanes=o,e.stateNode={isHidden:!1},e}function Yc(e,t,o){return e=Qt(6,e,null,t),e.lanes=o,e}function qc(e,t,o){return t=Qt(4,e.children!==null?e.children:[],e.key,t),t.lanes=o,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function N0(e,t,o,a,d){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ca(0),this.expirationTimes=Ca(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ca(0),this.identifierPrefix=a,this.onRecoverableError=d,this.mutableSourceEagerHydrationData=null}function Xc(e,t,o,a,d,p,w,_,O){return e=new N0(e,t,o,_,O),t===1?(t=1,p===!0&&(t|=8)):t=0,p=Qt(3,null,null,t),e.current=p,p.stateNode=e,p.memoizedState={element:a,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},uc(p),e}function R0(e,t,o){var a=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}return n(),ou.exports=W0(),ou.exports}var am;function V0(){if(am)return hl;am=1;var n=ug();return hl.createRoot=n.createRoot,hl.hydrateRoot=n.hydrateRoot,hl}var H0=V0(),ed=ug();/** +`+p.stack}return{value:e,source:t,stack:d,digest:null}}function Sc(e,t,o){return{value:e,source:null,stack:o??null,digest:t??null}}function Ec(e,t){try{console.error(t.value)}catch(o){setTimeout(function(){throw o})}}var c0=typeof WeakMap=="function"?WeakMap:Map;function sh(e,t,o){o=Pn(-1,o),o.tag=3,o.payload={element:null};var a=t.value;return o.callback=function(){el||(el=!0,Uc=a),Ec(e,t)},o}function lh(e,t,o){o=Pn(-1,o),o.tag=3;var a=e.type.getDerivedStateFromError;if(typeof a=="function"){var d=t.value;o.payload=function(){return a(d)},o.callback=function(){Ec(e,t)}}var p=e.stateNode;return p!==null&&typeof p.componentDidCatch=="function"&&(o.callback=function(){Ec(e,t),typeof a!="function"&&(hr===null?hr=new Set([this]):hr.add(this));var w=t.stack;this.componentDidCatch(t.value,{componentStack:w!==null?w:""})}),o}function ah(e,t,o){var a=e.pingCache;if(a===null){a=e.pingCache=new c0;var d=new Set;a.set(t,d)}else d=a.get(t),d===void 0&&(d=new Set,a.set(t,d));d.has(o)||(d.add(o),e=j0.bind(null,e,t,o),t.then(e,e))}function ch(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function uh(e,t,o,a,d){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,o.flags|=131072,o.flags&=-52805,o.tag===1&&(o.alternate===null?o.tag=17:(t=Pn(-1,1),t.tag=2,fr(o,t,1))),o.lanes|=1),e):(e.flags|=65536,e.lanes=d,e)}var u0=P.ReactCurrentOwner,Nt=!1;function kt(e,t,o,a){t.child=e===null?Pp(t,null,o,a):No(t,e.child,o,a)}function dh(e,t,o,a,d){o=o.render;var p=t.ref;return Po(t,d),a=vc(e,t,o,a,p,d),o=xc(),e!==null&&!Nt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~d,Dn(e,t,d)):(Ue&&o&&ec(t),t.flags|=1,kt(e,t,a,d),t.child)}function fh(e,t,o,a,d){if(e===null){var p=o.type;return typeof p=="function"&&!Qc(p)&&p.defaultProps===void 0&&o.compare===null&&o.defaultProps===void 0?(t.tag=15,t.type=p,ph(e,t,p,a,d)):(e=sl(o.type,null,a,t,t.mode,d),e.ref=t.ref,e.return=t,t.child=e)}if(p=e.child,(e.lanes&d)===0){var w=p.memoizedProps;if(o=o.compare,o=o!==null?o:yi,o(w,a)&&e.ref===t.ref)return Dn(e,t,d)}return t.flags|=1,e=xr(p,a),e.ref=t.ref,e.return=t,t.child=e}function ph(e,t,o,a,d){if(e!==null){var p=e.memoizedProps;if(yi(p,a)&&e.ref===t.ref)if(Nt=!1,t.pendingProps=a=p,(e.lanes&d)!==0)(e.flags&131072)!==0&&(Nt=!0);else return t.lanes=e.lanes,Dn(e,t,d)}return _c(e,t,o,a,d)}function hh(e,t,o){var a=t.pendingProps,d=a.children,p=e!==null?e.memoizedState:null;if(a.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Le(Mo,$t),$t|=o;else{if((o&1073741824)===0)return e=p!==null?p.baseLanes|o:o,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Le(Mo,$t),$t|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},a=p!==null?p.baseLanes:o,Le(Mo,$t),$t|=a}else p!==null?(a=p.baseLanes|o,t.memoizedState=null):a=o,Le(Mo,$t),$t|=a;return kt(e,t,d,o),t.child}function mh(e,t){var o=t.ref;(e===null&&o!==null||e!==null&&e.ref!==o)&&(t.flags|=512,t.flags|=2097152)}function _c(e,t,o,a,d){var p=_t(o)?Lr:gt.current;return p=Co(t,p),Po(t,d),o=vc(e,t,o,a,p,d),a=xc(),e!==null&&!Nt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~d,Dn(e,t,d)):(Ue&&a&&ec(t),t.flags|=1,kt(e,t,o,d),t.child)}function gh(e,t,o,a,d){if(_t(o)){var p=!0;Ds(t)}else p=!1;if(Po(t,d),t.stateNode===null)Ys(e,t),oh(t,o,a),Cc(t,o,a,d),a=!0;else if(e===null){var w=t.stateNode,_=t.memoizedProps;w.props=_;var O=w.context,U=o.contextType;typeof U=="object"&&U!==null?U=Ht(U):(U=_t(o)?Lr:gt.current,U=Co(t,U));var G=o.getDerivedStateFromProps,K=typeof G=="function"||typeof w.getSnapshotBeforeUpdate=="function";K||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(_!==a||O!==U)&&ih(t,w,a,U),dr=!1;var H=t.memoizedState;w.state=H,$s(t,a,w,d),O=t.memoizedState,_!==a||H!==O||Et.current||dr?(typeof G=="function"&&(jc(t,o,G,a),O=t.memoizedState),(_=dr||rh(t,o,_,a,H,O,U))?(K||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(t.flags|=4194308)):(typeof w.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=O),w.props=a,w.state=O,w.context=U,a=_):(typeof w.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{w=t.stateNode,Tp(e,t),_=t.memoizedProps,U=t.type===t.elementType?_:nn(t.type,_),w.props=U,K=t.pendingProps,H=w.context,O=o.contextType,typeof O=="object"&&O!==null?O=Ht(O):(O=_t(o)?Lr:gt.current,O=Co(t,O));var oe=o.getDerivedStateFromProps;(G=typeof oe=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(_!==K||H!==O)&&ih(t,w,a,O),dr=!1,H=t.memoizedState,w.state=H,$s(t,a,w,d);var ce=t.memoizedState;_!==K||H!==ce||Et.current||dr?(typeof oe=="function"&&(jc(t,o,oe,a),ce=t.memoizedState),(U=dr||rh(t,o,U,a,H,ce,O)||!1)?(G||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(a,ce,O),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(a,ce,O)),typeof w.componentDidUpdate=="function"&&(t.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof w.componentDidUpdate!="function"||_===e.memoizedProps&&H===e.memoizedState||(t.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&H===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=ce),w.props=a,w.state=ce,w.context=O,a=U):(typeof w.componentDidUpdate!="function"||_===e.memoizedProps&&H===e.memoizedState||(t.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&H===e.memoizedState||(t.flags|=1024),a=!1)}return Nc(e,t,o,a,p,d)}function Nc(e,t,o,a,d,p){mh(e,t);var w=(t.flags&128)!==0;if(!a&&!w)return d&&bp(t,o,!1),Dn(e,t,p);a=t.stateNode,u0.current=t;var _=w&&typeof o.getDerivedStateFromError!="function"?null:a.render();return t.flags|=1,e!==null&&w?(t.child=No(t,e.child,null,p),t.child=No(t,null,_,p)):kt(e,t,_,p),t.memoizedState=a.state,d&&bp(t,o,!0),t.child}function vh(e){var t=e.stateNode;t.pendingContext?yp(e,t.pendingContext,t.pendingContext!==t.context):t.context&&yp(e,t.context,!1),dc(e,t.containerInfo)}function xh(e,t,o,a,d){return _o(),oc(d),t.flags|=256,kt(e,t,o,a),t.child}var Rc={dehydrated:null,treeContext:null,retryLane:0};function Pc(e){return{baseLanes:e,cachePool:null,transitions:null}}function yh(e,t,o){var a=t.pendingProps,d=We.current,p=!1,w=(t.flags&128)!==0,_;if((_=w)||(_=e!==null&&e.memoizedState===null?!1:(d&2)!==0),_?(p=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(d|=1),Le(We,d&1),e===null)return rc(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:e.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(w=a.children,e=a.fallback,p?(a=t.mode,p=t.child,w={mode:"hidden",children:w},(a&1)===0&&p!==null?(p.childLanes=0,p.pendingProps=w):p=ll(w,a,0,null),e=Kr(e,a,o,null),p.return=t,e.return=t,p.sibling=e,t.child=p,t.child.memoizedState=Pc(o),t.memoizedState=Rc,e):Dc(t,w));if(d=e.memoizedState,d!==null&&(_=d.dehydrated,_!==null))return d0(e,t,w,a,_,d,o);if(p){p=a.fallback,w=t.mode,d=e.child,_=d.sibling;var O={mode:"hidden",children:a.children};return(w&1)===0&&t.child!==d?(a=t.child,a.childLanes=0,a.pendingProps=O,t.deletions=null):(a=xr(d,O),a.subtreeFlags=d.subtreeFlags&14680064),_!==null?p=xr(_,p):(p=Kr(p,w,o,null),p.flags|=2),p.return=t,a.return=t,a.sibling=p,t.child=a,a=p,p=t.child,w=e.child.memoizedState,w=w===null?Pc(o):{baseLanes:w.baseLanes|o,cachePool:null,transitions:w.transitions},p.memoizedState=w,p.childLanes=e.childLanes&~o,t.memoizedState=Rc,a}return p=e.child,e=p.sibling,a=xr(p,{mode:"visible",children:a.children}),(t.mode&1)===0&&(a.lanes=o),a.return=t,a.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=a,t.memoizedState=null,a}function Dc(e,t){return t=ll({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Qs(e,t,o,a){return a!==null&&oc(a),No(t,e.child,null,o),e=Dc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function d0(e,t,o,a,d,p,w){if(o)return t.flags&256?(t.flags&=-257,a=Sc(Error(i(422))),Qs(e,t,w,a)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(p=a.fallback,d=t.mode,a=ll({mode:"visible",children:a.children},d,0,null),p=Kr(p,d,w,null),p.flags|=2,a.return=t,p.return=t,a.sibling=p,t.child=a,(t.mode&1)!==0&&No(t,e.child,null,w),t.child.memoizedState=Pc(w),t.memoizedState=Rc,p);if((t.mode&1)===0)return Qs(e,t,w,null);if(d.data==="$!"){if(a=d.nextSibling&&d.nextSibling.dataset,a)var _=a.dgst;return a=_,p=Error(i(419)),a=Sc(p,a,void 0),Qs(e,t,w,a)}if(_=(w&e.childLanes)!==0,Nt||_){if(a=lt,a!==null){switch(w&-w){case 4:d=2;break;case 16:d=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:d=32;break;case 536870912:d=268435456;break;default:d=0}d=(d&(a.suspendedLanes|w))!==0?0:d,d!==0&&d!==p.retryLane&&(p.retryLane=d,Rn(e,d),sn(a,e,d,-1))}return Kc(),a=Sc(Error(i(421))),Qs(e,t,w,a)}return d.data==="$?"?(t.flags|=128,t.child=e.child,t=C0.bind(null,e),d._reactRetry=t,null):(e=p.treeContext,Ft=lr(d.nextSibling),zt=t,Ue=!0,tn=null,e!==null&&(Wt[Vt++]=_n,Wt[Vt++]=Nn,Wt[Vt++]=zr,_n=e.id,Nn=e.overflow,zr=t),t=Dc(t,a.children),t.flags|=4096,t)}function wh(e,t,o){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),ac(e.return,t,o)}function Tc(e,t,o,a,d){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:o,tailMode:d}:(p.isBackwards=t,p.rendering=null,p.renderingStartTime=0,p.last=a,p.tail=o,p.tailMode=d)}function bh(e,t,o){var a=t.pendingProps,d=a.revealOrder,p=a.tail;if(kt(e,t,a.children,o),a=We.current,(a&2)!==0)a=a&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&wh(e,o,t);else if(e.tag===19)wh(e,o,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}a&=1}if(Le(We,a),(t.mode&1)===0)t.memoizedState=null;else switch(d){case"forwards":for(o=t.child,d=null;o!==null;)e=o.alternate,e!==null&&Us(e)===null&&(d=o),o=o.sibling;o=d,o===null?(d=t.child,t.child=null):(d=o.sibling,o.sibling=null),Tc(t,!1,d,o,p);break;case"backwards":for(o=null,d=t.child,t.child=null;d!==null;){if(e=d.alternate,e!==null&&Us(e)===null){t.child=d;break}e=d.sibling,d.sibling=o,o=d,d=e}Tc(t,!0,o,null,p);break;case"together":Tc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ys(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Dn(e,t,o){if(e!==null&&(t.dependencies=e.dependencies),Wr|=t.lanes,(o&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,o=xr(e,e.pendingProps),t.child=o,o.return=t;e.sibling!==null;)e=e.sibling,o=o.sibling=xr(e,e.pendingProps),o.return=t;o.sibling=null}return t.child}function f0(e,t,o){switch(t.tag){case 3:vh(t),_o();break;case 5:Ap(t);break;case 1:_t(t.type)&&Ds(t);break;case 4:dc(t,t.stateNode.containerInfo);break;case 10:var a=t.type._context,d=t.memoizedProps.value;Le(Ls,a._currentValue),a._currentValue=d;break;case 13:if(a=t.memoizedState,a!==null)return a.dehydrated!==null?(Le(We,We.current&1),t.flags|=128,null):(o&t.child.childLanes)!==0?yh(e,t,o):(Le(We,We.current&1),e=Dn(e,t,o),e!==null?e.sibling:null);Le(We,We.current&1);break;case 19:if(a=(o&t.childLanes)!==0,(e.flags&128)!==0){if(a)return bh(e,t,o);t.flags|=128}if(d=t.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),Le(We,We.current),a)break;return null;case 22:case 23:return t.lanes=0,hh(e,t,o)}return Dn(e,t,o)}var kh,Oc,jh,Ch;kh=function(e,t){for(var o=t.child;o!==null;){if(o.tag===5||o.tag===6)e.appendChild(o.stateNode);else if(o.tag!==4&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break;for(;o.sibling===null;){if(o.return===null||o.return===t)return;o=o.return}o.sibling.return=o.return,o=o.sibling}},Oc=function(){},jh=function(e,t,o,a){var d=e.memoizedProps;if(d!==a){e=t.stateNode,Ur(fn.current);var p=null;switch(o){case"input":d=tt(e,d),a=tt(e,a),p=[];break;case"select":d=F({},d,{value:void 0}),a=F({},a,{value:void 0}),p=[];break;case"textarea":d=er(e,d),a=er(e,a),p=[];break;default:typeof d.onClick!="function"&&typeof a.onClick=="function"&&(e.onclick=Ns)}pa(o,a);var w;o=null;for(U in d)if(!a.hasOwnProperty(U)&&d.hasOwnProperty(U)&&d[U]!=null)if(U==="style"){var _=d[U];for(w in _)_.hasOwnProperty(w)&&(o||(o={}),o[w]="")}else U!=="dangerouslySetInnerHTML"&&U!=="children"&&U!=="suppressContentEditableWarning"&&U!=="suppressHydrationWarning"&&U!=="autoFocus"&&(c.hasOwnProperty(U)?p||(p=[]):(p=p||[]).push(U,null));for(U in a){var O=a[U];if(_=d!=null?d[U]:void 0,a.hasOwnProperty(U)&&O!==_&&(O!=null||_!=null))if(U==="style")if(_){for(w in _)!_.hasOwnProperty(w)||O&&O.hasOwnProperty(w)||(o||(o={}),o[w]="");for(w in O)O.hasOwnProperty(w)&&_[w]!==O[w]&&(o||(o={}),o[w]=O[w])}else o||(p||(p=[]),p.push(U,o)),o=O;else U==="dangerouslySetInnerHTML"?(O=O?O.__html:void 0,_=_?_.__html:void 0,O!=null&&_!==O&&(p=p||[]).push(U,O)):U==="children"?typeof O!="string"&&typeof O!="number"||(p=p||[]).push(U,""+O):U!=="suppressContentEditableWarning"&&U!=="suppressHydrationWarning"&&(c.hasOwnProperty(U)?(O!=null&&U==="onScroll"&&Fe("scroll",e),p||_===O||(p=[])):(p=p||[]).push(U,O))}o&&(p=p||[]).push("style",o);var U=p;(t.updateQueue=U)&&(t.flags|=4)}},Ch=function(e,t,o,a){o!==a&&(t.flags|=4)};function Mi(e,t){if(!Ue)switch(e.tailMode){case"hidden":t=e.tail;for(var o=null;t!==null;)t.alternate!==null&&(o=t),t=t.sibling;o===null?e.tail=null:o.sibling=null;break;case"collapsed":o=e.tail;for(var a=null;o!==null;)o.alternate!==null&&(a=o),o=o.sibling;a===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:a.sibling=null}}function xt(e){var t=e.alternate!==null&&e.alternate.child===e.child,o=0,a=0;if(t)for(var d=e.child;d!==null;)o|=d.lanes|d.childLanes,a|=d.subtreeFlags&14680064,a|=d.flags&14680064,d.return=e,d=d.sibling;else for(d=e.child;d!==null;)o|=d.lanes|d.childLanes,a|=d.subtreeFlags,a|=d.flags,d.return=e,d=d.sibling;return e.subtreeFlags|=a,e.childLanes=o,t}function p0(e,t,o){var a=t.pendingProps;switch(tc(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return xt(t),null;case 1:return _t(t.type)&&Ps(),xt(t),null;case 3:return a=t.stateNode,Do(),$e(Et),$e(gt),hc(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(As(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,tn!==null&&(Vc(tn),tn=null))),Oc(e,t),xt(t),null;case 5:fc(t);var d=Ur(Ri.current);if(o=t.type,e!==null&&t.stateNode!=null)jh(e,t,o,a,d),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!a){if(t.stateNode===null)throw Error(i(166));return xt(t),null}if(e=Ur(fn.current),As(t)){a=t.stateNode,o=t.type;var p=t.memoizedProps;switch(a[dn]=t,a[Ci]=p,e=(t.mode&1)!==0,o){case"dialog":Fe("cancel",a),Fe("close",a);break;case"iframe":case"object":case"embed":Fe("load",a);break;case"video":case"audio":for(d=0;d<\/script>",e=e.removeChild(e.firstChild)):typeof a.is=="string"?e=w.createElement(o,{is:a.is}):(e=w.createElement(o),o==="select"&&(w=e,a.multiple?w.multiple=!0:a.size&&(w.size=a.size))):e=w.createElementNS(e,o),e[dn]=t,e[Ci]=a,kh(e,t,!1,!1),t.stateNode=e;e:{switch(w=ha(o,a),o){case"dialog":Fe("cancel",e),Fe("close",e),d=a;break;case"iframe":case"object":case"embed":Fe("load",e),d=a;break;case"video":case"audio":for(d=0;dAo&&(t.flags|=128,a=!0,Mi(p,!1),t.lanes=4194304)}else{if(!a)if(e=Us(w),e!==null){if(t.flags|=128,a=!0,o=e.updateQueue,o!==null&&(t.updateQueue=o,t.flags|=4),Mi(p,!0),p.tail===null&&p.tailMode==="hidden"&&!w.alternate&&!Ue)return xt(t),null}else 2*Ye()-p.renderingStartTime>Ao&&o!==1073741824&&(t.flags|=128,a=!0,Mi(p,!1),t.lanes=4194304);p.isBackwards?(w.sibling=t.child,t.child=w):(o=p.last,o!==null?o.sibling=w:t.child=w,p.last=w)}return p.tail!==null?(t=p.tail,p.rendering=t,p.tail=t.sibling,p.renderingStartTime=Ye(),t.sibling=null,o=We.current,Le(We,a?o&1|2:o&1),t):(xt(t),null);case 22:case 23:return Gc(),a=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==a&&(t.flags|=8192),a&&(t.mode&1)!==0?($t&1073741824)!==0&&(xt(t),t.subtreeFlags&6&&(t.flags|=8192)):xt(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function h0(e,t){switch(tc(t),t.tag){case 1:return _t(t.type)&&Ps(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Do(),$e(Et),$e(gt),hc(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return fc(t),null;case 13:if($e(We),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));_o()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return $e(We),null;case 4:return Do(),null;case 10:return lc(t.type._context),null;case 22:case 23:return Gc(),null;case 24:return null;default:return null}}var qs=!1,yt=!1,m0=typeof WeakSet=="function"?WeakSet:Set,le=null;function Oo(e,t){var o=e.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(a){Ke(e,t,a)}else o.current=null}function Mc(e,t,o){try{o()}catch(a){Ke(e,t,a)}}var Sh=!1;function g0(e,t){if(Ga=gs,e=rp(),za(e)){if("selectionStart"in e)var o={start:e.selectionStart,end:e.selectionEnd};else e:{o=(o=e.ownerDocument)&&o.defaultView||window;var a=o.getSelection&&o.getSelection();if(a&&a.rangeCount!==0){o=a.anchorNode;var d=a.anchorOffset,p=a.focusNode;a=a.focusOffset;try{o.nodeType,p.nodeType}catch{o=null;break e}var w=0,_=-1,O=-1,U=0,G=0,K=e,H=null;t:for(;;){for(var oe;K!==o||d!==0&&K.nodeType!==3||(_=w+d),K!==p||a!==0&&K.nodeType!==3||(O=w+a),K.nodeType===3&&(w+=K.nodeValue.length),(oe=K.firstChild)!==null;)H=K,K=oe;for(;;){if(K===e)break t;if(H===o&&++U===d&&(_=w),H===p&&++G===a&&(O=w),(oe=K.nextSibling)!==null)break;K=H,H=K.parentNode}K=oe}o=_===-1||O===-1?null:{start:_,end:O}}else o=null}o=o||{start:0,end:0}}else o=null;for(Ka={focusedElem:e,selectionRange:o},gs=!1,le=t;le!==null;)if(t=le,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,le=e;else for(;le!==null;){t=le;try{var ce=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(ce!==null){var ue=ce.memoizedProps,qe=ce.memoizedState,z=t.stateNode,A=z.getSnapshotBeforeUpdate(t.elementType===t.type?ue:nn(t.type,ue),qe);z.__reactInternalSnapshotBeforeUpdate=A}break;case 3:var $=t.stateNode.containerInfo;$.nodeType===1?$.textContent="":$.nodeType===9&&$.documentElement&&$.removeChild($.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(X){Ke(t,t.return,X)}if(e=t.sibling,e!==null){e.return=t.return,le=e;break}le=t.return}return ce=Sh,Sh=!1,ce}function Ai(e,t,o){var a=t.updateQueue;if(a=a!==null?a.lastEffect:null,a!==null){var d=a=a.next;do{if((d.tag&e)===e){var p=d.destroy;d.destroy=void 0,p!==void 0&&Mc(t,o,p)}d=d.next}while(d!==a)}}function Xs(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var o=t=t.next;do{if((o.tag&e)===e){var a=o.create;o.destroy=a()}o=o.next}while(o!==t)}}function Ac(e){var t=e.ref;if(t!==null){var o=e.stateNode;switch(e.tag){case 5:e=o;break;default:e=o}typeof t=="function"?t(e):t.current=e}}function Eh(e){var t=e.alternate;t!==null&&(e.alternate=null,Eh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[dn],delete t[Ci],delete t[Xa],delete t[Jw],delete t[Zw])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function _h(e){return e.tag===5||e.tag===3||e.tag===4}function Nh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||_h(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.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 Ic(e,t,o){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?o.nodeType===8?o.parentNode.insertBefore(e,t):o.insertBefore(e,t):(o.nodeType===8?(t=o.parentNode,t.insertBefore(e,o)):(t=o,t.appendChild(e)),o=o._reactRootContainer,o!=null||t.onclick!==null||(t.onclick=Ns));else if(a!==4&&(e=e.child,e!==null))for(Ic(e,t,o),e=e.sibling;e!==null;)Ic(e,t,o),e=e.sibling}function Lc(e,t,o){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?o.insertBefore(e,t):o.appendChild(e);else if(a!==4&&(e=e.child,e!==null))for(Lc(e,t,o),e=e.sibling;e!==null;)Lc(e,t,o),e=e.sibling}var ft=null,rn=!1;function pr(e,t,o){for(o=o.child;o!==null;)Rh(e,t,o),o=o.sibling}function Rh(e,t,o){if(un&&typeof un.onCommitFiberUnmount=="function")try{un.onCommitFiberUnmount(us,o)}catch{}switch(o.tag){case 5:yt||Oo(o,t);case 6:var a=ft,d=rn;ft=null,pr(e,t,o),ft=a,rn=d,ft!==null&&(rn?(e=ft,o=o.stateNode,e.nodeType===8?e.parentNode.removeChild(o):e.removeChild(o)):ft.removeChild(o.stateNode));break;case 18:ft!==null&&(rn?(e=ft,o=o.stateNode,e.nodeType===8?qa(e.parentNode,o):e.nodeType===1&&qa(e,o),pi(e)):qa(ft,o.stateNode));break;case 4:a=ft,d=rn,ft=o.stateNode.containerInfo,rn=!0,pr(e,t,o),ft=a,rn=d;break;case 0:case 11:case 14:case 15:if(!yt&&(a=o.updateQueue,a!==null&&(a=a.lastEffect,a!==null))){d=a=a.next;do{var p=d,w=p.destroy;p=p.tag,w!==void 0&&((p&2)!==0||(p&4)!==0)&&Mc(o,t,w),d=d.next}while(d!==a)}pr(e,t,o);break;case 1:if(!yt&&(Oo(o,t),a=o.stateNode,typeof a.componentWillUnmount=="function"))try{a.props=o.memoizedProps,a.state=o.memoizedState,a.componentWillUnmount()}catch(_){Ke(o,t,_)}pr(e,t,o);break;case 21:pr(e,t,o);break;case 22:o.mode&1?(yt=(a=yt)||o.memoizedState!==null,pr(e,t,o),yt=a):pr(e,t,o);break;default:pr(e,t,o)}}function Ph(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var o=e.stateNode;o===null&&(o=e.stateNode=new m0),t.forEach(function(a){var d=S0.bind(null,e,a);o.has(a)||(o.add(a),a.then(d,d))})}}function on(e,t){var o=t.deletions;if(o!==null)for(var a=0;ad&&(d=w),a&=~p}if(a=d,a=Ye()-a,a=(120>a?120:480>a?480:1080>a?1080:1920>a?1920:3e3>a?3e3:4320>a?4320:1960*x0(a/1960))-a,10e?16:e,mr===null)var a=!1;else{if(e=mr,mr=null,nl=0,(Re&6)!==0)throw Error(i(331));var d=Re;for(Re|=4,le=e.current;le!==null;){var p=le,w=p.child;if((le.flags&16)!==0){var _=p.deletions;if(_!==null){for(var O=0;O<_.length;O++){var U=_[O];for(le=U;le!==null;){var G=le;switch(G.tag){case 0:case 11:case 15:Ai(8,G,p)}var K=G.child;if(K!==null)K.return=G,le=K;else for(;le!==null;){G=le;var H=G.sibling,oe=G.return;if(Eh(G),G===U){le=null;break}if(H!==null){H.return=oe,le=H;break}le=oe}}}var ce=p.alternate;if(ce!==null){var ue=ce.child;if(ue!==null){ce.child=null;do{var qe=ue.sibling;ue.sibling=null,ue=qe}while(ue!==null)}}le=p}}if((p.subtreeFlags&2064)!==0&&w!==null)w.return=p,le=w;else e:for(;le!==null;){if(p=le,(p.flags&2048)!==0)switch(p.tag){case 0:case 11:case 15:Ai(9,p,p.return)}var z=p.sibling;if(z!==null){z.return=p.return,le=z;break e}le=p.return}}var A=e.current;for(le=A;le!==null;){w=le;var $=w.child;if((w.subtreeFlags&2064)!==0&&$!==null)$.return=w,le=$;else e:for(w=A;le!==null;){if(_=le,(_.flags&2048)!==0)try{switch(_.tag){case 0:case 11:case 15:Xs(9,_)}}catch(fe){Ke(_,_.return,fe)}if(_===w){le=null;break e}var X=_.sibling;if(X!==null){X.return=_.return,le=X;break e}le=_.return}}if(Re=d,ur(),un&&typeof un.onPostCommitFiberRoot=="function")try{un.onPostCommitFiberRoot(us,e)}catch{}a=!0}return a}finally{Ae=o,Kt.transition=t}}return!1}function Bh(e,t,o){t=To(o,t),t=sh(e,t,1),e=fr(e,t,1),t=jt(),e!==null&&(ai(e,1,t),Pt(e,t))}function Ke(e,t,o){if(e.tag===3)Bh(e,e,o);else for(;t!==null;){if(t.tag===3){Bh(t,e,o);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(hr===null||!hr.has(a))){e=To(o,e),e=lh(t,e,1),t=fr(t,e,1),e=jt(),t!==null&&(ai(t,1,e),Pt(t,e));break}}t=t.return}}function j0(e,t,o){var a=e.pingCache;a!==null&&a.delete(t),t=jt(),e.pingedLanes|=e.suspendedLanes&o,lt===e&&(pt&o)===o&&(rt===4||rt===3&&(pt&130023424)===pt&&500>Ye()-$c?Hr(e,0):Fc|=o),Pt(e,t)}function Wh(e,t){t===0&&((e.mode&1)===0?t=1:(t=fs,fs<<=1,(fs&130023424)===0&&(fs=4194304)));var o=jt();e=Rn(e,t),e!==null&&(ai(e,t,o),Pt(e,o))}function C0(e){var t=e.memoizedState,o=0;t!==null&&(o=t.retryLane),Wh(e,o)}function S0(e,t){var o=0;switch(e.tag){case 13:var a=e.stateNode,d=e.memoizedState;d!==null&&(o=d.retryLane);break;case 19:a=e.stateNode;break;default:throw Error(i(314))}a!==null&&a.delete(t),Wh(e,o)}var Vh;Vh=function(e,t,o){if(e!==null)if(e.memoizedProps!==t.pendingProps||Et.current)Nt=!0;else{if((e.lanes&o)===0&&(t.flags&128)===0)return Nt=!1,f0(e,t,o);Nt=(e.flags&131072)!==0}else Nt=!1,Ue&&(t.flags&1048576)!==0&&jp(t,Ms,t.index);switch(t.lanes=0,t.tag){case 2:var a=t.type;Ys(e,t),e=t.pendingProps;var d=Co(t,gt.current);Po(t,o),d=vc(null,t,a,e,d,o);var p=xc();return t.flags|=1,typeof d=="object"&&d!==null&&typeof d.render=="function"&&d.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,_t(a)?(p=!0,Ds(t)):p=!1,t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,uc(t),d.updater=Ks,t.stateNode=d,d._reactInternals=t,Cc(t,a,e,o),t=Nc(null,t,a,!0,p,o)):(t.tag=0,Ue&&p&&ec(t),kt(null,t,d,o),t=t.child),t;case 16:a=t.elementType;e:{switch(Ys(e,t),e=t.pendingProps,d=a._init,a=d(a._payload),t.type=a,d=t.tag=_0(a),e=nn(a,e),d){case 0:t=_c(null,t,a,e,o);break e;case 1:t=gh(null,t,a,e,o);break e;case 11:t=dh(null,t,a,e,o);break e;case 14:t=fh(null,t,a,nn(a.type,e),o);break e}throw Error(i(306,a,""))}return t;case 0:return a=t.type,d=t.pendingProps,d=t.elementType===a?d:nn(a,d),_c(e,t,a,d,o);case 1:return a=t.type,d=t.pendingProps,d=t.elementType===a?d:nn(a,d),gh(e,t,a,d,o);case 3:e:{if(vh(t),e===null)throw Error(i(387));a=t.pendingProps,p=t.memoizedState,d=p.element,Tp(e,t),$s(t,a,null,o);var w=t.memoizedState;if(a=w.element,p.isDehydrated)if(p={element:a,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},t.updateQueue.baseState=p,t.memoizedState=p,t.flags&256){d=To(Error(i(423)),t),t=xh(e,t,a,o,d);break e}else if(a!==d){d=To(Error(i(424)),t),t=xh(e,t,a,o,d);break e}else for(Ft=lr(t.stateNode.containerInfo.firstChild),zt=t,Ue=!0,tn=null,o=Pp(t,null,a,o),t.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(_o(),a===d){t=Dn(e,t,o);break e}kt(e,t,a,o)}t=t.child}return t;case 5:return Ap(t),e===null&&rc(t),a=t.type,d=t.pendingProps,p=e!==null?e.memoizedProps:null,w=d.children,Qa(a,d)?w=null:p!==null&&Qa(a,p)&&(t.flags|=32),mh(e,t),kt(e,t,w,o),t.child;case 6:return e===null&&rc(t),null;case 13:return yh(e,t,o);case 4:return dc(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=No(t,null,a,o):kt(e,t,a,o),t.child;case 11:return a=t.type,d=t.pendingProps,d=t.elementType===a?d:nn(a,d),dh(e,t,a,d,o);case 7:return kt(e,t,t.pendingProps,o),t.child;case 8:return kt(e,t,t.pendingProps.children,o),t.child;case 12:return kt(e,t,t.pendingProps.children,o),t.child;case 10:e:{if(a=t.type._context,d=t.pendingProps,p=t.memoizedProps,w=d.value,Le(Ls,a._currentValue),a._currentValue=w,p!==null)if(en(p.value,w)){if(p.children===d.children&&!Et.current){t=Dn(e,t,o);break e}}else for(p=t.child,p!==null&&(p.return=t);p!==null;){var _=p.dependencies;if(_!==null){w=p.child;for(var O=_.firstContext;O!==null;){if(O.context===a){if(p.tag===1){O=Pn(-1,o&-o),O.tag=2;var U=p.updateQueue;if(U!==null){U=U.shared;var G=U.pending;G===null?O.next=O:(O.next=G.next,G.next=O),U.pending=O}}p.lanes|=o,O=p.alternate,O!==null&&(O.lanes|=o),ac(p.return,o,t),_.lanes|=o;break}O=O.next}}else if(p.tag===10)w=p.type===t.type?null:p.child;else if(p.tag===18){if(w=p.return,w===null)throw Error(i(341));w.lanes|=o,_=w.alternate,_!==null&&(_.lanes|=o),ac(w,o,t),w=p.sibling}else w=p.child;if(w!==null)w.return=p;else for(w=p;w!==null;){if(w===t){w=null;break}if(p=w.sibling,p!==null){p.return=w.return,w=p;break}w=w.return}p=w}kt(e,t,d.children,o),t=t.child}return t;case 9:return d=t.type,a=t.pendingProps.children,Po(t,o),d=Ht(d),a=a(d),t.flags|=1,kt(e,t,a,o),t.child;case 14:return a=t.type,d=nn(a,t.pendingProps),d=nn(a.type,d),fh(e,t,a,d,o);case 15:return ph(e,t,t.type,t.pendingProps,o);case 17:return a=t.type,d=t.pendingProps,d=t.elementType===a?d:nn(a,d),Ys(e,t),t.tag=1,_t(a)?(e=!0,Ds(t)):e=!1,Po(t,o),oh(t,a,d),Cc(t,a,d,o),Nc(null,t,a,!0,e,o);case 19:return bh(e,t,o);case 22:return hh(e,t,o)}throw Error(i(156,t.tag))};function Hh(e,t){return Cf(e,t)}function E0(e,t,o,a){this.tag=e,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qt(e,t,o,a){return new E0(e,t,o,a)}function Qc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _0(e){if(typeof e=="function")return Qc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ne)return 11;if(e===ie)return 14}return 2}function xr(e,t){var o=e.alternate;return o===null?(o=Qt(e.tag,t,e.key,e.mode),o.elementType=e.elementType,o.type=e.type,o.stateNode=e.stateNode,o.alternate=e,e.alternate=o):(o.pendingProps=t,o.type=e.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=e.flags&14680064,o.childLanes=e.childLanes,o.lanes=e.lanes,o.child=e.child,o.memoizedProps=e.memoizedProps,o.memoizedState=e.memoizedState,o.updateQueue=e.updateQueue,t=e.dependencies,o.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},o.sibling=e.sibling,o.index=e.index,o.ref=e.ref,o}function sl(e,t,o,a,d,p){var w=2;if(a=e,typeof e=="function")Qc(e)&&(w=1);else if(typeof e=="string")w=5;else e:switch(e){case I:return Kr(o.children,d,p,t);case L:w=8,d|=8;break;case Q:return e=Qt(12,o,t,d|2),e.elementType=Q,e.lanes=p,e;case de:return e=Qt(13,o,t,d),e.elementType=de,e.lanes=p,e;case re:return e=Qt(19,o,t,d),e.elementType=re,e.lanes=p,e;case Z:return ll(o,d,p,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ee:w=10;break e;case J:w=9;break e;case ne:w=11;break e;case ie:w=14;break e;case B:w=16,a=null;break e}throw Error(i(130,e==null?e:typeof e,""))}return t=Qt(w,o,t,d),t.elementType=e,t.type=a,t.lanes=p,t}function Kr(e,t,o,a){return e=Qt(7,e,a,t),e.lanes=o,e}function ll(e,t,o,a){return e=Qt(22,e,a,t),e.elementType=Z,e.lanes=o,e.stateNode={isHidden:!1},e}function Yc(e,t,o){return e=Qt(6,e,null,t),e.lanes=o,e}function qc(e,t,o){return t=Qt(4,e.children!==null?e.children:[],e.key,t),t.lanes=o,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function N0(e,t,o,a,d){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ja(0),this.expirationTimes=ja(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ja(0),this.identifierPrefix=a,this.onRecoverableError=d,this.mutableSourceEagerHydrationData=null}function Xc(e,t,o,a,d,p,w,_,O){return e=new N0(e,t,o,_,O),t===1?(t=1,p===!0&&(t|=8)):t=0,p=Qt(3,null,null,t),e.current=p,p.stateNode=e,p.memoizedState={element:a,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},uc(p),e}function R0(e,t,o){var a=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}return n(),ou.exports=W0(),ou.exports}var am;function V0(){if(am)return hl;am=1;var n=ug();return hl.createRoot=n.createRoot,hl.hydrateRoot=n.hydrateRoot,hl}var H0=V0(),ed=ug();/** * @remix-run/router v1.23.0 * * Copyright (c) Remix Software Inc. @@ -46,7 +46,7 @@ Error generating stack: `+p.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Wi(){return Wi=Object.assign?Object.assign.bind():function(n){for(var r=1;r"u")throw new Error(r)}function dg(n,r){if(!n){typeof console<"u"&&console.warn(r);try{throw new Error(r)}catch{}}}function K0(){return Math.random().toString(36).substr(2,8)}function um(n,r){return{usr:n.state,key:n.key,idx:r}}function ju(n,r,i,s){return i===void 0&&(i=null),Wi({pathname:typeof n=="string"?n:n.pathname,search:"",hash:""},typeof r=="string"?Ko(r):r,{state:i,key:r&&r.key||s||K0()})}function Ol(n){let{pathname:r="/",search:i="",hash:s=""}=n;return i&&i!=="?"&&(r+=i.charAt(0)==="?"?i:"?"+i),s&&s!=="#"&&(r+=s.charAt(0)==="#"?s:"#"+s),r}function Ko(n){let r={};if(n){let i=n.indexOf("#");i>=0&&(r.hash=n.substr(i),n=n.substr(0,i));let s=n.indexOf("?");s>=0&&(r.search=n.substr(s),n=n.substr(0,s)),n&&(r.pathname=n)}return r}function Q0(n,r,i,s){s===void 0&&(s={});let{window:c=document.defaultView,v5Compat:u=!1}=s,f=c.history,h=Cr.Pop,v=null,g=y();g==null&&(g=0,f.replaceState(Wi({},f.state,{idx:g}),""));function y(){return(f.state||{idx:null}).idx}function x(){h=Cr.Pop;let j=y(),E=j==null?null:j-g;g=j,v&&v({action:h,location:S.location,delta:E})}function b(j,E){h=Cr.Push;let D=ju(S.location,j,E);g=y()+1;let T=um(D,g),P=S.createHref(D);try{f.pushState(T,"",P)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;c.location.assign(P)}u&&v&&v({action:h,location:S.location,delta:1})}function C(j,E){h=Cr.Replace;let D=ju(S.location,j,E);g=y();let T=um(D,g),P=S.createHref(D);f.replaceState(T,"",P),u&&v&&v({action:h,location:S.location,delta:0})}function k(j){let E=c.location.origin!=="null"?c.location.origin:c.location.href,D=typeof j=="string"?j:Ol(j);return D=D.replace(/ $/,"%20"),Ge(E,"No window.location.(origin|href) available to create URL for href: "+D),new URL(D,E)}let S={get action(){return h},get location(){return n(c,f)},listen(j){if(v)throw new Error("A history only accepts one active listener");return c.addEventListener(cm,x),v=j,()=>{c.removeEventListener(cm,x),v=null}},createHref(j){return r(c,j)},createURL:k,encodeLocation(j){let E=k(j);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:b,replace:C,go(j){return f.go(j)}};return S}var dm;(function(n){n.data="data",n.deferred="deferred",n.redirect="redirect",n.error="error"})(dm||(dm={}));function Y0(n,r,i){return i===void 0&&(i="/"),q0(n,r,i)}function q0(n,r,i,s){let c=typeof r=="string"?Ko(r):r,u=Vo(c.pathname||"/",i);if(u==null)return null;let f=fg(n);X0(f);let h=null;for(let v=0;h==null&&v{let v={relativePath:h===void 0?u.path||"":h,caseSensitive:u.caseSensitive===!0,childrenIndex:f,route:u};v.relativePath.startsWith("/")&&(Ge(v.relativePath.startsWith(s),'Absolute route path "'+v.relativePath+'" nested under path '+('"'+s+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),v.relativePath=v.relativePath.slice(s.length));let g=jr([s,v.relativePath]),y=i.concat(v);u.children&&u.children.length>0&&(Ge(u.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+g+'".')),fg(u.children,r,y,g)),!(u.path==null&&!u.index)&&r.push({path:g,score:ob(g,u.index),routesMeta:y})};return n.forEach((u,f)=>{var h;if(u.path===""||!((h=u.path)!=null&&h.includes("?")))c(u,f);else for(let v of pg(u.path))c(u,f,v)}),r}function pg(n){let r=n.split("/");if(r.length===0)return[];let[i,...s]=r,c=i.endsWith("?"),u=i.replace(/\?$/,"");if(s.length===0)return c?[u,""]:[u];let f=pg(s.join("/")),h=[];return h.push(...f.map(v=>v===""?u:[u,v].join("/"))),c&&h.push(...f),h.map(v=>n.startsWith("/")&&v===""?"/":v)}function X0(n){n.sort((r,i)=>r.score!==i.score?i.score-r.score:ib(r.routesMeta.map(s=>s.childrenIndex),i.routesMeta.map(s=>s.childrenIndex)))}const J0=/^:[\w-]+$/,Z0=3,eb=2,tb=1,nb=10,rb=-2,fm=n=>n==="*";function ob(n,r){let i=n.split("/"),s=i.length;return i.some(fm)&&(s+=rb),r&&(s+=eb),i.filter(c=>!fm(c)).reduce((c,u)=>c+(J0.test(u)?Z0:u===""?tb:nb),s)}function ib(n,r){return n.length===r.length&&n.slice(0,-1).every((s,c)=>s===r[c])?n[n.length-1]-r[r.length-1]:0}function sb(n,r,i){let{routesMeta:s}=n,c={},u="/",f=[];for(let h=0;h{let{paramName:b,isOptional:C}=y;if(b==="*"){let S=h[x]||"";f=u.slice(0,u.length-S.length).replace(/(.)\/+$/,"$1")}const k=h[x];return C&&!k?g[b]=void 0:g[b]=(k||"").replace(/%2F/g,"/"),g},{}),pathname:u,pathnameBase:f,pattern:n}}function lb(n,r,i){r===void 0&&(r=!1),i===void 0&&(i=!0),dg(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 s=[],c="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(f,h,v)=>(s.push({paramName:h,isOptional:v!=null}),v?"/?([^\\/]+)?":"/([^\\/]+)"));return n.endsWith("*")?(s.push({paramName:"*"}),c+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?c+="\\/*$":n!==""&&n!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,r?void 0:"i"),s]}function ab(n){try{return n.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return dg(!1,'The URL path "'+n+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+r+").")),n}}function Vo(n,r){if(r==="/")return n;if(!n.toLowerCase().startsWith(r.toLowerCase()))return null;let i=r.endsWith("/")?r.length-1:r.length,s=n.charAt(i);return s&&s!=="/"?null:n.slice(i)||"/"}function cb(n,r){r===void 0&&(r="/");let{pathname:i,search:s="",hash:c=""}=typeof n=="string"?Ko(n):n;return{pathname:i?i.startsWith("/")?i:ub(i,r):r,search:pb(s),hash:hb(c)}}function ub(n,r){let i=r.replace(/\/+$/,"").split("/");return n.split("/").forEach(c=>{c===".."?i.length>1&&i.pop():c!=="."&&i.push(c)}),i.length>1?i.join("/"):"/"}function lu(n,r,i,s){return"Cannot include a '"+n+"' character in a manually specified "+("`to."+r+"` field ["+JSON.stringify(s)+"]. Please separate it out to the ")+("`to."+i+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function db(n){return n.filter((r,i)=>i===0||r.route.path&&r.route.path.length>0)}function td(n,r){let i=db(n);return r?i.map((s,c)=>c===i.length-1?s.pathname:s.pathnameBase):i.map(s=>s.pathnameBase)}function nd(n,r,i,s){s===void 0&&(s=!1);let c;typeof n=="string"?c=Ko(n):(c=Wi({},n),Ge(!c.pathname||!c.pathname.includes("?"),lu("?","pathname","search",c)),Ge(!c.pathname||!c.pathname.includes("#"),lu("#","pathname","hash",c)),Ge(!c.search||!c.search.includes("#"),lu("#","search","hash",c)));let u=n===""||c.pathname==="",f=u?"/":c.pathname,h;if(f==null)h=i;else{let x=r.length-1;if(!s&&f.startsWith("..")){let b=f.split("/");for(;b[0]==="..";)b.shift(),x-=1;c.pathname=b.join("/")}h=x>=0?r[x]:"/"}let v=cb(c,h),g=f&&f!=="/"&&f.endsWith("/"),y=(u||f===".")&&i.endsWith("/");return!v.pathname.endsWith("/")&&(g||y)&&(v.pathname+="/"),v}const jr=n=>n.join("/").replace(/\/\/+/g,"/"),fb=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),pb=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,hb=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n;function mb(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}const hg=["post","put","patch","delete"];new Set(hg);const gb=["get",...hg];new Set(gb);/** + */function Wi(){return Wi=Object.assign?Object.assign.bind():function(n){for(var r=1;r"u")throw new Error(r)}function dg(n,r){if(!n){typeof console<"u"&&console.warn(r);try{throw new Error(r)}catch{}}}function K0(){return Math.random().toString(36).substr(2,8)}function um(n,r){return{usr:n.state,key:n.key,idx:r}}function Cu(n,r,i,l){return i===void 0&&(i=null),Wi({pathname:typeof n=="string"?n:n.pathname,search:"",hash:""},typeof r=="string"?Ko(r):r,{state:i,key:r&&r.key||l||K0()})}function Ol(n){let{pathname:r="/",search:i="",hash:l=""}=n;return i&&i!=="?"&&(r+=i.charAt(0)==="?"?i:"?"+i),l&&l!=="#"&&(r+=l.charAt(0)==="#"?l:"#"+l),r}function Ko(n){let r={};if(n){let i=n.indexOf("#");i>=0&&(r.hash=n.substr(i),n=n.substr(0,i));let l=n.indexOf("?");l>=0&&(r.search=n.substr(l),n=n.substr(0,l)),n&&(r.pathname=n)}return r}function Q0(n,r,i,l){l===void 0&&(l={});let{window:c=document.defaultView,v5Compat:u=!1}=l,f=c.history,h=jr.Pop,v=null,g=y();g==null&&(g=0,f.replaceState(Wi({},f.state,{idx:g}),""));function y(){return(f.state||{idx:null}).idx}function x(){h=jr.Pop;let C=y(),E=C==null?null:C-g;g=C,v&&v({action:h,location:S.location,delta:E})}function b(C,E){h=jr.Push;let D=Cu(S.location,C,E);g=y()+1;let T=um(D,g),P=S.createHref(D);try{f.pushState(T,"",P)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;c.location.assign(P)}u&&v&&v({action:h,location:S.location,delta:1})}function j(C,E){h=jr.Replace;let D=Cu(S.location,C,E);g=y();let T=um(D,g),P=S.createHref(D);f.replaceState(T,"",P),u&&v&&v({action:h,location:S.location,delta:0})}function k(C){let E=c.location.origin!=="null"?c.location.origin:c.location.href,D=typeof C=="string"?C:Ol(C);return D=D.replace(/ $/,"%20"),Ge(E,"No window.location.(origin|href) available to create URL for href: "+D),new URL(D,E)}let S={get action(){return h},get location(){return n(c,f)},listen(C){if(v)throw new Error("A history only accepts one active listener");return c.addEventListener(cm,x),v=C,()=>{c.removeEventListener(cm,x),v=null}},createHref(C){return r(c,C)},createURL:k,encodeLocation(C){let E=k(C);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:b,replace:j,go(C){return f.go(C)}};return S}var dm;(function(n){n.data="data",n.deferred="deferred",n.redirect="redirect",n.error="error"})(dm||(dm={}));function Y0(n,r,i){return i===void 0&&(i="/"),q0(n,r,i)}function q0(n,r,i,l){let c=typeof r=="string"?Ko(r):r,u=Vo(c.pathname||"/",i);if(u==null)return null;let f=fg(n);X0(f);let h=null;for(let v=0;h==null&&v{let v={relativePath:h===void 0?u.path||"":h,caseSensitive:u.caseSensitive===!0,childrenIndex:f,route:u};v.relativePath.startsWith("/")&&(Ge(v.relativePath.startsWith(l),'Absolute route path "'+v.relativePath+'" nested under path '+('"'+l+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),v.relativePath=v.relativePath.slice(l.length));let g=Cr([l,v.relativePath]),y=i.concat(v);u.children&&u.children.length>0&&(Ge(u.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+g+'".')),fg(u.children,r,y,g)),!(u.path==null&&!u.index)&&r.push({path:g,score:ob(g,u.index),routesMeta:y})};return n.forEach((u,f)=>{var h;if(u.path===""||!((h=u.path)!=null&&h.includes("?")))c(u,f);else for(let v of pg(u.path))c(u,f,v)}),r}function pg(n){let r=n.split("/");if(r.length===0)return[];let[i,...l]=r,c=i.endsWith("?"),u=i.replace(/\?$/,"");if(l.length===0)return c?[u,""]:[u];let f=pg(l.join("/")),h=[];return h.push(...f.map(v=>v===""?u:[u,v].join("/"))),c&&h.push(...f),h.map(v=>n.startsWith("/")&&v===""?"/":v)}function X0(n){n.sort((r,i)=>r.score!==i.score?i.score-r.score:ib(r.routesMeta.map(l=>l.childrenIndex),i.routesMeta.map(l=>l.childrenIndex)))}const J0=/^:[\w-]+$/,Z0=3,eb=2,tb=1,nb=10,rb=-2,fm=n=>n==="*";function ob(n,r){let i=n.split("/"),l=i.length;return i.some(fm)&&(l+=rb),r&&(l+=eb),i.filter(c=>!fm(c)).reduce((c,u)=>c+(J0.test(u)?Z0:u===""?tb:nb),l)}function ib(n,r){return n.length===r.length&&n.slice(0,-1).every((l,c)=>l===r[c])?n[n.length-1]-r[r.length-1]:0}function sb(n,r,i){let{routesMeta:l}=n,c={},u="/",f=[];for(let h=0;h{let{paramName:b,isOptional:j}=y;if(b==="*"){let S=h[x]||"";f=u.slice(0,u.length-S.length).replace(/(.)\/+$/,"$1")}const k=h[x];return j&&!k?g[b]=void 0:g[b]=(k||"").replace(/%2F/g,"/"),g},{}),pathname:u,pathnameBase:f,pattern:n}}function lb(n,r,i){r===void 0&&(r=!1),i===void 0&&(i=!0),dg(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 l=[],c="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(f,h,v)=>(l.push({paramName:h,isOptional:v!=null}),v?"/?([^\\/]+)?":"/([^\\/]+)"));return n.endsWith("*")?(l.push({paramName:"*"}),c+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?c+="\\/*$":n!==""&&n!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,r?void 0:"i"),l]}function ab(n){try{return n.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return dg(!1,'The URL path "'+n+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+r+").")),n}}function Vo(n,r){if(r==="/")return n;if(!n.toLowerCase().startsWith(r.toLowerCase()))return null;let i=r.endsWith("/")?r.length-1:r.length,l=n.charAt(i);return l&&l!=="/"?null:n.slice(i)||"/"}function cb(n,r){r===void 0&&(r="/");let{pathname:i,search:l="",hash:c=""}=typeof n=="string"?Ko(n):n;return{pathname:i?i.startsWith("/")?i:ub(i,r):r,search:pb(l),hash:hb(c)}}function ub(n,r){let i=r.replace(/\/+$/,"").split("/");return n.split("/").forEach(c=>{c===".."?i.length>1&&i.pop():c!=="."&&i.push(c)}),i.length>1?i.join("/"):"/"}function lu(n,r,i,l){return"Cannot include a '"+n+"' character in a manually specified "+("`to."+r+"` field ["+JSON.stringify(l)+"]. Please separate it out to the ")+("`to."+i+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function db(n){return n.filter((r,i)=>i===0||r.route.path&&r.route.path.length>0)}function td(n,r){let i=db(n);return r?i.map((l,c)=>c===i.length-1?l.pathname:l.pathnameBase):i.map(l=>l.pathnameBase)}function nd(n,r,i,l){l===void 0&&(l=!1);let c;typeof n=="string"?c=Ko(n):(c=Wi({},n),Ge(!c.pathname||!c.pathname.includes("?"),lu("?","pathname","search",c)),Ge(!c.pathname||!c.pathname.includes("#"),lu("#","pathname","hash",c)),Ge(!c.search||!c.search.includes("#"),lu("#","search","hash",c)));let u=n===""||c.pathname==="",f=u?"/":c.pathname,h;if(f==null)h=i;else{let x=r.length-1;if(!l&&f.startsWith("..")){let b=f.split("/");for(;b[0]==="..";)b.shift(),x-=1;c.pathname=b.join("/")}h=x>=0?r[x]:"/"}let v=cb(c,h),g=f&&f!=="/"&&f.endsWith("/"),y=(u||f===".")&&i.endsWith("/");return!v.pathname.endsWith("/")&&(g||y)&&(v.pathname+="/"),v}const Cr=n=>n.join("/").replace(/\/\/+/g,"/"),fb=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),pb=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,hb=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n;function mb(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}const hg=["post","put","patch","delete"];new Set(hg);const gb=["get",...hg];new Set(gb);/** * React Router v6.30.1 * * Copyright (c) Remix Software Inc. @@ -55,7 +55,7 @@ Error generating stack: `+p.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Vi(){return Vi=Object.assign?Object.assign.bind():function(n){for(var r=1;r{h.current=!0}),m.useCallback(function(g,y){if(y===void 0&&(y={}),!h.current)return;if(typeof g=="number"){s.go(g);return}let x=nd(g,JSON.parse(f),u,y.relative==="path");n==null&&r!=="/"&&(x.pathname=x.pathname==="/"?r:jr([r,x.pathname])),(y.replace?s.replace:s.push)(x,y.state,y)},[r,s,f,u,n])}function Kl(n,r){let{relative:i}=r===void 0?{}:r,{future:s}=m.useContext(Hn),{matches:c}=m.useContext(Pr),{pathname:u}=Dr(),f=JSON.stringify(td(c,s.v7_relativeSplatPath));return m.useMemo(()=>nd(n,JSON.parse(f),u,i==="path"),[n,f,u,i])}function yb(n,r){return wb(n,r)}function wb(n,r,i,s){Qo()||Ge(!1);let{navigator:c}=m.useContext(Hn),{matches:u}=m.useContext(Pr),f=u[u.length-1],h=f?f.params:{};f&&f.pathname;let v=f?f.pathnameBase:"/";f&&f.route;let g=Dr(),y;if(r){var x;let j=typeof r=="string"?Ko(r):r;v==="/"||(x=j.pathname)!=null&&x.startsWith(v)||Ge(!1),y=j}else y=g;let b=y.pathname||"/",C=b;if(v!=="/"){let j=v.replace(/^\//,"").split("/");C="/"+b.replace(/^\//,"").split("/").slice(j.length).join("/")}let k=Y0(n,{pathname:C}),S=Sb(k&&k.map(j=>Object.assign({},j,{params:Object.assign({},h,j.params),pathname:jr([v,c.encodeLocation?c.encodeLocation(j.pathname).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?v:jr([v,c.encodeLocation?c.encodeLocation(j.pathnameBase).pathname:j.pathnameBase])})),u,i,s);return r&&S?m.createElement(Gl.Provider,{value:{location:Vi({pathname:"/",search:"",hash:"",state:null,key:"default"},y),navigationType:Cr.Pop}},S):S}function bb(){let n=Rb(),r=mb(n)?n.status+" "+n.statusText:n instanceof Error?n.message:JSON.stringify(n),i=n instanceof Error?n.stack:null,c={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},r),i?m.createElement("pre",{style:c},i):null,null)}const kb=m.createElement(bb,null);class Cb extends m.Component{constructor(r){super(r),this.state={location:r.location,revalidation:r.revalidation,error:r.error}}static getDerivedStateFromError(r){return{error:r}}static getDerivedStateFromProps(r,i){return i.location!==r.location||i.revalidation!=="idle"&&r.revalidation==="idle"?{error:r.error,location:r.location,revalidation:r.revalidation}:{error:r.error!==void 0?r.error:i.error,location:i.location,revalidation:r.revalidation||i.revalidation}}componentDidCatch(r,i){console.error("React Router caught the following error during render",r,i)}render(){return this.state.error!==void 0?m.createElement(Pr.Provider,{value:this.props.routeContext},m.createElement(gg.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function jb(n){let{routeContext:r,match:i,children:s}=n,c=m.useContext(Hl);return c&&c.static&&c.staticContext&&(i.route.errorElement||i.route.ErrorBoundary)&&(c.staticContext._deepestRenderedBoundaryId=i.route.id),m.createElement(Pr.Provider,{value:r},s)}function Sb(n,r,i,s){var c;if(r===void 0&&(r=[]),i===void 0&&(i=null),s===void 0&&(s=null),n==null){var u;if(!i)return null;if(i.errors)n=i.matches;else if((u=s)!=null&&u.v7_partialHydration&&r.length===0&&!i.initialized&&i.matches.length>0)n=i.matches;else return null}let f=n,h=(c=i)==null?void 0:c.errors;if(h!=null){let y=f.findIndex(x=>x.route.id&&(h==null?void 0:h[x.route.id])!==void 0);y>=0||Ge(!1),f=f.slice(0,Math.min(f.length,y+1))}let v=!1,g=-1;if(i&&s&&s.v7_partialHydration)for(let y=0;y=0?f=f.slice(0,g+1):f=[f[0]];break}}}return f.reduceRight((y,x,b)=>{let C,k=!1,S=null,j=null;i&&(C=h&&x.route.id?h[x.route.id]:void 0,S=x.route.errorElement||kb,v&&(g<0&&b===0?(Db("route-fallback"),k=!0,j=null):g===b&&(k=!0,j=x.route.hydrateFallbackElement||null)));let E=r.concat(f.slice(0,b+1)),D=()=>{let T;return C?T=S:k?T=j:x.route.Component?T=m.createElement(x.route.Component,null):x.route.element?T=x.route.element:T=y,m.createElement(jb,{match:x,routeContext:{outlet:y,matches:E,isDataRoute:i!=null},children:T})};return i&&(x.route.ErrorBoundary||x.route.errorElement||b===0)?m.createElement(Cb,{location:i.location,revalidation:i.revalidation,component:S,error:C,children:D(),routeContext:{outlet:null,matches:E,isDataRoute:!0}}):D()},null)}var yg=(function(n){return n.UseBlocker="useBlocker",n.UseRevalidator="useRevalidator",n.UseNavigateStable="useNavigate",n})(yg||{}),wg=(function(n){return n.UseBlocker="useBlocker",n.UseLoaderData="useLoaderData",n.UseActionData="useActionData",n.UseRouteError="useRouteError",n.UseNavigation="useNavigation",n.UseRouteLoaderData="useRouteLoaderData",n.UseMatches="useMatches",n.UseRevalidator="useRevalidator",n.UseNavigateStable="useNavigate",n.UseRouteId="useRouteId",n})(wg||{});function Eb(n){let r=m.useContext(Hl);return r||Ge(!1),r}function _b(n){let r=m.useContext(mg);return r||Ge(!1),r}function Nb(n){let r=m.useContext(Pr);return r||Ge(!1),r}function bg(n){let r=Nb(),i=r.matches[r.matches.length-1];return i.route.id||Ge(!1),i.route.id}function Rb(){var n;let r=m.useContext(gg),i=_b(),s=bg();return r!==void 0?r:(n=i.errors)==null?void 0:n[s]}function Pb(){let{router:n}=Eb(yg.UseNavigateStable),r=bg(wg.UseNavigateStable),i=m.useRef(!1);return vg(()=>{i.current=!0}),m.useCallback(function(c,u){u===void 0&&(u={}),i.current&&(typeof c=="number"?n.navigate(c):n.navigate(c,Vi({fromRouteId:r},u)))},[n,r])}const pm={};function Db(n,r,i){pm[n]||(pm[n]=!0)}function Tb(n,r){n==null||n.v7_startTransition,n==null||n.v7_relativeSplatPath}function hm(n){let{to:r,replace:i,state:s,relative:c}=n;Qo()||Ge(!1);let{future:u,static:f}=m.useContext(Hn),{matches:h}=m.useContext(Pr),{pathname:v}=Dr(),g=xg(),y=nd(r,td(h,u.v7_relativeSplatPath),v,c==="path"),x=JSON.stringify(y);return m.useEffect(()=>g(JSON.parse(x),{replace:i,state:s,relative:c}),[g,x,c,i,s]),null}function El(n){Ge(!1)}function Ob(n){let{basename:r="/",children:i=null,location:s,navigationType:c=Cr.Pop,navigator:u,static:f=!1,future:h}=n;Qo()&&Ge(!1);let v=r.replace(/^\/*/,"/"),g=m.useMemo(()=>({basename:v,navigator:u,static:f,future:Vi({v7_relativeSplatPath:!1},h)}),[v,h,u,f]);typeof s=="string"&&(s=Ko(s));let{pathname:y="/",search:x="",hash:b="",state:C=null,key:k="default"}=s,S=m.useMemo(()=>{let j=Vo(y,v);return j==null?null:{location:{pathname:j,search:x,hash:b,state:C,key:k},navigationType:c}},[v,y,x,b,C,k,c]);return S==null?null:m.createElement(Hn.Provider,{value:g},m.createElement(Gl.Provider,{children:i,value:S}))}function Mb(n){let{children:r,location:i}=n;return yb(Eu(r),i)}new Promise(()=>{});function Eu(n,r){r===void 0&&(r=[]);let i=[];return m.Children.forEach(n,(s,c)=>{if(!m.isValidElement(s))return;let u=[...r,c];if(s.type===m.Fragment){i.push.apply(i,Eu(s.props.children,u));return}s.type!==El&&Ge(!1),!s.props.index||!s.props.children||Ge(!1);let f={id:s.props.id||u.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,loader:s.props.loader,action:s.props.action,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(f.children=Eu(s.props.children,u)),i.push(f)}),i}/** + */function Vi(){return Vi=Object.assign?Object.assign.bind():function(n){for(var r=1;r{h.current=!0}),m.useCallback(function(g,y){if(y===void 0&&(y={}),!h.current)return;if(typeof g=="number"){l.go(g);return}let x=nd(g,JSON.parse(f),u,y.relative==="path");n==null&&r!=="/"&&(x.pathname=x.pathname==="/"?r:Cr([r,x.pathname])),(y.replace?l.replace:l.push)(x,y.state,y)},[r,l,f,u,n])}function Kl(n,r){let{relative:i}=r===void 0?{}:r,{future:l}=m.useContext(Hn),{matches:c}=m.useContext(Pr),{pathname:u}=Dr(),f=JSON.stringify(td(c,l.v7_relativeSplatPath));return m.useMemo(()=>nd(n,JSON.parse(f),u,i==="path"),[n,f,u,i])}function yb(n,r){return wb(n,r)}function wb(n,r,i,l){Qo()||Ge(!1);let{navigator:c}=m.useContext(Hn),{matches:u}=m.useContext(Pr),f=u[u.length-1],h=f?f.params:{};f&&f.pathname;let v=f?f.pathnameBase:"/";f&&f.route;let g=Dr(),y;if(r){var x;let C=typeof r=="string"?Ko(r):r;v==="/"||(x=C.pathname)!=null&&x.startsWith(v)||Ge(!1),y=C}else y=g;let b=y.pathname||"/",j=b;if(v!=="/"){let C=v.replace(/^\//,"").split("/");j="/"+b.replace(/^\//,"").split("/").slice(C.length).join("/")}let k=Y0(n,{pathname:j}),S=Sb(k&&k.map(C=>Object.assign({},C,{params:Object.assign({},h,C.params),pathname:Cr([v,c.encodeLocation?c.encodeLocation(C.pathname).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?v:Cr([v,c.encodeLocation?c.encodeLocation(C.pathnameBase).pathname:C.pathnameBase])})),u,i,l);return r&&S?m.createElement(Gl.Provider,{value:{location:Vi({pathname:"/",search:"",hash:"",state:null,key:"default"},y),navigationType:jr.Pop}},S):S}function bb(){let n=Rb(),r=mb(n)?n.status+" "+n.statusText:n instanceof Error?n.message:JSON.stringify(n),i=n instanceof Error?n.stack:null,c={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},r),i?m.createElement("pre",{style:c},i):null,null)}const kb=m.createElement(bb,null);class jb extends m.Component{constructor(r){super(r),this.state={location:r.location,revalidation:r.revalidation,error:r.error}}static getDerivedStateFromError(r){return{error:r}}static getDerivedStateFromProps(r,i){return i.location!==r.location||i.revalidation!=="idle"&&r.revalidation==="idle"?{error:r.error,location:r.location,revalidation:r.revalidation}:{error:r.error!==void 0?r.error:i.error,location:i.location,revalidation:r.revalidation||i.revalidation}}componentDidCatch(r,i){console.error("React Router caught the following error during render",r,i)}render(){return this.state.error!==void 0?m.createElement(Pr.Provider,{value:this.props.routeContext},m.createElement(gg.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Cb(n){let{routeContext:r,match:i,children:l}=n,c=m.useContext(Hl);return c&&c.static&&c.staticContext&&(i.route.errorElement||i.route.ErrorBoundary)&&(c.staticContext._deepestRenderedBoundaryId=i.route.id),m.createElement(Pr.Provider,{value:r},l)}function Sb(n,r,i,l){var c;if(r===void 0&&(r=[]),i===void 0&&(i=null),l===void 0&&(l=null),n==null){var u;if(!i)return null;if(i.errors)n=i.matches;else if((u=l)!=null&&u.v7_partialHydration&&r.length===0&&!i.initialized&&i.matches.length>0)n=i.matches;else return null}let f=n,h=(c=i)==null?void 0:c.errors;if(h!=null){let y=f.findIndex(x=>x.route.id&&(h==null?void 0:h[x.route.id])!==void 0);y>=0||Ge(!1),f=f.slice(0,Math.min(f.length,y+1))}let v=!1,g=-1;if(i&&l&&l.v7_partialHydration)for(let y=0;y=0?f=f.slice(0,g+1):f=[f[0]];break}}}return f.reduceRight((y,x,b)=>{let j,k=!1,S=null,C=null;i&&(j=h&&x.route.id?h[x.route.id]:void 0,S=x.route.errorElement||kb,v&&(g<0&&b===0?(Db("route-fallback"),k=!0,C=null):g===b&&(k=!0,C=x.route.hydrateFallbackElement||null)));let E=r.concat(f.slice(0,b+1)),D=()=>{let T;return j?T=S:k?T=C:x.route.Component?T=m.createElement(x.route.Component,null):x.route.element?T=x.route.element:T=y,m.createElement(Cb,{match:x,routeContext:{outlet:y,matches:E,isDataRoute:i!=null},children:T})};return i&&(x.route.ErrorBoundary||x.route.errorElement||b===0)?m.createElement(jb,{location:i.location,revalidation:i.revalidation,component:S,error:j,children:D(),routeContext:{outlet:null,matches:E,isDataRoute:!0}}):D()},null)}var yg=(function(n){return n.UseBlocker="useBlocker",n.UseRevalidator="useRevalidator",n.UseNavigateStable="useNavigate",n})(yg||{}),wg=(function(n){return n.UseBlocker="useBlocker",n.UseLoaderData="useLoaderData",n.UseActionData="useActionData",n.UseRouteError="useRouteError",n.UseNavigation="useNavigation",n.UseRouteLoaderData="useRouteLoaderData",n.UseMatches="useMatches",n.UseRevalidator="useRevalidator",n.UseNavigateStable="useNavigate",n.UseRouteId="useRouteId",n})(wg||{});function Eb(n){let r=m.useContext(Hl);return r||Ge(!1),r}function _b(n){let r=m.useContext(mg);return r||Ge(!1),r}function Nb(n){let r=m.useContext(Pr);return r||Ge(!1),r}function bg(n){let r=Nb(),i=r.matches[r.matches.length-1];return i.route.id||Ge(!1),i.route.id}function Rb(){var n;let r=m.useContext(gg),i=_b(),l=bg();return r!==void 0?r:(n=i.errors)==null?void 0:n[l]}function Pb(){let{router:n}=Eb(yg.UseNavigateStable),r=bg(wg.UseNavigateStable),i=m.useRef(!1);return vg(()=>{i.current=!0}),m.useCallback(function(c,u){u===void 0&&(u={}),i.current&&(typeof c=="number"?n.navigate(c):n.navigate(c,Vi({fromRouteId:r},u)))},[n,r])}const pm={};function Db(n,r,i){pm[n]||(pm[n]=!0)}function Tb(n,r){n==null||n.v7_startTransition,n==null||n.v7_relativeSplatPath}function hm(n){let{to:r,replace:i,state:l,relative:c}=n;Qo()||Ge(!1);let{future:u,static:f}=m.useContext(Hn),{matches:h}=m.useContext(Pr),{pathname:v}=Dr(),g=xg(),y=nd(r,td(h,u.v7_relativeSplatPath),v,c==="path"),x=JSON.stringify(y);return m.useEffect(()=>g(JSON.parse(x),{replace:i,state:l,relative:c}),[g,x,c,i,l]),null}function El(n){Ge(!1)}function Ob(n){let{basename:r="/",children:i=null,location:l,navigationType:c=jr.Pop,navigator:u,static:f=!1,future:h}=n;Qo()&&Ge(!1);let v=r.replace(/^\/*/,"/"),g=m.useMemo(()=>({basename:v,navigator:u,static:f,future:Vi({v7_relativeSplatPath:!1},h)}),[v,h,u,f]);typeof l=="string"&&(l=Ko(l));let{pathname:y="/",search:x="",hash:b="",state:j=null,key:k="default"}=l,S=m.useMemo(()=>{let C=Vo(y,v);return C==null?null:{location:{pathname:C,search:x,hash:b,state:j,key:k},navigationType:c}},[v,y,x,b,j,k,c]);return S==null?null:m.createElement(Hn.Provider,{value:g},m.createElement(Gl.Provider,{children:i,value:S}))}function Mb(n){let{children:r,location:i}=n;return yb(Eu(r),i)}new Promise(()=>{});function Eu(n,r){r===void 0&&(r=[]);let i=[];return m.Children.forEach(n,(l,c)=>{if(!m.isValidElement(l))return;let u=[...r,c];if(l.type===m.Fragment){i.push.apply(i,Eu(l.props.children,u));return}l.type!==El&&Ge(!1),!l.props.index||!l.props.children||Ge(!1);let f={id:l.props.id||u.join("-"),caseSensitive:l.props.caseSensitive,element:l.props.element,Component:l.props.Component,index:l.props.index,path:l.props.path,loader:l.props.loader,action:l.props.action,errorElement:l.props.errorElement,ErrorBoundary:l.props.ErrorBoundary,hasErrorBoundary:l.props.ErrorBoundary!=null||l.props.errorElement!=null,shouldRevalidate:l.props.shouldRevalidate,handle:l.props.handle,lazy:l.props.lazy};l.props.children&&(f.children=Eu(l.props.children,u)),i.push(f)}),i}/** * React Router DOM v6.30.1 * * Copyright (c) Remix Software Inc. @@ -64,7 +64,7 @@ Error generating stack: `+p.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Ml(){return Ml=Object.assign?Object.assign.bind():function(n){for(var r=1;r=0)&&(i[c]=n[c]);return i}function Ab(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function Ib(n,r){return n.button===0&&(!r||r==="_self")&&!Ab(n)}const Lb=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],zb=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],Fb="6";try{window.__reactRouterVersion=Fb}catch{}const $b=m.createContext({isTransitioning:!1}),Ub="startTransition",mm=Rr[Ub];function Bb(n){let{basename:r,children:i,future:s,window:c}=n,u=m.useRef();u.current==null&&(u.current=G0({window:c,v5Compat:!0}));let f=u.current,[h,v]=m.useState({action:f.action,location:f.location}),{v7_startTransition:g}=s||{},y=m.useCallback(x=>{g&&mm?mm(()=>v(x)):v(x)},[v,g]);return m.useLayoutEffect(()=>f.listen(y),[f,y]),m.useEffect(()=>Tb(s),[s]),m.createElement(Ob,{basename:r,children:i,location:h.location,navigationType:h.action,navigator:f,future:s})}const Wb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Vb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ho=m.forwardRef(function(r,i){let{onClick:s,relative:c,reloadDocument:u,replace:f,state:h,target:v,to:g,preventScrollReset:y,viewTransition:x}=r,b=kg(r,Lb),{basename:C}=m.useContext(Hn),k,S=!1;if(typeof g=="string"&&Vb.test(g)&&(k=g,Wb))try{let T=new URL(window.location.href),P=g.startsWith("//")?new URL(T.protocol+g):new URL(g),R=Vo(P.pathname,C);P.origin===T.origin&&R!=null?g=R+P.search+P.hash:S=!0}catch{}let j=vb(g,{relative:c}),E=Kb(g,{replace:f,state:h,target:v,preventScrollReset:y,relative:c,viewTransition:x});function D(T){s&&s(T),T.defaultPrevented||E(T)}return m.createElement("a",Ml({},b,{href:k||j,onClick:S||u?s:D,ref:i,target:v}))}),Hb=m.forwardRef(function(r,i){let{"aria-current":s="page",caseSensitive:c=!1,className:u="",end:f=!1,style:h,to:v,viewTransition:g,children:y}=r,x=kg(r,zb),b=Kl(v,{relative:x.relative}),C=Dr(),k=m.useContext(mg),{navigator:S,basename:j}=m.useContext(Hn),E=k!=null&&Qb(b)&&g===!0,D=S.encodeLocation?S.encodeLocation(b).pathname:b.pathname,T=C.pathname,P=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;c||(T=T.toLowerCase(),P=P?P.toLowerCase():null,D=D.toLowerCase()),P&&j&&(P=Vo(P,j)||P);const R=D!=="/"&&D.endsWith("/")?D.length-1:D.length;let N=T===D||!f&&T.startsWith(D)&&T.charAt(R)==="/",I=P!=null&&(P===D||!f&&P.startsWith(D)&&P.charAt(D.length)==="/"),L={isActive:N,isPending:I,isTransitioning:E},Q=N?s:void 0,ee;typeof u=="function"?ee=u(L):ee=[u,N?"active":null,I?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let J=typeof h=="function"?h(L):h;return m.createElement(Ho,Ml({},x,{"aria-current":Q,className:ee,ref:i,style:J,to:v,viewTransition:g}),typeof y=="function"?y(L):y)});var _u;(function(n){n.UseScrollRestoration="useScrollRestoration",n.UseSubmit="useSubmit",n.UseSubmitFetcher="useSubmitFetcher",n.UseFetcher="useFetcher",n.useViewTransitionState="useViewTransitionState"})(_u||(_u={}));var gm;(function(n){n.UseFetcher="useFetcher",n.UseFetchers="useFetchers",n.UseScrollRestoration="useScrollRestoration"})(gm||(gm={}));function Gb(n){let r=m.useContext(Hl);return r||Ge(!1),r}function Kb(n,r){let{target:i,replace:s,state:c,preventScrollReset:u,relative:f,viewTransition:h}=r===void 0?{}:r,v=xg(),g=Dr(),y=Kl(n,{relative:f});return m.useCallback(x=>{if(Ib(x,i)){x.preventDefault();let b=s!==void 0?s:Ol(g)===Ol(y);v(n,{replace:b,state:c,preventScrollReset:u,relative:f,viewTransition:h})}},[g,v,y,s,c,i,n,u,f,h])}function Qb(n,r){r===void 0&&(r={});let i=m.useContext($b);i==null&&Ge(!1);let{basename:s}=Gb(_u.useViewTransitionState),c=Kl(n,{relative:r.relative});if(!i.isTransitioning)return!1;let u=Vo(i.currentLocation.pathname,s)||i.currentLocation.pathname,f=Vo(i.nextLocation.pathname,s)||i.nextLocation.pathname;return Su(c.pathname,f)!=null||Su(c.pathname,u)!=null}var Nu,Yb=function(n){Nu=n},qb=function(){if(Nu)return Nu;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};/** + */function Ml(){return Ml=Object.assign?Object.assign.bind():function(n){for(var r=1;r=0)&&(i[c]=n[c]);return i}function Ab(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function Ib(n,r){return n.button===0&&(!r||r==="_self")&&!Ab(n)}const Lb=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],zb=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],Fb="6";try{window.__reactRouterVersion=Fb}catch{}const $b=m.createContext({isTransitioning:!1}),Ub="startTransition",mm=Rr[Ub];function Bb(n){let{basename:r,children:i,future:l,window:c}=n,u=m.useRef();u.current==null&&(u.current=G0({window:c,v5Compat:!0}));let f=u.current,[h,v]=m.useState({action:f.action,location:f.location}),{v7_startTransition:g}=l||{},y=m.useCallback(x=>{g&&mm?mm(()=>v(x)):v(x)},[v,g]);return m.useLayoutEffect(()=>f.listen(y),[f,y]),m.useEffect(()=>Tb(l),[l]),m.createElement(Ob,{basename:r,children:i,location:h.location,navigationType:h.action,navigator:f,future:l})}const Wb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Vb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ho=m.forwardRef(function(r,i){let{onClick:l,relative:c,reloadDocument:u,replace:f,state:h,target:v,to:g,preventScrollReset:y,viewTransition:x}=r,b=kg(r,Lb),{basename:j}=m.useContext(Hn),k,S=!1;if(typeof g=="string"&&Vb.test(g)&&(k=g,Wb))try{let T=new URL(window.location.href),P=g.startsWith("//")?new URL(T.protocol+g):new URL(g),R=Vo(P.pathname,j);P.origin===T.origin&&R!=null?g=R+P.search+P.hash:S=!0}catch{}let C=vb(g,{relative:c}),E=Kb(g,{replace:f,state:h,target:v,preventScrollReset:y,relative:c,viewTransition:x});function D(T){l&&l(T),T.defaultPrevented||E(T)}return m.createElement("a",Ml({},b,{href:k||C,onClick:S||u?l:D,ref:i,target:v}))}),Hb=m.forwardRef(function(r,i){let{"aria-current":l="page",caseSensitive:c=!1,className:u="",end:f=!1,style:h,to:v,viewTransition:g,children:y}=r,x=kg(r,zb),b=Kl(v,{relative:x.relative}),j=Dr(),k=m.useContext(mg),{navigator:S,basename:C}=m.useContext(Hn),E=k!=null&&Qb(b)&&g===!0,D=S.encodeLocation?S.encodeLocation(b).pathname:b.pathname,T=j.pathname,P=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;c||(T=T.toLowerCase(),P=P?P.toLowerCase():null,D=D.toLowerCase()),P&&C&&(P=Vo(P,C)||P);const R=D!=="/"&&D.endsWith("/")?D.length-1:D.length;let N=T===D||!f&&T.startsWith(D)&&T.charAt(R)==="/",I=P!=null&&(P===D||!f&&P.startsWith(D)&&P.charAt(D.length)==="/"),L={isActive:N,isPending:I,isTransitioning:E},Q=N?l:void 0,ee;typeof u=="function"?ee=u(L):ee=[u,N?"active":null,I?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let J=typeof h=="function"?h(L):h;return m.createElement(Ho,Ml({},x,{"aria-current":Q,className:ee,ref:i,style:J,to:v,viewTransition:g}),typeof y=="function"?y(L):y)});var _u;(function(n){n.UseScrollRestoration="useScrollRestoration",n.UseSubmit="useSubmit",n.UseSubmitFetcher="useSubmitFetcher",n.UseFetcher="useFetcher",n.useViewTransitionState="useViewTransitionState"})(_u||(_u={}));var gm;(function(n){n.UseFetcher="useFetcher",n.UseFetchers="useFetchers",n.UseScrollRestoration="useScrollRestoration"})(gm||(gm={}));function Gb(n){let r=m.useContext(Hl);return r||Ge(!1),r}function Kb(n,r){let{target:i,replace:l,state:c,preventScrollReset:u,relative:f,viewTransition:h}=r===void 0?{}:r,v=xg(),g=Dr(),y=Kl(n,{relative:f});return m.useCallback(x=>{if(Ib(x,i)){x.preventDefault();let b=l!==void 0?l:Ol(g)===Ol(y);v(n,{replace:b,state:c,preventScrollReset:u,relative:f,viewTransition:h})}},[g,v,y,l,c,i,n,u,f,h])}function Qb(n,r){r===void 0&&(r={});let i=m.useContext($b);i==null&&Ge(!1);let{basename:l}=Gb(_u.useViewTransitionState),c=Kl(n,{relative:r.relative});if(!i.isTransitioning)return!1;let u=Vo(i.currentLocation.pathname,l)||i.currentLocation.pathname,f=Vo(i.nextLocation.pathname,l)||i.nextLocation.pathname;return Su(c.pathname,f)!=null||Su(c.pathname,u)!=null}var Nu,Yb=function(n){Nu=n},qb=function(){if(Nu)return Nu;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};/** * @license lucide-react v1.68.0 - ISC * * This source code is licensed under the ISC license. @@ -79,7 +79,7 @@ Error generating stack: `+p.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Zb=n=>{let r="",i=!1;for(const s of n){if(s==="-"||s==="_"||s<=" "){i=r.length>0;continue}r.length===0?r+=s.toLowerCase():r+=i?s.toUpperCase():s,i=!1}return r};/** + */const Zb=n=>{let r="",i=!1;for(const l of n){if(l==="-"||l==="_"||l<=" "){i=r.length>0;continue}r.length===0?r+=l.toLowerCase():r+=i?l.toUpperCase():l,i=!1}return r};/** * @license lucide-react v1.68.0 - ISC * * This source code is licensed under the ISC license. @@ -89,7 +89,7 @@ Error generating stack: `+p.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ru=(...n)=>n.filter((r,i,s)=>!!r&&r.trim()!==""&&s.indexOf(r)===i).join(" ").trim();/** + */const Ru=(...n)=>n.filter((r,i,l)=>!!r&&r.trim()!==""&&l.indexOf(r)===i).join(" ").trim();/** * @license lucide-react v1.68.0 - ISC * * This source code is licensed under the ISC license. @@ -99,7 +99,7 @@ Error generating stack: `+p.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */function au(n){return n!=null}function t1(n,r={}){var b,C;const i=r.attributeNames??{},s=k=>i[k]??k,c=n.size??n.width??Qr.width,u=n.size??n.height??Qr.height,f=((b=n.aliases)==null?void 0:b.filter(k=>typeof k=="string"&&k.trim()!=="").map(k=>`lucide-${k}`))??[],h=[...n.name?[`lucide-${n.name}`]:[],...f],v=((C=r.className)==null?void 0:C.split(" ").filter(Boolean))??[],g=r.includeDefaultClasses===!1?Ru(...v):Ru("lucide",...h,...v),y=r.absoluteStrokeWidth?Number(r.strokeWidth??Qr["stroke-width"])*Number(n.size??n.width??Qr.width)/Number(r.size??r.width??Qr.width):r.strokeWidth??Qr["stroke-width"];return["svg",{...Object.entries(Qr).reduce((k,[S,j])=>(k[s(S)]=j,k),{}),..."color"in r&&r.color&&{[s("stroke")]:r.color},..."size"in r&&au(r.size)&&{[s("width")]:r.size,[s("height")]:r.size},..."width"in r&&au(r.width)&&{[s("width")]:r.width},..."height"in r&&au(r.height)&&{[s("height")]:r.height},[s("stroke-width")]:y,...g&&{[s("class")]:g},[s("viewBox")]:`0 0 ${c} ${u}`,...r.hasA11yProp===!1?{[s("aria-hidden")]:"true"}:{},..."attributes"in r&&r.attributes},n.node.map(k=>{const[S,j,E]=k,D=r.nonScalingStroke?{[s("vector-effect")]:"non-scaling-stroke",...j}:j;return E?[S,D,E]:[S,D]})]}/** + */function au(n){return n!=null}function t1(n,r={}){var b,j;const i=r.attributeNames??{},l=k=>i[k]??k,c=n.size??n.width??Qr.width,u=n.size??n.height??Qr.height,f=((b=n.aliases)==null?void 0:b.filter(k=>typeof k=="string"&&k.trim()!=="").map(k=>`lucide-${k}`))??[],h=[...n.name?[`lucide-${n.name}`]:[],...f],v=((j=r.className)==null?void 0:j.split(" ").filter(Boolean))??[],g=r.includeDefaultClasses===!1?Ru(...v):Ru("lucide",...h,...v),y=r.absoluteStrokeWidth?Number(r.strokeWidth??Qr["stroke-width"])*Number(n.size??n.width??Qr.width)/Number(r.size??r.width??Qr.width):r.strokeWidth??Qr["stroke-width"];return["svg",{...Object.entries(Qr).reduce((k,[S,C])=>(k[l(S)]=C,k),{}),..."color"in r&&r.color&&{[l("stroke")]:r.color},..."size"in r&&au(r.size)&&{[l("width")]:r.size,[l("height")]:r.size},..."width"in r&&au(r.width)&&{[l("width")]:r.width},..."height"in r&&au(r.height)&&{[l("height")]:r.height},[l("stroke-width")]:y,...g&&{[l("class")]:g},[l("viewBox")]:`0 0 ${c} ${u}`,...r.hasA11yProp===!1?{[l("aria-hidden")]:"true"}:{},..."attributes"in r&&r.attributes},n.node.map(k=>{const[S,C,E]=k,D=r.nonScalingStroke?{[l("vector-effect")]:"non-scaling-stroke",...C}:C;return E?[S,D,E]:[S,D]})]}/** * @license lucide-react v1.68.0 - ISC * * This source code is licensed under the ISC license. @@ -109,22 +109,22 @@ Error generating stack: `+p.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const r1=n=>{for(const r in n)if(r.startsWith("aria-")||r==="role"||r==="title")return!0;return!1},o1=m.createContext({}),i1=()=>m.useContext(o1),s1=m.forwardRef(({color:n,size:r,width:i,height:s,strokeWidth:c,absoluteStrokeWidth:u,nonScalingStroke:f,className:h="",children:v,iconNode:g=[],icon:y={node:g,aliases:[],size:24},...x},b)=>{const{size:C=24,strokeWidth:k=2,absoluteStrokeWidth:S=!1,nonScalingStroke:j=!1,color:E="currentColor",className:D=""}=i1()??{},T=!!v||r1(x),[P,R,N=[]]=n1(y,{color:n??E,width:i??r??C,height:s??r??C,strokeWidth:c??k,absoluteStrokeWidth:u??S,nonScalingStroke:f??j,className:Ru(D,h),hasA11yProp:T,attributes:x});return m.createElement(P,{ref:b,...R},[...N.map(([I,L])=>m.createElement(I,L)),...Array.isArray(v)?v:[v]])});/** + */const r1=n=>{for(const r in n)if(r.startsWith("aria-")||r==="role"||r==="title")return!0;return!1},o1=m.createContext({}),i1=()=>m.useContext(o1),s1=m.forwardRef(({color:n,size:r,width:i,height:l,strokeWidth:c,absoluteStrokeWidth:u,nonScalingStroke:f,className:h="",children:v,iconNode:g=[],icon:y={node:g,aliases:[],size:24},...x},b)=>{const{size:j=24,strokeWidth:k=2,absoluteStrokeWidth:S=!1,nonScalingStroke:C=!1,color:E="currentColor",className:D=""}=i1()??{},T=!!v||r1(x),[P,R,N=[]]=n1(y,{color:n??E,width:i??r??j,height:l??r??j,strokeWidth:c??k,absoluteStrokeWidth:u??S,nonScalingStroke:f??C,className:Ru(D,h),hasA11yProp:T,attributes:x});return m.createElement(P,{ref:b,...R},[...N.map(([I,L])=>m.createElement(I,L)),...Array.isArray(v)?v:[v]])});/** * @license lucide-react v1.68.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */function Te(n,r=[],i=[]){const s=typeof n=="string"?Jb(n,r,i):n,c=m.forwardRef(({className:u,...f},h)=>m.createElement(s1,{ref:h,icon:s,className:u,...f}));return s.name&&(c.displayName=e1(s.name)),c}/** + */function Te(n,r=[],i=[]){const l=typeof n=="string"?Jb(n,r,i):n,c=m.forwardRef(({className:u,...f},h)=>m.createElement(s1,{ref:h,icon:l,className:u,...f}));return l.name&&(c.displayName=e1(l.name)),c}/** * @license lucide-react v1.68.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Cg={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]};Cg.node;const l1=Te(Cg);/** + */const jg={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]};jg.node;const l1=Te(jg);/** * @license lucide-react v1.68.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const jg={name:"book-open",size:24,node:[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]]};jg.node;const a1=Te(jg);/** + */const Cg={name:"book-open",size:24,node:[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]]};Cg.node;const a1=Te(Cg);/** * @license lucide-react v1.68.0 - ISC * * This source code is licensed under the ISC license. @@ -234,7 +234,7 @@ Error generating stack: `+p.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Xg={name:"scroll-text",size:24,node:[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]};Xg.node;const C1=Te(Xg);/** + */const Xg={name:"scroll-text",size:24,node:[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]};Xg.node;const j1=Te(Xg);/** * @license lucide-react v1.68.0 - ISC * * This source code is licensed under the ISC license. @@ -244,7 +244,7 @@ Error generating stack: `+p.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Zg={name:"server",size:24,node:[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]};Zg.node;const j1=Te(Zg);/** + */const Zg={name:"server",size:24,node:[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]};Zg.node;const C1=Te(Zg);/** * @license lucide-react v1.68.0 - ISC * * This source code is licensed under the ISC license. @@ -274,45 +274,45 @@ Error generating stack: `+p.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const sv={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};sv.node;const lv=Te(sv);let av="";function R1(n){av=n}class vm extends Error{constructor(r,i){super(r),this.status=i}}async function ql(n,r,i){const s={};n!=="GET"&&(s["X-CSRF-Token"]=av),i!==void 0&&(s["Content-Type"]="application/json");const c=await fetch(r,{method:n,headers:s,cache:"no-store",body:i===void 0?void 0:JSON.stringify(i)});if(c.status===401)throw location.href="/admin/login?next="+encodeURIComponent(location.pathname),new vm("signed out",401);const u=await c.json().catch(()=>({}));if(!c.ok)throw new vm(u&&u.error||"HTTP "+c.status,c.status);return u}const jt=n=>ql("GET",n),Fn=(n,r)=>ql("POST",n,r),oo=(n,r)=>ql("PUT",n,r),Ji=n=>ql("DELETE",n);function Pu(n){const r=new URLSearchParams;for(const[s,c]of Object.entries(n))c!=null&&c!==""&&r.set(s,String(c));const i=r.toString();return i?"?"+i:""}function cv(n){var r,i,s="";if(typeof n=="string"||typeof n=="number")s+=n;else if(typeof n=="object")if(Array.isArray(n)){var c=n.length;for(r=0;r{const i=new Array(n.length+r.length);for(let s=0;s({classGroupId:n,validator:r}),dv=(n=new Map,r=null,i)=>({nextPart:n,validators:r,classGroupId:i}),Al="-",xm=[],T1="arbitrary..",O1=n=>{const r=A1(n),{conflictingClassGroups:i,conflictingClassGroupModifiers:s}=n;return{getClassGroupId:f=>{if(f.startsWith("[")&&f.endsWith("]"))return M1(f);const h=f.split(Al),v=h[0]===""&&h.length>1?1:0;return fv(h,v,r)},getConflictingClassGroupIds:(f,h)=>{if(h){const v=s[f],g=i[f];return v?g?P1(g,v):v:g||xm}return i[f]||xm}}},fv=(n,r,i)=>{if(n.length-r===0)return i.classGroupId;const c=n[r],u=i.nextPart.get(c);if(u){const g=fv(n,r+1,u);if(g)return g}const f=i.validators;if(f===null)return;const h=r===0?n.join(Al):n.slice(r).join(Al),v=f.length;for(let g=0;gn.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const r=n.slice(1,-1),i=r.indexOf(":"),s=r.slice(0,i);return s?T1+s:void 0})(),A1=n=>{const{theme:r,classGroups:i}=n;return I1(i,r)},I1=(n,r)=>{const i=dv();for(const s in n){const c=n[s];rd(c,i,s,r)}return i},rd=(n,r,i,s)=>{const c=n.length;for(let u=0;u{if(typeof n=="string"){z1(n,r,i);return}if(typeof n=="function"){F1(n,r,i,s);return}$1(n,r,i,s)},z1=(n,r,i)=>{const s=n===""?r:pv(r,n);s.classGroupId=i},F1=(n,r,i,s)=>{if(U1(n)){rd(n(s),r,i,s);return}r.validators===null&&(r.validators=[]),r.validators.push(D1(i,n))},$1=(n,r,i,s)=>{const c=Object.entries(n),u=c.length;for(let f=0;f{let i=n;const s=r.split(Al),c=s.length;for(let u=0;u"isThemeGetter"in n&&n.isThemeGetter===!0,B1=n=>{if(n<1)return{get:()=>{},set:()=>{}};let r=0,i=Object.create(null),s=Object.create(null);const c=(u,f)=>{i[u]=f,r++,r>n&&(r=0,s=i,i=Object.create(null))};return{get(u){let f=i[u];if(f!==void 0)return f;if((f=s[u])!==void 0)return c(u,f),f},set(u,f){u in i?i[u]=f:c(u,f)}}},Du="!",ym=":",W1=[],wm=(n,r,i,s,c)=>({modifiers:n,hasImportantModifier:r,baseClassName:i,maybePostfixModifierPosition:s,isExternal:c}),V1=n=>{const{prefix:r,experimentalParseClassName:i}=n;let s=c=>{const u=[];let f=0,h=0,v=0,g;const y=c.length;for(let S=0;Sv?g-v:void 0;return wm(u,C,b,k)};if(r){const c=r+ym,u=s;s=f=>f.startsWith(c)?u(f.slice(c.length)):wm(W1,!1,f,void 0,!0)}if(i){const c=s;s=u=>i({className:u,parseClassName:c})}return s},H1=n=>{const r=new Map;return n.orderSensitiveModifiers.forEach((i,s)=>{r.set(i,1e6+s)}),i=>{const s=[];let c=[];for(let u=0;u0&&(c.sort(),s.push(...c),c=[]),s.push(f)):c.push(f)}return c.length>0&&(c.sort(),s.push(...c)),s}},G1=n=>({cache:B1(n.cacheSize),parseClassName:V1(n),sortModifiers:H1(n),postfixLookupClassGroupIds:K1(n),...O1(n)}),K1=n=>{const r=Object.create(null),i=n.postfixLookupClassGroups;if(i)for(let s=0;s{const{parseClassName:i,getClassGroupId:s,getConflictingClassGroupIds:c,sortModifiers:u,postfixLookupClassGroupIds:f}=r,h=[],v=n.trim().split(Q1);let g="";for(let y=v.length-1;y>=0;y-=1){const x=v[y],{isExternal:b,modifiers:C,hasImportantModifier:k,baseClassName:S,maybePostfixModifierPosition:j}=i(x);if(b){g=x+(g.length>0?" "+g:g);continue}let E=!!j,D;if(E){const I=S.substring(0,j);D=s(I);const L=D&&f[D]?s(S):void 0;L&&L!==D&&(D=L,E=!1)}else D=s(S);if(!D){if(!E){g=x+(g.length>0?" "+g:g);continue}if(D=s(S),!D){g=x+(g.length>0?" "+g:g);continue}E=!1}const T=C.length===0?"":C.length===1?C[0]:u(C).join(":"),P=k?T+Du:T,R=P+D;if(h.indexOf(R)>-1)continue;h.push(R);const N=c(D,E);for(let I=0;I0?" "+g:g)}return g},q1=(...n)=>{let r=0,i,s,c="";for(;r{if(typeof n=="string")return n;let r,i="";for(let s=0;s{let i,s,c,u;const f=v=>{const g=r.reduce((y,x)=>x(y),n());return i=G1(g),s=i.cache.get,c=i.cache.set,u=h,h(v)},h=v=>{const g=s(v);if(g)return g;const y=Y1(v,i);return c(v,y),y};return u=f,(...v)=>u(q1(...v))},J1=[],ot=n=>{const r=i=>i[n]||J1;return r.isThemeGetter=!0,r.themeKey=n,r},mv=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,gv=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Z1=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ek=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,tk=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,nk=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,rk=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ok=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wr=n=>Z1.test(n),_e=n=>!!n&&!Number.isNaN(Number(n)),mn=n=>!!n&&Number.isInteger(Number(n)),cu=n=>n.endsWith("%")&&_e(n.slice(0,-1)),Tn=n=>ek.test(n),vv=()=>!0,ik=n=>tk.test(n)&&!nk.test(n),od=()=>!1,sk=n=>rk.test(n),lk=n=>ok.test(n),ak=n=>!se(n)&&!ae(n),ck=n=>n.startsWith("@container")&&(n[10]==="/"&&n[11]!==void 0||n[11]==="s"&&n[16]!==void 0&&n.startsWith("-size/",10)||n[11]==="n"&&n[18]!==void 0&&n.startsWith("-normal/",10)),uk=n=>Tr(n,wv,od),se=n=>mv.test(n),Yr=n=>Tr(n,bv,ik),bm=n=>Tr(n,xk,_e),dk=n=>Tr(n,Cv,vv),fk=n=>Tr(n,kv,od),km=n=>Tr(n,xv,od),pk=n=>Tr(n,yv,lk),ml=n=>Tr(n,jv,sk),ae=n=>gv.test(n),Ui=n=>io(n,bv),hk=n=>io(n,kv),Cm=n=>io(n,xv),mk=n=>io(n,wv),gk=n=>io(n,yv),gl=n=>io(n,jv,!0),vk=n=>io(n,Cv,!0),Tr=(n,r,i)=>{const s=mv.exec(n);return s?s[1]?r(s[1]):i(s[2]):!1},io=(n,r,i=!1)=>{const s=gv.exec(n);return s?s[1]?r(s[1]):i:!1},xv=n=>n==="position"||n==="percentage",yv=n=>n==="image"||n==="url",wv=n=>n==="length"||n==="size"||n==="bg-size",bv=n=>n==="length",xk=n=>n==="number",kv=n=>n==="family-name",Cv=n=>n==="number"||n==="weight",jv=n=>n==="shadow",yk=()=>{const n=ot("color"),r=ot("font"),i=ot("text"),s=ot("font-weight"),c=ot("tracking"),u=ot("leading"),f=ot("breakpoint"),h=ot("container"),v=ot("spacing"),g=ot("radius"),y=ot("shadow"),x=ot("inset-shadow"),b=ot("text-shadow"),C=ot("drop-shadow"),k=ot("blur"),S=ot("perspective"),j=ot("aspect"),E=ot("ease"),D=ot("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[...P(),ae,se],N=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],L=()=>[ae,se,v],Q=()=>[wr,"full","auto",...L()],ee=()=>[mn,"none","subgrid",ae,se],J=()=>["auto",{span:["full",mn,ae,se]},mn,ae,se],ne=()=>[mn,"auto",ae,se],de=()=>["auto","min","max","fr",ae,se],re=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ie=()=>["start","end","center","stretch","center-safe","end-safe"],B=()=>["auto",...L()],Z=()=>[wr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...L()],W=()=>[h,wr,"screen","full","dvw","lvw","svw","min","max","fit",...L()],q=()=>[wr,"screen","full","lh","dvh","lvh","svh","min","max","fit",...L()],F=()=>[n,ae,se],M=()=>[...P(),Cm,km,{position:[ae,se]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],he=()=>["auto","cover","contain",mk,uk,{size:[ae,se]}],be=()=>[cu,Ui,Yr],pe=()=>["","none","full",g,ae,se],Y=()=>["",_e,Ui,Yr],we=()=>["solid","dashed","dotted","double"],ke=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],me=()=>[_e,cu,Cm,km],Be=()=>["","none",k,ae,se],mt=()=>["none",_e,ae,se],It=()=>["none",_e,ae,se],ut=()=>[_e,ae,se],tt=()=>[wr,"full",...L()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Tn],breakpoint:[Tn],color:[vv],container:[Tn],"drop-shadow":[Tn],ease:["in","out","in-out"],font:[ak],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Tn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Tn],shadow:[Tn],spacing:["px",_e],text:[Tn],"text-shadow":[Tn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",wr,se,ae,j]}],container:["container"],"container-type":[{"@container":["","normal","size",ae,se]}],"container-named":[ck],columns:[{columns:[_e,"auto",se,ae,h]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:R()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Q()}],"inset-x":[{"inset-x":Q()}],"inset-y":[{"inset-y":Q()}],start:[{"inset-s":Q(),start:Q()}],end:[{"inset-e":Q(),end:Q()}],"inset-bs":[{"inset-bs":Q()}],"inset-be":[{"inset-be":Q()}],top:[{top:Q()}],right:[{right:Q()}],bottom:[{bottom:Q()}],left:[{left:Q()}],visibility:["visible","invisible","collapse"],z:[{z:[mn,"auto",ae,se]}],basis:[{basis:[wr,"full","auto",h,...L()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[_e,wr,"auto","initial","none",se]}],grow:[{grow:["",_e,ae,se]}],shrink:[{shrink:["",_e,ae,se]}],order:[{order:[mn,"first","last","none",ae,se]}],"grid-cols":[{"grid-cols":ee()}],"col-start-end":[{col:J()}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":ee()}],"row-start-end":[{row:J()}],"row-start":[{"row-start":ne()}],"row-end":[{"row-end":ne()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":de()}],"auto-rows":[{"auto-rows":de()}],gap:[{gap:L()}],"gap-x":[{"gap-x":L()}],"gap-y":[{"gap-y":L()}],"justify-content":[{justify:[...re(),"normal"]}],"justify-items":[{"justify-items":[...ie(),"normal"]}],"justify-self":[{"justify-self":["auto",...ie()]}],"align-content":[{content:["normal",...re()]}],"align-items":[{items:[...ie(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ie(),{baseline:["","last"]}]}],"place-content":[{"place-content":re()}],"place-items":[{"place-items":[...ie(),"baseline"]}],"place-self":[{"place-self":["auto",...ie()]}],p:[{p:L()}],px:[{px:L()}],py:[{py:L()}],ps:[{ps:L()}],pe:[{pe:L()}],pbs:[{pbs:L()}],pbe:[{pbe:L()}],pt:[{pt:L()}],pr:[{pr:L()}],pb:[{pb:L()}],pl:[{pl:L()}],m:[{m:B()}],mx:[{mx:B()}],my:[{my:B()}],ms:[{ms:B()}],me:[{me:B()}],mbs:[{mbs:B()}],mbe:[{mbe:B()}],mt:[{mt:B()}],mr:[{mr:B()}],mb:[{mb:B()}],ml:[{ml:B()}],"space-x":[{"space-x":L()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":L()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...W()]}],"min-inline-size":[{"min-inline":["auto",...W()]}],"max-inline-size":[{"max-inline":["none",...W()]}],"block-size":[{block:["auto",...q()]}],"min-block-size":[{"min-block":["auto",...q()]}],"max-block-size":[{"max-block":["none",...q()]}],w:[{w:[h,"screen",...Z()]}],"min-w":[{"min-w":[h,"screen","none",...Z()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[f]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh","none",...Z()]}],"font-size":[{text:["base",i,Ui,Yr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,vk,dk]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",cu,se]}],"font-family":[{font:[hk,fk,r]}],"font-features":[{"font-features":[se]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[c,ae,se]}],"line-clamp":[{"line-clamp":[_e,"none",ae,bm]}],leading:[{leading:["none",u,...L()]}],"list-image":[{"list-image":["none",ae,se]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ae,se]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...we(),"wavy"]}],"text-decoration-thickness":[{decoration:[_e,"from-font","auto",ae,Yr]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[_e,"auto",ae,se]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"tab-size":[{tab:[mn,ae,se]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ae,se]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ae,se]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:M()}],"bg-repeat":[{bg:V()}],"bg-size":[{bg:he()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},mn,ae,se],radial:["",ae,se],conic:["",mn,ae,se]},gk,pk]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:be()}],"gradient-via-pos":[{via:be()}],"gradient-to-pos":[{to:be()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:pe()}],"rounded-s":[{"rounded-s":pe()}],"rounded-e":[{"rounded-e":pe()}],"rounded-t":[{"rounded-t":pe()}],"rounded-r":[{"rounded-r":pe()}],"rounded-b":[{"rounded-b":pe()}],"rounded-l":[{"rounded-l":pe()}],"rounded-ss":[{"rounded-ss":pe()}],"rounded-se":[{"rounded-se":pe()}],"rounded-ee":[{"rounded-ee":pe()}],"rounded-es":[{"rounded-es":pe()}],"rounded-tl":[{"rounded-tl":pe()}],"rounded-tr":[{"rounded-tr":pe()}],"rounded-br":[{"rounded-br":pe()}],"rounded-bl":[{"rounded-bl":pe()}],"border-w":[{border:Y()}],"border-w-x":[{"border-x":Y()}],"border-w-y":[{"border-y":Y()}],"border-w-s":[{"border-s":Y()}],"border-w-e":[{"border-e":Y()}],"border-w-bs":[{"border-bs":Y()}],"border-w-be":[{"border-be":Y()}],"border-w-t":[{"border-t":Y()}],"border-w-r":[{"border-r":Y()}],"border-w-b":[{"border-b":Y()}],"border-w-l":[{"border-l":Y()}],"divide-x":[{"divide-x":Y()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Y()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...we(),"hidden","none"]}],"divide-style":[{divide:[...we(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-bs":[{"border-bs":F()}],"border-color-be":[{"border-be":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...we(),"none","hidden"]}],"outline-offset":[{"outline-offset":[_e,ae,se]}],"outline-w":[{outline:["",_e,Ui,Yr]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","inner","none",y,gl,ml]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",x,gl,ml]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[_e,Yr]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":Y()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",b,gl,ml]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[_e,ae,se]}],"mix-blend":[{"mix-blend":[...ke(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ke()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[_e]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":me()}],"mask-image-t-to-pos":[{"mask-t-to":me()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":me()}],"mask-image-r-to-pos":[{"mask-r-to":me()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":me()}],"mask-image-b-to-pos":[{"mask-b-to":me()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":me()}],"mask-image-l-to-pos":[{"mask-l-to":me()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":me()}],"mask-image-x-to-pos":[{"mask-x-to":me()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":me()}],"mask-image-y-to-pos":[{"mask-y-to":me()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[ae,se]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":P()}],"mask-image-conic-pos":[{"mask-conic":[_e]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:M()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:he()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ae,se]}],filter:[{filter:["","none",ae,se]}],blur:[{blur:Be()}],brightness:[{brightness:[_e,ae,se]}],contrast:[{contrast:[_e,ae,se]}],"drop-shadow":[{"drop-shadow":["","none",C,gl,ml]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",_e,ae,se]}],"hue-rotate":[{"hue-rotate":[_e,ae,se]}],invert:[{invert:["",_e,ae,se]}],saturate:[{saturate:[_e,ae,se]}],sepia:[{sepia:["",_e,ae,se]}],"backdrop-filter":[{"backdrop-filter":["","none",ae,se]}],"backdrop-blur":[{"backdrop-blur":Be()}],"backdrop-brightness":[{"backdrop-brightness":[_e,ae,se]}],"backdrop-contrast":[{"backdrop-contrast":[_e,ae,se]}],"backdrop-grayscale":[{"backdrop-grayscale":["",_e,ae,se]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[_e,ae,se]}],"backdrop-invert":[{"backdrop-invert":["",_e,ae,se]}],"backdrop-opacity":[{"backdrop-opacity":[_e,ae,se]}],"backdrop-saturate":[{"backdrop-saturate":[_e,ae,se]}],"backdrop-sepia":[{"backdrop-sepia":["",_e,ae,se]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":L()}],"border-spacing-x":[{"border-spacing-x":L()}],"border-spacing-y":[{"border-spacing-y":L()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ae,se]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[_e,"initial",ae,se]}],ease:[{ease:["linear","initial",E,ae,se]}],delay:[{delay:[_e,ae,se]}],animate:[{animate:["none",D,ae,se]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,ae,se]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:mt()}],"rotate-x":[{"rotate-x":mt()}],"rotate-y":[{"rotate-y":mt()}],"rotate-z":[{"rotate-z":mt()}],scale:[{scale:It()}],"scale-x":[{"scale-x":It()}],"scale-y":[{"scale-y":It()}],"scale-z":[{"scale-z":It()}],"scale-3d":["scale-3d"],skew:[{skew:ut()}],"skew-x":[{"skew-x":ut()}],"skew-y":[{"skew-y":ut()}],transform:[{transform:[ae,se,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:tt()}],"translate-x":[{"translate-x":tt()}],"translate-y":[{"translate-y":tt()}],"translate-z":[{"translate-z":tt()}],"translate-none":["translate-none"],zoom:[{zoom:[mn,ae,se]}],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ae,se]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":F()}],"scrollbar-track-color":[{"scrollbar-track":F()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mbs":[{"scroll-mbs":L()}],"scroll-mbe":[{"scroll-mbe":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pbs":[{"scroll-pbs":L()}],"scroll-pbe":[{"scroll-pbe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ae,se]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[_e,Ui,Yr,bm]}],stroke:[{stroke:["none",...F()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},wk=X1(yk);function te(...n){return wk(uv(n))}const jm=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,Sm=uv,Xl=(n,r)=>i=>{var s;if((r==null?void 0:r.variants)==null)return Sm(n,i==null?void 0:i.class,i==null?void 0:i.className);const{variants:c,defaultVariants:u}=r,f=Object.keys(c).map(g=>{const y=i==null?void 0:i[g],x=u==null?void 0:u[g];if(y===null)return null;const b=jm(y)||jm(x);return c[g][b]}),h=i&&Object.entries(i).reduce((g,y)=>{let[x,b]=y;return b===void 0||(g[x]=b),g},{}),v=r==null||(s=r.compoundVariants)===null||s===void 0?void 0:s.reduce((g,y)=>{let{class:x,className:b,...C}=y;return Object.entries(C).every(k=>{let[S,j]=k;return Array.isArray(j)?j.includes({...u,...h}[S]):{...u,...h}[S]===j})?[...g,x,b]:g},[]);return Sm(n,f,v,i==null?void 0:i.class,i==null?void 0:i.className)},bk=Xl("relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 [&>svg]:text-current"}},defaultVariants:{variant:"default"}});function Hi({className:n,variant:r,...i}){return l.jsx("div",{"data-slot":"alert",role:"alert",className:te(bk({variant:r}),n),...i})}function kk({className:n,...r}){return l.jsx("div",{"data-slot":"alert-title",className:te("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",n),...r})}function Gi({className:n,...r}){return l.jsx("div",{"data-slot":"alert-description",className:te("col-start-2 grid justify-items-start gap-1 text-sm text-muted-foreground [&_p]:leading-relaxed",n),...r})}var Ck=Object.defineProperty,id=(n,r)=>Ck(n,"name",{value:r,configurable:!0});function Tu(n,r){if(typeof n=="function")return n(r);n!=null&&(n.current=r)}id(Tu,"setRef");function Sv(...n){return r=>{let i=!1;const s=n.map(c=>{const u=Tu(c,r);return!i&&typeof u=="function"&&(i=!0),u});if(i)return()=>{for(let c=0;cjk(n,"name",{value:r,configurable:!0});function $n(n){const r=m.forwardRef((i,s)=>{let{children:c,...u}=i,f=null,h=!1;const v=[];c=Tv(c),m.Children.forEach(c,b=>{var C;if(Pv(b)){h=!0;const k=b;let S="child"in k.props?k.props.child:k.props.children;for(;ld(S)&&typeof Il=="function";)S=Il(S._payload);f=Sk(k,S),v.push((C=f==null?void 0:f.props)==null?void 0:C.children)}else v.push(b)}),f?f=m.cloneElement(f,void 0,v):!h&&m.Children.count(c)===1&&m.isValidElement(c)&&(f=c);const g=f?Rv(f):void 0,y=Ie(s,g);if(!f){if(c||c===0)throw new Error(h?Nk(n):_k(n));return c}const x=Nv(u,f.props??{});return f.type!==m.Fragment&&(x.ref=s?y:g),m.cloneElement(f,x)});return r.displayName=`${n}.Slot`,r}Bt($n,"createSlot");var sd=$n("Slot"),Ev=Symbol.for("radix.slottable");function _v(n){const r=Bt(i=>"child"in i?i.children(i.child):i.children,"Slottable");return r.displayName=`${n}.Slottable`,r.__radixId=Ev,r}Bt(_v,"createSlottable");var Sk=Bt((n,r)=>"child"in n.props?m.isValidElement(r)?m.cloneElement(r,void 0,n.props.children(r.props.children)):null:m.isValidElement(r)?r:null,"getSlottableElementFromSlottable");function Nv(n,r){const i={...r};for(const s in r){const c=n[s],u=r[s];/^on[A-Z]/.test(s)?c&&u?i[s]=(...h)=>{const v=u(...h);return c(...h),v}:c&&(i[s]=c):s==="style"?i[s]={...c,...u}:s==="className"?i[s]=[c,u].filter(Boolean).join(" "):s==="aria-describedby"&&(i[s]=Ov(u,c))}return{...n,...i}}Bt(Nv,"mergeProps");function Rv(n){var s,c;let r=(s=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:s.get,i=r&&"isReactWarning"in r&&r.isReactWarning;return i?n.ref:(r=(c=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:c.get,i=r&&"isReactWarning"in r&&r.isReactWarning,i?n.props.ref:n.props.ref||n.ref)}Bt(Rv,"getElementRef");function Pv(n){return m.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===Ev}Bt(Pv,"isSlottable");var Ek=Symbol.for("react.lazy");function ld(n){return n!=null&&typeof n=="object"&&"$$typeof"in n&&n.$$typeof===Ek&&"_payload"in n&&Dv(n._payload)}Bt(ld,"isLazyComponent");function Dv(n){return typeof n=="object"&&n!==null&&"then"in n}Bt(Dv,"isPromiseLike");function Tv(n){let r=n;for(;ld(r)&&typeof Il=="function";)r=Il(r._payload);return r}Bt(Tv,"useUnwrappedLazy");function Ov(...n){const r=new Set;for(const i of n)if(typeof i=="string")for(const s of String(i).trim().split(/\s+/))s&&r.add(s);return r.size>0?Array.from(r).join(" "):void 0}Bt(Ov,"concatAriaDescribedby");var _k=Bt(n=>`${n} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),Nk=Bt(n=>`${n} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Il=Rr[" use ".trim().toString()],Rk=Object.defineProperty,Pk=(n,r)=>Rk(n,"name",{value:r,configurable:!0}),Dk=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ze=Dk.reduce((n,r)=>{const i=$n(`Primitive.${r}`),s=m.forwardRef((c,u)=>{const{asChild:f,...h}=c,v=f?i:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(v,{...h,ref:u})});return s.displayName=`Primitive.${r}`,{...n,[r]:s}},{});function ad(n,r){n&&ed.flushSync(()=>n.dispatchEvent(r))}Pk(ad,"dispatchDiscreteCustomEvent");var Tk=Object.defineProperty,Ok=(n,r)=>Tk(n,"name",{value:r,configurable:!0}),Mk=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Ak=m.forwardRef(Ok(function(r,i){return l.jsx(ze.span,{...r,ref:i,style:{...Mk,...r.style}})},"VisuallyHidden")),Ik=Object.defineProperty,Yt=(n,r)=>Ik(n,"name",{value:r,configurable:!0});function Lk(n,r){const i=m.createContext(r);i.displayName=n+"Context";const s=Yt(u=>{const{children:f,...h}=u,v=m.useMemo(()=>h,Object.values(h));return l.jsx(i.Provider,{value:v,children:f})},"Provider");s.displayName=n+"Provider";function c(u,f={}){const{optional:h=!1}=f,v=m.useContext(i);if(v)return v;if(r!==void 0)return r;if(!h)throw new Error(`\`${u}\` must be used within \`${n}\``)}return Yt(c,"useContext"),[s,c]}Yt(Lk,"createContext");function an(n,r=[]){let i=[];function s(u,f){const h=m.createContext(f);h.displayName=u+"Context";const v=i.length;i=[...i,f];const g=Yt(x=>{var E;const{scope:b,children:C,...k}=x,S=((E=b==null?void 0:b[n])==null?void 0:E[v])||h,j=m.useMemo(()=>k,Object.values(k));return l.jsx(S.Provider,{value:j,children:C})},"Provider");g.displayName=u+"Provider";function y(x,b,C={}){var E;const{optional:k=!1}=C,S=((E=b==null?void 0:b[n])==null?void 0:E[v])||h,j=m.useContext(S);if(j)return j;if(f!==void 0)return f;if(!k)throw new Error(`\`${x}\` must be used within \`${u}\``)}return Yt(y,"useContext"),[g,y]}Yt(s,"createContext");const c=Yt(()=>{const u=i.map(f=>m.createContext(f));return Yt(function(h){const v=(h==null?void 0:h[n])||u;return m.useMemo(()=>({[`__scope${n}`]:{...h,[n]:v}}),[h,v])},"useScope")},"createScope");return c.scopeName=n,[s,Mv(c,...r)]}Yt(an,"createContextScope");function Mv(...n){const r=n[0];if(n.length===1)return r;const i=Yt(()=>{const s=n.map(c=>({useScope:c(),scopeName:c.scopeName}));return Yt(function(u){const f=s.reduce((h,{useScope:v,scopeName:g})=>{const x=v(u)[`__scope${g}`];return{...h,...x}},{});return m.useMemo(()=>({[`__scope${r.scopeName}`]:f}),[f])},"useComposedScopes")},"createScope");return i.scopeName=r.scopeName,i}Yt(Mv,"composeContextScopes");var wt=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},zk=Object.defineProperty,it=(n,r)=>zk(n,"name",{value:r,configurable:!0});function cd(n){const r=n+"CollectionProvider",[i,s]=an(r),[c,u]=i(r,{collectionRef:{current:null},itemMap:new Map}),f=it(S=>{const{scope:j,children:E}=S,D=m.useRef(null),T=m.useRef(new Map).current;return l.jsx(c,{scope:j,itemMap:T,collectionRef:D,children:E})},"CollectionProvider");f.displayName=r;const h=n+"CollectionSlot",v=$n(h),g=m.forwardRef((S,j)=>{const{scope:E,children:D}=S,T=u(h,E),P=Ie(j,T.collectionRef);return l.jsx(v,{ref:P,children:D})});g.displayName=h;const y=n+"CollectionItemSlot",x="data-radix-collection-item",b=$n(y),C=m.forwardRef((S,j)=>{const{scope:E,children:D,...T}=S,P=m.useRef(null),R=Ie(j,P),N=u(y,E);return m.useEffect(()=>(N.itemMap.set(P,{ref:P,...T}),()=>void N.itemMap.delete(P))),l.jsx(b,{[x]:"",ref:R,children:D})});C.displayName=y;function k(S){const j=u(n+"CollectionConsumer",S);return m.useCallback(()=>{const D=j.collectionRef.current;if(!D)return[];const T=Array.from(D.querySelectorAll(`[${x}]`));return Array.from(j.itemMap.values()).sort((N,I)=>T.indexOf(N.ref.current)-T.indexOf(I.ref.current))},[j.collectionRef,j.itemMap])}return it(k,"useCollection"),[{Provider:f,Slot:g,ItemSlot:C},k,s]}it(cd,"createCollection");var Em=new WeakMap,Xe,Ut,vl=(Ut=class extends Map{constructor(i){super(i);Zh(this,Xe);tu(this,Xe,[...super.keys()]),Em.set(this,!0)}set(i,s){return Em.get(this)&&!this.has(i)&&ht(this,Xe).push(i),super.set(i,s),this}insert(i,s,c){const u=this.has(s),f=u?this.size:this.size+1,h=ud(i),v=h>=0?Math.min(h,f-1):Math.max(f+h,0);if(u?ht(this,Xe).indexOf(s)===v:v===this.size)return this.set(s,c),this;const g=ht(this,Xe).filter(x=>x!==s);g.splice(v,0,s);const y=g.map(x=>[x,x===s?c:this.get(x)]);this.clear();for(const[x,b]of y)this.set(x,b);return this}with(i,s,c){const u=new Ut(this);return u.insert(i,s,c),u}before(i){const s=ht(this,Xe).indexOf(i)-1;if(!(s<0))return this.entryAt(s)}setBefore(i,s,c){const u=ht(this,Xe).indexOf(i);if(u===-1)return this;const f=ht(this,Xe).indexOf(s),h=f!==-1&&f=this.size&&(u=this.size-1),this.at(u)}keyFrom(i,s){const c=this.indexOf(i);if(c===-1)return;let u=c+s;return u<0&&(u=0),u>=this.size&&(u=this.size-1),this.keyAt(u)}find(i,s){let c=0;for(const u of this){if(Reflect.apply(i,s,[u,c,this]))return u;c++}}findIndex(i,s){let c=0;for(const u of this){if(Reflect.apply(i,s,[u,c,this]))return c;c++}return-1}filter(i,s){const c=[];let u=0;for(const f of this)Reflect.apply(i,s,[f,u,this])&&c.push(f),u++;return new Ut(c)}map(i,s){const c=[];let u=0;for(const f of this)c.push([f[0],Reflect.apply(i,s,[f,u,this])]),u++;return new Ut(c)}reduce(...i){const[s,c]=i,u=i.length>1;if(!u&&this.size===0)throw new TypeError("Reduce of empty OrderedDict with no initial value");let f=0,h=c;for(const v of this)f===0&&!u?h=v:h=Reflect.apply(s,this,[h,v,f,this]),f++;return h}reduceRight(...i){const[s,c]=i,u=i.length>1;if(!u&&this.size===0)throw new TypeError("Reduce of empty OrderedDict with no initial value");let f=c;for(let h=this.size-1;h>=0;h--){const v=this.entryAt(h);h===this.size-1&&!u?f=v:f=Reflect.apply(s,this,[f,v,h,this])}return f}sort(i){if(typeof i!="function")throw new TypeError("OrderedDict.sort requires a compare function");const s=[...this.entries()].sort(i);this.clear();for(const[c,u]of s)this.set(c,u);return this}toSorted(i){if(typeof i!="function")throw new TypeError("OrderedDict.toSorted requires a compare function");const s=[...this.entries()].sort(i);return new Ut(s)}toReversed(){const i=new Ut;for(let s=this.size-1;s>=0;s--){const c=this.keyAt(s),u=this.get(c);i.set(c,u)}return i}toSpliced(...i){const s=[...this.entries()];return s.splice(...i),new Ut(s)}slice(i,s){const c=new Ut;for(const u of ht(this,Xe).slice(i,s))c.set(u,this.get(u));return c}every(i,s){let c=0;for(const u of this){if(!Reflect.apply(i,s,[u,c,this]))return!1;c++}return!0}some(i,s){let c=0;for(const u of this){if(Reflect.apply(i,s,[u,c,this]))return!0;c++}return!1}},Xe=new WeakMap,it(Ut,"OrderedDict"),Ut);function _l(n,r){if("at"in Array.prototype)return Array.prototype.at.call(n,r);const i=Av(n,r);return i===-1?void 0:n[i]}it(_l,"at");function Av(n,r){const i=n.length,s=ud(r),c=s>=0?s:i+s;return c<0||c>=i?-1:c}it(Av,"toSafeIndex");function ud(n){return n!==n||n===0?0:Math.trunc(n)}it(ud,"toSafeInteger");function Fk(n){const r=n+"CollectionProvider",[i,s]=an(r),[c,u]=i(r);c.displayName=n+"CollectionStableContextProvider";const[f,h]=i(r);f.displayName=n+"CollectionStatefulContextProvider";const v=it(({state:N,...I})=>N?l.jsx(y,{...I,state:N}):l.jsx(g,{...I}),"CollectionProvider");v.displayName=r;const g=it(N=>{const I=D();return l.jsx(y,{...N,state:I})},"CollectionInit");g.displayName=n+"CollectionInit";const y=it(N=>{const{scope:I,children:L,state:Q}=N,ee=m.useRef(null),[J,ne]=m.useState(null),de=Ie(ee,ne),[re,ie]=Q,B=m.useRef(new vl),Z=m.useCallback(()=>{const W=B.current;return zv(W)||W.sort(Nl),W},[]);return m.useEffect(()=>{if(!J)return;const W=Fv(()=>{ie(q=>{const F=q.toSorted(Nl);return F.some(([V],he)=>q.keyAt(he)!==V)?F:q})});return W.observe(J,{childList:!0,subtree:!0}),()=>{W.disconnect()}},[J,ie]),l.jsx(c,{scope:I,collectionElementRef:de,collectionElementRefObject:ee,getCollection:Z,setCollection:ie,registryRef:B,children:l.jsx(f,{scope:I,collectionElement:J,collection:re,children:L})})},"CollectionProviderImpl");y.displayName=n+"CollectionProviderImpl";const x=n+"CollectionSlot",b=$n(x),C=m.forwardRef((N,I)=>{const{scope:L,children:Q}=N,ee=u(x,L),J=Ie(I,ee.collectionElementRef);return l.jsx(b,{ref:J,children:Q})});C.displayName=x;const k=n+"CollectionItemSlot",S="data-radix-collection-item",j=$n(k),E=m.forwardRef((N,I)=>{const{scope:L,children:Q,...ee}=N,J=m.useRef(null),ne=u(k,L),{setCollection:de,registryRef:re}=ne,ie=m.useRef(ee);Iv(ie.current,ee)||(ie.current=ee);const B=ie.current,Z=m.useCallback(F=>{const M=re.current;F?M.set(F,{...ie.current,element:F}):J.current&&M.delete(J.current)},[re]),W=Ie(I,Z,J);wt(()=>{const F=J.current,M=re.current;F&&M.has(F)&&M.set(F,{...B,element:F})},[B,re]);const q=m.useRef(null);return m.useEffect(()=>{const F=J.current,M=q.current;((M==null?void 0:M.element)??null)===F&&(!F||(M==null?void 0:M.itemData)===B)||(q.current=F?{element:F,itemData:B}:null,de(V=>{const he=new vl(V);return M&&M.element!==F&&he.delete(M.element),F&&he.set(F,{...B,element:F}),he.sort(Nl)}))}),m.useEffect(()=>()=>{const F=q.current;q.current=null,F&&de(M=>{if(!M.has(F.element))return M;const V=new vl(M);return V.delete(F.element),V})},[de]),l.jsx(j,{[S]:"",ref:W,children:Q})});E.displayName=k;function D(){return m.useState(new vl)}it(D,"useInitCollection");function T(N){const{collection:I}=h(n+"CollectionConsumer",N);return I}it(T,"useCollection");function P(N){const{getCollection:I}=u(n+"CollectionConsumer",N);return I}return it(P,"useGetCollection"),[{Provider:v,Slot:C,ItemSlot:E},{createCollectionScope:s,useCollection:T,useGetCollection:P,useInitCollection:D}]}it(Fk,"createCollection");function Iv(n,r){if(n===r)return!0;if(typeof n!="object"||typeof r!="object"||n==null||r==null)return!1;const i=Object.keys(n),s=Object.keys(r);if(i.length!==s.length)return!1;for(const c of i)if(!Object.prototype.hasOwnProperty.call(r,c)||n[c]!==r[c])return!1;return!0}it(Iv,"shallowEqual");function Lv(n,r){return!!(r.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_PRECEDING)}it(Lv,"isElementPreceding");function zv(n){let r;for(const i of n.keys()){if(r){const s=r.compareDocumentPosition(i);if(!(s&Node.DOCUMENT_POSITION_DISCONNECTED)&&s&Node.DOCUMENT_POSITION_PRECEDING)return!1}r=i}return!0}it(zv,"isInDocumentOrder");function Nl(n,r){return!n[1].element||!r[1].element?0:Lv(n[1].element,r[1].element)?-1:1}it(Nl,"sortByDocumentPosition");function Fv(n){return new MutationObserver(i=>{for(const s of i)if(s.type==="childList"){n();return}})}it(Fv,"getChildListObserver");var $k=Object.defineProperty,Yo=(n,r)=>$k(n,"name",{value:r,configurable:!0}),$v=!!(typeof window<"u"&&window.document&&window.document.createElement);function Ce(n,r,{checkForDefaultPrevented:i=!0}={}){return Yo(function(c){if(n==null||n(c),i===!1||!c||!c.defaultPrevented)return r==null?void 0:r(c)},"handleEvent")}Yo(Ce,"composeEventHandlers");function Uk(n){var r;if(!$v)throw new Error("Cannot access window outside of the DOM");return((r=n==null?void 0:n.ownerDocument)==null?void 0:r.defaultView)??window}Yo(Uk,"getOwnerWindow");function Ou(n){if(!$v)throw new Error("Cannot access document outside of the DOM");return(n==null?void 0:n.ownerDocument)??document}Yo(Ou,"getOwnerDocument");function Uv(n,r=!1){const{activeElement:i}=Ou(n);if(!(i!=null&&i.nodeName))return null;if(Bv(i)&&i.contentDocument)return Uv(i.contentDocument.body,r);if(r){const s=i.getAttribute("aria-activedescendant");if(s){const c=Ou(i).getElementById(s);if(c)return c}}return i}Yo(Uv,"getActiveElement");function Bv(n){return n.tagName==="IFRAME"}Yo(Bv,"isFrame");var Bk=Object.defineProperty,Wk=(n,r)=>Bk(n,"name",{value:r,configurable:!0}),_m=Rr[" useEffectEvent ".trim().toString()],Nm=Rr[" useInsertionEffect ".trim().toString()];function Wv(n){if(typeof _m=="function")return _m(n);const r=m.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Nm=="function"?Nm(()=>{r.current=n}):wt(()=>{r.current=n}),m.useMemo(()=>((...i)=>{var s;return(s=r.current)==null?void 0:s.call(r,...i)}),[])}Wk(Wv,"useEffectEvent");var Vk=Object.defineProperty,Zi=(n,r)=>Vk(n,"name",{value:r,configurable:!0}),Hk=Rr[" useInsertionEffect ".trim().toString()]||wt;function qo({prop:n,defaultProp:r,onChange:i=Zi(()=>{},"onChange"),caller:s}){const[c,u,f]=Vv({defaultProp:r,onChange:i}),h=n!==void 0,v=h?n:c,g=m.useCallback(y=>{var x;if(h){const b=Hv(y)?y(n):y;b!==n&&((x=f.current)==null||x.call(f,b))}else u(y)},[h,n,u,f]);return[v,g]}Zi(qo,"useControllableState");function Vv({defaultProp:n,onChange:r}){const[i,s]=m.useState(n),c=m.useRef(i),u=m.useRef(r);return Hk(()=>{u.current=r},[r]),m.useEffect(()=>{var f;c.current!==i&&((f=u.current)==null||f.call(u,i),c.current=i)},[i,c]),[i,s,u]}Zi(Vv,"useUncontrolledState");function Hv(n){return typeof n=="function"}Zi(Hv,"isFunction");var Rm=Symbol("RADIX:SYNC_STATE");function Gk(n,r,i,s){const{prop:c,defaultProp:u,onChange:f,caller:h}=r,v=c!==void 0,g=Wv(f),y=[{...i,state:u}];s&&y.push(s);const[x,b]=m.useReducer((j,E)=>{if(E.type===Rm)return{...j,state:E.state};const D=n(j,E);return v&&!Object.is(D.state,j.state)&&g(D.state),D},...y),C=x.state,k=m.useRef(C);m.useEffect(()=>{k.current!==C&&(k.current=C,v||g(C))},[C,k,v]);const S=m.useMemo(()=>c!==void 0?{...x,state:c}:x,[x,c]);return m.useEffect(()=>{v&&!Object.is(c,x.state)&&b({type:Rm,state:c})},[c,x.state,v]),[S,b]}Zi(Gk,"useControllableStateReducer");var Kk=Object.defineProperty,Un=(n,r)=>Kk(n,"name",{value:r,configurable:!0});function Gv(n,r){return m.useReducer((i,s)=>r[i][s]??i,n)}Un(Gv,"useStateMachine");var Gn=Un(n=>{const{present:r,children:i}=n,s=Kv(r),c=typeof i=="function"?i({present:s.isPresent}):m.Children.only(i),u=Qv(s.ref,Yv(c));return typeof i=="function"||s.isPresent?m.cloneElement(c,{ref:u}):null},"Presence");function Kv(n){const[r,i]=m.useState(),s=m.useRef(null),c=m.useRef(n),u=m.useRef("none"),f=m.useRef(void 0),h=n?"mounted":"unmounted",[v,g]=Gv(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{v==="mounted"?(u.current=f.current??Uo(s.current),f.current=void 0):u.current="none"},[v]),wt(()=>{const y=s.current,x=c.current;if(x!==n){const C=u.current,k=Uo(y);n?(f.current=k,g("MOUNT")):k==="none"||(y==null?void 0:y.display)==="none"?g("UNMOUNT"):g(x&&C!==k?"ANIMATION_OUT":"UNMOUNT"),c.current=n}},[n,g]),wt(()=>{if(r){let y;const x=r.ownerDocument.defaultView??window,b=Un(k=>{const j=Uo(s.current).includes(CSS.escape(k.animationName));if(k.target===r&&j&&(g("ANIMATION_END"),!c.current)){const E=r.style.animationFillMode;r.style.animationFillMode="forwards",y=x.setTimeout(()=>{r.style.animationFillMode==="forwards"&&(r.style.animationFillMode=E)})}},"handleAnimationEnd"),C=Un(k=>{k.target===r&&(u.current=Uo(s.current))},"handleAnimationStart");return r.addEventListener("animationstart",C),r.addEventListener("animationcancel",b),r.addEventListener("animationend",b),()=>{x.clearTimeout(y),r.removeEventListener("animationstart",C),r.removeEventListener("animationcancel",b),r.removeEventListener("animationend",b)}}else g("ANIMATION_END")},[r,g]),{isPresent:["mounted","unmountSuspended"].includes(v),ref:m.useCallback(y=>{if(y){const x=getComputedStyle(y);s.current=x,f.current=Uo(x)}else s.current=null;i(y)},[])}}Un(Kv,"usePresence");function Mu(n,r){if(typeof n=="function")return n(r);n!=null&&(n.current=r)}Un(Mu,"setRef");function Qv(...n){const r=m.useRef(n);return r.current=n,m.useCallback(i=>{const s=r.current;let c=!1;const u=s.map(f=>{const h=Mu(f,i);return!c&&typeof h=="function"&&(c=!0),h});if(c)return()=>{for(let f=0;fQk(n,"name",{value:r,configurable:!0}),qk=Rr[" useId ".trim().toString()]||(()=>{}),Xk=0;function Sr(n){const[r,i]=m.useState(qk());return wt(()=>{n||i(s=>s??String(Xk++))},[n]),n||(r?`radix-${r}`:"")}Yk(Sr,"useId");var Jk=Object.defineProperty,Zk=(n,r)=>Jk(n,"name",{value:r,configurable:!0}),eC={LTR:"ltr"},tC=m.createContext(void 0);function dd(n){const r=m.useContext(tC);return n||r||eC.LTR}Zk(dd,"useDirection");var nC=Object.defineProperty,rC=(n,r)=>nC(n,"name",{value:r,configurable:!0}),Pm=Rr[" useInsertionEffect ".trim().toString()];function yn(n){const r=m.useRef(n);return typeof Pm=="function"?Pm(()=>{r.current=n}):wt(()=>{r.current=n}),m.useMemo(()=>((...i)=>{var s;return(s=r.current)==null?void 0:s.call(r,...i)}),[])}rC(yn,"useCallbackRef");var oC=Object.defineProperty,ct=(n,r)=>oC(n,"name",{value:r,configurable:!0}),Au="dismissableLayer.update",iC="dismissableLayer.pointerDownOutside",sC="dismissableLayer.focusOutside",Dm,qv=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),fd=m.forwardRef(ct(function(r,i){const{disableOutsidePointerEvents:s=!1,deferPointerDownOutside:c=!1,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:v,onDismiss:g,...y}=r,x=m.useContext(qv),[b,C]=m.useState(null),k=(b==null?void 0:b.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,S]=m.useState({}),j=Ie(i,C),E=Array.from(x.layers),[D]=[...x.layersWithOutsidePointerEventsDisabled].slice(-1),T=D?E.indexOf(D):-1,P=b?E.indexOf(b):-1,R=x.layersWithOutsidePointerEventsDisabled.size>0,N=P>=T,I=m.useRef(!1),L=Jv(ne=>{f==null||f(ne),v==null||v(ne),ne.defaultPrevented||g==null||g()},{ownerDocument:k,deferPointerDownOutside:c,isDeferredPointerDownOutsideRef:I,dismissableSurfaces:x.dismissableSurfaces,shouldHandlePointerDownOutside:m.useCallback(ne=>{if(!(ne instanceof Node))return!1;const de=[...x.branches].some(re=>re.contains(ne));return N&&!de},[x.branches,N])}),Q=Zv(ne=>{if(c&&I.current)return;const de=ne.target;[...x.branches].some(ie=>ie.contains(de))||(h==null||h(ne),v==null||v(ne),ne.defaultPrevented||g==null||g())},k),ee=b?P===E.length-1:!1,J=yn(ne=>{ne.key==="Escape"&&(u==null||u(ne),!ne.defaultPrevented&&g&&(ne.preventDefault(),g()))});return m.useEffect(()=>{if(ee)return k.addEventListener("keydown",J,{capture:!0}),()=>k.removeEventListener("keydown",J,{capture:!0})},[k,ee,J]),m.useEffect(()=>{if(b)return s&&(x.layersWithOutsidePointerEventsDisabled.size===0&&(Dm=k.body.style.pointerEvents,k.body.style.pointerEvents="none"),x.layersWithOutsidePointerEventsDisabled.add(b)),x.layers.add(b),Iu(),()=>{s&&(x.layersWithOutsidePointerEventsDisabled.delete(b),x.layersWithOutsidePointerEventsDisabled.size===0&&(k.body.style.pointerEvents=Dm))}},[b,k,s,x]),m.useEffect(()=>()=>{b&&(x.layers.delete(b),x.layersWithOutsidePointerEventsDisabled.delete(b),Iu())},[b,x]),m.useEffect(()=>{const ne=ct(()=>S({}),"handleUpdate");return document.addEventListener(Au,ne),()=>document.removeEventListener(Au,ne)},[]),l.jsx(ze.div,{...y,ref:j,style:{pointerEvents:R?N?"auto":"none":void 0,...r.style},onFocusCapture:Ce(r.onFocusCapture,Q.onFocusCapture),onBlurCapture:Ce(r.onBlurCapture,Q.onBlurCapture),onPointerDownCapture:Ce(r.onPointerDownCapture,L.onPointerDownCapture)})},"DismissableLayer"));function Xv(){const n=m.useContext(qv),[r,i]=m.useState(null);return m.useEffect(()=>{if(r)return n.dismissableSurfaces.add(r),()=>{n.dismissableSurfaces.delete(r)}},[r,n.dismissableSurfaces]),i}ct(Xv,"useDismissableLayerSurface");var lC=ct(()=>!0,"IS_TRUE");function Jv(n,r){const{ownerDocument:i=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:s=!1,isDeferredPointerDownOutsideRef:c,dismissableSurfaces:u,shouldHandlePointerDownOutside:f=lC}=r,h=yn(n),v=m.useRef(!1),g=m.useRef(!1),y=m.useRef(new Map),x=m.useRef(()=>{});return m.useEffect(()=>{function b(){g.current=!1,c.current=!1,y.current.clear()}ct(b,"resetOutsideInteraction");function C(){return Array.from(y.current.values()).some(Boolean)}ct(C,"isOutsideInteractionIntercepted");function k(T){if(!g.current)return;const P=T.target;P instanceof Node&&[...u].some(N=>N.contains(P))||y.current.set(T.type,!0),T.type==="click"&&window.setTimeout(()=>{g.current&&x.current()},0)}ct(k,"handleInteractionCapture");function S(T){g.current&&y.current.set(T.type,!1)}ct(S,"handleInteractionBubble");const j=ct(T=>{if(T.target&&!v.current){let P=function(){i.removeEventListener("click",x.current);const N=C();b(),N||pd(iC,h,R,{discrete:!0})};if(ct(P,"handleAndDispatchPointerDownOutsideEvent"),!f(T.target)){i.removeEventListener("click",x.current),b(),v.current=!1;return}const R={originalEvent:T};g.current=!0,c.current=s&&T.button===0,y.current.clear(),!s||T.button!==0?P():(i.removeEventListener("click",x.current),x.current=P,i.addEventListener("click",x.current,{once:!0}))}else i.removeEventListener("click",x.current),b();v.current=!1},"handlePointerDown"),E=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const T of E)i.addEventListener(T,k,!0),i.addEventListener(T,S);const D=window.setTimeout(()=>{i.addEventListener("pointerdown",j)},0);return()=>{window.clearTimeout(D),i.removeEventListener("pointerdown",j),i.removeEventListener("click",x.current);for(const T of E)i.removeEventListener(T,k,!0),i.removeEventListener(T,S)}},[i,h,s,c,u,f]),{onPointerDownCapture:ct(()=>v.current=!0,"onPointerDownCapture")}}ct(Jv,"usePointerDownOutside");function Zv(n,r=globalThis==null?void 0:globalThis.document){const i=yn(n),s=m.useRef(!1);return m.useEffect(()=>{const c=ct(u=>{u.target&&!s.current&&pd(sC,i,{originalEvent:u},{discrete:!1})},"handleFocus");return r.addEventListener("focusin",c),()=>r.removeEventListener("focusin",c)},[r,i]),{onFocusCapture:ct(()=>s.current=!0,"onFocusCapture"),onBlurCapture:ct(()=>s.current=!1,"onBlurCapture")}}ct(Zv,"useFocusOutside");function Iu(){const n=new CustomEvent(Au);document.dispatchEvent(n)}ct(Iu,"dispatchUpdate");function pd(n,r,i,{discrete:s}){const c=i.originalEvent.target,u=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:i});r&&c.addEventListener(n,r,{once:!0}),s?ad(c,u):c.dispatchEvent(u)}ct(pd,"handleAndDispatchCustomEvent");var aC=Object.defineProperty,Ze=(n,r)=>aC(n,"name",{value:r,configurable:!0}),uu="focusScope.autoFocusOnMount",du="focusScope.autoFocusOnUnmount",Tm={bubbles:!1,cancelable:!0},ex=m.forwardRef(Ze(function(r,i){const{loop:s=!1,trapped:c=!1,branches:u,onMountAutoFocus:f,onUnmountAutoFocus:h,...v}=r,[g,y]=m.useState(null),x=yn(f),b=yn(h),C=m.useRef(null),k=Ie(i,y),S=m.useRef(u);m.useEffect(()=>{S.current=u});const j=m.useCallback(T=>{var P;return T?g!=null&&g.contains(T)?!0:!!((P=S.current)!=null&&P.some(R=>R.contains(T))):!1},[g]),E=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(c){let T=function(I){if(E.paused||!g)return;const L=I.target;j(L)?C.current=L:Mn(C.current,{select:!0})},P=function(I){if(E.paused||!g)return;const L=I.relatedTarget;L!==null&&(j(L)||Mn(C.current,{select:!0}))},R=function(I){if(document.activeElement===document.body)for(const Q of I)Q.removedNodes.length>0&&Mn(g)};Ze(T,"handleFocusIn"),Ze(P,"handleFocusOut"),Ze(R,"handleMutations"),document.addEventListener("focusin",T),document.addEventListener("focusout",P);const N=new MutationObserver(R);return g&&N.observe(g,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",T),document.removeEventListener("focusout",P),N.disconnect()}}},[c,g,E.paused,j]),m.useEffect(()=>{if(g){Om.add(E);const T=document.activeElement;if(!g.contains(T)){const R=new CustomEvent(uu,Tm);g.addEventListener(uu,x),g.dispatchEvent(R),R.defaultPrevented||(nx(lx(vd(g)),{select:!0}),document.activeElement===T&&Mn(g))}return()=>{g.removeEventListener(uu,x);const R=g.ownerDocument,N=CustomEvent;setTimeout(()=>{const I=new N(du,Tm);g.addEventListener(du,b),g.dispatchEvent(I),I.defaultPrevented||Mn(T??R.body,{select:!0}),g.removeEventListener(du,b),Om.remove(E)},0)}}},[g,x,b,E]);const D=m.useCallback(T=>{if(!s&&!c||E.paused)return;const P=T.key==="Tab"&&!T.altKey&&!T.ctrlKey&&!T.metaKey,R=document.activeElement;if(P&&R){const N=T.currentTarget,[I,L]=rx(N);I&&L?!T.shiftKey&&R===L?(T.preventDefault(),s&&Mn(I,{select:!0})):T.shiftKey&&R===I&&(T.preventDefault(),s&&Mn(L,{select:!0})):R===N&&T.preventDefault()}},[s,c,E.paused]);return l.jsx(ze.div,{tabIndex:-1,...v,ref:k,onKeyDown:D})},"FocusScope")),tx=m.createContext(null);function hd({registry:n,children:r}){return n?l.jsx(tx.Provider,{value:n,children:r}):r}Ze(hd,"FocusScopeBranchProvider");function md(){const[n,r]=m.useState([]),i=m.useMemo(()=>({add:Ze(s=>r(c=>c.includes(s)?c:[...c,s]),"add"),remove:Ze(s=>r(c=>c.filter(u=>u!==s)),"remove")}),[]);return{nodes:n,registry:i}}Ze(md,"useFocusScopeBranchRegistry");function gd(n){const r=m.useContext(tx);m.useEffect(()=>{if(!(!n||!r))return r.add(n),()=>r.remove(n)},[n,r])}Ze(gd,"useFocusScopeBranch");function nx(n,{select:r=!1}={}){const i=document.activeElement;for(const s of n)if(Mn(s,{select:r}),document.activeElement!==i)return}Ze(nx,"focusFirst");function rx(n){const r=vd(n),i=Lu(r,n),s=Lu(r.reverse(),n);return[i,s]}Ze(rx,"getTabbableEdges");function vd(n){const r=[],s=n.ownerDocument.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:Ze(c=>{const u=c.tagName==="INPUT"&&c.type==="hidden";return c.disabled||c.hidden||u?NodeFilter.FILTER_SKIP:c.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;s.nextNode();)r.push(s.currentNode);return r}Ze(vd,"getTabbableCandidates");function Lu(n,r){const i=typeof r.checkVisibility=="function"&&r.checkVisibility({checkVisibilityCSS:!0});for(const s of n)if(!(i?!s.checkVisibility({checkVisibilityCSS:!0}):ox(s,{upTo:r})))return s}Ze(Lu,"findVisible");function ox(n,{upTo:r}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(r!==void 0&&n===r)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}Ze(ox,"isHidden");function ix(n){return n.tagName==="INPUT"&&typeof n.select=="function"}Ze(ix,"isSelectableInput");function Mn(n,{select:r=!1}={}){if(n&&n.focus){const s=(n.ownerDocument??document).activeElement;n.focus({preventScroll:!0}),n!==s&&ix(n)&&r&&n.select()}}Ze(Mn,"focus");var Om=sx();function sx(){let n=[];return{add(r){const i=n[0];r!==i&&(i==null||i.pause()),n=zu(n,r),n.unshift(r)},remove(r){var i;n=zu(n,r),(i=n[0])==null||i.resume()}}}Ze(sx,"createFocusScopesStack");function zu(n,r){const i=[...n],s=i.indexOf(r);return s!==-1&&i.splice(s,1),i}Ze(zu,"arrayRemove");function lx(n){return n.filter(r=>r.tagName!=="A")}Ze(lx,"removeLinks");var cC=Object.defineProperty,uC=(n,r)=>cC(n,"name",{value:r,configurable:!0}),xd=m.forwardRef(uC(function(r,i){var v;const{container:s,...c}=r,[u,f]=m.useState(!1);wt(()=>f(!0),[]);const h=s||u&&((v=globalThis==null?void 0:globalThis.document)==null?void 0:v.body);return h?ed.createPortal(l.jsx(ze.div,{...c,ref:i}),h):null},"Portal")),dC=Object.defineProperty,yd=(n,r)=>dC(n,"name",{value:r,configurable:!0}),xl=0,gn=null;function fC(n){return Jl(),n.children}yd(fC,"FocusGuards");function Jl(){m.useEffect(()=>{gn||(gn={start:Fu(),end:Fu()});const{start:n,end:r}=gn;return document.body.firstElementChild!==n&&document.body.insertAdjacentElement("afterbegin",n),document.body.lastElementChild!==r&&document.body.insertAdjacentElement("beforeend",r),xl++,()=>{xl===1&&(gn==null||gn.start.remove(),gn==null||gn.end.remove(),gn=null),xl=Math.max(0,xl-1)}},[])}yd(Jl,"useFocusGuards");function Fu(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.outline="none",n.style.opacity="0",n.style.position="fixed",n.style.pointerEvents="none",n}yd(Fu,"createFocusGuard");var vn=function(){return vn=Object.assign||function(r){for(var i,s=1,c=arguments.length;s"u")return NC;var r=RC(n),i=document.documentElement.clientWidth,s=window.innerWidth;return{left:r[0],top:r[1],right:r[2],gap:Math.max(0,s-i+r[2]-r[0])}},DC=dx(),Bo="data-scroll-locked",TC=function(n,r,i,s){var c=n.left,u=n.top,f=n.right,h=n.gap;return i===void 0&&(i="margin"),` - .`.concat(hC,` { - overflow: hidden `).concat(s,`; - padding-right: `).concat(h,"px ").concat(s,`; + */const sv={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};sv.node;const lv=Te(sv);let av="";function R1(n){av=n}class vm extends Error{constructor(r,i){super(r),this.status=i}}async function ql(n,r,i){const l={};n!=="GET"&&(l["X-CSRF-Token"]=av),i!==void 0&&(l["Content-Type"]="application/json");const c=await fetch(r,{method:n,headers:l,cache:"no-store",body:i===void 0?void 0:JSON.stringify(i)});if(c.status===401)throw location.href="/admin/login?next="+encodeURIComponent(location.pathname),new vm("signed out",401);const u=await c.json().catch(()=>({}));if(!c.ok)throw new vm(u&&u.error||"HTTP "+c.status,c.status);return u}const Ct=n=>ql("GET",n),Fn=(n,r)=>ql("POST",n,r),oo=(n,r)=>ql("PUT",n,r),Ji=n=>ql("DELETE",n);function Pu(n){const r=new URLSearchParams;for(const[l,c]of Object.entries(n))c!=null&&c!==""&&r.set(l,String(c));const i=r.toString();return i?"?"+i:""}function cv(n){var r,i,l="";if(typeof n=="string"||typeof n=="number")l+=n;else if(typeof n=="object")if(Array.isArray(n)){var c=n.length;for(r=0;r{const i=new Array(n.length+r.length);for(let l=0;l({classGroupId:n,validator:r}),dv=(n=new Map,r=null,i)=>({nextPart:n,validators:r,classGroupId:i}),Al="-",xm=[],T1="arbitrary..",O1=n=>{const r=A1(n),{conflictingClassGroups:i,conflictingClassGroupModifiers:l}=n;return{getClassGroupId:f=>{if(f.startsWith("[")&&f.endsWith("]"))return M1(f);const h=f.split(Al),v=h[0]===""&&h.length>1?1:0;return fv(h,v,r)},getConflictingClassGroupIds:(f,h)=>{if(h){const v=l[f],g=i[f];return v?g?P1(g,v):v:g||xm}return i[f]||xm}}},fv=(n,r,i)=>{if(n.length-r===0)return i.classGroupId;const c=n[r],u=i.nextPart.get(c);if(u){const g=fv(n,r+1,u);if(g)return g}const f=i.validators;if(f===null)return;const h=r===0?n.join(Al):n.slice(r).join(Al),v=f.length;for(let g=0;gn.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const r=n.slice(1,-1),i=r.indexOf(":"),l=r.slice(0,i);return l?T1+l:void 0})(),A1=n=>{const{theme:r,classGroups:i}=n;return I1(i,r)},I1=(n,r)=>{const i=dv();for(const l in n){const c=n[l];rd(c,i,l,r)}return i},rd=(n,r,i,l)=>{const c=n.length;for(let u=0;u{if(typeof n=="string"){z1(n,r,i);return}if(typeof n=="function"){F1(n,r,i,l);return}$1(n,r,i,l)},z1=(n,r,i)=>{const l=n===""?r:pv(r,n);l.classGroupId=i},F1=(n,r,i,l)=>{if(U1(n)){rd(n(l),r,i,l);return}r.validators===null&&(r.validators=[]),r.validators.push(D1(i,n))},$1=(n,r,i,l)=>{const c=Object.entries(n),u=c.length;for(let f=0;f{let i=n;const l=r.split(Al),c=l.length;for(let u=0;u"isThemeGetter"in n&&n.isThemeGetter===!0,B1=n=>{if(n<1)return{get:()=>{},set:()=>{}};let r=0,i=Object.create(null),l=Object.create(null);const c=(u,f)=>{i[u]=f,r++,r>n&&(r=0,l=i,i=Object.create(null))};return{get(u){let f=i[u];if(f!==void 0)return f;if((f=l[u])!==void 0)return c(u,f),f},set(u,f){u in i?i[u]=f:c(u,f)}}},Du="!",ym=":",W1=[],wm=(n,r,i,l,c)=>({modifiers:n,hasImportantModifier:r,baseClassName:i,maybePostfixModifierPosition:l,isExternal:c}),V1=n=>{const{prefix:r,experimentalParseClassName:i}=n;let l=c=>{const u=[];let f=0,h=0,v=0,g;const y=c.length;for(let S=0;Sv?g-v:void 0;return wm(u,j,b,k)};if(r){const c=r+ym,u=l;l=f=>f.startsWith(c)?u(f.slice(c.length)):wm(W1,!1,f,void 0,!0)}if(i){const c=l;l=u=>i({className:u,parseClassName:c})}return l},H1=n=>{const r=new Map;return n.orderSensitiveModifiers.forEach((i,l)=>{r.set(i,1e6+l)}),i=>{const l=[];let c=[];for(let u=0;u0&&(c.sort(),l.push(...c),c=[]),l.push(f)):c.push(f)}return c.length>0&&(c.sort(),l.push(...c)),l}},G1=n=>({cache:B1(n.cacheSize),parseClassName:V1(n),sortModifiers:H1(n),postfixLookupClassGroupIds:K1(n),...O1(n)}),K1=n=>{const r=Object.create(null),i=n.postfixLookupClassGroups;if(i)for(let l=0;l{const{parseClassName:i,getClassGroupId:l,getConflictingClassGroupIds:c,sortModifiers:u,postfixLookupClassGroupIds:f}=r,h=[],v=n.trim().split(Q1);let g="";for(let y=v.length-1;y>=0;y-=1){const x=v[y],{isExternal:b,modifiers:j,hasImportantModifier:k,baseClassName:S,maybePostfixModifierPosition:C}=i(x);if(b){g=x+(g.length>0?" "+g:g);continue}let E=!!C,D;if(E){const I=S.substring(0,C);D=l(I);const L=D&&f[D]?l(S):void 0;L&&L!==D&&(D=L,E=!1)}else D=l(S);if(!D){if(!E){g=x+(g.length>0?" "+g:g);continue}if(D=l(S),!D){g=x+(g.length>0?" "+g:g);continue}E=!1}const T=j.length===0?"":j.length===1?j[0]:u(j).join(":"),P=k?T+Du:T,R=P+D;if(h.indexOf(R)>-1)continue;h.push(R);const N=c(D,E);for(let I=0;I0?" "+g:g)}return g},q1=(...n)=>{let r=0,i,l,c="";for(;r{if(typeof n=="string")return n;let r,i="";for(let l=0;l{let i,l,c,u;const f=v=>{const g=r.reduce((y,x)=>x(y),n());return i=G1(g),l=i.cache.get,c=i.cache.set,u=h,h(v)},h=v=>{const g=l(v);if(g)return g;const y=Y1(v,i);return c(v,y),y};return u=f,(...v)=>u(q1(...v))},J1=[],ot=n=>{const r=i=>i[n]||J1;return r.isThemeGetter=!0,r.themeKey=n,r},mv=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,gv=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Z1=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ek=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,tk=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,nk=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,rk=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ok=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wr=n=>Z1.test(n),_e=n=>!!n&&!Number.isNaN(Number(n)),mn=n=>!!n&&Number.isInteger(Number(n)),cu=n=>n.endsWith("%")&&_e(n.slice(0,-1)),On=n=>ek.test(n),vv=()=>!0,ik=n=>tk.test(n)&&!nk.test(n),od=()=>!1,sk=n=>rk.test(n),lk=n=>ok.test(n),ak=n=>!se(n)&&!ae(n),ck=n=>n.startsWith("@container")&&(n[10]==="/"&&n[11]!==void 0||n[11]==="s"&&n[16]!==void 0&&n.startsWith("-size/",10)||n[11]==="n"&&n[18]!==void 0&&n.startsWith("-normal/",10)),uk=n=>Tr(n,wv,od),se=n=>mv.test(n),Yr=n=>Tr(n,bv,ik),bm=n=>Tr(n,xk,_e),dk=n=>Tr(n,jv,vv),fk=n=>Tr(n,kv,od),km=n=>Tr(n,xv,od),pk=n=>Tr(n,yv,lk),ml=n=>Tr(n,Cv,sk),ae=n=>gv.test(n),Ui=n=>io(n,bv),hk=n=>io(n,kv),jm=n=>io(n,xv),mk=n=>io(n,wv),gk=n=>io(n,yv),gl=n=>io(n,Cv,!0),vk=n=>io(n,jv,!0),Tr=(n,r,i)=>{const l=mv.exec(n);return l?l[1]?r(l[1]):i(l[2]):!1},io=(n,r,i=!1)=>{const l=gv.exec(n);return l?l[1]?r(l[1]):i:!1},xv=n=>n==="position"||n==="percentage",yv=n=>n==="image"||n==="url",wv=n=>n==="length"||n==="size"||n==="bg-size",bv=n=>n==="length",xk=n=>n==="number",kv=n=>n==="family-name",jv=n=>n==="number"||n==="weight",Cv=n=>n==="shadow",yk=()=>{const n=ot("color"),r=ot("font"),i=ot("text"),l=ot("font-weight"),c=ot("tracking"),u=ot("leading"),f=ot("breakpoint"),h=ot("container"),v=ot("spacing"),g=ot("radius"),y=ot("shadow"),x=ot("inset-shadow"),b=ot("text-shadow"),j=ot("drop-shadow"),k=ot("blur"),S=ot("perspective"),C=ot("aspect"),E=ot("ease"),D=ot("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[...P(),ae,se],N=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],L=()=>[ae,se,v],Q=()=>[wr,"full","auto",...L()],ee=()=>[mn,"none","subgrid",ae,se],J=()=>["auto",{span:["full",mn,ae,se]},mn,ae,se],ne=()=>[mn,"auto",ae,se],de=()=>["auto","min","max","fr",ae,se],re=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ie=()=>["start","end","center","stretch","center-safe","end-safe"],B=()=>["auto",...L()],Z=()=>[wr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...L()],W=()=>[h,wr,"screen","full","dvw","lvw","svw","min","max","fit",...L()],q=()=>[wr,"screen","full","lh","dvh","lvh","svh","min","max","fit",...L()],F=()=>[n,ae,se],M=()=>[...P(),jm,km,{position:[ae,se]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],he=()=>["auto","cover","contain",mk,uk,{size:[ae,se]}],be=()=>[cu,Ui,Yr],pe=()=>["","none","full",g,ae,se],Y=()=>["",_e,Ui,Yr],we=()=>["solid","dashed","dotted","double"],ke=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],me=()=>[_e,cu,jm,km],Be=()=>["","none",k,ae,se],mt=()=>["none",_e,ae,se],It=()=>["none",_e,ae,se],ut=()=>[_e,ae,se],tt=()=>[wr,"full",...L()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[On],breakpoint:[On],color:[vv],container:[On],"drop-shadow":[On],ease:["in","out","in-out"],font:[ak],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[On],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[On],shadow:[On],spacing:["px",_e],text:[On],"text-shadow":[On],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",wr,se,ae,C]}],container:["container"],"container-type":[{"@container":["","normal","size",ae,se]}],"container-named":[ck],columns:[{columns:[_e,"auto",se,ae,h]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:R()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Q()}],"inset-x":[{"inset-x":Q()}],"inset-y":[{"inset-y":Q()}],start:[{"inset-s":Q(),start:Q()}],end:[{"inset-e":Q(),end:Q()}],"inset-bs":[{"inset-bs":Q()}],"inset-be":[{"inset-be":Q()}],top:[{top:Q()}],right:[{right:Q()}],bottom:[{bottom:Q()}],left:[{left:Q()}],visibility:["visible","invisible","collapse"],z:[{z:[mn,"auto",ae,se]}],basis:[{basis:[wr,"full","auto",h,...L()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[_e,wr,"auto","initial","none",se]}],grow:[{grow:["",_e,ae,se]}],shrink:[{shrink:["",_e,ae,se]}],order:[{order:[mn,"first","last","none",ae,se]}],"grid-cols":[{"grid-cols":ee()}],"col-start-end":[{col:J()}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":ee()}],"row-start-end":[{row:J()}],"row-start":[{"row-start":ne()}],"row-end":[{"row-end":ne()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":de()}],"auto-rows":[{"auto-rows":de()}],gap:[{gap:L()}],"gap-x":[{"gap-x":L()}],"gap-y":[{"gap-y":L()}],"justify-content":[{justify:[...re(),"normal"]}],"justify-items":[{"justify-items":[...ie(),"normal"]}],"justify-self":[{"justify-self":["auto",...ie()]}],"align-content":[{content:["normal",...re()]}],"align-items":[{items:[...ie(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ie(),{baseline:["","last"]}]}],"place-content":[{"place-content":re()}],"place-items":[{"place-items":[...ie(),"baseline"]}],"place-self":[{"place-self":["auto",...ie()]}],p:[{p:L()}],px:[{px:L()}],py:[{py:L()}],ps:[{ps:L()}],pe:[{pe:L()}],pbs:[{pbs:L()}],pbe:[{pbe:L()}],pt:[{pt:L()}],pr:[{pr:L()}],pb:[{pb:L()}],pl:[{pl:L()}],m:[{m:B()}],mx:[{mx:B()}],my:[{my:B()}],ms:[{ms:B()}],me:[{me:B()}],mbs:[{mbs:B()}],mbe:[{mbe:B()}],mt:[{mt:B()}],mr:[{mr:B()}],mb:[{mb:B()}],ml:[{ml:B()}],"space-x":[{"space-x":L()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":L()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...W()]}],"min-inline-size":[{"min-inline":["auto",...W()]}],"max-inline-size":[{"max-inline":["none",...W()]}],"block-size":[{block:["auto",...q()]}],"min-block-size":[{"min-block":["auto",...q()]}],"max-block-size":[{"max-block":["none",...q()]}],w:[{w:[h,"screen",...Z()]}],"min-w":[{"min-w":[h,"screen","none",...Z()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[f]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh","none",...Z()]}],"font-size":[{text:["base",i,Ui,Yr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[l,vk,dk]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",cu,se]}],"font-family":[{font:[hk,fk,r]}],"font-features":[{"font-features":[se]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[c,ae,se]}],"line-clamp":[{"line-clamp":[_e,"none",ae,bm]}],leading:[{leading:["none",u,...L()]}],"list-image":[{"list-image":["none",ae,se]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ae,se]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...we(),"wavy"]}],"text-decoration-thickness":[{decoration:[_e,"from-font","auto",ae,Yr]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[_e,"auto",ae,se]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"tab-size":[{tab:[mn,ae,se]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ae,se]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ae,se]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:M()}],"bg-repeat":[{bg:V()}],"bg-size":[{bg:he()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},mn,ae,se],radial:["",ae,se],conic:["",mn,ae,se]},gk,pk]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:be()}],"gradient-via-pos":[{via:be()}],"gradient-to-pos":[{to:be()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:pe()}],"rounded-s":[{"rounded-s":pe()}],"rounded-e":[{"rounded-e":pe()}],"rounded-t":[{"rounded-t":pe()}],"rounded-r":[{"rounded-r":pe()}],"rounded-b":[{"rounded-b":pe()}],"rounded-l":[{"rounded-l":pe()}],"rounded-ss":[{"rounded-ss":pe()}],"rounded-se":[{"rounded-se":pe()}],"rounded-ee":[{"rounded-ee":pe()}],"rounded-es":[{"rounded-es":pe()}],"rounded-tl":[{"rounded-tl":pe()}],"rounded-tr":[{"rounded-tr":pe()}],"rounded-br":[{"rounded-br":pe()}],"rounded-bl":[{"rounded-bl":pe()}],"border-w":[{border:Y()}],"border-w-x":[{"border-x":Y()}],"border-w-y":[{"border-y":Y()}],"border-w-s":[{"border-s":Y()}],"border-w-e":[{"border-e":Y()}],"border-w-bs":[{"border-bs":Y()}],"border-w-be":[{"border-be":Y()}],"border-w-t":[{"border-t":Y()}],"border-w-r":[{"border-r":Y()}],"border-w-b":[{"border-b":Y()}],"border-w-l":[{"border-l":Y()}],"divide-x":[{"divide-x":Y()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Y()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...we(),"hidden","none"]}],"divide-style":[{divide:[...we(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-bs":[{"border-bs":F()}],"border-color-be":[{"border-be":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...we(),"none","hidden"]}],"outline-offset":[{"outline-offset":[_e,ae,se]}],"outline-w":[{outline:["",_e,Ui,Yr]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","inner","none",y,gl,ml]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",x,gl,ml]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[_e,Yr]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":Y()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",b,gl,ml]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[_e,ae,se]}],"mix-blend":[{"mix-blend":[...ke(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ke()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[_e]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":me()}],"mask-image-t-to-pos":[{"mask-t-to":me()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":me()}],"mask-image-r-to-pos":[{"mask-r-to":me()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":me()}],"mask-image-b-to-pos":[{"mask-b-to":me()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":me()}],"mask-image-l-to-pos":[{"mask-l-to":me()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":me()}],"mask-image-x-to-pos":[{"mask-x-to":me()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":me()}],"mask-image-y-to-pos":[{"mask-y-to":me()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[ae,se]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":P()}],"mask-image-conic-pos":[{"mask-conic":[_e]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:M()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:he()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ae,se]}],filter:[{filter:["","none",ae,se]}],blur:[{blur:Be()}],brightness:[{brightness:[_e,ae,se]}],contrast:[{contrast:[_e,ae,se]}],"drop-shadow":[{"drop-shadow":["","none",j,gl,ml]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",_e,ae,se]}],"hue-rotate":[{"hue-rotate":[_e,ae,se]}],invert:[{invert:["",_e,ae,se]}],saturate:[{saturate:[_e,ae,se]}],sepia:[{sepia:["",_e,ae,se]}],"backdrop-filter":[{"backdrop-filter":["","none",ae,se]}],"backdrop-blur":[{"backdrop-blur":Be()}],"backdrop-brightness":[{"backdrop-brightness":[_e,ae,se]}],"backdrop-contrast":[{"backdrop-contrast":[_e,ae,se]}],"backdrop-grayscale":[{"backdrop-grayscale":["",_e,ae,se]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[_e,ae,se]}],"backdrop-invert":[{"backdrop-invert":["",_e,ae,se]}],"backdrop-opacity":[{"backdrop-opacity":[_e,ae,se]}],"backdrop-saturate":[{"backdrop-saturate":[_e,ae,se]}],"backdrop-sepia":[{"backdrop-sepia":["",_e,ae,se]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":L()}],"border-spacing-x":[{"border-spacing-x":L()}],"border-spacing-y":[{"border-spacing-y":L()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ae,se]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[_e,"initial",ae,se]}],ease:[{ease:["linear","initial",E,ae,se]}],delay:[{delay:[_e,ae,se]}],animate:[{animate:["none",D,ae,se]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,ae,se]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:mt()}],"rotate-x":[{"rotate-x":mt()}],"rotate-y":[{"rotate-y":mt()}],"rotate-z":[{"rotate-z":mt()}],scale:[{scale:It()}],"scale-x":[{"scale-x":It()}],"scale-y":[{"scale-y":It()}],"scale-z":[{"scale-z":It()}],"scale-3d":["scale-3d"],skew:[{skew:ut()}],"skew-x":[{"skew-x":ut()}],"skew-y":[{"skew-y":ut()}],transform:[{transform:[ae,se,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:tt()}],"translate-x":[{"translate-x":tt()}],"translate-y":[{"translate-y":tt()}],"translate-z":[{"translate-z":tt()}],"translate-none":["translate-none"],zoom:[{zoom:[mn,ae,se]}],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ae,se]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":F()}],"scrollbar-track-color":[{"scrollbar-track":F()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mbs":[{"scroll-mbs":L()}],"scroll-mbe":[{"scroll-mbe":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pbs":[{"scroll-pbs":L()}],"scroll-pbe":[{"scroll-pbe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ae,se]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[_e,Ui,Yr,bm]}],stroke:[{stroke:["none",...F()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},wk=X1(yk);function te(...n){return wk(uv(n))}const Cm=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,Sm=uv,Xl=(n,r)=>i=>{var l;if((r==null?void 0:r.variants)==null)return Sm(n,i==null?void 0:i.class,i==null?void 0:i.className);const{variants:c,defaultVariants:u}=r,f=Object.keys(c).map(g=>{const y=i==null?void 0:i[g],x=u==null?void 0:u[g];if(y===null)return null;const b=Cm(y)||Cm(x);return c[g][b]}),h=i&&Object.entries(i).reduce((g,y)=>{let[x,b]=y;return b===void 0||(g[x]=b),g},{}),v=r==null||(l=r.compoundVariants)===null||l===void 0?void 0:l.reduce((g,y)=>{let{class:x,className:b,...j}=y;return Object.entries(j).every(k=>{let[S,C]=k;return Array.isArray(C)?C.includes({...u,...h}[S]):{...u,...h}[S]===C})?[...g,x,b]:g},[]);return Sm(n,f,v,i==null?void 0:i.class,i==null?void 0:i.className)},bk=Xl("relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 [&>svg]:text-current"}},defaultVariants:{variant:"default"}});function Hi({className:n,variant:r,...i}){return s.jsx("div",{"data-slot":"alert",role:"alert",className:te(bk({variant:r}),n),...i})}function kk({className:n,...r}){return s.jsx("div",{"data-slot":"alert-title",className:te("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",n),...r})}function Gi({className:n,...r}){return s.jsx("div",{"data-slot":"alert-description",className:te("col-start-2 grid justify-items-start gap-1 text-sm text-muted-foreground [&_p]:leading-relaxed",n),...r})}var jk=Object.defineProperty,id=(n,r)=>jk(n,"name",{value:r,configurable:!0});function Tu(n,r){if(typeof n=="function")return n(r);n!=null&&(n.current=r)}id(Tu,"setRef");function Sv(...n){return r=>{let i=!1;const l=n.map(c=>{const u=Tu(c,r);return!i&&typeof u=="function"&&(i=!0),u});if(i)return()=>{for(let c=0;cCk(n,"name",{value:r,configurable:!0});function $n(n){const r=m.forwardRef((i,l)=>{let{children:c,...u}=i,f=null,h=!1;const v=[];c=Tv(c),m.Children.forEach(c,b=>{var j;if(Pv(b)){h=!0;const k=b;let S="child"in k.props?k.props.child:k.props.children;for(;ld(S)&&typeof Il=="function";)S=Il(S._payload);f=Sk(k,S),v.push((j=f==null?void 0:f.props)==null?void 0:j.children)}else v.push(b)}),f?f=m.cloneElement(f,void 0,v):!h&&m.Children.count(c)===1&&m.isValidElement(c)&&(f=c);const g=f?Rv(f):void 0,y=Ie(l,g);if(!f){if(c||c===0)throw new Error(h?Nk(n):_k(n));return c}const x=Nv(u,f.props??{});return f.type!==m.Fragment&&(x.ref=l?y:g),m.cloneElement(f,x)});return r.displayName=`${n}.Slot`,r}Bt($n,"createSlot");var sd=$n("Slot"),Ev=Symbol.for("radix.slottable");function _v(n){const r=Bt(i=>"child"in i?i.children(i.child):i.children,"Slottable");return r.displayName=`${n}.Slottable`,r.__radixId=Ev,r}Bt(_v,"createSlottable");var Sk=Bt((n,r)=>"child"in n.props?m.isValidElement(r)?m.cloneElement(r,void 0,n.props.children(r.props.children)):null:m.isValidElement(r)?r:null,"getSlottableElementFromSlottable");function Nv(n,r){const i={...r};for(const l in r){const c=n[l],u=r[l];/^on[A-Z]/.test(l)?c&&u?i[l]=(...h)=>{const v=u(...h);return c(...h),v}:c&&(i[l]=c):l==="style"?i[l]={...c,...u}:l==="className"?i[l]=[c,u].filter(Boolean).join(" "):l==="aria-describedby"&&(i[l]=Ov(u,c))}return{...n,...i}}Bt(Nv,"mergeProps");function Rv(n){var l,c;let r=(l=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:l.get,i=r&&"isReactWarning"in r&&r.isReactWarning;return i?n.ref:(r=(c=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:c.get,i=r&&"isReactWarning"in r&&r.isReactWarning,i?n.props.ref:n.props.ref||n.ref)}Bt(Rv,"getElementRef");function Pv(n){return m.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===Ev}Bt(Pv,"isSlottable");var Ek=Symbol.for("react.lazy");function ld(n){return n!=null&&typeof n=="object"&&"$$typeof"in n&&n.$$typeof===Ek&&"_payload"in n&&Dv(n._payload)}Bt(ld,"isLazyComponent");function Dv(n){return typeof n=="object"&&n!==null&&"then"in n}Bt(Dv,"isPromiseLike");function Tv(n){let r=n;for(;ld(r)&&typeof Il=="function";)r=Il(r._payload);return r}Bt(Tv,"useUnwrappedLazy");function Ov(...n){const r=new Set;for(const i of n)if(typeof i=="string")for(const l of String(i).trim().split(/\s+/))l&&r.add(l);return r.size>0?Array.from(r).join(" "):void 0}Bt(Ov,"concatAriaDescribedby");var _k=Bt(n=>`${n} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),Nk=Bt(n=>`${n} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Il=Rr[" use ".trim().toString()],Rk=Object.defineProperty,Pk=(n,r)=>Rk(n,"name",{value:r,configurable:!0}),Dk=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ze=Dk.reduce((n,r)=>{const i=$n(`Primitive.${r}`),l=m.forwardRef((c,u)=>{const{asChild:f,...h}=c,v=f?i:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(v,{...h,ref:u})});return l.displayName=`Primitive.${r}`,{...n,[r]:l}},{});function ad(n,r){n&&ed.flushSync(()=>n.dispatchEvent(r))}Pk(ad,"dispatchDiscreteCustomEvent");var Tk=Object.defineProperty,Ok=(n,r)=>Tk(n,"name",{value:r,configurable:!0}),Mk=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Ak=m.forwardRef(Ok(function(r,i){return s.jsx(ze.span,{...r,ref:i,style:{...Mk,...r.style}})},"VisuallyHidden")),Ik=Object.defineProperty,Yt=(n,r)=>Ik(n,"name",{value:r,configurable:!0});function Lk(n,r){const i=m.createContext(r);i.displayName=n+"Context";const l=Yt(u=>{const{children:f,...h}=u,v=m.useMemo(()=>h,Object.values(h));return s.jsx(i.Provider,{value:v,children:f})},"Provider");l.displayName=n+"Provider";function c(u,f={}){const{optional:h=!1}=f,v=m.useContext(i);if(v)return v;if(r!==void 0)return r;if(!h)throw new Error(`\`${u}\` must be used within \`${n}\``)}return Yt(c,"useContext"),[l,c]}Yt(Lk,"createContext");function an(n,r=[]){let i=[];function l(u,f){const h=m.createContext(f);h.displayName=u+"Context";const v=i.length;i=[...i,f];const g=Yt(x=>{var E;const{scope:b,children:j,...k}=x,S=((E=b==null?void 0:b[n])==null?void 0:E[v])||h,C=m.useMemo(()=>k,Object.values(k));return s.jsx(S.Provider,{value:C,children:j})},"Provider");g.displayName=u+"Provider";function y(x,b,j={}){var E;const{optional:k=!1}=j,S=((E=b==null?void 0:b[n])==null?void 0:E[v])||h,C=m.useContext(S);if(C)return C;if(f!==void 0)return f;if(!k)throw new Error(`\`${x}\` must be used within \`${u}\``)}return Yt(y,"useContext"),[g,y]}Yt(l,"createContext");const c=Yt(()=>{const u=i.map(f=>m.createContext(f));return Yt(function(h){const v=(h==null?void 0:h[n])||u;return m.useMemo(()=>({[`__scope${n}`]:{...h,[n]:v}}),[h,v])},"useScope")},"createScope");return c.scopeName=n,[l,Mv(c,...r)]}Yt(an,"createContextScope");function Mv(...n){const r=n[0];if(n.length===1)return r;const i=Yt(()=>{const l=n.map(c=>({useScope:c(),scopeName:c.scopeName}));return Yt(function(u){const f=l.reduce((h,{useScope:v,scopeName:g})=>{const x=v(u)[`__scope${g}`];return{...h,...x}},{});return m.useMemo(()=>({[`__scope${r.scopeName}`]:f}),[f])},"useComposedScopes")},"createScope");return i.scopeName=r.scopeName,i}Yt(Mv,"composeContextScopes");var wt=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},zk=Object.defineProperty,it=(n,r)=>zk(n,"name",{value:r,configurable:!0});function cd(n){const r=n+"CollectionProvider",[i,l]=an(r),[c,u]=i(r,{collectionRef:{current:null},itemMap:new Map}),f=it(S=>{const{scope:C,children:E}=S,D=m.useRef(null),T=m.useRef(new Map).current;return s.jsx(c,{scope:C,itemMap:T,collectionRef:D,children:E})},"CollectionProvider");f.displayName=r;const h=n+"CollectionSlot",v=$n(h),g=m.forwardRef((S,C)=>{const{scope:E,children:D}=S,T=u(h,E),P=Ie(C,T.collectionRef);return s.jsx(v,{ref:P,children:D})});g.displayName=h;const y=n+"CollectionItemSlot",x="data-radix-collection-item",b=$n(y),j=m.forwardRef((S,C)=>{const{scope:E,children:D,...T}=S,P=m.useRef(null),R=Ie(C,P),N=u(y,E);return m.useEffect(()=>(N.itemMap.set(P,{ref:P,...T}),()=>void N.itemMap.delete(P))),s.jsx(b,{[x]:"",ref:R,children:D})});j.displayName=y;function k(S){const C=u(n+"CollectionConsumer",S);return m.useCallback(()=>{const D=C.collectionRef.current;if(!D)return[];const T=Array.from(D.querySelectorAll(`[${x}]`));return Array.from(C.itemMap.values()).sort((N,I)=>T.indexOf(N.ref.current)-T.indexOf(I.ref.current))},[C.collectionRef,C.itemMap])}return it(k,"useCollection"),[{Provider:f,Slot:g,ItemSlot:j},k,l]}it(cd,"createCollection");var Em=new WeakMap,Xe,Ut,vl=(Ut=class extends Map{constructor(i){super(i);Zh(this,Xe);tu(this,Xe,[...super.keys()]),Em.set(this,!0)}set(i,l){return Em.get(this)&&!this.has(i)&&ht(this,Xe).push(i),super.set(i,l),this}insert(i,l,c){const u=this.has(l),f=u?this.size:this.size+1,h=ud(i),v=h>=0?Math.min(h,f-1):Math.max(f+h,0);if(u?ht(this,Xe).indexOf(l)===v:v===this.size)return this.set(l,c),this;const g=ht(this,Xe).filter(x=>x!==l);g.splice(v,0,l);const y=g.map(x=>[x,x===l?c:this.get(x)]);this.clear();for(const[x,b]of y)this.set(x,b);return this}with(i,l,c){const u=new Ut(this);return u.insert(i,l,c),u}before(i){const l=ht(this,Xe).indexOf(i)-1;if(!(l<0))return this.entryAt(l)}setBefore(i,l,c){const u=ht(this,Xe).indexOf(i);if(u===-1)return this;const f=ht(this,Xe).indexOf(l),h=f!==-1&&f=this.size&&(u=this.size-1),this.at(u)}keyFrom(i,l){const c=this.indexOf(i);if(c===-1)return;let u=c+l;return u<0&&(u=0),u>=this.size&&(u=this.size-1),this.keyAt(u)}find(i,l){let c=0;for(const u of this){if(Reflect.apply(i,l,[u,c,this]))return u;c++}}findIndex(i,l){let c=0;for(const u of this){if(Reflect.apply(i,l,[u,c,this]))return c;c++}return-1}filter(i,l){const c=[];let u=0;for(const f of this)Reflect.apply(i,l,[f,u,this])&&c.push(f),u++;return new Ut(c)}map(i,l){const c=[];let u=0;for(const f of this)c.push([f[0],Reflect.apply(i,l,[f,u,this])]),u++;return new Ut(c)}reduce(...i){const[l,c]=i,u=i.length>1;if(!u&&this.size===0)throw new TypeError("Reduce of empty OrderedDict with no initial value");let f=0,h=c;for(const v of this)f===0&&!u?h=v:h=Reflect.apply(l,this,[h,v,f,this]),f++;return h}reduceRight(...i){const[l,c]=i,u=i.length>1;if(!u&&this.size===0)throw new TypeError("Reduce of empty OrderedDict with no initial value");let f=c;for(let h=this.size-1;h>=0;h--){const v=this.entryAt(h);h===this.size-1&&!u?f=v:f=Reflect.apply(l,this,[f,v,h,this])}return f}sort(i){if(typeof i!="function")throw new TypeError("OrderedDict.sort requires a compare function");const l=[...this.entries()].sort(i);this.clear();for(const[c,u]of l)this.set(c,u);return this}toSorted(i){if(typeof i!="function")throw new TypeError("OrderedDict.toSorted requires a compare function");const l=[...this.entries()].sort(i);return new Ut(l)}toReversed(){const i=new Ut;for(let l=this.size-1;l>=0;l--){const c=this.keyAt(l),u=this.get(c);i.set(c,u)}return i}toSpliced(...i){const l=[...this.entries()];return l.splice(...i),new Ut(l)}slice(i,l){const c=new Ut;for(const u of ht(this,Xe).slice(i,l))c.set(u,this.get(u));return c}every(i,l){let c=0;for(const u of this){if(!Reflect.apply(i,l,[u,c,this]))return!1;c++}return!0}some(i,l){let c=0;for(const u of this){if(Reflect.apply(i,l,[u,c,this]))return!0;c++}return!1}},Xe=new WeakMap,it(Ut,"OrderedDict"),Ut);function _l(n,r){if("at"in Array.prototype)return Array.prototype.at.call(n,r);const i=Av(n,r);return i===-1?void 0:n[i]}it(_l,"at");function Av(n,r){const i=n.length,l=ud(r),c=l>=0?l:i+l;return c<0||c>=i?-1:c}it(Av,"toSafeIndex");function ud(n){return n!==n||n===0?0:Math.trunc(n)}it(ud,"toSafeInteger");function Fk(n){const r=n+"CollectionProvider",[i,l]=an(r),[c,u]=i(r);c.displayName=n+"CollectionStableContextProvider";const[f,h]=i(r);f.displayName=n+"CollectionStatefulContextProvider";const v=it(({state:N,...I})=>N?s.jsx(y,{...I,state:N}):s.jsx(g,{...I}),"CollectionProvider");v.displayName=r;const g=it(N=>{const I=D();return s.jsx(y,{...N,state:I})},"CollectionInit");g.displayName=n+"CollectionInit";const y=it(N=>{const{scope:I,children:L,state:Q}=N,ee=m.useRef(null),[J,ne]=m.useState(null),de=Ie(ee,ne),[re,ie]=Q,B=m.useRef(new vl),Z=m.useCallback(()=>{const W=B.current;return zv(W)||W.sort(Nl),W},[]);return m.useEffect(()=>{if(!J)return;const W=Fv(()=>{ie(q=>{const F=q.toSorted(Nl);return F.some(([V],he)=>q.keyAt(he)!==V)?F:q})});return W.observe(J,{childList:!0,subtree:!0}),()=>{W.disconnect()}},[J,ie]),s.jsx(c,{scope:I,collectionElementRef:de,collectionElementRefObject:ee,getCollection:Z,setCollection:ie,registryRef:B,children:s.jsx(f,{scope:I,collectionElement:J,collection:re,children:L})})},"CollectionProviderImpl");y.displayName=n+"CollectionProviderImpl";const x=n+"CollectionSlot",b=$n(x),j=m.forwardRef((N,I)=>{const{scope:L,children:Q}=N,ee=u(x,L),J=Ie(I,ee.collectionElementRef);return s.jsx(b,{ref:J,children:Q})});j.displayName=x;const k=n+"CollectionItemSlot",S="data-radix-collection-item",C=$n(k),E=m.forwardRef((N,I)=>{const{scope:L,children:Q,...ee}=N,J=m.useRef(null),ne=u(k,L),{setCollection:de,registryRef:re}=ne,ie=m.useRef(ee);Iv(ie.current,ee)||(ie.current=ee);const B=ie.current,Z=m.useCallback(F=>{const M=re.current;F?M.set(F,{...ie.current,element:F}):J.current&&M.delete(J.current)},[re]),W=Ie(I,Z,J);wt(()=>{const F=J.current,M=re.current;F&&M.has(F)&&M.set(F,{...B,element:F})},[B,re]);const q=m.useRef(null);return m.useEffect(()=>{const F=J.current,M=q.current;((M==null?void 0:M.element)??null)===F&&(!F||(M==null?void 0:M.itemData)===B)||(q.current=F?{element:F,itemData:B}:null,de(V=>{const he=new vl(V);return M&&M.element!==F&&he.delete(M.element),F&&he.set(F,{...B,element:F}),he.sort(Nl)}))}),m.useEffect(()=>()=>{const F=q.current;q.current=null,F&&de(M=>{if(!M.has(F.element))return M;const V=new vl(M);return V.delete(F.element),V})},[de]),s.jsx(C,{[S]:"",ref:W,children:Q})});E.displayName=k;function D(){return m.useState(new vl)}it(D,"useInitCollection");function T(N){const{collection:I}=h(n+"CollectionConsumer",N);return I}it(T,"useCollection");function P(N){const{getCollection:I}=u(n+"CollectionConsumer",N);return I}return it(P,"useGetCollection"),[{Provider:v,Slot:j,ItemSlot:E},{createCollectionScope:l,useCollection:T,useGetCollection:P,useInitCollection:D}]}it(Fk,"createCollection");function Iv(n,r){if(n===r)return!0;if(typeof n!="object"||typeof r!="object"||n==null||r==null)return!1;const i=Object.keys(n),l=Object.keys(r);if(i.length!==l.length)return!1;for(const c of i)if(!Object.prototype.hasOwnProperty.call(r,c)||n[c]!==r[c])return!1;return!0}it(Iv,"shallowEqual");function Lv(n,r){return!!(r.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_PRECEDING)}it(Lv,"isElementPreceding");function zv(n){let r;for(const i of n.keys()){if(r){const l=r.compareDocumentPosition(i);if(!(l&Node.DOCUMENT_POSITION_DISCONNECTED)&&l&Node.DOCUMENT_POSITION_PRECEDING)return!1}r=i}return!0}it(zv,"isInDocumentOrder");function Nl(n,r){return!n[1].element||!r[1].element?0:Lv(n[1].element,r[1].element)?-1:1}it(Nl,"sortByDocumentPosition");function Fv(n){return new MutationObserver(i=>{for(const l of i)if(l.type==="childList"){n();return}})}it(Fv,"getChildListObserver");var $k=Object.defineProperty,Yo=(n,r)=>$k(n,"name",{value:r,configurable:!0}),$v=!!(typeof window<"u"&&window.document&&window.document.createElement);function je(n,r,{checkForDefaultPrevented:i=!0}={}){return Yo(function(c){if(n==null||n(c),i===!1||!c||!c.defaultPrevented)return r==null?void 0:r(c)},"handleEvent")}Yo(je,"composeEventHandlers");function Uk(n){var r;if(!$v)throw new Error("Cannot access window outside of the DOM");return((r=n==null?void 0:n.ownerDocument)==null?void 0:r.defaultView)??window}Yo(Uk,"getOwnerWindow");function Ou(n){if(!$v)throw new Error("Cannot access document outside of the DOM");return(n==null?void 0:n.ownerDocument)??document}Yo(Ou,"getOwnerDocument");function Uv(n,r=!1){const{activeElement:i}=Ou(n);if(!(i!=null&&i.nodeName))return null;if(Bv(i)&&i.contentDocument)return Uv(i.contentDocument.body,r);if(r){const l=i.getAttribute("aria-activedescendant");if(l){const c=Ou(i).getElementById(l);if(c)return c}}return i}Yo(Uv,"getActiveElement");function Bv(n){return n.tagName==="IFRAME"}Yo(Bv,"isFrame");var Bk=Object.defineProperty,Wk=(n,r)=>Bk(n,"name",{value:r,configurable:!0}),_m=Rr[" useEffectEvent ".trim().toString()],Nm=Rr[" useInsertionEffect ".trim().toString()];function Wv(n){if(typeof _m=="function")return _m(n);const r=m.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Nm=="function"?Nm(()=>{r.current=n}):wt(()=>{r.current=n}),m.useMemo(()=>((...i)=>{var l;return(l=r.current)==null?void 0:l.call(r,...i)}),[])}Wk(Wv,"useEffectEvent");var Vk=Object.defineProperty,Zi=(n,r)=>Vk(n,"name",{value:r,configurable:!0}),Hk=Rr[" useInsertionEffect ".trim().toString()]||wt;function qo({prop:n,defaultProp:r,onChange:i=Zi(()=>{},"onChange"),caller:l}){const[c,u,f]=Vv({defaultProp:r,onChange:i}),h=n!==void 0,v=h?n:c,g=m.useCallback(y=>{var x;if(h){const b=Hv(y)?y(n):y;b!==n&&((x=f.current)==null||x.call(f,b))}else u(y)},[h,n,u,f]);return[v,g]}Zi(qo,"useControllableState");function Vv({defaultProp:n,onChange:r}){const[i,l]=m.useState(n),c=m.useRef(i),u=m.useRef(r);return Hk(()=>{u.current=r},[r]),m.useEffect(()=>{var f;c.current!==i&&((f=u.current)==null||f.call(u,i),c.current=i)},[i,c]),[i,l,u]}Zi(Vv,"useUncontrolledState");function Hv(n){return typeof n=="function"}Zi(Hv,"isFunction");var Rm=Symbol("RADIX:SYNC_STATE");function Gk(n,r,i,l){const{prop:c,defaultProp:u,onChange:f,caller:h}=r,v=c!==void 0,g=Wv(f),y=[{...i,state:u}];l&&y.push(l);const[x,b]=m.useReducer((C,E)=>{if(E.type===Rm)return{...C,state:E.state};const D=n(C,E);return v&&!Object.is(D.state,C.state)&&g(D.state),D},...y),j=x.state,k=m.useRef(j);m.useEffect(()=>{k.current!==j&&(k.current=j,v||g(j))},[j,k,v]);const S=m.useMemo(()=>c!==void 0?{...x,state:c}:x,[x,c]);return m.useEffect(()=>{v&&!Object.is(c,x.state)&&b({type:Rm,state:c})},[c,x.state,v]),[S,b]}Zi(Gk,"useControllableStateReducer");var Kk=Object.defineProperty,Un=(n,r)=>Kk(n,"name",{value:r,configurable:!0});function Gv(n,r){return m.useReducer((i,l)=>r[i][l]??i,n)}Un(Gv,"useStateMachine");var Gn=Un(n=>{const{present:r,children:i}=n,l=Kv(r),c=typeof i=="function"?i({present:l.isPresent}):m.Children.only(i),u=Qv(l.ref,Yv(c));return typeof i=="function"||l.isPresent?m.cloneElement(c,{ref:u}):null},"Presence");function Kv(n){const[r,i]=m.useState(),l=m.useRef(null),c=m.useRef(n),u=m.useRef("none"),f=m.useRef(void 0),h=n?"mounted":"unmounted",[v,g]=Gv(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{v==="mounted"?(u.current=f.current??Uo(l.current),f.current=void 0):u.current="none"},[v]),wt(()=>{const y=l.current,x=c.current;if(x!==n){const j=u.current,k=Uo(y);n?(f.current=k,g("MOUNT")):k==="none"||(y==null?void 0:y.display)==="none"?g("UNMOUNT"):g(x&&j!==k?"ANIMATION_OUT":"UNMOUNT"),c.current=n}},[n,g]),wt(()=>{if(r){let y;const x=r.ownerDocument.defaultView??window,b=Un(k=>{const C=Uo(l.current).includes(CSS.escape(k.animationName));if(k.target===r&&C&&(g("ANIMATION_END"),!c.current)){const E=r.style.animationFillMode;r.style.animationFillMode="forwards",y=x.setTimeout(()=>{r.style.animationFillMode==="forwards"&&(r.style.animationFillMode=E)})}},"handleAnimationEnd"),j=Un(k=>{k.target===r&&(u.current=Uo(l.current))},"handleAnimationStart");return r.addEventListener("animationstart",j),r.addEventListener("animationcancel",b),r.addEventListener("animationend",b),()=>{x.clearTimeout(y),r.removeEventListener("animationstart",j),r.removeEventListener("animationcancel",b),r.removeEventListener("animationend",b)}}else g("ANIMATION_END")},[r,g]),{isPresent:["mounted","unmountSuspended"].includes(v),ref:m.useCallback(y=>{if(y){const x=getComputedStyle(y);l.current=x,f.current=Uo(x)}else l.current=null;i(y)},[])}}Un(Kv,"usePresence");function Mu(n,r){if(typeof n=="function")return n(r);n!=null&&(n.current=r)}Un(Mu,"setRef");function Qv(...n){const r=m.useRef(n);return r.current=n,m.useCallback(i=>{const l=r.current;let c=!1;const u=l.map(f=>{const h=Mu(f,i);return!c&&typeof h=="function"&&(c=!0),h});if(c)return()=>{for(let f=0;fQk(n,"name",{value:r,configurable:!0}),qk=Rr[" useId ".trim().toString()]||(()=>{}),Xk=0;function Sr(n){const[r,i]=m.useState(qk());return wt(()=>{n||i(l=>l??String(Xk++))},[n]),n||(r?`radix-${r}`:"")}Yk(Sr,"useId");var Jk=Object.defineProperty,Zk=(n,r)=>Jk(n,"name",{value:r,configurable:!0}),ej={LTR:"ltr"},tj=m.createContext(void 0);function dd(n){const r=m.useContext(tj);return n||r||ej.LTR}Zk(dd,"useDirection");var nj=Object.defineProperty,rj=(n,r)=>nj(n,"name",{value:r,configurable:!0}),Pm=Rr[" useInsertionEffect ".trim().toString()];function wn(n){const r=m.useRef(n);return typeof Pm=="function"?Pm(()=>{r.current=n}):wt(()=>{r.current=n}),m.useMemo(()=>((...i)=>{var l;return(l=r.current)==null?void 0:l.call(r,...i)}),[])}rj(wn,"useCallbackRef");var oj=Object.defineProperty,ct=(n,r)=>oj(n,"name",{value:r,configurable:!0}),Au="dismissableLayer.update",ij="dismissableLayer.pointerDownOutside",sj="dismissableLayer.focusOutside",Dm,qv=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),fd=m.forwardRef(ct(function(r,i){const{disableOutsidePointerEvents:l=!1,deferPointerDownOutside:c=!1,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:v,onDismiss:g,...y}=r,x=m.useContext(qv),[b,j]=m.useState(null),k=(b==null?void 0:b.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,S]=m.useState({}),C=Ie(i,j),E=Array.from(x.layers),[D]=[...x.layersWithOutsidePointerEventsDisabled].slice(-1),T=D?E.indexOf(D):-1,P=b?E.indexOf(b):-1,R=x.layersWithOutsidePointerEventsDisabled.size>0,N=P>=T,I=m.useRef(!1),L=Jv(ne=>{f==null||f(ne),v==null||v(ne),ne.defaultPrevented||g==null||g()},{ownerDocument:k,deferPointerDownOutside:c,isDeferredPointerDownOutsideRef:I,dismissableSurfaces:x.dismissableSurfaces,shouldHandlePointerDownOutside:m.useCallback(ne=>{if(!(ne instanceof Node))return!1;const de=[...x.branches].some(re=>re.contains(ne));return N&&!de},[x.branches,N])}),Q=Zv(ne=>{if(c&&I.current)return;const de=ne.target;[...x.branches].some(ie=>ie.contains(de))||(h==null||h(ne),v==null||v(ne),ne.defaultPrevented||g==null||g())},k),ee=b?P===E.length-1:!1,J=wn(ne=>{ne.key==="Escape"&&(u==null||u(ne),!ne.defaultPrevented&&g&&(ne.preventDefault(),g()))});return m.useEffect(()=>{if(ee)return k.addEventListener("keydown",J,{capture:!0}),()=>k.removeEventListener("keydown",J,{capture:!0})},[k,ee,J]),m.useEffect(()=>{if(b)return l&&(x.layersWithOutsidePointerEventsDisabled.size===0&&(Dm=k.body.style.pointerEvents,k.body.style.pointerEvents="none"),x.layersWithOutsidePointerEventsDisabled.add(b)),x.layers.add(b),Iu(),()=>{l&&(x.layersWithOutsidePointerEventsDisabled.delete(b),x.layersWithOutsidePointerEventsDisabled.size===0&&(k.body.style.pointerEvents=Dm))}},[b,k,l,x]),m.useEffect(()=>()=>{b&&(x.layers.delete(b),x.layersWithOutsidePointerEventsDisabled.delete(b),Iu())},[b,x]),m.useEffect(()=>{const ne=ct(()=>S({}),"handleUpdate");return document.addEventListener(Au,ne),()=>document.removeEventListener(Au,ne)},[]),s.jsx(ze.div,{...y,ref:C,style:{pointerEvents:R?N?"auto":"none":void 0,...r.style},onFocusCapture:je(r.onFocusCapture,Q.onFocusCapture),onBlurCapture:je(r.onBlurCapture,Q.onBlurCapture),onPointerDownCapture:je(r.onPointerDownCapture,L.onPointerDownCapture)})},"DismissableLayer"));function Xv(){const n=m.useContext(qv),[r,i]=m.useState(null);return m.useEffect(()=>{if(r)return n.dismissableSurfaces.add(r),()=>{n.dismissableSurfaces.delete(r)}},[r,n.dismissableSurfaces]),i}ct(Xv,"useDismissableLayerSurface");var lj=ct(()=>!0,"IS_TRUE");function Jv(n,r){const{ownerDocument:i=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:l=!1,isDeferredPointerDownOutsideRef:c,dismissableSurfaces:u,shouldHandlePointerDownOutside:f=lj}=r,h=wn(n),v=m.useRef(!1),g=m.useRef(!1),y=m.useRef(new Map),x=m.useRef(()=>{});return m.useEffect(()=>{function b(){g.current=!1,c.current=!1,y.current.clear()}ct(b,"resetOutsideInteraction");function j(){return Array.from(y.current.values()).some(Boolean)}ct(j,"isOutsideInteractionIntercepted");function k(T){if(!g.current)return;const P=T.target;P instanceof Node&&[...u].some(N=>N.contains(P))||y.current.set(T.type,!0),T.type==="click"&&window.setTimeout(()=>{g.current&&x.current()},0)}ct(k,"handleInteractionCapture");function S(T){g.current&&y.current.set(T.type,!1)}ct(S,"handleInteractionBubble");const C=ct(T=>{if(T.target&&!v.current){let P=function(){i.removeEventListener("click",x.current);const N=j();b(),N||pd(ij,h,R,{discrete:!0})};if(ct(P,"handleAndDispatchPointerDownOutsideEvent"),!f(T.target)){i.removeEventListener("click",x.current),b(),v.current=!1;return}const R={originalEvent:T};g.current=!0,c.current=l&&T.button===0,y.current.clear(),!l||T.button!==0?P():(i.removeEventListener("click",x.current),x.current=P,i.addEventListener("click",x.current,{once:!0}))}else i.removeEventListener("click",x.current),b();v.current=!1},"handlePointerDown"),E=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const T of E)i.addEventListener(T,k,!0),i.addEventListener(T,S);const D=window.setTimeout(()=>{i.addEventListener("pointerdown",C)},0);return()=>{window.clearTimeout(D),i.removeEventListener("pointerdown",C),i.removeEventListener("click",x.current);for(const T of E)i.removeEventListener(T,k,!0),i.removeEventListener(T,S)}},[i,h,l,c,u,f]),{onPointerDownCapture:ct(()=>v.current=!0,"onPointerDownCapture")}}ct(Jv,"usePointerDownOutside");function Zv(n,r=globalThis==null?void 0:globalThis.document){const i=wn(n),l=m.useRef(!1);return m.useEffect(()=>{const c=ct(u=>{u.target&&!l.current&&pd(sj,i,{originalEvent:u},{discrete:!1})},"handleFocus");return r.addEventListener("focusin",c),()=>r.removeEventListener("focusin",c)},[r,i]),{onFocusCapture:ct(()=>l.current=!0,"onFocusCapture"),onBlurCapture:ct(()=>l.current=!1,"onBlurCapture")}}ct(Zv,"useFocusOutside");function Iu(){const n=new CustomEvent(Au);document.dispatchEvent(n)}ct(Iu,"dispatchUpdate");function pd(n,r,i,{discrete:l}){const c=i.originalEvent.target,u=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:i});r&&c.addEventListener(n,r,{once:!0}),l?ad(c,u):c.dispatchEvent(u)}ct(pd,"handleAndDispatchCustomEvent");var aj=Object.defineProperty,Ze=(n,r)=>aj(n,"name",{value:r,configurable:!0}),uu="focusScope.autoFocusOnMount",du="focusScope.autoFocusOnUnmount",Tm={bubbles:!1,cancelable:!0},ex=m.forwardRef(Ze(function(r,i){const{loop:l=!1,trapped:c=!1,branches:u,onMountAutoFocus:f,onUnmountAutoFocus:h,...v}=r,[g,y]=m.useState(null),x=wn(f),b=wn(h),j=m.useRef(null),k=Ie(i,y),S=m.useRef(u);m.useEffect(()=>{S.current=u});const C=m.useCallback(T=>{var P;return T?g!=null&&g.contains(T)?!0:!!((P=S.current)!=null&&P.some(R=>R.contains(T))):!1},[g]),E=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(c){let T=function(I){if(E.paused||!g)return;const L=I.target;C(L)?j.current=L:An(j.current,{select:!0})},P=function(I){if(E.paused||!g)return;const L=I.relatedTarget;L!==null&&(C(L)||An(j.current,{select:!0}))},R=function(I){if(document.activeElement===document.body)for(const Q of I)Q.removedNodes.length>0&&An(g)};Ze(T,"handleFocusIn"),Ze(P,"handleFocusOut"),Ze(R,"handleMutations"),document.addEventListener("focusin",T),document.addEventListener("focusout",P);const N=new MutationObserver(R);return g&&N.observe(g,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",T),document.removeEventListener("focusout",P),N.disconnect()}}},[c,g,E.paused,C]),m.useEffect(()=>{if(g){Om.add(E);const T=document.activeElement;if(!g.contains(T)){const R=new CustomEvent(uu,Tm);g.addEventListener(uu,x),g.dispatchEvent(R),R.defaultPrevented||(nx(lx(vd(g)),{select:!0}),document.activeElement===T&&An(g))}return()=>{g.removeEventListener(uu,x);const R=g.ownerDocument,N=CustomEvent;setTimeout(()=>{const I=new N(du,Tm);g.addEventListener(du,b),g.dispatchEvent(I),I.defaultPrevented||An(T??R.body,{select:!0}),g.removeEventListener(du,b),Om.remove(E)},0)}}},[g,x,b,E]);const D=m.useCallback(T=>{if(!l&&!c||E.paused)return;const P=T.key==="Tab"&&!T.altKey&&!T.ctrlKey&&!T.metaKey,R=document.activeElement;if(P&&R){const N=T.currentTarget,[I,L]=rx(N);I&&L?!T.shiftKey&&R===L?(T.preventDefault(),l&&An(I,{select:!0})):T.shiftKey&&R===I&&(T.preventDefault(),l&&An(L,{select:!0})):R===N&&T.preventDefault()}},[l,c,E.paused]);return s.jsx(ze.div,{tabIndex:-1,...v,ref:k,onKeyDown:D})},"FocusScope")),tx=m.createContext(null);function hd({registry:n,children:r}){return n?s.jsx(tx.Provider,{value:n,children:r}):r}Ze(hd,"FocusScopeBranchProvider");function md(){const[n,r]=m.useState([]),i=m.useMemo(()=>({add:Ze(l=>r(c=>c.includes(l)?c:[...c,l]),"add"),remove:Ze(l=>r(c=>c.filter(u=>u!==l)),"remove")}),[]);return{nodes:n,registry:i}}Ze(md,"useFocusScopeBranchRegistry");function gd(n){const r=m.useContext(tx);m.useEffect(()=>{if(!(!n||!r))return r.add(n),()=>r.remove(n)},[n,r])}Ze(gd,"useFocusScopeBranch");function nx(n,{select:r=!1}={}){const i=document.activeElement;for(const l of n)if(An(l,{select:r}),document.activeElement!==i)return}Ze(nx,"focusFirst");function rx(n){const r=vd(n),i=Lu(r,n),l=Lu(r.reverse(),n);return[i,l]}Ze(rx,"getTabbableEdges");function vd(n){const r=[],l=n.ownerDocument.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:Ze(c=>{const u=c.tagName==="INPUT"&&c.type==="hidden";return c.disabled||c.hidden||u?NodeFilter.FILTER_SKIP:c.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;l.nextNode();)r.push(l.currentNode);return r}Ze(vd,"getTabbableCandidates");function Lu(n,r){const i=typeof r.checkVisibility=="function"&&r.checkVisibility({checkVisibilityCSS:!0});for(const l of n)if(!(i?!l.checkVisibility({checkVisibilityCSS:!0}):ox(l,{upTo:r})))return l}Ze(Lu,"findVisible");function ox(n,{upTo:r}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(r!==void 0&&n===r)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}Ze(ox,"isHidden");function ix(n){return n.tagName==="INPUT"&&typeof n.select=="function"}Ze(ix,"isSelectableInput");function An(n,{select:r=!1}={}){if(n&&n.focus){const l=(n.ownerDocument??document).activeElement;n.focus({preventScroll:!0}),n!==l&&ix(n)&&r&&n.select()}}Ze(An,"focus");var Om=sx();function sx(){let n=[];return{add(r){const i=n[0];r!==i&&(i==null||i.pause()),n=zu(n,r),n.unshift(r)},remove(r){var i;n=zu(n,r),(i=n[0])==null||i.resume()}}}Ze(sx,"createFocusScopesStack");function zu(n,r){const i=[...n],l=i.indexOf(r);return l!==-1&&i.splice(l,1),i}Ze(zu,"arrayRemove");function lx(n){return n.filter(r=>r.tagName!=="A")}Ze(lx,"removeLinks");var cj=Object.defineProperty,uj=(n,r)=>cj(n,"name",{value:r,configurable:!0}),xd=m.forwardRef(uj(function(r,i){var v;const{container:l,...c}=r,[u,f]=m.useState(!1);wt(()=>f(!0),[]);const h=l||u&&((v=globalThis==null?void 0:globalThis.document)==null?void 0:v.body);return h?ed.createPortal(s.jsx(ze.div,{...c,ref:i}),h):null},"Portal")),dj=Object.defineProperty,yd=(n,r)=>dj(n,"name",{value:r,configurable:!0}),xl=0,gn=null;function fj(n){return Jl(),n.children}yd(fj,"FocusGuards");function Jl(){m.useEffect(()=>{gn||(gn={start:Fu(),end:Fu()});const{start:n,end:r}=gn;return document.body.firstElementChild!==n&&document.body.insertAdjacentElement("afterbegin",n),document.body.lastElementChild!==r&&document.body.insertAdjacentElement("beforeend",r),xl++,()=>{xl===1&&(gn==null||gn.start.remove(),gn==null||gn.end.remove(),gn=null),xl=Math.max(0,xl-1)}},[])}yd(Jl,"useFocusGuards");function Fu(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.outline="none",n.style.opacity="0",n.style.position="fixed",n.style.pointerEvents="none",n}yd(Fu,"createFocusGuard");var vn=function(){return vn=Object.assign||function(r){for(var i,l=1,c=arguments.length;l"u")return Nj;var r=Rj(n),i=document.documentElement.clientWidth,l=window.innerWidth;return{left:r[0],top:r[1],right:r[2],gap:Math.max(0,l-i+r[2]-r[0])}},Dj=dx(),Bo="data-scroll-locked",Tj=function(n,r,i,l){var c=n.left,u=n.top,f=n.right,h=n.gap;return i===void 0&&(i="margin"),` + .`.concat(hj,` { + overflow: hidden `).concat(l,`; + padding-right: `).concat(h,"px ").concat(l,`; } body[`).concat(Bo,`] { - overflow: hidden `).concat(s,`; + overflow: hidden `).concat(l,`; overscroll-behavior: contain; - `).concat([r&&"position: relative ".concat(s,";"),i==="margin"&&` + `).concat([r&&"position: relative ".concat(l,";"),i==="margin"&&` padding-left: `.concat(c,`px; padding-top: `).concat(u,`px; padding-right: `).concat(f,`px; margin-left:0; margin-top:0; - margin-right: `).concat(h,"px ").concat(s,`; - `),i==="padding"&&"padding-right: ".concat(h,"px ").concat(s,";")].filter(Boolean).join(""),` + margin-right: `).concat(h,"px ").concat(l,`; + `),i==="padding"&&"padding-right: ".concat(h,"px ").concat(l,";")].filter(Boolean).join(""),` } .`).concat(Rl,` { - right: `).concat(h,"px ").concat(s,`; + right: `).concat(h,"px ").concat(l,`; } .`).concat(Pl,` { - margin-right: `).concat(h,"px ").concat(s,`; + margin-right: `).concat(h,"px ").concat(l,`; } .`).concat(Rl," .").concat(Rl,` { - right: 0 `).concat(s,`; + right: 0 `).concat(l,`; } .`).concat(Pl," .").concat(Pl,` { - margin-right: 0 `).concat(s,`; + margin-right: 0 `).concat(l,`; } body[`).concat(Bo,`] { - `).concat(mC,": ").concat(h,`px; + `).concat(mj,": ").concat(h,`px; } -`)},Am=function(){var n=parseInt(document.body.getAttribute(Bo)||"0",10);return isFinite(n)?n:0},OC=function(){m.useEffect(function(){return document.body.setAttribute(Bo,(Am()+1).toString()),function(){var n=Am()-1;n<=0?document.body.removeAttribute(Bo):document.body.setAttribute(Bo,n.toString())}},[])},MC=function(n){var r=n.noRelative,i=n.noImportant,s=n.gapMode,c=s===void 0?"margin":s;OC();var u=m.useMemo(function(){return PC(c)},[c]);return m.createElement(DC,{styles:TC(u,!r,c,i?"":"!important")})},$u=!1;if(typeof window<"u")try{var yl=Object.defineProperty({},"passive",{get:function(){return $u=!0,!0}});window.addEventListener("test",yl,yl),window.removeEventListener("test",yl,yl)}catch{$u=!1}var Lo=$u?{passive:!1}:!1,AC=function(n){return n.tagName==="TEXTAREA"},fx=function(n,r){if(!(n instanceof Element))return!1;var i=window.getComputedStyle(n);return i[r]!=="hidden"&&!(i.overflowY===i.overflowX&&!AC(n)&&i[r]==="visible")},IC=function(n){return fx(n,"overflowY")},LC=function(n){return fx(n,"overflowX")},Im=function(n,r){var i=r.ownerDocument,s=r;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var c=px(n,s);if(c){var u=hx(n,s),f=u[1],h=u[2];if(f>h)return!0}s=s.parentNode}while(s&&s!==i.body);return!1},zC=function(n){var r=n.scrollTop,i=n.scrollHeight,s=n.clientHeight;return[r,i,s]},FC=function(n){var r=n.scrollLeft,i=n.scrollWidth,s=n.clientWidth;return[r,i,s]},px=function(n,r){return n==="v"?IC(r):LC(r)},hx=function(n,r){return n==="v"?zC(r):FC(r)},$C=function(n,r){return n==="h"&&r==="rtl"?-1:1},UC=function(n,r,i,s,c){var u=$C(n,window.getComputedStyle(r).direction),f=u*s,h=i.target,v=r.contains(h),g=!1,y=f>0,x=0,b=0;do{if(!h)break;var C=hx(n,h),k=C[0],S=C[1],j=C[2],E=S-j-u*k;(k||E)&&px(n,h)&&(x+=E,b+=k);var D=h.parentNode;h=D&&D.nodeType===Node.DOCUMENT_FRAGMENT_NODE?D.host:D}while(!v&&h!==document.body||v&&(r.contains(h)||r===h));return(y&&Math.abs(x)<1||!y&&Math.abs(b)<1)&&(g=!0),g},wl=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},Lm=function(n){return[n.deltaX,n.deltaY]},zm=function(n){return n&&"current"in n?n.current:n},BC=function(n,r){return n[0]===r[0]&&n[1]===r[1]},WC=function(n){return` +`)},Am=function(){var n=parseInt(document.body.getAttribute(Bo)||"0",10);return isFinite(n)?n:0},Oj=function(){m.useEffect(function(){return document.body.setAttribute(Bo,(Am()+1).toString()),function(){var n=Am()-1;n<=0?document.body.removeAttribute(Bo):document.body.setAttribute(Bo,n.toString())}},[])},Mj=function(n){var r=n.noRelative,i=n.noImportant,l=n.gapMode,c=l===void 0?"margin":l;Oj();var u=m.useMemo(function(){return Pj(c)},[c]);return m.createElement(Dj,{styles:Tj(u,!r,c,i?"":"!important")})},$u=!1;if(typeof window<"u")try{var yl=Object.defineProperty({},"passive",{get:function(){return $u=!0,!0}});window.addEventListener("test",yl,yl),window.removeEventListener("test",yl,yl)}catch{$u=!1}var Lo=$u?{passive:!1}:!1,Aj=function(n){return n.tagName==="TEXTAREA"},fx=function(n,r){if(!(n instanceof Element))return!1;var i=window.getComputedStyle(n);return i[r]!=="hidden"&&!(i.overflowY===i.overflowX&&!Aj(n)&&i[r]==="visible")},Ij=function(n){return fx(n,"overflowY")},Lj=function(n){return fx(n,"overflowX")},Im=function(n,r){var i=r.ownerDocument,l=r;do{typeof ShadowRoot<"u"&&l instanceof ShadowRoot&&(l=l.host);var c=px(n,l);if(c){var u=hx(n,l),f=u[1],h=u[2];if(f>h)return!0}l=l.parentNode}while(l&&l!==i.body);return!1},zj=function(n){var r=n.scrollTop,i=n.scrollHeight,l=n.clientHeight;return[r,i,l]},Fj=function(n){var r=n.scrollLeft,i=n.scrollWidth,l=n.clientWidth;return[r,i,l]},px=function(n,r){return n==="v"?Ij(r):Lj(r)},hx=function(n,r){return n==="v"?zj(r):Fj(r)},$j=function(n,r){return n==="h"&&r==="rtl"?-1:1},Uj=function(n,r,i,l,c){var u=$j(n,window.getComputedStyle(r).direction),f=u*l,h=i.target,v=r.contains(h),g=!1,y=f>0,x=0,b=0;do{if(!h)break;var j=hx(n,h),k=j[0],S=j[1],C=j[2],E=S-C-u*k;(k||E)&&px(n,h)&&(x+=E,b+=k);var D=h.parentNode;h=D&&D.nodeType===Node.DOCUMENT_FRAGMENT_NODE?D.host:D}while(!v&&h!==document.body||v&&(r.contains(h)||r===h));return(y&&Math.abs(x)<1||!y&&Math.abs(b)<1)&&(g=!0),g},wl=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},Lm=function(n){return[n.deltaX,n.deltaY]},zm=function(n){return n&&"current"in n?n.current:n},Bj=function(n,r){return n[0]===r[0]&&n[1]===r[1]},Wj=function(n){return` .block-interactivity-`.concat(n,` {pointer-events: none;} .allow-interactivity-`).concat(n,` {pointer-events: all;} -`)},VC=0,zo=[];function HC(n){var r=m.useRef([]),i=m.useRef([0,0]),s=m.useRef(),c=m.useState(VC++)[0],u=m.useState(dx)[0],f=m.useRef(n);m.useEffect(function(){f.current=n},[n]),m.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(c));var S=pC([n.lockRef.current],(n.shards||[]).map(zm),!0).filter(Boolean);return S.forEach(function(j){return j.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),S.forEach(function(j){return j.classList.remove("allow-interactivity-".concat(c))})}}},[n.inert,n.lockRef.current,n.shards]);var h=m.useCallback(function(S,j){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!f.current.allowPinchZoom;var E=wl(S),D=i.current,T="deltaX"in S?S.deltaX:D[0]-E[0],P="deltaY"in S?S.deltaY:D[1]-E[1],R,N=S.target,I=Math.abs(T)>Math.abs(P)?"h":"v";if("touches"in S&&I==="h"&&N.type==="range")return!1;var L=window.getSelection(),Q=L&&L.anchorNode,ee=Q?Q===N||Q.contains(N):!1;if(ee)return!1;var J=Im(I,N);if(!J)return!0;if(J?R=I:(R=I==="v"?"h":"v",J=Im(I,N)),!J)return!1;if(!s.current&&"changedTouches"in S&&(T||P)&&(s.current=R),!R)return!0;var ne=s.current||R;return UC(ne,j,S,ne==="h"?T:P)},[]),v=m.useCallback(function(S){var j=S;if(!(!zo.length||zo[zo.length-1]!==u)){var E="deltaY"in j?Lm(j):wl(j),D=r.current.filter(function(R){return R.name===j.type&&(R.target===j.target||j.target===R.shadowParent)&&BC(R.delta,E)})[0];if(D&&D.should){j.cancelable&&j.preventDefault();return}if(!D){var T=(f.current.shards||[]).map(zm).filter(Boolean).filter(function(R){return R.contains(j.target)}),P=T.length>0?h(j,T[0]):!f.current.noIsolation;P&&j.cancelable&&j.preventDefault()}}},[]),g=m.useCallback(function(S,j,E,D){var T={name:S,delta:j,target:E,should:D,shadowParent:GC(E)};r.current.push(T),setTimeout(function(){r.current=r.current.filter(function(P){return P!==T})},1)},[]),y=m.useCallback(function(S){i.current=wl(S),s.current=void 0},[]),x=m.useCallback(function(S){g(S.type,Lm(S),S.target,h(S,n.lockRef.current))},[]),b=m.useCallback(function(S){g(S.type,wl(S),S.target,h(S,n.lockRef.current))},[]);m.useEffect(function(){return zo.push(u),n.setCallbacks({onScrollCapture:x,onWheelCapture:x,onTouchMoveCapture:b}),document.addEventListener("wheel",v,Lo),document.addEventListener("touchmove",v,Lo),document.addEventListener("touchstart",y,Lo),function(){zo=zo.filter(function(S){return S!==u}),document.removeEventListener("wheel",v,Lo),document.removeEventListener("touchmove",v,Lo),document.removeEventListener("touchstart",y,Lo)}},[]);var C=n.removeScrollBar,k=n.inert;return m.createElement(m.Fragment,null,k?m.createElement(u,{styles:WC(c)}):null,C?m.createElement(MC,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function GC(n){for(var r=null;n!==null;)n instanceof ShadowRoot&&(r=n.host,n=n.host),n=n.parentNode;return r}const KC=kC(ux,HC);var wd=m.forwardRef(function(n,r){return m.createElement(Zl,vn({},n,{ref:r,sideCar:KC}))});wd.classNames=Zl.classNames;var QC=function(n){if(typeof document>"u")return null;var r=Array.isArray(n)?n[0]:n;return r.ownerDocument.body},Fo=new WeakMap,bl=new WeakMap,kl={},mu=0,mx=function(n){return n&&(n.host||mx(n.parentNode))},YC=function(n,r){return r.map(function(i){if(n.contains(i))return i;var s=mx(i);return s&&n.contains(s)?s:(console.error("aria-hidden",i,"in not contained inside",n,". Doing nothing"),null)}).filter(function(i){return!!i})},qC=function(n,r,i,s){var c=YC(r,Array.isArray(n)?n:[n]);kl[i]||(kl[i]=new WeakMap);var u=kl[i],f=[],h=new Set,v=new Set(c),g=function(x){!x||h.has(x)||(h.add(x),g(x.parentNode))};c.forEach(g);var y=function(x){!x||v.has(x)||Array.prototype.forEach.call(x.children,function(b){if(h.has(b))y(b);else try{var C=b.getAttribute(s),k=C!==null&&C!=="false",S=(Fo.get(b)||0)+1,j=(u.get(b)||0)+1;Fo.set(b,S),u.set(b,j),f.push(b),S===1&&k&&bl.set(b,!0),j===1&&b.setAttribute(i,"true"),k||b.setAttribute(s,"true")}catch(E){console.error("aria-hidden: cannot operate on ",b,E)}})};return y(r),h.clear(),mu++,function(){f.forEach(function(x){var b=Fo.get(x)-1,C=u.get(x)-1;Fo.set(x,b),u.set(x,C),b||(bl.has(x)||x.removeAttribute(s),bl.delete(x)),C||x.removeAttribute(i)}),mu--,mu||(Fo=new WeakMap,Fo=new WeakMap,bl=new WeakMap,kl={})}},gx=function(n,r,i){i===void 0&&(i="data-aria-hidden");var s=Array.from(Array.isArray(n)?n:[n]),c=QC(n);return c?(s.push.apply(s,Array.from(c.querySelectorAll("[aria-live], script"))),qC(s,c,i,"aria-hidden")):function(){return null}},XC=Object.defineProperty,At=(n,r)=>XC(n,"name",{value:r,configurable:!0}),bd="Dialog",[vx,xx]=an(bd),[JC,cn]=vx(bd),kd=At(n=>{const{__scopeDialog:r,children:i,open:s,defaultOpen:c,onOpenChange:u,modal:f=!0}=n,h=m.useRef(null),v=m.useRef(null),{nodes:g,registry:y}=md(),[x,b]=qo({prop:s,defaultProp:c??!1,onChange:u,caller:bd}),[C,k]=m.useState(0),[S,j]=m.useState(0);return l.jsx(JC,{scope:r,triggerRef:h,contentRef:v,contentId:Sr(),titleId:Sr(),descriptionId:Sr(),titlePresent:C>0,descriptionPresent:S>0,setTitleCount:k,setDescriptionCount:j,open:x,onOpenChange:b,onOpenToggle:m.useCallback(()=>b(E=>!E),[b]),modal:f,branchNodes:g,branchRegistry:y,children:i})},"Dialog"),ZC="DialogTrigger",ej=m.forwardRef(At(function(r,i){const{__scopeDialog:s,...c}=r,u=cn(ZC,s),f=Ie(i,u.triggerRef);return l.jsx(ze.button,{type:"button","aria-haspopup":"dialog","aria-expanded":u.open,"aria-controls":u.open?u.contentId:void 0,"data-state":ea(u.open),...c,ref:f,onClick:Ce(r.onClick,u.onOpenToggle)})},"DialogTrigger")),yx="DialogPortal",[tj,wx]=vx(yx,{forceMount:void 0}),Cd=At(n=>{const{__scopeDialog:r,forceMount:i,children:s,container:c}=n,u=cn(yx,r);return l.jsx(tj,{scope:r,forceMount:i,children:m.Children.map(s,f=>l.jsx(Gn,{present:i||u.open,children:l.jsx(xd,{asChild:!0,container:c,children:f})}))})},"DialogPortal"),Uu="DialogOverlay",jd=m.forwardRef(At(function(r,i){const s=wx(Uu,r.__scopeDialog),{forceMount:c=s.forceMount,...u}=r,f=cn(Uu,r.__scopeDialog);return f.modal?l.jsx(Gn,{present:c||f.open,children:l.jsx(rj,{...u,ref:i})}):null},"DialogOverlay")),nj=$n("DialogOverlay.RemoveScroll"),rj=m.forwardRef(At(function(r,i){const{__scopeDialog:s,...c}=r,u=cn(Uu,s),f=Xv(),h=Ie(i,f);return l.jsx(wd,{as:nj,allowPinchZoom:!0,shards:m.useMemo(()=>[u.contentRef,...u.branchNodes.map(v=>({current:v}))],[u.contentRef,u.branchNodes]),children:l.jsx(ze.div,{"data-state":ea(u.open),...c,ref:h,style:{pointerEvents:"auto",...c.style}})})},"DialogOverlayImpl")),Ki="DialogContent",Sd=m.forwardRef(At(function(r,i){const s=wx(Ki,r.__scopeDialog),{forceMount:c=s.forceMount,...u}=r,f=cn(Ki,r.__scopeDialog);return l.jsx(Gn,{present:c||f.open,children:f.modal?l.jsx(oj,{...u,ref:i}):l.jsx(ij,{...u,ref:i})})},"DialogContent")),oj=m.forwardRef(At(function(r,i){const s=cn(Ki,r.__scopeDialog),c=m.useRef(null),u=Ie(i,s.contentRef,c);return m.useEffect(()=>{const f=c.current;if(f)return gx(f)},[]),l.jsx(bx,{...r,ref:u,trapFocus:s.open,disableOutsidePointerEvents:s.open,onCloseAutoFocus:Ce(r.onCloseAutoFocus,f=>{var h;f.preventDefault(),(h=s.triggerRef.current)==null||h.focus()}),onPointerDownOutside:Ce(r.onPointerDownOutside,f=>{const h=f.detail.originalEvent,v=h.button===0&&h.ctrlKey===!0;(h.button===2||v)&&f.preventDefault()}),onFocusOutside:Ce(r.onFocusOutside,f=>f.preventDefault())})},"DialogContentModal")),ij=m.forwardRef(At(function(r,i){const s=cn(Ki,r.__scopeDialog),c=m.useRef(!1),u=m.useRef(!1);return l.jsx(bx,{...r,ref:i,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:f=>{var h,v;(h=r.onCloseAutoFocus)==null||h.call(r,f),f.defaultPrevented||(c.current||(v=s.triggerRef.current)==null||v.focus(),f.preventDefault()),c.current=!1,u.current=!1},onInteractOutside:f=>{var g,y;(g=r.onInteractOutside)==null||g.call(r,f),f.defaultPrevented||(c.current=!0,f.detail.originalEvent.type==="pointerdown"&&(u.current=!0));const h=f.target;((y=s.triggerRef.current)==null?void 0:y.contains(h))&&f.preventDefault(),f.detail.originalEvent.type==="focusin"&&u.current&&f.preventDefault()}})},"DialogContentNonModal")),bx=m.forwardRef(At(function(r,i){const{__scopeDialog:s,trapFocus:c,onOpenAutoFocus:u,onCloseAutoFocus:f,"aria-describedby":h,children:v,...g}=r,y=cn(Ki,s);return Jl(),l.jsx(hd,{registry:y.branchRegistry,children:l.jsx(ex,{asChild:!0,loop:!0,trapped:c,branches:y.branchNodes,onMountAutoFocus:u,onUnmountAutoFocus:f,children:l.jsx(fd,{role:"dialog",id:y.contentId,"aria-labelledby":y.titlePresent?y.titleId:void 0,"aria-describedby":y.descriptionPresent?kx(h,y.descriptionId):h,"data-state":ea(y.open),...g,ref:i,deferPointerDownOutside:!0,onDismiss:()=>y.onOpenChange(!1),children:v})})})},"DialogContentImpl")),Ed=m.forwardRef(At(function(r,i){const{__scopeDialog:s,...c}=r,u=cn("DialogTitle",s),{setTitleCount:f}=u;return wt(()=>(f(h=>h+1),()=>f(h=>h-1)),[f]),l.jsx(ze.h2,{id:u.titleId,...c,ref:i})},"DialogTitle")),_d=m.forwardRef(At(function(r,i){const{__scopeDialog:s,...c}=r,u=cn("DialogDescription",s),{setDescriptionCount:f}=u;return wt(()=>(f(h=>h+1),()=>f(h=>h-1)),[f]),l.jsx(ze.p,{id:u.descriptionId,...c,ref:i})},"DialogDescription")),sj="DialogClose",es=m.forwardRef(At(function(r,i){const{__scopeDialog:s,...c}=r,u=cn(sj,s);return l.jsx(ze.button,{type:"button",...c,ref:i,onClick:Ce(r.onClick,()=>u.onOpenChange(!1))})},"DialogClose"));function kx(...n){const r=new Set;for(const i of n)if(typeof i=="string")for(const s of String(i).trim().split(/\s+/))s&&r.add(s);return r.size>0?Array.from(r).join(" "):void 0}At(kx,"concatAriaDescribedby");function ea(n){return n?"open":"closed"}At(ea,"getState");var lj=Object.defineProperty,Kn=(n,r)=>lj(n,"name",{value:r,configurable:!0}),aj="AlertDialog",[cj,q2]=an(aj,[xx]),Qn=xx(),uj=Kn(n=>{const{__scopeAlertDialog:r,...i}=n,s=Qn(r);return l.jsx(kd,{...s,...i,modal:!0})},"AlertDialog");m.forwardRef(Kn(function(r,i){const{__scopeAlertDialog:s,...c}=r,u=Qn(s);return l.jsx(ej,{...u,...c,ref:i})},"AlertDialogTrigger"));var dj=Kn(n=>{const{__scopeAlertDialog:r,...i}=n,s=Qn(r);return l.jsx(Cd,{...s,...i})},"AlertDialogPortal"),fj=m.forwardRef(Kn(function(r,i){const{__scopeAlertDialog:s,...c}=r,u=Qn(s);return l.jsx(jd,{...u,...c,ref:i})},"AlertDialogOverlay")),pj="AlertDialogContent",[hj,mj]=cj(pj),gj=m.forwardRef(Kn(function(r,i){const{__scopeAlertDialog:s,children:c,...u}=r,f=Qn(s),h=m.useRef(null),v=Ie(i,h),g=m.useRef(null);return l.jsx(hj,{scope:s,cancelRef:g,children:l.jsx(Sd,{role:"alertdialog",...f,...u,ref:v,onOpenAutoFocus:Ce(u.onOpenAutoFocus,y=>{var x;y.preventDefault(),(x=g.current)==null||x.focus({preventScroll:!0})}),onPointerDownOutside:y=>y.preventDefault(),onInteractOutside:y=>y.preventDefault(),children:c})})},"AlertDialogContent")),vj=m.forwardRef(Kn(function(r,i){const{__scopeAlertDialog:s,...c}=r,u=Qn(s);return l.jsx(Ed,{...u,...c,ref:i})},"AlertDialogTitle")),xj=m.forwardRef(Kn(function(r,i){const{__scopeAlertDialog:s,...c}=r,u=Qn(s);return l.jsx(_d,{...u,...c,ref:i})},"AlertDialogDescription")),yj=m.forwardRef(Kn(function(r,i){const{__scopeAlertDialog:s,...c}=r,u=Qn(s);return l.jsx(es,{...u,...c,ref:i})},"AlertDialogAction")),wj="AlertDialogCancel",bj=m.forwardRef(Kn(function(r,i){const{__scopeAlertDialog:s,...c}=r,{cancelRef:u}=mj(wj,s),f=Qn(s),h=Ie(i,u);return l.jsx(es,{...f,...c,ref:h})},"AlertDialogCancel")),kj=Object.defineProperty,Cj=(n,r)=>kj(n,"name",{value:r,configurable:!0});function Nd(n){const[r,i]=m.useState(void 0);return wt(()=>{if(n){i({width:n.offsetWidth,height:n.offsetHeight});let s=0;const c=new ResizeObserver(u=>{if(!Array.isArray(u)||!u.length)return;const f=u[0];window.cancelAnimationFrame(s),s=window.requestAnimationFrame(()=>{let h,v;if("borderBoxSize"in f){const g=f.borderBoxSize,y=Array.isArray(g)?g[0]:g;h=y.inlineSize,v=y.blockSize}else h=n.offsetWidth,v=n.offsetHeight;i({width:h,height:v})})});return c.observe(n,{box:"border-box"}),()=>{window.cancelAnimationFrame(s),c.unobserve(n)}}else i(void 0)},[n]),r}Cj(Nd,"useSize");var jj=Object.defineProperty,Bn=(n,r)=>jj(n,"name",{value:r,configurable:!0}),Rd="Checkbox",[Sj,X2]=an(Rd),[Ej,Pd]=Sj(Rd);function Cx(n){const{__scopeCheckbox:r,checked:i,children:s,defaultChecked:c,disabled:u,form:f,name:h,onCheckedChange:v,required:g,value:y="on",internal_do_not_use_render:x}=n,[b,C]=qo({prop:i,defaultProp:c??!1,onChange:v,caller:Rd}),[k,S]=m.useState(null),[j,E]=m.useState(null),[D,T]=m.useState(null),P=k?!!f||!!k.closest("form"):!0,R={checked:b,disabled:u,setChecked:C,control:k,setControl:S,name:h,form:f,value:y,userClick:D,onUserClick:T,required:g,defaultChecked:qt(c)?!1:c,isFormControl:P,bubbleInput:j,setBubbleInput:E};return l.jsx(Ej,{scope:r,...R,children:jx(x)?x(R):s})}Bn(Cx,"CheckboxProvider");var _j="CheckboxTrigger",Nj=m.forwardRef(Bn(function({__scopeCheckbox:r,onKeyDown:i,onClick:s,...c},u){const{control:f,value:h,disabled:v,checked:g,required:y,setControl:x,setChecked:b,onUserClick:C,isFormControl:k,bubbleInput:S}=Pd(_j,r),j=Ie(u,x),E=m.useRef(g);return m.useEffect(()=>{const D=f==null?void 0:f.form;if(D){const T=Bn(()=>b(E.current),"reset");return D.addEventListener("reset",T),()=>D.removeEventListener("reset",T)}},[f,b]),l.jsx(ze.button,{type:"button",role:"checkbox","aria-checked":qt(g)?"mixed":g,"aria-required":y,"data-state":Dd(g),"data-disabled":v?"":void 0,disabled:v,value:h,...c,ref:j,onKeyDown:Ce(i,D=>{D.key==="Enter"&&D.preventDefault()}),onClick:Ce(s,D=>{const T=D.isPropagationStopped();C({requestedChecked:qt(g)?!0:!g,hasConsumerStoppedPropagation:T}),b(P=>qt(P)?!0:!P),S&&k&&(T||D.stopPropagation())})})},"CheckboxTrigger")),Rj=m.forwardRef(Bn(function(r,i){const{__scopeCheckbox:s,name:c,checked:u,defaultChecked:f,required:h,disabled:v,value:g,onCheckedChange:y,form:x,...b}=r;return l.jsx(Cx,{__scopeCheckbox:s,checked:u,defaultChecked:f,disabled:v,required:h,onCheckedChange:y,name:c,form:x,value:g,internal_do_not_use_render:({isFormControl:C})=>l.jsxs(l.Fragment,{children:[l.jsx(Nj,{...b,ref:i,__scopeCheckbox:s}),C&&l.jsx(Oj,{__scopeCheckbox:s})]})})},"Checkbox")),Pj="CheckboxIndicator",Dj=m.forwardRef(Bn(function(r,i){const{__scopeCheckbox:s,forceMount:c,...u}=r,f=Pd(Pj,s);return l.jsx(Gn,{present:c||qt(f.checked)||f.checked===!0,children:l.jsx(ze.span,{"data-state":Dd(f.checked),"data-disabled":f.disabled?"":void 0,...u,ref:i,style:{pointerEvents:"none",...r.style}})})},"CheckboxIndicator")),Tj="CheckboxBubbleInput",Oj=m.forwardRef(Bn(function({__scopeCheckbox:r,onClick:i,...s},c){const{control:u,userClick:f,checked:h,defaultChecked:v,required:g,disabled:y,name:x,value:b,form:C,bubbleInput:k,setBubbleInput:S}=Pd(Tj,r),j=Ie(c,S),E=Nd(u),D=m.useRef(!1),T=m.useRef(h),P=m.useRef(f),R=m.useRef(null);m.useEffect(()=>{const I=k;if(!I)return;const L=window.HTMLInputElement.prototype,ee=Object.getOwnPropertyDescriptor(L,"checked").set;if(!ee)return;const J=T.current!==h;T.current=h;const ne=f!==null&&f!==P.current;if(P.current=f,ne)R.current=J?null:f,J&&(I.indeterminate=qt(h),ee.call(I,qt(h)?!1:h)),I.dispatchEvent(new Event("click",{bubbles:!f.hasConsumerStoppedPropagation}));else if(J){const de=R.current;R.current=null;const re=(de==null?void 0:de.requestedChecked)===h;D.current=!0,I.indeterminate=qt(h),ee.call(I,qt(h)?!1:h),I.dispatchEvent(new Event("click",{bubbles:!(re&&de.hasConsumerStoppedPropagation)})),D.current=!1}},[k,h,f]);const N=m.useRef(qt(h)?!1:h);return l.jsx(ze.input,{type:"checkbox","aria-hidden":!0,defaultChecked:v??N.current,required:g,disabled:y,name:x,value:b,form:C,...s,tabIndex:-1,ref:j,onClick:Ce(i,I=>{D.current&&I.stopPropagation()}),style:{...s.style,...E,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function jx(n){return typeof n=="function"}Bn(jx,"isFunction");function qt(n){return n==="indeterminate"}Bn(qt,"isIndeterminate");function Dd(n){return qt(n)?"indeterminate":n?"checked":"unchecked"}Bn(Dd,"getState");const Mj=["top","right","bottom","left"],_r=Math.min,An=Math.max,Ll=Math.round,Cl=Math.floor,In=n=>({x:n,y:n}),Aj={left:"right",right:"left",bottom:"top",top:"bottom"};function Sx(n,r,i){return An(n,_r(r,i))}function Wn(n,r){return typeof n=="function"?n(r):n}function Nr(n){return n.split("-")[0]}function Xo(n){return n.split("-")[1]}function Td(n){return n==="x"?"y":"x"}function Od(n){return n==="y"?"height":"width"}function xn(n){const r=n[0];return r==="t"||r==="b"?"y":"x"}function Md(n){return Td(xn(n))}function Ij(n,r,i){i===void 0&&(i=!1);const s=Xo(n),c=Md(n),u=Od(c);let f=c==="x"?s===(i?"end":"start")?"right":"left":s==="start"?"bottom":"top";return r.reference[u]>r.floating[u]&&(f=zl(f)),[f,zl(f)]}function Lj(n){const r=zl(n);return[Bu(n),r,Bu(r)]}function Bu(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}const Fm=["left","right"],$m=["right","left"],zj=["top","bottom"],Fj=["bottom","top"];function $j(n,r,i){switch(n){case"top":case"bottom":return i?r?$m:Fm:r?Fm:$m;case"left":case"right":return r?zj:Fj;default:return[]}}function Uj(n,r,i,s){const c=Xo(n);let u=$j(Nr(n),i==="start",s);return c&&(u=u.map(f=>f+"-"+c),r&&(u=u.concat(u.map(Bu)))),u}function zl(n){const r=Nr(n);return Aj[r]+n.slice(r.length)}function Bj(n){var r,i,s,c;return{top:(r=n.top)!=null?r:0,right:(i=n.right)!=null?i:0,bottom:(s=n.bottom)!=null?s:0,left:(c=n.left)!=null?c:0}}function Ex(n){return typeof n!="number"?Bj(n):{top:n,right:n,bottom:n,left:n}}function Fl(n){const{x:r,y:i,width:s,height:c}=n;return{width:s,height:c,top:i,left:r,right:r+s,bottom:i+c,x:r,y:i}}function Um(n,r,i){let{reference:s,floating:c}=n;const u=xn(r),f=Md(r),h=Od(f),v=Nr(r),g=u==="y",y=s.x+s.width/2-c.width/2,x=s.y+s.height/2-c.height/2,b=s[h]/2-c[h]/2;let C;switch(v){case"top":C={x:y,y:s.y-c.height};break;case"bottom":C={x:y,y:s.y+s.height};break;case"right":C={x:s.x+s.width,y:x};break;case"left":C={x:s.x-c.width,y:x};break;default:C={x:s.x,y:s.y}}const k=Xo(r);return k&&(C[f]+=b*(k==="end"?1:-1)*(i&&g?-1:1)),C}async function Wj(n,r){var i;r===void 0&&(r={});const{x:s,y:c,platform:u,rects:f,elements:h,strategy:v}=n,{boundary:g="clippingAncestors",rootBoundary:y="viewport",elementContext:x="floating",altBoundary:b=!1,padding:C=0}=Wn(r,n),k=Ex(C),j=h[b?x==="floating"?"reference":"floating":x],E=Fl(await u.getClippingRect({element:(i=await(u.isElement==null?void 0:u.isElement(j)))==null||i?j:j.contextElement||await(u.getDocumentElement==null?void 0:u.getDocumentElement(h.floating)),boundary:g,rootBoundary:y,strategy:v})),D=x==="floating"?{x:s,y:c,width:f.floating.width,height:f.floating.height}:f.reference,T=await(u.getOffsetParent==null?void 0:u.getOffsetParent(h.floating)),P=await(u.isElement==null?void 0:u.isElement(T))&&await(u.getScale==null?void 0:u.getScale(T))||{x:1,y:1},R=Fl(u.convertOffsetParentRelativeRectToViewportRelativeRect?await u.convertOffsetParentRelativeRectToViewportRelativeRect({elements:h,rect:D,offsetParent:T,strategy:v}):D);return{top:(E.top-R.top+k.top)/P.y,bottom:(R.bottom-E.bottom+k.bottom)/P.y,left:(E.left-R.left+k.left)/P.x,right:(R.right-E.right+k.right)/P.x}}const Vj=50,Hj=async(n,r,i)=>{const{placement:s="bottom",strategy:c="absolute",middleware:u=[],platform:f}=i,h=f.detectOverflow?f:{...f,detectOverflow:Wj},v=await(f.isRTL==null?void 0:f.isRTL(r));let g=await f.getElementRects({reference:n,floating:r,strategy:c}),{x:y,y:x}=Um(g,s,v),b=s,C=0;const k={};for(let S=0;S({name:"arrow",options:n,async fn(r){const{x:i,y:s,placement:c,rects:u,platform:f,elements:h,middlewareData:v}=r,{element:g,padding:y=0}=Wn(n,r)||{};if(g==null)return{};const x=Ex(y),b={x:i,y:s},C=Md(c),k=Od(C),S=await f.getDimensions(g),j=C==="y",E=j?"top":"left",D=j?"bottom":"right",T=j?"clientHeight":"clientWidth",P=u.reference[k]+u.reference[C]-b[C]-u.floating[k],R=b[C]-u.reference[C],N=await(f.getOffsetParent==null?void 0:f.getOffsetParent(g));let I=N?N[T]:0;(!I||!await(f.isElement==null?void 0:f.isElement(N)))&&(I=h.floating[T]||u.floating[k]);const L=P/2-R/2,Q=I/2-S[k]/2-1,ee=_r(x[E],Q),J=_r(x[D],Q),ne=I-S[k]-J,de=I/2-S[k]/2+L,re=Sx(ee,de,ne),ie=!v.arrow&&Xo(c)!=null&&de!==re&&u.reference[k]/2-(dere<=0)){var J,ne;const re=(((J=u.flip)==null?void 0:J.index)||0)+1,ie=I[re];if(ie&&(!(x==="alignment"?D!==xn(ie):!1)||ee.every(W=>xn(W.placement)===D?W.overflows[0]>0:!0)))return{data:{index:re,overflows:ee},reset:{placement:ie}};let B=(ne=ee.filter(Z=>Z.overflows[0]<=0).sort((Z,W)=>Z.overflows[1]-W.overflows[1])[0])==null?void 0:ne.placement;if(!B)switch(C){case"bestFit":{var de;const Z=(de=ee.filter(W=>{if(N){const q=xn(W.placement);return q===D||q==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(q=>q>0).reduce((q,F)=>q+F,0)]).sort((W,q)=>W[1]-q[1])[0])==null?void 0:de[0];Z&&(B=Z);break}case"initialPlacement":B=h;break}if(c!==B)return{reset:{placement:B}}}return{}}}};function Bm(n,r){return{top:n.top-r.height,right:n.right-r.width,bottom:n.bottom-r.height,left:n.left-r.width}}function Wm(n){return Mj.some(r=>n[r]>=0)}const Qj=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(r){const{rects:i,platform:s}=r,{strategy:c="referenceHidden",...u}=Wn(n,r);switch(c){case"referenceHidden":{const f=await s.detectOverflow(r,{...u,elementContext:"reference"}),h=Bm(f,i.reference);return{data:{referenceHiddenOffsets:h,referenceHidden:Wm(h)}}}case"escaped":{const f=await s.detectOverflow(r,{...u,altBoundary:!0}),h=Bm(f,i.floating);return{data:{escapedOffsets:h,escaped:Wm(h)}}}default:return{}}}}},_x=new Set(["left","top"]);async function Yj(n,r){const{placement:i,platform:s,elements:c}=n,u=await(s.isRTL==null?void 0:s.isRTL(c.floating)),f=Nr(i),h=Xo(i),v=xn(i)==="y",g=_x.has(f)?-1:1,y=u&&v?-1:1,x=Wn(r,n);let{mainAxis:b,crossAxis:C,alignmentAxis:k}=typeof x=="number"?{mainAxis:x,crossAxis:0,alignmentAxis:null}:{mainAxis:x.mainAxis||0,crossAxis:x.crossAxis||0,alignmentAxis:x.alignmentAxis};return h&&typeof k=="number"&&(C=h==="end"?k*-1:k),v?{x:C*y,y:b*g}:{x:b*g,y:C*y}}const qj=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(r){var i,s;const{x:c,y:u,placement:f,middlewareData:h}=r,v=await Yj(r,n);return f===((i=h.offset)==null?void 0:i.placement)&&(s=h.arrow)!=null&&s.alignmentOffset?{}:{x:c+v.x,y:u+v.y,data:{...v,placement:f}}}}},Xj=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(r){const{x:i,y:s,placement:c,platform:u}=r,{mainAxis:f=!0,crossAxis:h=!1,limiter:v={fn:D=>{let{x:T,y:P}=D;return{x:T,y:P}}},...g}=Wn(n,r),y={x:i,y:s},x=await u.detectOverflow(r,g),b=xn(c),C=Td(b);let k=y[C],S=y[b];const j=(D,T)=>Sx(T+x[D==="y"?"top":"left"],T,T-x[D==="y"?"bottom":"right"]);f&&(k=j(C,k)),h&&(S=j(b,S));const E=v.fn({...r,[C]:k,[b]:S});return{...E,data:{x:E.x-i,y:E.y-s,enabled:{[C]:f,[b]:h}}}}}},Jj=function(n){return n===void 0&&(n={}),{options:n,fn(r){var i,s;const{x:c,y:u,placement:f,rects:h,middlewareData:v}=r,{offset:g=0,mainAxis:y=!0,crossAxis:x=!0}=Wn(n,r),b={x:c,y:u},C=xn(f),k=Td(C);let S=b[k],j=b[C];const E=Wn(g,r),D=typeof E=="number"?{mainAxis:E,crossAxis:0}:{mainAxis:(i=E.mainAxis)!=null?i:0,crossAxis:(s=E.crossAxis)!=null?s:0};if(y){const R=k==="y"?"height":"width",N=h.reference[k]-h.floating[R]+D.mainAxis,I=h.reference[k]+h.reference[R]-D.mainAxis;SI&&(S=I)}if(x){var T,P;const R=k==="y"?"width":"height",N=_x.has(Nr(f)),I=h.reference[C]-h.floating[R]+(N&&((T=v.offset)==null?void 0:T[C])||0)+(N?0:D.crossAxis),L=h.reference[C]+h.reference[R]+(N?0:((P=v.offset)==null?void 0:P[C])||0)-(N?D.crossAxis:0);jL&&(j=L)}return{[k]:S,[C]:j}}}},Zj=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(r){const{placement:i,rects:s,platform:c,elements:u}=r,{apply:f=()=>{},...h}=Wn(n,r),v=await c.detectOverflow(r,h),g=Nr(i),y=Xo(i),x=xn(i)==="y",{width:b,height:C}=s.floating;let k,S;g==="top"||g==="bottom"?(k=g,S=y===(await(c.isRTL==null?void 0:c.isRTL(u.floating))?"start":"end")?"left":"right"):(S=g,k=y==="end"?"top":"bottom");const j=C-v.top-v.bottom,E=b-v.left-v.right,D=_r(C-v[k],j),T=_r(b-v[S],E),P=r.middlewareData.shift,R=!P;let N=D,I=T;P!=null&&P.enabled.x&&(I=E),P!=null&&P.enabled.y&&(N=j),R&&!y&&(x?I=b-2*An(v.left,v.right):N=C-2*An(v.top,v.bottom)),await f({...r,availableWidth:I,availableHeight:N});const L=await c.getDimensions(u.floating);return b!==L.width||C!==L.height?{reset:{rects:!0}}:{}}}};function ta(){return typeof window<"u"}function Jo(n){return Nx(n)?(n.nodeName||"").toLowerCase():"#document"}function Ot(n){var r;return(n==null||(r=n.ownerDocument)==null?void 0:r.defaultView)||window}function Yn(n){var r;return(r=(Nx(n)?n.ownerDocument:n.document)||window.document)==null?void 0:r.documentElement}function Nx(n){return ta()?n instanceof Node||n instanceof Ot(n).Node:!1}function wn(n){return ta()?n instanceof Element||n instanceof Ot(n).Element:!1}function Or(n){return ta()?n instanceof HTMLElement||n instanceof Ot(n).HTMLElement:!1}function Vm(n){return!ta()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Ot(n).ShadowRoot}function na(n){const{overflow:r,overflowX:i,overflowY:s,display:c}=bn(n);return/auto|scroll|overlay|hidden|clip/.test(r+s+i)&&c!=="inline"&&c!=="contents"}function eS(n){return/^(table|td|th)$/.test(Jo(n))}function ra(n){try{if(n.matches(":popover-open"))return!0}catch{}try{return n.matches(":modal")}catch{return!1}}const tS=/transform|translate|scale|rotate|perspective|filter/,nS=/paint|layout|strict|content/,qr=n=>!!n&&n!=="none";let gu;function Ad(n){const r=wn(n)?bn(n):n;return qr(r.transform)||qr(r.translate)||qr(r.scale)||qr(r.rotate)||qr(r.perspective)||!Id()&&(qr(r.backdropFilter)||qr(r.filter))||tS.test(r.willChange||"")||nS.test(r.contain||"")}function rS(n){let r=Zr(n);for(;Or(r)&&!Qi(r);){if(Ad(r))return r;if(ra(r))return null;r=Zr(r)}return null}function Id(){return gu==null&&(gu=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),gu}function Qi(n){return/^(html|body|#document)$/.test(Jo(n))}function bn(n){return Ot(n).getComputedStyle(n)}function oa(n){return wn(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Zr(n){if(Jo(n)==="html")return n;const r=n.assignedSlot||n.parentNode||Vm(n)&&n.host||Yn(n);return Vm(r)?r.host:r}function Rx(n){const r=Zr(n);return Qi(r)?(n.ownerDocument||n).body:Or(r)&&na(r)?r:Rx(r)}function Yi(n,r,i){var s;r===void 0&&(r=[]),i===void 0&&(i=!0);const c=Rx(n),u=c===((s=n.ownerDocument)==null?void 0:s.body),f=Ot(c);if(u){const h=Wu(f);return r.concat(f,f.visualViewport||[],na(c)?c:[],h&&i?Yi(h):[])}else return r.concat(c,Yi(c,[],i))}function Wu(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Px(n){const r=bn(n);let i=parseFloat(r.width)||0,s=parseFloat(r.height)||0;const c=Or(n),u=c?n.offsetWidth:i,f=c?n.offsetHeight:s,h=Ll(i)!==u||Ll(s)!==f;return h&&(i=u,s=f),{width:i,height:s,$:h}}function Ld(n){return wn(n)?n:n.contextElement}function Wo(n){const r=Ld(n);if(!Or(r))return In(1);const i=r.getBoundingClientRect(),{width:s,height:c,$:u}=Px(r);let f=(u?Ll(i.width):i.width)/s,h=(u?Ll(i.height):i.height)/c;return(!f||!Number.isFinite(f))&&(f=1),(!h||!Number.isFinite(h))&&(h=1),{x:f,y:h}}const oS=In(0);function Dx(n){const r=Ot(n);return!Id()||!r.visualViewport?oS:{x:r.visualViewport.offsetLeft,y:r.visualViewport.offsetTop}}function iS(n,r,i){return r===void 0&&(r=!1),!!i&&r&&i===Ot(n)}function eo(n,r,i,s){r===void 0&&(r=!1),i===void 0&&(i=!1);const c=n.getBoundingClientRect(),u=Ld(n);let f=In(1);r&&(s?wn(s)&&(f=Wo(s)):f=Wo(n));const h=iS(u,i,s)?Dx(u):In(0);let v=(c.left+h.x)/f.x,g=(c.top+h.y)/f.y,y=c.width/f.x,x=c.height/f.y;if(u&&s){const b=Ot(u),C=wn(s)?Ot(s):s;let k=b,S=Wu(k);for(;S&&C!==k;){const j=Wo(S),E=S.getBoundingClientRect(),D=bn(S),T=E.left+(S.clientLeft+parseFloat(D.paddingLeft))*j.x,P=E.top+(S.clientTop+parseFloat(D.paddingTop))*j.y;v*=j.x,g*=j.y,y*=j.x,x*=j.y,v+=T,g+=P,k=Ot(S),S=Wu(k)}}return Fl({width:y,height:x,x:v,y:g})}function ia(n,r){const i=oa(n).scrollLeft;return r?r.left+i:eo(Yn(n)).left+i}function Tx(n,r){const i=n.getBoundingClientRect(),s=i.left+r.scrollLeft-ia(n,i),c=i.top+r.scrollTop;return{x:s,y:c}}function sS(n){let{elements:r,rect:i,offsetParent:s,strategy:c}=n;const u=c==="fixed",f=Yn(s),h=r?ra(r.floating):!1;if(s===f||h&&u)return i;let v={scrollLeft:0,scrollTop:0},g=In(1);const y=In(0),x=Or(s);if((x||!u)&&((Jo(s)!=="body"||na(f))&&(v=oa(s)),x)){const C=eo(s);g=Wo(s),y.x=C.x+s.clientLeft,y.y=C.y+s.clientTop}const b=f&&!x&&!u?Tx(f,v):In(0);return{width:i.width*g.x,height:i.height*g.y,x:i.x*g.x-v.scrollLeft*g.x+y.x+b.x,y:i.y*g.y-v.scrollTop*g.y+y.y+b.y}}function lS(n){return n.getClientRects?Array.from(n.getClientRects()):[]}function aS(n){const r=oa(n),i=n.ownerDocument.body,s=An(n.scrollWidth,n.clientWidth,i.scrollWidth,i.clientWidth),c=An(n.scrollHeight,n.clientHeight,i.scrollHeight,i.clientHeight);let u=-r.scrollLeft+ia(n);const f=-r.scrollTop;return bn(i).direction==="rtl"&&(u+=An(n.clientWidth,i.clientWidth)-s),{width:s,height:c,x:u,y:f}}const cS=25;function uS(n,r,i){i===void 0&&(i="viewport");const s=i==="layoutViewport",c=Ot(n),u=Yn(n),f=c.visualViewport;let h=u.clientWidth,v=u.clientHeight,g=0,y=0;if(f){const b=!Id()||r==="fixed";s?b||(g=-f.offsetLeft,y=-f.offsetTop):(h=f.width,v=f.height,b&&(g=f.offsetLeft,y=f.offsetTop))}if(ia(u)<=0){const b=u.ownerDocument,C=b.body,k=getComputedStyle(C),S=b.compatMode==="CSS1Compat"&&parseFloat(k.marginLeft)+parseFloat(k.marginRight)||0,j=Math.abs(u.clientWidth-C.clientWidth-S),E=getComputedStyle(u).scrollbarGutter==="stable both-edges"?j/2:j;E<=cS&&(h-=E)}return{width:h,height:v,x:g,y}}function dS(n,r){const i=eo(n,!0,r==="fixed"),s=i.top+n.clientTop,c=i.left+n.clientLeft,u=Wo(n),f=n.clientWidth*u.x,h=n.clientHeight*u.y,v=c*u.x,g=s*u.y;return{width:f,height:h,x:v,y:g}}function Hm(n,r,i){let s;if(r==="viewport"||r==="layoutViewport")s=uS(n,i,r);else if(r==="document")s=aS(Yn(n));else if(wn(r))s=dS(r,i);else{const c=Dx(n);s={x:r.x-c.x,y:r.y-c.y,width:r.width,height:r.height}}return Fl(s)}function fS(n,r){const i=r.get(n);if(i)return i;let s=Yi(n,[],!1).filter(h=>wn(h)&&Jo(h)!=="body"),c=null;const u=bn(n).position==="fixed";let f=u?Zr(n):n;for(;wn(f)&&!Qi(f);){const h=bn(f),v=Ad(f),g=c?c.position:u?"fixed":"";!v&&(g==="fixed"||g==="absolute"&&h.position==="static")?s=s.filter(x=>x!==f):c=h,f=Zr(f)}return r.set(n,s),s}function pS(n){let{element:r,boundary:i,rootBoundary:s,strategy:c}=n;const f=[...i==="clippingAncestors"?ra(r)?[]:fS(r,this._c):[].concat(i),s],h=Hm(r,f[0],c);let v=h.top,g=h.right,y=h.bottom,x=h.left;for(let b=1;b{h(!1,1e-7)},1e3)}I=!1}try{s=new IntersectionObserver(L,{...N,root:u.ownerDocument})}catch{s=new IntersectionObserver(L,N)}s.observe(n)}const v=Ot(n),g=()=>h(i);return v.addEventListener("resize",g),h(!0),()=>{v.removeEventListener("resize",g),f()}}function wS(n,r,i,s){s===void 0&&(s={});const{ancestorScroll:c=!0,ancestorResize:u=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:h=typeof IntersectionObserver=="function",animationFrame:v=!1}=s,g=Ld(n),y=c||u?[...g?Yi(g):[],...r?Yi(r):[]]:[];y.forEach(E=>{c&&E.addEventListener("scroll",i),u&&E.addEventListener("resize",i)});const x=g&&h?yS(g,i,u):null;let b=-1,C=null;f&&(C=new ResizeObserver(E=>{let[D]=E;D&&D.target===g&&C&&r&&(C.unobserve(r),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var T;(T=C)==null||T.observe(r)})),i()}),g&&!v&&C.observe(g),r&&C.observe(r));let k,S=v?eo(n):null;v&&j();function j(){const E=eo(n);S&&!Mx(S,E)&&i(),S=E,k=requestAnimationFrame(j)}return i(),()=>{var E;y.forEach(D=>{c&&D.removeEventListener("scroll",i),u&&D.removeEventListener("resize",i)}),x==null||x(),(E=C)==null||E.disconnect(),C=null,v&&cancelAnimationFrame(k)}}const bS=qj,kS=Xj,CS=Kj,jS=Zj,SS=Qj,Km=Gj,ES=Jj,_S=(n,r,i)=>{const s=new Map,c=i??{},u={...xS,...c.platform,_c:s};return Hj(n,r,{...c,platform:u})};var NS=typeof document<"u",RS=function(){},Dl=NS?m.useLayoutEffect:RS;function $l(n,r){if(n===r)return!0;if(typeof n!=typeof r)return!1;if(typeof n=="function"&&n.toString()===r.toString())return!0;let i,s,c;if(n&&r&&typeof n=="object"){if(Array.isArray(n)){if(i=n.length,i!==r.length)return!1;for(s=i;s--!==0;)if(!$l(n[s],r[s]))return!1;return!0}if(c=Object.keys(n),i=c.length,i!==Object.keys(r).length)return!1;for(s=i;s--!==0;)if(!{}.hasOwnProperty.call(r,c[s]))return!1;for(s=i;s--!==0;){const u=c[s];if(!(u==="_owner"&&n.$$typeof)&&!$l(n[u],r[u]))return!1}return!0}return n!==n&&r!==r}function Ax(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function Qm(n,r){const i=Ax(n);return Math.round(r*i)/i}function xu(n){const r=m.useRef(n);return Dl(()=>{r.current=n}),r}function PS(n){n===void 0&&(n={});const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:c,elements:{reference:u,floating:f}={},transform:h=!0,whileElementsMounted:v,open:g}=n,[y,x]=m.useState({x:0,y:0,strategy:i,placement:r,middlewareData:{},isPositioned:!1}),[b,C]=m.useState(s);$l(b,s)||C(s);const[k,S]=m.useState(null),[j,E]=m.useState(null),D=m.useCallback(W=>{W!==N.current&&(N.current=W,S(W))},[]),T=m.useCallback(W=>{W!==I.current&&(I.current=W,E(W))},[]),P=u||k,R=f||j,N=m.useRef(null),I=m.useRef(null),L=m.useRef(y),Q=v!=null,ee=xu(v),J=xu(c),ne=xu(g),de=m.useCallback(()=>{if(!N.current||!I.current)return;const W={placement:r,strategy:i,middleware:b};J.current&&(W.platform=J.current),_S(N.current,I.current,W).then(q=>{const F={...q,isPositioned:ne.current!==!1};re.current&&!$l(L.current,F)&&(L.current=F,ed.flushSync(()=>{x(F)}))})},[b,r,i,J,ne]);Dl(()=>{g===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,x(W=>({...W,isPositioned:!1})))},[g]);const re=m.useRef(!1);Dl(()=>(re.current=!0,()=>{re.current=!1}),[]),Dl(()=>{if(P&&(N.current=P),R&&(I.current=R),P&&R){if(ee.current)return ee.current(P,R,de);de()}},[P,R,de,ee,Q]);const ie=m.useMemo(()=>({reference:N,floating:I,setReference:D,setFloating:T}),[D,T]),B=m.useMemo(()=>({reference:P,floating:R}),[P,R]),Z=m.useMemo(()=>{const W={position:i,left:0,top:0};if(!B.floating)return W;const q=Qm(B.floating,y.x),F=Qm(B.floating,y.y);return h?{...W,transform:"translate("+q+"px, "+F+"px)",...Ax(B.floating)>=1.5&&{willChange:"transform"}}:{position:i,left:q,top:F}},[i,h,B.floating,y.x,y.y]);return m.useMemo(()=>({...y,update:de,refs:ie,elements:B,floatingStyles:Z}),[y,de,ie,B,Z])}const DS=n=>{function r(i){return{}.hasOwnProperty.call(i,"current")}return{name:"arrow",options:n,fn(i){const{element:s,padding:c}=typeof n=="function"?n(i):n;return s&&r(s)?s.current!=null?Km({element:s.current,padding:c}).fn(i):{}:s?Km({element:s,padding:c}).fn(i):{}}}},TS=(n,r)=>{const i=bS(n);return{name:i.name,fn:i.fn,options:[n,r]}},OS=(n,r)=>{const i=kS(n);return{name:i.name,fn:i.fn,options:[n,r]}},MS=(n,r)=>({fn:ES(n).fn,options:[n,r]}),AS=(n,r)=>{const i=CS(n);return{name:i.name,fn:i.fn,options:[n,r]}},IS=(n,r)=>{const i=jS(n);return{name:i.name,fn:i.fn,options:[n,r]}},LS=(n,r)=>{const i=SS(n);return{name:i.name,fn:i.fn,options:[n,r]}},zS=(n,r)=>{const i=DS(n);return{name:i.name,fn:i.fn,options:[n,r]}};var FS=Object.defineProperty,$S=(n,r)=>FS(n,"name",{value:r,configurable:!0}),US=m.forwardRef($S(function(r,i){const{children:s,width:c=10,height:u=5,...f}=r;return l.jsx(ze.svg,{...f,ref:i,width:c,height:u,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:r.asChild?s:l.jsx("polygon",{points:"0,0 30,0 15,10"})})},"Arrow")),BS=Object.defineProperty,Ln=(n,r)=>BS(n,"name",{value:r,configurable:!0}),Ym={Partial:"partial"},qm={Optimized:"optimized",Always:"always"},Ix="Popper",[Lx,sa]=an(Ix),[WS,zx]=Lx(Ix),Fx=Ln(n=>{const{__scopePopper:r,children:i}=n,[s,c]=m.useState(null),[u,f]=m.useState(void 0);return l.jsx(WS,{scope:r,anchor:s,onAnchorChange:c,placementState:u,setPlacementState:f,children:i})},"Popper"),VS="PopperAnchor",$x=m.forwardRef(Ln(function(r,i){const{__scopePopper:s,virtualRef:c,...u}=r,f=zx(VS,s),h=m.useRef(null),v=f.onAnchorChange,g=m.useCallback(S=>{h.current=S,S&&v(S)},[v]),y=Ie(i,g),x=m.useRef(null);m.useEffect(()=>{if(!c)return;const S=x.current;x.current=c.current,S!==x.current&&v(x.current)});const b=f.placementState&&la(f.placementState),C=b==null?void 0:b[0],k=b==null?void 0:b[1];return c?null:l.jsx(ze.div,{"data-radix-popper-side":C,"data-radix-popper-align":k,...u,ref:y})},"PopperAnchor")),Ux="PopperContent",[HS,GS]=Lx(Ux),Bx=m.forwardRef(Ln(function(r,i){var me,Be,mt,It,ut,tt,Jn;const{__scopePopper:s,side:c="bottom",sideOffset:u=0,align:f="center",alignOffset:h=0,arrowPadding:v=0,avoidCollisions:g=!0,collisionBoundary:y=[],collisionPadding:x=0,sticky:b=Ym.Partial,hideWhenDetached:C=!1,updatePositionStrategy:k=qm.Optimized,onPlaced:S,...j}=r,E=zx(Ux,s),[D,T]=m.useState(null),P=Ie(i,T),[R,N]=m.useState(null),I=Nd(R),L=(I==null?void 0:I.width)??0,Q=(I==null?void 0:I.height)??0,ee=c+(f!=="center"?"-"+f:""),J=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},ne=Array.isArray(y)?y:[y],de=ne.length>0,re={padding:J,boundary:ne.filter(Wx),altBoundary:de},{refs:ie,floatingStyles:B,placement:Z,isPositioned:W,middlewareData:q}=PS({strategy:"fixed",placement:ee,whileElementsMounted:Ln((...Cn)=>wS(...Cn,{animationFrame:k===qm.Always}),"whileElementsMounted"),elements:{reference:E.anchor},middleware:[TS({mainAxis:u+Q,alignmentAxis:h}),g&&OS({mainAxis:!0,crossAxis:!1,...b===Ym.Partial?{limiter:MS()}:{},...re}),g&&AS({...re}),IS({...re,apply:Ln(({elements:Cn,rects:dt,availableWidth:is,availableHeight:ti})=>{const{width:Mr,height:Zn}=dt.reference,er=Cn.floating.style;er.setProperty("--radix-popper-available-width",`${is}px`),er.setProperty("--radix-popper-available-height",`${ti}px`),er.setProperty("--radix-popper-anchor-width",`${Mr}px`),er.setProperty("--radix-popper-anchor-height",`${Zn}px`)},"apply")}),R&&zS({element:R,padding:v}),qS({arrowWidth:L,arrowHeight:Q}),C&&LS(de?{strategy:"referenceHidden",...re}:{strategy:"referenceHidden",padding:re.padding,altBoundary:re.altBoundary})]}),F=E.setPlacementState;wt(()=>(F(Z),()=>{F(void 0)}),[Z,F]);const[M,V]=la(Z),he=yn(S);wt(()=>{W&&(he==null||he())},[W,he]);const be=(me=q.arrow)==null?void 0:me.x,pe=(Be=q.arrow)==null?void 0:Be.y,Y=((mt=q.arrow)==null?void 0:mt.centerOffset)!==0,[we,ke]=m.useState();return wt(()=>{D&&ke(window.getComputedStyle(D).zIndex)},[D]),l.jsx("div",{ref:ie.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:W?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:we,"--radix-popper-transform-origin":[(It=q.transformOrigin)==null?void 0:It.x,(ut=q.transformOrigin)==null?void 0:ut.y].join(" "),...((tt=q.hide)==null?void 0:tt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:r.dir,children:l.jsx(HS,{scope:s,placedSide:M,placedAlign:V,onArrowChange:N,arrowX:be,arrowY:pe,shouldHideArrow:Y,children:l.jsx(ze.div,{"data-side":M,"data-align":V,...j,ref:P,style:{...j.style,animation:W?(Jn=j.style)==null?void 0:Jn.animation:"none"}})})})},"PopperContent")),KS="PopperArrow",QS={top:"bottom",right:"left",bottom:"top",left:"right"},YS=m.forwardRef(Ln(function(r,i){const{__scopePopper:s,...c}=r,u=GS(KS,s),f=QS[u.placedSide];return l.jsx("span",{ref:u.onArrowChange,style:{position:"absolute",left:u.arrowX,top:u.arrowY,[f]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[u.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[u.placedSide],visibility:u.shouldHideArrow?"hidden":void 0},children:l.jsx(US,{...c,ref:i,style:{...c.style,display:"block"}})})},"PopperArrow"));function Wx(n){return n!==null}Ln(Wx,"isNotNull");var qS=Ln(n=>({name:"transformOrigin",options:n,fn(r){var j,E,D;const{placement:i,rects:s,middlewareData:c}=r,f=((j=c.arrow)==null?void 0:j.centerOffset)!==0,h=f?0:n.arrowWidth,v=f?0:n.arrowHeight,[g,y]=la(i),x={start:"0%",center:"50%",end:"100%"}[y],b=(((E=c.arrow)==null?void 0:E.x)??0)+h/2,C=(((D=c.arrow)==null?void 0:D.y)??0)+v/2;let k="",S="";return g==="bottom"?(k=f?x:`${b}px`,S=`${-v}px`):g==="top"?(k=f?x:`${b}px`,S=`${s.floating.height+v}px`):g==="right"?(k=`${-v}px`,S=f?x:`${C}px`):g==="left"&&(k=`${s.floating.width+v}px`,S=f?x:`${C}px`),{data:{x:k,y:S}}}}),"transformOrigin");function la(n){const[r,i="center"]=n.split("-");return[r,i]}Ln(la,"getSideAndAlignFromPlacement");var XS=Object.defineProperty,zd=(n,r)=>XS(n,"name",{value:r,configurable:!0}),yu=!1;function Vx(){const[n,r]=m.useState(yu);return m.useEffect(()=>{yu||(yu=!0,r(!0))},[]),n}zd(Vx,"useIsHydrated");var Hx=Rr[" useSyncExternalStore ".trim().toString()];function Gx(){return()=>{}}zd(Gx,"subscribe");function Kx(){return Hx(Gx,()=>!0,()=>!1)}zd(Kx,"useIsHydratedModern");var JS=typeof Hx=="function"?Kx:Vx,ZS=Object.defineProperty,so=(n,r)=>ZS(n,"name",{value:r,configurable:!0}),wu="rovingFocusGroup.onEntryFocus",eE={bubbles:!1,cancelable:!0},aa="RovingFocusGroup",[Vu,Qx,tE]=cd(aa),[nE,Yx]=an(aa,[tE]),Xm={Vertical:"vertical",Horizontal:"horizontal"},rE={RTL:"rtl"},[oE,iE]=nE(aa),sE=m.forwardRef(so(function(r,i){return l.jsx(Vu.Provider,{scope:r.__scopeRovingFocusGroup,children:l.jsx(Vu.Slot,{scope:r.__scopeRovingFocusGroup,children:l.jsx(lE,{...r,ref:i})})})},"RovingFocusGroup")),lE=m.forwardRef(so(function(r,i){const{__scopeRovingFocusGroup:s,orientation:c,loop:u=!1,dir:f,currentTabStopId:h,defaultCurrentTabStopId:v,onCurrentTabStopIdChange:g,onEntryFocus:y,preventScrollOnEntryFocus:x=!1,...b}=r,C=m.useRef(null),k=Ie(i,C),S=dd(f),[j,E]=qo({prop:h,defaultProp:v??null,onChange:g,caller:aa}),[D,T]=m.useState(!1),P=yn(y),R=Qx(s),N=m.useRef(!1),[I,L]=m.useState(0);return m.useEffect(()=>{const Q=C.current;if(Q)return Q.addEventListener(wu,P),()=>Q.removeEventListener(wu,P)},[P]),l.jsx(oE,{scope:s,orientation:c,dir:S,loop:u,currentTabStopId:j,onItemFocus:m.useCallback(Q=>E(Q),[E]),onItemShiftTab:m.useCallback(()=>T(!0),[]),onFocusableItemAdd:m.useCallback(()=>L(Q=>Q+1),[]),onFocusableItemRemove:m.useCallback(()=>L(Q=>Q-1),[]),children:l.jsx(ze.div,{tabIndex:D||I===0?-1:0,"data-orientation":c,...b,ref:k,style:{outline:"none",...r.style},onMouseDown:Ce(r.onMouseDown,()=>{N.current=!0}),onFocus:Ce(r.onFocus,Q=>{const ee=!N.current;if(Q.target===Q.currentTarget&&ee&&!D){const J=new CustomEvent(wu,eE);if(Q.currentTarget.dispatchEvent(J),!J.defaultPrevented){const ne=R().filter(Z=>Z.focusable),de=ne.find(Z=>Z.active),re=ne.find(Z=>Z.id===j),B=[de,re,...ne].filter(Boolean).map(Z=>Z.ref.current);Fd(B,x)}}N.current=!1}),onBlur:Ce(r.onBlur,()=>T(!1))})})},"RovingFocusGroupImpl")),aE="RovingFocusGroupItem",cE=m.forwardRef(so(function(r,i){const{__scopeRovingFocusGroup:s,focusable:c=!0,active:u=!1,tabStopId:f,children:h,...v}=r,g=Sr(),y=f||g,x=iE(aE,s),b=x.currentTabStopId===y,C=Qx(s),{onFocusableItemAdd:k,onFocusableItemRemove:S,currentTabStopId:j}=x,E=JS();return wt(()=>{if(!(!E||!c))return k(),()=>S()},[E,c,k,S]),m.useEffect(()=>{if(!(E||!c))return k(),()=>S()},[E,c,k,S]),l.jsx(Vu.ItemSlot,{scope:s,id:y,focusable:c,active:u,children:l.jsx(ze.span,{tabIndex:b?0:-1,"data-orientation":x.orientation,...v,ref:i,onMouseDown:Ce(r.onMouseDown,D=>{c?x.onItemFocus(y):D.preventDefault()}),onFocus:Ce(r.onFocus,()=>x.onItemFocus(y)),onKeyDown:Ce(r.onKeyDown,D=>{if(D.key==="Tab"&&D.shiftKey){x.onItemShiftTab();return}if(D.target!==D.currentTarget)return;const T=Xx(D,x.orientation,x.dir);if(T!==void 0){if(D.metaKey||D.ctrlKey||D.altKey||D.shiftKey)return;D.preventDefault();let R=C().filter(N=>N.focusable).map(N=>N.ref.current);if(T==="last")R.reverse();else if(T==="prev"||T==="next"){T==="prev"&&R.reverse();const N=R.indexOf(D.currentTarget);R=x.loop?Jx(R,N+1):R.slice(N+1)}setTimeout(()=>Fd(R))}}),children:typeof h=="function"?h({isCurrentTabStop:b,hasTabStop:j!=null}):h})})},"RovingFocusGroupItem")),uE={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function qx(n,r){return r!==rE.RTL?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}so(qx,"getDirectionAwareKey");function Xx(n,r,i){const s=qx(n.key,i);if(!(r===Xm.Vertical&&["ArrowLeft","ArrowRight"].includes(s))&&!(r===Xm.Horizontal&&["ArrowUp","ArrowDown"].includes(s)))return uE[s]}so(Xx,"getFocusIntent");function Fd(n,r=!1){const i=document.activeElement;for(const s of n)if(s===i||(s.focus({preventScroll:r}),document.activeElement!==i))return}so(Fd,"focusFirst");function Jx(n,r){return n.map((i,s)=>n[(r+s)%n.length])}so(Jx,"wrapArray");var dE=Object.defineProperty,Oe=(n,r)=>dE(n,"name",{value:r,configurable:!0}),fE=["Enter"," "],pE=["ArrowDown","PageUp","Home"],Zx=["ArrowUp","PageDown","End"],hE=[...pE,...Zx],ca="Menu",[Hu,mE,gE]=cd(ca),[lo,ey]=an(ca,[gE,sa,Yx]),$d=sa(),ty=Yx(),[vE,ts]=lo(ca),[xE,Ud]=lo(ca),yE=Oe(n=>{const{__scopeMenu:r,open:i=!1,children:s,dir:c,onOpenChange:u,modal:f=!0}=n,h=$d(r),[v,g]=m.useState(null),y=m.useRef(!1),x=yn(u),b=dd(c);return m.useEffect(()=>{const C=Oe(()=>{y.current=!0,document.addEventListener("pointerdown",k,{capture:!0,once:!0}),document.addEventListener("pointermove",k,{capture:!0,once:!0})},"handleKeyDown"),k=Oe(()=>y.current=!1,"handlePointer");return document.addEventListener("keydown",C,{capture:!0}),()=>{document.removeEventListener("keydown",C,{capture:!0}),document.removeEventListener("pointerdown",k,{capture:!0}),document.removeEventListener("pointermove",k,{capture:!0})}},[]),m.useEffect(()=>{if(!i)return;const C=Oe(()=>x(!1),"handleBlur");return window.addEventListener("blur",C),()=>window.removeEventListener("blur",C)},[i,x]),l.jsx(Fx,{...h,children:l.jsx(vE,{scope:r,open:i,onOpenChange:x,content:v,onContentChange:g,children:l.jsx(xE,{scope:r,onClose:m.useCallback(()=>x(!1),[x]),isUsingKeyboardRef:y,dir:b,modal:f,children:s})})})},"Menu"),wE=m.forwardRef(Oe(function(r,i){const{__scopeMenu:s,...c}=r,u=$d(s);return l.jsx($x,{...u,...c,ref:i})},"MenuAnchor")),ny="MenuPortal",[bE,kE]=lo(ny,{forceMount:void 0}),CE=Oe(n=>{const{__scopeMenu:r,forceMount:i,children:s,container:c}=n,u=ts(ny,r);return l.jsx(bE,{scope:r,forceMount:i,children:l.jsx(Gn,{present:i||u.open,children:l.jsx(xd,{asChild:!0,container:c,children:s})})})},"MenuPortal"),Er="MenuContent",[jE,ry]=lo(Er),SE=m.forwardRef(Oe(function(r,i){const s=kE(Er,r.__scopeMenu),{forceMount:c=s.forceMount,...u}=r,f=ts(Er,r.__scopeMenu),h=Ud(Er,r.__scopeMenu);return l.jsx(Hu.Provider,{scope:r.__scopeMenu,children:l.jsx(Gn,{present:c||f.open,children:l.jsx(Hu.Slot,{scope:r.__scopeMenu,children:h.modal?l.jsx(EE,{...u,ref:i}):l.jsx(_E,{...u,ref:i})})})})},"MenuContent")),EE=m.forwardRef(Oe(function(r,i){const s=ts(Er,r.__scopeMenu),c=m.useRef(null),u=Ie(i,c);return m.useEffect(()=>{const f=c.current;if(f)return gx(f)},[]),l.jsx(oy,{...r,ref:u,trapFocus:s.open,disableOutsidePointerEvents:s.open,disableOutsideScroll:!0,onFocusOutside:Ce(r.onFocusOutside,f=>f.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>s.onOpenChange(!1)})},"MenuRootContentModal")),_E=m.forwardRef(Oe(function(r,i){const s=ts(Er,r.__scopeMenu);return l.jsx(oy,{...r,ref:i,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>s.onOpenChange(!1)})},"MenuRootContentNonModal")),NE=$n("MenuContent.ScrollLock"),oy=m.forwardRef(Oe(function(r,i){const{__scopeMenu:s,loop:c=!1,trapFocus:u,onOpenAutoFocus:f,onCloseAutoFocus:h,disableOutsidePointerEvents:v,onEntryFocus:g,onEscapeKeyDown:y,onPointerDownOutside:x,onFocusOutside:b,onInteractOutside:C,onDismiss:k,disableOutsideScroll:S,...j}=r,E=ts(Er,s),D=Ud(Er,s),T=$d(s),P=ty(s),R=mE(s),[N,I]=m.useState(null),L=m.useRef(null),[Q,ee]=m.useState(null);gd(Q);const{nodes:J,registry:ne}=md(),de=!!(u||S),re=Ie(i,L,E.onContentChange,ee),ie=m.useRef(0),B=m.useRef(""),Z=m.useRef(0),W=m.useRef(null),q=m.useRef("right"),F=m.useRef(0),M=m.useMemo(()=>S?[L,...J.map(Y=>({current:Y}))]:[],[L,J,S]),V=S?wd:m.Fragment,he=S?{as:NE,allowPinchZoom:!0,shards:M}:void 0,be=Oe(Y=>{var Jn,Cn;const we=B.current+Y,ke=R().filter(dt=>!dt.disabled),me=document.activeElement,Be=(Jn=ke.find(dt=>dt.ref.current===me))==null?void 0:Jn.textValue,mt=ke.map(dt=>dt.textValue),It=cy(mt,we,Be),ut=(Cn=ke.find(dt=>dt.textValue===It))==null?void 0:Cn.ref.current;function tt(dt){B.current=dt,window.clearTimeout(ie.current),dt!==""&&(ie.current=window.setTimeout(()=>tt(""),1e3))}Oe(tt,"updateSearch"),tt(we),ut&&setTimeout(()=>ut.focus())},"handleTypeaheadSearch");m.useEffect(()=>()=>window.clearTimeout(ie.current),[]),Jl();const pe=m.useCallback(Y=>{var ke,me;return q.current===((ke=W.current)==null?void 0:ke.side)&&dy(Y,(me=W.current)==null?void 0:me.area)},[]);return l.jsx(jE,{scope:s,searchRef:B,onItemEnter:m.useCallback(Y=>{pe(Y)&&Y.preventDefault()},[pe]),onItemLeave:m.useCallback(Y=>{var we;pe(Y)||((we=L.current)==null||we.focus(),I(null))},[pe]),onTriggerLeave:m.useCallback(Y=>{pe(Y)&&Y.preventDefault()},[pe]),pointerGraceTimerRef:Z,onPointerGraceIntentChange:m.useCallback(Y=>{W.current=Y},[]),children:l.jsx(hd,{registry:de?ne:null,children:l.jsx(V,{...he,children:l.jsx(ex,{asChild:!0,trapped:u,branches:J,onMountAutoFocus:Ce(f,Y=>{var we;Y.preventDefault(),(we=L.current)==null||we.focus({preventScroll:!0})}),onUnmountAutoFocus:h,children:l.jsx(fd,{asChild:!0,disableOutsidePointerEvents:v,onEscapeKeyDown:y,onPointerDownOutside:x,onFocusOutside:b,onInteractOutside:C,onDismiss:k,children:l.jsx(sE,{asChild:!0,...P,dir:D.dir,orientation:"vertical",loop:c,currentTabStopId:N,onCurrentTabStopIdChange:I,onEntryFocus:Ce(g,Y=>{D.isUsingKeyboardRef.current||Y.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(Bx,{role:"menu","aria-orientation":"vertical","data-state":sy(E.open),"data-radix-menu-content":"",dir:D.dir,...T,...j,ref:re,style:{outline:"none",...j.style},onKeyDown:Ce(j.onKeyDown,Y=>{const ke=Y.target.closest("[data-radix-menu-content]")===Y.currentTarget,me=Y.ctrlKey||Y.altKey||Y.metaKey,Be=Y.key.length===1;ke&&(Y.key==="Tab"&&Y.preventDefault(),!me&&Be&&be(Y.key));const mt=L.current;if(Y.target!==mt||!hE.includes(Y.key))return;Y.preventDefault();const ut=R().filter(tt=>!tt.disabled).map(tt=>tt.ref.current);Zx.includes(Y.key)&&ut.reverse(),ly(ut)}),onBlur:Ce(r.onBlur,Y=>{Y.currentTarget.contains(Y.target)||(window.clearTimeout(ie.current),B.current="")}),onPointerMove:Ce(r.onPointerMove,Ul(Y=>{const we=Y.target,ke=F.current!==Y.clientX;if(Y.currentTarget.contains(we)&&ke){const me=Y.clientX>F.current?"right":"left";q.current=me,F.current=Y.clientX}}))})})})})})})})},"MenuContentImpl")),RE=m.forwardRef(Oe(function(r,i){const{__scopeMenu:s,...c}=r;return l.jsx(ze.div,{role:"group",...c,ref:i})},"MenuGroup")),PE=m.forwardRef(Oe(function(r,i){const{__scopeMenu:s,...c}=r;return l.jsx(ze.div,{...c,ref:i})},"MenuLabel")),Gu="MenuItem",Jm="menu.itemSelect",DE=m.forwardRef(Oe(function(r,i){const{disabled:s=!1,onSelect:c,...u}=r,f=m.useRef(null),h=Ud(Gu,r.__scopeMenu),v=ry(Gu,r.__scopeMenu),g=Ie(i,f),y=m.useRef(!1),x=Oe(()=>{const b=f.current;if(!s&&b){const C=new CustomEvent(Jm,{bubbles:!0,cancelable:!0});b.addEventListener(Jm,k=>c==null?void 0:c(k),{once:!0}),ad(b,C),C.defaultPrevented?y.current=!1:h.onClose()}},"handleSelect");return l.jsx(TE,{...u,ref:g,disabled:s,onClick:Ce(r.onClick,x),onPointerDown:b=>{var C;(C=r.onPointerDown)==null||C.call(r,b),y.current=!0},onPointerUp:Ce(r.onPointerUp,b=>{var C;y.current||(C=b.currentTarget)==null||C.click()}),onKeyDown:Ce(r.onKeyDown,b=>{s||b.target!==b.currentTarget||v.searchRef.current!==""&&b.key===" "||fE.includes(b.key)&&(b.currentTarget.click(),b.preventDefault())})})},"MenuItem")),TE=m.forwardRef(Oe(function(r,i){const{__scopeMenu:s,disabled:c=!1,textValue:u,...f}=r,h=ry(Gu,s),v=ty(s),g=m.useRef(null),y=Ie(i,g),[x,b]=m.useState(!1),[C,k]=m.useState("");return m.useEffect(()=>{const S=g.current;S&&k((S.textContent??"").trim())},[f.children]),l.jsx(Hu.ItemSlot,{scope:s,disabled:c,textValue:u??C,children:l.jsx(cE,{asChild:!0,...v,focusable:!c,children:l.jsx(ze.div,{role:"menuitem","data-highlighted":x?"":void 0,"aria-disabled":c||void 0,"data-disabled":c?"":void 0,...f,ref:y,onPointerMove:Ce(r.onPointerMove,Ul(S=>{c?h.onItemLeave(S):(h.onItemEnter(S),S.defaultPrevented||S.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ce(r.onPointerLeave,Ul(S=>h.onItemLeave(S))),onFocus:Ce(r.onFocus,()=>b(!0)),onBlur:Ce(r.onBlur,()=>b(!1))})})})},"MenuItemImpl")),OE="MenuRadioGroup",[ME,AE]=lo(OE,{value:void 0,onValueChange:Oe(()=>{},"onValueChange")}),IE=m.forwardRef(Oe(function(r,i){const{value:s,onValueChange:c,...u}=r,f=yn(c);return l.jsx(ME,{scope:r.__scopeMenu,value:s,onValueChange:f,children:l.jsx(RE,{...u,ref:i})})},"MenuRadioGroup")),LE="MenuRadioItem",zE=m.forwardRef(Oe(function(r,i){const{value:s,...c}=r,u=AE(LE,r.__scopeMenu),f=s===u.value;return l.jsx(FE,{scope:r.__scopeMenu,checked:f,children:l.jsx(DE,{role:"menuitemradio","aria-checked":f,...c,ref:i,"data-state":Wd(f),onSelect:Ce(c.onSelect,()=>{var h;return(h=u.onValueChange)==null?void 0:h.call(u,s)},{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),iy="MenuItemIndicator",[FE,$E]=lo(iy,{checked:!1}),UE=m.forwardRef(Oe(function(r,i){const{__scopeMenu:s,forceMount:c,...u}=r,f=$E(iy,s);return l.jsx(Gn,{present:c||Bd(f.checked)||f.checked===!0,children:l.jsx(ze.span,{...u,ref:i,"data-state":Wd(f.checked)})})},"MenuItemIndicator")),BE=m.forwardRef(Oe(function(r,i){const{__scopeMenu:s,...c}=r;return l.jsx(ze.div,{role:"separator","aria-orientation":"horizontal",...c,ref:i})},"MenuSeparator")),WE="MenuSub",[J2,Z2]=lo(WE);function sy(n){return n?"open":"closed"}Oe(sy,"getOpenState");function Bd(n){return n==="indeterminate"}Oe(Bd,"isIndeterminate");function Wd(n){return Bd(n)?"indeterminate":n?"checked":"unchecked"}Oe(Wd,"getCheckedState");function ly(n){const r=document.activeElement;for(const i of n)if(i===r||(i.focus(),document.activeElement!==r))return}Oe(ly,"focusFirst");function ay(n,r){return n.map((i,s)=>n[(r+s)%n.length])}Oe(ay,"wrapArray");function cy(n,r,i){const c=r.length>1&&Array.from(r).every(g=>g===r[0])?r[0]:r,u=i?n.indexOf(i):-1;let f=ay(n,Math.max(u,0));c.length===1&&(f=f.filter(g=>g!==i));const v=f.find(g=>g.toLowerCase().startsWith(c.toLowerCase()));return v!==i?v:void 0}Oe(cy,"getNextMatch");function uy(n,r){const{x:i,y:s}=n;let c=!1;for(let u=0,f=r.length-1;us!=b>s&&i<(x-g)*(s-y)/(b-y)+g&&(c=!c)}return c}Oe(uy,"isPointInPolygon");function dy(n,r){if(!r)return!1;const i={x:n.clientX,y:n.clientY};return uy(i,r)}Oe(dy,"isPointerInGraceArea");function Ul(n){return r=>r.pointerType==="mouse"?n(r):void 0}Oe(Ul,"whenMouse");var VE=Object.defineProperty,qn=(n,r)=>VE(n,"name",{value:r,configurable:!0}),Vd="DropdownMenu",[HE,eN]=an(Vd,[ey]),Xn=ey(),[GE,fy]=HE(Vd),KE=qn(n=>{const{__scopeDropdownMenu:r,children:i,dir:s,open:c,defaultOpen:u,onOpenChange:f,modal:h=!0}=n,v=Xn(r),g=m.useRef(null),[y,x]=qo({prop:c,defaultProp:u??!1,onChange:f,caller:Vd});return l.jsx(GE,{scope:r,triggerId:Sr(),triggerRef:g,contentId:Sr(),open:y,onOpenChange:x,onOpenToggle:m.useCallback(()=>x(b=>!b),[x]),modal:h,children:l.jsx(yE,{...v,open:y,onOpenChange:x,dir:s,modal:h,children:i})})},"DropdownMenu"),QE="DropdownMenuTrigger",YE=m.forwardRef(qn(function(r,i){const{__scopeDropdownMenu:s,disabled:c=!1,...u}=r,f=fy(QE,s),h=Xn(s),v=Ie(i,f.triggerRef);return l.jsx(wE,{asChild:!0,...h,children:l.jsx(ze.button,{type:"button",id:f.triggerId,"aria-haspopup":"menu","aria-expanded":f.open,"aria-controls":f.open?f.contentId:void 0,"data-state":f.open?"open":"closed","data-disabled":c?"":void 0,disabled:c,...u,ref:v,onPointerDown:Ce(r.onPointerDown,g=>{!c&&g.button===0&&g.ctrlKey===!1&&(f.onOpenToggle(),f.open||g.preventDefault())}),onKeyDown:Ce(r.onKeyDown,g=>{c||(["Enter"," "].includes(g.key)&&f.onOpenToggle(),g.key==="ArrowDown"&&f.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(g.key)&&g.preventDefault())})})})},"DropdownMenuTrigger")),qE=qn(n=>{const{__scopeDropdownMenu:r,...i}=n,s=Xn(r);return l.jsx(CE,{...s,...i})},"DropdownMenuPortal"),XE="DropdownMenuContent",JE=m.forwardRef(qn(function(r,i){const{__scopeDropdownMenu:s,...c}=r,u=fy(XE,s),f=Xn(s),h=m.useRef(!1);return l.jsx(SE,{id:u.contentId,"aria-labelledby":u.triggerId,...f,...c,ref:i,onCloseAutoFocus:Ce(r.onCloseAutoFocus,v=>{var g;h.current||(g=u.triggerRef.current)==null||g.focus(),h.current=!1,v.preventDefault()}),onInteractOutside:Ce(r.onInteractOutside,v=>{const g=v.detail.originalEvent,y=g.button===0&&g.ctrlKey===!0,x=g.button===2||y;(!u.modal||x)&&(h.current=!0)}),style:{...r.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),ZE=m.forwardRef(qn(function(r,i){const{__scopeDropdownMenu:s,...c}=r,u=Xn(s);return l.jsx(PE,{...u,...c,ref:i})},"DropdownMenuLabel")),e_=m.forwardRef(qn(function(r,i){const{__scopeDropdownMenu:s,...c}=r,u=Xn(s);return l.jsx(IE,{...u,...c,ref:i})},"DropdownMenuRadioGroup")),t_=m.forwardRef(qn(function(r,i){const{__scopeDropdownMenu:s,...c}=r,u=Xn(s);return l.jsx(zE,{...u,...c,ref:i})},"DropdownMenuRadioItem")),n_=m.forwardRef(qn(function(r,i){const{__scopeDropdownMenu:s,...c}=r,u=Xn(s);return l.jsx(UE,{...u,...c,ref:i})},"DropdownMenuItemIndicator")),r_=m.forwardRef(qn(function(r,i){const{__scopeDropdownMenu:s,...c}=r,u=Xn(s);return l.jsx(BE,{...u,...c,ref:i})},"DropdownMenuSeparator")),o_=Object.defineProperty,i_=(n,r)=>o_(n,"name",{value:r,configurable:!0}),s_=m.forwardRef(i_(function(r,i){return l.jsx(ze.label,{...r,ref:i,onMouseDown:s=>{var u;s.target.closest("button, input, select, textarea")||((u=r.onMouseDown)==null||u.call(r,s),!s.defaultPrevented&&s.detail>1&&s.preventDefault())}})},"Label")),l_=Object.defineProperty,py=(n,r)=>l_(n,"name",{value:r,configurable:!0}),Hd={Horizontal:"horizontal",Vertical:"vertical"},Zm=Hd.Horizontal,a_=Object.values(Hd),c_=m.forwardRef(py(function(r,i){const{decorative:s,orientation:c=Zm,...u}=r,f=hy(c)?c:Zm,h=f===Hd.Vertical?f:void 0,v=s?{role:"none"}:{"aria-orientation":h,role:"separator"};return l.jsx(ze.div,{"data-orientation":f,...v,...u,ref:i})},"Separator"));function hy(n){return a_.includes(n)}py(hy,"isValidOrientation");var u_=Object.defineProperty,et=(n,r)=>u_(n,"name",{value:r,configurable:!0}),[Gd,tN]=an("Tooltip",[sa]),ua=sa(),d_="TooltipProvider",f_=700,Ku="tooltip.open",[p_,Kd]=Gd(d_),h_=et(n=>{const{__scopeTooltip:r,delayDuration:i=f_,skipDelayDuration:s=300,disableHoverableContent:c=!1,children:u}=n,f=m.useRef(!0),h=m.useRef(!1),v=m.useRef(0);return m.useEffect(()=>{const g=v.current;return()=>window.clearTimeout(g)},[]),l.jsx(p_,{scope:r,isOpenDelayedRef:f,delayDuration:i,onOpen:m.useCallback(()=>{s<=0||(window.clearTimeout(v.current),f.current=!1)},[s]),onClose:m.useCallback(()=>{s<=0||(window.clearTimeout(v.current),v.current=window.setTimeout(()=>f.current=!0,s))},[s]),isPointerInTransitRef:h,onPointerInTransitChange:m.useCallback(g=>{h.current=g},[]),disableHoverableContent:c,children:u})},"TooltipProvider"),Qu="Tooltip",[m_,ns]=Gd(Qu),g_=et(n=>{const{__scopeTooltip:r,children:i,open:s,defaultOpen:c,onOpenChange:u,disableHoverableContent:f,delayDuration:h}=n,v=Kd(Qu,n.__scopeTooltip),g=ua(r),[y,x]=m.useState(null),[b,C]=m.useState(void 0),k=Sr(),S=m.useRef(0),j=f??v.disableHoverableContent,E=h??v.delayDuration,D=m.useRef(!1),[T,P]=qo({prop:s,defaultProp:c??!1,onChange:et(ee=>{ee?(v.onOpen(),document.dispatchEvent(new CustomEvent(Ku))):v.onClose(),u==null||u(ee)},"onChange"),caller:Qu}),R=m.useMemo(()=>T?D.current?"delayed-open":"instant-open":"closed",[T]),N=m.useCallback(()=>{window.clearTimeout(S.current),S.current=0,D.current=!1,P(!0)},[P]),I=m.useCallback(()=>{window.clearTimeout(S.current),S.current=0,P(!1)},[P]),L=m.useCallback(()=>{window.clearTimeout(S.current),S.current=window.setTimeout(()=>{D.current=!0,P(!0),S.current=0},E)},[E,P]);m.useEffect(()=>()=>{S.current&&(window.clearTimeout(S.current),S.current=0)},[]);const Q=b??k;return l.jsx(Fx,{...g,children:l.jsx(m_,{scope:r,contentId:Q,setContentId:C,open:T,stateAttribute:R,trigger:y,onTriggerChange:x,onTriggerEnter:m.useCallback(()=>{v.isOpenDelayedRef.current?L():N()},[v.isOpenDelayedRef,L,N]),onTriggerLeave:m.useCallback(()=>{j?I():(window.clearTimeout(S.current),S.current=0)},[I,j]),onOpen:N,onClose:I,disableHoverableContent:j,children:i})})},"Tooltip"),eg="TooltipTrigger",v_=m.forwardRef(et(function(r,i){const{__scopeTooltip:s,"aria-describedby":c,...u}=r,f=ns(eg,s),h=Kd(eg,s),v=ua(s),g=m.useRef(null),y=Ie(i,g,f.onTriggerChange),x=m.useRef(!1),b=m.useRef(!1),C=m.useCallback(()=>x.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",C),[C]),l.jsx($x,{asChild:!0,...v,children:l.jsx(ze.button,{"aria-describedby":f.open?Cy(c,f.contentId):c,"data-state":f.stateAttribute,...u,ref:y,onPointerMove:Ce(r.onPointerMove,k=>{k.pointerType!=="touch"&&!b.current&&!h.isPointerInTransitRef.current&&(f.onTriggerEnter(),b.current=!0)}),onPointerLeave:Ce(r.onPointerLeave,()=>{f.onTriggerLeave(),b.current=!1}),onPointerDown:Ce(r.onPointerDown,()=>{f.open&&f.onClose(),x.current=!0,document.addEventListener("pointerup",C,{once:!0})}),onFocus:Ce(r.onFocus,()=>{x.current||f.onOpen()}),onBlur:Ce(r.onBlur,f.onClose),onClick:Ce(r.onClick,f.onClose)})})},"TooltipTrigger")),my="TooltipPortal",[x_,y_]=Gd(my,{forceMount:void 0}),w_=et(n=>{const{__scopeTooltip:r,forceMount:i,children:s,container:c}=n,u=ns(my,r);return l.jsx(x_,{scope:r,forceMount:i,children:l.jsx(Gn,{present:i||u.open,children:l.jsx(xd,{asChild:!0,container:c,children:s})})})},"TooltipPortal"),qi="TooltipContent",b_=m.forwardRef(et(function(r,i){const s=y_(qi,r.__scopeTooltip),{forceMount:c=s.forceMount,side:u="top",...f}=r,h=ns(qi,r.__scopeTooltip);return l.jsx(Gn,{present:c||h.open,children:h.disableHoverableContent?l.jsx(gy,{side:u,...f,ref:i}):l.jsx(k_,{side:u,...f,ref:i})})},"TooltipContent")),k_=m.forwardRef(et(function(r,i){const s=ns(qi,r.__scopeTooltip),c=Kd(qi,r.__scopeTooltip),u=m.useRef(null),f=Ie(i,u),[h,v]=m.useState(null),{trigger:g,onClose:y}=s,x=u.current,{onPointerInTransitChange:b}=c,C=m.useCallback(()=>{v(null),b(!1)},[b]),k=m.useCallback((S,j)=>{const E=S.currentTarget,D={x:S.clientX,y:S.clientY},T=vy(D,E.getBoundingClientRect()),P=xy(D,T),R=yy(j.getBoundingClientRect()),N=by([...P,...R]);v(N),b(!0)},[b]);return m.useEffect(()=>()=>C(),[C]),m.useEffect(()=>{if(g&&x){const S=et(E=>k(E,x),"handleTriggerLeave"),j=et(E=>k(E,g),"handleContentLeave");return g.addEventListener("pointerleave",S),x.addEventListener("pointerleave",j),()=>{g.removeEventListener("pointerleave",S),x.removeEventListener("pointerleave",j)}}},[g,x,k,C]),m.useEffect(()=>{if(h){const S=et(j=>{const E=j.target,D={x:j.clientX,y:j.clientY},T=(g==null?void 0:g.contains(E))||(x==null?void 0:x.contains(E)),P=!wy(D,h);T?C():P&&(C(),y())},"handleTrackPointerGrace");return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[g,x,h,y,C]),l.jsx(gy,{...r,ref:f})},"TooltipContentHoverable")),C_=_v("TooltipContent"),gy=m.forwardRef(et(function(r,i){const{__scopeTooltip:s,children:c,"aria-label":u,id:f,onEscapeKeyDown:h,onPointerDownOutside:v,...g}=r,y=ns(qi,s),x=ua(s),{onClose:b}=y,[C,k]=m.useState(null),S=Ie(i,k);gd(C),m.useEffect(()=>(document.addEventListener(Ku,b),()=>document.removeEventListener(Ku,b)),[b]),m.useEffect(()=>{if(y.trigger){const E=et(D=>{D.target instanceof Node&&D.target.contains(y.trigger)&&b()},"handleScroll");return window.addEventListener("scroll",E,{capture:!0}),()=>window.removeEventListener("scroll",E,{capture:!0})}},[y.trigger,b]);const{setContentId:j}=y;return wt(()=>(j(f),()=>{j(void 0)}),[f,j]),l.jsx(fd,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:h,onPointerDownOutside:v,onFocusOutside:E=>E.preventDefault(),onDismiss:b,children:l.jsxs(Bx,{"data-state":y.stateAttribute,role:u?void 0:"tooltip",id:u?void 0:y.contentId,...x,...g,ref:S,style:{...g.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[l.jsx(C_,{children:c}),u?l.jsx(Ak,{id:y.contentId,role:"tooltip",children:u}):null]})})},"TooltipContentImpl")),j_=m.forwardRef(et(function(r,i){const{__scopeTooltip:s,...c}=r,u=ua(s);return l.jsx(YS,{...u,...c,ref:i})},"TooltipArrow"));function vy(n,r){const i=Math.abs(r.top-n.y),s=Math.abs(r.bottom-n.y),c=Math.abs(r.right-n.x),u=Math.abs(r.left-n.x);switch(Math.min(i,s,c,u)){case u:return"left";case c:return"right";case i:return"top";case s:return"bottom";default:throw new Error("unreachable")}}et(vy,"getExitSideFromRect");function xy(n,r,i=5){const s=[];switch(r){case"top":s.push({x:n.x-i,y:n.y+i},{x:n.x+i,y:n.y+i});break;case"bottom":s.push({x:n.x-i,y:n.y-i},{x:n.x+i,y:n.y-i});break;case"left":s.push({x:n.x+i,y:n.y-i},{x:n.x+i,y:n.y+i});break;case"right":s.push({x:n.x-i,y:n.y-i},{x:n.x-i,y:n.y+i});break}return s}et(xy,"getPaddedExitPoints");function yy(n){const{top:r,right:i,bottom:s,left:c}=n;return[{x:c,y:r},{x:i,y:r},{x:i,y:s},{x:c,y:s}]}et(yy,"getPointsFromRect");function wy(n,r){const{x:i,y:s}=n;let c=!1;for(let u=0,f=r.length-1;us!=b>s&&i<(x-g)*(s-y)/(b-y)+g&&(c=!c)}return c}et(wy,"isPointInPolygon");function by(n){const r=n.slice();return r.sort((i,s)=>i.xs.x?1:i.ys.y?1:0),ky(r)}et(by,"getHull");function ky(n){if(n.length<=1)return n.slice();const r=[];for(let s=0;s=2;){const u=r[r.length-1],f=r[r.length-2];if((u.x-f.x)*(c.y-f.y)>=(u.y-f.y)*(c.x-f.x))r.pop();else break}r.push(c)}r.pop();const i=[];for(let s=n.length-1;s>=0;s--){const c=n[s];for(;i.length>=2;){const u=i[i.length-1],f=i[i.length-2];if((u.x-f.x)*(c.y-f.y)>=(u.y-f.y)*(c.x-f.x))i.pop();else break}i.push(c)}return i.pop(),r.length===1&&i.length===1&&r[0].x===i[0].x&&r[0].y===i[0].y?r:r.concat(i)}et(ky,"getHullPresorted");function Cy(...n){const r=new Set;for(const i of n)if(typeof i=="string")for(const s of String(i).trim().split(/\s+/))s&&r.add(s);return r.size>0?Array.from(r).join(" "):void 0}et(Cy,"concatAriaDescribedby");const S_=Xl("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function ge({className:n,variant:r="default",size:i="default",asChild:s=!1,...c}){const u=s?sd:"button";return l.jsx(u,{"data-slot":"button","data-variant":r,"data-size":i,className:te(S_({variant:r,size:i,className:n})),...c})}function E_({...n}){return l.jsx(uj,{"data-slot":"alert-dialog",...n})}function __({...n}){return l.jsx(dj,{"data-slot":"alert-dialog-portal",...n})}function N_({className:n,...r}){return l.jsx(fj,{"data-slot":"alert-dialog-overlay",className:te("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",n),...r})}function R_({className:n,size:r="default",...i}){return l.jsxs(__,{children:[l.jsx(N_,{}),l.jsx(gj,{"data-slot":"alert-dialog-content","data-size":r,className:te("group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[size=default]:sm:max-w-lg",n),...i})]})}function P_({className:n,...r}){return l.jsx("div",{"data-slot":"alert-dialog-header",className:te("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",n),...r})}function D_({className:n,...r}){return l.jsx("div",{"data-slot":"alert-dialog-footer",className:te("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",n),...r})}function T_({className:n,...r}){return l.jsx(vj,{"data-slot":"alert-dialog-title",className:te("text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",n),...r})}function O_({className:n,...r}){return l.jsx(xj,{"data-slot":"alert-dialog-description",className:te("text-sm text-muted-foreground",n),...r})}function M_({className:n,variant:r="default",size:i="default",...s}){return l.jsx(ge,{variant:r,size:i,asChild:!0,children:l.jsx(yj,{"data-slot":"alert-dialog-action",className:te(n),...s})})}function A_({className:n,variant:r="outline",size:i="default",...s}){return l.jsx(ge,{variant:r,size:i,asChild:!0,children:l.jsx(bj,{"data-slot":"alert-dialog-cancel",className:te(n),...s})})}const I_=Xl("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function kn({className:n,variant:r="default",asChild:i=!1,...s}){const c=i?sd:"span";return l.jsx(c,{"data-slot":"badge","data-variant":r,className:te(I_({variant:r}),n),...s})}function Me({className:n,type:r,...i}){return l.jsx("input",{type:r,"data-slot":"input",className:te("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",n),...i})}function jy({className:n,...r}){return l.jsx(s_,{"data-slot":"label",className:te("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",n),...r})}function Vn({className:n,...r}){return l.jsx("div",{"data-slot":"card",className:te("flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",n),...r})}function Bl({className:n,...r}){return l.jsx("div",{"data-slot":"card-header",className:te("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",n),...r})}function Qd({className:n,...r}){return l.jsx("div",{"data-slot":"card-title",className:te("leading-none font-semibold",n),...r})}function Yd({className:n,...r}){return l.jsx("div",{"data-slot":"card-description",className:te("text-sm text-muted-foreground",n),...r})}function to({className:n,...r}){return l.jsx("div",{"data-slot":"card-content",className:te("px-6",n),...r})}function L_({className:n,...r}){return l.jsx("div",{"data-slot":"card-footer",className:te("flex items-center px-6 [.border-t]:pt-6",n),...r})}function Sy({...n}){return l.jsx(kd,{"data-slot":"sheet",...n})}function z_({...n}){return l.jsx(Cd,{"data-slot":"sheet-portal",...n})}function F_({className:n,...r}){return l.jsx(jd,{"data-slot":"sheet-overlay",className:te("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",n),...r})}function Ey({className:n,children:r,side:i="right",showCloseButton:s=!0,...c}){return l.jsxs(z_,{children:[l.jsx(F_,{}),l.jsxs(Sd,{"data-slot":"sheet-content",className:te("fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500",i==="right"&&"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",i==="left"&&"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",i==="top"&&"inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",i==="bottom"&&"inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",n),...c,children:[r,s&&l.jsxs(es,{className:"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary",children:[l.jsx(lv,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function _y({className:n,...r}){return l.jsx("div",{"data-slot":"sheet-header",className:te("flex flex-col gap-1.5 p-4",n),...r})}function Ny({className:n,...r}){return l.jsx(Ed,{"data-slot":"sheet-title",className:te("font-semibold text-foreground",n),...r})}function Ry({className:n,...r}){return l.jsx(_d,{"data-slot":"sheet-description",className:te("text-sm text-muted-foreground",n),...r})}function rs({className:n,...r}){return l.jsx("textarea",{"data-slot":"textarea",className:te("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",n),...r})}const Py=m.createContext(()=>{}),St=()=>m.useContext(Py);function $_({children:n}){const[r,i]=m.useState(null),s=m.useRef(),c=m.useCallback((u,f=!1)=>{i(h=>({msg:u,err:f,n:((h==null?void 0:h.n)??0)+1})),window.clearTimeout(s.current),s.current=window.setTimeout(()=>i(null),4e3)},[]);return l.jsxs(Py.Provider,{value:c,children:[n,l.jsx("div",{"aria-live":"polite",className:"pointer-events-none fixed right-4 bottom-4 left-4 z-50 flex justify-end sm:left-auto",children:r&&l.jsxs("div",{id:"toast",role:"status",className:te("pointer-events-auto flex max-w-md items-start gap-2 rounded-lg border bg-popover px-4 py-3 text-sm text-popover-foreground shadow-lg animate-in fade-in slide-in-from-bottom-2",r.err&&"border-destructive/40"),children:[r.err?l.jsx(d1,{className:"mt-0.5 size-4 shrink-0 text-destructive"}):l.jsx(u1,{className:"mt-0.5 size-4 shrink-0 text-success"}),l.jsx("span",{children:r.msg})]},r.n)})]})}const De=n=>n instanceof Error?n.message:String(n),Dy=m.createContext(async()=>!1),Zo=()=>m.useContext(Dy);function U_({children:n}){const[r,i]=m.useState(null),s=m.useRef(),c=m.useCallback(f=>(i(f),new Promise(h=>s.current=h)),[]),u=f=>{var h;(h=s.current)==null||h.call(s,f),i(null)};return l.jsxs(Dy.Provider,{value:c,children:[n,l.jsx(E_,{open:!!r,onOpenChange:f=>!f&&u(!1),children:l.jsxs(R_,{children:[l.jsxs(P_,{children:[l.jsx(T_,{children:r==null?void 0:r.title}),(r==null?void 0:r.description)&&l.jsx(O_,{children:r.description})]}),l.jsxs(D_,{children:[l.jsx(A_,{onClick:()=>u(!1),children:"Cancel"}),l.jsx(M_,{className:te((r==null?void 0:r.danger)&&"bg-destructive text-white hover:bg-destructive/90"),onClick:()=>u(!0),children:(r==null?void 0:r.action)??"Continue"})]})]})})]})}const Ty=m.createContext(null),ei=()=>m.useContext(Ty),Oy=m.createContext(()=>{}),qd=()=>m.useContext(Oy),Wl={hosts:"Multiple code hosts and bot identities",rules:"Group and pattern rules",learnings:"Team learnings",executors:"Docker and Kubernetes executors",budgets:"Token budgets",metrics:"Metrics and long history",audit:"Audit log",branch_sync:"Branch-sync skip",sso_rules:"SSO domain and group rules"};function ln(n){return ei().license.features.includes(n)}function da({feature:n,children:r}){return l.jsxs(Hi,{role:"note",className:"locked border-dashed border-primary/60",children:[l.jsx(Fg,{className:"text-primary"}),l.jsxs(kk,{className:"flex items-center gap-2",children:[Wl[n],l.jsx(kn,{variant:"secondary",children:"licensed"})]}),l.jsx(Gi,{children:l.jsxs("p",{children:[r??"This is part of the licensed Divmora console."," ",l.jsx(Ho,{className:"font-medium text-primary underline-offset-4 hover:underline",to:"/license",children:"Install a license"})," ","or contact"," ",l.jsx("a",{className:"font-medium text-primary underline-offset-4 hover:underline",href:"mailto:licensing@divmora.com",children:"licensing@divmora.com"}),"."]})})]})}function Tl({feature:n}){return ln(n)?null:l.jsxs("span",{className:"locknote block text-xs leading-snug text-warning",children:[l.jsx(Fg,{className:"mr-1 inline size-3 align-[-2px]"}),"Needs a license with ",Wl[n].toLowerCase()," ·"," ",l.jsx(Ho,{to:"/license",className:"underline underline-offset-2",children:"License"})]})}function ao({children:n,className:r}){return l.jsx(Vn,{className:te("gap-0 overflow-hidden py-0",r),children:n})}function Go({open:n,onClose:r,title:i,description:s,children:c,wide:u}){return l.jsx(Sy,{open:n,onOpenChange:f=>!f&&r(),children:l.jsxs(Ey,{className:te("w-full gap-0 overflow-y-auto sm:max-w-xl",u&&"sm:max-w-3xl"),children:[l.jsxs(_y,{className:"border-b pr-10",children:[l.jsx(Ny,{children:i}),s&&l.jsx(Ry,{children:s})]}),l.jsx("div",{className:"p-4",children:c})]})})}function no({children:n,className:r}){return l.jsx("div",{className:te("flex flex-wrap items-center gap-2",r),children:n})}function Jt({children:n,className:r}){return l.jsx("p",{className:te("max-w-4xl text-sm leading-relaxed text-muted-foreground",r),children:n})}function bt({children:n}){return l.jsx("div",{className:"px-4 py-10 text-center text-sm text-muted-foreground",children:n})}function je({label:n,children:r,hint:i,className:s}){return l.jsxs("div",{className:te("grid content-start gap-1.5",s),children:[l.jsx(jy,{className:"text-xs font-medium text-muted-foreground",children:n}),r,i]})}function Xt({children:n,className:r}){return l.jsx("div",{className:te("grid gap-4 sm:grid-cols-2 lg:grid-cols-3",r),children:n})}function He({className:n,...r}){return l.jsx("select",{className:te("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none transition-[color,box-shadow] dark:bg-input/30","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50",n),...r})}const B_={on:"border-transparent bg-success-soft text-success",off:"border-transparent bg-danger-soft text-destructive",idle:"border-transparent bg-muted text-muted-foreground",warn:"border-transparent bg-warning-soft text-warning"};function zn({kind:n,children:r}){return l.jsx(kn,{className:te("state",n,B_[n]),children:r})}function Yu({items:n,empty:r}){return n.length?l.jsx("span",{className:"flex flex-wrap gap-1",children:n.map(i=>l.jsx(kn,{variant:"outline",className:"chip font-normal text-muted-foreground",children:i},i))}):l.jsx("span",{className:"text-sm text-muted-foreground",children:r??"defaults"})}function Qe({children:n,className:r}){return l.jsx("div",{className:te("mt-0.5 text-xs text-muted-foreground",r),children:n})}function My(n={}){const r=[];return n.profile&&r.push(n.profile),n.max_comments&&r.push("max "+n.max_comments),n.min_severity&&r.push("≥ "+n.min_severity),n.model&&r.push("model "+n.model),n.auto_review===!1&&r.push("auto review off"),n.auto_review===!0&&r.push("auto review on"),n.drafts===!0&&r.push("drafts"),n.instructions&&r.push("instructions"),r}function Vl({value:n,onChange:r,on:i,off:s,inherit:c="Inherit",label:u,disabled:f}){const h=n==null?"":String(n);return l.jsxs(He,{"aria-label":u,value:h,disabled:f,onChange:v=>r(v.target.value===""?null:v.target.value==="true"),children:[l.jsx("option",{value:"",children:c}),l.jsx("option",{value:"true",children:i}),l.jsx("option",{value:"false",children:s})]})}function Xd({value:n,onSave:r,onCancel:i,extra:s,inheritModel:c="Server default",saveLabel:u="Save settings",danger:f}){const h=ei(),v=n??{},[g,y]=m.useState(v.profile??""),[x,b]=m.useState(v.max_comments?String(v.max_comments):""),[C,k]=m.useState(v.min_severity??""),[S,j]=m.useState(v.model??""),[E,D]=m.useState(v.auto_review??null),[T,P]=m.useState(v.drafts??null),[R,N]=m.useState(v.instructions??""),I=()=>{const L={};g&&(L.profile=g),x&&(L.max_comments=parseInt(x,10)),C&&(L.min_severity=C),S&&(L.model=S),E!==null&&(L.auto_review=E),T!==null&&(L.drafts=T),R.trim()&&(L.instructions=R.trim()),r(L)};return l.jsxs("div",{className:"grid gap-5",children:[s,l.jsxs(Xt,{className:"lg:grid-cols-2",children:[l.jsx(je,{label:"Review profile",children:l.jsxs(He,{value:g,onChange:L=>y(L.target.value),children:[l.jsx("option",{value:"",children:"Inherit"}),l.jsx("option",{value:"chill",children:"Chill"}),l.jsx("option",{value:"balanced",children:"Balanced"}),l.jsx("option",{value:"assertive",children:"Assertive"})]})}),l.jsx(je,{label:"Max inline comments",children:l.jsx(Me,{type:"number",min:0,max:200,value:x,placeholder:"Inherit",onChange:L=>b(L.target.value)})}),l.jsx(je,{label:"Minimum severity",children:l.jsxs(He,{value:C,onChange:L=>k(L.target.value),children:[l.jsx("option",{value:"",children:"Inherit"}),l.jsx("option",{value:"critical",children:"Critical"}),l.jsx("option",{value:"major",children:"Major"}),l.jsx("option",{value:"minor",children:"Minor"}),l.jsx("option",{value:"nitpick",children:"Nitpick"})]})}),l.jsx(je,{label:"Model profile",children:l.jsxs(He,{value:S,onChange:L=>j(L.target.value),children:[l.jsx("option",{value:"",children:c}),h.profiles.map(L=>l.jsx("option",{value:L,children:L},L))]})}),l.jsx(je,{label:"Auto review on push",children:l.jsx(Vl,{value:E,onChange:D,on:"On",off:"Off"})}),l.jsx(je,{label:"Review draft PRs",children:l.jsx(Vl,{value:T,onChange:P,on:"On",off:"Off"})})]}),l.jsx(je,{label:"Extra review instructions",children:l.jsx(rs,{rows:4,maxLength:8e3,placeholder:"Appended to the repository's own instructions",value:R,onChange:L=>N(L.target.value)})}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx(ge,{onClick:I,children:u}),i&&l.jsx(ge,{variant:"outline",onClick:i,children:"Cancel"}),l.jsx("span",{className:"flex-1"}),f]})]})}function W_({...n}){return l.jsx(KE,{"data-slot":"dropdown-menu",...n})}function V_({...n}){return l.jsx(YE,{"data-slot":"dropdown-menu-trigger",...n})}function H_({className:n,sideOffset:r=4,...i}){return l.jsx(qE,{children:l.jsx(JE,{"data-slot":"dropdown-menu-content",sideOffset:r,className:te("z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",n),...i})})}function G_({...n}){return l.jsx(e_,{"data-slot":"dropdown-menu-radio-group",...n})}function bu({className:n,children:r,...i}){return l.jsxs(t_,{"data-slot":"dropdown-menu-radio-item",className:te("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",n),...i,children:[l.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:l.jsx(n_,{children:l.jsx(Pg,{className:"size-2 fill-current"})})}),r]})}function K_({className:n,inset:r,...i}){return l.jsx(ZE,{"data-slot":"dropdown-menu-label","data-inset":r,className:te("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",n),...i})}function Q_({className:n,...r}){return l.jsx(r_,{"data-slot":"dropdown-menu-separator",className:te("-mx-1 my-1 h-px bg-border",n),...r})}function Jr({className:n,orientation:r="horizontal",decorative:i=!0,...s}){return l.jsx(c_,{"data-slot":"separator",decorative:i,orientation:r,className:te("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",n),...s})}const ku=768;function Y_(){const[n,r]=m.useState(void 0);return m.useEffect(()=>{const i=window.matchMedia(`(max-width: ${ku-1}px)`),s=()=>{r(window.innerWidthi.removeEventListener("change",s)},[]),!!n}function Ay({delayDuration:n=0,...r}){return l.jsx(h_,{"data-slot":"tooltip-provider",delayDuration:n,...r})}function q_({...n}){return l.jsx(g_,{"data-slot":"tooltip",...n})}function X_({...n}){return l.jsx(v_,{"data-slot":"tooltip-trigger",...n})}function J_({className:n,sideOffset:r=0,children:i,...s}){return l.jsx(w_,{children:l.jsxs(b_,{"data-slot":"tooltip-content",sideOffset:r,className:te("z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",n),...s,children:[i,l.jsx(j_,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}const Z_="sidebar_state",e2=3600*24*7,t2="16rem",n2="18rem",r2="3rem",o2="b",Iy=m.createContext(null);function os(){const n=m.useContext(Iy);if(!n)throw new Error("useSidebar must be used within a SidebarProvider.");return n}function i2({defaultOpen:n=!0,open:r,onOpenChange:i,className:s,style:c,children:u,...f}){const h=Y_(),[v,g]=m.useState(!1),[y,x]=m.useState(n),b=r??y,C=m.useCallback(E=>{const D=typeof E=="function"?E(b):E;i?i(D):x(D),document.cookie=`${Z_}=${D}; path=/; max-age=${e2}`},[i,b]),k=m.useCallback(()=>h?g(E=>!E):C(E=>!E),[h,C,g]);m.useEffect(()=>{const E=D=>{D.key===o2&&(D.metaKey||D.ctrlKey)&&(D.preventDefault(),k())};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[k]);const S=b?"expanded":"collapsed",j=m.useMemo(()=>({state:S,open:b,setOpen:C,isMobile:h,openMobile:v,setOpenMobile:g,toggleSidebar:k}),[S,b,C,h,v,g,k]);return l.jsx(Iy.Provider,{value:j,children:l.jsx(Ay,{delayDuration:0,children:l.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":t2,"--sidebar-width-icon":r2,...c},className:te("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",s),...f,children:u})})})}function s2({side:n="left",variant:r="sidebar",collapsible:i="offcanvas",className:s,children:c,...u}){const{isMobile:f,state:h,openMobile:v,setOpenMobile:g}=os();return i==="none"?l.jsx("div",{"data-slot":"sidebar",className:te("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",s),...u,children:c}):f?l.jsx(Sy,{open:v,onOpenChange:g,...u,children:l.jsxs(Ey,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":n2},side:n,children:[l.jsxs(_y,{className:"sr-only",children:[l.jsx(Ny,{children:"Sidebar"}),l.jsx(Ry,{children:"Displays the mobile sidebar."})]}),l.jsx("div",{className:"flex h-full w-full flex-col",children:c})]})}):l.jsxs("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":h,"data-collapsible":h==="collapsed"?i:"","data-variant":r,"data-side":n,"data-slot":"sidebar",children:[l.jsx("div",{"data-slot":"sidebar-gap",className:te("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",r==="floating"||r==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),l.jsx("div",{"data-slot":"sidebar-container",className:te("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",n==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",r==="floating"||r==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",s),...u,children:l.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm",children:c})})]})}function l2({className:n,onClick:r,...i}){const{toggleSidebar:s}=os();return l.jsxs(ge,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:te("size-7",n),onClick:c=>{r==null||r(c),s()},...i,children:[l.jsx(y1,{}),l.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function a2({className:n,...r}){const{toggleSidebar:i}=os();return l.jsx("button",{"data-sidebar":"rail","data-slot":"sidebar-rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:i,title:"Toggle Sidebar",className:te("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex","in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",n),...r})}function c2({className:n,...r}){return l.jsx("main",{"data-slot":"sidebar-inset",className:te("relative flex w-full flex-1 flex-col bg-background","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",n),...r})}function u2({className:n,...r}){return l.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:te("flex flex-col gap-2 p-2",n),...r})}function d2({className:n,...r}){return l.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:te("flex flex-col gap-2 p-2",n),...r})}function f2({className:n,...r}){return l.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:te("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",n),...r})}function p2({className:n,...r}){return l.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:te("relative flex w-full min-w-0 flex-col p-2",n),...r})}function h2({className:n,...r}){return l.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:te("w-full text-sm",n),...r})}function tg({className:n,...r}){return l.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:te("flex w-full min-w-0 flex-col gap-1",n),...r})}function ng({className:n,...r}){return l.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:te("group/menu-item relative",n),...r})}const m2=Xl("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function rg({asChild:n=!1,isActive:r=!1,variant:i="default",size:s="default",tooltip:c,className:u,...f}){const h=n?sd:"button",{isMobile:v,state:g}=os(),y=l.jsx(h,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":s,"data-active":r,className:te(m2({variant:i,size:s}),u),...f});return c?(typeof c=="string"&&(c={children:c}),l.jsxs(q_,{children:[l.jsx(X_,{asChild:!0,children:y}),l.jsx(J_,{side:"right",align:"center",hidden:g!=="collapsed"||v,...c})]})):y}function og({className:n,...r}){return l.jsx("div",{"data-slot":"sidebar-menu-badge","data-sidebar":"menu-badge",className:te("pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",n),...r})}function ro(n){if(!n||n.startsWith("0001-"))return"never";const r=Math.round((Date.now()-new Date(n).getTime())/1e3);return r<60?"just now":r<3600?Math.floor(r/60)+"m ago":r<86400?Math.floor(r/3600)+"h ago":Math.floor(r/86400)+"d ago"}function Tt(n){return n>=1e6?(n/1e6).toFixed(1)+"M":n>=1e4?Math.round(n/1e3)+"k":n>=1e3?(n/1e3).toFixed(1)+"k":String(n)}function ig(n){if(!n)return"—";const r=Math.round(n/1e3);return r<60?r+"s":Math.floor(r/60)+"m "+r%60+"s"}function sg(n){return new Date(n).toLocaleString()}function Jd({...n}){return l.jsx(kd,{"data-slot":"dialog",...n})}function g2({...n}){return l.jsx(Cd,{"data-slot":"dialog-portal",...n})}function v2({className:n,...r}){return l.jsx(jd,{"data-slot":"dialog-overlay",className:te("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",n),...r})}function Zd({className:n,children:r,showCloseButton:i=!0,...s}){return l.jsxs(g2,{"data-slot":"dialog-portal",children:[l.jsx(v2,{}),l.jsxs(Sd,{"data-slot":"dialog-content",className:te("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",n),...s,children:[r,i&&l.jsxs(es,{"data-slot":"dialog-close",className:"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[l.jsx(lv,{}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function ef({className:n,...r}){return l.jsx("div",{"data-slot":"dialog-header",className:te("flex flex-col gap-2 text-center sm:text-left",n),...r})}function tf({className:n,showCloseButton:r=!1,children:i,...s}){return l.jsxs("div",{"data-slot":"dialog-footer",className:te("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",n),...s,children:[i,r&&l.jsx(es,{asChild:!0,children:l.jsx(ge,{variant:"outline",children:"Close"})})]})}function nf({className:n,...r}){return l.jsx(Ed,{"data-slot":"dialog-title",className:te("text-lg leading-none font-semibold",n),...r})}function rf({className:n,...r}){return l.jsx(_d,{"data-slot":"dialog-description",className:te("text-sm text-muted-foreground",n),...r})}function co({className:n,...r}){return l.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:l.jsx("table",{"data-slot":"table",className:te("w-full caption-bottom text-sm",n),...r})})}function uo({className:n,...r}){return l.jsx("thead",{"data-slot":"table-header",className:te("[&_tr]:border-b",n),...r})}function fo({className:n,...r}){return l.jsx("tbody",{"data-slot":"table-body",className:te("[&_tr:last-child]:border-0",n),...r})}function Mt({className:n,...r}){return l.jsx("tr",{"data-slot":"table-row",className:te("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",n),...r})}function Se({className:n,...r}){return l.jsx("th",{"data-slot":"table-head",className:te("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",n),...r})}function Ee({className:n,...r}){return l.jsx("td",{"data-slot":"table-cell",className:te("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",n),...r})}function x2(n){return n.source==="repository"?"set on this repository":n.source==="allowlist"?"no rule matches · allowlist default":n.source==="default"?"no rule matches · reviewed by default":"by "+n.source}function y2(){const n=ei(),r=St(),i=Zo(),[s,c]=m.useState(null),[u,f]=m.useState(""),[h,v]=m.useState("all"),[g,y]=m.useState(null),[x,b]=m.useState(!1),[C,k]=m.useState({platform:"github",host:"",path:"",mode:"enabled"}),S=()=>jt("/admin/api/repos").then(c).catch(N=>r(De(N),!0));m.useEffect(()=>{S()},[]);const j=(N,I,L)=>oo("/admin/api/repos/"+N.id,{mode:I,settings:L}).then(Q=>(c(ee=>(ee||[]).map(J=>J.id===Q.id?Q:J)),r(Q.path+": reviews "+(Q.effective.enabled?"on":"off")+" ("+Q.effective.source+")"),Q)),E=()=>Fn("/admin/api/repos",{...C,host:C.host.trim(),path:C.path.trim()}).then(N=>{c(I=>(I||[]).filter(L=>L.id!==N.id).concat([N])),k({...C,path:""}),b(!1),r("Added "+N.path)}).catch(N=>r(De(N),!0)),D=async N=>{await i({title:"Remove "+N.path+"?",description:"It reappears, set to Inherit, if it sends another webhook.",action:"Remove",danger:!0})&&Ji("/admin/api/repos/"+N.id).then(()=>{c(I=>(I||[]).filter(L=>L.id!==N.id)),y(null),r("Removed "+N.path)}).catch(I=>r(De(I),!0))},T=(s||[]).filter(N=>h==="on"&&!N.effective.enabled||h==="off"&&N.effective.enabled?!1:!u||(N.host+"/"+N.path).toLowerCase().includes(u.toLowerCase())),P=(s||[]).filter(N=>N.effective.enabled).length,R=(s==null?void 0:s.find(N=>N.id===g))??null;return l.jsxs("section",{className:"grid gap-4",children:[l.jsxs(no,{children:[l.jsxs("div",{className:"relative w-full sm:w-64",children:[l.jsx(Yl,{className:"pointer-events-none absolute top-2.5 left-2.5 size-4 text-muted-foreground"}),l.jsx(Me,{type:"search",className:"pl-8",placeholder:"Filter repositories","aria-label":"Filter repositories",value:u,onChange:N=>f(N.target.value)})]}),l.jsxs(He,{className:"w-auto","aria-label":"Show",value:h,onChange:N=>v(N.target.value),children:[l.jsx("option",{value:"all",children:"All"}),l.jsx("option",{value:"on",children:"Reviewed"}),l.jsx("option",{value:"off",children:"Not reviewed"})]}),l.jsx("span",{className:"text-sm text-muted-foreground",children:s&&P+" reviewed · "+(s.length-P)+" not reviewed"}),l.jsx("span",{className:"flex-1"}),l.jsxs(ge,{variant:"outline",onClick:()=>b(!0),children:[l.jsx(Xi,{})," Add repository"]})]}),l.jsx(ao,{children:s?T.length?l.jsxs(co,{children:[l.jsx(uo,{children:l.jsxs(Mt,{children:[l.jsx(Se,{className:"pl-4",children:"Reviews"}),l.jsx(Se,{children:"Repository"}),l.jsx(Se,{children:"Last webhook"}),l.jsx(Se,{children:"Effective settings"}),l.jsx(Se,{children:"Last changed"}),l.jsx(Se,{})]})}),l.jsx(fo,{children:T.map(N=>{const I=N.effective,L=[I.require_reviewer&&"reviewer required",I.skip_branch_sync&&"skips branch syncs",I.score_labels&&"score labels",I.commit_status&&"commit status"].filter(Boolean);return l.jsxs(Mt,{children:[l.jsxs(Ee,{className:"w-44 pl-4 align-top whitespace-normal",children:[l.jsxs(He,{"aria-label":"Reviews for "+N.path,value:N.mode,onChange:Q=>j(N,Q.target.value,N.settings||{}).catch(ee=>r(De(ee),!0)),children:[l.jsx("option",{value:"inherit",children:"Inherit"}),l.jsx("option",{value:"enabled",children:"Enabled"}),l.jsx("option",{value:"disabled",children:"Disabled"})]}),l.jsx("div",{className:"mt-1.5",children:l.jsx(zn,{kind:I.enabled?"on":"off",children:I.enabled?"Reviewed":"Not reviewed"})}),l.jsx(Qe,{children:x2(I)}),L.length>0&&l.jsx(Qe,{children:L.join(" · ")})]}),l.jsxs(Ee,{className:"align-top",children:[l.jsx("div",{className:"font-medium",children:N.path}),l.jsxs(Qe,{children:[N.platform," · ",N.host]})]}),l.jsx(Ee,{className:"align-top text-muted-foreground",children:ro(N.last_seen)}),l.jsxs(Ee,{className:"align-top whitespace-normal",children:[l.jsx(Yu,{items:My(I.settings)}),(I.rules||[]).length>0&&JSON.stringify(I.settings)!==JSON.stringify(N.settings||{})&&l.jsx(Qe,{children:"includes rule settings"})]}),l.jsx(Ee,{className:"align-top text-muted-foreground",children:N.updated_by?N.updated_by+" · "+ro(N.updated_at):"—"}),l.jsx(Ee,{className:"pr-4 text-right align-top",children:l.jsxs(ge,{variant:"ghost",size:"sm",onClick:()=>y(N.id),children:[l.jsx(S1,{})," Settings"]})})]},N.id)})})]}):l.jsx(bt,{children:s.length?"No repositories match.":"No repositories yet. They appear when they send their first webhook, or add one above."}):l.jsx(bt,{children:"Loading…"})}),l.jsxs(Jt,{children:["Repositories appear here automatically when they send their first webhook, set to ",l.jsx("b",{children:"Inherit"}),": they follow the most specific group or pattern rule, and otherwise the default (",n.allowlist?"not reviewed, because the allowlist is on":"reviewed, because the allowlist is off","). Choosing Enabled or Disabled here overrides every rule. Settings here override the rules' settings and the repository's own ",l.jsx("code",{children:".codereview.yaml"}),"."]}),n.require_reviewer&&l.jsxs(Jt,{children:[l.jsx("b",{children:"Reviewer required:"})," even in an enabled repository, a merge request is reviewed only when the bot user is one of its reviewers. Adding the bot as a reviewer starts a review; ",l.jsx("code",{children:"@bot review"})," comments still work."]}),l.jsx(Go,{open:!!R,onClose:()=>y(null),title:(R==null?void 0:R.path)??"",description:R?`${R.platform} · ${R.host} · review settings for this repository`:void 0,children:R&&l.jsx(Xd,{value:R.settings,onSave:N=>j(R,R.mode,N).then(()=>y(null)).catch(I=>r(De(I),!0)),onCancel:()=>y(null),danger:l.jsx(ge,{variant:"ghost",className:"text-destructive hover:text-destructive",onClick:()=>D(R),children:"Remove"})},R.id)}),l.jsx(Jd,{open:x,onOpenChange:b,children:l.jsxs(Zd,{className:"sm:max-w-lg",children:[l.jsxs(ef,{children:[l.jsx(nf,{children:"Add repository"}),l.jsx(rf,{children:"Repositories also appear by themselves when they send their first webhook."})]}),l.jsxs(Xt,{className:"lg:grid-cols-2",children:[l.jsx(je,{label:"Platform",children:l.jsxs(He,{value:C.platform,onChange:N=>k({...C,platform:N.target.value}),children:[l.jsx("option",{value:"github",children:"GitHub"}),l.jsx("option",{value:"gitlab",children:"GitLab"})]})}),l.jsx(je,{label:"Host",children:l.jsx(Me,{placeholder:"github.com",value:C.host,onChange:N=>k({...C,host:N.target.value})})}),l.jsx(je,{label:"Repository path",className:"sm:col-span-2",children:l.jsx(Me,{placeholder:"owner/repo or group/sub/project",value:C.path,onChange:N=>k({...C,path:N.target.value})})}),l.jsx(je,{label:"Reviews",children:l.jsxs(He,{value:C.mode,onChange:N=>k({...C,mode:N.target.value}),children:[l.jsx("option",{value:"enabled",children:"Enabled"}),l.jsx("option",{value:"disabled",children:"Disabled"}),l.jsx("option",{value:"inherit",children:"Inherit from rules"})]})})]}),l.jsxs(tf,{children:[l.jsx(ge,{variant:"outline",onClick:()=>b(!1),children:"Cancel"}),l.jsx(ge,{onClick:E,children:"Add"})]})]})})]})}const qu=[["done","Reviewed","--st-done"],["skipped","Skipped","--st-skip"],["failed","Failed","--st-fail"]];function lg(n,r,i=!1){const s=new Date(n);return r==="hour"?i?s.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):s.toLocaleTimeString([],{hour:"2-digit"}):r==="month"?s.toLocaleDateString([],{month:"short",year:i?"numeric":"2-digit"}):s.toLocaleDateString([],{month:"short",day:"numeric"})}const br=(n,r)=>typeof n[r]=="number"?n[r]:0;function w2({points:n,granularity:r}){const i=m.useRef(null),[s,c]=m.useState(900),[u,f]=m.useState(null);m.useEffect(()=>{const N=i.current;if(!N)return;const I=new ResizeObserver(()=>c(Math.max(320,N.clientWidth||900)));return I.observe(N),()=>I.disconnect()},[]);const h=s,v=200,g=34,y=8,x=8,b=24;let C=0;n.forEach(N=>C=Math.max(C,br(N,"done")+br(N,"skipped")+br(N,"failed")));const k=C<=4?4:Math.pow(10,Math.floor(Math.log10(C))),S=Math.ceil(C/k)*k||4,j=(h-g-y)/Math.max(1,n.length),E=Math.min(24,Math.max(2,j*.7)),D=N=>x+(v-x-b)*(1-N/S),T=Math.ceil(n.length/Math.max(2,Math.floor((h-g-y)/70))),P=u!==null?n[u]:null,R=u!==null?Math.min(h-170,Math.max(0,g+j*u+j/2+12)):0;return l.jsxs("div",{className:"chart relative w-full",ref:i,children:[l.jsxs("svg",{className:"block h-auto w-full",viewBox:`0 0 ${h} ${v}`,role:"img","aria-label":`Jobs per ${r}: reviewed, skipped and failed`,children:[n.map((N,I)=>l.jsx("rect",{x:g+j*I,y:x,width:j,height:v-x-b,fill:u===I?"var(--muted)":"transparent",fillOpacity:.5,tabIndex:0,onMouseEnter:()=>f(I),onMouseLeave:()=>f(null),onFocus:()=>f(I),onBlur:()=>f(null)},"h"+I)),[0,S/2,S].map(N=>l.jsxs("g",{pointerEvents:"none",children:[l.jsx("line",{x1:g,x2:h-y,y1:D(N),y2:D(N),stroke:"var(--grid)",strokeWidth:1}),l.jsx("text",{x:g-6,y:D(N)+4,textAnchor:"end",fontSize:11,fill:"var(--muted-foreground)",children:Tt(N)})]},"g"+N)),n.map((N,I)=>{const L=g+j*I+(j-E)/2,Q=qu.map(([J,,ne])=>[br(N,J),ne]).filter(([J])=>J>0);let ee=0;return l.jsxs("g",{pointerEvents:"none",children:[Q.map(([J,ne],de)=>{let re=D(ee+J);const ie=D(ee)-(de>0?2:0);ie-re<1&&(re=ie-1);const B=de===Q.length-1?Math.min(4,E/2,ie-re):0;ee+=J;const Z=`M${L},${ie}V${re+B}Q${L},${re} ${L+B},${re}H${L+E-B}Q${L+E},${re} ${L+E},${re+B}V${ie}Z`;return l.jsx("path",{d:Z,fill:`var(${ne})`},de)}),I%T===0&&l.jsx("text",{x:g+j*I+j/2,y:v-b+16,textAnchor:"middle",fontSize:11,fill:"var(--muted-foreground)",children:lg(N.bucket,r)})]},"b"+I)}),l.jsx("line",{x1:g,x2:h-y,y1:v-b,y2:v-b,stroke:"var(--grid)",strokeWidth:1,pointerEvents:"none"})]}),l.jsx("div",{className:"tip pointer-events-none absolute z-10 w-40 rounded-md border bg-popover p-2.5 text-xs text-popover-foreground shadow-md [&>div]:flex [&>div]:justify-between [&>div]:gap-3 [&>div>span:first-child]:text-muted-foreground "+(P?"show block":"hidden"),id:"mTip",ref:N=>N&&(N.style.left=R+"px",N.style.top="28px"),children:P&&l.jsxs(l.Fragment,{children:[l.jsx("b",{className:"mb-1 block font-semibold",children:lg(P.bucket,r,!0)}),qu.map(([N,I])=>l.jsxs("div",{children:[l.jsx("span",{children:I}),l.jsx("span",{children:br(P,N)})]},N)),l.jsxs("div",{children:[l.jsx("span",{children:"Comments"}),l.jsx("span",{children:br(P,"comments")})]}),l.jsxs("div",{children:[l.jsx("span",{children:"Tokens"}),l.jsx("span",{children:Tt(br(P,"tokens_in")+br(P,"tokens_out"))})]})]})})]})}function b2({className:n,...r}){return l.jsx(Rj,{"data-slot":"checkbox",className:te("peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary",n),...r,children:l.jsx(Dj,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:l.jsx(Ql,{className:"size-3.5"})})})}function k2(n){const r=[],i={};n.points.forEach(h=>i[new Date(h.bucket).toISOString()]=h);const s=new Date(n.to),c=new Date(n.from);if(n.granularity==="month"){let h=new Date(Date.UTC(c.getUTCFullYear(),c.getUTCMonth(),1));for(;h{jt("/admin/api/reviews/"+n.id).then(c).catch(h=>i(De(h),!0))},[n.id]),!s)return l.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading…"});let u=null;try{u=s.result?typeof s.result=="string"?JSON.parse(s.result):s.result:null}catch{u=null}const f=u==null?void 0:u.verification;return l.jsxs("div",{className:"grid gap-5 text-sm",children:[s.error&&l.jsxs("div",{className:"rounded-md border border-destructive/40 bg-danger-soft p-3",children:[l.jsx("div",{className:"mb-1 font-medium text-destructive",children:"Error"}),l.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap text-destructive",children:s.error})]}),u?l.jsxs(l.Fragment,{children:[u.summary&&l.jsxs("div",{children:[l.jsx("h3",{className:"mb-1 font-semibold",children:"Summary"}),l.jsx("p",{className:"leading-relaxed text-muted-foreground",children:u.summary})]}),u.scores&&l.jsx("div",{className:"grid grid-cols-3 gap-2",children:["quality","security","maintainability"].map(h=>l.jsxs("div",{className:"rounded-md border p-2.5",children:[l.jsx("div",{className:"text-lg font-semibold",children:u.scores[h]}),l.jsx("div",{className:"text-xs text-muted-foreground capitalize",children:h})]},h))}),l.jsxs("div",{children:[l.jsx("h3",{className:"mb-2 font-semibold",children:(u.findings||[]).length?`Findings (${u.findings.length})`:"No findings"}),l.jsx("div",{className:"grid gap-2",children:(u.findings||[]).map((h,v)=>l.jsxs("div",{className:"finding rounded-md border p-3",children:[l.jsx("div",{className:"font-medium",children:(h.kind==="question"?"❓ ":"")+h.title}),l.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:[l.jsx(zn,{kind:C2[h.severity]??"idle",children:h.severity}),l.jsx(kn,{variant:"outline",className:"font-normal",children:h.category}),l.jsxs("span",{className:"font-mono",children:[h.path,":",h.end_line]})]})]},v))})]}),(f==null?void 0:f.ran)&&l.jsxs("p",{className:"text-muted-foreground",children:["Verification (",f.model,"): ",f.confirmed||0," confirmed · ",f.false_positives||0," removed · ",f.questions||0," questions"]}),((f==null?void 0:f.removed)||[]).length>0&&l.jsx("div",{className:"grid gap-1.5",children:f.removed.map((h,v)=>l.jsxs("p",{className:"text-xs text-muted-foreground",children:["Removed: ",l.jsx("span",{className:"text-foreground",children:h.title})," — ",h.reason]},"r"+v))})]}):!s.error&&l.jsx("p",{className:"text-muted-foreground",children:s.note||"No review result stored for this job."}),l.jsx(Jr,{}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["Model ",s.model||"—"," · ",s.comments," comments · ",s.files," files"]}),n.kind.includes("review")&&l.jsxs("div",{className:"flex flex-wrap gap-2",children:[l.jsx(ge,{variant:"outline",onClick:()=>r(!1),children:"Re-run (new changes)"}),l.jsx(ge,{variant:"outline",onClick:()=>r(!0),children:"Re-run full review"})]})]})}function S2(){const n=St(),[r,i]=m.useState("day"),[s,c]=m.useState(null),[u,f]=m.useState([]),[h,v]=m.useState({host:"",repo:"",state:"",kind:"",trigger:"",from:"",to:""}),[g,y]=m.useState(""),[x,b]=m.useState(null),[C,k]=m.useState(!1),[S,j]=m.useState(null),[E,D]=m.useState(""),[T,P]=m.useState(!1);m.useEffect(()=>{jt("/admin/api/hosts").then(B=>f(B.hosts||[])).catch(()=>{})},[]);const R=ln("metrics"),N=ei();m.useEffect(()=>{R&&jt("/admin/api/metrics"+Pu({granularity:r,host:h.host})).then(c).catch(B=>n(De(B),!0))},[r,h.host,R]),m.useEffect(()=>{const B=window.setTimeout(()=>v(Z=>({...Z,repo:g.trim()})),300);return()=>window.clearTimeout(B)},[g]);const I=B=>jt("/admin/api/reviews"+Pu({limit:100,...h,before:B})).then(Z=>{b(W=>B?(W||[]).concat(Z.reviews):Z.reviews),k(Z.reviews.length>=100)}).catch(Z=>n(De(Z),!0));m.useEffect(()=>{I()},[h]);const L=()=>{if(!E.trim())return n("Paste a pull request or merge request URL",!0);Fn("/admin/api/reviews",{url:E.trim(),full:T}).then(B=>{D(""),n("Queued "+B.pr+" — it appears here when it finishes")}).catch(B=>n(De(B),!0))},Q=(B,Z)=>Fn(`/admin/api/reviews/${B.id}/rerun`,{full:Z}).then(W=>n("Queued "+W.pr)).catch(W=>n(De(W),!0)),ee=s?k2(s):[],J={jobs:0,done:0,skipped:0,failed:0,comments:0,tokens_in:0,tokens_out:0,duration_ms:0};ee.forEach(B=>Object.keys(J).forEach(Z=>J[Z]+=B[Z]||0));const ne=J.done+J.failed,de=[["Jobs",Tt(J.jobs)],["Reviewed",Tt(J.done)],["Skipped",Tt(J.skipped)],["Failed",Tt(J.failed)+(ne?" · "+Math.round(100*J.failed/ne)+"%":"")],["Comments posted",Tt(J.comments)],["Tokens in / out",Tt(J.tokens_in)+" / "+Tt(J.tokens_out)],["Avg time",ig(ne?J.duration_ms/Math.max(1,J.jobs):0)],["Tokens today (UTC)",Tt((s==null?void 0:s.today_tokens)||0)+(s!=null&&s.daily_token_budget?" of "+Tt(s.daily_token_budget):"")]],re=B=>Z=>v({...h,[B]:Z.target.value}),ie=(x==null?void 0:x.find(B=>B.id===S))??null;return l.jsxs("section",{className:"grid gap-4",children:[l.jsxs(no,{children:[R&&l.jsxs(He,{className:"w-auto","aria-label":"Period",value:r,onChange:B=>i(B.target.value),children:[l.jsx("option",{value:"hour",children:"Last 48 hours"}),l.jsx("option",{value:"day",children:"Last 30 days"}),l.jsx("option",{value:"month",children:"Last 12 months"})]}),l.jsx("span",{className:"flex-1"}),l.jsx(Me,{type:"url",className:"rn-url w-full sm:w-80",placeholder:"Paste a PR/MR URL to review it now","aria-label":"Pull request URL",value:E,onChange:B=>D(B.target.value),onKeyDown:B=>B.key==="Enter"&&L()}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(b2,{id:"rnFull",checked:T,onCheckedChange:B=>P(B===!0)}),l.jsx(jy,{htmlFor:"rnFull",className:"text-sm font-normal text-muted-foreground",children:"Full"})]}),l.jsxs(ge,{onClick:L,children:[l.jsx(w1,{})," Review now"]})]}),!R&&l.jsxs(da,{feature:"metrics",children:["Totals, charts and token use, and history kept longer than ",N.free_retention_days," days, are part of the licensed console. Every review is listed below."]}),R&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"tiles grid grid-cols-2 gap-3 md:grid-cols-4",children:de.map(([B,Z])=>l.jsx(Vn,{className:"tile gap-1 py-4",children:l.jsxs(to,{className:"px-4",children:[l.jsx("div",{className:"text-xl font-semibold tabular-nums",children:Z}),l.jsx("div",{className:"text-xs text-muted-foreground",children:B})]})},B))}),l.jsx(Vn,{className:"py-4",children:l.jsxs(to,{className:"grid gap-3 px-4",children:[l.jsx("div",{className:"flex flex-wrap gap-4 text-xs text-muted-foreground",children:qu.map(([B,Z,W])=>l.jsxs("span",{className:"flex items-center gap-1.5",children:[l.jsx("span",{className:"size-2.5 rounded-sm",ref:q=>q==null?void 0:q.style.setProperty("background",`var(${W})`)}),Z," ",Tt(J[B]||0)]},B))}),s&&l.jsx(w2,{points:ee,granularity:s.granularity})]})})]}),l.jsxs(no,{children:[l.jsxs(He,{className:"w-auto","aria-label":"Host",value:h.host,onChange:re("host"),children:[l.jsx("option",{value:"",children:"All hosts"}),u.map(B=>l.jsx("option",{value:B.host,children:B.name},B.host))]}),l.jsxs("div",{className:"relative w-full sm:w-52",children:[l.jsx(Yl,{className:"pointer-events-none absolute top-2.5 left-2.5 size-4 text-muted-foreground"}),l.jsx(Me,{type:"search",className:"pl-8",placeholder:"Repository","aria-label":"Repository",value:g,onChange:B=>y(B.target.value)})]}),l.jsxs(He,{className:"w-auto","aria-label":"State",value:h.state,onChange:re("state"),children:[l.jsx("option",{value:"",children:"Any state"}),l.jsx("option",{value:"done",children:"Done"}),l.jsx("option",{value:"skipped",children:"Skipped"}),l.jsx("option",{value:"failed",children:"Failed"})]}),l.jsxs(He,{className:"w-auto","aria-label":"Kind",value:h.kind,onChange:re("kind"),children:[l.jsx("option",{value:"",children:"Any kind"}),l.jsx("option",{value:"review",children:"Review"}),l.jsx("option",{value:"full review",children:"Full review"}),l.jsx("option",{value:"answer",children:"Answer"}),l.jsx("option",{value:"help",children:"Help"}),l.jsx("option",{value:"learn",children:"Learn"}),l.jsx("option",{value:"remember",children:"Remember"})]}),l.jsxs(He,{className:"w-auto","aria-label":"Trigger",value:h.trigger,onChange:re("trigger"),children:[l.jsx("option",{value:"",children:"Any trigger"}),l.jsx("option",{value:"push",children:"Push"}),l.jsx("option",{value:"command",children:"Command"}),l.jsx("option",{value:"reply",children:"Reply"}),l.jsx("option",{value:"ui",children:"Admin panel"})]}),l.jsx(Me,{type:"date",className:"w-auto","aria-label":"From",value:h.from,onChange:re("from")}),l.jsx(Me,{type:"date",className:"w-auto","aria-label":"To",value:h.to,onChange:re("to")})]}),l.jsx(ao,{children:x?x.length?l.jsxs(co,{children:[l.jsx(uo,{children:l.jsxs(Mt,{children:[l.jsx(Se,{className:"pl-4",children:"Finished"}),l.jsx(Se,{children:"Pull request"}),l.jsx(Se,{children:"Job"}),l.jsx(Se,{children:"State"}),l.jsx(Se,{className:"text-right",children:"Comments / files"}),l.jsx(Se,{className:"text-right",children:"Tokens in / out"}),l.jsx(Se,{className:"text-right",children:"Took"}),l.jsx(Se,{})]})}),l.jsx(fo,{children:x.map(B=>{const Z=B.started&&!B.started.startsWith("0001-")?new Date(B.finished).getTime()-new Date(B.started).getTime():0;return l.jsxs(Mt,{className:"cursor-pointer",onClick:()=>j(B.id),children:[l.jsx(Ee,{className:"pl-4 text-muted-foreground",title:new Date(B.finished).toLocaleString(),children:ro(B.finished)}),l.jsxs(Ee,{children:[l.jsx("div",{className:"font-medium",children:B.url?l.jsxs("a",{className:"inline-flex items-center gap-1 hover:underline",href:B.url,target:"_blank",rel:"noopener noreferrer",onClick:W=>W.stopPropagation(),children:[B.repo," #",B.number," ",l.jsx(Og,{className:"size-3 text-muted-foreground"})]}):`${B.repo} #${B.number}`}),l.jsxs(Qe,{children:[B.platform," · ",B.host]})]}),l.jsxs(Ee,{children:[l.jsx("div",{children:B.kind}),l.jsx(Qe,{children:B.trigger+(B.requested_by?" · "+B.requested_by:"")})]}),l.jsxs(Ee,{className:"max-w-64 whitespace-normal",children:[l.jsx(zn,{kind:B.state==="done"?"on":B.state==="failed"?"off":"idle",children:B.state}),(B.error||B.note)&&l.jsx(Qe,{className:"line-clamp-2",children:B.error?B.error.slice(0,120):B.note})]}),l.jsxs(Ee,{className:"text-right tabular-nums",children:[B.comments," / ",B.files]}),l.jsxs(Ee,{className:"text-right text-muted-foreground tabular-nums",children:[Tt(B.tokens_in)," / ",Tt(B.tokens_out)]}),l.jsx(Ee,{className:"text-right text-muted-foreground tabular-nums",children:ig(Z)}),l.jsx(Ee,{className:"pr-4 text-right",children:l.jsx(ge,{variant:"ghost",size:"sm",onClick:W=>(W.stopPropagation(),j(B.id)),children:"Details"})})]},B.id)})})]}):l.jsx(bt,{children:"No reviews match."}):l.jsx(bt,{children:"Loading…"})}),C&&l.jsx("div",{children:l.jsx(ge,{variant:"outline",onClick:()=>x&&I(x[x.length-1].id),children:"Load older"})}),l.jsx(Jt,{children:"Every finished review, answer, help and learning job. Charts read hourly, daily and monthly rollups that are updated as each job finishes. Reviews are kept for the retention set in Settings; hourly detail for 3 days, daily and monthly totals for good."}),l.jsx(Go,{wide:!0,open:!!ie,onClose:()=>j(null),title:ie?`${ie.repo} #${ie.number}`:"",description:ie?`${ie.kind} · ${ie.trigger} · ${ie.state} · ${ro(ie.finished)}`:void 0,children:ie&&l.jsx(j2,{job:ie,onRerun:B=>Q(ie,B)},ie.id)})]})}const E2={reply:"from a reply",command:"@bot remember",manual:"added here"};function _2({l:n,onSave:r,onCancel:i,onDelete:s}){const[c,u]=m.useState(n.scope),[f,h]=m.useState(n.path),[v,g]=m.useState(n.text);return l.jsxs("div",{className:"grid gap-4",children:[l.jsx(je,{label:"Applies to",children:l.jsx(Me,{value:c,placeholder:"empty = whole host · group · group/repo",onChange:y=>u(y.target.value)})}),l.jsx(je,{label:"Only files matching",children:l.jsx(Me,{value:f,placeholder:"optional glob",onChange:y=>h(y.target.value)})}),l.jsx(je,{label:"Learning",children:l.jsx(rs,{rows:5,maxLength:600,value:v,onChange:y=>g(y.target.value)})}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[l.jsx(ge,{onClick:()=>r({scope:c.trim(),path:f.trim(),text:v.trim()}),children:"Save"}),l.jsx(ge,{variant:"outline",onClick:i,children:"Cancel"}),l.jsx("span",{className:"flex-1"}),l.jsx(ge,{variant:"ghost",className:"text-destructive hover:text-destructive",onClick:s,children:"Delete"})]})]})}function N2(){const n=St(),r=Zo(),i=ln("learnings"),[s,c]=m.useState(null),[u,f]=m.useState(""),[h,v]=m.useState(""),[g,y]=m.useState(null),[x,b]=m.useState(!1),[C,k]=m.useState({platform:"gitlab",host:"",scope:"",path:"",text:""});m.useEffect(()=>{jt("/admin/api/learnings").then(R=>c(R.learnings||[])).catch(R=>n(De(R),!0))},[]);const S=(R,N)=>oo("/admin/api/learnings/"+R.id,{scope:R.scope,text:R.text,path:R.path,status:R.status,...N}).then(I=>(c(L=>(L||[]).map(Q=>Q.id===I.id?I:Q)),I)),j=()=>Fn("/admin/api/learnings",C).then(R=>{c(N=>(N||[]).concat([R])),k({...C,text:""}),b(!1),n("Learning added")}).catch(R=>n(De(R),!0)),E=async R=>{await r({title:"Delete this learning?",description:R.text,action:"Delete",danger:!0})&&Ji("/admin/api/learnings/"+R.id).then(()=>{c(N=>(N||[]).filter(I=>I.id!==R.id)),y(null),n("Deleted")}).catch(N=>n(De(N),!0))},D={active:0,pending:0,disabled:0};(s||[]).forEach(R=>D[R.status]+=1);const T=(s||[]).filter(R=>(!h||R.status===h)&&(!u||(R.text+" "+R.scope+" "+R.host+" "+R.path).toLowerCase().includes(u.toLowerCase()))),P=(s==null?void 0:s.find(R=>R.id===g))??null;return l.jsxs("section",{className:"grid gap-4",children:[!i&&l.jsxs(da,{feature:"learnings",children:["Capturing team decisions from review replies, ",l.jsx("code",{children:"@bot remember"}),", and applying them to reviews are part of the licensed console. Without a license nothing new is learned and existing learnings are not applied."]}),l.jsxs(no,{children:[l.jsxs("div",{className:"relative w-full sm:w-64",children:[l.jsx(Yl,{className:"pointer-events-none absolute top-2.5 left-2.5 size-4 text-muted-foreground"}),l.jsx(Me,{type:"search",className:"pl-8",placeholder:"Search learnings","aria-label":"Search learnings",value:u,onChange:R=>f(R.target.value)})]}),l.jsxs(He,{className:"w-auto","aria-label":"Status",value:h,onChange:R=>v(R.target.value),children:[l.jsx("option",{value:"",children:"Any status"}),l.jsx("option",{value:"active",children:"Active"}),l.jsx("option",{value:"pending",children:"Waiting for approval"}),l.jsx("option",{value:"disabled",children:"Disabled"})]}),l.jsx("span",{className:"text-sm text-muted-foreground",children:s&&`${D.active} active · ${D.pending} waiting · ${D.disabled} disabled`}),l.jsx("span",{className:"flex-1"}),i&&l.jsxs(ge,{variant:"outline",onClick:()=>b(!0),children:[l.jsx(Xi,{})," Add learning"]})]}),l.jsx(ao,{children:s?T.length?l.jsxs(co,{children:[l.jsx(uo,{children:l.jsxs(Mt,{children:[l.jsx(Se,{className:"pl-4",children:"Applies to"}),l.jsx(Se,{children:"Learning"}),l.jsx(Se,{children:"Status"}),l.jsx(Se,{children:"Source"}),l.jsx(Se,{})]})}),l.jsx(fo,{children:T.map(R=>l.jsxs(Mt,{children:[l.jsxs(Ee,{className:"pl-4 align-top",children:[l.jsx("div",{children:R.scope?l.jsx("code",{children:R.scope}):l.jsx("b",{children:"Whole host"})}),l.jsxs(Qe,{children:[R.platform," · ",R.host]})]}),l.jsxs(Ee,{className:"min-w-64 align-top whitespace-normal",children:[l.jsx("div",{children:R.text}),R.path&&l.jsxs(kn,{variant:"outline",className:"mt-1 font-normal text-muted-foreground",children:["files: ",R.path]})]}),l.jsx(Ee,{className:"w-36 align-top",children:l.jsxs(He,{"aria-label":"Status",value:R.status,disabled:!i,onChange:N=>S(R,{status:N.target.value}).then(I=>n("Learning "+I.status)).catch(I=>n(De(I),!0)),children:[l.jsx("option",{value:"active",children:"Active"}),l.jsx("option",{value:"pending",children:"Waiting"}),l.jsx("option",{value:"disabled",children:"Disabled"})]})}),l.jsxs(Ee,{className:"align-top text-muted-foreground",children:[l.jsx("div",{children:(E2[R.source]||R.source)+(R.source_author?" · "+R.source_author:"")}),R.source_url&&l.jsxs("a",{className:"inline-flex items-center gap-1 text-xs hover:text-foreground hover:underline",href:R.source_url,target:"_blank",rel:"noopener noreferrer",children:["open PR ",l.jsx(Og,{className:"size-3"})]}),l.jsx(Qe,{children:ro(R.updated_at)})]}),l.jsx(Ee,{className:"pr-4 text-right align-top",children:i?l.jsx(ge,{variant:"ghost",size:"sm",onClick:()=>y(R.id),children:"Edit"}):l.jsx(ge,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>E(R),children:"Delete"})})]},R.id))})]}):l.jsx(bt,{children:s.length?"No learnings match.":"No learnings yet. Reply to one of the bot's comments with a team decision, or use @bot remember."}):l.jsx(bt,{children:"Loading…"})}),l.jsxs(Jt,{children:["Learnings are team decisions from review discussions. When someone replies to one of the bot's comments, the bot reacts 👀, asks the model whether the reply states a rule for future reviews, and if so saves it here (✅ on GitLab, 🎉 on GitHub). ",l.jsx("code",{children:"@bot remember "})," saves one directly. Each starts scoped to its repository; widen ",l.jsx("b",{children:"Applies to"})," to a group or the whole host so one standard covers many repositories. Matching active learnings go with every review: the reviewer follows them and the verifier drops findings they rule out."]}),l.jsx(Go,{open:!!P,onClose:()=>y(null),title:"Edit learning",description:P?`${P.platform} · ${P.host}`:void 0,children:P&&l.jsx(_2,{l:P,onCancel:()=>y(null),onDelete:()=>E(P),onSave:R=>S(P,R).then(()=>{y(null),n("Saved")}).catch(N=>n(De(N),!0))},P.id)}),l.jsx(Jd,{open:x,onOpenChange:b,children:l.jsxs(Zd,{className:"sm:max-w-xl",children:[l.jsxs(ef,{children:[l.jsx(nf,{children:"Add learning"}),l.jsx(rf,{children:"A rule future reviews should follow."})]}),l.jsxs(Xt,{className:"lg:grid-cols-2",children:[l.jsx(je,{label:"Platform",children:l.jsxs(He,{value:C.platform,onChange:R=>k({...C,platform:R.target.value}),children:[l.jsx("option",{value:"gitlab",children:"GitLab"}),l.jsx("option",{value:"github",children:"GitHub"}),l.jsx("option",{value:"bitbucket",children:"Bitbucket"})]})}),l.jsx(je,{label:"Host",children:l.jsx(Me,{placeholder:"gitlab.example.com",value:C.host,onChange:R=>k({...C,host:R.target.value})})}),l.jsx(je,{label:"Applies to",children:l.jsx(Me,{placeholder:"empty = whole host · group · group/repo",value:C.scope,onChange:R=>k({...C,scope:R.target.value})})}),l.jsx(je,{label:"Only files matching",children:l.jsx(Me,{placeholder:"optional glob, e.g. api/legacy/**",value:C.path,onChange:R=>k({...C,path:R.target.value})})})]}),l.jsx(je,{label:"Learning",children:l.jsx(rs,{rows:4,maxLength:600,placeholder:"e.g. Account numbers are compared without leading zeros on purpose.",value:C.text,onChange:R=>k({...C,text:R.target.value})})}),l.jsxs(tf,{children:[l.jsx(ge,{variant:"outline",onClick:()=>b(!1),children:"Cancel"}),l.jsx(ge,{onClick:j,children:"Add learning"})]})]})})]})}const Xu={github:"GitHub",gitlab:"GitLab",bitbucket:"Bitbucket"},R2={github:"https://api.github.com",gitlab:"https://gitlab.com",bitbucket:"https://api.bitbucket.org/2.0"},jl=n=>n.split(` -`).map(r=>r.trim()).filter(Boolean);function kr({label:n,set:r,multi:i,list:s,help:c,value:u,onChange:f}){const h=r?"Set ✓ — leave blank to keep":s?"one per line":"";return l.jsx(je,{label:n+(c?" — "+c:""),children:i?l.jsx(rs,{rows:3,className:"font-mono text-xs",placeholder:h,autoComplete:"off",spellCheck:!1,value:u,onChange:v=>f(v.target.value)}):l.jsx(Me,{type:"password",placeholder:h,autoComplete:"new-password",value:u,onChange:v=>f(v.target.value)})})}function of({text:n,label:r="Copy"}){const i=St(),[s,c]=m.useState(!1),u=()=>navigator.clipboard.writeText(n).then(()=>{c(!0),setTimeout(()=>c(!1),1500)}).catch(()=>i("Copy failed: select the text and copy it",!0));return l.jsxs(ge,{variant:"ghost",size:"sm",onClick:u,"aria-label":r,children:[s?l.jsx(Ql,{}):l.jsx(f1,{})," ",r]})}function Ly({secret:n,platform:r,onDone:i}){const s=r==="gitlab"?"GitLab's Secret token field":"the webhook's Secret field";return l.jsxs("div",{className:"grid gap-2 rounded-lg border border-warning/40 bg-warning-soft p-3",children:[l.jsx("div",{className:"text-sm font-medium",children:"Copy the secret now: it is not shown again."}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("code",{className:"min-w-0 flex-1 break-all font-mono text-xs",children:n}),l.jsx(of,{text:n})]}),l.jsxs(Qe,{children:["Paste it into ",s,", together with the URL."]}),l.jsx("div",{children:l.jsx(ge,{size:"sm",variant:"outline",onClick:i,children:"I've copied it"})})]})}function P2({hook:n,platform:r,onChanged:i}){const s=St(),c=Zo(),[u,f]=m.useState(""),[h,v]=m.useState(n.name),[g,y]=m.useState(""),x=(k,S)=>oo("/admin/api/webhooks/"+n.id,k).then(j=>{s(S),j.secret&&f(j.secret),i()}).catch(j=>s(De(j),!0)),b=async()=>{await c({title:"Replace the secret of "+n.name+"?",description:"Deliveries signed with the old secret are rejected until you paste the new one into the code host.",action:"Replace secret",danger:!0})&&x({regenerate_secret:!0},"New secret for "+n.name)},C=async()=>{await c({title:"Delete "+n.name+"?",description:"Its URL stops working at once. Remove the webhook from the code host too.",action:"Delete webhook",danger:!0})&&Ji("/admin/api/webhooks/"+n.id).then(()=>{s("Deleted "+n.name),i()}).catch(k=>s(De(k),!0))};return l.jsxs("div",{className:"grid gap-3 rounded-lg border p-3",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx(Me,{className:"h-8 max-w-64",value:h,onChange:k=>v(k.target.value),onBlur:()=>h.trim()!==n.name&&x({name:h},"Renamed")}),l.jsx(zn,{kind:n.enabled?"on":"idle",children:n.enabled?"Enabled":"Disabled"}),r==="gitlab"&&n.secrets.signing_tokens>0&&l.jsx(kn,{variant:"outline",className:"font-normal text-muted-foreground",children:"signing token ✓"}),l.jsx("span",{className:"flex-1"}),l.jsx(ge,{variant:"ghost",size:"sm",onClick:()=>x({enabled:!n.enabled},n.enabled?"Disabled "+n.name:"Enabled "+n.name),children:n.enabled?"Disable":"Enable"}),l.jsx(ge,{variant:"ghost",size:"sm",onClick:b,children:"New secret"}),l.jsx(ge,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:C,children:"Delete"})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("code",{className:"hosturl min-w-0 flex-1 break-all",children:n.url}),l.jsx(of,{text:n.url,label:"Copy URL"})]}),u&&l.jsx(Ly,{secret:u,platform:r,onDone:()=>f("")}),r==="gitlab"&&l.jsx(je,{label:"Signing token (whsec_…) — GitLab 19.0+, "+(n.secrets.signing_tokens?"set ✓, paste to replace":"optional: copy it from the webhook in GitLab"),children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Me,{type:"password",autoComplete:"off",value:g,placeholder:n.secrets.signing_tokens?"Set ✓":"",onChange:k=>y(k.target.value)}),l.jsx(ge,{variant:"outline",size:"sm",disabled:!g.trim(),onClick:()=>x({signing_tokens:[g.trim()]},"Saved signing token").then(()=>y("")),children:"Save"}),n.secrets.signing_tokens>0&&l.jsx(ge,{variant:"ghost",size:"sm",onClick:()=>x({signing_tokens:[]},"Removed signing token"),children:"Remove"})]})}),l.jsxs(Qe,{children:["Added ",new Date(n.created_at).toLocaleDateString(),n.created_by?" by "+n.created_by:""]})]})}function D2({host:n,managed:r,onChanged:i}){const s=St(),[c,u]=m.useState(""),[f,h]=m.useState(null),v=()=>Fn(`/admin/api/hosts/${n.id}/webhooks`,{name:c.trim()}).then(y=>{u(""),h({id:y.webhook.id,secret:y.secret}),s("Added "+y.webhook.name),i()}).catch(y=>s(De(y),!0)),g=n.secrets.webhook_secrets>0||n.secrets.signing_tokens>0;return l.jsxs("div",{className:"grid gap-6",children:[r&&l.jsxs(Xr,{title:"Add a webhook",children:[l.jsxs("div",{className:"flex flex-wrap gap-2",children:[l.jsx(Me,{className:"max-w-80",value:c,placeholder:n.platform==="gitlab"?"e.g. the group it's for":"e.g. where it's set up",onChange:y=>u(y.target.value)}),l.jsxs(ge,{onClick:v,children:[l.jsx(Xi,{})," Add webhook"]})]}),l.jsxs(Qe,{children:["The console generates a URL and a secret. Set the code host's webhook to them, with these events: ",n.events.join(", "),"."]})]}),l.jsx(Xr,{title:`Webhooks (${n.webhooks.length})`,children:n.webhooks.length?n.webhooks.map(y=>l.jsxs("div",{className:"grid gap-2",children:[(f==null?void 0:f.id)===y.id&&l.jsx(Ly,{secret:f.secret,platform:n.platform,onDone:()=>h(null)}),l.jsx(P2,{hook:y,platform:n.platform,onChanged:i})]},y.id)):l.jsxs(Qe,{children:["No webhooks yet",r?": add one above.":"."]})}),l.jsx(Jr,{}),l.jsxs(Xr,{title:"Shared URL",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("code",{className:"hosturl min-w-0 flex-1 break-all",children:n.webhook_url}),l.jsx(of,{text:n.webhook_url,label:"Copy URL"})]}),l.jsx(Qe,{children:g?"Still accepted for existing hooks. It is shared by every "+Xu[n.platform]+" host and checked with the secrets in the host's settings. Move hooks to their own URL above when you can.":"Shared by every "+Xu[n.platform]+" host. This host has no secrets of its own for it, so only the webhooks above work."})]})]})}function Xr({title:n,children:r}){return l.jsxs("div",{className:"grid gap-3",children:[l.jsx("h3",{className:"text-xs font-semibold tracking-wide text-muted-foreground uppercase",children:n}),r]})}function T2({host:n,onSaved:r,onCancel:i}){const s=St(),c=ln("hosts"),u=(n==null?void 0:n.settings)??{},f=(n==null?void 0:n.secrets)??{token:!1,app_private_key:!1,api_token:!1,webhook_secrets:0,signing_tokens:0},[h,v]=m.useState((n==null?void 0:n.platform)??"gitlab"),[g,y]=m.useState({base:(n==null?void 0:n.base_url)??"",name:(n==null?void 0:n.name)??"",enabled:n?n.enabled:!0,token:"",appID:u.app_id?String(u.app_id):"",appKey:"",email:u.email??"",apiToken:"",secrets:"",signing:"",reqSig:!!u.require_signature,skipTLS:!!u.skip_tls_verify,bot:u.bot_name??"",reviewer:u.reviewer??""}),x=C=>k=>y({...g,[C]:typeof k=="object"&&(k!=null&&k.target)?k.target.value:k}),b=()=>{const C={platform:h,base_url:g.base.trim(),name:g.name.trim(),enabled:g.enabled,settings:{bot_name:g.bot.trim(),reviewer:g.reviewer.trim()}};h==="github"&&(C.settings.app_id=parseInt(g.appID||"0",10)),h==="gitlab"&&Object.assign(C.settings,{skip_tls_verify:g.skipTLS,require_signature:g.reqSig}),h==="bitbucket"&&(C.settings.email=g.email.trim()),g.token.trim()&&(C.token=g.token.trim()),g.appKey.trim()&&(C.app_private_key=g.appKey),g.apiToken.trim()&&(C.api_token=g.apiToken.trim()),jl(g.secrets).length&&(C.webhook_secrets=jl(g.secrets)),jl(g.signing).length&&(C.signing_tokens=jl(g.signing)),(n?oo("/admin/api/hosts/"+n.id,C):Fn("/admin/api/hosts",C)).then(k=>{s("Saved "+k.name),r(k)}).catch(k=>s(De(k),!0))};return l.jsxs("div",{className:"grid gap-6",children:[l.jsx(Xr,{title:"Host",children:l.jsxs(Xt,{className:"lg:grid-cols-2",children:[l.jsx(je,{label:"Platform",children:l.jsxs(He,{id:"hPlat",value:h,disabled:!!n,onChange:C=>v(C.target.value),children:[l.jsx("option",{value:"gitlab",children:"GitLab"}),l.jsx("option",{value:"github",children:"GitHub"}),l.jsx("option",{value:"bitbucket",children:"Bitbucket Cloud"})]})}),l.jsx(je,{label:"Status",children:l.jsxs(He,{value:String(g.enabled),onChange:C=>y({...g,enabled:C.target.value==="true"}),children:[l.jsx("option",{value:"true",children:"Enabled"}),l.jsx("option",{value:"false",children:"Disabled"})]})}),l.jsx(je,{label:h==="gitlab"?"Instance URL":"API URL",children:l.jsx(Me,{value:g.base,placeholder:R2[h],onChange:x("base")})}),l.jsx(je,{label:"Name",children:l.jsx(Me,{value:g.name,placeholder:"shown in the console",onChange:x("name")})})]})}),l.jsx(Jr,{}),l.jsx(Xr,{title:"API access",children:l.jsxs("div",{className:"grid gap-4",children:[h==="github"&&l.jsxs(l.Fragment,{children:[l.jsx(kr,{label:"Token",help:"or use a GitHub App below",set:f.token,value:g.token,onChange:x("token")}),l.jsx(je,{label:"GitHub App ID",children:l.jsx(Me,{type:"number",value:g.appID,onChange:x("appID")})}),l.jsx(kr,{label:"GitHub App private key (PEM)",set:f.app_private_key,multi:!0,value:g.appKey,onChange:x("appKey")})]}),h==="gitlab"&&l.jsxs(l.Fragment,{children:[l.jsx(kr,{label:"Access token (api scope)",set:f.token,value:g.token,onChange:x("token")}),l.jsx(je,{label:"TLS",children:l.jsxs(He,{value:String(g.skipTLS),onChange:C=>y({...g,skipTLS:C.target.value==="true"}),children:[l.jsx("option",{value:"false",children:"Verify certificates"}),l.jsx("option",{value:"true",children:"Skip verification (self-signed)"})]})})]}),h==="bitbucket"&&l.jsxs(l.Fragment,{children:[l.jsx(kr,{label:"Access token",help:"repository or workspace token",set:f.token,value:g.token,onChange:x("token")}),l.jsx(je,{label:"Account email",children:l.jsx(Me,{value:g.email,placeholder:"with an API token instead",onChange:x("email")})}),l.jsx(kr,{label:"Atlassian API token",set:f.api_token,value:g.apiToken,onChange:x("apiToken")})]})]})}),l.jsx(Jr,{}),l.jsxs(Xr,{title:"Shared URL secrets (optional)",children:[l.jsxs(Qe,{children:["Only for hooks on the shared ","/webhooks/"+h," URL. Webhooks added under Webhooks have their own URL and secret."]}),l.jsx("div",{className:"grid gap-4",children:h==="gitlab"?l.jsxs(l.Fragment,{children:[l.jsx(kr,{label:"Signing tokens (whsec_…)",multi:!0,list:!0,set:f.signing_tokens>0,help:f.signing_tokens?f.signing_tokens+" set":"GitLab 19.0+, recommended",value:g.signing,onChange:x("signing")}),l.jsx(kr,{label:"Secret tokens",multi:!0,list:!0,set:f.webhook_secrets>0,help:f.webhook_secrets?f.webhook_secrets+" set":"older hooks",value:g.secrets,onChange:x("secrets")}),l.jsx(je,{label:"Unsigned webhooks",children:l.jsxs(He,{value:String(g.reqSig),onChange:C=>y({...g,reqSig:C.target.value==="true"}),children:[l.jsx("option",{value:"false",children:"Accept with a secret token"}),l.jsx("option",{value:"true",children:"Reject"})]})})]}):l.jsx(kr,{label:"Webhook secrets",multi:!0,list:!0,set:f.webhook_secrets>0,help:f.webhook_secrets?f.webhook_secrets+" set":"one per hook",value:g.secrets,onChange:x("secrets")})})]}),l.jsx(Jr,{}),l.jsx(Xr,{title:"Bot identity",children:l.jsxs(Xt,{className:"lg:grid-cols-2",children:[l.jsx(je,{label:"Mention name",hint:l.jsx(Tl,{feature:"hosts"}),children:l.jsx(Me,{value:g.bot,placeholder:"default: the token's user",disabled:!c&&!g.bot,onChange:x("bot")})}),l.jsx(je,{label:"Reviewer username",children:l.jsx(Me,{value:g.reviewer,placeholder:"default: the token's user",disabled:!c&&!g.reviewer,onChange:x("reviewer")})})]})}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[l.jsx(ge,{onClick:b,children:n?"Save host":"Add host"}),l.jsx(ge,{variant:"outline",onClick:i,children:"Cancel"})]})]})}function O2(){const n=St(),r=Zo(),i=ln("hosts"),[s,c]=m.useState(null),[u,f]=m.useState(null),[h,v]=m.useState(null),[g,y]=m.useState({}),x=()=>jt("/admin/api/hosts").then(c).catch(E=>n(De(E),!0));m.useEffect(()=>{x()},[]);const b=E=>{y(D=>({...D,[E.id]:{pending:!0}})),Fn(`/admin/api/hosts/${E.id}/test`).then(D=>y(T=>({...T,[E.id]:D}))).catch(D=>y(T=>({...T,[E.id]:{ok:!1,message:De(D)}})))},C=async E=>{await r({title:"Delete "+E.name+"?",description:"Webhooks from it will be rejected and its stored tokens removed.",action:"Delete host",danger:!0})&&Ji("/admin/api/hosts/"+E.id).then(()=>{n("Deleted "+E.name),x()}).catch(D=>n(De(D),!0))},k=(s==null?void 0:s.mode)==="database",S=u?(s==null?void 0:s.hosts.find(E=>E.id===u))??null:null,j=h?(s==null?void 0:s.hosts.find(E=>E.id===h))??null:null;return l.jsxs("section",{className:"grid gap-4",children:[l.jsxs(no,{children:[l.jsxs("span",{className:"text-sm text-muted-foreground",children:[s&&(k?"Managed here; stored encrypted in the database.":`Hosts come from the config file (read-only). Set ${s.key_env||"CODEREVIEW_CONSOLE_SECRET_KEY"} to manage them here.`),s&&!i&&" Free: one host per platform."]}),l.jsx("span",{className:"flex-1"}),k&&l.jsxs(ge,{variant:"outline",onClick:()=>f(0),children:[l.jsx(Xi,{})," Add host"]})]}),l.jsx(ao,{children:s?s.hosts.length?l.jsxs(co,{children:[l.jsx(uo,{children:l.jsxs(Mt,{children:[l.jsx(Se,{className:"pl-4",children:"Host"}),l.jsx(Se,{children:"Credentials"}),l.jsx(Se,{children:"Webhooks"}),l.jsx(Se,{children:"Check"}),l.jsx(Se,{})]})}),l.jsx(fo,{children:s.hosts.map(E=>{const D=E.secrets,T=[D.token&&"token ✓",E.settings.app_id&&`App ${E.settings.app_id}${D.app_private_key?" ✓":" (no key)"}`,D.api_token&&"API token ✓",D.signing_tokens&&`${D.signing_tokens} signing token${D.signing_tokens>1?"s":""}`,D.webhook_secrets&&`${D.webhook_secrets} webhook secret${D.webhook_secrets>1?"s":""}`].filter(Boolean),P=g[E.id];return l.jsxs(Mt,{children:[l.jsxs(Ee,{className:"pl-4 align-top",children:[l.jsx("div",{className:"font-medium",children:E.name}),l.jsxs(Qe,{children:[Xu[E.platform]," · ",E.host]}),l.jsx("div",{className:"mt-1.5",children:E.licensed?l.jsx(zn,{kind:E.enabled?"on":"idle",children:E.enabled?"Enabled":"Disabled"}):l.jsx(zn,{kind:"warn",children:"Inactive: needs a license"})})]}),l.jsxs(Ee,{className:"align-top whitespace-normal",children:[l.jsx("div",{className:"flex flex-wrap gap-1",children:T.map(R=>l.jsx(kn,{variant:"outline",className:"font-normal text-muted-foreground",children:R},R))}),l.jsxs(Qe,{children:["mention: ",E.settings.bot_name?"@"+E.settings.bot_name:"token user",E.settings.reviewer?" · reviewer: "+E.settings.reviewer:""]})]}),l.jsxs(Ee,{className:"max-w-80 align-top whitespace-normal",children:[E.webhooks.length?l.jsx("div",{className:"grid gap-0.5 text-sm",children:E.webhooks.map(R=>l.jsx("div",{className:R.enabled?"":"text-muted-foreground line-through",children:R.name},R.id))}):l.jsx(Qe,{children:E.secrets.webhook_secrets||E.secrets.signing_tokens?"Shared URL only":"None yet"}),l.jsxs(ge,{variant:"link",size:"sm",className:"h-auto px-0",onClick:()=>v(E.id),children:[l.jsx(iv,{})," ",k?"Manage webhooks":"Show URLs"]})]}),l.jsx(Ee,{className:"max-w-56 align-top whitespace-normal",children:P&&(P.pending?l.jsx("span",{className:"text-sm text-muted-foreground",children:"testing…"}):l.jsx(zn,{kind:P.ok?"on":"off",children:P.message}))}),l.jsx(Ee,{className:"pr-4 text-right align-top",children:l.jsxs("div",{className:"flex justify-end gap-1",children:[l.jsxs(ge,{variant:"ghost",size:"sm",onClick:()=>b(E),children:[l.jsx(b1,{})," Test"]}),k&&l.jsxs(l.Fragment,{children:[l.jsx(ge,{variant:"ghost",size:"sm",onClick:()=>f(E.id),children:"Edit"}),l.jsx(ge,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>C(E),children:"Delete"})]})]})})]},E.id)})})]}):l.jsx(bt,{children:"No code hosts yet. Add GitHub, GitLab or Bitbucket."}):l.jsx(bt,{children:"Loading…"})}),l.jsxs(Jt,{children:["Each host is a GitHub (github.com or Enterprise), GitLab (gitlab.com or self-managed) or Bitbucket Cloud account the console reviews for. Tokens and webhook secrets are encrypted with ",l.jsx("code",{children:"CODEREVIEW_CONSOLE_SECRET_KEY"})," before they are stored and are never shown again: leave a secret blank to keep it. Under ",l.jsx("b",{children:"Manage webhooks"}),", add one webhook per hook you set up (a GitLab system hook, each group hook): each gets its own URL and secret, so one can be replaced or removed without touching the others."]}),l.jsx(Go,{open:j!==null,onClose:()=>v(null),title:j?"Webhooks: "+j.name:"",description:"Each webhook has its own URL and secret.",wide:!0,children:j&&l.jsx(D2,{host:j,managed:k,onChanged:x},j.id)}),l.jsx(Go,{open:u!==null,onClose:()=>f(null),title:S?"Edit "+S.name:"New host",description:"Credentials are encrypted before they are stored.",children:u!==null&&l.jsx(T2,{host:S,onCancel:()=>f(null),onSaved:E=>{f(null),x().then(()=>b(E))}},u)})]})}const Ju=[["enabled","Reviews","Enabled","Disabled"],["require_reviewer","Reviewer required","On","Off"],["skip_branch_sync","Branch syncs","Skip","Review"],["score_labels","Score labels","On","Off"],["commit_status","Commit status","On","Off"]],Bi=n=>n.pattern||"Whole host";function M2({rule:n,onSave:r,onDelete:i}){const[s,c]=m.useState(()=>Object.fromEntries(Ju.map(([u])=>[u,n[u]??null])));return l.jsx(Xd,{value:n.settings,inheritModel:"Inherit",onSave:u=>r({...s,settings:u}),danger:l.jsx(ge,{variant:"ghost",className:"text-destructive hover:text-destructive",onClick:i,children:"Delete rule"}),extra:l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid gap-3",children:[l.jsx("h3",{className:"text-xs font-semibold tracking-wide text-muted-foreground uppercase",children:"Settings for this level"}),l.jsx(Xt,{className:"lg:grid-cols-2",children:Ju.map(([u,f,h,v])=>l.jsx(je,{label:f,children:l.jsx(Vl,{value:s[u],on:h,off:v,onChange:g=>c({...s,[u]:g})})},u))})]}),l.jsx(Jr,{}),l.jsx("h3",{className:"text-xs font-semibold tracking-wide text-muted-foreground uppercase",children:"Review settings"})]})})}function A2(){const n=St(),r=Zo(),i=ln("rules"),[s,c]=m.useState(null),[u,f]=m.useState([]),[h,v]=m.useState(null),[g,y]=m.useState(!1),[x,b]=m.useState({platform:"gitlab",host:"",pattern:"",enabled:null}),C=()=>jt("/admin/api/repos").then(P=>f(P||[]));m.useEffect(()=>{jt("/admin/api/rules").then(P=>c(P||[])).catch(P=>n(De(P),!0)),C().catch(()=>{})},[]);const k=P=>{const R=P.pattern?P.pattern:"host "+P.host;return u.filter(N=>(N.effective.rules||[]).includes(R)&&N.platform===P.platform&&N.host===P.host).length},S=()=>{const P={platform:x.platform,host:x.host.trim(),pattern:x.pattern.trim()};x.enabled!==null&&(P.enabled=x.enabled),Fn("/admin/api/rules",P).then(R=>(c(N=>(N||[]).filter(I=>I.id!==R.id).concat([R])),b({...x,pattern:""}),y(!1),v(R.id),n("Saved rule "+Bi(R)+" — set its options"),C())).catch(R=>n(De(R),!0))},j=(P,R)=>oo("/admin/api/rules/"+P.id,R).then(N=>(c(I=>(I||[]).map(L=>L.id===N.id?N:L)),v(null),n("Saved "+Bi(N)),C())).catch(N=>n(De(N),!0)),E=async P=>{await r({title:"Delete the rule for "+Bi(P)+"?",description:"On "+P.host+". Repositories fall back to the level above.",action:"Delete rule",danger:!0})&&Ji("/admin/api/rules/"+P.id).then(()=>(c(R=>(R||[]).filter(N=>N.id!==P.id)),v(null),n("Deleted rule "+Bi(P)),C())).catch(R=>n(De(R),!0))},D=(s||[]).slice().sort((P,R)=>(P.platform+P.host).localeCompare(R.platform+R.host)||(P.pattern?1:0)-(R.pattern?1:0)||P.pattern.localeCompare(R.pattern)),T=(s==null?void 0:s.find(P=>P.id===h))??null;return l.jsxs("section",{className:"grid gap-4",children:[!i&&l.jsx(da,{feature:"rules",children:"Settings for a whole host, a group or a name pattern are part of the licensed console. Without a license, repositories follow the global settings and their own mode; any rules below are kept but ignored."}),l.jsxs(no,{children:[l.jsx("span",{className:"text-sm text-muted-foreground",children:"Settings for a whole host, or for a group, organisation or name pattern on a host."}),l.jsx("span",{className:"flex-1"}),i&&l.jsxs(ge,{variant:"outline",onClick:()=>y(!0),children:[l.jsx(Xi,{})," Add rule"]})]}),l.jsx(ao,{children:s?s.length?l.jsxs(co,{children:[l.jsx(uo,{children:l.jsxs(Mt,{children:[l.jsx(Se,{className:"pl-4",children:"Scope"}),l.jsx(Se,{children:"Sets"}),l.jsx(Se,{children:"Covers"}),l.jsx(Se,{children:"Last changed"}),l.jsx(Se,{})]})}),l.jsx(fo,{children:D.map(P=>{const R=k(P),N=Ju.filter(([I])=>P[I]!==null&&P[I]!==void 0).map(([I,L,Q,ee])=>L+": "+(P[I]?Q:ee));return l.jsxs(Mt,{children:[l.jsxs(Ee,{className:"pl-4 align-top",children:[l.jsx("div",{children:P.pattern?l.jsx("code",{children:P.pattern}):l.jsx("b",{children:"Whole host"})}),l.jsxs(Qe,{children:[P.platform," · ",P.host]})]}),l.jsxs(Ee,{className:"align-top whitespace-normal",children:[l.jsx(Yu,{items:N,empty:"inherits everything"}),l.jsx("div",{className:"mt-1",children:l.jsx(Yu,{items:My(P.settings)})})]}),l.jsx(Ee,{className:"align-top text-muted-foreground",children:R+(R===1?" known repository":" known repositories")}),l.jsx(Ee,{className:"align-top text-muted-foreground",children:P.updated_by?P.updated_by+" · "+ro(P.updated_at):"—"}),l.jsx(Ee,{className:"pr-4 text-right align-top",children:i?l.jsx(ge,{variant:"ghost",size:"sm",onClick:()=>v(P.id),children:"Edit"}):l.jsx(ge,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>E(P),children:"Delete"})})]},P.id)})})]}):l.jsx(bt,{children:"No rules yet. Add one for a whole host, a group or a name pattern."}):l.jsx(bt,{children:"Loading…"})}),l.jsxs(Jt,{children:["Levels, broadest first: ",l.jsx("b",{children:"Settings"})," (everything) → ",l.jsx("b",{children:"whole host"})," (empty pattern) → ",l.jsx("b",{children:"group or owner"})," (",l.jsx("code",{children:"acme"}),", ",l.jsx("code",{children:"acme/platform"}),", subgroups included) or ",l.jsx("b",{children:"pattern"})," (",l.jsx("code",{children:"acme/svc-*"}),"; ",l.jsx("code",{children:"*"})," stays within one level) → ",l.jsx("b",{children:"repository"}),". For each setting the most specific level that sets it wins; ",l.jsx("b",{children:"Inherit"}),' means "use the level above". Review settings add up the same way. Hosts are separate: a rule for ',l.jsx("code",{children:"acme"})," on one host never touches ",l.jsx("code",{children:"acme"})," on another."]}),l.jsx(Go,{open:!!T,onClose:()=>v(null),title:T?Bi(T):"",description:T?`${T.platform} · ${T.host}`:void 0,children:T&&l.jsx(M2,{rule:T,onSave:P=>j(T,P),onDelete:()=>E(T)},T.id)}),l.jsx(Jd,{open:g,onOpenChange:y,children:l.jsxs(Zd,{className:"sm:max-w-lg",children:[l.jsxs(ef,{children:[l.jsx(nf,{children:"Add rule"}),l.jsx(rf,{children:"After adding it, set its options."})]}),l.jsxs(Xt,{className:"lg:grid-cols-2",children:[l.jsx(je,{label:"Platform",children:l.jsxs(He,{value:x.platform,onChange:P=>b({...x,platform:P.target.value}),children:[l.jsx("option",{value:"gitlab",children:"GitLab"}),l.jsx("option",{value:"github",children:"GitHub"})]})}),l.jsx(je,{label:"Host",children:l.jsx(Me,{placeholder:"gitlab.com",value:x.host,onChange:P=>b({...x,host:P.target.value})})}),l.jsx(je,{label:"Group, owner or pattern",className:"sm:col-span-2",children:l.jsx(Me,{placeholder:"empty = whole host · acme · acme/svc-*",value:x.pattern,onChange:P=>b({...x,pattern:P.target.value})})}),l.jsx(je,{label:"Reviews",children:l.jsx(Vl,{value:x.enabled,on:"Enabled",off:"Disabled",onChange:P=>b({...x,enabled:P})})})]}),l.jsxs(tf,{children:[l.jsx(ge,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),l.jsx(ge,{onClick:S,children:"Add rule"})]})]})})]})}const ag=["queued","ignored","duplicate","rejected","error"],I2=n=>({queued:"on",rejected:"off",error:"off"})[n]||"idle";function L2(){const n=St(),[r,i]=m.useState(null),[s,c]=m.useState({}),[u,f]=m.useState(!1),[h,v]=m.useState(""),[g,y]=m.useState(""),[x,b]=m.useState({});m.useEffect(()=>{jt("/admin/api/hosts").then(k=>b(Object.fromEntries(k.hosts.flatMap(S=>(S.webhooks||[]).map(j=>[j.id,j.name]))))).catch(()=>{})},[]);const C=k=>{const S=k&&(r!=null&&r.length)?r[r.length-1].id:void 0;jt("/admin/api/webhooks"+Pu({limit:100,project:h.trim(),outcome:g,before:S})).then(j=>{i(E=>k?(E||[]).concat(j.events):j.events),c(j.counts_24h||{}),f(j.events.length>=100)}).catch(j=>n(De(j),!0))};return m.useEffect(()=>{const k=window.setTimeout(()=>C(),h?250:0);return()=>window.clearTimeout(k)},[h,g]),l.jsxs("section",{className:"grid gap-4",children:[l.jsxs(no,{children:[l.jsxs("div",{className:"relative w-full sm:w-64",children:[l.jsx(Yl,{className:"pointer-events-none absolute top-2.5 left-2.5 size-4 text-muted-foreground"}),l.jsx(Me,{type:"search",className:"pl-8",placeholder:"Filter by project","aria-label":"Filter webhooks by project",value:h,onChange:k=>v(k.target.value)})]}),l.jsxs(He,{className:"w-auto","aria-label":"Outcome",value:g,onChange:k=>y(k.target.value),children:[l.jsx("option",{value:"",children:"All outcomes"}),ag.map(k=>l.jsx("option",{value:k,children:k[0].toUpperCase()+k.slice(1)},k))]}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:["Last 24 h: ",ag.map(k=>(s[k]||0)+" "+k).join(" · ")]}),l.jsx("span",{className:"flex-1"}),l.jsxs(ge,{variant:"outline",onClick:()=>C(),children:[l.jsx(Yg,{})," Refresh"]})]}),l.jsx(ao,{children:r?r.length?l.jsxs(co,{children:[l.jsx(uo,{children:l.jsxs(Mt,{children:[l.jsx(Se,{className:"pl-4",children:"When"}),l.jsx(Se,{children:"Project"}),l.jsx(Se,{children:"Event"}),l.jsx(Se,{children:"Outcome"}),l.jsx(Se,{children:"Reason"}),l.jsx(Se,{className:"pr-4",children:"Via"})]})}),l.jsx(fo,{children:r.map(k=>{const S=[k.kind||k.event,k.action].filter(Boolean).join(" · ")+(k.number?" · !"+k.number:"");return l.jsxs(Mt,{children:[l.jsx(Ee,{className:"pl-4 align-top text-muted-foreground",title:new Date(k.received_at).toLocaleString(),children:ro(k.received_at)}),l.jsxs(Ee,{className:"align-top",children:[l.jsx("div",{className:"font-medium",children:k.project||"—"}),l.jsx(Qe,{children:k.platform+(k.host?" · "+k.host:"")})]}),l.jsxs(Ee,{className:"align-top",children:[l.jsx("div",{children:S||"—"}),l.jsx(Qe,{children:k.event+(k.sender?" · by "+k.sender:"")})]}),l.jsx(Ee,{className:"align-top",children:l.jsx(zn,{kind:I2(k.outcome),children:k.outcome})}),l.jsx(Ee,{className:"reason min-w-64 align-top text-sm whitespace-normal text-muted-foreground",children:k.reason}),l.jsxs(Ee,{className:"pr-4 align-top text-muted-foreground",children:[l.jsx("div",{children:k.endpoint?x[k.endpoint]||"unknown webhook":"shared URL"}),l.jsx(Qe,{children:k.auth})]})]},k.id)})})]}):l.jsx(bt,{children:"No webhook deliveries match."}):l.jsx(bt,{children:"Loading…"})}),u&&l.jsx("div",{children:l.jsx(ge,{variant:"outline",onClick:()=>C(!0),children:"Load older"})}),l.jsxs(Jt,{children:["Every webhook delivery and what the console did with it. ",l.jsx("b",{children:"Ignored"})," is normal for events that should not start a review (approvals, label or reviewer changes, edits without new commits) and for repositories that are not enabled. ",l.jsx("b",{children:"Rejected"})," means the signature or token did not match. History is kept for the days set in Settings (14 by default)."]})]})}function On({label:n,value:r,onChange:i,yes:s,no:c,disabled:u,note:f}){return l.jsx(je,{label:n,hint:f,children:l.jsxs(He,{value:String(r),disabled:u,onChange:h=>i(h.target.value==="true"),children:[l.jsx("option",{value:"true",children:s}),l.jsx("option",{value:"false",children:c})]})})}function Sl({label:n,value:r,onChange:i,note:s,...c}){return l.jsx(je,{label:n,hint:s,children:l.jsx(Me,{type:"number",value:r||"",...c,onChange:u=>i(parseInt(u.target.value||"0",10))})})}function $o({title:n,description:r,children:i}){return l.jsxs(Vn,{children:[l.jsxs(Bl,{children:[l.jsx(Qd,{className:"h2",children:n}),r&&l.jsx(Yd,{children:r})]}),l.jsx(to,{children:i})]})}function z2(){const n=St(),r=qd(),i=ei(),s={learnings:ln("learnings"),budgets:ln("budgets"),sync:ln("branch_sync"),metrics:ln("metrics")},[c,u]=m.useState(null),[f,h]=m.useState(null),[v,g]=m.useState(""),[y,x]=m.useState(0),b=j=>{u(j),h(j),g((j.sync_source_branches||[]).join(", "))};if(m.useEffect(()=>{jt("/admin/api/settings").then(b).catch(j=>n(De(j),!0))},[]),!c||!f)return l.jsx(bt,{children:"Loading…"});const C=j=>E=>h({...f,[j]:E}),k=j=>{const{source:E,...D}={...f,review_defaults:j,dashboard_title:f.dashboard_title.trim(),sync_source_branches:v.split(",").map(T=>T.trim()).filter(Boolean)};oo("/admin/api/settings",D).then(T=>{b(T),x(P=>P+1),r(),n("Settings saved")}).catch(T=>n(De(T),!0))},S=Object.keys(c.source||{}).filter(j=>c.source[j]==="config");return l.jsxs("section",{className:"grid gap-4",children:[l.jsx($o,{title:"Repository access",description:"Which repositories are reviewed, and when.",children:l.jsxs(Xt,{children:[l.jsx(On,{label:"Repositories no rule matches",value:f.allowlist,onChange:C("allowlist"),yes:"Not reviewed (allowlist on)",no:"Reviewed (allowlist off)"}),l.jsx(On,{label:"Who asks for a review",value:f.require_reviewer,onChange:C("require_reviewer"),yes:"Only when the bot is a reviewer",no:"Any opened MR or push"}),l.jsx(On,{label:"Branch syncs (source is the default branch)",value:f.skip_branch_sync,onChange:C("skip_branch_sync"),yes:"Skip",no:"Review",disabled:!s.sync,note:l.jsx(Tl,{feature:"branch_sync"})}),l.jsx(je,{label:"Also treat these source branches as syncs",children:l.jsx(Me,{placeholder:"develop, release/*",value:v,disabled:!s.sync,onChange:j=>g(j.target.value)})}),l.jsx(On,{label:"Score labels on MRs/PRs",value:f.score_labels,onChange:C("score_labels"),yes:"On",no:"Off"}),l.jsx(On,{label:"Commit status on the reviewed commit",value:f.commit_status,onChange:C("commit_status"),yes:"On",no:"Off"})]})}),l.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[l.jsx($o,{title:"Learnings",children:l.jsxs(Xt,{className:"lg:grid-cols-2",children:[l.jsx(On,{label:"Learn from replies to the bot",value:f.learnings_enabled,onChange:C("learnings_enabled"),yes:"On",no:"Off",disabled:!s.learnings,note:l.jsx(Tl,{feature:"learnings"})}),l.jsx(On,{label:"New learnings",value:f.learnings_auto_activate,onChange:C("learnings_auto_activate"),yes:"Apply at once",no:"Wait for an admin's approval",disabled:!s.learnings})]})}),l.jsx($o,{title:"Budgets",description:'Input plus output tokens of finished jobs in the current UTC day. When a budget is used up, automatic reviews and chat commands wait until the next day; "Review now" and re-runs from this panel still run.',children:l.jsxs(Xt,{className:"lg:grid-cols-2",children:[l.jsx(Sl,{label:"Daily tokens, all repositories",min:0,step:1e4,placeholder:"0 = no limit",value:f.daily_token_budget,onChange:C("daily_token_budget"),disabled:!s.budgets,note:l.jsx(Tl,{feature:"budgets"})}),l.jsx(Sl,{label:"Daily tokens per repository",min:0,step:1e4,placeholder:"0 = no limit",value:f.repo_daily_token_budget,onChange:C("repo_daily_token_budget"),disabled:!s.budgets})]})}),l.jsx($o,{title:"History",children:l.jsxs(Xt,{className:"lg:grid-cols-2",children:[l.jsx(Sl,{label:"Keep reviews (days)",min:1,max:3650,value:f.review_retention_days,onChange:C("review_retention_days"),note:!s.metrics&&f.review_retention_days>i.free_retention_days?l.jsxs("span",{className:"locknote text-xs text-warning",children:["Without a license with metrics and long history, reviews are kept ",i.free_retention_days," days."]}):null}),l.jsx(Sl,{label:"Keep webhook deliveries (days)",min:1,max:3650,value:f.webhook_retention_days,onChange:C("webhook_retention_days")})]})}),l.jsx($o,{title:"Status dashboard",children:l.jsxs(Xt,{className:"lg:grid-cols-2",children:[l.jsx(On,{label:"Dashboard",value:f.dashboard_enabled,onChange:C("dashboard_enabled"),yes:"On",no:"Off"}),l.jsx(On,{label:"Repository names",value:!f.hide_repos,onChange:j=>C("hide_repos")(!j),yes:"Shown",no:"Hidden"}),l.jsx(je,{label:"Title",className:"sm:col-span-2",children:l.jsx(Me,{maxLength:120,value:f.dashboard_title,onChange:j=>C("dashboard_title")(j.target.value)})})]})})]}),l.jsx(Vn,{className:"py-4",children:l.jsxs(L_,{className:"flex flex-wrap items-center gap-3",children:[l.jsx(ge,{onClick:()=>k(c.review_defaults),children:"Save settings"}),l.jsx("span",{className:"text-sm text-muted-foreground",children:S.length?"Not saved yet (from the config file): "+S.join(", "):""})]})}),l.jsx($o,{title:"Default review settings",description:"Apply to every repository. Group and pattern rules, then repository settings, override them.",children:l.jsx(Xd,{value:c.review_defaults,onSave:k,saveLabel:"Save default review settings"},y)}),l.jsx(Jt,{children:"The config file is the initial configuration: on first start its values are copied here, and from then on these settings are kept in the database. Editing the config file later does not change them; the server log notes any difference. Every change is in the audit log."})]})}function F2(){const n=St(),[r,i]=m.useState(null),s=ln("audit");return m.useEffect(()=>{s&&jt("/admin/api/audit").then(c=>i(c||[])).catch(c=>n(De(c),!0))},[s]),s?l.jsx("section",{className:"grid gap-4",children:l.jsx(ao,{children:r?r.length?l.jsxs(co,{children:[l.jsx(uo,{children:l.jsxs(Mt,{children:[l.jsx(Se,{className:"pl-4",children:"When"}),l.jsx(Se,{children:"Who"}),l.jsx(Se,{children:"Action"}),l.jsx(Se,{children:"Target"}),l.jsx(Se,{className:"pr-4",children:"Details"})]})}),l.jsx(fo,{children:r.map((c,u)=>l.jsxs(Mt,{children:[l.jsx(Ee,{className:"pl-4 align-top text-muted-foreground",children:new Date(c.at).toLocaleString()}),l.jsx(Ee,{className:"align-top",children:c.actor}),l.jsx(Ee,{className:"align-top",children:l.jsx("code",{children:c.action})}),l.jsx(Ee,{className:"align-top",children:c.target}),l.jsx(Ee,{className:"max-w-xl pr-4 align-top whitespace-normal",children:l.jsx("pre",{className:"detail max-h-40 overflow-auto rounded-md bg-muted p-2 font-mono text-xs whitespace-pre-wrap break-all",children:JSON.stringify(c.detail)})})]},c.id??u))})]}):l.jsx(bt,{children:"No admin activity yet."}):l.jsx(bt,{children:"Loading…"})})}):l.jsx("section",{children:l.jsx(da,{feature:"audit",children:"Every admin change is still recorded; viewing the audit log is part of the licensed console."})})}const $2={none:["Free core","idle"],active:["Active","on"],grace:["Expired — grace period","warn"],expired:["Expired","off"],invalid:["Not valid","off"]};function U2(){const n=ei(),r=qd(),i=St(),s=Zo(),c=n.license,[u,f]=m.useState(""),[h,v]=$2[c.state],g=x=>oo("/admin/api/license",{key:x}).then(()=>{f(""),r(),i(x?"License installed":"License removed")}).catch(b=>i(De(b),!0)),y=async()=>{await s({title:"Remove the license?",description:"Paid features turn off at once.",action:"Remove license",danger:!0})&&g("")};return l.jsxs("section",{className:"grid gap-4",children:[l.jsxs(Vn,{children:[l.jsx(Bl,{children:l.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[l.jsx(zn,{kind:v,children:h}),c.customer&&l.jsxs("span",{className:"text-sm",children:[l.jsx("b",{children:c.customer})," · ",c.plan]}),l.jsx("span",{className:"flex-1"}),c.expires_at&&l.jsxs("span",{className:"text-sm text-muted-foreground",children:["expires ",sg(c.expires_at)]})]})}),l.jsxs(to,{className:"grid gap-4",children:[c.error&&l.jsx(Hi,{variant:"destructive",className:"banner bad",children:l.jsx(Gi,{children:c.error})}),c.state==="grace"&&l.jsx(Hi,{className:"banner border-warning/40 bg-warning-soft",children:l.jsxs(Gi,{className:"text-warning",children:["The license has expired. Paid features keep working until ",sg(c.grace_until),"; renew it to keep them."]})}),l.jsxs("div",{children:[l.jsx("h2",{className:"h2 mb-3 text-sm font-semibold",children:"Features"}),l.jsx("ul",{className:"feats grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:Object.keys(Wl).map(x=>{const b=c.features.includes(x);return l.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[l.jsx("span",{className:"flex size-5 items-center justify-center rounded-full "+(b?"bg-success-soft text-success":"bg-muted text-muted-foreground"),children:b?l.jsx(Ql,{className:"size-3"}):l.jsx(g1,{className:"size-3"})}),l.jsx("span",{className:b?"":"text-muted-foreground",children:Wl[x]}),l.jsx("span",{className:"sr-only",children:b?"on":"off"})]},x)})})]}),l.jsxs(Jt,{children:["Free without a license: reviews for one GitHub, GitLab and Bitbucket host each, the local executor, repository on/off, ",l.jsx("code",{children:"@bot"})," commands, review history for ",n.free_retention_days," days, the status dashboard and admin sign-in by email."]})]})]}),l.jsxs(Vn,{children:[l.jsxs(Bl,{children:[l.jsxs(Qd,{className:"flex items-center gap-2",children:[l.jsx(Ig,{className:"size-4"}),c.state==="none"?"Install a license":"Replace the license"]}),l.jsx(Yd,{children:"Keys are verified offline; the console never calls home."})]}),l.jsx(to,{className:"grid gap-4",children:c.managed?l.jsxs("p",{className:"text-sm text-muted-foreground",children:["This license comes from ",c.source==="env"?l.jsx("code",{children:"CODEREVIEW_CONSOLE_LICENSE"}):l.jsx("code",{children:"license.file"}),"; change it there and restart the console."]}):l.jsxs(l.Fragment,{children:[l.jsx(je,{label:"License key",children:l.jsx(rs,{className:"key min-h-28 font-mono text-xs",placeholder:"DIV1.… or the -----BEGIN DIVMORA LICENSE KEY----- block",autoComplete:"off",spellCheck:!1,value:u,onChange:x=>f(x.target.value)})}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[l.jsx(ge,{disabled:!u.trim(),onClick:()=>g(u.trim()),children:"Install"}),c.source==="database"&&l.jsx(ge,{variant:"ghost",className:"text-destructive hover:text-destructive",onClick:y,children:"Remove license"})]}),l.jsx(Jt,{children:"A pasted key is stored in the database and applies at once, except the executor, which is chosen when the console starts."})]})})]}),l.jsxs(Jt,{children:["Every use of a paid feature needs a license from Divmora, in development, CI and production alike. For a license or a trial, contact"," ",l.jsx("a",{className:"text-primary underline-offset-4 hover:underline",href:"mailto:licensing@divmora.com",children:"licensing@divmora.com"}),"."]})]})}const B2={"/license":"Open License","/hosts":"Open Code hosts","/webhooks":"Open Webhooks","/settings":"Open Settings","/repositories":"Open Repositories","/reviews":"Open Reviews"};function W2(){const n=St(),r=qd(),[i,s]=m.useState(null),c=m.useRef(""),u=()=>jt("/admin/api/setup").then(v=>{s(v);const g=v.done+"/"+v.complete;c.current!==g&&(c.current!==""&&r(),c.current=g)}).catch(v=>n(De(v),!0));if(m.useEffect(()=>{u();const v=window.setInterval(u,15e3);return()=>window.clearInterval(v)},[]),!i)return l.jsx(bt,{children:"Loading…"});const f=i.steps.find(v=>!v.done&&!v.optional),h=i.total?Math.round(i.done/i.total*100):100;return l.jsxs("section",{className:"grid max-w-3xl gap-4",children:[l.jsxs(Vn,{children:[l.jsxs(Bl,{children:[l.jsx(Qd,{className:"h2",children:i.complete?"All set":"Get your first review"}),l.jsx(Yd,{children:i.complete?"Everything needed for reviews is in place. This page stays here for when you add more.":`${i.done} of ${i.total} steps done. Each step is checked against what is configured right now.`})]}),l.jsxs(to,{className:"grid gap-3",children:[l.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-muted",role:"progressbar","aria-valuenow":h,"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Setup progress",children:l.jsx("div",{className:"h-full rounded-full bg-primary transition-all",style:{width:h+"%"}})}),l.jsx("div",{children:l.jsxs(ge,{variant:"outline",size:"sm",onClick:u,children:[l.jsx(Yg,{})," Check again"]})})]})]}),l.jsx("ol",{className:"grid gap-3",children:i.steps.map((v,g)=>{const y=(f==null?void 0:f.id)===v.id;return l.jsx("li",{children:l.jsx(Vn,{className:te("gap-3 py-4",y&&"border-primary ring-1 ring-primary/40"),children:l.jsxs(to,{className:"flex gap-3 px-4",children:[l.jsx("div",{className:te("mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full border text-xs font-semibold",v.done?"border-success bg-success-soft text-success":y?"border-primary text-primary":"text-muted-foreground"),"aria-hidden":!0,children:v.done?l.jsx(Ql,{className:"size-4"}):y?g+1:l.jsx(Pg,{className:"size-3"})}),l.jsxs("div",{className:"grid min-w-0 flex-1 gap-1.5",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("span",{className:"font-medium",children:v.title}),v.optional&&l.jsx(kn,{variant:"outline",className:"font-normal text-muted-foreground",children:"optional"}),y&&l.jsx(kn,{children:"next"}),l.jsx("span",{className:"sr-only",children:v.done?"done":"not done"})]}),v.detail&&l.jsx("div",{className:te("text-sm",v.done?"text-success":/rejected|failed|expired|not valid/.test(v.detail)?"text-destructive":"text-muted-foreground"),children:v.detail}),(!v.done||y)&&l.jsx("p",{className:"text-sm leading-relaxed text-muted-foreground",children:v.help}),v.link&&!v.done&&l.jsx("div",{children:l.jsx(ge,{asChild:!0,size:"sm",variant:y?"default":"outline",children:l.jsxs(Ho,{to:v.link,children:[B2[v.link]||"Open"," ",l.jsx(l1,{})]})})})]})]})})},v.id)})}),l.jsx(Jt,{children:"Steps update on their own every 15 seconds while this page is open, so you can set up the webhook on the code host and watch it turn green."})]})}const sf=[{path:"setup",title:"Setup",icon:k1,el:l.jsx(W2,{})},{path:"repositories",title:"Repositories",icon:p1,el:l.jsx(y2,{})},{path:"reviews",title:"Reviews",icon:c1,el:l.jsx(S2,{})},{path:"learnings",title:"Learnings",icon:a1,el:l.jsx(N2,{}),paid:"learnings"},{path:"hosts",title:"Code hosts",icon:j1,el:l.jsx(O2,{})},{path:"rules",title:"Rules",icon:h1,el:l.jsx(A2,{}),paid:"rules"},{path:"webhooks",title:"Webhooks",icon:iv,el:l.jsx(L2,{})},{path:"settings",title:"Settings",icon:_1,el:l.jsx(z2,{})},{path:"audit",title:"Audit log",icon:C1,el:l.jsx(F2,{}),paid:"audit"},{path:"license",title:"License",icon:Ig,el:l.jsx(U2,{})}];function V2({me:n}){const r=n.license;return r.state==="grace"?l.jsx(Hi,{role:"status",className:"banner border-warning/40 bg-warning-soft text-warning",children:l.jsx(Gi,{className:"text-warning",children:l.jsxs("p",{children:["The Divmora license expired on ",new Date(r.expires_at).toLocaleDateString(),". Paid features stop on ",new Date(r.grace_until).toLocaleDateString(),"."," ",l.jsx(Ho,{className:"font-semibold underline underline-offset-2",to:"/license",children:"Renew"})]})})}):r.state==="expired"||r.state==="invalid"?l.jsx(Hi,{role:"status",variant:"destructive",className:"banner bad",children:l.jsx(Gi,{children:l.jsxs("p",{children:[r.state==="expired"?"The Divmora license has expired":"The Divmora license is not valid",": paid features are off."," ",l.jsx(Ho,{className:"font-semibold underline underline-offset-2",to:"/license",children:"License"})]})})}):null}function H2(){const[n,r]=m.useState(()=>{try{return localStorage.getItem("crc-theme")||"system"}catch{return"system"}}),i=c=>{r(c);try{localStorage.setItem("crc-theme",c)}catch{}const u=window.__crcApplyTheme;u?u():document.documentElement.classList.toggle("dark",c==="dark")},s=n==="light"?N1:n==="dark"?x1:v1;return l.jsxs(W_,{children:[l.jsx(V_,{asChild:!0,children:l.jsx(ge,{variant:"ghost",size:"icon",id:"theme","aria-label":"Theme",children:l.jsx(s,{})})}),l.jsxs(H_,{align:"end",children:[l.jsx(K_,{children:"Theme"}),l.jsx(Q_,{}),l.jsxs(G_,{value:n,onValueChange:i,children:[l.jsx(bu,{value:"system",children:"System"}),l.jsx(bu,{value:"light",children:"Light"}),l.jsx(bu,{value:"dark",children:"Dark"})]})]})]})}function zy(n){return sf.find(r=>n.startsWith("/"+r.path))}function G2({me:n}){const r=Dr(),{setOpenMobile:i}=os(),s=()=>Fn("/admin/logout").finally(()=>location.href="/admin/login");return l.jsxs(s2,{collapsible:"icon",children:[l.jsx(u2,{children:l.jsxs("div",{className:"flex items-center gap-2 px-1 py-1.5",children:[l.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-primary text-primary-foreground",children:l.jsx(E1,{className:"size-4"})}),l.jsxs("div",{className:"grid leading-tight group-data-[collapsible=icon]:hidden",children:[l.jsx("span",{className:"truncate text-sm font-semibold",children:"Code review"}),l.jsx("span",{className:"truncate text-xs text-muted-foreground",children:"Divmora console"})]})]})}),l.jsx(f2,{children:l.jsx(p2,{children:l.jsx(h2,{children:l.jsx(tg,{className:"side","aria-label":"Sections",children:sf.map(c=>{var h;const u=c.paid&&!n.license.features.includes(c.paid),f=((h=zy(r.pathname))==null?void 0:h.path)===c.path;return l.jsxs(ng,{children:[l.jsx(rg,{asChild:!0,isActive:f,tooltip:c.title,children:l.jsxs(Hb,{to:"/"+c.path,className:f?"on":"",onClick:()=>i(!1),children:[l.jsx(c.icon,{}),l.jsx("span",{children:c.title})]})}),c.path==="setup"&&n.setup&&!n.setup.complete&&l.jsxs(og,{className:"text-[10px] font-normal text-muted-foreground",title:"Setup steps done",children:[n.setup.done,"/",n.setup.total]}),u&&l.jsx(og,{className:"paid text-[10px] font-normal text-muted-foreground",title:"Needs a license",children:"licensed"})]},c.path)})})})})}),l.jsxs(d2,{children:[l.jsxs("div",{className:"grid gap-1 px-2 pb-1 text-xs text-muted-foreground group-data-[collapsible=icon]:hidden",children:[l.jsxs("span",{className:"truncate",children:["Signed in as ",n.name||n.email]}),l.jsx("a",{className:"underline-offset-2 hover:text-foreground hover:underline",href:"/dashboard",children:"Status dashboard"}),n.version&&l.jsxs("span",{children:["Version ",n.version]})]}),l.jsx(tg,{children:l.jsx(ng,{children:l.jsxs(rg,{id:"logout",onClick:s,tooltip:"Sign out",children:[l.jsx(m1,{}),l.jsx("span",{children:"Sign out"})]})})})]}),l.jsx(a2,{})]})}function K2({me:n}){const r=Dr(),i=zy(r.pathname),s=(i==null?void 0:i.title)??"Repositories";return m.useEffect(()=>{document.title=s+" · Code review admin"},[s]),l.jsxs("header",{className:"sticky top-0 z-10 flex h-14 shrink-0 items-center gap-2 border-b bg-background/80 px-4 backdrop-blur",children:[l.jsx(l2,{className:"-ml-1"}),l.jsx(Jr,{orientation:"vertical",className:"mr-1 data-[orientation=vertical]:h-4"}),l.jsx("h1",{id:"pageTitle",className:"text-base font-semibold",children:s}),(i==null?void 0:i.paid)&&!n.license.features.includes(i.paid)&&l.jsx(kn,{variant:"secondary",children:"licensed"}),l.jsx("span",{className:"flex-1"}),l.jsx(H2,{})]})}function Q2(){const[n,r]=m.useState(null),[i,s]=m.useState(""),c=()=>jt("/admin/api/me").then(u=>{R1(u.csrf),r(u)}).catch(u=>s(String(u.message||u)));return m.useEffect(()=>{c()},[]),n?l.jsx(Ty.Provider,{value:n,children:l.jsx(Oy.Provider,{value:c,children:l.jsx(Ay,{delayDuration:300,children:l.jsx($_,{children:l.jsx(U_,{children:l.jsxs(i2,{children:[l.jsx(G2,{me:n}),l.jsxs(c2,{className:"min-w-0",children:[l.jsx(K2,{me:n}),l.jsxs("div",{className:"mx-auto grid w-full max-w-7xl gap-4 p-4 md:p-6",children:[l.jsx(V2,{me:n}),l.jsxs(Mb,{children:[l.jsx(El,{path:"/",element:l.jsx(hm,{to:n.setup&&!n.setup.complete?"/setup":"/repositories",replace:!0})}),sf.map(u=>l.jsx(El,{path:"/"+u.path,element:u.el},u.path)),l.jsx(El,{path:"*",element:l.jsx(hm,{to:"/repositories",replace:!0})})]})]})]})]})})})})})}):l.jsx("div",{className:"grid min-h-svh place-items-center text-sm text-muted-foreground",children:i||"Loading…"})}var cg;const Cu=(cg=document.querySelector('meta[name="csp-nonce"]'))==null?void 0:cg.content;Cu&&!Cu.startsWith("__")&&Yb(Cu);H0.createRoot(document.getElementById("root")).render(l.jsx(m.StrictMode,{children:l.jsx(Bb,{basename:"/admin",children:l.jsx(Q2,{})})})); +`)},Vj=0,zo=[];function Hj(n){var r=m.useRef([]),i=m.useRef([0,0]),l=m.useRef(),c=m.useState(Vj++)[0],u=m.useState(dx)[0],f=m.useRef(n);m.useEffect(function(){f.current=n},[n]),m.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(c));var S=pj([n.lockRef.current],(n.shards||[]).map(zm),!0).filter(Boolean);return S.forEach(function(C){return C.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),S.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(c))})}}},[n.inert,n.lockRef.current,n.shards]);var h=m.useCallback(function(S,C){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!f.current.allowPinchZoom;var E=wl(S),D=i.current,T="deltaX"in S?S.deltaX:D[0]-E[0],P="deltaY"in S?S.deltaY:D[1]-E[1],R,N=S.target,I=Math.abs(T)>Math.abs(P)?"h":"v";if("touches"in S&&I==="h"&&N.type==="range")return!1;var L=window.getSelection(),Q=L&&L.anchorNode,ee=Q?Q===N||Q.contains(N):!1;if(ee)return!1;var J=Im(I,N);if(!J)return!0;if(J?R=I:(R=I==="v"?"h":"v",J=Im(I,N)),!J)return!1;if(!l.current&&"changedTouches"in S&&(T||P)&&(l.current=R),!R)return!0;var ne=l.current||R;return Uj(ne,C,S,ne==="h"?T:P)},[]),v=m.useCallback(function(S){var C=S;if(!(!zo.length||zo[zo.length-1]!==u)){var E="deltaY"in C?Lm(C):wl(C),D=r.current.filter(function(R){return R.name===C.type&&(R.target===C.target||C.target===R.shadowParent)&&Bj(R.delta,E)})[0];if(D&&D.should){C.cancelable&&C.preventDefault();return}if(!D){var T=(f.current.shards||[]).map(zm).filter(Boolean).filter(function(R){return R.contains(C.target)}),P=T.length>0?h(C,T[0]):!f.current.noIsolation;P&&C.cancelable&&C.preventDefault()}}},[]),g=m.useCallback(function(S,C,E,D){var T={name:S,delta:C,target:E,should:D,shadowParent:Gj(E)};r.current.push(T),setTimeout(function(){r.current=r.current.filter(function(P){return P!==T})},1)},[]),y=m.useCallback(function(S){i.current=wl(S),l.current=void 0},[]),x=m.useCallback(function(S){g(S.type,Lm(S),S.target,h(S,n.lockRef.current))},[]),b=m.useCallback(function(S){g(S.type,wl(S),S.target,h(S,n.lockRef.current))},[]);m.useEffect(function(){return zo.push(u),n.setCallbacks({onScrollCapture:x,onWheelCapture:x,onTouchMoveCapture:b}),document.addEventListener("wheel",v,Lo),document.addEventListener("touchmove",v,Lo),document.addEventListener("touchstart",y,Lo),function(){zo=zo.filter(function(S){return S!==u}),document.removeEventListener("wheel",v,Lo),document.removeEventListener("touchmove",v,Lo),document.removeEventListener("touchstart",y,Lo)}},[]);var j=n.removeScrollBar,k=n.inert;return m.createElement(m.Fragment,null,k?m.createElement(u,{styles:Wj(c)}):null,j?m.createElement(Mj,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function Gj(n){for(var r=null;n!==null;)n instanceof ShadowRoot&&(r=n.host,n=n.host),n=n.parentNode;return r}const Kj=kj(ux,Hj);var wd=m.forwardRef(function(n,r){return m.createElement(Zl,vn({},n,{ref:r,sideCar:Kj}))});wd.classNames=Zl.classNames;var Qj=function(n){if(typeof document>"u")return null;var r=Array.isArray(n)?n[0]:n;return r.ownerDocument.body},Fo=new WeakMap,bl=new WeakMap,kl={},mu=0,mx=function(n){return n&&(n.host||mx(n.parentNode))},Yj=function(n,r){return r.map(function(i){if(n.contains(i))return i;var l=mx(i);return l&&n.contains(l)?l:(console.error("aria-hidden",i,"in not contained inside",n,". Doing nothing"),null)}).filter(function(i){return!!i})},qj=function(n,r,i,l){var c=Yj(r,Array.isArray(n)?n:[n]);kl[i]||(kl[i]=new WeakMap);var u=kl[i],f=[],h=new Set,v=new Set(c),g=function(x){!x||h.has(x)||(h.add(x),g(x.parentNode))};c.forEach(g);var y=function(x){!x||v.has(x)||Array.prototype.forEach.call(x.children,function(b){if(h.has(b))y(b);else try{var j=b.getAttribute(l),k=j!==null&&j!=="false",S=(Fo.get(b)||0)+1,C=(u.get(b)||0)+1;Fo.set(b,S),u.set(b,C),f.push(b),S===1&&k&&bl.set(b,!0),C===1&&b.setAttribute(i,"true"),k||b.setAttribute(l,"true")}catch(E){console.error("aria-hidden: cannot operate on ",b,E)}})};return y(r),h.clear(),mu++,function(){f.forEach(function(x){var b=Fo.get(x)-1,j=u.get(x)-1;Fo.set(x,b),u.set(x,j),b||(bl.has(x)||x.removeAttribute(l),bl.delete(x)),j||x.removeAttribute(i)}),mu--,mu||(Fo=new WeakMap,Fo=new WeakMap,bl=new WeakMap,kl={})}},gx=function(n,r,i){i===void 0&&(i="data-aria-hidden");var l=Array.from(Array.isArray(n)?n:[n]),c=Qj(n);return c?(l.push.apply(l,Array.from(c.querySelectorAll("[aria-live], script"))),qj(l,c,i,"aria-hidden")):function(){return null}},Xj=Object.defineProperty,At=(n,r)=>Xj(n,"name",{value:r,configurable:!0}),bd="Dialog",[vx,xx]=an(bd),[Jj,cn]=vx(bd),kd=At(n=>{const{__scopeDialog:r,children:i,open:l,defaultOpen:c,onOpenChange:u,modal:f=!0}=n,h=m.useRef(null),v=m.useRef(null),{nodes:g,registry:y}=md(),[x,b]=qo({prop:l,defaultProp:c??!1,onChange:u,caller:bd}),[j,k]=m.useState(0),[S,C]=m.useState(0);return s.jsx(Jj,{scope:r,triggerRef:h,contentRef:v,contentId:Sr(),titleId:Sr(),descriptionId:Sr(),titlePresent:j>0,descriptionPresent:S>0,setTitleCount:k,setDescriptionCount:C,open:x,onOpenChange:b,onOpenToggle:m.useCallback(()=>b(E=>!E),[b]),modal:f,branchNodes:g,branchRegistry:y,children:i})},"Dialog"),Zj="DialogTrigger",eC=m.forwardRef(At(function(r,i){const{__scopeDialog:l,...c}=r,u=cn(Zj,l),f=Ie(i,u.triggerRef);return s.jsx(ze.button,{type:"button","aria-haspopup":"dialog","aria-expanded":u.open,"aria-controls":u.open?u.contentId:void 0,"data-state":ea(u.open),...c,ref:f,onClick:je(r.onClick,u.onOpenToggle)})},"DialogTrigger")),yx="DialogPortal",[tC,wx]=vx(yx,{forceMount:void 0}),jd=At(n=>{const{__scopeDialog:r,forceMount:i,children:l,container:c}=n,u=cn(yx,r);return s.jsx(tC,{scope:r,forceMount:i,children:m.Children.map(l,f=>s.jsx(Gn,{present:i||u.open,children:s.jsx(xd,{asChild:!0,container:c,children:f})}))})},"DialogPortal"),Uu="DialogOverlay",Cd=m.forwardRef(At(function(r,i){const l=wx(Uu,r.__scopeDialog),{forceMount:c=l.forceMount,...u}=r,f=cn(Uu,r.__scopeDialog);return f.modal?s.jsx(Gn,{present:c||f.open,children:s.jsx(rC,{...u,ref:i})}):null},"DialogOverlay")),nC=$n("DialogOverlay.RemoveScroll"),rC=m.forwardRef(At(function(r,i){const{__scopeDialog:l,...c}=r,u=cn(Uu,l),f=Xv(),h=Ie(i,f);return s.jsx(wd,{as:nC,allowPinchZoom:!0,shards:m.useMemo(()=>[u.contentRef,...u.branchNodes.map(v=>({current:v}))],[u.contentRef,u.branchNodes]),children:s.jsx(ze.div,{"data-state":ea(u.open),...c,ref:h,style:{pointerEvents:"auto",...c.style}})})},"DialogOverlayImpl")),Ki="DialogContent",Sd=m.forwardRef(At(function(r,i){const l=wx(Ki,r.__scopeDialog),{forceMount:c=l.forceMount,...u}=r,f=cn(Ki,r.__scopeDialog);return s.jsx(Gn,{present:c||f.open,children:f.modal?s.jsx(oC,{...u,ref:i}):s.jsx(iC,{...u,ref:i})})},"DialogContent")),oC=m.forwardRef(At(function(r,i){const l=cn(Ki,r.__scopeDialog),c=m.useRef(null),u=Ie(i,l.contentRef,c);return m.useEffect(()=>{const f=c.current;if(f)return gx(f)},[]),s.jsx(bx,{...r,ref:u,trapFocus:l.open,disableOutsidePointerEvents:l.open,onCloseAutoFocus:je(r.onCloseAutoFocus,f=>{var h;f.preventDefault(),(h=l.triggerRef.current)==null||h.focus()}),onPointerDownOutside:je(r.onPointerDownOutside,f=>{const h=f.detail.originalEvent,v=h.button===0&&h.ctrlKey===!0;(h.button===2||v)&&f.preventDefault()}),onFocusOutside:je(r.onFocusOutside,f=>f.preventDefault())})},"DialogContentModal")),iC=m.forwardRef(At(function(r,i){const l=cn(Ki,r.__scopeDialog),c=m.useRef(!1),u=m.useRef(!1);return s.jsx(bx,{...r,ref:i,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:f=>{var h,v;(h=r.onCloseAutoFocus)==null||h.call(r,f),f.defaultPrevented||(c.current||(v=l.triggerRef.current)==null||v.focus(),f.preventDefault()),c.current=!1,u.current=!1},onInteractOutside:f=>{var g,y;(g=r.onInteractOutside)==null||g.call(r,f),f.defaultPrevented||(c.current=!0,f.detail.originalEvent.type==="pointerdown"&&(u.current=!0));const h=f.target;((y=l.triggerRef.current)==null?void 0:y.contains(h))&&f.preventDefault(),f.detail.originalEvent.type==="focusin"&&u.current&&f.preventDefault()}})},"DialogContentNonModal")),bx=m.forwardRef(At(function(r,i){const{__scopeDialog:l,trapFocus:c,onOpenAutoFocus:u,onCloseAutoFocus:f,"aria-describedby":h,children:v,...g}=r,y=cn(Ki,l);return Jl(),s.jsx(hd,{registry:y.branchRegistry,children:s.jsx(ex,{asChild:!0,loop:!0,trapped:c,branches:y.branchNodes,onMountAutoFocus:u,onUnmountAutoFocus:f,children:s.jsx(fd,{role:"dialog",id:y.contentId,"aria-labelledby":y.titlePresent?y.titleId:void 0,"aria-describedby":y.descriptionPresent?kx(h,y.descriptionId):h,"data-state":ea(y.open),...g,ref:i,deferPointerDownOutside:!0,onDismiss:()=>y.onOpenChange(!1),children:v})})})},"DialogContentImpl")),Ed=m.forwardRef(At(function(r,i){const{__scopeDialog:l,...c}=r,u=cn("DialogTitle",l),{setTitleCount:f}=u;return wt(()=>(f(h=>h+1),()=>f(h=>h-1)),[f]),s.jsx(ze.h2,{id:u.titleId,...c,ref:i})},"DialogTitle")),_d=m.forwardRef(At(function(r,i){const{__scopeDialog:l,...c}=r,u=cn("DialogDescription",l),{setDescriptionCount:f}=u;return wt(()=>(f(h=>h+1),()=>f(h=>h-1)),[f]),s.jsx(ze.p,{id:u.descriptionId,...c,ref:i})},"DialogDescription")),sC="DialogClose",es=m.forwardRef(At(function(r,i){const{__scopeDialog:l,...c}=r,u=cn(sC,l);return s.jsx(ze.button,{type:"button",...c,ref:i,onClick:je(r.onClick,()=>u.onOpenChange(!1))})},"DialogClose"));function kx(...n){const r=new Set;for(const i of n)if(typeof i=="string")for(const l of String(i).trim().split(/\s+/))l&&r.add(l);return r.size>0?Array.from(r).join(" "):void 0}At(kx,"concatAriaDescribedby");function ea(n){return n?"open":"closed"}At(ea,"getState");var lC=Object.defineProperty,Kn=(n,r)=>lC(n,"name",{value:r,configurable:!0}),aC="AlertDialog",[cC,X2]=an(aC,[xx]),Qn=xx(),uC=Kn(n=>{const{__scopeAlertDialog:r,...i}=n,l=Qn(r);return s.jsx(kd,{...l,...i,modal:!0})},"AlertDialog");m.forwardRef(Kn(function(r,i){const{__scopeAlertDialog:l,...c}=r,u=Qn(l);return s.jsx(eC,{...u,...c,ref:i})},"AlertDialogTrigger"));var dC=Kn(n=>{const{__scopeAlertDialog:r,...i}=n,l=Qn(r);return s.jsx(jd,{...l,...i})},"AlertDialogPortal"),fC=m.forwardRef(Kn(function(r,i){const{__scopeAlertDialog:l,...c}=r,u=Qn(l);return s.jsx(Cd,{...u,...c,ref:i})},"AlertDialogOverlay")),pC="AlertDialogContent",[hC,mC]=cC(pC),gC=m.forwardRef(Kn(function(r,i){const{__scopeAlertDialog:l,children:c,...u}=r,f=Qn(l),h=m.useRef(null),v=Ie(i,h),g=m.useRef(null);return s.jsx(hC,{scope:l,cancelRef:g,children:s.jsx(Sd,{role:"alertdialog",...f,...u,ref:v,onOpenAutoFocus:je(u.onOpenAutoFocus,y=>{var x;y.preventDefault(),(x=g.current)==null||x.focus({preventScroll:!0})}),onPointerDownOutside:y=>y.preventDefault(),onInteractOutside:y=>y.preventDefault(),children:c})})},"AlertDialogContent")),vC=m.forwardRef(Kn(function(r,i){const{__scopeAlertDialog:l,...c}=r,u=Qn(l);return s.jsx(Ed,{...u,...c,ref:i})},"AlertDialogTitle")),xC=m.forwardRef(Kn(function(r,i){const{__scopeAlertDialog:l,...c}=r,u=Qn(l);return s.jsx(_d,{...u,...c,ref:i})},"AlertDialogDescription")),yC=m.forwardRef(Kn(function(r,i){const{__scopeAlertDialog:l,...c}=r,u=Qn(l);return s.jsx(es,{...u,...c,ref:i})},"AlertDialogAction")),wC="AlertDialogCancel",bC=m.forwardRef(Kn(function(r,i){const{__scopeAlertDialog:l,...c}=r,{cancelRef:u}=mC(wC,l),f=Qn(l),h=Ie(i,u);return s.jsx(es,{...f,...c,ref:h})},"AlertDialogCancel")),kC=Object.defineProperty,jC=(n,r)=>kC(n,"name",{value:r,configurable:!0});function Nd(n){const[r,i]=m.useState(void 0);return wt(()=>{if(n){i({width:n.offsetWidth,height:n.offsetHeight});let l=0;const c=new ResizeObserver(u=>{if(!Array.isArray(u)||!u.length)return;const f=u[0];window.cancelAnimationFrame(l),l=window.requestAnimationFrame(()=>{let h,v;if("borderBoxSize"in f){const g=f.borderBoxSize,y=Array.isArray(g)?g[0]:g;h=y.inlineSize,v=y.blockSize}else h=n.offsetWidth,v=n.offsetHeight;i({width:h,height:v})})});return c.observe(n,{box:"border-box"}),()=>{window.cancelAnimationFrame(l),c.unobserve(n)}}else i(void 0)},[n]),r}jC(Nd,"useSize");var CC=Object.defineProperty,Bn=(n,r)=>CC(n,"name",{value:r,configurable:!0}),Rd="Checkbox",[SC,J2]=an(Rd),[EC,Pd]=SC(Rd);function jx(n){const{__scopeCheckbox:r,checked:i,children:l,defaultChecked:c,disabled:u,form:f,name:h,onCheckedChange:v,required:g,value:y="on",internal_do_not_use_render:x}=n,[b,j]=qo({prop:i,defaultProp:c??!1,onChange:v,caller:Rd}),[k,S]=m.useState(null),[C,E]=m.useState(null),[D,T]=m.useState(null),P=k?!!f||!!k.closest("form"):!0,R={checked:b,disabled:u,setChecked:j,control:k,setControl:S,name:h,form:f,value:y,userClick:D,onUserClick:T,required:g,defaultChecked:qt(c)?!1:c,isFormControl:P,bubbleInput:C,setBubbleInput:E};return s.jsx(EC,{scope:r,...R,children:Cx(x)?x(R):l})}Bn(jx,"CheckboxProvider");var _C="CheckboxTrigger",NC=m.forwardRef(Bn(function({__scopeCheckbox:r,onKeyDown:i,onClick:l,...c},u){const{control:f,value:h,disabled:v,checked:g,required:y,setControl:x,setChecked:b,onUserClick:j,isFormControl:k,bubbleInput:S}=Pd(_C,r),C=Ie(u,x),E=m.useRef(g);return m.useEffect(()=>{const D=f==null?void 0:f.form;if(D){const T=Bn(()=>b(E.current),"reset");return D.addEventListener("reset",T),()=>D.removeEventListener("reset",T)}},[f,b]),s.jsx(ze.button,{type:"button",role:"checkbox","aria-checked":qt(g)?"mixed":g,"aria-required":y,"data-state":Dd(g),"data-disabled":v?"":void 0,disabled:v,value:h,...c,ref:C,onKeyDown:je(i,D=>{D.key==="Enter"&&D.preventDefault()}),onClick:je(l,D=>{const T=D.isPropagationStopped();j({requestedChecked:qt(g)?!0:!g,hasConsumerStoppedPropagation:T}),b(P=>qt(P)?!0:!P),S&&k&&(T||D.stopPropagation())})})},"CheckboxTrigger")),RC=m.forwardRef(Bn(function(r,i){const{__scopeCheckbox:l,name:c,checked:u,defaultChecked:f,required:h,disabled:v,value:g,onCheckedChange:y,form:x,...b}=r;return s.jsx(jx,{__scopeCheckbox:l,checked:u,defaultChecked:f,disabled:v,required:h,onCheckedChange:y,name:c,form:x,value:g,internal_do_not_use_render:({isFormControl:j})=>s.jsxs(s.Fragment,{children:[s.jsx(NC,{...b,ref:i,__scopeCheckbox:l}),j&&s.jsx(OC,{__scopeCheckbox:l})]})})},"Checkbox")),PC="CheckboxIndicator",DC=m.forwardRef(Bn(function(r,i){const{__scopeCheckbox:l,forceMount:c,...u}=r,f=Pd(PC,l);return s.jsx(Gn,{present:c||qt(f.checked)||f.checked===!0,children:s.jsx(ze.span,{"data-state":Dd(f.checked),"data-disabled":f.disabled?"":void 0,...u,ref:i,style:{pointerEvents:"none",...r.style}})})},"CheckboxIndicator")),TC="CheckboxBubbleInput",OC=m.forwardRef(Bn(function({__scopeCheckbox:r,onClick:i,...l},c){const{control:u,userClick:f,checked:h,defaultChecked:v,required:g,disabled:y,name:x,value:b,form:j,bubbleInput:k,setBubbleInput:S}=Pd(TC,r),C=Ie(c,S),E=Nd(u),D=m.useRef(!1),T=m.useRef(h),P=m.useRef(f),R=m.useRef(null);m.useEffect(()=>{const I=k;if(!I)return;const L=window.HTMLInputElement.prototype,ee=Object.getOwnPropertyDescriptor(L,"checked").set;if(!ee)return;const J=T.current!==h;T.current=h;const ne=f!==null&&f!==P.current;if(P.current=f,ne)R.current=J?null:f,J&&(I.indeterminate=qt(h),ee.call(I,qt(h)?!1:h)),I.dispatchEvent(new Event("click",{bubbles:!f.hasConsumerStoppedPropagation}));else if(J){const de=R.current;R.current=null;const re=(de==null?void 0:de.requestedChecked)===h;D.current=!0,I.indeterminate=qt(h),ee.call(I,qt(h)?!1:h),I.dispatchEvent(new Event("click",{bubbles:!(re&&de.hasConsumerStoppedPropagation)})),D.current=!1}},[k,h,f]);const N=m.useRef(qt(h)?!1:h);return s.jsx(ze.input,{type:"checkbox","aria-hidden":!0,defaultChecked:v??N.current,required:g,disabled:y,name:x,value:b,form:j,...l,tabIndex:-1,ref:C,onClick:je(i,I=>{D.current&&I.stopPropagation()}),style:{...l.style,...E,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function Cx(n){return typeof n=="function"}Bn(Cx,"isFunction");function qt(n){return n==="indeterminate"}Bn(qt,"isIndeterminate");function Dd(n){return qt(n)?"indeterminate":n?"checked":"unchecked"}Bn(Dd,"getState");const MC=["top","right","bottom","left"],_r=Math.min,In=Math.max,Ll=Math.round,jl=Math.floor,Ln=n=>({x:n,y:n}),AC={left:"right",right:"left",bottom:"top",top:"bottom"};function Sx(n,r,i){return In(n,_r(r,i))}function Wn(n,r){return typeof n=="function"?n(r):n}function Nr(n){return n.split("-")[0]}function Xo(n){return n.split("-")[1]}function Td(n){return n==="x"?"y":"x"}function Od(n){return n==="y"?"height":"width"}function xn(n){const r=n[0];return r==="t"||r==="b"?"y":"x"}function Md(n){return Td(xn(n))}function IC(n,r,i){i===void 0&&(i=!1);const l=Xo(n),c=Md(n),u=Od(c);let f=c==="x"?l===(i?"end":"start")?"right":"left":l==="start"?"bottom":"top";return r.reference[u]>r.floating[u]&&(f=zl(f)),[f,zl(f)]}function LC(n){const r=zl(n);return[Bu(n),r,Bu(r)]}function Bu(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}const Fm=["left","right"],$m=["right","left"],zC=["top","bottom"],FC=["bottom","top"];function $C(n,r,i){switch(n){case"top":case"bottom":return i?r?$m:Fm:r?Fm:$m;case"left":case"right":return r?zC:FC;default:return[]}}function UC(n,r,i,l){const c=Xo(n);let u=$C(Nr(n),i==="start",l);return c&&(u=u.map(f=>f+"-"+c),r&&(u=u.concat(u.map(Bu)))),u}function zl(n){const r=Nr(n);return AC[r]+n.slice(r.length)}function BC(n){var r,i,l,c;return{top:(r=n.top)!=null?r:0,right:(i=n.right)!=null?i:0,bottom:(l=n.bottom)!=null?l:0,left:(c=n.left)!=null?c:0}}function Ex(n){return typeof n!="number"?BC(n):{top:n,right:n,bottom:n,left:n}}function Fl(n){const{x:r,y:i,width:l,height:c}=n;return{width:l,height:c,top:i,left:r,right:r+l,bottom:i+c,x:r,y:i}}function Um(n,r,i){let{reference:l,floating:c}=n;const u=xn(r),f=Md(r),h=Od(f),v=Nr(r),g=u==="y",y=l.x+l.width/2-c.width/2,x=l.y+l.height/2-c.height/2,b=l[h]/2-c[h]/2;let j;switch(v){case"top":j={x:y,y:l.y-c.height};break;case"bottom":j={x:y,y:l.y+l.height};break;case"right":j={x:l.x+l.width,y:x};break;case"left":j={x:l.x-c.width,y:x};break;default:j={x:l.x,y:l.y}}const k=Xo(r);return k&&(j[f]+=b*(k==="end"?1:-1)*(i&&g?-1:1)),j}async function WC(n,r){var i;r===void 0&&(r={});const{x:l,y:c,platform:u,rects:f,elements:h,strategy:v}=n,{boundary:g="clippingAncestors",rootBoundary:y="viewport",elementContext:x="floating",altBoundary:b=!1,padding:j=0}=Wn(r,n),k=Ex(j),C=h[b?x==="floating"?"reference":"floating":x],E=Fl(await u.getClippingRect({element:(i=await(u.isElement==null?void 0:u.isElement(C)))==null||i?C:C.contextElement||await(u.getDocumentElement==null?void 0:u.getDocumentElement(h.floating)),boundary:g,rootBoundary:y,strategy:v})),D=x==="floating"?{x:l,y:c,width:f.floating.width,height:f.floating.height}:f.reference,T=await(u.getOffsetParent==null?void 0:u.getOffsetParent(h.floating)),P=await(u.isElement==null?void 0:u.isElement(T))&&await(u.getScale==null?void 0:u.getScale(T))||{x:1,y:1},R=Fl(u.convertOffsetParentRelativeRectToViewportRelativeRect?await u.convertOffsetParentRelativeRectToViewportRelativeRect({elements:h,rect:D,offsetParent:T,strategy:v}):D);return{top:(E.top-R.top+k.top)/P.y,bottom:(R.bottom-E.bottom+k.bottom)/P.y,left:(E.left-R.left+k.left)/P.x,right:(R.right-E.right+k.right)/P.x}}const VC=50,HC=async(n,r,i)=>{const{placement:l="bottom",strategy:c="absolute",middleware:u=[],platform:f}=i,h=f.detectOverflow?f:{...f,detectOverflow:WC},v=await(f.isRTL==null?void 0:f.isRTL(r));let g=await f.getElementRects({reference:n,floating:r,strategy:c}),{x:y,y:x}=Um(g,l,v),b=l,j=0;const k={};for(let S=0;S({name:"arrow",options:n,async fn(r){const{x:i,y:l,placement:c,rects:u,platform:f,elements:h,middlewareData:v}=r,{element:g,padding:y=0}=Wn(n,r)||{};if(g==null)return{};const x=Ex(y),b={x:i,y:l},j=Md(c),k=Od(j),S=await f.getDimensions(g),C=j==="y",E=C?"top":"left",D=C?"bottom":"right",T=C?"clientHeight":"clientWidth",P=u.reference[k]+u.reference[j]-b[j]-u.floating[k],R=b[j]-u.reference[j],N=await(f.getOffsetParent==null?void 0:f.getOffsetParent(g));let I=N?N[T]:0;(!I||!await(f.isElement==null?void 0:f.isElement(N)))&&(I=h.floating[T]||u.floating[k]);const L=P/2-R/2,Q=I/2-S[k]/2-1,ee=_r(x[E],Q),J=_r(x[D],Q),ne=I-S[k]-J,de=I/2-S[k]/2+L,re=Sx(ee,de,ne),ie=!v.arrow&&Xo(c)!=null&&de!==re&&u.reference[k]/2-(dere<=0)){var J,ne;const re=(((J=u.flip)==null?void 0:J.index)||0)+1,ie=I[re];if(ie&&(!(x==="alignment"?D!==xn(ie):!1)||ee.every(W=>xn(W.placement)===D?W.overflows[0]>0:!0)))return{data:{index:re,overflows:ee},reset:{placement:ie}};let B=(ne=ee.filter(Z=>Z.overflows[0]<=0).sort((Z,W)=>Z.overflows[1]-W.overflows[1])[0])==null?void 0:ne.placement;if(!B)switch(j){case"bestFit":{var de;const Z=(de=ee.filter(W=>{if(N){const q=xn(W.placement);return q===D||q==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(q=>q>0).reduce((q,F)=>q+F,0)]).sort((W,q)=>W[1]-q[1])[0])==null?void 0:de[0];Z&&(B=Z);break}case"initialPlacement":B=h;break}if(c!==B)return{reset:{placement:B}}}return{}}}};function Bm(n,r){return{top:n.top-r.height,right:n.right-r.width,bottom:n.bottom-r.height,left:n.left-r.width}}function Wm(n){return MC.some(r=>n[r]>=0)}const QC=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(r){const{rects:i,platform:l}=r,{strategy:c="referenceHidden",...u}=Wn(n,r);switch(c){case"referenceHidden":{const f=await l.detectOverflow(r,{...u,elementContext:"reference"}),h=Bm(f,i.reference);return{data:{referenceHiddenOffsets:h,referenceHidden:Wm(h)}}}case"escaped":{const f=await l.detectOverflow(r,{...u,altBoundary:!0}),h=Bm(f,i.floating);return{data:{escapedOffsets:h,escaped:Wm(h)}}}default:return{}}}}},_x=new Set(["left","top"]);async function YC(n,r){const{placement:i,platform:l,elements:c}=n,u=await(l.isRTL==null?void 0:l.isRTL(c.floating)),f=Nr(i),h=Xo(i),v=xn(i)==="y",g=_x.has(f)?-1:1,y=u&&v?-1:1,x=Wn(r,n);let{mainAxis:b,crossAxis:j,alignmentAxis:k}=typeof x=="number"?{mainAxis:x,crossAxis:0,alignmentAxis:null}:{mainAxis:x.mainAxis||0,crossAxis:x.crossAxis||0,alignmentAxis:x.alignmentAxis};return h&&typeof k=="number"&&(j=h==="end"?k*-1:k),v?{x:j*y,y:b*g}:{x:b*g,y:j*y}}const qC=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(r){var i,l;const{x:c,y:u,placement:f,middlewareData:h}=r,v=await YC(r,n);return f===((i=h.offset)==null?void 0:i.placement)&&(l=h.arrow)!=null&&l.alignmentOffset?{}:{x:c+v.x,y:u+v.y,data:{...v,placement:f}}}}},XC=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(r){const{x:i,y:l,placement:c,platform:u}=r,{mainAxis:f=!0,crossAxis:h=!1,limiter:v={fn:D=>{let{x:T,y:P}=D;return{x:T,y:P}}},...g}=Wn(n,r),y={x:i,y:l},x=await u.detectOverflow(r,g),b=xn(c),j=Td(b);let k=y[j],S=y[b];const C=(D,T)=>Sx(T+x[D==="y"?"top":"left"],T,T-x[D==="y"?"bottom":"right"]);f&&(k=C(j,k)),h&&(S=C(b,S));const E=v.fn({...r,[j]:k,[b]:S});return{...E,data:{x:E.x-i,y:E.y-l,enabled:{[j]:f,[b]:h}}}}}},JC=function(n){return n===void 0&&(n={}),{options:n,fn(r){var i,l;const{x:c,y:u,placement:f,rects:h,middlewareData:v}=r,{offset:g=0,mainAxis:y=!0,crossAxis:x=!0}=Wn(n,r),b={x:c,y:u},j=xn(f),k=Td(j);let S=b[k],C=b[j];const E=Wn(g,r),D=typeof E=="number"?{mainAxis:E,crossAxis:0}:{mainAxis:(i=E.mainAxis)!=null?i:0,crossAxis:(l=E.crossAxis)!=null?l:0};if(y){const R=k==="y"?"height":"width",N=h.reference[k]-h.floating[R]+D.mainAxis,I=h.reference[k]+h.reference[R]-D.mainAxis;SI&&(S=I)}if(x){var T,P;const R=k==="y"?"width":"height",N=_x.has(Nr(f)),I=h.reference[j]-h.floating[R]+(N&&((T=v.offset)==null?void 0:T[j])||0)+(N?0:D.crossAxis),L=h.reference[j]+h.reference[R]+(N?0:((P=v.offset)==null?void 0:P[j])||0)-(N?D.crossAxis:0);CL&&(C=L)}return{[k]:S,[j]:C}}}},ZC=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(r){const{placement:i,rects:l,platform:c,elements:u}=r,{apply:f=()=>{},...h}=Wn(n,r),v=await c.detectOverflow(r,h),g=Nr(i),y=Xo(i),x=xn(i)==="y",{width:b,height:j}=l.floating;let k,S;g==="top"||g==="bottom"?(k=g,S=y===(await(c.isRTL==null?void 0:c.isRTL(u.floating))?"start":"end")?"left":"right"):(S=g,k=y==="end"?"top":"bottom");const C=j-v.top-v.bottom,E=b-v.left-v.right,D=_r(j-v[k],C),T=_r(b-v[S],E),P=r.middlewareData.shift,R=!P;let N=D,I=T;P!=null&&P.enabled.x&&(I=E),P!=null&&P.enabled.y&&(N=C),R&&!y&&(x?I=b-2*In(v.left,v.right):N=j-2*In(v.top,v.bottom)),await f({...r,availableWidth:I,availableHeight:N});const L=await c.getDimensions(u.floating);return b!==L.width||j!==L.height?{reset:{rects:!0}}:{}}}};function ta(){return typeof window<"u"}function Jo(n){return Nx(n)?(n.nodeName||"").toLowerCase():"#document"}function Ot(n){var r;return(n==null||(r=n.ownerDocument)==null?void 0:r.defaultView)||window}function Yn(n){var r;return(r=(Nx(n)?n.ownerDocument:n.document)||window.document)==null?void 0:r.documentElement}function Nx(n){return ta()?n instanceof Node||n instanceof Ot(n).Node:!1}function bn(n){return ta()?n instanceof Element||n instanceof Ot(n).Element:!1}function Or(n){return ta()?n instanceof HTMLElement||n instanceof Ot(n).HTMLElement:!1}function Vm(n){return!ta()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Ot(n).ShadowRoot}function na(n){const{overflow:r,overflowX:i,overflowY:l,display:c}=kn(n);return/auto|scroll|overlay|hidden|clip/.test(r+l+i)&&c!=="inline"&&c!=="contents"}function eS(n){return/^(table|td|th)$/.test(Jo(n))}function ra(n){try{if(n.matches(":popover-open"))return!0}catch{}try{return n.matches(":modal")}catch{return!1}}const tS=/transform|translate|scale|rotate|perspective|filter/,nS=/paint|layout|strict|content/,qr=n=>!!n&&n!=="none";let gu;function Ad(n){const r=bn(n)?kn(n):n;return qr(r.transform)||qr(r.translate)||qr(r.scale)||qr(r.rotate)||qr(r.perspective)||!Id()&&(qr(r.backdropFilter)||qr(r.filter))||tS.test(r.willChange||"")||nS.test(r.contain||"")}function rS(n){let r=Zr(n);for(;Or(r)&&!Qi(r);){if(Ad(r))return r;if(ra(r))return null;r=Zr(r)}return null}function Id(){return gu==null&&(gu=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),gu}function Qi(n){return/^(html|body|#document)$/.test(Jo(n))}function kn(n){return Ot(n).getComputedStyle(n)}function oa(n){return bn(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Zr(n){if(Jo(n)==="html")return n;const r=n.assignedSlot||n.parentNode||Vm(n)&&n.host||Yn(n);return Vm(r)?r.host:r}function Rx(n){const r=Zr(n);return Qi(r)?(n.ownerDocument||n).body:Or(r)&&na(r)?r:Rx(r)}function Yi(n,r,i){var l;r===void 0&&(r=[]),i===void 0&&(i=!0);const c=Rx(n),u=c===((l=n.ownerDocument)==null?void 0:l.body),f=Ot(c);if(u){const h=Wu(f);return r.concat(f,f.visualViewport||[],na(c)?c:[],h&&i?Yi(h):[])}else return r.concat(c,Yi(c,[],i))}function Wu(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Px(n){const r=kn(n);let i=parseFloat(r.width)||0,l=parseFloat(r.height)||0;const c=Or(n),u=c?n.offsetWidth:i,f=c?n.offsetHeight:l,h=Ll(i)!==u||Ll(l)!==f;return h&&(i=u,l=f),{width:i,height:l,$:h}}function Ld(n){return bn(n)?n:n.contextElement}function Wo(n){const r=Ld(n);if(!Or(r))return Ln(1);const i=r.getBoundingClientRect(),{width:l,height:c,$:u}=Px(r);let f=(u?Ll(i.width):i.width)/l,h=(u?Ll(i.height):i.height)/c;return(!f||!Number.isFinite(f))&&(f=1),(!h||!Number.isFinite(h))&&(h=1),{x:f,y:h}}const oS=Ln(0);function Dx(n){const r=Ot(n);return!Id()||!r.visualViewport?oS:{x:r.visualViewport.offsetLeft,y:r.visualViewport.offsetTop}}function iS(n,r,i){return r===void 0&&(r=!1),!!i&&r&&i===Ot(n)}function eo(n,r,i,l){r===void 0&&(r=!1),i===void 0&&(i=!1);const c=n.getBoundingClientRect(),u=Ld(n);let f=Ln(1);r&&(l?bn(l)&&(f=Wo(l)):f=Wo(n));const h=iS(u,i,l)?Dx(u):Ln(0);let v=(c.left+h.x)/f.x,g=(c.top+h.y)/f.y,y=c.width/f.x,x=c.height/f.y;if(u&&l){const b=Ot(u),j=bn(l)?Ot(l):l;let k=b,S=Wu(k);for(;S&&j!==k;){const C=Wo(S),E=S.getBoundingClientRect(),D=kn(S),T=E.left+(S.clientLeft+parseFloat(D.paddingLeft))*C.x,P=E.top+(S.clientTop+parseFloat(D.paddingTop))*C.y;v*=C.x,g*=C.y,y*=C.x,x*=C.y,v+=T,g+=P,k=Ot(S),S=Wu(k)}}return Fl({width:y,height:x,x:v,y:g})}function ia(n,r){const i=oa(n).scrollLeft;return r?r.left+i:eo(Yn(n)).left+i}function Tx(n,r){const i=n.getBoundingClientRect(),l=i.left+r.scrollLeft-ia(n,i),c=i.top+r.scrollTop;return{x:l,y:c}}function sS(n){let{elements:r,rect:i,offsetParent:l,strategy:c}=n;const u=c==="fixed",f=Yn(l),h=r?ra(r.floating):!1;if(l===f||h&&u)return i;let v={scrollLeft:0,scrollTop:0},g=Ln(1);const y=Ln(0),x=Or(l);if((x||!u)&&((Jo(l)!=="body"||na(f))&&(v=oa(l)),x)){const j=eo(l);g=Wo(l),y.x=j.x+l.clientLeft,y.y=j.y+l.clientTop}const b=f&&!x&&!u?Tx(f,v):Ln(0);return{width:i.width*g.x,height:i.height*g.y,x:i.x*g.x-v.scrollLeft*g.x+y.x+b.x,y:i.y*g.y-v.scrollTop*g.y+y.y+b.y}}function lS(n){return n.getClientRects?Array.from(n.getClientRects()):[]}function aS(n){const r=oa(n),i=n.ownerDocument.body,l=In(n.scrollWidth,n.clientWidth,i.scrollWidth,i.clientWidth),c=In(n.scrollHeight,n.clientHeight,i.scrollHeight,i.clientHeight);let u=-r.scrollLeft+ia(n);const f=-r.scrollTop;return kn(i).direction==="rtl"&&(u+=In(n.clientWidth,i.clientWidth)-l),{width:l,height:c,x:u,y:f}}const cS=25;function uS(n,r,i){i===void 0&&(i="viewport");const l=i==="layoutViewport",c=Ot(n),u=Yn(n),f=c.visualViewport;let h=u.clientWidth,v=u.clientHeight,g=0,y=0;if(f){const b=!Id()||r==="fixed";l?b||(g=-f.offsetLeft,y=-f.offsetTop):(h=f.width,v=f.height,b&&(g=f.offsetLeft,y=f.offsetTop))}if(ia(u)<=0){const b=u.ownerDocument,j=b.body,k=getComputedStyle(j),S=b.compatMode==="CSS1Compat"&&parseFloat(k.marginLeft)+parseFloat(k.marginRight)||0,C=Math.abs(u.clientWidth-j.clientWidth-S),E=getComputedStyle(u).scrollbarGutter==="stable both-edges"?C/2:C;E<=cS&&(h-=E)}return{width:h,height:v,x:g,y}}function dS(n,r){const i=eo(n,!0,r==="fixed"),l=i.top+n.clientTop,c=i.left+n.clientLeft,u=Wo(n),f=n.clientWidth*u.x,h=n.clientHeight*u.y,v=c*u.x,g=l*u.y;return{width:f,height:h,x:v,y:g}}function Hm(n,r,i){let l;if(r==="viewport"||r==="layoutViewport")l=uS(n,i,r);else if(r==="document")l=aS(Yn(n));else if(bn(r))l=dS(r,i);else{const c=Dx(n);l={x:r.x-c.x,y:r.y-c.y,width:r.width,height:r.height}}return Fl(l)}function fS(n,r){const i=r.get(n);if(i)return i;let l=Yi(n,[],!1).filter(h=>bn(h)&&Jo(h)!=="body"),c=null;const u=kn(n).position==="fixed";let f=u?Zr(n):n;for(;bn(f)&&!Qi(f);){const h=kn(f),v=Ad(f),g=c?c.position:u?"fixed":"";!v&&(g==="fixed"||g==="absolute"&&h.position==="static")?l=l.filter(x=>x!==f):c=h,f=Zr(f)}return r.set(n,l),l}function pS(n){let{element:r,boundary:i,rootBoundary:l,strategy:c}=n;const f=[...i==="clippingAncestors"?ra(r)?[]:fS(r,this._c):[].concat(i),l],h=Hm(r,f[0],c);let v=h.top,g=h.right,y=h.bottom,x=h.left;for(let b=1;b{h(!1,1e-7)},1e3)}I=!1}try{l=new IntersectionObserver(L,{...N,root:u.ownerDocument})}catch{l=new IntersectionObserver(L,N)}l.observe(n)}const v=Ot(n),g=()=>h(i);return v.addEventListener("resize",g),h(!0),()=>{v.removeEventListener("resize",g),f()}}function wS(n,r,i,l){l===void 0&&(l={});const{ancestorScroll:c=!0,ancestorResize:u=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:h=typeof IntersectionObserver=="function",animationFrame:v=!1}=l,g=Ld(n),y=c||u?[...g?Yi(g):[],...r?Yi(r):[]]:[];y.forEach(E=>{c&&E.addEventListener("scroll",i),u&&E.addEventListener("resize",i)});const x=g&&h?yS(g,i,u):null;let b=-1,j=null;f&&(j=new ResizeObserver(E=>{let[D]=E;D&&D.target===g&&j&&r&&(j.unobserve(r),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var T;(T=j)==null||T.observe(r)})),i()}),g&&!v&&j.observe(g),r&&j.observe(r));let k,S=v?eo(n):null;v&&C();function C(){const E=eo(n);S&&!Mx(S,E)&&i(),S=E,k=requestAnimationFrame(C)}return i(),()=>{var E;y.forEach(D=>{c&&D.removeEventListener("scroll",i),u&&D.removeEventListener("resize",i)}),x==null||x(),(E=j)==null||E.disconnect(),j=null,v&&cancelAnimationFrame(k)}}const bS=qC,kS=XC,jS=KC,CS=ZC,SS=QC,Km=GC,ES=JC,_S=(n,r,i)=>{const l=new Map,c=i??{},u={...xS,...c.platform,_c:l};return HC(n,r,{...c,platform:u})};var NS=typeof document<"u",RS=function(){},Dl=NS?m.useLayoutEffect:RS;function $l(n,r){if(n===r)return!0;if(typeof n!=typeof r)return!1;if(typeof n=="function"&&n.toString()===r.toString())return!0;let i,l,c;if(n&&r&&typeof n=="object"){if(Array.isArray(n)){if(i=n.length,i!==r.length)return!1;for(l=i;l--!==0;)if(!$l(n[l],r[l]))return!1;return!0}if(c=Object.keys(n),i=c.length,i!==Object.keys(r).length)return!1;for(l=i;l--!==0;)if(!{}.hasOwnProperty.call(r,c[l]))return!1;for(l=i;l--!==0;){const u=c[l];if(!(u==="_owner"&&n.$$typeof)&&!$l(n[u],r[u]))return!1}return!0}return n!==n&&r!==r}function Ax(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function Qm(n,r){const i=Ax(n);return Math.round(r*i)/i}function xu(n){const r=m.useRef(n);return Dl(()=>{r.current=n}),r}function PS(n){n===void 0&&(n={});const{placement:r="bottom",strategy:i="absolute",middleware:l=[],platform:c,elements:{reference:u,floating:f}={},transform:h=!0,whileElementsMounted:v,open:g}=n,[y,x]=m.useState({x:0,y:0,strategy:i,placement:r,middlewareData:{},isPositioned:!1}),[b,j]=m.useState(l);$l(b,l)||j(l);const[k,S]=m.useState(null),[C,E]=m.useState(null),D=m.useCallback(W=>{W!==N.current&&(N.current=W,S(W))},[]),T=m.useCallback(W=>{W!==I.current&&(I.current=W,E(W))},[]),P=u||k,R=f||C,N=m.useRef(null),I=m.useRef(null),L=m.useRef(y),Q=v!=null,ee=xu(v),J=xu(c),ne=xu(g),de=m.useCallback(()=>{if(!N.current||!I.current)return;const W={placement:r,strategy:i,middleware:b};J.current&&(W.platform=J.current),_S(N.current,I.current,W).then(q=>{const F={...q,isPositioned:ne.current!==!1};re.current&&!$l(L.current,F)&&(L.current=F,ed.flushSync(()=>{x(F)}))})},[b,r,i,J,ne]);Dl(()=>{g===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,x(W=>({...W,isPositioned:!1})))},[g]);const re=m.useRef(!1);Dl(()=>(re.current=!0,()=>{re.current=!1}),[]),Dl(()=>{if(P&&(N.current=P),R&&(I.current=R),P&&R){if(ee.current)return ee.current(P,R,de);de()}},[P,R,de,ee,Q]);const ie=m.useMemo(()=>({reference:N,floating:I,setReference:D,setFloating:T}),[D,T]),B=m.useMemo(()=>({reference:P,floating:R}),[P,R]),Z=m.useMemo(()=>{const W={position:i,left:0,top:0};if(!B.floating)return W;const q=Qm(B.floating,y.x),F=Qm(B.floating,y.y);return h?{...W,transform:"translate("+q+"px, "+F+"px)",...Ax(B.floating)>=1.5&&{willChange:"transform"}}:{position:i,left:q,top:F}},[i,h,B.floating,y.x,y.y]);return m.useMemo(()=>({...y,update:de,refs:ie,elements:B,floatingStyles:Z}),[y,de,ie,B,Z])}const DS=n=>{function r(i){return{}.hasOwnProperty.call(i,"current")}return{name:"arrow",options:n,fn(i){const{element:l,padding:c}=typeof n=="function"?n(i):n;return l&&r(l)?l.current!=null?Km({element:l.current,padding:c}).fn(i):{}:l?Km({element:l,padding:c}).fn(i):{}}}},TS=(n,r)=>{const i=bS(n);return{name:i.name,fn:i.fn,options:[n,r]}},OS=(n,r)=>{const i=kS(n);return{name:i.name,fn:i.fn,options:[n,r]}},MS=(n,r)=>({fn:ES(n).fn,options:[n,r]}),AS=(n,r)=>{const i=jS(n);return{name:i.name,fn:i.fn,options:[n,r]}},IS=(n,r)=>{const i=CS(n);return{name:i.name,fn:i.fn,options:[n,r]}},LS=(n,r)=>{const i=SS(n);return{name:i.name,fn:i.fn,options:[n,r]}},zS=(n,r)=>{const i=DS(n);return{name:i.name,fn:i.fn,options:[n,r]}};var FS=Object.defineProperty,$S=(n,r)=>FS(n,"name",{value:r,configurable:!0}),US=m.forwardRef($S(function(r,i){const{children:l,width:c=10,height:u=5,...f}=r;return s.jsx(ze.svg,{...f,ref:i,width:c,height:u,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:r.asChild?l:s.jsx("polygon",{points:"0,0 30,0 15,10"})})},"Arrow")),BS=Object.defineProperty,zn=(n,r)=>BS(n,"name",{value:r,configurable:!0}),Ym={Partial:"partial"},qm={Optimized:"optimized",Always:"always"},Ix="Popper",[Lx,sa]=an(Ix),[WS,zx]=Lx(Ix),Fx=zn(n=>{const{__scopePopper:r,children:i}=n,[l,c]=m.useState(null),[u,f]=m.useState(void 0);return s.jsx(WS,{scope:r,anchor:l,onAnchorChange:c,placementState:u,setPlacementState:f,children:i})},"Popper"),VS="PopperAnchor",$x=m.forwardRef(zn(function(r,i){const{__scopePopper:l,virtualRef:c,...u}=r,f=zx(VS,l),h=m.useRef(null),v=f.onAnchorChange,g=m.useCallback(S=>{h.current=S,S&&v(S)},[v]),y=Ie(i,g),x=m.useRef(null);m.useEffect(()=>{if(!c)return;const S=x.current;x.current=c.current,S!==x.current&&v(x.current)});const b=f.placementState&&la(f.placementState),j=b==null?void 0:b[0],k=b==null?void 0:b[1];return c?null:s.jsx(ze.div,{"data-radix-popper-side":j,"data-radix-popper-align":k,...u,ref:y})},"PopperAnchor")),Ux="PopperContent",[HS,GS]=Lx(Ux),Bx=m.forwardRef(zn(function(r,i){var me,Be,mt,It,ut,tt,Jn;const{__scopePopper:l,side:c="bottom",sideOffset:u=0,align:f="center",alignOffset:h=0,arrowPadding:v=0,avoidCollisions:g=!0,collisionBoundary:y=[],collisionPadding:x=0,sticky:b=Ym.Partial,hideWhenDetached:j=!1,updatePositionStrategy:k=qm.Optimized,onPlaced:S,...C}=r,E=zx(Ux,l),[D,T]=m.useState(null),P=Ie(i,T),[R,N]=m.useState(null),I=Nd(R),L=(I==null?void 0:I.width)??0,Q=(I==null?void 0:I.height)??0,ee=c+(f!=="center"?"-"+f:""),J=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},ne=Array.isArray(y)?y:[y],de=ne.length>0,re={padding:J,boundary:ne.filter(Wx),altBoundary:de},{refs:ie,floatingStyles:B,placement:Z,isPositioned:W,middlewareData:q}=PS({strategy:"fixed",placement:ee,whileElementsMounted:zn((...Cn)=>wS(...Cn,{animationFrame:k===qm.Always}),"whileElementsMounted"),elements:{reference:E.anchor},middleware:[TS({mainAxis:u+Q,alignmentAxis:h}),g&&OS({mainAxis:!0,crossAxis:!1,...b===Ym.Partial?{limiter:MS()}:{},...re}),g&&AS({...re}),IS({...re,apply:zn(({elements:Cn,rects:dt,availableWidth:is,availableHeight:ti})=>{const{width:Mr,height:Zn}=dt.reference,er=Cn.floating.style;er.setProperty("--radix-popper-available-width",`${is}px`),er.setProperty("--radix-popper-available-height",`${ti}px`),er.setProperty("--radix-popper-anchor-width",`${Mr}px`),er.setProperty("--radix-popper-anchor-height",`${Zn}px`)},"apply")}),R&&zS({element:R,padding:v}),qS({arrowWidth:L,arrowHeight:Q}),j&&LS(de?{strategy:"referenceHidden",...re}:{strategy:"referenceHidden",padding:re.padding,altBoundary:re.altBoundary})]}),F=E.setPlacementState;wt(()=>(F(Z),()=>{F(void 0)}),[Z,F]);const[M,V]=la(Z),he=wn(S);wt(()=>{W&&(he==null||he())},[W,he]);const be=(me=q.arrow)==null?void 0:me.x,pe=(Be=q.arrow)==null?void 0:Be.y,Y=((mt=q.arrow)==null?void 0:mt.centerOffset)!==0,[we,ke]=m.useState();return wt(()=>{D&&ke(window.getComputedStyle(D).zIndex)},[D]),s.jsx("div",{ref:ie.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:W?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:we,"--radix-popper-transform-origin":[(It=q.transformOrigin)==null?void 0:It.x,(ut=q.transformOrigin)==null?void 0:ut.y].join(" "),...((tt=q.hide)==null?void 0:tt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:r.dir,children:s.jsx(HS,{scope:l,placedSide:M,placedAlign:V,onArrowChange:N,arrowX:be,arrowY:pe,shouldHideArrow:Y,children:s.jsx(ze.div,{"data-side":M,"data-align":V,...C,ref:P,style:{...C.style,animation:W?(Jn=C.style)==null?void 0:Jn.animation:"none"}})})})},"PopperContent")),KS="PopperArrow",QS={top:"bottom",right:"left",bottom:"top",left:"right"},YS=m.forwardRef(zn(function(r,i){const{__scopePopper:l,...c}=r,u=GS(KS,l),f=QS[u.placedSide];return s.jsx("span",{ref:u.onArrowChange,style:{position:"absolute",left:u.arrowX,top:u.arrowY,[f]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[u.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[u.placedSide],visibility:u.shouldHideArrow?"hidden":void 0},children:s.jsx(US,{...c,ref:i,style:{...c.style,display:"block"}})})},"PopperArrow"));function Wx(n){return n!==null}zn(Wx,"isNotNull");var qS=zn(n=>({name:"transformOrigin",options:n,fn(r){var C,E,D;const{placement:i,rects:l,middlewareData:c}=r,f=((C=c.arrow)==null?void 0:C.centerOffset)!==0,h=f?0:n.arrowWidth,v=f?0:n.arrowHeight,[g,y]=la(i),x={start:"0%",center:"50%",end:"100%"}[y],b=(((E=c.arrow)==null?void 0:E.x)??0)+h/2,j=(((D=c.arrow)==null?void 0:D.y)??0)+v/2;let k="",S="";return g==="bottom"?(k=f?x:`${b}px`,S=`${-v}px`):g==="top"?(k=f?x:`${b}px`,S=`${l.floating.height+v}px`):g==="right"?(k=`${-v}px`,S=f?x:`${j}px`):g==="left"&&(k=`${l.floating.width+v}px`,S=f?x:`${j}px`),{data:{x:k,y:S}}}}),"transformOrigin");function la(n){const[r,i="center"]=n.split("-");return[r,i]}zn(la,"getSideAndAlignFromPlacement");var XS=Object.defineProperty,zd=(n,r)=>XS(n,"name",{value:r,configurable:!0}),yu=!1;function Vx(){const[n,r]=m.useState(yu);return m.useEffect(()=>{yu||(yu=!0,r(!0))},[]),n}zd(Vx,"useIsHydrated");var Hx=Rr[" useSyncExternalStore ".trim().toString()];function Gx(){return()=>{}}zd(Gx,"subscribe");function Kx(){return Hx(Gx,()=>!0,()=>!1)}zd(Kx,"useIsHydratedModern");var JS=typeof Hx=="function"?Kx:Vx,ZS=Object.defineProperty,so=(n,r)=>ZS(n,"name",{value:r,configurable:!0}),wu="rovingFocusGroup.onEntryFocus",eE={bubbles:!1,cancelable:!0},aa="RovingFocusGroup",[Vu,Qx,tE]=cd(aa),[nE,Yx]=an(aa,[tE]),Xm={Vertical:"vertical",Horizontal:"horizontal"},rE={RTL:"rtl"},[oE,iE]=nE(aa),sE=m.forwardRef(so(function(r,i){return s.jsx(Vu.Provider,{scope:r.__scopeRovingFocusGroup,children:s.jsx(Vu.Slot,{scope:r.__scopeRovingFocusGroup,children:s.jsx(lE,{...r,ref:i})})})},"RovingFocusGroup")),lE=m.forwardRef(so(function(r,i){const{__scopeRovingFocusGroup:l,orientation:c,loop:u=!1,dir:f,currentTabStopId:h,defaultCurrentTabStopId:v,onCurrentTabStopIdChange:g,onEntryFocus:y,preventScrollOnEntryFocus:x=!1,...b}=r,j=m.useRef(null),k=Ie(i,j),S=dd(f),[C,E]=qo({prop:h,defaultProp:v??null,onChange:g,caller:aa}),[D,T]=m.useState(!1),P=wn(y),R=Qx(l),N=m.useRef(!1),[I,L]=m.useState(0);return m.useEffect(()=>{const Q=j.current;if(Q)return Q.addEventListener(wu,P),()=>Q.removeEventListener(wu,P)},[P]),s.jsx(oE,{scope:l,orientation:c,dir:S,loop:u,currentTabStopId:C,onItemFocus:m.useCallback(Q=>E(Q),[E]),onItemShiftTab:m.useCallback(()=>T(!0),[]),onFocusableItemAdd:m.useCallback(()=>L(Q=>Q+1),[]),onFocusableItemRemove:m.useCallback(()=>L(Q=>Q-1),[]),children:s.jsx(ze.div,{tabIndex:D||I===0?-1:0,"data-orientation":c,...b,ref:k,style:{outline:"none",...r.style},onMouseDown:je(r.onMouseDown,()=>{N.current=!0}),onFocus:je(r.onFocus,Q=>{const ee=!N.current;if(Q.target===Q.currentTarget&&ee&&!D){const J=new CustomEvent(wu,eE);if(Q.currentTarget.dispatchEvent(J),!J.defaultPrevented){const ne=R().filter(Z=>Z.focusable),de=ne.find(Z=>Z.active),re=ne.find(Z=>Z.id===C),B=[de,re,...ne].filter(Boolean).map(Z=>Z.ref.current);Fd(B,x)}}N.current=!1}),onBlur:je(r.onBlur,()=>T(!1))})})},"RovingFocusGroupImpl")),aE="RovingFocusGroupItem",cE=m.forwardRef(so(function(r,i){const{__scopeRovingFocusGroup:l,focusable:c=!0,active:u=!1,tabStopId:f,children:h,...v}=r,g=Sr(),y=f||g,x=iE(aE,l),b=x.currentTabStopId===y,j=Qx(l),{onFocusableItemAdd:k,onFocusableItemRemove:S,currentTabStopId:C}=x,E=JS();return wt(()=>{if(!(!E||!c))return k(),()=>S()},[E,c,k,S]),m.useEffect(()=>{if(!(E||!c))return k(),()=>S()},[E,c,k,S]),s.jsx(Vu.ItemSlot,{scope:l,id:y,focusable:c,active:u,children:s.jsx(ze.span,{tabIndex:b?0:-1,"data-orientation":x.orientation,...v,ref:i,onMouseDown:je(r.onMouseDown,D=>{c?x.onItemFocus(y):D.preventDefault()}),onFocus:je(r.onFocus,()=>x.onItemFocus(y)),onKeyDown:je(r.onKeyDown,D=>{if(D.key==="Tab"&&D.shiftKey){x.onItemShiftTab();return}if(D.target!==D.currentTarget)return;const T=Xx(D,x.orientation,x.dir);if(T!==void 0){if(D.metaKey||D.ctrlKey||D.altKey||D.shiftKey)return;D.preventDefault();let R=j().filter(N=>N.focusable).map(N=>N.ref.current);if(T==="last")R.reverse();else if(T==="prev"||T==="next"){T==="prev"&&R.reverse();const N=R.indexOf(D.currentTarget);R=x.loop?Jx(R,N+1):R.slice(N+1)}setTimeout(()=>Fd(R))}}),children:typeof h=="function"?h({isCurrentTabStop:b,hasTabStop:C!=null}):h})})},"RovingFocusGroupItem")),uE={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function qx(n,r){return r!==rE.RTL?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}so(qx,"getDirectionAwareKey");function Xx(n,r,i){const l=qx(n.key,i);if(!(r===Xm.Vertical&&["ArrowLeft","ArrowRight"].includes(l))&&!(r===Xm.Horizontal&&["ArrowUp","ArrowDown"].includes(l)))return uE[l]}so(Xx,"getFocusIntent");function Fd(n,r=!1){const i=document.activeElement;for(const l of n)if(l===i||(l.focus({preventScroll:r}),document.activeElement!==i))return}so(Fd,"focusFirst");function Jx(n,r){return n.map((i,l)=>n[(r+l)%n.length])}so(Jx,"wrapArray");var dE=Object.defineProperty,Oe=(n,r)=>dE(n,"name",{value:r,configurable:!0}),fE=["Enter"," "],pE=["ArrowDown","PageUp","Home"],Zx=["ArrowUp","PageDown","End"],hE=[...pE,...Zx],ca="Menu",[Hu,mE,gE]=cd(ca),[lo,ey]=an(ca,[gE,sa,Yx]),$d=sa(),ty=Yx(),[vE,ts]=lo(ca),[xE,Ud]=lo(ca),yE=Oe(n=>{const{__scopeMenu:r,open:i=!1,children:l,dir:c,onOpenChange:u,modal:f=!0}=n,h=$d(r),[v,g]=m.useState(null),y=m.useRef(!1),x=wn(u),b=dd(c);return m.useEffect(()=>{const j=Oe(()=>{y.current=!0,document.addEventListener("pointerdown",k,{capture:!0,once:!0}),document.addEventListener("pointermove",k,{capture:!0,once:!0})},"handleKeyDown"),k=Oe(()=>y.current=!1,"handlePointer");return document.addEventListener("keydown",j,{capture:!0}),()=>{document.removeEventListener("keydown",j,{capture:!0}),document.removeEventListener("pointerdown",k,{capture:!0}),document.removeEventListener("pointermove",k,{capture:!0})}},[]),m.useEffect(()=>{if(!i)return;const j=Oe(()=>x(!1),"handleBlur");return window.addEventListener("blur",j),()=>window.removeEventListener("blur",j)},[i,x]),s.jsx(Fx,{...h,children:s.jsx(vE,{scope:r,open:i,onOpenChange:x,content:v,onContentChange:g,children:s.jsx(xE,{scope:r,onClose:m.useCallback(()=>x(!1),[x]),isUsingKeyboardRef:y,dir:b,modal:f,children:l})})})},"Menu"),wE=m.forwardRef(Oe(function(r,i){const{__scopeMenu:l,...c}=r,u=$d(l);return s.jsx($x,{...u,...c,ref:i})},"MenuAnchor")),ny="MenuPortal",[bE,kE]=lo(ny,{forceMount:void 0}),jE=Oe(n=>{const{__scopeMenu:r,forceMount:i,children:l,container:c}=n,u=ts(ny,r);return s.jsx(bE,{scope:r,forceMount:i,children:s.jsx(Gn,{present:i||u.open,children:s.jsx(xd,{asChild:!0,container:c,children:l})})})},"MenuPortal"),Er="MenuContent",[CE,ry]=lo(Er),SE=m.forwardRef(Oe(function(r,i){const l=kE(Er,r.__scopeMenu),{forceMount:c=l.forceMount,...u}=r,f=ts(Er,r.__scopeMenu),h=Ud(Er,r.__scopeMenu);return s.jsx(Hu.Provider,{scope:r.__scopeMenu,children:s.jsx(Gn,{present:c||f.open,children:s.jsx(Hu.Slot,{scope:r.__scopeMenu,children:h.modal?s.jsx(EE,{...u,ref:i}):s.jsx(_E,{...u,ref:i})})})})},"MenuContent")),EE=m.forwardRef(Oe(function(r,i){const l=ts(Er,r.__scopeMenu),c=m.useRef(null),u=Ie(i,c);return m.useEffect(()=>{const f=c.current;if(f)return gx(f)},[]),s.jsx(oy,{...r,ref:u,trapFocus:l.open,disableOutsidePointerEvents:l.open,disableOutsideScroll:!0,onFocusOutside:je(r.onFocusOutside,f=>f.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>l.onOpenChange(!1)})},"MenuRootContentModal")),_E=m.forwardRef(Oe(function(r,i){const l=ts(Er,r.__scopeMenu);return s.jsx(oy,{...r,ref:i,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>l.onOpenChange(!1)})},"MenuRootContentNonModal")),NE=$n("MenuContent.ScrollLock"),oy=m.forwardRef(Oe(function(r,i){const{__scopeMenu:l,loop:c=!1,trapFocus:u,onOpenAutoFocus:f,onCloseAutoFocus:h,disableOutsidePointerEvents:v,onEntryFocus:g,onEscapeKeyDown:y,onPointerDownOutside:x,onFocusOutside:b,onInteractOutside:j,onDismiss:k,disableOutsideScroll:S,...C}=r,E=ts(Er,l),D=Ud(Er,l),T=$d(l),P=ty(l),R=mE(l),[N,I]=m.useState(null),L=m.useRef(null),[Q,ee]=m.useState(null);gd(Q);const{nodes:J,registry:ne}=md(),de=!!(u||S),re=Ie(i,L,E.onContentChange,ee),ie=m.useRef(0),B=m.useRef(""),Z=m.useRef(0),W=m.useRef(null),q=m.useRef("right"),F=m.useRef(0),M=m.useMemo(()=>S?[L,...J.map(Y=>({current:Y}))]:[],[L,J,S]),V=S?wd:m.Fragment,he=S?{as:NE,allowPinchZoom:!0,shards:M}:void 0,be=Oe(Y=>{var Jn,Cn;const we=B.current+Y,ke=R().filter(dt=>!dt.disabled),me=document.activeElement,Be=(Jn=ke.find(dt=>dt.ref.current===me))==null?void 0:Jn.textValue,mt=ke.map(dt=>dt.textValue),It=cy(mt,we,Be),ut=(Cn=ke.find(dt=>dt.textValue===It))==null?void 0:Cn.ref.current;function tt(dt){B.current=dt,window.clearTimeout(ie.current),dt!==""&&(ie.current=window.setTimeout(()=>tt(""),1e3))}Oe(tt,"updateSearch"),tt(we),ut&&setTimeout(()=>ut.focus())},"handleTypeaheadSearch");m.useEffect(()=>()=>window.clearTimeout(ie.current),[]),Jl();const pe=m.useCallback(Y=>{var ke,me;return q.current===((ke=W.current)==null?void 0:ke.side)&&dy(Y,(me=W.current)==null?void 0:me.area)},[]);return s.jsx(CE,{scope:l,searchRef:B,onItemEnter:m.useCallback(Y=>{pe(Y)&&Y.preventDefault()},[pe]),onItemLeave:m.useCallback(Y=>{var we;pe(Y)||((we=L.current)==null||we.focus(),I(null))},[pe]),onTriggerLeave:m.useCallback(Y=>{pe(Y)&&Y.preventDefault()},[pe]),pointerGraceTimerRef:Z,onPointerGraceIntentChange:m.useCallback(Y=>{W.current=Y},[]),children:s.jsx(hd,{registry:de?ne:null,children:s.jsx(V,{...he,children:s.jsx(ex,{asChild:!0,trapped:u,branches:J,onMountAutoFocus:je(f,Y=>{var we;Y.preventDefault(),(we=L.current)==null||we.focus({preventScroll:!0})}),onUnmountAutoFocus:h,children:s.jsx(fd,{asChild:!0,disableOutsidePointerEvents:v,onEscapeKeyDown:y,onPointerDownOutside:x,onFocusOutside:b,onInteractOutside:j,onDismiss:k,children:s.jsx(sE,{asChild:!0,...P,dir:D.dir,orientation:"vertical",loop:c,currentTabStopId:N,onCurrentTabStopIdChange:I,onEntryFocus:je(g,Y=>{D.isUsingKeyboardRef.current||Y.preventDefault()}),preventScrollOnEntryFocus:!0,children:s.jsx(Bx,{role:"menu","aria-orientation":"vertical","data-state":sy(E.open),"data-radix-menu-content":"",dir:D.dir,...T,...C,ref:re,style:{outline:"none",...C.style},onKeyDown:je(C.onKeyDown,Y=>{const ke=Y.target.closest("[data-radix-menu-content]")===Y.currentTarget,me=Y.ctrlKey||Y.altKey||Y.metaKey,Be=Y.key.length===1;ke&&(Y.key==="Tab"&&Y.preventDefault(),!me&&Be&&be(Y.key));const mt=L.current;if(Y.target!==mt||!hE.includes(Y.key))return;Y.preventDefault();const ut=R().filter(tt=>!tt.disabled).map(tt=>tt.ref.current);Zx.includes(Y.key)&&ut.reverse(),ly(ut)}),onBlur:je(r.onBlur,Y=>{Y.currentTarget.contains(Y.target)||(window.clearTimeout(ie.current),B.current="")}),onPointerMove:je(r.onPointerMove,Ul(Y=>{const we=Y.target,ke=F.current!==Y.clientX;if(Y.currentTarget.contains(we)&&ke){const me=Y.clientX>F.current?"right":"left";q.current=me,F.current=Y.clientX}}))})})})})})})})},"MenuContentImpl")),RE=m.forwardRef(Oe(function(r,i){const{__scopeMenu:l,...c}=r;return s.jsx(ze.div,{role:"group",...c,ref:i})},"MenuGroup")),PE=m.forwardRef(Oe(function(r,i){const{__scopeMenu:l,...c}=r;return s.jsx(ze.div,{...c,ref:i})},"MenuLabel")),Gu="MenuItem",Jm="menu.itemSelect",DE=m.forwardRef(Oe(function(r,i){const{disabled:l=!1,onSelect:c,...u}=r,f=m.useRef(null),h=Ud(Gu,r.__scopeMenu),v=ry(Gu,r.__scopeMenu),g=Ie(i,f),y=m.useRef(!1),x=Oe(()=>{const b=f.current;if(!l&&b){const j=new CustomEvent(Jm,{bubbles:!0,cancelable:!0});b.addEventListener(Jm,k=>c==null?void 0:c(k),{once:!0}),ad(b,j),j.defaultPrevented?y.current=!1:h.onClose()}},"handleSelect");return s.jsx(TE,{...u,ref:g,disabled:l,onClick:je(r.onClick,x),onPointerDown:b=>{var j;(j=r.onPointerDown)==null||j.call(r,b),y.current=!0},onPointerUp:je(r.onPointerUp,b=>{var j;y.current||(j=b.currentTarget)==null||j.click()}),onKeyDown:je(r.onKeyDown,b=>{l||b.target!==b.currentTarget||v.searchRef.current!==""&&b.key===" "||fE.includes(b.key)&&(b.currentTarget.click(),b.preventDefault())})})},"MenuItem")),TE=m.forwardRef(Oe(function(r,i){const{__scopeMenu:l,disabled:c=!1,textValue:u,...f}=r,h=ry(Gu,l),v=ty(l),g=m.useRef(null),y=Ie(i,g),[x,b]=m.useState(!1),[j,k]=m.useState("");return m.useEffect(()=>{const S=g.current;S&&k((S.textContent??"").trim())},[f.children]),s.jsx(Hu.ItemSlot,{scope:l,disabled:c,textValue:u??j,children:s.jsx(cE,{asChild:!0,...v,focusable:!c,children:s.jsx(ze.div,{role:"menuitem","data-highlighted":x?"":void 0,"aria-disabled":c||void 0,"data-disabled":c?"":void 0,...f,ref:y,onPointerMove:je(r.onPointerMove,Ul(S=>{c?h.onItemLeave(S):(h.onItemEnter(S),S.defaultPrevented||S.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:je(r.onPointerLeave,Ul(S=>h.onItemLeave(S))),onFocus:je(r.onFocus,()=>b(!0)),onBlur:je(r.onBlur,()=>b(!1))})})})},"MenuItemImpl")),OE="MenuRadioGroup",[ME,AE]=lo(OE,{value:void 0,onValueChange:Oe(()=>{},"onValueChange")}),IE=m.forwardRef(Oe(function(r,i){const{value:l,onValueChange:c,...u}=r,f=wn(c);return s.jsx(ME,{scope:r.__scopeMenu,value:l,onValueChange:f,children:s.jsx(RE,{...u,ref:i})})},"MenuRadioGroup")),LE="MenuRadioItem",zE=m.forwardRef(Oe(function(r,i){const{value:l,...c}=r,u=AE(LE,r.__scopeMenu),f=l===u.value;return s.jsx(FE,{scope:r.__scopeMenu,checked:f,children:s.jsx(DE,{role:"menuitemradio","aria-checked":f,...c,ref:i,"data-state":Wd(f),onSelect:je(c.onSelect,()=>{var h;return(h=u.onValueChange)==null?void 0:h.call(u,l)},{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),iy="MenuItemIndicator",[FE,$E]=lo(iy,{checked:!1}),UE=m.forwardRef(Oe(function(r,i){const{__scopeMenu:l,forceMount:c,...u}=r,f=$E(iy,l);return s.jsx(Gn,{present:c||Bd(f.checked)||f.checked===!0,children:s.jsx(ze.span,{...u,ref:i,"data-state":Wd(f.checked)})})},"MenuItemIndicator")),BE=m.forwardRef(Oe(function(r,i){const{__scopeMenu:l,...c}=r;return s.jsx(ze.div,{role:"separator","aria-orientation":"horizontal",...c,ref:i})},"MenuSeparator")),WE="MenuSub",[Z2,eN]=lo(WE);function sy(n){return n?"open":"closed"}Oe(sy,"getOpenState");function Bd(n){return n==="indeterminate"}Oe(Bd,"isIndeterminate");function Wd(n){return Bd(n)?"indeterminate":n?"checked":"unchecked"}Oe(Wd,"getCheckedState");function ly(n){const r=document.activeElement;for(const i of n)if(i===r||(i.focus(),document.activeElement!==r))return}Oe(ly,"focusFirst");function ay(n,r){return n.map((i,l)=>n[(r+l)%n.length])}Oe(ay,"wrapArray");function cy(n,r,i){const c=r.length>1&&Array.from(r).every(g=>g===r[0])?r[0]:r,u=i?n.indexOf(i):-1;let f=ay(n,Math.max(u,0));c.length===1&&(f=f.filter(g=>g!==i));const v=f.find(g=>g.toLowerCase().startsWith(c.toLowerCase()));return v!==i?v:void 0}Oe(cy,"getNextMatch");function uy(n,r){const{x:i,y:l}=n;let c=!1;for(let u=0,f=r.length-1;ul!=b>l&&i<(x-g)*(l-y)/(b-y)+g&&(c=!c)}return c}Oe(uy,"isPointInPolygon");function dy(n,r){if(!r)return!1;const i={x:n.clientX,y:n.clientY};return uy(i,r)}Oe(dy,"isPointerInGraceArea");function Ul(n){return r=>r.pointerType==="mouse"?n(r):void 0}Oe(Ul,"whenMouse");var VE=Object.defineProperty,qn=(n,r)=>VE(n,"name",{value:r,configurable:!0}),Vd="DropdownMenu",[HE,tN]=an(Vd,[ey]),Xn=ey(),[GE,fy]=HE(Vd),KE=qn(n=>{const{__scopeDropdownMenu:r,children:i,dir:l,open:c,defaultOpen:u,onOpenChange:f,modal:h=!0}=n,v=Xn(r),g=m.useRef(null),[y,x]=qo({prop:c,defaultProp:u??!1,onChange:f,caller:Vd});return s.jsx(GE,{scope:r,triggerId:Sr(),triggerRef:g,contentId:Sr(),open:y,onOpenChange:x,onOpenToggle:m.useCallback(()=>x(b=>!b),[x]),modal:h,children:s.jsx(yE,{...v,open:y,onOpenChange:x,dir:l,modal:h,children:i})})},"DropdownMenu"),QE="DropdownMenuTrigger",YE=m.forwardRef(qn(function(r,i){const{__scopeDropdownMenu:l,disabled:c=!1,...u}=r,f=fy(QE,l),h=Xn(l),v=Ie(i,f.triggerRef);return s.jsx(wE,{asChild:!0,...h,children:s.jsx(ze.button,{type:"button",id:f.triggerId,"aria-haspopup":"menu","aria-expanded":f.open,"aria-controls":f.open?f.contentId:void 0,"data-state":f.open?"open":"closed","data-disabled":c?"":void 0,disabled:c,...u,ref:v,onPointerDown:je(r.onPointerDown,g=>{!c&&g.button===0&&g.ctrlKey===!1&&(f.onOpenToggle(),f.open||g.preventDefault())}),onKeyDown:je(r.onKeyDown,g=>{c||(["Enter"," "].includes(g.key)&&f.onOpenToggle(),g.key==="ArrowDown"&&f.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(g.key)&&g.preventDefault())})})})},"DropdownMenuTrigger")),qE=qn(n=>{const{__scopeDropdownMenu:r,...i}=n,l=Xn(r);return s.jsx(jE,{...l,...i})},"DropdownMenuPortal"),XE="DropdownMenuContent",JE=m.forwardRef(qn(function(r,i){const{__scopeDropdownMenu:l,...c}=r,u=fy(XE,l),f=Xn(l),h=m.useRef(!1);return s.jsx(SE,{id:u.contentId,"aria-labelledby":u.triggerId,...f,...c,ref:i,onCloseAutoFocus:je(r.onCloseAutoFocus,v=>{var g;h.current||(g=u.triggerRef.current)==null||g.focus(),h.current=!1,v.preventDefault()}),onInteractOutside:je(r.onInteractOutside,v=>{const g=v.detail.originalEvent,y=g.button===0&&g.ctrlKey===!0,x=g.button===2||y;(!u.modal||x)&&(h.current=!0)}),style:{...r.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),ZE=m.forwardRef(qn(function(r,i){const{__scopeDropdownMenu:l,...c}=r,u=Xn(l);return s.jsx(PE,{...u,...c,ref:i})},"DropdownMenuLabel")),e_=m.forwardRef(qn(function(r,i){const{__scopeDropdownMenu:l,...c}=r,u=Xn(l);return s.jsx(IE,{...u,...c,ref:i})},"DropdownMenuRadioGroup")),t_=m.forwardRef(qn(function(r,i){const{__scopeDropdownMenu:l,...c}=r,u=Xn(l);return s.jsx(zE,{...u,...c,ref:i})},"DropdownMenuRadioItem")),n_=m.forwardRef(qn(function(r,i){const{__scopeDropdownMenu:l,...c}=r,u=Xn(l);return s.jsx(UE,{...u,...c,ref:i})},"DropdownMenuItemIndicator")),r_=m.forwardRef(qn(function(r,i){const{__scopeDropdownMenu:l,...c}=r,u=Xn(l);return s.jsx(BE,{...u,...c,ref:i})},"DropdownMenuSeparator")),o_=Object.defineProperty,i_=(n,r)=>o_(n,"name",{value:r,configurable:!0}),s_=m.forwardRef(i_(function(r,i){return s.jsx(ze.label,{...r,ref:i,onMouseDown:l=>{var u;l.target.closest("button, input, select, textarea")||((u=r.onMouseDown)==null||u.call(r,l),!l.defaultPrevented&&l.detail>1&&l.preventDefault())}})},"Label")),l_=Object.defineProperty,py=(n,r)=>l_(n,"name",{value:r,configurable:!0}),Hd={Horizontal:"horizontal",Vertical:"vertical"},Zm=Hd.Horizontal,a_=Object.values(Hd),c_=m.forwardRef(py(function(r,i){const{decorative:l,orientation:c=Zm,...u}=r,f=hy(c)?c:Zm,h=f===Hd.Vertical?f:void 0,v=l?{role:"none"}:{"aria-orientation":h,role:"separator"};return s.jsx(ze.div,{"data-orientation":f,...v,...u,ref:i})},"Separator"));function hy(n){return a_.includes(n)}py(hy,"isValidOrientation");var u_=Object.defineProperty,et=(n,r)=>u_(n,"name",{value:r,configurable:!0}),[Gd,nN]=an("Tooltip",[sa]),ua=sa(),d_="TooltipProvider",f_=700,Ku="tooltip.open",[p_,Kd]=Gd(d_),h_=et(n=>{const{__scopeTooltip:r,delayDuration:i=f_,skipDelayDuration:l=300,disableHoverableContent:c=!1,children:u}=n,f=m.useRef(!0),h=m.useRef(!1),v=m.useRef(0);return m.useEffect(()=>{const g=v.current;return()=>window.clearTimeout(g)},[]),s.jsx(p_,{scope:r,isOpenDelayedRef:f,delayDuration:i,onOpen:m.useCallback(()=>{l<=0||(window.clearTimeout(v.current),f.current=!1)},[l]),onClose:m.useCallback(()=>{l<=0||(window.clearTimeout(v.current),v.current=window.setTimeout(()=>f.current=!0,l))},[l]),isPointerInTransitRef:h,onPointerInTransitChange:m.useCallback(g=>{h.current=g},[]),disableHoverableContent:c,children:u})},"TooltipProvider"),Qu="Tooltip",[m_,ns]=Gd(Qu),g_=et(n=>{const{__scopeTooltip:r,children:i,open:l,defaultOpen:c,onOpenChange:u,disableHoverableContent:f,delayDuration:h}=n,v=Kd(Qu,n.__scopeTooltip),g=ua(r),[y,x]=m.useState(null),[b,j]=m.useState(void 0),k=Sr(),S=m.useRef(0),C=f??v.disableHoverableContent,E=h??v.delayDuration,D=m.useRef(!1),[T,P]=qo({prop:l,defaultProp:c??!1,onChange:et(ee=>{ee?(v.onOpen(),document.dispatchEvent(new CustomEvent(Ku))):v.onClose(),u==null||u(ee)},"onChange"),caller:Qu}),R=m.useMemo(()=>T?D.current?"delayed-open":"instant-open":"closed",[T]),N=m.useCallback(()=>{window.clearTimeout(S.current),S.current=0,D.current=!1,P(!0)},[P]),I=m.useCallback(()=>{window.clearTimeout(S.current),S.current=0,P(!1)},[P]),L=m.useCallback(()=>{window.clearTimeout(S.current),S.current=window.setTimeout(()=>{D.current=!0,P(!0),S.current=0},E)},[E,P]);m.useEffect(()=>()=>{S.current&&(window.clearTimeout(S.current),S.current=0)},[]);const Q=b??k;return s.jsx(Fx,{...g,children:s.jsx(m_,{scope:r,contentId:Q,setContentId:j,open:T,stateAttribute:R,trigger:y,onTriggerChange:x,onTriggerEnter:m.useCallback(()=>{v.isOpenDelayedRef.current?L():N()},[v.isOpenDelayedRef,L,N]),onTriggerLeave:m.useCallback(()=>{C?I():(window.clearTimeout(S.current),S.current=0)},[I,C]),onOpen:N,onClose:I,disableHoverableContent:C,children:i})})},"Tooltip"),eg="TooltipTrigger",v_=m.forwardRef(et(function(r,i){const{__scopeTooltip:l,"aria-describedby":c,...u}=r,f=ns(eg,l),h=Kd(eg,l),v=ua(l),g=m.useRef(null),y=Ie(i,g,f.onTriggerChange),x=m.useRef(!1),b=m.useRef(!1),j=m.useCallback(()=>x.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",j),[j]),s.jsx($x,{asChild:!0,...v,children:s.jsx(ze.button,{"aria-describedby":f.open?jy(c,f.contentId):c,"data-state":f.stateAttribute,...u,ref:y,onPointerMove:je(r.onPointerMove,k=>{k.pointerType!=="touch"&&!b.current&&!h.isPointerInTransitRef.current&&(f.onTriggerEnter(),b.current=!0)}),onPointerLeave:je(r.onPointerLeave,()=>{f.onTriggerLeave(),b.current=!1}),onPointerDown:je(r.onPointerDown,()=>{f.open&&f.onClose(),x.current=!0,document.addEventListener("pointerup",j,{once:!0})}),onFocus:je(r.onFocus,()=>{x.current||f.onOpen()}),onBlur:je(r.onBlur,f.onClose),onClick:je(r.onClick,f.onClose)})})},"TooltipTrigger")),my="TooltipPortal",[x_,y_]=Gd(my,{forceMount:void 0}),w_=et(n=>{const{__scopeTooltip:r,forceMount:i,children:l,container:c}=n,u=ns(my,r);return s.jsx(x_,{scope:r,forceMount:i,children:s.jsx(Gn,{present:i||u.open,children:s.jsx(xd,{asChild:!0,container:c,children:l})})})},"TooltipPortal"),qi="TooltipContent",b_=m.forwardRef(et(function(r,i){const l=y_(qi,r.__scopeTooltip),{forceMount:c=l.forceMount,side:u="top",...f}=r,h=ns(qi,r.__scopeTooltip);return s.jsx(Gn,{present:c||h.open,children:h.disableHoverableContent?s.jsx(gy,{side:u,...f,ref:i}):s.jsx(k_,{side:u,...f,ref:i})})},"TooltipContent")),k_=m.forwardRef(et(function(r,i){const l=ns(qi,r.__scopeTooltip),c=Kd(qi,r.__scopeTooltip),u=m.useRef(null),f=Ie(i,u),[h,v]=m.useState(null),{trigger:g,onClose:y}=l,x=u.current,{onPointerInTransitChange:b}=c,j=m.useCallback(()=>{v(null),b(!1)},[b]),k=m.useCallback((S,C)=>{const E=S.currentTarget,D={x:S.clientX,y:S.clientY},T=vy(D,E.getBoundingClientRect()),P=xy(D,T),R=yy(C.getBoundingClientRect()),N=by([...P,...R]);v(N),b(!0)},[b]);return m.useEffect(()=>()=>j(),[j]),m.useEffect(()=>{if(g&&x){const S=et(E=>k(E,x),"handleTriggerLeave"),C=et(E=>k(E,g),"handleContentLeave");return g.addEventListener("pointerleave",S),x.addEventListener("pointerleave",C),()=>{g.removeEventListener("pointerleave",S),x.removeEventListener("pointerleave",C)}}},[g,x,k,j]),m.useEffect(()=>{if(h){const S=et(C=>{const E=C.target,D={x:C.clientX,y:C.clientY},T=(g==null?void 0:g.contains(E))||(x==null?void 0:x.contains(E)),P=!wy(D,h);T?j():P&&(j(),y())},"handleTrackPointerGrace");return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[g,x,h,y,j]),s.jsx(gy,{...r,ref:f})},"TooltipContentHoverable")),j_=_v("TooltipContent"),gy=m.forwardRef(et(function(r,i){const{__scopeTooltip:l,children:c,"aria-label":u,id:f,onEscapeKeyDown:h,onPointerDownOutside:v,...g}=r,y=ns(qi,l),x=ua(l),{onClose:b}=y,[j,k]=m.useState(null),S=Ie(i,k);gd(j),m.useEffect(()=>(document.addEventListener(Ku,b),()=>document.removeEventListener(Ku,b)),[b]),m.useEffect(()=>{if(y.trigger){const E=et(D=>{D.target instanceof Node&&D.target.contains(y.trigger)&&b()},"handleScroll");return window.addEventListener("scroll",E,{capture:!0}),()=>window.removeEventListener("scroll",E,{capture:!0})}},[y.trigger,b]);const{setContentId:C}=y;return wt(()=>(C(f),()=>{C(void 0)}),[f,C]),s.jsx(fd,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:h,onPointerDownOutside:v,onFocusOutside:E=>E.preventDefault(),onDismiss:b,children:s.jsxs(Bx,{"data-state":y.stateAttribute,role:u?void 0:"tooltip",id:u?void 0:y.contentId,...x,...g,ref:S,style:{...g.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[s.jsx(j_,{children:c}),u?s.jsx(Ak,{id:y.contentId,role:"tooltip",children:u}):null]})})},"TooltipContentImpl")),C_=m.forwardRef(et(function(r,i){const{__scopeTooltip:l,...c}=r,u=ua(l);return s.jsx(YS,{...u,...c,ref:i})},"TooltipArrow"));function vy(n,r){const i=Math.abs(r.top-n.y),l=Math.abs(r.bottom-n.y),c=Math.abs(r.right-n.x),u=Math.abs(r.left-n.x);switch(Math.min(i,l,c,u)){case u:return"left";case c:return"right";case i:return"top";case l:return"bottom";default:throw new Error("unreachable")}}et(vy,"getExitSideFromRect");function xy(n,r,i=5){const l=[];switch(r){case"top":l.push({x:n.x-i,y:n.y+i},{x:n.x+i,y:n.y+i});break;case"bottom":l.push({x:n.x-i,y:n.y-i},{x:n.x+i,y:n.y-i});break;case"left":l.push({x:n.x+i,y:n.y-i},{x:n.x+i,y:n.y+i});break;case"right":l.push({x:n.x-i,y:n.y-i},{x:n.x-i,y:n.y+i});break}return l}et(xy,"getPaddedExitPoints");function yy(n){const{top:r,right:i,bottom:l,left:c}=n;return[{x:c,y:r},{x:i,y:r},{x:i,y:l},{x:c,y:l}]}et(yy,"getPointsFromRect");function wy(n,r){const{x:i,y:l}=n;let c=!1;for(let u=0,f=r.length-1;ul!=b>l&&i<(x-g)*(l-y)/(b-y)+g&&(c=!c)}return c}et(wy,"isPointInPolygon");function by(n){const r=n.slice();return r.sort((i,l)=>i.xl.x?1:i.yl.y?1:0),ky(r)}et(by,"getHull");function ky(n){if(n.length<=1)return n.slice();const r=[];for(let l=0;l=2;){const u=r[r.length-1],f=r[r.length-2];if((u.x-f.x)*(c.y-f.y)>=(u.y-f.y)*(c.x-f.x))r.pop();else break}r.push(c)}r.pop();const i=[];for(let l=n.length-1;l>=0;l--){const c=n[l];for(;i.length>=2;){const u=i[i.length-1],f=i[i.length-2];if((u.x-f.x)*(c.y-f.y)>=(u.y-f.y)*(c.x-f.x))i.pop();else break}i.push(c)}return i.pop(),r.length===1&&i.length===1&&r[0].x===i[0].x&&r[0].y===i[0].y?r:r.concat(i)}et(ky,"getHullPresorted");function jy(...n){const r=new Set;for(const i of n)if(typeof i=="string")for(const l of String(i).trim().split(/\s+/))l&&r.add(l);return r.size>0?Array.from(r).join(" "):void 0}et(jy,"concatAriaDescribedby");const S_=Xl("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function ge({className:n,variant:r="default",size:i="default",asChild:l=!1,...c}){const u=l?sd:"button";return s.jsx(u,{"data-slot":"button","data-variant":r,"data-size":i,className:te(S_({variant:r,size:i,className:n})),...c})}function E_({...n}){return s.jsx(uC,{"data-slot":"alert-dialog",...n})}function __({...n}){return s.jsx(dC,{"data-slot":"alert-dialog-portal",...n})}function N_({className:n,...r}){return s.jsx(fC,{"data-slot":"alert-dialog-overlay",className:te("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",n),...r})}function R_({className:n,size:r="default",...i}){return s.jsxs(__,{children:[s.jsx(N_,{}),s.jsx(gC,{"data-slot":"alert-dialog-content","data-size":r,className:te("group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[size=default]:sm:max-w-lg",n),...i})]})}function P_({className:n,...r}){return s.jsx("div",{"data-slot":"alert-dialog-header",className:te("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",n),...r})}function D_({className:n,...r}){return s.jsx("div",{"data-slot":"alert-dialog-footer",className:te("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",n),...r})}function T_({className:n,...r}){return s.jsx(vC,{"data-slot":"alert-dialog-title",className:te("text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",n),...r})}function O_({className:n,...r}){return s.jsx(xC,{"data-slot":"alert-dialog-description",className:te("text-sm text-muted-foreground",n),...r})}function M_({className:n,variant:r="default",size:i="default",...l}){return s.jsx(ge,{variant:r,size:i,asChild:!0,children:s.jsx(yC,{"data-slot":"alert-dialog-action",className:te(n),...l})})}function A_({className:n,variant:r="outline",size:i="default",...l}){return s.jsx(ge,{variant:r,size:i,asChild:!0,children:s.jsx(bC,{"data-slot":"alert-dialog-cancel",className:te(n),...l})})}const I_=Xl("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function jn({className:n,variant:r="default",asChild:i=!1,...l}){const c=i?sd:"span";return s.jsx(c,{"data-slot":"badge","data-variant":r,className:te(I_({variant:r}),n),...l})}function Me({className:n,type:r,...i}){return s.jsx("input",{type:r,"data-slot":"input",className:te("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",n),...i})}function Cy({className:n,...r}){return s.jsx(s_,{"data-slot":"label",className:te("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",n),...r})}function Vn({className:n,...r}){return s.jsx("div",{"data-slot":"card",className:te("flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",n),...r})}function Bl({className:n,...r}){return s.jsx("div",{"data-slot":"card-header",className:te("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",n),...r})}function Qd({className:n,...r}){return s.jsx("div",{"data-slot":"card-title",className:te("leading-none font-semibold",n),...r})}function Yd({className:n,...r}){return s.jsx("div",{"data-slot":"card-description",className:te("text-sm text-muted-foreground",n),...r})}function to({className:n,...r}){return s.jsx("div",{"data-slot":"card-content",className:te("px-6",n),...r})}function L_({className:n,...r}){return s.jsx("div",{"data-slot":"card-footer",className:te("flex items-center px-6 [.border-t]:pt-6",n),...r})}function Sy({...n}){return s.jsx(kd,{"data-slot":"sheet",...n})}function z_({...n}){return s.jsx(jd,{"data-slot":"sheet-portal",...n})}function F_({className:n,...r}){return s.jsx(Cd,{"data-slot":"sheet-overlay",className:te("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",n),...r})}function Ey({className:n,children:r,side:i="right",showCloseButton:l=!0,...c}){return s.jsxs(z_,{children:[s.jsx(F_,{}),s.jsxs(Sd,{"data-slot":"sheet-content",className:te("fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500",i==="right"&&"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",i==="left"&&"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",i==="top"&&"inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",i==="bottom"&&"inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",n),...c,children:[r,l&&s.jsxs(es,{className:"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary",children:[s.jsx(lv,{className:"size-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function _y({className:n,...r}){return s.jsx("div",{"data-slot":"sheet-header",className:te("flex flex-col gap-1.5 p-4",n),...r})}function Ny({className:n,...r}){return s.jsx(Ed,{"data-slot":"sheet-title",className:te("font-semibold text-foreground",n),...r})}function Ry({className:n,...r}){return s.jsx(_d,{"data-slot":"sheet-description",className:te("text-sm text-muted-foreground",n),...r})}function rs({className:n,...r}){return s.jsx("textarea",{"data-slot":"textarea",className:te("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",n),...r})}const Py=m.createContext(()=>{}),St=()=>m.useContext(Py);function $_({children:n}){const[r,i]=m.useState(null),l=m.useRef(),c=m.useCallback((u,f=!1)=>{i(h=>({msg:u,err:f,n:((h==null?void 0:h.n)??0)+1})),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i(null),4e3)},[]);return s.jsxs(Py.Provider,{value:c,children:[n,s.jsx("div",{"aria-live":"polite",className:"pointer-events-none fixed right-4 bottom-4 left-4 z-50 flex justify-end sm:left-auto",children:r&&s.jsxs("div",{id:"toast",role:"status",className:te("pointer-events-auto flex max-w-md items-start gap-2 rounded-lg border bg-popover px-4 py-3 text-sm text-popover-foreground shadow-lg animate-in fade-in slide-in-from-bottom-2",r.err&&"border-destructive/40"),children:[r.err?s.jsx(d1,{className:"mt-0.5 size-4 shrink-0 text-destructive"}):s.jsx(u1,{className:"mt-0.5 size-4 shrink-0 text-success"}),s.jsx("span",{children:r.msg})]},r.n)})]})}const De=n=>n instanceof Error?n.message:String(n),Dy=m.createContext(async()=>!1),Zo=()=>m.useContext(Dy);function U_({children:n}){const[r,i]=m.useState(null),l=m.useRef(),c=m.useCallback(f=>(i(f),new Promise(h=>l.current=h)),[]),u=f=>{var h;(h=l.current)==null||h.call(l,f),i(null)};return s.jsxs(Dy.Provider,{value:c,children:[n,s.jsx(E_,{open:!!r,onOpenChange:f=>!f&&u(!1),children:s.jsxs(R_,{children:[s.jsxs(P_,{children:[s.jsx(T_,{children:r==null?void 0:r.title}),(r==null?void 0:r.description)&&s.jsx(O_,{children:r.description})]}),s.jsxs(D_,{children:[s.jsx(A_,{onClick:()=>u(!1),children:"Cancel"}),s.jsx(M_,{className:te((r==null?void 0:r.danger)&&"bg-destructive text-white hover:bg-destructive/90"),onClick:()=>u(!0),children:(r==null?void 0:r.action)??"Continue"})]})]})})]})}const Ty=m.createContext(null),ei=()=>m.useContext(Ty),Oy=m.createContext(()=>{}),qd=()=>m.useContext(Oy),Wl={hosts:"Multiple code hosts and bot identities",rules:"Group and pattern rules",learnings:"Team learnings",executors:"Docker and Kubernetes executors",budgets:"Token budgets",metrics:"Metrics and long history",audit:"Audit log",branch_sync:"Branch-sync skip",sso_rules:"SSO domain and group rules"};function ln(n){return ei().license.features.includes(n)}function da({feature:n,children:r}){return s.jsxs(Hi,{role:"note",className:"locked border-dashed border-primary/60",children:[s.jsx(Fg,{className:"text-primary"}),s.jsxs(kk,{className:"flex items-center gap-2",children:[Wl[n],s.jsx(jn,{variant:"secondary",children:"licensed"})]}),s.jsx(Gi,{children:s.jsxs("p",{children:[r??"This is part of the licensed Divmora console."," ",s.jsx(Ho,{className:"font-medium text-primary underline-offset-4 hover:underline",to:"/license",children:"Install a license"})," ","or contact"," ",s.jsx("a",{className:"font-medium text-primary underline-offset-4 hover:underline",href:"mailto:licensing@divmora.com",children:"licensing@divmora.com"}),"."]})})]})}function Tl({feature:n}){return ln(n)?null:s.jsxs("span",{className:"locknote block text-xs leading-snug text-warning",children:[s.jsx(Fg,{className:"mr-1 inline size-3 align-[-2px]"}),"Needs a license with ",Wl[n].toLowerCase()," ·"," ",s.jsx(Ho,{to:"/license",className:"underline underline-offset-2",children:"License"})]})}function ao({children:n,className:r}){return s.jsx(Vn,{className:te("gap-0 overflow-hidden py-0",r),children:n})}function Go({open:n,onClose:r,title:i,description:l,children:c,wide:u}){return s.jsx(Sy,{open:n,onOpenChange:f=>!f&&r(),children:s.jsxs(Ey,{className:te("w-full gap-0 overflow-y-auto sm:max-w-xl",u&&"sm:max-w-3xl"),children:[s.jsxs(_y,{className:"border-b pr-10",children:[s.jsx(Ny,{children:i}),l&&s.jsx(Ry,{children:l})]}),s.jsx("div",{className:"p-4",children:c})]})})}function no({children:n,className:r}){return s.jsx("div",{className:te("flex flex-wrap items-center gap-2",r),children:n})}function Jt({children:n,className:r}){return s.jsx("p",{className:te("max-w-4xl text-sm leading-relaxed text-muted-foreground",r),children:n})}function bt({children:n}){return s.jsx("div",{className:"px-4 py-10 text-center text-sm text-muted-foreground",children:n})}function Ce({label:n,children:r,hint:i,className:l}){return s.jsxs("div",{className:te("grid content-start gap-1.5",l),children:[s.jsx(Cy,{className:"text-xs font-medium text-muted-foreground",children:n}),r,i]})}function Xt({children:n,className:r}){return s.jsx("div",{className:te("grid gap-4 sm:grid-cols-2 lg:grid-cols-3",r),children:n})}function He({className:n,...r}){return s.jsx("select",{className:te("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none transition-[color,box-shadow] dark:bg-input/30","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50",n),...r})}const B_={on:"border-transparent bg-success-soft text-success",off:"border-transparent bg-danger-soft text-destructive",idle:"border-transparent bg-muted text-muted-foreground",warn:"border-transparent bg-warning-soft text-warning"};function yn({kind:n,children:r}){return s.jsx(jn,{className:te("state",n,B_[n]),children:r})}function Yu({items:n,empty:r}){return n.length?s.jsx("span",{className:"flex flex-wrap gap-1",children:n.map(i=>s.jsx(jn,{variant:"outline",className:"chip font-normal text-muted-foreground",children:i},i))}):s.jsx("span",{className:"text-sm text-muted-foreground",children:r??"defaults"})}function Qe({children:n,className:r}){return s.jsx("div",{className:te("mt-0.5 text-xs text-muted-foreground",r),children:n})}function My(n={}){const r=[];return n.profile&&r.push(n.profile),n.max_comments&&r.push("max "+n.max_comments),n.min_severity&&r.push("≥ "+n.min_severity),n.model&&r.push("model "+n.model),n.auto_review===!1&&r.push("auto review off"),n.auto_review===!0&&r.push("auto review on"),n.drafts===!0&&r.push("drafts"),n.instructions&&r.push("instructions"),r}function Vl({value:n,onChange:r,on:i,off:l,inherit:c="Inherit",label:u,disabled:f}){const h=n==null?"":String(n);return s.jsxs(He,{"aria-label":u,value:h,disabled:f,onChange:v=>r(v.target.value===""?null:v.target.value==="true"),children:[s.jsx("option",{value:"",children:c}),s.jsx("option",{value:"true",children:i}),s.jsx("option",{value:"false",children:l})]})}function Xd({value:n,onSave:r,onCancel:i,extra:l,inheritModel:c="Server default",saveLabel:u="Save settings",danger:f}){const h=ei(),v=n??{},[g,y]=m.useState(v.profile??""),[x,b]=m.useState(v.max_comments?String(v.max_comments):""),[j,k]=m.useState(v.min_severity??""),[S,C]=m.useState(v.model??""),[E,D]=m.useState(v.auto_review??null),[T,P]=m.useState(v.drafts??null),[R,N]=m.useState(v.instructions??""),I=()=>{const L={};g&&(L.profile=g),x&&(L.max_comments=parseInt(x,10)),j&&(L.min_severity=j),S&&(L.model=S),E!==null&&(L.auto_review=E),T!==null&&(L.drafts=T),R.trim()&&(L.instructions=R.trim()),r(L)};return s.jsxs("div",{className:"grid gap-5",children:[l,s.jsxs(Xt,{className:"lg:grid-cols-2",children:[s.jsx(Ce,{label:"Review profile",children:s.jsxs(He,{value:g,onChange:L=>y(L.target.value),children:[s.jsx("option",{value:"",children:"Inherit"}),s.jsx("option",{value:"chill",children:"Chill"}),s.jsx("option",{value:"balanced",children:"Balanced"}),s.jsx("option",{value:"assertive",children:"Assertive"})]})}),s.jsx(Ce,{label:"Max inline comments",children:s.jsx(Me,{type:"number",min:0,max:200,value:x,placeholder:"Inherit",onChange:L=>b(L.target.value)})}),s.jsx(Ce,{label:"Minimum severity",children:s.jsxs(He,{value:j,onChange:L=>k(L.target.value),children:[s.jsx("option",{value:"",children:"Inherit"}),s.jsx("option",{value:"critical",children:"Critical"}),s.jsx("option",{value:"major",children:"Major"}),s.jsx("option",{value:"minor",children:"Minor"}),s.jsx("option",{value:"nitpick",children:"Nitpick"})]})}),s.jsx(Ce,{label:"Model profile",children:s.jsxs(He,{value:S,onChange:L=>C(L.target.value),children:[s.jsx("option",{value:"",children:c}),h.profiles.map(L=>s.jsx("option",{value:L,children:L},L))]})}),s.jsx(Ce,{label:"Auto review on push",children:s.jsx(Vl,{value:E,onChange:D,on:"On",off:"Off"})}),s.jsx(Ce,{label:"Review draft PRs",children:s.jsx(Vl,{value:T,onChange:P,on:"On",off:"Off"})})]}),s.jsx(Ce,{label:"Extra review instructions",children:s.jsx(rs,{rows:4,maxLength:8e3,placeholder:"Appended to the repository's own instructions",value:R,onChange:L=>N(L.target.value)})}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(ge,{onClick:I,children:u}),i&&s.jsx(ge,{variant:"outline",onClick:i,children:"Cancel"}),s.jsx("span",{className:"flex-1"}),f]})]})}function W_({...n}){return s.jsx(KE,{"data-slot":"dropdown-menu",...n})}function V_({...n}){return s.jsx(YE,{"data-slot":"dropdown-menu-trigger",...n})}function H_({className:n,sideOffset:r=4,...i}){return s.jsx(qE,{children:s.jsx(JE,{"data-slot":"dropdown-menu-content",sideOffset:r,className:te("z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",n),...i})})}function G_({...n}){return s.jsx(e_,{"data-slot":"dropdown-menu-radio-group",...n})}function bu({className:n,children:r,...i}){return s.jsxs(t_,{"data-slot":"dropdown-menu-radio-item",className:te("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",n),...i,children:[s.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:s.jsx(n_,{children:s.jsx(Pg,{className:"size-2 fill-current"})})}),r]})}function K_({className:n,inset:r,...i}){return s.jsx(ZE,{"data-slot":"dropdown-menu-label","data-inset":r,className:te("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",n),...i})}function Q_({className:n,...r}){return s.jsx(r_,{"data-slot":"dropdown-menu-separator",className:te("-mx-1 my-1 h-px bg-border",n),...r})}function Jr({className:n,orientation:r="horizontal",decorative:i=!0,...l}){return s.jsx(c_,{"data-slot":"separator",decorative:i,orientation:r,className:te("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",n),...l})}const ku=768;function Y_(){const[n,r]=m.useState(void 0);return m.useEffect(()=>{const i=window.matchMedia(`(max-width: ${ku-1}px)`),l=()=>{r(window.innerWidthi.removeEventListener("change",l)},[]),!!n}function Ay({delayDuration:n=0,...r}){return s.jsx(h_,{"data-slot":"tooltip-provider",delayDuration:n,...r})}function q_({...n}){return s.jsx(g_,{"data-slot":"tooltip",...n})}function X_({...n}){return s.jsx(v_,{"data-slot":"tooltip-trigger",...n})}function J_({className:n,sideOffset:r=0,children:i,...l}){return s.jsx(w_,{children:s.jsxs(b_,{"data-slot":"tooltip-content",sideOffset:r,className:te("z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",n),...l,children:[i,s.jsx(C_,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}const Z_="sidebar_state",e2=3600*24*7,t2="16rem",n2="18rem",r2="3rem",o2="b",Iy=m.createContext(null);function os(){const n=m.useContext(Iy);if(!n)throw new Error("useSidebar must be used within a SidebarProvider.");return n}function i2({defaultOpen:n=!0,open:r,onOpenChange:i,className:l,style:c,children:u,...f}){const h=Y_(),[v,g]=m.useState(!1),[y,x]=m.useState(n),b=r??y,j=m.useCallback(E=>{const D=typeof E=="function"?E(b):E;i?i(D):x(D),document.cookie=`${Z_}=${D}; path=/; max-age=${e2}`},[i,b]),k=m.useCallback(()=>h?g(E=>!E):j(E=>!E),[h,j,g]);m.useEffect(()=>{const E=D=>{D.key===o2&&(D.metaKey||D.ctrlKey)&&(D.preventDefault(),k())};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[k]);const S=b?"expanded":"collapsed",C=m.useMemo(()=>({state:S,open:b,setOpen:j,isMobile:h,openMobile:v,setOpenMobile:g,toggleSidebar:k}),[S,b,j,h,v,g,k]);return s.jsx(Iy.Provider,{value:C,children:s.jsx(Ay,{delayDuration:0,children:s.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":t2,"--sidebar-width-icon":r2,...c},className:te("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",l),...f,children:u})})})}function s2({side:n="left",variant:r="sidebar",collapsible:i="offcanvas",className:l,children:c,...u}){const{isMobile:f,state:h,openMobile:v,setOpenMobile:g}=os();return i==="none"?s.jsx("div",{"data-slot":"sidebar",className:te("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",l),...u,children:c}):f?s.jsx(Sy,{open:v,onOpenChange:g,...u,children:s.jsxs(Ey,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":n2},side:n,children:[s.jsxs(_y,{className:"sr-only",children:[s.jsx(Ny,{children:"Sidebar"}),s.jsx(Ry,{children:"Displays the mobile sidebar."})]}),s.jsx("div",{className:"flex h-full w-full flex-col",children:c})]})}):s.jsxs("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":h,"data-collapsible":h==="collapsed"?i:"","data-variant":r,"data-side":n,"data-slot":"sidebar",children:[s.jsx("div",{"data-slot":"sidebar-gap",className:te("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",r==="floating"||r==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),s.jsx("div",{"data-slot":"sidebar-container",className:te("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",n==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",r==="floating"||r==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",l),...u,children:s.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm",children:c})})]})}function l2({className:n,onClick:r,...i}){const{toggleSidebar:l}=os();return s.jsxs(ge,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:te("size-7",n),onClick:c=>{r==null||r(c),l()},...i,children:[s.jsx(y1,{}),s.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function a2({className:n,...r}){const{toggleSidebar:i}=os();return s.jsx("button",{"data-sidebar":"rail","data-slot":"sidebar-rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:i,title:"Toggle Sidebar",className:te("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex","in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",n),...r})}function c2({className:n,...r}){return s.jsx("main",{"data-slot":"sidebar-inset",className:te("relative flex w-full flex-1 flex-col bg-background","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",n),...r})}function u2({className:n,...r}){return s.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:te("flex flex-col gap-2 p-2",n),...r})}function d2({className:n,...r}){return s.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:te("flex flex-col gap-2 p-2",n),...r})}function f2({className:n,...r}){return s.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:te("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",n),...r})}function p2({className:n,...r}){return s.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:te("relative flex w-full min-w-0 flex-col p-2",n),...r})}function h2({className:n,...r}){return s.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:te("w-full text-sm",n),...r})}function tg({className:n,...r}){return s.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:te("flex w-full min-w-0 flex-col gap-1",n),...r})}function ng({className:n,...r}){return s.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:te("group/menu-item relative",n),...r})}const m2=Xl("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function rg({asChild:n=!1,isActive:r=!1,variant:i="default",size:l="default",tooltip:c,className:u,...f}){const h=n?sd:"button",{isMobile:v,state:g}=os(),y=s.jsx(h,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":l,"data-active":r,className:te(m2({variant:i,size:l}),u),...f});return c?(typeof c=="string"&&(c={children:c}),s.jsxs(q_,{children:[s.jsx(X_,{asChild:!0,children:y}),s.jsx(J_,{side:"right",align:"center",hidden:g!=="collapsed"||v,...c})]})):y}function og({className:n,...r}){return s.jsx("div",{"data-slot":"sidebar-menu-badge","data-sidebar":"menu-badge",className:te("pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",n),...r})}function ro(n){if(!n||n.startsWith("0001-"))return"never";const r=Math.round((Date.now()-new Date(n).getTime())/1e3);return r<60?"just now":r<3600?Math.floor(r/60)+"m ago":r<86400?Math.floor(r/3600)+"h ago":Math.floor(r/86400)+"d ago"}function Tt(n){return n>=1e6?(n/1e6).toFixed(1)+"M":n>=1e4?Math.round(n/1e3)+"k":n>=1e3?(n/1e3).toFixed(1)+"k":String(n)}function ig(n){if(!n)return"—";const r=Math.round(n/1e3);return r<60?r+"s":Math.floor(r/60)+"m "+r%60+"s"}function sg(n){return new Date(n).toLocaleString()}function Jd({...n}){return s.jsx(kd,{"data-slot":"dialog",...n})}function g2({...n}){return s.jsx(jd,{"data-slot":"dialog-portal",...n})}function v2({className:n,...r}){return s.jsx(Cd,{"data-slot":"dialog-overlay",className:te("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",n),...r})}function Zd({className:n,children:r,showCloseButton:i=!0,...l}){return s.jsxs(g2,{"data-slot":"dialog-portal",children:[s.jsx(v2,{}),s.jsxs(Sd,{"data-slot":"dialog-content",className:te("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",n),...l,children:[r,i&&s.jsxs(es,{"data-slot":"dialog-close",className:"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[s.jsx(lv,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function ef({className:n,...r}){return s.jsx("div",{"data-slot":"dialog-header",className:te("flex flex-col gap-2 text-center sm:text-left",n),...r})}function tf({className:n,showCloseButton:r=!1,children:i,...l}){return s.jsxs("div",{"data-slot":"dialog-footer",className:te("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",n),...l,children:[i,r&&s.jsx(es,{asChild:!0,children:s.jsx(ge,{variant:"outline",children:"Close"})})]})}function nf({className:n,...r}){return s.jsx(Ed,{"data-slot":"dialog-title",className:te("text-lg leading-none font-semibold",n),...r})}function rf({className:n,...r}){return s.jsx(_d,{"data-slot":"dialog-description",className:te("text-sm text-muted-foreground",n),...r})}function co({className:n,...r}){return s.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:s.jsx("table",{"data-slot":"table",className:te("w-full caption-bottom text-sm",n),...r})})}function uo({className:n,...r}){return s.jsx("thead",{"data-slot":"table-header",className:te("[&_tr]:border-b",n),...r})}function fo({className:n,...r}){return s.jsx("tbody",{"data-slot":"table-body",className:te("[&_tr:last-child]:border-0",n),...r})}function Mt({className:n,...r}){return s.jsx("tr",{"data-slot":"table-row",className:te("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",n),...r})}function Se({className:n,...r}){return s.jsx("th",{"data-slot":"table-head",className:te("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",n),...r})}function Ee({className:n,...r}){return s.jsx("td",{"data-slot":"table-cell",className:te("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",n),...r})}function x2(n){return n.source==="repository"?"set on this repository":n.source==="allowlist"?"no rule matches · allowlist default":n.source==="default"?"no rule matches · reviewed by default":"by "+n.source}function y2(){const n=ei(),r=St(),i=Zo(),[l,c]=m.useState(null),[u,f]=m.useState(""),[h,v]=m.useState("all"),[g,y]=m.useState(null),[x,b]=m.useState(!1),[j,k]=m.useState({platform:"github",host:"",path:"",mode:"enabled"}),S=()=>Ct("/admin/api/repos").then(c).catch(N=>r(De(N),!0));m.useEffect(()=>{S()},[]);const C=(N,I,L)=>oo("/admin/api/repos/"+N.id,{mode:I,settings:L}).then(Q=>(c(ee=>(ee||[]).map(J=>J.id===Q.id?Q:J)),r(Q.path+": reviews "+(Q.effective.enabled?"on":"off")+" ("+Q.effective.source+")"),Q)),E=()=>Fn("/admin/api/repos",{...j,host:j.host.trim(),path:j.path.trim()}).then(N=>{c(I=>(I||[]).filter(L=>L.id!==N.id).concat([N])),k({...j,path:""}),b(!1),r("Added "+N.path)}).catch(N=>r(De(N),!0)),D=async N=>{await i({title:"Remove "+N.path+"?",description:"It reappears, set to Inherit, if it sends another webhook.",action:"Remove",danger:!0})&&Ji("/admin/api/repos/"+N.id).then(()=>{c(I=>(I||[]).filter(L=>L.id!==N.id)),y(null),r("Removed "+N.path)}).catch(I=>r(De(I),!0))},T=(l||[]).filter(N=>h==="on"&&!N.effective.enabled||h==="off"&&N.effective.enabled?!1:!u||(N.host+"/"+N.path).toLowerCase().includes(u.toLowerCase())),P=(l||[]).filter(N=>N.effective.enabled).length,R=(l==null?void 0:l.find(N=>N.id===g))??null;return s.jsxs("section",{className:"grid gap-4",children:[s.jsxs(no,{children:[s.jsxs("div",{className:"relative w-full sm:w-64",children:[s.jsx(Yl,{className:"pointer-events-none absolute top-2.5 left-2.5 size-4 text-muted-foreground"}),s.jsx(Me,{type:"search",className:"pl-8",placeholder:"Filter repositories","aria-label":"Filter repositories",value:u,onChange:N=>f(N.target.value)})]}),s.jsxs(He,{className:"w-auto","aria-label":"Show",value:h,onChange:N=>v(N.target.value),children:[s.jsx("option",{value:"all",children:"All"}),s.jsx("option",{value:"on",children:"Reviewed"}),s.jsx("option",{value:"off",children:"Not reviewed"})]}),s.jsx("span",{className:"text-sm text-muted-foreground",children:l&&P+" reviewed · "+(l.length-P)+" not reviewed"}),s.jsx("span",{className:"flex-1"}),s.jsxs(ge,{variant:"outline",onClick:()=>b(!0),children:[s.jsx(Xi,{})," Add repository"]})]}),s.jsx(ao,{children:l?T.length?s.jsxs(co,{children:[s.jsx(uo,{children:s.jsxs(Mt,{children:[s.jsx(Se,{className:"pl-4",children:"Reviews"}),s.jsx(Se,{children:"Repository"}),s.jsx(Se,{children:"Last webhook"}),s.jsx(Se,{children:"Effective settings"}),s.jsx(Se,{children:"Last changed"}),s.jsx(Se,{})]})}),s.jsx(fo,{children:T.map(N=>{const I=N.effective,L=[I.require_reviewer&&"reviewer required",I.skip_branch_sync&&"skips branch syncs",I.score_labels&&"score labels",I.commit_status&&"commit status"].filter(Boolean);return s.jsxs(Mt,{children:[s.jsxs(Ee,{className:"w-44 pl-4 align-top whitespace-normal",children:[s.jsxs(He,{"aria-label":"Reviews for "+N.path,value:N.mode,onChange:Q=>C(N,Q.target.value,N.settings||{}).catch(ee=>r(De(ee),!0)),children:[s.jsx("option",{value:"inherit",children:"Inherit"}),s.jsx("option",{value:"enabled",children:"Enabled"}),s.jsx("option",{value:"disabled",children:"Disabled"})]}),s.jsx("div",{className:"mt-1.5",children:s.jsx(yn,{kind:I.enabled?"on":"off",children:I.enabled?"Reviewed":"Not reviewed"})}),s.jsx(Qe,{children:x2(I)}),L.length>0&&s.jsx(Qe,{children:L.join(" · ")})]}),s.jsxs(Ee,{className:"align-top",children:[s.jsx("div",{className:"font-medium",children:N.path}),s.jsxs(Qe,{children:[N.platform," · ",N.host]})]}),s.jsx(Ee,{className:"align-top text-muted-foreground",children:ro(N.last_seen)}),s.jsxs(Ee,{className:"align-top whitespace-normal",children:[s.jsx(Yu,{items:My(I.settings)}),(I.rules||[]).length>0&&JSON.stringify(I.settings)!==JSON.stringify(N.settings||{})&&s.jsx(Qe,{children:"includes rule settings"})]}),s.jsx(Ee,{className:"align-top text-muted-foreground",children:N.updated_by?N.updated_by+" · "+ro(N.updated_at):"—"}),s.jsx(Ee,{className:"pr-4 text-right align-top",children:s.jsxs(ge,{variant:"ghost",size:"sm",onClick:()=>y(N.id),children:[s.jsx(S1,{})," Settings"]})})]},N.id)})})]}):s.jsx(bt,{children:l.length?"No repositories match.":"No repositories yet. They appear when they send their first webhook, or add one above."}):s.jsx(bt,{children:"Loading…"})}),s.jsxs(Jt,{children:["Repositories appear here automatically when they send their first webhook, set to ",s.jsx("b",{children:"Inherit"}),": they follow the most specific group or pattern rule, and otherwise the default (",n.allowlist?"not reviewed, because the allowlist is on":"reviewed, because the allowlist is off","). Choosing Enabled or Disabled here overrides every rule. Settings here override the rules' settings and the repository's own ",s.jsx("code",{children:".codereview.yaml"}),"."]}),n.require_reviewer&&s.jsxs(Jt,{children:[s.jsx("b",{children:"Reviewer required:"})," even in an enabled repository, a merge request is reviewed only when the bot user is one of its reviewers. Adding the bot as a reviewer starts a review; ",s.jsx("code",{children:"@bot review"})," comments still work."]}),s.jsx(Go,{open:!!R,onClose:()=>y(null),title:(R==null?void 0:R.path)??"",description:R?`${R.platform} · ${R.host} · review settings for this repository`:void 0,children:R&&s.jsx(Xd,{value:R.settings,onSave:N=>C(R,R.mode,N).then(()=>y(null)).catch(I=>r(De(I),!0)),onCancel:()=>y(null),danger:s.jsx(ge,{variant:"ghost",className:"text-destructive hover:text-destructive",onClick:()=>D(R),children:"Remove"})},R.id)}),s.jsx(Jd,{open:x,onOpenChange:b,children:s.jsxs(Zd,{className:"sm:max-w-lg",children:[s.jsxs(ef,{children:[s.jsx(nf,{children:"Add repository"}),s.jsx(rf,{children:"Repositories also appear by themselves when they send their first webhook."})]}),s.jsxs(Xt,{className:"lg:grid-cols-2",children:[s.jsx(Ce,{label:"Platform",children:s.jsxs(He,{value:j.platform,onChange:N=>k({...j,platform:N.target.value}),children:[s.jsx("option",{value:"github",children:"GitHub"}),s.jsx("option",{value:"gitlab",children:"GitLab"})]})}),s.jsx(Ce,{label:"Host",children:s.jsx(Me,{placeholder:"github.com",value:j.host,onChange:N=>k({...j,host:N.target.value})})}),s.jsx(Ce,{label:"Repository path",className:"sm:col-span-2",children:s.jsx(Me,{placeholder:"owner/repo or group/sub/project",value:j.path,onChange:N=>k({...j,path:N.target.value})})}),s.jsx(Ce,{label:"Reviews",children:s.jsxs(He,{value:j.mode,onChange:N=>k({...j,mode:N.target.value}),children:[s.jsx("option",{value:"enabled",children:"Enabled"}),s.jsx("option",{value:"disabled",children:"Disabled"}),s.jsx("option",{value:"inherit",children:"Inherit from rules"})]})})]}),s.jsxs(tf,{children:[s.jsx(ge,{variant:"outline",onClick:()=>b(!1),children:"Cancel"}),s.jsx(ge,{onClick:E,children:"Add"})]})]})})]})}const qu=[["done","Reviewed","--st-done"],["skipped","Skipped","--st-skip"],["failed","Failed","--st-fail"]];function lg(n,r,i=!1){const l=new Date(n);return r==="hour"?i?l.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):l.toLocaleTimeString([],{hour:"2-digit"}):r==="month"?l.toLocaleDateString([],{month:"short",year:i?"numeric":"2-digit"}):l.toLocaleDateString([],{month:"short",day:"numeric"})}const br=(n,r)=>typeof n[r]=="number"?n[r]:0;function w2({points:n,granularity:r}){const i=m.useRef(null),[l,c]=m.useState(900),[u,f]=m.useState(null);m.useEffect(()=>{const N=i.current;if(!N)return;const I=new ResizeObserver(()=>c(Math.max(320,N.clientWidth||900)));return I.observe(N),()=>I.disconnect()},[]);const h=l,v=200,g=34,y=8,x=8,b=24;let j=0;n.forEach(N=>j=Math.max(j,br(N,"done")+br(N,"skipped")+br(N,"failed")));const k=j<=4?4:Math.pow(10,Math.floor(Math.log10(j))),S=Math.ceil(j/k)*k||4,C=(h-g-y)/Math.max(1,n.length),E=Math.min(24,Math.max(2,C*.7)),D=N=>x+(v-x-b)*(1-N/S),T=Math.ceil(n.length/Math.max(2,Math.floor((h-g-y)/70))),P=u!==null?n[u]:null,R=u!==null?Math.min(h-170,Math.max(0,g+C*u+C/2+12)):0;return s.jsxs("div",{className:"chart relative w-full",ref:i,children:[s.jsxs("svg",{className:"block h-auto w-full",viewBox:`0 0 ${h} ${v}`,role:"img","aria-label":`Jobs per ${r}: reviewed, skipped and failed`,children:[n.map((N,I)=>s.jsx("rect",{x:g+C*I,y:x,width:C,height:v-x-b,fill:u===I?"var(--muted)":"transparent",fillOpacity:.5,tabIndex:0,onMouseEnter:()=>f(I),onMouseLeave:()=>f(null),onFocus:()=>f(I),onBlur:()=>f(null)},"h"+I)),[0,S/2,S].map(N=>s.jsxs("g",{pointerEvents:"none",children:[s.jsx("line",{x1:g,x2:h-y,y1:D(N),y2:D(N),stroke:"var(--grid)",strokeWidth:1}),s.jsx("text",{x:g-6,y:D(N)+4,textAnchor:"end",fontSize:11,fill:"var(--muted-foreground)",children:Tt(N)})]},"g"+N)),n.map((N,I)=>{const L=g+C*I+(C-E)/2,Q=qu.map(([J,,ne])=>[br(N,J),ne]).filter(([J])=>J>0);let ee=0;return s.jsxs("g",{pointerEvents:"none",children:[Q.map(([J,ne],de)=>{let re=D(ee+J);const ie=D(ee)-(de>0?2:0);ie-re<1&&(re=ie-1);const B=de===Q.length-1?Math.min(4,E/2,ie-re):0;ee+=J;const Z=`M${L},${ie}V${re+B}Q${L},${re} ${L+B},${re}H${L+E-B}Q${L+E},${re} ${L+E},${re+B}V${ie}Z`;return s.jsx("path",{d:Z,fill:`var(${ne})`},de)}),I%T===0&&s.jsx("text",{x:g+C*I+C/2,y:v-b+16,textAnchor:"middle",fontSize:11,fill:"var(--muted-foreground)",children:lg(N.bucket,r)})]},"b"+I)}),s.jsx("line",{x1:g,x2:h-y,y1:v-b,y2:v-b,stroke:"var(--grid)",strokeWidth:1,pointerEvents:"none"})]}),s.jsx("div",{className:"tip pointer-events-none absolute z-10 w-40 rounded-md border bg-popover p-2.5 text-xs text-popover-foreground shadow-md [&>div]:flex [&>div]:justify-between [&>div]:gap-3 [&>div>span:first-child]:text-muted-foreground "+(P?"show block":"hidden"),id:"mTip",ref:N=>N&&(N.style.left=R+"px",N.style.top="28px"),children:P&&s.jsxs(s.Fragment,{children:[s.jsx("b",{className:"mb-1 block font-semibold",children:lg(P.bucket,r,!0)}),qu.map(([N,I])=>s.jsxs("div",{children:[s.jsx("span",{children:I}),s.jsx("span",{children:br(P,N)})]},N)),s.jsxs("div",{children:[s.jsx("span",{children:"Comments"}),s.jsx("span",{children:br(P,"comments")})]}),s.jsxs("div",{children:[s.jsx("span",{children:"Tokens"}),s.jsx("span",{children:Tt(br(P,"tokens_in")+br(P,"tokens_out"))})]})]})})]})}function b2({className:n,...r}){return s.jsx(RC,{"data-slot":"checkbox",className:te("peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary",n),...r,children:s.jsx(DC,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:s.jsx(Ql,{className:"size-3.5"})})})}function k2(n){const r=[],i={};n.points.forEach(h=>i[new Date(h.bucket).toISOString()]=h);const l=new Date(n.to),c=new Date(n.from);if(n.granularity==="month"){let h=new Date(Date.UTC(c.getUTCFullYear(),c.getUTCMonth(),1));for(;h{Ct("/admin/api/reviews/"+n.id).then(c).catch(h=>i(De(h),!0))},[n.id]),!l)return s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading…"});let u=null;try{u=l.result?typeof l.result=="string"?JSON.parse(l.result):l.result:null}catch{u=null}const f=u==null?void 0:u.verification;return s.jsxs("div",{className:"grid gap-5 text-sm",children:[l.error&&s.jsxs("div",{className:"rounded-md border border-destructive/40 bg-danger-soft p-3",children:[s.jsx("div",{className:"mb-1 font-medium text-destructive",children:"Error"}),s.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap text-destructive",children:l.error})]}),u?s.jsxs(s.Fragment,{children:[u.summary&&s.jsxs("div",{children:[s.jsx("h3",{className:"mb-1 font-semibold",children:"Summary"}),s.jsx("p",{className:"leading-relaxed text-muted-foreground",children:u.summary})]}),u.scores&&s.jsx("div",{className:"grid grid-cols-3 gap-2",children:["quality","security","maintainability"].map(h=>s.jsxs("div",{className:"rounded-md border p-2.5",children:[s.jsx("div",{className:"text-lg font-semibold",children:u.scores[h]}),s.jsx("div",{className:"text-xs text-muted-foreground capitalize",children:h})]},h))}),s.jsxs("div",{children:[s.jsx("h3",{className:"mb-2 font-semibold",children:(u.findings||[]).length?`Findings (${u.findings.length})`:"No findings"}),s.jsx("div",{className:"grid gap-2",children:(u.findings||[]).map((h,v)=>s.jsxs("div",{className:"finding rounded-md border p-3",children:[s.jsx("div",{className:"font-medium",children:(h.kind==="question"?"❓ ":"")+h.title}),s.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:[s.jsx(yn,{kind:j2[h.severity]??"idle",children:h.severity}),s.jsx(jn,{variant:"outline",className:"font-normal",children:h.category}),s.jsxs("span",{className:"font-mono",children:[h.path,":",h.end_line]})]})]},v))})]}),(f==null?void 0:f.ran)&&s.jsxs("p",{className:"text-muted-foreground",children:["Verification (",f.model,"): ",f.confirmed||0," confirmed · ",f.false_positives||0," removed · ",f.questions||0," questions"]}),((f==null?void 0:f.removed)||[]).length>0&&s.jsx("div",{className:"grid gap-1.5",children:f.removed.map((h,v)=>s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Removed: ",s.jsx("span",{className:"text-foreground",children:h.title})," — ",h.reason]},"r"+v))})]}):!l.error&&s.jsx("p",{className:"text-muted-foreground",children:l.note||"No review result stored for this job."}),s.jsx(Jr,{}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Model ",l.model||"—"," · ",l.comments," comments · ",l.files," files"]}),n.kind.includes("review")&&s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(ge,{variant:"outline",onClick:()=>r(!1),children:"Re-run (new changes)"}),s.jsx(ge,{variant:"outline",onClick:()=>r(!0),children:"Re-run full review"})]})]})}function S2(){const n=St(),[r,i]=m.useState("day"),[l,c]=m.useState(null),[u,f]=m.useState([]),[h,v]=m.useState({host:"",repo:"",state:"",kind:"",trigger:"",from:"",to:""}),[g,y]=m.useState(""),[x,b]=m.useState(null),[j,k]=m.useState(!1),[S,C]=m.useState(null),[E,D]=m.useState(""),[T,P]=m.useState(!1);m.useEffect(()=>{Ct("/admin/api/hosts").then(B=>f(B.hosts||[])).catch(()=>{})},[]);const R=ln("metrics"),N=ei();m.useEffect(()=>{R&&Ct("/admin/api/metrics"+Pu({granularity:r,host:h.host})).then(c).catch(B=>n(De(B),!0))},[r,h.host,R]),m.useEffect(()=>{const B=window.setTimeout(()=>v(Z=>({...Z,repo:g.trim()})),300);return()=>window.clearTimeout(B)},[g]);const I=B=>Ct("/admin/api/reviews"+Pu({limit:100,...h,before:B})).then(Z=>{b(W=>B?(W||[]).concat(Z.reviews):Z.reviews),k(Z.reviews.length>=100)}).catch(Z=>n(De(Z),!0));m.useEffect(()=>{I()},[h]);const L=()=>{if(!E.trim())return n("Paste a pull request or merge request URL",!0);Fn("/admin/api/reviews",{url:E.trim(),full:T}).then(B=>{D(""),n("Queued "+B.pr+" — it appears here when it finishes")}).catch(B=>n(De(B),!0))},Q=(B,Z)=>Fn(`/admin/api/reviews/${B.id}/rerun`,{full:Z}).then(W=>n("Queued "+W.pr)).catch(W=>n(De(W),!0)),ee=l?k2(l):[],J={jobs:0,done:0,skipped:0,failed:0,comments:0,tokens_in:0,tokens_out:0,duration_ms:0};ee.forEach(B=>Object.keys(J).forEach(Z=>J[Z]+=B[Z]||0));const ne=J.done+J.failed,de=[["Jobs",Tt(J.jobs)],["Reviewed",Tt(J.done)],["Skipped",Tt(J.skipped)],["Failed",Tt(J.failed)+(ne?" · "+Math.round(100*J.failed/ne)+"%":"")],["Comments posted",Tt(J.comments)],["Tokens in / out",Tt(J.tokens_in)+" / "+Tt(J.tokens_out)],["Avg time",ig(ne?J.duration_ms/Math.max(1,J.jobs):0)],["Tokens today (UTC)",Tt((l==null?void 0:l.today_tokens)||0)+(l!=null&&l.daily_token_budget?" of "+Tt(l.daily_token_budget):"")]],re=B=>Z=>v({...h,[B]:Z.target.value}),ie=(x==null?void 0:x.find(B=>B.id===S))??null;return s.jsxs("section",{className:"grid gap-4",children:[s.jsxs(no,{children:[R&&s.jsxs(He,{className:"w-auto","aria-label":"Period",value:r,onChange:B=>i(B.target.value),children:[s.jsx("option",{value:"hour",children:"Last 48 hours"}),s.jsx("option",{value:"day",children:"Last 30 days"}),s.jsx("option",{value:"month",children:"Last 12 months"})]}),s.jsx("span",{className:"flex-1"}),s.jsx(Me,{type:"url",className:"rn-url w-full sm:w-80",placeholder:"Paste a PR/MR URL to review it now","aria-label":"Pull request URL",value:E,onChange:B=>D(B.target.value),onKeyDown:B=>B.key==="Enter"&&L()}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(b2,{id:"rnFull",checked:T,onCheckedChange:B=>P(B===!0)}),s.jsx(Cy,{htmlFor:"rnFull",className:"text-sm font-normal text-muted-foreground",children:"Full"})]}),s.jsxs(ge,{onClick:L,children:[s.jsx(w1,{})," Review now"]})]}),!R&&s.jsxs(da,{feature:"metrics",children:["Totals, charts and token use, and history kept longer than ",N.free_retention_days," days, are part of the licensed console. Every review is listed below."]}),R&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"tiles grid grid-cols-2 gap-3 md:grid-cols-4",children:de.map(([B,Z])=>s.jsx(Vn,{className:"tile gap-1 py-4",children:s.jsxs(to,{className:"px-4",children:[s.jsx("div",{className:"text-xl font-semibold tabular-nums",children:Z}),s.jsx("div",{className:"text-xs text-muted-foreground",children:B})]})},B))}),s.jsx(Vn,{className:"py-4",children:s.jsxs(to,{className:"grid gap-3 px-4",children:[s.jsx("div",{className:"flex flex-wrap gap-4 text-xs text-muted-foreground",children:qu.map(([B,Z,W])=>s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"size-2.5 rounded-sm",ref:q=>q==null?void 0:q.style.setProperty("background",`var(${W})`)}),Z," ",Tt(J[B]||0)]},B))}),l&&s.jsx(w2,{points:ee,granularity:l.granularity})]})})]}),s.jsxs(no,{children:[s.jsxs(He,{className:"w-auto","aria-label":"Host",value:h.host,onChange:re("host"),children:[s.jsx("option",{value:"",children:"All hosts"}),u.map(B=>s.jsx("option",{value:B.host,children:B.name},B.host))]}),s.jsxs("div",{className:"relative w-full sm:w-52",children:[s.jsx(Yl,{className:"pointer-events-none absolute top-2.5 left-2.5 size-4 text-muted-foreground"}),s.jsx(Me,{type:"search",className:"pl-8",placeholder:"Repository","aria-label":"Repository",value:g,onChange:B=>y(B.target.value)})]}),s.jsxs(He,{className:"w-auto","aria-label":"State",value:h.state,onChange:re("state"),children:[s.jsx("option",{value:"",children:"Any state"}),s.jsx("option",{value:"done",children:"Done"}),s.jsx("option",{value:"skipped",children:"Skipped"}),s.jsx("option",{value:"failed",children:"Failed"})]}),s.jsxs(He,{className:"w-auto","aria-label":"Kind",value:h.kind,onChange:re("kind"),children:[s.jsx("option",{value:"",children:"Any kind"}),s.jsx("option",{value:"review",children:"Review"}),s.jsx("option",{value:"full review",children:"Full review"}),s.jsx("option",{value:"answer",children:"Answer"}),s.jsx("option",{value:"help",children:"Help"}),s.jsx("option",{value:"learn",children:"Learn"}),s.jsx("option",{value:"remember",children:"Remember"})]}),s.jsxs(He,{className:"w-auto","aria-label":"Trigger",value:h.trigger,onChange:re("trigger"),children:[s.jsx("option",{value:"",children:"Any trigger"}),s.jsx("option",{value:"push",children:"Push"}),s.jsx("option",{value:"command",children:"Command"}),s.jsx("option",{value:"reply",children:"Reply"}),s.jsx("option",{value:"ui",children:"Admin panel"})]}),s.jsx(Me,{type:"date",className:"w-auto","aria-label":"From",value:h.from,onChange:re("from")}),s.jsx(Me,{type:"date",className:"w-auto","aria-label":"To",value:h.to,onChange:re("to")})]}),s.jsx(ao,{children:x?x.length?s.jsxs(co,{children:[s.jsx(uo,{children:s.jsxs(Mt,{children:[s.jsx(Se,{className:"pl-4",children:"Finished"}),s.jsx(Se,{children:"Pull request"}),s.jsx(Se,{children:"Job"}),s.jsx(Se,{children:"State"}),s.jsx(Se,{className:"text-right",children:"Comments / files"}),s.jsx(Se,{className:"text-right",children:"Tokens in / out"}),s.jsx(Se,{className:"text-right",children:"Took"}),s.jsx(Se,{})]})}),s.jsx(fo,{children:x.map(B=>{const Z=B.started&&!B.started.startsWith("0001-")?new Date(B.finished).getTime()-new Date(B.started).getTime():0;return s.jsxs(Mt,{className:"cursor-pointer",onClick:()=>C(B.id),children:[s.jsx(Ee,{className:"pl-4 text-muted-foreground",title:new Date(B.finished).toLocaleString(),children:ro(B.finished)}),s.jsxs(Ee,{children:[s.jsx("div",{className:"font-medium",children:B.url?s.jsxs("a",{className:"inline-flex items-center gap-1 hover:underline",href:B.url,target:"_blank",rel:"noopener noreferrer",onClick:W=>W.stopPropagation(),children:[B.repo," #",B.number," ",s.jsx(Og,{className:"size-3 text-muted-foreground"})]}):`${B.repo} #${B.number}`}),s.jsxs(Qe,{children:[B.platform," · ",B.host]})]}),s.jsxs(Ee,{children:[s.jsx("div",{children:B.kind}),s.jsx(Qe,{children:B.trigger+(B.requested_by?" · "+B.requested_by:"")})]}),s.jsxs(Ee,{className:"max-w-64 whitespace-normal",children:[s.jsx(yn,{kind:B.state==="done"?"on":B.state==="failed"?"off":"idle",children:B.state}),(B.error||B.note)&&s.jsx(Qe,{className:"line-clamp-2",children:B.error?B.error.slice(0,120):B.note})]}),s.jsxs(Ee,{className:"text-right tabular-nums",children:[B.comments," / ",B.files]}),s.jsxs(Ee,{className:"text-right text-muted-foreground tabular-nums",children:[Tt(B.tokens_in)," / ",Tt(B.tokens_out)]}),s.jsx(Ee,{className:"text-right text-muted-foreground tabular-nums",children:ig(Z)}),s.jsx(Ee,{className:"pr-4 text-right",children:s.jsx(ge,{variant:"ghost",size:"sm",onClick:W=>(W.stopPropagation(),C(B.id)),children:"Details"})})]},B.id)})})]}):s.jsx(bt,{children:"No reviews match."}):s.jsx(bt,{children:"Loading…"})}),j&&s.jsx("div",{children:s.jsx(ge,{variant:"outline",onClick:()=>x&&I(x[x.length-1].id),children:"Load older"})}),s.jsx(Jt,{children:"Every finished review, answer, help and learning job. Charts read hourly, daily and monthly rollups that are updated as each job finishes. Reviews are kept for the retention set in Settings; hourly detail for 3 days, daily and monthly totals for good."}),s.jsx(Go,{wide:!0,open:!!ie,onClose:()=>C(null),title:ie?`${ie.repo} #${ie.number}`:"",description:ie?`${ie.kind} · ${ie.trigger} · ${ie.state} · ${ro(ie.finished)}`:void 0,children:ie&&s.jsx(C2,{job:ie,onRerun:B=>Q(ie,B)},ie.id)})]})}const E2={reply:"from a reply",command:"@bot remember",manual:"added here"};function _2({l:n,onSave:r,onCancel:i,onDelete:l}){const[c,u]=m.useState(n.scope),[f,h]=m.useState(n.path),[v,g]=m.useState(n.text);return s.jsxs("div",{className:"grid gap-4",children:[s.jsx(Ce,{label:"Applies to",children:s.jsx(Me,{value:c,placeholder:"empty = whole host · group · group/repo",onChange:y=>u(y.target.value)})}),s.jsx(Ce,{label:"Only files matching",children:s.jsx(Me,{value:f,placeholder:"optional glob",onChange:y=>h(y.target.value)})}),s.jsx(Ce,{label:"Learning",children:s.jsx(rs,{rows:5,maxLength:600,value:v,onChange:y=>g(y.target.value)})}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(ge,{onClick:()=>r({scope:c.trim(),path:f.trim(),text:v.trim()}),children:"Save"}),s.jsx(ge,{variant:"outline",onClick:i,children:"Cancel"}),s.jsx("span",{className:"flex-1"}),s.jsx(ge,{variant:"ghost",className:"text-destructive hover:text-destructive",onClick:l,children:"Delete"})]})]})}function N2(){const n=St(),r=Zo(),i=ln("learnings"),[l,c]=m.useState(null),[u,f]=m.useState(""),[h,v]=m.useState(""),[g,y]=m.useState(null),[x,b]=m.useState(!1),[j,k]=m.useState({platform:"gitlab",host:"",scope:"",path:"",text:""});m.useEffect(()=>{Ct("/admin/api/learnings").then(R=>c(R.learnings||[])).catch(R=>n(De(R),!0))},[]);const S=(R,N)=>oo("/admin/api/learnings/"+R.id,{scope:R.scope,text:R.text,path:R.path,status:R.status,...N}).then(I=>(c(L=>(L||[]).map(Q=>Q.id===I.id?I:Q)),I)),C=()=>Fn("/admin/api/learnings",j).then(R=>{c(N=>(N||[]).concat([R])),k({...j,text:""}),b(!1),n("Learning added")}).catch(R=>n(De(R),!0)),E=async R=>{await r({title:"Delete this learning?",description:R.text,action:"Delete",danger:!0})&&Ji("/admin/api/learnings/"+R.id).then(()=>{c(N=>(N||[]).filter(I=>I.id!==R.id)),y(null),n("Deleted")}).catch(N=>n(De(N),!0))},D={active:0,pending:0,disabled:0};(l||[]).forEach(R=>D[R.status]+=1);const T=(l||[]).filter(R=>(!h||R.status===h)&&(!u||(R.text+" "+R.scope+" "+R.host+" "+R.path).toLowerCase().includes(u.toLowerCase()))),P=(l==null?void 0:l.find(R=>R.id===g))??null;return s.jsxs("section",{className:"grid gap-4",children:[!i&&s.jsxs(da,{feature:"learnings",children:["Capturing team decisions from review replies, ",s.jsx("code",{children:"@bot remember"}),", and applying them to reviews are part of the licensed console. Without a license nothing new is learned and existing learnings are not applied."]}),s.jsxs(no,{children:[s.jsxs("div",{className:"relative w-full sm:w-64",children:[s.jsx(Yl,{className:"pointer-events-none absolute top-2.5 left-2.5 size-4 text-muted-foreground"}),s.jsx(Me,{type:"search",className:"pl-8",placeholder:"Search learnings","aria-label":"Search learnings",value:u,onChange:R=>f(R.target.value)})]}),s.jsxs(He,{className:"w-auto","aria-label":"Status",value:h,onChange:R=>v(R.target.value),children:[s.jsx("option",{value:"",children:"Any status"}),s.jsx("option",{value:"active",children:"Active"}),s.jsx("option",{value:"pending",children:"Waiting for approval"}),s.jsx("option",{value:"disabled",children:"Disabled"})]}),s.jsx("span",{className:"text-sm text-muted-foreground",children:l&&`${D.active} active · ${D.pending} waiting · ${D.disabled} disabled`}),s.jsx("span",{className:"flex-1"}),i&&s.jsxs(ge,{variant:"outline",onClick:()=>b(!0),children:[s.jsx(Xi,{})," Add learning"]})]}),s.jsx(ao,{children:l?T.length?s.jsxs(co,{children:[s.jsx(uo,{children:s.jsxs(Mt,{children:[s.jsx(Se,{className:"pl-4",children:"Applies to"}),s.jsx(Se,{children:"Learning"}),s.jsx(Se,{children:"Status"}),s.jsx(Se,{children:"Source"}),s.jsx(Se,{})]})}),s.jsx(fo,{children:T.map(R=>s.jsxs(Mt,{children:[s.jsxs(Ee,{className:"pl-4 align-top",children:[s.jsx("div",{children:R.scope?s.jsx("code",{children:R.scope}):s.jsx("b",{children:"Whole host"})}),s.jsxs(Qe,{children:[R.platform," · ",R.host]})]}),s.jsxs(Ee,{className:"min-w-64 align-top whitespace-normal",children:[s.jsx("div",{children:R.text}),R.path&&s.jsxs(jn,{variant:"outline",className:"mt-1 font-normal text-muted-foreground",children:["files: ",R.path]})]}),s.jsx(Ee,{className:"w-36 align-top",children:s.jsxs(He,{"aria-label":"Status",value:R.status,disabled:!i,onChange:N=>S(R,{status:N.target.value}).then(I=>n("Learning "+I.status)).catch(I=>n(De(I),!0)),children:[s.jsx("option",{value:"active",children:"Active"}),s.jsx("option",{value:"pending",children:"Waiting"}),s.jsx("option",{value:"disabled",children:"Disabled"})]})}),s.jsxs(Ee,{className:"align-top text-muted-foreground",children:[s.jsx("div",{children:(E2[R.source]||R.source)+(R.source_author?" · "+R.source_author:"")}),R.source_url&&s.jsxs("a",{className:"inline-flex items-center gap-1 text-xs hover:text-foreground hover:underline",href:R.source_url,target:"_blank",rel:"noopener noreferrer",children:["open PR ",s.jsx(Og,{className:"size-3"})]}),s.jsx(Qe,{children:ro(R.updated_at)})]}),s.jsx(Ee,{className:"pr-4 text-right align-top",children:i?s.jsx(ge,{variant:"ghost",size:"sm",onClick:()=>y(R.id),children:"Edit"}):s.jsx(ge,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>E(R),children:"Delete"})})]},R.id))})]}):s.jsx(bt,{children:l.length?"No learnings match.":"No learnings yet. Reply to one of the bot's comments with a team decision, or use @bot remember."}):s.jsx(bt,{children:"Loading…"})}),s.jsxs(Jt,{children:["Learnings are team decisions from review discussions. When someone replies to one of the bot's comments, the bot reacts 👀, asks the model whether the reply states a rule for future reviews, and if so saves it here (✅ on GitLab, 🎉 on GitHub). ",s.jsx("code",{children:"@bot remember "})," saves one directly. Each starts scoped to its repository; widen ",s.jsx("b",{children:"Applies to"})," to a group or the whole host so one standard covers many repositories. Matching active learnings go with every review: the reviewer follows them and the verifier drops findings they rule out."]}),s.jsx(Go,{open:!!P,onClose:()=>y(null),title:"Edit learning",description:P?`${P.platform} · ${P.host}`:void 0,children:P&&s.jsx(_2,{l:P,onCancel:()=>y(null),onDelete:()=>E(P),onSave:R=>S(P,R).then(()=>{y(null),n("Saved")}).catch(N=>n(De(N),!0))},P.id)}),s.jsx(Jd,{open:x,onOpenChange:b,children:s.jsxs(Zd,{className:"sm:max-w-xl",children:[s.jsxs(ef,{children:[s.jsx(nf,{children:"Add learning"}),s.jsx(rf,{children:"A rule future reviews should follow."})]}),s.jsxs(Xt,{className:"lg:grid-cols-2",children:[s.jsx(Ce,{label:"Platform",children:s.jsxs(He,{value:j.platform,onChange:R=>k({...j,platform:R.target.value}),children:[s.jsx("option",{value:"gitlab",children:"GitLab"}),s.jsx("option",{value:"github",children:"GitHub"}),s.jsx("option",{value:"bitbucket",children:"Bitbucket"})]})}),s.jsx(Ce,{label:"Host",children:s.jsx(Me,{placeholder:"gitlab.example.com",value:j.host,onChange:R=>k({...j,host:R.target.value})})}),s.jsx(Ce,{label:"Applies to",children:s.jsx(Me,{placeholder:"empty = whole host · group · group/repo",value:j.scope,onChange:R=>k({...j,scope:R.target.value})})}),s.jsx(Ce,{label:"Only files matching",children:s.jsx(Me,{placeholder:"optional glob, e.g. api/legacy/**",value:j.path,onChange:R=>k({...j,path:R.target.value})})})]}),s.jsx(Ce,{label:"Learning",children:s.jsx(rs,{rows:4,maxLength:600,placeholder:"e.g. Account numbers are compared without leading zeros on purpose.",value:j.text,onChange:R=>k({...j,text:R.target.value})})}),s.jsxs(tf,{children:[s.jsx(ge,{variant:"outline",onClick:()=>b(!1),children:"Cancel"}),s.jsx(ge,{onClick:C,children:"Add learning"})]})]})})]})}const Xu={github:"GitHub",gitlab:"GitLab",bitbucket:"Bitbucket"},R2={github:"https://api.github.com",gitlab:"https://gitlab.com",bitbucket:"https://api.bitbucket.org/2.0"},Cl=n=>n.split(` +`).map(r=>r.trim()).filter(Boolean);function kr({label:n,set:r,multi:i,list:l,help:c,value:u,onChange:f}){const h=r?"Set ✓ — leave blank to keep":l?"one per line":"";return s.jsx(Ce,{label:n+(c?" — "+c:""),children:i?s.jsx(rs,{rows:3,className:"font-mono text-xs",placeholder:h,autoComplete:"off",spellCheck:!1,value:u,onChange:v=>f(v.target.value)}):s.jsx(Me,{type:"password",placeholder:h,autoComplete:"new-password",value:u,onChange:v=>f(v.target.value)})})}function of({text:n,label:r="Copy"}){const i=St(),[l,c]=m.useState(!1),u=()=>navigator.clipboard.writeText(n).then(()=>{c(!0),setTimeout(()=>c(!1),1500)}).catch(()=>i("Copy failed: select the text and copy it",!0));return s.jsxs(ge,{variant:"ghost",size:"sm",onClick:u,"aria-label":r,children:[l?s.jsx(Ql,{}):s.jsx(f1,{})," ",r]})}function Ly({secret:n,platform:r,onDone:i}){const l=r==="gitlab"?"GitLab's Secret token field":"the webhook's Secret field";return s.jsxs("div",{className:"grid gap-2 rounded-lg border border-warning/40 bg-warning-soft p-3",children:[s.jsx("div",{className:"text-sm font-medium",children:"Copy the secret now: it is not shown again."}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("code",{className:"min-w-0 flex-1 break-all font-mono text-xs",children:n}),s.jsx(of,{text:n})]}),s.jsxs(Qe,{children:["Paste it into ",l,", together with the URL."]}),s.jsx("div",{children:s.jsx(ge,{size:"sm",variant:"outline",onClick:i,children:"I've copied it"})})]})}function P2({hook:n,platform:r,onChanged:i}){const l=St(),c=Zo(),[u,f]=m.useState(""),[h,v]=m.useState(n.name),[g,y]=m.useState(""),x=(k,S)=>oo("/admin/api/webhooks/"+n.id,k).then(C=>{l(S),C.secret&&f(C.secret),i()}).catch(C=>l(De(C),!0)),b=async()=>{await c({title:"Replace the secret of "+n.name+"?",description:"Deliveries signed with the old secret are rejected until you paste the new one into the code host.",action:"Replace secret",danger:!0})&&x({regenerate_secret:!0},"New secret for "+n.name)},j=async()=>{await c({title:"Delete "+n.name+"?",description:"Its URL stops working at once. Remove the webhook from the code host too.",action:"Delete webhook",danger:!0})&&Ji("/admin/api/webhooks/"+n.id).then(()=>{l("Deleted "+n.name),i()}).catch(k=>l(De(k),!0))};return s.jsxs("div",{className:"grid gap-3 rounded-lg border p-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(Me,{className:"h-8 max-w-64",value:h,onChange:k=>v(k.target.value),onBlur:()=>h.trim()!==n.name&&x({name:h},"Renamed")}),s.jsx(yn,{kind:n.enabled?"on":"idle",children:n.enabled?"Enabled":"Disabled"}),r==="gitlab"&&n.secrets.signing_tokens>0&&s.jsx(jn,{variant:"outline",className:"font-normal text-muted-foreground",children:"signing token ✓"}),s.jsx("span",{className:"flex-1"}),s.jsx(ge,{variant:"ghost",size:"sm",onClick:()=>x({enabled:!n.enabled},n.enabled?"Disabled "+n.name:"Enabled "+n.name),children:n.enabled?"Disable":"Enable"}),s.jsx(ge,{variant:"ghost",size:"sm",onClick:b,children:"New secret"}),s.jsx(ge,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:j,children:"Delete"})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("code",{className:"hosturl min-w-0 flex-1 break-all",children:n.url}),s.jsx(of,{text:n.url,label:"Copy URL"})]}),u&&s.jsx(Ly,{secret:u,platform:r,onDone:()=>f("")}),r==="gitlab"&&s.jsx(Ce,{label:"Signing token (whsec_…) — GitLab 19.0+, "+(n.secrets.signing_tokens?"set ✓, paste to replace":"optional: copy it from the webhook in GitLab"),children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Me,{type:"password",autoComplete:"off",value:g,placeholder:n.secrets.signing_tokens?"Set ✓":"",onChange:k=>y(k.target.value)}),s.jsx(ge,{variant:"outline",size:"sm",disabled:!g.trim(),onClick:()=>x({signing_tokens:[g.trim()]},"Saved signing token").then(()=>y("")),children:"Save"}),n.secrets.signing_tokens>0&&s.jsx(ge,{variant:"ghost",size:"sm",onClick:()=>x({signing_tokens:[]},"Removed signing token"),children:"Remove"})]})}),s.jsxs(Qe,{children:["Added ",new Date(n.created_at).toLocaleDateString(),n.created_by?" by "+n.created_by:""]})]})}function D2({text:n}){return s.jsx("div",{role:"status",className:"rounded-lg border border-warning/40 bg-warning-soft p-3 text-sm text-warning",children:n})}function T2({host:n,managed:r,onChanged:i}){const l=St(),[c,u]=m.useState(""),[f,h]=m.useState(null),v=()=>Fn(`/admin/api/hosts/${n.id}/webhooks`,{name:c.trim()}).then(y=>{u(""),h({id:y.webhook.id,secret:y.secret}),l("Added "+y.webhook.name),i()}).catch(y=>l(De(y),!0)),g=n.secrets.webhook_secrets>0||n.secrets.signing_tokens>0;return s.jsxs("div",{className:"grid gap-6",children:[n.comment_warning&&s.jsx(D2,{text:n.comment_warning}),r&&s.jsxs(Xr,{title:"Add a webhook",children:[s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(Me,{className:"max-w-80",value:c,placeholder:n.platform==="gitlab"?"e.g. the group it's for":"e.g. where it's set up",onChange:y=>u(y.target.value)}),s.jsxs(ge,{onClick:v,children:[s.jsx(Xi,{})," Add webhook"]})]}),s.jsxs(Qe,{children:["The console generates a URL and a secret. Set the code host's webhook to them, with these events: ",n.events.join(", "),".",n.platform==="gitlab"&&" A system hook alone isn't enough: it doesn't send comments, so @bot commands need a group or project webhook with Comments."]})]}),s.jsx(Xr,{title:`Webhooks (${n.webhooks.length})`,children:n.webhooks.length?n.webhooks.map(y=>s.jsxs("div",{className:"grid gap-2",children:[(f==null?void 0:f.id)===y.id&&s.jsx(Ly,{secret:f.secret,platform:n.platform,onDone:()=>h(null)}),s.jsx(P2,{hook:y,platform:n.platform,onChanged:i})]},y.id)):s.jsxs(Qe,{children:["No webhooks yet",r?": add one above.":"."]})}),s.jsx(Jr,{}),s.jsxs(Xr,{title:"Shared URL",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("code",{className:"hosturl min-w-0 flex-1 break-all",children:n.webhook_url}),s.jsx(of,{text:n.webhook_url,label:"Copy URL"})]}),s.jsx(Qe,{children:g?"Still accepted for existing hooks. It is shared by every "+Xu[n.platform]+" host and checked with the secrets in the host's settings. Move hooks to their own URL above when you can.":"Shared by every "+Xu[n.platform]+" host. This host has no secrets of its own for it, so only the webhooks above work."})]})]})}function Xr({title:n,children:r}){return s.jsxs("div",{className:"grid gap-3",children:[s.jsx("h3",{className:"text-xs font-semibold tracking-wide text-muted-foreground uppercase",children:n}),r]})}function O2({host:n,onSaved:r,onCancel:i}){const l=St(),c=ln("hosts"),u=(n==null?void 0:n.settings)??{},f=(n==null?void 0:n.secrets)??{token:!1,app_private_key:!1,api_token:!1,webhook_secrets:0,signing_tokens:0},[h,v]=m.useState((n==null?void 0:n.platform)??"gitlab"),[g,y]=m.useState({base:(n==null?void 0:n.base_url)??"",name:(n==null?void 0:n.name)??"",enabled:n?n.enabled:!0,token:"",appID:u.app_id?String(u.app_id):"",appKey:"",email:u.email??"",apiToken:"",secrets:"",signing:"",reqSig:!!u.require_signature,skipTLS:!!u.skip_tls_verify,bot:u.bot_name??"",reviewer:u.reviewer??""}),x=j=>k=>y({...g,[j]:typeof k=="object"&&(k!=null&&k.target)?k.target.value:k}),b=()=>{const j={platform:h,base_url:g.base.trim(),name:g.name.trim(),enabled:g.enabled,settings:{bot_name:g.bot.trim(),reviewer:g.reviewer.trim()}};h==="github"&&(j.settings.app_id=parseInt(g.appID||"0",10)),h==="gitlab"&&Object.assign(j.settings,{skip_tls_verify:g.skipTLS,require_signature:g.reqSig}),h==="bitbucket"&&(j.settings.email=g.email.trim()),g.token.trim()&&(j.token=g.token.trim()),g.appKey.trim()&&(j.app_private_key=g.appKey),g.apiToken.trim()&&(j.api_token=g.apiToken.trim()),Cl(g.secrets).length&&(j.webhook_secrets=Cl(g.secrets)),Cl(g.signing).length&&(j.signing_tokens=Cl(g.signing)),(n?oo("/admin/api/hosts/"+n.id,j):Fn("/admin/api/hosts",j)).then(k=>{l("Saved "+k.name),r(k)}).catch(k=>l(De(k),!0))};return s.jsxs("div",{className:"grid gap-6",children:[s.jsx(Xr,{title:"Host",children:s.jsxs(Xt,{className:"lg:grid-cols-2",children:[s.jsx(Ce,{label:"Platform",children:s.jsxs(He,{id:"hPlat",value:h,disabled:!!n,onChange:j=>v(j.target.value),children:[s.jsx("option",{value:"gitlab",children:"GitLab"}),s.jsx("option",{value:"github",children:"GitHub"}),s.jsx("option",{value:"bitbucket",children:"Bitbucket Cloud"})]})}),s.jsx(Ce,{label:"Status",children:s.jsxs(He,{value:String(g.enabled),onChange:j=>y({...g,enabled:j.target.value==="true"}),children:[s.jsx("option",{value:"true",children:"Enabled"}),s.jsx("option",{value:"false",children:"Disabled"})]})}),s.jsx(Ce,{label:h==="gitlab"?"Instance URL":"API URL",children:s.jsx(Me,{value:g.base,placeholder:R2[h],onChange:x("base")})}),s.jsx(Ce,{label:"Name",children:s.jsx(Me,{value:g.name,placeholder:"shown in the console",onChange:x("name")})})]})}),s.jsx(Jr,{}),s.jsx(Xr,{title:"API access",children:s.jsxs("div",{className:"grid gap-4",children:[h==="github"&&s.jsxs(s.Fragment,{children:[s.jsx(kr,{label:"Token",help:"or use a GitHub App below",set:f.token,value:g.token,onChange:x("token")}),s.jsx(Ce,{label:"GitHub App ID",children:s.jsx(Me,{type:"number",value:g.appID,onChange:x("appID")})}),s.jsx(kr,{label:"GitHub App private key (PEM)",set:f.app_private_key,multi:!0,value:g.appKey,onChange:x("appKey")})]}),h==="gitlab"&&s.jsxs(s.Fragment,{children:[s.jsx(kr,{label:"Access token (api scope)",set:f.token,value:g.token,onChange:x("token")}),s.jsx(Ce,{label:"TLS",children:s.jsxs(He,{value:String(g.skipTLS),onChange:j=>y({...g,skipTLS:j.target.value==="true"}),children:[s.jsx("option",{value:"false",children:"Verify certificates"}),s.jsx("option",{value:"true",children:"Skip verification (self-signed)"})]})})]}),h==="bitbucket"&&s.jsxs(s.Fragment,{children:[s.jsx(kr,{label:"Access token",help:"repository or workspace token",set:f.token,value:g.token,onChange:x("token")}),s.jsx(Ce,{label:"Account email",children:s.jsx(Me,{value:g.email,placeholder:"with an API token instead",onChange:x("email")})}),s.jsx(kr,{label:"Atlassian API token",set:f.api_token,value:g.apiToken,onChange:x("apiToken")})]})]})}),s.jsx(Jr,{}),s.jsxs(Xr,{title:"Shared URL secrets (optional)",children:[s.jsxs(Qe,{children:["Only for hooks on the shared ","/webhooks/"+h," URL. Webhooks added under Webhooks have their own URL and secret."]}),s.jsx("div",{className:"grid gap-4",children:h==="gitlab"?s.jsxs(s.Fragment,{children:[s.jsx(kr,{label:"Signing tokens (whsec_…)",multi:!0,list:!0,set:f.signing_tokens>0,help:f.signing_tokens?f.signing_tokens+" set":"GitLab 19.0+, recommended",value:g.signing,onChange:x("signing")}),s.jsx(kr,{label:"Secret tokens",multi:!0,list:!0,set:f.webhook_secrets>0,help:f.webhook_secrets?f.webhook_secrets+" set":"older hooks",value:g.secrets,onChange:x("secrets")}),s.jsx(Ce,{label:"Unsigned webhooks",children:s.jsxs(He,{value:String(g.reqSig),onChange:j=>y({...g,reqSig:j.target.value==="true"}),children:[s.jsx("option",{value:"false",children:"Accept with a secret token"}),s.jsx("option",{value:"true",children:"Reject"})]})})]}):s.jsx(kr,{label:"Webhook secrets",multi:!0,list:!0,set:f.webhook_secrets>0,help:f.webhook_secrets?f.webhook_secrets+" set":"one per hook",value:g.secrets,onChange:x("secrets")})})]}),s.jsx(Jr,{}),s.jsx(Xr,{title:"Bot identity",children:s.jsxs(Xt,{className:"lg:grid-cols-2",children:[s.jsx(Ce,{label:"Mention name",hint:s.jsx(Tl,{feature:"hosts"}),children:s.jsx(Me,{value:g.bot,placeholder:"default: the token's user",disabled:!c&&!g.bot,onChange:x("bot")})}),s.jsx(Ce,{label:"Reviewer username",children:s.jsx(Me,{value:g.reviewer,placeholder:"default: the token's user",disabled:!c&&!g.reviewer,onChange:x("reviewer")})})]})}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(ge,{onClick:b,children:n?"Save host":"Add host"}),s.jsx(ge,{variant:"outline",onClick:i,children:"Cancel"})]})]})}function M2(){const n=St(),r=Zo(),i=ln("hosts"),[l,c]=m.useState(null),[u,f]=m.useState(null),[h,v]=m.useState(null),[g,y]=m.useState({}),x=()=>Ct("/admin/api/hosts").then(c).catch(E=>n(De(E),!0));m.useEffect(()=>{x()},[]);const b=E=>{y(D=>({...D,[E.id]:{pending:!0}})),Fn(`/admin/api/hosts/${E.id}/test`).then(D=>y(T=>({...T,[E.id]:D}))).catch(D=>y(T=>({...T,[E.id]:{ok:!1,message:De(D)}})))},j=async E=>{await r({title:"Delete "+E.name+"?",description:"Webhooks from it will be rejected and its stored tokens removed.",action:"Delete host",danger:!0})&&Ji("/admin/api/hosts/"+E.id).then(()=>{n("Deleted "+E.name),x()}).catch(D=>n(De(D),!0))},k=(l==null?void 0:l.mode)==="database",S=u?(l==null?void 0:l.hosts.find(E=>E.id===u))??null:null,C=h?(l==null?void 0:l.hosts.find(E=>E.id===h))??null:null;return s.jsxs("section",{className:"grid gap-4",children:[s.jsxs(no,{children:[s.jsxs("span",{className:"text-sm text-muted-foreground",children:[l&&(k?"Managed here; stored encrypted in the database.":`Hosts come from the config file (read-only). Set ${l.key_env||"CODEREVIEW_CONSOLE_SECRET_KEY"} to manage them here.`),l&&!i&&" Free: one host per platform."]}),s.jsx("span",{className:"flex-1"}),k&&s.jsxs(ge,{variant:"outline",onClick:()=>f(0),children:[s.jsx(Xi,{})," Add host"]})]}),s.jsx(ao,{children:l?l.hosts.length?s.jsxs(co,{children:[s.jsx(uo,{children:s.jsxs(Mt,{children:[s.jsx(Se,{className:"pl-4",children:"Host"}),s.jsx(Se,{children:"Credentials"}),s.jsx(Se,{children:"Webhooks"}),s.jsx(Se,{children:"Check"}),s.jsx(Se,{})]})}),s.jsx(fo,{children:l.hosts.map(E=>{const D=E.secrets,T=[D.token&&"token ✓",E.settings.app_id&&`App ${E.settings.app_id}${D.app_private_key?" ✓":" (no key)"}`,D.api_token&&"API token ✓",D.signing_tokens&&`${D.signing_tokens} signing token${D.signing_tokens>1?"s":""}`,D.webhook_secrets&&`${D.webhook_secrets} webhook secret${D.webhook_secrets>1?"s":""}`].filter(Boolean),P=g[E.id];return s.jsxs(Mt,{children:[s.jsxs(Ee,{className:"pl-4 align-top",children:[s.jsx("div",{className:"font-medium",children:E.name}),s.jsxs(Qe,{children:[Xu[E.platform]," · ",E.host]}),s.jsx("div",{className:"mt-1.5",children:E.licensed?s.jsx(yn,{kind:E.enabled?"on":"idle",children:E.enabled?"Enabled":"Disabled"}):s.jsx(yn,{kind:"warn",children:"Inactive: needs a license"})})]}),s.jsxs(Ee,{className:"align-top whitespace-normal",children:[s.jsx("div",{className:"flex flex-wrap gap-1",children:T.map(R=>s.jsx(jn,{variant:"outline",className:"font-normal text-muted-foreground",children:R},R))}),s.jsxs(Qe,{children:["mention: ",E.settings.bot_name?"@"+E.settings.bot_name:"token user",E.settings.reviewer?" · reviewer: "+E.settings.reviewer:""]})]}),s.jsxs(Ee,{className:"max-w-80 align-top whitespace-normal",children:[E.webhooks.length?s.jsx("div",{className:"grid gap-0.5 text-sm",children:E.webhooks.map(R=>s.jsx("div",{className:R.enabled?"":"text-muted-foreground line-through",children:R.name},R.id))}):s.jsx(Qe,{children:E.secrets.webhook_secrets||E.secrets.signing_tokens?"Shared URL only":"None yet"}),E.comment_warning&&s.jsx("div",{className:"mt-1.5",children:s.jsx(yn,{kind:"warn",children:"No comment events"})}),s.jsxs(ge,{variant:"link",size:"sm",className:"h-auto px-0",onClick:()=>v(E.id),children:[s.jsx(iv,{})," ",k?"Manage webhooks":"Show URLs"]})]}),s.jsx(Ee,{className:"max-w-56 align-top whitespace-normal",children:P&&(P.pending?s.jsx("span",{className:"text-sm text-muted-foreground",children:"testing…"}):s.jsx(yn,{kind:P.ok?"on":"off",children:P.message}))}),s.jsx(Ee,{className:"pr-4 text-right align-top",children:s.jsxs("div",{className:"flex justify-end gap-1",children:[s.jsxs(ge,{variant:"ghost",size:"sm",onClick:()=>b(E),children:[s.jsx(b1,{})," Test"]}),k&&s.jsxs(s.Fragment,{children:[s.jsx(ge,{variant:"ghost",size:"sm",onClick:()=>f(E.id),children:"Edit"}),s.jsx(ge,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>j(E),children:"Delete"})]})]})})]},E.id)})})]}):s.jsx(bt,{children:"No code hosts yet. Add GitHub, GitLab or Bitbucket."}):s.jsx(bt,{children:"Loading…"})}),s.jsxs(Jt,{children:["Each host is a GitHub (github.com or Enterprise), GitLab (gitlab.com or self-managed) or Bitbucket Cloud account the console reviews for. Tokens and webhook secrets are encrypted with ",s.jsx("code",{children:"CODEREVIEW_CONSOLE_SECRET_KEY"})," before they are stored and are never shown again: leave a secret blank to keep it. Under ",s.jsx("b",{children:"Manage webhooks"}),", add one webhook per hook you set up (a GitLab system hook, each group hook): each gets its own URL and secret, so one can be replaced or removed without touching the others."]}),s.jsx(Go,{open:C!==null,onClose:()=>v(null),title:C?"Webhooks: "+C.name:"",description:"Each webhook has its own URL and secret.",wide:!0,children:C&&s.jsx(T2,{host:C,managed:k,onChanged:x},C.id)}),s.jsx(Go,{open:u!==null,onClose:()=>f(null),title:S?"Edit "+S.name:"New host",description:"Credentials are encrypted before they are stored.",children:u!==null&&s.jsx(O2,{host:S,onCancel:()=>f(null),onSaved:E=>{f(null),x().then(()=>b(E))}},u)})]})}const Ju=[["enabled","Reviews","Enabled","Disabled"],["require_reviewer","Reviewer required","On","Off"],["skip_branch_sync","Branch syncs","Skip","Review"],["score_labels","Score labels","On","Off"],["commit_status","Commit status","On","Off"]],Bi=n=>n.pattern||"Whole host";function A2({rule:n,onSave:r,onDelete:i}){const[l,c]=m.useState(()=>Object.fromEntries(Ju.map(([u])=>[u,n[u]??null])));return s.jsx(Xd,{value:n.settings,inheritModel:"Inherit",onSave:u=>r({...l,settings:u}),danger:s.jsx(ge,{variant:"ghost",className:"text-destructive hover:text-destructive",onClick:i,children:"Delete rule"}),extra:s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid gap-3",children:[s.jsx("h3",{className:"text-xs font-semibold tracking-wide text-muted-foreground uppercase",children:"Settings for this level"}),s.jsx(Xt,{className:"lg:grid-cols-2",children:Ju.map(([u,f,h,v])=>s.jsx(Ce,{label:f,children:s.jsx(Vl,{value:l[u],on:h,off:v,onChange:g=>c({...l,[u]:g})})},u))})]}),s.jsx(Jr,{}),s.jsx("h3",{className:"text-xs font-semibold tracking-wide text-muted-foreground uppercase",children:"Review settings"})]})})}function I2(){const n=St(),r=Zo(),i=ln("rules"),[l,c]=m.useState(null),[u,f]=m.useState([]),[h,v]=m.useState(null),[g,y]=m.useState(!1),[x,b]=m.useState({platform:"gitlab",host:"",pattern:"",enabled:null}),j=()=>Ct("/admin/api/repos").then(P=>f(P||[]));m.useEffect(()=>{Ct("/admin/api/rules").then(P=>c(P||[])).catch(P=>n(De(P),!0)),j().catch(()=>{})},[]);const k=P=>{const R=P.pattern?P.pattern:"host "+P.host;return u.filter(N=>(N.effective.rules||[]).includes(R)&&N.platform===P.platform&&N.host===P.host).length},S=()=>{const P={platform:x.platform,host:x.host.trim(),pattern:x.pattern.trim()};x.enabled!==null&&(P.enabled=x.enabled),Fn("/admin/api/rules",P).then(R=>(c(N=>(N||[]).filter(I=>I.id!==R.id).concat([R])),b({...x,pattern:""}),y(!1),v(R.id),n("Saved rule "+Bi(R)+" — set its options"),j())).catch(R=>n(De(R),!0))},C=(P,R)=>oo("/admin/api/rules/"+P.id,R).then(N=>(c(I=>(I||[]).map(L=>L.id===N.id?N:L)),v(null),n("Saved "+Bi(N)),j())).catch(N=>n(De(N),!0)),E=async P=>{await r({title:"Delete the rule for "+Bi(P)+"?",description:"On "+P.host+". Repositories fall back to the level above.",action:"Delete rule",danger:!0})&&Ji("/admin/api/rules/"+P.id).then(()=>(c(R=>(R||[]).filter(N=>N.id!==P.id)),v(null),n("Deleted rule "+Bi(P)),j())).catch(R=>n(De(R),!0))},D=(l||[]).slice().sort((P,R)=>(P.platform+P.host).localeCompare(R.platform+R.host)||(P.pattern?1:0)-(R.pattern?1:0)||P.pattern.localeCompare(R.pattern)),T=(l==null?void 0:l.find(P=>P.id===h))??null;return s.jsxs("section",{className:"grid gap-4",children:[!i&&s.jsx(da,{feature:"rules",children:"Settings for a whole host, a group or a name pattern are part of the licensed console. Without a license, repositories follow the global settings and their own mode; any rules below are kept but ignored."}),s.jsxs(no,{children:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"Settings for a whole host, or for a group, organisation or name pattern on a host."}),s.jsx("span",{className:"flex-1"}),i&&s.jsxs(ge,{variant:"outline",onClick:()=>y(!0),children:[s.jsx(Xi,{})," Add rule"]})]}),s.jsx(ao,{children:l?l.length?s.jsxs(co,{children:[s.jsx(uo,{children:s.jsxs(Mt,{children:[s.jsx(Se,{className:"pl-4",children:"Scope"}),s.jsx(Se,{children:"Sets"}),s.jsx(Se,{children:"Covers"}),s.jsx(Se,{children:"Last changed"}),s.jsx(Se,{})]})}),s.jsx(fo,{children:D.map(P=>{const R=k(P),N=Ju.filter(([I])=>P[I]!==null&&P[I]!==void 0).map(([I,L,Q,ee])=>L+": "+(P[I]?Q:ee));return s.jsxs(Mt,{children:[s.jsxs(Ee,{className:"pl-4 align-top",children:[s.jsx("div",{children:P.pattern?s.jsx("code",{children:P.pattern}):s.jsx("b",{children:"Whole host"})}),s.jsxs(Qe,{children:[P.platform," · ",P.host]})]}),s.jsxs(Ee,{className:"align-top whitespace-normal",children:[s.jsx(Yu,{items:N,empty:"inherits everything"}),s.jsx("div",{className:"mt-1",children:s.jsx(Yu,{items:My(P.settings)})})]}),s.jsx(Ee,{className:"align-top text-muted-foreground",children:R+(R===1?" known repository":" known repositories")}),s.jsx(Ee,{className:"align-top text-muted-foreground",children:P.updated_by?P.updated_by+" · "+ro(P.updated_at):"—"}),s.jsx(Ee,{className:"pr-4 text-right align-top",children:i?s.jsx(ge,{variant:"ghost",size:"sm",onClick:()=>v(P.id),children:"Edit"}):s.jsx(ge,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>E(P),children:"Delete"})})]},P.id)})})]}):s.jsx(bt,{children:"No rules yet. Add one for a whole host, a group or a name pattern."}):s.jsx(bt,{children:"Loading…"})}),s.jsxs(Jt,{children:["Levels, broadest first: ",s.jsx("b",{children:"Settings"})," (everything) → ",s.jsx("b",{children:"whole host"})," (empty pattern) → ",s.jsx("b",{children:"group or owner"})," (",s.jsx("code",{children:"acme"}),", ",s.jsx("code",{children:"acme/platform"}),", subgroups included) or ",s.jsx("b",{children:"pattern"})," (",s.jsx("code",{children:"acme/svc-*"}),"; ",s.jsx("code",{children:"*"})," stays within one level) → ",s.jsx("b",{children:"repository"}),". For each setting the most specific level that sets it wins; ",s.jsx("b",{children:"Inherit"}),' means "use the level above". Review settings add up the same way. Hosts are separate: a rule for ',s.jsx("code",{children:"acme"})," on one host never touches ",s.jsx("code",{children:"acme"})," on another."]}),s.jsx(Go,{open:!!T,onClose:()=>v(null),title:T?Bi(T):"",description:T?`${T.platform} · ${T.host}`:void 0,children:T&&s.jsx(A2,{rule:T,onSave:P=>C(T,P),onDelete:()=>E(T)},T.id)}),s.jsx(Jd,{open:g,onOpenChange:y,children:s.jsxs(Zd,{className:"sm:max-w-lg",children:[s.jsxs(ef,{children:[s.jsx(nf,{children:"Add rule"}),s.jsx(rf,{children:"After adding it, set its options."})]}),s.jsxs(Xt,{className:"lg:grid-cols-2",children:[s.jsx(Ce,{label:"Platform",children:s.jsxs(He,{value:x.platform,onChange:P=>b({...x,platform:P.target.value}),children:[s.jsx("option",{value:"gitlab",children:"GitLab"}),s.jsx("option",{value:"github",children:"GitHub"})]})}),s.jsx(Ce,{label:"Host",children:s.jsx(Me,{placeholder:"gitlab.com",value:x.host,onChange:P=>b({...x,host:P.target.value})})}),s.jsx(Ce,{label:"Group, owner or pattern",className:"sm:col-span-2",children:s.jsx(Me,{placeholder:"empty = whole host · acme · acme/svc-*",value:x.pattern,onChange:P=>b({...x,pattern:P.target.value})})}),s.jsx(Ce,{label:"Reviews",children:s.jsx(Vl,{value:x.enabled,on:"Enabled",off:"Disabled",onChange:P=>b({...x,enabled:P})})})]}),s.jsxs(tf,{children:[s.jsx(ge,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),s.jsx(ge,{onClick:S,children:"Add rule"})]})]})})]})}const ag=["queued","ignored","duplicate","rejected","error"],L2=n=>({queued:"on",rejected:"off",error:"off"})[n]||"idle";function z2(){const n=St(),[r,i]=m.useState(null),[l,c]=m.useState({}),[u,f]=m.useState(!1),[h,v]=m.useState(""),[g,y]=m.useState(""),[x,b]=m.useState({});m.useEffect(()=>{Ct("/admin/api/hosts").then(k=>b(Object.fromEntries(k.hosts.flatMap(S=>(S.webhooks||[]).map(C=>[C.id,C.name]))))).catch(()=>{})},[]);const j=k=>{const S=k&&(r!=null&&r.length)?r[r.length-1].id:void 0;Ct("/admin/api/webhooks"+Pu({limit:100,project:h.trim(),outcome:g,before:S})).then(C=>{i(E=>k?(E||[]).concat(C.events):C.events),c(C.counts_24h||{}),f(C.events.length>=100)}).catch(C=>n(De(C),!0))};return m.useEffect(()=>{const k=window.setTimeout(()=>j(),h?250:0);return()=>window.clearTimeout(k)},[h,g]),s.jsxs("section",{className:"grid gap-4",children:[s.jsxs(no,{children:[s.jsxs("div",{className:"relative w-full sm:w-64",children:[s.jsx(Yl,{className:"pointer-events-none absolute top-2.5 left-2.5 size-4 text-muted-foreground"}),s.jsx(Me,{type:"search",className:"pl-8",placeholder:"Filter by project","aria-label":"Filter webhooks by project",value:h,onChange:k=>v(k.target.value)})]}),s.jsxs(He,{className:"w-auto","aria-label":"Outcome",value:g,onChange:k=>y(k.target.value),children:[s.jsx("option",{value:"",children:"All outcomes"}),ag.map(k=>s.jsx("option",{value:k,children:k[0].toUpperCase()+k.slice(1)},k))]}),s.jsxs("span",{className:"text-sm text-muted-foreground",children:["Last 24 h: ",ag.map(k=>(l[k]||0)+" "+k).join(" · ")]}),s.jsx("span",{className:"flex-1"}),s.jsxs(ge,{variant:"outline",onClick:()=>j(),children:[s.jsx(Yg,{})," Refresh"]})]}),s.jsx(ao,{children:r?r.length?s.jsxs(co,{children:[s.jsx(uo,{children:s.jsxs(Mt,{children:[s.jsx(Se,{className:"pl-4",children:"When"}),s.jsx(Se,{children:"Project"}),s.jsx(Se,{children:"Event"}),s.jsx(Se,{children:"Outcome"}),s.jsx(Se,{children:"Reason"}),s.jsx(Se,{className:"pr-4",children:"Via"})]})}),s.jsx(fo,{children:r.map(k=>{const S=[k.kind||k.event,k.action].filter(Boolean).join(" · ")+(k.number?" · !"+k.number:"");return s.jsxs(Mt,{children:[s.jsx(Ee,{className:"pl-4 align-top text-muted-foreground",title:new Date(k.received_at).toLocaleString(),children:ro(k.received_at)}),s.jsxs(Ee,{className:"align-top",children:[s.jsx("div",{className:"font-medium",children:k.project||"—"}),s.jsx(Qe,{children:k.platform+(k.host?" · "+k.host:"")})]}),s.jsxs(Ee,{className:"align-top",children:[s.jsx("div",{children:S||"—"}),s.jsx(Qe,{children:k.event+(k.sender?" · by "+k.sender:"")})]}),s.jsx(Ee,{className:"align-top",children:s.jsx(yn,{kind:L2(k.outcome),children:k.outcome})}),s.jsx(Ee,{className:"reason min-w-64 align-top text-sm whitespace-normal text-muted-foreground",children:k.reason}),s.jsxs(Ee,{className:"pr-4 align-top text-muted-foreground",children:[s.jsx("div",{children:k.endpoint?x[k.endpoint]||"unknown webhook":"shared URL"}),s.jsx(Qe,{children:k.auth})]})]},k.id)})})]}):s.jsx(bt,{children:"No webhook deliveries match."}):s.jsx(bt,{children:"Loading…"})}),u&&s.jsx("div",{children:s.jsx(ge,{variant:"outline",onClick:()=>j(!0),children:"Load older"})}),s.jsxs(Jt,{children:["Every webhook delivery and what the console did with it. ",s.jsx("b",{children:"Ignored"})," is normal for events that should not start a review (approvals, label or reviewer changes, edits without new commits) and for repositories that are not enabled. ",s.jsx("b",{children:"Rejected"})," means the signature or token did not match. History is kept for the days set in Settings (14 by default)."]})]})}function Mn({label:n,value:r,onChange:i,yes:l,no:c,disabled:u,note:f}){return s.jsx(Ce,{label:n,hint:f,children:s.jsxs(He,{value:String(r),disabled:u,onChange:h=>i(h.target.value==="true"),children:[s.jsx("option",{value:"true",children:l}),s.jsx("option",{value:"false",children:c})]})})}function Sl({label:n,value:r,onChange:i,note:l,...c}){return s.jsx(Ce,{label:n,hint:l,children:s.jsx(Me,{type:"number",value:r||"",...c,onChange:u=>i(parseInt(u.target.value||"0",10))})})}function $o({title:n,description:r,children:i}){return s.jsxs(Vn,{children:[s.jsxs(Bl,{children:[s.jsx(Qd,{className:"h2",children:n}),r&&s.jsx(Yd,{children:r})]}),s.jsx(to,{children:i})]})}function F2(){const n=St(),r=qd(),i=ei(),l={learnings:ln("learnings"),budgets:ln("budgets"),sync:ln("branch_sync"),metrics:ln("metrics")},[c,u]=m.useState(null),[f,h]=m.useState(null),[v,g]=m.useState(""),[y,x]=m.useState(0),b=C=>{u(C),h(C),g((C.sync_source_branches||[]).join(", "))};if(m.useEffect(()=>{Ct("/admin/api/settings").then(b).catch(C=>n(De(C),!0))},[]),!c||!f)return s.jsx(bt,{children:"Loading…"});const j=C=>E=>h({...f,[C]:E}),k=C=>{const{source:E,...D}={...f,review_defaults:C,dashboard_title:f.dashboard_title.trim(),sync_source_branches:v.split(",").map(T=>T.trim()).filter(Boolean)};oo("/admin/api/settings",D).then(T=>{b(T),x(P=>P+1),r(),n("Settings saved")}).catch(T=>n(De(T),!0))},S=Object.keys(c.source||{}).filter(C=>c.source[C]==="config");return s.jsxs("section",{className:"grid gap-4",children:[s.jsx($o,{title:"Repository access",description:"Which repositories are reviewed, and when.",children:s.jsxs(Xt,{children:[s.jsx(Mn,{label:"Repositories no rule matches",value:f.allowlist,onChange:j("allowlist"),yes:"Not reviewed (allowlist on)",no:"Reviewed (allowlist off)"}),s.jsx(Mn,{label:"Who asks for a review",value:f.require_reviewer,onChange:j("require_reviewer"),yes:"Only when the bot is a reviewer",no:"Any opened MR or push"}),s.jsx(Mn,{label:"Branch syncs (source is the default branch)",value:f.skip_branch_sync,onChange:j("skip_branch_sync"),yes:"Skip",no:"Review",disabled:!l.sync,note:s.jsx(Tl,{feature:"branch_sync"})}),s.jsx(Ce,{label:"Also treat these source branches as syncs",children:s.jsx(Me,{placeholder:"develop, release/*",value:v,disabled:!l.sync,onChange:C=>g(C.target.value)})}),s.jsx(Mn,{label:"Score labels on MRs/PRs",value:f.score_labels,onChange:j("score_labels"),yes:"On",no:"Off"}),s.jsx(Mn,{label:"Commit status on the reviewed commit",value:f.commit_status,onChange:j("commit_status"),yes:"On",no:"Off"})]})}),s.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[s.jsx($o,{title:"Learnings",children:s.jsxs(Xt,{className:"lg:grid-cols-2",children:[s.jsx(Mn,{label:"Learn from replies to the bot",value:f.learnings_enabled,onChange:j("learnings_enabled"),yes:"On",no:"Off",disabled:!l.learnings,note:s.jsx(Tl,{feature:"learnings"})}),s.jsx(Mn,{label:"New learnings",value:f.learnings_auto_activate,onChange:j("learnings_auto_activate"),yes:"Apply at once",no:"Wait for an admin's approval",disabled:!l.learnings})]})}),s.jsx($o,{title:"Budgets",description:'Input plus output tokens of finished jobs in the current UTC day. When a budget is used up, automatic reviews and chat commands wait until the next day; "Review now" and re-runs from this panel still run.',children:s.jsxs(Xt,{className:"lg:grid-cols-2",children:[s.jsx(Sl,{label:"Daily tokens, all repositories",min:0,step:1e4,placeholder:"0 = no limit",value:f.daily_token_budget,onChange:j("daily_token_budget"),disabled:!l.budgets,note:s.jsx(Tl,{feature:"budgets"})}),s.jsx(Sl,{label:"Daily tokens per repository",min:0,step:1e4,placeholder:"0 = no limit",value:f.repo_daily_token_budget,onChange:j("repo_daily_token_budget"),disabled:!l.budgets})]})}),s.jsx($o,{title:"History",children:s.jsxs(Xt,{className:"lg:grid-cols-2",children:[s.jsx(Sl,{label:"Keep reviews (days)",min:1,max:3650,value:f.review_retention_days,onChange:j("review_retention_days"),note:!l.metrics&&f.review_retention_days>i.free_retention_days?s.jsxs("span",{className:"locknote text-xs text-warning",children:["Without a license with metrics and long history, reviews are kept ",i.free_retention_days," days."]}):null}),s.jsx(Sl,{label:"Keep webhook deliveries (days)",min:1,max:3650,value:f.webhook_retention_days,onChange:j("webhook_retention_days")})]})}),s.jsx($o,{title:"Status dashboard",children:s.jsxs(Xt,{className:"lg:grid-cols-2",children:[s.jsx(Mn,{label:"Dashboard",value:f.dashboard_enabled,onChange:j("dashboard_enabled"),yes:"On",no:"Off"}),s.jsx(Mn,{label:"Repository names",value:!f.hide_repos,onChange:C=>j("hide_repos")(!C),yes:"Shown",no:"Hidden"}),s.jsx(Ce,{label:"Title",className:"sm:col-span-2",children:s.jsx(Me,{maxLength:120,value:f.dashboard_title,onChange:C=>j("dashboard_title")(C.target.value)})})]})})]}),s.jsx(Vn,{className:"py-4",children:s.jsxs(L_,{className:"flex flex-wrap items-center gap-3",children:[s.jsx(ge,{onClick:()=>k(c.review_defaults),children:"Save settings"}),s.jsx("span",{className:"text-sm text-muted-foreground",children:S.length?"Not saved yet (from the config file): "+S.join(", "):""})]})}),s.jsx($o,{title:"Default review settings",description:"Apply to every repository. Group and pattern rules, then repository settings, override them.",children:s.jsx(Xd,{value:c.review_defaults,onSave:k,saveLabel:"Save default review settings"},y)}),s.jsx(Jt,{children:"The config file is the initial configuration: on first start its values are copied here, and from then on these settings are kept in the database. Editing the config file later does not change them; the server log notes any difference. Every change is in the audit log."})]})}function $2(){const n=St(),[r,i]=m.useState(null),l=ln("audit");return m.useEffect(()=>{l&&Ct("/admin/api/audit").then(c=>i(c||[])).catch(c=>n(De(c),!0))},[l]),l?s.jsx("section",{className:"grid gap-4",children:s.jsx(ao,{children:r?r.length?s.jsxs(co,{children:[s.jsx(uo,{children:s.jsxs(Mt,{children:[s.jsx(Se,{className:"pl-4",children:"When"}),s.jsx(Se,{children:"Who"}),s.jsx(Se,{children:"Action"}),s.jsx(Se,{children:"Target"}),s.jsx(Se,{className:"pr-4",children:"Details"})]})}),s.jsx(fo,{children:r.map((c,u)=>s.jsxs(Mt,{children:[s.jsx(Ee,{className:"pl-4 align-top text-muted-foreground",children:new Date(c.at).toLocaleString()}),s.jsx(Ee,{className:"align-top",children:c.actor}),s.jsx(Ee,{className:"align-top",children:s.jsx("code",{children:c.action})}),s.jsx(Ee,{className:"align-top",children:c.target}),s.jsx(Ee,{className:"max-w-xl pr-4 align-top whitespace-normal",children:s.jsx("pre",{className:"detail max-h-40 overflow-auto rounded-md bg-muted p-2 font-mono text-xs whitespace-pre-wrap break-all",children:JSON.stringify(c.detail)})})]},c.id??u))})]}):s.jsx(bt,{children:"No admin activity yet."}):s.jsx(bt,{children:"Loading…"})})}):s.jsx("section",{children:s.jsx(da,{feature:"audit",children:"Every admin change is still recorded; viewing the audit log is part of the licensed console."})})}const U2={none:["Free core","idle"],active:["Active","on"],grace:["Expired — grace period","warn"],expired:["Expired","off"],invalid:["Not valid","off"]};function B2(){const n=ei(),r=qd(),i=St(),l=Zo(),c=n.license,[u,f]=m.useState(""),[h,v]=U2[c.state],g=x=>oo("/admin/api/license",{key:x}).then(()=>{f(""),r(),i(x?"License installed":"License removed")}).catch(b=>i(De(b),!0)),y=async()=>{await l({title:"Remove the license?",description:"Paid features turn off at once.",action:"Remove license",danger:!0})&&g("")};return s.jsxs("section",{className:"grid gap-4",children:[s.jsxs(Vn,{children:[s.jsx(Bl,{children:s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx(yn,{kind:v,children:h}),c.customer&&s.jsxs("span",{className:"text-sm",children:[s.jsx("b",{children:c.customer})," · ",c.plan]}),s.jsx("span",{className:"flex-1"}),c.expires_at&&s.jsxs("span",{className:"text-sm text-muted-foreground",children:["expires ",sg(c.expires_at)]})]})}),s.jsxs(to,{className:"grid gap-4",children:[c.error&&s.jsx(Hi,{variant:"destructive",className:"banner bad",children:s.jsx(Gi,{children:c.error})}),c.state==="grace"&&s.jsx(Hi,{className:"banner border-warning/40 bg-warning-soft",children:s.jsxs(Gi,{className:"text-warning",children:["The license has expired. Paid features keep working until ",sg(c.grace_until),"; renew it to keep them."]})}),s.jsxs("div",{children:[s.jsx("h2",{className:"h2 mb-3 text-sm font-semibold",children:"Features"}),s.jsx("ul",{className:"feats grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:Object.keys(Wl).map(x=>{const b=c.features.includes(x);return s.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[s.jsx("span",{className:"flex size-5 items-center justify-center rounded-full "+(b?"bg-success-soft text-success":"bg-muted text-muted-foreground"),children:b?s.jsx(Ql,{className:"size-3"}):s.jsx(g1,{className:"size-3"})}),s.jsx("span",{className:b?"":"text-muted-foreground",children:Wl[x]}),s.jsx("span",{className:"sr-only",children:b?"on":"off"})]},x)})})]}),s.jsxs(Jt,{children:["Free without a license: reviews for one GitHub, GitLab and Bitbucket host each, the local executor, repository on/off, ",s.jsx("code",{children:"@bot"})," commands, review history for ",n.free_retention_days," days, the status dashboard and admin sign-in by email."]})]})]}),s.jsxs(Vn,{children:[s.jsxs(Bl,{children:[s.jsxs(Qd,{className:"flex items-center gap-2",children:[s.jsx(Ig,{className:"size-4"}),c.state==="none"?"Install a license":"Replace the license"]}),s.jsx(Yd,{children:"Keys are verified offline; the console never calls home."})]}),s.jsx(to,{className:"grid gap-4",children:c.managed?s.jsxs("p",{className:"text-sm text-muted-foreground",children:["This license comes from ",c.source==="env"?s.jsx("code",{children:"CODEREVIEW_CONSOLE_LICENSE"}):s.jsx("code",{children:"license.file"}),"; change it there and restart the console."]}):s.jsxs(s.Fragment,{children:[s.jsx(Ce,{label:"License key",children:s.jsx(rs,{className:"key min-h-28 font-mono text-xs",placeholder:"DIV1.… or the -----BEGIN DIVMORA LICENSE KEY----- block",autoComplete:"off",spellCheck:!1,value:u,onChange:x=>f(x.target.value)})}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(ge,{disabled:!u.trim(),onClick:()=>g(u.trim()),children:"Install"}),c.source==="database"&&s.jsx(ge,{variant:"ghost",className:"text-destructive hover:text-destructive",onClick:y,children:"Remove license"})]}),s.jsx(Jt,{children:"A pasted key is stored in the database and applies at once, except the executor, which is chosen when the console starts."})]})})]}),s.jsxs(Jt,{children:["Every use of a paid feature needs a license from Divmora, in development, CI and production alike. For a license or a trial, contact"," ",s.jsx("a",{className:"text-primary underline-offset-4 hover:underline",href:"mailto:licensing@divmora.com",children:"licensing@divmora.com"}),"."]})]})}const W2={"/license":"Open License","/hosts":"Open Code hosts","/webhooks":"Open Webhooks","/settings":"Open Settings","/repositories":"Open Repositories","/reviews":"Open Reviews"};function V2(){const n=St(),r=qd(),[i,l]=m.useState(null),c=m.useRef(""),u=()=>Ct("/admin/api/setup").then(v=>{l(v);const g=v.done+"/"+v.complete;c.current!==g&&(c.current!==""&&r(),c.current=g)}).catch(v=>n(De(v),!0));if(m.useEffect(()=>{u();const v=window.setInterval(u,15e3);return()=>window.clearInterval(v)},[]),!i)return s.jsx(bt,{children:"Loading…"});const f=i.steps.find(v=>!v.done&&!v.optional),h=i.total?Math.round(i.done/i.total*100):100;return s.jsxs("section",{className:"grid max-w-3xl gap-4",children:[s.jsxs(Vn,{children:[s.jsxs(Bl,{children:[s.jsx(Qd,{className:"h2",children:i.complete?"All set":"Get your first review"}),s.jsx(Yd,{children:i.complete?"Everything needed for reviews is in place. This page stays here for when you add more.":`${i.done} of ${i.total} steps done. Each step is checked against what is configured right now.`})]}),s.jsxs(to,{className:"grid gap-3",children:[s.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-muted",role:"progressbar","aria-valuenow":h,"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Setup progress",children:s.jsx("div",{className:"h-full rounded-full bg-primary transition-all",style:{width:h+"%"}})}),s.jsx("div",{children:s.jsxs(ge,{variant:"outline",size:"sm",onClick:u,children:[s.jsx(Yg,{})," Check again"]})})]})]}),s.jsx("ol",{className:"grid gap-3",children:i.steps.map((v,g)=>{const y=(f==null?void 0:f.id)===v.id;return s.jsx("li",{children:s.jsx(Vn,{className:te("gap-3 py-4",y&&"border-primary ring-1 ring-primary/40"),children:s.jsxs(to,{className:"flex gap-3 px-4",children:[s.jsx("div",{className:te("mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full border text-xs font-semibold",v.done?"border-success bg-success-soft text-success":y?"border-primary text-primary":"text-muted-foreground"),"aria-hidden":!0,children:v.done?s.jsx(Ql,{className:"size-4"}):y?g+1:s.jsx(Pg,{className:"size-3"})}),s.jsxs("div",{className:"grid min-w-0 flex-1 gap-1.5",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"font-medium",children:v.title}),v.optional&&s.jsx(jn,{variant:"outline",className:"font-normal text-muted-foreground",children:"optional"}),y&&s.jsx(jn,{children:"next"}),s.jsx("span",{className:"sr-only",children:v.done?"done":"not done"})]}),v.detail&&s.jsx("div",{className:te("text-sm",v.done?"text-success":/rejected|failed|expired|not valid|won't work/.test(v.detail)?"text-destructive":"text-muted-foreground"),children:v.detail}),(!v.done||y)&&s.jsx("p",{className:"text-sm leading-relaxed text-muted-foreground",children:v.help}),v.link&&!v.done&&s.jsx("div",{children:s.jsx(ge,{asChild:!0,size:"sm",variant:y?"default":"outline",children:s.jsxs(Ho,{to:v.link,children:[W2[v.link]||"Open"," ",s.jsx(l1,{})]})})})]})]})})},v.id)})}),s.jsx(Jt,{children:"Steps update on their own every 15 seconds while this page is open, so you can set up the webhook on the code host and watch it turn green."})]})}const sf=[{path:"setup",title:"Setup",icon:k1,el:s.jsx(V2,{})},{path:"repositories",title:"Repositories",icon:p1,el:s.jsx(y2,{})},{path:"reviews",title:"Reviews",icon:c1,el:s.jsx(S2,{})},{path:"learnings",title:"Learnings",icon:a1,el:s.jsx(N2,{}),paid:"learnings"},{path:"hosts",title:"Code hosts",icon:C1,el:s.jsx(M2,{})},{path:"rules",title:"Rules",icon:h1,el:s.jsx(I2,{}),paid:"rules"},{path:"webhooks",title:"Webhooks",icon:iv,el:s.jsx(z2,{})},{path:"settings",title:"Settings",icon:_1,el:s.jsx(F2,{})},{path:"audit",title:"Audit log",icon:j1,el:s.jsx($2,{}),paid:"audit"},{path:"license",title:"License",icon:Ig,el:s.jsx(B2,{})}];function H2({me:n}){const r=n.license;return r.state==="grace"?s.jsx(Hi,{role:"status",className:"banner border-warning/40 bg-warning-soft text-warning",children:s.jsx(Gi,{className:"text-warning",children:s.jsxs("p",{children:["The Divmora license expired on ",new Date(r.expires_at).toLocaleDateString(),". Paid features stop on ",new Date(r.grace_until).toLocaleDateString(),"."," ",s.jsx(Ho,{className:"font-semibold underline underline-offset-2",to:"/license",children:"Renew"})]})})}):r.state==="expired"||r.state==="invalid"?s.jsx(Hi,{role:"status",variant:"destructive",className:"banner bad",children:s.jsx(Gi,{children:s.jsxs("p",{children:[r.state==="expired"?"The Divmora license has expired":"The Divmora license is not valid",": paid features are off."," ",s.jsx(Ho,{className:"font-semibold underline underline-offset-2",to:"/license",children:"License"})]})})}):null}function G2(){const[n,r]=m.useState(()=>{try{return localStorage.getItem("crc-theme")||"system"}catch{return"system"}}),i=c=>{r(c);try{localStorage.setItem("crc-theme",c)}catch{}const u=window.__crcApplyTheme;u?u():document.documentElement.classList.toggle("dark",c==="dark")},l=n==="light"?N1:n==="dark"?x1:v1;return s.jsxs(W_,{children:[s.jsx(V_,{asChild:!0,children:s.jsx(ge,{variant:"ghost",size:"icon",id:"theme","aria-label":"Theme",children:s.jsx(l,{})})}),s.jsxs(H_,{align:"end",children:[s.jsx(K_,{children:"Theme"}),s.jsx(Q_,{}),s.jsxs(G_,{value:n,onValueChange:i,children:[s.jsx(bu,{value:"system",children:"System"}),s.jsx(bu,{value:"light",children:"Light"}),s.jsx(bu,{value:"dark",children:"Dark"})]})]})]})}function zy(n){return sf.find(r=>n.startsWith("/"+r.path))}function K2({me:n}){const r=Dr(),{setOpenMobile:i}=os(),l=()=>Fn("/admin/logout").finally(()=>location.href="/admin/login");return s.jsxs(s2,{collapsible:"icon",children:[s.jsx(u2,{children:s.jsxs("div",{className:"flex items-center gap-2 px-1 py-1.5",children:[s.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-primary text-primary-foreground",children:s.jsx(E1,{className:"size-4"})}),s.jsxs("div",{className:"grid leading-tight group-data-[collapsible=icon]:hidden",children:[s.jsx("span",{className:"truncate text-sm font-semibold",children:"Code review"}),s.jsx("span",{className:"truncate text-xs text-muted-foreground",children:"Divmora console"})]})]})}),s.jsx(f2,{children:s.jsx(p2,{children:s.jsx(h2,{children:s.jsx(tg,{className:"side","aria-label":"Sections",children:sf.map(c=>{var h;const u=c.paid&&!n.license.features.includes(c.paid),f=((h=zy(r.pathname))==null?void 0:h.path)===c.path;return s.jsxs(ng,{children:[s.jsx(rg,{asChild:!0,isActive:f,tooltip:c.title,children:s.jsxs(Hb,{to:"/"+c.path,className:f?"on":"",onClick:()=>i(!1),children:[s.jsx(c.icon,{}),s.jsx("span",{children:c.title})]})}),c.path==="setup"&&n.setup&&!n.setup.complete&&s.jsxs(og,{className:"text-[10px] font-normal text-muted-foreground",title:"Setup steps done",children:[n.setup.done,"/",n.setup.total]}),u&&s.jsx(og,{className:"paid text-[10px] font-normal text-muted-foreground",title:"Needs a license",children:"licensed"})]},c.path)})})})})}),s.jsxs(d2,{children:[s.jsxs("div",{className:"grid gap-1 px-2 pb-1 text-xs text-muted-foreground group-data-[collapsible=icon]:hidden",children:[s.jsxs("span",{className:"truncate",children:["Signed in as ",n.name||n.email]}),s.jsx("a",{className:"underline-offset-2 hover:text-foreground hover:underline",href:"/dashboard",children:"Status dashboard"}),n.version&&s.jsxs("span",{children:["Version ",n.version]})]}),s.jsx(tg,{children:s.jsx(ng,{children:s.jsxs(rg,{id:"logout",onClick:l,tooltip:"Sign out",children:[s.jsx(m1,{}),s.jsx("span",{children:"Sign out"})]})})})]}),s.jsx(a2,{})]})}function Q2({me:n}){const r=Dr(),i=zy(r.pathname),l=(i==null?void 0:i.title)??"Repositories";return m.useEffect(()=>{document.title=l+" · Code review admin"},[l]),s.jsxs("header",{className:"sticky top-0 z-10 flex h-14 shrink-0 items-center gap-2 border-b bg-background/80 px-4 backdrop-blur",children:[s.jsx(l2,{className:"-ml-1"}),s.jsx(Jr,{orientation:"vertical",className:"mr-1 data-[orientation=vertical]:h-4"}),s.jsx("h1",{id:"pageTitle",className:"text-base font-semibold",children:l}),(i==null?void 0:i.paid)&&!n.license.features.includes(i.paid)&&s.jsx(jn,{variant:"secondary",children:"licensed"}),s.jsx("span",{className:"flex-1"}),s.jsx(G2,{})]})}function Y2(){const[n,r]=m.useState(null),[i,l]=m.useState(""),c=()=>Ct("/admin/api/me").then(u=>{R1(u.csrf),r(u)}).catch(u=>l(String(u.message||u)));return m.useEffect(()=>{c()},[]),n?s.jsx(Ty.Provider,{value:n,children:s.jsx(Oy.Provider,{value:c,children:s.jsx(Ay,{delayDuration:300,children:s.jsx($_,{children:s.jsx(U_,{children:s.jsxs(i2,{children:[s.jsx(K2,{me:n}),s.jsxs(c2,{className:"min-w-0",children:[s.jsx(Q2,{me:n}),s.jsxs("div",{className:"mx-auto grid w-full max-w-7xl gap-4 p-4 md:p-6",children:[s.jsx(H2,{me:n}),s.jsxs(Mb,{children:[s.jsx(El,{path:"/",element:s.jsx(hm,{to:n.setup&&!n.setup.complete?"/setup":"/repositories",replace:!0})}),sf.map(u=>s.jsx(El,{path:"/"+u.path,element:u.el},u.path)),s.jsx(El,{path:"*",element:s.jsx(hm,{to:"/repositories",replace:!0})})]})]})]})]})})})})})}):s.jsx("div",{className:"grid min-h-svh place-items-center text-sm text-muted-foreground",children:i||"Loading…"})}var cg;const ju=(cg=document.querySelector('meta[name="csp-nonce"]'))==null?void 0:cg.content;ju&&!ju.startsWith("__")&&Yb(ju);H0.createRoot(document.getElementById("root")).render(s.jsx(m.StrictMode,{children:s.jsx(Bb,{basename:"/admin",children:s.jsx(Y2,{})})})); diff --git a/internal/admin/ui/index.html b/internal/admin/ui/index.html index 575bdc7..6ab8a4c 100644 --- a/internal/admin/ui/index.html +++ b/internal/admin/ui/index.html @@ -8,7 +8,7 @@ - + diff --git a/internal/store/store.go b/internal/store/store.go index 58ea197..9240c94 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -157,6 +157,24 @@ type WebhookEvent struct { DurationMS int `json:"duration_ms"` } +// HostHookStats summarises a host's verified webhook deliveries in the +// history (see PruneWebhookEvents for how long it is kept). +type HostHookStats struct { + Platform string `json:"platform"` + Host string `json:"host"` + // Verified counts deliveries whose signature or token matched. + Verified int `json:"verified"` + // Comments counts verified comment events (GitLab notes, GitHub issue + // and review comments, Bitbucket comment_created). + Comments int `json:"comments"` + // SystemHook counts verified deliveries from a GitLab system hook, + // which never sends comments. + SystemHook int `json:"system_hook"` +} + +// CommentKinds are the webhook kinds that carry a comment. +var CommentKinds = []string{"note", "issue_comment", "pull_request_review_comment", "pullrequest:comment_created"} + // Webhook outcomes. const ( HookQueued = "queued" @@ -292,6 +310,8 @@ type Store interface { ListWebhookEvents(ctx context.Context, f WebhookFilter) ([]WebhookEvent, error) // CountWebhookEvents counts events by outcome since a time. CountWebhookEvents(ctx context.Context, since time.Time) (map[string]int, error) + // HookStats summarises verified deliveries per host. + HookStats(ctx context.Context) ([]HostHookStats, error) // PruneWebhookEvents deletes events older than before and keeps at most // keep rows. PruneWebhookEvents(ctx context.Context, before time.Time, keep int) (int64, error) @@ -1162,6 +1182,26 @@ func (p *Postgres) CountWebhookEvents(ctx context.Context, since time.Time) (map return out, rows.Err() } +func (p *Postgres) HookStats(ctx context.Context) ([]HostHookStats, error) { + rows, err := p.pool.Query(ctx, `SELECT platform, host, count(*), + count(*) FILTER (WHERE kind = ANY($1) OR event = 'Note Hook'), + count(*) FILTER (WHERE event = 'System Hook') + FROM webhook_events WHERE auth IN ('signature', 'token') AND host <> '' GROUP BY platform, host ORDER BY platform, host`, CommentKinds) + if err != nil { + return nil, err + } + defer rows.Close() + out := []HostHookStats{} + for rows.Next() { + var s HostHookStats + if err := rows.Scan(&s.Platform, &s.Host, &s.Verified, &s.Comments, &s.SystemHook); err != nil { + return nil, err + } + out = append(out, s) + } + return out, rows.Err() +} + func (p *Postgres) PruneWebhookEvents(ctx context.Context, before time.Time, keep int) (int64, error) { tag, err := p.pool.Exec(ctx, `DELETE FROM webhook_events WHERE received_at < $1 OR id <= (SELECT id FROM webhook_events ORDER BY id DESC OFFSET $2 LIMIT 1)`, before, keep) diff --git a/internal/store/store_test.go b/internal/store/store_test.go index 486a3ff..c9d6a82 100644 --- a/internal/store/store_test.go +++ b/internal/store/store_test.go @@ -491,3 +491,29 @@ func TestWebhookEndpointsStore(t *testing.T) { t.Errorf("a malformed ID is just not found: %v", err) } } + +func TestHookStats(t *testing.T) { + p := openTest(t) + ctx := context.Background() + host := fmt.Sprintf("stats-%d.example.com", time.Now().UnixNano()) + if err := p.InsertWebhookEvents(ctx, []WebhookEvent{ + {Platform: "gitlab", Host: host, Event: "System Hook", Kind: "merge_request", Auth: "signature"}, + {Platform: "gitlab", Host: host, Event: "Note Hook", Kind: "note", Auth: "token"}, + {Platform: "gitlab", Host: host, Event: "Note Hook", Kind: "note", Auth: "failed"}, + }); err != nil { + t.Fatal(err) + } + list, err := p.HookStats(ctx) + if err != nil { + t.Fatal(err) + } + for _, s := range list { + if s.Host == host { + if s.Verified != 2 || s.Comments != 1 || s.SystemHook != 1 { + t.Errorf("stats = %+v", s) + } + return + } + } + t.Errorf("host missing from %+v", list) +} diff --git a/internal/store/storetest/memory.go b/internal/store/storetest/memory.go index f18a075..3c886be 100644 --- a/internal/store/storetest/memory.go +++ b/internal/store/storetest/memory.go @@ -5,6 +5,7 @@ import ( "context" "encoding/json" "fmt" + "slices" "sort" "strings" "sync" @@ -371,6 +372,38 @@ func (m *Memory) InsertWebhookEvents(_ context.Context, events []store.WebhookEv return nil } +func (m *Memory) HookStats(context.Context) ([]store.HostHookStats, error) { + m.mu.Lock() + defer m.mu.Unlock() + by := map[string]*store.HostHookStats{} + var keys []string + for _, e := range m.hooks { + if (e.Auth != "signature" && e.Auth != "token") || e.Host == "" { + continue + } + k := e.Platform + ":" + e.Host + s := by[k] + if s == nil { + s = &store.HostHookStats{Platform: e.Platform, Host: e.Host} + by[k] = s + keys = append(keys, k) + } + s.Verified++ + if slices.Contains(store.CommentKinds, e.Kind) || e.Event == "Note Hook" { + s.Comments++ + } + if e.Event == "System Hook" { + s.SystemHook++ + } + } + sort.Strings(keys) + out := []store.HostHookStats{} + for _, k := range keys { + out = append(out, *by[k]) + } + return out, nil +} + func (m *Memory) ListWebhookEvents(_ context.Context, f store.WebhookFilter) ([]store.WebhookEvent, error) { m.mu.Lock() defer m.mu.Unlock() diff --git a/web/src/pages/Hosts.tsx b/web/src/pages/Hosts.tsx index 194fb27..c2e29ac 100644 --- a/web/src/pages/Hosts.tsx +++ b/web/src/pages/Hosts.tsx @@ -13,7 +13,7 @@ type Host = { id: number; platform: "github" | "gitlab" | "bitbucket"; host: string; base_url: string; name: string; enabled: boolean; settings: { app_id?: number; email?: string; require_signature?: boolean; skip_tls_verify?: boolean; bot_name?: string; reviewer?: string }; secrets: { token: boolean; app_private_key: boolean; api_token: boolean; webhook_secrets: number; signing_tokens: number }; - webhook_url: string; webhooks: Hook[]; events: string[]; licensed: boolean; + webhook_url: string; webhooks: Hook[]; events: string[]; licensed: boolean; comment_warning?: string; }; type Hook = { @@ -148,6 +148,14 @@ function HookRow({ hook, platform, onChanged }: { hook: Hook; platform: Host["pl ); } +function CommentWarning({ text }: { text: string }) { + return ( +
+ {text} +
+ ); +} + function HostWebhooks({ host, managed, onChanged }: { host: Host; managed: boolean; onChanged: () => void }) { const toast = useToast(); const [name, setName] = useState(""); @@ -164,6 +172,7 @@ function HostWebhooks({ host, managed, onChanged }: { host: Host; managed: boole const shared = host.secrets.webhook_secrets > 0 || host.secrets.signing_tokens > 0; return (
+ {host.comment_warning && } {managed && (
@@ -172,7 +181,10 @@ function HostWebhooks({ host, managed, onChanged }: { host: Host; managed: boole Add webhook
- The console generates a URL and a secret. Set the code host's webhook to them, with these events: {host.events.join(", ")}. + + The console generates a URL and a secret. Set the code host's webhook to them, with these events: {host.events.join(", ")}. + {host.platform === "gitlab" && " A system hook alone isn't enough: it doesn't send comments, so @bot commands need a group or project webhook with Comments."} +
)}
@@ -447,6 +459,11 @@ export default function Hosts() { ) : ( {h.secrets.webhook_secrets || h.secrets.signing_tokens ? "Shared URL only" : "None yet"} )} + {h.comment_warning && ( +
+ No comment events +
+ )} diff --git a/web/src/pages/Setup.tsx b/web/src/pages/Setup.tsx index afbc924..fc195f1 100644 --- a/web/src/pages/Setup.tsx +++ b/web/src/pages/Setup.tsx @@ -86,7 +86,7 @@ export default function Setup() { {isNext && next} {s.done ? "done" : "not done"}
- {s.detail &&
{s.detail}
} + {s.detail &&
{s.detail}
} {(!s.done || isNext) &&

{s.help}

} {s.link && !s.done && (