@alivault/pico 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/assets/{index-CthXqlK7.js → index-CMM5qfmc.js} +2 -2
- package/.output/public/assets/{routes-Bp0r03R8.js → routes-DKSQMHLP.js} +2 -2
- package/.output/server/_ssr/{router-Bz70uQ0p.mjs → router-w30bDftT.mjs} +2 -2
- package/.output/server/_ssr/{routes-C7oV8l68.mjs → routes-Bd3fCVcg.mjs} +5 -3
- package/.output/server/_ssr/{routes-DGvt0TQ-.mjs → routes-DUPealHx.mjs} +2 -2
- package/.output/server/_ssr/ssr.mjs +2 -2
- package/.output/server/{_tanstack-start-manifest_v-D0yEuwRY.mjs → _tanstack-start-manifest_v-BDke-OKc.mjs} +6 -6
- package/.output/server/index.mjs +643 -643
- package/README.md +2 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-BZNntD0J.js","assets/rolldown-runtime-S-ySWqyJ.js","assets/html-ddqpqPg0.js","assets/css-DRmnABqB.js","assets/javascript-Cop1kpy_.js","assets/angular-ts-SQQMYL2C.js","assets/scss-DNczJ95n.js","assets/apl-D5V6uPDr.js","assets/json-CTw4n7kn.js","assets/xml-eU7M3iZJ.js","assets/java-DVLnIrqC.js","assets/astro-DeXKSaFP.js","assets/postcss-BTQso3H9.js","assets/tsx-BjkCKOtw.js","assets/typescript-BoHeP9q1.js","assets/blade-Bu5re0Vg.js","assets/html-derivative-DWGxf_At.js","assets/sql-CrTmZCMa.js","assets/bsl-B1qbqNES.js","assets/sdbl-BmWYR-pI.js","assets/c-Nc9zJT78.js","assets/cairo-BDj8wWhy.js","assets/python-CKg5r0C3.js","assets/cobol-nvZDS9LT.js","assets/coffee-BKLOTq4e.js","assets/cpp-D6g1DVNt.js","assets/glsl-JAhLUe0P.js","assets/regexp-3-A0406L.js","assets/crystal-DfoZI57w.js","assets/shellscript-DaVPunOM.js","assets/edge-DwocGnOF.js","assets/elixir-Dtbfds1r.js","assets/elm-CpPtm471.js","assets/erb--z3IM9Cb.js","assets/ruby-Cl8PVkbY.js","assets/graphql-D2ba3BkR.js","assets/jsx-0oMUGqZj.js","assets/haml-C-oIZcDo.js","assets/lua-31hdJClp.js","assets/yaml-BTD1XHJG.js","assets/erlang-Bc4hQuqa.js","assets/markdown-BaI9LyM4.js","assets/fortran-fixed-form-B02FOYI-.js","assets/fortran-free-form-BPTf0lbT.js","assets/fsharp-DhdR18vN.js","assets/gdresource-DgnrMPIx.js","assets/gdscript-CsadCSaZ.js","assets/gdshader-PfnN_8tR.js","assets/git-commit-DGJi7qBD.js","assets/diff-CdkWtnkL.js","assets/git-rebase-Ce47xoa6.js","assets/glimmer-js-C0BuzxQC.js","assets/glimmer-ts-irOZ-cAQ.js","assets/hack-CgzUpY8l.js","assets/handlebars-CbP-Mhzf.js","assets/http-Bg1nG1nG.js","assets/hurl-zm47Pi1n.js","assets/csv-DNUpVBxl.js","assets/hxml-adC65L_J.js","assets/haxe-DfXTCEOz.js","assets/jinja-Bnj4awH5.js","assets/jison-CuCNs9Q3.js","assets/julia-DNYHzXlE.js","assets/r-UcxRcvcA.js","assets/just-BlWkkmf2.js","assets/perl-CAGVW6Ra.js","assets/latex-DqPzjMIt.js","assets/tex-D8LVuLf5.js","assets/liquid-BURJK16h.js","assets/marko-C2ZcdSLh.js","assets/less-C95PyOu0.js","assets/mdc-N1ii9pk5.js","assets/nextflow-JEyYUlIq.js","assets/nextflow-groovy-wvmJO4hi.js","assets/nginx-BuomO0W8.js","assets/nim-hKoEPsYL.js","assets/php-BycclmzS.js","assets/pug-4maJHz9G.js","assets/qml-JLIQfzyb.js","assets/razor-P8rbooCh.js","assets/csharp-BDKQY1K9.js","assets/rst-C6GHyL-N.js","assets/cmake-D5rSbMir.js","assets/sas-CXoVwlZN.js","assets/shaderlab-DZ3Lsiak.js","assets/hlsl-DpuYn7pp.js","assets/shellsession-COm1V40U.js","assets/soy-DwewhJ_3.js","assets/sparql-B9c85a_o.js","assets/turtle-CqNXyJWZ.js","assets/stata-Bl--TAbZ.js","assets/surrealql-BW79EE-U.js","assets/svelte-ziMErdPi.js","assets/templ-C_9I6ncv.js","assets/go-DLnOLj8q.js","assets/ts-tags-DKuFCGsc.js","assets/twig-Bs1kcsO6.js","assets/vue-Dnf0y5RU.js","assets/vue-html-CRtKS76J.js","assets/vue-vine-BxjPqU7T.js","assets/stylus-sKwvsUaC.js","assets/xsl-DSqe4nTO.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{n as e,r as t,t as n}from"./rolldown-runtime-S-ySWqyJ.js";import{$ as r,$n as i,$t as a,A as o,An as s,Ar as c,At as l,B as u,Bn as d,Br as f,Bt as p,C as m,Cn as h,Cr as g,Ct as _,D as v,Dn as y,Dr as b,Dt as x,E as S,En as C,Er as w,Et as T,F as E,Fn as D,Fr as O,Ft as k,G as A,Gn as j,Gr as M,Gt as N,H as P,Hn as F,Hr as I,Ht as L,I as R,In as z,Ir as B,It as V,J as H,Jn as U,Jr as W,Jt as ee,K as G,Kr as te,Kt as K,L as q,Ln as J,Lr as ne,Lt as Y,M as re,Mn as ie,Mr as ae,Mt as oe,N as se,Nn as ce,Nr as le,Nt as ue,O as de,On as fe,Or as pe,Ot as me,P as he,Pn as ge,Pr as _e,Pt as ve,Q as ye,Qt as be,R as xe,Rn as Se,Rr as Ce,Rt as we,S as Te,Sn as Ee,Sr as De,St as Oe,T as ke,Tn as Ae,Tr as je,Tt as Me,U as Ne,Un as Pe,Ur as Fe,Ut as Ie,V as Le,Vn as Re,Vr as ze,Vt as Be,W as Ve,Wn as He,Wr as Ue,Wt as We,X as Ge,Xn as Ke,Xr as qe,Xt as Je,Y as Ye,Yn as Xe,Yr as Ze,Yt as Qe,Z as $e,Zn as et,Zr as tt,Zt as nt,_ as rt,_n as it,_r as at,_t as ot,a as st,an as ct,ar as lt,at as ut,b as dt,bn as ft,br as pt,bt as mt,c as ht,cn as gt,cr as _t,ct as vt,d as yt,dn as bt,dr as xt,dt as St,en as Ct,et as wt,f as Tt,fn as Et,fr as Dt,ft as Ot,g as kt,gn as At,gr as jt,gt as Mt,h as Nt,hn as Pt,hr as Ft,ht as It,i as Lt,in as Rt,ir as zt,it as Bt,j as Vt,jn as Ht,jr as Ut,jt as Wt,k as Gt,kn as Kt,kr as qt,kt as Jt,l as Yt,ln as Xt,lr as Zt,lt as Qt,m as $t,mn as en,mr as tn,mt as nn,n as X,nn as rn,nr as an,nt as on,o as sn,on as cn,or as ln,ot as un,p as dn,pn as fn,pr as pn,pt as mn,q as hn,qn as gn,qr as _n,qt as vn,r as yn,rn as bn,rr as xn,rt as Sn,s as Cn,sn as wn,sr as Tn,st as En,t as Dn,tn as On,tr as kn,tt as An,u as jn,un as Mn,ur as Nn,ut as Pn,v as Fn,vn as In,vr as Ln,vt as Rn,w as zn,wn as Bn,wr as Vn,wt as Hn,x as Un,xn as Wn,xr as Gn,xt as Kn,y as qn,yn as Jn,yr as Yn,yt as Xn,z as Zn,zn as Qn,zr as $n,zt as er}from"./index-CthXqlK7.js";var tr=class extends Ze{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=O(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),rr(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ir(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ir(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof I(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Ue(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&ar(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||I(this.options.enabled,this.#t)!==I(t.enabled,this.#t)||Fe(this.options.staleTime,this.#t)!==Fe(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||I(this.options.enabled,this.#t)!==I(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return sr(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch($n)),t}#g(){this.#b();let e=Fe(this.options.staleTime,this.#t);if(B.isServer()||this.#r.isStale||!Ce(e))return;let t=te(this.#r.dataUpdatedAt,e)+1;this.#d=_n.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(B.isServer()||I(this.options.enabled,this.#t)===!1||!Ce(this.#p)||this.#p===0)&&(this.#f=_n.setInterval(()=>{(this.options.refetchIntervalInBackground||W.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(_n.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(_n.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&rr(e,t),o=i&&ar(e,n,t,r);(a||o)&&(l={...l,...le(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:p,errorUpdatedAt:m,status:h}=l;d=l.data;let g=!1;if(t.placeholderData!==void 0&&d===void 0&&h===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,g=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(h=`success`,d=f(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!g)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=f(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(p=this.#s,d=this.#l,m=Date.now(),h=`error`);let _=l.fetchStatus===`fetching`,v=h===`pending`,y=h===`error`,b=v&&_,x=d!==void 0,S={status:h,fetchStatus:l.fetchStatus,isPending:v,isSuccess:h===`success`,isError:y,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:p,errorUpdatedAt:m,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:or(e,t),refetch:this.refetch,promise:this.#o,isEnabled:I(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{i(this.#o=S.promise=O())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a();break}}return S}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!Ue(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){_e.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function nr(e,t){return I(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function rr(e,t){return nr(e,t)||e.state.data!==void 0&&ir(e,t,t.refetchOnMount)}function ir(e,t,n){if(I(t.enabled,e)!==!1&&Fe(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&or(e,t)}return!1}function ar(e,t,n,r){return(e!==t||I(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&or(e,n)}function or(e,t){return I(t.enabled,e)!==!1&&e.isStaleByTime(Fe(t.staleTime,e))}function sr(e,t){return!Ue(e.getCurrentResult(),t)}var cr=class extends Ze{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),Ue(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&ne(t.mutationKey)!==ne(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??ae();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){_e.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Z=t(tt(),1),lr=Z.createContext(!1),ur=()=>Z.useContext(lr);lr.Provider;var Q=Ut();function dr(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var fr=Z.createContext(dr()),pr=()=>Z.useContext(fr),mr=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?M(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},hr=e=>{Z.useEffect(()=>{e.clearReset()},[e])},gr=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||M(n,[e.error,r])),_r=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},vr=(e,t)=>e.isLoading&&e.isFetching&&!t,yr=(e,t)=>e?.suspense&&t.isPending,br=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function xr(e,t,n){let r=ur(),i=pr(),a=c(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,_r(o),mr(o,i,s),hr(i);let l=!a.getQueryCache().get(o.queryHash),[u]=Z.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&e.subscribed!==!1;if(Z.useSyncExternalStore(Z.useCallback(e=>{let t=f?u.subscribe(_e.batchCalls(e)):$n;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),Z.useEffect(()=>{u.setOptions(o)},[o,u]),yr(o,d))throw br(o,u,i);if(gr({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!B.isServer()&&vr(d,r)&&(l?br(o,u,i):s?.promise)?.catch($n).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function Sr(e,t){return xr(e,tr,t)}function Cr(e,t){let n=c(t),r=n.getQueryCache();return Z.useSyncExternalStore(Z.useCallback(e=>r.subscribe(_e.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}function wr(e,t){let n=c(t);return Er({filters:{...e,status:`pending`}},n).length}function Tr(e,t){return e.findAll(t.filters).map(e=>t.select?t.select(e):e.state)}function Er(e={},t){let n=c(t).getMutationCache(),r=Z.useRef(e),i=Z.useRef(null);return i.current===null&&(i.current=Tr(n,e)),Z.useEffect(()=>{r.current=e}),Z.useSyncExternalStore(Z.useCallback(e=>n.subscribe(()=>{let t=ze(i.current,Tr(n,r.current));i.current!==t&&(i.current=t,_e.schedule(e))}),[n]),()=>i.current,()=>i.current)}function Dr(e,t){let n=c(t),[r]=Z.useState(()=>new cr(n,e));Z.useEffect(()=>{r.setOptions(e)},[r,e]);let i=Z.useSyncExternalStore(Z.useCallback(e=>r.subscribe(_e.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=Z.useCallback((e,t)=>{r.mutate(e,t).catch($n)},[r]);if(i.error&&M(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function Or(e){return typeof e==`object`&&!!e&&`current`in e}function kr(){if(typeof navigator>`u`)return`linux`;let e=navigator.platform?.toLowerCase()??``,t=navigator.userAgent?.toLowerCase()??``;return e.includes(`mac`)||t.includes(`mac`)?`mac`:e.includes(`win`)||t.includes(`win`)?`windows`:`linux`}var Ar=[`Control`,`Alt`,`Shift`,`Meta`];new Set(Ar);var jr={Control:`Control`,Ctrl:`Control`,control:`Control`,ctrl:`Control`,Shift:`Shift`,shift:`Shift`,Alt:`Alt`,Option:`Alt`,alt:`Alt`,option:`Alt`,Command:`Meta`,Cmd:`Meta`,Meta:`Meta`,command:`Meta`,cmd:`Meta`,meta:`Meta`,OS:`Meta`,os:`Meta`,Win:`Meta`,win:`Meta`,CommandOrControl:`Mod`,Mod:`Mod`,commandorcontrol:`Mod`,mod:`Mod`};function Mr(e,t=kr()){return e===`Mod`?t===`mac`?`Meta`:`Control`:e}var Nr=new Set(`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``)),Pr=new Set([`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`]),Fr=new Set([`F1`,`F2`,`F3`,`F4`,`F5`,`F6`,`F7`,`F8`,`F9`,`F10`,`F11`,`F12`]),Ir=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`]),Lr=new Set([`Enter`,`Escape`,`Space`,`Tab`,`Backspace`,`Delete`]),Rr=new Set([`/`,`[`,`]`,`\\`,`=`,`-`,`,`,`.`,`;`,"`"]),zr={Backquote:"`",Backslash:`\\`,BracketLeft:`[`,BracketRight:`]`,Comma:`,`,Equal:`=`,Minus:`-`,Period:`.`,Semicolon:`;`,Slash:`/`};new Set([...Nr,...Pr,...Fr,...Ir,...Lr,...Rr]);var Br={Esc:`Escape`,esc:`Escape`,escape:`Escape`,Return:`Enter`,return:`Enter`,enter:`Enter`," ":`Space`,space:`Space`,Spacebar:`Space`,spacebar:`Space`,tab:`Tab`,backspace:`Backspace`,Del:`Delete`,del:`Delete`,delete:`Delete`,Up:`ArrowUp`,up:`ArrowUp`,arrowup:`ArrowUp`,Down:`ArrowDown`,down:`ArrowDown`,arrowdown:`ArrowDown`,Left:`ArrowLeft`,left:`ArrowLeft`,arrowleft:`ArrowLeft`,Right:`ArrowRight`,right:`ArrowRight`,arrowright:`ArrowRight`,home:`Home`,end:`End`,pageup:`PageUp`,pagedown:`PageDown`,PgUp:`PageUp`,PgDn:`PageDown`,pgup:`PageUp`,pgdn:`PageDown`};function Vr(e){return/^\p{Letter}$/u.test(e)}function Hr(e){if(!e)return``;if(e in Br)return Br[e];if(Vr(e)){let t=e.toUpperCase();return t.length===1?t:e}let t=e.toUpperCase();return/^F([1-9]|1[0-2])$/.test(t)?t:e}var Ur={Control:`⌃`,Alt:`⌥`,Shift:`⇧`,Meta:`⌘`,Mod:`⌘`},Wr={Control:`Control`,Alt:`Option`,Shift:`Shift`,Meta:`Cmd`,Mod:`Cmd`},Gr={Control:`Ctrl`,Alt:`Alt`,Shift:`Shift`,Meta:`Win`,Mod:`Ctrl`},Kr={...Gr,Meta:`Super`},qr={"`":`Backquote`,"\\":`Backslash`,"[":`Left Bracket`,"]":`Right Bracket`,",":`Comma`,"=":`Equal`,"-":`Minus`,".":`Period`,";":`Semicolon`},Jr={ArrowUp:`↑`,ArrowDown:`↓`,ArrowLeft:`←`,ArrowRight:`→`,Enter:`↵`,Escape:`Esc`,Backspace:`⌫`,Delete:`⌦`,Tab:`⇥`,Space:`␣`};function Yr(e,t=kr()){let n=e.split(`+`),r=new Set,i=``;for(let e=0;e<n.length;e++){let a=n[e].trim();if(e===n.length-1)i=Hr(a);else{let e=jr[a]??jr[a.toLowerCase()];if(e){let n=Mr(e,t);r.add(n)}else n.length===1&&(i=Hr(a))}}return!i&&n.length>0&&(i=Hr(n[n.length-1].trim())),{key:i,ctrl:r.has(`Control`),shift:r.has(`Shift`),alt:r.has(`Alt`),meta:r.has(`Meta`),modifiers:Ar.filter(e=>r.has(e))}}function Xr(e,t=kr()){let n=e.ctrl??!1,r=e.shift??!1,i=e.alt??!1,a=e.meta??!1;e.mod&&(Mr(`Mod`,t)===`Control`?n=!0:a=!0);let o=Ar.filter(e=>{switch(e){case`Control`:return n;case`Shift`:return r;case`Alt`:return i;case`Meta`:return a;default:return!1}});return{key:e.key,ctrl:n,shift:r,alt:i,meta:a,modifiers:o}}function Zr(e,t){let n=t===`mac`?e.meta&&!e.ctrl:e.ctrl&&!e.meta,r=[];if(n)r.push(`Mod`),e.alt&&r.push(`Alt`),e.shift&&r.push(`Shift`);else for(let t of Ar)e.modifiers.includes(t)&&r.push(t);return r.push(Hr(e.key)),r.join(`+`)}function Qr(e,t=kr()){return Zr(Yr(e,t),t)}function $r(e,t=kr()){return Zr(e,t)}function ei(e,t=kr()){return typeof e==`string`?Qr(e,t):$r(Xr(e,t),t)}function ti(e){return e in jr||e.toLowerCase()in jr}function ni(e){let t=[];for(let n of Ar)e.modifiers.includes(n)&&t.push(n);return t.push(e.key),t.join(`+`)}function ri(e,t={}){let n=t.platform??kr(),r=t.useSymbols??!0,i=t.separatorToken??(n===`mac`&&r?` `:`+`);return ei(e,n).split(`+`).map(e=>{if(ti(e)){let t=jr[e]??jr[e.toLowerCase()];return n===`mac`?r?Ur[t]:Wr[t]:n===`windows`?Gr[t]:Kr[t]}else return r&&Jr[e]||!r&&qr[e]||e}).join(i)}function ii(e,t,n=kr()){let r=typeof t==`string`?Yr(t,n):t;if(e.ctrlKey!==r.ctrl||e.shiftKey!==r.shift||e.altKey!==r.alt||e.metaKey!==r.meta)return!1;let i=Hr(e.key),a=r.key;if(i!==`Dead`&&i.length===1&&a.length===1){if(i.toUpperCase()===a.toUpperCase())return!0;if(Vr(i)&&(/^[A-Za-z]$/.test(i)||!e.altKey))return!1}if(e.code&&(i===`Dead`||i.length===1&&a.length===1)){if(e.code.startsWith(`Key`)){let t=e.code.slice(3);if(t.length===1&&/^[A-Za-z]$/.test(t))return t.toUpperCase()===a.toUpperCase()}if(e.code.startsWith(`Digit`)){let t=e.code.slice(5);if(t.length===1&&/^[0-9]$/.test(t))return t===a}return e.code in zr?zr[e.code]===a:!1}return i===a}var ai={preventDefault:!0,stopPropagation:!0,eventType:`keydown`,enabled:!0,ignoreInputs:!0,conflictBehavior:`warn`};function oi(e){return!(e.ctrl||e.meta||e.key===`Escape`)}function si(e){if(!e)return!1;if(e instanceof HTMLInputElement){let t=e.type.toLowerCase();return!(t===`button`||t===`submit`||t===`reset`)}return!!(e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable)}function ci(e){return typeof document>`u`?null:typeof Document<`u`&&e instanceof Document||typeof Node<`u`&&e.nodeType===Node.DOCUMENT_NODE?e.activeElement:typeof HTMLElement<`u`&&e instanceof HTMLElement?e.ownerDocument.activeElement??null:e.document.activeElement??null}function li(e,t,n){let r=ci(t);return r&&si(r)&&r!==n||e.composedPath().some(e=>si(e)&&e!==n)?!0:si(e.target)&&e.target!==n}function ui(e,t){return t===document||t===window?e.currentTarget===t||e.currentTarget===document.documentElement:t===window?e.currentTarget===window||e.currentTarget===document||e.currentTarget===document.documentElement:!!(t instanceof HTMLElement&&(e.currentTarget===t||e.target instanceof Node&&t.contains(e.target)))}function di(e,t,n,r){if(n!==`allow`){if(n===`warn`){console.warn(`'${t}' is already registered. Multiple handlers will be triggered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to suppress this warning.`);return}if(n===`error`)throw Error(`'${t}' is already registered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to allow multiple registrations.`);r(e)}}var fi=function(e){return e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e}({});function pi({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&(fi.RecursedCheck|fi.Recursed|fi.Dirty|fi.Pending)?a&(fi.RecursedCheck|fi.Recursed)?a&fi.RecursedCheck?!(a&(fi.Dirty|fi.Pending))&&c(e,i)?(i.flags=a|(fi.Recursed|fi.Pending),a&=fi.Mutable):a=fi.None:i.flags=a&~fi.Recursed|fi.Pending:a=fi.None:i.flags=a|fi.Pending,a&fi.Watching&&t(i),a&fi.Mutable){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&fi.Dirty)a=!0;else if((c&(fi.Mutable|fi.Dirty))===(fi.Mutable|fi.Dirty)){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&(fi.Mutable|fi.Pending))===(fi.Mutable|fi.Pending)){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=~fi.Pending;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&(fi.Pending|fi.Dirty))===fi.Pending&&(n.flags=r|fi.Dirty,(r&(fi.Watching|fi.RecursedCheck))===fi.Watching&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function mi(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var hi=[],gi=0,{link:_i,unlink:vi,propagate:yi,checkDirty:bi,shallowPropagate:xi}=pi({update(e){return e._update()},notify(e){hi[Ci++]=e,e.flags&=~fi.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=fi.Mutable|fi.Dirty,Di(e))}}),Si=0,Ci=0,wi,Ti=0;function Ei(e){try{++Ti,e()}finally{--Ti||Oi()}}function Di(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=vi(n,e)}function Oi(){if(!(Ti>0)){for(;Si<Ci;){let e=hi[Si];hi[Si++]=void 0,e.notify()}Si=0,Ci=0}}function ki(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?fi.None:fi.Mutable,get(){return wi!==void 0&&_i(i,wi,gi),i._snapshot},subscribe(e){let t=mi(e),n={current:!1},r=Ai(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=wi,o=t?.compare??Object.is;if(n)wi=i,++gi,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=fi.Mutable|fi.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{wi=a,n&&(i.flags&=~fi.RecursedCheck),Di(i)}}};return n?(i.flags=fi.Mutable|fi.Dirty,i.get=function(){let e=i.flags;if(e&fi.Dirty||e&fi.Pending&&bi(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&xi(e)}}else e&fi.Pending&&(i.flags=e&~fi.Pending);return wi!==void 0&&_i(i,wi,gi),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(yi(e),xi(e),Oi())}},i}function Ai(e){let t=()=>{let t=wi;wi=n,++gi,n.depsTail=void 0,n.flags=fi.Watching|fi.RecursedCheck;try{return e()}finally{wi=t,n.flags&=~fi.RecursedCheck,Di(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:fi.Watching|fi.RecursedCheck,notify(){let e=this.flags;e&fi.Dirty||e&fi.Pending&&bi(this.deps,this)?t():this.flags=fi.Watching},stop(){this.flags=fi.None,this.depsTail=void 0,Di(this)}};return t(),n}var ji=class{constructor(e,t){this.atom=ki(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(mi(e))}},Mi=class{constructor(e){this.atom=ki(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(mi(e))}};function Ni(e,t){return typeof e==`function`?new Mi(e):t?new ji(e,t):new ji(e)}function Pi(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=Fi(e);if(n.length!==Fi(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function Fi(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var Ii=0;function Li(){return`hotkey_${++Ii}`}var Ri=class e{static#e=null;#t;#n=new Map;#r=new Map;constructor(){this.registrations=new ji(new Map),this.#t=kr()}static getInstance(){return e.#e||=new e,e.#e}static resetInstance(){e.#e&&=(e.#e.destroy(),null)}register(e,t,n={}){if(typeof document>`u`&&!n.target){let e=t;return{id:Li(),unregister:()=>{},get callback(){return e},set callback(t){e=t},setOptions:()=>{},get isActive(){return!1}}}let r=Li(),i=n.platform??this.#t,a=typeof e==`string`?Yr(e,i):Xr(e,i),o=typeof e==`string`?e:ni(a),s=n.target??document,c=n.conflictBehavior??`warn`,l=this.#d(o,s);l&&di(l.id,o,c,e=>this.#i(e));let u=n.ignoreInputs??oi(a),d={id:r,hotkey:o,parsedHotkey:a,callback:t,options:{...ai,requireReset:!1,...n,platform:i,ignoreInputs:u},hasFired:!1,triggerCount:0,target:s};this.registrations.setState(e=>new Map(e).set(r,d)),this.#r.has(s)||this.#r.set(s,new Set),this.#r.get(s).add(r),this.#a(s);let f=this;return{get id(){return r},unregister:()=>{f.#i(r)},get callback(){return f.registrations.state.get(r)?.callback??t},set callback(e){let t=f.registrations.state.get(r);t&&(t.callback=e)},setOptions:e=>{f.registrations.setState(t=>{let n=t.get(r);if(n){let i=new Map(t);return i.set(r,{...n,options:{...n.options,...e}}),i}return t})},get isActive(){return f.registrations.state.has(r)}}}#i(e){let t=this.registrations.state.get(e);if(!t)return;let n=t.target;this.registrations.setState(t=>{let n=new Map(t);return n.delete(e),n});let r=this.#r.get(n);r&&(r.delete(e),r.size===0&&this.#o(n))}#a(e){if(typeof document>`u`||this.#n.has(e))return;let t=this.#l(e),n=this.#u(e);e.addEventListener(`keydown`,t),e.addEventListener(`keyup`,n),this.#n.set(e,{keydown:t,keyup:n})}#o(e){if(typeof document>`u`)return;let t=this.#n.get(e);t&&(e.removeEventListener(`keydown`,t.keydown),e.removeEventListener(`keyup`,t.keyup),this.#n.delete(e),this.#r.delete(e))}#s(e,t,n){let r=this.#r.get(t);if(r)for(let i of r){let r=this.registrations.state.get(i);if(r&&ui(e,t)&&r.options.enabled&&!(r.options.ignoreInputs!==!1&&li(e,t,r.target)))if(n===`keydown`){if(r.options.eventType!==`keydown`)continue;ii(e,r.parsedHotkey,r.options.platform)&&(r.options.preventDefault&&e.preventDefault(),r.options.stopPropagation&&e.stopPropagation(),(!r.options.requireReset||!r.hasFired)&&(this.#c(r,e),r.options.requireReset&&(r.hasFired=!0)))}else r.options.eventType===`keyup`&&ii(e,r.parsedHotkey,r.options.platform)&&this.#c(r,e),r.options.requireReset&&r.hasFired&&this.#f(r,e)&&(r.hasFired=!1)}}#c(e,t){e.options.preventDefault&&t.preventDefault(),e.options.stopPropagation&&t.stopPropagation(),e.triggerCount++,this.registrations.setState(e=>new Map(e));let n={hotkey:e.hotkey,parsedHotkey:e.parsedHotkey};e.callback(t,n)}#l(e){return t=>{this.#s(t,e,`keydown`)}}#u(e){return t=>{this.#s(t,e,`keyup`)}}#d(e,t){for(let n of this.registrations.state.values())if(n.hotkey===e&&n.target===t)return n;return null}#f(e,t){let n=e.parsedHotkey,r=Hr(t.key),i=n.key.length===1?n.key.toUpperCase():n.key;return!!((r.length===1?r.toUpperCase():r)===i||n.ctrl&&r===`Control`||n.shift&&r===`Shift`||n.alt&&r===`Alt`||n.meta&&r===`Meta`)}triggerRegistration(e){let t=this.registrations.state.get(e);if(!t)return!1;let n=t.parsedHotkey,r=new KeyboardEvent(t.options.eventType??`keydown`,{key:n.key,ctrlKey:n.ctrl,shiftKey:n.shift,altKey:n.alt,metaKey:n.meta,bubbles:!0,cancelable:!0});return t.triggerCount++,this.registrations.setState(e=>new Map(e)),t.callback(r,{hotkey:t.hotkey,parsedHotkey:t.parsedHotkey}),!0}getRegistrationCount(){return this.registrations.state.size}isRegistered(e,t){for(let n of this.registrations.state.values())if(n.hotkey===e&&(t===void 0||n.target===t))return!0;return!1}destroy(){for(let e of this.#n.keys())this.#o(e);this.registrations.setState(()=>new Map),this.#n.clear(),this.#r.clear()}};function zi(){return Ri.getInstance()}function Bi(e,t={}){let n=b().hotkey,r=zi(),i=t.platform??n?.platform??kr(),a=(0,Z.useRef)(new Map),o=(0,Z.useRef)(e),s=(0,Z.useRef)([]),c=(0,Z.useRef)(t),l=(0,Z.useRef)(n),u=(0,Z.useRef)(r),d=e.map(e=>ei(e.hotkey,i));o.current=e,s.current=d,c.current=t,l.current=n,u.current=r,(0,Z.useEffect)(()=>{let e=a.current,t=new Map,n=[];for(let e=0;e<o.current.length;e++){let t=o.current[e],r=s.current[e],i={...l.current,...c.current,...t.options},a=Or(i.target)?i.target.current:i.target??(typeof document<`u`?document:null);if(!a)continue;let u=`${e}:${r}`;n.push({registrationKey:u,def:t,hotkeyStr:r,mergedOptions:i,resolvedTarget:a})}let r=new Set(n.map(e=>e.registrationKey));for(let[t,n]of e)!r.has(t)&&n.handle.isActive&&n.handle.unregister();for(let r of n){let{registrationKey:n,def:i,hotkeyStr:a,mergedOptions:o,resolvedTarget:s}=r,c=e.get(n);if(c?.handle.isActive&&c.target===s){t.set(n,c);continue}c?.handle.isActive&&c.handle.unregister();let l=u.current.register(a,i.callback,{...o,target:s});t.set(n,{handle:l,target:s})}a.current=t}),(0,Z.useEffect)(()=>()=>{for(let{handle:e}of a.current.values())e.isActive&&e.unregister();a.current=new Map},[]);for(let r=0;r<e.length;r++){let i=e[r],o=d[r],s=`${r}:${o}`,c=a.current.get(s)?.handle;if(c?.isActive){c.callback=i.callback;let{target:e,...r}={...n,...t,...i.options};c.setOptions(r)}}}var Vi=qt();function Hi(e,t){return e===t}function Ui(e,t=e=>e,n){let r=n?.compare??Hi,i=(0,Z.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,Z.useCallback)(()=>e.get(),[e]);return(0,Vi.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var Wi=0;function Gi(e,t={}){let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(Wi);let a=()=>e?.focus({preventScroll:n});if(i)return a(),_t;let o=requestAnimationFrame(a);return Wi=o,()=>{Wi===o&&(cancelAnimationFrame(o),Wi=0)}}var Ki={inert:new WeakMap,"aria-hidden":new WeakMap},qi=`data-base-ui-inert`,Ji={inert:new WeakSet,"aria-hidden":new WeakSet},Yi=new WeakMap,Xi=0;function Zi(e){return Ji[e]}function Qi(e){return e?F(e)?e.host:Qi(e.parentNode):null}var $i=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Qi(t);return e.contains(n)?n:null}).filter(e=>e!=null),ea=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},ta=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{D(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function na(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){let o=r?`inert`:n?`aria-hidden`:null,s=null,c=null,l=$i(t,e),u=i?$i(t,a):[],d=new Set(u),f=i?ta(t,ea(l),new Set(l)).filter(e=>!d.has(e)):[],p=[],m=[];if(o){let e=Ki[o],n=Zi(o);c=n,s=e;let r=$i(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=l.concat(r);ta(t,ea(i),new Set(i)).forEach(t=>{let r=t.getAttribute(o),i=r!==null&&r!==`false`,a=(e.get(t)||0)+1;e.set(t,a),p.push(t),a===1&&i&&n.add(t),i||t.setAttribute(o,o===`inert`?``:`true`)})}return i&&f.forEach(e=>{let t=(Yi.get(e)||0)+1;Yi.set(e,t),m.push(e),t===1&&e.setAttribute(qi,``)}),Xi+=1,()=>{s&&p.forEach(e=>{let t=(s.get(e)||0)-1;s.set(e,t),t||(!c?.has(e)&&o&&e.removeAttribute(o),c?.delete(e))}),i&&m.forEach(e=>{let t=(Yi.get(e)||0)-1;Yi.set(e,t),t||e.removeAttribute(qi)}),--Xi,Xi||(Ki.inert=new WeakMap,Ki[`aria-hidden`]=new WeakMap,Ji.inert=new WeakSet,Ji[`aria-hidden`]=new WeakSet,Yi=new WeakMap)}}function ra(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:a=[]}=t,o=y(e[0]).body;return na(e,o,n,r,{mark:i,markerIgnoreElements:a})}function ia(e,t){let n=J(Wn(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var aa=20,oa=[];function sa(){oa=oa.filter(e=>e.deref()?.isConnected)}function ca(e){sa(),e&&D(e)!==`body`&&(oa.push(new WeakRef(e)),oa.length>aa&&(oa=oa.slice(-aa)))}function la(){return sa(),oa[oa.length-1]?.deref()}function ua(e){return e?Rt(e)?e:ct(e)[0]||e:null}function da(e){return!e||!e.isConnected?!1:typeof e.checkVisibility==`function`?e.checkVisibility():fn(e)}function fa(e,t){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=be(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Rt(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),r=e.getAttribute(`tabindex`);t.current.includes(`floating`)||n.length===0?r!==`0`&&e.setAttribute(`tabindex`,`0`):(r!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function pa(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:o=!0,restoreFocus:c=!1,modal:l=!0,closeOnFocusOut:u=!0,openInteractionType:d=``,nextFocusableElement:f,previousFocusableElement:m,beforeContentFocusGuardRef:h,externalTree:g,getInsideElements:_}=e,v=`rootStore`in t?t.rootStore:t,b=v.useState(`open`),x=v.useState(`domReferenceElement`),S=v.useState(`floatingElement`),{events:w,dataRef:T}=v.context,E=s(()=>T.current.floatingContext?.nodeId),D=i===!1,O=it(x)&&D,A=Z.useRef([`content`]),j=Ht(i),M=Ht(o),N=Ht(d),P=p(g),F=Ie(),I=Z.useRef(!1),L=Z.useRef(!1),R=Z.useRef(!1),z=Z.useRef(null),B=Z.useRef(``),V=Z.useRef(``),H=Z.useRef(null),U=Z.useRef(null),W=ie(H,h,F?.beforeInsideRef),ee=ie(U,F?.afterInsideRef),G=Ln(),te=Ln(),K=Kt(),q=F!=null,J=At(S),ne=s((e=J)=>e?ct(e):[]),Y=s(()=>_?.().filter(e=>e!=null)??[]);Z.useEffect(()=>{if(r||!l)return;function e(e){e.key===`Tab`&&ft(J,Jn(y(J)))&&ne().length===0&&!O&&pn(e)}return ge(y(J),`keydown`,e)},[r,x,J,l,A,O,ne]),Z.useEffect(()=>{if(r||!b)return;let e=y(J);function t(){R.current=!1}function n(e){let t=Wn(e),n=Y();R.current=!(ft(S,t)||ft(x,t)||ft(F?.portalNode,t)||n.some(e=>e===t||ft(e,t))),V.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(L.current=!0)}function i(){V.current=`keyboard`}return ce(ge(e,`pointerdown`,n,!0),ge(e,`pointerup`,t,!0),ge(e,`pointercancel`,t,!0),ge(e,`keydown`,i,!0))},[r,S,x,J,b,F,Y]),Z.useEffect(()=>{if(r||!u)return;let e=y(J);function t(){L.current=!0,te.start(0,()=>{L.current=!1})}function n(e){let t=Wn(e);Rt(t)&&(z.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=Wn(t);queueMicrotask(()=>{let a=E(),o=v.context.triggerElements,s=Y(),u=n?.hasAttribute(Qe(`focus-guard`))&&[H.current,U.current,F?.beforeInsideRef.current,F?.afterInsideRef.current,F?.beforeOutsideRef.current,F?.afterOutsideRef.current,k(m),k(f)].includes(n),d=!(ft(x,n)||ft(S,n)||ft(n,S)||ft(F?.portalNode,n)||s.some(e=>e===n||ft(e,n))||n!=null&&o.hasElement(n)||o.hasMatchingElement(e=>ft(e,n))||u||P&&(nt(P.nodesRef.current,a).find(e=>ft(e.context?.elements.floating,n)||ft(e.context?.elements.domReference,n))||Je(P.nodesRef.current,a).find(e=>[e.context?.elements.floating,At(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===x&&J&&fa(J,A),c&&r!==x&&!da(i)&&Jn(e)===e.body){if(Qn(J)&&(J.focus(),c===`popup`)){K.request(()=>{J.focus()});return}let e=ne(),t=z.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||J;Qn(n)&&n.focus()}if(T.current.insideReactTree){T.current.insideReactTree=!1;return}(O||!l)&&n&&d&&!L.current&&(O||n!==la())&&(I.current=!0,v.setOpen(!1,Pe(gn,t)))})}function a(){R.current||(T.current.insideReactTree=!0,G.start(0,()=>{T.current.insideReactTree=!1}))}let o=Qn(x)?x:null;if(!(!S&&!o))return ce(o&&ge(o,`focusout`,i),o&&ge(o,`pointerdown`,t),S&&ge(S,`focusin`,n),S&&ge(S,`focusout`,i),S&&F&&ge(S,`focusout`,a,!0))},[r,x,S,J,l,P,F,v,u,c,ne,O,E,A,T,G,te,K,f,m,Y]),Z.useEffect(()=>{if(r||!S||!b)return;let e=Array.from(F?.portalNode?.querySelectorAll(`[${Qe(`portal`)}]`)||[]),t=(P?Je(P.nodesRef.current,E()):[]).find(e=>it(e.context?.elements.domReference||null))?.context?.elements.domReference,n=ra([...[S,...e,H.current,U.current,F?.beforeOutsideRef.current,F?.afterOutsideRef.current,...Y()],t,k(m),k(f),O?x:null].filter(e=>e!=null),{ariaHidden:l||O,mark:!1}),i=ra([S,...e].filter(e=>e!=null));return()=>{i(),n()}},[b,r,x,S,l,A,F,O,P,E,f,m,Y]),Gn(()=>{if(!b||r||!Qn(J))return;let e=Jn(y(J));queueMicrotask(()=>{let t=j.current,n=typeof t==`function`?t(N.current||``):t;if(n===void 0||n===!1||ft(J,e))return;let r=null,i=()=>(r??=ne(J),r[0]||J),a;a=n===!0||n===null?i():k(n),a||=i(),Gi(a,{preventScroll:a===J})})},[r,b,J,D,ne,j,N]),Gn(()=>{if(r||!J)return;let e=y(J);ca(Jn(e));function t(e){if(e.open||(B.current=ia(e.nativeEvent,V.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(I.current=!0),e.reason===`outside-press`)if(e.nested)I.current=!1;else if(xt(e.nativeEvent)||Dt(e.nativeEvent))I.current=!1;else{let e=!1;y(J).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?I.current=!1:I.current=!0}}w.on(`openchange`,t);function n(){let e=M.current,t=typeof e==`function`?e(B.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`){let e=x||la();return e&&e.isConnected?e:null}let n=x||la();return k(t)||n||null}return()=>{w.off(`openchange`,t);let r=Jn(e),i=Y(),a=ft(S,r)||i.some(e=>e===r||ft(e,r))||P&&nt(P.nodesRef.current,E(),!1).some(e=>ft(e.context?.elements.floating,r)),o=M.current,s=n();queueMicrotask(()=>{let t=ua(s),n=typeof o!=`boolean`;o&&!I.current&&Qn(t)&&(!(!n&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),I.current=!1})}},[r,S,J,M,T,w,P,x,E,Y]),Gn(()=>{if(!jt||b||!S)return;let e=Jn(y(S));!Qn(e)||!In(e)||ft(S,e)&&e.blur()},[b,S]),Gn(()=>{if(!(r||!F))return F.setFocusManagerState({modal:l,closeOnFocusOut:u,open:b,onOpenChange:v.setOpen,domReference:x}),()=>{F.setFocusManagerState(null)}},[r,F,l,b,v,u,x]),Gn(()=>{if(!(r||!J))return fa(J,A),()=>{queueMicrotask(sa)}},[r,J,A]);let re=!r&&(l?!O:!0)&&(q||l);return(0,Q.jsxs)(Z.Fragment,{children:[re&&(0,Q.jsx)(C,{"data-type":`inside`,ref:W,onFocus:e=>{if(l){let e=ne();Gi(e[e.length-1])}else F?.portalNode&&(I.current=!1,bn(e,F.portalNode)?a(x)?.focus():k(m??F.beforeOutsideRef)?.focus())}}),n,re&&(0,Q.jsx)(C,{"data-type":`inside`,ref:ee,onFocus:e=>{l?Gi(ne()[0]):F?.portalNode&&(u&&(I.current=!0),bn(e,F.portalNode)?Ct(x)?.focus():k(f??F.afterOutsideRef)?.focus())}})]})}function ma(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,{enabled:i=!0,event:a=`click`,toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:c=!0,touchOpenDelay:l=0,reason:u=an}=t,d=Z.useRef(void 0),f=Kt(),p=Ln(),m=Z.useMemo(()=>({onPointerDown(e){d.current=e.pointerType},onMouseDown(e){let t=d.current,i=e.nativeEvent,m=n.select(`open`);if(e.button!==0||a===`click`||Nn(t,!0)&&s)return;let h=r.current.openEvent,g=h?.type,_=n.select(`domReferenceElement`)!==e.currentTarget,v=m&&_||!(m&&o&&(!(h&&c)||g===`click`||g===`mousedown`)),y=Wn(i);if(In(y)){let e=Pe(u,i,y);v&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(v,e);return}let b=e.currentTarget;f.request(()=>{let e=Pe(u,i,b);v&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(v,e)})},onClick(e){if(a===`mousedown-only`)return;let t=d.current;if(a===`mousedown`&&t){d.current=void 0;return}if(Nn(t,!0)&&s)return;let i=n.select(`open`),f=r.current.openEvent,m=n.select(`domReferenceElement`)!==e.currentTarget,h=i&&m||!(i&&o&&(!(f&&c)||Zt(f))),g=Pe(u,e.nativeEvent,e.currentTarget);h&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,g)}):n.setOpen(h,g)},onKeyDown(){d.current=void 0}}),[r,a,s,n,c,o,f,p,l,u]);return Z.useMemo(()=>i?{reference:m}:Tn,[i,m])}function ha(e){let t=e.currentTarget.getBoundingClientRect();return t.top+1<=e.clientY&&e.clientY<=t.bottom-1&&t.left+1<=e.clientX&&e.clientX<=t.right-1}var ga=`Escape`;function _a(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function va(e,t){return _a(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function ya(e,t,n){return _a(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function ba(e,t,n){return _a(t,n?e===h:e===Bn,e===Ee)}function eee(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===ga:_a(t,n?e===Bn:e===h,e===Ae)}function tee(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{listRef:c,activeIndex:l,onNavigate:u=()=>{},enabled:d=!0,selectedIndex:f=null,allowEscape:m=!1,loopFocus:h=!1,nested:g=!1,rtl:_=!1,virtual:v=!1,focusItemOnOpen:b=`auto`,focusItemOnHover:x=!0,openOnArrowKeyDown:S=!0,disabledIndices:C=void 0,orientation:w=`vertical`,parentOrientation:T,cols:E=1,id:D,resetOnPointerLeave:O=!0,externalTree:k}=t,A=Ht(At(i)),j=er(),M=p(k);Gn(()=>{o.current.orientation=w},[o,w]);let N=it(a),P=Z.useRef(b),F=Z.useRef(f??-1),I=Z.useRef(null),L=Z.useRef(!0),R=s(e=>{u(F.current===-1?null:F.current,e)}),z=Z.useRef(R),B=Z.useRef(!!i),V=Z.useRef(r),H=Z.useRef(!1),U=Z.useRef(!1),W=Z.useRef(null),ee=Ht(C),G=Ht(r),te=Ht(f),K=Ht(O),q=s(()=>{function e(e){v?M?.events.emit(`virtualfocus`,e):W.current=Gi(e,{sync:H.current,preventScroll:!0})}let t=c.current[F.current],n=U.current;t&&e(t),(H.current?e=>e():requestAnimationFrame)(()=>{let r=c.current[F.current]||t;r&&(t||e(r),Y&&(n||!L.current)&&r.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Gn(()=>{d&&(r&&i?(F.current=f??-1,P.current&&f!=null&&(U.current=!0,R())):B.current&&(F.current=-1,z.current()))},[d,r,i,f,R]),Gn(()=>{if(d){if(!r){H.current=!1;return}if(i)if(l==null){if(H.current=!1,te.current!=null)return;if(B.current&&(F.current=-1,q()),(!V.current||!B.current)&&P.current&&(I.current!=null||P.current===!0&&I.current==null)){let e=0,t=()=>{c.current[0]==null?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e+=1):(F.current=I.current==null||ya(I.current,w,_)||g?Et(c):bt(c),I.current=null,R())};t()}}else en(c.current,l)||(F.current=l,q(),U.current=!1)}},[d,r,i,l,te,g,c,w,_,R,q,ee]),Gn(()=>{if(!d||i||!M||v||!B.current)return;let e=M.nodesRef.current,t=e.find(e=>e.id===j)?.context?.elements.floating,n=Jn(y(i)),r=e.some(e=>e.context&&ft(e.context.elements.floating,n));t&&!r&&L.current&&t.focus({preventScroll:!0})},[d,i,M,j,v]),Gn(()=>{z.current=R,V.current=r,B.current=!!i}),Gn(()=>{r||(I.current=null,P.current=b)},[r,b]);let J=l!=null,ne=s(e=>{if(!G.current)return;let t=c.current.indexOf(e.currentTarget);t!==-1&&(F.current!==t||l!==t)&&(F.current=t,R(e))}),Y=Z.useMemo(()=>({onFocus(e){H.current=!0,ne(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){H.current=!0,U.current=!1,x&&ne(e)},onPointerLeave(e){if(!G.current||!L.current||e.pointerType===`touch`)return;H.current=!0;let t=e.relatedTarget;if(!ha(e)&&!(!x||c.current.includes(t))&&K.current&&(W.current?.(),W.current=null,F.current=-1,R(e),!v)){let e=A.current,t=Jn(y(e));e&&ft(e,t)&&e.focus({preventScroll:!0})}}}),[ne,G,A,x,c,R,K,v]),re=Z.useCallback(()=>T??M?.nodesRef.current.find(e=>e.id===j)?.context?.dataRef?.current.orientation,[j,M,T]),ie=s(e=>{if(L.current=!1,H.current=!0,e.which===229||!G.current&&e.currentTarget===A.current)return;if(g&&eee(e.key,w,_,E)){va(e.key,re())||pn(e),n.setOpen(!1,Pe(Ke,e.nativeEvent)),Qn(a)&&(v?M?.events.emit(`virtualfocus`,a):a.focus());return}let t=F.current,i=Et(c,C),o=bt(c,C);if(N||(e.key===`Home`&&(pn(e),F.current=i,R(e)),e.key===`End`&&(pn(e),F.current=o,R(e))),E>1){let t=Array.from({length:c.current.length},()=>({width:1,height:1})),n=cn(t,E,!1),r=n.findIndex(e=>e!=null&&!Pt(c.current,e,C)),a=n.reduce((e,t,n)=>t!=null&&!Pt(c.current,t,C)?n:e,-1),s=n[Mn(n.map(e=>e==null?null:c.current[e]),{event:e,orientation:w,loopFocus:h,rtl:_,cols:E,disabledIndices:Xt([...(typeof C==`function`?null:C)||c.current.map((e,t)=>Pt(c.current,t,C)?t:void 0),void 0],n),minIndex:r,maxIndex:a,prevIndex:gt(F.current>o?i:F.current,t,n,E,e.key===`ArrowDown`?`bl`:e.key===(_?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(s!=null&&(F.current=s,R(e)),w===`both`)return}if(va(e.key,w)){if(pn(e),r&&!v&&Jn(e.currentTarget.ownerDocument)===e.currentTarget){F.current=ya(e.key,w,_)?i:o,R(e);return}ya(e.key,w,_)?h?t>=o?m&&t!==c.current.length?F.current=-1:(H.current=!1,F.current=i):F.current=wn(c.current,{startingIndex:t,disabledIndices:C}):F.current=Math.min(o,wn(c.current,{startingIndex:t,disabledIndices:C})):h?t<=i?m&&t!==-1?F.current=c.current.length:(H.current=!1,F.current=o):F.current=wn(c.current,{startingIndex:t,decrement:!0,disabledIndices:C}):F.current=Math.max(i,wn(c.current,{startingIndex:t,decrement:!0,disabledIndices:C})),en(c.current,F.current)&&(F.current=-1),R(e)}}),ae=Z.useMemo(()=>v&&r&&J&&{"aria-activedescendant":`${D}-${l}`},[v,r,J,D,l]),oe=Z.useMemo(()=>({"aria-orientation":w===`both`?void 0:w,...N?{}:ae,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&r&&!v){let t=Wn(e.nativeEvent);if(t&&!ft(A.current,t))return;pn(e),n.setOpen(!1,Pe(gn,e.nativeEvent)),Qn(a)&&a.focus();return}ie(e)},onPointerMove(){L.current=!0}}),[ae,ie,A,w,N,n,r,v,a]),se=Z.useMemo(()=>{function e(e){b===`auto`&&xt(e.nativeEvent)&&(P.current=!v)}function t(e){P.current=b,b===`auto`&&Dt(e.nativeEvent)&&(P.current=!0)}return{onKeyDown(e){let t=n.select(`open`);L.current=!1;let r=e.key.startsWith(`Arrow`),i=ba(e.key,re(),_),a=va(e.key,w),o=(g?i:a)||e.key===`Enter`||e.key.trim()===``;if(v&&t)return ie(e);if(!(!t&&!S&&r)){if(o){let t=va(e.key,re());I.current=g&&t?null:e.key}if(g){i&&(pn(e),t?(F.current=Et(c,ee.current),R(e)):n.setOpen(!0,Pe(Ke,e.nativeEvent,e.currentTarget)));return}a&&(te.current!=null&&(F.current=te.current),pn(e),!t&&S?n.setOpen(!0,Pe(Ke,e.nativeEvent,e.currentTarget)):ie(e),t&&R(e))}},onFocus(e){n.select(`open`)&&!v&&(F.current=-1,R(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[ie,ee,b,c,g,R,n,S,w,re,_,te,v]),ce=Z.useMemo(()=>({...ae,...se}),[ae,se]);return Z.useMemo(()=>d?{reference:ce,floating:oe,item:Y,trigger:se}:{},[d,ce,oe,se,Y])}var nee=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function xa(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingId`),a=n.useState(`domReferenceElement`),o=n.useState(`floatingElement`),{role:s=`dialog`}=t,c=ee(),l=a?.id||c,u=Z.useMemo(()=>At(o)?.id||i,[o,i]),d=nee.get(s)??s,f=er()!=null,p=Z.useMemo(()=>d===`tooltip`||s===`label`?Tn:{"aria-haspopup":d===`alertdialog`?`dialog`:d,"aria-expanded":`false`,...d===`listbox`&&{role:`combobox`},...d===`menu`&&f&&{role:`menuitem`},...s===`select`&&{"aria-autocomplete":`none`},...s===`combobox`&&{"aria-autocomplete":`list`}},[d,f,s]),m=Z.useMemo(()=>d===`tooltip`||s===`label`?{[`aria-${s===`label`?`labelledby`:`describedby`}`]:r?u:void 0}:{...p,"aria-expanded":r?`true`:`false`,"aria-controls":r?u:void 0,...d===`menu`&&{id:l}},[d,u,r,l,s,p]),h=Z.useMemo(()=>{let e={id:u,...d&&{role:d}};return d===`tooltip`||s===`label`?e:{...e,...d===`menu`&&{"aria-labelledby":l}}},[d,u,l,s]),g=Z.useCallback(({active:e,selected:t})=>{let n={role:`option`,...e&&{id:`${u}-fui-option`}};switch(s){case`select`:case`combobox`:return{...n,"aria-selected":t};default:}return{}},[u,s]);return Z.useMemo(()=>({reference:m,floating:h,item:g,trigger:p}),[m,h,p,g])}function Sa(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,i=n.useState(`open`),{listRef:a,elementsRef:o,activeIndex:c,onMatch:l,onTypingChange:u,enabled:d=!0,resetMs:f=750,selectedIndex:p=null}=t,m=Ln(),h=Z.useRef(``),g=Z.useRef(p??c??-1),_=Z.useRef(null);Gn(()=>{!i&&p!==null||(m.clear(),_.current=null,h.current!==``&&(h.current=``))},[i,p,m]),Gn(()=>{i&&h.current===``&&(g.current=p??c??-1)},[i,p,c]);let v=s(e=>{e?r.current.typing||(r.current.typing=e,u?.(e)):r.current.typing&&(r.current.typing=e,u?.(e))}),y=s(e=>{function t(e){let t=o?.current[e];return!t||fn(t)}function n(e,n,r=0){if(e.length===0)return-1;let i=(r%e.length+e.length)%e.length,a=n.toLocaleLowerCase();for(let n=0;n<e.length;n+=1){let r=(i+n)%e.length;if(!(!e[r]?.toLocaleLowerCase().startsWith(a)||!t(r)))return r}return-1}let r=a.current;if(h.current.length>0&&e.key===` `&&(pn(e),v(!0)),h.current.length>0&&h.current[0]!==` `&&n(r,h.current)===-1&&e.key!==` `&&v(!1),r==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;i&&e.key!==` `&&(pn(e),v(!0));let s=h.current===``;s&&(g.current=p??c??-1),r.every(e=>e?e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase():!0)&&h.current===e.key&&(h.current=``,g.current=_.current),h.current+=e.key,m.start(f,()=>{h.current=``,g.current=_.current,v(!1)});let u=((s?p??c??-1:g.current)??0)+1,d=n(r,h.current,u);d===-1?e.key!==` `&&(h.current=``,v(!1)):(l?.(d),_.current=d)}),b=s(e=>{let t=e.relatedTarget,r=n.select(`domReferenceElement`),i=n.select(`floatingElement`),a=ft(r,t),o=ft(i,t);a||o||(m.clear(),h.current=``,g.current=_.current,v(!1))}),x=Z.useMemo(()=>({onKeyDown:y,onBlur:b}),[y,b]),S=Z.useMemo(()=>({onKeyDown:y,onBlur:b}),[y,b]);return Z.useMemo(()=>d?{reference:x,floating:S}:{},[d,x,S])}function Ca(e){return vn(19)?e:e?`true`:void 0}var wa=An(`arrow-up-to-line`,[[`path`,{d:`M5 3h14`,key:`7usisc`}],[`path`,{d:`m18 13-6-6-6 6`,key:`1kf1n9`}],[`path`,{d:`M12 7v14`,key:`1akyts`}]]),Ta=An(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Ea=An(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Da=An(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Oa=An(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),ka=An(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Aa=An(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),ja=An(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Ma=An(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Na=An(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Pa=An(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Fa=An(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Ia=An(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),La=An(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Ra=An(`image-plus`,[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]),za=An(`list-end`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M16 12H3`,key:`1a2rj7`}],[`path`,{d:`M9 19H3`,key:`s61nz1`}],[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M21 5v12a2 2 0 0 1-2 2h-6`,key:`hey24a`}]]),Ba=An(`list-start`,[[`path`,{d:`M3 5h6`,key:`1ltk0q`}],[`path`,{d:`M3 12h13`,key:`ppymz1`}],[`path`,{d:`M3 19h13`,key:`bpdczq`}],[`path`,{d:`m16 8-3-3 3-3`,key:`1pjpp6`}],[`path`,{d:`M21 19V7a2 2 0 0 0-2-2h-6`,key:`4zzq67`}]]),Va=An(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),Ha=An(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),Ua=An(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Wa=An(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),Ga=An(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Ka=An(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),qa=An(`square-arrow-out-up-right`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]),Ja=An(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Ya=An(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Xa=An(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Za=An(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),Qa=An(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function $a(e){return typeof e==`function`}function eo(e,...t){return $a(e)?e(...t):e}var to=class{#e=!0;#t;#n;#r;#i;#a;#o;#s;#c=0;#l=5;#u=!1;#d=!1;#f=null;#p=()=>{this.debugLog(`Connected to event bus`),this.#a=!0,this.#u=!1,this.debugLog(`Emitting queued events`,this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener(`tanstack-connect-success`,this.#p)};#m=()=>{if(this.#c<this.#l){this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{});return}this.#n().removeEventListener(`tanstack-connect`,this.#m),this.#d=!0,this.debugLog(`Max retries reached, giving up on connection`),this.stopConnectLoop()};#h=()=>{this.#u||(this.#u=!0,this.#n().addEventListener(`tanstack-connect-success`,this.#p),this.#m())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(` Initializing event subscription for plugin`,this.#t),this.#i=[],this.#a=!1,this.#d=!1,this.#o=null,this.#s=r}startConnectLoop(){this.#o!==null||this.#a||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#o=setInterval(this.#m,this.#s))}stopConnectLoop(){this.#u=!1,this.#o!==null&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog(`Stopped connect loop`))}debugLog(...e){this.#r&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if(typeof globalThis<`u`&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog(`Using global event target`),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<`u`&&window.addEventListener!==void 0)return this.debugLog(`Using window as event target`),window;let e=typeof EventTarget<`u`?new EventTarget:void 0;return e===void 0||e.addEventListener===void 0?(this.debugLog(`No event mechanism available, running in non-web environment`),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog(`Using new EventTarget as fallback`),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch{this.debugLog(`Failed to dispatch shim event`)}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog(`Emitting event to client bus`,e),this.dispatchCustomEvent(`tanstack-dispatch-event`,e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e){this.debugLog(`Event bus client is disabled, not emitting event`,e,t);return}if(this.#f&&(this.debugLog(`Emitting event to internal event target`,e,t),this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d){this.debugLog(`Previously failed to connect, not emitting to bus`);return}if(!this.#a){this.debugLog(`Bus not available, will be pushed as soon as connected`),this.#i.push(this.createEventPayload(e,t)),typeof CustomEvent<`u`&&!this.#u&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#f||=new EventTarget,this.#f.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`,i),()=>{};let a=e=>{this.debugLog(`Received event from bus`,e.detail),t(e.detail)};return this.#n().addEventListener(i,a),this.debugLog(`Registered event to bus`,i),()=>{r&&this.#f?.removeEventListener(i,a),this.#n().removeEventListener(i,a)}}onAll(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}},no=new Map;function ro(e,t){no.set(e,t)}function io(e){if(e!==void 0)try{return JSON.parse(JSON.stringify(e))}catch{return null}}function ao(e){return typeof e.get==`function`?e.get():e.state}function oo(e){return{key:e.key,store:{state:io(ao(e.store))},options:io(e.options)}}var so=class extends to{constructor(e){super({pluginId:`pacer`,debug:e?.debug,reconnectEveryMs:1e3})}},co=(e,t)=>{let n=t.key;n&&(ro(n,t),lo.emit(e,oo({...t,key:n})))},lo=new so;function uo(){return{currentAttempt:0,executionCount:0,isExecuting:!1,lastError:void 0,lastExecutionTime:0,lastResult:void 0,status:`idle`,totalExecutionTime:0}}var fo={backoff:`exponential`,baseWait:1e3,maxWait:1/0,enabled:!0,jitter:0,maxAttempts:3,maxExecutionTime:1/0,maxTotalExecutionTime:1/0,throwOnError:`last`},ree=class{#e;constructor(e,t={}){this.fn=e,this.store=new ji(uo()),this.#e=null,this.setOptions=e=>{this.options={...this.options,...e}},this.#t=e=>{this.store.setState(t=>{let n={...t,...e},{isExecuting:r,currentAttempt:i}=n;return{...n,status:this.#n()?r&&i===1?`executing`:r&&i>1?`retrying`:`idle`:`disabled`}}),co(`AsyncRetryer`,this)},this.#n=()=>!!eo(this.options.enabled,this),this.#r=()=>eo(this.options.maxAttempts,this),this.#i=()=>eo(this.options.baseWait,this),this.#a=()=>eo(this.options.maxWait,this),this.#o=e=>{let t=this.options.jitter;if(t<=0)return 0;try{let n=typeof globalThis<`u`?globalThis.crypto:void 0;if(n?.getRandomValues){let r=new Uint32Array(1);n.getRandomValues(r);let i=r[0]/4294967295*2-1;return Math.floor(e*t*i)}}catch{}return 0},this.#s=e=>{let t=this.#i(),n;switch(this.options.backoff){case`linear`:n=t*e;break;case`exponential`:n=t*2**(e-1);break;default:n=t;break}n=Math.min(n,this.#a());let r=this.#o(n);return Math.max(0,n+r)},this.execute=async(...e)=>{if(!this.#n())return;this.abort(`new-execution`);let t=Date.now(),n,r;this.#e=new AbortController;let i=this.#e.signal;this.#t({isExecuting:!0,currentAttempt:0,lastError:void 0});let a;this.options.maxTotalExecutionTime!==1/0&&(a=setTimeout(()=>{this.options.onTotalExecutionTimeout?.(this),this.abort(`total-timeout`)},this.options.maxTotalExecutionTime));let o=!1;for(let a=1;a<=this.#r();a++){o=a===this.#r(),this.#t({currentAttempt:a});try{if(i.aborted)return;let n=Date.now()-t;if(this.options.maxTotalExecutionTime!==1/0&&n>=this.options.maxTotalExecutionTime){this.options.onTotalExecutionTimeout?.(this),this.abort(`total-timeout`);return}if(r=this.options.maxExecutionTime===1/0?await this.fn(...e):await Promise.race([this.fn(...e),new Promise((e,t)=>{let n=setTimeout(()=>{this.options.onExecutionTimeout?.(this),this.abort(`execution-timeout`),t(Error(`Execution timeout: ${this.options.maxExecutionTime}ms exceeded`))},this.options.maxExecutionTime);i.addEventListener(`abort`,()=>{clearTimeout(n),t(Error(`Aborted`))},{once:!0})})]),i.aborted)return;let a=Date.now()-t;return this.#t({executionCount:this.store.state.executionCount+1,isExecuting:!1,lastExecutionTime:Date.now(),totalExecutionTime:a,currentAttempt:0,lastResult:r}),this.options.onSuccess?.(r,e,this),r}catch(t){if(t&&typeof t==`object`&&`name`in t&&t.name===`AbortError`)return;if(n=t instanceof Error?t:Error(String(t)),this.#t({lastError:n}),this.options.onError?.(n,e,this),a<this.#r()){this.options.onRetry?.(a,n,this);let e=this.#s(a);if(e>0&&(this.#t({isExecuting:!0,currentAttempt:a+1}),await new Promise(t=>{let n=setTimeout(()=>{i.removeEventListener(`abort`,r),t()},e),r=()=>{clearTimeout(n),i.removeEventListener(`abort`,r),t()};i.addEventListener(`abort`,r)}),i.aborted))return}}finally{this.options.onSettled?.(e,this)}}if(a&&clearTimeout(a),this.#t({isExecuting:!1}),this.options.onLastError?.(n,this),this.options.onSettled?.(e,this),this.options.throwOnError===`last`&&o||this.options.throwOnError===!0)throw n},this.getAbortSignal=()=>this.#e?.signal??null,this.abort=(e=`manual`)=>{this.#e&&(this.#e.abort(),this.#e=null,this.#t({isExecuting:!1}),this.options.onAbort?.(e,this))},this.reset=()=>{this.#t(uo())},this.key=t.key,this.options={...fo,...t,throwOnError:t.throwOnError??(t.onError?!1:fo.throwOnError)},this.#t(this.options.initialState??{}),this.key&&lo.on(`d-AsyncRetryer`,e=>{e.payload.key===this.key&&(this.#t(e.payload.store.state),this.setOptions(e.payload.options))})}#t;#n;#r;#i;#a;#o;#s};function po(){return{canLeadingExecute:!0,errorCount:0,isExecuting:!1,isPending:!1,lastArgs:void 0,lastResult:void 0,maybeExecuteCount:0,settleCount:0,status:`idle`,successCount:0}}var mo={asyncRetryerOptions:{maxAttempts:1},enabled:!0,leading:!1,trailing:!0,wait:0},ho=class{#e;#t;constructor(e,t){this.fn=e,this.store=new ji(po()),this.asyncRetryers=new Map,this.#e=null,this.#t=null,this.setOptions=e=>{this.options={...this.options,...e},this.#r()||this.cancel()},this.#n=e=>{this.store.setState(t=>{let n={...t,...e},{isPending:r,isExecuting:i,settleCount:a}=n;return{...n,status:this.#r()?r?`pending`:i?`executing`:a>0?`settled`:`idle`:`disabled`}}),co(`AsyncDebouncer`,this)},this.#r=()=>!!eo(this.options.enabled,this),this.#i=()=>eo(this.options.wait,this),this.maybeExecute=async(...e)=>{if(this.#r())return this.#c(),this.#n({lastArgs:e,maybeExecuteCount:this.store.state.maybeExecuteCount+1}),this.options.leading&&this.store.state.canLeadingExecute?(this.#n({canLeadingExecute:!1}),await this.#a(...e),this.store.state.lastResult):(this.options.trailing&&this.#r()&&this.#n({isPending:!0}),new Promise((e,t)=>{this.#t=e,this.#e=setTimeout(async()=>{if(this.options.trailing&&this.store.state.lastArgs)try{await this.#a(...this.store.state.lastArgs)}catch(e){t(e)}this.#n({canLeadingExecute:!0}),this.#t=null,e(this.store.state.lastResult)},this.#i())}))},this.#a=async(...e)=>{if(!this.#r())return;let t=this.store.state.maybeExecuteCount+1;try{this.#n({isExecuting:!0});let n=new ree(this.fn,{...this.options.asyncRetryerOptions,key:`${this.key}-retryer-${t}`});this.asyncRetryers.set(t,n);let r=await n.execute(...e);this.#n({lastResult:r,successCount:this.store.state.successCount+1}),this.options.onSuccess?.(r,e,this)}catch(t){if(this.#n({errorCount:this.store.state.errorCount+1}),this.options.onError?.(t,e,this),this.options.throwOnError)throw t}finally{this.asyncRetryers.delete(t),this.#n({isExecuting:!1,isPending:!1,lastArgs:void 0,settleCount:this.store.state.settleCount+1}),this.options.onSettled?.(e,this)}return this.store.state.lastResult},this.flush=async()=>{if(this.store.state.isPending&&this.store.state.lastArgs){let{lastArgs:e}=this.store.state;return this.#c(),await this.#a(...e)}},this.#o=()=>{this.#t&&=(this.#t(this.store.state.lastResult),null)},this.#s=()=>{this.#e&&=(clearTimeout(this.#e),null)},this.#c=()=>{this.#s(),this.#o(),this.#n({isPending:!1,lastArgs:void 0})},this.getAbortSignal=e=>{let t=e??this.store.state.maybeExecuteCount;return this.asyncRetryers.get(t)?.getAbortSignal()??null},this.abort=()=>{this.asyncRetryers.forEach(e=>e.abort()),this.asyncRetryers.clear(),this.#n({isExecuting:!1})},this.cancel=()=>{this.#c(),this.#n({canLeadingExecute:!0})},this.reset=()=>{this.#n(po()),this.asyncRetryers.forEach(e=>e.reset())},this.key=t.key,this.options={...mo,...t,throwOnError:t.throwOnError??!t.onError},this.#n(this.options.initialState??{}),this.key&&lo.on(`d-AsyncDebouncer`,e=>{e.payload.key===this.key&&(this.#n(e.payload.store.state),this.setOptions(e.payload.options))})}#n;#r;#i;#a;#o;#s;#c};function go(){return{executionCount:0,isEmpty:!0,isPending:!1,totalItemsProcessed:0,items:[],size:0,status:`idle`}}var _o={getShouldExecute:()=>!1,maxSize:1/0,started:!0,wait:1/0},vo=class{#e;constructor(e,t){this.fn=e,this.store=new ji(go()),this.#e=null,this.setOptions=e=>{this.options={...this.options,...e}},this.#t=e=>{this.store.setState(t=>{let n={...t,...e},{isPending:r,items:i}=n,a=i.length,o=a===0;return{...n,isEmpty:o,size:a,status:r?`pending`:`idle`}}),co(`Batcher`,this)},this.#n=()=>eo(this.options.wait,this),this.addItem=e=>{this.#t({items:[...this.store.state.items,e],isPending:this.options.wait!==1/0}),this.options.onItemsChange?.(this),this.store.state.items.length>=this.options.maxSize||this.options.getShouldExecute(this.store.state.items,this)?this.#r():this.options.wait!==1/0&&(this.#i(),this.#e=setTimeout(()=>this.#r(),this.#n()))},this.#r=()=>{if(this.store.state.items.length===0)return;let e=this.peekAllItems();this.clear(),this.options.onItemsChange?.(this),this.fn(e),this.#t({executionCount:this.store.state.executionCount+1,totalItemsProcessed:this.store.state.totalItemsProcessed+e.length}),this.options.onExecute?.(e,this)},this.flush=()=>{this.#i(),this.#r()},this.peekAllItems=()=>[...this.store.state.items],this.#i=()=>{this.#e&&=(clearTimeout(this.#e),null)},this.clear=()=>{this.#t({items:[],isPending:!1})},this.cancel=()=>{this.#i(),this.#t({isPending:!1})},this.reset=()=>{this.#t(go()),this.options.onItemsChange?.(this)},this.key=t.key,this.options={..._o,...t},this.#t(this.options.initialState??{}),this.key&&lo.on(`d-Batcher`,e=>{e.payload.key===this.key&&(this.#t(e.payload.store.state),this.setOptions(e.payload.options))})}#t;#n;#r;#i};function yo(){return{executionCount:0,isPending:!1,lastArgs:void 0,lastExecutionTime:0,nextExecutionTime:0,status:`idle`,maybeExecuteCount:0}}var bo={enabled:!0,leading:!0,trailing:!0,wait:0},xo=class{#e;constructor(e,t){this.fn=e,this.store=new ji(yo()),this.setOptions=e=>{this.options={...this.options,...e},this.#n()||this.cancel()},this.#t=e=>{this.store.setState(t=>{let n={...t,...e},{isPending:r}=n;return{...n,status:this.#n()?r?`pending`:`idle`:`disabled`}}),co(`Throttler`,this)},this.#n=()=>!!eo(this.options.enabled,this),this.#r=()=>eo(this.options.wait,this),this.maybeExecute=(...e)=>{this.#t({maybeExecuteCount:this.store.state.maybeExecuteCount+1});let t=Date.now(),n=t-this.store.state.lastExecutionTime,r=this.#r();if(this.options.leading&&n>=r)this.#i(...e);else if(this.#t({lastArgs:e}),!this.#e&&this.options.trailing){let e=r-(this.store.state.lastExecutionTime?t-this.store.state.lastExecutionTime:0);this.#t({isPending:!0}),this.#e=setTimeout(()=>{let{lastArgs:e}=this.store.state;e!==void 0&&this.#i(...e)},e)}},this.#i=(...e)=>{if(!this.#n())return;this.fn(...e);let t=Date.now(),n=t+this.#r();this.#a(),this.#t({executionCount:this.store.state.executionCount+1,lastExecutionTime:t,nextExecutionTime:n,isPending:!1,lastArgs:void 0}),this.options.onExecute?.(e,this),setTimeout(()=>{this.store.state.isPending||this.#t({nextExecutionTime:void 0})},this.#r())},this.flush=()=>{this.store.state.isPending&&this.store.state.lastArgs&&this.#i(...this.store.state.lastArgs)},this.#a=()=>{this.#e&&=(clearTimeout(this.#e),void 0)},this.cancel=()=>{this.#a(),this.#t({lastArgs:void 0,isPending:!1})},this.reset=()=>{this.#t(yo())},this.key=t.key,this.options={...bo,...t},this.#t(this.options.initialState??{}),this.key&&lo.on(`d-Throttler`,e=>{e.payload.key===this.key&&(this.#t(e.payload.store.state),this.setOptions(e.payload.options))})}#t;#n;#r;#i;#a},$=pe(),So=4,Co=.5,wo=.2,To=20,Eo=10,Do=320,Oo=256,ko=512;function Ao(){if(typeof window>`u`)return`col-resize`;let e=window.navigator.userAgent;return e.includes(`Chrome`)||e.includes(`Firefox`)?`ew-resize`:`col-resize`}function jo(){if(typeof window>`u`)return`row-resize`;let e=window.navigator.userAgent;return e.includes(`Chrome`)||e.includes(`Firefox`)?`ns-resize`:`row-resize`}function Mo(){return typeof window>`u`?Eo:window.matchMedia(`(pointer:coarse)`).matches?To:Eo}function No(e){let t=document.createElement(`style`);return t.dataset.resizeCursor=`true`,t.textContent=`*, *:hover { cursor: ${e} !important; }`,document.head.append(t),()=>t.remove()}function Po(e,t){let n=e.trim(),r=Number.parseFloat(n);return Number.isFinite(r)?n.endsWith(`rem`)?r*(typeof window>`u`?16:Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)||16):r:t}function Fo(e,t,n){return Math.min(Math.max(e,t),n)}function Io(e){return e.closest(`[data-slot='sidebar']`)?.dataset.side===`right`?`right`:`left`}function Lo(e){return e.closest(`[data-slot='sidebar-wrapper']`)}function Ro(e,t){e.latestWidth=t,e.previewElement&&e.previewAnimationFrame===null&&(e.previewAnimationFrame=window.requestAnimationFrame(()=>{e.previewAnimationFrame=null,!(!e.previewElement||!e.latestWidth)&&e.previewElement.style.setProperty(`--sidebar-width`,e.latestWidth)}))}function zo(e){e.previewAnimationFrame!==null&&(window.cancelAnimationFrame(e.previewAnimationFrame),e.previewAnimationFrame=null)}function Bo(e,t){let n=t-e.startX;return e.side===`left`?e.startWidth+n:e.startWidth-n}function Vo(e,t){return e.side===`left`?t>e.startX:t<e.startX}function Ho(e){let t=Z.useRef(e);return t.current=e,t}function Uo(e){let t=(0,$.c)(20),{enabled:n,expandThreshold:r,isMobile:i,maxWidth:a,minWidth:o,state:s,width:c,onOpenChange:l,onResize:u,onResizeActiveChange:d}=e,f=n===void 0?!0:n,p=r===void 0?wo:r,m;t[0]!==f||t[1]!==p||t[2]!==i||t[3]!==a||t[4]!==o||t[5]!==l||t[6]!==u||t[7]!==d||t[8]!==s||t[9]!==c?(m={enabled:f,expandThreshold:p,isMobile:i,maxWidth:a,minWidth:o,state:s,width:c,onOpenChange:l,onResize:u,onResizeActiveChange:d},t[0]=f,t[1]=p,t[2]=i,t[3]=a,t[4]=o,t[5]=l,t[6]=u,t[7]=d,t[8]=s,t[9]=c,t[10]=m):m=t[10];let h=Ho(m),g=Z.useRef(!1),_=Z.useRef(null),v,y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>()=>_.current?.(),y=[],t[11]=v,t[12]=y):(v=t[11],y=t[12]),Z.useEffect(v,y);let b;t[13]===h?b=t[14]:(b=e=>{if(g.current){e.preventDefault(),e.stopPropagation(),g.current=!1;return}let{onOpenChange:t,state:n}=h.current;t(n!==`expanded`)},t[13]=h,t[14]=b);let x=b,S;t[15]===h?S=t[16]:(S=e=>{let t=h.current;if(e.defaultPrevented||e.button!==0||t.isMobile||!t.enabled)return;let n=Po(t.minWidth,Oo),r=Po(t.maxWidth,ko),i=Po(t.width,Do),a={collapsed:t.state!==`expanded`,latestWidth:null,moved:!1,previewAnimationFrame:null,previewElement:Lo(e.currentTarget),previousCursor:document.body.style.cursor,previousUserSelect:document.body.style.userSelect,side:Io(e.currentTarget),startWidth:t.state===`expanded`?i:0,startX:e.clientX};_.current?.();let o=null,s=()=>{window.removeEventListener(`pointermove`,d),window.removeEventListener(`pointerup`,f),window.removeEventListener(`pointercancel`,f),o?.(),zo(a),document.body.style.cursor=a.previousCursor,document.body.style.userSelect=a.previousUserSelect,a.moved&&h.current.onResizeActiveChange(!1),_.current=null},c=()=>{let e=Ao();a.moved=!0,g.current=!0,h.current.onResizeActiveChange(!0),o=No(e),document.body.style.cursor=e,document.body.style.userSelect=`none`},l=e=>{let t=`${Math.round(n)}px`;Ro(a,t),h.current.onResize(t),h.current.onOpenChange(!1),a.collapsed=!0,a.startWidth=0,a.startX=e},u=e=>{let t=`${Math.round(n)}px`;Ro(a,t),h.current.onResize(t),h.current.onOpenChange(!0),a.collapsed=!1,a.startWidth=n,a.startX=e},d=e=>{let t=Math.abs(e.clientX-a.startX);if(!a.moved&&t<So)return;a.moved||c(),e.preventDefault();let i=Bo(a,e.clientX);if(a.collapsed){let t=n*h.current.expandThreshold;Vo(a,e.clientX)&&i>=t&&u(e.clientX);return}if(i<=n*Co){l(e.clientX);return}let o=Fo(i,n,r);Ro(a,`${Math.round(o)}px`)},f=e=>{a.moved&&(e.preventDefault(),a.latestWidth&&h.current.onResize(a.latestWidth),window.setTimeout(()=>{g.current=!1},0)),s()};_.current=s,window.addEventListener(`pointermove`,d),window.addEventListener(`pointerup`,f),window.addEventListener(`pointercancel`,f)},t[15]=h,t[16]=S);let C=S,w;return t[17]!==x||t[18]!==C?(w={handleClick:x,handlePointerDown:C},t[17]=x,t[18]=C,t[19]=w):w=t[19],w}function Wo(e){let t=Array.isArray(e)?e.map(e=>e.trim()).filter(Boolean):[];if(t.length===0)return;if(t.length===1)return t[0];let n=t.slice(0,3),r=t.length-n.length,i=r>0?` + ${r} more`:``;return`${t.length} commits: ${n.join(` · `)}${i}`}function Go({response:e,force:t=!1}){if(!e.ok)return;let n=Wo(e.pushedCommitMessages),r=t?`Force pushed changes`:`Pushed changes`;n?P.success(r,{description:n}):P.success(r)}function Ko(e){return We(e.defaultTagName??`div`,e,e)}var qo=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Jo=Sn,Yo=(e,t)=>n=>{if(t?.variants==null)return Jo(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=qo(t)||qo(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Jo(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Xo=Yo(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 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/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function Zo(e){let t=(0,$.c)(13),n,r,i,a,o;if(t[0]!==e){let{className:s,variant:c,render:l,...u}=e;n=l,o=c===void 0?`default`:c,a=Ko,r=`span`,i=K({className:on(Xo({variant:o}),s)},u),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o}else n=t[1],r=t[2],i=t[3],a=t[4],o=t[5];let s;t[6]===o?s=t[7]:(s={slot:`badge`,variant:o},t[6]=o,t[7]=s);let c;return t[8]!==n||t[9]!==r||t[10]!==i||t[11]!==s?(c={defaultTagName:r,props:i,render:n,state:s},t[8]=n,t[9]=r,t[10]=i,t[11]=s,t[12]=c):c=t[12],a(c)}var Qo=Z.createContext(void 0);function $o(e=!1){let t=Z.useContext(Qo);if(t===void 0&&!e)throw Error(pt(16));return t}function es(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:Z.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function ts(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=Z.useRef(null),c=$o(!0),l=a??c!==void 0,{props:u}=es({focusableWhenDisabled:n,disabled:t,composite:l,tabIndex:r,isNativeButton:i}),d=Z.useCallback(()=>{let e=o.current;ns(e)&&l&&t&&u.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,u.disabled,l]);return Gn(d,[d]),{getButtonProps:Z.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...c}=e;return K({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(N(e),o?.(e),e.baseUIHandlerPrevented))return;let r=e.target===e.currentTarget,a=e.currentTarget,s=ns(a),c=!i&&rs(a),u=r&&(i?s:!c),d=e.key===`Enter`,f=e.key===` `,p=a.getAttribute(`role`),m=p?.startsWith(`menuitem`)||p===`option`||p===`gridcell`;if(r&&l&&f){if(e.defaultPrevented&&m)return;e.preventDefault(),c||i&&s?(a.click(),e.preventBaseUIHandler()):u&&(n?.(e),e.preventBaseUIHandler());return}u&&(!i&&(f||d)&&e.preventDefault(),!i&&d&&n?.(e))},onKeyUp(e){if(!t){if(N(e),a?.(e),e.target===e.currentTarget&&i&&l&&ns(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!l&&e.key===` `&&n?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?void 0:{role:`button`},u,c)},[t,u,l,i]),buttonRef:s(e=>{o.current=e,d()})}}function ns(e){return Qn(e)&&e.tagName===`BUTTON`}function rs(e){return!!(e?.tagName===`A`&&e?.href)}var is=Z.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=ts({disabled:i,focusableWhenDisabled:a,native:o});return We(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})}),as=Yo(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 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 [a]:hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function os(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:i,size:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`default`:i,s=a===void 0?`default`:a,c;t[5]!==n||t[6]!==s||t[7]!==o?(c=on(as({variant:o,size:s,className:n})),t[5]=n,t[6]=s,t[7]=o,t[8]=c):c=t[8];let l;return t[9]!==r||t[10]!==c?(l=(0,Q.jsx)(is,{"data-slot":`button`,className:c,...r}),t[9]=r,t[10]=c,t[11]=l):l=t[11],l}var ss=Z.createContext(void 0);function cs(e){let t=Z.useContext(ss);if(e===!1&&t===void 0)throw Error(pt(27));return t}var ls={...St,...l},us=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,{store:s}=cs(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return We(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:ls,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),ds=Z.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,style:o,...s}=e,{store:c}=cs(),l=c.useState(`open`);function u(e){l&&c.setOpen(!1,Pe(j,e.nativeEvent))}let{getButtonProps:d,buttonRef:f}=ts({disabled:i,native:a});return We(`button`,e,{state:{disabled:i},ref:[t,f],props:[{onClick:u},s,d]})}),fs=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=cs(),c=Qt(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),We(`p`,e,{ref:t,props:[{id:c},o]})}),ps=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),ms=function(e){return e[e.open=Pn.open]=`open`,e[e.closed=Pn.closed]=`closed`,e[e.startingStyle=Pn.startingStyle]=`startingStyle`,e[e.endingStyle=Pn.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),hs=Z.createContext(void 0);function gs(){let e=Z.useContext(hs);if(e===void 0)throw Error(pt(26));return e}var _s=`ArrowUp`,vs=`ArrowDown`,ys=`ArrowLeft`,bs=`ArrowRight`,xs=`Home`,Ss=new Set([ys,bs]),Cs=new Set([ys,bs,xs,`End`]),ws=new Set([_s,vs]),Ts=new Set([_s,vs,xs,`End`]),Es=new Set([...Ss,...ws]),Ds=new Set([...Es,xs,`End`]),Os=new Set([_s,vs,ys,bs,xs,`End`]),ks=new Set([`Shift`,`Control`,`Alt`,`Meta`]);function As(e){return Qn(e)&&e.tagName===`INPUT`}function js(e){return!!(As(e)&&e.selectionStart!=null||Qn(e)&&e.tagName===`TEXTAREA`)}function Ms(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=Ns(e,t,`left`),a=Ps(e),o=Ps(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginRight<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=Ns(e,t,`top`),r=Ps(e),i=Ps(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function Ns(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function Ps(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}var Fs={...St,...l,nestedDialogOpen(e){return e?{[ms.nestedDialogOpen]:``}:null}},Is=Z.forwardRef(function(e,t){let{className:n,finalFocus:r,initialFocus:i,render:a,style:o,...s}=e,{store:c}=cs(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),S=c.useState(`role`);gs(),x({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});function C(e){return e===`touch`?c.context.popupRef.current:!0}let w=i===void 0?C:i,T=We(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:g>0},props:[f,{"aria-labelledby":y??void 0,"aria-describedby":l??void 0,role:S,tabIndex:-1,hidden:!m,onKeyDown(e){Os.has(e.key)&&e.stopPropagation()},style:{[ps.nestedDialogs]:g}},s],ref:[t,c.context.popupRef,c.useStateSetter(`popupElement`)],stateAttributesMapping:Fs});return(0,Q.jsx)(pa,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:w,returnFocus:r,modal:p!==!1,restoreFocus:`popup`,children:T})}),Ls=Z.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,Q.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),Rs=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=cs(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,Q.jsx)(hs.Provider,{value:n,children:(0,Q.jsxs)(L,{ref:t,...r,children:[a&&o===!0&&(0,Q.jsx)(Ls,{ref:i.context.internalBackdropRef,inert:Ca(!s)}),e.children]})}):null}),zs={},Bs={},Vs=``;function Hs(e){if(typeof document>`u`)return!1;let t=y(e);return J(t).innerWidth-t.documentElement.clientWidth>0}function Us(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=y(e),n=t.documentElement,r=t.body,i=Re(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function Ws(e){let t=y(e),n=t.documentElement,r=t.body,i=Re(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function Gs(e){let t=y(e),n=t.documentElement,r=t.body,i=J(n),a=0,o=0,s=!1,c=fe.create();if(jt&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,zs={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Vs=n.style.scrollBehavior,Bs={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=Re(n)?n:r;if(s=Us(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,zs),Object.assign(r.style,Bs),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=Vs)}function d(){u(),c.request(l)}l();let f=ge(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var Ks=new class{lockCount=0;restore=null;timeoutLock=at.create();timeoutUnlock=at.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=y(e).documentElement,n=J(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=_t;return}let r=tn||!Hs(e);this.restore=r?Ws(e):Gs(e)}};function qs(e=!0,t=null){Gn(()=>{if(e)return Ks.acquire(t)},[e,t])}function Js(e){let t=Z.useRef(``),n=Z.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Z.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Ys(e,t){let n=Z.useRef(e),r=s(t);Gn(()=>{n.current!==e&&r(n.current)},[e,r]),Gn(()=>{n.current=e},[e])}function Xs(e){let[t,n]=Z.useState(null),r=s((t,r)=>{e||n(r||(tn?`touch`:``))});Ys(e,t=>{t&&!e&&n(null)});let{onClick:i,onPointerDown:a}=Js(r);return Z.useMemo(()=>({openMethod:t,triggerProps:{onClick:i,onPointerDown:a}}),[t,i,a])}function Zs(e){let{store:t,parentContext:n,actionsRef:r,isDrawer:i}=e,a=t.useState(`open`),o=t.useState(`disablePointerDismissal`),c=t.useState(`modal`),l=t.useState(`popupElement`),{openMethod:u,triggerProps:d}=Xs(a);_(t);let{forceUnmount:f}=Hn(a,t),p=s(e=>{let n=Pe(e);return n.preventUnmountOnClose=()=>{t.set(`preventUnmountingOnClose`,!0)},n}),m=Z.useCallback(()=>{t.setOpen(!1,p(U))},[t,p]);Z.useImperativeHandle(r,()=>({unmount:f,close:m}),[f,m]);let h=Xn({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[g,v]=Z.useState(0),[y,b]=Z.useState(0),x=g===0,S=xa(h),C=ve(h,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?`intentional`:{mouse:c===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(e){if(!t.context.outsidePressEnabledRef.current||`button`in e&&e.button!==0||`touches`in e&&e.touches.length!==1)return!1;let n=Wn(e);if(x&&!o){let e=n;return c&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===e||t.context.backdropRef.current===e||ft(e,l)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:x});qs(a&&c===!0,l);let{getReferenceProps:w,getFloatingProps:T,getTriggerProps:E}=It([S,C]);t.useContextCallback(`onNestedDialogOpen`,(e,t)=>{v(e),b(t)}),t.useContextCallback(`onNestedDialogClose`,()=>{v(0),b(0)}),Z.useEffect(()=>(n?.onNestedDialogOpen&&a&&n.onNestedDialogOpen(g+1,y+ +!!i),n?.onNestedDialogClose&&!a&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&a&&n.onNestedDialogClose()}),[i,a,g,y,n]);let D=Z.useMemo(()=>w(d),[w,d]),O=Z.useMemo(()=>E(d),[E,d]),k=Z.useMemo(()=>T(),[T]);t.useSyncedValues({openMethod:u,activeTriggerProps:D,inactiveTriggerProps:O,popupProps:k,floatingRootContext:h,nestedOpenDialogCount:g,nestedOpenDrawerCount:y})}var Qs={...Kn,modal:ue(e=>e.modal),nested:ue(e=>e.nested),nestedOpenDialogCount:ue(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:ue(e=>e.nestedOpenDrawerCount),disablePointerDismissal:ue(e=>e.disablePointerDismissal),openMethod:ue(e=>e.openMethod),descriptionElementId:ue(e=>e.descriptionElementId),titleElementId:ue(e=>e.titleElementId),viewportElement:ue(e=>e.viewportElement),role:ue(e=>e.role)},$s=class e extends oe{constructor(e){super(ec(e),{popupRef:Z.createRef(),backdropRef:Z.createRef(),internalBackdropRef:Z.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new Oe,onOpenChange:void 0,onOpenChangeComplete:void 0},Qs)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};static useStore(t,n){let r=je(()=>new e(n)).current;return t??r}};function ec(e={}){return{...mt(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}var tc=Z.createContext(!1);function nc(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:o=!1,modal:s=!0,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:d=null}=e,f=cs(!0),p=Z.useContext(tc),m=!!f,h=$s.useStore(l?.store,{open:r,openProp:n,activeTriggerId:d,triggerIdProp:u,modal:s,disablePointerDismissal:o,nested:m});De(()=>{n===void 0&&h.state.open===!1&&r===!0&&h.update({open:!0,activeTriggerId:d})}),h.useControlledProp(`openProp`,n),h.useControlledProp(`triggerIdProp`,u),h.useSyncedValues({disablePointerDismissal:o,nested:m,modal:s}),h.useContextCallback(`onOpenChange`,i),h.useContextCallback(`onOpenChangeComplete`,a);let g=h.useState(`payload`);Zs({store:h,actionsRef:c,parentContext:f?.store.context,isDrawer:p,onOpenChange:i,triggerIdProp:u});let _=Z.useMemo(()=>({store:h}),[h]);return(0,Q.jsx)(tc.Provider,{value:!1,children:(0,Q.jsx)(ss.Provider,{value:_,children:typeof t==`function`?t({payload:g}):t})})}var rc=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=cs(),c=Qt(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),We(`h2`,e,{ref:t,props:[{id:c},o]})});function ic(){if(typeof document>`u`)return;let e=document.activeElement;e instanceof HTMLElement&&(e.closest(`[data-slot="dialog-content"]`)||e.blur())}function ac(e){let t=(0,$.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({open:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=Z.useRef(n===!0),a,o;t[3]===n?(a=t[4],o=t[5]):(a=()=>{let e=n===!0;e&&!i.current&&ic(),i.current=e},o=[n],t[3]=n,t[4]=a,t[5]=o),Z.useLayoutEffect(a,o);let s;return t[6]!==n||t[7]!==r?(s=(0,Q.jsx)(nc,{"data-slot":`dialog`,open:n,...r}),t[6]=n,t[7]=r,t[8]=s):s=t[8],s}function oc(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Q.jsx)(Rs,{"data-slot":`dialog-portal`,...n}),t[2]=n,t[3]=r),r}function sc(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`fixed inset-0 isolate z-50 bg-black/50 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(us,{"data-slot":`dialog-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function cc(e){let t=(0,$.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,showCloseButton:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?!0:a,s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(sc,{}),t[5]=s):s=t[5];let c;t[6]===r?c=t[7]:(c=on(`fixed top-1/2 left-1/2 z-50 grid max-h-dvh w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-h-[80vh] sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,r),t[6]=r,t[7]=c);let l;t[8]===o?l=t[9]:(l=o&&(0,Q.jsxs)(ds,{"data-slot":`dialog-close`,render:(0,Q.jsx)(os,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,Q.jsx)(Qa,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t[8]=o,t[9]=l);let u;return t[10]!==n||t[11]!==i||t[12]!==c||t[13]!==l?(u=(0,Q.jsxs)(oc,{children:[s,(0,Q.jsxs)(Is,{"data-slot":`dialog-content`,className:c,...i,children:[n,l]})]}),t[10]=n,t[11]=i,t[12]=c,t[13]=l,t[14]=u):u=t[14],u}function lc(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`flex flex-col gap-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`dialog-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function uc(e){let t=(0,$.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,showCloseButton:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?!1:a,s;t[5]===r?s=t[6]:(s=on(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end`,r),t[5]=r,t[6]=s);let c;t[7]===o?c=t[8]:(c=o&&(0,Q.jsx)(ds,{render:(0,Q.jsx)(os,{variant:`outline`}),children:`Close`}),t[7]=o,t[8]=c);let l;return t[9]!==n||t[10]!==i||t[11]!==s||t[12]!==c?(l=(0,Q.jsxs)(`div`,{"data-slot":`dialog-footer`,className:s,...i,children:[n,c]}),t[9]=n,t[10]=i,t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function dc(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`font-heading text-base leading-none font-medium`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(rc,{"data-slot":`dialog-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function fc(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(fs,{"data-slot":`dialog-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var pc=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),mc={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},hc={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},gc={disabled:!1,...hc},_c={valid(e){return e===null?null:e?{[pc.valid]:``}:{[pc.invalid]:``}}},vc=Z.createContext({invalid:void 0,name:void 0,validityData:{state:mc,errors:[],error:``,value:``,initialValue:null},setValidityData:_t,disabled:void 0,touched:hc.touched,setTouched:_t,dirty:hc.dirty,setDirty:_t,filled:hc.filled,setFilled:_t,focused:hc.focused,setFocused:_t,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:gc,markedDirtyRef:{current:!1},registerFieldControl:_t,validation:{getValidationProps:(e=Tn)=>e,getInputValidationProps:(e=Tn)=>e,inputRef:{current:null},commit:async()=>{}}});function yc(e=!0){let t=Z.useContext(vc);if(t.setValidityData===_t&&!e)throw Error(pt(28));return t}var bc=Z.createContext({controlId:void 0,registerControlId:_t,labelId:void 0,setLabelId:_t,messageIds:[],setMessageIds:_t,getDescriptionProps:e=>e});function xc(){return Z.useContext(bc)}function Sc({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=Z.useRef(e!==void 0),[a,o]=Z.useState(t);return[i?e:a,Z.useCallback(e=>{i||o(e)},[])]}function Cc(e,t){let{enabled:n=!0,getValue:r,id:i,value:a}=t,{registerFieldControl:o}=yc(),s=Z.useRef(null);s.current||=Symbol(),Gn(()=>{let t=s.current;if(!(!t||!n))return o(t,{controlRef:e,getValue:r,id:i,value:a}),()=>{o(t,void 0)}},[e,n,r,i,o,a])}function wc(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=xc(),o=Qt(t),c=n?i:void 0,l=je(()=>Symbol(`labelable-control`)),u=Z.useRef(!1),d=Z.useRef(t!=null),f=s(()=>{!u.current||a===_t||(u.current=!1,a(l.current,void 0))});return Gn(()=>{if(a===_t)return;let e;if(n){let n=r?.current;e=Se(n)&&n.closest(`label`)!=null?t??null:c??o}else if(t!=null)d.current=!0,e=t;else if(d.current)e=o;else{f();return}if(e===void 0){f();return}u.current=!0,a(l.current,e)},[t,r,c,a,n,o,l,f]),Z.useEffect(()=>f,[f]),i??o}var Tc=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:c=!1,onValueChange:l,defaultValue:u,autoFocus:d=!1,style:f,...p}=e,{state:m,name:h,disabled:g,setTouched:_,setDirty:v,validityData:b,setFocused:x,setFilled:S,validationMode:C,validation:w}=yc(),T=g||c,E=h??a,D={...m,disabled:T},{labelId:O}=xc(),k=wc({id:i});Gn(()=>{let e=o!=null;w.inputRef.current?.value||e&&o!==``?S(!0):e&&o===``&&S(!1)},[w.inputRef,S,o]);let A=Z.useRef(null);Gn(()=>{d&&A.current===Jn(y(A.current))&&x(!0)},[d,x]);let[j]=Sc({controlled:o,default:u,name:`FieldControl`,state:`value`}),M=o!==void 0,N=M?j:void 0,P=s(()=>w.inputRef.current?.value);return Cc(w.inputRef,{id:k,value:N,getValue:P}),We(`input`,e,{ref:[t,A],state:D,props:[{id:k,disabled:T,name:E,ref:w.inputRef,"aria-labelledby":O,autoFocus:d,...M?{value:N}:{defaultValue:u},onChange(e){let t=e.currentTarget.value;l?.(t,Pe(et,e.nativeEvent)),v(t!==b.initialValue),S(t!==``)},onFocus(){x(!0)},onBlur(e){_(!0),x(!1),C===`onBlur`&&w.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(_(!0),w.commit(e.currentTarget.value))}},w.getInputValidationProps(),p],stateAttributesMapping:_c})}),Ec=Z.forwardRef(function(e,t){return(0,Q.jsx)(Tc,{ref:t,...e})});function Dc(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,type:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=on(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==a||t[8]!==i?(o=(0,Q.jsx)(Ec,{type:i,"data-slot":`input`,className:a,...r}),t[6]=r,t[7]=a,t[8]=i,t[9]=o):o=t[9],o}var Oc=`after:transition-colors after:duration-150 hover:after:bg-primary focus-visible:after:bg-primary active:after:bg-primary`,kc=`after:transition-colors after:duration-150 hover:group-data-[collapsible=offcanvas]:after:bg-primary focus-visible:group-data-[collapsible=offcanvas]:after:bg-primary active:group-data-[collapsible=offcanvas]:after:bg-primary`,Ac=Z.createContext(void 0);function jc(e){let t=Z.useContext(Ac);if(t===void 0&&!e)throw Error(pt(33));return t}var Mc=Z.createContext(void 0);function Nc(e){let t=Z.useContext(Mc);if(t===void 0&&!e)throw Error(pt(36));return t}var Pc=Z.createContext(void 0);function Fc(e=!0){let t=Z.useContext(Pc);if(t===void 0&&!e)throw Error(pt(25));return t}function Ic(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=Fc(!0),d=u!==void 0;return Z.useMemo(()=>({id:r,role:`menuitem`,tabIndex:n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:Xe})},onMouseUp(e){if(u){let t=u.initialCursorPointRef.current;if(u.initialCursorPointRef.current=null,d&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||d&&!Ft&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!d||e.button===2)&&(!c||c.type===`regular-item`)&&s.current.click()}}),[t,n,r,l,i,a,o,s,u,d,c])}var Lc={type:`regular-item`};function Rc(e){let{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=Z.useRef(null),{getButtonProps:d,buttonRef:f}=ts({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=Ic({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=Z.useCallback(e=>K(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=ie(u,f);return Z.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var zc=Z.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Bc(){return Z.useContext(zc)}var Vc=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function Hc(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,elementsRef:l,labelsRef:u,nextIndexRef:d}=Bc(),f=Z.useRef(-1),[p,m]=Z.useState(a??(i===Vc.GuessFromOrder?()=>{if(f.current===-1){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),h=Z.useRef(null),g=Z.useCallback(e=>{if(h.current=e,p!==-1&&e!==null&&(l.current[p]=e,u)){let n=t!==void 0;u.current[p]=n?t:r?.current?.textContent??e.textContent}},[p,l,u,t,r]);return Gn(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),Gn(()=>{if(a==null)return c(e=>{let t=h.current?e.get(h.current)?.index:null;t!=null&&m(t)})},[a,c,m]),Z.useMemo(()=>({ref:g,index:p}),[p,g])}var Uc=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=Hc({label:a}),f=jc(!0),p=Qt(i),{store:m}=Nc(),h=m.useState(`isActive`,d.index),g=m.useState(`itemProps`),{getItemProps:_,itemRef:v}=Rc({closeOnClick:c,disabled:s,highlighted:h,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:Lc});return We(`div`,e,{state:{disabled:s,highlighted:h},props:[g,u,_],ref:[v,t,d.ref]})}),Wc=Z.createContext(void 0);function Gc(e){let t=Z.useContext(Wc);if(t===void 0&&!e)throw Error(pt(69));return t}var Kc={...St,...l},qc=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=Nc(),{side:c,align:l}=jc(),u=Gc(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),S=s.useState(`floatingTreeRoot`),C=s.useState(`closeDelay`),w=s.useState(`activeTriggerElement`),T=_.type===`context-menu`;x({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),Z.useEffect(()=>{function e(e){s.setOpen(!1,Pe(e.reason,e.domEvent))}return S.events.on(`close`,e),()=>{S.events.off(`close`,e)}},[S.events,s]);let E=s.useState(`hoverEnabled`),D=s.useState(`disabled`);ot(b,{enabled:E&&!D&&!T&&_.type!==`menubar`,closeDelay:C});let O={transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},k=Z.useCallback(e=>{s.set(`popupElement`,e)},[s]),A=We(`div`,e,{state:O,ref:[t,s.context.popupRef,k],stateAttributesMapping:Kc,props:[p,{onKeyDown(e){u&&Os.has(e.key)&&e.stopPropagation()}},ut(f),o,{"data-rootownerid":y}]}),j=_.type===void 0||T;return(g||_.type===`menubar`&&v!==`outside-press`)&&(j=!0),(0,Q.jsx)(pa,{context:b,modal:T,disabled:!m,returnFocus:a===void 0?j:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:S,previousFocusableElement:w,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:A})}),Jc=Z.createContext(void 0);function Yc(){let e=Z.useContext(Jc);if(e===void 0)throw Error(pt(32));return e}var Xc=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Nc();return i.useState(`mounted`)||n?(0,Q.jsx)(Jc.Provider,{value:n,children:(0,Q.jsx)(L,{ref:t,...r})}):null});function Zc(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=s(i),o=Z.useRef(0),c=je($c).current,l=je(Qc).current,[u,d]=Z.useState(0),f=Z.useRef(u),p=s((e,t)=>{l.set(e,t??null),f.current+=1,d(f.current)}),m=s(e=>{l.delete(e),f.current+=1,d(f.current)}),h=Z.useMemo(()=>{let e=new Map;return Array.from(l.keys()).filter(e=>e.isConnected).sort(el).forEach((t,n)=>{let r=l.get(t)??{};e.set(t,{...r,index:n})}),e},[l,u]);Gn(()=>{if(typeof MutationObserver!=`function`||h.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(f.current+=1,d(f.current))});return h.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[h]),Gn(()=>{f.current===u&&(n.current.length!==h.size&&(n.current.length=h.size),r&&r.current.length!==h.size&&(r.current.length=h.size),o.current=h.size),a(h)},[a,h,n,r,u]),Gn(()=>()=>{n.current=[]},[n]),Gn(()=>()=>{r&&(r.current=[])},[r]);let g=s(e=>(c.add(e),()=>{c.delete(e)}));Gn(()=>{c.forEach(e=>e(h))},[c,h]);let _=Z.useMemo(()=>({register:p,unregister:m,subscribeMapChange:g,elementsRef:n,labelsRef:r,nextIndexRef:o}),[p,m,g,n,r,o]);return(0,Q.jsx)(zc.Provider,{value:_,children:t})}function Qc(){return new Map}function $c(){return new Set}function el(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var tl=20;function nl(e,t,n,r){let[i,a]=Z.useState(!1);Gn(()=>{if(!e||!t||n==null){a(!1);return}let r=y(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-tl)},[e,t,n]),qs(e&&(!t||i),r)}var rl=Z.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:a,render:o,side:s,align:c,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=zt,style:_,...v}=e,{store:y}=Nc(),b=Yc(),x=Fc(!0),S=y.useState(`parent`),C=y.useState(`floatingRootContext`),w=y.useState(`floatingTreeRoot`),T=y.useState(`mounted`),E=y.useState(`open`),D=y.useState(`modal`),O=y.useState(`openMethod`),k=y.useState(`activeTriggerElement`),A=y.useState(`transitionStatus`),j=y.useState(`positionerElement`),M=y.useState(`instantType`),N=y.useState(`hasViewport`),P=y.useState(`lastOpenChangeReason`),F=y.useState(`floatingNodeId`),I=y.useState(`floatingParentNodeId`),L=C.useState(`domReferenceElement`),R=Z.useRef(null),z=me(j,!1,!1),B=n,H=l,U=u,W=c,ee=g;S.type===`context-menu`&&(B=n??S.context?.anchor,W??=`start`,!s&&W!==`center`&&(U=e.alignOffset??2,H=e.sideOffset??-5));let G=s,te=W;S.type===`menu`?(G??=`inline-end`,te??=`start`,ee=e.collisionAvoidance??lt):S.type===`menubar`&&(G??=`bottom`,te??=`start`);let K=S.type===`context-menu`,q=un({anchor:B,floatingRootContext:C,positionMethod:x?`fixed`:r,mounted:T,side:G,sideOffset:H,align:te,alignOffset:U,arrowPadding:K?0:p,collisionBoundary:d,collisionPadding:f,sticky:m,nodeId:F,keepMounted:b,disableAnchorTracking:h,collisionAvoidance:ee,shiftCrossAxis:K&&!(`side`in ee&&ee.side===`flip`),externalTree:w,adaptiveOrigin:N?En:void 0});Z.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===F&&y.set(`hoverEnabled`,!1),e.nodeId!==F&&e.parentNodeId===y.select(`floatingParentNodeId`)&&y.setOpen(!1,Pe(i)))}return w.events.on(`menuopenchange`,e),()=>{w.events.off(`menuopenchange`,e)}},[y,w.events,F]),Z.useEffect(()=>{if(y.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==y.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;y.setOpen(!1,Pe(t))}return w.events.on(`menuopenchange`,e),()=>{w.events.off(`menuopenchange`,e)}},[w.events,y]);let J=Ln();Z.useEffect(()=>{E||J.clear()},[E,J]),Z.useEffect(()=>{function e(e){if(!(!E||e.nodeId!==y.select(`floatingParentNodeId`)))if(e.target&&k&&k!==e.target){let e=y.select(`closeDelay`);e>0?J.isStarted()||J.start(e,()=>{y.setOpen(!1,Pe(i))}):y.setOpen(!1,Pe(i))}else J.clear()}return w.events.on(`itemhover`,e),()=>{w.events.off(`itemhover`,e)}},[w.events,E,k,y,J]),Z.useEffect(()=>{let e={open:E,nodeId:F,parentNodeId:I,reason:y.select(`lastOpenChangeReason`)};w.events.emit(`menuopenchange`,e)},[w.events,E,y,F,I]),Gn(()=>{let e=L,t=R.current;if(e&&(R.current=e),t&&e&&e!==t){y.set(`instantType`,void 0);let e=new AbortController;return z(()=>{y.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[L,z,y]);let ne={open:E,side:q.side,align:q.align,anchorHidden:q.anchorHidden,nested:S.type===`menu`,instant:M},Y=S.type===`menubar`&&S.context.modal;nl(E&&(Y||D&&P!==`trigger-hover`),O===`touch`,j,k);let re=Bt(e,ne,{styles:q.positionerStyles,transitionStatus:A,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!T,inert:!E}),ie=T&&S.type!==`menu`&&(S.type!==`menubar`&&D&&P!==`trigger-hover`||S.type===`menubar`&&S.context.modal),ae=null;return S.type===`menubar`?ae=S.context.contentElement:S.type===void 0&&(ae=k),(0,Q.jsxs)(Ac.Provider,{value:q,children:[ie&&(0,Q.jsx)(Ls,{ref:S.type===`context-menu`||S.type===`nested-context-menu`?S.context.internalBackdropRef:null,inert:Ca(!E),cutout:ae}),(0,Q.jsx)(V,{id:F,children:(0,Q.jsx)(Zc,{elementsRef:y.context.itemDomElements,labelsRef:y.context.itemLabels,children:re})})]})}),il=Z.createContext(null);function al(e){let t=Z.useContext(il);if(t===null&&!e)throw Error(pt(5));return t}var ol={...Kn,disabled:ue(e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled),modal:ue(e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0)),openMethod:ue(e=>e.openMethod),allowMouseEnter:ue(e=>e.allowMouseEnter),stickIfOpen:ue(e=>e.stickIfOpen),parent:ue(e=>e.parent),rootId:ue(e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId),activeIndex:ue(e=>e.activeIndex),isActive:ue((e,t)=>e.activeIndex===t),hoverEnabled:ue(e=>e.hoverEnabled),instantType:ue(e=>e.instantType),lastOpenChangeReason:ue(e=>e.openChangeReason),floatingTreeRoot:ue(e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot),floatingNodeId:ue(e=>e.floatingNodeId),floatingParentNodeId:ue(e=>e.floatingParentNodeId),itemProps:ue(e=>e.itemProps),closeDelay:ue(e=>e.closeDelay),hasViewport:ue(e=>e.hasViewport),keyboardEventRelay:ue(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)})},sl=class e extends oe{constructor(e){super({...cl(),...e},{positionerRef:Z.createRef(),popupRef:Z.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),onOpenChangeComplete:void 0,triggerElements:new Oe},ol),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);t===i&&n===a&&r===o||(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}static useStore(t,n){let r=je(()=>new e(n)).current;return t??r}unsubscribeParentListener=null};function cl(){return{...mt(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Be,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Tn,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}var ll=Z.createContext(void 0);function ul(){return Z.useContext(ll)}var dl=g(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:c,loopFocus:l=!0,orientation:u=`vertical`,actionsRef:d,closeParentOnEsc:f=!1,handle:p,triggerId:m,defaultTriggerId:h=null,highlightItemOnHover:g=!0}=e,v=Fc(!0),y=Nc(!0),b=al(!0),x=ul(),S=Z.useMemo(()=>x&&y?{type:`menu`,store:y.store}:b?{type:`menubar`,context:b}:v&&!y?{type:`context-menu`,context:v}:{type:void 0},[v,y,b,x]),C=sl.useStore(p?.store,{open:a,openProp:n,activeTriggerId:h,triggerIdProp:m,parent:S});De(()=>{n===void 0&&C.state.open===!1&&a===!0&&C.update({open:!0,activeTriggerId:h})}),C.useControlledProp(`openProp`,n),C.useControlledProp(`triggerIdProp`,m),C.useContextCallback(`onOpenChangeComplete`,i);let w=C.useState(`floatingTreeRoot`),T=we(w),E=er();Gn(()=>{v&&!y?C.update({parent:{type:`context-menu`,context:v},floatingNodeId:T,floatingParentNodeId:E}):y&&C.update({floatingNodeId:T,floatingParentNodeId:E})},[v,y,T,E,C]);let D=C.useState(`open`),O=C.useState(`activeTriggerElement`),k=C.useState(`positionerElement`),A=C.useState(`hoverEnabled`),j=C.useState(`disabled`),M=C.useState(`lastOpenChangeReason`),N=C.useState(`parent`),P=C.useState(`activeIndex`),F=C.useState(`payload`),I=C.useState(`floatingParentNodeId`),L=Z.useRef(null),R=I!=null,{openMethod:z,triggerProps:B}=Xs(D);C.useSyncedValues({disabled:o,modal:N.type===void 0?c:void 0,openMethod:z,rootId:ee()}),_(C);let{forceUnmount:V}=Hn(D,C,()=>{C.update({allowMouseEnter:!1,stickIfOpen:!0})}),H=Z.useRef(N.type!==`context-menu`),W=Ln();Z.useEffect(()=>{if(D||(L.current=null),N.type===`context-menu`){if(!D){W.clear(),H.current=!1;return}W.start(500,()=>{H.current=!0})}},[W,D,N.type]),Gn(()=>{!D&&!A&&C.set(`hoverEnabled`,!0)},[D,A,C]);let G=Z.useRef(!0),te=Ln(),q=s((e,t)=>{let n=t.reason;if(D===e&&t.trigger===O&&M===n||(t.preventUnmountOnClose=()=>{C.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&(t.trigger=O??void 0),r?.(e,t),t.isCanceled))return;C.state.floatingRootContext.dispatchOpenChange(e,t);let i=t.event;if(e===!1&&i?.type===`click`&&i.pointerType===`touch`&&!G.current)return;if(!e&&P!==null){let e=C.context.itemDomElements.current[P];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}e&&n===`trigger-focus`?(G.current=!1,te.start(300,()=>{G.current=!0})):(G.current=!0,te.clear());let a=(n===`trigger-press`||n===`item-press`)&&i.detail===0&&i?.isTrusted,o=!e&&(n===`escape-key`||n==null),s={open:e,openChangeReason:n};L.current=t.event??null;let c=t.trigger?.id??null;(c||e)&&(s.activeTriggerId=c,s.activeTriggerElement=t.trigger??null),C.update(s),N.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?C.set(`instantType`,`group`):a||o?C.set(`instantType`,a?`click`:`dismiss`):C.set(`instantType`,void 0)}),J=Z.useCallback(e=>{let t=Pe(e);return t.preventUnmountOnClose=()=>{C.set(`preventUnmountingOnClose`,!0)},t},[C]),ne=Z.useCallback(()=>{C.setOpen(!1,J(U))},[C,J]);Z.useImperativeHandle(d,()=>({unmount:V,close:ne}),[V,ne]);let re;N.type===`context-menu`&&(re=N.context),Z.useImperativeHandle(re?.positionerRef,()=>k,[k]),Z.useImperativeHandle(re?.actionsRef,()=>({setOpen:q}),[q]);let ie=Xn({popupStore:C,onOpenChange:q}),ae=ie.context.events;Z.useEffect(()=>{let e=({open:e,eventDetails:t})=>q(e,t);return ae.on(`setOpen`,e),()=>{ae?.off(`setOpen`,e)}},[ae,q]);let oe=ve(ie,{enabled:!j,bubbles:{escapeKey:f&&N.type===`menu`},outsidePress(){return N.type!==`context-menu`||L.current?.type===`contextmenu`?!0:H.current},externalTree:R?w:void 0}),se=xa(ie,{role:`menu`}),ce=vt(),le=Z.useCallback(e=>{C.select(`activeIndex`)!==e&&C.set(`activeIndex`,e)},[C]),ue=tee(ie,{enabled:!j,listRef:C.context.itemDomElements,activeIndex:P,nested:N.type!==void 0,loopFocus:l,orientation:u,parentOrientation:N.type===`menubar`?N.context.orientation:void 0,rtl:ce===`rtl`,disabledIndices:ln,onNavigate:le,openOnArrowKeyDown:N.type!==`context-menu`,externalTree:R?w:void 0,focusItemOnHover:g}),de=Z.useCallback(e=>{C.context.typingRef.current=e},[C]),{getReferenceProps:fe,getFloatingProps:pe,getItemProps:me,getTriggerProps:he}=It([oe,se,ue,Sa(ie,{listRef:C.context.itemLabels,elementsRef:C.context.itemDomElements,activeIndex:P,resetMs:500,onMatch:e=>{D&&e!==P&&C.set(`activeIndex`,e)},onTypingChange:de})]),ge=Z.useMemo(()=>{let e=K(fe(),{onMouseMove(){C.set(`allowMouseEnter`,!0)}},B);return delete e.role,e},[fe,C,B]),_e=Z.useMemo(()=>{let e=he();if(!e)return e;let t=K(e,B);return delete t.role,delete t[`aria-controls`],t},[he,B]),ye=Z.useMemo(()=>pe({onMouseMove(){C.set(`allowMouseEnter`,!0),N.type===`menu`&&C.set(`hoverEnabled`,!1)},onClick(){C.select(`hoverEnabled`)&&C.set(`hoverEnabled`,!1)},onKeyDown(e){let t=C.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}}),[pe,N.type,C]),be=Z.useMemo(()=>me(),[me]);C.useSyncedValues({floatingRootContext:ie,activeTriggerProps:ge,inactiveTriggerProps:_e,popupProps:ye,itemProps:be});let xe=Z.useMemo(()=>({store:C,parent:S}),[C,S]),Se=(0,Q.jsx)(Mc.Provider,{value:xe,children:typeof t==`function`?t({payload:F}):t});return N.type===void 0||N.type===`context-menu`?(0,Q.jsx)(Y,{externalTree:w,children:Se}):Se});function fl(e){let t=Nc().store,n=Z.useMemo(()=>({parentMenu:t}),[t]);return(0,Q.jsx)(ll.Provider,{value:n,children:(0,Q.jsx)(dl,{...e})})}function pl(e){let t=e.getBoundingClientRect(),n=J(e),r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(!(r.content!==`none`||i.content!==`none`))return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function ml(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=$o(),{ref:i,index:a}=Hc(e),o=n===a,s=Z.useRef(null),c=ie(i,s);return{compositeProps:Z.useMemo(()=>({tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}}),[o,r,a,t]),compositeRef:c,index:a}}function hl(e){let{render:t,className:n,style:r,state:i=Tn,props:a=ln,refs:o=ln,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=ml({metadata:s});return We(l,e,{state:i,ref:[...o,f],props:[d,...a,u],stateAttributesMapping:c})}function gl(e){if(Qn(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`)??void 0;if(!d(e))return gl(z(e))}var _l=t(qe());function vl(e,t){let n=Z.useRef(null);return{preFocusGuardRef:n,handlePreFocusGuardFocus:s(t=>{_l.flushSync(()=>{e.setOpen(!1,Pe(gn,t.nativeEvent,t.currentTarget))}),rn(n.current)?.focus()}),handleFocusTargetFocus:s(n=>{let r=e.select(`positionerElement`);if(r&&bn(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{_l.flushSync(()=>{e.setOpen(!1,Pe(gn,n.nativeEvent,n.currentTarget))});let i=On(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&ft(r,i);){let e=i;if(i=a(i),i===e)break}i?.focus()}})}}function yl(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=Z.useRef(!1);return Z.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,y(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:Tn,[t,n,r])}var bl=2,xl=Vn(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,id:o,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,style:m,...h}=e,g=Nc(!0),_=d?.store??g?.store;if(!_)throw Error(pt(85));let v=Qt(o),b=_.useState(`isTriggerActive`,v),x=_.useState(`floatingRootContext`),S=_.useState(`isOpenedByTrigger`,v),w=Z.useRef(null),T=Cl(),E=$o(!0),D=p(),O=Z.useMemo(()=>D??new Be,[D]),{registerTrigger:k,isMountedByThisTrigger:A}=Me(v,w,_,{payload:f,closeDelay:u,parent:T,floatingTreeRoot:O,floatingNodeId:we(O),floatingParentNodeId:er(),keyboardEventRelay:E?.relayKeyboardEvent}),j=T.type===`menubar`,M=_.useState(`disabled`),N=i||M||j&&T.context.disabled,{getButtonProps:P,buttonRef:F}=ts({disabled:N,native:a});Z.useEffect(()=>{!S&&T.type===void 0&&(_.context.allowMouseUpTriggerRef.current=!1)},[_,S,T.type]);let I=Z.useRef(null),L=Ln(),R=s(e=>{if(!I.current)return;L.clear(),_.context.allowMouseUpTriggerRef.current=!1;let t=e.target;if(ft(I.current,t)||ft(_.select(`positionerElement`),t)||t===I.current||t!=null&&gl(t)===_.select(`rootId`))return;let n=pl(I.current);e.clientX>=n.left-bl&&e.clientX<=n.right+bl&&e.clientY>=n.top-bl&&e.clientY<=n.bottom+bl||O.events.emit(`close`,{domEvent:e,reason:He})});Z.useEffect(()=>{S&&_.select(`lastOpenChangeReason`)===`trigger-hover`&&y(I.current).addEventListener(`mouseup`,R,{once:!0})},[S,R,_]);let z=j&&T.context.hasSubmenuOpen,B=Mt(x,{enabled:(c??z)&&!N&&T.type!==`context-menu`&&(!j||z&&!A),handleClose:nn({blockPointerEvents:!j}),mouseOnly:!0,move:!1,restMs:T.type===void 0?l:void 0,delay:{close:u},triggerElementRef:w,externalTree:O,isActiveTrigger:b,isClosing:()=>_.select(`transitionStatus`)===`ending`}),V=Sl(S,_.select(`lastOpenChangeReason`)),H=ma(x,{enabled:!N&&T.type!==`context-menu`,event:S&&j?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:T.type===void 0?V:!1}),U=Rn(x,{enabled:!N&&z}),W=yl({open:S,enabled:j,mouseDownAction:`open`}),ee=It([H,U]),G={disabled:N,open:S},te=_.useState(`triggerProps`,A),K=[I,t,F,k,w],q=[ee.getReferenceProps(),B??Tn,te,{"aria-haspopup":`menu`,id:v,onMouseDown:e=>{_.select(`open`)||(L.start(200,()=>{_.context.allowMouseUpTriggerRef.current=!0}),y(e.currentTarget).addEventListener(`mouseup`,R,{once:!0}))}},j?{role:`menuitem`}:{},W,h,P],{preFocusGuardRef:J,handlePreFocusGuardFocus:ne,handleFocusTargetFocus:Y}=vl(_,w),re=We(`button`,e,{enabled:!j,stateAttributesMapping:Ot,state:G,ref:K,props:q});return j?(0,Q.jsx)(hl,{tag:`button`,render:n,className:r,style:m,state:G,refs:K,props:q,stateAttributesMapping:Ot}):S?(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(C,{ref:J,onFocus:ne},`${v}-pre-focus-guard`),(0,Q.jsx)(Z.Fragment,{children:re},v),(0,Q.jsx)(C,{ref:_.context.triggerFocusTargetRef,onFocus:Y},`${v}-post-focus-guard`)]}):(0,Q.jsx)(Z.Fragment,{children:re},v)});function Sl(e,t){let n=Ln(),[r,i]=Z.useState(!1);return Gn(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Cl(){let e=Fc(!0),t=Nc(!0),n=al(!0);return Z.useMemo(()=>n?{type:`menubar`,context:n}:e&&!t?{type:`context-menu`,context:e}:{type:void 0},[e,t,n])}var wl=Z.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return We(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function Tl(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var El=Z.forwardRef(function(e,t){let{render:n,className:r,label:i,id:a,nativeButton:o=!1,openOnHover:s=!0,delay:c=100,closeDelay:l=0,disabled:u=!1,style:d,...f}=e,p=Hc(),m=jc(),{store:h}=Nc(),g=Qt(a),_=h.useState(`open`),v=h.useState(`floatingRootContext`),y=h.useState(`floatingTreeRoot`),b=T(g,h),x=Z.useCallback(e=>{let t=b(e);return e!==null&&h.select(`open`)&&h.select(`activeTriggerId`)==null&&h.update({activeTriggerId:g,activeTriggerElement:e,closeDelay:l}),t},[b,l,h,g]),S=Z.useRef(null),C=Z.useCallback(e=>{S.current=e,h.set(`activeTriggerElement`,e)},[h]),w=ul();if(!w?.parentMenu)throw Error(pt(37));h.useSyncedValue(`closeDelay`,l);let E=w.parentMenu,D=E.useState(`itemProps`),O=E.useState(`isActive`,p.index),k=Z.useMemo(()=>({type:`submenu-trigger`,setActive(){E.set(`activeIndex`,p.index)}}),[E,p.index]),A=h.useState(`disabled`),j=u||A,{getItemProps:M,itemRef:N}=Rc({closeOnClick:!1,disabled:j,highlighted:O,id:g,store:h,typingRef:E.context.typingRef,nativeButton:o,itemMetadata:k,nodeId:m?.context.nodeId}),P=h.useState(`hoverEnabled`),F=E.useState(`allowMouseEnter`),I=Mt(v,{enabled:P&&s&&!j,handleClose:nn({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:c,delay:F?{open:c,close:l}:0,triggerElementRef:S,externalTree:y,isClosing:()=>h.select(`transitionStatus`)===`ending`}),L=It([ma(v,{enabled:!j,event:`mousedown`,toggle:!s,ignoreMouse:s,stickIfOpen:!1})]),R=h.useState(`triggerProps`,!0);return delete R.id,We(`div`,e,{state:{disabled:j,highlighted:O,open:_},stateAttributesMapping:mn,props:[L.getReferenceProps(),I,R,D,{tabIndex:_||O?0:-1,onBlur(){O&&E.set(`activeIndex`,null)}},f,M],ref:[t,p.ref,N,x,C]})});function Dl(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Q.jsx)(dl,{"data-slot":`dropdown-menu`,...n}),t[2]=n,t[3]=r),r}function Ol(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Q.jsx)(xl,{"data-slot":`dropdown-menu-trigger`,...n}),t[2]=n,t[3]=r),r}function kl(e){let t=(0,$.c)(18),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({align:i,alignOffset:a,side:o,sideOffset:s,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=i===void 0?`start`:i,l=a===void 0?0:a,u=o===void 0?`bottom`:o,d=s===void 0?4:s,f;t[7]===n?f=t[8]:(f=on(`z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95`,n),t[7]=n,t[8]=f);let p;t[9]!==r||t[10]!==f?(p=(0,Q.jsx)(qc,{"data-slot":`dropdown-menu-content`,className:f,...r}),t[9]=r,t[10]=f,t[11]=p):p=t[11];let m;return t[12]!==c||t[13]!==l||t[14]!==u||t[15]!==d||t[16]!==p?(m=(0,Q.jsx)(Xc,{children:(0,Q.jsx)(rl,{className:`isolate z-50 outline-none`,align:c,alignOffset:l,side:u,sideOffset:d,children:p})}),t[12]=c,t[13]=l,t[14]=u,t[15]=d,t[16]=p,t[17]=m):m=t[17],m}function Al(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=on(`group/dropdown-menu-item relative flex min-h-8 cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,Q.jsx)(Uc,{"data-slot":`dropdown-menu-item`,"data-inset":r,"data-variant":o,className:s,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function jl(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Q.jsx)(fl,{"data-slot":`dropdown-menu-sub`,...n}),t[2]=n,t[3]=r),r}function Ml(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=on(`flex min-h-8 cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(Da,{className:`ml-auto`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,Q.jsxs)(El,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function Nl(e){let t=(0,$.c)(16),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({align:i,alignOffset:a,side:o,sideOffset:s,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=i===void 0?`start`:i,l=a===void 0?-3:a,u=o===void 0?`right`:o,d=s===void 0?0:s,f;t[7]===n?f=t[8]:(f=on(`w-auto min-w-[96px] rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 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-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n),t[7]=n,t[8]=f);let p;return t[9]!==c||t[10]!==l||t[11]!==r||t[12]!==u||t[13]!==d||t[14]!==f?(p=(0,Q.jsx)(kl,{"data-slot":`dropdown-menu-sub-content`,className:f,align:c,alignOffset:l,side:u,sideOffset:d,...r}),t[9]=c,t[10]=l,t[11]=r,t[12]=u,t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function Pl(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(wl,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Fl(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=on(`ml-auto hidden items-center justify-end text-xs text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground md:inline-flex`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=(0,Q.jsx)(H,{children:n}),t[6]=n,t[7]=o);let s;return t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,Q.jsx)(`span`,{"data-slot":`dropdown-menu-shortcut`,className:a,...i,children:o}),t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}function Il(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`empty`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ll(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`flex max-w-sm flex-col items-center gap-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`empty-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Rl=Yo(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`}});function zl(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]!==n||t[5]!==a?(o=on(Rl({variant:a,className:n})),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o||t[9]!==a?(s=(0,Q.jsx)(`div`,{"data-slot":`empty-icon`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function Bl(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`font-heading text-sm font-medium tracking-tight`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`empty-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Vl(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`empty-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Hl(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`empty-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Ul=768;function Wl(){let e=(0,$.c)(2),[t,n]=Z.useState(void 0),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(max-width: ${Ul-1}px)`),t=()=>{n(window.innerWidth<Ul)};return e.addEventListener(`change`,t),n(window.innerWidth<Ul),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),Z.useEffect(r,i),!!t}function Gl(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`horizontal`:i,o;t[4]===n?o=t[5]:(o=on(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Q.jsx)(wl,{"data-slot":`separator`,orientation:a,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function Kl(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Q.jsx)(nc,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function ql(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Q.jsx)(Rs,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}function Jl(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(us,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Yl(e){let t=(0,$.c)(17),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,side:a,showCloseButton:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?`right`:a,c=o===void 0?!0:o,l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(Jl,{}),t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=on(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm`,r),t[7]=r,t[8]=u);let d;t[9]===c?d=t[10]:(d=c&&(0,Q.jsxs)(ds,{"data-slot":`sheet-close`,render:(0,Q.jsx)(os,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`}),children:[(0,Q.jsx)(Qa,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t[9]=c,t[10]=d);let f;return t[11]!==n||t[12]!==i||t[13]!==s||t[14]!==u||t[15]!==d?(f=(0,Q.jsxs)(ql,{children:[l,(0,Q.jsxs)(Is,{"data-slot":`sheet-content`,"data-side":s,className:u,...i,children:[n,d]})]}),t[11]=n,t[12]=i,t[13]=s,t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function Xl(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`flex flex-col gap-0.5 p-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`sheet-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Zl(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`font-heading text-base font-medium text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(rc,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ql(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`text-sm text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(fs,{"data-slot":`sheet-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var $l=`sidebar_state`,eu=3600*24*7,tu=`20rem`,nu=`16rem`,ru=`32rem`,iu=`pico-sidebar-width`,au=`sidebar_width`,ou=`20rem`,su=`3rem`,cu=`b`,lu=Z.createContext(null);function uu(e,t){let n=e.trim(),r=Number.parseFloat(n);return Number.isFinite(r)?n.endsWith(`rem`)?r*(typeof window>`u`?16:Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)||16):r:t}function du(e){let t=uu(tu,320),n=uu(nu,256),r=uu(ru,512),i=uu(e??``,t);return`${Math.round(Math.min(Math.max(i,n),r))}px`}function fu(){if(typeof window>`u`)return du(tu);try{return du(window.localStorage.getItem(iu)??window.localStorage.getItem(au))}catch{return du(tu)}}function pu(e){try{window.localStorage.setItem(iu,e)}catch{}}function mu(e){let t=Z.useRef(e);return t.current=e,t}function hu(){let e=Z.useContext(lu);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function gu({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o}){let s=Wl(),[c,l]=Z.useState(!1),[u,d]=Z.useState(!1),[f,p]=Z.useState(()=>du(tu)),[m,h]=Z.useState(!1),g=Z.useRef(f);g.current=f,Z.useEffect(()=>{let e=fu();g.current!==e&&(g.current=e,p(e))},[]);let _=e=>{let t=du(e);g.current!==t&&(g.current=t,p(t),pu(t))},[v,y]=Z.useState(e),b=t??v,x=e=>{let t=typeof e==`function`?e(b):e;n?n(t):y(t),document.cookie=`${$l}=${t}; path=/; max-age=${eu}`},S=()=>s?l(e=>!e):x(e=>!e),C=mu(S);Z.useEffect(()=>{let e=e=>{e.key.toLowerCase()===cu&&(e.metaKey||e.ctrlKey)&&!(e.metaKey&&e.ctrlKey)&&!e.shiftKey&&!e.altKey&&(e.preventDefault(),C.current())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[C]);let w={state:b?`expanded`:`collapsed`,open:b,setOpen:x,isMobile:s,openMobile:c,openMobileSettled:u,setOpenMobile:l,setOpenMobileSettled:d,sidebarResizing:m,setSidebarResizing:h,sidebarWidth:f,setSidebarWidth:_,toggleSidebar:S};return(0,Q.jsx)(lu.Provider,{value:w,children:(0,Q.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{...i,"--sidebar-width":f,"--sidebar-width-icon":su},className:on(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...o,children:a})})}function _u(e){let t=(0,$.c)(50),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({side:o,variant:s,collapsible:c,className:r,children:n,dir:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=o===void 0?`left`:o,u=s===void 0?`sidebar`:s,d=c===void 0?`offcanvas`:c,{isMobile:f,state:p,openMobile:m,setOpenMobile:h,setOpenMobileSettled:g,sidebarResizing:_}=hu();if(d===`none`){let e;t[8]===r?e=t[9]:(e=on(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[8]=r,t[9]=e);let i;return t[10]!==n||t[11]!==a||t[12]!==e?(i=(0,Q.jsx)(`div`,{"data-slot":`sidebar`,className:e,...a,children:n}),t[10]=n,t[11]=a,t[12]=e,t[13]=i):i=t[13],i}if(f){let e;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e={"--sidebar-width":ou},t[14]=e):e=t[14];let r;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsxs)(Xl,{className:`sr-only`,children:[(0,Q.jsx)(Zl,{children:`Sidebar`}),(0,Q.jsx)(Ql,{children:`Displays the mobile sidebar.`})]}),t[15]=r):r=t[15];let o;t[16]===n?o=t[17]:(o=(0,Q.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:n}),t[16]=n,t[17]=o);let s;t[18]!==i||t[19]!==l||t[20]!==o?(s=(0,Q.jsxs)(Yl,{dir:i,"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden`,style:e,side:l,children:[r,o]}),t[18]=i,t[19]=l,t[20]=o,t[21]=s):s=t[21];let c;return t[22]!==m||t[23]!==a||t[24]!==h||t[25]!==g||t[26]!==s?(c=(0,Q.jsx)(Kl,{open:m,onOpenChange:h,onOpenChangeComplete:g,...a,children:s}),t[22]=m,t[23]=a,t[24]=h,t[25]=g,t[26]=s,t[27]=c):c=t[27],c}let v=p===`collapsed`?d:``,y=_?`true`:void 0,b=u===`floating`||u===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,x;t[28]===b?x=t[29]:(x=on(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear group-data-[resizing=true]:transition-none`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,b),t[28]=b,t[29]=x);let S;t[30]===x?S=t[31]:(S=(0,Q.jsx)(`div`,{"data-slot":`sidebar-gap`,className:x}),t[30]=x,t[31]=S);let C=u===`floating`||u===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`border-sidebar-border/70 group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,w;t[32]!==r||t[33]!==C?(w=on(`fixed inset-y-0 z-30 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear group-data-[resizing=true]:transition-none data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex`,C,r),t[32]=r,t[33]=C,t[34]=w):w=t[34];let T;t[35]===n?T=t[36]:(T=(0,Q.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[35]=n,t[36]=T);let E;t[37]!==a||t[38]!==l||t[39]!==w||t[40]!==T?(E=(0,Q.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":l,className:w,...a,children:T}),t[37]=a,t[38]=l,t[39]=w,t[40]=T,t[41]=E):E=t[41];let D;return t[42]!==l||t[43]!==p||t[44]!==E||t[45]!==v||t[46]!==y||t[47]!==S||t[48]!==u?(D=(0,Q.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":p,"data-collapsible":v,"data-resizing":y,"data-variant":u,"data-side":l,"data-slot":`sidebar`,children:[S,E]}),t[42]=l,t[43]=p,t[44]=E,t[45]=v,t[46]=y,t[47]=S,t[48]=u,t[49]=D):D=t[49],D}function vu(e){let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{toggleSidebar:a}=hu(),o;t[4]===n?o=t[5]:(o=on(n),t[4]=n,t[5]=o);let s;t[6]!==r||t[7]!==a?(s=e=>{r?.(e),a()},t[6]=r,t[7]=a,t[8]=s):s=t[8];let c,l;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(Ua,{}),l=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`}),t[9]=c,t[10]=l):(c=t[9],l=t[10]);let u;return t[11]!==i||t[12]!==o||t[13]!==s?(u=(0,Q.jsx)(Ne,{title:`Toggle sidebar`,kbd:`⌃ B`,children:(0,Q.jsxs)(os,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon`,className:o,onClick:s,...i,children:[c,l]})}),t[11]=i,t[12]=o,t[13]=s,t[14]=u):u=t[14],u}function yu(e){let t=(0,$.c)(34),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,onClick:r,onPointerDown:i,style:o,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let{isMobile:s,setOpen:c,setSidebarResizing:l,setSidebarWidth:u,sidebarWidth:d,state:f}=hu(),p;t[6]!==s||t[7]!==c||t[8]!==l||t[9]!==u||t[10]!==d||t[11]!==f?(p={isMobile:s,maxWidth:ru,minWidth:nu,state:f,width:d,onOpenChange:c,onResize:u,onResizeActiveChange:l},t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p):p=t[12];let{handleClick:m,handlePointerDown:h}=Uo(p),[g,_]=Z.useState(`col-resize`),[v,y]=Z.useState(10),b,x;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{let e=()=>{y(Mo())},t=window.matchMedia(`(pointer:coarse)`);return _(Ao()),e(),t.addEventListener(`change`,e),()=>{t.removeEventListener(`change`,e)}},x=[],t[13]=b,t[14]=x):(b=t[13],x=t[14]),Z.useEffect(b,x);let S=g===`ew-resize`?`cursor-ew-resize group-data-[side=left]:cursor-ew-resize group-data-[side=right]:cursor-ew-resize [[data-side=left][data-state=collapsed]_&]:cursor-ew-resize [[data-side=right][data-state=collapsed]_&]:cursor-ew-resize`:`cursor-col-resize group-data-[side=left]:cursor-col-resize group-data-[side=right]:cursor-col-resize [[data-side=left][data-state=collapsed]_&]:cursor-col-resize [[data-side=right][data-state=collapsed]_&]:cursor-col-resize`,C;t[15]!==m||t[16]!==r?(C=e=>{r?.(e),!e.defaultPrevented&&m(e)},t[15]=m,t[16]=r,t[17]=C):C=t[17];let w;t[18]!==h||t[19]!==i?(w=e=>{i?.(e),!e.defaultPrevented&&h(e)},t[18]=h,t[19]=i,t[20]=w):w=t[20];let T=`${v}px`,E;t[21]!==g||t[22]!==o||t[23]!==T?(E={...o,"--sidebar-rail-width":T,cursor:g},t[21]=g,t[22]=o,t[23]=T,t[24]=E):E=t[24];let D=E,O;t[25]!==n||t[26]!==S?(O=on(`absolute inset-y-0 z-40 hidden w-(--sidebar-rail-width) touch-none bg-transparent transition-all ease-linear select-none group-data-[side=left]:right-[calc(var(--sidebar-rail-width)*-1)] group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-px after:bg-transparent sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,Oc,S,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full`,kc,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,n),t[25]=n,t[26]=S,t[27]=O):O=t[27];let k;return t[28]!==a||t[29]!==C||t[30]!==w||t[31]!==D||t[32]!==O?(k=(0,Q.jsx)(`button`,{"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":`Toggle or resize Sidebar`,tabIndex:-1,onClick:C,onPointerDown:w,title:`Toggle or resize Sidebar`,style:D,className:O,...a}),t[28]=a,t[29]=C,t[30]=w,t[31]=D,t[32]=O,t[33]=k):k=t[33],k}function bu(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`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),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`main`,{"data-slot":`sidebar-inset`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xu(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Su(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Cu(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function wu(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`relative flex w-full min-w-0 flex-col p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Tu(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`w-full text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Eu(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Du(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Ou=Yo(`peer/menu-button group/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:text-sidebar-accent-foreground not-data-active:hover:bg-sidebar-accent/50 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-open:hover:bg-sidebar-accent/50 data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground [&_svg]:shrink-0 [&>span:last-child]:truncate [&>svg]:size-4`,{variants:{variant:{default:`hover:text-sidebar-accent-foreground not-data-active:hover:bg-sidebar-accent/50`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))] not-data-active:hover:bg-sidebar-accent/50`},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 ku(e){let t=(0,$.c)(18),{render:n,isActive:r,variant:i,size:a,tooltip:o,className:s,...c}=e,l=r===void 0?!1:r,u=i===void 0?`default`:i,d=a===void 0?`default`:a,{isMobile:f,state:p}=hu(),m=K({className:on(Ou({variant:u,size:d}),s)},c),h;t[0]!==n||t[1]!==o?(h=o?(0,Q.jsx)(G,{render:n}):n,t[0]=n,t[1]=o,t[2]=h):h=t[2];let g;t[3]!==l||t[4]!==d?(g={slot:`sidebar-menu-button`,sidebar:`menu-button`,size:d,active:l},t[3]=l,t[4]=d,t[5]=g):g=t[5];let _;t[6]!==m||t[7]!==h||t[8]!==g?(_={defaultTagName:`button`,props:m,render:h,state:g},t[6]=m,t[7]=h,t[8]=g,t[9]=_):_=t[9];let v=Ko(_);if(!o)return v;if(typeof o==`string`){let e;t[10]===o?e=t[11]:(e={children:o},t[10]=o,t[11]=e),o=e}let y=p!==`collapsed`||f,b;t[12]!==y||t[13]!==o?(b=(0,Q.jsx)(A,{side:`right`,align:`center`,hidden:y,...o}),t[12]=y,t[13]=o,t[14]=b):b=t[14];let x;return t[15]!==v||t[16]!==b?(x=(0,Q.jsxs)(Ve,{children:[v,b]}),t[15]=v,t[16]=b,t[17]=x):x=t[17],x}var Au=Z.createContext(void 0);function ju(){let e=Z.useContext(Au);if(e===void 0)throw Error(pt(64));return e}var Mu=function(e){return e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e}({}),Nu={tabActivationDirection:e=>({[Mu.activationDirection]:e})},Pu=Z.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:o,value:c,style:l,...u}=e,d=Object.hasOwn(e,`defaultValue`),f=Z.useRef([]),[p,m]=Z.useState(()=>new Map),[h,g]=Sc({controlled:c,default:r,name:`Tabs`,state:`value`}),_=c!==void 0,[v,y]=Z.useState(()=>new Map),b=Z.useCallback(e=>{if(e===void 0)return null;for(let[t,n]of v.entries())if(n!=null&&e===(n.value??n.index))return t;return null},[v]),[x,S]=Z.useState(()=>({previousValue:h,tabActivationDirection:`none`})),{previousValue:C,tabActivationDirection:w}=x,T=w,E=!1;C!==h&&(T=Fu(C,h,a,v),E=C!=null&&h!=null&&b(h)==null);let D=E?C:h,O=C!==D||w!==T;Gn(()=>{O&&S({previousValue:D,tabActivationDirection:T})},[D,O,T]);let k=s((e,t)=>{t.activationDirection=Fu(h,e,a,v),i?.(e,t),!t.isCanceled&&g(e)}),A=s((e,t)=>{m(n=>{if(n.get(e)===t)return n;let r=new Map(n);return r.set(e,t),r})}),j=s((e,t)=>{m(n=>{if(!n.has(e)||n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})}),M=Z.useCallback(e=>p.get(e),[p]),N=Z.useCallback(e=>{for(let t of v.values())if(e===t?.value)return t?.id},[v]),P=Z.useMemo(()=>({getTabElementBySelectedValue:b,getTabIdByPanelValue:N,getTabPanelIdByValue:M,onValueChange:k,orientation:a,registerMountedTabPanel:A,setTabMap:y,unregisterMountedTabPanel:j,tabActivationDirection:T,value:h}),[b,N,M,k,a,A,y,j,T,h]),F=Z.useMemo(()=>{for(let e of v.values())if(e!=null&&e.value===h)return e},[v,h]),I=Z.useMemo(()=>{for(let e of v.values())if(e!=null&&!e.disabled)return e.value},[v]);Gn(()=>{if(_||v.size===0)return;let e=F?.disabled;if(d&&e&&h===r||!e&&!(F==null&&h!==null))return;let t=I??null;h!==t&&(g(t),S(e=>e.tabActivationDirection===`none`?e:{...e,tabActivationDirection:`none`}))},[r,I,d,_,F,g,v,h]);let L=We(`div`,e,{state:{orientation:a,tabActivationDirection:T},ref:t,props:u,stateAttributesMapping:Nu});return(0,Q.jsx)(Au.Provider,{value:P,children:(0,Q.jsx)(Zc,{elementsRef:f,children:L})})});function Fu(e,t,n,r){if(e==null||t==null)return`none`;let i=null,a=null;for(let[n,o]of r.entries()){if(o==null)continue;let r=o.value??o.index;if(e===r&&(i=n),t===r&&(a=n),i!=null&&a!=null)break}if(i==null||a==null)return i!==a&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?n===`horizontal`?t>e?`right`:`left`:t>e?`down`:`up`:`none`;let o=i.getBoundingClientRect(),s=a.getBoundingClientRect();if(n===`horizontal`){if(s.left<o.left)return`left`;if(s.left>o.left)return`right`}else{if(s.top<o.top)return`up`;if(s.top>o.top)return`down`}return`none`}var Iu=`data-composite-item-active`,Lu=Z.createContext(void 0);function Ru(){let e=Z.useContext(Lu);if(e===void 0)throw Error(pt(65));return e}var zu=Z.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:o,nativeButton:s=!0,style:c,...l}=e,{value:u,getTabPanelIdByValue:d,orientation:f}=ju(),{activateOnFocus:p,highlightedTabIndex:m,onTabActivation:h,registerTabResizeObserverElement:g,setHighlightedTabIndex:_,tabsListElement:v}=Ru(),b=Qt(o),{compositeProps:x,compositeRef:S,index:C}=ml({metadata:Z.useMemo(()=>({disabled:r,id:b,value:a}),[r,b,a])}),w=a===u,T=Z.useRef(!1),E=Z.useRef(null);Z.useEffect(()=>{let e=E.current;if(e)return g(e)},[g]),Gn(()=>{if(T.current){T.current=!1;return}if(!(w&&C>-1&&m!==C))return;let e=v;if(e!=null){let t=Jn(y(e));if(t&&ft(e,t))return}r||_(C)},[w,C,m,_,r,v]);let{getButtonProps:D,buttonRef:O}=ts({disabled:r,native:s,focusableWhenDisabled:!0}),k=d(a),A=Z.useRef(!1),j=Z.useRef(!1);function M(e){w||r||h(a,Pe(et,e.nativeEvent,void 0,{activationDirection:`none`}))}function N(e){w||(C>-1&&!r&&_(C),!r&&p&&(!A.current||A.current&&j.current)&&h(a,Pe(et,e.nativeEvent,void 0,{activationDirection:`none`})))}function P(e){if(w||r)return;A.current=!0;function t(){A.current=!1,j.current=!1}(!e.button||e.button===0)&&(j.current=!0,y(e.currentTarget).addEventListener(`pointerup`,t,{once:!0}))}return We(`button`,e,{state:{disabled:r,active:w,orientation:f},ref:[t,O,S,E],props:[x,{role:`tab`,"aria-controls":k,"aria-selected":w,id:b,onClick:M,onFocus:N,onPointerDown:P,[Iu]:w?``:void 0,onKeyDownCapture(){T.current=!0}},l,D]})}),Bu=[];function Vu(e){let{itemSizes:t,cols:n=1,loopFocus:r=!0,onLoop:i,dense:a=!1,orientation:o=`both`,direction:c,highlightedIndex:l,onHighlightedIndexChange:u,rootRef:d,enableHomeAndEndKeys:f=!1,stopEventPropagation:p=!1,disabledIndices:m,modifierKeys:h=Bu}=e,[g,_]=Z.useState(0),v=n>1,y=Z.useRef(null),b=ie(y,d),x=Z.useRef([]),S=Z.useRef(!1),C=l??g,w=s((e,t=!1)=>{if((u??_)(e),t){let t=x.current[e];Ms(y.current,t,c,o)}}),T=s(e=>{if(e.size===0||S.current)return;S.current=!0;let t=Array.from(e.keys()),n=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,r=n?t.indexOf(n):-1;r!==-1&&w(r),Ms(y.current,n,c,o)}),E=s((e,t,n)=>i?i?.(e,t,n,x):n),D=Z.useMemo(()=>({"aria-orientation":o===`both`?void 0:o,ref:b,onFocus(e){let t=y.current,n=Wn(e.nativeEvent);!t||n==null||!js(n)||n.setSelectionRange(0,n.value.length??0)},onKeyDown(e){let s=f?Ds:Es;if(!s.has(e.key)||Hu(e,h)||!y.current)return;let l=c===`rtl`,u=l?ys:bs,d={horizontal:u,vertical:vs,both:u}[o],g=l?bs:ys,_={horizontal:g,vertical:_s,both:g}[o],b=Wn(e.nativeEvent);if(b!=null&&js(b)&&!Tl(b)){let t=b.selectionStart,n=b.selectionEnd,r=b.value??``;if(t==null||e.shiftKey||t!==n||e.key!==_&&t<r.length||e.key!==d&&t>0)return}let S=C,T=Et(x,m),D=bt(x,m);if(v){let i=t||Array.from({length:x.current.length},()=>({width:1,height:1})),s=cn(i,n,a),c=s.findIndex(e=>e!=null&&!Pt(x.current,e,m)),u=s.reduce((e,t,n)=>t!=null&&!Pt(x.current,t,m)?n:e,-1);S=s[Mn(s.map(e=>e==null?null:x.current[e]),{event:e,orientation:o,loopFocus:r,onLoop:E,cols:n,disabledIndices:Xt([...m||x.current.map((e,t)=>Pt(x.current,t)?t:void 0),void 0],s),minIndex:c,maxIndex:u,prevIndex:gt(C>D?T:C,i,s,n,e.key===`ArrowDown`?`bl`:e.key===`ArrowRight`?`tr`:`tl`),rtl:l})]}let O={horizontal:[u],vertical:[vs],both:[u,vs]}[o],k={horizontal:[g],vertical:[_s],both:[g,_s]}[o],A=v?s:{horizontal:f?Cs:Ss,vertical:f?Ts:ws,both:s}[o];f&&(e.key===`Home`?S=T:e.key===`End`&&(S=D)),S===C&&(O.includes(e.key)||k.includes(e.key))&&(r&&S===D&&O.includes(e.key)?(S=T,i&&(S=i(e,C,S,x))):r&&S===T&&k.includes(e.key)?(S=D,i&&(S=i(e,C,S,x))):S=wn(x.current,{startingIndex:S,decrement:k.includes(e.key),disabledIndices:m})),S!==C&&!en(x.current,S)&&(p&&e.stopPropagation(),A.has(e.key)&&e.preventDefault(),w(S,!0),queueMicrotask(()=>{x.current[S]?.focus()}))}}),[n,a,c,m,x,f,C,v,t,r,i,E,b,h,w,o,p]);return Z.useMemo(()=>({props:D,highlightedIndex:C,onHighlightedIndexChange:w,elementsRef:x,disabledIndices:m,onMapChange:T,relayKeyboardEvent:D.onKeyDown}),[D,C,w,x,m,T])}function Hu(e,t){for(let n of ks.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Uu(e){let{render:t,className:n,style:r,refs:i=ln,props:a=ln,state:o=Tn,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,dense:d,itemSizes:f,loopFocus:p,onLoop:m,cols:h,enableHomeAndEndKeys:g,onMapChange:_,stopEventPropagation:v=!0,rootRef:y,disabledIndices:b,modifierKeys:x,highlightItemOnHover:S=!1,tag:C=`div`,...w}=e,{props:T,highlightedIndex:E,onHighlightedIndexChange:D,elementsRef:O,onMapChange:k,relayKeyboardEvent:A}=Vu({itemSizes:f,cols:h,loopFocus:p,onLoop:m,dense:d,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:y,stopEventPropagation:v,enableHomeAndEndKeys:g,direction:vt(),disabledIndices:b,modifierKeys:x}),j=We(C,e,{state:o,ref:i,props:[T,...a,w],stateAttributesMapping:s}),M=Z.useMemo(()=>({highlightedIndex:E,onHighlightedIndexChange:D,highlightItemOnHover:S,relayKeyboardEvent:A}),[E,D,S,A]);return(0,Q.jsx)(Qo.Provider,{value:M,children:(0,Q.jsx)(Zc,{elementsRef:O,onMapChange:e=>{_?.(e),k(e)},children:j})})}var Wu=Z.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:a,style:o,...c}=e,{onValueChange:l,orientation:u,value:d,setTabMap:f,tabActivationDirection:p}=ju(),[m,h]=Z.useState(0),[g,_]=Z.useState(null),v=Z.useRef(new Set),y=Z.useRef(new Set),b=Z.useRef(null),x=s(()=>{v.current.forEach(e=>{e()})});Z.useEffect(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{v.current.size&&x()});return b.current=e,g&&e.observe(g),y.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),b.current=null}},[g,x]);let S=s(e=>(v.current.add(e),()=>{v.current.delete(e)})),C=s(e=>(y.current.add(e),b.current?.observe(e),()=>{y.current.delete(e),b.current?.unobserve(e)})),w=s((e,t)=>{e!==d&&l(e,t)}),T={orientation:u,tabActivationDirection:p},E={"aria-orientation":u===`vertical`?`vertical`:void 0,role:`tablist`},D=Z.useMemo(()=>({activateOnFocus:n,highlightedTabIndex:m,registerIndicatorUpdateListener:S,registerTabResizeObserverElement:C,onTabActivation:w,setHighlightedTabIndex:h,tabsListElement:g}),[n,m,S,C,w,h,g]);return(0,Q.jsx)(Lu.Provider,{value:D,children:(0,Q.jsx)(Uu,{render:a,className:r,style:o,state:T,refs:[t,_],props:[E,c],stateAttributesMapping:Nu,highlightedIndex:m,enableHomeAndEndKeys:!0,loopFocus:i,orientation:u,onHighlightedIndexChange:h,onMapChange:f,disabledIndices:ln})})});function Gu(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`horizontal`:i,o;t[4]===n?o=t[5]:(o=on(`group/tabs flex gap-2 data-horizontal:flex-col`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Q.jsx)(Pu,{"data-slot":`tabs`,"data-orientation":a,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}var iee=Yo(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function aee(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]!==n||t[5]!==a?(o=on(iee({variant:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o||t[9]!==a?(s=(0,Q.jsx)(Wu,{"data-slot":`tabs-list`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function Ku(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:border-transparent data-active:bg-background data-active:text-foreground dark:data-active:border-transparent dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(zu,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var qu=1,oee=.9,see=.8,cee=.17,Ju=.1,Yu=.999,lee=.9999,uee=.99,Xu=/[\\\/_+.#"@\[\(\{&]/,Zu=/[\\\/_+.#"@\[\(\{&]/g,Qu=/[\s-]/,$u=/[\s-]/g;function ed(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?qu:uee;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=ed(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=qu:Xu.test(e.charAt(l-1))?(d*=see,p=e.slice(i,l-1).match(Zu),p&&i>0&&(d*=Yu**+p.length)):Qu.test(e.charAt(l-1))?(d*=oee,m=e.slice(i,l-1).match($u),m&&i>0&&(d*=Yu**+m.length)):(d*=cee,i>0&&(d*=Yu**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=lee)),(d<Ju&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=ed(e,t,n,r,l+1,a+2,o),f*Ju>d&&(d=f*Ju)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function td(e){return e.toLowerCase().replace($u,` `)}function nd(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,ed(e,t,td(e),td(t),0,0,{})}typeof window<`u`&&window.document&&window.document.createElement;function rd(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function id(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function ad(...e){return t=>{let n=!1,r=e.map(e=>{let r=id(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():id(e[t],null)}}}}function od(...e){return Z.useCallback(ad(...e),e)}function sd(e,t){let n=Z.createContext(t),r=e=>{let{children:t,...r}=e,i=Z.useMemo(()=>r,Object.values(r));return(0,Q.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=Z.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function cd(e,t=[]){let n=[];function r(t,r){let i=Z.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=Z.useMemo(()=>o,Object.values(o));return(0,Q.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=Z.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>Z.createContext(e));return function(n){let r=n?.[e]||t;return Z.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,ld(i,...t)]}function ld(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return Z.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var ud=globalThis?.document?Z.useLayoutEffect:()=>{},dd=Z.useId||(()=>void 0),fd=0;function pd(e){let[t,n]=Z.useState(dd());return ud(()=>{e||n(e=>e??String(fd++))},[e]),e||(t?`radix-${t}`:``)}var md=Z.useInsertionEffect||ud;function hd({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=gd({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=Z.useRef(e!==void 0);Z.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,Z.useCallback(t=>{if(s){let n=_d(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function gd({defaultProp:e,onChange:t}){let[n,r]=Z.useState(e),i=Z.useRef(n),a=Z.useRef(t);return md(()=>{a.current=t},[t]),Z.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function _d(e){return typeof e==`function`}function vd(e){let t=yd(e),n=Z.forwardRef((e,n)=>{let{children:r,...i}=e,a=Z.Children.toArray(r),o=a.find(xd);if(o){let e=o.props.children,r=a.map(t=>t===o?Z.Children.count(e)>1?Z.Children.only(null):Z.isValidElement(e)?e.props.children:null:t);return(0,Q.jsx)(t,{...i,ref:n,children:Z.isValidElement(e)?Z.cloneElement(e,void 0,r):null})}return(0,Q.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function yd(e){let t=Z.forwardRef((e,t)=>{let{children:n,...r}=e;if(Z.isValidElement(n)){let e=Cd(n),i=Sd(r,n.props);return n.type!==Z.Fragment&&(i.ref=t?ad(t,e):e),Z.cloneElement(n,i)}return Z.Children.count(n)>1?Z.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var bd=Symbol(`radix.slottable`);function xd(e){return Z.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===bd}function Sd(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Cd(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var wd=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=vd(`Primitive.${t}`),r=Z.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,Q.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Td(e,t){e&&_l.flushSync(()=>e.dispatchEvent(t))}function Ed(e){let t=Z.useRef(e);return Z.useEffect(()=>{t.current=e}),Z.useMemo(()=>(...e)=>t.current?.(...e),[])}function Dd(e,t=globalThis?.document){let n=Ed(e);Z.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Od=`DismissableLayer`,kd=`dismissableLayer.update`,Ad=`dismissableLayer.pointerDownOutside`,jd=`dismissableLayer.focusOutside`,Md,Nd=Z.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Pd=Z.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=Z.useContext(Nd),[u,d]=Z.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=Z.useState({}),m=od(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=Ld(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=Rd(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return Dd(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),Z.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Md=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),zd(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Md)}},[u,f,n,l]),Z.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),zd())},[u,l]),Z.useEffect(()=>{let e=()=>p({});return document.addEventListener(kd,e),()=>document.removeEventListener(kd,e)},[]),(0,Q.jsx)(wd.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:rd(e.onFocusCapture,S.onFocusCapture),onBlurCapture:rd(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:rd(e.onPointerDownCapture,x.onPointerDownCapture)})});Pd.displayName=Od;var Fd=`DismissableLayerBranch`,Id=Z.forwardRef((e,t)=>{let n=Z.useContext(Nd),r=Z.useRef(null),i=od(t,r);return Z.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,Q.jsx)(wd.div,{...e,ref:i})});Id.displayName=Fd;function Ld(e,t=globalThis?.document){let n=Ed(e),r=Z.useRef(!1),i=Z.useRef(()=>{});return Z.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Bd(Ad,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Rd(e,t=globalThis?.document){let n=Ed(e),r=Z.useRef(!1);return Z.useEffect(()=>{let e=e=>{e.target&&!r.current&&Bd(jd,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function zd(){let e=new CustomEvent(kd);document.dispatchEvent(e)}function Bd(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Td(i,a):i.dispatchEvent(a)}var Vd=`focusScope.autoFocusOnMount`,Hd=`focusScope.autoFocusOnUnmount`,Ud={bubbles:!1,cancelable:!0},Wd=`FocusScope`,Gd=Z.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=Z.useState(null),l=Ed(i),u=Ed(a),d=Z.useRef(null),f=od(t,e=>c(e)),p=Z.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Z.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Qd(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Qd(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Qd(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),Z.useEffect(()=>{if(s){$d.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Vd,Ud);s.addEventListener(Vd,l),s.dispatchEvent(t),t.defaultPrevented||(Kd(nf(Jd(s)),{select:!0}),document.activeElement===e&&Qd(s))}return()=>{s.removeEventListener(Vd,l),setTimeout(()=>{let t=new CustomEvent(Hd,Ud);s.addEventListener(Hd,u),s.dispatchEvent(t),t.defaultPrevented||Qd(e??document.body,{select:!0}),s.removeEventListener(Hd,u),$d.remove(p)},0)}}},[s,l,u,p]);let m=Z.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=qd(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Qd(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Qd(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,Q.jsx)(wd.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});Gd.displayName=Wd;function Kd(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Qd(r,{select:t}),document.activeElement!==n)return}function qd(e){let t=Jd(e);return[Yd(t,e),Yd(t.reverse(),e)]}function Jd(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Yd(e,t){for(let n of e)if(!Xd(n,{upTo:t}))return n}function Xd(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function Zd(e){return e instanceof HTMLInputElement&&`select`in e}function Qd(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Zd(e)&&t&&e.select()}}var $d=ef();function ef(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=tf(e,t),e.unshift(t)},remove(t){e=tf(e,t),e[0]?.resume()}}}function tf(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function nf(e){return e.filter(e=>e.tagName!==`A`)}var rf=`Portal`,af=Z.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=Z.useState(!1);ud(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?_l.createPortal((0,Q.jsx)(wd.div,{...r,ref:t}),o):null});af.displayName=rf;function of(e,t){return Z.useReducer((e,n)=>t[e][n]??e,e)}var sf=e=>{let{present:t,children:n}=e,r=cf(t),i=typeof n==`function`?n({present:r.isPresent}):Z.Children.only(n),a=od(r.ref,uf(i));return typeof n==`function`||r.isPresent?Z.cloneElement(i,{ref:a}):null};sf.displayName=`Presence`;function cf(e){let[t,n]=Z.useState(),r=Z.useRef(null),i=Z.useRef(e),a=Z.useRef(`none`),[o,s]=of(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return Z.useEffect(()=>{let e=lf(r.current);a.current=o===`mounted`?e:`none`},[o]),ud(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=lf(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),ud(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=lf(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=lf(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:Z.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function lf(e){return e?.animationName||`none`}function uf(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var df=0;function ff(){Z.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??pf()),document.body.insertAdjacentElement(`beforeend`,e[1]??pf()),df++,()=>{df===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),df--}},[])}function pf(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var mf=function(){return mf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},mf.apply(this,arguments)};function hf(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function gf(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var _f=`right-scroll-bar-position`,vf=`width-before-scroll-bar`,yf=`with-scroll-bars-hidden`,bf=`--removed-body-scroll-bar-size`;function xf(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Sf(e,t){var n=(0,Z.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Cf=typeof window<`u`?Z.useLayoutEffect:Z.useEffect,wf=new WeakMap;function Tf(e,t){var n=Sf(t||null,function(t){return e.forEach(function(e){return xf(e,t)})});return Cf(function(){var t=wf.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||xf(e,null)}),i.forEach(function(e){r.has(e)||xf(e,a)})}wf.set(n,e)},[e]),n}function Ef(e){return e}function Df(e,t){t===void 0&&(t=Ef);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Of(e){e===void 0&&(e={});var t=Df(null);return t.options=mf({async:!0,ssr:!1},e),t}var kf=function(e){var t=e.sideCar,n=hf(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return Z.createElement(r,mf({},n))};kf.isSideCarExport=!0;function Af(e,t){return e.useMedium(t),kf}var jf=Of(),Mf=function(){},Nf=Z.forwardRef(function(e,t){var n=Z.useRef(null),r=Z.useState({onScrollCapture:Mf,onWheelCapture:Mf,onTouchMoveCapture:Mf}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=hf(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Tf([n,t]),C=mf(mf({},b),i);return Z.createElement(Z.Fragment,null,u&&Z.createElement(x,{sideCar:jf,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?Z.cloneElement(Z.Children.only(s),mf(mf({},C),{ref:S})):Z.createElement(v,mf({},C,{className:c,ref:S}),s))});Nf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Nf.classNames={fullWidth:vf,zeroRight:_f};var Pf,Ff=function(){if(Pf)return Pf;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function If(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Ff();return t&&e.setAttribute(`nonce`,t),e}function Lf(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Rf(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var zf=function(){var e=0,t=null;return{add:function(n){e==0&&(t=If())&&(Lf(t,n),Rf(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Bf=function(){var e=zf();return function(t,n){Z.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Vf=function(){var e=Bf();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Hf={left:0,top:0,right:0,gap:0},Uf=function(e){return parseInt(e||``,10)||0},Wf=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Uf(n),Uf(r),Uf(i)]},Gf=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Hf;var t=Wf(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Kf=Vf(),qf=`data-scroll-locked`,Jf=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
2
|
+
import{n as e,r as t,t as n}from"./rolldown-runtime-S-ySWqyJ.js";import{$ as r,$n as i,$t as a,A as o,An as s,Ar as c,At as l,B as u,Bn as d,Br as f,Bt as p,C as m,Cn as h,Cr as g,Ct as _,D as v,Dn as y,Dr as b,Dt as x,E as S,En as C,Er as w,Et as T,F as E,Fn as D,Fr as O,Ft as k,G as A,Gn as j,Gr as M,Gt as N,H as P,Hn as F,Hr as I,Ht as L,I as R,In as z,Ir as B,It as V,J as H,Jn as U,Jr as W,Jt as ee,K as G,Kr as te,Kt as K,L as q,Ln as J,Lr as ne,Lt as Y,M as re,Mn as ie,Mr as ae,Mt as oe,N as se,Nn as ce,Nr as le,Nt as ue,O as de,On as fe,Or as pe,Ot as me,P as he,Pn as ge,Pr as _e,Pt as ve,Q as ye,Qt as be,R as xe,Rn as Se,Rr as Ce,Rt as we,S as Te,Sn as Ee,Sr as De,St as Oe,T as ke,Tn as Ae,Tr as je,Tt as Me,U as Ne,Un as Pe,Ur as Fe,Ut as Ie,V as Le,Vn as Re,Vr as ze,Vt as Be,W as Ve,Wn as He,Wr as Ue,Wt as We,X as Ge,Xn as Ke,Xr as qe,Xt as Je,Y as Ye,Yn as Xe,Yr as Ze,Yt as Qe,Z as $e,Zn as et,Zr as tt,Zt as nt,_ as rt,_n as it,_r as at,_t as ot,a as st,an as ct,ar as lt,at as ut,b as dt,bn as ft,br as pt,bt as mt,c as ht,cn as gt,cr as _t,ct as vt,d as yt,dn as bt,dr as xt,dt as St,en as Ct,et as wt,f as Tt,fn as Et,fr as Dt,ft as Ot,g as kt,gn as At,gr as jt,gt as Mt,h as Nt,hn as Pt,hr as Ft,ht as It,i as Lt,in as Rt,ir as zt,it as Bt,j as Vt,jn as Ht,jr as Ut,jt as Wt,k as Gt,kn as Kt,kr as qt,kt as Jt,l as Yt,ln as Xt,lr as Zt,lt as Qt,m as $t,mn as en,mr as tn,mt as nn,n as X,nn as rn,nr as an,nt as on,o as sn,on as cn,or as ln,ot as un,p as dn,pn as fn,pr as pn,pt as mn,q as hn,qn as gn,qr as _n,qt as vn,r as yn,rn as bn,rr as xn,rt as Sn,s as Cn,sn as wn,sr as Tn,st as En,t as Dn,tn as On,tr as kn,tt as An,u as jn,un as Mn,ur as Nn,ut as Pn,v as Fn,vn as In,vr as Ln,vt as Rn,w as zn,wn as Bn,wr as Vn,wt as Hn,x as Un,xn as Wn,xr as Gn,xt as Kn,y as qn,yn as Jn,yr as Yn,yt as Xn,z as Zn,zn as Qn,zr as $n,zt as er}from"./index-CMM5qfmc.js";var tr=class extends Ze{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=O(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),rr(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ir(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ir(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof I(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Ue(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&ar(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||I(this.options.enabled,this.#t)!==I(t.enabled,this.#t)||Fe(this.options.staleTime,this.#t)!==Fe(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||I(this.options.enabled,this.#t)!==I(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return sr(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch($n)),t}#g(){this.#b();let e=Fe(this.options.staleTime,this.#t);if(B.isServer()||this.#r.isStale||!Ce(e))return;let t=te(this.#r.dataUpdatedAt,e)+1;this.#d=_n.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(B.isServer()||I(this.options.enabled,this.#t)===!1||!Ce(this.#p)||this.#p===0)&&(this.#f=_n.setInterval(()=>{(this.options.refetchIntervalInBackground||W.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(_n.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(_n.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&rr(e,t),o=i&&ar(e,n,t,r);(a||o)&&(l={...l,...le(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:p,errorUpdatedAt:m,status:h}=l;d=l.data;let g=!1;if(t.placeholderData!==void 0&&d===void 0&&h===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,g=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(h=`success`,d=f(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!g)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=f(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(p=this.#s,d=this.#l,m=Date.now(),h=`error`);let _=l.fetchStatus===`fetching`,v=h===`pending`,y=h===`error`,b=v&&_,x=d!==void 0,S={status:h,fetchStatus:l.fetchStatus,isPending:v,isSuccess:h===`success`,isError:y,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:p,errorUpdatedAt:m,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:or(e,t),refetch:this.refetch,promise:this.#o,isEnabled:I(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{i(this.#o=S.promise=O())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a();break}}return S}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!Ue(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){_e.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function nr(e,t){return I(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function rr(e,t){return nr(e,t)||e.state.data!==void 0&&ir(e,t,t.refetchOnMount)}function ir(e,t,n){if(I(t.enabled,e)!==!1&&Fe(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&or(e,t)}return!1}function ar(e,t,n,r){return(e!==t||I(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&or(e,n)}function or(e,t){return I(t.enabled,e)!==!1&&e.isStaleByTime(Fe(t.staleTime,e))}function sr(e,t){return!Ue(e.getCurrentResult(),t)}var cr=class extends Ze{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),Ue(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&ne(t.mutationKey)!==ne(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??ae();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){_e.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Z=t(tt(),1),lr=Z.createContext(!1),ur=()=>Z.useContext(lr);lr.Provider;var Q=Ut();function dr(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var fr=Z.createContext(dr()),pr=()=>Z.useContext(fr),mr=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?M(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},hr=e=>{Z.useEffect(()=>{e.clearReset()},[e])},gr=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||M(n,[e.error,r])),_r=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},vr=(e,t)=>e.isLoading&&e.isFetching&&!t,yr=(e,t)=>e?.suspense&&t.isPending,br=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function xr(e,t,n){let r=ur(),i=pr(),a=c(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,_r(o),mr(o,i,s),hr(i);let l=!a.getQueryCache().get(o.queryHash),[u]=Z.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&e.subscribed!==!1;if(Z.useSyncExternalStore(Z.useCallback(e=>{let t=f?u.subscribe(_e.batchCalls(e)):$n;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),Z.useEffect(()=>{u.setOptions(o)},[o,u]),yr(o,d))throw br(o,u,i);if(gr({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!B.isServer()&&vr(d,r)&&(l?br(o,u,i):s?.promise)?.catch($n).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function Sr(e,t){return xr(e,tr,t)}function Cr(e,t){let n=c(t),r=n.getQueryCache();return Z.useSyncExternalStore(Z.useCallback(e=>r.subscribe(_e.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}function wr(e,t){let n=c(t);return Er({filters:{...e,status:`pending`}},n).length}function Tr(e,t){return e.findAll(t.filters).map(e=>t.select?t.select(e):e.state)}function Er(e={},t){let n=c(t).getMutationCache(),r=Z.useRef(e),i=Z.useRef(null);return i.current===null&&(i.current=Tr(n,e)),Z.useEffect(()=>{r.current=e}),Z.useSyncExternalStore(Z.useCallback(e=>n.subscribe(()=>{let t=ze(i.current,Tr(n,r.current));i.current!==t&&(i.current=t,_e.schedule(e))}),[n]),()=>i.current,()=>i.current)}function Dr(e,t){let n=c(t),[r]=Z.useState(()=>new cr(n,e));Z.useEffect(()=>{r.setOptions(e)},[r,e]);let i=Z.useSyncExternalStore(Z.useCallback(e=>r.subscribe(_e.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=Z.useCallback((e,t)=>{r.mutate(e,t).catch($n)},[r]);if(i.error&&M(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function Or(e){return typeof e==`object`&&!!e&&`current`in e}function kr(){if(typeof navigator>`u`)return`linux`;let e=navigator.platform?.toLowerCase()??``,t=navigator.userAgent?.toLowerCase()??``;return e.includes(`mac`)||t.includes(`mac`)?`mac`:e.includes(`win`)||t.includes(`win`)?`windows`:`linux`}var Ar=[`Control`,`Alt`,`Shift`,`Meta`];new Set(Ar);var jr={Control:`Control`,Ctrl:`Control`,control:`Control`,ctrl:`Control`,Shift:`Shift`,shift:`Shift`,Alt:`Alt`,Option:`Alt`,alt:`Alt`,option:`Alt`,Command:`Meta`,Cmd:`Meta`,Meta:`Meta`,command:`Meta`,cmd:`Meta`,meta:`Meta`,OS:`Meta`,os:`Meta`,Win:`Meta`,win:`Meta`,CommandOrControl:`Mod`,Mod:`Mod`,commandorcontrol:`Mod`,mod:`Mod`};function Mr(e,t=kr()){return e===`Mod`?t===`mac`?`Meta`:`Control`:e}var Nr=new Set(`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``)),Pr=new Set([`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`]),Fr=new Set([`F1`,`F2`,`F3`,`F4`,`F5`,`F6`,`F7`,`F8`,`F9`,`F10`,`F11`,`F12`]),Ir=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`]),Lr=new Set([`Enter`,`Escape`,`Space`,`Tab`,`Backspace`,`Delete`]),Rr=new Set([`/`,`[`,`]`,`\\`,`=`,`-`,`,`,`.`,`;`,"`"]),zr={Backquote:"`",Backslash:`\\`,BracketLeft:`[`,BracketRight:`]`,Comma:`,`,Equal:`=`,Minus:`-`,Period:`.`,Semicolon:`;`,Slash:`/`};new Set([...Nr,...Pr,...Fr,...Ir,...Lr,...Rr]);var Br={Esc:`Escape`,esc:`Escape`,escape:`Escape`,Return:`Enter`,return:`Enter`,enter:`Enter`," ":`Space`,space:`Space`,Spacebar:`Space`,spacebar:`Space`,tab:`Tab`,backspace:`Backspace`,Del:`Delete`,del:`Delete`,delete:`Delete`,Up:`ArrowUp`,up:`ArrowUp`,arrowup:`ArrowUp`,Down:`ArrowDown`,down:`ArrowDown`,arrowdown:`ArrowDown`,Left:`ArrowLeft`,left:`ArrowLeft`,arrowleft:`ArrowLeft`,Right:`ArrowRight`,right:`ArrowRight`,arrowright:`ArrowRight`,home:`Home`,end:`End`,pageup:`PageUp`,pagedown:`PageDown`,PgUp:`PageUp`,PgDn:`PageDown`,pgup:`PageUp`,pgdn:`PageDown`};function Vr(e){return/^\p{Letter}$/u.test(e)}function Hr(e){if(!e)return``;if(e in Br)return Br[e];if(Vr(e)){let t=e.toUpperCase();return t.length===1?t:e}let t=e.toUpperCase();return/^F([1-9]|1[0-2])$/.test(t)?t:e}var Ur={Control:`⌃`,Alt:`⌥`,Shift:`⇧`,Meta:`⌘`,Mod:`⌘`},Wr={Control:`Control`,Alt:`Option`,Shift:`Shift`,Meta:`Cmd`,Mod:`Cmd`},Gr={Control:`Ctrl`,Alt:`Alt`,Shift:`Shift`,Meta:`Win`,Mod:`Ctrl`},Kr={...Gr,Meta:`Super`},qr={"`":`Backquote`,"\\":`Backslash`,"[":`Left Bracket`,"]":`Right Bracket`,",":`Comma`,"=":`Equal`,"-":`Minus`,".":`Period`,";":`Semicolon`},Jr={ArrowUp:`↑`,ArrowDown:`↓`,ArrowLeft:`←`,ArrowRight:`→`,Enter:`↵`,Escape:`Esc`,Backspace:`⌫`,Delete:`⌦`,Tab:`⇥`,Space:`␣`};function Yr(e,t=kr()){let n=e.split(`+`),r=new Set,i=``;for(let e=0;e<n.length;e++){let a=n[e].trim();if(e===n.length-1)i=Hr(a);else{let e=jr[a]??jr[a.toLowerCase()];if(e){let n=Mr(e,t);r.add(n)}else n.length===1&&(i=Hr(a))}}return!i&&n.length>0&&(i=Hr(n[n.length-1].trim())),{key:i,ctrl:r.has(`Control`),shift:r.has(`Shift`),alt:r.has(`Alt`),meta:r.has(`Meta`),modifiers:Ar.filter(e=>r.has(e))}}function Xr(e,t=kr()){let n=e.ctrl??!1,r=e.shift??!1,i=e.alt??!1,a=e.meta??!1;e.mod&&(Mr(`Mod`,t)===`Control`?n=!0:a=!0);let o=Ar.filter(e=>{switch(e){case`Control`:return n;case`Shift`:return r;case`Alt`:return i;case`Meta`:return a;default:return!1}});return{key:e.key,ctrl:n,shift:r,alt:i,meta:a,modifiers:o}}function Zr(e,t){let n=t===`mac`?e.meta&&!e.ctrl:e.ctrl&&!e.meta,r=[];if(n)r.push(`Mod`),e.alt&&r.push(`Alt`),e.shift&&r.push(`Shift`);else for(let t of Ar)e.modifiers.includes(t)&&r.push(t);return r.push(Hr(e.key)),r.join(`+`)}function Qr(e,t=kr()){return Zr(Yr(e,t),t)}function $r(e,t=kr()){return Zr(e,t)}function ei(e,t=kr()){return typeof e==`string`?Qr(e,t):$r(Xr(e,t),t)}function ti(e){return e in jr||e.toLowerCase()in jr}function ni(e){let t=[];for(let n of Ar)e.modifiers.includes(n)&&t.push(n);return t.push(e.key),t.join(`+`)}function ri(e,t={}){let n=t.platform??kr(),r=t.useSymbols??!0,i=t.separatorToken??(n===`mac`&&r?` `:`+`);return ei(e,n).split(`+`).map(e=>{if(ti(e)){let t=jr[e]??jr[e.toLowerCase()];return n===`mac`?r?Ur[t]:Wr[t]:n===`windows`?Gr[t]:Kr[t]}else return r&&Jr[e]||!r&&qr[e]||e}).join(i)}function ii(e,t,n=kr()){let r=typeof t==`string`?Yr(t,n):t;if(e.ctrlKey!==r.ctrl||e.shiftKey!==r.shift||e.altKey!==r.alt||e.metaKey!==r.meta)return!1;let i=Hr(e.key),a=r.key;if(i!==`Dead`&&i.length===1&&a.length===1){if(i.toUpperCase()===a.toUpperCase())return!0;if(Vr(i)&&(/^[A-Za-z]$/.test(i)||!e.altKey))return!1}if(e.code&&(i===`Dead`||i.length===1&&a.length===1)){if(e.code.startsWith(`Key`)){let t=e.code.slice(3);if(t.length===1&&/^[A-Za-z]$/.test(t))return t.toUpperCase()===a.toUpperCase()}if(e.code.startsWith(`Digit`)){let t=e.code.slice(5);if(t.length===1&&/^[0-9]$/.test(t))return t===a}return e.code in zr?zr[e.code]===a:!1}return i===a}var ai={preventDefault:!0,stopPropagation:!0,eventType:`keydown`,enabled:!0,ignoreInputs:!0,conflictBehavior:`warn`};function oi(e){return!(e.ctrl||e.meta||e.key===`Escape`)}function si(e){if(!e)return!1;if(e instanceof HTMLInputElement){let t=e.type.toLowerCase();return!(t===`button`||t===`submit`||t===`reset`)}return!!(e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable)}function ci(e){return typeof document>`u`?null:typeof Document<`u`&&e instanceof Document||typeof Node<`u`&&e.nodeType===Node.DOCUMENT_NODE?e.activeElement:typeof HTMLElement<`u`&&e instanceof HTMLElement?e.ownerDocument.activeElement??null:e.document.activeElement??null}function li(e,t,n){let r=ci(t);return r&&si(r)&&r!==n||e.composedPath().some(e=>si(e)&&e!==n)?!0:si(e.target)&&e.target!==n}function ui(e,t){return t===document||t===window?e.currentTarget===t||e.currentTarget===document.documentElement:t===window?e.currentTarget===window||e.currentTarget===document||e.currentTarget===document.documentElement:!!(t instanceof HTMLElement&&(e.currentTarget===t||e.target instanceof Node&&t.contains(e.target)))}function di(e,t,n,r){if(n!==`allow`){if(n===`warn`){console.warn(`'${t}' is already registered. Multiple handlers will be triggered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to suppress this warning.`);return}if(n===`error`)throw Error(`'${t}' is already registered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to allow multiple registrations.`);r(e)}}var fi=function(e){return e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e}({});function pi({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&(fi.RecursedCheck|fi.Recursed|fi.Dirty|fi.Pending)?a&(fi.RecursedCheck|fi.Recursed)?a&fi.RecursedCheck?!(a&(fi.Dirty|fi.Pending))&&c(e,i)?(i.flags=a|(fi.Recursed|fi.Pending),a&=fi.Mutable):a=fi.None:i.flags=a&~fi.Recursed|fi.Pending:a=fi.None:i.flags=a|fi.Pending,a&fi.Watching&&t(i),a&fi.Mutable){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&fi.Dirty)a=!0;else if((c&(fi.Mutable|fi.Dirty))===(fi.Mutable|fi.Dirty)){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&(fi.Mutable|fi.Pending))===(fi.Mutable|fi.Pending)){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=~fi.Pending;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&(fi.Pending|fi.Dirty))===fi.Pending&&(n.flags=r|fi.Dirty,(r&(fi.Watching|fi.RecursedCheck))===fi.Watching&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function mi(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var hi=[],gi=0,{link:_i,unlink:vi,propagate:yi,checkDirty:bi,shallowPropagate:xi}=pi({update(e){return e._update()},notify(e){hi[Ci++]=e,e.flags&=~fi.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=fi.Mutable|fi.Dirty,Di(e))}}),Si=0,Ci=0,wi,Ti=0;function Ei(e){try{++Ti,e()}finally{--Ti||Oi()}}function Di(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=vi(n,e)}function Oi(){if(!(Ti>0)){for(;Si<Ci;){let e=hi[Si];hi[Si++]=void 0,e.notify()}Si=0,Ci=0}}function ki(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?fi.None:fi.Mutable,get(){return wi!==void 0&&_i(i,wi,gi),i._snapshot},subscribe(e){let t=mi(e),n={current:!1},r=Ai(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=wi,o=t?.compare??Object.is;if(n)wi=i,++gi,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=fi.Mutable|fi.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{wi=a,n&&(i.flags&=~fi.RecursedCheck),Di(i)}}};return n?(i.flags=fi.Mutable|fi.Dirty,i.get=function(){let e=i.flags;if(e&fi.Dirty||e&fi.Pending&&bi(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&xi(e)}}else e&fi.Pending&&(i.flags=e&~fi.Pending);return wi!==void 0&&_i(i,wi,gi),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(yi(e),xi(e),Oi())}},i}function Ai(e){let t=()=>{let t=wi;wi=n,++gi,n.depsTail=void 0,n.flags=fi.Watching|fi.RecursedCheck;try{return e()}finally{wi=t,n.flags&=~fi.RecursedCheck,Di(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:fi.Watching|fi.RecursedCheck,notify(){let e=this.flags;e&fi.Dirty||e&fi.Pending&&bi(this.deps,this)?t():this.flags=fi.Watching},stop(){this.flags=fi.None,this.depsTail=void 0,Di(this)}};return t(),n}var ji=class{constructor(e,t){this.atom=ki(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(mi(e))}},Mi=class{constructor(e){this.atom=ki(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(mi(e))}};function Ni(e,t){return typeof e==`function`?new Mi(e):t?new ji(e,t):new ji(e)}function Pi(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=Fi(e);if(n.length!==Fi(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function Fi(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var Ii=0;function Li(){return`hotkey_${++Ii}`}var Ri=class e{static#e=null;#t;#n=new Map;#r=new Map;constructor(){this.registrations=new ji(new Map),this.#t=kr()}static getInstance(){return e.#e||=new e,e.#e}static resetInstance(){e.#e&&=(e.#e.destroy(),null)}register(e,t,n={}){if(typeof document>`u`&&!n.target){let e=t;return{id:Li(),unregister:()=>{},get callback(){return e},set callback(t){e=t},setOptions:()=>{},get isActive(){return!1}}}let r=Li(),i=n.platform??this.#t,a=typeof e==`string`?Yr(e,i):Xr(e,i),o=typeof e==`string`?e:ni(a),s=n.target??document,c=n.conflictBehavior??`warn`,l=this.#d(o,s);l&&di(l.id,o,c,e=>this.#i(e));let u=n.ignoreInputs??oi(a),d={id:r,hotkey:o,parsedHotkey:a,callback:t,options:{...ai,requireReset:!1,...n,platform:i,ignoreInputs:u},hasFired:!1,triggerCount:0,target:s};this.registrations.setState(e=>new Map(e).set(r,d)),this.#r.has(s)||this.#r.set(s,new Set),this.#r.get(s).add(r),this.#a(s);let f=this;return{get id(){return r},unregister:()=>{f.#i(r)},get callback(){return f.registrations.state.get(r)?.callback??t},set callback(e){let t=f.registrations.state.get(r);t&&(t.callback=e)},setOptions:e=>{f.registrations.setState(t=>{let n=t.get(r);if(n){let i=new Map(t);return i.set(r,{...n,options:{...n.options,...e}}),i}return t})},get isActive(){return f.registrations.state.has(r)}}}#i(e){let t=this.registrations.state.get(e);if(!t)return;let n=t.target;this.registrations.setState(t=>{let n=new Map(t);return n.delete(e),n});let r=this.#r.get(n);r&&(r.delete(e),r.size===0&&this.#o(n))}#a(e){if(typeof document>`u`||this.#n.has(e))return;let t=this.#l(e),n=this.#u(e);e.addEventListener(`keydown`,t),e.addEventListener(`keyup`,n),this.#n.set(e,{keydown:t,keyup:n})}#o(e){if(typeof document>`u`)return;let t=this.#n.get(e);t&&(e.removeEventListener(`keydown`,t.keydown),e.removeEventListener(`keyup`,t.keyup),this.#n.delete(e),this.#r.delete(e))}#s(e,t,n){let r=this.#r.get(t);if(r)for(let i of r){let r=this.registrations.state.get(i);if(r&&ui(e,t)&&r.options.enabled&&!(r.options.ignoreInputs!==!1&&li(e,t,r.target)))if(n===`keydown`){if(r.options.eventType!==`keydown`)continue;ii(e,r.parsedHotkey,r.options.platform)&&(r.options.preventDefault&&e.preventDefault(),r.options.stopPropagation&&e.stopPropagation(),(!r.options.requireReset||!r.hasFired)&&(this.#c(r,e),r.options.requireReset&&(r.hasFired=!0)))}else r.options.eventType===`keyup`&&ii(e,r.parsedHotkey,r.options.platform)&&this.#c(r,e),r.options.requireReset&&r.hasFired&&this.#f(r,e)&&(r.hasFired=!1)}}#c(e,t){e.options.preventDefault&&t.preventDefault(),e.options.stopPropagation&&t.stopPropagation(),e.triggerCount++,this.registrations.setState(e=>new Map(e));let n={hotkey:e.hotkey,parsedHotkey:e.parsedHotkey};e.callback(t,n)}#l(e){return t=>{this.#s(t,e,`keydown`)}}#u(e){return t=>{this.#s(t,e,`keyup`)}}#d(e,t){for(let n of this.registrations.state.values())if(n.hotkey===e&&n.target===t)return n;return null}#f(e,t){let n=e.parsedHotkey,r=Hr(t.key),i=n.key.length===1?n.key.toUpperCase():n.key;return!!((r.length===1?r.toUpperCase():r)===i||n.ctrl&&r===`Control`||n.shift&&r===`Shift`||n.alt&&r===`Alt`||n.meta&&r===`Meta`)}triggerRegistration(e){let t=this.registrations.state.get(e);if(!t)return!1;let n=t.parsedHotkey,r=new KeyboardEvent(t.options.eventType??`keydown`,{key:n.key,ctrlKey:n.ctrl,shiftKey:n.shift,altKey:n.alt,metaKey:n.meta,bubbles:!0,cancelable:!0});return t.triggerCount++,this.registrations.setState(e=>new Map(e)),t.callback(r,{hotkey:t.hotkey,parsedHotkey:t.parsedHotkey}),!0}getRegistrationCount(){return this.registrations.state.size}isRegistered(e,t){for(let n of this.registrations.state.values())if(n.hotkey===e&&(t===void 0||n.target===t))return!0;return!1}destroy(){for(let e of this.#n.keys())this.#o(e);this.registrations.setState(()=>new Map),this.#n.clear(),this.#r.clear()}};function zi(){return Ri.getInstance()}function Bi(e,t={}){let n=b().hotkey,r=zi(),i=t.platform??n?.platform??kr(),a=(0,Z.useRef)(new Map),o=(0,Z.useRef)(e),s=(0,Z.useRef)([]),c=(0,Z.useRef)(t),l=(0,Z.useRef)(n),u=(0,Z.useRef)(r),d=e.map(e=>ei(e.hotkey,i));o.current=e,s.current=d,c.current=t,l.current=n,u.current=r,(0,Z.useEffect)(()=>{let e=a.current,t=new Map,n=[];for(let e=0;e<o.current.length;e++){let t=o.current[e],r=s.current[e],i={...l.current,...c.current,...t.options},a=Or(i.target)?i.target.current:i.target??(typeof document<`u`?document:null);if(!a)continue;let u=`${e}:${r}`;n.push({registrationKey:u,def:t,hotkeyStr:r,mergedOptions:i,resolvedTarget:a})}let r=new Set(n.map(e=>e.registrationKey));for(let[t,n]of e)!r.has(t)&&n.handle.isActive&&n.handle.unregister();for(let r of n){let{registrationKey:n,def:i,hotkeyStr:a,mergedOptions:o,resolvedTarget:s}=r,c=e.get(n);if(c?.handle.isActive&&c.target===s){t.set(n,c);continue}c?.handle.isActive&&c.handle.unregister();let l=u.current.register(a,i.callback,{...o,target:s});t.set(n,{handle:l,target:s})}a.current=t}),(0,Z.useEffect)(()=>()=>{for(let{handle:e}of a.current.values())e.isActive&&e.unregister();a.current=new Map},[]);for(let r=0;r<e.length;r++){let i=e[r],o=d[r],s=`${r}:${o}`,c=a.current.get(s)?.handle;if(c?.isActive){c.callback=i.callback;let{target:e,...r}={...n,...t,...i.options};c.setOptions(r)}}}var Vi=qt();function Hi(e,t){return e===t}function Ui(e,t=e=>e,n){let r=n?.compare??Hi,i=(0,Z.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,Z.useCallback)(()=>e.get(),[e]);return(0,Vi.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var Wi=0;function Gi(e,t={}){let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(Wi);let a=()=>e?.focus({preventScroll:n});if(i)return a(),_t;let o=requestAnimationFrame(a);return Wi=o,()=>{Wi===o&&(cancelAnimationFrame(o),Wi=0)}}var Ki={inert:new WeakMap,"aria-hidden":new WeakMap},qi=`data-base-ui-inert`,Ji={inert:new WeakSet,"aria-hidden":new WeakSet},Yi=new WeakMap,Xi=0;function Zi(e){return Ji[e]}function Qi(e){return e?F(e)?e.host:Qi(e.parentNode):null}var $i=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Qi(t);return e.contains(n)?n:null}).filter(e=>e!=null),ea=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},ta=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{D(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function na(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){let o=r?`inert`:n?`aria-hidden`:null,s=null,c=null,l=$i(t,e),u=i?$i(t,a):[],d=new Set(u),f=i?ta(t,ea(l),new Set(l)).filter(e=>!d.has(e)):[],p=[],m=[];if(o){let e=Ki[o],n=Zi(o);c=n,s=e;let r=$i(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=l.concat(r);ta(t,ea(i),new Set(i)).forEach(t=>{let r=t.getAttribute(o),i=r!==null&&r!==`false`,a=(e.get(t)||0)+1;e.set(t,a),p.push(t),a===1&&i&&n.add(t),i||t.setAttribute(o,o===`inert`?``:`true`)})}return i&&f.forEach(e=>{let t=(Yi.get(e)||0)+1;Yi.set(e,t),m.push(e),t===1&&e.setAttribute(qi,``)}),Xi+=1,()=>{s&&p.forEach(e=>{let t=(s.get(e)||0)-1;s.set(e,t),t||(!c?.has(e)&&o&&e.removeAttribute(o),c?.delete(e))}),i&&m.forEach(e=>{let t=(Yi.get(e)||0)-1;Yi.set(e,t),t||e.removeAttribute(qi)}),--Xi,Xi||(Ki.inert=new WeakMap,Ki[`aria-hidden`]=new WeakMap,Ji.inert=new WeakSet,Ji[`aria-hidden`]=new WeakSet,Yi=new WeakMap)}}function ra(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:a=[]}=t,o=y(e[0]).body;return na(e,o,n,r,{mark:i,markerIgnoreElements:a})}function ia(e,t){let n=J(Wn(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var aa=20,oa=[];function sa(){oa=oa.filter(e=>e.deref()?.isConnected)}function ca(e){sa(),e&&D(e)!==`body`&&(oa.push(new WeakRef(e)),oa.length>aa&&(oa=oa.slice(-aa)))}function la(){return sa(),oa[oa.length-1]?.deref()}function ua(e){return e?Rt(e)?e:ct(e)[0]||e:null}function da(e){return!e||!e.isConnected?!1:typeof e.checkVisibility==`function`?e.checkVisibility():fn(e)}function fa(e,t){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=be(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Rt(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),r=e.getAttribute(`tabindex`);t.current.includes(`floating`)||n.length===0?r!==`0`&&e.setAttribute(`tabindex`,`0`):(r!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function pa(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:o=!0,restoreFocus:c=!1,modal:l=!0,closeOnFocusOut:u=!0,openInteractionType:d=``,nextFocusableElement:f,previousFocusableElement:m,beforeContentFocusGuardRef:h,externalTree:g,getInsideElements:_}=e,v=`rootStore`in t?t.rootStore:t,b=v.useState(`open`),x=v.useState(`domReferenceElement`),S=v.useState(`floatingElement`),{events:w,dataRef:T}=v.context,E=s(()=>T.current.floatingContext?.nodeId),D=i===!1,O=it(x)&&D,A=Z.useRef([`content`]),j=Ht(i),M=Ht(o),N=Ht(d),P=p(g),F=Ie(),I=Z.useRef(!1),L=Z.useRef(!1),R=Z.useRef(!1),z=Z.useRef(null),B=Z.useRef(``),V=Z.useRef(``),H=Z.useRef(null),U=Z.useRef(null),W=ie(H,h,F?.beforeInsideRef),ee=ie(U,F?.afterInsideRef),G=Ln(),te=Ln(),K=Kt(),q=F!=null,J=At(S),ne=s((e=J)=>e?ct(e):[]),Y=s(()=>_?.().filter(e=>e!=null)??[]);Z.useEffect(()=>{if(r||!l)return;function e(e){e.key===`Tab`&&ft(J,Jn(y(J)))&&ne().length===0&&!O&&pn(e)}return ge(y(J),`keydown`,e)},[r,x,J,l,A,O,ne]),Z.useEffect(()=>{if(r||!b)return;let e=y(J);function t(){R.current=!1}function n(e){let t=Wn(e),n=Y();R.current=!(ft(S,t)||ft(x,t)||ft(F?.portalNode,t)||n.some(e=>e===t||ft(e,t))),V.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(L.current=!0)}function i(){V.current=`keyboard`}return ce(ge(e,`pointerdown`,n,!0),ge(e,`pointerup`,t,!0),ge(e,`pointercancel`,t,!0),ge(e,`keydown`,i,!0))},[r,S,x,J,b,F,Y]),Z.useEffect(()=>{if(r||!u)return;let e=y(J);function t(){L.current=!0,te.start(0,()=>{L.current=!1})}function n(e){let t=Wn(e);Rt(t)&&(z.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=Wn(t);queueMicrotask(()=>{let a=E(),o=v.context.triggerElements,s=Y(),u=n?.hasAttribute(Qe(`focus-guard`))&&[H.current,U.current,F?.beforeInsideRef.current,F?.afterInsideRef.current,F?.beforeOutsideRef.current,F?.afterOutsideRef.current,k(m),k(f)].includes(n),d=!(ft(x,n)||ft(S,n)||ft(n,S)||ft(F?.portalNode,n)||s.some(e=>e===n||ft(e,n))||n!=null&&o.hasElement(n)||o.hasMatchingElement(e=>ft(e,n))||u||P&&(nt(P.nodesRef.current,a).find(e=>ft(e.context?.elements.floating,n)||ft(e.context?.elements.domReference,n))||Je(P.nodesRef.current,a).find(e=>[e.context?.elements.floating,At(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===x&&J&&fa(J,A),c&&r!==x&&!da(i)&&Jn(e)===e.body){if(Qn(J)&&(J.focus(),c===`popup`)){K.request(()=>{J.focus()});return}let e=ne(),t=z.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||J;Qn(n)&&n.focus()}if(T.current.insideReactTree){T.current.insideReactTree=!1;return}(O||!l)&&n&&d&&!L.current&&(O||n!==la())&&(I.current=!0,v.setOpen(!1,Pe(gn,t)))})}function a(){R.current||(T.current.insideReactTree=!0,G.start(0,()=>{T.current.insideReactTree=!1}))}let o=Qn(x)?x:null;if(!(!S&&!o))return ce(o&&ge(o,`focusout`,i),o&&ge(o,`pointerdown`,t),S&&ge(S,`focusin`,n),S&&ge(S,`focusout`,i),S&&F&&ge(S,`focusout`,a,!0))},[r,x,S,J,l,P,F,v,u,c,ne,O,E,A,T,G,te,K,f,m,Y]),Z.useEffect(()=>{if(r||!S||!b)return;let e=Array.from(F?.portalNode?.querySelectorAll(`[${Qe(`portal`)}]`)||[]),t=(P?Je(P.nodesRef.current,E()):[]).find(e=>it(e.context?.elements.domReference||null))?.context?.elements.domReference,n=ra([...[S,...e,H.current,U.current,F?.beforeOutsideRef.current,F?.afterOutsideRef.current,...Y()],t,k(m),k(f),O?x:null].filter(e=>e!=null),{ariaHidden:l||O,mark:!1}),i=ra([S,...e].filter(e=>e!=null));return()=>{i(),n()}},[b,r,x,S,l,A,F,O,P,E,f,m,Y]),Gn(()=>{if(!b||r||!Qn(J))return;let e=Jn(y(J));queueMicrotask(()=>{let t=j.current,n=typeof t==`function`?t(N.current||``):t;if(n===void 0||n===!1||ft(J,e))return;let r=null,i=()=>(r??=ne(J),r[0]||J),a;a=n===!0||n===null?i():k(n),a||=i(),Gi(a,{preventScroll:a===J})})},[r,b,J,D,ne,j,N]),Gn(()=>{if(r||!J)return;let e=y(J);ca(Jn(e));function t(e){if(e.open||(B.current=ia(e.nativeEvent,V.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(I.current=!0),e.reason===`outside-press`)if(e.nested)I.current=!1;else if(xt(e.nativeEvent)||Dt(e.nativeEvent))I.current=!1;else{let e=!1;y(J).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?I.current=!1:I.current=!0}}w.on(`openchange`,t);function n(){let e=M.current,t=typeof e==`function`?e(B.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`){let e=x||la();return e&&e.isConnected?e:null}let n=x||la();return k(t)||n||null}return()=>{w.off(`openchange`,t);let r=Jn(e),i=Y(),a=ft(S,r)||i.some(e=>e===r||ft(e,r))||P&&nt(P.nodesRef.current,E(),!1).some(e=>ft(e.context?.elements.floating,r)),o=M.current,s=n();queueMicrotask(()=>{let t=ua(s),n=typeof o!=`boolean`;o&&!I.current&&Qn(t)&&(!(!n&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),I.current=!1})}},[r,S,J,M,T,w,P,x,E,Y]),Gn(()=>{if(!jt||b||!S)return;let e=Jn(y(S));!Qn(e)||!In(e)||ft(S,e)&&e.blur()},[b,S]),Gn(()=>{if(!(r||!F))return F.setFocusManagerState({modal:l,closeOnFocusOut:u,open:b,onOpenChange:v.setOpen,domReference:x}),()=>{F.setFocusManagerState(null)}},[r,F,l,b,v,u,x]),Gn(()=>{if(!(r||!J))return fa(J,A),()=>{queueMicrotask(sa)}},[r,J,A]);let re=!r&&(l?!O:!0)&&(q||l);return(0,Q.jsxs)(Z.Fragment,{children:[re&&(0,Q.jsx)(C,{"data-type":`inside`,ref:W,onFocus:e=>{if(l){let e=ne();Gi(e[e.length-1])}else F?.portalNode&&(I.current=!1,bn(e,F.portalNode)?a(x)?.focus():k(m??F.beforeOutsideRef)?.focus())}}),n,re&&(0,Q.jsx)(C,{"data-type":`inside`,ref:ee,onFocus:e=>{l?Gi(ne()[0]):F?.portalNode&&(u&&(I.current=!0),bn(e,F.portalNode)?Ct(x)?.focus():k(f??F.afterOutsideRef)?.focus())}})]})}function ma(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,{enabled:i=!0,event:a=`click`,toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:c=!0,touchOpenDelay:l=0,reason:u=an}=t,d=Z.useRef(void 0),f=Kt(),p=Ln(),m=Z.useMemo(()=>({onPointerDown(e){d.current=e.pointerType},onMouseDown(e){let t=d.current,i=e.nativeEvent,m=n.select(`open`);if(e.button!==0||a===`click`||Nn(t,!0)&&s)return;let h=r.current.openEvent,g=h?.type,_=n.select(`domReferenceElement`)!==e.currentTarget,v=m&&_||!(m&&o&&(!(h&&c)||g===`click`||g===`mousedown`)),y=Wn(i);if(In(y)){let e=Pe(u,i,y);v&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(v,e);return}let b=e.currentTarget;f.request(()=>{let e=Pe(u,i,b);v&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(v,e)})},onClick(e){if(a===`mousedown-only`)return;let t=d.current;if(a===`mousedown`&&t){d.current=void 0;return}if(Nn(t,!0)&&s)return;let i=n.select(`open`),f=r.current.openEvent,m=n.select(`domReferenceElement`)!==e.currentTarget,h=i&&m||!(i&&o&&(!(f&&c)||Zt(f))),g=Pe(u,e.nativeEvent,e.currentTarget);h&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,g)}):n.setOpen(h,g)},onKeyDown(){d.current=void 0}}),[r,a,s,n,c,o,f,p,l,u]);return Z.useMemo(()=>i?{reference:m}:Tn,[i,m])}function ha(e){let t=e.currentTarget.getBoundingClientRect();return t.top+1<=e.clientY&&e.clientY<=t.bottom-1&&t.left+1<=e.clientX&&e.clientX<=t.right-1}var ga=`Escape`;function _a(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function va(e,t){return _a(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function ya(e,t,n){return _a(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function ba(e,t,n){return _a(t,n?e===h:e===Bn,e===Ee)}function eee(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===ga:_a(t,n?e===Bn:e===h,e===Ae)}function tee(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{listRef:c,activeIndex:l,onNavigate:u=()=>{},enabled:d=!0,selectedIndex:f=null,allowEscape:m=!1,loopFocus:h=!1,nested:g=!1,rtl:_=!1,virtual:v=!1,focusItemOnOpen:b=`auto`,focusItemOnHover:x=!0,openOnArrowKeyDown:S=!0,disabledIndices:C=void 0,orientation:w=`vertical`,parentOrientation:T,cols:E=1,id:D,resetOnPointerLeave:O=!0,externalTree:k}=t,A=Ht(At(i)),j=er(),M=p(k);Gn(()=>{o.current.orientation=w},[o,w]);let N=it(a),P=Z.useRef(b),F=Z.useRef(f??-1),I=Z.useRef(null),L=Z.useRef(!0),R=s(e=>{u(F.current===-1?null:F.current,e)}),z=Z.useRef(R),B=Z.useRef(!!i),V=Z.useRef(r),H=Z.useRef(!1),U=Z.useRef(!1),W=Z.useRef(null),ee=Ht(C),G=Ht(r),te=Ht(f),K=Ht(O),q=s(()=>{function e(e){v?M?.events.emit(`virtualfocus`,e):W.current=Gi(e,{sync:H.current,preventScroll:!0})}let t=c.current[F.current],n=U.current;t&&e(t),(H.current?e=>e():requestAnimationFrame)(()=>{let r=c.current[F.current]||t;r&&(t||e(r),Y&&(n||!L.current)&&r.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Gn(()=>{d&&(r&&i?(F.current=f??-1,P.current&&f!=null&&(U.current=!0,R())):B.current&&(F.current=-1,z.current()))},[d,r,i,f,R]),Gn(()=>{if(d){if(!r){H.current=!1;return}if(i)if(l==null){if(H.current=!1,te.current!=null)return;if(B.current&&(F.current=-1,q()),(!V.current||!B.current)&&P.current&&(I.current!=null||P.current===!0&&I.current==null)){let e=0,t=()=>{c.current[0]==null?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e+=1):(F.current=I.current==null||ya(I.current,w,_)||g?Et(c):bt(c),I.current=null,R())};t()}}else en(c.current,l)||(F.current=l,q(),U.current=!1)}},[d,r,i,l,te,g,c,w,_,R,q,ee]),Gn(()=>{if(!d||i||!M||v||!B.current)return;let e=M.nodesRef.current,t=e.find(e=>e.id===j)?.context?.elements.floating,n=Jn(y(i)),r=e.some(e=>e.context&&ft(e.context.elements.floating,n));t&&!r&&L.current&&t.focus({preventScroll:!0})},[d,i,M,j,v]),Gn(()=>{z.current=R,V.current=r,B.current=!!i}),Gn(()=>{r||(I.current=null,P.current=b)},[r,b]);let J=l!=null,ne=s(e=>{if(!G.current)return;let t=c.current.indexOf(e.currentTarget);t!==-1&&(F.current!==t||l!==t)&&(F.current=t,R(e))}),Y=Z.useMemo(()=>({onFocus(e){H.current=!0,ne(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){H.current=!0,U.current=!1,x&&ne(e)},onPointerLeave(e){if(!G.current||!L.current||e.pointerType===`touch`)return;H.current=!0;let t=e.relatedTarget;if(!ha(e)&&!(!x||c.current.includes(t))&&K.current&&(W.current?.(),W.current=null,F.current=-1,R(e),!v)){let e=A.current,t=Jn(y(e));e&&ft(e,t)&&e.focus({preventScroll:!0})}}}),[ne,G,A,x,c,R,K,v]),re=Z.useCallback(()=>T??M?.nodesRef.current.find(e=>e.id===j)?.context?.dataRef?.current.orientation,[j,M,T]),ie=s(e=>{if(L.current=!1,H.current=!0,e.which===229||!G.current&&e.currentTarget===A.current)return;if(g&&eee(e.key,w,_,E)){va(e.key,re())||pn(e),n.setOpen(!1,Pe(Ke,e.nativeEvent)),Qn(a)&&(v?M?.events.emit(`virtualfocus`,a):a.focus());return}let t=F.current,i=Et(c,C),o=bt(c,C);if(N||(e.key===`Home`&&(pn(e),F.current=i,R(e)),e.key===`End`&&(pn(e),F.current=o,R(e))),E>1){let t=Array.from({length:c.current.length},()=>({width:1,height:1})),n=cn(t,E,!1),r=n.findIndex(e=>e!=null&&!Pt(c.current,e,C)),a=n.reduce((e,t,n)=>t!=null&&!Pt(c.current,t,C)?n:e,-1),s=n[Mn(n.map(e=>e==null?null:c.current[e]),{event:e,orientation:w,loopFocus:h,rtl:_,cols:E,disabledIndices:Xt([...(typeof C==`function`?null:C)||c.current.map((e,t)=>Pt(c.current,t,C)?t:void 0),void 0],n),minIndex:r,maxIndex:a,prevIndex:gt(F.current>o?i:F.current,t,n,E,e.key===`ArrowDown`?`bl`:e.key===(_?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(s!=null&&(F.current=s,R(e)),w===`both`)return}if(va(e.key,w)){if(pn(e),r&&!v&&Jn(e.currentTarget.ownerDocument)===e.currentTarget){F.current=ya(e.key,w,_)?i:o,R(e);return}ya(e.key,w,_)?h?t>=o?m&&t!==c.current.length?F.current=-1:(H.current=!1,F.current=i):F.current=wn(c.current,{startingIndex:t,disabledIndices:C}):F.current=Math.min(o,wn(c.current,{startingIndex:t,disabledIndices:C})):h?t<=i?m&&t!==-1?F.current=c.current.length:(H.current=!1,F.current=o):F.current=wn(c.current,{startingIndex:t,decrement:!0,disabledIndices:C}):F.current=Math.max(i,wn(c.current,{startingIndex:t,decrement:!0,disabledIndices:C})),en(c.current,F.current)&&(F.current=-1),R(e)}}),ae=Z.useMemo(()=>v&&r&&J&&{"aria-activedescendant":`${D}-${l}`},[v,r,J,D,l]),oe=Z.useMemo(()=>({"aria-orientation":w===`both`?void 0:w,...N?{}:ae,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&r&&!v){let t=Wn(e.nativeEvent);if(t&&!ft(A.current,t))return;pn(e),n.setOpen(!1,Pe(gn,e.nativeEvent)),Qn(a)&&a.focus();return}ie(e)},onPointerMove(){L.current=!0}}),[ae,ie,A,w,N,n,r,v,a]),se=Z.useMemo(()=>{function e(e){b===`auto`&&xt(e.nativeEvent)&&(P.current=!v)}function t(e){P.current=b,b===`auto`&&Dt(e.nativeEvent)&&(P.current=!0)}return{onKeyDown(e){let t=n.select(`open`);L.current=!1;let r=e.key.startsWith(`Arrow`),i=ba(e.key,re(),_),a=va(e.key,w),o=(g?i:a)||e.key===`Enter`||e.key.trim()===``;if(v&&t)return ie(e);if(!(!t&&!S&&r)){if(o){let t=va(e.key,re());I.current=g&&t?null:e.key}if(g){i&&(pn(e),t?(F.current=Et(c,ee.current),R(e)):n.setOpen(!0,Pe(Ke,e.nativeEvent,e.currentTarget)));return}a&&(te.current!=null&&(F.current=te.current),pn(e),!t&&S?n.setOpen(!0,Pe(Ke,e.nativeEvent,e.currentTarget)):ie(e),t&&R(e))}},onFocus(e){n.select(`open`)&&!v&&(F.current=-1,R(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[ie,ee,b,c,g,R,n,S,w,re,_,te,v]),ce=Z.useMemo(()=>({...ae,...se}),[ae,se]);return Z.useMemo(()=>d?{reference:ce,floating:oe,item:Y,trigger:se}:{},[d,ce,oe,se,Y])}var nee=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function xa(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingId`),a=n.useState(`domReferenceElement`),o=n.useState(`floatingElement`),{role:s=`dialog`}=t,c=ee(),l=a?.id||c,u=Z.useMemo(()=>At(o)?.id||i,[o,i]),d=nee.get(s)??s,f=er()!=null,p=Z.useMemo(()=>d===`tooltip`||s===`label`?Tn:{"aria-haspopup":d===`alertdialog`?`dialog`:d,"aria-expanded":`false`,...d===`listbox`&&{role:`combobox`},...d===`menu`&&f&&{role:`menuitem`},...s===`select`&&{"aria-autocomplete":`none`},...s===`combobox`&&{"aria-autocomplete":`list`}},[d,f,s]),m=Z.useMemo(()=>d===`tooltip`||s===`label`?{[`aria-${s===`label`?`labelledby`:`describedby`}`]:r?u:void 0}:{...p,"aria-expanded":r?`true`:`false`,"aria-controls":r?u:void 0,...d===`menu`&&{id:l}},[d,u,r,l,s,p]),h=Z.useMemo(()=>{let e={id:u,...d&&{role:d}};return d===`tooltip`||s===`label`?e:{...e,...d===`menu`&&{"aria-labelledby":l}}},[d,u,l,s]),g=Z.useCallback(({active:e,selected:t})=>{let n={role:`option`,...e&&{id:`${u}-fui-option`}};switch(s){case`select`:case`combobox`:return{...n,"aria-selected":t};default:}return{}},[u,s]);return Z.useMemo(()=>({reference:m,floating:h,item:g,trigger:p}),[m,h,p,g])}function Sa(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,i=n.useState(`open`),{listRef:a,elementsRef:o,activeIndex:c,onMatch:l,onTypingChange:u,enabled:d=!0,resetMs:f=750,selectedIndex:p=null}=t,m=Ln(),h=Z.useRef(``),g=Z.useRef(p??c??-1),_=Z.useRef(null);Gn(()=>{!i&&p!==null||(m.clear(),_.current=null,h.current!==``&&(h.current=``))},[i,p,m]),Gn(()=>{i&&h.current===``&&(g.current=p??c??-1)},[i,p,c]);let v=s(e=>{e?r.current.typing||(r.current.typing=e,u?.(e)):r.current.typing&&(r.current.typing=e,u?.(e))}),y=s(e=>{function t(e){let t=o?.current[e];return!t||fn(t)}function n(e,n,r=0){if(e.length===0)return-1;let i=(r%e.length+e.length)%e.length,a=n.toLocaleLowerCase();for(let n=0;n<e.length;n+=1){let r=(i+n)%e.length;if(!(!e[r]?.toLocaleLowerCase().startsWith(a)||!t(r)))return r}return-1}let r=a.current;if(h.current.length>0&&e.key===` `&&(pn(e),v(!0)),h.current.length>0&&h.current[0]!==` `&&n(r,h.current)===-1&&e.key!==` `&&v(!1),r==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;i&&e.key!==` `&&(pn(e),v(!0));let s=h.current===``;s&&(g.current=p??c??-1),r.every(e=>e?e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase():!0)&&h.current===e.key&&(h.current=``,g.current=_.current),h.current+=e.key,m.start(f,()=>{h.current=``,g.current=_.current,v(!1)});let u=((s?p??c??-1:g.current)??0)+1,d=n(r,h.current,u);d===-1?e.key!==` `&&(h.current=``,v(!1)):(l?.(d),_.current=d)}),b=s(e=>{let t=e.relatedTarget,r=n.select(`domReferenceElement`),i=n.select(`floatingElement`),a=ft(r,t),o=ft(i,t);a||o||(m.clear(),h.current=``,g.current=_.current,v(!1))}),x=Z.useMemo(()=>({onKeyDown:y,onBlur:b}),[y,b]),S=Z.useMemo(()=>({onKeyDown:y,onBlur:b}),[y,b]);return Z.useMemo(()=>d?{reference:x,floating:S}:{},[d,x,S])}function Ca(e){return vn(19)?e:e?`true`:void 0}var wa=An(`arrow-up-to-line`,[[`path`,{d:`M5 3h14`,key:`7usisc`}],[`path`,{d:`m18 13-6-6-6 6`,key:`1kf1n9`}],[`path`,{d:`M12 7v14`,key:`1akyts`}]]),Ta=An(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Ea=An(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Da=An(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Oa=An(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),ka=An(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Aa=An(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),ja=An(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Ma=An(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Na=An(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Pa=An(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Fa=An(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Ia=An(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),La=An(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Ra=An(`image-plus`,[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]),za=An(`list-end`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M16 12H3`,key:`1a2rj7`}],[`path`,{d:`M9 19H3`,key:`s61nz1`}],[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M21 5v12a2 2 0 0 1-2 2h-6`,key:`hey24a`}]]),Ba=An(`list-start`,[[`path`,{d:`M3 5h6`,key:`1ltk0q`}],[`path`,{d:`M3 12h13`,key:`ppymz1`}],[`path`,{d:`M3 19h13`,key:`bpdczq`}],[`path`,{d:`m16 8-3-3 3-3`,key:`1pjpp6`}],[`path`,{d:`M21 19V7a2 2 0 0 0-2-2h-6`,key:`4zzq67`}]]),Va=An(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),Ha=An(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),Ua=An(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Wa=An(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),Ga=An(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Ka=An(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),qa=An(`square-arrow-out-up-right`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]),Ja=An(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Ya=An(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Xa=An(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Za=An(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),Qa=An(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function $a(e){return typeof e==`function`}function eo(e,...t){return $a(e)?e(...t):e}var to=class{#e=!0;#t;#n;#r;#i;#a;#o;#s;#c=0;#l=5;#u=!1;#d=!1;#f=null;#p=()=>{this.debugLog(`Connected to event bus`),this.#a=!0,this.#u=!1,this.debugLog(`Emitting queued events`,this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener(`tanstack-connect-success`,this.#p)};#m=()=>{if(this.#c<this.#l){this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{});return}this.#n().removeEventListener(`tanstack-connect`,this.#m),this.#d=!0,this.debugLog(`Max retries reached, giving up on connection`),this.stopConnectLoop()};#h=()=>{this.#u||(this.#u=!0,this.#n().addEventListener(`tanstack-connect-success`,this.#p),this.#m())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(` Initializing event subscription for plugin`,this.#t),this.#i=[],this.#a=!1,this.#d=!1,this.#o=null,this.#s=r}startConnectLoop(){this.#o!==null||this.#a||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#o=setInterval(this.#m,this.#s))}stopConnectLoop(){this.#u=!1,this.#o!==null&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog(`Stopped connect loop`))}debugLog(...e){this.#r&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if(typeof globalThis<`u`&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog(`Using global event target`),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<`u`&&window.addEventListener!==void 0)return this.debugLog(`Using window as event target`),window;let e=typeof EventTarget<`u`?new EventTarget:void 0;return e===void 0||e.addEventListener===void 0?(this.debugLog(`No event mechanism available, running in non-web environment`),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog(`Using new EventTarget as fallback`),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch{this.debugLog(`Failed to dispatch shim event`)}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog(`Emitting event to client bus`,e),this.dispatchCustomEvent(`tanstack-dispatch-event`,e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e){this.debugLog(`Event bus client is disabled, not emitting event`,e,t);return}if(this.#f&&(this.debugLog(`Emitting event to internal event target`,e,t),this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d){this.debugLog(`Previously failed to connect, not emitting to bus`);return}if(!this.#a){this.debugLog(`Bus not available, will be pushed as soon as connected`),this.#i.push(this.createEventPayload(e,t)),typeof CustomEvent<`u`&&!this.#u&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#f||=new EventTarget,this.#f.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`,i),()=>{};let a=e=>{this.debugLog(`Received event from bus`,e.detail),t(e.detail)};return this.#n().addEventListener(i,a),this.debugLog(`Registered event to bus`,i),()=>{r&&this.#f?.removeEventListener(i,a),this.#n().removeEventListener(i,a)}}onAll(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}},no=new Map;function ro(e,t){no.set(e,t)}function io(e){if(e!==void 0)try{return JSON.parse(JSON.stringify(e))}catch{return null}}function ao(e){return typeof e.get==`function`?e.get():e.state}function oo(e){return{key:e.key,store:{state:io(ao(e.store))},options:io(e.options)}}var so=class extends to{constructor(e){super({pluginId:`pacer`,debug:e?.debug,reconnectEveryMs:1e3})}},co=(e,t)=>{let n=t.key;n&&(ro(n,t),lo.emit(e,oo({...t,key:n})))},lo=new so;function uo(){return{currentAttempt:0,executionCount:0,isExecuting:!1,lastError:void 0,lastExecutionTime:0,lastResult:void 0,status:`idle`,totalExecutionTime:0}}var fo={backoff:`exponential`,baseWait:1e3,maxWait:1/0,enabled:!0,jitter:0,maxAttempts:3,maxExecutionTime:1/0,maxTotalExecutionTime:1/0,throwOnError:`last`},ree=class{#e;constructor(e,t={}){this.fn=e,this.store=new ji(uo()),this.#e=null,this.setOptions=e=>{this.options={...this.options,...e}},this.#t=e=>{this.store.setState(t=>{let n={...t,...e},{isExecuting:r,currentAttempt:i}=n;return{...n,status:this.#n()?r&&i===1?`executing`:r&&i>1?`retrying`:`idle`:`disabled`}}),co(`AsyncRetryer`,this)},this.#n=()=>!!eo(this.options.enabled,this),this.#r=()=>eo(this.options.maxAttempts,this),this.#i=()=>eo(this.options.baseWait,this),this.#a=()=>eo(this.options.maxWait,this),this.#o=e=>{let t=this.options.jitter;if(t<=0)return 0;try{let n=typeof globalThis<`u`?globalThis.crypto:void 0;if(n?.getRandomValues){let r=new Uint32Array(1);n.getRandomValues(r);let i=r[0]/4294967295*2-1;return Math.floor(e*t*i)}}catch{}return 0},this.#s=e=>{let t=this.#i(),n;switch(this.options.backoff){case`linear`:n=t*e;break;case`exponential`:n=t*2**(e-1);break;default:n=t;break}n=Math.min(n,this.#a());let r=this.#o(n);return Math.max(0,n+r)},this.execute=async(...e)=>{if(!this.#n())return;this.abort(`new-execution`);let t=Date.now(),n,r;this.#e=new AbortController;let i=this.#e.signal;this.#t({isExecuting:!0,currentAttempt:0,lastError:void 0});let a;this.options.maxTotalExecutionTime!==1/0&&(a=setTimeout(()=>{this.options.onTotalExecutionTimeout?.(this),this.abort(`total-timeout`)},this.options.maxTotalExecutionTime));let o=!1;for(let a=1;a<=this.#r();a++){o=a===this.#r(),this.#t({currentAttempt:a});try{if(i.aborted)return;let n=Date.now()-t;if(this.options.maxTotalExecutionTime!==1/0&&n>=this.options.maxTotalExecutionTime){this.options.onTotalExecutionTimeout?.(this),this.abort(`total-timeout`);return}if(r=this.options.maxExecutionTime===1/0?await this.fn(...e):await Promise.race([this.fn(...e),new Promise((e,t)=>{let n=setTimeout(()=>{this.options.onExecutionTimeout?.(this),this.abort(`execution-timeout`),t(Error(`Execution timeout: ${this.options.maxExecutionTime}ms exceeded`))},this.options.maxExecutionTime);i.addEventListener(`abort`,()=>{clearTimeout(n),t(Error(`Aborted`))},{once:!0})})]),i.aborted)return;let a=Date.now()-t;return this.#t({executionCount:this.store.state.executionCount+1,isExecuting:!1,lastExecutionTime:Date.now(),totalExecutionTime:a,currentAttempt:0,lastResult:r}),this.options.onSuccess?.(r,e,this),r}catch(t){if(t&&typeof t==`object`&&`name`in t&&t.name===`AbortError`)return;if(n=t instanceof Error?t:Error(String(t)),this.#t({lastError:n}),this.options.onError?.(n,e,this),a<this.#r()){this.options.onRetry?.(a,n,this);let e=this.#s(a);if(e>0&&(this.#t({isExecuting:!0,currentAttempt:a+1}),await new Promise(t=>{let n=setTimeout(()=>{i.removeEventListener(`abort`,r),t()},e),r=()=>{clearTimeout(n),i.removeEventListener(`abort`,r),t()};i.addEventListener(`abort`,r)}),i.aborted))return}}finally{this.options.onSettled?.(e,this)}}if(a&&clearTimeout(a),this.#t({isExecuting:!1}),this.options.onLastError?.(n,this),this.options.onSettled?.(e,this),this.options.throwOnError===`last`&&o||this.options.throwOnError===!0)throw n},this.getAbortSignal=()=>this.#e?.signal??null,this.abort=(e=`manual`)=>{this.#e&&(this.#e.abort(),this.#e=null,this.#t({isExecuting:!1}),this.options.onAbort?.(e,this))},this.reset=()=>{this.#t(uo())},this.key=t.key,this.options={...fo,...t,throwOnError:t.throwOnError??(t.onError?!1:fo.throwOnError)},this.#t(this.options.initialState??{}),this.key&&lo.on(`d-AsyncRetryer`,e=>{e.payload.key===this.key&&(this.#t(e.payload.store.state),this.setOptions(e.payload.options))})}#t;#n;#r;#i;#a;#o;#s};function po(){return{canLeadingExecute:!0,errorCount:0,isExecuting:!1,isPending:!1,lastArgs:void 0,lastResult:void 0,maybeExecuteCount:0,settleCount:0,status:`idle`,successCount:0}}var mo={asyncRetryerOptions:{maxAttempts:1},enabled:!0,leading:!1,trailing:!0,wait:0},ho=class{#e;#t;constructor(e,t){this.fn=e,this.store=new ji(po()),this.asyncRetryers=new Map,this.#e=null,this.#t=null,this.setOptions=e=>{this.options={...this.options,...e},this.#r()||this.cancel()},this.#n=e=>{this.store.setState(t=>{let n={...t,...e},{isPending:r,isExecuting:i,settleCount:a}=n;return{...n,status:this.#r()?r?`pending`:i?`executing`:a>0?`settled`:`idle`:`disabled`}}),co(`AsyncDebouncer`,this)},this.#r=()=>!!eo(this.options.enabled,this),this.#i=()=>eo(this.options.wait,this),this.maybeExecute=async(...e)=>{if(this.#r())return this.#c(),this.#n({lastArgs:e,maybeExecuteCount:this.store.state.maybeExecuteCount+1}),this.options.leading&&this.store.state.canLeadingExecute?(this.#n({canLeadingExecute:!1}),await this.#a(...e),this.store.state.lastResult):(this.options.trailing&&this.#r()&&this.#n({isPending:!0}),new Promise((e,t)=>{this.#t=e,this.#e=setTimeout(async()=>{if(this.options.trailing&&this.store.state.lastArgs)try{await this.#a(...this.store.state.lastArgs)}catch(e){t(e)}this.#n({canLeadingExecute:!0}),this.#t=null,e(this.store.state.lastResult)},this.#i())}))},this.#a=async(...e)=>{if(!this.#r())return;let t=this.store.state.maybeExecuteCount+1;try{this.#n({isExecuting:!0});let n=new ree(this.fn,{...this.options.asyncRetryerOptions,key:`${this.key}-retryer-${t}`});this.asyncRetryers.set(t,n);let r=await n.execute(...e);this.#n({lastResult:r,successCount:this.store.state.successCount+1}),this.options.onSuccess?.(r,e,this)}catch(t){if(this.#n({errorCount:this.store.state.errorCount+1}),this.options.onError?.(t,e,this),this.options.throwOnError)throw t}finally{this.asyncRetryers.delete(t),this.#n({isExecuting:!1,isPending:!1,lastArgs:void 0,settleCount:this.store.state.settleCount+1}),this.options.onSettled?.(e,this)}return this.store.state.lastResult},this.flush=async()=>{if(this.store.state.isPending&&this.store.state.lastArgs){let{lastArgs:e}=this.store.state;return this.#c(),await this.#a(...e)}},this.#o=()=>{this.#t&&=(this.#t(this.store.state.lastResult),null)},this.#s=()=>{this.#e&&=(clearTimeout(this.#e),null)},this.#c=()=>{this.#s(),this.#o(),this.#n({isPending:!1,lastArgs:void 0})},this.getAbortSignal=e=>{let t=e??this.store.state.maybeExecuteCount;return this.asyncRetryers.get(t)?.getAbortSignal()??null},this.abort=()=>{this.asyncRetryers.forEach(e=>e.abort()),this.asyncRetryers.clear(),this.#n({isExecuting:!1})},this.cancel=()=>{this.#c(),this.#n({canLeadingExecute:!0})},this.reset=()=>{this.#n(po()),this.asyncRetryers.forEach(e=>e.reset())},this.key=t.key,this.options={...mo,...t,throwOnError:t.throwOnError??!t.onError},this.#n(this.options.initialState??{}),this.key&&lo.on(`d-AsyncDebouncer`,e=>{e.payload.key===this.key&&(this.#n(e.payload.store.state),this.setOptions(e.payload.options))})}#n;#r;#i;#a;#o;#s;#c};function go(){return{executionCount:0,isEmpty:!0,isPending:!1,totalItemsProcessed:0,items:[],size:0,status:`idle`}}var _o={getShouldExecute:()=>!1,maxSize:1/0,started:!0,wait:1/0},vo=class{#e;constructor(e,t){this.fn=e,this.store=new ji(go()),this.#e=null,this.setOptions=e=>{this.options={...this.options,...e}},this.#t=e=>{this.store.setState(t=>{let n={...t,...e},{isPending:r,items:i}=n,a=i.length,o=a===0;return{...n,isEmpty:o,size:a,status:r?`pending`:`idle`}}),co(`Batcher`,this)},this.#n=()=>eo(this.options.wait,this),this.addItem=e=>{this.#t({items:[...this.store.state.items,e],isPending:this.options.wait!==1/0}),this.options.onItemsChange?.(this),this.store.state.items.length>=this.options.maxSize||this.options.getShouldExecute(this.store.state.items,this)?this.#r():this.options.wait!==1/0&&(this.#i(),this.#e=setTimeout(()=>this.#r(),this.#n()))},this.#r=()=>{if(this.store.state.items.length===0)return;let e=this.peekAllItems();this.clear(),this.options.onItemsChange?.(this),this.fn(e),this.#t({executionCount:this.store.state.executionCount+1,totalItemsProcessed:this.store.state.totalItemsProcessed+e.length}),this.options.onExecute?.(e,this)},this.flush=()=>{this.#i(),this.#r()},this.peekAllItems=()=>[...this.store.state.items],this.#i=()=>{this.#e&&=(clearTimeout(this.#e),null)},this.clear=()=>{this.#t({items:[],isPending:!1})},this.cancel=()=>{this.#i(),this.#t({isPending:!1})},this.reset=()=>{this.#t(go()),this.options.onItemsChange?.(this)},this.key=t.key,this.options={..._o,...t},this.#t(this.options.initialState??{}),this.key&&lo.on(`d-Batcher`,e=>{e.payload.key===this.key&&(this.#t(e.payload.store.state),this.setOptions(e.payload.options))})}#t;#n;#r;#i};function yo(){return{executionCount:0,isPending:!1,lastArgs:void 0,lastExecutionTime:0,nextExecutionTime:0,status:`idle`,maybeExecuteCount:0}}var bo={enabled:!0,leading:!0,trailing:!0,wait:0},xo=class{#e;constructor(e,t){this.fn=e,this.store=new ji(yo()),this.setOptions=e=>{this.options={...this.options,...e},this.#n()||this.cancel()},this.#t=e=>{this.store.setState(t=>{let n={...t,...e},{isPending:r}=n;return{...n,status:this.#n()?r?`pending`:`idle`:`disabled`}}),co(`Throttler`,this)},this.#n=()=>!!eo(this.options.enabled,this),this.#r=()=>eo(this.options.wait,this),this.maybeExecute=(...e)=>{this.#t({maybeExecuteCount:this.store.state.maybeExecuteCount+1});let t=Date.now(),n=t-this.store.state.lastExecutionTime,r=this.#r();if(this.options.leading&&n>=r)this.#i(...e);else if(this.#t({lastArgs:e}),!this.#e&&this.options.trailing){let e=r-(this.store.state.lastExecutionTime?t-this.store.state.lastExecutionTime:0);this.#t({isPending:!0}),this.#e=setTimeout(()=>{let{lastArgs:e}=this.store.state;e!==void 0&&this.#i(...e)},e)}},this.#i=(...e)=>{if(!this.#n())return;this.fn(...e);let t=Date.now(),n=t+this.#r();this.#a(),this.#t({executionCount:this.store.state.executionCount+1,lastExecutionTime:t,nextExecutionTime:n,isPending:!1,lastArgs:void 0}),this.options.onExecute?.(e,this),setTimeout(()=>{this.store.state.isPending||this.#t({nextExecutionTime:void 0})},this.#r())},this.flush=()=>{this.store.state.isPending&&this.store.state.lastArgs&&this.#i(...this.store.state.lastArgs)},this.#a=()=>{this.#e&&=(clearTimeout(this.#e),void 0)},this.cancel=()=>{this.#a(),this.#t({lastArgs:void 0,isPending:!1})},this.reset=()=>{this.#t(yo())},this.key=t.key,this.options={...bo,...t},this.#t(this.options.initialState??{}),this.key&&lo.on(`d-Throttler`,e=>{e.payload.key===this.key&&(this.#t(e.payload.store.state),this.setOptions(e.payload.options))})}#t;#n;#r;#i;#a},$=pe(),So=4,Co=.5,wo=.2,To=20,Eo=10,Do=320,Oo=256,ko=512;function Ao(){if(typeof window>`u`)return`col-resize`;let e=window.navigator.userAgent;return e.includes(`Chrome`)||e.includes(`Firefox`)?`ew-resize`:`col-resize`}function jo(){if(typeof window>`u`)return`row-resize`;let e=window.navigator.userAgent;return e.includes(`Chrome`)||e.includes(`Firefox`)?`ns-resize`:`row-resize`}function Mo(){return typeof window>`u`?Eo:window.matchMedia(`(pointer:coarse)`).matches?To:Eo}function No(e){let t=document.createElement(`style`);return t.dataset.resizeCursor=`true`,t.textContent=`*, *:hover { cursor: ${e} !important; }`,document.head.append(t),()=>t.remove()}function Po(e,t){let n=e.trim(),r=Number.parseFloat(n);return Number.isFinite(r)?n.endsWith(`rem`)?r*(typeof window>`u`?16:Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)||16):r:t}function Fo(e,t,n){return Math.min(Math.max(e,t),n)}function Io(e){return e.closest(`[data-slot='sidebar']`)?.dataset.side===`right`?`right`:`left`}function Lo(e){return e.closest(`[data-slot='sidebar-wrapper']`)}function Ro(e,t){e.latestWidth=t,e.previewElement&&e.previewAnimationFrame===null&&(e.previewAnimationFrame=window.requestAnimationFrame(()=>{e.previewAnimationFrame=null,!(!e.previewElement||!e.latestWidth)&&e.previewElement.style.setProperty(`--sidebar-width`,e.latestWidth)}))}function zo(e){e.previewAnimationFrame!==null&&(window.cancelAnimationFrame(e.previewAnimationFrame),e.previewAnimationFrame=null)}function Bo(e,t){let n=t-e.startX;return e.side===`left`?e.startWidth+n:e.startWidth-n}function Vo(e,t){return e.side===`left`?t>e.startX:t<e.startX}function Ho(e){let t=Z.useRef(e);return t.current=e,t}function Uo(e){let t=(0,$.c)(20),{enabled:n,expandThreshold:r,isMobile:i,maxWidth:a,minWidth:o,state:s,width:c,onOpenChange:l,onResize:u,onResizeActiveChange:d}=e,f=n===void 0?!0:n,p=r===void 0?wo:r,m;t[0]!==f||t[1]!==p||t[2]!==i||t[3]!==a||t[4]!==o||t[5]!==l||t[6]!==u||t[7]!==d||t[8]!==s||t[9]!==c?(m={enabled:f,expandThreshold:p,isMobile:i,maxWidth:a,minWidth:o,state:s,width:c,onOpenChange:l,onResize:u,onResizeActiveChange:d},t[0]=f,t[1]=p,t[2]=i,t[3]=a,t[4]=o,t[5]=l,t[6]=u,t[7]=d,t[8]=s,t[9]=c,t[10]=m):m=t[10];let h=Ho(m),g=Z.useRef(!1),_=Z.useRef(null),v,y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>()=>_.current?.(),y=[],t[11]=v,t[12]=y):(v=t[11],y=t[12]),Z.useEffect(v,y);let b;t[13]===h?b=t[14]:(b=e=>{if(g.current){e.preventDefault(),e.stopPropagation(),g.current=!1;return}let{onOpenChange:t,state:n}=h.current;t(n!==`expanded`)},t[13]=h,t[14]=b);let x=b,S;t[15]===h?S=t[16]:(S=e=>{let t=h.current;if(e.defaultPrevented||e.button!==0||t.isMobile||!t.enabled)return;let n=Po(t.minWidth,Oo),r=Po(t.maxWidth,ko),i=Po(t.width,Do),a={collapsed:t.state!==`expanded`,latestWidth:null,moved:!1,previewAnimationFrame:null,previewElement:Lo(e.currentTarget),previousCursor:document.body.style.cursor,previousUserSelect:document.body.style.userSelect,side:Io(e.currentTarget),startWidth:t.state===`expanded`?i:0,startX:e.clientX};_.current?.();let o=null,s=()=>{window.removeEventListener(`pointermove`,d),window.removeEventListener(`pointerup`,f),window.removeEventListener(`pointercancel`,f),o?.(),zo(a),document.body.style.cursor=a.previousCursor,document.body.style.userSelect=a.previousUserSelect,a.moved&&h.current.onResizeActiveChange(!1),_.current=null},c=()=>{let e=Ao();a.moved=!0,g.current=!0,h.current.onResizeActiveChange(!0),o=No(e),document.body.style.cursor=e,document.body.style.userSelect=`none`},l=e=>{let t=`${Math.round(n)}px`;Ro(a,t),h.current.onResize(t),h.current.onOpenChange(!1),a.collapsed=!0,a.startWidth=0,a.startX=e},u=e=>{let t=`${Math.round(n)}px`;Ro(a,t),h.current.onResize(t),h.current.onOpenChange(!0),a.collapsed=!1,a.startWidth=n,a.startX=e},d=e=>{let t=Math.abs(e.clientX-a.startX);if(!a.moved&&t<So)return;a.moved||c(),e.preventDefault();let i=Bo(a,e.clientX);if(a.collapsed){let t=n*h.current.expandThreshold;Vo(a,e.clientX)&&i>=t&&u(e.clientX);return}if(i<=n*Co){l(e.clientX);return}let o=Fo(i,n,r);Ro(a,`${Math.round(o)}px`)},f=e=>{a.moved&&(e.preventDefault(),a.latestWidth&&h.current.onResize(a.latestWidth),window.setTimeout(()=>{g.current=!1},0)),s()};_.current=s,window.addEventListener(`pointermove`,d),window.addEventListener(`pointerup`,f),window.addEventListener(`pointercancel`,f)},t[15]=h,t[16]=S);let C=S,w;return t[17]!==x||t[18]!==C?(w={handleClick:x,handlePointerDown:C},t[17]=x,t[18]=C,t[19]=w):w=t[19],w}function Wo(e){let t=Array.isArray(e)?e.map(e=>e.trim()).filter(Boolean):[];if(t.length===0)return;if(t.length===1)return t[0];let n=t.slice(0,3),r=t.length-n.length,i=r>0?` + ${r} more`:``;return`${t.length} commits: ${n.join(` · `)}${i}`}function Go({response:e,force:t=!1}){if(!e.ok)return;let n=Wo(e.pushedCommitMessages),r=t?`Force pushed changes`:`Pushed changes`;n?P.success(r,{description:n}):P.success(r)}function Ko(e){return We(e.defaultTagName??`div`,e,e)}var qo=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Jo=Sn,Yo=(e,t)=>n=>{if(t?.variants==null)return Jo(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=qo(t)||qo(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Jo(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Xo=Yo(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 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/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function Zo(e){let t=(0,$.c)(13),n,r,i,a,o;if(t[0]!==e){let{className:s,variant:c,render:l,...u}=e;n=l,o=c===void 0?`default`:c,a=Ko,r=`span`,i=K({className:on(Xo({variant:o}),s)},u),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o}else n=t[1],r=t[2],i=t[3],a=t[4],o=t[5];let s;t[6]===o?s=t[7]:(s={slot:`badge`,variant:o},t[6]=o,t[7]=s);let c;return t[8]!==n||t[9]!==r||t[10]!==i||t[11]!==s?(c={defaultTagName:r,props:i,render:n,state:s},t[8]=n,t[9]=r,t[10]=i,t[11]=s,t[12]=c):c=t[12],a(c)}var Qo=Z.createContext(void 0);function $o(e=!1){let t=Z.useContext(Qo);if(t===void 0&&!e)throw Error(pt(16));return t}function es(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:Z.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function ts(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=Z.useRef(null),c=$o(!0),l=a??c!==void 0,{props:u}=es({focusableWhenDisabled:n,disabled:t,composite:l,tabIndex:r,isNativeButton:i}),d=Z.useCallback(()=>{let e=o.current;ns(e)&&l&&t&&u.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,u.disabled,l]);return Gn(d,[d]),{getButtonProps:Z.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...c}=e;return K({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(N(e),o?.(e),e.baseUIHandlerPrevented))return;let r=e.target===e.currentTarget,a=e.currentTarget,s=ns(a),c=!i&&rs(a),u=r&&(i?s:!c),d=e.key===`Enter`,f=e.key===` `,p=a.getAttribute(`role`),m=p?.startsWith(`menuitem`)||p===`option`||p===`gridcell`;if(r&&l&&f){if(e.defaultPrevented&&m)return;e.preventDefault(),c||i&&s?(a.click(),e.preventBaseUIHandler()):u&&(n?.(e),e.preventBaseUIHandler());return}u&&(!i&&(f||d)&&e.preventDefault(),!i&&d&&n?.(e))},onKeyUp(e){if(!t){if(N(e),a?.(e),e.target===e.currentTarget&&i&&l&&ns(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!l&&e.key===` `&&n?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?void 0:{role:`button`},u,c)},[t,u,l,i]),buttonRef:s(e=>{o.current=e,d()})}}function ns(e){return Qn(e)&&e.tagName===`BUTTON`}function rs(e){return!!(e?.tagName===`A`&&e?.href)}var is=Z.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=ts({disabled:i,focusableWhenDisabled:a,native:o});return We(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})}),as=Yo(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 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 [a]:hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function os(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:i,size:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`default`:i,s=a===void 0?`default`:a,c;t[5]!==n||t[6]!==s||t[7]!==o?(c=on(as({variant:o,size:s,className:n})),t[5]=n,t[6]=s,t[7]=o,t[8]=c):c=t[8];let l;return t[9]!==r||t[10]!==c?(l=(0,Q.jsx)(is,{"data-slot":`button`,className:c,...r}),t[9]=r,t[10]=c,t[11]=l):l=t[11],l}var ss=Z.createContext(void 0);function cs(e){let t=Z.useContext(ss);if(e===!1&&t===void 0)throw Error(pt(27));return t}var ls={...St,...l},us=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,{store:s}=cs(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return We(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:ls,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),ds=Z.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,style:o,...s}=e,{store:c}=cs(),l=c.useState(`open`);function u(e){l&&c.setOpen(!1,Pe(j,e.nativeEvent))}let{getButtonProps:d,buttonRef:f}=ts({disabled:i,native:a});return We(`button`,e,{state:{disabled:i},ref:[t,f],props:[{onClick:u},s,d]})}),fs=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=cs(),c=Qt(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),We(`p`,e,{ref:t,props:[{id:c},o]})}),ps=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),ms=function(e){return e[e.open=Pn.open]=`open`,e[e.closed=Pn.closed]=`closed`,e[e.startingStyle=Pn.startingStyle]=`startingStyle`,e[e.endingStyle=Pn.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),hs=Z.createContext(void 0);function gs(){let e=Z.useContext(hs);if(e===void 0)throw Error(pt(26));return e}var _s=`ArrowUp`,vs=`ArrowDown`,ys=`ArrowLeft`,bs=`ArrowRight`,xs=`Home`,Ss=new Set([ys,bs]),Cs=new Set([ys,bs,xs,`End`]),ws=new Set([_s,vs]),Ts=new Set([_s,vs,xs,`End`]),Es=new Set([...Ss,...ws]),Ds=new Set([...Es,xs,`End`]),Os=new Set([_s,vs,ys,bs,xs,`End`]),ks=new Set([`Shift`,`Control`,`Alt`,`Meta`]);function As(e){return Qn(e)&&e.tagName===`INPUT`}function js(e){return!!(As(e)&&e.selectionStart!=null||Qn(e)&&e.tagName===`TEXTAREA`)}function Ms(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=Ns(e,t,`left`),a=Ps(e),o=Ps(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginRight<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=Ns(e,t,`top`),r=Ps(e),i=Ps(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function Ns(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function Ps(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}var Fs={...St,...l,nestedDialogOpen(e){return e?{[ms.nestedDialogOpen]:``}:null}},Is=Z.forwardRef(function(e,t){let{className:n,finalFocus:r,initialFocus:i,render:a,style:o,...s}=e,{store:c}=cs(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),S=c.useState(`role`);gs(),x({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});function C(e){return e===`touch`?c.context.popupRef.current:!0}let w=i===void 0?C:i,T=We(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:g>0},props:[f,{"aria-labelledby":y??void 0,"aria-describedby":l??void 0,role:S,tabIndex:-1,hidden:!m,onKeyDown(e){Os.has(e.key)&&e.stopPropagation()},style:{[ps.nestedDialogs]:g}},s],ref:[t,c.context.popupRef,c.useStateSetter(`popupElement`)],stateAttributesMapping:Fs});return(0,Q.jsx)(pa,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:w,returnFocus:r,modal:p!==!1,restoreFocus:`popup`,children:T})}),Ls=Z.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,Q.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),Rs=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=cs(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,Q.jsx)(hs.Provider,{value:n,children:(0,Q.jsxs)(L,{ref:t,...r,children:[a&&o===!0&&(0,Q.jsx)(Ls,{ref:i.context.internalBackdropRef,inert:Ca(!s)}),e.children]})}):null}),zs={},Bs={},Vs=``;function Hs(e){if(typeof document>`u`)return!1;let t=y(e);return J(t).innerWidth-t.documentElement.clientWidth>0}function Us(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=y(e),n=t.documentElement,r=t.body,i=Re(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function Ws(e){let t=y(e),n=t.documentElement,r=t.body,i=Re(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function Gs(e){let t=y(e),n=t.documentElement,r=t.body,i=J(n),a=0,o=0,s=!1,c=fe.create();if(jt&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,zs={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Vs=n.style.scrollBehavior,Bs={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=Re(n)?n:r;if(s=Us(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,zs),Object.assign(r.style,Bs),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=Vs)}function d(){u(),c.request(l)}l();let f=ge(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var Ks=new class{lockCount=0;restore=null;timeoutLock=at.create();timeoutUnlock=at.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=y(e).documentElement,n=J(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=_t;return}let r=tn||!Hs(e);this.restore=r?Ws(e):Gs(e)}};function qs(e=!0,t=null){Gn(()=>{if(e)return Ks.acquire(t)},[e,t])}function Js(e){let t=Z.useRef(``),n=Z.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Z.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Ys(e,t){let n=Z.useRef(e),r=s(t);Gn(()=>{n.current!==e&&r(n.current)},[e,r]),Gn(()=>{n.current=e},[e])}function Xs(e){let[t,n]=Z.useState(null),r=s((t,r)=>{e||n(r||(tn?`touch`:``))});Ys(e,t=>{t&&!e&&n(null)});let{onClick:i,onPointerDown:a}=Js(r);return Z.useMemo(()=>({openMethod:t,triggerProps:{onClick:i,onPointerDown:a}}),[t,i,a])}function Zs(e){let{store:t,parentContext:n,actionsRef:r,isDrawer:i}=e,a=t.useState(`open`),o=t.useState(`disablePointerDismissal`),c=t.useState(`modal`),l=t.useState(`popupElement`),{openMethod:u,triggerProps:d}=Xs(a);_(t);let{forceUnmount:f}=Hn(a,t),p=s(e=>{let n=Pe(e);return n.preventUnmountOnClose=()=>{t.set(`preventUnmountingOnClose`,!0)},n}),m=Z.useCallback(()=>{t.setOpen(!1,p(U))},[t,p]);Z.useImperativeHandle(r,()=>({unmount:f,close:m}),[f,m]);let h=Xn({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[g,v]=Z.useState(0),[y,b]=Z.useState(0),x=g===0,S=xa(h),C=ve(h,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?`intentional`:{mouse:c===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(e){if(!t.context.outsidePressEnabledRef.current||`button`in e&&e.button!==0||`touches`in e&&e.touches.length!==1)return!1;let n=Wn(e);if(x&&!o){let e=n;return c&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===e||t.context.backdropRef.current===e||ft(e,l)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:x});qs(a&&c===!0,l);let{getReferenceProps:w,getFloatingProps:T,getTriggerProps:E}=It([S,C]);t.useContextCallback(`onNestedDialogOpen`,(e,t)=>{v(e),b(t)}),t.useContextCallback(`onNestedDialogClose`,()=>{v(0),b(0)}),Z.useEffect(()=>(n?.onNestedDialogOpen&&a&&n.onNestedDialogOpen(g+1,y+ +!!i),n?.onNestedDialogClose&&!a&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&a&&n.onNestedDialogClose()}),[i,a,g,y,n]);let D=Z.useMemo(()=>w(d),[w,d]),O=Z.useMemo(()=>E(d),[E,d]),k=Z.useMemo(()=>T(),[T]);t.useSyncedValues({openMethod:u,activeTriggerProps:D,inactiveTriggerProps:O,popupProps:k,floatingRootContext:h,nestedOpenDialogCount:g,nestedOpenDrawerCount:y})}var Qs={...Kn,modal:ue(e=>e.modal),nested:ue(e=>e.nested),nestedOpenDialogCount:ue(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:ue(e=>e.nestedOpenDrawerCount),disablePointerDismissal:ue(e=>e.disablePointerDismissal),openMethod:ue(e=>e.openMethod),descriptionElementId:ue(e=>e.descriptionElementId),titleElementId:ue(e=>e.titleElementId),viewportElement:ue(e=>e.viewportElement),role:ue(e=>e.role)},$s=class e extends oe{constructor(e){super(ec(e),{popupRef:Z.createRef(),backdropRef:Z.createRef(),internalBackdropRef:Z.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new Oe,onOpenChange:void 0,onOpenChangeComplete:void 0},Qs)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};static useStore(t,n){let r=je(()=>new e(n)).current;return t??r}};function ec(e={}){return{...mt(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}var tc=Z.createContext(!1);function nc(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:o=!1,modal:s=!0,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:d=null}=e,f=cs(!0),p=Z.useContext(tc),m=!!f,h=$s.useStore(l?.store,{open:r,openProp:n,activeTriggerId:d,triggerIdProp:u,modal:s,disablePointerDismissal:o,nested:m});De(()=>{n===void 0&&h.state.open===!1&&r===!0&&h.update({open:!0,activeTriggerId:d})}),h.useControlledProp(`openProp`,n),h.useControlledProp(`triggerIdProp`,u),h.useSyncedValues({disablePointerDismissal:o,nested:m,modal:s}),h.useContextCallback(`onOpenChange`,i),h.useContextCallback(`onOpenChangeComplete`,a);let g=h.useState(`payload`);Zs({store:h,actionsRef:c,parentContext:f?.store.context,isDrawer:p,onOpenChange:i,triggerIdProp:u});let _=Z.useMemo(()=>({store:h}),[h]);return(0,Q.jsx)(tc.Provider,{value:!1,children:(0,Q.jsx)(ss.Provider,{value:_,children:typeof t==`function`?t({payload:g}):t})})}var rc=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=cs(),c=Qt(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),We(`h2`,e,{ref:t,props:[{id:c},o]})});function ic(){if(typeof document>`u`)return;let e=document.activeElement;e instanceof HTMLElement&&(e.closest(`[data-slot="dialog-content"]`)||e.blur())}function ac(e){let t=(0,$.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({open:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=Z.useRef(n===!0),a,o;t[3]===n?(a=t[4],o=t[5]):(a=()=>{let e=n===!0;e&&!i.current&&ic(),i.current=e},o=[n],t[3]=n,t[4]=a,t[5]=o),Z.useLayoutEffect(a,o);let s;return t[6]!==n||t[7]!==r?(s=(0,Q.jsx)(nc,{"data-slot":`dialog`,open:n,...r}),t[6]=n,t[7]=r,t[8]=s):s=t[8],s}function oc(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Q.jsx)(Rs,{"data-slot":`dialog-portal`,...n}),t[2]=n,t[3]=r),r}function sc(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`fixed inset-0 isolate z-50 bg-black/50 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(us,{"data-slot":`dialog-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function cc(e){let t=(0,$.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,showCloseButton:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?!0:a,s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(sc,{}),t[5]=s):s=t[5];let c;t[6]===r?c=t[7]:(c=on(`fixed top-1/2 left-1/2 z-50 grid max-h-dvh w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-h-[80vh] sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,r),t[6]=r,t[7]=c);let l;t[8]===o?l=t[9]:(l=o&&(0,Q.jsxs)(ds,{"data-slot":`dialog-close`,render:(0,Q.jsx)(os,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,Q.jsx)(Qa,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t[8]=o,t[9]=l);let u;return t[10]!==n||t[11]!==i||t[12]!==c||t[13]!==l?(u=(0,Q.jsxs)(oc,{children:[s,(0,Q.jsxs)(Is,{"data-slot":`dialog-content`,className:c,...i,children:[n,l]})]}),t[10]=n,t[11]=i,t[12]=c,t[13]=l,t[14]=u):u=t[14],u}function lc(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`flex flex-col gap-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`dialog-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function uc(e){let t=(0,$.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,showCloseButton:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?!1:a,s;t[5]===r?s=t[6]:(s=on(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end`,r),t[5]=r,t[6]=s);let c;t[7]===o?c=t[8]:(c=o&&(0,Q.jsx)(ds,{render:(0,Q.jsx)(os,{variant:`outline`}),children:`Close`}),t[7]=o,t[8]=c);let l;return t[9]!==n||t[10]!==i||t[11]!==s||t[12]!==c?(l=(0,Q.jsxs)(`div`,{"data-slot":`dialog-footer`,className:s,...i,children:[n,c]}),t[9]=n,t[10]=i,t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function dc(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`font-heading text-base leading-none font-medium`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(rc,{"data-slot":`dialog-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function fc(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(fs,{"data-slot":`dialog-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var pc=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),mc={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},hc={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},gc={disabled:!1,...hc},_c={valid(e){return e===null?null:e?{[pc.valid]:``}:{[pc.invalid]:``}}},vc=Z.createContext({invalid:void 0,name:void 0,validityData:{state:mc,errors:[],error:``,value:``,initialValue:null},setValidityData:_t,disabled:void 0,touched:hc.touched,setTouched:_t,dirty:hc.dirty,setDirty:_t,filled:hc.filled,setFilled:_t,focused:hc.focused,setFocused:_t,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:gc,markedDirtyRef:{current:!1},registerFieldControl:_t,validation:{getValidationProps:(e=Tn)=>e,getInputValidationProps:(e=Tn)=>e,inputRef:{current:null},commit:async()=>{}}});function yc(e=!0){let t=Z.useContext(vc);if(t.setValidityData===_t&&!e)throw Error(pt(28));return t}var bc=Z.createContext({controlId:void 0,registerControlId:_t,labelId:void 0,setLabelId:_t,messageIds:[],setMessageIds:_t,getDescriptionProps:e=>e});function xc(){return Z.useContext(bc)}function Sc({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=Z.useRef(e!==void 0),[a,o]=Z.useState(t);return[i?e:a,Z.useCallback(e=>{i||o(e)},[])]}function Cc(e,t){let{enabled:n=!0,getValue:r,id:i,value:a}=t,{registerFieldControl:o}=yc(),s=Z.useRef(null);s.current||=Symbol(),Gn(()=>{let t=s.current;if(!(!t||!n))return o(t,{controlRef:e,getValue:r,id:i,value:a}),()=>{o(t,void 0)}},[e,n,r,i,o,a])}function wc(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=xc(),o=Qt(t),c=n?i:void 0,l=je(()=>Symbol(`labelable-control`)),u=Z.useRef(!1),d=Z.useRef(t!=null),f=s(()=>{!u.current||a===_t||(u.current=!1,a(l.current,void 0))});return Gn(()=>{if(a===_t)return;let e;if(n){let n=r?.current;e=Se(n)&&n.closest(`label`)!=null?t??null:c??o}else if(t!=null)d.current=!0,e=t;else if(d.current)e=o;else{f();return}if(e===void 0){f();return}u.current=!0,a(l.current,e)},[t,r,c,a,n,o,l,f]),Z.useEffect(()=>f,[f]),i??o}var Tc=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:c=!1,onValueChange:l,defaultValue:u,autoFocus:d=!1,style:f,...p}=e,{state:m,name:h,disabled:g,setTouched:_,setDirty:v,validityData:b,setFocused:x,setFilled:S,validationMode:C,validation:w}=yc(),T=g||c,E=h??a,D={...m,disabled:T},{labelId:O}=xc(),k=wc({id:i});Gn(()=>{let e=o!=null;w.inputRef.current?.value||e&&o!==``?S(!0):e&&o===``&&S(!1)},[w.inputRef,S,o]);let A=Z.useRef(null);Gn(()=>{d&&A.current===Jn(y(A.current))&&x(!0)},[d,x]);let[j]=Sc({controlled:o,default:u,name:`FieldControl`,state:`value`}),M=o!==void 0,N=M?j:void 0,P=s(()=>w.inputRef.current?.value);return Cc(w.inputRef,{id:k,value:N,getValue:P}),We(`input`,e,{ref:[t,A],state:D,props:[{id:k,disabled:T,name:E,ref:w.inputRef,"aria-labelledby":O,autoFocus:d,...M?{value:N}:{defaultValue:u},onChange(e){let t=e.currentTarget.value;l?.(t,Pe(et,e.nativeEvent)),v(t!==b.initialValue),S(t!==``)},onFocus(){x(!0)},onBlur(e){_(!0),x(!1),C===`onBlur`&&w.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(_(!0),w.commit(e.currentTarget.value))}},w.getInputValidationProps(),p],stateAttributesMapping:_c})}),Ec=Z.forwardRef(function(e,t){return(0,Q.jsx)(Tc,{ref:t,...e})});function Dc(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,type:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=on(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==a||t[8]!==i?(o=(0,Q.jsx)(Ec,{type:i,"data-slot":`input`,className:a,...r}),t[6]=r,t[7]=a,t[8]=i,t[9]=o):o=t[9],o}var Oc=`after:transition-colors after:duration-150 hover:after:bg-primary focus-visible:after:bg-primary active:after:bg-primary`,kc=`after:transition-colors after:duration-150 hover:group-data-[collapsible=offcanvas]:after:bg-primary focus-visible:group-data-[collapsible=offcanvas]:after:bg-primary active:group-data-[collapsible=offcanvas]:after:bg-primary`,Ac=Z.createContext(void 0);function jc(e){let t=Z.useContext(Ac);if(t===void 0&&!e)throw Error(pt(33));return t}var Mc=Z.createContext(void 0);function Nc(e){let t=Z.useContext(Mc);if(t===void 0&&!e)throw Error(pt(36));return t}var Pc=Z.createContext(void 0);function Fc(e=!0){let t=Z.useContext(Pc);if(t===void 0&&!e)throw Error(pt(25));return t}function Ic(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=Fc(!0),d=u!==void 0;return Z.useMemo(()=>({id:r,role:`menuitem`,tabIndex:n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:Xe})},onMouseUp(e){if(u){let t=u.initialCursorPointRef.current;if(u.initialCursorPointRef.current=null,d&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||d&&!Ft&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!d||e.button===2)&&(!c||c.type===`regular-item`)&&s.current.click()}}),[t,n,r,l,i,a,o,s,u,d,c])}var Lc={type:`regular-item`};function Rc(e){let{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=Z.useRef(null),{getButtonProps:d,buttonRef:f}=ts({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=Ic({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=Z.useCallback(e=>K(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=ie(u,f);return Z.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var zc=Z.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Bc(){return Z.useContext(zc)}var Vc=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function Hc(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,elementsRef:l,labelsRef:u,nextIndexRef:d}=Bc(),f=Z.useRef(-1),[p,m]=Z.useState(a??(i===Vc.GuessFromOrder?()=>{if(f.current===-1){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),h=Z.useRef(null),g=Z.useCallback(e=>{if(h.current=e,p!==-1&&e!==null&&(l.current[p]=e,u)){let n=t!==void 0;u.current[p]=n?t:r?.current?.textContent??e.textContent}},[p,l,u,t,r]);return Gn(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),Gn(()=>{if(a==null)return c(e=>{let t=h.current?e.get(h.current)?.index:null;t!=null&&m(t)})},[a,c,m]),Z.useMemo(()=>({ref:g,index:p}),[p,g])}var Uc=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=Hc({label:a}),f=jc(!0),p=Qt(i),{store:m}=Nc(),h=m.useState(`isActive`,d.index),g=m.useState(`itemProps`),{getItemProps:_,itemRef:v}=Rc({closeOnClick:c,disabled:s,highlighted:h,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:Lc});return We(`div`,e,{state:{disabled:s,highlighted:h},props:[g,u,_],ref:[v,t,d.ref]})}),Wc=Z.createContext(void 0);function Gc(e){let t=Z.useContext(Wc);if(t===void 0&&!e)throw Error(pt(69));return t}var Kc={...St,...l},qc=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=Nc(),{side:c,align:l}=jc(),u=Gc(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),S=s.useState(`floatingTreeRoot`),C=s.useState(`closeDelay`),w=s.useState(`activeTriggerElement`),T=_.type===`context-menu`;x({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),Z.useEffect(()=>{function e(e){s.setOpen(!1,Pe(e.reason,e.domEvent))}return S.events.on(`close`,e),()=>{S.events.off(`close`,e)}},[S.events,s]);let E=s.useState(`hoverEnabled`),D=s.useState(`disabled`);ot(b,{enabled:E&&!D&&!T&&_.type!==`menubar`,closeDelay:C});let O={transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},k=Z.useCallback(e=>{s.set(`popupElement`,e)},[s]),A=We(`div`,e,{state:O,ref:[t,s.context.popupRef,k],stateAttributesMapping:Kc,props:[p,{onKeyDown(e){u&&Os.has(e.key)&&e.stopPropagation()}},ut(f),o,{"data-rootownerid":y}]}),j=_.type===void 0||T;return(g||_.type===`menubar`&&v!==`outside-press`)&&(j=!0),(0,Q.jsx)(pa,{context:b,modal:T,disabled:!m,returnFocus:a===void 0?j:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:S,previousFocusableElement:w,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:A})}),Jc=Z.createContext(void 0);function Yc(){let e=Z.useContext(Jc);if(e===void 0)throw Error(pt(32));return e}var Xc=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Nc();return i.useState(`mounted`)||n?(0,Q.jsx)(Jc.Provider,{value:n,children:(0,Q.jsx)(L,{ref:t,...r})}):null});function Zc(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=s(i),o=Z.useRef(0),c=je($c).current,l=je(Qc).current,[u,d]=Z.useState(0),f=Z.useRef(u),p=s((e,t)=>{l.set(e,t??null),f.current+=1,d(f.current)}),m=s(e=>{l.delete(e),f.current+=1,d(f.current)}),h=Z.useMemo(()=>{let e=new Map;return Array.from(l.keys()).filter(e=>e.isConnected).sort(el).forEach((t,n)=>{let r=l.get(t)??{};e.set(t,{...r,index:n})}),e},[l,u]);Gn(()=>{if(typeof MutationObserver!=`function`||h.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(f.current+=1,d(f.current))});return h.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[h]),Gn(()=>{f.current===u&&(n.current.length!==h.size&&(n.current.length=h.size),r&&r.current.length!==h.size&&(r.current.length=h.size),o.current=h.size),a(h)},[a,h,n,r,u]),Gn(()=>()=>{n.current=[]},[n]),Gn(()=>()=>{r&&(r.current=[])},[r]);let g=s(e=>(c.add(e),()=>{c.delete(e)}));Gn(()=>{c.forEach(e=>e(h))},[c,h]);let _=Z.useMemo(()=>({register:p,unregister:m,subscribeMapChange:g,elementsRef:n,labelsRef:r,nextIndexRef:o}),[p,m,g,n,r,o]);return(0,Q.jsx)(zc.Provider,{value:_,children:t})}function Qc(){return new Map}function $c(){return new Set}function el(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var tl=20;function nl(e,t,n,r){let[i,a]=Z.useState(!1);Gn(()=>{if(!e||!t||n==null){a(!1);return}let r=y(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-tl)},[e,t,n]),qs(e&&(!t||i),r)}var rl=Z.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:a,render:o,side:s,align:c,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=zt,style:_,...v}=e,{store:y}=Nc(),b=Yc(),x=Fc(!0),S=y.useState(`parent`),C=y.useState(`floatingRootContext`),w=y.useState(`floatingTreeRoot`),T=y.useState(`mounted`),E=y.useState(`open`),D=y.useState(`modal`),O=y.useState(`openMethod`),k=y.useState(`activeTriggerElement`),A=y.useState(`transitionStatus`),j=y.useState(`positionerElement`),M=y.useState(`instantType`),N=y.useState(`hasViewport`),P=y.useState(`lastOpenChangeReason`),F=y.useState(`floatingNodeId`),I=y.useState(`floatingParentNodeId`),L=C.useState(`domReferenceElement`),R=Z.useRef(null),z=me(j,!1,!1),B=n,H=l,U=u,W=c,ee=g;S.type===`context-menu`&&(B=n??S.context?.anchor,W??=`start`,!s&&W!==`center`&&(U=e.alignOffset??2,H=e.sideOffset??-5));let G=s,te=W;S.type===`menu`?(G??=`inline-end`,te??=`start`,ee=e.collisionAvoidance??lt):S.type===`menubar`&&(G??=`bottom`,te??=`start`);let K=S.type===`context-menu`,q=un({anchor:B,floatingRootContext:C,positionMethod:x?`fixed`:r,mounted:T,side:G,sideOffset:H,align:te,alignOffset:U,arrowPadding:K?0:p,collisionBoundary:d,collisionPadding:f,sticky:m,nodeId:F,keepMounted:b,disableAnchorTracking:h,collisionAvoidance:ee,shiftCrossAxis:K&&!(`side`in ee&&ee.side===`flip`),externalTree:w,adaptiveOrigin:N?En:void 0});Z.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===F&&y.set(`hoverEnabled`,!1),e.nodeId!==F&&e.parentNodeId===y.select(`floatingParentNodeId`)&&y.setOpen(!1,Pe(i)))}return w.events.on(`menuopenchange`,e),()=>{w.events.off(`menuopenchange`,e)}},[y,w.events,F]),Z.useEffect(()=>{if(y.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==y.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;y.setOpen(!1,Pe(t))}return w.events.on(`menuopenchange`,e),()=>{w.events.off(`menuopenchange`,e)}},[w.events,y]);let J=Ln();Z.useEffect(()=>{E||J.clear()},[E,J]),Z.useEffect(()=>{function e(e){if(!(!E||e.nodeId!==y.select(`floatingParentNodeId`)))if(e.target&&k&&k!==e.target){let e=y.select(`closeDelay`);e>0?J.isStarted()||J.start(e,()=>{y.setOpen(!1,Pe(i))}):y.setOpen(!1,Pe(i))}else J.clear()}return w.events.on(`itemhover`,e),()=>{w.events.off(`itemhover`,e)}},[w.events,E,k,y,J]),Z.useEffect(()=>{let e={open:E,nodeId:F,parentNodeId:I,reason:y.select(`lastOpenChangeReason`)};w.events.emit(`menuopenchange`,e)},[w.events,E,y,F,I]),Gn(()=>{let e=L,t=R.current;if(e&&(R.current=e),t&&e&&e!==t){y.set(`instantType`,void 0);let e=new AbortController;return z(()=>{y.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[L,z,y]);let ne={open:E,side:q.side,align:q.align,anchorHidden:q.anchorHidden,nested:S.type===`menu`,instant:M},Y=S.type===`menubar`&&S.context.modal;nl(E&&(Y||D&&P!==`trigger-hover`),O===`touch`,j,k);let re=Bt(e,ne,{styles:q.positionerStyles,transitionStatus:A,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!T,inert:!E}),ie=T&&S.type!==`menu`&&(S.type!==`menubar`&&D&&P!==`trigger-hover`||S.type===`menubar`&&S.context.modal),ae=null;return S.type===`menubar`?ae=S.context.contentElement:S.type===void 0&&(ae=k),(0,Q.jsxs)(Ac.Provider,{value:q,children:[ie&&(0,Q.jsx)(Ls,{ref:S.type===`context-menu`||S.type===`nested-context-menu`?S.context.internalBackdropRef:null,inert:Ca(!E),cutout:ae}),(0,Q.jsx)(V,{id:F,children:(0,Q.jsx)(Zc,{elementsRef:y.context.itemDomElements,labelsRef:y.context.itemLabels,children:re})})]})}),il=Z.createContext(null);function al(e){let t=Z.useContext(il);if(t===null&&!e)throw Error(pt(5));return t}var ol={...Kn,disabled:ue(e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled),modal:ue(e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0)),openMethod:ue(e=>e.openMethod),allowMouseEnter:ue(e=>e.allowMouseEnter),stickIfOpen:ue(e=>e.stickIfOpen),parent:ue(e=>e.parent),rootId:ue(e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId),activeIndex:ue(e=>e.activeIndex),isActive:ue((e,t)=>e.activeIndex===t),hoverEnabled:ue(e=>e.hoverEnabled),instantType:ue(e=>e.instantType),lastOpenChangeReason:ue(e=>e.openChangeReason),floatingTreeRoot:ue(e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot),floatingNodeId:ue(e=>e.floatingNodeId),floatingParentNodeId:ue(e=>e.floatingParentNodeId),itemProps:ue(e=>e.itemProps),closeDelay:ue(e=>e.closeDelay),hasViewport:ue(e=>e.hasViewport),keyboardEventRelay:ue(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)})},sl=class e extends oe{constructor(e){super({...cl(),...e},{positionerRef:Z.createRef(),popupRef:Z.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),onOpenChangeComplete:void 0,triggerElements:new Oe},ol),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);t===i&&n===a&&r===o||(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}static useStore(t,n){let r=je(()=>new e(n)).current;return t??r}unsubscribeParentListener=null};function cl(){return{...mt(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Be,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Tn,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}var ll=Z.createContext(void 0);function ul(){return Z.useContext(ll)}var dl=g(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:c,loopFocus:l=!0,orientation:u=`vertical`,actionsRef:d,closeParentOnEsc:f=!1,handle:p,triggerId:m,defaultTriggerId:h=null,highlightItemOnHover:g=!0}=e,v=Fc(!0),y=Nc(!0),b=al(!0),x=ul(),S=Z.useMemo(()=>x&&y?{type:`menu`,store:y.store}:b?{type:`menubar`,context:b}:v&&!y?{type:`context-menu`,context:v}:{type:void 0},[v,y,b,x]),C=sl.useStore(p?.store,{open:a,openProp:n,activeTriggerId:h,triggerIdProp:m,parent:S});De(()=>{n===void 0&&C.state.open===!1&&a===!0&&C.update({open:!0,activeTriggerId:h})}),C.useControlledProp(`openProp`,n),C.useControlledProp(`triggerIdProp`,m),C.useContextCallback(`onOpenChangeComplete`,i);let w=C.useState(`floatingTreeRoot`),T=we(w),E=er();Gn(()=>{v&&!y?C.update({parent:{type:`context-menu`,context:v},floatingNodeId:T,floatingParentNodeId:E}):y&&C.update({floatingNodeId:T,floatingParentNodeId:E})},[v,y,T,E,C]);let D=C.useState(`open`),O=C.useState(`activeTriggerElement`),k=C.useState(`positionerElement`),A=C.useState(`hoverEnabled`),j=C.useState(`disabled`),M=C.useState(`lastOpenChangeReason`),N=C.useState(`parent`),P=C.useState(`activeIndex`),F=C.useState(`payload`),I=C.useState(`floatingParentNodeId`),L=Z.useRef(null),R=I!=null,{openMethod:z,triggerProps:B}=Xs(D);C.useSyncedValues({disabled:o,modal:N.type===void 0?c:void 0,openMethod:z,rootId:ee()}),_(C);let{forceUnmount:V}=Hn(D,C,()=>{C.update({allowMouseEnter:!1,stickIfOpen:!0})}),H=Z.useRef(N.type!==`context-menu`),W=Ln();Z.useEffect(()=>{if(D||(L.current=null),N.type===`context-menu`){if(!D){W.clear(),H.current=!1;return}W.start(500,()=>{H.current=!0})}},[W,D,N.type]),Gn(()=>{!D&&!A&&C.set(`hoverEnabled`,!0)},[D,A,C]);let G=Z.useRef(!0),te=Ln(),q=s((e,t)=>{let n=t.reason;if(D===e&&t.trigger===O&&M===n||(t.preventUnmountOnClose=()=>{C.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&(t.trigger=O??void 0),r?.(e,t),t.isCanceled))return;C.state.floatingRootContext.dispatchOpenChange(e,t);let i=t.event;if(e===!1&&i?.type===`click`&&i.pointerType===`touch`&&!G.current)return;if(!e&&P!==null){let e=C.context.itemDomElements.current[P];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}e&&n===`trigger-focus`?(G.current=!1,te.start(300,()=>{G.current=!0})):(G.current=!0,te.clear());let a=(n===`trigger-press`||n===`item-press`)&&i.detail===0&&i?.isTrusted,o=!e&&(n===`escape-key`||n==null),s={open:e,openChangeReason:n};L.current=t.event??null;let c=t.trigger?.id??null;(c||e)&&(s.activeTriggerId=c,s.activeTriggerElement=t.trigger??null),C.update(s),N.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?C.set(`instantType`,`group`):a||o?C.set(`instantType`,a?`click`:`dismiss`):C.set(`instantType`,void 0)}),J=Z.useCallback(e=>{let t=Pe(e);return t.preventUnmountOnClose=()=>{C.set(`preventUnmountingOnClose`,!0)},t},[C]),ne=Z.useCallback(()=>{C.setOpen(!1,J(U))},[C,J]);Z.useImperativeHandle(d,()=>({unmount:V,close:ne}),[V,ne]);let re;N.type===`context-menu`&&(re=N.context),Z.useImperativeHandle(re?.positionerRef,()=>k,[k]),Z.useImperativeHandle(re?.actionsRef,()=>({setOpen:q}),[q]);let ie=Xn({popupStore:C,onOpenChange:q}),ae=ie.context.events;Z.useEffect(()=>{let e=({open:e,eventDetails:t})=>q(e,t);return ae.on(`setOpen`,e),()=>{ae?.off(`setOpen`,e)}},[ae,q]);let oe=ve(ie,{enabled:!j,bubbles:{escapeKey:f&&N.type===`menu`},outsidePress(){return N.type!==`context-menu`||L.current?.type===`contextmenu`?!0:H.current},externalTree:R?w:void 0}),se=xa(ie,{role:`menu`}),ce=vt(),le=Z.useCallback(e=>{C.select(`activeIndex`)!==e&&C.set(`activeIndex`,e)},[C]),ue=tee(ie,{enabled:!j,listRef:C.context.itemDomElements,activeIndex:P,nested:N.type!==void 0,loopFocus:l,orientation:u,parentOrientation:N.type===`menubar`?N.context.orientation:void 0,rtl:ce===`rtl`,disabledIndices:ln,onNavigate:le,openOnArrowKeyDown:N.type!==`context-menu`,externalTree:R?w:void 0,focusItemOnHover:g}),de=Z.useCallback(e=>{C.context.typingRef.current=e},[C]),{getReferenceProps:fe,getFloatingProps:pe,getItemProps:me,getTriggerProps:he}=It([oe,se,ue,Sa(ie,{listRef:C.context.itemLabels,elementsRef:C.context.itemDomElements,activeIndex:P,resetMs:500,onMatch:e=>{D&&e!==P&&C.set(`activeIndex`,e)},onTypingChange:de})]),ge=Z.useMemo(()=>{let e=K(fe(),{onMouseMove(){C.set(`allowMouseEnter`,!0)}},B);return delete e.role,e},[fe,C,B]),_e=Z.useMemo(()=>{let e=he();if(!e)return e;let t=K(e,B);return delete t.role,delete t[`aria-controls`],t},[he,B]),ye=Z.useMemo(()=>pe({onMouseMove(){C.set(`allowMouseEnter`,!0),N.type===`menu`&&C.set(`hoverEnabled`,!1)},onClick(){C.select(`hoverEnabled`)&&C.set(`hoverEnabled`,!1)},onKeyDown(e){let t=C.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}}),[pe,N.type,C]),be=Z.useMemo(()=>me(),[me]);C.useSyncedValues({floatingRootContext:ie,activeTriggerProps:ge,inactiveTriggerProps:_e,popupProps:ye,itemProps:be});let xe=Z.useMemo(()=>({store:C,parent:S}),[C,S]),Se=(0,Q.jsx)(Mc.Provider,{value:xe,children:typeof t==`function`?t({payload:F}):t});return N.type===void 0||N.type===`context-menu`?(0,Q.jsx)(Y,{externalTree:w,children:Se}):Se});function fl(e){let t=Nc().store,n=Z.useMemo(()=>({parentMenu:t}),[t]);return(0,Q.jsx)(ll.Provider,{value:n,children:(0,Q.jsx)(dl,{...e})})}function pl(e){let t=e.getBoundingClientRect(),n=J(e),r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(!(r.content!==`none`||i.content!==`none`))return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function ml(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=$o(),{ref:i,index:a}=Hc(e),o=n===a,s=Z.useRef(null),c=ie(i,s);return{compositeProps:Z.useMemo(()=>({tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}}),[o,r,a,t]),compositeRef:c,index:a}}function hl(e){let{render:t,className:n,style:r,state:i=Tn,props:a=ln,refs:o=ln,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=ml({metadata:s});return We(l,e,{state:i,ref:[...o,f],props:[d,...a,u],stateAttributesMapping:c})}function gl(e){if(Qn(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`)??void 0;if(!d(e))return gl(z(e))}var _l=t(qe());function vl(e,t){let n=Z.useRef(null);return{preFocusGuardRef:n,handlePreFocusGuardFocus:s(t=>{_l.flushSync(()=>{e.setOpen(!1,Pe(gn,t.nativeEvent,t.currentTarget))}),rn(n.current)?.focus()}),handleFocusTargetFocus:s(n=>{let r=e.select(`positionerElement`);if(r&&bn(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{_l.flushSync(()=>{e.setOpen(!1,Pe(gn,n.nativeEvent,n.currentTarget))});let i=On(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&ft(r,i);){let e=i;if(i=a(i),i===e)break}i?.focus()}})}}function yl(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=Z.useRef(!1);return Z.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,y(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:Tn,[t,n,r])}var bl=2,xl=Vn(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,id:o,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,style:m,...h}=e,g=Nc(!0),_=d?.store??g?.store;if(!_)throw Error(pt(85));let v=Qt(o),b=_.useState(`isTriggerActive`,v),x=_.useState(`floatingRootContext`),S=_.useState(`isOpenedByTrigger`,v),w=Z.useRef(null),T=Cl(),E=$o(!0),D=p(),O=Z.useMemo(()=>D??new Be,[D]),{registerTrigger:k,isMountedByThisTrigger:A}=Me(v,w,_,{payload:f,closeDelay:u,parent:T,floatingTreeRoot:O,floatingNodeId:we(O),floatingParentNodeId:er(),keyboardEventRelay:E?.relayKeyboardEvent}),j=T.type===`menubar`,M=_.useState(`disabled`),N=i||M||j&&T.context.disabled,{getButtonProps:P,buttonRef:F}=ts({disabled:N,native:a});Z.useEffect(()=>{!S&&T.type===void 0&&(_.context.allowMouseUpTriggerRef.current=!1)},[_,S,T.type]);let I=Z.useRef(null),L=Ln(),R=s(e=>{if(!I.current)return;L.clear(),_.context.allowMouseUpTriggerRef.current=!1;let t=e.target;if(ft(I.current,t)||ft(_.select(`positionerElement`),t)||t===I.current||t!=null&&gl(t)===_.select(`rootId`))return;let n=pl(I.current);e.clientX>=n.left-bl&&e.clientX<=n.right+bl&&e.clientY>=n.top-bl&&e.clientY<=n.bottom+bl||O.events.emit(`close`,{domEvent:e,reason:He})});Z.useEffect(()=>{S&&_.select(`lastOpenChangeReason`)===`trigger-hover`&&y(I.current).addEventListener(`mouseup`,R,{once:!0})},[S,R,_]);let z=j&&T.context.hasSubmenuOpen,B=Mt(x,{enabled:(c??z)&&!N&&T.type!==`context-menu`&&(!j||z&&!A),handleClose:nn({blockPointerEvents:!j}),mouseOnly:!0,move:!1,restMs:T.type===void 0?l:void 0,delay:{close:u},triggerElementRef:w,externalTree:O,isActiveTrigger:b,isClosing:()=>_.select(`transitionStatus`)===`ending`}),V=Sl(S,_.select(`lastOpenChangeReason`)),H=ma(x,{enabled:!N&&T.type!==`context-menu`,event:S&&j?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:T.type===void 0?V:!1}),U=Rn(x,{enabled:!N&&z}),W=yl({open:S,enabled:j,mouseDownAction:`open`}),ee=It([H,U]),G={disabled:N,open:S},te=_.useState(`triggerProps`,A),K=[I,t,F,k,w],q=[ee.getReferenceProps(),B??Tn,te,{"aria-haspopup":`menu`,id:v,onMouseDown:e=>{_.select(`open`)||(L.start(200,()=>{_.context.allowMouseUpTriggerRef.current=!0}),y(e.currentTarget).addEventListener(`mouseup`,R,{once:!0}))}},j?{role:`menuitem`}:{},W,h,P],{preFocusGuardRef:J,handlePreFocusGuardFocus:ne,handleFocusTargetFocus:Y}=vl(_,w),re=We(`button`,e,{enabled:!j,stateAttributesMapping:Ot,state:G,ref:K,props:q});return j?(0,Q.jsx)(hl,{tag:`button`,render:n,className:r,style:m,state:G,refs:K,props:q,stateAttributesMapping:Ot}):S?(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(C,{ref:J,onFocus:ne},`${v}-pre-focus-guard`),(0,Q.jsx)(Z.Fragment,{children:re},v),(0,Q.jsx)(C,{ref:_.context.triggerFocusTargetRef,onFocus:Y},`${v}-post-focus-guard`)]}):(0,Q.jsx)(Z.Fragment,{children:re},v)});function Sl(e,t){let n=Ln(),[r,i]=Z.useState(!1);return Gn(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Cl(){let e=Fc(!0),t=Nc(!0),n=al(!0);return Z.useMemo(()=>n?{type:`menubar`,context:n}:e&&!t?{type:`context-menu`,context:e}:{type:void 0},[e,t,n])}var wl=Z.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return We(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function Tl(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var El=Z.forwardRef(function(e,t){let{render:n,className:r,label:i,id:a,nativeButton:o=!1,openOnHover:s=!0,delay:c=100,closeDelay:l=0,disabled:u=!1,style:d,...f}=e,p=Hc(),m=jc(),{store:h}=Nc(),g=Qt(a),_=h.useState(`open`),v=h.useState(`floatingRootContext`),y=h.useState(`floatingTreeRoot`),b=T(g,h),x=Z.useCallback(e=>{let t=b(e);return e!==null&&h.select(`open`)&&h.select(`activeTriggerId`)==null&&h.update({activeTriggerId:g,activeTriggerElement:e,closeDelay:l}),t},[b,l,h,g]),S=Z.useRef(null),C=Z.useCallback(e=>{S.current=e,h.set(`activeTriggerElement`,e)},[h]),w=ul();if(!w?.parentMenu)throw Error(pt(37));h.useSyncedValue(`closeDelay`,l);let E=w.parentMenu,D=E.useState(`itemProps`),O=E.useState(`isActive`,p.index),k=Z.useMemo(()=>({type:`submenu-trigger`,setActive(){E.set(`activeIndex`,p.index)}}),[E,p.index]),A=h.useState(`disabled`),j=u||A,{getItemProps:M,itemRef:N}=Rc({closeOnClick:!1,disabled:j,highlighted:O,id:g,store:h,typingRef:E.context.typingRef,nativeButton:o,itemMetadata:k,nodeId:m?.context.nodeId}),P=h.useState(`hoverEnabled`),F=E.useState(`allowMouseEnter`),I=Mt(v,{enabled:P&&s&&!j,handleClose:nn({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:c,delay:F?{open:c,close:l}:0,triggerElementRef:S,externalTree:y,isClosing:()=>h.select(`transitionStatus`)===`ending`}),L=It([ma(v,{enabled:!j,event:`mousedown`,toggle:!s,ignoreMouse:s,stickIfOpen:!1})]),R=h.useState(`triggerProps`,!0);return delete R.id,We(`div`,e,{state:{disabled:j,highlighted:O,open:_},stateAttributesMapping:mn,props:[L.getReferenceProps(),I,R,D,{tabIndex:_||O?0:-1,onBlur(){O&&E.set(`activeIndex`,null)}},f,M],ref:[t,p.ref,N,x,C]})});function Dl(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Q.jsx)(dl,{"data-slot":`dropdown-menu`,...n}),t[2]=n,t[3]=r),r}function Ol(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Q.jsx)(xl,{"data-slot":`dropdown-menu-trigger`,...n}),t[2]=n,t[3]=r),r}function kl(e){let t=(0,$.c)(18),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({align:i,alignOffset:a,side:o,sideOffset:s,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=i===void 0?`start`:i,l=a===void 0?0:a,u=o===void 0?`bottom`:o,d=s===void 0?4:s,f;t[7]===n?f=t[8]:(f=on(`z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95`,n),t[7]=n,t[8]=f);let p;t[9]!==r||t[10]!==f?(p=(0,Q.jsx)(qc,{"data-slot":`dropdown-menu-content`,className:f,...r}),t[9]=r,t[10]=f,t[11]=p):p=t[11];let m;return t[12]!==c||t[13]!==l||t[14]!==u||t[15]!==d||t[16]!==p?(m=(0,Q.jsx)(Xc,{children:(0,Q.jsx)(rl,{className:`isolate z-50 outline-none`,align:c,alignOffset:l,side:u,sideOffset:d,children:p})}),t[12]=c,t[13]=l,t[14]=u,t[15]=d,t[16]=p,t[17]=m):m=t[17],m}function Al(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=on(`group/dropdown-menu-item relative flex min-h-8 cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,Q.jsx)(Uc,{"data-slot":`dropdown-menu-item`,"data-inset":r,"data-variant":o,className:s,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function jl(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Q.jsx)(fl,{"data-slot":`dropdown-menu-sub`,...n}),t[2]=n,t[3]=r),r}function Ml(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=on(`flex min-h-8 cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(Da,{className:`ml-auto`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,Q.jsxs)(El,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function Nl(e){let t=(0,$.c)(16),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({align:i,alignOffset:a,side:o,sideOffset:s,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=i===void 0?`start`:i,l=a===void 0?-3:a,u=o===void 0?`right`:o,d=s===void 0?0:s,f;t[7]===n?f=t[8]:(f=on(`w-auto min-w-[96px] rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 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-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n),t[7]=n,t[8]=f);let p;return t[9]!==c||t[10]!==l||t[11]!==r||t[12]!==u||t[13]!==d||t[14]!==f?(p=(0,Q.jsx)(kl,{"data-slot":`dropdown-menu-sub-content`,className:f,align:c,alignOffset:l,side:u,sideOffset:d,...r}),t[9]=c,t[10]=l,t[11]=r,t[12]=u,t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function Pl(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(wl,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Fl(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=on(`ml-auto hidden items-center justify-end text-xs text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground md:inline-flex`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=(0,Q.jsx)(H,{children:n}),t[6]=n,t[7]=o);let s;return t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,Q.jsx)(`span`,{"data-slot":`dropdown-menu-shortcut`,className:a,...i,children:o}),t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}function Il(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`empty`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ll(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`flex max-w-sm flex-col items-center gap-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`empty-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Rl=Yo(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`}});function zl(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]!==n||t[5]!==a?(o=on(Rl({variant:a,className:n})),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o||t[9]!==a?(s=(0,Q.jsx)(`div`,{"data-slot":`empty-icon`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function Bl(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`font-heading text-sm font-medium tracking-tight`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`empty-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Vl(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`empty-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Hl(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`empty-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Ul=768;function Wl(){let e=(0,$.c)(2),[t,n]=Z.useState(void 0),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(max-width: ${Ul-1}px)`),t=()=>{n(window.innerWidth<Ul)};return e.addEventListener(`change`,t),n(window.innerWidth<Ul),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),Z.useEffect(r,i),!!t}function Gl(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`horizontal`:i,o;t[4]===n?o=t[5]:(o=on(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Q.jsx)(wl,{"data-slot":`separator`,orientation:a,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function Kl(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Q.jsx)(nc,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function ql(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Q.jsx)(Rs,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}function Jl(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(us,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Yl(e){let t=(0,$.c)(17),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,side:a,showCloseButton:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?`right`:a,c=o===void 0?!0:o,l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(Jl,{}),t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=on(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm`,r),t[7]=r,t[8]=u);let d;t[9]===c?d=t[10]:(d=c&&(0,Q.jsxs)(ds,{"data-slot":`sheet-close`,render:(0,Q.jsx)(os,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`}),children:[(0,Q.jsx)(Qa,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t[9]=c,t[10]=d);let f;return t[11]!==n||t[12]!==i||t[13]!==s||t[14]!==u||t[15]!==d?(f=(0,Q.jsxs)(ql,{children:[l,(0,Q.jsxs)(Is,{"data-slot":`sheet-content`,"data-side":s,className:u,...i,children:[n,d]})]}),t[11]=n,t[12]=i,t[13]=s,t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function Xl(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`flex flex-col gap-0.5 p-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`sheet-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Zl(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`font-heading text-base font-medium text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(rc,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ql(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`text-sm text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(fs,{"data-slot":`sheet-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var $l=`sidebar_state`,eu=3600*24*7,tu=`20rem`,nu=`16rem`,ru=`32rem`,iu=`pico-sidebar-width`,au=`sidebar_width`,ou=`20rem`,su=`3rem`,cu=`b`,lu=Z.createContext(null);function uu(e,t){let n=e.trim(),r=Number.parseFloat(n);return Number.isFinite(r)?n.endsWith(`rem`)?r*(typeof window>`u`?16:Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize)||16):r:t}function du(e){let t=uu(tu,320),n=uu(nu,256),r=uu(ru,512),i=uu(e??``,t);return`${Math.round(Math.min(Math.max(i,n),r))}px`}function fu(){if(typeof window>`u`)return du(tu);try{return du(window.localStorage.getItem(iu)??window.localStorage.getItem(au))}catch{return du(tu)}}function pu(e){try{window.localStorage.setItem(iu,e)}catch{}}function mu(e){let t=Z.useRef(e);return t.current=e,t}function hu(){let e=Z.useContext(lu);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function gu({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o}){let s=Wl(),[c,l]=Z.useState(!1),[u,d]=Z.useState(!1),[f,p]=Z.useState(()=>du(tu)),[m,h]=Z.useState(!1),g=Z.useRef(f);g.current=f,Z.useEffect(()=>{let e=fu();g.current!==e&&(g.current=e,p(e))},[]);let _=e=>{let t=du(e);g.current!==t&&(g.current=t,p(t),pu(t))},[v,y]=Z.useState(e),b=t??v,x=e=>{let t=typeof e==`function`?e(b):e;n?n(t):y(t),document.cookie=`${$l}=${t}; path=/; max-age=${eu}`},S=()=>s?l(e=>!e):x(e=>!e),C=mu(S);Z.useEffect(()=>{let e=e=>{e.key.toLowerCase()===cu&&(e.metaKey||e.ctrlKey)&&!(e.metaKey&&e.ctrlKey)&&!e.shiftKey&&!e.altKey&&(e.preventDefault(),C.current())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[C]);let w={state:b?`expanded`:`collapsed`,open:b,setOpen:x,isMobile:s,openMobile:c,openMobileSettled:u,setOpenMobile:l,setOpenMobileSettled:d,sidebarResizing:m,setSidebarResizing:h,sidebarWidth:f,setSidebarWidth:_,toggleSidebar:S};return(0,Q.jsx)(lu.Provider,{value:w,children:(0,Q.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{...i,"--sidebar-width":f,"--sidebar-width-icon":su},className:on(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...o,children:a})})}function _u(e){let t=(0,$.c)(50),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({side:o,variant:s,collapsible:c,className:r,children:n,dir:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=o===void 0?`left`:o,u=s===void 0?`sidebar`:s,d=c===void 0?`offcanvas`:c,{isMobile:f,state:p,openMobile:m,setOpenMobile:h,setOpenMobileSettled:g,sidebarResizing:_}=hu();if(d===`none`){let e;t[8]===r?e=t[9]:(e=on(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[8]=r,t[9]=e);let i;return t[10]!==n||t[11]!==a||t[12]!==e?(i=(0,Q.jsx)(`div`,{"data-slot":`sidebar`,className:e,...a,children:n}),t[10]=n,t[11]=a,t[12]=e,t[13]=i):i=t[13],i}if(f){let e;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e={"--sidebar-width":ou},t[14]=e):e=t[14];let r;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsxs)(Xl,{className:`sr-only`,children:[(0,Q.jsx)(Zl,{children:`Sidebar`}),(0,Q.jsx)(Ql,{children:`Displays the mobile sidebar.`})]}),t[15]=r):r=t[15];let o;t[16]===n?o=t[17]:(o=(0,Q.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:n}),t[16]=n,t[17]=o);let s;t[18]!==i||t[19]!==l||t[20]!==o?(s=(0,Q.jsxs)(Yl,{dir:i,"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden`,style:e,side:l,children:[r,o]}),t[18]=i,t[19]=l,t[20]=o,t[21]=s):s=t[21];let c;return t[22]!==m||t[23]!==a||t[24]!==h||t[25]!==g||t[26]!==s?(c=(0,Q.jsx)(Kl,{open:m,onOpenChange:h,onOpenChangeComplete:g,...a,children:s}),t[22]=m,t[23]=a,t[24]=h,t[25]=g,t[26]=s,t[27]=c):c=t[27],c}let v=p===`collapsed`?d:``,y=_?`true`:void 0,b=u===`floating`||u===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,x;t[28]===b?x=t[29]:(x=on(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear group-data-[resizing=true]:transition-none`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,b),t[28]=b,t[29]=x);let S;t[30]===x?S=t[31]:(S=(0,Q.jsx)(`div`,{"data-slot":`sidebar-gap`,className:x}),t[30]=x,t[31]=S);let C=u===`floating`||u===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`border-sidebar-border/70 group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,w;t[32]!==r||t[33]!==C?(w=on(`fixed inset-y-0 z-30 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear group-data-[resizing=true]:transition-none data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex`,C,r),t[32]=r,t[33]=C,t[34]=w):w=t[34];let T;t[35]===n?T=t[36]:(T=(0,Q.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[35]=n,t[36]=T);let E;t[37]!==a||t[38]!==l||t[39]!==w||t[40]!==T?(E=(0,Q.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":l,className:w,...a,children:T}),t[37]=a,t[38]=l,t[39]=w,t[40]=T,t[41]=E):E=t[41];let D;return t[42]!==l||t[43]!==p||t[44]!==E||t[45]!==v||t[46]!==y||t[47]!==S||t[48]!==u?(D=(0,Q.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":p,"data-collapsible":v,"data-resizing":y,"data-variant":u,"data-side":l,"data-slot":`sidebar`,children:[S,E]}),t[42]=l,t[43]=p,t[44]=E,t[45]=v,t[46]=y,t[47]=S,t[48]=u,t[49]=D):D=t[49],D}function vu(e){let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{toggleSidebar:a}=hu(),o;t[4]===n?o=t[5]:(o=on(n),t[4]=n,t[5]=o);let s;t[6]!==r||t[7]!==a?(s=e=>{r?.(e),a()},t[6]=r,t[7]=a,t[8]=s):s=t[8];let c,l;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(Ua,{}),l=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`}),t[9]=c,t[10]=l):(c=t[9],l=t[10]);let u;return t[11]!==i||t[12]!==o||t[13]!==s?(u=(0,Q.jsx)(Ne,{title:`Toggle sidebar`,kbd:`⌃ B`,children:(0,Q.jsxs)(os,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon`,className:o,onClick:s,...i,children:[c,l]})}),t[11]=i,t[12]=o,t[13]=s,t[14]=u):u=t[14],u}function yu(e){let t=(0,$.c)(34),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,onClick:r,onPointerDown:i,style:o,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let{isMobile:s,setOpen:c,setSidebarResizing:l,setSidebarWidth:u,sidebarWidth:d,state:f}=hu(),p;t[6]!==s||t[7]!==c||t[8]!==l||t[9]!==u||t[10]!==d||t[11]!==f?(p={isMobile:s,maxWidth:ru,minWidth:nu,state:f,width:d,onOpenChange:c,onResize:u,onResizeActiveChange:l},t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p):p=t[12];let{handleClick:m,handlePointerDown:h}=Uo(p),[g,_]=Z.useState(`col-resize`),[v,y]=Z.useState(10),b,x;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{let e=()=>{y(Mo())},t=window.matchMedia(`(pointer:coarse)`);return _(Ao()),e(),t.addEventListener(`change`,e),()=>{t.removeEventListener(`change`,e)}},x=[],t[13]=b,t[14]=x):(b=t[13],x=t[14]),Z.useEffect(b,x);let S=g===`ew-resize`?`cursor-ew-resize group-data-[side=left]:cursor-ew-resize group-data-[side=right]:cursor-ew-resize [[data-side=left][data-state=collapsed]_&]:cursor-ew-resize [[data-side=right][data-state=collapsed]_&]:cursor-ew-resize`:`cursor-col-resize group-data-[side=left]:cursor-col-resize group-data-[side=right]:cursor-col-resize [[data-side=left][data-state=collapsed]_&]:cursor-col-resize [[data-side=right][data-state=collapsed]_&]:cursor-col-resize`,C;t[15]!==m||t[16]!==r?(C=e=>{r?.(e),!e.defaultPrevented&&m(e)},t[15]=m,t[16]=r,t[17]=C):C=t[17];let w;t[18]!==h||t[19]!==i?(w=e=>{i?.(e),!e.defaultPrevented&&h(e)},t[18]=h,t[19]=i,t[20]=w):w=t[20];let T=`${v}px`,E;t[21]!==g||t[22]!==o||t[23]!==T?(E={...o,"--sidebar-rail-width":T,cursor:g},t[21]=g,t[22]=o,t[23]=T,t[24]=E):E=t[24];let D=E,O;t[25]!==n||t[26]!==S?(O=on(`absolute inset-y-0 z-40 hidden w-(--sidebar-rail-width) touch-none bg-transparent transition-all ease-linear select-none group-data-[side=left]:right-[calc(var(--sidebar-rail-width)*-1)] group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-px after:bg-transparent sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,Oc,S,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full`,kc,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,n),t[25]=n,t[26]=S,t[27]=O):O=t[27];let k;return t[28]!==a||t[29]!==C||t[30]!==w||t[31]!==D||t[32]!==O?(k=(0,Q.jsx)(`button`,{"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":`Toggle or resize Sidebar`,tabIndex:-1,onClick:C,onPointerDown:w,title:`Toggle or resize Sidebar`,style:D,className:O,...a}),t[28]=a,t[29]=C,t[30]=w,t[31]=D,t[32]=O,t[33]=k):k=t[33],k}function bu(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`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),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`main`,{"data-slot":`sidebar-inset`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xu(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Su(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Cu(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function wu(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`relative flex w-full min-w-0 flex-col p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Tu(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`w-full text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Eu(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Du(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Ou=Yo(`peer/menu-button group/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:text-sidebar-accent-foreground not-data-active:hover:bg-sidebar-accent/50 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-open:hover:bg-sidebar-accent/50 data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground [&_svg]:shrink-0 [&>span:last-child]:truncate [&>svg]:size-4`,{variants:{variant:{default:`hover:text-sidebar-accent-foreground not-data-active:hover:bg-sidebar-accent/50`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))] not-data-active:hover:bg-sidebar-accent/50`},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 ku(e){let t=(0,$.c)(18),{render:n,isActive:r,variant:i,size:a,tooltip:o,className:s,...c}=e,l=r===void 0?!1:r,u=i===void 0?`default`:i,d=a===void 0?`default`:a,{isMobile:f,state:p}=hu(),m=K({className:on(Ou({variant:u,size:d}),s)},c),h;t[0]!==n||t[1]!==o?(h=o?(0,Q.jsx)(G,{render:n}):n,t[0]=n,t[1]=o,t[2]=h):h=t[2];let g;t[3]!==l||t[4]!==d?(g={slot:`sidebar-menu-button`,sidebar:`menu-button`,size:d,active:l},t[3]=l,t[4]=d,t[5]=g):g=t[5];let _;t[6]!==m||t[7]!==h||t[8]!==g?(_={defaultTagName:`button`,props:m,render:h,state:g},t[6]=m,t[7]=h,t[8]=g,t[9]=_):_=t[9];let v=Ko(_);if(!o)return v;if(typeof o==`string`){let e;t[10]===o?e=t[11]:(e={children:o},t[10]=o,t[11]=e),o=e}let y=p!==`collapsed`||f,b;t[12]!==y||t[13]!==o?(b=(0,Q.jsx)(A,{side:`right`,align:`center`,hidden:y,...o}),t[12]=y,t[13]=o,t[14]=b):b=t[14];let x;return t[15]!==v||t[16]!==b?(x=(0,Q.jsxs)(Ve,{children:[v,b]}),t[15]=v,t[16]=b,t[17]=x):x=t[17],x}var Au=Z.createContext(void 0);function ju(){let e=Z.useContext(Au);if(e===void 0)throw Error(pt(64));return e}var Mu=function(e){return e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e}({}),Nu={tabActivationDirection:e=>({[Mu.activationDirection]:e})},Pu=Z.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:o,value:c,style:l,...u}=e,d=Object.hasOwn(e,`defaultValue`),f=Z.useRef([]),[p,m]=Z.useState(()=>new Map),[h,g]=Sc({controlled:c,default:r,name:`Tabs`,state:`value`}),_=c!==void 0,[v,y]=Z.useState(()=>new Map),b=Z.useCallback(e=>{if(e===void 0)return null;for(let[t,n]of v.entries())if(n!=null&&e===(n.value??n.index))return t;return null},[v]),[x,S]=Z.useState(()=>({previousValue:h,tabActivationDirection:`none`})),{previousValue:C,tabActivationDirection:w}=x,T=w,E=!1;C!==h&&(T=Fu(C,h,a,v),E=C!=null&&h!=null&&b(h)==null);let D=E?C:h,O=C!==D||w!==T;Gn(()=>{O&&S({previousValue:D,tabActivationDirection:T})},[D,O,T]);let k=s((e,t)=>{t.activationDirection=Fu(h,e,a,v),i?.(e,t),!t.isCanceled&&g(e)}),A=s((e,t)=>{m(n=>{if(n.get(e)===t)return n;let r=new Map(n);return r.set(e,t),r})}),j=s((e,t)=>{m(n=>{if(!n.has(e)||n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})}),M=Z.useCallback(e=>p.get(e),[p]),N=Z.useCallback(e=>{for(let t of v.values())if(e===t?.value)return t?.id},[v]),P=Z.useMemo(()=>({getTabElementBySelectedValue:b,getTabIdByPanelValue:N,getTabPanelIdByValue:M,onValueChange:k,orientation:a,registerMountedTabPanel:A,setTabMap:y,unregisterMountedTabPanel:j,tabActivationDirection:T,value:h}),[b,N,M,k,a,A,y,j,T,h]),F=Z.useMemo(()=>{for(let e of v.values())if(e!=null&&e.value===h)return e},[v,h]),I=Z.useMemo(()=>{for(let e of v.values())if(e!=null&&!e.disabled)return e.value},[v]);Gn(()=>{if(_||v.size===0)return;let e=F?.disabled;if(d&&e&&h===r||!e&&!(F==null&&h!==null))return;let t=I??null;h!==t&&(g(t),S(e=>e.tabActivationDirection===`none`?e:{...e,tabActivationDirection:`none`}))},[r,I,d,_,F,g,v,h]);let L=We(`div`,e,{state:{orientation:a,tabActivationDirection:T},ref:t,props:u,stateAttributesMapping:Nu});return(0,Q.jsx)(Au.Provider,{value:P,children:(0,Q.jsx)(Zc,{elementsRef:f,children:L})})});function Fu(e,t,n,r){if(e==null||t==null)return`none`;let i=null,a=null;for(let[n,o]of r.entries()){if(o==null)continue;let r=o.value??o.index;if(e===r&&(i=n),t===r&&(a=n),i!=null&&a!=null)break}if(i==null||a==null)return i!==a&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?n===`horizontal`?t>e?`right`:`left`:t>e?`down`:`up`:`none`;let o=i.getBoundingClientRect(),s=a.getBoundingClientRect();if(n===`horizontal`){if(s.left<o.left)return`left`;if(s.left>o.left)return`right`}else{if(s.top<o.top)return`up`;if(s.top>o.top)return`down`}return`none`}var Iu=`data-composite-item-active`,Lu=Z.createContext(void 0);function Ru(){let e=Z.useContext(Lu);if(e===void 0)throw Error(pt(65));return e}var zu=Z.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:o,nativeButton:s=!0,style:c,...l}=e,{value:u,getTabPanelIdByValue:d,orientation:f}=ju(),{activateOnFocus:p,highlightedTabIndex:m,onTabActivation:h,registerTabResizeObserverElement:g,setHighlightedTabIndex:_,tabsListElement:v}=Ru(),b=Qt(o),{compositeProps:x,compositeRef:S,index:C}=ml({metadata:Z.useMemo(()=>({disabled:r,id:b,value:a}),[r,b,a])}),w=a===u,T=Z.useRef(!1),E=Z.useRef(null);Z.useEffect(()=>{let e=E.current;if(e)return g(e)},[g]),Gn(()=>{if(T.current){T.current=!1;return}if(!(w&&C>-1&&m!==C))return;let e=v;if(e!=null){let t=Jn(y(e));if(t&&ft(e,t))return}r||_(C)},[w,C,m,_,r,v]);let{getButtonProps:D,buttonRef:O}=ts({disabled:r,native:s,focusableWhenDisabled:!0}),k=d(a),A=Z.useRef(!1),j=Z.useRef(!1);function M(e){w||r||h(a,Pe(et,e.nativeEvent,void 0,{activationDirection:`none`}))}function N(e){w||(C>-1&&!r&&_(C),!r&&p&&(!A.current||A.current&&j.current)&&h(a,Pe(et,e.nativeEvent,void 0,{activationDirection:`none`})))}function P(e){if(w||r)return;A.current=!0;function t(){A.current=!1,j.current=!1}(!e.button||e.button===0)&&(j.current=!0,y(e.currentTarget).addEventListener(`pointerup`,t,{once:!0}))}return We(`button`,e,{state:{disabled:r,active:w,orientation:f},ref:[t,O,S,E],props:[x,{role:`tab`,"aria-controls":k,"aria-selected":w,id:b,onClick:M,onFocus:N,onPointerDown:P,[Iu]:w?``:void 0,onKeyDownCapture(){T.current=!0}},l,D]})}),Bu=[];function Vu(e){let{itemSizes:t,cols:n=1,loopFocus:r=!0,onLoop:i,dense:a=!1,orientation:o=`both`,direction:c,highlightedIndex:l,onHighlightedIndexChange:u,rootRef:d,enableHomeAndEndKeys:f=!1,stopEventPropagation:p=!1,disabledIndices:m,modifierKeys:h=Bu}=e,[g,_]=Z.useState(0),v=n>1,y=Z.useRef(null),b=ie(y,d),x=Z.useRef([]),S=Z.useRef(!1),C=l??g,w=s((e,t=!1)=>{if((u??_)(e),t){let t=x.current[e];Ms(y.current,t,c,o)}}),T=s(e=>{if(e.size===0||S.current)return;S.current=!0;let t=Array.from(e.keys()),n=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,r=n?t.indexOf(n):-1;r!==-1&&w(r),Ms(y.current,n,c,o)}),E=s((e,t,n)=>i?i?.(e,t,n,x):n),D=Z.useMemo(()=>({"aria-orientation":o===`both`?void 0:o,ref:b,onFocus(e){let t=y.current,n=Wn(e.nativeEvent);!t||n==null||!js(n)||n.setSelectionRange(0,n.value.length??0)},onKeyDown(e){let s=f?Ds:Es;if(!s.has(e.key)||Hu(e,h)||!y.current)return;let l=c===`rtl`,u=l?ys:bs,d={horizontal:u,vertical:vs,both:u}[o],g=l?bs:ys,_={horizontal:g,vertical:_s,both:g}[o],b=Wn(e.nativeEvent);if(b!=null&&js(b)&&!Tl(b)){let t=b.selectionStart,n=b.selectionEnd,r=b.value??``;if(t==null||e.shiftKey||t!==n||e.key!==_&&t<r.length||e.key!==d&&t>0)return}let S=C,T=Et(x,m),D=bt(x,m);if(v){let i=t||Array.from({length:x.current.length},()=>({width:1,height:1})),s=cn(i,n,a),c=s.findIndex(e=>e!=null&&!Pt(x.current,e,m)),u=s.reduce((e,t,n)=>t!=null&&!Pt(x.current,t,m)?n:e,-1);S=s[Mn(s.map(e=>e==null?null:x.current[e]),{event:e,orientation:o,loopFocus:r,onLoop:E,cols:n,disabledIndices:Xt([...m||x.current.map((e,t)=>Pt(x.current,t)?t:void 0),void 0],s),minIndex:c,maxIndex:u,prevIndex:gt(C>D?T:C,i,s,n,e.key===`ArrowDown`?`bl`:e.key===`ArrowRight`?`tr`:`tl`),rtl:l})]}let O={horizontal:[u],vertical:[vs],both:[u,vs]}[o],k={horizontal:[g],vertical:[_s],both:[g,_s]}[o],A=v?s:{horizontal:f?Cs:Ss,vertical:f?Ts:ws,both:s}[o];f&&(e.key===`Home`?S=T:e.key===`End`&&(S=D)),S===C&&(O.includes(e.key)||k.includes(e.key))&&(r&&S===D&&O.includes(e.key)?(S=T,i&&(S=i(e,C,S,x))):r&&S===T&&k.includes(e.key)?(S=D,i&&(S=i(e,C,S,x))):S=wn(x.current,{startingIndex:S,decrement:k.includes(e.key),disabledIndices:m})),S!==C&&!en(x.current,S)&&(p&&e.stopPropagation(),A.has(e.key)&&e.preventDefault(),w(S,!0),queueMicrotask(()=>{x.current[S]?.focus()}))}}),[n,a,c,m,x,f,C,v,t,r,i,E,b,h,w,o,p]);return Z.useMemo(()=>({props:D,highlightedIndex:C,onHighlightedIndexChange:w,elementsRef:x,disabledIndices:m,onMapChange:T,relayKeyboardEvent:D.onKeyDown}),[D,C,w,x,m,T])}function Hu(e,t){for(let n of ks.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Uu(e){let{render:t,className:n,style:r,refs:i=ln,props:a=ln,state:o=Tn,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,dense:d,itemSizes:f,loopFocus:p,onLoop:m,cols:h,enableHomeAndEndKeys:g,onMapChange:_,stopEventPropagation:v=!0,rootRef:y,disabledIndices:b,modifierKeys:x,highlightItemOnHover:S=!1,tag:C=`div`,...w}=e,{props:T,highlightedIndex:E,onHighlightedIndexChange:D,elementsRef:O,onMapChange:k,relayKeyboardEvent:A}=Vu({itemSizes:f,cols:h,loopFocus:p,onLoop:m,dense:d,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:y,stopEventPropagation:v,enableHomeAndEndKeys:g,direction:vt(),disabledIndices:b,modifierKeys:x}),j=We(C,e,{state:o,ref:i,props:[T,...a,w],stateAttributesMapping:s}),M=Z.useMemo(()=>({highlightedIndex:E,onHighlightedIndexChange:D,highlightItemOnHover:S,relayKeyboardEvent:A}),[E,D,S,A]);return(0,Q.jsx)(Qo.Provider,{value:M,children:(0,Q.jsx)(Zc,{elementsRef:O,onMapChange:e=>{_?.(e),k(e)},children:j})})}var Wu=Z.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:r,loopFocus:i=!0,render:a,style:o,...c}=e,{onValueChange:l,orientation:u,value:d,setTabMap:f,tabActivationDirection:p}=ju(),[m,h]=Z.useState(0),[g,_]=Z.useState(null),v=Z.useRef(new Set),y=Z.useRef(new Set),b=Z.useRef(null),x=s(()=>{v.current.forEach(e=>{e()})});Z.useEffect(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{v.current.size&&x()});return b.current=e,g&&e.observe(g),y.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),b.current=null}},[g,x]);let S=s(e=>(v.current.add(e),()=>{v.current.delete(e)})),C=s(e=>(y.current.add(e),b.current?.observe(e),()=>{y.current.delete(e),b.current?.unobserve(e)})),w=s((e,t)=>{e!==d&&l(e,t)}),T={orientation:u,tabActivationDirection:p},E={"aria-orientation":u===`vertical`?`vertical`:void 0,role:`tablist`},D=Z.useMemo(()=>({activateOnFocus:n,highlightedTabIndex:m,registerIndicatorUpdateListener:S,registerTabResizeObserverElement:C,onTabActivation:w,setHighlightedTabIndex:h,tabsListElement:g}),[n,m,S,C,w,h,g]);return(0,Q.jsx)(Lu.Provider,{value:D,children:(0,Q.jsx)(Uu,{render:a,className:r,style:o,state:T,refs:[t,_],props:[E,c],stateAttributesMapping:Nu,highlightedIndex:m,enableHomeAndEndKeys:!0,loopFocus:i,orientation:u,onHighlightedIndexChange:h,onMapChange:f,disabledIndices:ln})})});function Gu(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`horizontal`:i,o;t[4]===n?o=t[5]:(o=on(`group/tabs flex gap-2 data-horizontal:flex-col`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Q.jsx)(Pu,{"data-slot":`tabs`,"data-orientation":a,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}var iee=Yo(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function aee(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]!==n||t[5]!==a?(o=on(iee({variant:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o||t[9]!==a?(s=(0,Q.jsx)(Wu,{"data-slot":`tabs-list`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function Ku(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:border-transparent data-active:bg-background data-active:text-foreground dark:data-active:border-transparent dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(zu,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var qu=1,oee=.9,see=.8,cee=.17,Ju=.1,Yu=.999,lee=.9999,uee=.99,Xu=/[\\\/_+.#"@\[\(\{&]/,Zu=/[\\\/_+.#"@\[\(\{&]/g,Qu=/[\s-]/,$u=/[\s-]/g;function ed(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?qu:uee;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=ed(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=qu:Xu.test(e.charAt(l-1))?(d*=see,p=e.slice(i,l-1).match(Zu),p&&i>0&&(d*=Yu**+p.length)):Qu.test(e.charAt(l-1))?(d*=oee,m=e.slice(i,l-1).match($u),m&&i>0&&(d*=Yu**+m.length)):(d*=cee,i>0&&(d*=Yu**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=lee)),(d<Ju&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=ed(e,t,n,r,l+1,a+2,o),f*Ju>d&&(d=f*Ju)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function td(e){return e.toLowerCase().replace($u,` `)}function nd(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,ed(e,t,td(e),td(t),0,0,{})}typeof window<`u`&&window.document&&window.document.createElement;function rd(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function id(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function ad(...e){return t=>{let n=!1,r=e.map(e=>{let r=id(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():id(e[t],null)}}}}function od(...e){return Z.useCallback(ad(...e),e)}function sd(e,t){let n=Z.createContext(t),r=e=>{let{children:t,...r}=e,i=Z.useMemo(()=>r,Object.values(r));return(0,Q.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=Z.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function cd(e,t=[]){let n=[];function r(t,r){let i=Z.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=Z.useMemo(()=>o,Object.values(o));return(0,Q.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=Z.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>Z.createContext(e));return function(n){let r=n?.[e]||t;return Z.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,ld(i,...t)]}function ld(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return Z.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var ud=globalThis?.document?Z.useLayoutEffect:()=>{},dd=Z.useId||(()=>void 0),fd=0;function pd(e){let[t,n]=Z.useState(dd());return ud(()=>{e||n(e=>e??String(fd++))},[e]),e||(t?`radix-${t}`:``)}var md=Z.useInsertionEffect||ud;function hd({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=gd({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=Z.useRef(e!==void 0);Z.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,Z.useCallback(t=>{if(s){let n=_d(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function gd({defaultProp:e,onChange:t}){let[n,r]=Z.useState(e),i=Z.useRef(n),a=Z.useRef(t);return md(()=>{a.current=t},[t]),Z.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function _d(e){return typeof e==`function`}function vd(e){let t=yd(e),n=Z.forwardRef((e,n)=>{let{children:r,...i}=e,a=Z.Children.toArray(r),o=a.find(xd);if(o){let e=o.props.children,r=a.map(t=>t===o?Z.Children.count(e)>1?Z.Children.only(null):Z.isValidElement(e)?e.props.children:null:t);return(0,Q.jsx)(t,{...i,ref:n,children:Z.isValidElement(e)?Z.cloneElement(e,void 0,r):null})}return(0,Q.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function yd(e){let t=Z.forwardRef((e,t)=>{let{children:n,...r}=e;if(Z.isValidElement(n)){let e=Cd(n),i=Sd(r,n.props);return n.type!==Z.Fragment&&(i.ref=t?ad(t,e):e),Z.cloneElement(n,i)}return Z.Children.count(n)>1?Z.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var bd=Symbol(`radix.slottable`);function xd(e){return Z.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===bd}function Sd(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Cd(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var wd=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=vd(`Primitive.${t}`),r=Z.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,Q.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Td(e,t){e&&_l.flushSync(()=>e.dispatchEvent(t))}function Ed(e){let t=Z.useRef(e);return Z.useEffect(()=>{t.current=e}),Z.useMemo(()=>(...e)=>t.current?.(...e),[])}function Dd(e,t=globalThis?.document){let n=Ed(e);Z.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Od=`DismissableLayer`,kd=`dismissableLayer.update`,Ad=`dismissableLayer.pointerDownOutside`,jd=`dismissableLayer.focusOutside`,Md,Nd=Z.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Pd=Z.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=Z.useContext(Nd),[u,d]=Z.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=Z.useState({}),m=od(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=Ld(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=Rd(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return Dd(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),Z.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Md=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),zd(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Md)}},[u,f,n,l]),Z.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),zd())},[u,l]),Z.useEffect(()=>{let e=()=>p({});return document.addEventListener(kd,e),()=>document.removeEventListener(kd,e)},[]),(0,Q.jsx)(wd.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:rd(e.onFocusCapture,S.onFocusCapture),onBlurCapture:rd(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:rd(e.onPointerDownCapture,x.onPointerDownCapture)})});Pd.displayName=Od;var Fd=`DismissableLayerBranch`,Id=Z.forwardRef((e,t)=>{let n=Z.useContext(Nd),r=Z.useRef(null),i=od(t,r);return Z.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,Q.jsx)(wd.div,{...e,ref:i})});Id.displayName=Fd;function Ld(e,t=globalThis?.document){let n=Ed(e),r=Z.useRef(!1),i=Z.useRef(()=>{});return Z.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Bd(Ad,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Rd(e,t=globalThis?.document){let n=Ed(e),r=Z.useRef(!1);return Z.useEffect(()=>{let e=e=>{e.target&&!r.current&&Bd(jd,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function zd(){let e=new CustomEvent(kd);document.dispatchEvent(e)}function Bd(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Td(i,a):i.dispatchEvent(a)}var Vd=`focusScope.autoFocusOnMount`,Hd=`focusScope.autoFocusOnUnmount`,Ud={bubbles:!1,cancelable:!0},Wd=`FocusScope`,Gd=Z.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=Z.useState(null),l=Ed(i),u=Ed(a),d=Z.useRef(null),f=od(t,e=>c(e)),p=Z.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;Z.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Qd(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Qd(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Qd(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),Z.useEffect(()=>{if(s){$d.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Vd,Ud);s.addEventListener(Vd,l),s.dispatchEvent(t),t.defaultPrevented||(Kd(nf(Jd(s)),{select:!0}),document.activeElement===e&&Qd(s))}return()=>{s.removeEventListener(Vd,l),setTimeout(()=>{let t=new CustomEvent(Hd,Ud);s.addEventListener(Hd,u),s.dispatchEvent(t),t.defaultPrevented||Qd(e??document.body,{select:!0}),s.removeEventListener(Hd,u),$d.remove(p)},0)}}},[s,l,u,p]);let m=Z.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=qd(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Qd(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Qd(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,Q.jsx)(wd.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});Gd.displayName=Wd;function Kd(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Qd(r,{select:t}),document.activeElement!==n)return}function qd(e){let t=Jd(e);return[Yd(t,e),Yd(t.reverse(),e)]}function Jd(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Yd(e,t){for(let n of e)if(!Xd(n,{upTo:t}))return n}function Xd(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function Zd(e){return e instanceof HTMLInputElement&&`select`in e}function Qd(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Zd(e)&&t&&e.select()}}var $d=ef();function ef(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=tf(e,t),e.unshift(t)},remove(t){e=tf(e,t),e[0]?.resume()}}}function tf(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function nf(e){return e.filter(e=>e.tagName!==`A`)}var rf=`Portal`,af=Z.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=Z.useState(!1);ud(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?_l.createPortal((0,Q.jsx)(wd.div,{...r,ref:t}),o):null});af.displayName=rf;function of(e,t){return Z.useReducer((e,n)=>t[e][n]??e,e)}var sf=e=>{let{present:t,children:n}=e,r=cf(t),i=typeof n==`function`?n({present:r.isPresent}):Z.Children.only(n),a=od(r.ref,uf(i));return typeof n==`function`||r.isPresent?Z.cloneElement(i,{ref:a}):null};sf.displayName=`Presence`;function cf(e){let[t,n]=Z.useState(),r=Z.useRef(null),i=Z.useRef(e),a=Z.useRef(`none`),[o,s]=of(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return Z.useEffect(()=>{let e=lf(r.current);a.current=o===`mounted`?e:`none`},[o]),ud(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=lf(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),ud(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=lf(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=lf(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:Z.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function lf(e){return e?.animationName||`none`}function uf(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var df=0;function ff(){Z.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??pf()),document.body.insertAdjacentElement(`beforeend`,e[1]??pf()),df++,()=>{df===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),df--}},[])}function pf(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var mf=function(){return mf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},mf.apply(this,arguments)};function hf(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function gf(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var _f=`right-scroll-bar-position`,vf=`width-before-scroll-bar`,yf=`with-scroll-bars-hidden`,bf=`--removed-body-scroll-bar-size`;function xf(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Sf(e,t){var n=(0,Z.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Cf=typeof window<`u`?Z.useLayoutEffect:Z.useEffect,wf=new WeakMap;function Tf(e,t){var n=Sf(t||null,function(t){return e.forEach(function(e){return xf(e,t)})});return Cf(function(){var t=wf.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||xf(e,null)}),i.forEach(function(e){r.has(e)||xf(e,a)})}wf.set(n,e)},[e]),n}function Ef(e){return e}function Df(e,t){t===void 0&&(t=Ef);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Of(e){e===void 0&&(e={});var t=Df(null);return t.options=mf({async:!0,ssr:!1},e),t}var kf=function(e){var t=e.sideCar,n=hf(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return Z.createElement(r,mf({},n))};kf.isSideCarExport=!0;function Af(e,t){return e.useMedium(t),kf}var jf=Of(),Mf=function(){},Nf=Z.forwardRef(function(e,t){var n=Z.useRef(null),r=Z.useState({onScrollCapture:Mf,onWheelCapture:Mf,onTouchMoveCapture:Mf}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=hf(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Tf([n,t]),C=mf(mf({},b),i);return Z.createElement(Z.Fragment,null,u&&Z.createElement(x,{sideCar:jf,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?Z.cloneElement(Z.Children.only(s),mf(mf({},C),{ref:S})):Z.createElement(v,mf({},C,{className:c,ref:S}),s))});Nf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Nf.classNames={fullWidth:vf,zeroRight:_f};var Pf,Ff=function(){if(Pf)return Pf;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function If(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Ff();return t&&e.setAttribute(`nonce`,t),e}function Lf(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Rf(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var zf=function(){var e=0,t=null;return{add:function(n){e==0&&(t=If())&&(Lf(t,n),Rf(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Bf=function(){var e=zf();return function(t,n){Z.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Vf=function(){var e=Bf();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Hf={left:0,top:0,right:0,gap:0},Uf=function(e){return parseInt(e||``,10)||0},Wf=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Uf(n),Uf(r),Uf(i)]},Gf=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Hf;var t=Wf(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Kf=Vf(),qf=`data-scroll-locked`,Jf=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
3
3
|
.${yf} {
|
|
4
4
|
overflow: hidden ${r};
|
|
5
5
|
padding-right: ${s}px ${r};
|
|
@@ -47,7 +47,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
47
47
|
[data-state=closed]
|
|
48
48
|
){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function Th(){let e=navigator.userAgent;return typeof window<`u`&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function Eh(){return jh(/^Mac/)}function Dh(){return jh(/^iPhone/)}function Oh(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function kh(){return jh(/^iPad/)||Eh()&&navigator.maxTouchPoints>1}function Ah(){return Dh()||kh()}function jh(e){return typeof window<`u`&&window.navigator!=null?e.test(window.navigator.platform):void 0}var Mh=24,Nh=typeof window<`u`?Z.useLayoutEffect:Z.useEffect;function Ph(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}var Fh=typeof document<`u`&&window.visualViewport;function Ih(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function Lh(e){for(Ih(e)&&(e=e.parentElement);e&&!Ih(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}var Rh=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]),zh=0,Bh;function Vh(e={}){let{isDisabled:t}=e;Nh(()=>{if(!t)return zh++,zh===1&&Ah()&&(Bh=Hh()),()=>{zh--,zh===0&&Bh?.()}},[t])}function Hh(){let e,t=0,n=n=>{e=Lh(n.target),!(e===document.documentElement&&e===document.body)&&(t=n.changedTouches[0].pageY)},r=n=>{if(!e||e===document.documentElement||e===document.body){n.preventDefault();return}let r=n.changedTouches[0].pageY,i=e.scrollTop,a=e.scrollHeight-e.clientHeight;a!==0&&((i<=0&&r>t||i>=a&&r<t)&&n.preventDefault(),t=r)},i=e=>{let t=e.target;Kh(t)&&t!==document.activeElement&&(e.preventDefault(),t.style.transform=`translateY(-2000px)`,t.focus(),requestAnimationFrame(()=>{t.style.transform=``}))},a=e=>{let t=e.target;Kh(t)&&(t.style.transform=`translateY(-2000px)`,requestAnimationFrame(()=>{t.style.transform=``,Fh&&(Fh.height<window.innerHeight?requestAnimationFrame(()=>{Gh(t)}):Fh.addEventListener(`resize`,()=>Gh(t),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},s=window.pageXOffset,c=window.pageYOffset,l=Ph(Uh(document.documentElement,`paddingRight`,`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let u=Ph(Wh(document,`touchstart`,n,{passive:!1,capture:!0}),Wh(document,`touchmove`,r,{passive:!1,capture:!0}),Wh(document,`touchend`,i,{passive:!1,capture:!0}),Wh(document,`focus`,a,!0),Wh(window,`scroll`,o));return()=>{l(),u(),window.scrollTo(s,c)}}function Uh(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Wh(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Gh(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let t=Lh(e);if(t!==document.documentElement&&t!==document.body&&t!==e){let n=t.getBoundingClientRect().top,r=e.getBoundingClientRect().top;e.getBoundingClientRect().bottom>t.getBoundingClientRect().bottom+Mh&&(t.scrollTop+=r-n)}e=t.parentElement}}function Kh(e){return e instanceof HTMLInputElement&&!Rh.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function qh(e,t){typeof e==`function`?e(t):e!=null&&(e.current=t)}function Jh(...e){return t=>e.forEach(e=>qh(e,t))}function Yh(...e){return Z.useCallback(Jh(...e),e)}var Xh=new WeakMap;function Zh(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([t,n])=>{if(t.startsWith(`--`)){e.style.setProperty(t,n);return}r[t]=e.style[t],e.style[t]=n}),!n&&Xh.set(e,r)}function Qh(e,t){if(!e||!(e instanceof HTMLElement))return;let n=Xh.get(e);n&&(e.style[t]=n[t])}var $h=e=>{switch(e){case`top`:case`bottom`:return!0;case`left`:case`right`:return!1;default:return e}};function eg(e,t){if(!e)return null;let n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform,i=r.match(/^matrix3d\((.+)\)$/);return i?parseFloat(i[1].split(`, `)[$h(t)?13:12]):(i=r.match(/^matrix\((.+)\)$/),i?parseFloat(i[1].split(`, `)[$h(t)?5:4]):null)}function tg(e){return 8*(Math.log(e+1)-2)}function ng(e,t){if(!e)return()=>{};let n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}var rg={DURATION:.5,EASE:[.32,.72,0,1]},ig=.4,ag=.25,og=100,sg=8,cg=16,lg=26,ug=`vaul-dragging`;function dg(e){let t=Z.useRef(e);return Z.useEffect(()=>{t.current=e}),Z.useMemo(()=>(...e)=>t.current==null?void 0:t.current.call(t,...e),[])}function fg({defaultProp:e,onChange:t}){let n=Z.useState(e),[r]=n,i=Z.useRef(r),a=dg(t);return Z.useEffect(()=>{i.current!==r&&(a(r),i.current=r)},[r,i,a]),n}function pg({prop:e,defaultProp:t,onChange:n=()=>{}}){let[r,i]=fg({defaultProp:t,onChange:n}),a=e!==void 0,o=a?e:r,s=dg(n);return[o,Z.useCallback(t=>{if(a){let n=typeof t==`function`?t(e):t;n!==e&&s(n)}else i(t)},[a,e,i,s])]}function mg({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:i,fadeFromIndex:a,onSnapPointChange:o,direction:s=`bottom`,container:c,snapToSequentialPoint:l}){let[u,d]=pg({prop:e,defaultProp:n?.[0],onChange:t}),[f,p]=Z.useState(typeof window<`u`?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);Z.useEffect(()=>{function e(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let m=Z.useMemo(()=>u===n?.[n.length-1]||null,[n,u]),h=Z.useMemo(()=>n?.findIndex(e=>e===u)??null,[n,u]),g=n&&n.length>0&&(a||a===0)&&!Number.isNaN(a)&&n[a]===u||!n,_=Z.useMemo(()=>{let e=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<`u`?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};return n?.map(t=>{let n=typeof t==`string`,r=0;if(n&&(r=parseInt(t,10)),$h(s)){let i=n?r:f?t*e.height:0;return f?s===`bottom`?e.height-i:-e.height+i:i}let i=n?r:f?t*e.width:0;return f?s===`right`?e.width-i:-e.width+i:i})??[]},[n,f,c]),v=Z.useMemo(()=>h===null?null:_?.[h],[_,h]),y=Z.useCallback(e=>{let t=_?.findIndex(t=>t===e)??null;o(t),Zh(r.current,{transition:`transform ${rg.DURATION}s cubic-bezier(${rg.EASE.join(`,`)})`,transform:$h(s)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`}),_&&t!==_.length-1&&a!==void 0&&t!==a&&t<a?Zh(i.current,{transition:`opacity ${rg.DURATION}s cubic-bezier(${rg.EASE.join(`,`)})`,opacity:`0`}):Zh(i.current,{transition:`opacity ${rg.DURATION}s cubic-bezier(${rg.EASE.join(`,`)})`,opacity:`1`}),d(n?.[Math.max(t,0)])},[r.current,n,_,a,i,d]);Z.useEffect(()=>{if(u||e){let t=n?.findIndex(t=>t===e||t===u)??-1;_&&t!==-1&&typeof _[t]==`number`&&y(_[t])}},[u,e,n,_,y]);function b({draggedDistance:e,closeDrawer:t,velocity:r,dismissible:o}){if(a===void 0)return;let c=s===`bottom`||s===`right`?(v??0)-e:(v??0)+e,u=h===a-1,d=h===0,f=e>0;if(u&&Zh(i.current,{transition:`opacity ${rg.DURATION}s cubic-bezier(${rg.EASE.join(`,`)})`}),!l&&r>2&&!f){o?t():y(_[0]);return}if(!l&&r>2&&f&&_&&n){y(_[n.length-1]);return}let p=_?.reduce((e,t)=>typeof e!=`number`||typeof t!=`number`?e:Math.abs(t-c)<Math.abs(e-c)?t:e),g=$h(s)?window.innerHeight:window.innerWidth;if(r>ig&&Math.abs(e)<g*.4){let e=f?1:-1;if(e>0&&m&&n){y(_[n.length-1]);return}if(d&&e<0&&o&&t(),h===null)return;y(_[h+e]);return}y(p)}function x({draggedDistance:e}){if(v===null)return;let t=s===`bottom`||s===`right`?v-e:v+e;(s===`bottom`||s===`right`)&&t<_[_.length-1]||(s===`top`||s===`left`)&&t>_[_.length-1]||Zh(r.current,{transform:$h(s)?`translate3d(0, ${t}px, 0)`:`translate3d(${t}px, 0, 0)`})}function S(e,t){if(!n||typeof h!=`number`||!_||a===void 0)return null;let r=h===a-1;if(h>=a&&t)return 0;if(r&&!t)return 1;if(!g&&!r)return null;let i=r?h+1:h-1,o=r?_[i]-_[i-1]:_[i+1]-_[i],s=e/Math.abs(o);return r?1-s:s}return{isLastSnapPoint:m,activeSnapPoint:u,shouldFade:g,getPercentageDragged:S,setActiveSnapPoint:d,activeSnapPointIndex:h,onRelease:b,onDrag:x,snapPointsOffset:_}}function hg(){let{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:i}=wh(),a=Z.useRef(null),o=(0,Z.useMemo)(()=>document.body.style.backgroundColor,[]);function s(){return(window.innerWidth-lg)/window.innerWidth}Z.useEffect(()=>{if(t&&n){a.current&&clearTimeout(a.current);let t=document.querySelector(`[data-vaul-drawer-wrapper]`)||document.querySelector(`[vaul-drawer-wrapper]`);if(!t)return;r&&!i&&ng(document.body,{background:`black`}),ng(t,{transformOrigin:$h(e)?`top`:`left`,transitionProperty:`transform, border-radius`,transitionDuration:`${rg.DURATION}s`,transitionTimingFunction:`cubic-bezier(${rg.EASE.join(`,`)})`});let n=ng(t,{borderRadius:`${sg}px`,overflow:`hidden`,...$h(e)?{transform:`scale(${s()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${s()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{n(),a.current=window.setTimeout(()=>{o?document.body.style.background=o:document.body.style.removeProperty(`background`)},rg.DURATION*1e3)}}},[t,n,o])}var gg=null;function _g({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:i,noBodyStyles:a}){let[o,s]=Z.useState(()=>typeof window<`u`?window.location.href:``),c=Z.useRef(0),l=Z.useCallback(()=>{if(Oh()&&gg===null&&e&&!a){gg={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:`unset`};let{scrollX:e,innerHeight:t}=window;document.body.style.setProperty(`position`,`fixed`,`important`),Object.assign(document.body.style,{top:`${-c.current}px`,left:`${-e}px`,right:`0px`,height:`auto`}),window.setTimeout(()=>window.requestAnimationFrame(()=>{let e=t-window.innerHeight;e&&c.current>=t&&(document.body.style.top=`${-(c.current+e)}px`)}),300)}},[e]),u=Z.useCallback(()=>{if(Oh()&&gg!==null&&!a){let e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);Object.assign(document.body.style,gg),window.requestAnimationFrame(()=>{if(i&&o!==window.location.href){s(window.location.href);return}window.scrollTo(t,e)}),gg=null}},[o]);return Z.useEffect(()=>{function e(){c.current=window.scrollY}return e(),window.addEventListener(`scroll`,e),()=>{window.removeEventListener(`scroll`,e)}},[]),Z.useEffect(()=>{if(t)return()=>{typeof document>`u`||document.querySelector(`[data-vaul-drawer]`)||u()}},[t,u]),Z.useEffect(()=>{n||!r||(e?(!window.matchMedia(`(display-mode: standalone)`).matches&&l(),t||window.setTimeout(()=>{u()},500)):u())},[e,r,o,t,n,l,u]),{restorePositionSetting:u}}function vg({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:i,snapPoints:a,shouldScaleBackground:o=!1,setBackgroundColorOnScale:s=!0,closeThreshold:c=ag,scrollLockTimeout:l=og,dismissible:u=!0,handleOnly:d=!1,fadeFromIndex:f=a&&a.length-1,activeSnapPoint:p,setActiveSnapPoint:m,fixed:h,modal:g=!0,onClose:_,nested:v,noBodyStyles:y=!1,direction:b=`bottom`,defaultOpen:x=!1,disablePreventScroll:S=!0,snapToSequentialPoint:C=!1,preventScrollRestoration:w=!1,repositionInputs:T=!0,onAnimationEnd:E,container:D,autoFocus:O=!1}){let[k=!1,A]=pg({defaultProp:x,prop:e,onChange:e=>{t?.(e),!e&&!v&&ue(),setTimeout(()=>{E?.(e)},rg.DURATION*1e3),e&&!g&&typeof window<`u`&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents=`auto`}),e||(document.body.style.pointerEvents=`auto`)}}),[j,M]=Z.useState(!1),[N,P]=Z.useState(!1),[F,I]=Z.useState(!1),L=Z.useRef(null),R=Z.useRef(null),z=Z.useRef(null),B=Z.useRef(null),V=Z.useRef(null),H=Z.useRef(!1),U=Z.useRef(null),W=Z.useRef(0),ee=Z.useRef(!1),G=Z.useRef(!x),te=Z.useRef(0),K=Z.useRef(null),q=Z.useRef(K.current?.getBoundingClientRect().height||0),J=Z.useRef(K.current?.getBoundingClientRect().width||0),ne=Z.useRef(0),{activeSnapPoint:Y,activeSnapPointIndex:re,setActiveSnapPoint:ie,onRelease:ae,snapPointsOffset:oe,onDrag:se,shouldFade:ce,getPercentageDragged:le}=mg({snapPoints:a,activeSnapPointProp:p,setActiveSnapPointProp:m,drawerRef:K,fadeFromIndex:f,overlayRef:L,onSnapPointChange:Z.useCallback(e=>{a&&e===oe.length-1&&(R.current=new Date)},[]),direction:b,container:D,snapToSequentialPoint:C});Vh({isDisabled:!k||N||!g||F||!j||!T||!S});let{restorePositionSetting:ue}=_g({isOpen:k,modal:g,nested:v??!1,hasBeenOpened:j,preventScrollRestoration:w,noBodyStyles:y});function de(){return(window.innerWidth-lg)/window.innerWidth}function fe(e){!u&&!a||K.current&&!K.current.contains(e.target)||(q.current=K.current?.getBoundingClientRect().height||0,J.current=K.current?.getBoundingClientRect().width||0,P(!0),z.current=new Date,Ah()&&window.addEventListener(`touchend`,()=>H.current=!1,{once:!0}),e.target.setPointerCapture(e.pointerId),W.current=$h(b)?e.pageY:e.pageX)}function pe(e,t){let n=e,r=window.getSelection()?.toString(),i=K.current?eg(K.current,b):null,a=new Date;if(n.tagName===`SELECT`||n.hasAttribute(`data-vaul-no-drag`)||n.closest(`[data-vaul-no-drag]`))return!1;if(b===`right`||b===`left`)return!0;if(R.current&&a.getTime()-R.current.getTime()<500)return!1;if(i!==null&&(b===`bottom`?i>0:i<0))return!0;if(r&&r.length>0)return!1;if(V.current&&a.getTime()-V.current.getTime()<l&&i===0||t)return V.current=a,!1;for(;n;){if(n.scrollHeight>n.clientHeight){if(n.scrollTop!==0)return V.current=new Date,!1;if(n.getAttribute(`role`)===`dialog`)return!0}n=n.parentNode}return!0}function me(e){if(K.current&&N){let t=b===`bottom`||b===`right`?1:-1,n=(W.current-($h(b)?e.pageY:e.pageX))*t,i=n>0,s=a&&!u&&!i;if(s&&re===0)return;let c=Math.abs(n),l=document.querySelector(`[data-vaul-drawer-wrapper]`),d=c/(b===`bottom`||b===`top`?q.current:J.current),p=le(c,i);if(p!==null&&(d=p),s&&d>=1||!H.current&&!pe(e.target,i))return;if(K.current.classList.add(ug),H.current=!0,Zh(K.current,{transition:`none`}),Zh(L.current,{transition:`none`}),a&&se({draggedDistance:n}),i&&!a){let e=tg(n),r=Math.min(e*-1,0)*t;Zh(K.current,{transform:$h(b)?`translate3d(0, ${r}px, 0)`:`translate3d(${r}px, 0, 0)`});return}let m=1-d;if((ce||f&&re===f-1)&&(r?.(e,d),Zh(L.current,{opacity:`${m}`,transition:`none`},!0)),l&&L.current&&o){let e=Math.min(de()+d*(1-de()),1),t=8-d*8,n=Math.max(0,14-d*14);Zh(l,{borderRadius:`${t}px`,transform:$h(b)?`scale(${e}) translate3d(0, ${n}px, 0)`:`scale(${e}) translate3d(${n}px, 0, 0)`,transition:`none`},!0)}if(!a){let e=c*t;Zh(K.current,{transform:$h(b)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})}}}Z.useEffect(()=>{window.requestAnimationFrame(()=>{G.current=!0})},[]),Z.useEffect(()=>{var e;function t(){if(!K.current||!T)return;let e=document.activeElement;if(Kh(e)||ee.current){let e=window.visualViewport?.height||0,t=window.innerHeight,n=t-e,r=K.current.getBoundingClientRect().height||0,i=r>t*.8;ne.current||=r;let o=K.current.getBoundingClientRect().top;if(Math.abs(te.current-n)>60&&(ee.current=!ee.current),a&&a.length>0&&oe&&re){let e=oe[re]||0;n+=e}if(te.current=n,r>e||ee.current){let t=K.current.getBoundingClientRect().height,r=t;t>e&&(r=e-(i?o:lg)),h?K.current.style.height=`${t-Math.max(n,0)}px`:K.current.style.height=`${Math.max(r,e-o)}px`}else Th()||(K.current.style.height=`${ne.current}px`);a&&a.length>0&&!ee.current?K.current.style.bottom=`0px`:K.current.style.bottom=`${Math.max(n,0)}px`}}return(e=window.visualViewport)==null||e.addEventListener(`resize`,t),()=>window.visualViewport?.removeEventListener(`resize`,t)},[re,a,oe]);function he(e){_e(),_?.(),e||A(!1),setTimeout(()=>{a&&ie(a[0])},rg.DURATION*1e3)}function ge(){if(!K.current)return;let e=document.querySelector(`[data-vaul-drawer-wrapper]`),t=eg(K.current,b);Zh(K.current,{transform:`translate3d(0, 0, 0)`,transition:`transform ${rg.DURATION}s cubic-bezier(${rg.EASE.join(`,`)})`}),Zh(L.current,{transition:`opacity ${rg.DURATION}s cubic-bezier(${rg.EASE.join(`,`)})`,opacity:`1`}),o&&t&&t>0&&k&&Zh(e,{borderRadius:`${sg}px`,overflow:`hidden`,...$h(b)?{transform:`scale(${de()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:`top`}:{transform:`scale(${de()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:`left`},transitionProperty:`transform, border-radius`,transitionDuration:`${rg.DURATION}s`,transitionTimingFunction:`cubic-bezier(${rg.EASE.join(`,`)})`},!0)}function _e(){!N||!K.current||(K.current.classList.remove(ug),H.current=!1,P(!1),B.current=new Date)}function ve(e){if(!N||!K.current)return;K.current.classList.remove(ug),H.current=!1,P(!1),B.current=new Date;let t=eg(K.current,b);if(!e||!pe(e.target,!1)||!t||Number.isNaN(t)||z.current===null)return;let n=B.current.getTime()-z.current.getTime(),r=W.current-($h(b)?e.pageY:e.pageX),o=Math.abs(r)/n;if(o>.05&&(I(!0),setTimeout(()=>{I(!1)},200)),a){ae({draggedDistance:r*(b===`bottom`||b===`right`?1:-1),closeDrawer:he,velocity:o,dismissible:u}),i?.(e,!0);return}if(b===`bottom`||b===`right`?r>0:r<0){ge(),i?.(e,!0);return}if(o>ig){he(),i?.(e,!1);return}let s=Math.min(K.current.getBoundingClientRect().height??0,window.innerHeight),l=Math.min(K.current.getBoundingClientRect().width??0,window.innerWidth);if(Math.abs(t)>=(b===`left`||b===`right`?l:s)*c){he(),i?.(e,!1);return}i?.(e,!0),ge()}Z.useEffect(()=>(k&&(Zh(document.documentElement,{scrollBehavior:`auto`}),R.current=new Date),()=>{Qh(document.documentElement,`scrollBehavior`)}),[k]);function ye(e){let t=e?(window.innerWidth-cg)/window.innerWidth:1,n=e?-cg:0;U.current&&window.clearTimeout(U.current),Zh(K.current,{transition:`transform ${rg.DURATION}s cubic-bezier(${rg.EASE.join(`,`)})`,transform:$h(b)?`scale(${t}) translate3d(0, ${n}px, 0)`:`scale(${t}) translate3d(${n}px, 0, 0)`}),!e&&K.current&&(U.current=setTimeout(()=>{let e=eg(K.current,b);Zh(K.current,{transition:`none`,transform:$h(b)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})},500))}function be(e,t){if(t<0)return;let n=(window.innerWidth-cg)/window.innerWidth,r=n+t*(1-n),i=-cg+t*cg;Zh(K.current,{transform:$h(b)?`scale(${r}) translate3d(0, ${i}px, 0)`:`scale(${r}) translate3d(${i}px, 0, 0)`,transition:`none`})}function xe(e,t){let n=$h(b)?window.innerHeight:window.innerWidth,r=t?(n-cg)/n:1,i=t?-cg:0;t&&Zh(K.current,{transition:`transform ${rg.DURATION}s cubic-bezier(${rg.EASE.join(`,`)})`,transform:$h(b)?`scale(${r}) translate3d(0, ${i}px, 0)`:`scale(${r}) translate3d(${i}px, 0, 0)`})}return Z.useEffect(()=>{g||window.requestAnimationFrame(()=>{document.body.style.pointerEvents=`auto`})},[g]),Z.createElement(um,{defaultOpen:x,onOpenChange:e=>{!u&&!e||(e?M(!0):he(!0),A(e))},open:k},Z.createElement(Ch.Provider,{value:{activeSnapPoint:Y,snapPoints:a,setActiveSnapPoint:ie,drawerRef:K,overlayRef:L,onOpenChange:t,onPress:fe,onRelease:ve,onDrag:me,dismissible:u,shouldAnimate:G,handleOnly:d,isOpen:k,isDragging:N,shouldFade:ce,closeDrawer:he,onNestedDrag:be,onNestedOpenChange:ye,onNestedRelease:xe,keyboardIsOpen:ee,modal:g,snapPointsOffset:oe,activeSnapPointIndex:re,direction:b,shouldScaleBackground:o,setBackgroundColorOnScale:s,noBodyStyles:y,container:D,autoFocus:O}},n))}var yg=Z.forwardRef(function({...e},t){let{overlayRef:n,snapPoints:r,onRelease:i,shouldFade:a,isOpen:o,modal:s,shouldAnimate:c}=wh(),l=Yh(t,n),u=r&&r.length>0;if(!s)return null;let d=Z.useCallback(e=>i(e),[i]);return Z.createElement(pm,{onMouseUp:d,ref:l,"data-vaul-overlay":``,"data-vaul-snap-points":o&&u?`true`:`false`,"data-vaul-snap-points-overlay":o&&a?`true`:`false`,"data-vaul-animate":c?.current?`true`:`false`,...e})});yg.displayName=`Drawer.Overlay`;var bg=Z.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},i){let{drawerRef:a,onPress:o,onRelease:s,onDrag:c,keyboardIsOpen:l,snapPointsOffset:u,activeSnapPointIndex:d,modal:f,isOpen:p,direction:m,snapPoints:h,container:g,handleOnly:_,shouldAnimate:v,autoFocus:y}=wh(),[b,x]=Z.useState(!1),S=Yh(i,a),C=Z.useRef(null),w=Z.useRef(null),T=Z.useRef(!1),E=h&&h.length>0;hg();let D=(e,t,n=0)=>{if(T.current)return!0;let r=Math.abs(e.y),i=Math.abs(e.x),a=i>r,o=[`bottom`,`right`].includes(t)?1:-1;if(t===`left`||t===`right`){if(!(e.x*o<0)&&i>=0&&i<=n)return a}else if(!(e.y*o<0)&&r>=0&&r<=n)return!a;return T.current=!0,!0};Z.useEffect(()=>{E&&window.requestAnimationFrame(()=>{x(!0)})},[]);function O(e){C.current=null,T.current=!1,s(e)}return Z.createElement(mm,{"data-vaul-drawer-direction":m,"data-vaul-drawer":``,"data-vaul-delayed-snap-points":b?`true`:`false`,"data-vaul-snap-points":p&&E?`true`:`false`,"data-vaul-custom-container":g?`true`:`false`,"data-vaul-animate":v?.current?`true`:`false`,...r,ref:S,style:u&&u.length>0?{"--snap-point-height":`${u[d??0]}px`,...t}:t,onPointerDown:e=>{_||(r.onPointerDown==null||r.onPointerDown.call(r,e),C.current={x:e.pageX,y:e.pageY},o(e))},onOpenAutoFocus:e=>{n?.(e),y||e.preventDefault()},onPointerDownOutside:t=>{if(e?.(t),!f||t.defaultPrevented){t.preventDefault();return}l.current&&=!1},onFocusOutside:e=>{if(!f){e.preventDefault();return}},onPointerMove:e=>{if(w.current=e,_||(r.onPointerMove==null||r.onPointerMove.call(r,e),!C.current))return;let t=e.pageY-C.current.y,n=e.pageX-C.current.x,i=e.pointerType===`touch`?10:2;D({x:n,y:t},m,i)?c(e):(Math.abs(n)>i||Math.abs(t)>i)&&(C.current=null)},onPointerUp:e=>{r.onPointerUp==null||r.onPointerUp.call(r,e),C.current=null,T.current=!1,s(e)},onPointerOut:e=>{r.onPointerOut==null||r.onPointerOut.call(r,e),O(w.current)},onContextMenu:e=>{r.onContextMenu==null||r.onContextMenu.call(r,e),w.current&&O(w.current)}})});bg.displayName=`Drawer.Content`;var xg=250,Sg=120,Cg=Z.forwardRef(function({preventCycle:e=!1,children:t,...n},r){let{closeDrawer:i,isDragging:a,snapPoints:o,activeSnapPoint:s,setActiveSnapPoint:c,dismissible:l,handleOnly:u,isOpen:d,onPress:f,onDrag:p}=wh(),m=Z.useRef(null),h=Z.useRef(!1);function g(){if(h.current){y();return}window.setTimeout(()=>{_()},Sg)}function _(){if(a||e||h.current){y();return}if(y(),!o||o.length===0){l||i();return}if(s===o[o.length-1]&&l){i();return}let t=o.findIndex(e=>e===s);if(t===-1)return;let n=o[t+1];c(n)}function v(){m.current=window.setTimeout(()=>{h.current=!0},xg)}function y(){m.current&&window.clearTimeout(m.current),h.current=!1}return Z.createElement(`div`,{onClick:g,onPointerCancel:y,onPointerDown:e=>{u&&f(e),v()},onPointerMove:e=>{u&&p(e)},ref:r,"data-vaul-drawer-visible":d?`true`:`false`,"data-vaul-handle":``,"aria-hidden":`true`,...n},Z.createElement(`span`,{"data-vaul-handle-hitarea":``,"aria-hidden":`true`},t))});Cg.displayName=`Drawer.Handle`;function wg({onDrag:e,onOpenChange:t,open:n,...r}){let{onNestedDrag:i,onNestedOpenChange:a,onNestedRelease:o}=wh();if(!i)throw Error(`Drawer.NestedRoot must be placed in another drawer`);return Z.createElement(vg,{nested:!0,open:n,onClose:()=>{a(!1)},onDrag:(t,n)=>{i(t,n),e?.(t,n)},onOpenChange:e=>{e&&a(e),t?.(e)},onRelease:o,...r})}function Tg(e){let t=wh(),{container:n=t.container,...r}=e;return Z.createElement(fm,{container:n,...r})}var Eg={Root:vg,NestedRoot:wg,Content:bg,Overlay:yg,Trigger:dm,Portal:Tg,Handle:Cg,Close:_m,Title:hm,Description:gm};function Dg(e){let t=(0,$.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({shouldScaleBackground:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let i=r===void 0?!1:r,a;return t[3]!==n||t[4]!==i?(a=(0,Q.jsx)(Eg.Root,{"data-slot":`drawer`,shouldScaleBackground:i,...n}),t[3]=n,t[4]=i,t[5]=a):a=t[5],a}function Og(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Q.jsx)(Eg.Portal,{"data-slot":`drawer-portal`,...n}),t[2]=n,t[3]=r),r}function kg(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`fixed inset-0 z-50 bg-black/40 supports-backdrop-filter:backdrop-blur-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(Eg.Overlay,{"data-slot":`drawer-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ag(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(kg,{}),t[4]=a):a=t[4];let o;t[5]===r?o=t[6]:(o=on(`fixed inset-x-0 bottom-0 z-50 flex max-h-[90svh] flex-col rounded-t-[20px] border border-border bg-popover text-sm text-popover-foreground shadow-lg outline-none`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(Eg.Handle,{"data-slot":`drawer-handle`,className:`mx-auto mt-3 h-1.5 w-12 shrink-0 rounded-full bg-muted-foreground/20`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==o?(c=(0,Q.jsxs)(Og,{children:[a,(0,Q.jsxs)(Eg.Content,{"data-slot":`drawer-content`,className:o,...i,children:[s,n]})]}),t[8]=n,t[9]=i,t[10]=o,t[11]=c):c=t[11],c}function jg(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`flex flex-col gap-1.5 px-4 pt-3 pb-2 text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`drawer-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Mg(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`mt-auto flex flex-col gap-2 p-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`drawer-footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ng(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`font-heading text-base font-medium`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(Eg.Title,{"data-slot":`drawer-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Pg(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`text-sm text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(Eg.Description,{"data-slot":`drawer-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Fg=`unknown`,Ig=!1;function Lg(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(`(pointer: fine)`).matches||window.matchMedia(`(any-pointer: fine)`).matches||window.matchMedia(`(hover: hover)`).matches||window.matchMedia(`(any-hover: hover)`).matches}function Rg(){typeof window>`u`||Ig||(Ig=!0,window.addEventListener(`keydown`,()=>{Fg=`keyboard`},!0),window.addEventListener(`pointerdown`,()=>{Fg=`pointer`},!0))}function zg(e){let t=(0,$.c)(2),n;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0],Z.useEffect(Bg,n),!e||Fg===`keyboard`)return!0;let r;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=Lg(),t[1]=r):r=t[1],r}function Bg(){Rg()}function Vg(e){return[e.title,e.description,...e.keywords??[]].join(` `)}function Hg(e){let t=(0,$.c)(31),{open:n,onOpenChange:r,commands:i,onCommandError:a}=e,[o,s]=Z.useState(``),c=Wl(),l=zg(c),u;if(t[0]!==i){let e=new Map;for(let t of i){let n=e.get(t.group);n?n.push(t):e.set(t.group,[t])}u=Array.from(e.entries()),t[0]=i,t[1]=u}else u=t[1];let d=u,f,p;t[2]!==n||t[3]!==o?(f=()=>{!n&&o&&s(``)},p=[n,o],t[2]=n,t[3]=o,t[4]=f,t[5]=p):(f=t[4],p=t[5]),Z.useEffect(f,p);let m;t[6]!==a||t[7]!==r?(m=e=>{r(!1),Promise.resolve(e.onSelect()).catch(e=>{a?.(e)})},t[6]=a,t[7]=r,t[8]=m):m=t[8];let h=m,g;t[9]!==o||t[10]!==l?(g=(0,Q.jsx)(gh,{autoFocus:l,value:o,onValueChange:s,placeholder:`Search commands`,className:`text-base md:text-sm`}),t[9]=o,t[10]=l,t[11]=g):g=t[11];let _;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(vh,{children:`No commands found.`}),t[12]=_):_=t[12];let v;t[13]!==d||t[14]!==h?(v=(0,Q.jsxs)(_h,{className:`max-h-none min-h-0 flex-1 md:max-h-[min(70vh,32rem)]`,children:[_,d.map(e=>{let[t,n]=e;return(0,Q.jsx)(yh,{heading:t,children:n.map(e=>(0,Q.jsxs)(bh,{value:Vg(e),onSelect:()=>h(e),children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,Q.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.description})]}),e.shortcut?(0,Q.jsx)(xh,{children:e.shortcut}):null]},e.id))},t)})]}),t[13]=d,t[14]=h,t[15]=v):v=t[15];let y;t[16]!==g||t[17]!==v?(y=(0,Q.jsxs)(mh,{shouldFilter:!0,loop:!0,className:`min-h-0 flex-1`,children:[g,v]}),t[16]=g,t[17]=v,t[18]=y):y=t[18];let b=y;if(c){let e;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(jg,{children:[(0,Q.jsx)(Ng,{children:`Command palette`}),(0,Q.jsx)(Pg,{children:`Search for commands and session actions.`})]}),t[19]=e):e=t[19];let i;t[20]===b?i=t[21]:(i=(0,Q.jsxs)(Ag,{className:`max-h-[90svh] overflow-hidden`,children:[e,(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-4 pb-4`,children:b})]}),t[20]=b,t[21]=i);let a;return t[22]!==r||t[23]!==n||t[24]!==l||t[25]!==i?(a=(0,Q.jsx)(Dg,{open:n,onOpenChange:r,autoFocus:l,children:i}),t[22]=r,t[23]=n,t[24]=l,t[25]=i,t[26]=a):a=t[26],a}let x;return t[27]!==b||t[28]!==r||t[29]!==n?(x=(0,Q.jsx)(hh,{open:n,onOpenChange:r,title:`Command palette`,description:`Search for commands and session actions.`,className:`sm:max-w-2xl`,initialFocus:!0,children:b}),t[27]=b,t[28]=r,t[29]=n,t[30]=x):x=t[30],x}function Ug(e){let t=(0,$.c)(25),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({ref:o,openStateRef:i,commands:n,getCommandsRef:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let[s,c]=Z.useState(!1),l;t[6]===n?l=t[7]:(l=()=>n??[],t[6]=n,t[7]=l);let[u,d]=Z.useState(l),f=Z.useRef(s),p;t[8]!==n||t[9]!==r?(p=()=>r?.current()??n??[],t[8]=n,t[9]=r,t[10]=p):p=t[10];let m=p,h;t[11]!==i||t[12]!==m?(h=e=>{f.current=e,i&&(i.current=e),e&&d(m()),c(e)},t[11]=i,t[12]=m,t[13]=h):h=t[13];let g=h,_;t[14]===g?_=t[15]:(_=()=>({open:()=>{g(!0)},close:()=>{g(!1)},isOpen:()=>f.current}),t[14]=g,t[15]=_);let v;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(v=[],t[16]=v):v=t[16],Z.useImperativeHandle(o,_,v);let y;t[17]!==s||t[18]!==u?(y=s?u:[],t[17]=s,t[18]=u,t[19]=y):y=t[19];let b;return t[20]!==s||t[21]!==a||t[22]!==g||t[23]!==y?(b=(0,Q.jsx)(Hg,{open:s,onOpenChange:g,commands:y,...a}),t[20]=s,t[21]=a,t[22]=g,t[23]=y,t[24]=b):b=t[24],b}function Wg(e){return!!(e&&typeof e==`object`&&e.ok===!1&&typeof e.error==`string`)}function Gg(e){return!!(e&&typeof e==`object`&&e.type===`state_sync`)}function Kg(e){return!!(e&&typeof e==`object`&&e.type===`sessions`)}function qg(e){return!!(e&&typeof e==`object`&&e.type===`session_status`)}function Jg(e){return!!(e&&typeof e==`object`&&e.type===`session_done`&&typeof e.id==`string`)}function pee(e){return!!(e&&typeof e==`object`&&e.type===`git_changed`&&typeof e.cwd==`string`)}function mee(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function hee(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function Yg(e,t){return!e&&!t?!0:!e||!t?!1:e.id===t.id&&e.provider===t.provider&&e.name===t.name&&!!e.reasoning==!!t.reasoning}function gee(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!Yg(e[n],t[n]))return!1;return!0}function _ee(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(!r||!i||r.name!==i.name||r.description!==i.description||r.scope!==i.scope||r.source!==i.source)return!1}return!0}function vee(e){let t=e?.statuses;if(!t||typeof t!=`object`)return{};let n={};for(let[e,r]of Object.entries(t))typeof r==`string`&&(n[e]=r);return n}function yee(e){return e.kind===`user`&&!e.queued&&e.streamingBehavior!==`followUp`&&e.streamingBehavior!==`steer`}function bee(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n){if(yee(n))return;if(n.kind===`assistant`)for(let e=n.blocks.length-1;e>=0;--e){let t=n.blocks[e];if(t?.type!==`thinking`)continue;let r=jn(t,{allowPlaceholder:!0});if(r)return r}}}}function xee(e,t){if(!t)return e;let n=vee(t),r=hee(e.statuses,n)?e.statuses:n,i={statuses:r,title:typeof t.title==`string`?t.title:void 0,editorText:typeof t.editorText==`string`?t.editorText:void 0,workingMessage:typeof t.workingMessage==`string`?t.workingMessage:void 0};return r===e.statuses&&e.title===i.title&&e.editorText===i.editorText&&e.workingMessage===i.workingMessage?e:i}function Xg(e,{contextId:t,sessionId:n,searchParams:r}){let i=new URL(e,window.location.origin);i.searchParams.set(`context`,t),n&&i.searchParams.set(`session`,n);for(let[e,t]of Object.entries(r??{})){if(Array.isArray(t)){for(let n of t)i.searchParams.append(e,String(n));continue}t!=null&&i.searchParams.set(e,String(t))}return i.toString()}async function Zg(e,t){let n=await fetch(e,t),r=await n.text(),i=r?JSON.parse(r):{};if(!n.ok){let e=Wg(i)?i.error:`${n.status} ${n.statusText}`;throw Error(e)}if(Wg(i))throw Error(i.error);return i}async function See(e){let t=await e.arrayBuffer(),n=new Uint8Array(t),r=``;for(let e of n)r+=String.fromCharCode(e);let i=window.btoa(r);return{type:`image`,mimeType:e.type||`image/png`,data:i,previewUrl:ht({mimeType:e.type||`image/png`,data:i})}}function Cee(e){return e.kind===`user`?!!e.pendingId||!!e.queued:e.kind===`assistant`&&e.streaming&&e.blocks.length===0}function wee(e,t){if(!t)return e;let n=e.filter(e=>!Cee(e)),r=Number.isInteger(t.previousLength)?t.previousLength:n.length,i=Number.isInteger(t.start)?t.start:-1,a=Number.isInteger(t.deleteCount)?t.deleteCount:-1,o=Array.isArray(t.items)?t.items:null;if(i<0||i>n.length||a<0||!o)return e;let s=r===n.length&&i+a<=n.length?a:Math.min(a,n.length-i);return[...n.slice(0,i),...o,...n.slice(i+s)]}function Tee(e,t){let n=typeof t.sessionKey==`string`&&t.sessionKey!==(e.sessionKey||``),r=n?{...sn(),connected:e.connected}:e,i=S({cwd:typeof t.cwd==`string`?t.cwd:e.cwd}),a=n&&e.sessionKey===`optimistic:${i}`?e.items:r.items,o=typeof t.streaming==`boolean`?t.streaming:r.streaming,s=typeof t.compacting==`boolean`?t.compacting:r.compacting,c=typeof t.draft==`boolean`?t.draft:r.draft,l=t.itemsPatch?{...t,draft:c,streaming:o,items:wee(a,t.itemsPatch)}:{...t,draft:c,streaming:o},u=Array.isArray(t.messages)?t.messages:r.messages,{items:d}=st(l,a),f=typeof t.historyOffset==`number`?t.historyOffset:r.historyOffset,p=typeof t.historyTotalCount==`number`?t.historyTotalCount:r.historyTotalCount,m=typeof t.sessionKey==`string`?t.sessionKey:r.sessionKey,h=Object.prototype.hasOwnProperty.call(t,`sessionId`)?t.sessionId:r.sessionId,g=Object.prototype.hasOwnProperty.call(t,`sessionName`)?t.sessionName:r.sessionName,_=Object.prototype.hasOwnProperty.call(t,`firstMessage`)?t.firstMessage||``:r.firstMessage,v=Object.prototype.hasOwnProperty.call(t,`sessionFile`)?t.sessionFile:r.sessionFile,y=Object.prototype.hasOwnProperty.call(t,`cwd`)?t.cwd:r.cwd,b=Object.prototype.hasOwnProperty.call(t,`modified`)?t.modified:r.modified,x=Object.prototype.hasOwnProperty.call(t,`model`)?Yg(r.model,t.model)?r.model:t.model:r.model,C=Object.prototype.hasOwnProperty.call(t,`thinkingLevel`)&&t.thinkingLevel||r.thinkingLevel,w=t.availableThinkingLevels?mee(r.availableThinkingLevels,t.availableThinkingLevels)?r.availableThinkingLevels:t.availableThinkingLevels:r.availableThinkingLevels,T=t.availableModels?gee(r.availableModels,t.availableModels)?r.availableModels:t.availableModels:r.availableModels,E=t.availableSkills?_ee(r.availableSkills,t.availableSkills)?r.availableSkills:t.availableSkills:r.availableSkills,D=typeof t.hideThinkingBlock==`boolean`?t.hideThinkingBlock:r.hideThinkingBlock,O=Object.prototype.hasOwnProperty.call(t,`contextUsage`)?Yt(r.contextUsage,t.contextUsage)?r.contextUsage:t.contextUsage:r.contextUsage,k=xee(r.uiState,t.uiState),A=o&&D?bee(d):void 0;return e.connected&&!e.replaying&&e.streaming===o&&e.compacting===s&&e.draft===c&&e.messages===u&&e.items===d&&e.historyOffset===f&&e.historyTotalCount===p&&e.sessionId===h&&e.sessionKey===m&&e.sessionName===g&&e.firstMessage===_&&e.sessionFile===v&&e.cwd===y&&e.modified===b&&e.model===x&&e.thinkingLevel===C&&e.availableThinkingLevels===w&&e.availableModels===T&&e.availableSkills===E&&e.hideThinkingBlock===D&&e.hiddenThinkingPreview===A&&e.contextUsage===O&&e.uiState===k?e:{...r,connected:!0,replaying:!1,streaming:o,compacting:s,draft:c,messages:u,items:d,historyOffset:f,historyTotalCount:p,sessionId:h,sessionKey:m,sessionName:g,firstMessage:_,sessionFile:v,cwd:y,modified:b,model:x,thinkingLevel:C,availableThinkingLevels:w,availableModels:T,availableSkills:E,hideThinkingBlock:D,hiddenThinkingPreview:A,contextUsage:O,uiState:k}}function Qg(e){return ri(e,{useSymbols:!0})}function $g(e,t){return ii(e,t)}function e_(e){return e.replace(/^\/Users\/[^/]+(?=\/|$)/,`~`).replace(/^\/home\/[^/]+(?=\/|$)/,`~`)}function Eee(e){let t=new Set,n=[];for(let r of e){let e=r.trim();!e||t.has(e)||(t.add(e),n.push(e))}return n}function Dee(e,t=Date.now()){if(!e)return``;let n=new Date(e).getTime();if(Number.isNaN(n))return``;let r=t-n,i=r>=0,a=Math.max(1,Math.floor(Math.abs(r)/1e3)),o=i?`ago`:`from now`;if(a<60)return`${a}s ${o}`;let s=Math.floor(a/60);if(s<60)return`${s}m ${o}`;let c=Math.floor(s/60);if(c<24)return`${c}h ${o}`;let l=Math.floor(c/24);if(l<7)return`${l}d ${o}`;let u=Math.floor(l/7);if(u<5)return`${u}w ${o}`;let d=Math.floor(l/30);if(d<12)return`${Math.max(1,d)}mo ${o}`;let f=Math.floor(l/365);return`${Math.max(1,f)}y ${o}`}function t_(e){if(typeof e!=`number`||!Number.isFinite(e)||e<0)return``;let t=Math.floor(e);return`${t.toLocaleString()} msg${t===1?``:`s`}`}function n_(e){let t=e.lastUserMessageAt||e.modified;if(!t)return 0;let n=new Date(t).getTime();return Number.isNaN(n)?0:n}function Oee(e,t){let n=e.path?`path:${e.path}`:``,r=e.id?`id:${e.id}`:``;return(n?t[n]:void 0)||(r?t[r]:void 0)}function kee(e,t){let n=e.path?t[e.path]:void 0;return!n||e.title===n?e:{...e,name:n,title:n}}function Aee(e,t){if(!t)return e;let n=typeof t.streaming==`boolean`?t.streaming:e.streaming,r=typeof t.unread==`boolean`?t.unread:e.unread;return!!e.streaming==!!n&&!!e.unread==!!r?e:{...e,streaming:n,unread:r}}function jee(e,t){return[e.title,e.name,e.path,e.cwd,t,t_(e.messageCount)].filter(Boolean)}function r_(e,t,n){return!!(e.id&&t&&e.id===t||e.path&&n&&e.path===n)}function Mee(e,t){return Zg(Xg(`/api/directory-sessions-indexes`,{contextId:e,searchParams:{directory:t}}))}function i_(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(hn,{children:n}),t[0]=n,t[1]=r),r}function Nee(e){let t=(0,$.c)(89),{open:n,onOpenChange:i,viewerContextId:a,currentDirectory:o,knownDirectories:s,directorySessionsByPath:c,sessionStatusByKey:l,activeSessionId:d,activeSessionPath:f,onSelectSession:p,onRenameSession:m,onDeleteSession:h,onError:g}=e,_=Wl(),v=zg(_),[y,b]=Z.useState(``),[x,S]=Z.useState(`current`),[C,w]=Z.useState(`browse`),[T,E]=Z.useState(``),[D,O]=Z.useState(``),k;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(k={},t[0]=k):k=t[0];let[A,j]=Z.useState(k),M;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(M={},t[1]=M):M=t[1];let[N,P]=Z.useState(M),F;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(F={},t[2]=F):F=t[2];let[I,L]=Z.useState(F),R=o.trim(),z=Eee([R,...s,...Object.keys(c)]),B=R?[R]:z.slice(0,1),V=x===`all`?z:B,H={...N,...c},U=V.map(e=>({directory:e,sessions:(H[e]||[]).map(e=>kee(Aee(e,Oee(e,l)),A)),loading:!!I[e]})),W=U.flatMap(Lee),ee=[...W].sort(Iee),G=T?W.find(e=>e.key===T)?.entry:void 0,te=U.some(Fee),K,q;t[3]!==n||t[4]!==y?(K=()=>{if(!n){y&&b(``),S(`current`),w(`browse`),O(``);return}},q=[n,y],t[3]=n,t[4]=y,t[5]=K,t[6]=q):(K=t[5],q=t[6]),Z.useEffect(K,q),Z.useEffect(()=>{if(!n||!a||V.length===0)return;let e=V.filter(e=>!Object.prototype.hasOwnProperty.call(H,e)&&!I[e]);e.length!==0&&(L(t=>{let n={...t};for(let t of e)n[t]=!0;return n}),Mee(a,e).then(t=>{t.ok&&P(n=>{let r={...n};for(let n of e)r[n]=t.directoryIndexes[n]?.sessions||[];return r})}).catch(e=>{g?.(e)}).finally(()=>{L(t=>{let n={...t};for(let t of e)delete n[t];return n})}))},[I,H,g,n,V,a]),Z.useEffect(()=>{n&&(W.some(e=>e.key===T)||(C!==`browse`&&(w(`browse`),O(``)),E(W.find(e=>r_(e.entry,d,f))?.key||W[0]?.key||``)))},[d,f,W,n,T,C]);let J;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>{S(Pee)},t[7]=J):J=t[7];let ne=J,Y;t[8]!==i||t[9]!==p?(Y=e=>{e.id&&(i(!1),p(e.id,{sessionPath:e.path}))},t[8]=i,t[9]=p,t[10]=Y):Y=t[10];let re=Y,ie=()=>{G?.path&&(O(G.title),w(`rename`))},ae=async()=>{let e=G?.path,t=D.trim();e&&await Promise.resolve(m(e,t))!==!1&&(j(n=>({...n,[e]:t})),w(`browse`))},oe=()=>{G?.path&&w(`delete`)},se=async()=>{let e=G?.path;if(!G||!e)return;let t={...G,path:e};await Promise.resolve(h([t]))!==!1&&(P(t=>{let n={},r=!1;for(let[i,a]of Object.entries(t)){let t=a.filter(t=>t.path!==e);n[i]=t,t.length!==a.length&&(r=!0)}return r?n:t}),j(t=>{if(!Object.prototype.hasOwnProperty.call(t,e))return t;let n={...t};return delete n[e],n}),E(``),w(`browse`))},ce;t[11]!==oe||t[12]!==ie?(ce=e=>{if(e.key.toLowerCase()===`tab`){e.preventDefault(),ne();return}if($g(e.nativeEvent,`Control+R`)){e.preventDefault(),ie();return}$g(e.nativeEvent,`Control+D`)&&(e.preventDefault(),oe())},t[11]=oe,t[12]=ie,t[13]=ce):ce=t[13];let le=ce,ue=mh,de=x===`all`?`Search all sessions`:`Search sessions`,fe;t[14]!==y||t[15]!==v||t[16]!==de?(fe=(0,Q.jsx)(gh,{autoFocus:v,value:y,onValueChange:b,placeholder:de,className:`text-base md:text-sm`}),t[14]=y,t[15]=v,t[16]=de,t[17]=fe):fe=t[17];let pe=_h,me=te?`Loading sessions…`:`No sessions found.`,he;t[18]===me?he=t[19]:(he=(0,Q.jsx)(vh,{children:me}),t[18]=me,t[19]=he);let ge=yh,_e=`${x===`all`?`All sessions`:`Current directory · ${e_(B[0]||``)}`}${te?` · loading`:``}`,ve=te&&ee.length===0?(0,Q.jsxs)(bh,{value:`loading:sessions`,disabled:!0,children:[(0,Q.jsx)(Le,{className:`size-3.5 text-primary`}),(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Loading sessions…`})]}):null,ye;t[20]!==d||t[21]!==f||t[22]!==re?(ye=e=>{let{directory:t,entry:n}=e,r=u(n),i=Dee(n.lastUserMessageAt||n.modified),a=t_(n.messageCount),o=r_(n,d,f),s=!!n.unread&&!n.streaming;return(0,Q.jsxs)(bh,{value:r,keywords:jee(n,t),onSelect:()=>re(n),className:`items-start py-2`,children:[(0,Q.jsx)(`span`,{className:`mt-0.5 flex size-4 shrink-0 items-center justify-center`,children:n.streaming?(0,Q.jsx)(Le,{className:`size-3.5 text-primary`,"aria-label":`Session streaming`}):s?(0,Q.jsx)(`span`,{className:`size-2 rounded-full bg-primary`,"aria-label":`Session done`}):null}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`truncate font-medium`,children:n.title}),(0,Q.jsx)(`span`,{className:`line-clamp-1 text-xs text-muted-foreground`,children:e_(n.cwd||t)}),i||a?(0,Q.jsxs)(`span`,{className:`truncate text-[11px] text-muted-foreground/70`,children:[i,i&&a?` · `:null,a]}):null]}),(0,Q.jsx)(xh,{className:on(`shrink-0 tracking-normal normal-case`,!o&&`opacity-0`),children:`Current`})]},r)},t[20]=d,t[21]=f,t[22]=re,t[23]=ye):ye=t[23];let be=ee.map(ye),xe;t[24]!==ge||t[25]!==_e||t[26]!==ve||t[27]!==be?(xe=(0,Q.jsxs)(ge,{heading:_e,children:[ve,be]}),t[24]=ge,t[25]=_e,t[26]=ve,t[27]=be,t[28]=xe):xe=t[28];let Se;t[29]!==pe||t[30]!==he||t[31]!==xe?(Se=(0,Q.jsxs)(pe,{className:`max-h-none min-h-0 flex-1 md:max-h-[min(70vh,32rem)]`,children:[he,xe]}),t[29]=pe,t[30]=he,t[31]=xe,t[32]=Se):Se=t[32];let Ce;t[33]!==_||t[34]!==x?(Ce=_?null:(0,Q.jsxs)(`div`,{className:`hidden flex-wrap items-center gap-x-3 gap-y-1 border-t border-border/70 px-3 py-2 text-xs text-muted-foreground md:flex`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(i_,{children:`Tab`}),x===`all`?`Current directory`:`All sessions`]}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(i_,{children:`Enter`}),` Switch`]}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(i_,{children:Qg(`Control+R`)}),` Rename`]}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(i_,{children:Qg(`Control+D`)}),` Delete`]}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(i_,{children:`Esc`}),` Close`]})]}),t[33]=_,t[34]=x,t[35]=Ce):Ce=t[35];let we;t[36]!==ue||t[37]!==le||t[38]!==T||t[39]!==fe||t[40]!==Se||t[41]!==Ce?(we=(0,Q.jsxs)(ue,{shouldFilter:!0,loop:!0,value:T,onValueChange:E,onKeyDown:le,className:`min-h-0 flex-1`,children:[fe,Se,Ce]}),t[36]=ue,t[37]=le,t[38]=T,t[39]=fe,t[40]=Se,t[41]=Ce,t[42]=we):we=t[42];let Te=we,Ee;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=()=>w(`browse`),t[43]=Ee):Ee=t[43];let De;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Q.jsx)(os,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:Ee,"aria-label":`Back to sessions`,children:(0,Q.jsx)(r,{})}),t[44]=De):De=t[44];let Oe;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium`,children:`Rename session`}),t[45]=Oe):Oe=t[45];let ke=G?.title||`Selected session`,Ae;t[46]===ke?Ae=t[47]:(Ae=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 px-3 py-2`,children:[De,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[Oe,(0,Q.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:ke})]})]}),t[46]=ke,t[47]=Ae);let je;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(je=e=>O(e.target.value),t[48]=je):je=t[48];let Me;t[49]===ae?Me=t[50]:(Me=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),w(`browse`);return}e.key!==`Enter`||e.nativeEvent.isComposing||(e.preventDefault(),e.stopPropagation(),ae())},t[49]=ae,t[50]=Me);let Ne;t[51]!==D||t[52]!==v||t[53]!==Me?(Ne=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center p-3`,children:(0,Q.jsx)(Dc,{autoFocus:v,value:D,onChange:je,onKeyDown:Me,placeholder:`Session name`,className:`min-w-0 flex-1`})}),t[51]=D,t[52]=v,t[53]=Me,t[54]=Ne):Ne=t[54];let Pe;t[55]===_?Pe=t[56]:(Pe=_?null:(0,Q.jsxs)(`div`,{className:`hidden flex-wrap items-center gap-x-3 gap-y-1 border-t border-border/70 px-3 py-2 text-xs text-muted-foreground md:flex`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(i_,{children:`Enter`}),` Save`]}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(i_,{children:`Esc`}),` Back`]})]}),t[55]=_,t[56]=Pe);let Fe;t[57]!==Ae||t[58]!==Ne||t[59]!==Pe?(Fe=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[Ae,Ne,Pe]}),t[57]=Ae,t[58]=Ne,t[59]=Pe,t[60]=Fe):Fe=t[60];let Ie=Fe,Re;t[61]===se?Re=t[62]:(Re=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),w(`browse`);return}e.key!==`Enter`||e.nativeEvent.isComposing||(e.preventDefault(),e.stopPropagation(),se())},t[61]=se,t[62]=Re);let ze;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>w(`browse`),t[63]=ze):ze=t[63];let Be;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,Q.jsx)(os,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:ze,"aria-label":`Back to sessions`,children:(0,Q.jsx)(r,{})}),t[64]=Be):Be=t[64];let Ve;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium`,children:`Delete session`}),t[65]=Ve):Ve=t[65];let He=G?.title||`Selected session`,Ue;t[66]===He?Ue=t[67]:(Ue=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 px-3 py-2`,children:[Be,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[Ve,(0,Q.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:He})]})]}),t[66]=He,t[67]=Ue);let We=G?.title||`New session`,Ge;t[68]===We?Ge=t[69]:(Ge=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center p-3`,children:(0,Q.jsxs)(`p`,{className:`min-w-0 flex-1 truncate text-sm text-muted-foreground`,children:[`Delete "`,We,`" from disk?`]})}),t[68]=We,t[69]=Ge);let Ke;t[70]===_?Ke=t[71]:(Ke=_?null:(0,Q.jsxs)(`div`,{className:`hidden flex-wrap items-center gap-x-3 gap-y-1 border-t border-border/70 px-3 py-2 text-xs text-muted-foreground md:flex`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(i_,{children:`Enter`}),` Delete`]}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(i_,{children:`Esc`}),` Back`]})]}),t[70]=_,t[71]=Ke);let qe;t[72]!==Re||t[73]!==Ue||t[74]!==Ge||t[75]!==Ke?(qe=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,onKeyDown:Re,children:[Ue,Ge,Ke]}),t[72]=Re,t[73]=Ue,t[74]=Ge,t[75]=Ke,t[76]=qe):qe=t[76];let Je=C===`rename`?Ie:C===`delete`?qe:Te;if(_){let e;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(jg,{children:[(0,Q.jsx)(Ng,{children:`Sessions`}),(0,Q.jsx)(Pg,{children:`Search and switch sessions.`})]}),t[77]=e):e=t[77];let r;t[78]===Je?r=t[79]:(r=(0,Q.jsxs)(Ag,{className:`max-h-[90svh] overflow-hidden`,children:[e,(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-4 pb-4`,children:Je})]}),t[78]=Je,t[79]=r);let a;return t[80]!==i||t[81]!==n||t[82]!==v||t[83]!==r?(a=(0,Q.jsx)(Dg,{open:n,onOpenChange:i,autoFocus:v,children:r}),t[80]=i,t[81]=n,t[82]=v,t[83]=r,t[84]=a):a=t[84],a}let Ye;return t[85]!==i||t[86]!==n||t[87]!==Je?(Ye=(0,Q.jsx)(hh,{open:n,onOpenChange:i,title:`Sessions`,description:`Search and switch sessions. Press Tab to toggle current directory and all sessions.`,className:`sm:max-w-2xl`,initialFocus:!0,children:Je}),t[85]=i,t[86]=n,t[87]=Je,t[88]=Ye):Ye=t[88],Ye}function Pee(e){return e===`current`?`all`:`current`}function Fee(e){return e.loading}function Iee(e,t){return n_(t.entry)-n_(e.entry)}function Lee(e){return e.sessions.map(t=>({directory:e.directory,entry:t,key:u(t)}))}function Ree(e){let t=(0,$.c)(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({ref:i,openStateRef:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let[a,o]=Z.useState(!1),s=Z.useRef(a),c;t[4]===n?c=t[5]:(c=e=>{s.current=e,n&&(n.current=e),o(e)},t[4]=n,t[5]=c);let l=c,u;t[6]===l?u=t[7]:(u=()=>({open:()=>{l(!0)},close:()=>{l(!1)},isOpen:()=>s.current}),t[6]=l,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],t[8]=d):d=t[8],Z.useImperativeHandle(i,u,d);let f;return t[9]!==a||t[10]!==r||t[11]!==l?(f=(0,Q.jsx)(Nee,{open:a,onOpenChange:l,...r}),t[9]=a,t[10]=r,t[11]=l,t[12]=f):f=t[12],f}var a_=[`system`,`light`,`dark`];function o_(e){return e===`unsupported`?`Desktop notifications are unavailable in this browser.`:e===`granted`?`Desktop notifications are enabled for this origin.`:e===`denied`?`Desktop notifications are blocked in this browser.`:`Desktop notifications will ask for browser permission when enabled.`}function s_(e){return`${e[0].toUpperCase()}${e.slice(1)}`}function c_(e){return e?`On`:`Off`}function l_(e){return a_[(a_.indexOf(e)+1)%a_.length]??`system`}function u_(e){return[e.title,e.description,e.valueLabel,...e.keywords]}function d_(e,t,n){let r=t.trim().toLowerCase();return r?+!![e,...n??[]].join(` `).toLowerCase().includes(r):1}function f_(e){let t=(0,$.c)(30),{open:n,onOpenChange:r,currentTheme:i,onThemeChange:a,hideThinkingBlocks:o,onHideThinkingBlocksChange:s,hideToolBlocks:c,onHideToolBlocksChange:l,centerMessages:u,onCenterMessagesChange:d,autoScrollEnabled:f,onAutoScrollEnabledChange:p,sessionDoneSoundEnabled:m,onSessionDoneSoundEnabledChange:h,sessionDoneDesktopNotificationsEnabled:g,onSessionDoneDesktopNotificationsEnabledChange:_,desktopNotificationPermission:v,onLoginProviders:y,onLogoutProviders:b}=e,[x,S]=Z.useState(``),[C,w]=Z.useState(`theme`),T=Wl(),E=o_(v),D=[{heading:`Appearance`,commands:[{id:`theme`,title:`Theme`,description:`Cycle between system, light, and dark mode.`,valueLabel:s_(i),keywords:[`color`,`mode`,`system`,`light`,`dark`],onSelect:()=>a(l_(i))}]},{heading:`Conversation display`,commands:[{id:`hide-thinking-blocks`,title:`Hide thinking blocks`,description:`Collapse assistant reasoning into the short hidden-thinking preview.`,valueLabel:c_(o),keywords:[`reasoning`,`thinking`,`display`,`collapse`],onSelect:()=>s(!o)},{id:`hide-tool-calls`,title:`Hide tool calls`,description:`Hide assistant tool execution cards in the conversation view.`,valueLabel:c_(c),keywords:[`tools`,`calls`,`display`,`cards`],onSelect:()=>l(!c)},{id:`center-messages`,title:`Center messages at 80ch`,description:`Constrain each message to a centered 80 character column.`,valueLabel:c_(u),keywords:[`center`,`messages`,`width`,`80`,`column`],onSelect:()=>d(!u)},{id:`auto-scroll-latest`,title:`Auto-scroll to latest messages`,description:`Follow new messages and streaming output automatically.`,valueLabel:c_(f),keywords:[`auto`,`scroll`,`latest`,`follow`,`streaming`],onSelect:()=>p(!f)}]},{heading:`Provider authentication`,commands:[{id:`login-providers`,title:`Login to provider`,description:`Authenticate a subscription provider or save a provider API key.`,valueLabel:`Open`,keywords:[`auth`,`authentication`,`login`,`provider`,`api key`],onSelect:y},{id:`logout-providers`,title:`Logout from provider`,description:`Remove saved provider credentials from pi auth storage.`,valueLabel:`Open`,keywords:[`auth`,`authentication`,`logout`,`provider`,`remove`],onSelect:b}]},{heading:`Session completion notifications`,commands:[{id:`desktop-notifications`,title:`Desktop notifications`,description:E,valueLabel:c_(g),keywords:[`desktop`,`browser`,`notifications`,`permission`,v],onSelect:()=>_(!g)},{id:`completion-sound`,title:`Completion sound`,description:`Play a short confirmation sound when a session finishes.`,valueLabel:c_(m),keywords:[`sound`,`audio`,`completion`,`notifications`],onSelect:()=>h(!m)}]}],O,k;t[0]!==n||t[1]!==x?(O=()=>{!n&&x&&S(``)},k=[n,x],t[0]=n,t[1]=x,t[2]=O,t[3]=k):(O=t[2],k=t[3]),Z.useEffect(O,k);let A=p_,j=mh,M=d_,N=!T,P;t[4]!==x||t[5]!==N?(P=(0,Q.jsx)(gh,{autoFocus:N,value:x,onValueChange:S,placeholder:`Search settings`,className:`text-base md:text-sm`}),t[4]=x,t[5]=N,t[6]=P):P=t[6];let F=_h,I;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(vh,{children:`No settings found.`}),t[7]=I):I=t[7];let L=D.map(e=>(0,Q.jsx)(yh,{heading:e.heading,children:e.commands.map(e=>(0,Q.jsxs)(bh,{value:e.id,keywords:u_(e),onSelect:()=>A(e),className:`items-start py-2`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`truncate font-medium`,children:e.title}),(0,Q.jsx)(`span`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:e.description})]}),(0,Q.jsx)(xh,{className:`inline shrink-0 tracking-normal normal-case`,children:e.valueLabel})]},e.id))},e.heading)),R;t[8]!==F||t[9]!==I||t[10]!==L?(R=(0,Q.jsxs)(F,{className:`max-h-none min-h-0 flex-1 md:max-h-[min(70vh,32rem)]`,children:[I,L]}),t[8]=F,t[9]=I,t[10]=L,t[11]=R):R=t[11];let z;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(`div`,{className:`hidden border-t border-border/70 px-3 py-2 text-xs text-muted-foreground md:block`,children:`Use ↑/↓ to select, Enter to cycle or toggle, and Esc to close.`}),t[12]=z):z=t[12];let B;t[13]!==j||t[14]!==C||t[15]!==R||t[16]!==M||t[17]!==P?(B=(0,Q.jsxs)(j,{shouldFilter:!0,filter:M,loop:!0,value:C,onValueChange:w,className:`min-h-0 flex-1`,children:[P,R,z]}),t[13]=j,t[14]=C,t[15]=R,t[16]=M,t[17]=P,t[18]=B):B=t[18];let V=B;if(T){let e;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(jg,{children:[(0,Q.jsx)(Ng,{children:`Settings`}),(0,Q.jsx)(Pg,{children:`Search and update settings.`})]}),t[19]=e):e=t[19];let i;t[20]===V?i=t[21]:(i=(0,Q.jsxs)(Ag,{className:`max-h-[90svh] overflow-hidden`,children:[e,(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-4 pb-4`,children:V})]}),t[20]=V,t[21]=i);let a;return t[22]!==r||t[23]!==n||t[24]!==i?(a=(0,Q.jsx)(Dg,{open:n,onOpenChange:r,autoFocus:!1,children:i}),t[22]=r,t[23]=n,t[24]=i,t[25]=a):a=t[25],a}let H;return t[26]!==r||t[27]!==n||t[28]!==V?(H=(0,Q.jsx)(hh,{open:n,onOpenChange:r,title:`Settings`,description:`Search settings. Press Enter on a setting to cycle or toggle it.`,className:`sm:max-w-2xl`,initialFocus:!0,children:V}),t[26]=r,t[27]=n,t[28]=V,t[29]=H):H=t[29],H}function p_(e){Promise.resolve(e.onSelect()).catch(m_)}function m_(e){console.error(e)}function h_(e){let t=(0,$.c)(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({ref:i,openStateRef:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let[a,o]=Z.useState(!1),s=Z.useRef(a),c;t[4]===n?c=t[5]:(c=e=>{s.current=e,n&&(n.current=e),o(e)},t[4]=n,t[5]=c);let l=c,u;t[6]===l?u=t[7]:(u=()=>({open:()=>{l(!0)},close:()=>{l(!1)},isOpen:()=>s.current}),t[6]=l,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],t[8]=d):d=t[8],Z.useImperativeHandle(i,u,d);let f;return t[9]!==a||t[10]!==r||t[11]!==l?(f=(0,Q.jsx)(f_,{open:a,onOpenChange:l,...r}),t[9]=a,t[10]=r,t[11]=l,t[12]=f):f=t[12],f}function g_(e){let t=e.trim();if(!t)return e;let n=t.replace(/^\/Users\/[^/]+(?=\/|$)/,`~`).replace(/^\/home\/[^/]+(?=\/|$)/,`~`);return n===`~`?`~/`:n}function __(e){return e.trim().toLowerCase().replace(/[^\p{L}\p{N}]+/gu,` `).replace(/\s+/g,` `)}function v_(e,t){let n=t.trim().toLowerCase();if(!n)return!0;let r=g_(e),i=__(t);return e.toLowerCase().includes(n)||r.toLowerCase().includes(n)||__(e).includes(i)||__(r).includes(i)}function y_(e,t){return t?e.some(e=>{let n=e.trim().toLowerCase(),r=g_(e).trim().toLowerCase();return n===t||r===t}):!1}function b_(e){if(!e)return{leading:``,trailing:``};let t=e.replace(/[\\/]+$/,``);if(!t)return{leading:``,trailing:e};let n=e.slice(t.length),r=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return r<0||r===t.length-1?{leading:``,trailing:`${t}${n}`}:{leading:t.slice(0,r+1),trailing:`${t.slice(r+1)}${n}`}}function x_(e){let t=(0,$.c)(13),{path:n,prefix:r}=e,i,a;t[0]===n?(i=t[1],a=t[2]):(i=g_(n),a=b_(i),t[0]=n,t[1]=i,t[2]=a);let{leading:o,trailing:s}=a,c;t[3]===r?c=t[4]:(c=r?(0,Q.jsx)(`span`,{className:`shrink-0 font-medium`,children:r}):null,t[3]=r,t[4]=c);let l;t[5]===o?l=t[6]:(l=o?(0,Q.jsx)(`span`,{className:`truncate text-muted-foreground`,children:o}):null,t[5]=o,t[6]=l);let u=s||i,d;t[7]===u?d=t[8]:(d=(0,Q.jsx)(`span`,{className:`shrink-0 font-medium`,children:u}),t[7]=u,t[8]=d);let f;return t[9]!==c||t[10]!==l||t[11]!==d?(f=(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center text-foreground`,children:[c,l,d]}),t[9]=c,t[10]=l,t[11]=d,t[12]=f):f=t[12],f}function S_(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(hn,{children:n}),t[0]=n,t[1]=r),r}function C_(e,t){return`path-completion:${t}:${e.value}`}function w_(e,t){return`directory-search:${t}:${e.value}`}function T_(e){let t=e.trim();return t.startsWith(`~`)||t.startsWith(`.`)||t.startsWith(`/`)||t.includes(`/`)||t.includes(`\\`)}function E_(e){let t=g_(e.value);return t.endsWith(`/`)?t:`${t}/`}function D_({open:e,onOpenChange:t,directoryInput:n,onDirectoryInputChange:r,openedDirectories:i,currentDirectory:a,recentDirectories:o,knownDirectories:s,useForNewSession:c=!1,onAddDirectoryPath:l,onRequestPathCompletions:u,onSearchDirectories:d}){let f=Wl(),p=Z.useRef(n),m=Z.useRef(0),h=Z.useRef(0),g=Z.useRef(u),_=Z.useRef(d),[v,y]=Z.useState([]),[b,x]=Z.useState(!1),[S,C]=Z.useState([]),[w,T]=Z.useState(!1),[E,D]=Z.useState(``);p.current=n,g.current=u,_.current=d;let O=Z.useRef(null);O.current||=new ho(async e=>{let t=g.current;return t?await t(e):[]},{key:`pico.add-directory.path-completions`,wait:80});let k=O.current,A=Z.useRef(null);A.current||=new ho(async e=>{let t=_.current;return t?await t(e):[]},{key:`pico.add-directory.directory-search`,wait:120});let j=A.current,M=n.trim(),N=M.toLowerCase(),P=new Set(i),F=new Set(o),I=M?i.filter(e=>v_(e,M)):[],L=a&&!P.has(a)&&v_(a,M)?[a]:[],R=o.filter(e=>!P.has(e)).filter(e=>v_(e,M)),z=s.filter(e=>!P.has(e)).filter(e=>e!==a).filter(e=>!F.has(e)).filter(e=>v_(e,M)),B=M&&!y_([...i,...o,...s],N)?M:``,V=I.length>0||L.length>0||R.length>0||z.length>0,H=T_(M),U=!!(M&&u&&!V&&H),W=!!(M&&d&&!V&&!H),ee=U&&(b||v.length>0),G=W&&(w||S.length>0),te=!!B||V||ee||G,K=c?`Add to sidebar and use for this new session.`:`Resolve and add this path to the sidebar.`,q=c?`Use for this new session.`:`Expand and show it in the sidebar.`,J=c?`Use the current Pico working directory for this new session.`:`Use the current Pico working directory.`,ne=c?`Add to sidebar and use for this new session.`:``;Z.useEffect(()=>{if(!U){m.current+=1,k.cancel(),x(!1),y(e=>e.length===0?e:[]);return}let e=M,t=m.current+1;m.current=t,x(!0),y(e=>e.length===0?e:[]),(async()=>{try{let n=await k.maybeExecute(e);if(t!==m.current||p.current.trim()!==e)return;y((n??[]).filter(t=>t.isDirectory&&t.value.trim()!==e))}catch{t===m.current&&y(e=>e.length===0?e:[])}finally{t===m.current&&x(!1)}})()},[M,k,U]),Z.useEffect(()=>{if(!W){h.current+=1,j.cancel(),T(!1),C(e=>e.length===0?e:[]);return}let e=M,t=h.current+1;h.current=t,T(!0),C(e=>e.length===0?e:[]),(async()=>{try{let n=await j.maybeExecute(e);if(t!==h.current||p.current.trim()!==e)return;C((n??[]).filter(e=>e.isDirectory))}catch{t===h.current&&C(e=>e.length===0?e:[])}finally{t===h.current&&T(!1)}})()},[M,j,W]),Z.useEffect(()=>()=>{k.cancel(),k.abort(),j.cancel(),j.abort()},[j,k]);let Y=[...v.map(C_),...S.map(w_),...B?[`add ${B}`]:[],...I.map(e=>`opened ${e}`),...L.map(e=>`current ${e}`),...R.map(e=>`recent ${e}`),...z.map(e=>`known ${e}`)];Z.useEffect(()=>{E&&Y.includes(E)||D(Y[0]||``)},[Y,E]);let re=v.find((e,t)=>C_(e,t)===E),ie=S.find((e,t)=>w_(e,t)===E),ae=e=>(r(e.value),!0),oe=e=>(r(E_(e)),!0),se=async()=>{let e=re;if(e)return ae(e);let t=ie;if(t)return oe(t);let n=p.current.trim();if(!n)return!1;if(!T_(n)&&d){let e=h.current+1;h.current=e;try{let t=await d(n);if(e!==h.current||p.current.trim()!==n)return!0;let r=t.find(e=>e.isDirectory);return r?oe(r):!1}catch{return!1}}if(!u)return!1;let r=m.current+1;m.current=r;try{let e=await u(n);if(r!==m.current||p.current.trim()!==n)return!0;let t=e.find(e=>e.isDirectory&&e.value.trim()!==n);return t?ae(t):!1}catch{return!1}},ce=(0,Q.jsxs)(mh,{shouldFilter:!1,loop:!0,value:E,onValueChange:D,className:`min-h-0 flex-1 rounded-lg`,children:[(0,Q.jsx)(gh,{autoFocus:!f,value:n,onValueChange:r,onKeyDown:e=>{e.key!==`Tab`||e.shiftKey||e.altKey||e.ctrlKey||e.metaKey||!u&&!d||!n.trim()||(e.preventDefault(),se())},placeholder:`Search or paste a path`,className:`text-base md:text-sm`}),(0,Q.jsxs)(_h,{className:`max-h-none min-h-0 flex-1 md:max-h-[min(70vh,32rem)]`,children:[te?null:(0,Q.jsx)(vh,{children:M?`No directories found. Type or paste a path to add it.`:`No recent or discovered directories yet.`}),U&&(b||v.length>0)?(0,Q.jsxs)(yh,{heading:`Path completions`,children:[b&&v.length===0?(0,Q.jsx)(bh,{value:`path-completion:loading`,disabled:!0,children:`Loading directories…`}):null,v.map((e,t)=>(0,Q.jsx)(bh,{value:C_(e,t),onSelect:()=>l(e.value),children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsx)(x_,{path:e.value}),(0,Q.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:`Press Tab to complete this path instead.`})]})},`path-completion:${e.value}`))]}):null,W&&(w||S.length>0)?(0,Q.jsxs)(yh,{heading:`Matching folders`,children:[w&&S.length===0?(0,Q.jsx)(bh,{value:`directory-search:loading`,disabled:!0,children:`Searching directories…`}):null,S.map((e,t)=>(0,Q.jsx)(bh,{value:w_(e,t),onSelect:()=>l(e.value),children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsx)(x_,{path:e.value}),(0,Q.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.description||`Found on disk`})]})},`directory-search:${e.value}`))]}):null,B?(0,Q.jsx)(yh,{heading:`Add path`,children:(0,Q.jsx)(bh,{value:`add ${B}`,onSelect:()=>l(B),children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsx)(x_,{path:B,prefix:(0,Q.jsx)(Q.Fragment,{children:`Add\xA0`})}),(0,Q.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:K})]})})}):null,I.length>0?(0,Q.jsx)(yh,{heading:`Already added`,children:I.map(e=>(0,Q.jsx)(bh,{value:`opened ${e}`,onSelect:()=>l(e),children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsx)(x_,{path:e}),(0,Q.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:q})]})},`opened:${e}`))}):null,L.length>0?(0,Q.jsx)(yh,{heading:`Current directory`,children:L.map(e=>(0,Q.jsx)(bh,{value:`current ${e}`,onSelect:()=>l(e),children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsx)(x_,{path:e}),(0,Q.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:J})]})},`current:${e}`))}):null,R.length>0?(0,Q.jsx)(yh,{heading:`Recent directories`,children:R.map(e=>(0,Q.jsx)(bh,{value:`recent ${e}`,onSelect:()=>l(e),children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsx)(x_,{path:e}),ne?(0,Q.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:ne}):null]})},`recent:${e}`))}):null,z.length>0?(0,Q.jsx)(yh,{heading:M?`Matching directories`:`Known directories`,children:z.map(e=>(0,Q.jsx)(bh,{value:`known ${e}`,onSelect:()=>l(e),children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsx)(x_,{path:e}),ne?(0,Q.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:ne}):null]})},`known:${e}`))}):null]}),(0,Q.jsxs)(`div`,{className:`hidden flex-wrap items-center gap-x-3 gap-y-1 border-t border-border/70 px-3 py-2 text-xs text-muted-foreground md:flex`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(S_,{children:`↑↓`}),` Navigate`]}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(S_,{children:`Enter`}),` Select`]}),u||d?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(S_,{children:`Tab`}),` Complete`]}):null,(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(S_,{children:`Esc`}),` Close`]})]})]});return f?(0,Q.jsx)(Dg,{open:e,onOpenChange:t,autoFocus:!1,children:(0,Q.jsxs)(Ag,{className:`max-h-[90svh] overflow-hidden`,children:[(0,Q.jsxs)(jg,{children:[(0,Q.jsx)(Ng,{children:`Add directory`}),(0,Q.jsx)(Pg,{children:`Search recent and known directories or add a new path to the sidebar.`})]}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-4 pb-4`,children:ce})]})}):(0,Q.jsx)(hh,{open:e,onOpenChange:t,title:`Add directory`,description:`Search recent and known directories or add a new path to the sidebar.`,className:`sm:max-w-2xl`,initialFocus:!0,children:ce})}function O_(e){let t=(0,$.c)(22),{ref:n,openStateRef:r,openedDirectories:i,currentDirectory:a,recentDirectories:o,knownDirectories:s,useForNewSession:c,onAddDirectoryPath:l,onRequestPathCompletions:u,onSearchDirectories:d}=e,[f,p]=Z.useState(!1),[m,h]=Z.useState(``),g=Z.useRef(f),_;t[0]===r?_=t[1]:(_=e=>{g.current=e,r&&(r.current=e),p(e)},t[0]=r,t[1]=_);let v=_,y;t[2]!==l||t[3]!==v?(y=async e=>{await l(e)!==!1&&(h(``),v(!1))},t[2]=l,t[3]=v,t[4]=y):y=t[4];let b=y,x;t[5]===v?x=t[6]:(x=()=>({open:()=>{h(``),v(!0)},close:()=>{v(!1)},isOpen:()=>g.current}),t[5]=v,t[6]=x);let S;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[7]=S):S=t[7],Z.useImperativeHandle(n,x,S);let C;t[8]===b?C=t[9]:(C=e=>{b(e)},t[8]=b,t[9]=C);let w;return t[10]!==a||t[11]!==m||t[12]!==s||t[13]!==u||t[14]!==d||t[15]!==f||t[16]!==i||t[17]!==o||t[18]!==v||t[19]!==C||t[20]!==c?(w=(0,Q.jsx)(D_,{open:f,onOpenChange:v,directoryInput:m,onDirectoryInputChange:h,openedDirectories:i,currentDirectory:a,recentDirectories:o,knownDirectories:s,useForNewSession:c,onAddDirectoryPath:C,onRequestPathCompletions:u,onSearchDirectories:d}),t[10]=a,t[11]=m,t[12]=s,t[13]=u,t[14]=d,t[15]=f,t[16]=i,t[17]=o,t[18]=v,t[19]=C,t[20]=c,t[21]=w):w=t[21],w}function k_(e){return`${e.authType}:${e.id}`}function A_(e){return[e.id,e.name,e.authType===`oauth`?`oauth subscription login`:`api key`,e.configured?`saved configured`:``,e.source||``].filter(Boolean)}function j_(e){let t=e.authType===`oauth`?`Subscription / OAuth`:`API key`;return e.source?`${t} · ${e.source}`:t}function M_(e){let t=(0,$.c)(23),{provider:n,actionLabel:r,disabled:i,onSelect:a}=e,o;t[0]===n?o=t[1]:(o=k_(n),t[0]=n,t[1]=o);let s;t[2]===n?s=t[3]:(s=A_(n),t[2]=n,t[3]=s);let c;t[4]===n.name?c=t[5]:(c=(0,Q.jsx)(`span`,{className:`truncate font-medium`,children:n.name}),t[4]=n.name,t[5]=c);let l;t[6]===n?l=t[7]:(l=j_(n),t[6]=n,t[7]=l);let u;t[8]===l?u=t[9]:(u=(0,Q.jsx)(`span`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:l}),t[8]=l,t[9]=u);let d;t[10]!==c||t[11]!==u?(d=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[c,u]}),t[10]=c,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==r||t[14]!==n.configured?(f=n.configured?(0,Q.jsx)(Zo,{variant:`secondary`,className:`shrink-0`,children:`Saved`}):(0,Q.jsx)(xh,{className:`inline shrink-0 tracking-normal normal-case`,children:r}),t[13]=r,t[14]=n.configured,t[15]=f):f=t[15];let p;return t[16]!==i||t[17]!==a||t[18]!==o||t[19]!==s||t[20]!==d||t[21]!==f?(p=(0,Q.jsxs)(bh,{value:o,keywords:s,disabled:i,onSelect:a,className:`items-start py-2`,children:[d,f]}),t[16]=i,t[17]=a,t[18]=o,t[19]=s,t[20]=d,t[21]=f,t[22]=p):p=t[22],p}function N_({ref:e,openStateRef:t,viewerContextId:n,sessionId:i}){let a=Wl(),o=c(),[s,l]=Z.useState(!1),[u,d]=Z.useState(!1),[f,p]=Z.useState(!1),[m,h]=Z.useState(null),[g,_]=Z.useState(``),v=Z.useRef(!1),y=Z.useRef(null),b=s||u||f;Z.useLayoutEffect(()=>{v.current=b,t&&(t.current=b)},[b,t]);let x=()=>{p(!1),h(null),_(``)},S=()=>{x(),l(!0)},C=e=>{l(!1),d(!1),x();let t=y.current;y.current=null,e?.returnToOrigin&&t&&t()},w=()=>{C({returnToOrigin:!0})},T=Sr({queryKey:[`pico`,`auth`,`providers`,n,i],enabled:b&&!!n,queryFn:async()=>await Zg(Xg(`/api/auth/providers`,{contextId:n,sessionId:i}))}),E=async()=>{await o.invalidateQueries({queryKey:[`pico`,`auth`,`providers`,n,i]})},D=Dr({mutationFn:async({provider:e,key:t})=>await Zg(Xg(`/api/auth/api-key`,{contextId:n,sessionId:i}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({provider:e,key:t})}),onSuccess:async(e,t)=>{P.success(`Saved API key for ${t.provider}`),await E(),C()},onError:e=>{P.error(e instanceof Error?e.message:`Failed to save API key`)}}),O=Dr({mutationFn:async({provider:e})=>await Zg(Xg(`/api/auth/oauth`,{contextId:n,sessionId:i}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({provider:e})}),onSuccess:async(e,t)=>{P.success(`Logged in to ${t.provider}`),await E(),C()},onError:e=>{let t=e instanceof Error?e.message:`Login failed`;t!==`Login cancelled`&&P.error(t)}}),k=Dr({mutationFn:async({provider:e})=>await Zg(Xg(`/api/auth/logout`,{contextId:n,sessionId:i}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({provider:e})}),onSuccess:async(e,t)=>{P.success(`Logged out of ${t.provider}`),await E(),C()},onError:e=>{P.error(e instanceof Error?e.message:`Logout failed`)}});Z.useImperativeHandle(e,()=>({open:(e=`login`,t)=>{t?.returnOnClose&&(y.current=t.returnOnClose),x(),e===`logout`?(l(!1),d(!0)):(d(!1),l(!0))},close:()=>C(),isOpen:()=>v.current}),[]);let A=T.data?.ok?T.data:void 0,j=A?.oauthProviders??[],M=A?.apiKeyProviders??[],N=A?.loggedInProviders??[],F=e=>{if(e.authType===`oauth`){l(!1),O.mutate({provider:e.id});return}h(e),_(``),l(!1),p(!0)},I=e=>{e.preventDefault(),!(!m||!g.trim())&&D.mutate({provider:m.id,key:g})},L=(0,Q.jsxs)(mh,{loop:!0,shouldFilter:!0,className:`min-h-0 flex-1`,children:[(0,Q.jsx)(gh,{autoFocus:!a,placeholder:`Search login providers`,className:`text-base md:text-sm`}),(0,Q.jsxs)(_h,{className:`max-h-none min-h-0 flex-1 md:max-h-[min(70vh,32rem)]`,children:[(0,Q.jsx)(vh,{children:T.isLoading?`Loading providers…`:T.isError?T.error instanceof Error?T.error.message:`Failed to load providers`:`No auth providers found.`}),j.length>0&&(0,Q.jsx)(yh,{heading:`Subscriptions / OAuth`,children:j.map(e=>(0,Q.jsx)(M_,{provider:e,actionLabel:`Login`,onSelect:()=>F(e)},k_(e)))}),M.length>0&&(0,Q.jsx)(yh,{heading:`API keys`,children:M.map(e=>(0,Q.jsx)(M_,{provider:e,actionLabel:`Set key`,onSelect:()=>F(e)},k_(e)))})]}),a?(0,Q.jsx)(`div`,{className:`border-t border-border/70 p-3`,children:(0,Q.jsx)(os,{type:`button`,variant:`outline`,className:`w-full`,onClick:w,children:`Cancel`})}):(0,Q.jsxs)(`div`,{className:`hidden border-t border-border/70 px-3 py-2 text-xs text-muted-foreground md:block`,children:[`Use ↑/↓ to select, Enter to start login or enter an API key, and Esc to `,y.current?`go back`:`close`,`.`]})]}),R=(0,Q.jsxs)(mh,{loop:!0,shouldFilter:!0,className:`min-h-0 flex-1`,children:[(0,Q.jsx)(gh,{autoFocus:!a,placeholder:`Search logged-in providers`,className:`text-base md:text-sm`}),(0,Q.jsxs)(_h,{className:`max-h-none min-h-0 flex-1 md:max-h-[min(70vh,32rem)]`,children:[(0,Q.jsx)(vh,{children:T.isLoading?`Loading providers…`:T.isError?T.error instanceof Error?T.error.message:`Failed to load providers`:`No providers are currently logged in.`}),N.length>0&&(0,Q.jsx)(yh,{heading:`Logged in providers`,children:N.map(e=>(0,Q.jsx)(M_,{provider:e,actionLabel:`Logout`,disabled:k.isPending,onSelect:()=>{k.isPending||(d(!1),k.mutate({provider:e.id}))}},k_(e)))})]}),a?(0,Q.jsx)(`div`,{className:`border-t border-border/70 p-3`,children:(0,Q.jsx)(os,{type:`button`,variant:`outline`,className:`w-full`,onClick:w,children:`Cancel`})}):(0,Q.jsxs)(`div`,{className:`hidden border-t border-border/70 px-3 py-2 text-xs text-muted-foreground md:block`,children:[`Use ↑/↓ to select, Enter to remove credentials, and Esc to`,` `,y.current?`go back`:`close`,`.`]})]}),z=(0,Q.jsxs)(`form`,{onSubmit:I,className:`flex min-h-0 flex-1 flex-col`,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),S())},children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 px-3 py-2`,children:[(0,Q.jsx)(os,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:S,"aria-label":`Back to login providers`,children:(0,Q.jsx)(r,{})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium`,children:m?`Set ${m.name} API key`:`Set provider API key`}),(0,Q.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:`The key is saved to pi auth storage, not the browser.`})]})]}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center p-3`,children:(0,Q.jsx)(Dc,{type:`password`,value:g,onChange:e=>_(e.target.value),placeholder:m?`Enter ${m.name} API key`:`Enter API key`,autoComplete:`off`,autoFocus:!a,className:`min-w-0 flex-1`})}),a?(0,Q.jsx)(`div`,{className:`border-t border-border/70 p-3`,children:(0,Q.jsx)(os,{type:`submit`,className:`w-full`,disabled:D.isPending||!g.trim(),children:D.isPending?`Saving…`:`Save API key`})}):(0,Q.jsxs)(`div`,{className:`hidden flex-wrap items-center gap-x-3 gap-y-1 border-t border-border/70 px-3 py-2 text-xs text-muted-foreground md:flex`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(hn,{children:`Enter`}),`Save`]}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(hn,{children:`Esc`}),`Back`]})]})]}),B=(e,t,n,r,i)=>a?(0,Q.jsx)(Dg,{open:e,onOpenChange:t,autoFocus:!1,children:(0,Q.jsxs)(Ag,{className:`max-h-[90svh] overflow-hidden`,children:[(0,Q.jsxs)(jg,{children:[(0,Q.jsx)(Ng,{children:n}),(0,Q.jsx)(Pg,{children:r})]}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-4 pb-4`,children:i})]})}):(0,Q.jsx)(hh,{open:e,onOpenChange:t,title:n,description:r,className:`sm:max-w-xl`,initialFocus:!0,children:i});return(0,Q.jsxs)(Q.Fragment,{children:[B(s,e=>{e?l(!0):w()},`Login to provider`,`Search providers and press Enter to configure authentication.`,L),B(u,e=>{e?d(!0):w()},`Logout from provider`,`Search saved provider credentials and press Enter to remove them.`,R),B(f,e=>{e?p(!0):S()},m?`Set ${m.name} API key`:`Set provider API key`,`Enter an API key to save it to pi auth storage.`,z)]})}function P_(e){return e.draft?`draft:${e.cwd||``}`:e.sessionFile||e.sessionId||``}var F_={directorySessionsIndex:(e,t)=>[`pico`,`directory-sessions-index`,e,t],gitStatus:(e,t)=>[`pico`,`git-status`,e,t],gitChanges:(e,t)=>[`pico`,`git-changes`,e,t],gitFiles:(e,t)=>[`pico`,`git-files`,e,t],gitFileDiffs:(e,t)=>[`pico`,`git-file-diffs`,e,t],gitFileDiff:(e,t,n)=>[`pico`,`git-file-diffs`,e,t,n],gitFileReviews:(e,t)=>[`pico`,`git-file-reviews`,e,t],gitFileReview:(e,t,n,r=``)=>[`pico`,`git-file-reviews`,e,t,n,r],gitBranches:(e,t)=>[`pico`,`git-branches`,e,t],gitCommits:(e,t)=>[`pico`,`git-commits`,e,t],gitAction:(e,t,n)=>[`pico`,`git-action`,e,t,n],projectFileTree:(e,t)=>[`pico`,`project-file-tree`,e,t],projectFileRead:(e,t,n)=>[`pico`,`project-file-read`,e,t,n],sessionTree:(e,t)=>[`pico`,`session-tree`,e,t],forkableMessages:(e,t)=>[`pico`,`forkable-messages`,e,t]},I_=[{mode:`default`,label:`Default`,shortcut:`Control+D`},{mode:`no-tools`,label:`No tools`,shortcut:`Control+T`},{mode:`user-only`,label:`User only`,shortcut:`Control+U`},{mode:`labeled-only`,label:`Labeled`,shortcut:`Control+L`},{mode:`all`,label:`All`,shortcut:`Control+A`}];function L_(e,t){return t===`default`||e===t?`default`:t}function R_(e){let t=(0,$.c)(3),{children:n,active:r}=e,i=r!==void 0&&r?`true`:void 0,a;return t[0]!==n||t[1]!==i?(a=(0,Q.jsx)(hn,{"data-active":i,children:n}),t[0]=n,t[1]=i,t[2]=a):a=t[2],a}function z_(e){let t=(0,$.c)(6),{kbd:n,active:r,children:i}=e,a;t[0]!==r||t[1]!==n?(a=(0,Q.jsx)(R_,{active:r,children:n}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==a?(o=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[a,i]}),t[3]=i,t[4]=a,t[5]=o):o=t[5],o}function B_(e){return typeof e==`string`?e.replace(/[\n\t]/g,` `).trim():``}function V_(e){let t=e.node.entry;if(t.type===`message`)switch(t.message?.role){case`user`:return`User`;case`assistant`:return`Assistant`;case`toolResult`:return`Tool`;case`bashExecution`:return`Bash`;default:return t.message?.role||`Message`}switch(t.type){case`compaction`:return`Compaction`;case`branch_summary`:return`Summary`;case`custom_message`:return`Custom`;case`model_change`:return`Model`;case`thinking_level_change`:return`Thinking`;case`session_info`:return`Title`;case`label`:return`Label`;case`custom`:return`Custom`;default:return t.type||`Entry`}}function H_(e){let t=e.node.entry,n=t.message||{};if(t.type===`message`)switch(n.role){case`user`:return B_(n.text)||`(no content)`;case`assistant`:return B_(n.text)||(n.stopReason===`aborted`?`(aborted)`:n.errorMessage?B_(n.errorMessage):`(no content)`);case`toolResult`:return B_(n.text)||n.toolName||`Tool result`;case`bashExecution`:return B_(n.command)||`Bash command`;default:return B_(n.text)||`Message`}switch(t.type){case`branch_summary`:return B_(t.summary)||`Branch summary`;case`compaction`:return`Compaction event`;case`session_info`:return B_(t.name)||`Session title`;case`model_change`:return B_(t.modelId)||`Model changed`;case`thinking_level_change`:return B_(t.thinkingLevel)||`Thinking level changed`;case`label`:return B_(t.label)||`Label updated`;case`custom_message`:case`custom`:return B_(t.text)||B_(t.customType)||`Custom entry`;default:return B_(e.text)||V_(e)}}function U_(e){let t=e.node.entry,n=[e.label||``,H_(e)];if(t.type===`message`){n.push(t.message?.role||``),n.push(t.message?.command||``),n.push(t.message?.errorMessage||``);for(let e of t.message?.toolCalls||[])n.push(e.preview||e.name||``)}return n.push(t.type||``),n.push(t.customType||``),n.push(t.summary||``),n.push(t.modelId||``),n.push(t.thinkingLevel||``),n.push(t.name||``),n.push(t.label||``),n.join(` `).toLowerCase()}function W_(e){let t=e.node.entry.type;return t===`label`||t===`custom`||t===`model_change`||t===`thinking_level_change`||t===`session_info`}function G_(e,t,n,r){let i=e.node.entry,a=i.message||{};if(e.id!==n&&i.type===`message`&&a.role===`assistant`){let e=!!B_(a.text),t=typeof a.stopReason==`string`?a.stopReason:``;if(!e&&!(t&&t!==`stop`&&t!==`toolUse`))return!1}switch(t){case`user-only`:if(!(i.type===`message`&&a.role===`user`))return!1;break;case`no-tools`:if(W_(e)||i.type===`message`&&a.role===`toolResult`)return!1;break;case`labeled-only`:if(!e.label)return!1;break;case`all`:break;default:if(W_(e))return!1;break}if(r.length>0){let t=U_(e);if(!r.every(e=>t.includes(e)))return!1}return!0}function K_(e){let t=new Map(e.map(e=>[e.id,e]));return e.filter(e=>{let n=e.parentId??null;return n===null||!t.has(n)}).map(e=>e.node)}function q_(e,t){let n=new Set,r=t;for(;r;)n.add(r),r=e.get(r)?.parentId??null;return n}function J_({flatTree:e,currentLeafId:t}){let n=new Map(e.map(e=>[e.id,e])),r=K_(e),i=[],a=r.length>1,o=new Map,s=[],c=[...r];for(;c.length>0;){let e=c.pop();if(e?.entry?.id){s.push(e);for(let t=e.children.length-1;t>=0;--t)c.push(e.children[t])}}for(let e=s.length-1;e>=0;--e){let n=s[e],r=t!==null&&n.entry.id===t;for(let e of n.children)if(o.get(e)){r=!0;break}o.set(n,r)}let l=[...r].sort((e,t)=>Number(!!o.get(t))-Number(!!o.get(e))),u=[];for(let e=l.length-1;e>=0;--e){let t=e===l.length-1;u.push([l[e],+!!a,a,a,t,[],a])}for(;u.length>0;){let[e,t,r,s,c,l,d]=u.pop(),f=n.get(e.entry.id);if(!f)continue;i.push({...f,indent:t,showConnector:s,isLast:c,gutters:l,isVirtualRootChild:d,multipleRoots:a});let p=e.children,m=p.length>1,h=[],g=[];for(let e of p)o.get(e)?h.push(e):g.push(e);let _=[...h,...g],v;v=m||r&&t>0?t+1:t;let y=s&&!d,b=a?Math.max(0,t-1):t,x=Math.max(0,b-1),S=y?[...l,{position:x,show:!c}]:l;for(let e=_.length-1;e>=0;--e){let t=e===_.length-1;u.push([_[e],v,m,m,t,S,!1])}}return i}function Y_(e,t){let n=new Map,r=new Map([[null,[]]]);if(e.length===0)return{visibleParentById:n,visibleChildrenById:r};let i=new Set(e.map(e=>e.id)),a=new Map(t.map(e=>[e.id,e])),o=e=>{let t=a.get(e)?.parentId??null;for(;t!==null;){if(i.has(t))return t;t=a.get(t)?.parentId??null}return null};for(let t of e){let e=o(t.id);n.set(t.id,e);let i=r.get(e)??[];i.push(t.id),r.set(e,i)}let s=r.get(null)??[],c=s.length>1,l=new Map(e.map(e=>[e.id,e])),u=[];for(let e=s.length-1;e>=0;--e){let t=e===s.length-1;u.push([s[e],+!!c,c,c,t,[],c])}for(;u.length>0;){let[e,t,n,i,a,o,s]=u.pop(),d=l.get(e);if(!d)continue;d.indent=t,d.showConnector=i,d.isLast=a,d.gutters=o,d.isVirtualRootChild=s,d.multipleRoots=c;let f=r.get(e)??[],p=f.length>1,m;m=p||n&&t>0?t+1:t;let h=i&&!s,g=c?Math.max(0,t-1):t,_=Math.max(0,g-1),v=h?[...o,{position:_,show:!a}]:o;for(let e=f.length-1;e>=0;--e){let t=e===f.length-1;u.push([f[e],m,p,p,t,v,!1])}}return{visibleParentById:n,visibleChildrenById:r}}function X_({flatTree:e,currentLeafId:t,query:n,filterMode:r,foldedEntryIds:i}){let a=new Map(e.map(e=>[e.id,e])),o=q_(a,t),s=J_({flatTree:e,currentLeafId:t}),c=n.trim().toLowerCase().split(/\s+/).filter(Boolean),l=s.filter(e=>G_(e,r,t,c)),{visibleParentById:u,visibleChildrenById:d}=Y_(l,s),f=new Set;if(i.size>0)for(let e of s){let t=e.parentId??null;t!==null&&(i.has(t)||f.has(t))&&f.add(e.id)}let p=l.filter(e=>!f.has(e.id)),{visibleParentById:m,visibleChildrenById:h}=Y_(p,s);return{nodeById:a,visibleParentById:m,visibleChildrenById:h,orderedVisibleNodes:p.map(e=>{let n=d.get(e.id)??[],r=u.get(e.id),a=d.get(r??null)??[],s=n.length>0&&(r==null||a.length>1);return{...e,hasVisibleChildren:(h.get(e.id)?.length??0)>0,isCurrentLeaf:e.id===t,isActivePath:o.has(e.id),isFoldable:s,isFolded:i.has(e.id)}})}}function Z_(e,t,n){if(t.length===0)return null;if(!e)return t[0]?.id??null;let r=new Set(t.map(e=>e.id)),i=e;for(;i;){if(r.has(i))return i;i=n.get(i)?.parentId??null}return t[0]?.id??null}function Q_(e,t){let n=e.visibleChildrenById.get(t);if(!n||n.length===0)return!1;let r=e.visibleParentById.get(t);if(r==null)return!0;let i=e.visibleChildrenById.get(r);return Array.isArray(i)&&i.length>1}function $_(e,t,n){let r=new Map(e.orderedVisibleNodes.map((e,t)=>[e.id,t])),i=t;if(n===`down`)for(;;){let t=e.visibleChildrenById.get(i)??[];if(t.length===0)return i;if(t.length>1)return t[0]??i;i=t[0]??i}for(;;){let n=e.visibleParentById.get(i)??null;if(n===null)return i;if((e.visibleChildrenById.get(n)??[]).length>1){let e=r.get(i),n=r.get(t);if(typeof e==`number`&&typeof n==`number`&&e<n)return i}i=n}}function ev(e){let t=(e,t=`0 0 10 24`)=>`<svg class="size-full block" viewBox="${t}" fill="none" aria-hidden="true">${e}</svg>`;switch(e){case`gutter`:return t(`<path d="M5 0V24" stroke="currentColor" stroke-width="1"/>`);case`connector-tee`:return t(`<path d="M5 0V24M5 12H10" stroke="currentColor" stroke-width="1"/>`);case`connector-elbow`:return t(`<path d="M5 0V12M5 12H10" stroke="currentColor" stroke-width="1"/>`);case`leaf-line`:return t(`<path d="M0 12H10" stroke="currentColor" stroke-width="1"/>`);case`fold-open`:return t(`<rect x="0.5" y="7.5" width="9" height="9" rx="1.5" stroke="currentColor" stroke-width="1"/><path d="M2.5 12H7.5" stroke="currentColor" stroke-width="1"/>`);case`fold-closed`:return t(`<rect x="0.5" y="7.5" width="9" height="9" rx="1.5" stroke="currentColor" stroke-width="1"/><path d="M2.5 12H7.5M5 9.5V14.5" stroke="currentColor" stroke-width="1"/>`);case`active-path`:return t(`<circle cx="5" cy="12" r="2.25" fill="currentColor"/>`)}}function tv(e){let t=(0,$.c)(9),{name:n,className:r}=e,i;t[0]===r?i=t[1]:(i=on(`block h-6 w-2.5 [&_svg]:block [&_svg]:h-full [&_svg]:w-full`,r),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=ev(n),t[2]=n,t[3]=a);let o;t[4]===a?o=t[5]:(o={__html:a},t[4]=a,t[5]=o);let s;return t[6]!==i||t[7]!==o?(s=(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:i,dangerouslySetInnerHTML:o}),t[6]=i,t[7]=o,t[8]=s):s=t[8],s}function nv(e){let t=(0,$.c)(21),{node:n,viewModel:r}=e,i=n.multipleRoots?Math.max(0,n.indent-1):n.indent,a=n.showConnector&&!n.isVirtualRootChild,o=a?i-1:-1,s;t[0]!==n.id||t[1]!==r?(s=Q_(r,n.id),t[0]=n.id,t[1]=r,t[2]=s):s=t[2];let c=s,l=i*3;if(l<=0){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`span`,{className:`block h-6 w-0 shrink-0`,"aria-hidden":`true`}),t[3]=e):e=t[3],e}let u;if(t[4]!==c||t[5]!==a||t[6]!==o||t[7]!==n.gutters||t[8]!==n.id||t[9]!==n.isFolded||t[10]!==n.isLast||t[11]!==l){let e;t[13]!==c||t[14]!==a||t[15]!==o||t[16]!==n.gutters||t[17]!==n.id||t[18]!==n.isFolded||t[19]!==n.isLast?(e=(e,t)=>{let r=Math.floor(t/3),i=t%3,s=n.gutters.find(e=>e.position===r);if(s)return(0,Q.jsx)(`span`,{className:`flex h-6 w-2.5 items-center justify-center`,children:i===0&&s.show?(0,Q.jsx)(tv,{name:`gutter`}):null},`${n.id}-gutter-${t}`);if(a&&r===o){if(i===0)return(0,Q.jsx)(`span`,{className:`flex h-6 w-2.5 items-center justify-center`,children:(0,Q.jsx)(tv,{name:n.isLast?`connector-elbow`:`connector-tee`})},`${n.id}-connector-${t}`);if(i===1)return(0,Q.jsx)(`span`,{className:`flex h-6 w-2.5 items-center justify-center`,children:(0,Q.jsx)(tv,{name:n.isFolded?`fold-closed`:c?`fold-open`:`leaf-line`})},`${n.id}-marker-${t}`)}return(0,Q.jsx)(`span`,{className:`block h-6 w-2.5 shrink-0`},`${n.id}-empty-${t}`)},t[13]=c,t[14]=a,t[15]=o,t[16]=n.gutters,t[17]=n.id,t[18]=n.isFolded,t[19]=n.isLast,t[20]=e):e=t[20],u=(0,Q.jsx)(`span`,{className:`inline-flex h-6 shrink-0 items-stretch text-muted-foreground`,children:Array.from({length:l},e)}),t[4]=c,t[5]=a,t[6]=o,t[7]=n.gutters,t[8]=n.id,t[9]=n.isFolded,t[10]=n.isLast,t[11]=l,t[12]=u}else u=t[12];return u}function rv(e){let t=e.node.entry,n=t.message||{};if(t.type===`message`)switch(n.role){case`user`:return`user: ${B_(n.text)||`(no content)`}`;case`assistant`:{let e=B_(n.text);return e?`assistant: ${e}`:n.stopReason===`aborted`?`assistant: (aborted)`:n.errorMessage?`assistant: ${B_(n.errorMessage)}`:`assistant: (no content)`}case`toolResult`:return H_(e);case`bashExecution`:return`[bash]: ${B_(n.command)}`;default:return H_(e)}switch(t.type){case`compaction`:return`[compaction: ${Math.round((Number(t.tokensBefore)||0)/1e3)}k tokens]`;case`branch_summary`:return`[branch summary]: ${B_(t.summary)||`Branch summary`}`;case`custom_message`:return`[${t.customType||`custom`}]: ${B_(t.text)||`Custom message`}`;case`model_change`:return`[model: ${t.modelId||``}]`;case`thinking_level_change`:return`[thinking: ${t.thinkingLevel||``}]`;case`session_info`:return t.name?`[title: ${t.name}]`:`[title: empty]`;case`label`:return`[label: ${t.label??`(cleared)`}]`;case`custom`:return`[custom: ${t.customType||`custom`}]`;default:return`[${t.type||`entry`}]`}}function iv(e){let t=(0,$.c)(55),{node:n}=e,r=n.node.entry,i;t[0]===r.message?i=t[1]:(i=r.message||{},t[0]=r.message,t[1]=i);let a=i;if(r.type===`message`)switch(a.role){case`user`:{let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`span`,{className:`font-semibold text-primary`,children:`user:`}),t[2]=e):e=t[2];let n;t[3]===a.text?n=t[4]:(n=B_(a.text)||`(no content)`,t[3]=a.text,t[4]=n);let r;return t[5]===n?r=t[6]:(r=(0,Q.jsxs)(`div`,{className:`min-w-0 truncate text-sm leading-6 text-foreground`,children:[e,` `,n]}),t[5]=n,t[6]=r),r}case`assistant`:{let e;t[7]===a.text?e=t[8]:(e=B_(a.text),t[7]=a.text,t[8]=e);let n=e,r;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(`span`,{className:`font-semibold text-[var(--success)]`,children:`assistant:`}),t[9]=r):r=t[9];let i;t[10]!==a.errorMessage||t[11]!==a.stopReason||t[12]!==n?(i=n||(a.stopReason===`aborted`?(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`(aborted)`}):a.errorMessage?(0,Q.jsx)(`span`,{className:`text-[var(--danger)]`,children:B_(a.errorMessage)}):(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`(no content)`})),t[10]=a.errorMessage,t[11]=a.stopReason,t[12]=n,t[13]=i):i=t[13];let o;return t[14]===i?o=t[15]:(o=(0,Q.jsxs)(`div`,{className:`min-w-0 truncate text-sm leading-6 text-foreground`,children:[r,` `,i]}),t[14]=i,t[15]=o),o}case`toolResult`:{let e;t[16]===n?e=t[17]:(e=H_(n),t[16]=n,t[17]=e);let r;return t[18]===e?r=t[19]:(r=(0,Q.jsx)(`div`,{className:`min-w-0 truncate text-sm leading-6 text-muted-foreground`,children:e}),t[18]=e,t[19]=r),r}case`bashExecution`:{let e;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`[bash]:`}),t[20]=e):e=t[20];let n;t[21]===a.command?n=t[22]:(n=B_(a.command)||`Bash command`,t[21]=a.command,t[22]=n);let r;return t[23]===n?r=t[24]:(r=(0,Q.jsxs)(`div`,{className:`min-w-0 truncate text-sm leading-6 text-foreground`,children:[e,` `,n]}),t[23]=n,t[24]=r),r}default:{let e;t[25]===n?e=t[26]:(e=H_(n),t[25]=n,t[26]=e);let r;return t[27]===e?r=t[28]:(r=(0,Q.jsx)(`div`,{className:`min-w-0 truncate text-sm leading-6 text-muted-foreground`,children:e}),t[27]=e,t[28]=r),r}}switch(r.type){case`compaction`:{let e;t[29]===r.tokensBefore?e=t[30]:(e=Math.round((Number(r.tokensBefore)||0)/1e3),t[29]=r.tokensBefore,t[30]=e);let n=e,i;return t[31]===n?i=t[32]:(i=(0,Q.jsxs)(`div`,{className:`min-w-0 truncate text-sm leading-6 text-[var(--warning)]`,children:[`[compaction: `,n,`k tokens]`]}),t[31]=n,t[32]=i),i}case`branch_summary`:{let e;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`span`,{className:`font-semibold`,children:`[branch summary]:`}),t[33]=e):e=t[33];let n;t[34]===r.summary?n=t[35]:(n=B_(r.summary)||`Branch summary`,t[34]=r.summary,t[35]=n);let i;return t[36]===n?i=t[37]:(i=(0,Q.jsxs)(`div`,{className:`min-w-0 truncate text-sm leading-6 text-[var(--warning)]`,children:[e,` `,n]}),t[36]=n,t[37]=i),i}case`custom_message`:{let e=r.customType||`custom`,n;t[38]===r.text?n=t[39]:(n=B_(r.text)||`Custom message`,t[38]=r.text,t[39]=n);let i;return t[40]!==e||t[41]!==n?(i=(0,Q.jsxs)(`div`,{className:`min-w-0 truncate text-sm leading-6 text-[var(--warning)]`,children:[`[`,e,`]:`,` `,n]}),t[40]=e,t[41]=n,t[42]=i):i=t[42],i}case`model_change`:{let e=r.modelId||``,n;return t[43]===e?n=t[44]:(n=(0,Q.jsxs)(`div`,{className:`min-w-0 truncate text-sm leading-6 text-muted-foreground`,children:[`[model: `,e,`]`]}),t[43]=e,t[44]=n),n}case`thinking_level_change`:{let e=r.thinkingLevel||``,n;return t[45]===e?n=t[46]:(n=(0,Q.jsxs)(`div`,{className:`min-w-0 truncate text-sm leading-6 text-muted-foreground`,children:[`[thinking: `,e,`]`]}),t[45]=e,t[46]=n),n}case`session_info`:{let e=r.name?`[title: ${r.name}]`:`[title: empty]`,n;return t[47]===e?n=t[48]:(n=(0,Q.jsx)(`div`,{className:`min-w-0 truncate text-sm leading-6 text-muted-foreground`,children:e}),t[47]=e,t[48]=n),n}case`label`:{let e=r.label??`(cleared)`,n;return t[49]===e?n=t[50]:(n=(0,Q.jsxs)(`div`,{className:`min-w-0 truncate text-sm leading-6 text-muted-foreground`,children:[`[label: `,e,`]`]}),t[49]=e,t[50]=n),n}case`custom`:{let e=r.customType||`custom`,n;return t[51]===e?n=t[52]:(n=(0,Q.jsxs)(`div`,{className:`min-w-0 truncate text-sm leading-6 text-muted-foreground`,children:[`[custom: `,e,`]`]}),t[51]=e,t[52]=n),n}default:{let e=r.type||`entry`,n;return t[53]===e?n=t[54]:(n=(0,Q.jsxs)(`div`,{className:`min-w-0 truncate text-sm leading-6 text-muted-foreground`,children:[`[`,e,`]`]}),t[53]=e,t[54]=n),n}}}function av(e){let t=(0,$.c)(117),{isMobile:n,treeFilterMode:r,onTreeFilterModeChange:i,treeLoading:a,treeSubmitting:o,treeLeafId:s,treeStreamingEntryId:c,treeQuery:l,onTreeQueryChange:u,treeViewModel:d,foldedTreeNodeIds:f,onFoldedTreeNodeIdsChange:p,selectedTreeNodeId:m,onSelectTreeNode:h,onLabelTreeNode:g}=e,[_,v]=Z.useState(m||s||null),y=Z.useRef(null),b=Z.useRef(null),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=new Map,t[0]=x):x=t[0];let S=Z.useRef(x),C=Z.useRef(!1),w;t[1]!==_||t[2]!==d.orderedVisibleNodes?(w=_==null?null:d.orderedVisibleNodes.find(e=>e.id===_)??null,t[1]=_,t[2]=d.orderedVisibleNodes,t[3]=w):w=t[3];let T=w,E;t[4]!==_||t[5]!==d.orderedVisibleNodes?(E=_?d.orderedVisibleNodes.findIndex(e=>e.id===_):-1,t[4]=_,t[5]=d.orderedVisibleNodes,t[6]=E):E=t[6];let D=E,O=d.orderedVisibleNodes.length,k=Math.max(1,String(O).length),A=String(Math.max(0,D+1)),j;t[7]!==A||t[8]!==k?(j=A.padStart(k,`0`),t[7]=A,t[8]=k,t[9]=j):j=t[9];let M=j,N,P;t[10]!==m||t[11]!==_||t[12]!==s||t[13]!==d.nodeById||t[14]!==d.orderedVisibleNodes?(N=()=>{let e=Z_(_||m||s,d.orderedVisibleNodes,d.nodeById);e!==_&&v(e)},P=[m,_,s,d.nodeById,d.orderedVisibleNodes],t[10]=m,t[11]=_,t[12]=s,t[13]=d.nodeById,t[14]=d.orderedVisibleNodes,t[15]=N,t[16]=P):(N=t[15],P=t[16]),Z.useEffect(N,P);let F,I;t[17]===n?(F=t[18],I=t[19]):(F=()=>{if(n)return;let e=window.requestAnimationFrame(()=>{y.current?.focus()});return()=>{window.cancelAnimationFrame(e)}},I=[n],t[17]=n,t[18]=F,t[19]=I),Z.useEffect(F,I);let L,R;t[20]===_?(L=t[21],R=t[22]):(L=()=>{if(!_)return;let e=window.requestAnimationFrame(()=>{S.current.get(_)?.scrollIntoView({block:`nearest`})});return()=>{window.cancelAnimationFrame(e)}},R=[_],t[20]=_,t[21]=L,t[22]=R),Z.useEffect(L,R);let z,B,V,H,U,W,ee,G,te,K,q,J,ne,Y,re;if(t[23]!==D||t[24]!==T||t[25]!==f||t[26]!==n||t[27]!==p||t[28]!==g||t[29]!==h||t[30]!==i||t[31]!==u||t[32]!==_||t[33]!==r||t[34]!==s||t[35]!==a||t[36]!==l||t[37]!==c||t[38]!==o||t[39]!==d){let e=(e,t)=>e===0&&t===0?!1:(C.current=!0,!0),m;t[55]===_?m=t[56]:(m=e=>{_!==e&&v(e)},t[55]=_,t[56]=m);let x=m,w;t[57]!==D||t[58]!==d.orderedVisibleNodes?(w=e=>{let t=d.orderedVisibleNodes;if(t.length===0)return;let n=t[(((D>=0?D:e>0?-1:0)+e)%t.length+t.length)%t.length];n&&v(n.id)},t[57]=D,t[58]=d.orderedVisibleNodes,t[59]=w):w=t[59];let E=w,O;t[60]!==T||t[61]!==f||t[62]!==p||t[63]!==d?(O=e=>{if(!T)return;let t=new Set(f),n=T.id;e?T.isFolded?t.delete(T.id):n=$_(d,T.id,`down`):T.isFoldable&&!T.isFolded?t.add(T.id):n=$_(d,T.id,`up`),p(t),v(n)},t[60]=T,t[61]=f,t[62]=p,t[63]=d,t[64]=O):O=t[64];let k=O,A;t[65]===d.orderedVisibleNodes?A=t[66]:(A=()=>{let e=b.current,t=d.orderedVisibleNodes;if(!e||t.length===0)return 1;let n=e.getBoundingClientRect();return Math.max(1,t.filter(e=>{let t=S.current.get(e.id);if(!t)return!1;let r=t.getBoundingClientRect();return r.bottom>n.top&&r.top<n.bottom}).length)},t[65]=d.orderedVisibleNodes,t[66]=A);let j=A,M;t[67]!==E||t[68]!==j?(M=(e,t)=>{let n=j();E((t===`half`?Math.max(1,Math.floor(n/2)):n)*e)},t[67]=E,t[68]=j,t[69]=M):M=t[69];let N=M;Y=`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,t[70]!==n||t[71]!==i||t[72]!==r?(re=n?(0,Q.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border/70 px-1 pb-3`,children:I_.map(e=>(0,Q.jsx)(os,{size:`sm`,variant:r===e.mode?`default`:`outline`,onClick:()=>i(e.mode),children:e.label},e.mode))}):null,t[70]=n,t[71]=i,t[72]=r,t[73]=re):re=t[73],B=mh,ee=!1,G=!0,te=T?.id??void 0,t[74]!==_||t[75]!==d.nodeById?(K=e=>{!e||e===_||d.nodeById.has(e)&&C.current&&v(e)},t[74]=_,t[75]=d.nodeById,t[76]=K):K=t[76],t[77]!==T||t[78]!==E||t[79]!==N||t[80]!==g||t[81]!==k||t[82]!==c||t[83]!==o?(q=e=>{let t=e.key.toLowerCase();if(e.shiftKey&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&t===`l`&&T&&!o&&!c){e.preventDefault(),e.stopPropagation(),g(T.id);return}if(!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&!e.altKey){if(e.key===`ArrowUp`||e.key===`ArrowDown`){e.preventDefault(),e.stopPropagation(),E(e.key===`ArrowDown`?1:-1);return}if(e.key===`ArrowLeft`||e.key===`ArrowRight`){e.preventDefault(),e.stopPropagation(),N(e.key===`ArrowRight`?1:-1,`full`);return}}if($g(e.nativeEvent,`Control+ArrowLeft`)||$g(e.nativeEvent,`Control+ArrowRight`)){e.preventDefault(),e.stopPropagation(),k(e.key===`ArrowRight`);return}},t[77]=T,t[78]=E,t[79]=N,t[80]=g,t[81]=k,t[82]=c,t[83]=o,t[84]=q):q=t[84],J=`min-h-0 w-full max-w-full min-w-0 flex-1`;let P=!n;t[85]!==u||t[86]!==P||t[87]!==l?(ne=(0,Q.jsx)(gh,{ref:y,autoFocus:P,value:l,onValueChange:u,placeholder:`Search tree`,className:`text-base md:text-sm`}),t[85]=u,t[86]=P,t[87]=l,t[88]=ne):ne=t[88],z=_h,V=b,H=`max-h-none min-h-0 flex-1 md:max-h-[min(calc(80vh_-_9rem),32rem)]`,U=t=>{e(t.movementX,t.movementY)},W=a?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 p-4 text-sm text-muted-foreground`,children:[(0,Q.jsx)(Le,{}),` Loading tree…`]}):d.orderedVisibleNodes.length>0?d.orderedVisibleNodes.map(t=>(0,Q.jsx)(Ne,{title:rv(t),children:(0,Q.jsxs)(bh,{value:t.id,disabled:o||t.id===s,onMouseEnter:()=>{C.current&&x(t.id)},onMouseMove:n=>{!C.current&&!e(n.movementX,n.movementY)||x(t.id)},onClick:()=>h(t.id),onSelect:()=>h(t.id),ref:e=>{e?S.current.set(t.id,e):S.current.delete(t.id)},className:`h-6 min-w-0 items-stretch gap-2 overflow-hidden px-2 py-0`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-stretch gap-1 text-muted-foreground`,children:[(0,Q.jsx)(nv,{node:t,viewModel:d}),(0,Q.jsx)(`span`,{className:`flex h-6 w-2.5 items-center justify-center`,children:t.streaming||t.id===c?(0,Q.jsx)(Le,{className:`size-3 text-[var(--success)]`,"aria-label":`Streaming`}):t.isActivePath?(0,Q.jsx)(tv,{name:`active-path`,className:on(t.isActivePath?`text-[var(--success)]`:`text-muted-foreground`)}):null})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden`,children:[t.label?(0,Q.jsxs)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded-full border border-border/90 bg-background/20 px-2 text-[11px] font-semibold text-muted-foreground`,children:[`[`,t.label,`]`]}):null,(0,Q.jsx)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:(0,Q.jsx)(iv,{node:t})})]})]})},t.id)):(0,Q.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:l.trim()?`No tree entries match the current search.`:`No tree entries match the current filter.`}),t[23]=D,t[24]=T,t[25]=f,t[26]=n,t[27]=p,t[28]=g,t[29]=h,t[30]=i,t[31]=u,t[32]=_,t[33]=r,t[34]=s,t[35]=a,t[36]=l,t[37]=c,t[38]=o,t[39]=d,t[40]=z,t[41]=B,t[42]=V,t[43]=H,t[44]=U,t[45]=W,t[46]=ee,t[47]=G,t[48]=te,t[49]=K,t[50]=q,t[51]=J,t[52]=ne,t[53]=Y,t[54]=re}else z=t[40],B=t[41],V=t[42],H=t[43],U=t[44],W=t[45],ee=t[46],G=t[47],te=t[48],K=t[49],q=t[50],J=t[51],ne=t[52],Y=t[53],re=t[54];let ie;t[89]!==z||t[90]!==V||t[91]!==H||t[92]!==U||t[93]!==W?(ie=(0,Q.jsx)(z,{ref:V,className:H,onPointerMoveCapture:U,children:W}),t[89]=z,t[90]=V,t[91]=H,t[92]=U,t[93]=W,t[94]=ie):ie=t[94];let ae;t[95]!==M||t[96]!==n||t[97]!==r||t[98]!==a||t[99]!==c||t[100]!==O?(ae=n?null:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-border/70 px-3 py-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`tabular-nums`,children:a?`Loading tree…`:`${M}/${O}`}),(0,Q.jsx)(z_,{kbd:`↑/↓`,children:`Move`}),(0,Q.jsx)(z_,{kbd:`←/→`,children:`Page`}),(0,Q.jsx)(z_,{kbd:`${Qg(`Control+ArrowLeft`)}/${Qg(`Control+ArrowRight`)}`,children:`Fold`}),I_.map(e=>(0,Q.jsx)(z_,{kbd:Qg(e.shortcut),active:r===e.mode,children:e.label},e.mode)),c?null:(0,Q.jsx)(z_,{kbd:`Shift+L`,children:`Label`}),(0,Q.jsx)(z_,{kbd:`Esc`,children:`Close`})]}),t[95]=M,t[96]=n,t[97]=r,t[98]=a,t[99]=c,t[100]=O,t[101]=ae):ae=t[101];let oe;t[102]!==B||t[103]!==ee||t[104]!==G||t[105]!==te||t[106]!==K||t[107]!==q||t[108]!==J||t[109]!==ne||t[110]!==ie||t[111]!==ae?(oe=(0,Q.jsxs)(B,{shouldFilter:ee,loop:G,value:te,onValueChange:K,onKeyDownCapture:q,className:J,children:[ne,ie,ae]}),t[102]=B,t[103]=ee,t[104]=G,t[105]=te,t[106]=K,t[107]=q,t[108]=J,t[109]=ne,t[110]=ie,t[111]=ae,t[112]=oe):oe=t[112];let se;return t[113]!==Y||t[114]!==re||t[115]!==oe?(se=(0,Q.jsxs)(`div`,{className:Y,children:[re,oe]}),t[113]=Y,t[114]=re,t[115]=oe,t[116]=se):se=t[116],se}function ov(e){let t=(0,$.c)(74),{isMobile:n,canNavigateSelectedNode:r,treeSummaryAvailable:i,treeSubmitting:a,activeSessionStreaming:o,selectedTreeNodeId:s,onNavigateTreeNode:c,onCustomPrompt:l}=e,[u,d]=Z.useState(`No summary`),f=!r||a||o,p;t[0]===f?p=t[1]:(p={value:`No summary`,disabled:f},t[0]=f,t[1]=p);let m=!r||!i||a||o,h;t[2]===m?h=t[3]:(h={value:`Summarize`,disabled:m},t[2]=m,t[3]=h);let g=!r||!i||a||o,_;t[4]===g?_=t[5]:(_={value:`Summarize with custom prompt`,disabled:g},t[4]=g,t[5]=_);let v;t[6]!==p||t[7]!==h||t[8]!==_?(v=[p,h,_],t[6]=p,t[7]=h,t[8]=_,t[9]=v):v=t[9];let y=v,b;t[10]===y?b=t[11]:(b=y.filter(sv),t[10]=y,t[11]=b);let x=b,S,C;t[12]!==x||t[13]!==u?(C=()=>{x.length!==0&&(x.some(e=>e.value===u)||d(x[0]?.value??`No summary`))},S=[x,u],t[12]=x,t[13]=u,t[14]=S,t[15]=C):(S=t[14],C=t[15]),Z.useEffect(C,S);let w;t[16]!==x||t[17]!==u?(w=e=>{if(x.length===0)return;let t=x[(Math.max(0,x.findIndex(e=>e.value===u))+e+x.length)%x.length];t&&d(t.value)},t[16]=x,t[17]=u,t[18]=w):w=t[18];let T=w,E;t[19]!==y||t[20]!==l||t[21]!==c||t[22]!==u||t[23]!==s?(E=()=>{if(!s)return;let e=y.find(e=>e.value===u);if(!(!e||e.disabled)){if(u===`Summarize with custom prompt`){l();return}c(s,u===`Summarize`?{summarize:!0}:void 0)}},t[19]=y,t[20]=l,t[21]=c,t[22]=u,t[23]=s,t[24]=E):E=t[24];let D=E,O;t[25]!==T||t[26]!==D?(O=()=>{let e=e=>{let t=$g(e,`Control+J`)||!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&e.key===`ArrowDown`,n=$g(e,`Control+K`)||!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&e.key===`ArrowUp`;if(t||n){e.preventDefault(),e.stopPropagation(),T(t?1:-1);return}e.key===`Enter`&&!e.metaKey&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&(e.preventDefault(),e.stopPropagation(),D())};return window.addEventListener(`keydown`,e,!0),()=>{window.removeEventListener(`keydown`,e,!0)}},t[25]=T,t[26]=D,t[27]=O):O=t[27];let k;t[28]!==o||t[29]!==r||t[30]!==x||t[31]!==l||t[32]!==c||t[33]!==u||t[34]!==s||t[35]!==a||t[36]!==i?(k=[o,r,x,l,c,u,s,a,i],t[28]=o,t[29]=r,t[30]=x,t[31]=l,t[32]=c,t[33]=u,t[34]=s,t[35]=a,t[36]=i,t[37]=k):k=t[37],Z.useEffect(O,k);let A;t[38]===y?A=t[39]:(A=e=>{y.some(t=>t.value===e)&&d(e)},t[38]=y,t[39]=A);let j;t[40]===T?j=t[41]:(j=e=>{!e.metaKey&&!e.altKey&&!e.shiftKey&&!e.ctrlKey&&(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),e.stopPropagation(),T(e.key===`ArrowDown`?1:-1))},t[40]=T,t[41]=j);let M=!r||a||o,N;t[42]!==c||t[43]!==s?(N=()=>{s&&c(s)},t[42]=c,t[43]=s,t[44]=N):N=t[44];let P;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`No summary`}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Continue from this point immediately.`})]}),t[45]=P):P=t[45];let F;t[46]!==M||t[47]!==N?(F=(0,Q.jsx)(bh,{value:`No summary`,disabled:M,onSelect:N,children:P}),t[46]=M,t[47]=N,t[48]=F):F=t[48];let I=!r||!i||a||o,L;t[49]!==c||t[50]!==s?(L=()=>{s&&c(s,{summarize:!0})},t[49]=c,t[50]=s,t[51]=L):L=t[51];let R;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Summarize`}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Summarize the branch you are leaving first.`})]}),t[52]=R):R=t[52];let z;t[53]!==I||t[54]!==L?(z=(0,Q.jsx)(bh,{value:`Summarize`,disabled:I,onSelect:L,children:R}),t[53]=I,t[54]=L,t[55]=z):z=t[55];let B=!r||!i||a||o,V;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Summarize with custom prompt`}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Add extra instructions before continuing.`})]}),t[56]=V):V=t[56];let H;t[57]!==l||t[58]!==B?(H=(0,Q.jsx)(bh,{value:`Summarize with custom prompt`,disabled:B,onSelect:l,children:V}),t[57]=l,t[58]=B,t[59]=H):H=t[59];let U;t[60]!==F||t[61]!==z||t[62]!==H?(U=(0,Q.jsx)(_h,{className:`max-h-none min-h-0 flex-1 md:max-h-[min(calc(80vh_-_7rem),32rem)]`,children:(0,Q.jsxs)(yh,{children:[F,z,H]})}),t[60]=F,t[61]=z,t[62]=H,t[63]=U):U=t[63];let W;t[64]!==o||t[65]!==n||t[66]!==i?(W=n?null:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-border/70 px-3 py-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(z_,{kbd:`↑/↓`,children:`Move`}),(0,Q.jsx)(z_,{kbd:`Enter`,children:`Select`}),(0,Q.jsx)(z_,{kbd:`Esc`,children:`Back`}),o?(0,Q.jsx)(`span`,{children:`Summary actions require the response to finish.`}):i?null:(0,Q.jsx)(`span`,{children:`Summary actions require a selected model.`})]}),t[64]=o,t[65]=n,t[66]=i,t[67]=W):W=t[67];let ee;return t[68]!==u||t[69]!==A||t[70]!==j||t[71]!==U||t[72]!==W?(ee=(0,Q.jsxs)(mh,{loop:!0,value:u,onValueChange:A,onKeyDownCapture:j,className:`min-h-0 flex-1`,children:[U,W]}),t[68]=u,t[69]=A,t[70]=j,t[71]=U,t[72]=W,t[73]=ee):ee=t[73],ee}function sv(e){return!e.disabled}function cv(e){let t=(0,$.c)(11),{isMobile:n,defaultLabel:r,disabled:i,onSave:a}=e,o=Z.useRef(null),s;t[0]===a?s=t[1]:(s=e=>{e.key===`Enter`&&(e.preventDefault(),a(e.currentTarget.value))},t[0]=a,t[1]=s);let c;t[2]!==r||t[3]!==i||t[4]!==s?(c=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center p-3`,children:(0,Q.jsx)(Dc,{ref:o,defaultValue:r,placeholder:`Optional label (empty to remove)`,disabled:i,onKeyDown:s,autoFocus:!0,className:`min-w-0 flex-1`},r)}),t[2]=r,t[3]=i,t[4]=s,t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=n?null:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-border/70 px-3 py-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(z_,{kbd:`Enter`,children:`Save`}),(0,Q.jsx)(z_,{kbd:`Esc`,children:`Back`})]}),t[6]=n,t[7]=l);let u;return t[8]!==c||t[9]!==l?(u=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10],u}function lv(e){let t=(0,$.c)(82),{open:n,onOpenChange:i,treeLoading:a,treeSubmitting:o,treeAborting:s,treeLeafId:c,treeStreamingEntryId:l,treeSummaryAvailable:u,treeQuery:d,onTreeQueryChange:f,flatTree:p,selectedTreeNodeId:m,onSelectedTreeNodeIdChange:h,selectedTreeNodeLabel:g,onSelectedTreeNodeLabelChange:_,onNavigateTreeNode:v,onAbortStreamingSession:y,onSaveTreeLabel:b}=e,[x,S]=Z.useState(`no-tools`),[C,w]=Z.useState(`browse`),[T,E]=Z.useState(dv),D=Z.useRef(null),O=Z.useRef(!1),k;t[0]!==x||t[1]!==d?(k={filterMode:x,query:d},t[0]=x,t[1]=d,t[2]=k):k=t[2];let A=Z.useRef(k),j=Wl(),M;t[3]!==p||t[4]!==T||t[5]!==x||t[6]!==c||t[7]!==d?(M=X_({flatTree:p,currentLeafId:c,query:d,filterMode:x,foldedEntryIds:T}),t[3]=p,t[4]=T,t[5]=x,t[6]=c,t[7]=d,t[8]=M):M=t[8];let N=M,P=m==null?null:N.nodeById.get(m)??null,F=!!l,I;t[9]===n?I=t[10]:(I=()=>{let e=O.current;O.current=n,!(!n||e)&&(S(`no-tools`),w(`browse`),E(new Set))},t[9]=n,t[10]=I);let L;t[11]!==n||t[12]!==m||t[13]!==c?(L=[n,m,c],t[11]=n,t[12]=m,t[13]=c,t[14]=L):L=t[14],Z.useEffect(I,L);let R,z;t[15]!==x||t[16]!==d?(R=()=>{let e=A.current;A.current={filterMode:x,query:d},!(e.filterMode===x&&e.query===d)&&E(new Set)},z=[x,d],t[15]=x,t[16]=d,t[17]=R,t[18]=z):(R=t[17],z=t[18]),Z.useEffect(R,z),Z.useEffect(()=>{n&&C!==`browse`&&!P&&w(`browse`)},[n,P,C]);let B;t[19]!==F||t[20]!==v||t[21]!==n||t[22]!==m||t[23]!==c||t[24]!==C||t[25]!==o?(B=()=>{if(!n)return;let e=e=>{let t=e.key.toLowerCase();if(C===`browse`){let n={d:`default`,t:`no-tools`,u:`user-only`,l:`labeled-only`,a:`all`}[t];if(n&&$g(e,`Control+${t.toUpperCase()}`)){e.preventDefault(),e.stopPropagation(),S(e=>L_(e,n));return}}if(e.key!==`Escape`){C===`custom`&&$g(e,`Control+Enter`)&&m&&m!==c&&!o&&!F&&(e.preventDefault(),e.stopPropagation(),v(m,{summarize:!0,customInstructions:D.current?.value??``}));return}if(C===`custom`||C===`label`){e.preventDefault(),e.stopPropagation(),w(C===`custom`?`actions`:`browse`);return}C===`actions`&&(e.preventDefault(),e.stopPropagation(),w(`browse`))};return window.addEventListener(`keydown`,e,!0),()=>{window.removeEventListener(`keydown`,e,!0)}},t[19]=F,t[20]=v,t[21]=n,t[22]=m,t[23]=c,t[24]=C,t[25]=o,t[26]=B):B=t[26];let V;t[27]!==F||t[28]!==v||t[29]!==n||t[30]!==m||t[31]!==x||t[32]!==c||t[33]!==C||t[34]!==o?(V=[v,n,m,x,c,C,F,o],t[27]=F,t[28]=v,t[29]=n,t[30]=m,t[31]=x,t[32]=c,t[33]=C,t[34]=o,t[35]=V):V=t[35],Z.useEffect(B,V);let H,U;t[36]!==n||t[37]!==C?(U=()=>{if(!n||C!==`custom`)return;let e=window.requestAnimationFrame(()=>{D.current?.focus()});return()=>{window.cancelAnimationFrame(e)}},H=[n,C],t[36]=n,t[37]=C,t[38]=H,t[39]=U):(H=t[38],U=t[39]),Z.useEffect(U,H);let W,ee;t[40]!==F||t[41]!==n||t[42]!==C?(W=()=>{!n||C!==`abort`||F||w(`actions`)},ee=[F,n,C],t[40]=F,t[41]=n,t[42]=C,t[43]=W,t[44]=ee):(W=t[43],ee=t[44]),Z.useEffect(W,ee);let G;t[45]!==F||t[46]!==h||t[47]!==_||t[48]!==N.nodeById?(G=e=>{let t=N.nodeById.get(e);t&&(h(e),_(t.label||``),w(F?`abort`:`actions`))},t[45]=F,t[46]=h,t[47]=_,t[48]=N.nodeById,t[49]=G):G=t[49];let te=G,K;t[50]!==F||t[51]!==h||t[52]!==_||t[53]!==N.nodeById?(K=e=>{if(F)return;let t=N.nodeById.get(e);t&&(h(e),_(t.label||``),w(`label`))},t[50]=F,t[51]=h,t[52]=_,t[53]=N.nodeById,t[54]=K):K=t[54];let q=K,J=!!(m&&m!==c&&P),ne;t[55]!==F||t[56]!==v||t[57]!==m?(ne=()=>{!m||F||v(m,{summarize:!0,customInstructions:D.current?.value??``})},t[55]=F,t[56]=v,t[57]=m,t[58]=ne):ne=t[58];let Y=ne,re=C===`custom`?`Summarize with custom prompt`:C===`label`?`Label selected node`:C===`abort`?`Abort response?`:C===`actions`?`Summarize branch?`:`Session tree`,ie=C===`browse`?`Browse branches, search the tree, and continue from an older point.`:C===`custom`?`Add summary instructions before continuing from the selected node.`:C===`label`?`Add or update the selected node label.`:C===`abort`?`Abort the current response before continuing from this point.`:`Choose how to continue from the selected node.`,ae=C===`browse`?(0,Q.jsx)(av,{isMobile:j,treeFilterMode:x,onTreeFilterModeChange:S,treeLoading:a,treeSubmitting:o,treeLeafId:c,treeStreamingEntryId:l,treeQuery:d,onTreeQueryChange:f,treeViewModel:N,foldedTreeNodeIds:T,onFoldedTreeNodeIdsChange:E,selectedTreeNodeId:m,onSelectTreeNode:te,onLabelTreeNode:q},n?`open`:`closed`):P?(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 px-3 py-2`,children:[(0,Q.jsx)(os,{size:`icon-sm`,variant:`ghost`,onClick:()=>w(C===`custom`?`actions`:`browse`),disabled:o||s,"aria-label":C===`custom`?`Back`:`Back to tree`,children:(0,Q.jsx)(r,{})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium`,children:C===`custom`?`Summarize with custom prompt`:C===`label`?`Label selected node`:C===`abort`?`Abort response?`:`Summarize branch?`}),(0,Q.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:rv(P)})]})]}),C===`actions`?(0,Q.jsx)(ov,{isMobile:j,canNavigateSelectedNode:J,treeSummaryAvailable:u,treeSubmitting:o,activeSessionStreaming:F,selectedTreeNodeId:m,onNavigateTreeNode:v,onCustomPrompt:()=>w(`custom`)}):C===`abort`?(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 p-3 text-sm`,children:[(0,Q.jsx)(`div`,{className:`rounded-lg border border-border/70 bg-muted/30 p-3 text-muted-foreground`,children:`Tree navigation changes the active branch. Abort the current response before continuing from the selected point.`}),(0,Q.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`The streaming node is marked with the spinner in the tree.`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 border-t border-border/70 px-3 py-3 sm:flex-row sm:justify-end`,children:[(0,Q.jsx)(os,{variant:`outline`,onClick:()=>w(`browse`),disabled:s,children:`Back`}),(0,Q.jsxs)(os,{variant:`destructive`,disabled:s||!F,onClick:()=>{Promise.resolve(y()).then(()=>{w(`actions`)}).catch(uv)},children:[s?(0,Q.jsx)(Le,{}):null,`Abort response`]})]})]}):C===`label`?(0,Q.jsx)(cv,{isMobile:j,defaultLabel:g,disabled:!m||o||F,onSave:e=>{_(e),Promise.resolve(b(e)).then(()=>{w(`browse`)})}}):(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 p-3`,children:(0,Q.jsx)(lh,{ref:D,placeholder:`Add summary instructions before continuing`,className:`min-h-32 resize-none`,disabled:!J||o||F,autoFocus:!0})}),j?(0,Q.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 border-t border-border/70 px-3 py-3 sm:flex-row sm:justify-end`,children:[(0,Q.jsx)(os,{variant:`outline`,onClick:()=>w(`actions`),disabled:o,children:`Back`}),(0,Q.jsxs)(os,{disabled:!J||o||F,onClick:Y,children:[o?(0,Q.jsx)(Le,{}):null,`Summarize & continue`]})]}):(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-border/70 px-3 py-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(z_,{kbd:Qg(`Control+Enter`),children:`Summarize`}),(0,Q.jsx)(z_,{kbd:`Esc`,children:`Back`})]})]})]}):(0,Q.jsx)(`div`,{className:`rounded-lg border border-dashed p-4 text-sm text-muted-foreground`,children:`Select a tree node first.`});if(j){let e=C===`browse`?void 0:`sr-only`,r;t[59]===re?r=t[60]:(r=(0,Q.jsx)(Ng,{children:re}),t[59]=re,t[60]=r);let a;t[61]===ie?a=t[62]:(a=(0,Q.jsx)(Pg,{children:ie}),t[61]=ie,t[62]=a);let o;t[63]!==e||t[64]!==r||t[65]!==a?(o=(0,Q.jsxs)(jg,{className:e,children:[r,a]}),t[63]=e,t[64]=r,t[65]=a,t[66]=o):o=t[66];let s;t[67]===ae?s=t[68]:(s=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-4 pb-4`,children:ae}),t[67]=ae,t[68]=s);let c;t[69]!==o||t[70]!==s?(c=(0,Q.jsxs)(Ag,{className:`max-h-[90svh] overflow-hidden`,children:[o,s]}),t[69]=o,t[70]=s,t[71]=c):c=t[71];let l;return t[72]!==i||t[73]!==n||t[74]!==c?(l=(0,Q.jsx)(Dg,{open:n,onOpenChange:i,autoFocus:!1,children:c}),t[72]=i,t[73]=n,t[74]=c,t[75]=l):l=t[75],l}let oe;return t[76]!==i||t[77]!==n||t[78]!==ae||t[79]!==ie||t[80]!==re?(oe=(0,Q.jsx)(hh,{open:n,onOpenChange:i,title:re,description:ie,className:`flex! flex-col sm:max-w-2xl`,initialFocus:!0,children:ae}),t[76]=i,t[77]=n,t[78]=ae,t[79]=ie,t[80]=re,t[81]=oe):oe=t[81],oe}function uv(){}function dv(){return new Set}function fv({ref:e,openStateRef:t,viewerContextId:n,sessionScopeKey:r,sessionId:i,treeSummaryAvailable:a,activeSessionStreaming:o}){let[s,l]=Z.useState(!1),[u,d]=Z.useState(``),[f,p]=Z.useState(null),[m,h]=Z.useState(``),g=Z.useRef(s),_=c(),v=F_.sessionTree(n,r),y=e=>{g.current=e,t&&(t.current=e),l(e)},b=Sr({queryKey:v,queryFn:()=>Zg(Xg(`/api/session/tree`,{contextId:n,sessionId:i})),staleTime:0,gcTime:1e3*60*10,enabled:!!(n&&s&&r)}),x=Dr({mutationFn:async({entryId:e,label:t})=>{if(!n)throw Error(`Viewer context unavailable`);return await Zg(Xg(`/api/session/tree/label`,{contextId:n,sessionId:i}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({entryId:e,label:t})})},onSuccess:e=>{_.setQueryData(v,e)}}),S=Dr({mutationFn:async()=>{if(!n)throw Error(`Viewer context unavailable`);return await Zg(Xg(`/api/abort`,{contextId:n,sessionId:i}),{method:`POST`})},onSuccess:async()=>{await _.invalidateQueries({queryKey:v,exact:!0,refetchType:`active`})}}),C=Dr({mutationFn:async({targetId:e,summarize:t,customInstructions:r})=>{if(!n)throw Error(`Viewer context unavailable`);return await Zg(Xg(`/api/session/tree`,{contextId:n,sessionId:i}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({targetId:e,summarize:!!t,customInstructions:r})})}}),w=async()=>{n&&(d(``),y(!0),await _.invalidateQueries({queryKey:v,exact:!0,refetchType:`active`}))},T=async(e=m)=>{if(!(!n||!f)){h(e);try{await x.mutateAsync({entryId:f,label:e})}catch(e){P.error(e instanceof Error?e.message:`Failed to save label`)}}},E=async(e,t)=>{if(n)try{let n=await C.mutateAsync({targetId:e,summarize:t?.summarize,customInstructions:t?.customInstructions});if(n.aborted){P.info(`Branch summarization cancelled`);return}if(n.cancelled){P.info(`Tree navigation cancelled`);return}y(!1),P.success(t?.summarize?`Continued from summarized branch`:`Moved session tree cursor`)}catch(e){P.error(e instanceof Error?e.message:`Failed to navigate tree`)}},D=async()=>{if(n)try{await S.mutateAsync(),P.info(`Response aborted`)}catch(e){throw P.error(e instanceof Error?e.message:`Failed to abort response`),e}};Z.useEffect(()=>{!s||!b.error||P.error(b.error instanceof Error?b.error.message:`Failed to load tree`)},[s,b.error,b.errorUpdatedAt]);let O=b.data??null,k=O?Lt(O.tree):[],A=O?.leafId??null,j=O&&`streamingEntryId`in O?O.streamingEntryId??null:o?A:null;Z.useEffect(()=>{if(!s||!O)return;let e=Lt(O.tree);p(t=>t&&e.some(e=>e.id===t)?t:O.leafId)},[O,s]),Z.useEffect(()=>{if(!O)return;let e=Lt(O.tree),t=f||O.leafId;h(e.find(e=>e.id===t)?.label||``)},[f,O]),Z.useImperativeHandle(e,()=>({open:w,close:()=>{y(!1)},isOpen:()=>g.current}),[v,n]);let M=!!(b.isPending&&!b.data),N=x.isPending||C.isPending,F=S.isPending;return(0,Q.jsx)(lv,{open:s,onOpenChange:y,treeLoading:M,treeSubmitting:N,treeAborting:F,treeLeafId:A,treeStreamingEntryId:j,treeSummaryAvailable:a,treeQuery:u,onTreeQueryChange:d,flatTree:k,selectedTreeNodeId:f,onSelectedTreeNodeIdChange:p,selectedTreeNodeLabel:m,onSelectedTreeNodeLabelChange:h,onNavigateTreeNode:(e,t)=>{E(e,t)},onAbortStreamingSession:D,onSaveTreeLabel:e=>T(e)})}function pv(e){let t=(0,$.c)(157),{pendingUiRequest:n,pendingUiValue:i,onPendingUiValueChange:a,onResolveUiRequest:o,onAuthBack:s}=e,c=Wl(),[l,u]=Z.useState(!1),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{u(!1)},t[0]=d):d=t[0];let f=n?.id,p;t[1]===f?p=t[2]:(p=[f],t[1]=f,t[2]=p),Z.useEffect(d,p);let m;t[3]===c?m=t[4]:(m=(e,t,n,r,i)=>c?(0,Q.jsx)(Dg,{open:e,onOpenChange:t,autoFocus:!1,children:(0,Q.jsxs)(Ag,{className:`max-h-[90svh] overflow-hidden`,children:[(0,Q.jsxs)(jg,{children:[(0,Q.jsx)(Ng,{children:n}),(0,Q.jsx)(Pg,{children:r})]}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-4 pb-4`,children:i})]})}):(0,Q.jsx)(hh,{open:e,onOpenChange:t,title:n,description:r,className:`sm:max-w-xl`,initialFocus:!0,children:i}),t[3]=c,t[4]=m);let h=m;if(n?.method===`auth`&&n.authUrl){let e;t[5]!==s||t[6]!==o?(e=()=>{o({cancelled:!0}),s?.()},t[5]=s,t[6]=o,t[7]=e):e=t[7];let d=e;if(l){let e;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>{e||u(!1)},t[8]=e):e=t[8];let n;t[9]!==o||t[10]!==i?(n=e=>{e.preventDefault(),i.trim()&&o({value:i})},t[9]=o,t[10]=i,t[11]=n):n=t[11];let s;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(s=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),u(!1))},t[12]=s):s=t[12];let l;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>u(!1),t[13]=l):l=t[13];let d;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(os,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:l,"aria-label":`Back to login actions`,children:(0,Q.jsx)(r,{})}),t[14]=d):d=t[14];let f;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 px-3 py-2`,children:[d,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium`,children:`Paste redirect URL`}),(0,Q.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:`Fallback only: paste the full localhost callback URL.`})]})]}),t[15]=f):f=t[15];let p;t[16]===a?p=t[17]:(p=e=>a(e.target.value),t[16]=a,t[17]=p);let m=!c,g;t[18]!==i||t[19]!==p||t[20]!==m?(g=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center p-3`,children:(0,Q.jsx)(Dc,{value:i,onChange:p,placeholder:`Final redirected URL`,autoFocus:m,className:`min-w-0 flex-1`})}),t[18]=i,t[19]=p,t[20]=m,t[21]=g):g=t[21];let _;t[22]!==c||t[23]!==i?(_=c?(0,Q.jsx)(`div`,{className:`border-t border-border/70 p-3`,children:(0,Q.jsx)(os,{type:`submit`,className:`w-full`,disabled:!i.trim(),children:`Submit URL`})}):(0,Q.jsxs)(`div`,{className:`hidden flex-wrap items-center gap-x-3 gap-y-1 border-t border-border/70 px-3 py-2 text-xs text-muted-foreground md:flex`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(hn,{children:`Enter`}),`Submit URL`]}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(hn,{children:`Esc`}),`Back`]})]}),t[22]=c,t[23]=i,t[24]=_):_=t[24];let v;t[25]!==g||t[26]!==_||t[27]!==n?(v=(0,Q.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:n,onKeyDown:s,children:[f,g,_]}),t[25]=g,t[26]=_,t[27]=n,t[28]=v):v=t[28];let y;return t[29]!==h||t[30]!==v?(y=h(!0,e,`Paste redirect URL`,`Paste the final redirected URL from the browser address bar.`,v),t[29]=h,t[30]=v,t[31]=y):y=t[31],y}let f;t[32]===d?f=t[33]:(f=e=>{e||d()},t[32]=d,t[33]=f);let p=n.title||`Log in to provider`,m=n.message||`Open the login page, then complete login in your browser.`,g=!c,_;t[34]===g?_=t[35]:(_=(0,Q.jsx)(gh,{autoFocus:g,placeholder:`Choose login action`,className:`text-base md:text-sm`}),t[34]=g,t[35]=_);let v=n.title||`Provider login`,y;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(y=[`open`,`browser`,`login`,`page`],t[36]=y):y=t[36];let b;t[37]===n.authUrl?b=t[38]:(b=()=>{window.open(n.authUrl,`_blank`,`noopener,noreferrer`)},t[37]=n.authUrl,t[38]=b);let x,S;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`truncate font-medium`,children:`Open login page`}),(0,Q.jsx)(`span`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:`Continue OAuth in your browser. Keep Pico open while the provider redirects back.`})]}),S=(0,Q.jsx)(xh,{className:`inline shrink-0 tracking-normal normal-case`,children:`Enter`}),t[39]=x,t[40]=S):(x=t[39],S=t[40]);let C;t[41]===b?C=t[42]:(C=(0,Q.jsxs)(bh,{value:`open-login-page`,keywords:y,onSelect:b,children:[x,S]}),t[41]=b,t[42]=C);let w;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(w=[`copy`,`link`,`url`,`login`],t[43]=w):w=t[43];let T;t[44]===n.authUrl?T=t[45]:(T=()=>{navigator.clipboard.writeText(n.authUrl),P.success(`Login link copied`)},t[44]=n.authUrl,t[45]=T);let E;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`truncate font-medium`,children:`Copy login link`}),(0,Q.jsx)(`span`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:`Copy the browser login link without showing the full URL.`})]}),t[46]=E):E=t[46];let D;t[47]===T?D=t[48]:(D=(0,Q.jsx)(bh,{value:`copy-login-link`,keywords:w,onSelect:T,children:E}),t[47]=T,t[48]=D);let O;t[49]!==a||t[50]!==n.authManualAllowed?(O=n.authManualAllowed&&(0,Q.jsx)(bh,{value:`paste-redirect-url`,keywords:[`paste`,`redirect`,`manual`,`fallback`],onSelect:()=>{a(``),u(!0)},children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`truncate font-medium`,children:`Paste redirect URL manually`}),(0,Q.jsx)(`span`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:`Fallback only: use this if the browser reaches a localhost callback URL but cannot connect.`})]})}),t[49]=a,t[50]=n.authManualAllowed,t[51]=O):O=t[51];let k;t[52]!==v||t[53]!==C||t[54]!==D||t[55]!==O?(k=(0,Q.jsx)(_h,{children:(0,Q.jsxs)(yh,{heading:v,children:[C,D,O]})}),t[52]=v,t[53]=C,t[54]=D,t[55]=O,t[56]=k):k=t[56];let A;t[57]!==d||t[58]!==c?(A=c?(0,Q.jsx)(`div`,{className:`border-t border-border/70 p-3`,children:(0,Q.jsx)(os,{type:`button`,variant:`outline`,className:`w-full`,onClick:d,children:`Cancel login`})}):(0,Q.jsx)(`div`,{className:`hidden border-t border-border/70 px-3 py-2 text-xs text-muted-foreground md:block`,children:`Use ↑/↓ to select, Enter to run an action, and Esc to go back.`}),t[57]=d,t[58]=c,t[59]=A):A=t[59];let j;t[60]!==_||t[61]!==k||t[62]!==A?(j=(0,Q.jsxs)(mh,{loop:!0,shouldFilter:!0,children:[_,k,A]}),t[60]=_,t[61]=k,t[62]=A,t[63]=j):j=t[63];let M;return t[64]!==h||t[65]!==j||t[66]!==f||t[67]!==p||t[68]!==m?(M=h(!0,f,p,m,j),t[64]=h,t[65]=j,t[66]=f,t[67]=p,t[68]=m,t[69]=M):M=t[69],M}if(n?.method===`auth_input`){let e=!!n.allowEmpty,l;t[70]!==s||t[71]!==o?(l=()=>{o({cancelled:!0}),s?.()},t[70]=s,t[71]=o,t[72]=l):l=t[72];let u=l,d;t[73]===u?d=t[74]:(d=e=>{e||u()},t[73]=u,t[74]=d);let f=n.title||`Log in to provider`,p=n.message||`Enter the requested login information.`,m;t[75]!==e||t[76]!==o||t[77]!==i?(m=t=>{t.preventDefault(),!(!e&&!i.trim())&&o({value:i})},t[75]=e,t[76]=o,t[77]=i,t[78]=m):m=t[78];let g;t[79]===u?g=t[80]:(g=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),u())},t[79]=u,t[80]=g);let _;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(r,{}),t[81]=_):_=t[81];let v;t[82]===u?v=t[83]:(v=(0,Q.jsx)(os,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:u,"aria-label":`Back to login providers`,children:_}),t[82]=u,t[83]=v);let y=n.title||`Log in to provider`,b;t[84]===y?b=t[85]:(b=(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium`,children:y}),t[84]=y,t[85]=b);let x=n.message||`Enter the requested login information.`,S;t[86]===x?S=t[87]:(S=(0,Q.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:x}),t[86]=x,t[87]=S);let C;t[88]!==b||t[89]!==S?(C=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,S]}),t[88]=b,t[89]=S,t[90]=C):C=t[90];let w;t[91]!==v||t[92]!==C?(w=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 px-3 py-2`,children:[v,C]}),t[91]=v,t[92]=C,t[93]=w):w=t[93];let T;t[94]===a?T=t[95]:(T=e=>a(e.target.value),t[94]=a,t[95]=T);let E=!c,D;t[96]!==n.placeholder||t[97]!==i||t[98]!==T||t[99]!==E?(D=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center p-3`,children:(0,Q.jsx)(Dc,{value:i,onChange:T,placeholder:n.placeholder,autoFocus:E,className:`min-w-0 flex-1`})}),t[96]=n.placeholder,t[97]=i,t[98]=T,t[99]=E,t[100]=D):D=t[100];let O;t[101]!==e||t[102]!==u||t[103]!==c||t[104]!==i?(O=c?(0,Q.jsxs)(`div`,{className:`space-y-2 border-t border-border/70 p-3`,children:[(0,Q.jsx)(os,{type:`submit`,className:`w-full`,disabled:!e&&!i.trim(),children:`Continue`}),(0,Q.jsx)(os,{type:`button`,variant:`outline`,className:`w-full`,onClick:u,children:`Cancel login`})]}):(0,Q.jsxs)(`div`,{className:`hidden flex-wrap items-center gap-x-3 gap-y-1 border-t border-border/70 px-3 py-2 text-xs text-muted-foreground md:flex`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(hn,{children:`Enter`}),`Continue`]}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(hn,{children:`Esc`}),`Back`]})]}),t[101]=e,t[102]=u,t[103]=c,t[104]=i,t[105]=O):O=t[105];let k;t[106]!==g||t[107]!==w||t[108]!==D||t[109]!==O||t[110]!==m?(k=(0,Q.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:m,onKeyDown:g,children:[w,D,O]}),t[106]=g,t[107]=w,t[108]=D,t[109]=O,t[110]=m,t[111]=k):k=t[111];let A;return t[112]!==h||t[113]!==k||t[114]!==d||t[115]!==f||t[116]!==p?(A=h(!0,d,f,p,k),t[112]=h,t[113]=k,t[114]=d,t[115]=f,t[116]=p,t[117]=A):A=t[117],A}let g=!!n,_;t[118]!==o||t[119]!==n?(_=e=>{!e&&n&&o({cancelled:!0})},t[118]=o,t[119]=n,t[120]=_):_=t[120];let v=n?.title||`Pico request`,y;t[121]===v?y=t[122]:(y=(0,Q.jsx)(dc,{children:v}),t[121]=v,t[122]=y);let b;t[123]===n?b=t[124]:(b=n?.message&&(0,Q.jsx)(fc,{children:n.message}),t[123]=n,t[124]=b);let x;t[125]!==y||t[126]!==b?(x=(0,Q.jsxs)(lc,{children:[y,b]}),t[125]=y,t[126]=b,t[127]=x):x=t[127];let S;t[128]!==a||t[129]!==n||t[130]!==i?(S=(n?.method===`input`||n?.method===`editor`)&&(n.method===`editor`?(0,Q.jsx)(lh,{value:i,onChange:e=>a(e.target.value),placeholder:n.placeholder}):(0,Q.jsx)(Dc,{value:i,onChange:e=>a(e.target.value),placeholder:n.placeholder})),t[128]=a,t[129]=n,t[130]=i,t[131]=S):S=t[131];let C;t[132]!==o||t[133]!==n?(C=n?.method===`select`&&(0,Q.jsx)(`div`,{className:`space-y-2`,children:n.options?.map(e=>{let t=typeof e==`string`?e:e.value;return(0,Q.jsx)(os,{variant:`outline`,className:`w-full justify-start`,onClick:()=>o({value:t}),children:typeof e==`string`?e:e.label||e.value},t)})}),t[132]=o,t[133]=n,t[134]=C):C=t[134];let w;t[135]===o?w=t[136]:(w=(0,Q.jsx)(os,{variant:`outline`,onClick:()=>o({cancelled:!0}),children:`Cancel`}),t[135]=o,t[136]=w);let T;t[137]!==o||t[138]!==n?.method?(T=n?.method===`confirm`&&(0,Q.jsx)(os,{onClick:()=>o({confirmed:!0}),children:`Confirm`}),t[137]=o,t[138]=n?.method,t[139]=T):T=t[139];let E;t[140]!==o||t[141]!==n?.method||t[142]!==i?(E=(n?.method===`input`||n?.method===`editor`)&&(0,Q.jsx)(os,{onClick:()=>o({value:i}),children:`Submit`}),t[140]=o,t[141]=n?.method,t[142]=i,t[143]=E):E=t[143];let D;t[144]!==w||t[145]!==T||t[146]!==E?(D=(0,Q.jsxs)(uc,{children:[w,T,E]}),t[144]=w,t[145]=T,t[146]=E,t[147]=D):D=t[147];let O;t[148]!==x||t[149]!==S||t[150]!==C||t[151]!==D?(O=(0,Q.jsxs)(cc,{children:[x,S,C,D]}),t[148]=x,t[149]=S,t[150]=C,t[151]=D,t[152]=O):O=t[152];let k;return t[153]!==O||t[154]!==g||t[155]!==_?(k=(0,Q.jsx)(ac,{open:g,onOpenChange:_,children:O}),t[153]=O,t[154]=g,t[155]=_,t[156]=k):k=t[156],k}function mv(e){let t=(0,$.c)(24),{ref:n,openStateRef:r,viewerContextId:i,sessionId:a,onAuthBack:o}=e,[s,c]=Z.useState(null),[l,u]=Z.useState(``),d=Z.useRef(!1),f=Z.useRef(null),p;t[0]===r?p=t[1]:(p=e=>{d.current=e,r&&(r.current=e)},t[0]=r,t[1]=p);let m=p,h;t[2]!==a||t[3]!==i?(h={mutationFn:async e=>{let{requestId:t,body:n}=e;if(!i)throw Error(`Viewer context unavailable`);return await Zg(Xg(`/api/ui/${encodeURIComponent(t)}`,{contextId:i,sessionId:a}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(n)})}},t[2]=a,t[3]=i,t[4]=h):h=t[4];let g=Dr(h),_;t[5]===m?_=t[6]:(_=e=>{e&&f.current?.id!==e||(f.current=null,c(null),u(``),m(!1))},t[5]=m,t[6]=_);let v=_,y;t[7]!==v||t[8]!==s||t[9]!==g||t[10]!==i?(y=async e=>{if(!i||!s)return;let t=s.id;try{await g.mutateAsync({requestId:t,body:e}),v(t)}catch(e){let t=e;P.error(t instanceof Error?t.message:`Failed to resolve UI request`)}},t[7]=v,t[8]=s,t[9]=g,t[10]=i,t[11]=y):y=t[11];let b=y,x;t[12]!==v||t[13]!==m?(x=()=>({open:e=>{f.current=e,c(e),u(e.prefill||``),m(!0)},close:()=>{v()},isOpen:()=>d.current}),t[12]=v,t[13]=m,t[14]=x):x=t[14];let S;t[15]===s?S=t[16]:(S=[s],t[15]=s,t[16]=S),Z.useImperativeHandle(n,x,S);let C;t[17]===b?C=t[18]:(C=e=>{b(e)},t[17]=b,t[18]=C);let w;return t[19]!==o||t[20]!==s||t[21]!==l||t[22]!==C?(w=(0,Q.jsx)(pv,{pendingUiRequest:s,pendingUiValue:l,onPendingUiValueChange:u,onResolveUiRequest:C,onAuthBack:o}),t[19]=o,t[20]=s,t[21]=l,t[22]=C,t[23]=w):w=t[23],w}function hv(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(hn,{children:n}),t[0]=n,t[1]=r),r}function gv(e){let t=(0,$.c)(40),{open:n,onOpenChange:r,renameValue:i,onRenameValueChange:a,onRenameSession:o}=e,s=Wl(),c;t[0]===a?c=t[1]:(c=e=>a(e.target.value),t[0]=a,t[1]=c);let l;t[2]===o?l=t[3]:(l=e=>{e.key!==`Enter`||e.nativeEvent.isComposing||(e.preventDefault(),o())},t[2]=o,t[3]=l);let u;t[4]!==i||t[5]!==c||t[6]!==l?(u=(0,Q.jsx)(Dc,{value:i,onChange:c,onKeyDown:l,placeholder:`Session name`}),t[4]=i,t[5]=c,t[6]=l,t[7]=u):u=t[7];let d=u;if(s){let e;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(jg,{children:[(0,Q.jsx)(Ng,{children:`Rename session`}),(0,Q.jsx)(Pg,{children:`Update the display name shown in the sidebar.`})]}),t[8]=e):e=t[8];let i;t[9]===d?i=t[10]:(i=(0,Q.jsx)(`div`,{className:`px-4 pb-2`,children:d}),t[9]=d,t[10]=i);let a;t[11]===r?a=t[12]:(a=(0,Q.jsx)(os,{variant:`outline`,onClick:()=>r(!1),children:`Cancel`}),t[11]=r,t[12]=a);let s;t[13]===o?s=t[14]:(s=(0,Q.jsx)(os,{onClick:o,children:`Save`}),t[13]=o,t[14]=s);let c;t[15]!==a||t[16]!==s?(c=(0,Q.jsxs)(Mg,{className:`border-t border-border/70`,children:[a,s]}),t[15]=a,t[16]=s,t[17]=c):c=t[17];let l;t[18]!==i||t[19]!==c?(l=(0,Q.jsxs)(Ag,{children:[e,i,c]}),t[18]=i,t[19]=c,t[20]=l):l=t[20];let u;return t[21]!==r||t[22]!==n||t[23]!==l?(u=(0,Q.jsx)(Dg,{open:n,onOpenChange:r,autoFocus:!1,children:l}),t[21]=r,t[22]=n,t[23]=l,t[24]=u):u=t[24],u}let f;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsxs)(lc,{children:[(0,Q.jsx)(dc,{children:`Rename session`}),(0,Q.jsx)(fc,{children:`Update the display name shown in the sidebar.`})]}),t[25]=f):f=t[25];let p;t[26]===r?p=t[27]:(p=(0,Q.jsx)(os,{variant:`outline`,onClick:()=>r(!1),children:`Cancel`}),t[26]=r,t[27]=p);let m;t[28]===o?m=t[29]:(m=(0,Q.jsx)(os,{onClick:o,children:`Save`}),t[28]=o,t[29]=m);let h;t[30]!==p||t[31]!==m?(h=(0,Q.jsxs)(uc,{children:[p,m]}),t[30]=p,t[31]=m,t[32]=h):h=t[32];let g;t[33]!==d||t[34]!==h?(g=(0,Q.jsxs)(cc,{children:[f,d,h]}),t[33]=d,t[34]=h,t[35]=g):g=t[35];let _;return t[36]!==r||t[37]!==n||t[38]!==g?(_=(0,Q.jsx)(ac,{open:n,onOpenChange:r,children:g}),t[36]=r,t[37]=n,t[38]=g,t[39]=_):_=t[39],_}function _v(e){let t=(0,$.c)(22),{ref:n,openStateRef:r,onRenameSession:i}=e,[a,o]=Z.useState(!1),[s,c]=Z.useState(``),l=Z.useRef(``),u=Z.useRef(a),d;t[0]===r?d=t[1]:(d=e=>{u.current=e,r&&(r.current=e),o(e)},t[0]=r,t[1]=d);let f=d,p;t[2]===f?p=t[3]:(p=e=>{let t=e.path.trim();t&&(l.current=t,c(e.title),f(!0))},t[2]=f,t[3]=p);let m=p,h;t[4]!==i||t[5]!==s||t[6]!==f?(h=async()=>{await i(l.current,s)!==!1&&f(!1)},t[4]=i,t[5]=s,t[6]=f,t[7]=h):h=t[7];let g=h,_;t[8]!==m||t[9]!==f?(_=()=>({open:m,openForEntry:e=>{e.path&&m({path:e.path,title:e.title||``})},close:()=>{f(!1)},isOpen:()=>u.current}),t[8]=m,t[9]=f,t[10]=_):_=t[10];let v;t[11]===s?v=t[12]:(v=[s],t[11]=s,t[12]=v),Z.useImperativeHandle(n,_,v);let y;t[13]===f?y=t[14]:(y=e=>{f(e)},t[13]=f,t[14]=y);let b;t[15]===g?b=t[16]:(b=()=>{g()},t[15]=g,t[16]=b);let x;return t[17]!==a||t[18]!==s||t[19]!==y||t[20]!==b?(x=(0,Q.jsx)(gv,{open:a,onOpenChange:y,renameValue:s,onRenameValueChange:c,onRenameSession:b}),t[17]=a,t[18]=s,t[19]=y,t[20]=b,t[21]=x):x=t[21],x}function vv(e){let t=(0,$.c)(42),{open:n,onOpenChange:r,title:i,description:a,onDeleteSession:o}=e;if(Wl()){let e;t[0]===i?e=t[1]:(e=(0,Q.jsx)(Ng,{children:i}),t[0]=i,t[1]=e);let s;t[2]===a?s=t[3]:(s=(0,Q.jsx)(Pg,{children:a}),t[2]=a,t[3]=s);let c;t[4]!==e||t[5]!==s?(c=(0,Q.jsxs)(jg,{children:[e,s]}),t[4]=e,t[5]=s,t[6]=c):c=t[6];let l;t[7]===r?l=t[8]:(l=(0,Q.jsx)(os,{variant:`outline`,onClick:()=>r(!1),children:`Cancel`}),t[7]=r,t[8]=l);let u;t[9]===o?u=t[10]:(u=(0,Q.jsx)(os,{variant:`destructive`,onClick:o,children:`Delete`}),t[9]=o,t[10]=u);let d;t[11]!==l||t[12]!==u?(d=(0,Q.jsxs)(Mg,{className:`border-t border-border/70`,children:[l,u]}),t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;t[14]!==c||t[15]!==d?(f=(0,Q.jsxs)(Ag,{children:[c,d]}),t[14]=c,t[15]=d,t[16]=f):f=t[16];let p;return t[17]!==r||t[18]!==n||t[19]!==f?(p=(0,Q.jsx)(Dg,{open:n,onOpenChange:r,children:f}),t[17]=r,t[18]=n,t[19]=f,t[20]=p):p=t[20],p}let s;t[21]===i?s=t[22]:(s=(0,Q.jsx)(dc,{children:i}),t[21]=i,t[22]=s);let c;t[23]===a?c=t[24]:(c=(0,Q.jsx)(fc,{children:a}),t[23]=a,t[24]=c);let l;t[25]!==s||t[26]!==c?(l=(0,Q.jsxs)(lc,{children:[s,c]}),t[25]=s,t[26]=c,t[27]=l):l=t[27];let u;t[28]===r?u=t[29]:(u=(0,Q.jsx)(os,{variant:`outline`,onClick:()=>r(!1),children:`Cancel`}),t[28]=r,t[29]=u);let d;t[30]===o?d=t[31]:(d=(0,Q.jsx)(os,{variant:`destructive`,onClick:o,children:`Delete`}),t[30]=o,t[31]=d);let f;t[32]!==u||t[33]!==d?(f=(0,Q.jsxs)(uc,{children:[u,d]}),t[32]=u,t[33]=d,t[34]=f):f=t[34];let p;t[35]!==l||t[36]!==f?(p=(0,Q.jsxs)(cc,{children:[l,f]}),t[35]=l,t[36]=f,t[37]=p):p=t[37];let m;return t[38]!==r||t[39]!==n||t[40]!==p?(m=(0,Q.jsx)(ac,{open:n,onOpenChange:r,children:p}),t[38]=r,t[39]=n,t[40]=p,t[41]=m):m=t[41],m}function yv(e){let t=(0,$.c)(58),{open:n,onOpenChange:r,directory:i,daysValue:a,preview:o,previewLoading:s,deleteLoading:c,onDaysValueChange:l,onPreview:u,onDelete:d}=e,f=Wl(),p=o?.matchingSessions.length??0,m=!!o&&p>0&&!c,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:`old-session-days`,children:`Older than days`}),t[0]=h):h=t[0];let g;t[1]===l?g=t[2]:(g=e=>l(e.target.value),t[1]=l,t[2]=g);let _;t[3]!==a||t[4]!==g?(_=(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[h,(0,Q.jsx)(Dc,{id:`old-session-days`,inputMode:`numeric`,value:a,onChange:g,placeholder:`30`})]}),t[3]=a,t[4]=g,t[5]=_):_=t[5];let v=_,y;t[6]!==p||t[7]!==o?(y=o?(0,Q.jsx)(`div`,{className:`rounded-lg border bg-muted/30 p-3 text-sm`,children:p>0?(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`p`,{className:`font-medium`,children:[p,` session`,p===1?``:`s`,` will be deleted.`]}),(0,Q.jsxs)(`div`,{className:`max-h-48 space-y-1 overflow-y-auto text-muted-foreground`,children:[o.matchingSessions.slice(0,20).map(bv),p>20?(0,Q.jsxs)(`div`,{children:[`…and `,p-20,` more`]}):null]})]}):(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:`No old sessions found.`})}):null,t[6]=p,t[7]=o,t[8]=y):y=t[8];let b=y,x;t[9]===i?x=t[10]:(x=(0,Q.jsx)(`p`,{className:`text-sm break-all text-muted-foreground`,children:i}),t[9]=i,t[10]=x);let S;t[11]!==v||t[12]!==b||t[13]!==x?(S=(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[x,v,b]}),t[11]=v,t[12]=b,t[13]=x,t[14]=S):S=t[14];let C=S,w;t[15]===r?w=t[16]:(w=()=>r(!1),t[15]=r,t[16]=w);let T;t[17]!==c||t[18]!==w?(T=(0,Q.jsx)(os,{variant:`outline`,onClick:w,disabled:c,children:`Cancel`}),t[17]=c,t[18]=w,t[19]=T):T=t[19];let E;t[20]===s?E=t[21]:(E=s?(0,Q.jsx)(Le,{}):null,t[20]=s,t[21]=E);let D;t[22]!==u||t[23]!==s||t[24]!==E?(D=(0,Q.jsxs)(os,{variant:`outline`,onClick:u,disabled:s,children:[E,`Preview`]}),t[22]=u,t[23]=s,t[24]=E,t[25]=D):D=t[25];let O=!m,k;t[26]===c?k=t[27]:(k=c?(0,Q.jsx)(Le,{}):null,t[26]=c,t[27]=k);let A;t[28]!==d||t[29]!==O||t[30]!==k?(A=(0,Q.jsxs)(os,{variant:`destructive`,onClick:d,disabled:O,children:[k,`Delete`]}),t[28]=d,t[29]=O,t[30]=k,t[31]=A):A=t[31];let j;t[32]!==D||t[33]!==A||t[34]!==T?(j=(0,Q.jsxs)(Q.Fragment,{children:[T,D,A]}),t[32]=D,t[33]=A,t[34]=T,t[35]=j):j=t[35];let M=j;if(f){let e;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(jg,{children:[(0,Q.jsx)(Ng,{children:`Delete old sessions`}),(0,Q.jsx)(Pg,{children:`Preview and delete inactive sessions in this directory.`})]}),t[36]=e):e=t[36];let i;t[37]===C?i=t[38]:(i=(0,Q.jsx)(`div`,{className:`px-4 pb-2`,children:C}),t[37]=C,t[38]=i);let a;t[39]===M?a=t[40]:(a=(0,Q.jsx)(Mg,{className:`border-t border-border/70`,children:M}),t[39]=M,t[40]=a);let o;t[41]!==i||t[42]!==a?(o=(0,Q.jsxs)(Ag,{children:[e,i,a]}),t[41]=i,t[42]=a,t[43]=o):o=t[43];let s;return t[44]!==r||t[45]!==n||t[46]!==o?(s=(0,Q.jsx)(Dg,{open:n,onOpenChange:r,autoFocus:!1,children:o}),t[44]=r,t[45]=n,t[46]=o,t[47]=s):s=t[47],s}let N;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsxs)(lc,{children:[(0,Q.jsx)(dc,{children:`Delete old sessions`}),(0,Q.jsx)(fc,{children:`Preview and delete inactive sessions in this directory.`})]}),t[48]=N):N=t[48];let P;t[49]===M?P=t[50]:(P=(0,Q.jsx)(uc,{children:M}),t[49]=M,t[50]=P);let F;t[51]!==C||t[52]!==P?(F=(0,Q.jsxs)(cc,{children:[N,C,P]}),t[51]=C,t[52]=P,t[53]=F):F=t[53];let I;return t[54]!==r||t[55]!==n||t[56]!==F?(I=(0,Q.jsx)(ac,{open:n,onOpenChange:r,children:F}),t[54]=r,t[55]=n,t[56]=F,t[57]=I):I=t[57],I}function bv(e){return(0,Q.jsx)(`div`,{className:`truncate`,children:e.title},e.path||e.id)}function xv({ref:e,openStateRef:t,viewerContextId:n}){let r=c(),[i,a]=Z.useState(!1),[o,s]=Z.useState(``),[l,u]=Z.useState(`30`),[d,f]=Z.useState(null),p=Z.useRef(i),m=e=>{p.current=e,t&&(t.current=e),a(e),e||f(null)},h=()=>{let e=Number(l);if(!Number.isFinite(e)||e<=0)throw Error(`Enter a positive number of days`);return e*24*60*60*1e3},g=Dr({mutationFn:async e=>await Zg(Xg(`/api/directory-sessions/cleanup`,{contextId:n}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({directory:o,olderThanMs:h(),dryRun:e})})}),_=async()=>{try{f(await g.mutateAsync(!0))}catch(e){P.error(e instanceof Error?e.message:`Failed to preview sessions`)}},v=async()=>{try{let e=await g.mutateAsync(!1);f(e),await r.invalidateQueries({queryKey:F_.directorySessionsIndex(n,o)}),P.success(`Deleted ${e.deletedSessionIds.length} old session${e.deletedSessionIds.length===1?``:`s`}`),m(!1)}catch(e){P.error(e instanceof Error?e.message:`Failed to delete sessions`)}},y=e=>{let t=e.trim();t&&(s(t),u(`30`),f(null),m(!0))};return Z.useImperativeHandle(e,()=>({open:y,close:()=>{m(!1)},isOpen:()=>p.current}),[l,o,n]),(0,Q.jsx)(yv,{open:i,onOpenChange:m,directory:o,daysValue:l,preview:d,previewLoading:g.isPending&&!d,deleteLoading:g.isPending&&!!d,onDaysValueChange:e=>{u(e),f(null)},onPreview:()=>{_()},onDelete:()=>{v()}})}function Sv(e){let t=[],n=new Set;for(let r of e){if(!r.path)continue;let e=`${r.path}:${r.id||``}`;n.has(e)||(n.add(e),t.push(r))}return t}function Cv(e){let t=(0,$.c)(22),{ref:n,openStateRef:r,onDeleteSession:i}=e,[a,o]=Z.useState(!1),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=[],t[0]=s):s=t[0];let[c,l]=Z.useState(s),u=Z.useRef(a),d;t[1]===r?d=t[2]:(d=e=>{u.current=e,r&&(r.current=e),o(e),e||l([])},t[1]=r,t[2]=d);let f=d,p;t[3]===f?p=t[4]:(p=e=>{let t=Sv(e);t.length!==0&&(l(t),f(!0))},t[3]=f,t[4]=p);let m=p,h;t[5]!==i||t[6]!==f||t[7]!==c?(h=async()=>{await i(c)!==!1&&f(!1)},t[5]=i,t[6]=f,t[7]=c,t[8]=h):h=t[8];let g=h,_;t[9]!==m||t[10]!==f?(_=()=>({open:m,close:()=>{f(!1)},isOpen:()=>u.current}),t[9]=m,t[10]=f,t[11]=_):_=t[11];let v;t[12]===c?v=t[13]:(v=[c],t[12]=c,t[13]=v),Z.useImperativeHandle(n,_,v);let y=c.length===1?`Delete session`:`Delete sessions`,b=c.length===1?`Delete "${c[0]?.title||`New session`}" from disk?`:`Delete ${c.length} selected sessions from disk?`,x;t[14]===g?x=t[15]:(x=()=>{g()},t[14]=g,t[15]=x);let S;return t[16]!==b||t[17]!==a||t[18]!==f||t[19]!==x||t[20]!==y?(S=(0,Q.jsx)(vv,{open:a,onOpenChange:f,title:y,description:b,onDeleteSession:x}),t[16]=b,t[17]=a,t[18]=f,t[19]=x,t[20]=y,t[21]=S):S=t[21],S}function wv(e){let t=(0,$.c)(48),{open:n,onOpenChange:r,forkLoading:i,forkMessages:a,onForkFromMessage:o}=e,[s,c]=Z.useState(``),l=Wl(),u=zg(l),d,f;t[0]!==s||t[1]!==n?(d=()=>{!n&&s&&c(``)},f=[n,s],t[0]=s,t[1]=n,t[2]=d,t[3]=f):(d=t[2],f=t[3]),Z.useEffect(d,f);let p,m,h,g,_,v,y,b;if(t[4]!==i||t[5]!==a||t[6]!==s||t[7]!==o||t[8]!==u){let e;t[17]===s?e=t[18]:(e=e=>e.text.toLowerCase().includes(s.trim().toLowerCase()),t[17]=s,t[18]=e);let n=(a??[]).filter(e);m=mh,_=!1,v=!0,y=`min-h-0 flex-1 rounded-lg`,t[19]!==s||t[20]!==u?(b=(0,Q.jsx)(gh,{autoFocus:u,value:s,onValueChange:c,placeholder:`Search fork points`,className:`text-base md:text-sm`}),t[19]=s,t[20]=u,t[21]=b):b=t[21],p=_h,h=`max-h-none min-h-0 flex-1 md:max-h-[min(70vh,32rem)]`,g=i?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-6 text-sm text-muted-foreground`,children:[(0,Q.jsx)(Le,{}),` Loading fork points…`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(vh,{children:a&&a.length>0?`No fork points match your search.`:`No forkable prompts found.`}),n.length>0?(0,Q.jsx)(yh,{heading:`Fork points`,children:n.map(e=>(0,Q.jsx)(bh,{value:e.text,onSelect:()=>o(e.entryId),children:(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Q.jsx)(`div`,{className:`line-clamp-3 text-sm whitespace-pre-wrap text-foreground`,children:e.text})})},e.entryId))}):null]}),t[4]=i,t[5]=a,t[6]=s,t[7]=o,t[8]=u,t[9]=p,t[10]=m,t[11]=h,t[12]=g,t[13]=_,t[14]=v,t[15]=y,t[16]=b}else p=t[9],m=t[10],h=t[11],g=t[12],_=t[13],v=t[14],y=t[15],b=t[16];let x;t[22]!==p||t[23]!==h||t[24]!==g?(x=(0,Q.jsx)(p,{className:h,children:g}),t[22]=p,t[23]=h,t[24]=g,t[25]=x):x=t[25];let S;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(hv,{children:`↑↓`}),` Navigate`]}),t[26]=S):S=t[26];let C;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(hv,{children:`Enter`}),` Fork`]}),t[27]=C):C=t[27];let w;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsxs)(`div`,{className:`hidden flex-wrap items-center gap-x-3 gap-y-1 border-t border-border/70 px-3 py-2 text-xs text-muted-foreground md:flex`,children:[S,C,(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(hv,{children:`Esc`}),` Close`]})]}),t[28]=w):w=t[28];let T;t[29]!==m||t[30]!==_||t[31]!==v||t[32]!==y||t[33]!==b||t[34]!==x?(T=(0,Q.jsxs)(m,{shouldFilter:_,loop:v,className:y,children:[b,x,w]}),t[29]=m,t[30]=_,t[31]=v,t[32]=y,t[33]=b,t[34]=x,t[35]=T):T=t[35];let E=T;if(l){let e;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(jg,{children:[(0,Q.jsx)(Ng,{children:`Fork session`}),(0,Q.jsx)(Pg,{children:`Search earlier user prompts and branch from a specific point.`})]}),t[36]=e):e=t[36];let i;t[37]===E?i=t[38]:(i=(0,Q.jsxs)(Ag,{className:`max-h-[90svh] overflow-hidden`,children:[e,(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-4 pb-4`,children:E})]}),t[37]=E,t[38]=i);let a;return t[39]!==r||t[40]!==n||t[41]!==u||t[42]!==i?(a=(0,Q.jsx)(Dg,{open:n,onOpenChange:r,autoFocus:u,children:i}),t[39]=r,t[40]=n,t[41]=u,t[42]=i,t[43]=a):a=t[43],a}let D;return t[44]!==E||t[45]!==r||t[46]!==n?(D=(0,Q.jsx)(hh,{open:n,onOpenChange:r,title:`Fork session`,description:`Search earlier user prompts and branch from a specific point.`,className:`sm:max-w-2xl`,initialFocus:!0,children:E}),t[44]=E,t[45]=r,t[46]=n,t[47]=D):D=t[47],D}function Tv(e){let t=(0,$.c)(46),{ref:n,openStateRef:r,viewerContextId:i,sessionScopeKey:a,sessionId:o}=e,[s,l]=Z.useState(!1),u=Z.useRef(s),d=c(),f;t[0]!==a||t[1]!==i?(f=F_.forkableMessages(i,a),t[0]=a,t[1]=i,t[2]=f):f=t[2];let p=f,m;t[3]===r?m=t[4]:(m=e=>{u.current=e,r&&(r.current=e),l(e)},t[3]=r,t[4]=m);let h=m,g;t[5]!==o||t[6]!==i?(g=()=>Zg(Xg(`/api/session/fork`,{contextId:i,sessionId:o})),t[5]=o,t[6]=i,t[7]=g):g=t[7];let _=!!(i&&s&&a),v;t[8]!==p||t[9]!==g||t[10]!==_?(v={queryKey:p,queryFn:g,staleTime:0,gcTime:6e5,enabled:_},t[8]=p,t[9]=g,t[10]=_,t[11]=v):v=t[11];let y=Sr(v),b;t[12]!==o||t[13]!==i?(b={mutationFn:async e=>{if(!i)throw Error(`Viewer context unavailable`);return await Zg(Xg(`/api/session/fork`,{contextId:i,sessionId:o}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({entryId:e})})}},t[12]=o,t[13]=i,t[14]=b):b=t[14];let x=Dr(b),S;t[15]!==d||t[16]!==p||t[17]!==h||t[18]!==i?(S=async()=>{i&&(h(!0),await d.invalidateQueries({queryKey:p,exact:!0,refetchType:`active`}))},t[15]=d,t[16]=p,t[17]=h,t[18]=i,t[19]=S):S=t[19];let C=S,w;t[20]!==x||t[21]!==h||t[22]!==i?(w=async e=>{if(i)try{await x.mutateAsync(e),h(!1),P.success(`Forked session`)}catch(e){let t=e;P.error(t instanceof Error?t.message:`Failed to fork session`)}},t[20]=x,t[21]=h,t[22]=i,t[23]=w):w=t[23];let T=w,E;t[24]!==y.error||t[25]!==s||t[26]!==h?(E=()=>{!s||!y.error||(P.error(y.error instanceof Error?y.error.message:`Failed to load fork points`),h(!1))},t[24]=y.error,t[25]=s,t[26]=h,t[27]=E):E=t[27];let D;t[28]!==y.error||t[29]!==y.errorUpdatedAt||t[30]!==s?(D=[y.error,y.errorUpdatedAt,s],t[28]=y.error,t[29]=y.errorUpdatedAt,t[30]=s,t[31]=D):D=t[31],Z.useEffect(E,D);let O;t[32]!==C||t[33]!==h?(O=()=>({open:C,close:()=>{h(!1)},isOpen:()=>u.current}),t[32]=C,t[33]=h,t[34]=O):O=t[34];let k;t[35]!==p||t[36]!==i?(k=[p,i],t[35]=p,t[36]=i,t[37]=k):k=t[37],Z.useImperativeHandle(n,O,k);let A=!!(y.isPending&&!y.data||x.isPending),j=y.data?.messages??null,M;t[38]===T?M=t[39]:(M=e=>{T(e)},t[38]=T,t[39]=M);let N;return t[40]!==A||t[41]!==s||t[42]!==h||t[43]!==j||t[44]!==M?(N=(0,Q.jsx)(wv,{open:s,onOpenChange:h,forkLoading:A,forkMessages:j,onForkFromMessage:M}),t[40]=A,t[41]=s,t[42]=h,t[43]=j,t[44]=M,t[45]=N):N=t[45],N}var Ev=new WeakMap;function Dv(e,t=Object.is){let n=Ni(e);return Ev.set(n,t),n}function Ov(e,t){return typeof t==`function`?t(e):t}function kv(e,t,n){let r=e.state,i=Ov(r,t);(n??Ev.get(e)??Object.is)(r,i)||e.setState(()=>i)}function Av(e,t,n,r=Object.is){kv(e,e=>{let i=Ov(e[t],n);return r(e[t],i)?e:{...e,[t]:i}})}function jv(e){return e.label||e.value}function Mv(e){let t=(0,$.c)(15),{visibleCompletion:n,slashMenuState:r,slashSelectionStore:i,onHoverCompletion:a,onApplyCompletion:o,onHoverSlashCommand:s,onApplySlashSuggestion:c}=e,l=Z.useRef(null),u=Z.useSyncExternalStore(i.subscribe,i.getSnapshot,i.getSnapshot),d=n?n.selectedIndex:u,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{(l.current?.querySelector(`[data-composer-assist-selected='true']`))?.scrollIntoView({block:`nearest`})},t[0]=f):f=t[0];let p;if(t[1]!==d||t[2]!==r||t[3]!==n?(p=[d,n,r],t[1]=d,t[2]=r,t[3]=n,t[4]=p):p=t[4],Z.useEffect(f,p),!n&&!r)return null;let m;t[5]!==o||t[6]!==c||t[7]!==a||t[8]!==s||t[9]!==r||t[10]!==u||t[11]!==n?(m=n?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[n.items.map((e,t)=>{let r=t===n.selectedIndex;return(0,Q.jsxs)(`button`,{type:`button`,"data-composer-assist-selected":r?`true`:void 0,className:on(`flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left text-sm`,r?`bg-muted`:`hover:bg-muted/70`),onMouseEnter:()=>{a(t)},onClick:()=>{o(e)},children:[(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block truncate font-medium`,children:jv(e)}),e.description?(0,Q.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.description}):null]}),r?(0,Q.jsx)(Ta,{className:`mt-0.5 shrink-0`}):null]},`${e.value}:${e.description||e.label}`)}),(0,Q.jsx)(Gl,{}),(0,Q.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:n.query.kind===`file-reference`?`@ file references`:`Path suggestions`})]}):r?(0,Q.jsx)(`div`,{className:`flex flex-col gap-1`,children:r.commands.map((e,t)=>{let n=t===u;return(0,Q.jsxs)(`button`,{type:`button`,"data-composer-assist-selected":n?`true`:void 0,className:on(`flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left text-sm`,n?`bg-muted`:`hover:bg-muted/70`),onMouseEnter:()=>{s(t)},onClick:()=>{c(e)},children:[(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`span`,{className:`block truncate font-medium`,children:[`/`,e.name]}),e.description?(0,Q.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.description}):null]}),n?(0,Q.jsx)(Ta,{className:`mt-0.5 shrink-0`}):null]},e.name)})}):null,t[5]=o,t[6]=c,t[7]=a,t[8]=s,t[9]=r,t[10]=u,t[11]=n,t[12]=m):m=t[12];let h;return t[13]===m?h=t[14]:(h=(0,Q.jsx)(`div`,{className:`absolute inset-x-0 bottom-full z-20 mb-2 rounded-lg border bg-popover p-1 shadow-lg ring-1 ring-foreground/10`,children:(0,Q.jsx)(`div`,{ref:l,className:`max-h-64 overflow-y-auto`,children:m})}),t[13]=m,t[14]=h),h}var Nv=Z.createContext(void 0);function Pv(){let e=Z.useContext(Nv);if(e===void 0)throw Error(pt(10));return e}var Fv={value:()=>null},Iv=Z.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,hiddenUntilFound:a,keepMounted:o,loopFocus:c=!0,onValueChange:l,multiple:u=!1,orientation:d=`vertical`,value:f,defaultValue:p,style:m,...h}=e,g=vt(),_=Z.useMemo(()=>{if(f===void 0)return p??[]},[f,p]),v=s(l),y=Z.useRef([]),[b,x]=Sc({controlled:f,default:_,name:`Accordion`,state:`value`}),S=s((e,t)=>{let n=Pe(et);if(!u){let t=b[0]===e?[]:[e];if(v(t,n),n.isCanceled)return;x(t)}else if(t){let t=b.slice();if(t.push(e),v(t,n),n.isCanceled)return;x(t)}else{let t=b.filter(t=>t!==e);if(v(t,n),n.isCanceled)return;x(t)}}),C=Z.useMemo(()=>({value:b,disabled:i,orientation:d}),[b,i,d]),w=Z.useMemo(()=>({accordionItemRefs:y,direction:g,disabled:i,handleValueChange:S,hiddenUntilFound:a??!1,keepMounted:o??!1,loopFocus:c,orientation:d,state:C,value:b}),[g,i,S,a,o,c,d,C,b]),T=We(`div`,e,{state:C,ref:t,props:[{dir:g,role:`region`},h],stateAttributesMapping:Fv});return(0,Q.jsx)(Nv.Provider,{value:w,children:(0,Q.jsx)(Zc,{elementsRef:y,children:T})})});function Lv(e){let{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,a=t!==void 0,[o,c]=Sc({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:l,setMounted:u,transitionStatus:d}=Wt(o,!0,!0),[f,p]=Z.useState(o),[{height:m,width:h},g]=Z.useState({height:void 0,width:void 0}),_=Qt(),[v,y]=Z.useState(),b=v??_,[x,S]=Z.useState(!1),[C,w]=Z.useState(!1),T=Z.useRef(null),E=Z.useRef(null),D=Z.useRef(null),O=Z.useRef(null),k=me(O,!1),A=s(e=>{let t=!o,n=Pe(an,e.nativeEvent);if(r(t,n),n.isCanceled)return;let i=O.current;E.current===`css-animation`&&i!=null&&i.style.removeProperty(`animation-name`),!x&&!C&&(E.current!=null&&E.current!==`css-animation`&&!l&&t&&u(!0),E.current===`css-animation`&&(!f&&t&&p(!0),!l&&t&&u(!0))),c(t),E.current===`none`&&l&&!t&&u(!1)});return Gn(()=>{a&&E.current===`none`&&!o&&u(!1)},[a,o,t,u]),Z.useMemo(()=>({abortControllerRef:T,animationTypeRef:E,disabled:i,handleTrigger:A,height:m,mounted:l,open:o,panelId:b,panelRef:O,runOnceAnimationsFinish:k,setDimensions:g,setHiddenUntilFound:S,setKeepMounted:w,setMounted:u,setOpen:c,setPanelIdState:y,setVisible:p,transitionDimensionRef:D,transitionStatus:d,visible:f,width:h}),[T,E,i,A,m,l,o,b,O,k,g,S,w,u,c,p,D,d,f,h])}var Rv=Z.createContext(void 0);function zv(){let e=Z.useContext(Rv);if(e===void 0)throw Error(pt(15));return e}var Bv=Z.createContext(void 0);function Vv(){let e=Z.useContext(Bv);if(e===void 0)throw Error(pt(9));return e}var Hv=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Jt.startingStyle]=`startingStyle`,e[e.endingStyle=Jt.endingStyle]=`endingStyle`,e}({}),Uv=function(e){return e.panelOpen=`data-panel-open`,e}({}),Wv={[Hv.open]:``},Gv={[Hv.closed]:``},Kv={open(e){return e?{[Uv.panelOpen]:``}:null}},qv={open(e){return e?Wv:Gv}},Jv=function(e){return e.index=`data-index`,e.disabled=`data-disabled`,e.open=`data-open`,e}({}),Yv={...qv,index:e=>Number.isInteger(e)?{[Jv.index]:String(e)}:null,...l,value:()=>null},Xv=Z.forwardRef(function(e,t){let{className:n,disabled:r=!1,onOpenChange:i,render:a,value:o,style:c,...l}=e,{ref:u,index:d}=Hc(),f=ie(t,u),{disabled:p,handleValueChange:m,state:h,value:g}=Pv(),_=Qt(),v=o??_,y=r||p,b=Z.useMemo(()=>{if(!g)return!1;for(let e=0;e<g.length;e+=1)if(g[e]===v)return!0;return!1},[g,v]),x=s((e,t)=>{i?.(e,t),!t.isCanceled&&m(v,e)}),S=Lv({open:b,onOpenChange:x,disabled:y}),C=Z.useMemo(()=>({open:S.open,disabled:S.disabled,hidden:!S.mounted,transitionStatus:S.transitionStatus}),[S.open,S.disabled,S.mounted,S.transitionStatus]),w=Z.useMemo(()=>({...S,onOpenChange:x,state:C}),[S,C,x]),T=Z.useMemo(()=>({...h,index:d,disabled:y,open:b}),[y,d,b,h]),[E,D]=Z.useState(Qt()),O=Z.useMemo(()=>({open:b,state:T,setTriggerId:D,triggerId:E}),[b,T,D,E]),k=We(`div`,e,{state:T,ref:f,props:l,stateAttributesMapping:Yv});return(0,Q.jsx)(Rv.Provider,{value:w,children:(0,Q.jsx)(Bv.Provider,{value:O,children:k})})}),Zv=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=Vv();return We(`h3`,e,{state:o,ref:t,props:a,stateAttributesMapping:Yv})}),Qv=new Set([vs,_s,bs,ys,xs,`End`]);function $v(e){let{current:t}=e,n=[];for(let e=0;e<t.length;e+=1){let r=t[e];if(!Tl(r)){let e=r?.querySelector(`[type="button"], [role="button"]`);e&&!Tl(e)&&n.push(e)}}return n}var ey=Z.forwardRef(function(e,t){let{disabled:n,className:r,id:i,render:a,nativeButton:o=!0,style:s,...c}=e,{panelId:l,open:u,handleTrigger:d,disabled:f}=zv(),{getButtonProps:p,buttonRef:m}=ts({disabled:n??f,focusableWhenDisabled:!0,native:o,composite:!0}),{accordionItemRefs:h,direction:g,loopFocus:_,orientation:v}=Pv(),y=g===`rtl`,b=v===`horizontal`,{state:x,setTriggerId:S,triggerId:C}=Vv();Gn(()=>(i&&S(i),()=>{S(void 0)}),[i,S]);let w=Z.useMemo(()=>({"aria-controls":u?l:void 0,"aria-expanded":u,id:C,tabIndex:0,onClick:d,onKeyDown(e){if(!Qv.has(e.key))return;pn(e);let t=$v(h),n=t.length-1,r=-1,i=t.indexOf(e.currentTarget);function a(){r=_?i+1>n?0:i+1:Math.min(i+1,n)}function o(){r=_&&i===0?n:i-1}switch(e.key){case vs:b||a();break;case _s:b||o();break;case bs:b&&(y?o():a());break;case ys:b&&(y?a():o());break;case`Home`:r=0;break;case`End`:r=n;break;default:break}r>-1&&t[r].focus()}}),[h,d,C,b,y,_,u,l]);return We(`button`,e,{state:x,ref:[t,m],props:[w,c,p],stateAttributesMapping:Kv})}),ty=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e}({});function ny(e){let{abortControllerRef:t,animationTypeRef:n,externalRef:r,height:i,hiddenUntilFound:a,keepMounted:o,id:c,mounted:l,onOpenChange:u,open:d,panelRef:f,runOnceAnimationsFinish:p,setDimensions:m,setMounted:h,setOpen:g,setVisible:_,transitionDimensionRef:v,visible:y,width:b}=e,x=Z.useRef(!1),S=Z.useRef(null),C=Z.useRef(d),w=Z.useRef(d),T=Kt(),E=Z.useMemo(()=>n.current===`css-animation`?!y:!d&&!l,[d,l,y,n]),D=ie(r,f,s(e=>{if(!e)return;if(n.current==null||v.current==null){let t=getComputedStyle(e),r=t.animationName!==`none`&&t.animationName!==``,i=t.transitionDuration!==`0s`&&t.transitionDuration!==``;r&&i||(t.animationName===`none`&&t.transitionDuration!==`0s`?n.current=`css-transition`:t.animationName!==`none`&&t.transitionDuration===`0s`?n.current=`css-animation`:n.current=`none`),e.getAttribute(ty.orientation)===`horizontal`||t.transitionProperty.indexOf(`width`)>-1?v.current=`width`:v.current=`height`}if(n.current!==`css-transition`)return;(i===void 0||b===void 0)&&(m({height:e.scrollHeight,width:e.scrollWidth}),w.current&&e.style.setProperty(`transition-duration`,`0s`));let t=-1,r=-1;return t=fe.request(()=>{w.current=!1,r=fe.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})}),()=>{fe.cancel(t),fe.cancel(r)}}));return Gn(()=>{if(n.current!==`css-transition`)return;let e=f.current;if(!e)return;let r=-1;if(t.current!=null&&(t.current.abort(),t.current=null),d){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)}),!w.current&&!o&&e.setAttribute(Hv.startingStyle,``),m({height:e.scrollHeight,width:e.scrollWidth}),r=fe.request(()=>{Object.entries(t).forEach(([t,n])=>{n===``?e.style.removeProperty(t):e.style.setProperty(t,n)})})}else{if(e.scrollHeight===0&&e.scrollWidth===0)return;m({height:e.scrollHeight,width:e.scrollWidth});let n=new AbortController;t.current=n;let r=n.signal,i=null,a=Hv.endingStyle;return i=new MutationObserver(o=>{o.some(e=>e.type===`attributes`&&e.attributeName===a)&&(i?.disconnect(),i=null,p(()=>{m({height:0,width:0}),e.style.removeProperty(`content-visibility`),h(!1),t.current===n&&(t.current=null)},r))}),i.observe(e,{attributes:!0,attributeFilter:[a]}),()=>{i?.disconnect(),T.cancel(),t.current===n&&(n.abort(),t.current=null)}}return()=>{fe.cancel(r)}},[t,n,T,a,o,l,d,f,p,m,h]),Gn(()=>{if(n.current!==`css-animation`)return;let e=f.current;e&&(S.current=e.style.animationName||S.current,e.style.setProperty(`animation-name`,`none`),m({height:e.scrollHeight,width:e.scrollWidth}),!C.current&&!x.current&&e.style.removeProperty(`animation-name`),d?(t.current!=null&&(t.current.abort(),t.current=null),h(!0),_(!0)):(t.current=new AbortController,p(()=>{h(!1),_(!1),t.current=null},t.current.signal)))},[t,n,d,f,p,m,h,_,y]),Yn(()=>{let e=fe.request(()=>{C.current=!1});return()=>fe.cancel(e)}),Gn(()=>{if(!a)return;let e=f.current;if(!e)return;let t=-1,n=-1;return d&&x.current&&(e.style.transitionDuration=`0s`,m({height:e.scrollHeight,width:e.scrollWidth}),t=fe.request(()=>{x.current=!1,n=fe.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})})),()=>{fe.cancel(t),fe.cancel(n)}},[a,d,f,m]),Gn(()=>{let e=f.current;e&&a&&E&&(e.setAttribute(`hidden`,`until-found`),n.current===`css-transition`&&e.setAttribute(Hv.startingStyle,``))},[a,E,n,f]),Z.useEffect(function(){let e=f.current;if(!e)return;function t(e){x.current=!0,g(!0),u(!0,Pe(et,e))}return ge(e,`beforematch`,t)},[u,f,g]),Z.useMemo(()=>({props:{hidden:E,id:c,ref:D}}),[E,c,D])}var ry=function(e){return e.accordionPanelHeight=`--accordion-panel-height`,e.accordionPanelWidth=`--accordion-panel-width`,e}({}),iy=Z.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,id:a,render:o,style:s,...c}=e,{hiddenUntilFound:l,keepMounted:u}=Pv(),{abortControllerRef:d,animationTypeRef:f,height:p,mounted:m,onOpenChange:h,open:g,panelId:_,panelRef:v,runOnceAnimationsFinish:y,setDimensions:b,setHiddenUntilFound:S,setKeepMounted:C,setMounted:w,setOpen:T,setVisible:E,transitionDimensionRef:D,visible:O,width:k,setPanelIdState:A,transitionStatus:j}=zv(),M=r??l,N=i??u;Gn(()=>{if(a)return A(a),()=>{A(void 0)}},[a,A]),Gn(()=>{S(M)},[S,M]),Gn(()=>{C(N)},[C,N]),x({open:g&&j===`idle`,ref:v,onComplete(){g&&b({width:void 0,height:void 0})}});let{props:P}=ny({abortControllerRef:d,animationTypeRef:f,externalRef:t,height:p,hiddenUntilFound:M,id:a??_,keepMounted:N,mounted:m,onOpenChange:h,open:g,panelRef:v,runOnceAnimationsFinish:y,setDimensions:b,setMounted:w,setOpen:T,setVisible:E,transitionDimensionRef:D,visible:O,width:k}),{state:F,triggerId:I}=Vv(),L=We(`div`,e,{state:Z.useMemo(()=>({...F,transitionStatus:j}),[F,j]),ref:[t,v],props:[P,{"aria-labelledby":I,role:`region`,style:{[ry.accordionPanelHeight]:p===void 0?`auto`:`${p}px`,[ry.accordionPanelWidth]:k===void 0?`auto`:`${k}px`}},c],stateAttributesMapping:Yv});return N||M||m?L:null});function ay(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`flex w-full flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(Iv,{"data-slot":`accordion`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function oy(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=on(`not-last:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(Xv,{"data-slot":`accordion-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function sy(e){let t=(0,$.c)(18),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,headerClassName:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===i?o=t[6]:(o=on(`flex`,i),t[5]=i,t[6]=o);let s;t[7]===r?s=t[8]:(s=on(`group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground`,r),t[7]=r,t[8]=s);let c,l;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(Ea,{"data-slot":`accordion-trigger-icon`,className:`pointer-events-none size-4 shrink-0 group-aria-expanded/accordion-trigger:hidden`}),l=(0,Q.jsx)($e,{"data-slot":`accordion-trigger-icon`,className:`pointer-events-none hidden size-4 shrink-0 group-aria-expanded/accordion-trigger:inline`}),t[9]=c,t[10]=l):(c=t[9],l=t[10]);let u;t[11]!==n||t[12]!==a||t[13]!==s?(u=(0,Q.jsxs)(ey,{"data-slot":`accordion-trigger`,className:s,...a,children:[n,c,l]}),t[11]=n,t[12]=a,t[13]=s,t[14]=u):u=t[14];let d;return t[15]!==o||t[16]!==u?(d=(0,Q.jsx)(Zv,{className:o,children:u}),t[15]=o,t[16]=u,t[17]=d):d=t[17],d}function cy(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=on(`h-(--accordion-panel-height) pt-0 pb-2.5 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,r),t[4]=r,t[5]=a);let o;t[6]!==n||t[7]!==a?(o=(0,Q.jsx)(`div`,{className:a,children:n}),t[6]=n,t[7]=a,t[8]=o):o=t[8];let s;return t[9]!==i||t[10]!==o?(s=(0,Q.jsx)(iy,{"data-slot":`accordion-content`,className:`overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up`,...i,children:o}),t[9]=i,t[10]=o,t[11]=s):s=t[11],s}function ly(e){return[{title:`Steer`,items:e.filter(e=>e.streamingBehavior===`steer`),emptyLabel:`Steer prompts will interrupt the current response.`},{title:`Follow-up`,items:e.filter(e=>e.streamingBehavior!==`steer`),emptyLabel:`Follow-up prompts will run after the current response.`}]}var uy=Z.memo(function(e){let t=(0,$.c)(35),{currentPendingMessages:n,onEditPendingMessage:r,onRemovePendingMessage:i,onReorderPending:a}=e,[o,s]=Z.useState(null),[c,l]=Z.useState(``),[u,d]=Z.useState(null),f;t[0]!==n||t[1]!==o?(f=o?n.find(e=>e.pendingId===o):void 0,t[0]=n,t[1]=o,t[2]=f):f=t[2];let p=f,m,h;if(t[3]!==p||t[4]!==o?(m=()=>{o&&(p||(s(null),l(``),d(null)))},h=[p,o],t[3]=p,t[4]=o,t[5]=m,t[6]=h):(m=t[5],h=t[6]),Z.useEffect(m,h),n.length===0)return null;let g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{s(e.pendingId),l(e.text),d(null)},t[7]=g):g=t[7];let _=g,v;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>{s(null),l(``),d(null)},t[8]=v):v=t[8];let y=v,b;t[9]!==c||t[10]!==r?(b=e=>{if(!c.trim()&&e.images.length===0){d(`Enter a message or keep at least one image.`);return}r(e.pendingId,c),y()},t[9]=c,t[10]=r,t[11]=b):b=t[11];let x=b,S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(`span`,{className:`truncate`,children:`Queue`}),t[12]=S):S=t[12];let C;t[13]===n.length?C=t[14]:(C=(0,Q.jsx)(sy,{className:`min-h-10 items-center gap-3 px-3 py-2 hover:no-underline`,children:(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-sm font-medium`,children:[S,(0,Q.jsx)(Zo,{variant:`outline`,className:`shrink-0`,children:n.length})]})}),t[13]=n.length,t[14]=C);let w;if(t[15]!==n||t[16]!==u||t[17]!==c||t[18]!==o||t[19]!==i||t[20]!==a||t[21]!==x){let e;t[23]!==u||t[24]!==c||t[25]!==o||t[26]!==i||t[27]!==a||t[28]!==x?(e=e=>(0,Q.jsxs)(`section`,{className:`border-border/70 not-first:border-t`,children:[(0,Q.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center justify-between gap-3 bg-card px-3 pt-3 pb-2 text-xs font-medium tracking-wide text-muted-foreground uppercase`,children:[(0,Q.jsx)(`span`,{children:e.title}),(0,Q.jsx)(`span`,{children:e.items.length})]}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-2 px-3 pb-3`,children:e.items.length>0?e.items.map((t,n)=>{let r=t.streamingBehavior===`steer`,s=r&&n===0,f=!r&&n===e.items.length-1;return(0,Q.jsx)(`div`,{className:`rounded-xl border bg-muted/25 p-2.5`,children:o===t.pendingId?(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(lh,{value:c,className:`min-h-20 resize-none text-base md:text-base`,autoFocus:!0,placeholder:t.images.length>0?`Optional text for this image prompt`:`Edit queued message`,"aria-invalid":!!u,onChange:e=>{l(e.target.value),u&&d(null)},onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),x(t)),e.key===`Escape`&&(e.preventDefault(),y())}}),u?(0,Q.jsx)(`div`,{className:`text-xs text-destructive`,children:u}):null,t.images.length>0?(0,Q.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[t.images.length,` image`,t.images.length===1?``:`s`,` `,`kept`]}):null,(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(os,{size:`sm`,onClick:()=>x(t),children:`Save`}),(0,Q.jsx)(os,{size:`sm`,variant:`ghost`,onClick:y,children:`Cancel`})]})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`line-clamp-3 text-sm`,children:t.text||(r?`Steer image prompt`:`Follow-up image prompt`)}),t.images.length>0?(0,Q.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[t.images.length,` image`,t.images.length===1?``:`s`]}):null,(0,Q.jsxs)(`div`,{className:`mt-2 flex items-center gap-1`,children:[(0,Q.jsx)(os,{size:`sm`,variant:`ghost`,disabled:s,title:r?`Move up`:`Move up or promote to steer`,onClick:()=>a(t.pendingId,-1),children:`↑`}),(0,Q.jsx)(os,{size:`sm`,variant:`ghost`,disabled:f,title:r?`Move down or demote to follow-up`:`Move down`,onClick:()=>a(t.pendingId,1),children:`↓`}),(0,Q.jsx)(os,{size:`sm`,variant:`ghost`,onClick:()=>_(t),children:`Edit`}),(0,Q.jsx)(os,{size:`sm`,variant:`ghost`,onClick:()=>i(t.pendingId),children:`Remove`})]})]})},t.pendingId)}):(0,Q.jsx)(`div`,{className:`rounded-md border border-dashed px-3 py-4 text-sm text-muted-foreground`,children:e.emptyLabel})})]},e.title),t[23]=u,t[24]=c,t[25]=o,t[26]=i,t[27]=a,t[28]=x,t[29]=e):e=t[29],w=ly(n).map(e),t[15]=n,t[16]=u,t[17]=c,t[18]=o,t[19]=i,t[20]=a,t[21]=x,t[22]=w}else w=t[22];let T;t[30]===w?T=t[31]:(T=(0,Q.jsx)(cy,{className:`p-0`,children:(0,Q.jsx)(`div`,{className:`max-h-[min(34vh,320px)] overflow-y-auto border-t`,children:w})}),t[30]=w,t[31]=T);let E;return t[32]!==T||t[33]!==C?(E=(0,Q.jsx)(ay,{className:`rounded-2xl border bg-card`,children:(0,Q.jsxs)(oy,{value:`pending-prompts`,className:`border-0`,children:[C,T]})}),t[32]=T,t[33]=C,t[34]=E):E=t[34],E}),dy=Z.createContext(void 0);function fy(e){let t=Z.useContext(dy);if(t===void 0&&!e)throw Error(pt(47));return t}function py(){return{...mt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var my={...Kn,disabled:ue(e=>e.disabled),instantType:ue(e=>e.instantType),openMethod:ue(e=>e.openMethod),openChangeReason:ue(e=>e.openChangeReason),modal:ue(e=>e.modal),focusManagerModal:ue(e=>e.focusManagerModal),stickIfOpen:ue(e=>e.stickIfOpen),titleElementId:ue(e=>e.titleElementId),descriptionElementId:ue(e=>e.descriptionElementId),openOnHover:ue(e=>e.openOnHover),closeDelay:ue(e=>e.closeDelay),hasViewport:ue(e=>e.hasViewport)},hy=class e extends oe{constructor(e){let t={...py(),...e};t.open&&e?.mounted===void 0&&(t.mounted=!0),super(t,{popupRef:Z.createRef(),backdropRef:Z.createRef(),internalBackdropRef:Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),stickIfOpenTimeout:new at,triggerElements:new Oe},my)}setOpen=(e,t)=>{let n=t.reason===kn,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let a=()=>{let n={open:e,openChangeReason:t.reason},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),_l.flushSync(a)):a(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let r=je(()=>new e(n)).current,i=t??r;return Yn(r.disposeEffect),i}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function gy({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=hy.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});De(()=>{n===void 0&&u.state.open===!1&&r===!0&&u.update({open:!0,activeTriggerId:l})}),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a);let{openMethod:p,triggerProps:m}=Xs(d);_(u);let{forceUnmount:h}=Hn(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});Z.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let g=Z.useCallback(e=>{let t=Pe(e);return t.preventUnmountOnClose=()=>{u.set(`preventUnmountingOnClose`,!0)},t},[u]),v=Z.useCallback(()=>{u.setOpen(!1,g(U))},[u,g]);Z.useImperativeHandle(e.actionsRef,()=>({unmount:h,close:v}),[h,v]);let y=Xn({popupStore:u,onOpenChange:u.setOpen}),{getReferenceProps:b,getFloatingProps:x,getTriggerProps:S}=It([ve(y,{outsidePressEvent:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),xa(y)]),C=Z.useMemo(()=>b(m),[b,m]),w=Z.useMemo(()=>S(m),[S,m]),T=Z.useMemo(()=>x(),[x]);u.useSyncedValues({modal:o,openMethod:p,activeTriggerProps:C,inactiveTriggerProps:w,popupProps:T,floatingRootContext:y,nested:er()!=null});let E=Z.useMemo(()=>({store:u}),[u]);return(0,Q.jsx)(dy.Provider,{value:E,children:typeof t==`function`?t({payload:f}):t})}function _y(e){return fy(!0)?(0,Q.jsx)(gy,{props:e}):(0,Q.jsx)(Y,{children:(0,Q.jsx)(gy,{props:e})})}var vy=Z.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,handle:o,payload:s,openOnHover:c=!1,delay:l=300,closeDelay:u=0,id:d,style:f,...p}=e,m=fy(!0),h=o?.store??m?.store;if(!h)throw Error(pt(74));let g=Qt(d),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=Z.useRef(null),{registerTrigger:x,isMountedByThisTrigger:S}=Me(g,b,h,{payload:s,disabled:i,openOnHover:c,closeDelay:u}),w=h.useState(`openChangeReason`),T=h.useState(`stickIfOpen`),E=h.useState(`openMethod`),D=h.useState(`focusManagerModal`),O=Mt(v,{enabled:v!=null&&c&&(E!==`touch`||w!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:nn(),restMs:l,delay:{close:u},triggerElementRef:b,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),k=It([ma(v,{enabled:v!=null,stickIfOpen:T})]),A=h.useState(`triggerProps`,S),j={disabled:i,open:y},{getButtonProps:M,buttonRef:N}=ts({disabled:i,native:a}),P=Z.useMemo(()=>({open(e){return e&&w===`trigger-press`?Ot.open(e):mn.open(e)}}),[w]),F=We(`button`,e,{state:j,ref:[N,t,x,b],props:[k.getReferenceProps(),O,A,{[xn]:``,id:g},p,M],stateAttributesMapping:P}),{preFocusGuardRef:I,handlePreFocusGuardFocus:L,handleFocusTargetFocus:R}=vl(h,b);return _&&!D?(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(C,{ref:I,onFocus:L}),(0,Q.jsx)(Z.Fragment,{children:F},g),(0,Q.jsx)(C,{ref:h.context.triggerFocusTargetRef,onFocus:R})]}):(0,Q.jsx)(Z.Fragment,{children:F},g)}),yy=Z.createContext(void 0);function by(){let e=Z.useContext(yy);if(e===void 0)throw Error(pt(45));return e}var xy=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=fy();return i.useState(`mounted`)||n?(0,Q.jsx)(yy.Provider,{value:n,children:(0,Q.jsx)(L,{ref:t,...r})}):null}),Sy=Z.createContext(void 0);function Cy(){let e=Z.useContext(Sy);if(!e)throw Error(pt(46));return e}var wy=Z.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=lt,style:g,..._}=e,{store:v}=fy(),y=by(),b=we(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=v.useState(`hasViewport`),M=Z.useRef(null),N=me(O,!1,!1),P=un({anchor:i,floatingRootContext:x,positionMethod:a,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:y,nodeId:b,collisionAvoidance:h,adaptiveOrigin:j?En:void 0}),F=x.useState(`domReferenceElement`);Gn(()=>{let e=F,t=M.current;if(e&&(M.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return N(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[F,N,v]);let I={open:C,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:k};nl(C&&E===!0&&w!==`trigger-hover`,D===`touch`,O,T);let L=Z.useCallback(e=>{v.set(`positionerElement`,e)},[v]),R=Bt(e,I,{styles:P.positionerStyles,transitionStatus:A,props:_,refs:[t,L],hidden:!S,inert:!C});return(0,Q.jsxs)(Sy.Provider,{value:P,children:[S&&E===!0&&w!==`trigger-hover`&&(0,Q.jsx)(Ls,{ref:v.context.internalBackdropRef,inert:Ca(!C),cutout:T}),(0,Q.jsx)(V,{id:b,children:R})]})}),Ty=Z.createContext(void 0);function Ey(){let[e,t]=Z.useState(0),n=s(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Z.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function Dy(e){let{value:t,children:n}=e;return(0,Q.jsx)(Ty.Provider,{value:t,children:n})}var Oy={...St,...l},ky=Z.forwardRef(function(e,t){let{className:n,render:r,initialFocus:i,finalFocus:a,style:o,...s}=e,{store:c}=fy(),l=Cy(),u=Gc(!0)!=null,{context:d,hasClosePart:f}=Ey(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),S=c.useState(`mounted`),C=c.useState(`openChangeReason`),w=c.useState(`activeTriggerElement`),T=c.useState(`floatingRootContext`);x({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}});let E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);ot(T,{enabled:D&&!E,closeDelay:O});function k(e){return e===`touch`?c.context.popupRef.current:!0}let A=i===void 0?k:i,j={open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},M=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,M);let N=Z.useCallback(e=>{c.set(`popupElement`,e)},[c]),P=We(`div`,e,{state:j,ref:[t,c.context.popupRef,N],props:[_,{"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&Os.has(e.key)&&e.stopPropagation()}},ut(g),s],stateAttributesMapping:Oy});return(0,Q.jsx)(pa,{context:T,openInteractionType:m,modal:M,disabled:!S||C===`trigger-hover`,initialFocus:A,returnFocus:a,restoreFocus:`popup`,previousFocusableElement:Qn(w)?w:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,Q.jsx)(Dy,{value:d,children:P})})});function Ay(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Q.jsx)(_y,{"data-slot":`popover`,...n}),t[2]=n,t[3]=r),r}function jy(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Q.jsx)(vy,{"data-slot":`popover-trigger`,...n}),t[2]=n,t[3]=r),r}function My(e){let t=(0,$.c)(18),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({className:n,align:i,alignOffset:a,side:o,sideOffset:s,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=i===void 0?`center`:i,l=a===void 0?0:a,u=o===void 0?`bottom`:o,d=s===void 0?4:s,f;t[7]===n?f=t[8]:(f=on(`z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n),t[7]=n,t[8]=f);let p;t[9]!==r||t[10]!==f?(p=(0,Q.jsx)(ky,{"data-slot":`popover-content`,className:f,...r}),t[9]=r,t[10]=f,t[11]=p):p=t[11];let m;return t[12]!==c||t[13]!==l||t[14]!==u||t[15]!==d||t[16]!==p?(m=(0,Q.jsx)(xy,{children:(0,Q.jsx)(wy,{align:c,alignOffset:l,side:u,sideOffset:d,className:`isolate z-50`,children:p})}),t[12]=c,t[13]=l,t[14]=u,t[15]=d,t[16]=p,t[17]=m):m=t[17],m}var Ny=new Intl.NumberFormat(`en-US`),Py=`(hover: none), (pointer: coarse)`,Fy=14,Iy=10.5,Ly=2.2,Ry={1:[{radius:Iy,strokeWidth:3}],2:[{radius:11,strokeWidth:2.6},{radius:7.2,strokeWidth:2.6}],3:[{radius:11.5,strokeWidth:Ly},{radius:8,strokeWidth:Ly},{radius:4.5,strokeWidth:Ly}]};function zy(e){return Ny.format(e)}function By(e){return e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1).replace(/\.0$/,``)}M`:e>=1e3?`${(e/1e3).toFixed(e>=1e5?0:1).replace(/\.0$/,``)}k`:zy(e)}function Vy(e){return String(Math.round(e))}function Hy(){let e=(0,$.c)(2),[t,n]=Z.useState(!1),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(Py),t=()=>n(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),Z.useEffect(r,i),t}function Uy(e){return e>=90?`var(--destructive)`:e>=80?`var(--warning)`:`var(--primary)`}var Wy=new Set([`used`,`tokens`,`usage`,`limit`,`total`,`max`,`percent`,`percentage`,`timeLeft`,`remaining`,`resetAt`,`resetsAt`,`expiresAt`]),Gy=Dv(void 0);function Ky(e){return!!e&&typeof e==`object`}function qy(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Jy(e,t){for(let n of t){let t=qy(e[n]);if(t!=null)return t}return null}function Yy(e,t){for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t}return null}function Xy(e,t){for(let n of t){let t=e[n];if(Ky(t))return t}return null}function Zy(e,t){return t?e:e.filter(e=>!Wy.has(e))}function Qy(e){let t=Math.max(0,Math.ceil(e/6e4)),n=Math.floor(t/60),r=t%60;return n>0&&r>0?`${n}h ${r}m`:n>0?`${n}h`:`${r}m`}function $y(e){if(typeof e==`number`&&Number.isFinite(e))return e<1e10?e*1e3:e;if(typeof e!=`string`||!e.trim())return null;let t=Number(e);if(Number.isFinite(t))return t<1e10?t*1e3:t;let n=new Date(e).getTime();return Number.isNaN(n)?null:n}function eb(e,t,n){let r=Yy(e,t);if(r)return r;let i=n.map(t=>$y(e[t])).find(e=>e!=null);if(i==null)return null;let a=i-Date.now();return a<=0?`0m`:Qy(a)}function tb(e,t,n,r,i,a,o,s){let c=Xy(e,n),l=!!c,u=c??e,d=Jy(u,Zy(r,l)),f=Jy(u,Zy(i,l)),p=Jy(u,Zy(a,l))??(d!=null&&f!=null&&f>0?d/f*100:null),m=eb(u,Zy(o,l),Zy(s,l));return d==null&&f==null&&p==null&&m==null?null:{label:t,used:d,limit:f,percent:p==null?null:Math.max(0,Math.min(100,p)),timeLeft:m}}function nb(e){if(!e?.contextWindow)return;let t=typeof e.tokens==`number`?e.tokens:null,n=typeof e.percent==`number`?e.percent:t!=null&&e.contextWindow>0?t/e.contextWindow*100:null,r=n==null?null:Math.max(0,Math.min(100,n)),i=r==null?null:Math.max(0,Math.min(100,Math.round(r))),a=tb(e,`5h usage`,[`fiveHourUsage`,`fiveHour`,`usage5h`,`5h`,`fiveHourLimit`],[`used`,`tokens`,`usage`,`fiveHourUsed`,`fiveHourTokens`,`usage5h`],[`limit`,`total`,`max`,`fiveHourLimit`,`limit5h`],[`percent`,`percentage`,`fiveHourPercent`,`percent5h`],[`timeLeft`,`remaining`,`fiveHourTimeLeft`,`timeLeft5h`],[`resetAt`,`resetsAt`,`expiresAt`,`fiveHourResetAt`,`resetAt5h`]),o=tb(e,`Weekly usage`,[`weeklyUsage`,`weekly`,`usageWeekly`,`week`,`weeklyLimit`],[`used`,`tokens`,`usage`,`weeklyUsed`,`weeklyTokens`,`usageWeekly`],[`limit`,`total`,`max`,`weeklyLimit`,`limitWeekly`],[`percent`,`percentage`,`weeklyPercent`,`percentWeekly`],[`timeLeft`,`remaining`,`weeklyTimeLeft`,`timeLeftWeekly`],[`resetAt`,`resetsAt`,`expiresAt`,`weeklyResetAt`,`resetAtWeekly`]);return{contextWindow:e.contextWindow,tokens:t,percent:i,roundedPercent:i,fiveHourUsage:a,weeklyUsage:o}}function rb(e,t){return e?.label===t?.label&&e?.used===t?.used&&e?.limit===t?.limit&&e?.percent===t?.percent&&e?.timeLeft===t?.timeLeft}function ib(e,t){return e?.contextWindow===t?.contextWindow&&e?.tokens===t?.tokens&&e?.roundedPercent===t?.roundedPercent&&rb(e?.fiveHourUsage,t?.fiveHourUsage)&&rb(e?.weeklyUsage,t?.weeklyUsage)}function ab(e){let t=(0,$.c)(1),n;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={compare:ib},t[0]=n):n=t[0],Ui(e,nb,n)}function ob(e){return e==null?null:`${Vy(e)}%`}function sb(e){return e==null?null:By(e)}function cb(e){let t=(0,$.c)(5),{percent:n}=e,r=Math.max(0,Math.min(100,n)),i=`${r}%`,a;t[0]===r?a=t[1]:(a=Uy(r),t[0]=r,t[1]=a);let o;return t[2]!==i||t[3]!==a?(o=(0,Q.jsx)(`div`,{className:`mt-2 h-1.5 overflow-hidden rounded-full bg-muted`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full`,style:{width:i,backgroundColor:a}})}),t[2]=i,t[3]=a,t[4]=o):o=t[4],o}function lb(e){let t=(0,$.c)(22),{quota:n}=e,r;t[0]===n.percent?r=t[1]:(r=ob(n.percent),t[0]=n.percent,t[1]=r);let i=r,a;t[2]===n.used?a=t[3]:(a=sb(n.used),t[2]=n.used,t[3]=a);let o=a,s;t[4]===n.limit?s=t[5]:(s=sb(n.limit),t[4]=n.limit,t[5]=s);let c=s,l=o!=null&&c!=null?`${o} / ${c}`:o??c??`Available`,u;t[6]===n.label?u=t[7]:(u=(0,Q.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:n.label}),t[6]=n.label,t[7]=u);let d=i?`${i} `:null,f;t[8]!==d||t[9]!==l?(f=(0,Q.jsxs)(`span`,{className:`font-semibold text-foreground`,children:[d,l]}),t[8]=d,t[9]=l,t[10]=f):f=t[10];let p;t[11]!==u||t[12]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[u,f]}),t[11]=u,t[12]=f,t[13]=p):p=t[13];let m;t[14]===n.percent?m=t[15]:(m=n.percent==null?null:(0,Q.jsx)(cb,{percent:n.percent}),t[14]=n.percent,t[15]=m);let h;t[16]===n.timeLeft?h=t[17]:(h=n.timeLeft?(0,Q.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Resets in `,n.timeLeft]}):null,t[16]=n.timeLeft,t[17]=h);let g;return t[18]!==p||t[19]!==m||t[20]!==h?(g=(0,Q.jsxs)(`div`,{className:`rounded-lg bg-background/70 px-2.5 py-2`,children:[p,m,h]}),t[18]=p,t[19]=m,t[20]=h,t[21]=g):g=t[21],g}function ub(e){let t=(0,$.c)(17),{window:n}=e,r;t[0]===n.usedPercent?r=t[1]:(r=Vy(n.usedPercent),t[0]=n.usedPercent,t[1]=r);let i=`${r}%`,a=n.label===`Week`?`Weekly usage`:`${n.label} usage`,o;t[2]===a?o=t[3]:(o=(0,Q.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:a}),t[2]=a,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(`span`,{className:`font-semibold text-foreground`,children:i}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;t[9]===n.usedPercent?l=t[10]:(l=(0,Q.jsx)(cb,{percent:n.usedPercent}),t[9]=n.usedPercent,t[10]=l);let u;t[11]===n.resetsIn?u=t[12]:(u=n.resetsIn?(0,Q.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Resets in `,n.resetsIn]}):null,t[11]=n.resetsIn,t[12]=u);let d;return t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,Q.jsxs)(`div`,{className:`rounded-lg bg-background/70 px-2.5 py-2`,children:[c,l,u]}),t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function db(e){return Math.max(0,Math.min(100,e))}function fb(e){let t=e.label.trim().toLowerCase().replace(/\s+/g,``);return t===`5h`||t===`5hr`||t.includes(`five`)}function pb(e){let t=e.label.trim().toLowerCase().replace(/\s+/g,``);return t===`week`||t===`weekly`||t===`7d`||t.includes(`seven`)}function mb(e,t,n,r){let i=r.find(fb),a=r.find(pb),o=i?.usedPercent??t?.percent??null,s=a?.usedPercent??n?.percent??null,c=[{key:`context`,label:`Context window`,percent:e==null?null:db(e)}];return o!=null&&c.push({key:`five-hour`,label:i?`${i.label} usage`:t?.label??`5h usage`,percent:db(o)}),s!=null&&c.push({key:`weekly`,label:a?.label===`Week`?`Weekly usage`:a?`${a.label} usage`:n?.label??`Weekly usage`,percent:db(s)}),c.slice(0,3)}function hb(e){return e>=3?Ry[3]:e===2?Ry[2]:Ry[1]}function gb(e){let t=(0,$.c)(80),{contextUsageStore:n,disabled:r,modelProvider:i}=e,a=n===void 0?Gy:n,o=r===void 0?!1:r,s=ab(a),c=Hy(),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=[],t[0]=l):l=t[0];let[u,d]=Z.useState(l),f;t[1]===i?f=t[2]:(f=()=>{if(!i){d([]);return}let e=!1,t=`/api/provider-usage?provider=${encodeURIComponent(i)}`;return fetch(t).then(yb).then(t=>{e||d(Array.isArray(t?.usage?.windows)?t.usage.windows:[])}).catch(()=>{e||d([])}),()=>{e=!0}},t[1]=i,t[2]=f);let p=s?.tokens,m;if(t[3]!==i||t[4]!==p?(m=[i,p],t[3]=i,t[4]=p,t[5]=m):m=t[5],Z.useEffect(f,m),o||!s)return null;let{contextWindow:h,fiveHourUsage:g,percent:_,roundedPercent:v,tokens:y,weeklyUsage:b}=s,x;t[6]===v?x=t[7]:(x=v==null?`Pending`:`${Vy(v)}%`,t[6]=v,t[7]=x);let S=x,C;t[8]===h?C=t[9]:(C=By(h),t[8]=h,t[9]=C);let w=C,T;t[10]===y?T=t[11]:(T=y==null?null:By(y),t[10]=y,t[11]=T);let E=T,D,O,k,j,M,N,P,F,I,L,R,z;if(t[12]!==w||t[13]!==E||t[14]!==S||t[15]!==g||t[16]!==_||t[17]!==u||t[18]!==v||t[19]!==y||t[20]!==b){let e=mb(_,g,b,u),n=hb(e.length),r=e.slice(1).map(vb).join(` `),i=`${v==null?`Context window. Usage estimate pending. ${w} token window.`:y==null?`Context window. ${S} used. ${w} tokens available.`:`Context window. ${S} used. ${E} / ${w} tokens used.`}${r?` ${r}`:``}`;D=os,F=`button`,I=`ghost`,L=`icon`,R=`relative ml-auto shrink-0`,z=i,O=`pointer-events-none absolute top-1/2 left-1/2 size-7 -translate-x-1/2 -translate-y-1/2`,k=`0 0 28 28`,j=`none`,M=`true`,N=e.map((e,t)=>{let r=n[t];return r?(0,Q.jsx)(`circle`,{cx:Fy,cy:Fy,r:r.radius,stroke:`var(--border)`,strokeWidth:r.strokeWidth,strokeOpacity:`0.75`,vectorEffect:`non-scaling-stroke`},`${e.key}-track`):null}),P=e.map((e,t)=>{let r=n[t];return!r||e.percent==null?null:(0,Q.jsx)(`circle`,{cx:Fy,cy:Fy,r:r.radius,pathLength:100,stroke:Uy(e.percent),strokeWidth:r.strokeWidth,strokeDasharray:`${e.percent.toFixed(1)} 100`,strokeLinecap:`round`,vectorEffect:`non-scaling-stroke`,className:`origin-center -rotate-90`},e.key)}),t[12]=w,t[13]=E,t[14]=S,t[15]=g,t[16]=_,t[17]=u,t[18]=v,t[19]=y,t[20]=b,t[21]=D,t[22]=O,t[23]=k,t[24]=j,t[25]=M,t[26]=N,t[27]=P,t[28]=F,t[29]=I,t[30]=L,t[31]=R,t[32]=z}else D=t[21],O=t[22],k=t[23],j=t[24],M=t[25],N=t[26],P=t[27],F=t[28],I=t[29],L=t[30],R=t[31],z=t[32];let B;t[33]!==O||t[34]!==k||t[35]!==j||t[36]!==M||t[37]!==N||t[38]!==P?(B=(0,Q.jsxs)(`svg`,{className:O,viewBox:k,fill:j,"aria-hidden":M,children:[N,P]}),t[33]=O,t[34]=k,t[35]=j,t[36]=M,t[37]=N,t[38]=P,t[39]=B):B=t[39];let V;t[40]!==D||t[41]!==F||t[42]!==I||t[43]!==L||t[44]!==R||t[45]!==z||t[46]!==B?(V=(0,Q.jsx)(D,{type:F,variant:I,size:L,className:R,"aria-label":z,children:B}),t[40]=D,t[41]=F,t[42]=I,t[43]=L,t[44]=R,t[45]=z,t[46]=B,t[47]=V):V=t[47];let H=V,U;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Context window`}),t[48]=U):U=t[48];let W;t[49]===S?W=t[50]:(W=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[U,(0,Q.jsx)(`span`,{className:`font-semibold text-foreground`,children:S})]}),t[49]=S,t[50]=W);let ee;t[51]===_?ee=t[52]:(ee=_==null?null:(0,Q.jsx)(cb,{percent:_}),t[51]=_,t[52]=ee);let te=E==null?`Usage estimate pending · ${w} token window`:`${E} / ${w} tokens used`,K;t[53]===te?K=t[54]:(K=(0,Q.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:te}),t[53]=te,t[54]=K);let q;t[55]!==W||t[56]!==ee||t[57]!==K?(q=(0,Q.jsxs)(`div`,{className:`rounded-lg bg-background/70 px-2.5 py-2`,children:[W,ee,K]}),t[55]=W,t[56]=ee,t[57]=K,t[58]=q):q=t[58];let J;t[59]!==g||t[60]!==u||t[61]!==b?(J=u.length>0?u.map(_b):(0,Q.jsxs)(Q.Fragment,{children:[g?(0,Q.jsx)(lb,{quota:g}):null,b?(0,Q.jsx)(lb,{quota:b}):null]}),t[59]=g,t[60]=u,t[61]=b,t[62]=J):J=t[62];let ne;t[63]!==q||t[64]!==J?(ne=(0,Q.jsxs)(Q.Fragment,{children:[q,J]}),t[63]=q,t[64]=J,t[65]=ne):ne=t[65];let Y=ne;if(c){let e;t[66]===H?e=t[67]:(e=(0,Q.jsx)(jy,{render:H}),t[66]=H,t[67]=e);let n;t[68]===Y?n=t[69]:(n=(0,Q.jsx)(My,{side:`top`,align:`end`,sideOffset:8,className:`w-72 max-w-none items-stretch gap-2 rounded-xl bg-secondary px-3 py-3 text-sm text-secondary-foreground`,children:Y}),t[68]=Y,t[69]=n);let r;return t[70]!==e||t[71]!==n?(r=(0,Q.jsxs)(Ay,{children:[e,n]}),t[70]=e,t[71]=n,t[72]=r):r=t[72],r}let re;t[73]===H?re=t[74]:(re=(0,Q.jsx)(G,{render:H}),t[73]=H,t[74]=re);let ie;t[75]===Y?ie=t[76]:(ie=(0,Q.jsx)(A,{side:`top`,align:`end`,sideOffset:8,className:`w-72 max-w-none flex-col items-stretch gap-2 rounded-xl px-3 py-3 text-sm`,children:Y}),t[75]=Y,t[76]=ie);let ae;return t[77]!==re||t[78]!==ie?(ae=(0,Q.jsxs)(Ve,{children:[re,ie]}),t[77]=re,t[78]=ie,t[79]=ae):ae=t[79],ae}function _b(e){return(0,Q.jsx)(ub,{window:e},e.label)}function vb(e){return e.percent==null?`${e.label}. Usage estimate unavailable.`:`${e.label}. ${Vy(e.percent)}% used.`}function yb(e){return e.ok?e.json():void 0}function bb(e){switch(e){case`off`:return`Off`;case`minimal`:return`Minimal`;case`low`:return`Low`;case`medium`:return`Medium`;case`high`:return`High`;case`xhigh`:return`Extra High`;default:return e}}function xb(e){return e?`${e.provider}/${e.id}`:``}function Sb(e,t){return e.model===t.model&&e.availableModels===t.availableModels}function Cb(e,t){return e.thinkingLevel===t.thinkingLevel&&e.availableThinkingLevels===t.availableThinkingLevels}function wb(e){let t=(0,$.c)(1),n;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={compare:Sb},t[0]=n):n=t[0],Ui(e,Tb,n)}function Tb(e){return{availableModels:e.availableModels,model:e.model}}function Eb(e){let t=(0,$.c)(1),n;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={compare:Cb},t[0]=n):n=t[0],Ui(e,Db,n)}function Db(e){return{availableThinkingLevels:e.availableThinkingLevels,thinkingLevel:e.thinkingLevel}}var Ob=Z.memo(function({disabled:e,modelQuery:t,onModelQueryChange:n,onOpenChange:r,onSelectModel:i,open:a,sessionStore:o}){let{availableModels:s,model:c}=wb(o),l=(()=>{let e=t.trim().toLowerCase(),n=[...s.length>0?s:c?[c]:[]].sort((e,t)=>(e.provider||``).localeCompare(t.provider||``)||(e.name||e.id).localeCompare(t.name||t.id));return e?n.filter(t=>`${t.provider||``} ${t.name||``} ${t.id}`.toLowerCase().includes(e)):n})(),u=(()=>{let e=new Map;for(let t of l){let n=t.provider||`Models`,r=e.get(n)??[];r.push(t),e.set(n,r)}return[...e.entries()]})(),d=c?.name||`Select model`;return(0,Q.jsxs)(Ay,{open:!e&&a,onOpenChange:r,children:[(0,Q.jsx)(Ne,{title:`Model`,kbd:Qg(`Control+M`),children:(0,Q.jsxs)(jy,{render:(0,Q.jsx)(os,{variant:`ghost`,className:`max-w-full`,disabled:e}),children:[(0,Q.jsx)(`span`,{className:`truncate`,children:d}),(0,Q.jsx)(Ea,{"data-icon":`inline-end`})]})}),(0,Q.jsx)(My,{className:`w-88 p-0`,side:`top`,align:`start`,children:(0,Q.jsxs)(mh,{shouldFilter:!1,children:[(0,Q.jsx)(gh,{value:t,onValueChange:n,placeholder:`Search models`}),(0,Q.jsxs)(_h,{children:[(0,Q.jsx)(vh,{children:`No models match your search.`}),u.map(([t,n])=>(0,Q.jsx)(yh,{heading:t,children:n.map(t=>{let n=`${t.provider}/${t.id}`,a=n===xb(c);return(0,Q.jsxs)(bh,{value:`${t.provider||``} ${t.name||t.id} ${t.id}`,onSelect:()=>{e||(i(n),r(!1))},children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`truncate font-medium`,children:t.name||t.id}),(0,Q.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[t.provider,`/`,t.id]})]}),a?(0,Q.jsx)(Ta,{}):null]},n)})},t))]})]})})]})}),kb=Z.memo(function(e){let t=(0,$.c)(4),{contextUsageStore:n,disabled:r,sessionStore:i}=e,a=Ui(i,Mb),o;return t[0]!==n||t[1]!==r||t[2]!==a?(o=(0,Q.jsx)(gb,{contextUsageStore:n,disabled:r,modelProvider:a}),t[0]=n,t[1]=r,t[2]=a,t[3]=o):o=t[3],o}),Ab=Z.memo(function(e){let t=(0,$.c)(30),{disabled:n,onOpenChange:r,onSelectThinkingLevel:i,open:a,sessionStore:o}=e,{availableThinkingLevels:s,thinkingLevel:c}=Eb(o),l;t[0]===c?l=t[1]:(l=bb(c),t[0]=c,t[1]=l);let u=l,d=!n&&a,f,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=Qg(`Control+R`),p=Qg(`Control+Shift+R`),t[2]=f,t[3]=p):(f=t[2],p=t[3]);let m;t[4]===n?m=t[5]:(m=(0,Q.jsx)(os,{variant:`ghost`,className:`max-w-full`,disabled:n}),t[4]=n,t[5]=m);let h;t[6]===u?h=t[7]:(h=(0,Q.jsx)(`span`,{className:`truncate`,children:u}),t[6]=u,t[7]=h);let g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(Ea,{"data-icon":`inline-end`}),t[8]=g):g=t[8];let _;t[9]!==m||t[10]!==h?(_=(0,Q.jsx)(Ne,{title:`Reasoning`,kbd:`${f} / ${p}`,children:(0,Q.jsxs)(jy,{render:m,children:[h,g]})}),t[9]=m,t[10]=h,t[11]=_):_=t[11];let v;if(t[12]!==s||t[13]!==n||t[14]!==r||t[15]!==i||t[16]!==c){let e;t[18]!==n||t[19]!==r||t[20]!==i||t[21]!==c?(e=e=>(0,Q.jsxs)(bh,{value:e,onSelect:()=>{n||(i(e),r(!1))},children:[(0,Q.jsx)(`span`,{className:`flex-1`,children:bb(e)}),c===e?(0,Q.jsx)(Ta,{}):null]},e),t[18]=n,t[19]=r,t[20]=i,t[21]=c,t[22]=e):e=t[22],v=s.map(e),t[12]=s,t[13]=n,t[14]=r,t[15]=i,t[16]=c,t[17]=v}else v=t[17];let y;t[23]===v?y=t[24]:(y=(0,Q.jsx)(My,{className:`w-64 p-0`,side:`top`,align:`start`,children:(0,Q.jsx)(mh,{children:(0,Q.jsx)(_h,{children:(0,Q.jsx)(yh,{heading:`Reasoning`,children:v})})})}),t[23]=v,t[24]=y);let b;return t[25]!==r||t[26]!==y||t[27]!==d||t[28]!==_?(b=(0,Q.jsxs)(Ay,{open:d,onOpenChange:r,children:[_,y]}),t[25]=r,t[26]=y,t[27]=d,t[28]=_,t[29]=b):b=t[29],b}),jb=Z.memo(function(e){let t=(0,$.c)(30),{modelPickerOpen:n,onModelPickerOpenChange:r,thinkingPickerOpen:i,onThinkingPickerOpenChange:a,modelQuery:o,onModelQueryChange:s,contextUsageStore:c,sessionStore:l,disabled:u,onSelectModel:d,onSelectThinkingLevel:f}=e,p=u===void 0?!1:u,m;t[0]!==p||t[1]!==r?(m=e=>{p&&e||r(e)},t[0]=p,t[1]=r,t[2]=m):m=t[2];let h=m,g;t[3]!==p||t[4]!==a?(g=e=>{p&&e||a(e)},t[3]=p,t[4]=a,t[5]=g):g=t[5];let _=g,v;t[6]!==p||t[7]!==h||t[8]!==n||t[9]!==o||t[10]!==s||t[11]!==d||t[12]!==l?(v=(0,Q.jsx)(Ob,{disabled:p,modelQuery:o,onModelQueryChange:s,onOpenChange:h,onSelectModel:d,open:n,sessionStore:l}),t[6]=p,t[7]=h,t[8]=n,t[9]=o,t[10]=s,t[11]=d,t[12]=l,t[13]=v):v=t[13];let y;t[14]!==p||t[15]!==_||t[16]!==f||t[17]!==l||t[18]!==i?(y=(0,Q.jsx)(Ab,{disabled:p,onOpenChange:_,onSelectThinkingLevel:f,open:i,sessionStore:l}),t[14]=p,t[15]=_,t[16]=f,t[17]=l,t[18]=i,t[19]=y):y=t[19];let b;t[20]!==v||t[21]!==y?(b=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[v,y]}),t[20]=v,t[21]=y,t[22]=b):b=t[22];let x;t[23]!==c||t[24]!==p||t[25]!==l?(x=(0,Q.jsx)(kb,{contextUsageStore:c,disabled:p,sessionStore:l}),t[23]=c,t[24]=p,t[25]=l,t[26]=x):x=t[26];let S;return t[27]!==b||t[28]!==x?(S=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-b-[18px] bg-muted/15 p-1.5`,children:[b,x]}),t[27]=b,t[28]=x,t[29]=S):S=t[29],S});function Mb(e){return e.model?.provider}var Nb=new Set([` `,` `,`
|
|
49
49
|
`,`"`,`'`,`=`]);function Pb(e=``){let t=typeof e==`string`?e:``,n=t.match(/^\/skill:([^\s]+)(?:\s+([\s\S]*))?$/);return n?{matched:!0,skillName:n[1]||void 0,text:n[2]||``}:{matched:!1,skillName:void 0,text:t}}function Fb({text:e=``,skillName:t}){let n=typeof e==`string`?e:``,r=typeof t==`string`?t.trim():``;return r?n?`/skill:${r} ${n}`:`/skill:${r}`:n}function Ib(e=``){return e.split(/[-_]+/).filter(Boolean).map(e=>e.length<=3?e.toUpperCase():`${e.charAt(0).toUpperCase()}${e.slice(1)}`).join(` `)}function Lb(e=``){let t=typeof e==`string`?e:``,n=t.trimStart();if(!n.startsWith(`/`))return null;let r=n.slice(1),i=r.search(/\s/);return{rawValue:t,trimmedStart:n,name:i>=0?r.slice(0,i):r,args:i>=0?r.slice(i).trim():``,hasArguments:i>=0}}function Rb(e=``){return String(e).toLowerCase().replace(/[^a-z0-9]+/g,``)}function zb(e,t){if(!e)return!0;let n=0;for(let r of t)if(r===e[n]&&(n+=1,n>=e.length))return!0;return!1}function Bb(e){let t=[e.name,e.description||``];return e.kind===`skill`&&t.push(e.skillName||``,`skill${e.skillName||``}`,`skills ${e.skillName||``}`,Ib(e.skillName||``)),t.filter(Boolean)}function Vb(e,t){let n=typeof t==`string`?t.trim().toLowerCase():``;if(!n)return e.kind===`builtin`?0:10;let r=Rb(n),i=1/0;for(let t of Bb(e)){let e=String(t).toLowerCase(),a=Rb(e);if(e===n){i=Math.min(i,0);continue}if(e.startsWith(n)){i=Math.min(i,1);continue}if(r&&a.startsWith(r)){i=Math.min(i,2);continue}if(e.includes(n)){i=Math.min(i,3);continue}if(r&&a.includes(r)){i=Math.min(i,4);continue}r&&zb(r,a)&&(i=Math.min(i,5))}return Number.isFinite(i)?i+(e.kind===`builtin`?0:.1):1/0}function Hb(e,t){return e.map(e=>({command:e,rank:Vb(e,t)})).filter(e=>Number.isFinite(e.rank)).sort((e,t)=>e.rank-t.rank||e.command.name.localeCompare(t.command.name)).map(e=>e.command)}function Ub(e=``){for(let t=e.length-1;t>=0;--t)if(Nb.has(e[t]||``))return t;return-1}function Wb(e=``,t=0){for(let n=Math.max(0,t);n<e.length;n+=1)if(Nb.has(e[n]||``))return n;return e.length}function Gb(e=``){let t=!1,n=-1;for(let r=0;r<e.length;r+=1)e[r]===`"`&&(t=!t,t&&(n=r));return t?n:null}function Kb(e=``,t=0){return t===0||Nb.has(e[t-1]||``)}function qb(e=``){let t=Gb(e);return t===null?null:t>0&&e[t-1]===`@`?Kb(e,t-1)?e.slice(t-1):null:Kb(e,t)?e.slice(t):null}function Jb(e=``){let t=qb(e);if(t?.startsWith(`@"`))return t;let n=Ub(e),r=n===-1?0:n+1;return e[r]===`@`?e.slice(r):null}function Yb(e=``){return e.startsWith(`@"`)?{rawPrefix:e.slice(2),isQuotedPrefix:!0}:e.startsWith(`@`)?{rawPrefix:e.slice(1),isQuotedPrefix:!1}:{rawPrefix:e,isQuotedPrefix:!1}}function Xb(e=``,t=0){let n=e.lastIndexOf(`
|
|
50
|
-
`,Math.max(0,t-1));return e.slice(n+1,t)}function Zb({value:e,selectionStart:t,selectionEnd:n,force:r=!1}){if(t!==n)return null;let i=Xb(e,t).trimStart();if(i.startsWith(`/`)&&!i.includes(` `))return null;let a=e.slice(0,t),o=qb(a);if(o&&!o.startsWith(`@`)){let r=t-o.length,i=e.slice(t).indexOf(`"`),a=i>=0?t+i+1:t;return{kind:`path`,value:e,selectionStart:t,selectionEnd:n,start:r,end:a,prefix:o,rawPrefix:o.slice(1),isQuotedPrefix:!0,token:e.slice(r,a)}}let s=Ub(a)+1,c=Wb(e,t),l=e.slice(s,t);return!r&&!(l.includes(`/`)||l.startsWith(`.`)||l.startsWith(`~`))?null:{kind:`path`,value:e,selectionStart:t,selectionEnd:n,start:s,end:c,prefix:l,rawPrefix:l,isQuotedPrefix:!1,token:e.slice(s,c)}}function Qb({value:e,selectionStart:t,selectionEnd:n}){if(t!==n)return null;let r=Jb(e.slice(0,t));if(!r)return null;let i=t-r.length,a=e.slice(t),o=r.startsWith(`@"`)?(()=>{let e=a.indexOf(`"`);return e>=0?t+e+1:t})():Wb(e,t),s=Yb(r);return{kind:`file-reference`,value:e,selectionStart:t,selectionEnd:n,start:i,end:o,prefix:r,rawPrefix:s.rawPrefix,isQuotedPrefix:s.isQuotedPrefix,token:e.slice(i,o)}}function $b(e,t){return!e||!t?!1:e.kind===t.kind&&e.start===t.start&&e.end===t.end&&e.prefix===t.prefix}function ex(e,t){let n=e.value.replace(/\\/g,`/`);return!(t.isQuotedPrefix||n.includes(` `))||n.startsWith(`"`)?n:`"${n}"`}function tx({value:e,query:t,item:n}){let r=e.slice(0,t.start),i=e.slice(t.end),a=t.kind===`path`?ex(n,t):n.value,o=t.kind===`file-reference`&&!n.isDirectory?` `:``,s=`${r}${a}${o}${i}`,c=a.endsWith(`"`),l=n.isDirectory&&c?a.length-1:a.length,u=r.length+l+o.length;return{value:s,selectionStart:u,selectionEnd:u}}var nx={position:`absolute`,top:0,bottom:0,textAlign:`center`},rx={display:`contents`};function ix(){return null}var ax=`diffs-container`,ox=/(?=^From [a-f0-9]+ .+$)/m,sx=/(?=^diff --git)/gm,cx=/(?=^---\s+\S)/gm,lx=/(?=^@@ )/gm,ux=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,dx=/(?<=\n)/,fx=/^(---|\+\+\+)\s+([^\t\r\n]+)/,px=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,mx=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,hx=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,gx=`header-prefix`,_x=`header-metadata`,vx=`header-custom`,yx={dark:`pierre-dark`,light:`pierre-light`},bx=`data-theme-css`,xx=`data-unsafe-css`,Sx={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,hunkSeparatorHeight:32,fileGap:8},Cx=Object.freeze({fromStart:0,fromEnd:0}),wx={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Tx={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function Ex(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function Dx(e,t){return typeof window>`u`&&t!=null?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,Q.jsx)(Q.Fragment,{children:e})}var Ox=(0,Z.createContext)(void 0);function kx(){return(0,Z.useContext)(Ox)}var Ax=new Map,jx=new Map,Mx=new Map,Nx=new Set;function Px(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=Ax.get(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,Ax.has(n)||Ax.set(n,e);Nx.has(n)||(Nx.add(n),t.loadThemeSync(e))}}var Fx=new Map,Ix=new Map,Lx=new Map,Rx=new Set;function zx(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(Rx.has(n.name))continue;let e=Fx.get(n.name);e??(e=n,Fx.set(n.name,e)),Rx.add(e.name),t.loadLanguageSync(e.data)}}function Bx(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var Vx=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Hx(e){return Ux(e)}function Ux(e){return Array.isArray(e)?Wx(e):e instanceof RegExp?e:typeof e==`object`?Gx(e):e}function Wx(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Ux(e[n]);return t}function Gx(e){let t={};for(let n in e)t[n]=Ux(e[n]);return t}function Kx(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function qx(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?qx(e.substring(0,e.length-1)):e.substr(~t+1)}var Jx=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Yx=class{static hasCaptures(e){return e===null?!1:(Jx.lastIndex=0,Jx.test(e))}static replaceCaptures(e,t,n){return e.replace(Jx,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function Xx(e,t){return e<t?-1:+(e>t)}function Zx(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=Xx(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function Qx(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function $x(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var eS=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},tS=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(oS(e),t)}static createFromParsedTheme(e,t){return lS(e,t)}_cachedMatchRoot=new eS(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>rS(e.parent,t.parentScopes));return n?new aS(n.fontStyle,n.foreground,n.background):null}},nS=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function rS(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!iS(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function iS(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var aS=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function oS(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8;break}}let s=null;typeof i.settings.foreground==`string`&&Qx(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&Qx(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new sS(l,u,e,o,s,c)}}return n}var sS=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},cS=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(cS||{});function lS(e,t){e.sort((e,t)=>{let n=Xx(e.scope,t.scope);return n!==0||(n=Zx(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new uS(t),o=new aS(n,a.getId(r),a.getId(i)),s=new pS(new fS(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new tS(a,o,s)}var uS=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},dS=Object.freeze([]),fS=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||dS,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},pS=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),fS.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(Zx(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new fS(e,t,n,r,i))}},mS=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!=0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=gS(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function hS(e){return e}function gS(e){return e}function _S(e,t){let n=[],r=yS(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(vS(i)){let e=[];do e.push(i),i=r.next();while(vS(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function vS(e){return!!e&&!!e.match(/[\w\.:]+/)}function yS(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function bS(e){typeof e.dispose==`function`&&e.dispose()}var xS=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},SS=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},CS=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},wS=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new xS(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new CS;for(let n of e)TS(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof xS){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function TS(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof xS?DS({baseGrammar:a,selfGrammar:i},r):ES(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new xS(e))}function ES(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];OS([r],t,n)}}function DS(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&OS(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&OS(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function OS(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?Kx({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&OS(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=PS(i);switch(a.kind){case 0:DS({...t,selfGrammar:t.baseGrammar},n);break;case 1:DS(t,n);break;case 2:ES(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?ES(a.ruleName,i,n):DS(i,n)}else a.kind===4?n.add(new SS(a.scopeName,a.ruleName)):n.add(new xS(a.scopeName));break}}}var kS=class{kind=0},AS=class{kind=1},jS=class{constructor(e){this.ruleName=e}kind=2},MS=class{constructor(e){this.scopeName=e}kind=3},NS=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function PS(e){if(e===`$base`)return new kS;if(e===`$self`)return new AS;let t=e.indexOf(`#`);return t===-1?new MS(e):t===0?new jS(e.substring(1)):new NS(e.substring(0,t),e.substring(t+1))}var FS=/\\(\d+)/,IS=/\\(\d+)/g,LS=-1,RS=-2;function zS(e){return e}function BS(e){return e}var VS=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=Yx.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Yx.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${qx(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:Yx.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Yx.replaceCaptures(this._contentName,e,t)}},HS=class extends VS{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},US=class extends VS{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new JS(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new YS,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},WS=class extends VS{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new YS,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},GS=class extends VS{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new JS(i,this.id),this.beginCaptures=a,this._end=new JS(o||``,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new YS;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},KS=class extends VS{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new JS(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new JS(o,RS),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new YS;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new YS,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||``),this._cachedCompiledWhilePatterns}},qS=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new HS(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new US(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=Kx({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new WS(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new KS(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new GS(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=PS(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l)if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository);break}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof WS||e instanceof GS||e instanceof KS)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},JS=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,typeof this.source==`string`?this.hasBackReferences=FS.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return IS.lastIndex=0,this.source.replace(IS,(e,t)=>$x(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=``,t[i+1]=``,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=``,t[i+1]=`G`,n[i+1]=``,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},YS=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new XS(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new XS(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},XS=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
|
|
50
|
+
`,Math.max(0,t-1));return e.slice(n+1,t)}function Zb({value:e,selectionStart:t,selectionEnd:n,force:r=!1}){if(t!==n)return null;let i=Xb(e,t).trimStart();if(i.startsWith(`/`)&&!i.includes(` `))return null;let a=e.slice(0,t),o=qb(a);if(o&&!o.startsWith(`@`)){let i=o.slice(1);if(!r&&!i)return null;let a=t-o.length,s=e.slice(t).indexOf(`"`),c=s>=0?t+s+1:t;return{kind:`path`,value:e,selectionStart:t,selectionEnd:n,start:a,end:c,prefix:o,rawPrefix:i,isQuotedPrefix:!0,token:e.slice(a,c)}}let s=Ub(a)+1,c=Wb(e,t),l=e.slice(s,t);return!r&&!(l.includes(`/`)||l.startsWith(`.`)||l.startsWith(`~`))?null:{kind:`path`,value:e,selectionStart:t,selectionEnd:n,start:s,end:c,prefix:l,rawPrefix:l,isQuotedPrefix:!1,token:e.slice(s,c)}}function Qb({value:e,selectionStart:t,selectionEnd:n}){if(t!==n)return null;let r=Jb(e.slice(0,t));if(!r)return null;let i=t-r.length,a=e.slice(t),o=r.startsWith(`@"`)?(()=>{let e=a.indexOf(`"`);return e>=0?t+e+1:t})():Wb(e,t),s=Yb(r);return{kind:`file-reference`,value:e,selectionStart:t,selectionEnd:n,start:i,end:o,prefix:r,rawPrefix:s.rawPrefix,isQuotedPrefix:s.isQuotedPrefix,token:e.slice(i,o)}}function $b(e,t){return!e||!t?!1:e.kind===t.kind&&e.start===t.start&&e.end===t.end&&e.prefix===t.prefix}function ex(e,t){let n=e.value.replace(/\\/g,`/`);return!(t.isQuotedPrefix||n.includes(` `))||n.startsWith(`"`)?n:`"${n}"`}function tx({value:e,query:t,item:n}){let r=e.slice(0,t.start),i=e.slice(t.end),a=t.kind===`path`?ex(n,t):n.value,o=t.kind===`file-reference`&&!n.isDirectory?` `:``,s=`${r}${a}${o}${i}`,c=a.endsWith(`"`),l=n.isDirectory&&c?a.length-1:a.length,u=r.length+l+o.length;return{value:s,selectionStart:u,selectionEnd:u}}var nx={position:`absolute`,top:0,bottom:0,textAlign:`center`},rx={display:`contents`};function ix(){return null}var ax=`diffs-container`,ox=/(?=^From [a-f0-9]+ .+$)/m,sx=/(?=^diff --git)/gm,cx=/(?=^---\s+\S)/gm,lx=/(?=^@@ )/gm,ux=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,dx=/(?<=\n)/,fx=/^(---|\+\+\+)\s+([^\t\r\n]+)/,px=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,mx=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,hx=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,gx=`header-prefix`,_x=`header-metadata`,vx=`header-custom`,yx={dark:`pierre-dark`,light:`pierre-light`},bx=`data-theme-css`,xx=`data-unsafe-css`,Sx={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,hunkSeparatorHeight:32,fileGap:8},Cx=Object.freeze({fromStart:0,fromEnd:0}),wx={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Tx={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function Ex(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function Dx(e,t){return typeof window>`u`&&t!=null?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,Q.jsx)(Q.Fragment,{children:e})}var Ox=(0,Z.createContext)(void 0);function kx(){return(0,Z.useContext)(Ox)}var Ax=new Map,jx=new Map,Mx=new Map,Nx=new Set;function Px(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=Ax.get(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,Ax.has(n)||Ax.set(n,e);Nx.has(n)||(Nx.add(n),t.loadThemeSync(e))}}var Fx=new Map,Ix=new Map,Lx=new Map,Rx=new Set;function zx(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(Rx.has(n.name))continue;let e=Fx.get(n.name);e??(e=n,Fx.set(n.name,e)),Rx.add(e.name),t.loadLanguageSync(e.data)}}function Bx(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var Vx=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Hx(e){return Ux(e)}function Ux(e){return Array.isArray(e)?Wx(e):e instanceof RegExp?e:typeof e==`object`?Gx(e):e}function Wx(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Ux(e[n]);return t}function Gx(e){let t={};for(let n in e)t[n]=Ux(e[n]);return t}function Kx(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function qx(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?qx(e.substring(0,e.length-1)):e.substr(~t+1)}var Jx=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Yx=class{static hasCaptures(e){return e===null?!1:(Jx.lastIndex=0,Jx.test(e))}static replaceCaptures(e,t,n){return e.replace(Jx,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function Xx(e,t){return e<t?-1:+(e>t)}function Zx(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=Xx(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function Qx(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function $x(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var eS=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},tS=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(oS(e),t)}static createFromParsedTheme(e,t){return lS(e,t)}_cachedMatchRoot=new eS(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>rS(e.parent,t.parentScopes));return n?new aS(n.fontStyle,n.foreground,n.background):null}},nS=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function rS(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!iS(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function iS(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var aS=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function oS(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8;break}}let s=null;typeof i.settings.foreground==`string`&&Qx(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&Qx(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new sS(l,u,e,o,s,c)}}return n}var sS=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},cS=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(cS||{});function lS(e,t){e.sort((e,t)=>{let n=Xx(e.scope,t.scope);return n!==0||(n=Zx(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new uS(t),o=new aS(n,a.getId(r),a.getId(i)),s=new pS(new fS(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new tS(a,o,s)}var uS=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},dS=Object.freeze([]),fS=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||dS,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},pS=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),fS.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(Zx(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new fS(e,t,n,r,i))}},mS=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!=0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=gS(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function hS(e){return e}function gS(e){return e}function _S(e,t){let n=[],r=yS(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(vS(i)){let e=[];do e.push(i),i=r.next();while(vS(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function vS(e){return!!e&&!!e.match(/[\w\.:]+/)}function yS(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function bS(e){typeof e.dispose==`function`&&e.dispose()}var xS=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},SS=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},CS=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},wS=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new xS(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new CS;for(let n of e)TS(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof xS){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function TS(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof xS?DS({baseGrammar:a,selfGrammar:i},r):ES(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new xS(e))}function ES(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];OS([r],t,n)}}function DS(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&OS(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&OS(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function OS(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?Kx({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&OS(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=PS(i);switch(a.kind){case 0:DS({...t,selfGrammar:t.baseGrammar},n);break;case 1:DS(t,n);break;case 2:ES(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?ES(a.ruleName,i,n):DS(i,n)}else a.kind===4?n.add(new SS(a.scopeName,a.ruleName)):n.add(new xS(a.scopeName));break}}}var kS=class{kind=0},AS=class{kind=1},jS=class{constructor(e){this.ruleName=e}kind=2},MS=class{constructor(e){this.scopeName=e}kind=3},NS=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function PS(e){if(e===`$base`)return new kS;if(e===`$self`)return new AS;let t=e.indexOf(`#`);return t===-1?new MS(e):t===0?new jS(e.substring(1)):new NS(e.substring(0,t),e.substring(t+1))}var FS=/\\(\d+)/,IS=/\\(\d+)/g,LS=-1,RS=-2;function zS(e){return e}function BS(e){return e}var VS=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=Yx.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Yx.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${qx(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:Yx.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Yx.replaceCaptures(this._contentName,e,t)}},HS=class extends VS{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},US=class extends VS{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new JS(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new YS,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},WS=class extends VS{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new YS,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},GS=class extends VS{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new JS(i,this.id),this.beginCaptures=a,this._end=new JS(o||``,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new YS;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},KS=class extends VS{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new JS(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new JS(o,RS),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new YS;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new YS,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||``),this._cachedCompiledWhilePatterns}},qS=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new HS(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new US(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=Kx({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new WS(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new KS(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new GS(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=PS(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l)if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository);break}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof WS||e instanceof GS||e instanceof KS)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},JS=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,typeof this.source==`string`?this.hasBackReferences=FS.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return IS.lastIndex=0,this.source.replace(IS,(e,t)=>$x(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=``,t[i+1]=``,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=``,t[i+1]=`G`,n[i+1]=``,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},YS=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new XS(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new XS(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},XS=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
|
|
51
51
|
`)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},ZS=class{constructor(e,t){this.languageId=e,this.tokenType=t}},QS=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new ZS(e,8),this._embeddedLanguagesMatcher=new $S(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new ZS(0,0);_getBasicScopeAttributes=new eS(e=>new ZS(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},$S=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>$x(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var eC=!1,tC=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function nC(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=rC(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new tC(i,!0);f()}return new tC(i,!1);function f(){let o=iC(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===LS){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),uC(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof GS){let r=o;uC(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof KS){let r=o;uC(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(uC(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function rC(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof KS&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=cC(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==RS){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),uC(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function iC(e,t,n,r,i,a){let o=aC(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=oC(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function aC(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=sC(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function oC(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=sC(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function sC(e,t,n,r,i){return eC?{ruleScanner:e.compile(t,n),findOptions:lC(r,i)}:{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function cC(e,t,n,r,i){return eC?{ruleScanner:e.compileWhile(t,n),findOptions:lC(r,i)}:{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function lC(e,t){let n=0;return e||(n|=1),t||(n|=4),n}function uC(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let t=0;t<c;t++){let c=a[t];if(c===null)continue;let d=o[t];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?i.produceFromScopes(l[l.length-1].scopes,d.start):i.produce(r,d.start),c.retokenizeCapturedWithRuleId){let t=c.getName(s,o),a=r.contentNameScopesList.pushAttributed(t,e),l=c.getContentName(s,o),u=a.pushAttributed(l,e),f=r.push(c.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,u),p=e.createOnigString(s.substring(0,d.end));nC(e,p,n&&d.start===0,d.start,f,i,!1,0),bS(p);continue}let f=c.getName(s,o);if(f!==null){let t=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);l.push(new dC(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var dC=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function fC(e,t,n,r,i,a,o,s){return new gC(e,t,n,r,i,a,o,s)}function pC(e,t,n,r,i){let a=_S(t,mC),o=qS.getCompiledRuleId(n,r,i.repository);for(let n of a)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:i,priority:n.priority})}function mC(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(hC(t[r],e))return n=r+1,!0;return!1})}function hC(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]===`.`}var gC=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new QS(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=_C(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=_S(e,mC);for(let n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:i[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let e=r.injections;if(e)for(let n in e)pC(t,n,e[n],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(e=>{let n=this.getExternalGrammar(e);if(n){let e=n.injectionSelector;e&&pC(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(zS(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[BS(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=_C(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=qS.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===yC.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=mS.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?vC.createRootAndLookUpScopeName(a,r,this):vC.createRoot(`unknown`,r),t=new yC(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
|
|
52
52
|
`;let a=this.createOnigString(e),o=a.content.length,s=new xC(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=nC(this,a,i,0,t,s,!0,r);return bS(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function _C(e,t){return e=Hx(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var vC=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=nS.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new nS(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new nS(null,t),o=r.themeProvider.themeMatch(a);return new e(null,a,e.mergeAttributes(n,i,o))}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(!0)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),mS.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a);return new e(t,a,e.mergeAttributes(t.tokenAttributes,i,o))}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},yC=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t===null?!1:e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?vC.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:BS(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=vC.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,zS(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,vC.fromExtension(r,n.contentNameScopesList))}},bC=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):_S(e,mC).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>_S(e,mC).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},xC=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=mS.set(n,0,hS(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=mS.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},SC=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,fC(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},CC=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new SC(tS.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(tS.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new bC(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new wS(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},wC=yC.NULL,TC=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],EC=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};EC.prototype.normal={},EC.prototype.property={},EC.prototype.space=void 0;function DC(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new EC(n,r,t)}function OC(e){return e.toLowerCase()}var kC=class{constructor(e,t){this.attribute=t,this.property=e}};kC.prototype.attribute=``,kC.prototype.booleanish=!1,kC.prototype.boolean=!1,kC.prototype.commaOrSpaceSeparated=!1,kC.prototype.commaSeparated=!1,kC.prototype.defined=!1,kC.prototype.mustUseProperty=!1,kC.prototype.number=!1,kC.prototype.overloadedBoolean=!1,kC.prototype.property=``,kC.prototype.spaceSeparated=!1,kC.prototype.space=void 0;var AC=e({boolean:()=>MC,booleanish:()=>NC,commaOrSpaceSeparated:()=>RC,commaSeparated:()=>LC,number:()=>FC,overloadedBoolean:()=>PC,spaceSeparated:()=>IC}),jC=0,MC=zC(),NC=zC(),PC=zC(),FC=zC(),IC=zC(),LC=zC(),RC=zC();function zC(){return 2**++jC}var BC=Object.keys(AC),VC=class extends kC{constructor(e,t,n,r){let i=-1;if(super(e,t),HC(this,`space`,r),typeof n==`number`)for(;++i<BC.length;){let e=BC[i];HC(this,BC[i],(n&AC[e])===AC[e])}}};VC.prototype.defined=!0;function HC(e,t,n){n&&(e[t]=n)}function UC(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new VC(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[OC(r)]=r,n[OC(a.attribute)]=r}return new EC(t,n,e.space)}var WC=UC({properties:{ariaActiveDescendant:null,ariaAtomic:NC,ariaAutoComplete:null,ariaBusy:NC,ariaChecked:NC,ariaColCount:FC,ariaColIndex:FC,ariaColSpan:FC,ariaControls:IC,ariaCurrent:null,ariaDescribedBy:IC,ariaDetails:null,ariaDisabled:NC,ariaDropEffect:IC,ariaErrorMessage:null,ariaExpanded:NC,ariaFlowTo:IC,ariaGrabbed:NC,ariaHasPopup:null,ariaHidden:NC,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:IC,ariaLevel:FC,ariaLive:null,ariaModal:NC,ariaMultiLine:NC,ariaMultiSelectable:NC,ariaOrientation:null,ariaOwns:IC,ariaPlaceholder:null,ariaPosInSet:FC,ariaPressed:NC,ariaReadOnly:NC,ariaRelevant:null,ariaRequired:NC,ariaRoleDescription:IC,ariaRowCount:FC,ariaRowIndex:FC,ariaRowSpan:FC,ariaSelected:NC,ariaSetSize:FC,ariaSort:null,ariaValueMax:FC,ariaValueMin:FC,ariaValueNow:FC,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function GC(e,t){return t in e?e[t]:t}function KC(e,t){return GC(e,t.toLowerCase())}var qC=UC({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:LC,acceptCharset:IC,accessKey:IC,action:null,allow:null,allowFullScreen:MC,allowPaymentRequest:MC,allowUserMedia:MC,alt:null,as:null,async:MC,autoCapitalize:null,autoComplete:IC,autoFocus:MC,autoPlay:MC,blocking:IC,capture:null,charSet:null,checked:MC,cite:null,className:IC,cols:FC,colSpan:null,content:null,contentEditable:NC,controls:MC,controlsList:IC,coords:FC|LC,crossOrigin:null,data:null,dateTime:null,decoding:null,default:MC,defer:MC,dir:null,dirName:null,disabled:MC,download:PC,draggable:NC,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:MC,formTarget:null,headers:IC,height:FC,hidden:PC,high:FC,href:null,hrefLang:null,htmlFor:IC,httpEquiv:IC,id:null,imageSizes:null,imageSrcSet:null,inert:MC,inputMode:null,integrity:null,is:null,isMap:MC,itemId:null,itemProp:IC,itemRef:IC,itemScope:MC,itemType:IC,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:MC,low:FC,manifest:null,max:null,maxLength:FC,media:null,method:null,min:null,minLength:FC,multiple:MC,muted:MC,name:null,nonce:null,noModule:MC,noValidate:MC,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:MC,optimum:FC,pattern:null,ping:IC,placeholder:null,playsInline:MC,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:MC,referrerPolicy:null,rel:IC,required:MC,reversed:MC,rows:FC,rowSpan:FC,sandbox:IC,scope:null,scoped:MC,seamless:MC,selected:MC,shadowRootClonable:MC,shadowRootDelegatesFocus:MC,shadowRootMode:null,shape:null,size:FC,sizes:null,slot:null,span:FC,spellCheck:NC,src:null,srcDoc:null,srcLang:null,srcSet:null,start:FC,step:null,style:null,tabIndex:FC,target:null,title:null,translate:null,type:null,typeMustMatch:MC,useMap:null,value:NC,width:FC,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:IC,axis:null,background:null,bgColor:null,border:FC,borderColor:null,bottomMargin:FC,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:MC,declare:MC,event:null,face:null,frame:null,frameBorder:null,hSpace:FC,leftMargin:FC,link:null,longDesc:null,lowSrc:null,marginHeight:FC,marginWidth:FC,noResize:MC,noHref:MC,noShade:MC,noWrap:MC,object:null,profile:null,prompt:null,rev:null,rightMargin:FC,rules:null,scheme:null,scrolling:NC,standby:null,summary:null,text:null,topMargin:FC,valueType:null,version:null,vAlign:null,vLink:null,vSpace:FC,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:MC,disableRemotePlayback:MC,prefix:null,property:null,results:FC,security:null,unselectable:null},space:`html`,transform:KC}),JC=UC({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:RC,accentHeight:FC,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:FC,amplitude:FC,arabicForm:null,ascent:FC,attributeName:null,attributeType:null,azimuth:FC,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:FC,by:null,calcMode:null,capHeight:FC,className:IC,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:FC,diffuseConstant:FC,direction:null,display:null,dur:null,divisor:FC,dominantBaseline:null,download:MC,dx:null,dy:null,edgeMode:null,editable:null,elevation:FC,enableBackground:null,end:null,event:null,exponent:FC,externalResourcesRequired:null,fill:null,fillOpacity:FC,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:LC,g2:LC,glyphName:LC,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:FC,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:FC,horizOriginX:FC,horizOriginY:FC,id:null,ideographic:FC,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:FC,k:FC,k1:FC,k2:FC,k3:FC,k4:FC,kernelMatrix:RC,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:FC,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:FC,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:FC,overlineThickness:FC,paintOrder:null,panose1:null,path:null,pathLength:FC,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:IC,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:FC,pointsAtY:FC,pointsAtZ:FC,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:RC,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:RC,rev:RC,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:RC,requiredFeatures:RC,requiredFonts:RC,requiredFormats:RC,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:FC,specularExponent:FC,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:FC,strikethroughThickness:FC,string:null,stroke:null,strokeDashArray:RC,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:FC,strokeOpacity:FC,strokeWidth:null,style:null,surfaceScale:FC,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:RC,tabIndex:FC,tableValues:null,target:null,targetX:FC,targetY:FC,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:RC,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:FC,underlineThickness:FC,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:FC,values:null,vAlphabetic:FC,vMathematical:FC,vectorEffect:null,vHanging:FC,vIdeographic:FC,version:null,vertAdvY:FC,vertOriginX:FC,vertOriginY:FC,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:FC,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:GC}),YC=UC({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),XC=UC({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:KC}),ZC=UC({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),QC={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},$C=/[A-Z]/g,ew=/-[a-z]/g,tw=/^data[-\w.:]+$/i;function nw(e,t){let n=OC(t),r=t,i=kC;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&tw.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(ew,iw);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!ew.test(e)){let n=e.replace($C,rw);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=VC}return new i(r,t)}function rw(e){return`-`+e.toLowerCase()}function iw(e){return e.charAt(1).toUpperCase()}var aw=DC([WC,qC,YC,XC,ZC],`html`),ow=DC([WC,JC,YC,XC,ZC],`svg`),sw={}.hasOwnProperty;function cw(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&sw.call(t,e)){let n=String(t[e]);i=sw.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var lw=/["&'<>`]/g,uw=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,dw=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,fw=/[|\\{}()[\]^$+*?.]/g,pw=new WeakMap;function mw(e,t){if(e=e.replace(t.subset?hw(t.subset):lw,r),t.subset||t.escapeOnly)return e;return e.replace(uw,n).replace(dw,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function hw(e){let t=pw.get(e);return t||(t=gw(e),pw.set(e,t)),t}function gw(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(fw,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var _w=/[\dA-Fa-f]/;function vw(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!_w.test(String.fromCharCode(t))?r:r+`;`}var yw=/\d/;function bw(e,t,n){let r=`&#`+String(e);return n&&t&&!yw.test(String.fromCharCode(t))?r:r+`;`}var xw=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),Sw={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:``,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:``,zwj:``,lrm:``,rlm:``,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},Cw=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],ww={}.hasOwnProperty,Tw={},Ew;for(Ew in Sw)ww.call(Sw,Ew)&&(Tw[Sw[Ew]]=Ew);var Dw=/[^\dA-Za-z]/;function Ow(e,t,n,r){let i=String.fromCharCode(e);if(ww.call(Tw,i)){let e=Tw[i],a=`&`+e;return n&&xw.includes(e)&&!Cw.includes(e)&&(!r||t&&t!==61&&Dw.test(String.fromCharCode(t)))?a:a+`;`}return``}function kw(e,t,n){let r=vw(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=Ow(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=bw(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function Aw(e,t){return mw(e,Object.assign({format:kw},t))}var jw=/^>|^->|<!--|-->|--!>|<!-$/g,Mw=[`>`],Nw=[`<`,`>`];function Pw(e,t,n,r){return r.settings.bogusComments?`<?`+Aw(e.value,Object.assign({},r.settings.characterReferences,{subset:Mw}))+`>`:`<!--`+e.value.replace(jw,i)+`-->`;function i(e){return Aw(e,Object.assign({},r.settings.characterReferences,{subset:Nw}))}}function Fw(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function Iw(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Lw(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function Rw(e){return e.join(` `).trim()}var zw=/[ \t\n\f\r]/g;function Bw(e){return typeof e==`object`?e.type===`text`?Vw(e.value):!1:Vw(e)}function Vw(e){return e.replace(zw,``)===``}var Hw=Gw(1),Uw=Gw(-1),Ww=[];function Gw(e){return t;function t(t,n,r){let i=t?t.children:Ww,a=(n||0)+e,o=i[a];if(!r)for(;o&&Bw(o);)a+=e,o=i[a];return o}}var Kw={}.hasOwnProperty;function qw(e){return t;function t(t,n,r){return Kw.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var Jw=qw({body:Zw,caption:Yw,colgroup:Yw,dd:tT,dt:eT,head:Yw,html:Xw,li:$w,optgroup:zee,option:rT,p:Qw,rp:nT,rt:nT,tbody:aT,td:cT,tfoot:oT,th:cT,thead:iT,tr:sT});function Yw(e,t,n){let r=Hw(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&Bw(r.value.charAt(0)))}function Xw(e,t,n){let r=Hw(n,t);return!r||r.type!==`comment`}function Zw(e,t,n){let r=Hw(n,t);return!r||r.type!==`comment`}function Qw(e,t,n){let r=Hw(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||!(n.type===`element`&&(n.tagName===`a`||n.tagName===`audio`||n.tagName===`del`||n.tagName===`ins`||n.tagName===`map`||n.tagName===`noscript`||n.tagName===`video`))}function $w(e,t,n){let r=Hw(n,t);return!r||r.type===`element`&&r.tagName===`li`}function eT(e,t,n){let r=Hw(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function tT(e,t,n){let r=Hw(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function nT(e,t,n){let r=Hw(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function zee(e,t,n){let r=Hw(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function rT(e,t,n){let r=Hw(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function iT(e,t,n){let r=Hw(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function aT(e,t,n){let r=Hw(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function oT(e,t,n){return!Hw(n,t)}function sT(e,t,n){let r=Hw(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function cT(e,t,n){let r=Hw(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var lT=qw({body:fT,colgroup:pT,head:dT,html:uT,tbody:mT});function uT(e){let t=Hw(e,-1);return!t||t.type!==`comment`}function dT(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function fT(e){let t=Hw(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&Bw(t.value.charAt(0)))&&!(t.type===`element`&&(t.tagName===`meta`||t.tagName===`link`||t.tagName===`script`||t.tagName===`style`||t.tagName===`template`))}function pT(e,t,n){let r=Uw(n,t),i=Hw(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&Jw(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function mT(e,t,n){let r=Uw(n,t),i=Hw(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&Jw(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var hT={name:[[`
|
|
53
53
|
\f\r &/=>`.split(``),`
|